@memoarchitect/architect 0.6.6 → 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 +26 -4
- package/dist/assets/AiWorkspace-Bu9TlIWg.js +7 -0
- package/dist/assets/AnalysisWorkspace-CodmoI-v.js +39 -0
- package/dist/assets/{ComplianceWizard-k98NZ2ec.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-B9V_n7kg.js → DhfDashboard-w-dJoJHU.js} +1 -1
- package/dist/assets/{DhfWorkbench-TOnZkdUU.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-CyMm-tSP.js → ImportView-D8svP04Q.js} +1 -1
- package/dist/assets/{LayerGrid-DNPZYTsD.js → LayerGrid-DEe0Ryz-.js} +1 -1
- package/dist/assets/{LayerTable-DhOq1DHo.js → LayerTable-CN_b2rDr.js} +2 -2
- package/dist/assets/{MaxGraphCanvas-DqKU1PTY.js → MaxGraphCanvas-bo8oPBct.js} +6 -6
- package/dist/assets/{ModelDiff-BbqIoesG.js → ModelDiff-xe95oVua.js} +1 -1
- package/dist/assets/OntologyDecompositionDiagram-BL9R8bdB.js +1 -0
- package/dist/assets/{OntologyViewer-BIpJC66j.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-DKoExM8K.js → ReviewDashboard-DeTge2oC.js} +1 -1
- package/dist/assets/ScenarioEditor-FAEYTHgP.js +3 -0
- package/dist/assets/{StatisticsDashboard-B8BduIDz.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-7--f9OH2.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/package.json +11 -5
- package/dist/assets/AiWorkspace-DS79vBOT.js +0 -3
- package/dist/assets/AnalysisWorkspace-D_u4shRY.js +0 -39
- package/dist/assets/DSMView-DGheBwZ0.js +0 -1
- package/dist/assets/Dashboard-BRUQvUFK.js +0 -1
- package/dist/assets/DhfSettingsPanel-B8aLsWn6.js +0 -1
- package/dist/assets/DiagramCanvas-B9d4aLKt.js +0 -1
- package/dist/assets/DiagramEditor-CJ7OG2IC.js +0 -4
- package/dist/assets/ElementDetailView-CDcm1rvf.js +0 -2
- package/dist/assets/OntologyDecompositionDiagram-DkxTe2C_.js +0 -1
- package/dist/assets/ScenarioEditor-JQ3huCnz.js +0 -3
- package/dist/assets/TabularView-BXfFSluC.js +0 -1
- package/dist/assets/TraceabilityMatrix-CHZHFucA.js +0 -1
- package/dist/assets/index-CVW92JY7.js +0 -3280
- package/dist/assets/index-Y1UZTZg-.css +0 -1
- package/dist/assets/layout-selection-ClQ295Xc.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
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 T}from"./reactflow-CsCqNKB-.js";import{a as p}from"./zustand-CrhqMOHB.js";/* empty css */import{r as I}from"./layout-providers-Dr743WlP.js";import{f as L,u as h,K as P,M,N as z}from"./index-CVW92JY7.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 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 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(T,{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,3 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./reactflow-CsCqNKB-.js";import{a as x}from"./zustand-CrhqMOHB.js";import{u as A,h as he,i as fe,C as f,F as C,f as E,E as O,j as Z,r as ge,D as ye}from"./index-CVW92JY7.js";function je(d){const r=d.diagramType.toLowerCase(),b=["afd","ofd","ffd"].includes(r)?ge(d):r;return ye[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 ke({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 be(d){return d.map((r,b)=>`${b+1}. ${r.text}`).join(`
|
|
3
|
-
`)}function Ne({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),[M,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 L=g.map(s=>n[s]).filter(s=>!!s),$=s=>!D||s.name.toLowerCase().includes(D.toLowerCase())||s.kind.toLowerCase().includes(D.toLowerCase());return L.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=be(i);fe({...p,doc:t}),F(null)},[p,i]),V=x.useCallback(()=>{if(!M.trim())return;const t=[...i||k,{index:k.length,text:M.trim()}];F(t),P("")},[M,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(ke,{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=je(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:L=>L.currentTarget.style.background="#F0F0ED",onMouseLeave:L=>L.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:{fontSize:"32px",marginBottom:"8px",opacity:.5},children:"▶"}),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:M,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{Ne as ScenarioEditor};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./reactflow-CsCqNKB-.js";import{a as u}from"./zustand-CrhqMOHB.js";import{u as w,F as j,e as D,f as T}from"./index-CVW92JY7.js";function R({element:r}){var f;const i=!!((f=r.doc)!=null&&f.trim()),d=Object.keys(r.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:r,sortKey:i,sortDir:d}){return r!==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 r=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]=u.useState("name"),[f,C]=u.useState("asc"),[E,B]=u.useState(""),[g,I]=u.useState(""),[b,M]=u.useState(""),h=u.useMemo(()=>{var o,s,n,c,l;if(!r)return[];const e=Object.values(r.elements);if(i.type==="tabular"&&i.diagramId){const a=(o=r.diagrams)==null?void 0:o.find(x=>x.id===i.diagramId);if((s=a==null?void 0:a.elementIds)!=null&&s.length){const x=new Set(a.elementIds);return e.filter(m=>x.has(m.id))}}if(d){const a=(n=r.viewpoints)==null?void 0:n.find(x=>x.id===d);if(a){const x=(c=a.visibleLayers)!=null&&c.length?new Set(a.visibleLayers):null,m=(l=a.visibleKinds)!=null&&l.length?new Set(a.visibleKinds):null;return e.filter(F=>(!x||x.has(F.layer))&&(!m||m.has(F.kind)))}}return e},[r,i,d]),k=u.useMemo(()=>{const e=new Map;for(const s of h)for(const n of Object.keys(s.attributes))e.set(n,(e.get(n)??0)+1);const o=Math.max(1,h.length*.1);return[...e.entries()].filter(([,s])=>s>=o).sort((s,n)=>n[1]-s[1]).slice(0,4).map(([s])=>s)},[h]),O=u.useMemo(()=>[...new Set(h.map(e=>e.layer))].sort(),[h]),V=u.useMemo(()=>[...new Set(h.map(e=>e.kind))].sort(),[h]),N=u.useMemo(()=>{const e=E.toLowerCase();let o=h.filter(s=>!(e&&!s.name.toLowerCase().includes(e)&&!s.kind.toLowerCase().includes(e)||g&&s.layer!==g||b&&s.kind!==b));return o.sort((s,n)=>{let c="",l="";if(p==="name")c=s.name,l=n.name;else if(p==="kind")c=s.kind,l=n.kind;else if(p==="layer")c=s.layer,l=n.layer;else if(p==="status"){const x=m=>{var L;const F=!!((L=m.doc)!=null&&L.trim()),z=Object.keys(m.attributes).length>=1;return F&&z?2:F||z?1:0};c=String(x(s)),l=String(x(n))}else c=s.attributes[p]??"",l=n.attributes[p]??"";const a=c.localeCompare(l,void 0,{numeric:!0});return f==="asc"?a:-a}),o},[h,E,g,b,p,f]);function K(e){p===e?C(o=>o==="asc"?"desc":"asc"):(A(e),C("asc"))}const W=u.useMemo(()=>{var e,o;if(!r)return"";if(i.type==="tabular"&&i.diagramId){const s=(e=r.diagrams)==null?void 0:e.find(n=>n.id===i.diagramId);return s?`Diagram: ${s.name}`:"Diagram"}if(d){const s=(o=r.viewpoints)==null?void 0:o.find(n=>n.id===d);return s?`Viewpoint: ${s.label}`:"Viewpoint"}return"All Elements"},[r,i,d]),y=({col:e,label:o,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:[o,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:g,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:D[e]??e},e))]}),t.jsxs("select",{value:b,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:"doc",label:"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||g||b?"No elements match the current filters":"No elements in scope"})}),N.map(e=>{var c;const o=e.id===v,s=T[e.layer]??"#9CA3AF",n=((c=e.doc)==null?void 0:c.trim().slice(0,100))??"";return t.jsxs("tr",{onClick:()=>S(e.id),className:"cursor-pointer",style:{background:o?"#2DD4A812":"transparent",borderBottom:"1px solid #F0F0ED"},onMouseEnter:l=>{o||(l.currentTarget.style.background="#F7F7F5")},onMouseLeave:l=>{o||(l.currentTarget.style.background="transparent")},children:[t.jsx("td",{className:"px-2",children:o&&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:D[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:n})}),k.map(l=>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[l]??""})},l))]},e.id)})]})]})})]})}export{P as TabularView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./reactflow-CsCqNKB-.js";import{a as p}from"./zustand-CrhqMOHB.js";import{u as j,f as w}from"./index-CVW92JY7.js";const F=[{id:"risk-control",label:"ISO 14971: Risk → Control",description:"Hazards and hazardous situations traced to risk controls",rowKinds:["Hazard","HazardousSituation"],colKinds:["RiskControlMeasure","SafetyGoal"],relationshipTypes:["mitigates","traceTo","causes","leadsTo"]},{id:"req-test",label:"IEC 62304: Requirement → Test",description:"Software requirements traced to verification tests",rowKinds:["Requirement","Requirement","Requirement"],colKinds:["Test"],relationshipTypes:["verify","satisfy","traceTo"]},{id:"req-function",label:"Requirement → Function",description:"Requirements traced to system/component functions",rowKinds:["Requirement","Requirement","Requirement"],colKinds:["Function","Function"],relationshipTypes:["satisfy","traceTo","allocateTo"]},{id:"function-component",label:"Function → Component",description:"Functions allocated to logical/physical components",rowKinds:["Function","Function"],colKinds:["System","Subsystem","Component","LogicalComponent","SoftwareComponent","PhysicalComponent"],relationshipTypes:["allocateTo","traceTo","composedOf"]},{id:"all",label:"All Elements",description:"Full N×N matrix of all elements and relationships",rowKinds:[],colKinds:[],relationshipTypes:[]}];function N({cell:n,onClick:m}){if(!n||n.rels.length===0)return s.jsx("td",{className:"border",style:{borderColor:"#E5E5E0",width:"28px",height:"28px"}});const u=[...new Set(n.rels.map(f=>f.type))],h=n.rels.length>1?"#2DD4A830":"#2DD4A818";return s.jsx("td",{className:"border text-center cursor-pointer",style:{borderColor:"#E5E5E0",background:h,width:"28px",height:"28px"},title:u.join(", "),onClick:m,children:s.jsx("span",{className:"text-xs font-semibold",style:{color:"#1B3A4B",fontSize:"10px"},children:n.rels.length})})}function K(){const n=j(e=>e.model),m=j(e=>e.selectElement),[u,h]=p.useState("risk-control"),[f,g]=p.useState(null),[v,E]=p.useState(null),d=F.find(e=>e.id===u)||F[0],{rows:c,cols:x,matrix:y}=p.useMemo(()=>{if(!n)return{rows:[],cols:[],matrix:new Map};const e=Object.values(n.elements);let i,r;if(d.rowKinds.length===0&&d.colKinds.length===0)i=e,r=e;else{const t=new Set(d.rowKinds),o=new Set(d.colKinds);i=e.filter(l=>t.has(l.kind)),r=e.filter(l=>o.has(l.kind))}i.sort((t,o)=>t.kind.localeCompare(o.kind)||t.name.localeCompare(o.name)),r.sort((t,o)=>t.kind.localeCompare(o.kind)||t.name.localeCompare(o.name));const a=new Map,k=d.relationshipTypes.length>0?new Set(d.relationshipTypes):null,C=new Set(i.map(t=>t.id)),S=new Set(r.map(t=>t.id));for(const t of n.relationships)if(!(k&&!k.has(t.type))){if(C.has(t.sourceId)&&S.has(t.targetId)){const o=`${t.sourceId}:${t.targetId}`,l=a.get(o);l?l.rels.push(t):a.set(o,{rels:[t]})}if(C.has(t.targetId)&&S.has(t.sourceId)){const o=`${t.targetId}:${t.sourceId}`,l=a.get(o);l?l.rels.push(t):a.set(o,{rels:[t]})}}return{rows:i,cols:r,matrix:a}},[n,d]),b=p.useMemo(()=>{const e=new Set;for(const[i]of y){const r=i.split(":")[0];e.add(r)}return e.size},[y]);return n?s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:"#FAFAF8"},children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2",style:{borderBottom:"1px solid #E5E5E0",background:"#FFFFFF"},children:[s.jsx("span",{className:"text-xs font-medium",style:{color:"#6B7280"},children:"Preset:"}),F.map(e=>s.jsx("button",{onClick:()=>h(e.id),className:"px-2 py-1 text-xs rounded-md transition-colors",style:u===e.id?{background:"#2DD4A818",color:"#1B3A4B",fontWeight:600}:{color:"#6B7280"},title:e.description,children:e.label},e.id)),s.jsx("div",{className:"flex-1"}),s.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:[c.length," rows × ",x.length," cols · ",b,"/",c.length," traced (",c.length>0?Math.round(b/c.length*100):0,"%)"]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:c.length===0||x.length===0?s.jsx("div",{className:"flex items-center justify-center h-full text-xs",style:{color:"#9CA3AF"},children:"No elements match the selected preset. Try a different preset or add more model elements."}):s.jsxs("table",{className:"border-collapse text-xs",style:{borderColor:"#E5E5E0"},children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"border px-2 py-1 sticky left-0 z-10",style:{borderColor:"#E5E5E0",background:"#FFFFFF",minWidth:"140px"}}),x.map(e=>(w[e.layer],s.jsx("th",{className:"border px-1 py-1",style:{borderColor:"#E5E5E0",background:v===e.id?"#F0F0ED":"#FFFFFF",writingMode:"vertical-rl",textOrientation:"mixed",maxWidth:"28px",fontSize:"10px",color:"#374151",cursor:"pointer"},onMouseEnter:()=>E(e.id),onMouseLeave:()=>E(null),onClick:()=>m(e.id),title:`${e.name} (${e.kind})`,children:s.jsx("span",{className:"truncate",style:{maxHeight:"100px",display:"block",overflow:"hidden"},children:e.name})},e.id)))]})}),s.jsx("tbody",{children:c.map(e=>{const i=w[e.layer]||"#6B7280";return s.jsxs("tr",{children:[s.jsx("td",{className:"border px-2 py-1 sticky left-0 z-10 cursor-pointer truncate",style:{borderColor:"#E5E5E0",background:f===e.id?"#F0F0ED":"#FFFFFF",maxWidth:"180px",fontSize:"11px",color:"#374151",borderLeft:`3px solid ${i}`},onMouseEnter:()=>g(e.id),onMouseLeave:()=>g(null),onClick:()=>m(e.id),title:`${e.name} (${e.kind})`,children:e.name}),x.map(r=>{const a=y.get(`${e.id}:${r.id}`)||null;return s.jsx(N,{cell:a,onClick:a?()=>m(e.id):void 0},r.id)})]},e.id)})})]})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"#9CA3AF"},children:"No model loaded"})}export{K as TraceabilityMatrix};
|