@memoarchitect/architect 0.7.2 → 0.8.27
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 +1 -1
- package/dist/assets/{AiWorkspace-Bu9TlIWg.js → AiWorkspace-Dp5oBDww.js} +1 -1
- package/dist/assets/{AnalysisWorkspace-CodmoI-v.js → AnalysisWorkspace-CNHTkSRD.js} +1 -1
- package/dist/assets/{ComplianceWizard-CTihkUi-.js → ComplianceWizard-CAJDtLdv.js} +1 -1
- package/dist/assets/DSMView-Bv9j1Vk_.js +5 -0
- package/dist/assets/Dashboard-BnOwnA1R.js +1 -0
- package/dist/assets/DhfDashboard-CQpiYHtW.js +1 -0
- package/dist/assets/DhfWorkbench-DHxWuiiL.js +69 -0
- package/dist/assets/DiagramCanvas-DtLlTvJf.js +4 -0
- package/dist/assets/{DiagramEditor-UJDHcAUF.js → DiagramEditor-DP_PiI7K.js} +2 -2
- package/dist/assets/DiagramToolbarControls-XMGLx08e.js +1 -0
- package/dist/assets/{ElementDetailView-10U0rr33.js → ElementDetailView-BQsWfbPD.js} +1 -1
- package/dist/assets/ExplorerTreeRow-CmGPHRI8.js +3 -0
- package/dist/assets/{ImportView-D8svP04Q.js → ImportView-YFBlvgF_.js} +1 -1
- package/dist/assets/{LayerGrid-DEe0Ryz-.js → LayerGrid-KXyuibWY.js} +1 -1
- package/dist/assets/{LayerTable-CN_b2rDr.js → LayerTable-CGsFJsKs.js} +1 -1
- package/dist/assets/{MaxGraphCanvas-bo8oPBct.js → MaxGraphCanvas-BNn0Jxr6.js} +1 -1
- package/dist/assets/{ModelDiff-xe95oVua.js → ModelDiff-CJCXuz_h.js} +1 -1
- package/dist/assets/{OntologyDecompositionDiagram-BL9R8bdB.js → OntologyDecompositionDiagram-5JWUI_PB.js} +1 -1
- package/dist/assets/{OntologyViewer-CtqNkkCn.js → OntologyViewer-DxIWCcJM.js} +2 -2
- package/dist/assets/{RelationshipOverlay-DL0N8Vmk.js → RelationshipOverlay-B3AN-bM-.js} +1 -1
- package/dist/assets/{RelationshipsSection-BoJ0aUXe.js → RelationshipsSection-DggeGBKP.js} +1 -1
- package/dist/assets/{ReviewDashboard-DeTge2oC.js → ReviewDashboard-Qyj8RRFp.js} +1 -1
- package/dist/assets/{ScenarioEditor-FAEYTHgP.js → ScenarioEditor-BIAh6tLX.js} +1 -1
- package/dist/assets/{StatisticsDashboard-BAZRqIPN.js → StatisticsDashboard-CtI1hlfO.js} +1 -1
- package/dist/assets/{SysmlCodeEditor-BBfup_Ni.js → SysmlCodeEditor-i0BHj3of.js} +117 -117
- package/dist/assets/{TabularView-I4LjHhoH.js → TabularView-DXxpRshk.js} +1 -1
- package/dist/assets/TraceabilityMatrix-qEKmDy8z.js +3 -0
- package/dist/assets/UiScreensWorkspace-BHhs5tcY.js +1 -0
- package/dist/assets/{WorkflowWizard-VwpEHt3R.js → WorkflowWizard-BjtGPRsS.js} +1 -1
- package/dist/assets/index-Cdkjp-H4.css +1 -0
- package/dist/assets/index-a2rpMs5Y.js +4067 -0
- package/dist/assets/{index.es-ClbJxlAQ.js → index.es-BwDQ0kmQ.js} +1 -1
- package/dist/assets/{jspdf.es.min-DZ68BGxk.js → jspdf.es.min-KfOikWO5.js} +3 -3
- package/dist/assets/{layout-providers-Dr743WlP.js → layout-providers-BSDYNZu0.js} +1 -1
- package/dist/assets/notation-scene-CxT28i2i.js +1 -0
- package/dist/assets/{reactflow-s7jmJtXx.js → reactflow-C9OlmOYw.js} +1 -1
- package/dist/assets/xlsx-CkFp8p6R.js +105 -0
- package/dist/index.html +3 -3
- package/dist-standalone/index.html +5504 -0
- package/lib/__tests__/standalone-distribution.test.d.ts +2 -0
- package/lib/__tests__/standalone-distribution.test.d.ts.map +1 -0
- package/lib/__tests__/standalone-distribution.test.js +51 -0
- package/lib/__tests__/standalone-distribution.test.js.map +1 -0
- package/lib/__tests__/supervised-child-args.test.js +21 -1
- package/lib/__tests__/supervised-child-args.test.js.map +1 -1
- package/lib/bin/memo-architect.js +15 -6
- package/lib/bin/memo-architect.js.map +1 -1
- package/lib/commands/build.d.ts.map +1 -1
- package/lib/commands/build.js +15 -18
- package/lib/commands/build.js.map +1 -1
- package/lib/commands/dev.d.ts +14 -0
- package/lib/commands/dev.d.ts.map +1 -1
- package/lib/commands/dev.js +40 -1
- package/lib/commands/dev.js.map +1 -1
- package/lib/feature-grants.d.ts.map +1 -1
- package/lib/feature-grants.js +3 -1
- package/lib/feature-grants.js.map +1 -1
- package/package.json +10 -6
- package/dist/assets/DSMView-BiC845df.js +0 -1
- package/dist/assets/Dashboard-CgnNLhKq.js +0 -1
- package/dist/assets/DhfDashboard-w-dJoJHU.js +0 -1
- package/dist/assets/DhfWorkbench-o6B_MT-0.js +0 -69
- package/dist/assets/DiagramCanvas-CqGqDbgT.js +0 -3
- package/dist/assets/DiagramToolbarControls-B2gZFJlg.js +0 -1
- package/dist/assets/ExplorerTreeRow-DqhF_qoO.js +0 -3
- package/dist/assets/TraceabilityMatrix-DbrvjqLN.js +0 -3
- package/dist/assets/UiScreensWorkspace-DDD_PyJs.js +0 -1
- package/dist/assets/editor.worker-DyuDvpVp.js +0 -26
- package/dist/assets/element-options-B7AgTB8R.js +0 -3
- package/dist/assets/index-BWMNo4wW.css +0 -1
- package/dist/assets/index-Bij8Q4Kg.js +0 -45
- package/dist/assets/notation-scene-DT8LpWVK.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r}from"./reactflow-C9OlmOYw.js";import{W as c}from"./zustand-CrhqMOHB.js";const o="#ECEBE6",i="#1B3A4B",l="#5B6470",j="0 1px 2px rgba(0,0,0,0.16), 0 0 0 0.5px rgba(0,0,0,0.05)",s=(e,x)=>r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{display:"block"},children:x}),F={arrowRight:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M4 12h14"}),r.jsx("path",{d:"M13 6l6 6-6 6"})]})),arrowDown:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M12 4v14"}),r.jsx("path",{d:"M6 13l6 6 6-6"})]})),arrowUp:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M12 20V6"}),r.jsx("path",{d:"m6 11 6-6 6 6"})]})),panelCollapse:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M18 4v16"}),r.jsx("path",{d:"m13 7-5 5 5 5"})]})),elements:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("rect",{x:"4",y:"4",width:"6",height:"6",rx:"1"}),r.jsx("circle",{cx:"17",cy:"7",r:"3"}),r.jsx("path",{d:"m7 14 4 6H3z"}),r.jsx("path",{d:"m17 14 3 3-3 3-3-3z"})]})),tools:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"}),r.jsx("circle",{cx:"9",cy:"6",r:"1.8",fill:"currentColor"}),r.jsx("circle",{cx:"15",cy:"12",r:"1.8",fill:"currentColor"}),r.jsx("circle",{cx:"11",cy:"18",r:"1.8",fill:"currentColor"})]})),overlay:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("rect",{x:"4",y:"7",width:"12",height:"12",rx:"1.5"}),r.jsx("rect",{x:"8",y:"3",width:"12",height:"12",rx:"1.5"})]})),eye:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M2.5 12s3.4-5 9.5-5 9.5 5 9.5 5-3.4 5-9.5 5-9.5-5-9.5-5Z"}),r.jsx("circle",{cx:"12",cy:"12",r:"2.2"})]})),split:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),r.jsx("path",{d:"M12 4v16"})]})),code:({size:e=16})=>s(e,r.jsx(r.Fragment,{children:r.jsx("path",{d:"m8 7-4 5 4 5M16 7l4 5-4 5M14 4l-4 16"})})),lanes:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("rect",{x:"3",y:"5",width:"18",height:"3.4",rx:"1.3"}),r.jsx("rect",{x:"3",y:"10.3",width:"18",height:"3.4",rx:"1.3"}),r.jsx("rect",{x:"3",y:"15.6",width:"18",height:"3.4",rx:"1.3"})]})),lanesOff:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("rect",{x:"3",y:"5",width:"18",height:"3.4",rx:"1.3"}),r.jsx("rect",{x:"3",y:"15.6",width:"18",height:"3.4",rx:"1.3"}),r.jsx("path",{d:"M4 20 20 4"})]})),grid:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2.5"}),r.jsx("path",{d:"M9.2 3.5v17M14.8 3.5v17M3.5 9.2h17M3.5 14.8h17"})]})),gridOff:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2.5"}),r.jsx("path",{d:"M4 20 20 4"})]})),expand:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M15 4h5v5"}),r.jsx("path",{d:"M9 20H4v-5"}),r.jsx("path",{d:"M20 4l-7 7"}),r.jsx("path",{d:"M4 20l7-7"})]})),collapse:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M14 10h5"}),r.jsx("path",{d:"M19 10V5"}),r.jsx("path",{d:"M10 14H5"}),r.jsx("path",{d:"M5 14v5"}),r.jsx("path",{d:"M20 4l-6 6"}),r.jsx("path",{d:"M4 20l6-6"})]})),filter:({size:e=16})=>s(e,r.jsx("path",{d:"M4 5h16l-6.2 7.4V19l-3.6 1.8v-8.4z"})),back:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M11 5l-6 7 6 7"}),r.jsx("path",{d:"M5 12h14"})]})),rectangle:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"2"}),r.jsx("path",{d:"M8 5v14M16 5v14",strokeDasharray:"2 2"})]})),upload:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M12 16V4"}),r.jsx("path",{d:"M7.5 8.5 12 4l4.5 4.5"}),r.jsx("path",{d:"M4 15v4h16v-4"})]})),capture:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("rect",{x:"3",y:"6",width:"18",height:"13",rx:"2"}),r.jsx("path",{d:"M8 6l1.5-2h5L16 6"}),r.jsx("circle",{cx:"12",cy:"12.5",r:"3.2"})]})),info:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"12",cy:"12",r:"9"}),r.jsx("path",{d:"M12 10.5v6"}),r.jsx("path",{d:"M12 7.5h.01"})]})),plus:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M12 5v14"}),r.jsx("path",{d:"M5 12h14"})]})),minus:({size:e=16})=>s(e,r.jsx("path",{d:"M5 12h14"})),library:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("rect",{x:"4",y:"4",width:"5",height:"16",rx:"1"}),r.jsx("rect",{x:"10",y:"4",width:"5",height:"16",rx:"1"}),r.jsx("path",{d:"M17 5l3 14"})]})),detect:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M8 4H4v4M16 4h4v4M8 20H4v-4M16 20h4v-4"}),r.jsx("rect",{x:"7",y:"8",width:"10",height:"8",rx:"1.5",strokeDasharray:"2 2"})]})),tidy:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M3 7h6l4-4h8"}),r.jsx("path",{d:"M3 17h6l4 4h8"}),r.jsx("circle",{cx:"3",cy:"7",r:"1.3"}),r.jsx("circle",{cx:"3",cy:"17",r:"1.3"})]})),arrange:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("rect",{x:"4",y:"4",width:"5",height:"5",rx:"1"}),r.jsx("rect",{x:"15",y:"4",width:"5",height:"5",rx:"1"}),r.jsx("rect",{x:"4",y:"15",width:"5",height:"5",rx:"1"}),r.jsx("rect",{x:"15",y:"15",width:"5",height:"5",rx:"1"}),r.jsx("path",{d:"m10.5 7 3 0M12 10.5v3"})]})),download:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M12 4v11"}),r.jsx("path",{d:"M7.5 10.5 12 15l4.5-4.5"}),r.jsx("path",{d:"M4 16v3h16v-3"})]})),save:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 3h12l3 3v15H5z"}),r.jsx("path",{d:"M8 3v6h8V3M8 20v-7h8v7"})]})),clock:({size:e=16})=>s(e,r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"12",cy:"12",r:"8"}),r.jsx("path",{d:"M12 7v5l3 2"})]}))};function m({hidden:e=!1}){return e?null:r.jsx("span",{"aria-hidden":"true",style:{width:1,height:18,background:"#E2E1DB",margin:"0 3px",borderRadius:1}})}function u({options:e,value:x,onChange:a}){return r.jsx("div",{role:"tablist",style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,background:o,borderRadius:9},children:e.map(t=>{const n=t.value===x;return r.jsxs("button",{role:"tab","aria-selected":n,onClick:()=>a(t.value),title:t.title,className:"flex items-center gap-1.5 text-xs font-semibold",style:{padding:t.label?"3px 9px":"4px 7px",borderRadius:7,border:"none",cursor:"pointer",color:n?i:l,background:n?"#FFFFFF":"transparent",boxShadow:n?j:"none",transition:"background 140ms ease, color 140ms ease, box-shadow 140ms ease"},children:[t.icon,t.label&&r.jsx("span",{children:t.label})]},t.value)})})}function M({children:e}){return r.jsx("div",{style:{display:"inline-flex",alignItems:"center",background:"#FFFFFF",border:"1px solid #E2E1DB",borderRadius:9,overflow:"hidden"},children:c.Children.toArray(e).map((x,a)=>r.jsxs(c.Fragment,{children:[a>0&&r.jsx("span",{"aria-hidden":"true",style:{width:1,alignSelf:"stretch",background:"#EDECE7"}}),x]},a))})}function y({icon:e,label:x,onClick:a,active:t=!1,title:n,ariaExpanded:h,ariaLabel:d}){return r.jsxs("button",{onClick:a,title:n,"aria-label":d,"aria-pressed":t,"aria-expanded":h,className:"flex items-center gap-1.5 text-xs font-semibold",style:{padding:x?"5px 9px":"5px 7px",border:"none",cursor:"pointer",color:t?"#FFFFFF":l,background:t?i:"transparent",transition:"background 140ms ease, color 140ms ease"},children:[e,x&&r.jsx("span",{children:x})]})}function b({icon:e,label:x,onClick:a,active:t=!1,title:n,badge:h,fullWidth:d=!1}){return r.jsxs("button",{onClick:a,title:n,"aria-pressed":t,className:"flex items-center gap-1.5 text-xs font-semibold",style:{width:d?"100%":void 0,justifyContent:d?"center":void 0,padding:h!=null||x!=null?"5px 9px":"5px 7px",borderRadius:9,border:`1px solid ${t?i:"#E2E1DB"}`,cursor:"pointer",color:t?"#FFFFFF":l,background:t?i:"#FFFFFF",transition:"background 140ms ease, color 140ms ease, border-color 140ms ease"},children:[e,x!=null&&r.jsx("span",{children:x}),h!=null&&r.jsx("span",{style:{fontSize:11,fontWeight:700,lineHeight:1,padding:"2px 5px",borderRadius:6,background:t?"rgba(255,255,255,0.22)":"#F0EFEA",color:t?"#FFFFFF":"#6B7280"},children:h})]})}export{F as I,u as S,M as T,b as a,y as b,m as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e}from"./reactflow-
|
|
1
|
+
import{j as e}from"./reactflow-C9OlmOYw.js";import{a as E}from"./zustand-CrhqMOHB.js";import{u as h,k as C,C as i,F as a,h as V,x as D,P as z,y as F,R as f,z as P,A as U,B as S,G as u}from"./index-a2rpMs5Y.js";const r="page",_=new Set(["Scenario","UseCase","UserActivity"]);function H(p){return p?p.split(`
|
|
2
2
|
`).filter(o=>o.trim()).map((o,d)=>{const m=o.match(/^\d+\.\s*(.*)/);return{index:d,text:m?m[1].trim():o.trim()}}):[]}function Y({element:p,layerColor:o,onSave:d}){const m=E.useMemo(()=>H(p.doc||""),[p.doc]),[w,y]=E.useState(!1);return w||m.length===0?e.jsxs("div",{children:[e.jsxs("p",{style:{fontSize:a.xs,color:i.faint,marginBottom:6,marginTop:0},children:["One step per line, numbered: ",e.jsx("code",{children:"1. User does something"})]}),e.jsx(F,{value:p.doc||"",onSave:x=>{d(x),y(!1)},density:r,multiline:!0,placeholder:"Click to add scenario steps…"})]}):e.jsxs("div",{style:{position:"relative"},children:[e.jsx("button",{onClick:()=>y(!0),style:{position:"absolute",top:0,right:0,fontSize:a.xs,color:i.muted,padding:"2px 9px",border:`1px solid ${i.border}`,borderRadius:"6px",background:i.surface,cursor:"pointer"},onMouseEnter:x=>{x.currentTarget.style.borderColor=i.accent},onMouseLeave:x=>{x.currentTarget.style.borderColor=i.border},children:"✎ Edit steps"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",paddingTop:4},children:[e.jsx("div",{style:{padding:"6px 20px",borderRadius:"999px",fontSize:a.xs,fontWeight:700,background:o,color:"#fff",letterSpacing:"0.06em",textTransform:"uppercase"},children:"Start"}),m.map((x,s)=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",width:"100%"},children:[e.jsx(M,{color:o}),e.jsxs("div",{style:{width:"100%",maxWidth:"560px",display:"flex",alignItems:"flex-start",gap:"12px",background:i.surface,border:`1px solid ${o}30`,borderRadius:"8px",padding:"10px 14px",boxShadow:"0 1px 3px rgba(0,0,0,0.05)"},children:[e.jsx("span",{style:{flexShrink:0,width:"24px",height:"24px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:o+"18",color:o,fontSize:a.xs,fontWeight:700},children:s+1}),e.jsx("span",{style:{fontSize:a.sm,color:i.primary,lineHeight:1.5,paddingTop:"3px"},children:x.text})]})]},s)),e.jsx(M,{color:o}),e.jsx("div",{style:{padding:"6px 20px",borderRadius:"999px",fontSize:a.xs,fontWeight:700,background:o+"20",color:o,letterSpacing:"0.06em",textTransform:"uppercase",border:`1px solid ${o}40`},children:"End"})]})]})}function M({color:p}){return e.jsx("div",{style:{width:"2px",height:"20px",background:p+"50",position:"relative"},children:e.jsx("div",{style:{position:"absolute",bottom:-5,left:"50%",transform:"translateX(-50%)",width:0,height:0,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderTop:`6px solid ${p}80`}})})}function q({elementId:p}={}){var N,$,B,L;const o=h(t=>t.activeView),d=h(t=>t.model),m=h(t=>t.validation),w=h(t=>t.updateElementField),y=h(t=>t.updateElementAttribute),x=h(t=>t.applyEdit),s=p??(o.type==="element-detail"?o.elementId:null),n=s&&d?d.elements[s]:null,R=E.useMemo(()=>{if(!d||!s)return{incoming:[],outgoing:[]};const t=C(d,s);return{incoming:t.filter(c=>c.targetId===s),outgoing:t.filter(c=>c.sourceId===s)}},[d,s]),b=E.useMemo(()=>!m||!s?[]:m.violations.filter(t=>t.elementId===s),[m,s]);if(!n||!s)return e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:i.surfaceAlt},children:e.jsxs("div",{className:"text-center",style:{color:i.faint,marginTop:"-48px"},children:[e.jsxs("div",{style:{position:"relative",width:"280px",maxWidth:"60vw",margin:"0 auto -32px"},children:[e.jsx("img",{src:"/logo.png",alt:"MEMO",style:{width:"100%",display:"block",opacity:.5,mixBlendMode:"multiply"}}),e.jsx("span",{style:{position:"absolute",left:"59%",top:"60%",color:"#8B949E",fontSize:"19px",fontWeight:600,letterSpacing:"0.02em",whiteSpace:"nowrap"},children:"Architect"})]}),e.jsx("p",{style:{fontSize:a.md,margin:0},children:"Select an element to view details"})]})});const j=V[n.layer]||i.muted,l=(N=n.provenance)==null?void 0:N.declaration,k=(l==null?void 0:l.writable)!==!1,g=($=d==null?void 0:d.registries)==null?void 0:$.kinds.find(t=>t.name===n.kind),T=((B=g==null?void 0:g.namespace)==null?void 0:B[1])??((L=g==null?void 0:g.namespace)==null?void 0:L[0]),O=(t,c)=>{w(s,t,c),x(s)},I=(t,c)=>{y(s,t,c),x(s)},v=Object.entries(n.attributes).filter(([t])=>t!=="id"&&t!=="name"),A=_.has(n.kind);return e.jsx("div",{className:"flex-1 overflow-y-auto",style:{background:"#EEF4F7"},children:e.jsxs("div",{style:{maxWidth:"1040px",margin:"0 auto",padding:"20px 28px 48px"},children:[e.jsxs("header",{style:{background:i.surface,border:"1px solid rgba(60,60,67,0.12)",borderLeft:`4px solid ${j}`,borderRadius:"16px",padding:"14px 18px",marginBottom:16,boxShadow:"0 1px 3px rgba(15,23,42,0.05)"},children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",style:{marginBottom:8},children:[e.jsx("span",{className:"px-2 py-0.5 rounded-md font-semibold",style:{background:j+"18",color:j,fontSize:a.xs},children:n.kind}),e.jsx("span",{className:"px-2 py-0.5 rounded-md",style:{background:i.surfaceAlt,color:i.muted,fontSize:a.xs},children:n.layer}),T&&e.jsx("span",{style:{color:i.faint,fontSize:a.xs},children:T.replace(/[_-]/g," ").replace(/\b\w/g,t=>t.toUpperCase())}),n.shortId&&e.jsx("span",{style:{marginLeft:"auto",color:i.faint,fontSize:a.xs,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:n.shortId})]}),e.jsx("h1",{style:{fontSize:"24px",fontWeight:700,color:i.primary,lineHeight:1.2,margin:0},children:n.name}),e.jsx("div",{style:{marginTop:9,paddingTop:8,borderTop:`1px solid ${i.borderLight}`},children:e.jsx(D,{density:r})})]}),b.length>0&&e.jsxs("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid #FEE2E2",background:"#FEF2F2",marginBottom:20},children:[e.jsxs("div",{className:"px-4 py-2 font-semibold",style:{color:"#DC2626",fontSize:a.sm,borderBottom:"1px solid #FEE2E2"},children:[b.length," violation",b.length!==1?"s":""]}),b.map((t,c)=>e.jsxs("div",{className:"px-4 py-2 flex items-center gap-2",style:{fontSize:a.xs},children:[e.jsx("span",{style:{color:"#DC2626"},children:"✖"}),e.jsxs("span",{style:{color:i.faint},children:["[",t.ruleId,"]"]}),e.jsx("span",{style:{color:"#991B1B"},children:t.description})]},c))]}),e.jsx(z,{title:A?"Flow":"Description",density:r,collapsible:!1,children:A&&k?e.jsx(Y,{element:n,layerColor:j,onSave:t=>O("doc",t)}):k?e.jsx(F,{value:n.attributes.description||"",onSave:t=>I("description",t),density:r,multiline:!0,placeholder:"Click to add a description…"}):e.jsx(f,{value:n.attributes.description||n.doc||"",editability:{kind:"derived",reason:`This ${(l==null?void 0:l.origin)??"library"} declaration is read-only.`},density:r})}),e.jsxs(z,{title:"Attributes",count:v.length,density:r,collapsible:!1,children:[v.length===0&&e.jsx("p",{style:{fontSize:a.sm,color:i.faint,margin:0},children:"This element defines no attributes."}),v.length>0&&e.jsx("div",{style:{borderTop:`1px solid ${i.border}`,maxWidth:900},children:v.map(([t,c])=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(150px, 24%) minmax(0, 1fr)",gap:16,alignItems:"center",padding:"7px 0",borderBottom:`1px solid ${i.borderLight}`},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{color:i.secondary,fontSize:a.sm,fontWeight:600},children:t}),e.jsx("div",{style:{color:i.faint,fontSize:"10px"},children:"Editable"})]}),k?e.jsx(F,{value:String(c??""),onSave:W=>I(t,W),density:r,placeholder:"Add value…",compact:!0}):e.jsx(f,{value:String(c??""),editability:{kind:"derived",reason:`This ${(l==null?void 0:l.origin)??"library"} declaration is read-only.`},density:r})]},t))})]}),e.jsx(P,{element:n,outgoing:R.outgoing,incoming:R.incoming,density:r}),e.jsx("div",{style:{background:i.surface,borderRadius:12,marginBottom:16},children:e.jsx(U,{subject:n})}),e.jsx(z,{title:"Origin",density:r,collapsible:!1,children:e.jsxs("div",{style:{maxWidth:720},children:[e.jsx(S,{label:"SysML source file",editability:u("file"),density:r,children:e.jsx(f,{value:n.file??"—",editability:u("file"),density:r,mono:!0})}),l&&e.jsxs(e.Fragment,{children:[e.jsx(S,{label:"Origin",editability:u("origin"),density:r,children:e.jsx(f,{value:l.origin,editability:u("origin"),density:r})}),e.jsx(S,{label:"Package",editability:u("package"),density:r,children:e.jsx(f,{value:`${l.packageName}${l.packageVersion?` v${l.packageVersion}`:""}`,editability:u("package"),density:r})}),e.jsx(S,{label:"Access",editability:u("access"),density:r,children:e.jsx(f,{value:l.writable?"Editable project content":"Read-only reusable content",editability:u("access"),density:r})})]})]})})]})})}export{q as ElementDetailView};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{j as s}from"./reactflow-C9OlmOYw.js";import{a as F}from"./zustand-CrhqMOHB.js";import{u as ne,F as W}from"./index-a2rpMs5Y.js";const ce=new Set(["overlay","transient"]);function V(t){if(!t)return"";const o=t.lastIndexOf("::");return o>=0?t.slice(o+2):t}function $(t){if(t===void 0||t==="")return;const o=Number(t);return Number.isFinite(o)?o:void 0}function ie(t){const o=t.attributes??{},g=$(o["bounds.x"]),d=$(o["bounds.y"]),l=$(o["bounds.width"]),a=$(o["bounds.height"]);if(!(g===void 0||d===void 0||l===void 0||a===void 0))return{x:g,y:d,width:l,height:a}}function le(t,o){return{x:t.x+o.x*t.width,y:t.y+o.y*t.height,width:o.width*t.width,height:o.height*t.height}}function G(t,o){const g=new Map;for(const d of t){if(d.type.toLowerCase()!==o)continue;const l=g.get(d.sourceId)??[];l.push(d.targetId),g.set(d.sourceId,l)}return g}function ue(t,o={}){var x,r,k;const g=Object.values(t.elements??{}),d=new Map(g.map(b=>[b.id,b])),l=t.relationships??[],a=g.filter(b=>b.kind==="ScreenCapture"),u=o.captureId?a.find(b=>b.id===o.captureId):a[0];if(!u)return{nodes:[],emptyReason:"No ScreenCapture in this view."};const E=G(l,"capturesscreen"),S=(E.get(u.id)??[])[0],C=S?d.get(S):void 0;if(!C)return{capture:u,nodes:[],emptyReason:`"${u.name}" is not linked to a screen by CapturesScreen.`};const z=G(l,"composes"),R=G(l,"navigatesto"),v={x:0,y:0,width:1,height:1},w=[],I=new Set,f=new Set([...E.values()].flat()),c=(b,M,D,P)=>{if(I.has(b.id))return;I.add(b.id);const p=b.attributes??{},N=V(p.detectionMethod),L=(z.get(b.id)??[]).filter(U=>{const y=d.get(U);return!!y&&y.kind==="UIElement"&&!!ie(y)});if(w.push({element:b,rect:M,depth:D,childIds:L,parentId:P,formKind:V(p.formKind),disclosureKind:V(p.disclosureKind)||"inline",boundaryColor:p.boundaryColor||void 0,boundaryWidth:$(p.boundaryWidth),unconfirmed:N==="automatic"&&!(p.confirmedBy??"").trim(),detectionConfidence:$(p.detectionConfidence),navigatesToId:(R.get(b.id)??[])[0]}),!(b.id!==C.id&&f.has(b.id)))for(const U of L){const y=d.get(U);c(y,le(M,ie(y)),D+1,b.id)}};return c(C,v,0),{capture:u,screen:C,imageUri:pe((x=u.attributes)==null?void 0:x.imageUri),pixelWidth:$((r=u.attributes)==null?void 0:r.pixelWidth),pixelHeight:$((k=u.attributes)==null?void 0:k.pixelHeight),nodes:w}}function pe(t){if(t)return t.startsWith("/")||/^[a-z][a-z0-9+.-]*:/i.test(t)?t:`/${t}`}function xe(t){return Object.values(t.elements??{}).filter(o=>o.kind==="ScreenCapture")}function K(t,o){const d=(t.relationships??[]).find(l=>l.type.toLowerCase()==="capturesscreen"&&l.targetId===o);if(d)return(t.elements??{})[d.sourceId]??Object.values(t.elements??{}).find(l=>l.id===d.sourceId)}function ye(t,o,g){const d=new Map((t.relationships??[]).filter(u=>u.type.toLowerCase()==="composes").map(u=>[u.targetId,u.sourceId])),l=new Set;let a=d.get(g);for(;a&&a!==o&&!l.has(a);){l.add(a);const u=K(t,a);if(u)return u;a=d.get(a)}return K(t,o)}function _(t){return ce.has(t.disclosureKind)}const he={screen:"#1B3A4B",panel:"#2DD4A8",dialog:"#A855F7",field:"#E4572E",button:"#A855F7",selector:"#F59E0B",table:"#3B82F6",chart:"#3B82F6",decoration:"#9CA3AF"},ge=t=>t.boundaryColor||he[t.formKind]||"#6B7280",X=(t,o=0,g=1)=>Math.max(o,Math.min(g,t));function Fe({diagram:t,model:o,captureId:g,viewpointFilter:d,editable:l=!1,drawMode:a=!1,newElementDefaultName:u="New UIElement",onCreateBounds:E,onBoundsChange:S,proposals:C=[],onAcceptProposal:z,onRejectProposal:R}){var Z;const v=ne(e=>e.inspectElement),w=ne(e=>e.selectedElementId),[I,f]=F.useState([]),[c,x]=F.useState(null),[r,k]=F.useState(null),[b,M]=F.useState(null),D=F.useRef(null),P=I[I.length-1]??g;F.useEffect(()=>f([]),[g]),F.useEffect(()=>{a||k(e=>(e==null?void 0:e.kind)==="create"?null:e)},[a]);const p=F.useMemo(()=>ue(o,{captureId:P}),[o,P]),N=F.useMemo(()=>d?p.nodes.filter(e=>d(e.element)):p.nodes,[p.nodes,d]),L=N.find(e=>e.element.id===w),y=N.find(e=>e.element.id===b)??L,oe=new Set((y==null?void 0:y.childIds)??[]),q=F.useCallback(e=>{const i=e.navigatesToId??e.element.id,n=K(o,i);(n==null?void 0:n.id)!==P&&n&&f(m=>[...m,n.id])},[o,P]);if(!p.nodes.length)return s.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:s.jsxs("div",{className:"text-center",style:{maxWidth:420},children:[s.jsx("h3",{style:{fontSize:W.lg,fontWeight:600,color:"#374151",marginBottom:8},children:t.name}),s.jsx("p",{style:{fontSize:W.md,color:"#9CA3AF",lineHeight:1.6},children:p.emptyReason??"Nothing to lay out in this view."})]})});const re=[...N].sort((e,i)=>{const n=_(e)?1:0,m=_(i)?1:0;return n-m||e.depth-i.depth}),se=p.pixelWidth&&p.pixelHeight?p.pixelHeight/p.pixelWidth:.625,O=(e,i)=>{var m;const n=(m=D.current)==null?void 0:m.getBoundingClientRect();return n?{x:X((e-n.left)/n.width),y:X((i-n.top)/n.height)}:{x:0,y:0}},B=e=>{if(e.kind==="draw")return{x:Math.min(e.startX,e.currentX),y:Math.min(e.startY,e.currentY),width:Math.abs(e.currentX-e.startX),height:Math.abs(e.currentY-e.startY)};const i=e.currentX-e.startX,n=e.currentY-e.startY;return e.kind==="move"?{...e.baseRect,x:X(e.baseRect.x+i,0,1-e.baseRect.width),y:X(e.baseRect.y+n,0,1-e.baseRect.height)}:{...e.baseRect,width:X(e.baseRect.width+i,.01,1-e.baseRect.x),height:X(e.baseRect.height+n,.01,1-e.baseRect.y)}},ae=(e,i)=>{var m;const n=e.parentId?(m=p.nodes.find(A=>A.element.id===e.parentId))==null?void 0:m.rect:void 0;return n?{x:(i.x-n.x)/n.width,y:(i.y-n.y)/n.height,width:i.width/n.width,height:i.height/n.height}:i},de=()=>{if(!c)return;const e=B(c);c.kind==="draw"?e.width>=.01&&e.height>=.01&&k({kind:"create",rect:e,name:u}):(Math.abs(c.currentX-c.startX)>=.002||Math.abs(c.currentY-c.startY)>=.002)&&k(c.node?{kind:"edit",node:c.node,rect:e}:{kind:"create",rect:e,name:(r==null?void 0:r.kind)==="create"?r.name:u}),x(null)},J=(e,i,n)=>{var A;e.stopPropagation();const m=O(e.clientX,e.clientY);(A=D.current)==null||A.setPointerCapture(e.pointerId),x({kind:i,node:n.kind==="edit"?n.node:void 0,baseRect:n.rect,startX:m.x,startY:m.y,currentX:m.x,currentY:m.y})},Q=()=>{if(r){if(r.kind==="create"){const e=r.name.trim();if(!e)return;E==null||E(r.rect,e)}else S==null||S(r.node.element.id,ae(r.node,r.rect));k(null)}};return s.jsxs("div",{className:"flex-1 flex flex-col overflow-auto",style:{background:"#F7F7F5"},children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2",style:{borderBottom:"1px solid #E5E5E0"},children:[s.jsx("span",{style:{fontSize:W.sm,fontWeight:600,color:"#374151"},children:(Z=p.screen)==null?void 0:Z.name}),I.length>0&&s.jsx("button",{onClick:()=>f(e=>e.slice(0,-1)),style:{fontSize:W.xs,padding:"2px 8px",marginLeft:"auto",border:"1px solid #E5E5E0",borderRadius:6,background:"#FFFFFF",color:"#374151",cursor:"pointer"},children:"← Back"})]}),s.jsx("div",{className:"p-4",children:s.jsxs("div",{ref:D,role:"application","aria-label":"Screen region canvas",onPointerDown:e=>{if(!l||!a||r||e.target!==e.currentTarget)return;const i=O(e.clientX,e.clientY);e.currentTarget.setPointerCapture(e.pointerId),x({kind:"draw",startX:i.x,startY:i.y,currentX:i.x,currentY:i.y})},onPointerMove:e=>{if(!c)return;const i=O(e.clientX,e.clientY);x(n=>n?{...n,currentX:i.x,currentY:i.y}:null)},onPointerUp:de,onPointerCancel:()=>x(null),style:{position:"relative",width:"100%",maxWidth:900,paddingBottom:`${se*100}%`,margin:"0 auto",background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:8,backgroundImage:p.imageUri?`url(${p.imageUri})`:void 0,backgroundSize:"contain",backgroundRepeat:"no-repeat",cursor:a&&!r?"crosshair":"default"},children:[!p.imageUri&&s.jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{fontSize:W.xs,color:"#9CA3AF"},children:"No image at this capture’s imageUri — boxes shown without a backdrop"}),!a&&re.map(e=>{const i=e.element.id===w,n=e.element.id===b,m=e.element.id===(y==null?void 0:y.element.id),A=oe.has(e.element.id),H=!!y&&!m&&!A,Y=ge(e),ee=K(o,e.navigatesToId??e.element.id),te=!!ee&&ee.id!==P;return s.jsxs("div",{id:`screen-node-${e.element.id}`,onClick:h=>{h.stopPropagation(),v(e.element.id)},onDoubleClick:h=>{h.stopPropagation(),q(e)},onMouseEnter:()=>M(e.element.id),onMouseLeave:()=>M(h=>h===e.element.id?null:h),onPointerDown:h=>{var T;if(!l||a||r||e.depth===0)return;h.stopPropagation(),v(e.element.id);const j=O(h.clientX,h.clientY);(T=D.current)==null||T.setPointerCapture(h.pointerId),x({kind:"move",node:e,baseRect:e.rect,startX:j.x,startY:j.y,currentX:j.x,currentY:j.y})},title:`${e.element.name} · ${e.formKind}${te?" · double-click to open":""}`,style:{position:"absolute",left:`${e.rect.x*100}%`,top:`${e.rect.y*100}%`,width:`${e.rect.width*100}%`,height:`${e.rect.height*100}%`,border:`${e.boundaryWidth??(i||n?2:1)}px ${e.unconfirmed?"dashed":"solid"} ${H?"#9CA3AF":Y}`,borderRadius:3,background:H?"#6B728012":n?`color-mix(in srgb, ${Y} 12%, transparent)`:i?`color-mix(in srgb, ${Y} 6%, transparent)`:"transparent",boxShadow:_(e)?"0 2px 10px rgba(0,0,0,0.18)":void 0,opacity:H?.18:1,pointerEvents:a?"none":"auto",cursor:l&&i?"move":"pointer",transition:"opacity 120ms ease, border-width 120ms ease"},children:[(i||!L)&&e.depth>0&&s.jsxs("span",{style:{position:"absolute",top:-2,left:2,transform:"translateY(-100%)",fontSize:9,fontWeight:600,color:Y,background:"#FFFFFFDD",padding:"0 3px",borderRadius:2,whiteSpace:"nowrap",pointerEvents:"none"},children:[e.element.name,e.unconfirmed&&e.detectionConfidence!==void 0&&` · ${Math.round(e.detectionConfidence*100)}%?`]}),te&&s.jsx("button",{type:"button","aria-label":`Open ${e.element.name}`,onPointerDown:h=>h.stopPropagation(),onClick:h=>{h.stopPropagation(),q(e)},style:{position:"absolute",top:3,right:3,zIndex:3,width:22,height:22,borderRadius:5,border:`1px solid ${Y}`,background:"#FFFFFFE8",color:Y,fontSize:13,lineHeight:"18px",cursor:"pointer",opacity:H?.25:1},title:`Open nested region ${e.element.name}`,children:"↗"}),l&&i&&e.depth>0&&s.jsx("span",{onPointerDown:h=>{var T;h.stopPropagation();const j=O(h.clientX,h.clientY);(T=D.current)==null||T.setPointerCapture(h.pointerId),x({kind:"resize",node:e,baseRect:e.rect,startX:j.x,startY:j.y,currentX:j.x,currentY:j.y})},title:"Drag to resize",style:{position:"absolute",width:10,height:10,right:-5,bottom:-5,borderRadius:2,background:Y,border:"1px solid #FFFFFF",cursor:"nwse-resize"}})]},e.element.id)}),!a&&C.filter(e=>e.status==="pending").map((e,i)=>s.jsx("div",{title:`Detected boundary · ${Math.round(e.confidence*100)}% confidence`,style:{position:"absolute",zIndex:20+i,left:`${e.bounds.x*100}%`,top:`${e.bounds.y*100}%`,width:`${e.bounds.width*100}%`,height:`${e.bounds.height*100}%`,border:"2px dashed #2563EB",borderRadius:3,background:"#2563EB12",pointerEvents:"none"},children:s.jsxs("span",{style:{position:"absolute",top:2,right:2,display:"inline-flex",gap:3,pointerEvents:"auto",background:"#FFFFFFEE",padding:2,borderRadius:5,boxShadow:"0 1px 4px rgba(0,0,0,0.16)"},children:[s.jsx("button",{type:"button","aria-label":`Accept detected region ${e.id}`,onPointerDown:n=>n.stopPropagation(),onClick:n=>{n.stopPropagation(),z==null||z(e.id)},title:"Accept region",style:{width:22,height:20,border:0,borderRadius:4,background:"#DCFCE7",color:"#15803D",cursor:"pointer"},children:"✓"}),s.jsx("button",{type:"button","aria-label":`Reject detected region ${e.id}`,onPointerDown:n=>n.stopPropagation(),onClick:n=>{n.stopPropagation(),R==null||R(e.id)},title:"Reject region",style:{width:22,height:20,border:0,borderRadius:4,background:"#FEE2E2",color:"#DC2626",cursor:"pointer"},children:"×"})]})},e.id)),c&&s.jsx("div",{style:{position:"absolute",left:`${B(c).x*100}%`,top:`${B(c).y*100}%`,width:`${B(c).width*100}%`,height:`${B(c).height*100}%`,border:"2px dashed #0F766E",background:"#2DD4A81A",pointerEvents:"none"}}),r&&!c&&s.jsxs("div",{"aria-label":r.kind==="create"?"New region boundary draft":"Edited region boundary draft",onPointerDown:e=>J(e,"move",r),style:{position:"absolute",zIndex:80,left:`${r.rect.x*100}%`,top:`${r.rect.y*100}%`,width:`${r.rect.width*100}%`,height:`${r.rect.height*100}%`,border:"2px dashed #0F766E",borderRadius:3,background:"#2DD4A824",cursor:"move",boxShadow:"0 0 0 1px #FFFFFF99"},children:[s.jsxs("span",{style:{position:"absolute",top:4,left:4,display:"flex",gap:4,padding:3,borderRadius:6,background:"#FFFFFFF2",boxShadow:"0 1px 5px rgba(15,23,42,0.18)"},children:[r.kind==="create"&&s.jsx("input",{autoFocus:!0,"aria-label":"New UIElement name",placeholder:"UIElement name",value:r.name,onPointerDown:e=>e.stopPropagation(),onFocus:e=>e.currentTarget.select(),onChange:e=>k(i=>(i==null?void 0:i.kind)==="create"?{...i,name:e.target.value}:i),onKeyDown:e=>{e.key==="Enter"&&Q(),e.key==="Escape"&&k(null)},style:{width:150,border:"1px solid #CBD5E1",borderRadius:4,padding:"3px 6px",color:"#1F2937",fontSize:10}}),s.jsx("button",{type:"button",disabled:r.kind==="create"&&!r.name.trim(),onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),Q()},"aria-label":"Confirm region boundary",title:"Save this boundary",style:{border:0,borderRadius:4,padding:"3px 7px",background:"#DCFCE7",color:"#15803D",cursor:r.kind==="create"&&!r.name.trim()?"not-allowed":"pointer",opacity:r.kind==="create"&&!r.name.trim()?.5:1,fontSize:10,fontWeight:700},children:"✓ Confirm"}),s.jsx("button",{type:"button",onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),k(null)},"aria-label":"Cancel region boundary",title:"Discard this boundary change",style:{border:0,borderRadius:4,padding:"3px 7px",background:"#FEE2E2",color:"#DC2626",cursor:"pointer",fontSize:10,fontWeight:700},children:"× Cancel"})]}),s.jsx("span",{"aria-label":"Resize region boundary draft",onPointerDown:e=>J(e,"resize",r),title:"Drag to resize before confirming",style:{position:"absolute",width:12,height:12,right:-6,bottom:-6,borderRadius:2,background:"#0F766E",border:"2px solid #FFFFFF",cursor:"nwse-resize"}})]}),a&&!c&&!r&&s.jsx("div",{style:{position:"absolute",zIndex:70,left:8,top:8,padding:"5px 8px",borderRadius:6,pointerEvents:"none",background:"#0F766EEB",color:"#FFFFFF",fontSize:10,fontWeight:650},children:"Click and drag to define a region"})]})})]})}function ve({id:t,label:o,depth:g,hasChildren:d,expanded:l,selected:a,badge:u,badgeColor:E="#0F766E",count:S,title:C,onClick:z,onDelete:R}){const[v,w]=F.useState(null),I=F.useRef(null);return F.useEffect(()=>{if(!v)return;const f=x=>{var r;(r=I.current)!=null&&r.contains(x.target)||w(null)},c=x=>{x.key==="Escape"&&w(null)};return document.addEventListener("mousedown",f),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",c)}},[v]),s.jsxs("div",{role:"none",children:[s.jsxs("button",{type:"button",role:"treeitem","aria-selected":a,"aria-expanded":d?l:void 0,"data-tree-id":t,onClick:z,onContextMenu:R?f=>{f.preventDefault(),f.stopPropagation(),w({x:f.clientX,y:f.clientY})}:void 0,title:C,className:"flex items-center gap-1.5 w-full text-left",style:{minHeight:28,padding:"4px 8px",paddingLeft:8+g*18,border:0,borderRadius:6,cursor:"pointer",background:a?"#2DD4A818":"transparent",color:a?"#0F766E":"#374151"},onMouseEnter:f=>{a||(f.currentTarget.style.background="#F0F0ED")},onMouseLeave:f=>{f.currentTarget.style.background=a?"#2DD4A818":"transparent"},children:[s.jsx("span",{"aria-hidden":!0,style:{width:12,textAlign:"center",flexShrink:0,fontSize:9,color:"#9CA3AF",transform:l?"rotate(90deg)":"none",transition:"transform 120ms ease",visibility:d?"visible":"hidden"},children:"▶"}),u&&s.jsx("span",{style:{minWidth:27,height:17,padding:"0 4px",borderRadius:4,flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",background:`${E}18`,color:E,fontSize:9,fontWeight:800},children:u}),s.jsx("span",{className:"truncate",style:{flex:1,fontSize:W.xs,fontWeight:d?650:500},children:o}),S!==void 0&&s.jsx("span",{style:{color:"#9CA3AF",fontSize:9},children:S})]}),v&&R&&s.jsx("div",{ref:I,role:"menu",className:"fixed z-50 rounded-lg overflow-hidden py-1",style:{left:v.x,top:v.y,minWidth:180,background:"#FFFFFF",border:"1px solid #E5E7EB",boxShadow:"0 8px 24px rgba(0,0,0,0.16)"},children:s.jsx("button",{type:"button",role:"menuitem",onClick:async()=>{w(null);const f=typeof o=="string"?o:C??"this element";if(!window.confirm(`Delete “${f}”?
|
|
2
|
+
|
|
3
|
+
All incoming and outgoing relationships will also be deleted. This cannot be undone.`))return;const c=await R();c.success||window.alert(c.error??"The element could not be deleted.")},style:{width:"100%",border:0,padding:"8px 12px",textAlign:"left",cursor:"pointer",background:"#FFFFFF",color:"#DC2626",fontSize:12,fontWeight:600},children:"Delete element…"})})]})}export{ve as E,Fe as S,K as a,ye as b,ue as c,xe as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./reactflow-
|
|
1
|
+
import{j as e}from"./reactflow-C9OlmOYw.js";import{u as n}from"./index-a2rpMs5Y.js";import"./zustand-CrhqMOHB.js";function p(){const i=n(t=>t.setBulkImportOpen),s=n(t=>t.connected),a=[{icon:"📄",title:"Import Elements from CSV",description:"Import model elements from a CSV or tab-separated file. Supports column mapping, artifact type presets, and batch preview before committing.",action:()=>i(!0),requiresConnection:!0}];return e.jsx("div",{style:{flex:1,overflow:"auto",padding:"40px 48px",background:"linear-gradient(135deg, #F0F4F7 0%, #E8EFF3 100%)",minHeight:0},children:e.jsxs("div",{style:{maxWidth:720,margin:"0 auto"},children:[e.jsx("h1",{style:{fontSize:"22px",fontWeight:700,color:"#1B3A4B",marginBottom:6},children:"Import"}),e.jsx("p",{style:{fontSize:"14px",color:"#6B7280",marginBottom:36},children:"Bring data into your model from external sources."}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:16},children:a.map(t=>{const r=t.requiresConnection&&!s;return e.jsxs("button",{onClick:r?void 0:t.action,disabled:r,style:{display:"flex",alignItems:"flex-start",gap:20,padding:"20px 24px",borderRadius:12,textAlign:"left",background:r?"rgba(255,255,255,0.4)":"rgba(255,255,255,0.75)",border:`1px solid ${r?"rgba(255,255,255,0.6)":"rgba(255,255,255,0.95)"}`,boxShadow:r?"none":"0 2px 8px rgba(0,0,0,0.06)",cursor:r?"not-allowed":"pointer",transition:"all 0.15s",opacity:r?.55:1},onMouseEnter:o=>{r||(o.currentTarget.style.background="rgba(255,255,255,0.95)",o.currentTarget.style.boxShadow="0 4px 16px rgba(0,0,0,0.1)",o.currentTarget.style.transform="translateY(-1px)")},onMouseLeave:o=>{r||(o.currentTarget.style.background="rgba(255,255,255,0.75)",o.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.06)",o.currentTarget.style.transform="none")},children:[e.jsx("div",{style:{fontSize:28,lineHeight:1,flexShrink:0,marginTop:2},children:t.icon}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"15px",fontWeight:600,color:"#1B3A4B",marginBottom:4},children:t.title}),e.jsx("div",{style:{fontSize:"13px",color:"#6B7280",lineHeight:1.55},children:t.description}),r&&e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:8},children:"Connect to the dev server to use this import."})]})]},t.title)})})]})})}export{p as ImportView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t}from"./reactflow-
|
|
1
|
+
import{j as t}from"./reactflow-C9OlmOYw.js";import{a as f}from"./zustand-CrhqMOHB.js";import{L as M}from"./index-a2rpMs5Y.js";const $={"purpose-operational":{bg:"#f0f7ff",header:"#cce5ff",text:"#1e40af",border:"#93c5fd"},requirements:{bg:"#f0f6ff",header:"#dae8fc",text:"#1d4ed8",border:"#93c5fd"},architecture:{bg:"#f0faf0",header:"#d5e8d4",text:"#166534",border:"#86efac"},risk:{bg:"#fff5f5",header:"#f8cecc",text:"#991b1b",border:"#fca5a5"},"vv-evidence":{bg:"#faf5ff",header:"#e1d5e7",text:"#6b21a8",border:"#c4b5fd"},"dhf-outputs":{bg:"#fffbeb",header:"#fff2cc",text:"#92400e",border:"#fcd34d"},other:{bg:"#f9fafb",header:"#f3f4f6",text:"#374151",border:"#d1d5db"}},F=[{id:"purpose-operational",label:"Purpose & Operational",abbr:"PUR",layerIds:["purpose","business","operational"]},{id:"requirements",label:"Requirements",abbr:"REQ",layerIds:["requirements"]},{id:"architecture",label:"Architecture",abbr:"ARCH",layerIds:["functional","behavior","logical","physical","software","interfaces","ui"],subGroups:[{label:"Functional",layerIds:["functional","behavior"]},{label:"Logical",layerIds:["logical"]},{label:"Physical",layerIds:["physical"]},{label:"Software",layerIds:["software"]},{label:"Interfaces",layerIds:["interfaces","ui"]}]},{id:"risk",label:"Risk",abbr:"RISK",layerIds:["risk","safety","cybersecurity"]},{id:"vv-evidence",label:"V&V & Evidence",abbr:"V&V",layerIds:["verification","analysis"]},{id:"dhf-outputs",label:"DHF Outputs",abbr:"DHF",layerIds:["design-control","qms","software-lifecycle","operations","clinical","privacy"]}],A=Object.fromEntries(M.map((n,r)=>[n,r]));function O(n){return[...n].sort((r,d)=>(A[r.id]??99)-(A[d.id]??99))}function T(n){return[...n].sort((r,d)=>{const a=r.derivesFrom?1:0,x=d.derivesFrom?1:0;return a!==x?a-x:r.name.localeCompare(d.name)})}function B({kind:n,layerColor:r,domainBg:d,selected:a,onClick:x,onContextMenu:N,isFlashing:p,flashTick:R}){const[b,g]=f.useState(!1),[v,j]=f.useState(!1);f.useEffect(()=>{if(!p)return;j(!0);const w=setTimeout(()=>j(!1),700);return()=>clearTimeout(w)},[p,R]);const m=a?`${r}18`:b?`${r}0C`:"#ffffff",I=a?r:"transparent",k=r;return t.jsxs("button",{"data-kind":n.name,onClick:x,onContextMenu:N,onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),className:"text-left transition-all",style:{width:"130px",minHeight:"55px",background:m,border:`1px solid ${I}`,borderLeft:`3px solid ${k}`,borderRadius:"6px",padding:"6px 8px",cursor:"pointer",transform:v?"scale(1.04)":"scale(1)",boxShadow:v?`0 0 0 2px ${r}, 0 0 12px ${r}60`:a?`0 0 0 1px ${r}40`:b?"0 1px 3px rgba(0,0,0,0.08)":"none",flexShrink:0},children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("span",{style:{fontSize:"9px",fontFamily:"monospace",color:r,opacity:.8,textTransform:"uppercase",letterSpacing:"0.02em",lineHeight:1},children:n.construct.replace("part def","pd").replace("connection def","cd").replace("attribute def","ad")}),n.instanceCount>0&&t.jsx("span",{style:{fontSize:"9px",color:"#6B7280",background:`${r}15`,borderRadius:"8px",padding:"0 4px",lineHeight:"14px"},children:n.instanceCount})]}),t.jsx("div",{style:{fontSize:"11px",fontWeight:n.derivesFrom?400:600,color:a?r:"#1F2937",lineHeight:1.3,wordBreak:"break-word"},children:n.name}),n.derivesFrom&&t.jsxs("div",{style:{fontSize:"9px",color:"#9CA3AF",marginTop:"2px",lineHeight:1},children:["↳ ",n.derivesFrom]})]})}function z({layers:n,selectedKind:r,onKindClick:d,activeLayerId:a,flashKindName:x,flashTick:N}){const p=f.useRef({}),[R,b]=f.useState(null),[g,v]=f.useState(()=>new Set(F.map(e=>e.id).concat(["other"])));if(f.useEffect(()=>{if(!a)return;const e=p.current[a];if(e){e.scrollIntoView({behavior:"smooth",block:"start"}),b(a);const o=setTimeout(()=>b(null),1200);return()=>clearTimeout(o)}},[a]),n.length===0)return t.jsx("div",{className:"flex items-center justify-center py-12",style:{color:"#9CA3AF"},children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-2xl mb-2",children:"⬡"}),t.jsx("div",{className:"text-xs",children:"No layers found in this ontology"})]})});const j=new Set(F.flatMap(e=>e.layerIds)),m=O(n.filter(e=>!j.has(e.id)));function I(e,o){e.preventDefault()}function k(e){v(o=>{const s=new Set(o);return s.has(e)?s.delete(e):s.add(e),s})}const w=(e,o,s)=>T(e).map(l=>t.jsx(B,{kind:l,layerColor:o,domainBg:s,selected:r===l.name,onClick:()=>d(r===l.name?null:l.name),onContextMenu:u=>I(u,l.name),isFlashing:x===l.name,flashTick:N},l.name)),C=(e,o)=>{const s=$[e.id]??$.other,L=o.reduce((i,c)=>i+c.kindCount,0),l=L===0,u=g.has(e.id),E=O(o);return t.jsxs("div",{ref:i=>{p.current[e.id]=i},className:"rounded-xl overflow-hidden transition-all",style:{border:`1px solid ${s.border}`,background:s.bg,outline:R===e.id?`2px solid ${s.border}`:"none",outlineOffset:"2px"},children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 cursor-pointer select-none",style:{background:s.header,borderBottom:u?"none":`1px solid ${s.border}`},onClick:()=>k(e.id),title:u?"Expand":"Collapse",children:[t.jsx("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"none",style:{transition:"transform 150ms ease",transform:u?"rotate(-90deg)":"rotate(0deg)",flexShrink:0},children:t.jsx("path",{d:"M4 6L8 10L12 6",stroke:s.text,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),t.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:s.text,letterSpacing:"0.08em",textTransform:"uppercase",minWidth:"32px",textAlign:"center"},children:e.abbr}),t.jsx("span",{style:{width:"1px",height:"14px",background:`${s.border}`,opacity:.5}}),t.jsx("span",{className:"text-xs font-semibold flex-1",style:{color:s.text},children:e.label}),t.jsx("span",{className:"text-xs",style:{color:s.text,opacity:.7},children:l?"no kinds":`${L} kinds`})]}),!u&&(l?t.jsx("div",{className:"px-4 py-1.5 text-xs italic",style:{color:s.text,opacity:.4},children:"(no elements)"}):t.jsx("div",{className:"p-3 space-y-3",children:e.subGroups?e.subGroups.map(i=>{const c=E.filter(y=>i.layerIds.includes(y.id));if(c.length===0)return null;const h=c.flatMap(y=>y.kinds);if(h.length===0)return null;const S=c[0].color??s.text;return t.jsxs("div",{children:[t.jsxs("div",{className:"text-xs font-medium mb-1.5 flex items-center gap-1.5",style:{color:s.text,opacity:.75},ref:y=>{c.forEach(H=>{p.current[H.id]=y})},children:[t.jsx("span",{className:"inline-block w-2 h-2 rounded-sm flex-shrink-0",style:{background:S}}),i.label]}),t.jsx("div",{className:"flex flex-wrap gap-2",children:w(h,S,s.bg)})]},i.label)}):(()=>{var h;const i=E.flatMap(S=>S.kinds),c=((h=E[0])==null?void 0:h.color)??s.text;return t.jsx("div",{className:"flex flex-wrap gap-2",children:w(i,c,s.bg)})})()}))]},e.id)};return t.jsxs("div",{className:"space-y-3 mb-6",children:[F.map(e=>{const o=n.filter(s=>e.layerIds.includes(s.id));return o.length===0?null:C(e,o)}),m.length>0&&C({id:"other",label:"Other",abbr:"EXT",layerIds:m.map(e=>e.id)},m)]})}export{z as LayerGrid};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as t}from"./reactflow-
|
|
1
|
+
import{j as t}from"./reactflow-C9OlmOYw.js";import{a}from"./zustand-CrhqMOHB.js";import{h as A}from"./index-a2rpMs5Y.js";function q({layers:p,selectedKind:L,onKindClick:S}){const[F,D]=a.useState("name"),[g,j]=a.useState("asc"),[h,M]=a.useState(""),[c,T]=a.useState(!1),[i,v]=a.useState("all"),[d,E]=a.useState("all"),[B,f]=a.useState(!1),[N,b]=a.useState(!1),y=a.useMemo(()=>p.flatMap(e=>e.kinds.map(s=>({...s,layerLabel:e.label,layerColor:A[e.id]??e.color??"#6B7280"}))),[p]),R=a.useMemo(()=>[...new Set(p.map(e=>e.id))],[p]),K=a.useMemo(()=>[...new Set(y.map(e=>e.construct))],[y]),C=a.useMemo(()=>{let e=y;if(h.trim()){const s=h.toLowerCase();e=e.filter(o=>{var l,r;return o.name.toLowerCase().includes(s)||o.label.toLowerCase().includes(s)||o.layer.toLowerCase().includes(s)||(((l=o.description)==null?void 0:l.toLowerCase().includes(s))??!1)||(((r=o.derivesFrom)==null?void 0:r.toLowerCase().includes(s))??!1)})}return i!=="all"&&(e=e.filter(s=>s.layer===i)),d!=="all"&&(e=e.filter(s=>s.construct===d)),e},[y,h,i,d]),x=a.useMemo(()=>[...C].sort((e,s)=>{var l,r;let o=0;switch(F){case"name":o=e.name.localeCompare(s.name);break;case"layer":o=e.layer.localeCompare(s.layer);break;case"construct":o=e.construct.localeCompare(s.construct);break;case"instanceCount":o=e.instanceCount-s.instanceCount;break;case"derivesFrom":o=(e.derivesFrom??"").localeCompare(s.derivesFrom??"");break;case"derivedByCount":o=(((l=e.derivedBy)==null?void 0:l.length)??0)-(((r=s.derivedBy)==null?void 0:r.length)??0);break}return g==="asc"?o:-o}),[C,F,g]),k=a.useMemo(()=>{if(c)return null;const e=new Map;for(const s of x)e.has(s.layer)||e.set(s.layer,[]),e.get(s.layer).push(s);return e},[x,c]);function u(e){F===e?j(s=>s==="asc"?"desc":"asc"):(D(e),j("asc"))}const z=a.useCallback(()=>{const e=[["Name","Layer","Construct","Instances","Derives From","Derived By","Description"]];for(const n of x)e.push([n.name,n.layer,n.construct,String(n.instanceCount),n.derivesFrom??"",(n.derivedBy??[]).join("; "),n.description??""]);const s=e.map(n=>n.map($=>`"${$.replace(/"/g,'""')}"`).join(",")).join(`
|
|
2
2
|
`),o=new Blob([s],{type:"text/csv;charset=utf-8;"}),l=URL.createObjectURL(o),r=document.createElement("a");r.href=l,r.download="ontology-kinds.csv",r.click(),URL.revokeObjectURL(l)},[x]),m=({k:e})=>t.jsx("span",{style:{fontSize:"10px",color:F===e?"#1B3A4B":"#D1D5DB",marginLeft:"3px"},children:F===e?g==="asc"?"▲":"▼":"⇅"}),w=(e,s)=>{var l,r;const o=L===e.name;return t.jsxs("div",{className:"grid items-center cursor-pointer text-xs",style:{gridTemplateColumns:"1.5fr 100px 90px 60px 120px 60px",padding:"7px 16px",background:o?"#EFF6FF":s%2===0?"#FAFAF8":"#FFFFFF",borderLeft:o?`3px solid ${e.layerColor}`:"3px solid transparent",transition:"background 100ms ease"},onClick:()=>S(o?null:e.name),onMouseEnter:n=>{o||(n.currentTarget.style.background="#F0F7FF")},onMouseLeave:n=>{o||(n.currentTarget.style.background=o?"#EFF6FF":s%2===0?"#FAFAF8":"#FFFFFF")},children:[t.jsxs("div",{className:"flex items-center gap-2 truncate",children:[t.jsx("span",{className:"w-2 h-2 rounded flex-shrink-0",style:{backgroundColor:e.layerColor}}),t.jsx("span",{style:{color:"#1a1a1a",fontWeight:o?600:400},children:e.name})]}),t.jsx("span",{className:"capitalize",style:{color:"#6B7280"},children:e.layer}),t.jsx("span",{className:"font-mono",style:{color:"#9CA3AF"},children:e.construct}),t.jsx("span",{className:"text-right",style:{color:e.instanceCount>0?"#1B3A4B":"#D1D5DB"},children:e.instanceCount>0?e.instanceCount:"—"}),t.jsx("span",{className:"truncate",style:{color:e.derivesFrom?"#2563EB":"#D1D5DB"},children:e.derivesFrom??"—"}),t.jsx("span",{className:"text-right",style:{color:(((l=e.derivedBy)==null?void 0:l.length)??0)>0?"#374151":"#D1D5DB"},children:(((r=e.derivedBy)==null?void 0:r.length)??0)>0?e.derivedBy.length:"—"})]},`${e.layer}:${e.name}`)};return t.jsxs("div",{className:"mb-6",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3 flex-wrap",children:[t.jsx("input",{type:"text",placeholder:"Search kinds...",value:h,onChange:e=>M(e.target.value),className:"px-2.5 py-1.5 text-xs rounded-md flex-1 min-w-[140px]",style:{border:"1px solid #E5E7EB",background:"#F9FAFB",color:"#374151",outline:"none",maxWidth:"240px"},onFocus:e=>e.currentTarget.style.borderColor="#2563EB",onBlur:e=>e.currentTarget.style.borderColor="#E5E7EB"}),t.jsxs("div",{className:"relative",children:[t.jsxs("button",{onClick:()=>{f(!B),b(!1)},className:"px-2.5 py-1.5 text-xs rounded-md",style:{border:"1px solid #E5E7EB",background:i!=="all"?"#EFF6FF":"#F9FAFB",color:"#374151"},children:["Layer: ",i==="all"?"All":i]}),B&&t.jsxs("div",{className:"absolute top-full left-0 mt-1 rounded-lg shadow-lg py-1 z-20",style:{background:"#FFFFFF",border:"1px solid #E5E7EB",minWidth:"120px"},children:[t.jsx("button",{className:"block w-full text-left px-3 py-1.5 text-xs hover:bg-gray-50",style:{color:"#374151"},onClick:()=>{v("all"),f(!1)},children:"All"}),R.map(e=>t.jsx("button",{className:"block w-full text-left px-3 py-1.5 text-xs hover:bg-gray-50 capitalize",style:{color:"#374151"},onClick:()=>{v(e),f(!1)},children:e},e))]})]}),t.jsxs("div",{className:"relative",children:[t.jsxs("button",{onClick:()=>{b(!N),f(!1)},className:"px-2.5 py-1.5 text-xs rounded-md",style:{border:"1px solid #E5E7EB",background:d!=="all"?"#EFF6FF":"#F9FAFB",color:"#374151"},children:["Construct: ",d==="all"?"All":d]}),N&&t.jsxs("div",{className:"absolute top-full left-0 mt-1 rounded-lg shadow-lg py-1 z-20",style:{background:"#FFFFFF",border:"1px solid #E5E7EB",minWidth:"140px"},children:[t.jsx("button",{className:"block w-full text-left px-3 py-1.5 text-xs hover:bg-gray-50",style:{color:"#374151"},onClick:()=>{E("all"),b(!1)},children:"All"}),K.map(e=>t.jsx("button",{className:"block w-full text-left px-3 py-1.5 text-xs hover:bg-gray-50 font-mono",style:{color:"#374151"},onClick:()=>{E(e),b(!1)},children:e},e))]})]}),t.jsx("button",{onClick:()=>T(!c),className:"px-2.5 py-1.5 text-xs rounded-md",style:{border:"1px solid #E5E7EB",background:c?"#1B3A4B":"#F9FAFB",color:c?"#2DD4A8":"#374151"},children:c?"Grouped":"Flatten"}),t.jsx("button",{onClick:z,className:"px-2.5 py-1.5 text-xs rounded-md ml-auto",style:{border:"1px solid #E5E7EB",background:"#F9FAFB",color:"#374151"},title:"Export as CSV",children:"Export CSV"}),t.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:[C.length," / ",y.length," kinds"]})]}),t.jsxs("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid #E5E5E0"},children:[t.jsxs("div",{className:"grid text-xs font-medium",style:{gridTemplateColumns:"1.5fr 100px 90px 60px 120px 60px",background:"#F7F7F5",borderBottom:"1px solid #E5E5E0",padding:"8px 16px",color:"#6B7280",position:"sticky",top:0,zIndex:5},children:[t.jsxs("button",{className:"text-left flex items-center",onClick:()=>u("name"),children:["Kind ",t.jsx(m,{k:"name"})]}),t.jsxs("button",{className:"text-left flex items-center",onClick:()=>u("layer"),children:["Layer ",t.jsx(m,{k:"layer"})]}),t.jsxs("button",{className:"text-left flex items-center",onClick:()=>u("construct"),children:["Construct ",t.jsx(m,{k:"construct"})]}),t.jsxs("button",{className:"text-right flex items-center justify-end",onClick:()=>u("instanceCount"),children:["# ",t.jsx(m,{k:"instanceCount"})]}),t.jsxs("button",{className:"text-left flex items-center",onClick:()=>u("derivesFrom"),children:["Derives From ",t.jsx(m,{k:"derivesFrom"})]}),t.jsxs("button",{className:"text-right flex items-center justify-end",onClick:()=>u("derivedByCount"),children:["Subs ",t.jsx(m,{k:"derivedByCount"})]})]}),c?x.map((e,s)=>w(e,s)):k&&[...k.entries()].map(([e,s])=>{const o=p.find(r=>r.id===e),l=A[e]??"#6B7280";return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 text-xs font-semibold",style:{background:`${l}08`,borderTop:"1px solid #E5E5E0",color:l},children:[t.jsx("span",{className:"w-2.5 h-2.5 rounded flex-shrink-0",style:{backgroundColor:l}}),(o==null?void 0:o.label)??e,t.jsxs("span",{className:"font-normal",style:{color:"#9CA3AF"},children:["(",s.length,")"]})]}),s.map((r,n)=>w(r,n))]},e)}),x.length===0&&t.jsx("div",{className:"py-8 text-center text-xs",style:{color:"#9CA3AF"},children:"No kinds match the current filters"})]})]})}export{q as LayerTable};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as jsxRuntimeExports}from"./reactflow-
|
|
1
|
+
import{j as jsxRuntimeExports}from"./reactflow-C9OlmOYw.js";import{a as reactExports}from"./zustand-CrhqMOHB.js";import{D as DIAGRAM_TYPE_META,u as useModelStore,g as getDiagram,J as sendDiagramLayoutUpdate,F as FONT,i as getRegistries}from"./index-a2rpMs5Y.js";import{c as computeFBSLayout,F as buildFunctionalTree,b as computeContainmentLayout,H as buildDecompositionTree,d as computeUseCaseViewLayout,w as useCaseViewOptions,e as computeContextViewLayout,f as computeInterconnectionLayout,g as computeActionFlowViewLayout,h as computeStateTransitionLayout,i as computeSequenceLayout,v as resolveGeneralMode,j as computeGeneralViewLayout,E as buildGeneralViewTree,k as computeLayout,U as projectLayoutToNotationScene,s as selectedLayoutProviderId,q as commonDisplayLevels,V as notationSceneToSvg,K as GridView,L as BrowserView,R as RelationshipPicker}from"./notation-scene-CxT28i2i.js";import{S as ScreenLayoutView}from"./ExplorerTreeRow-CmGPHRI8.js";import"./layout-providers-BSDYNZu0.js";import"./elk-6l8mIQnQ.js";class ImageBox{constructor(t,e,i){this.src=t,this.width=e,this.height=i}}class EventObject{constructor(t="",...e){if(this.consumed=!1,this.name=t,this.properties={},e[0]&&e[0].constructor===Object)for(const[i,s]of Object.entries(e[0]))this.properties[i]=s;else for(let i=0;i<e.length;i+=2)e[i+1]!==null&&(this.properties[e[i]]=e[i+1])}getName(){return this.name}getProperties(){return this.properties}getProperty(t){return this.properties[t]}isConsumed(){return this.consumed}consume(){this.consumed=!0}}class EventSource{constructor(t=null){this.eventListeners=[],this.eventsEnabled=!0,this.eventSource=null,this.eventSource=t}isEventsEnabled(){return this.eventsEnabled}setEventsEnabled(t){this.eventsEnabled=t}getEventSource(){return this.eventSource}setEventSource(t){this.eventSource=t}addListener(t,e){this.eventListeners.push({name:t,funct:e})}removeListener(t){let e=0;for(;e<this.eventListeners.length;)this.eventListeners[e].funct===t?this.eventListeners.splice(e,1):e+=1}fireEvent(t,e=null){if(this.isEventsEnabled()){t||(t=new EventObject("")),e||(e=this.getEventSource()),e||(e=this);for(const i of this.eventListeners)(i.name===null||i.name===t.getName())&&i.funct.apply(this,[e,t])}}destroy(){this.eventListeners.length=0}}const DEFAULT_HOTSPOT=.3,MIN_HOTSPOT_SIZE=8,MAX_HOTSPOT_SIZE=0,IDENTITY_FIELD_NAME="mxObjectId",NS_SVG="http://www.w3.org/2000/svg",NS_XLINK="http://www.w3.org/1999/xlink",SHADOWCOLOR="gray",SHADOW_OFFSET_X=2,SHADOW_OFFSET_Y=3,SHADOW_OPACITY=1,TOOLTIP_VERTICAL_OFFSET=16,DEFAULT_VALID_COLOR="#00FF00",DEFAULT_INVALID_COLOR="#FF0000",OUTLINE_HIGHLIGHT_COLOR="#00FF00",OUTLINE_HIGHLIGHT_STROKEWIDTH=5,HIGHLIGHT_STROKEWIDTH=3,HIGHLIGHT_SIZE=2,HIGHLIGHT_OPACITY=100,INVALID_CONNECT_TARGET_COLOR="#FF0000",DROP_TARGET_COLOR="#0000FF",VALID_COLOR="#00FF00",INVALID_COLOR="#FF0000",EDGE_SELECTION_COLOR="#00FF00",VERTEX_SELECTION_COLOR="#00FF00",VERTEX_SELECTION_STROKEWIDTH=1,EDGE_SELECTION_STROKEWIDTH=1,VERTEX_SELECTION_DASHED=!0,EDGE_SELECTION_DASHED=!0,GUIDE_COLOR="#FF0000",GUIDE_STROKEWIDTH=1,HANDLE_SIZE=6,LABEL_HANDLE_SIZE=4,HANDLE_FILLCOLOR="#00FF00",HANDLE_STROKECOLOR="black",LABEL_HANDLE_FILLCOLOR="yellow",CONNECT_HANDLE_FILLCOLOR="#0000FF",LOCKED_HANDLE_FILLCOLOR="#FF0000",DEFAULT_FONTFAMILY="Arial,Helvetica,sans-serif",DEFAULT_FONTSIZE=11,DEFAULT_TEXT_DIRECTION="",LINE_HEIGHT=1.2,WORD_WRAP="normal",DEFAULT_FONTSTYLE=0,DEFAULT_STARTSIZE=40,DEFAULT_MARKERSIZE=6,DEFAULT_IMAGESIZE=24,ENTITY_SEGMENT=30,RECTANGLE_ROUNDING_FACTOR=.15,LINE_ARCSIZE=20,ARROW_SPACING=0,ARROW_WIDTH=30,ARROW_SIZE=30,PAGE_FORMAT_A4_PORTRAIT=[0,0,827,1169],NONE="none",FONT_STYLE_MASK={BOLD:1,ITALIC:2,UNDERLINE:4,STRIKETHROUGH:8},DIRECTION_MASK={NONE:0,WEST:1,NORTH:2,SOUTH:4,EAST:8,ALL:15},NODE_TYPE={ELEMENT:1},isWindowObjectAvailable=()=>typeof window<"u",isUserAgentAvailable=()=>!!navigator.userAgent,isUserAgentIncludes=r=>navigator.userAgent.includes(r),isAppVersionAvailable=()=>!!navigator.appVersion,isAppVersionIncludes=r=>navigator.appVersion.includes(r);class Client{}Client.basePath=".";Client.setBasePath=r=>{typeof r<"u"&&r.length>0?(r.substring(r.length-1)==="/"&&(r=r.substring(0,r.length-1)),Client.basePath=r):Client.basePath="."};Client.imageBasePath=".";Client.setImageBasePath=r=>{typeof r<"u"&&r.length>0?(r.substring(r.length-1)==="/"&&(r=r.substring(0,r.length-1)),Client.imageBasePath=r):Client.imageBasePath=`${Client.basePath}/images`};Client.IS_EDGE=isWindowObjectAvailable()&&isUserAgentAvailable()&&!!navigator.userAgent.match(/Edge\//);Client.IS_NS=isWindowObjectAvailable()&&isUserAgentAvailable()&&isUserAgentIncludes("Mozilla/")&&!isUserAgentIncludes("MSIE")&&!isUserAgentIncludes("Edge/");Client.IS_SF=isWindowObjectAvailable()&&/Apple Computer, Inc/.test(navigator.vendor);Client.IS_ANDROID=isWindowObjectAvailable()&&isAppVersionAvailable()&&isAppVersionIncludes("Android");Client.IS_IOS=isWindowObjectAvailable()&&/iP(hone|od|ad)/.test(navigator.platform);Client.IS_GC=isWindowObjectAvailable()&&/Google Inc/.test(navigator.vendor);Client.IS_CHROMEAPP=isWindowObjectAvailable()&&window.chrome!=null&&chrome.app!=null&&chrome.app.runtime!=null;Client.IS_FF=isUserAgentAvailable()&&navigator.userAgent.toLowerCase().includes("firefox");Client.IS_MT=isWindowObjectAvailable()&&isUserAgentAvailable()&&(isUserAgentIncludes("Firefox/")&&!isUserAgentIncludes("Firefox/1.")&&!isUserAgentIncludes("Firefox/2.")||isUserAgentIncludes("Iceweasel/")&&!isUserAgentIncludes("Iceweasel/1.")&&!isUserAgentIncludes("Iceweasel/2.")||isUserAgentIncludes("SeaMonkey/")&&!isUserAgentIncludes("SeaMonkey/1.")||isUserAgentIncludes("Iceape/")&&!isUserAgentIncludes("Iceape/1."));var Mt;Client.IS_SVG=isWindowObjectAvailable()&&((Mt=navigator.appName)==null?void 0:Mt.toUpperCase())!=="MICROSOFT INTERNET EXPLORER";Client.NO_FO=isWindowObjectAvailable()&&(!document.createElementNS||document.createElementNS(NS_SVG,"foreignObject").toString()!=="[object SVGForeignObjectElement]"||isUserAgentIncludes("Opera/"));Client.IS_WIN=isWindowObjectAvailable()&&isAppVersionAvailable()&&isAppVersionIncludes("Win");Client.IS_MAC=isWindowObjectAvailable()&&isAppVersionAvailable()&&isAppVersionIncludes("Mac");Client.IS_CHROMEOS=isWindowObjectAvailable()&&/\bCrOS\b/.test(navigator.appVersion);Client.IS_TOUCH=isWindowObjectAvailable()&&"ontouchstart"in document.documentElement;Client.IS_POINTER=isWindowObjectAvailable()&&!!window.PointerEvent&&isAppVersionAvailable()&&!isAppVersionIncludes("Mac");Client.IS_LOCAL=isWindowObjectAvailable()&&!document.location.href.includes("http://")&&!document.location.href.includes("https://");const getMainEvent=r=>{let t=r;return(t.type==="touchstart"||t.type==="touchmove")&&t.touches&&t.touches[0]?t=t.touches[0]:t.type==="touchend"&&t.changedTouches&&t.changedTouches[0]&&(t=t.changedTouches[0]),t},getClientX=r=>getMainEvent(r).clientX,getClientY=r=>getMainEvent(r).clientY,getSource=r=>r.target,isConsumed=r=>{const t=r;return t.isConsumed!==void 0&&t.isConsumed},isTouchEvent=r=>{const t=r;return t.pointerType?t.pointerType==="touch"||t.pointerType===t.MSPOINTER_TYPE_TOUCH:t.mozInputSource!==void 0?t.mozInputSource===5:t.type.indexOf("touch")===0},isPenEvent=r=>{const t=r;return t.pointerType?t.pointerType=="pen"||t.pointerType===t.MSPOINTER_TYPE_PEN:t.mozInputSource!==void 0?t.mozInputSource===2:t.type.indexOf("pen")===0},isMultiTouchEvent=r=>{const t=r;return t.type&&t.type.indexOf("touch")==0&&t.touches!==void 0&&t.touches.length>1},isMouseEvent=r=>{const t=r;return t.pointerType?t.pointerType=="mouse"||t.pointerType===t.MSPOINTER_TYPE_MOUSE:t.mozInputSource!==void 0?t.mozInputSource===1:t.type.indexOf("mouse")===0},isLeftMouseButton=r=>"buttons"in r&&(r.type==="mousedown"||r.type==="mousemove")?r.buttons===1:r.which!==void 0?r.which===1:r.button===1,isRightMouseButton=r=>r.button===2,isPopupTrigger=r=>isRightMouseButton(r)||Client.IS_MAC&&isControlDown(r)&&!isShiftDown(r)&&!isMetaDown(r)&&!isAltDown(r),isShiftDown=r=>r.shiftKey,isAltDown=r=>r.altKey,isControlDown=r=>r.ctrlKey,isMetaDown=r=>r.metaKey;class NoOpLogger{debug(t){}enter(t){}error(t,...e){}info(t){}leave(t,e){}show(){}trace(t){}warn(t){}}const shallowCopy=(r,t)=>{for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)){const i=r[e];Array.isArray(i)?t[e]=[...i]:t[e]=i}};class NoOpI18n{isEnabled(){return!1}get(){return null}addResource(){}}const GlobalConfig={i18n:new NoOpI18n,logger:new NoOpLogger},StyleDefaultsConfig={fontFamily:DEFAULT_FONTFAMILY,fontSize:DEFAULT_FONTSIZE,imageSize:DEFAULT_IMAGESIZE,lineArcSize:LINE_ARCSIZE,markerSize:DEFAULT_MARKERSIZE,roundingFactor:RECTANGLE_ROUNDING_FACTOR,shadowColor:SHADOWCOLOR,shadowOffsetX:SHADOW_OFFSET_X,shadowOffsetY:SHADOW_OFFSET_Y,shadowOpacity:SHADOW_OPACITY,startSize:DEFAULT_STARTSIZE},doEval=expression=>eval(expression),isElement=r=>(r==null?void 0:r.nodeType)===NODE_TYPE.ELEMENT,isNullish=r=>r==null,log=()=>GlobalConfig.logger,mixInto=r=>t=>{const e=Reflect.ownKeys(t);try{for(const i of e)Object.defineProperty(r.prototype,i,{value:t[i],writable:!0})}catch(i){log().error("Error while mixing",i)}},matchBinaryMask=(r,t)=>(r&t)===t,blocks=new Set(["BLOCKQUOTE","DIV","H1","H2","H3","H4","H5","H6","OL","P","PRE","TABLE","UL"]),extractTextWithWhitespace=r=>{const t=[];function e(i){if(!(i.length==1&&(i[0].nodeName=="BR"||i[0].innerHTML==`
|
|
2
2
|
`)))for(let s=0;s<i.length;s+=1){const n=i[s];n.nodeName=="BR"||n.innerHTML==`
|
|
3
3
|
`||(i.length==1||s==0)&&n.nodeName=="DIV"&&n.innerHTML.toLowerCase()=="<br>"?t.push(`
|
|
4
4
|
`):(n.nodeType===3||n.nodeType===4?n.nodeValue&&n.nodeValue.length>0&&t.push(n.nodeValue):n.nodeType!==8&&n.childNodes.length>0&&e(Array.from(n.childNodes)),s<i.length-1&&blocks.has(i[s+1].nodeName)&&t.push(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./reactflow-
|
|
1
|
+
import{j as e}from"./reactflow-C9OlmOYw.js";import{a as y}from"./zustand-CrhqMOHB.js";import{u as F,h as j}from"./index-a2rpMs5Y.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,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
|
+
import{j as e,H as C,P as k,R as D,c as S,k as O,l as R,m as T}from"./reactflow-C9OlmOYw.js";import{a as p}from"./zustand-CrhqMOHB.js";/* empty css */import{r as I}from"./layout-providers-BSDYNZu0.js";import{h as L,u as h,Z as P,$ as M,d as z}from"./index-a2rpMs5Y.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 Z(){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(U,{menuRef:f,state:t,onClose:()=>x(null),packages:i})]})}const U=({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(Z,{})})}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{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
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LayerGrid-KXyuibWY.js","assets/reactflow-C9OlmOYw.js","assets/zustand-CrhqMOHB.js","assets/index-a2rpMs5Y.js","assets/index-Cdkjp-H4.css","assets/LayerTable-CGsFJsKs.js","assets/RelationshipsSection-DggeGBKP.js","assets/sysml-edge-styles-ByJeCWqa.js","assets/RelationshipOverlay-B3AN-bM-.js","assets/OntologyDecompositionDiagram-5JWUI_PB.js","assets/layout-providers-BSDYNZu0.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-a2rpMs5Y.js";import{j as e}from"./reactflow-C9OlmOYw.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-KXyuibWY.js"),__vite__mapDeps([0,1,2,3,4])).then(s=>({default:s.LayerGrid}))),ie=a.lazy(()=>O(()=>import("./LayerTable-CGsFJsKs.js"),__vite__mapDeps([5,1,2,3,4])).then(s=>({default:s.LayerTable}))),K=a.lazy(()=>O(()=>import("./RelationshipsSection-DggeGBKP.js"),__vite__mapDeps([6,1,2,7])).then(s=>({default:s.RelationshipsSection}))),le=a.lazy(()=>O(()=>import("./RelationshipOverlay-B3AN-bM-.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-5JWUI_PB.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-C9OlmOYw.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-C9OlmOYw.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};
|