@duckcodeailabs/dql-cli 1.13.1 → 1.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apps-api.d.ts +225 -5
- package/dist/apps-api.d.ts.map +1 -1
- package/dist/apps-api.js +1950 -117
- package/dist/apps-api.js.map +1 -1
- package/dist/assets/dql-notebook/assets/{AgentLogPage-D6fgEAEy.js → AgentLogPage-BlUE3qsX.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiBuildDialog-8miXFPse.js → AiBuildDialog-O88iK6UW.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiBuildResult-DPJ_SI0R.js → AiBuildResult-D-6G4Sh3.js} +8 -8
- package/dist/assets/dql-notebook/assets/{AiSidePanel-NVA6lZnn.js → AiSidePanel-MRSGtQDV.js} +1 -1
- package/dist/assets/dql-notebook/assets/AnalyticsHome-CcRVO6zN.js +6 -0
- package/dist/assets/dql-notebook/assets/AppsView-BTkGC-wl.js +5588 -0
- package/dist/assets/dql-notebook/assets/{BlockStudio--jNw9XUI.js → BlockStudio-BrTNaDpb.js} +10 -15
- package/dist/assets/dql-notebook/assets/{BusinessArtifactView-DtRMiaF4.js → BusinessArtifactView-itEIUrYy.js} +1 -1
- package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-CbAqOpNc.js +22 -0
- package/dist/assets/dql-notebook/assets/{GitPage-CazC-eTR.js → GitPage-BxOqRYu2.js} +1 -1
- package/dist/assets/dql-notebook/assets/GlobalAiRail-Tfkx76CI.js +1 -0
- package/dist/assets/dql-notebook/assets/GovernedContextPage-CeaDbepP.js +7 -0
- package/dist/assets/dql-notebook/assets/{HelpDocsPage-DMHPsVqP.js → HelpDocsPage-D1lAryYv.js} +1 -1
- package/dist/assets/dql-notebook/assets/{HomePage-DcSI4dnU.js → HomePage-GB6se6xW.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDAG-BJ6xz06u.js → LineageDAG-zCyN-hdg.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDetailView-8WrQm-MF.js → LineageDetailView-Cg0TgG2Y.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDrawer-hnqCW_t-.js → LineageDrawer-DwMcenDf.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineagePathBreadcrumb-B4LZTUsl.js → LineagePathBreadcrumb-DUZx3ksU.js} +1 -1
- package/dist/assets/dql-notebook/assets/{MiniLineageGraph-CotnRuxa.js → MiniLineageGraph-DT_ycl6s.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NewBlockModal-DHn-CEEW.js → NewBlockModal-qdhzeJPF.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NewNotebookModal-BPGp-8oq.js → NewNotebookModal-BnaDzs1A.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NotebookEditor-B0OTHM6W.js → NotebookEditor-CouPFzdo.js} +5 -5
- package/dist/assets/dql-notebook/assets/{ReadinessPage-CoOIpxWq.js → ReadinessPage-DB_KbH9Y.js} +1 -1
- package/dist/assets/dql-notebook/assets/{SetupOnboarding-DxK_mFzf.js → SetupOnboarding-CamQq_N2.js} +1 -1
- package/dist/assets/dql-notebook/assets/SkillsPage--mYkOAK2.js +10 -0
- package/dist/assets/dql-notebook/assets/{TrustBadge-ZuD5N5Ww.js → TrustBadge-ClEYiYeA.js} +1 -1
- package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-DBfsmXes.js +88 -0
- package/dist/assets/dql-notebook/assets/{answer-to-notebook-WAVAYjBv.js → answer-to-notebook-Cg3UyGwh.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-left-L8odLbyN.js → arrow-left-DnYPGqlr.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-right-WIF1V9a9.js → arrow-right-Ct_YGrmU.js} +1 -1
- package/dist/assets/dql-notebook/assets/{book-open-text-BpqWMa4m.js → book-open-text-DULlwbj6.js} +1 -1
- package/dist/assets/dql-notebook/assets/{circle-x-CQBOM0b0.js → circle-x-ByYxoiS9.js} +1 -1
- package/dist/assets/dql-notebook/assets/{dagre.esm-DlZi7NR3.js → dagre.esm-BjYSO53F.js} +1 -1
- package/dist/assets/dql-notebook/assets/{external-link-DYqdQIGp.js → external-link-DprWh9Yf.js} +1 -1
- package/dist/assets/dql-notebook/assets/{grip-vertical-HmUijbwN.js → grip-vertical-CrEEYkXN.js} +1 -1
- package/dist/assets/dql-notebook/assets/{index-Cpx47jCH.js → index-9w93YPF9.js} +127 -126
- package/dist/assets/dql-notebook/assets/index-B3shyZsg.css +1 -0
- package/dist/assets/dql-notebook/assets/link-2-BkW-rkEC.js +6 -0
- package/dist/assets/dql-notebook/assets/{list-tree-DGKqCxmz.js → list-tree-BipBLmIE.js} +1 -1
- package/dist/assets/dql-notebook/assets/{minimize-2-C8dvqCxX.js → minimize-2-BhXsglrO.js} +1 -1
- package/dist/assets/dql-notebook/assets/{panel-right-open-yuVkIo5n.js → panel-right-open-BoCSilYB.js} +1 -1
- package/dist/assets/dql-notebook/assets/{bot-CLR1V6dO.js → play-mdoZawPu.js} +7 -2
- package/dist/assets/dql-notebook/assets/{rotate-ccw-Di0kRnrM.js → rotate-ccw-ELiDRUmj.js} +1 -1
- package/dist/assets/dql-notebook/assets/{semantic-fields-BMQV0li8.js → semantic-fields-DVNRLfeU.js} +1 -1
- package/dist/assets/dql-notebook/assets/{sliders-horizontal-alebptlJ.js → sliders-horizontal-GeUzpmKz.js} +1 -1
- package/dist/assets/dql-notebook/assets/{star-CgCQbnXc.js → star-D63O81Wp.js} +1 -1
- package/dist/assets/dql-notebook/assets/{triangle-alert-SyuSZ4ht.js → triangle-alert-BWrCxQVE.js} +1 -1
- package/dist/assets/dql-notebook/assets/upload-CI-ldXhC.js +6 -0
- package/dist/assets/dql-notebook/assets/usePersistedAgentThreadId-Cv7Yq2hK.js +32 -0
- package/dist/assets/dql-notebook/assets/{user-round-J4PQHxo9.js → user-round-Do21aFGo.js} +1 -1
- package/dist/assets/dql-notebook/assets/{wand-sparkles-c4WDXTCk.js → wand-sparkles-DT7u7F_x.js} +1 -1
- package/dist/assets/dql-notebook/assets/{workflow-NtRLaq7n.js → workflow-DHh2mMbn.js} +1 -1
- package/dist/assets/dql-notebook/assets/{wrench-CS1f1Zv4.js → wrench-7tYr_GKb.js} +1 -1
- package/dist/assets/dql-notebook/assets/{x-CbKEfe5m.js → x-CcYceFMz.js} +1 -1
- package/dist/assets/dql-notebook/index.html +2 -2
- package/dist/commands/app.d.ts.map +1 -1
- package/dist/commands/app.js +65 -133
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/model.js +21 -2
- package/dist/commands/model.js.map +1 -1
- package/dist/llm/providers/dql-agent-provider.d.ts +16 -0
- package/dist/llm/providers/dql-agent-provider.d.ts.map +1 -1
- package/dist/llm/providers/dql-agent-provider.js +65 -2
- package/dist/llm/providers/dql-agent-provider.js.map +1 -1
- package/dist/local-runtime.d.ts +65 -0
- package/dist/local-runtime.d.ts.map +1 -1
- package/dist/local-runtime.js +1008 -125
- package/dist/local-runtime.js.map +1 -1
- package/dist/package.json +10 -10
- package/dist/sql-result-filter.d.ts +9 -0
- package/dist/sql-result-filter.d.ts.map +1 -1
- package/dist/sql-result-filter.js +25 -0
- package/dist/sql-result-filter.js.map +1 -1
- package/package.json +10 -10
- package/dist/assets/dql-notebook/assets/AgentAnswerCard-c8QUo6NH.js +0 -5
- package/dist/assets/dql-notebook/assets/AnalyticsHome-DgwnRW71.js +0 -6
- package/dist/assets/dql-notebook/assets/AppsView-B6LYUpgm.js +0 -4578
- package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-DhBsLCYr.js +0 -22
- package/dist/assets/dql-notebook/assets/GlobalAiRail-1Tgweuu2.js +0 -1
- package/dist/assets/dql-notebook/assets/GovernedContextPage-C7qGrH3d.js +0 -16
- package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-duFXXNV_.js +0 -88
- package/dist/assets/dql-notebook/assets/index-DKu4CZt3.css +0 -1
- package/dist/assets/dql-notebook/assets/upload-BPhfea_E.js +0 -11
- package/dist/assets/dql-notebook/assets/usePersistedAgentThreadId-Bnl9gWhj.js +0 -28
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as Se,i as je,k as Ce,t as Re,r as a,aw as O,a as pe,ax as Ee,ay as Le,az as Te,aA as Be,j as e,p as E,au as H,aB as Ie,l as ge}from"./index-Cpx47jCH.js";import{u as ze,a as We,M as Me,i as Fe,B as Ne,C as Pe,b as Oe,P as De,T as he,c as P,H as xe}from"./dagre.esm-DlZi7NR3.js";import"./react-CRB3T2We.js";const G=[{key:"technical",label:"Technical",title:"Physical sources and dbt transformations",types:Ee},{key:"domain",label:"Domain",title:"Business terms, governed domains, semantic metrics, and certified blocks",types:Le},{key:"end-to-end",label:"End-to-end",title:"Complete path from physical sources through governed meaning to consumption",types:O}],Y=[{type:"block",label:"Blocks"},{type:"app",label:"Apps"},{type:"notebook",label:"Notebooks"},{type:"dashboard",label:"Dashboards"}];function $e(n,h,o="flow",g="LR"){var v;const p=new he.graphlib.Graph().setDefaultEdgeLabel(()=>({})),b=g==="LR";p.setGraph({rankdir:g,ranksep:o==="layered"?120:b?80:60,nodesep:b?40:50,marginx:32,marginy:32});for(const d of n){const y={width:190,height:58};if(o==="layered"&&((v=d.data)!=null&&v.layer)){const x=Ie.indexOf(d.data.layer);x>=0&&(y.rank=x)}p.setNode(d.id,y)}for(const d of h)p.setEdge(d.source,d.target);return he.layout(p),n.map(d=>{const y=p.node(d.id);return{...d,position:{x:y.x-95,y:y.y-29},data:{...d.data,direction:g}}})}function _e({data:n,selected:h}){const o=n.nodeType,g=E[o]??"var(--color-text-tertiary)",p=n.direction??"LR",b=p==="LR"?P.Left:P.Top,v=p==="LR"?P.Right:P.Bottom,d=!!n.dimmed,y=n.status==="certified";return e.jsxs("div",{style:{width:196,display:"flex",alignItems:"center",gap:8,background:"var(--color-bg-card)",border:`1.5px solid ${h?"var(--accent)":"var(--border-default)"}`,borderRadius:9,padding:"9px 11px",boxShadow:h?"0 1px 6px rgba(107,93,211,0.16)":"0 1px 4px rgba(26,26,26,0.05)",opacity:d?.3:1,transition:"opacity 0.15s ease"},children:[e.jsx(xe,{type:"target",position:b,style:{width:7,height:7,background:g,border:"none"}}),e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:g,flexShrink:0}}),e.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[e.jsx("span",{title:n.label,style:{fontSize:11.5,fontWeight:650,color:"var(--color-text-primary)",fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.label}),e.jsx("span",{style:{fontSize:9.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:g},children:H[o]??o})]}),y?e.jsx(ge,{size:12,color:"var(--status-success)",strokeWidth:2,style:{flexShrink:0}}):null,e.jsx(xe,{type:"source",position:v,style:{width:7,height:7,background:g,border:"none"}})]})}const Ae={dagNode:_e};function Qe(){var ae,le,de;const n=Se(je(t=>({lineageFocusNodeId:t.lineageFocusNodeId,themeMode:t.themeMode}))),h=Ce(),o=Re[n.themeMode],[g,p]=a.useState(!0),[b,v]=a.useState({nodes:[],edges:[]}),[d,y]=a.useState({nodes:[],edges:[]}),[x,w]=a.useState(null),[c,L]=a.useState(null),[W,T]=a.useState(!1),[l,s]=a.useState(null),[f,j]=a.useState(Object.fromEntries(O.map(t=>[t,!0]))),[k,Q]=a.useState("flow"),[C,J]=a.useState("LR"),[B,M]=a.useState(null),[D,F]=a.useState(!1),[V,q]=a.useState("block"),[U,K]=a.useState(""),[X,N]=a.useState(!1),[Z,ee]=a.useState(""),[ye,te,fe]=ze([]),[be,oe,me]=We([]),re=a.useCallback(async()=>{p(!0);try{const t=await pe.fetchLineage();v({nodes:t.nodes??[],edges:t.edges??[]})}finally{p(!1)}},[]);a.useEffect(()=>{re()},[re]);const R=a.useMemo(()=>b.nodes.filter(t=>Y.some(r=>r.type===t.type)).sort((t,r)=>t.name.localeCompare(r.name)),[b.nodes]),I=a.useCallback(async t=>{L(t),F(!1),M(null),s(null),T(!0);try{const r=await pe.queryLineage({focus:t,upstreamDepth:12,downstreamDepth:12});y(r.graph??{nodes:[],edges:[]}),w(r.focalNode??null)}finally{T(!1)}},[]);a.useCallback(()=>{L(null),y({nodes:[],edges:[]}),w(null),s(null),M(null),F(!1),h({type:"SET_LINEAGE_FOCUS",nodeId:null})},[h]),a.useEffect(()=>{n.lineageFocusNodeId&&n.lineageFocusNodeId!==c&&I(n.lineageFocusNodeId)},[n.lineageFocusNodeId]);const m=a.useMemo(()=>{const t=new Set(d.nodes.filter(r=>f[r.type]??!0).map(r=>r.id));return{nodes:d.nodes.filter(r=>t.has(r.id)),edges:d.edges.filter(r=>t.has(r.source)&&t.has(r.target))}},[d,f]),z=a.useMemo(()=>{for(const t of G){const r=new Set(t.types);if(O.every(u=>(f[u]??!0)===r.has(u)))return t.key}return"custom"},[f]),ve=a.useCallback(t=>{const r=new Set(t);j(Object.fromEntries(O.map(i=>[i,r.has(i)])))},[]),S=a.useMemo(()=>{if(!B)return null;const t=new Set([B]),r=new Set([B]);let i=!0;for(;i;){i=!1;for(const u of m.edges)t.has(u.target)&&!t.has(u.source)&&(t.add(u.source),i=!0),r.has(u.source)&&!r.has(u.target)&&(r.add(u.target),i=!0)}return new Set([...t,...r])},[B,m.edges]);a.useEffect(()=>{const t=m.nodes.map(i=>({id:i.id,type:"dagNode",selected:i.id===c,position:{x:0,y:0},data:{label:i.name,nodeType:i.type,domain:i.domain,status:i.status,layer:Te(i),dimmed:S?!S.has(i.id):!1}})),r=m.edges.map((i,u)=>{const A=S?S.has(i.source)&&S.has(i.target):!1,ce=A?"var(--accent)":Be[i.type]??"var(--color-text-tertiary)";return{id:`edge-${u}-${i.source}-${i.target}-${i.type}`,source:i.source,target:i.target,style:{stroke:ce,strokeWidth:A?2:1.5,opacity:S&&!A?.25:1},markerEnd:{type:Me.ArrowClosed,color:ce,width:12,height:12}}});te($e(t,r,k,C)),oe(r)},[m,k,C,S,c,oe,te]);const ke=a.useCallback((t,r)=>{M(r.id);const i=m.nodes.find(u=>u.id===r.id)??null;s(i)},[m.nodes]),$=a.useCallback(()=>{M(null),s(null)},[]),_=a.useMemo(()=>{if(!l)return null;const t=d.edges.filter(i=>i.target===l.id).length,r=d.edges.filter(i=>i.source===l.id).length;return{incoming:t,outgoing:r}},[d.edges,l]),ne=(x==null?void 0:x.name)??((ae=R.find(t=>t.id===c))==null?void 0:ae.name)??c??"",we=(x==null?void 0:x.type)??((le=R.find(t=>t.id===c))==null?void 0:le.type)??"block",ie=Z.trim().toLowerCase(),se=(ie?R.filter(t=>t.name.toLowerCase().includes(ie)):R).slice(0,40);return g?e.jsx("div",{style:{padding:16,color:o.textMuted,fontSize:12},children:"Loading lineage graph..."}):b.nodes.length===0?e.jsx("div",{style:{padding:16,color:o.textMuted,fontSize:12},children:"No lineage graph available yet."}):c?e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--color-bg-primary)"},children:[e.jsx("div",{style:{padding:8,borderBottom:`1px solid ${o.headerBorder}`,background:o.sidebarBg},children:e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{onClick:()=>F(t=>!t),title:"Change the traced entity",style:{display:"inline-flex",alignItems:"center",gap:7,height:30,padding:"0 11px",borderRadius:8,border:`1px solid ${D?o.accent:o.headerBorder}`,background:D?"var(--accent-dim)":o.cellBg,color:o.textPrimary,cursor:"pointer",fontFamily:o.font,maxWidth:320},children:[e.jsx("span",{style:{fontSize:10.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:o.textMuted},children:"Tracing"}),e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[we]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{fontSize:12.5,fontWeight:650,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ne}),e.jsx("span",{style:{fontSize:9,color:o.textMuted},children:"▾"})]}),D&&e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:()=>F(!1),style:{position:"fixed",inset:0,zIndex:30}}),e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:31,width:340,background:o.cellBg,border:`1px solid ${o.headerBorder}`,borderRadius:11,boxShadow:"0 10px 30px rgba(26,26,26,0.14)",padding:12},children:e.jsx(ue,{t:o,entities:R,activeType:V,onTypeChange:q,query:U,onQueryChange:K,onSelect:t=>void I(t),focalId:c,listHeight:240})})]})]}),e.jsxs("div",{style:{position:"relative",flex:"0 1 300px",minWidth:160},children:[e.jsxs("svg",{style:{position:"absolute",left:9,top:"50%",transform:"translateY(-50%)",color:o.textMuted,pointerEvents:"none"},width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"m21 21-4.3-4.3"})]}),e.jsx("input",{value:Z,onChange:t=>{ee(t.target.value),N(!0)},onFocus:()=>N(!0),placeholder:"Search another block, app, or notebook…",style:{width:"100%",boxSizing:"border-box",height:30,padding:"0 10px 0 28px",borderRadius:8,border:`1px solid ${X?o.accent:o.headerBorder}`,background:"var(--color-bg-sunken)",color:o.textPrimary,fontSize:12,fontFamily:o.font,outline:"none"}}),X&&e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:()=>N(!1),style:{position:"fixed",inset:0,zIndex:30}}),e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:31,width:"min(340px, 90vw)",maxHeight:300,overflow:"auto",background:o.cellBg,border:`1px solid ${o.headerBorder}`,borderRadius:11,boxShadow:"0 10px 30px rgba(26,26,26,0.14)",padding:4},children:se.length===0?e.jsx("div",{style:{padding:"12px 11px",fontSize:12,color:o.textMuted,fontFamily:o.font},children:"No matching block, app, or notebook."}):se.map(t=>e.jsxs("button",{onClick:()=>{I(t.id),ee(""),N(!1)},style:{width:"100%",display:"flex",alignItems:"center",gap:9,textAlign:"left",padding:"8px 10px",border:"none",borderRadius:7,background:t.id===c?"var(--accent-dim)":"transparent",cursor:"pointer",fontFamily:o.font},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[t.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:550,color:o.textPrimary,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),e.jsx("span",{style:{fontSize:9.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:o.textMuted,flexShrink:0},children:H[t.type]??t.type})]},t.id))})]})]}),e.jsx("div",{style:{width:1,height:20,background:o.headerBorder,margin:"0 2px"}}),e.jsxs("div",{style:{display:"flex",borderRadius:6,border:`1px solid ${o.headerBorder}`,overflow:"hidden"},children:[e.jsx("button",{onClick:()=>Q("flow"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",cursor:"pointer",background:k==="flow"?"var(--color-bg-tertiary)":"transparent",color:k==="flow"?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:"Flow"}),e.jsx("button",{onClick:()=>Q("layered"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",borderLeft:`1px solid ${o.headerBorder}`,cursor:"pointer",background:k==="layered"?"var(--color-bg-tertiary)":"transparent",color:k==="layered"?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:"Layered"})]}),e.jsxs("div",{style:{display:"flex",borderRadius:6,border:`1px solid ${o.headerBorder}`,overflow:"hidden",marginRight:4},children:[e.jsxs("button",{title:"Horizontal layout (left → right)",onClick:()=>J("LR"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",cursor:"pointer",background:C==="LR"?"var(--color-bg-tertiary)":"transparent",color:C==="LR"?"var(--color-text-primary)":"var(--color-text-tertiary)",display:"flex",alignItems:"center",gap:3},children:[e.jsxs("svg",{width:"14",height:"10",viewBox:"0 0 14 10",fill:"none",children:[e.jsx("rect",{x:"0",y:"2",width:"4",height:"6",rx:"1",fill:"currentColor",opacity:"0.7"}),e.jsx("line",{x1:"4",y1:"5",x2:"10",y2:"5",stroke:"currentColor",strokeWidth:"1.2"}),e.jsx("path",{d:"M9 3l2 2-2 2",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),e.jsx("rect",{x:"10",y:"2",width:"4",height:"6",rx:"1",fill:"currentColor"})]}),"LR"]}),e.jsxs("button",{title:"Vertical layout (top → bottom)",onClick:()=>J("TB"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",borderLeft:`1px solid ${o.headerBorder}`,cursor:"pointer",background:C==="TB"?"var(--color-bg-tertiary)":"transparent",color:C==="TB"?"var(--color-text-primary)":"var(--color-text-tertiary)",display:"flex",alignItems:"center",gap:3},children:[e.jsxs("svg",{width:"10",height:"14",viewBox:"0 0 10 14",fill:"none",children:[e.jsx("rect",{x:"2",y:"0",width:"6",height:"4",rx:"1",fill:"currentColor",opacity:"0.7"}),e.jsx("line",{x1:"5",y1:"4",x2:"5",y2:"10",stroke:"currentColor",strokeWidth:"1.2"}),e.jsx("path",{d:"M3 9l2 2 2-2",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),e.jsx("rect",{x:"2",y:"10",width:"6",height:"4",rx:"1",fill:"currentColor"})]}),"TB"]})]}),e.jsx("div",{role:"group","aria-label":"Lineage view",style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${o.headerBorder}`,borderRadius:7,background:o.appBg,marginRight:4},children:G.map(t=>e.jsx("button",{onClick:()=>ve(t.types),title:t.title,"aria-pressed":z===t.key,style:{padding:"4px 11px",fontSize:11.5,fontWeight:600,border:"none",borderRadius:5,cursor:"pointer",fontFamily:o.font,whiteSpace:"nowrap",background:z===t.key?"var(--accent-dim)":"transparent",color:z===t.key?o.accent:o.textMuted},children:t.label},t.key))}),B&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1}}),e.jsx("button",{onClick:$,style:{borderRadius:7,border:`1px solid ${o.accent}`,background:"var(--accent-dim)",color:o.accent,cursor:"pointer",fontSize:11.5,fontWeight:650,padding:"5px 11px",whiteSpace:"nowrap"},children:"Show all"})]})]})}),e.jsx("div",{style:{flex:1,position:"relative"},children:e.jsxs(Fe,{nodes:ye,edges:be,onNodesChange:fe,onEdgesChange:me,onNodeClick:ke,onPaneClick:$,nodeTypes:Ae,fitView:!0,fitViewOptions:{padding:.18},proOptions:{hideAttribution:!0},style:{background:"var(--bg-canvas)"},children:[e.jsx(Ne,{color:"var(--border-strong)",gap:22,size:1}),e.jsx(Pe,{showInteractive:!1}),e.jsx(Oe,{nodeColor:t=>{var r;return E[((r=t.data)==null?void 0:r.nodeType)??"source_table"]??"var(--color-text-tertiary)"},maskColor:"color-mix(in srgb, var(--color-bg-primary) 55%, transparent)",style:{background:"var(--color-bg-sunken)",border:"1px solid var(--color-border-primary)"}}),e.jsx(De,{position:"bottom-left",children:l?e.jsxs("div",{style:{width:264,background:"var(--color-bg-card)",border:"1px solid var(--color-border-primary)",borderRadius:11,boxShadow:"0 8px 26px rgba(26,26,26,0.13)",padding:"12px 14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[l.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:700,color:"var(--color-text-primary)",fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.name}),e.jsx("button",{onClick:$,title:"Clear focus",style:{width:20,height:20,borderRadius:5,border:"none",background:"none",color:"var(--color-text-tertiary)",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0,flexShrink:0},children:"×"})]}),e.jsxs("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",marginTop:3},children:[H[l.type]??l.type,_?` · ${_.incoming} upstream · ${_.outgoing} downstream`:""]}),l.domain?e.jsxs("div",{style:{fontSize:11.5,color:"var(--color-text-secondary)",lineHeight:1.5,marginTop:7},children:["Domain: ",l.domain]}):null,e.jsxs("div",{style:{display:"flex",gap:8,marginTop:10},children:[e.jsx("button",{onClick:()=>{l&&l.id!==c&&I(l.id)},disabled:!l||l.id===c,title:(l==null?void 0:l.id)===c?"Already the traced entity":"Re-scope lineage to this node",style:{display:"inline-flex",alignItems:"center",gap:5,height:26,padding:"0 10px",borderRadius:6,border:"none",background:"var(--accent)",color:"#fff",fontSize:11,fontWeight:650,cursor:(l==null?void 0:l.id)===c?"default":"pointer",opacity:(l==null?void 0:l.id)===c?.5:1},children:"Trace from here"}),e.jsx("button",{onClick:()=>h({type:"OPEN_GLOBAL_AI",autoRun:{text:`Explain the lineage of ${l.name} — where does it come from and what consumes it?`}}),style:{display:"inline-flex",alignItems:"center",gap:5,height:26,padding:"0 10px",borderRadius:6,border:"1px solid var(--color-border-primary)",background:"var(--color-bg-card)",color:"var(--color-text-secondary)",fontSize:11,fontWeight:600,cursor:"pointer"},children:"Ask about this"})]})]}):null})]})}),e.jsxs("div",{style:{height:28,flexShrink:0,borderTop:"1px solid var(--border-subtle)",background:"var(--color-bg-card)",display:"flex",alignItems:"center",gap:14,padding:"0 14px",fontSize:10.5,color:"var(--color-text-tertiary)"},children:[e.jsxs("span",{children:[z==="custom"?"Custom":(de=G.find(t=>t.key===z))==null?void 0:de.label," lineage of ",ne," · ",m.nodes.length," nodes · ",m.edges.length," edges",W?" · loading…":""]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:999,background:"var(--status-success)"}}),"Compiled from the dbt manifest"]}),e.jsx("div",{style:{flex:1}}),e.jsx("span",{children:"Click a node to focus its path · click the canvas to clear"})]})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--color-bg-primary)",alignItems:"center",justifyContent:"center",padding:24,overflow:"auto"},children:e.jsxs("div",{style:{width:"min(560px, 100%)",border:`1px solid ${o.headerBorder}`,borderRadius:14,background:o.cellBg,padding:"22px 22px 18px",boxShadow:"0 1px 4px rgba(26,26,26,0.05)"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:o.textPrimary,fontFamily:o.font},children:"Trace lineage"}),e.jsx("div",{style:{fontSize:12.5,color:o.textMuted,marginTop:3,lineHeight:1.5,fontFamily:o.font},children:"Pick a block, app, or notebook to see its upstream sources and downstream consumers — no project-wide noise."}),e.jsx("div",{style:{marginTop:16},children:e.jsx(ue,{t:o,entities:R,activeType:V,onTypeChange:q,query:U,onQueryChange:K,onSelect:t=>void I(t),focalId:c,listHeight:300})})]})})}function ue({t:n,entities:h,activeType:o,onTypeChange:g,query:p,onQueryChange:b,onSelect:v,focalId:d,listHeight:y}){var T,l;const x=Y.filter(s=>h.some(f=>f.type===s.type)),w=x.some(s=>s.type===o)?o:((T=x[0])==null?void 0:T.type)??o,c=p.trim().toLowerCase(),L=h.filter(s=>s.type===w).filter(s=>!c||s.name.toLowerCase().includes(c)),W=((l=Y.find(s=>s.type===w))==null?void 0:l.label)??"items";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9,minWidth:0},children:[e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${n.headerBorder}`,borderRadius:8,background:n.appBg,alignSelf:"flex-start",flexWrap:"wrap"},children:x.map(s=>{const f=s.type===w,j=h.filter(k=>k.type===s.type).length;return e.jsxs("button",{onClick:()=>g(s.type),style:{display:"inline-flex",alignItems:"center",gap:6,border:"none",borderRadius:6,padding:"5px 11px",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:n.font,background:f?"var(--accent-dim)":"transparent",color:f?n.accent:n.textMuted},children:[s.label,e.jsx("span",{style:{fontSize:10.5,color:f?n.accent:n.textMuted,opacity:.8},children:j})]},s.type)})}),e.jsx("input",{value:p,onChange:s=>b(s.target.value),placeholder:`Search ${W.toLowerCase()}…`,style:{padding:"8px 10px",borderRadius:8,border:`1px solid ${n.headerBorder}`,background:"var(--color-bg-sunken)",color:n.textPrimary,fontSize:12,fontFamily:n.font,outline:"none"}}),e.jsx("div",{style:{maxHeight:y,overflow:"auto",border:`1px solid ${n.headerBorder}`,borderRadius:8},children:L.length===0?e.jsx("div",{style:{padding:"14px 12px",fontSize:12,color:n.textMuted,fontFamily:n.font},children:h.some(s=>s.type===w)?"No matches.":`No ${W.toLowerCase()} in this project yet.`}):L.map((s,f)=>{const j=s.id===d;return e.jsxs("button",{onClick:()=>v(s.id),style:{width:"100%",display:"flex",alignItems:"center",gap:9,textAlign:"left",padding:"9px 11px",border:"none",borderTop:f===0?"none":`1px solid ${n.headerBorder}`,background:j?"var(--accent-dim)":"transparent",cursor:"pointer",fontFamily:n.font},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[s.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:j?650:500,color:n.textPrimary,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name}),s.status==="certified"?e.jsx(ge,{size:12,color:"var(--status-success)",strokeWidth:2,style:{flexShrink:0}}):null]},s.id)})})]})}export{Qe as LineageDAG};
|
|
1
|
+
import{h as Se,i as je,k as Ce,t as Re,r as a,aw as O,a as pe,ax as Ee,ay as Le,az as Te,aA as Be,j as e,p as E,au as H,aB as Ie,l as ge}from"./index-9w93YPF9.js";import{u as ze,a as We,M as Me,i as Fe,B as Ne,C as Pe,b as Oe,P as De,T as he,c as P,H as xe}from"./dagre.esm-BjYSO53F.js";import"./react-CRB3T2We.js";const G=[{key:"technical",label:"Technical",title:"Physical sources and dbt transformations",types:Ee},{key:"domain",label:"Domain",title:"Business terms, governed domains, semantic metrics, and certified blocks",types:Le},{key:"end-to-end",label:"End-to-end",title:"Complete path from physical sources through governed meaning to consumption",types:O}],Y=[{type:"block",label:"Blocks"},{type:"app",label:"Apps"},{type:"notebook",label:"Notebooks"},{type:"dashboard",label:"Dashboards"}];function $e(n,h,o="flow",g="LR"){var v;const p=new he.graphlib.Graph().setDefaultEdgeLabel(()=>({})),b=g==="LR";p.setGraph({rankdir:g,ranksep:o==="layered"?120:b?80:60,nodesep:b?40:50,marginx:32,marginy:32});for(const d of n){const y={width:190,height:58};if(o==="layered"&&((v=d.data)!=null&&v.layer)){const x=Ie.indexOf(d.data.layer);x>=0&&(y.rank=x)}p.setNode(d.id,y)}for(const d of h)p.setEdge(d.source,d.target);return he.layout(p),n.map(d=>{const y=p.node(d.id);return{...d,position:{x:y.x-95,y:y.y-29},data:{...d.data,direction:g}}})}function _e({data:n,selected:h}){const o=n.nodeType,g=E[o]??"var(--color-text-tertiary)",p=n.direction??"LR",b=p==="LR"?P.Left:P.Top,v=p==="LR"?P.Right:P.Bottom,d=!!n.dimmed,y=n.status==="certified";return e.jsxs("div",{style:{width:196,display:"flex",alignItems:"center",gap:8,background:"var(--color-bg-card)",border:`1.5px solid ${h?"var(--accent)":"var(--border-default)"}`,borderRadius:9,padding:"9px 11px",boxShadow:h?"0 1px 6px rgba(107,93,211,0.16)":"0 1px 4px rgba(26,26,26,0.05)",opacity:d?.3:1,transition:"opacity 0.15s ease"},children:[e.jsx(xe,{type:"target",position:b,style:{width:7,height:7,background:g,border:"none"}}),e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:g,flexShrink:0}}),e.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[e.jsx("span",{title:n.label,style:{fontSize:11.5,fontWeight:650,color:"var(--color-text-primary)",fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.label}),e.jsx("span",{style:{fontSize:9.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:g},children:H[o]??o})]}),y?e.jsx(ge,{size:12,color:"var(--status-success)",strokeWidth:2,style:{flexShrink:0}}):null,e.jsx(xe,{type:"source",position:v,style:{width:7,height:7,background:g,border:"none"}})]})}const Ae={dagNode:_e};function Qe(){var ae,le,de;const n=Se(je(t=>({lineageFocusNodeId:t.lineageFocusNodeId,themeMode:t.themeMode}))),h=Ce(),o=Re[n.themeMode],[g,p]=a.useState(!0),[b,v]=a.useState({nodes:[],edges:[]}),[d,y]=a.useState({nodes:[],edges:[]}),[x,w]=a.useState(null),[c,L]=a.useState(null),[W,T]=a.useState(!1),[l,s]=a.useState(null),[f,j]=a.useState(Object.fromEntries(O.map(t=>[t,!0]))),[k,Q]=a.useState("flow"),[C,J]=a.useState("LR"),[B,M]=a.useState(null),[D,F]=a.useState(!1),[V,q]=a.useState("block"),[U,K]=a.useState(""),[X,N]=a.useState(!1),[Z,ee]=a.useState(""),[ye,te,fe]=ze([]),[be,oe,me]=We([]),re=a.useCallback(async()=>{p(!0);try{const t=await pe.fetchLineage();v({nodes:t.nodes??[],edges:t.edges??[]})}finally{p(!1)}},[]);a.useEffect(()=>{re()},[re]);const R=a.useMemo(()=>b.nodes.filter(t=>Y.some(r=>r.type===t.type)).sort((t,r)=>t.name.localeCompare(r.name)),[b.nodes]),I=a.useCallback(async t=>{L(t),F(!1),M(null),s(null),T(!0);try{const r=await pe.queryLineage({focus:t,upstreamDepth:12,downstreamDepth:12});y(r.graph??{nodes:[],edges:[]}),w(r.focalNode??null)}finally{T(!1)}},[]);a.useCallback(()=>{L(null),y({nodes:[],edges:[]}),w(null),s(null),M(null),F(!1),h({type:"SET_LINEAGE_FOCUS",nodeId:null})},[h]),a.useEffect(()=>{n.lineageFocusNodeId&&n.lineageFocusNodeId!==c&&I(n.lineageFocusNodeId)},[n.lineageFocusNodeId]);const m=a.useMemo(()=>{const t=new Set(d.nodes.filter(r=>f[r.type]??!0).map(r=>r.id));return{nodes:d.nodes.filter(r=>t.has(r.id)),edges:d.edges.filter(r=>t.has(r.source)&&t.has(r.target))}},[d,f]),z=a.useMemo(()=>{for(const t of G){const r=new Set(t.types);if(O.every(u=>(f[u]??!0)===r.has(u)))return t.key}return"custom"},[f]),ve=a.useCallback(t=>{const r=new Set(t);j(Object.fromEntries(O.map(i=>[i,r.has(i)])))},[]),S=a.useMemo(()=>{if(!B)return null;const t=new Set([B]),r=new Set([B]);let i=!0;for(;i;){i=!1;for(const u of m.edges)t.has(u.target)&&!t.has(u.source)&&(t.add(u.source),i=!0),r.has(u.source)&&!r.has(u.target)&&(r.add(u.target),i=!0)}return new Set([...t,...r])},[B,m.edges]);a.useEffect(()=>{const t=m.nodes.map(i=>({id:i.id,type:"dagNode",selected:i.id===c,position:{x:0,y:0},data:{label:i.name,nodeType:i.type,domain:i.domain,status:i.status,layer:Te(i),dimmed:S?!S.has(i.id):!1}})),r=m.edges.map((i,u)=>{const A=S?S.has(i.source)&&S.has(i.target):!1,ce=A?"var(--accent)":Be[i.type]??"var(--color-text-tertiary)";return{id:`edge-${u}-${i.source}-${i.target}-${i.type}`,source:i.source,target:i.target,style:{stroke:ce,strokeWidth:A?2:1.5,opacity:S&&!A?.25:1},markerEnd:{type:Me.ArrowClosed,color:ce,width:12,height:12}}});te($e(t,r,k,C)),oe(r)},[m,k,C,S,c,oe,te]);const ke=a.useCallback((t,r)=>{M(r.id);const i=m.nodes.find(u=>u.id===r.id)??null;s(i)},[m.nodes]),$=a.useCallback(()=>{M(null),s(null)},[]),_=a.useMemo(()=>{if(!l)return null;const t=d.edges.filter(i=>i.target===l.id).length,r=d.edges.filter(i=>i.source===l.id).length;return{incoming:t,outgoing:r}},[d.edges,l]),ne=(x==null?void 0:x.name)??((ae=R.find(t=>t.id===c))==null?void 0:ae.name)??c??"",we=(x==null?void 0:x.type)??((le=R.find(t=>t.id===c))==null?void 0:le.type)??"block",ie=Z.trim().toLowerCase(),se=(ie?R.filter(t=>t.name.toLowerCase().includes(ie)):R).slice(0,40);return g?e.jsx("div",{style:{padding:16,color:o.textMuted,fontSize:12},children:"Loading lineage graph..."}):b.nodes.length===0?e.jsx("div",{style:{padding:16,color:o.textMuted,fontSize:12},children:"No lineage graph available yet."}):c?e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--color-bg-primary)"},children:[e.jsx("div",{style:{padding:8,borderBottom:`1px solid ${o.headerBorder}`,background:o.sidebarBg},children:e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{onClick:()=>F(t=>!t),title:"Change the traced entity",style:{display:"inline-flex",alignItems:"center",gap:7,height:30,padding:"0 11px",borderRadius:8,border:`1px solid ${D?o.accent:o.headerBorder}`,background:D?"var(--accent-dim)":o.cellBg,color:o.textPrimary,cursor:"pointer",fontFamily:o.font,maxWidth:320},children:[e.jsx("span",{style:{fontSize:10.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:o.textMuted},children:"Tracing"}),e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[we]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{fontSize:12.5,fontWeight:650,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ne}),e.jsx("span",{style:{fontSize:9,color:o.textMuted},children:"▾"})]}),D&&e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:()=>F(!1),style:{position:"fixed",inset:0,zIndex:30}}),e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:31,width:340,background:o.cellBg,border:`1px solid ${o.headerBorder}`,borderRadius:11,boxShadow:"0 10px 30px rgba(26,26,26,0.14)",padding:12},children:e.jsx(ue,{t:o,entities:R,activeType:V,onTypeChange:q,query:U,onQueryChange:K,onSelect:t=>void I(t),focalId:c,listHeight:240})})]})]}),e.jsxs("div",{style:{position:"relative",flex:"0 1 300px",minWidth:160},children:[e.jsxs("svg",{style:{position:"absolute",left:9,top:"50%",transform:"translateY(-50%)",color:o.textMuted,pointerEvents:"none"},width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"m21 21-4.3-4.3"})]}),e.jsx("input",{value:Z,onChange:t=>{ee(t.target.value),N(!0)},onFocus:()=>N(!0),placeholder:"Search another block, app, or notebook…",style:{width:"100%",boxSizing:"border-box",height:30,padding:"0 10px 0 28px",borderRadius:8,border:`1px solid ${X?o.accent:o.headerBorder}`,background:"var(--color-bg-sunken)",color:o.textPrimary,fontSize:12,fontFamily:o.font,outline:"none"}}),X&&e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:()=>N(!1),style:{position:"fixed",inset:0,zIndex:30}}),e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:31,width:"min(340px, 90vw)",maxHeight:300,overflow:"auto",background:o.cellBg,border:`1px solid ${o.headerBorder}`,borderRadius:11,boxShadow:"0 10px 30px rgba(26,26,26,0.14)",padding:4},children:se.length===0?e.jsx("div",{style:{padding:"12px 11px",fontSize:12,color:o.textMuted,fontFamily:o.font},children:"No matching block, app, or notebook."}):se.map(t=>e.jsxs("button",{onClick:()=>{I(t.id),ee(""),N(!1)},style:{width:"100%",display:"flex",alignItems:"center",gap:9,textAlign:"left",padding:"8px 10px",border:"none",borderRadius:7,background:t.id===c?"var(--accent-dim)":"transparent",cursor:"pointer",fontFamily:o.font},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[t.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:550,color:o.textPrimary,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),e.jsx("span",{style:{fontSize:9.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:o.textMuted,flexShrink:0},children:H[t.type]??t.type})]},t.id))})]})]}),e.jsx("div",{style:{width:1,height:20,background:o.headerBorder,margin:"0 2px"}}),e.jsxs("div",{style:{display:"flex",borderRadius:6,border:`1px solid ${o.headerBorder}`,overflow:"hidden"},children:[e.jsx("button",{onClick:()=>Q("flow"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",cursor:"pointer",background:k==="flow"?"var(--color-bg-tertiary)":"transparent",color:k==="flow"?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:"Flow"}),e.jsx("button",{onClick:()=>Q("layered"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",borderLeft:`1px solid ${o.headerBorder}`,cursor:"pointer",background:k==="layered"?"var(--color-bg-tertiary)":"transparent",color:k==="layered"?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:"Layered"})]}),e.jsxs("div",{style:{display:"flex",borderRadius:6,border:`1px solid ${o.headerBorder}`,overflow:"hidden",marginRight:4},children:[e.jsxs("button",{title:"Horizontal layout (left → right)",onClick:()=>J("LR"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",cursor:"pointer",background:C==="LR"?"var(--color-bg-tertiary)":"transparent",color:C==="LR"?"var(--color-text-primary)":"var(--color-text-tertiary)",display:"flex",alignItems:"center",gap:3},children:[e.jsxs("svg",{width:"14",height:"10",viewBox:"0 0 14 10",fill:"none",children:[e.jsx("rect",{x:"0",y:"2",width:"4",height:"6",rx:"1",fill:"currentColor",opacity:"0.7"}),e.jsx("line",{x1:"4",y1:"5",x2:"10",y2:"5",stroke:"currentColor",strokeWidth:"1.2"}),e.jsx("path",{d:"M9 3l2 2-2 2",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),e.jsx("rect",{x:"10",y:"2",width:"4",height:"6",rx:"1",fill:"currentColor"})]}),"LR"]}),e.jsxs("button",{title:"Vertical layout (top → bottom)",onClick:()=>J("TB"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",borderLeft:`1px solid ${o.headerBorder}`,cursor:"pointer",background:C==="TB"?"var(--color-bg-tertiary)":"transparent",color:C==="TB"?"var(--color-text-primary)":"var(--color-text-tertiary)",display:"flex",alignItems:"center",gap:3},children:[e.jsxs("svg",{width:"10",height:"14",viewBox:"0 0 10 14",fill:"none",children:[e.jsx("rect",{x:"2",y:"0",width:"6",height:"4",rx:"1",fill:"currentColor",opacity:"0.7"}),e.jsx("line",{x1:"5",y1:"4",x2:"5",y2:"10",stroke:"currentColor",strokeWidth:"1.2"}),e.jsx("path",{d:"M3 9l2 2 2-2",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),e.jsx("rect",{x:"2",y:"10",width:"6",height:"4",rx:"1",fill:"currentColor"})]}),"TB"]})]}),e.jsx("div",{role:"group","aria-label":"Lineage view",style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${o.headerBorder}`,borderRadius:7,background:o.appBg,marginRight:4},children:G.map(t=>e.jsx("button",{onClick:()=>ve(t.types),title:t.title,"aria-pressed":z===t.key,style:{padding:"4px 11px",fontSize:11.5,fontWeight:600,border:"none",borderRadius:5,cursor:"pointer",fontFamily:o.font,whiteSpace:"nowrap",background:z===t.key?"var(--accent-dim)":"transparent",color:z===t.key?o.accent:o.textMuted},children:t.label},t.key))}),B&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1}}),e.jsx("button",{onClick:$,style:{borderRadius:7,border:`1px solid ${o.accent}`,background:"var(--accent-dim)",color:o.accent,cursor:"pointer",fontSize:11.5,fontWeight:650,padding:"5px 11px",whiteSpace:"nowrap"},children:"Show all"})]})]})}),e.jsx("div",{style:{flex:1,position:"relative"},children:e.jsxs(Fe,{nodes:ye,edges:be,onNodesChange:fe,onEdgesChange:me,onNodeClick:ke,onPaneClick:$,nodeTypes:Ae,fitView:!0,fitViewOptions:{padding:.18},proOptions:{hideAttribution:!0},style:{background:"var(--bg-canvas)"},children:[e.jsx(Ne,{color:"var(--border-strong)",gap:22,size:1}),e.jsx(Pe,{showInteractive:!1}),e.jsx(Oe,{nodeColor:t=>{var r;return E[((r=t.data)==null?void 0:r.nodeType)??"source_table"]??"var(--color-text-tertiary)"},maskColor:"color-mix(in srgb, var(--color-bg-primary) 55%, transparent)",style:{background:"var(--color-bg-sunken)",border:"1px solid var(--color-border-primary)"}}),e.jsx(De,{position:"bottom-left",children:l?e.jsxs("div",{style:{width:264,background:"var(--color-bg-card)",border:"1px solid var(--color-border-primary)",borderRadius:11,boxShadow:"0 8px 26px rgba(26,26,26,0.13)",padding:"12px 14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[l.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:700,color:"var(--color-text-primary)",fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.name}),e.jsx("button",{onClick:$,title:"Clear focus",style:{width:20,height:20,borderRadius:5,border:"none",background:"none",color:"var(--color-text-tertiary)",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0,flexShrink:0},children:"×"})]}),e.jsxs("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",marginTop:3},children:[H[l.type]??l.type,_?` · ${_.incoming} upstream · ${_.outgoing} downstream`:""]}),l.domain?e.jsxs("div",{style:{fontSize:11.5,color:"var(--color-text-secondary)",lineHeight:1.5,marginTop:7},children:["Domain: ",l.domain]}):null,e.jsxs("div",{style:{display:"flex",gap:8,marginTop:10},children:[e.jsx("button",{onClick:()=>{l&&l.id!==c&&I(l.id)},disabled:!l||l.id===c,title:(l==null?void 0:l.id)===c?"Already the traced entity":"Re-scope lineage to this node",style:{display:"inline-flex",alignItems:"center",gap:5,height:26,padding:"0 10px",borderRadius:6,border:"none",background:"var(--accent)",color:"#fff",fontSize:11,fontWeight:650,cursor:(l==null?void 0:l.id)===c?"default":"pointer",opacity:(l==null?void 0:l.id)===c?.5:1},children:"Trace from here"}),e.jsx("button",{onClick:()=>h({type:"OPEN_GLOBAL_AI",autoRun:{text:`Explain the lineage of ${l.name} — where does it come from and what consumes it?`}}),style:{display:"inline-flex",alignItems:"center",gap:5,height:26,padding:"0 10px",borderRadius:6,border:"1px solid var(--color-border-primary)",background:"var(--color-bg-card)",color:"var(--color-text-secondary)",fontSize:11,fontWeight:600,cursor:"pointer"},children:"Ask about this"})]})]}):null})]})}),e.jsxs("div",{style:{height:28,flexShrink:0,borderTop:"1px solid var(--border-subtle)",background:"var(--color-bg-card)",display:"flex",alignItems:"center",gap:14,padding:"0 14px",fontSize:10.5,color:"var(--color-text-tertiary)"},children:[e.jsxs("span",{children:[z==="custom"?"Custom":(de=G.find(t=>t.key===z))==null?void 0:de.label," lineage of ",ne," · ",m.nodes.length," nodes · ",m.edges.length," edges",W?" · loading…":""]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:999,background:"var(--status-success)"}}),"Compiled from the dbt manifest"]}),e.jsx("div",{style:{flex:1}}),e.jsx("span",{children:"Click a node to focus its path · click the canvas to clear"})]})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--color-bg-primary)",alignItems:"center",justifyContent:"center",padding:24,overflow:"auto"},children:e.jsxs("div",{style:{width:"min(560px, 100%)",border:`1px solid ${o.headerBorder}`,borderRadius:14,background:o.cellBg,padding:"22px 22px 18px",boxShadow:"0 1px 4px rgba(26,26,26,0.05)"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:o.textPrimary,fontFamily:o.font},children:"Trace lineage"}),e.jsx("div",{style:{fontSize:12.5,color:o.textMuted,marginTop:3,lineHeight:1.5,fontFamily:o.font},children:"Pick a block, app, or notebook to see its upstream sources and downstream consumers — no project-wide noise."}),e.jsx("div",{style:{marginTop:16},children:e.jsx(ue,{t:o,entities:R,activeType:V,onTypeChange:q,query:U,onQueryChange:K,onSelect:t=>void I(t),focalId:c,listHeight:300})})]})})}function ue({t:n,entities:h,activeType:o,onTypeChange:g,query:p,onQueryChange:b,onSelect:v,focalId:d,listHeight:y}){var T,l;const x=Y.filter(s=>h.some(f=>f.type===s.type)),w=x.some(s=>s.type===o)?o:((T=x[0])==null?void 0:T.type)??o,c=p.trim().toLowerCase(),L=h.filter(s=>s.type===w).filter(s=>!c||s.name.toLowerCase().includes(c)),W=((l=Y.find(s=>s.type===w))==null?void 0:l.label)??"items";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9,minWidth:0},children:[e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${n.headerBorder}`,borderRadius:8,background:n.appBg,alignSelf:"flex-start",flexWrap:"wrap"},children:x.map(s=>{const f=s.type===w,j=h.filter(k=>k.type===s.type).length;return e.jsxs("button",{onClick:()=>g(s.type),style:{display:"inline-flex",alignItems:"center",gap:6,border:"none",borderRadius:6,padding:"5px 11px",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:n.font,background:f?"var(--accent-dim)":"transparent",color:f?n.accent:n.textMuted},children:[s.label,e.jsx("span",{style:{fontSize:10.5,color:f?n.accent:n.textMuted,opacity:.8},children:j})]},s.type)})}),e.jsx("input",{value:p,onChange:s=>b(s.target.value),placeholder:`Search ${W.toLowerCase()}…`,style:{padding:"8px 10px",borderRadius:8,border:`1px solid ${n.headerBorder}`,background:"var(--color-bg-sunken)",color:n.textPrimary,fontSize:12,fontFamily:n.font,outline:"none"}}),e.jsx("div",{style:{maxHeight:y,overflow:"auto",border:`1px solid ${n.headerBorder}`,borderRadius:8},children:L.length===0?e.jsx("div",{style:{padding:"14px 12px",fontSize:12,color:n.textMuted,fontFamily:n.font},children:h.some(s=>s.type===w)?"No matches.":`No ${W.toLowerCase()} in this project yet.`}):L.map((s,f)=>{const j=s.id===d;return e.jsxs("button",{onClick:()=>v(s.id),style:{width:"100%",display:"flex",alignItems:"center",gap:9,textAlign:"left",padding:"9px 11px",border:"none",borderTop:f===0?"none":`1px solid ${n.headerBorder}`,background:j?"var(--accent-dim)":"transparent",cursor:"pointer",fontFamily:n.font},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[s.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:j?650:500,color:n.textPrimary,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name}),s.status==="certified"?e.jsx(ge,{size:12,color:"var(--status-success)",strokeWidth:2,style:{flexShrink:0}}):null]},s.id)})})]})}export{Qe as LineageDAG};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as O,t as N,r as u,a as A,j as t,p as C,q as E,au as W,av as R}from"./index-Cpx47jCH.js";import{M as _}from"./MiniLineageGraph-CotnRuxa.js";import{LineageDAG as H}from"./LineageDAG-BJ6xz06u.js";import{A as F}from"./arrow-left-L8odLbyN.js";import{L as G}from"./list-tree-DGKqCxmz.js";import"./react-CRB3T2We.js";import"./dagre.esm-DlZi7NR3.js";function U(i){return i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function q(i){if(i==null)return null;if(typeof i=="string")return i.trim()||null;if(typeof i=="number"||typeof i=="boolean")return String(i);if(Array.isArray(i)){const n=i.map(e=>e==null?null:typeof e=="string"||typeof e=="number"||typeof e=="boolean"?String(e):null).filter(e=>!!e);return n.length>0?n.join(", "):null}return null}function V(i){return i?i.type==="term"?"Business definition used by blocks, views, dashboards, and AI agents.":i.type==="business_view"?"Business composition built from trusted terms, DQL blocks, and other business views.":i.type==="block"?"Reusable DQL block with its technical inputs and business consumption paths.":i.type==="dbt_model"||i.type==="dbt_source"||i.type==="source_table"?"Technical data asset connected to semantic, business, and consumption lineage.":i.type==="dashboard"||i.type==="notebook"||i.type==="app"||i.type==="chart"?"Consumption surface showing which trusted blocks and business concepts feed the experience.":"Focused technical and business lineage for the selected item.":"Focused technical and business lineage for the selected item."}function se(){var z;const{state:i,dispatch:n}=O(),e=N[i.themeMode],s=i.lineageFocusNodeId,[o,l]=u.useState({nodes:[],edges:[],focalNode:null}),[d,h]=u.useState(!1),[c,x]=u.useState("details"),[w,S]=u.useState(!1);u.useEffect(()=>{if(!s)return;let r=!1;return h(!0),A.queryLineage({focus:s,upstreamDepth:3,downstreamDepth:3}).then(v=>{var I,L;r||(l({nodes:((I=v.graph)==null?void 0:I.nodes)??[],edges:((L=v.graph)==null?void 0:L.edges)??[],focalNode:v.focalNode??null}),h(!1))}).catch(()=>{r||h(!1)}),()=>{r=!0}},[s]);const a=o.focalNode,m=u.useMemo(()=>new Map(o.nodes.map(r=>[r.id,r])),[o.nodes]),b=u.useMemo(()=>a?o.edges.filter(r=>r.target===a.id).map(r=>({edge:r,node:m.get(r.source)})).filter(r=>!!r.node):[],[a,o.edges,m]),j=u.useMemo(()=>a?o.edges.filter(r=>r.source===a.id).map(r=>({edge:r,node:m.get(r.target)})).filter(r=>!!r.node):[],[a,o.edges,m]);if(!s||w)return t.jsxs("div",{style:{flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[w&&s?t.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px",borderBottom:`1px solid ${e.headerBorder}`,background:e.cellBg},children:t.jsx("button",{type:"button",onClick:()=>S(!1),style:{border:`1px solid ${e.headerBorder}`,background:e.cellBg,color:e.textSecondary,borderRadius:7,padding:"5px 11px",fontSize:11.5,fontWeight:600,cursor:"pointer",fontFamily:e.font},children:"← Back to focused view"})}):null,t.jsx(H,{})]});const f=(a==null?void 0:a.type)??s.split(":")[0]??"node",D=C[f]??e.accent,P=E[f]??f.slice(0,4).toUpperCase(),B=(a==null?void 0:a.metadata)??{},k=B.path??B.filePath,$=(a==null?void 0:a.name)??s,g=i.sidebarOpen&&i.sidebarPanel==="lineage",p=((z=i.lineageReturnTarget)==null?void 0:z.view)==="apps"?i.lineageReturnTarget:null,T=p!=null&&p.label?`Back to ${p.label}`:"Back to app";return t.jsxs("div",{style:{flex:1,minWidth:0,overflow:"auto",background:"var(--color-bg-primary)"},children:[t.jsx("div",{style:{padding:"22px 28px 18px",borderBottom:`1px solid ${e.headerBorder}`,background:e.appBg},children:t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:16},children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[t.jsx("span",{style:{color:e.appBg,background:D,borderRadius:5,padding:"3px 7px",fontSize:10,fontWeight:800,letterSpacing:0},title:W[f]??f,children:P}),t.jsxs("span",{style:{color:e.textMuted,fontSize:12},children:["Focused lineage · ↑ ",b.length," · ↓ ",j.length]})]}),t.jsx("h1",{style:{margin:0,fontSize:26,lineHeight:1.15,color:e.textPrimary},children:$}),t.jsx("div",{style:{marginTop:7,color:e.textMuted,fontSize:13,maxWidth:760,lineHeight:1.45},children:V(a)})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[t.jsx("button",{type:"button",onClick:()=>S(!0),title:"Open the full lineage graph",style:{display:"inline-flex",alignItems:"center",gap:6,border:`1px solid ${e.headerBorder}`,background:e.cellBg,color:e.textSecondary,borderRadius:7,padding:"6px 11px",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:e.font,whiteSpace:"nowrap"},children:"Full graph"}),p?t.jsxs("button",{type:"button",onClick:()=>{n({type:"OPEN_APP",appId:p.appId,dashboardId:p.dashboardId??null,experience:p.experience,section:p.section})},title:T,style:{display:"inline-flex",alignItems:"center",gap:7,border:`1px solid ${e.headerBorder}`,background:e.sidebarBg,color:e.textPrimary,borderRadius:6,padding:"7px 10px",fontSize:12,fontWeight:800,cursor:"pointer",whiteSpace:"nowrap",maxWidth:220,overflow:"hidden",textOverflow:"ellipsis"},children:[t.jsx(F,{size:14}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:T})]}):null,t.jsxs("button",{type:"button",onClick:()=>{n(g?{type:"TOGGLE_SIDEBAR"}:{type:"SET_SIDEBAR_PANEL",panel:"lineage"})},style:{display:"inline-flex",alignItems:"center",gap:7,border:`1px solid ${g?e.accent:e.headerBorder}`,background:g?`${e.accent}1a`:e.sidebarBg,color:g?e.textPrimary:e.textSecondary,borderRadius:6,padding:"7px 10px",fontSize:12,fontWeight:800,cursor:"pointer",whiteSpace:"nowrap"},children:[t.jsx(G,{size:14}),g?"Hide list":"Browse lineage"]})]})]})}),t.jsxs("div",{style:{padding:16,display:"grid",gridTemplateColumns:"minmax(0, 1fr) clamp(190px, 26%, 280px)",gap:14,minHeight:"calc(100vh - 160px)",minWidth:0},children:[t.jsxs("section",{style:{border:`1px solid ${e.headerBorder}`,borderRadius:8,background:e.sidebarBg,overflow:"hidden",display:"flex",flexDirection:"column",minWidth:0,minHeight:560},children:[t.jsxs("div",{style:{padding:"10px 12px",borderBottom:`1px solid ${e.headerBorder}`,flexShrink:0},children:[t.jsx("div",{style:{fontWeight:800,color:e.textPrimary,fontSize:14},children:"Focused lineage"}),t.jsx("div",{style:{color:e.textMuted,fontSize:12,marginTop:3},children:"Technical chain, business concepts, and consumption endpoints for this item."})]}),t.jsx("div",{style:{flex:1,minHeight:490,padding:12},children:d?t.jsx("div",{style:{color:e.textMuted,fontSize:12},children:"Loading lineage..."}):o.nodes.length===0?t.jsx("div",{style:{color:e.textMuted,fontSize:12},children:"No lineage available."}):t.jsx(_,{nodes:o.nodes,edges:o.edges,focalNodeId:s,height:"100%",fitViewPadding:.04,onNodeClick:r=>{n({type:"OPEN_LINEAGE_DETAIL",nodeId:r})},interactive:!0})})]}),t.jsxs("aside",{"aria-label":"Lineage details",style:{border:`1px solid ${e.headerBorder}`,borderRadius:8,background:e.sidebarBg,minWidth:0,maxHeight:"calc(100vh - 160px)",overflow:"hidden",display:"flex",flexDirection:"column"},children:[t.jsxs("div",{style:{padding:8,borderBottom:`1px solid ${e.headerBorder}`,display:"grid",gridTemplateColumns:"1fr 1fr",gap:4},children:[t.jsx(y,{label:"Details",active:c==="details",onClick:()=>x("details"),t:e}),t.jsx(y,{label:`Up ${b.length}`,active:c==="upstream",onClick:()=>x("upstream"),t:e}),t.jsx(y,{label:`Down ${j.length}`,active:c==="downstream",onClick:()=>x("downstream"),t:e}),t.jsx(y,{label:"Source",active:c==="source",onClick:()=>x("source"),t:e})]}),t.jsxs("div",{style:{padding:12,overflow:"auto",flex:1,minHeight:0},children:[c==="details"&&(a?t.jsx(Q,{node:a,t:e}):t.jsx(Y,{t:e,label:"No metadata available."})),c==="upstream"&&t.jsx(M,{title:"Upstream",connections:b,t:e}),c==="downstream"&&t.jsx(M,{title:"Downstream",connections:j,t:e}),c==="source"&&t.jsx(K,{filePath:typeof k=="string"?k:null,t:e})]})]})]})]})}function y({label:i,active:n,onClick:e,t:s}){return t.jsx("button",{onClick:e,style:{border:`1px solid ${n?s.accent:s.headerBorder}`,background:n?`${s.accent}1c`:"transparent",color:n?s.textPrimary:s.textMuted,borderRadius:5,padding:"5px 6px",fontSize:10,fontWeight:800,cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i})}function Y({t:i,label:n}){return t.jsx("div",{style:{color:i.textMuted,fontSize:12,lineHeight:1.45},children:n})}function Q({node:i,t:n}){const e=i.metadata??{},s=new Set,o=[],l=(d,h,c=d)=>{const x=q(h);!x||s.has(c)||(s.add(c),o.push({label:d,value:x}))};l("Type",W[i.type]??i.type,"type"),l("Domain",i.domain,"domain"),l("Owner",i.owner,"owner"),l("Status",i.status,"status"),l("Term Type",e.termType,"termType"),l("Block Type",e.blockType,"blockType"),l("Materialized As",e.materializedAs,"materializedAs"),l("Identifiers",e.identifiers,"identifiers"),l("Synonyms",e.synonyms,"synonyms"),l("Description",e.description,"description"),l("Business Outcome",e.businessOutcome,"businessOutcome"),l("Decision Use",e.decisionUse,"decisionUse"),l("Review Cadence",e.reviewCadence,"reviewCadence");for(const[d,h]of Object.entries(e))d==="path"||d==="filePath"||d==="sql"||d==="compiledSql"||l(U(d),h,d);return t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:800,color:n.textPrimary,marginBottom:10},children:"Lineage metadata"}),o.length===0?t.jsx("div",{style:{color:n.textMuted,fontSize:12},children:"No metadata available for this node."}):t.jsx("div",{style:{display:"grid",gap:8},children:o.map(d=>t.jsxs("div",{style:{display:"grid",gap:3},children:[t.jsx("div",{style:{color:n.textMuted,fontSize:10,fontWeight:800,textTransform:"uppercase"},children:d.label}),t.jsx("div",{style:{color:n.textSecondary,fontSize:12,lineHeight:1.45},children:d.value})]},d.label))})]})}function M({title:i,connections:n,t:e}){return t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:800,color:e.textPrimary,marginBottom:10},children:i}),n.length===0?t.jsxs("div",{style:{color:e.textMuted,fontSize:12},children:["No ",i.toLowerCase()," connections in this focused window."]}):t.jsxs("div",{style:{display:"grid",gap:7},children:[n.slice(0,10).map(({edge:s,node:o})=>{const l=C[o.type]??e.textMuted;return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"92px 1fr",gap:8,minWidth:0,fontSize:12},children:[t.jsx("span",{style:{color:e.textMuted},children:R[s.type]??s.type}),t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:0},children:[t.jsx("span",{style:{color:e.appBg,background:l,borderRadius:3,padding:"1px 4px",fontSize:9,fontWeight:800,flexShrink:0},children:E[o.type]??o.type.slice(0,4).toUpperCase()}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:o.name,children:o.name})]})]},`${s.source}-${s.target}-${s.type}`)}),n.length>10&&t.jsxs("div",{style:{color:e.textMuted,fontSize:12},children:[n.length-10," more connection",n.length-10===1?"":"s"," in the graph"]})]})]})}function K({filePath:i,t:n}){const e=i==null?void 0:i.trim();return t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:800,color:n.textPrimary,marginBottom:10},children:"Source file"}),e?t.jsx("div",{style:{color:n.textMuted,fontSize:12,lineHeight:1.5,overflowWrap:"anywhere"},children:e}):t.jsx("div",{style:{color:n.textMuted,fontSize:12},children:"No source file path available for this node."})]})}export{se as LineageDetailView};
|
|
1
|
+
import{u as O,t as N,r as u,a as A,j as t,p as C,q as E,au as W,av as R}from"./index-9w93YPF9.js";import{M as _}from"./MiniLineageGraph-DT_ycl6s.js";import{LineageDAG as H}from"./LineageDAG-zCyN-hdg.js";import{A as F}from"./arrow-left-DnYPGqlr.js";import{L as G}from"./list-tree-BipBLmIE.js";import"./react-CRB3T2We.js";import"./dagre.esm-BjYSO53F.js";function U(i){return i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function q(i){if(i==null)return null;if(typeof i=="string")return i.trim()||null;if(typeof i=="number"||typeof i=="boolean")return String(i);if(Array.isArray(i)){const n=i.map(e=>e==null?null:typeof e=="string"||typeof e=="number"||typeof e=="boolean"?String(e):null).filter(e=>!!e);return n.length>0?n.join(", "):null}return null}function V(i){return i?i.type==="term"?"Business definition used by blocks, views, dashboards, and AI agents.":i.type==="business_view"?"Business composition built from trusted terms, DQL blocks, and other business views.":i.type==="block"?"Reusable DQL block with its technical inputs and business consumption paths.":i.type==="dbt_model"||i.type==="dbt_source"||i.type==="source_table"?"Technical data asset connected to semantic, business, and consumption lineage.":i.type==="dashboard"||i.type==="notebook"||i.type==="app"||i.type==="chart"?"Consumption surface showing which trusted blocks and business concepts feed the experience.":"Focused technical and business lineage for the selected item.":"Focused technical and business lineage for the selected item."}function se(){var z;const{state:i,dispatch:n}=O(),e=N[i.themeMode],s=i.lineageFocusNodeId,[o,l]=u.useState({nodes:[],edges:[],focalNode:null}),[d,h]=u.useState(!1),[c,x]=u.useState("details"),[w,S]=u.useState(!1);u.useEffect(()=>{if(!s)return;let r=!1;return h(!0),A.queryLineage({focus:s,upstreamDepth:3,downstreamDepth:3}).then(v=>{var I,L;r||(l({nodes:((I=v.graph)==null?void 0:I.nodes)??[],edges:((L=v.graph)==null?void 0:L.edges)??[],focalNode:v.focalNode??null}),h(!1))}).catch(()=>{r||h(!1)}),()=>{r=!0}},[s]);const a=o.focalNode,m=u.useMemo(()=>new Map(o.nodes.map(r=>[r.id,r])),[o.nodes]),b=u.useMemo(()=>a?o.edges.filter(r=>r.target===a.id).map(r=>({edge:r,node:m.get(r.source)})).filter(r=>!!r.node):[],[a,o.edges,m]),j=u.useMemo(()=>a?o.edges.filter(r=>r.source===a.id).map(r=>({edge:r,node:m.get(r.target)})).filter(r=>!!r.node):[],[a,o.edges,m]);if(!s||w)return t.jsxs("div",{style:{flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[w&&s?t.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px",borderBottom:`1px solid ${e.headerBorder}`,background:e.cellBg},children:t.jsx("button",{type:"button",onClick:()=>S(!1),style:{border:`1px solid ${e.headerBorder}`,background:e.cellBg,color:e.textSecondary,borderRadius:7,padding:"5px 11px",fontSize:11.5,fontWeight:600,cursor:"pointer",fontFamily:e.font},children:"← Back to focused view"})}):null,t.jsx(H,{})]});const f=(a==null?void 0:a.type)??s.split(":")[0]??"node",D=C[f]??e.accent,P=E[f]??f.slice(0,4).toUpperCase(),B=(a==null?void 0:a.metadata)??{},k=B.path??B.filePath,$=(a==null?void 0:a.name)??s,g=i.sidebarOpen&&i.sidebarPanel==="lineage",p=((z=i.lineageReturnTarget)==null?void 0:z.view)==="apps"?i.lineageReturnTarget:null,T=p!=null&&p.label?`Back to ${p.label}`:"Back to app";return t.jsxs("div",{style:{flex:1,minWidth:0,overflow:"auto",background:"var(--color-bg-primary)"},children:[t.jsx("div",{style:{padding:"22px 28px 18px",borderBottom:`1px solid ${e.headerBorder}`,background:e.appBg},children:t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:16},children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[t.jsx("span",{style:{color:e.appBg,background:D,borderRadius:5,padding:"3px 7px",fontSize:10,fontWeight:800,letterSpacing:0},title:W[f]??f,children:P}),t.jsxs("span",{style:{color:e.textMuted,fontSize:12},children:["Focused lineage · ↑ ",b.length," · ↓ ",j.length]})]}),t.jsx("h1",{style:{margin:0,fontSize:26,lineHeight:1.15,color:e.textPrimary},children:$}),t.jsx("div",{style:{marginTop:7,color:e.textMuted,fontSize:13,maxWidth:760,lineHeight:1.45},children:V(a)})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[t.jsx("button",{type:"button",onClick:()=>S(!0),title:"Open the full lineage graph",style:{display:"inline-flex",alignItems:"center",gap:6,border:`1px solid ${e.headerBorder}`,background:e.cellBg,color:e.textSecondary,borderRadius:7,padding:"6px 11px",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:e.font,whiteSpace:"nowrap"},children:"Full graph"}),p?t.jsxs("button",{type:"button",onClick:()=>{n({type:"OPEN_APP",appId:p.appId,dashboardId:p.dashboardId??null,experience:p.experience,section:p.section})},title:T,style:{display:"inline-flex",alignItems:"center",gap:7,border:`1px solid ${e.headerBorder}`,background:e.sidebarBg,color:e.textPrimary,borderRadius:6,padding:"7px 10px",fontSize:12,fontWeight:800,cursor:"pointer",whiteSpace:"nowrap",maxWidth:220,overflow:"hidden",textOverflow:"ellipsis"},children:[t.jsx(F,{size:14}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:T})]}):null,t.jsxs("button",{type:"button",onClick:()=>{n(g?{type:"TOGGLE_SIDEBAR"}:{type:"SET_SIDEBAR_PANEL",panel:"lineage"})},style:{display:"inline-flex",alignItems:"center",gap:7,border:`1px solid ${g?e.accent:e.headerBorder}`,background:g?`${e.accent}1a`:e.sidebarBg,color:g?e.textPrimary:e.textSecondary,borderRadius:6,padding:"7px 10px",fontSize:12,fontWeight:800,cursor:"pointer",whiteSpace:"nowrap"},children:[t.jsx(G,{size:14}),g?"Hide list":"Browse lineage"]})]})]})}),t.jsxs("div",{style:{padding:16,display:"grid",gridTemplateColumns:"minmax(0, 1fr) clamp(190px, 26%, 280px)",gap:14,minHeight:"calc(100vh - 160px)",minWidth:0},children:[t.jsxs("section",{style:{border:`1px solid ${e.headerBorder}`,borderRadius:8,background:e.sidebarBg,overflow:"hidden",display:"flex",flexDirection:"column",minWidth:0,minHeight:560},children:[t.jsxs("div",{style:{padding:"10px 12px",borderBottom:`1px solid ${e.headerBorder}`,flexShrink:0},children:[t.jsx("div",{style:{fontWeight:800,color:e.textPrimary,fontSize:14},children:"Focused lineage"}),t.jsx("div",{style:{color:e.textMuted,fontSize:12,marginTop:3},children:"Technical chain, business concepts, and consumption endpoints for this item."})]}),t.jsx("div",{style:{flex:1,minHeight:490,padding:12},children:d?t.jsx("div",{style:{color:e.textMuted,fontSize:12},children:"Loading lineage..."}):o.nodes.length===0?t.jsx("div",{style:{color:e.textMuted,fontSize:12},children:"No lineage available."}):t.jsx(_,{nodes:o.nodes,edges:o.edges,focalNodeId:s,height:"100%",fitViewPadding:.04,onNodeClick:r=>{n({type:"OPEN_LINEAGE_DETAIL",nodeId:r})},interactive:!0})})]}),t.jsxs("aside",{"aria-label":"Lineage details",style:{border:`1px solid ${e.headerBorder}`,borderRadius:8,background:e.sidebarBg,minWidth:0,maxHeight:"calc(100vh - 160px)",overflow:"hidden",display:"flex",flexDirection:"column"},children:[t.jsxs("div",{style:{padding:8,borderBottom:`1px solid ${e.headerBorder}`,display:"grid",gridTemplateColumns:"1fr 1fr",gap:4},children:[t.jsx(y,{label:"Details",active:c==="details",onClick:()=>x("details"),t:e}),t.jsx(y,{label:`Up ${b.length}`,active:c==="upstream",onClick:()=>x("upstream"),t:e}),t.jsx(y,{label:`Down ${j.length}`,active:c==="downstream",onClick:()=>x("downstream"),t:e}),t.jsx(y,{label:"Source",active:c==="source",onClick:()=>x("source"),t:e})]}),t.jsxs("div",{style:{padding:12,overflow:"auto",flex:1,minHeight:0},children:[c==="details"&&(a?t.jsx(Q,{node:a,t:e}):t.jsx(Y,{t:e,label:"No metadata available."})),c==="upstream"&&t.jsx(M,{title:"Upstream",connections:b,t:e}),c==="downstream"&&t.jsx(M,{title:"Downstream",connections:j,t:e}),c==="source"&&t.jsx(K,{filePath:typeof k=="string"?k:null,t:e})]})]})]})]})}function y({label:i,active:n,onClick:e,t:s}){return t.jsx("button",{onClick:e,style:{border:`1px solid ${n?s.accent:s.headerBorder}`,background:n?`${s.accent}1c`:"transparent",color:n?s.textPrimary:s.textMuted,borderRadius:5,padding:"5px 6px",fontSize:10,fontWeight:800,cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i})}function Y({t:i,label:n}){return t.jsx("div",{style:{color:i.textMuted,fontSize:12,lineHeight:1.45},children:n})}function Q({node:i,t:n}){const e=i.metadata??{},s=new Set,o=[],l=(d,h,c=d)=>{const x=q(h);!x||s.has(c)||(s.add(c),o.push({label:d,value:x}))};l("Type",W[i.type]??i.type,"type"),l("Domain",i.domain,"domain"),l("Owner",i.owner,"owner"),l("Status",i.status,"status"),l("Term Type",e.termType,"termType"),l("Block Type",e.blockType,"blockType"),l("Materialized As",e.materializedAs,"materializedAs"),l("Identifiers",e.identifiers,"identifiers"),l("Synonyms",e.synonyms,"synonyms"),l("Description",e.description,"description"),l("Business Outcome",e.businessOutcome,"businessOutcome"),l("Decision Use",e.decisionUse,"decisionUse"),l("Review Cadence",e.reviewCadence,"reviewCadence");for(const[d,h]of Object.entries(e))d==="path"||d==="filePath"||d==="sql"||d==="compiledSql"||l(U(d),h,d);return t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:800,color:n.textPrimary,marginBottom:10},children:"Lineage metadata"}),o.length===0?t.jsx("div",{style:{color:n.textMuted,fontSize:12},children:"No metadata available for this node."}):t.jsx("div",{style:{display:"grid",gap:8},children:o.map(d=>t.jsxs("div",{style:{display:"grid",gap:3},children:[t.jsx("div",{style:{color:n.textMuted,fontSize:10,fontWeight:800,textTransform:"uppercase"},children:d.label}),t.jsx("div",{style:{color:n.textSecondary,fontSize:12,lineHeight:1.45},children:d.value})]},d.label))})]})}function M({title:i,connections:n,t:e}){return t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:800,color:e.textPrimary,marginBottom:10},children:i}),n.length===0?t.jsxs("div",{style:{color:e.textMuted,fontSize:12},children:["No ",i.toLowerCase()," connections in this focused window."]}):t.jsxs("div",{style:{display:"grid",gap:7},children:[n.slice(0,10).map(({edge:s,node:o})=>{const l=C[o.type]??e.textMuted;return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"92px 1fr",gap:8,minWidth:0,fontSize:12},children:[t.jsx("span",{style:{color:e.textMuted},children:R[s.type]??s.type}),t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:0},children:[t.jsx("span",{style:{color:e.appBg,background:l,borderRadius:3,padding:"1px 4px",fontSize:9,fontWeight:800,flexShrink:0},children:E[o.type]??o.type.slice(0,4).toUpperCase()}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:o.name,children:o.name})]})]},`${s.source}-${s.target}-${s.type}`)}),n.length>10&&t.jsxs("div",{style:{color:e.textMuted,fontSize:12},children:[n.length-10," more connection",n.length-10===1?"":"s"," in the graph"]})]})]})}function K({filePath:i,t:n}){const e=i==null?void 0:i.trim();return t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:800,color:n.textPrimary,marginBottom:10},children:"Source file"}),e?t.jsx("div",{style:{color:n.textMuted,fontSize:12,lineHeight:1.5,overflowWrap:"anywhere"},children:e}):t.jsx("div",{style:{color:n.textMuted,fontSize:12},children:"No source file path available for this node."})]})}export{se as LineageDetailView};
|
package/dist/assets/dql-notebook/assets/{LineageDrawer-hnqCW_t-.js → LineageDrawer-DwMcenDf.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as F,t as J,r as l,a as K,p as R,q as I,j as t,au as Q,av as Z}from"./index-Cpx47jCH.js";import{M as ee}from"./MiniLineageGraph-CotnRuxa.js";import{P as te}from"./panel-right-open-yuVkIo5n.js";import{X as B}from"./x-CbKEfe5m.js";import{M as re}from"./minimize-2-C8dvqCxX.js";import{R as ie}from"./rotate-ccw-Di0kRnrM.js";import{G as ne}from"./grip-vertical-HmUijbwN.js";import{E as se}from"./external-link-DYqdQIGp.js";import"./react-CRB3T2We.js";import"./dagre.esm-DlZi7NR3.js";const O=320,oe=48;function T(){return typeof window>"u"?380:Math.min(420,Math.max(O,Math.round(window.innerWidth*.42)))}function ae(){return typeof window>"u"?760:Math.max(420,Math.min(880,Math.round(window.innerWidth*.72)))}function le(o){return Math.min(ae(),Math.max(O,o))}function be(){var E,D;const{state:o,dispatch:a}=F(),e=J[o.themeMode],n=o.lineageDrawerNodeId,[s,m]=l.useState({nodes:[],edges:[],focalNode:null}),[N,y]=l.useState(!1),j=l.useRef(null),[A,P]=l.useState(360),[w,S]=l.useState(()=>T()),[k,f]=l.useState(!1),[p,M]=l.useState(!1),b=l.useRef(w);l.useEffect(()=>{const r=j.current;if(!r)return;const d=new ResizeObserver(u=>{for(const c of u){const x=Math.max(160,c.contentRect.height);P(x)}});return d.observe(r),()=>d.disconnect()},[]),l.useEffect(()=>{if(!n)return;let r=!1;return y(!0),K.queryLineage({focus:n,upstreamDepth:2,downstreamDepth:2}).then(d=>{var u,c;r||(m({nodes:((u=d.graph)==null?void 0:u.nodes)??[],edges:((c=d.graph)==null?void 0:c.edges)??[],focalNode:d.focalNode??null}),y(!1))}).catch(()=>{r||y(!1)}),()=>{r=!0}},[n]);const i=s.focalNode,$=i?s.edges.filter(r=>r.target===i.id).length:0,_=i?s.edges.filter(r=>r.source===i.id).length:0,H=i?R[i.type]??e.textSecondary:e.textSecondary,G=i?I[i.type]??i.type.toUpperCase():"",g=l.useMemo(()=>new Map(s.nodes.map(r=>[r.id,r])),[s.nodes]),U=l.useMemo(()=>i?s.edges.filter(r=>r.target===i.id).map(r=>({edge:r,node:g.get(r.source)})).filter(r=>!!r.node):[],[i,s.edges,g]),X=l.useMemo(()=>i?s.edges.filter(r=>r.source===i.id).map(r=>({edge:r,node:g.get(r.target)})).filter(r=>!!r.node):[],[i,s.edges,g]),v=((E=i==null?void 0:i.metadata)==null?void 0:E.path)??((D=i==null?void 0:i.metadata)==null?void 0:D.filePath);if(!n)return null;const q=r=>{r!==n&&a({type:"OPEN_LINEAGE_DRAWER",nodeId:r})},Y=r=>{r.preventDefault(),r.stopPropagation(),k&&f(!1);const d=r.clientX,u=b.current;M(!0);const c=V=>{const L=le(u+(d-V.clientX));b.current=L,S(L)},x=()=>{M(!1),document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",x)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",c),window.addEventListener("mouseup",x)},z=()=>{const r=T();b.current=r,S(r),f(!1)},W=()=>a({type:"CLOSE_LINEAGE_DRAWER"});return k?t.jsxs("aside",{"aria-label":"Collapsed lineage drawer",style:{width:oe,flexShrink:0,borderLeft:`1px solid ${e.headerBorder}`,background:e.appBg,color:e.textPrimary,display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"10px 6px",overflow:"hidden"},children:[t.jsx(h,{title:"Show lineage details",onClick:()=>f(!1),t:e,children:t.jsx(te,{size:15,strokeWidth:1.9})}),t.jsx(h,{title:"Hide lineage drawer",onClick:W,t:e,children:t.jsx(B,{size:15,strokeWidth:2})}),t.jsx("div",{title:(i==null?void 0:i.name)??n,style:{writingMode:"vertical-rl",transform:"rotate(180deg)",color:e.textMuted,fontSize:11,fontWeight:700,lineHeight:1,marginTop:4,maxHeight:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(i==null?void 0:i.name)??"Lineage"})]}):t.jsxs("aside",{"aria-label":"Lineage drawer",style:{width:w,flexShrink:0,borderLeft:`1px solid ${e.headerBorder}`,background:e.appBg,color:e.textPrimary,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative",animation:"dql-drawer-slide-in 180ms cubic-bezier(0.22, 0.61, 0.36, 1)"},children:[t.jsx("div",{onMouseDown:Y,onDoubleClick:z,title:"Drag to resize. Double-click to reset width.",style:{position:"absolute",top:0,left:0,width:8,height:"100%",cursor:"col-resize",zIndex:20,display:"flex",alignItems:"center",justifyContent:"center",background:p?`${e.accent}1f`:"transparent",transition:p?"none":"background 0.15s"},onMouseEnter:r=>{p||(r.currentTarget.style.background=`${e.accent}14`)},onMouseLeave:r=>{p||(r.currentTarget.style.background="transparent")},children:t.jsx("div",{style:{width:3,height:44,borderRadius:999,background:p?e.accent:e.headerBorder,boxShadow:p?`0 0 0 3px ${e.accent}1f`:"none"}})}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 14px 11px",borderBottom:`1px solid ${e.headerBorder}`,background:e.appBg,flexShrink:0},children:[t.jsx("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:38,padding:"2px 6px",background:H,color:e.appBg,fontSize:10,fontWeight:700,letterSpacing:0,borderRadius:4},title:i?Q[i.type]??i.type:"",children:G||"NODE"}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{color:e.textMuted,fontSize:10,fontWeight:800,marginBottom:3},children:"Lineage Inspector"}),t.jsx("div",{style:{fontSize:14,fontWeight:700,color:e.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:(i==null?void 0:i.name)??n,children:(i==null?void 0:i.name)??n}),t.jsxs("div",{style:{fontSize:11,color:e.textMuted,marginTop:2},children:["Lineage · ↑ ",$," · ↓ ",_]})]}),t.jsx(h,{title:"Collapse drawer",onClick:()=>f(!0),t:e,children:t.jsx(re,{size:14,strokeWidth:1.8})}),t.jsx(h,{title:"Reset width",onClick:z,t:e,children:t.jsx(ie,{size:14,strokeWidth:1.8})}),t.jsx(h,{title:"Hide lineage drawer",onClick:W,t:e,children:t.jsx(B,{size:14,strokeWidth:2})})]}),t.jsxs("div",{style:{height:30,padding:"0 14px",borderBottom:`1px solid ${e.headerBorder}`,display:"flex",alignItems:"center",gap:8,color:e.textMuted,fontSize:11,flexShrink:0,background:e.sidebarBg},children:[t.jsx(ne,{size:13,strokeWidth:1.8}),t.jsx("span",{children:"Drag the left edge to resize"}),t.jsxs("span",{style:{marginLeft:"auto",color:e.textMuted},children:[w,"px"]})]}),i&&t.jsx(de,{node:i,t:e}),t.jsx("div",{ref:j,style:{flex:1,minHeight:220,padding:12,overflow:"hidden",display:"flex",background:e.appBg},children:N?t.jsx("div",{style:{color:e.textMuted,fontSize:12,padding:8},children:"Loading lineage…"}):s.nodes.length===0?t.jsx("div",{style:{color:e.textMuted,fontSize:12,padding:8},children:"No lineage available for this node."}):t.jsx("div",{style:{flex:1,minWidth:0},children:t.jsx(ee,{nodes:s.nodes,edges:s.edges,focalNodeId:n,height:Math.max(0,A-24),onNodeClick:q,interactive:!0})})}),i&&t.jsxs("div",{style:{borderTop:`1px solid ${e.headerBorder}`,padding:"10px 12px",display:"grid",gap:10,maxHeight:280,overflow:"auto",background:e.sidebarBg,flexShrink:0},children:[t.jsx(C,{title:"Upstream",connections:U,t:e}),t.jsx(C,{title:"Downstream",connections:X,t:e})]}),typeof v=="string"&&t.jsxs("div",{style:{padding:"8px 14px",borderTop:`1px solid ${e.headerBorder}`,fontSize:11,color:e.textMuted,display:"flex",alignItems:"center",gap:6},children:[t.jsx(se,{size:11,strokeWidth:1.75}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:v,children:v})]})]})}function de({node:o,t:a}){const e=o.metadata??{},n=[];return o.domain&&n.push({label:"Domain",value:o.domain}),o.owner&&n.push({label:"Owner",value:o.owner}),o.status&&n.push({label:"Status",value:o.status}),o.type==="term"&&typeof e.termType=="string"&&n.push({label:"Term Type",value:e.termType}),o.type==="block"&&typeof e.blockType=="string"&&n.push({label:"Block Type",value:e.blockType}),typeof e.materializedAs=="string"&&n.push({label:"Materialized As",value:e.materializedAs}),Array.isArray(e.identifiers)&&e.identifiers.length>0&&n.push({label:"Identifiers",value:e.identifiers.map(String).join(", ")}),Array.isArray(e.synonyms)&&e.synonyms.length>0&&n.push({label:"Synonyms",value:e.synonyms.map(String).join(", ")}),typeof e.description=="string"&&e.description.trim()&&n.push({label:"Description",value:e.description}),typeof e.businessOutcome=="string"&&e.businessOutcome.trim()&&n.push({label:"Business Outcome",value:e.businessOutcome}),n.length===0?null:t.jsx("div",{style:{padding:"10px 14px",borderBottom:`1px solid ${a.headerBorder}`,display:"grid",gap:6,background:a.sidebarBg},children:n.slice(0,6).map(s=>t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"92px 1fr",gap:8,minWidth:0},children:[t.jsx("span",{style:{color:a.textMuted,fontSize:10,fontWeight:700,textTransform:"uppercase"},children:s.label}),t.jsx("span",{style:{color:a.textSecondary,fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:s.value.length>90?"normal":"nowrap"},title:s.value,children:s.value})]},s.label))})}function C({title:o,connections:a,t:e}){return a.length===0?t.jsxs("div",{style:{color:e.textMuted,fontSize:11},children:[o,": none in this focused window"]}):t.jsxs("div",{children:[t.jsx("div",{style:{color:e.textMuted,fontSize:10,fontWeight:700,textTransform:"uppercase",marginBottom:5},children:o}),t.jsxs("div",{style:{display:"grid",gap:4},children:[a.slice(0,5).map(({edge:n,node:s})=>{const m=R[s.type]??e.textMuted;return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"76px 1fr",gap:8,alignItems:"center",fontSize:11,minWidth:0},children:[t.jsx("span",{style:{color:e.textMuted},children:Z[n.type]??n.type}),t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,minWidth:0},children:[t.jsx("span",{style:{color:e.appBg,background:m,borderRadius:3,padding:"1px 4px",fontSize:8,fontWeight:700,flexShrink:0},children:I[s.type]??s.type.slice(0,4).toUpperCase()}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:s.name,children:s.name})]})]},`${n.source}-${n.target}-${n.type}`)}),a.length>5&&t.jsxs("div",{style:{color:e.textMuted,fontSize:11},children:[a.length-5," more connection",a.length-5===1?"":"s"," in the graph"]})]})]})}function h({title:o,onClick:a,children:e,t:n}){return t.jsx("button",{"aria-label":o,title:o,onClick:a,style:{width:26,height:26,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:`1px solid ${n.headerBorder}`,borderRadius:5,color:n.textSecondary,cursor:"pointer"},onMouseEnter:s=>{s.currentTarget.style.color=n.textPrimary,s.currentTarget.style.background=n.textPrimary+"0f"},onMouseLeave:s=>{s.currentTarget.style.color=n.textSecondary,s.currentTarget.style.background="transparent"},children:e})}export{be as LineageDrawer};
|
|
1
|
+
import{u as F,t as J,r as l,a as K,p as R,q as I,j as t,au as Q,av as Z}from"./index-9w93YPF9.js";import{M as ee}from"./MiniLineageGraph-DT_ycl6s.js";import{P as te}from"./panel-right-open-BoCSilYB.js";import{X as B}from"./x-CcYceFMz.js";import{M as re}from"./minimize-2-BhXsglrO.js";import{R as ie}from"./rotate-ccw-ELiDRUmj.js";import{G as ne}from"./grip-vertical-CrEEYkXN.js";import{E as se}from"./external-link-DprWh9Yf.js";import"./react-CRB3T2We.js";import"./dagre.esm-BjYSO53F.js";const O=320,oe=48;function T(){return typeof window>"u"?380:Math.min(420,Math.max(O,Math.round(window.innerWidth*.42)))}function ae(){return typeof window>"u"?760:Math.max(420,Math.min(880,Math.round(window.innerWidth*.72)))}function le(o){return Math.min(ae(),Math.max(O,o))}function be(){var E,D;const{state:o,dispatch:a}=F(),e=J[o.themeMode],n=o.lineageDrawerNodeId,[s,m]=l.useState({nodes:[],edges:[],focalNode:null}),[N,y]=l.useState(!1),j=l.useRef(null),[A,P]=l.useState(360),[w,S]=l.useState(()=>T()),[k,f]=l.useState(!1),[p,M]=l.useState(!1),b=l.useRef(w);l.useEffect(()=>{const r=j.current;if(!r)return;const d=new ResizeObserver(u=>{for(const c of u){const x=Math.max(160,c.contentRect.height);P(x)}});return d.observe(r),()=>d.disconnect()},[]),l.useEffect(()=>{if(!n)return;let r=!1;return y(!0),K.queryLineage({focus:n,upstreamDepth:2,downstreamDepth:2}).then(d=>{var u,c;r||(m({nodes:((u=d.graph)==null?void 0:u.nodes)??[],edges:((c=d.graph)==null?void 0:c.edges)??[],focalNode:d.focalNode??null}),y(!1))}).catch(()=>{r||y(!1)}),()=>{r=!0}},[n]);const i=s.focalNode,$=i?s.edges.filter(r=>r.target===i.id).length:0,_=i?s.edges.filter(r=>r.source===i.id).length:0,H=i?R[i.type]??e.textSecondary:e.textSecondary,G=i?I[i.type]??i.type.toUpperCase():"",g=l.useMemo(()=>new Map(s.nodes.map(r=>[r.id,r])),[s.nodes]),U=l.useMemo(()=>i?s.edges.filter(r=>r.target===i.id).map(r=>({edge:r,node:g.get(r.source)})).filter(r=>!!r.node):[],[i,s.edges,g]),X=l.useMemo(()=>i?s.edges.filter(r=>r.source===i.id).map(r=>({edge:r,node:g.get(r.target)})).filter(r=>!!r.node):[],[i,s.edges,g]),v=((E=i==null?void 0:i.metadata)==null?void 0:E.path)??((D=i==null?void 0:i.metadata)==null?void 0:D.filePath);if(!n)return null;const q=r=>{r!==n&&a({type:"OPEN_LINEAGE_DRAWER",nodeId:r})},Y=r=>{r.preventDefault(),r.stopPropagation(),k&&f(!1);const d=r.clientX,u=b.current;M(!0);const c=V=>{const L=le(u+(d-V.clientX));b.current=L,S(L)},x=()=>{M(!1),document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",x)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",c),window.addEventListener("mouseup",x)},z=()=>{const r=T();b.current=r,S(r),f(!1)},W=()=>a({type:"CLOSE_LINEAGE_DRAWER"});return k?t.jsxs("aside",{"aria-label":"Collapsed lineage drawer",style:{width:oe,flexShrink:0,borderLeft:`1px solid ${e.headerBorder}`,background:e.appBg,color:e.textPrimary,display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"10px 6px",overflow:"hidden"},children:[t.jsx(h,{title:"Show lineage details",onClick:()=>f(!1),t:e,children:t.jsx(te,{size:15,strokeWidth:1.9})}),t.jsx(h,{title:"Hide lineage drawer",onClick:W,t:e,children:t.jsx(B,{size:15,strokeWidth:2})}),t.jsx("div",{title:(i==null?void 0:i.name)??n,style:{writingMode:"vertical-rl",transform:"rotate(180deg)",color:e.textMuted,fontSize:11,fontWeight:700,lineHeight:1,marginTop:4,maxHeight:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(i==null?void 0:i.name)??"Lineage"})]}):t.jsxs("aside",{"aria-label":"Lineage drawer",style:{width:w,flexShrink:0,borderLeft:`1px solid ${e.headerBorder}`,background:e.appBg,color:e.textPrimary,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative",animation:"dql-drawer-slide-in 180ms cubic-bezier(0.22, 0.61, 0.36, 1)"},children:[t.jsx("div",{onMouseDown:Y,onDoubleClick:z,title:"Drag to resize. Double-click to reset width.",style:{position:"absolute",top:0,left:0,width:8,height:"100%",cursor:"col-resize",zIndex:20,display:"flex",alignItems:"center",justifyContent:"center",background:p?`${e.accent}1f`:"transparent",transition:p?"none":"background 0.15s"},onMouseEnter:r=>{p||(r.currentTarget.style.background=`${e.accent}14`)},onMouseLeave:r=>{p||(r.currentTarget.style.background="transparent")},children:t.jsx("div",{style:{width:3,height:44,borderRadius:999,background:p?e.accent:e.headerBorder,boxShadow:p?`0 0 0 3px ${e.accent}1f`:"none"}})}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 14px 11px",borderBottom:`1px solid ${e.headerBorder}`,background:e.appBg,flexShrink:0},children:[t.jsx("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:38,padding:"2px 6px",background:H,color:e.appBg,fontSize:10,fontWeight:700,letterSpacing:0,borderRadius:4},title:i?Q[i.type]??i.type:"",children:G||"NODE"}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{color:e.textMuted,fontSize:10,fontWeight:800,marginBottom:3},children:"Lineage Inspector"}),t.jsx("div",{style:{fontSize:14,fontWeight:700,color:e.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:(i==null?void 0:i.name)??n,children:(i==null?void 0:i.name)??n}),t.jsxs("div",{style:{fontSize:11,color:e.textMuted,marginTop:2},children:["Lineage · ↑ ",$," · ↓ ",_]})]}),t.jsx(h,{title:"Collapse drawer",onClick:()=>f(!0),t:e,children:t.jsx(re,{size:14,strokeWidth:1.8})}),t.jsx(h,{title:"Reset width",onClick:z,t:e,children:t.jsx(ie,{size:14,strokeWidth:1.8})}),t.jsx(h,{title:"Hide lineage drawer",onClick:W,t:e,children:t.jsx(B,{size:14,strokeWidth:2})})]}),t.jsxs("div",{style:{height:30,padding:"0 14px",borderBottom:`1px solid ${e.headerBorder}`,display:"flex",alignItems:"center",gap:8,color:e.textMuted,fontSize:11,flexShrink:0,background:e.sidebarBg},children:[t.jsx(ne,{size:13,strokeWidth:1.8}),t.jsx("span",{children:"Drag the left edge to resize"}),t.jsxs("span",{style:{marginLeft:"auto",color:e.textMuted},children:[w,"px"]})]}),i&&t.jsx(de,{node:i,t:e}),t.jsx("div",{ref:j,style:{flex:1,minHeight:220,padding:12,overflow:"hidden",display:"flex",background:e.appBg},children:N?t.jsx("div",{style:{color:e.textMuted,fontSize:12,padding:8},children:"Loading lineage…"}):s.nodes.length===0?t.jsx("div",{style:{color:e.textMuted,fontSize:12,padding:8},children:"No lineage available for this node."}):t.jsx("div",{style:{flex:1,minWidth:0},children:t.jsx(ee,{nodes:s.nodes,edges:s.edges,focalNodeId:n,height:Math.max(0,A-24),onNodeClick:q,interactive:!0})})}),i&&t.jsxs("div",{style:{borderTop:`1px solid ${e.headerBorder}`,padding:"10px 12px",display:"grid",gap:10,maxHeight:280,overflow:"auto",background:e.sidebarBg,flexShrink:0},children:[t.jsx(C,{title:"Upstream",connections:U,t:e}),t.jsx(C,{title:"Downstream",connections:X,t:e})]}),typeof v=="string"&&t.jsxs("div",{style:{padding:"8px 14px",borderTop:`1px solid ${e.headerBorder}`,fontSize:11,color:e.textMuted,display:"flex",alignItems:"center",gap:6},children:[t.jsx(se,{size:11,strokeWidth:1.75}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:v,children:v})]})]})}function de({node:o,t:a}){const e=o.metadata??{},n=[];return o.domain&&n.push({label:"Domain",value:o.domain}),o.owner&&n.push({label:"Owner",value:o.owner}),o.status&&n.push({label:"Status",value:o.status}),o.type==="term"&&typeof e.termType=="string"&&n.push({label:"Term Type",value:e.termType}),o.type==="block"&&typeof e.blockType=="string"&&n.push({label:"Block Type",value:e.blockType}),typeof e.materializedAs=="string"&&n.push({label:"Materialized As",value:e.materializedAs}),Array.isArray(e.identifiers)&&e.identifiers.length>0&&n.push({label:"Identifiers",value:e.identifiers.map(String).join(", ")}),Array.isArray(e.synonyms)&&e.synonyms.length>0&&n.push({label:"Synonyms",value:e.synonyms.map(String).join(", ")}),typeof e.description=="string"&&e.description.trim()&&n.push({label:"Description",value:e.description}),typeof e.businessOutcome=="string"&&e.businessOutcome.trim()&&n.push({label:"Business Outcome",value:e.businessOutcome}),n.length===0?null:t.jsx("div",{style:{padding:"10px 14px",borderBottom:`1px solid ${a.headerBorder}`,display:"grid",gap:6,background:a.sidebarBg},children:n.slice(0,6).map(s=>t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"92px 1fr",gap:8,minWidth:0},children:[t.jsx("span",{style:{color:a.textMuted,fontSize:10,fontWeight:700,textTransform:"uppercase"},children:s.label}),t.jsx("span",{style:{color:a.textSecondary,fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:s.value.length>90?"normal":"nowrap"},title:s.value,children:s.value})]},s.label))})}function C({title:o,connections:a,t:e}){return a.length===0?t.jsxs("div",{style:{color:e.textMuted,fontSize:11},children:[o,": none in this focused window"]}):t.jsxs("div",{children:[t.jsx("div",{style:{color:e.textMuted,fontSize:10,fontWeight:700,textTransform:"uppercase",marginBottom:5},children:o}),t.jsxs("div",{style:{display:"grid",gap:4},children:[a.slice(0,5).map(({edge:n,node:s})=>{const m=R[s.type]??e.textMuted;return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"76px 1fr",gap:8,alignItems:"center",fontSize:11,minWidth:0},children:[t.jsx("span",{style:{color:e.textMuted},children:Z[n.type]??n.type}),t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,minWidth:0},children:[t.jsx("span",{style:{color:e.appBg,background:m,borderRadius:3,padding:"1px 4px",fontSize:8,fontWeight:700,flexShrink:0},children:I[s.type]??s.type.slice(0,4).toUpperCase()}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:s.name,children:s.name})]})]},`${n.source}-${n.target}-${n.type}`)}),a.length>5&&t.jsxs("div",{style:{color:e.textMuted,fontSize:11},children:[a.length-5," more connection",a.length-5===1?"":"s"," in the graph"]})]})]})}function h({title:o,onClick:a,children:e,t:n}){return t.jsx("button",{"aria-label":o,title:o,onClick:a,style:{width:26,height:26,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:`1px solid ${n.headerBorder}`,borderRadius:5,color:n.textSecondary,cursor:"pointer"},onMouseEnter:s=>{s.currentTarget.style.color=n.textPrimary,s.currentTarget.style.background=n.textPrimary+"0f"},onMouseLeave:s=>{s.currentTarget.style.color=n.textSecondary,s.currentTarget.style.background="transparent"},children:e})}export{be as LineageDrawer};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as v,j as d,t as _e,Z as Be,_ as he,aq as Ie,a as Te,ar as je,as as ze,at as Oe,R as ye,p as Ne,q as Ke}from"./index-
|
|
1
|
+
import{r as v,j as d,t as _e,Z as Be,_ as he,aq as Ie,a as Te,ar as je,as as ze,at as Oe,R as ye,p as Ne,q as Ke}from"./index-9w93YPF9.js";import{S as V,g as ve,E as S,s as Qe,a as g,b as Se,c as Ze,P as Ge,d as Ue,e as Ve,F as He,f as Ye,h as we,V as Je,D as q,R as Xe,i as et,C as M,j as ke,k as y,r as tt,l as rt,m as nt,u as st,n as at,t as it,o as ot,p as lt,q as ct,v as ut,w as ht,x as dt,y as ft,z as pt,A as mt,B as gt,G as xt,H as bt,I as yt,J as vt,K as St,L as wt,M as kt,N as de,O as Ct,Q as u}from"./codemirror-DXt7RW72.js";const fe=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class _{constructor(e,r,n=0,s=e.length,a,i){this.test=i,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,s),this.bufferStart=n,this.normalize=a?o=>a(fe(o)):fe,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ue(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let r=et(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Ve(e);let s=this.normalize(r);if(s.length)for(let a=0,i=n;;a++){let o=s.charCodeAt(a),l=this.match(o,i,this.bufferPos+this.bufferStart);if(a==s.length-1){if(l)return this.value=l,this;break}i==n&&a<r.length&&r.charCodeAt(a)==o&&i++}}}match(e,r,n){let s=null;for(let a=0;a<this.matches.length;a+=2){let i=this.matches[a],o=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?s={from:this.matches[a+1],to:n}:(this.matches[a]++,o=!0)),o||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:r,to:n}:this.matches.push(1,r)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(_.prototype[Symbol.iterator]=function(){return this});const Ce={from:-1,to:-1,match:/.*/.exec("")},ae="gm"+(/x/.unicode==null?"":"u");class Me{constructor(e,r,n,s=0,a=e.length){if(this.text=e,this.to=a,this.curLine="",this.done=!1,this.value=Ce,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new Le(e,r,n,s,a);this.re=new RegExp(r,ae+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.iter=e.iter();let i=e.lineAt(s);this.curLineStart=i.from,this.matchPos=K(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,s=n+r[0].length;if(this.matchPos=K(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<s||n>this.value.to)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const J=new WeakMap;class W{constructor(e,r){this.from=e,this.text=r}get to(){return this.from+this.text.length}static get(e,r,n){let s=J.get(e);if(!s||s.from>=n||s.to<=r){let o=new W(r,e.sliceString(r,n));return J.set(e,o),o}if(s.from==r&&s.to==n)return s;let{text:a,from:i}=s;return i>r&&(a=e.sliceString(r,i)+a,i=r),s.to<n&&(a+=e.sliceString(s.to,n)),J.set(e,new W(i,a)),new W(r,a.slice(r-i,n-i))}}class Le{constructor(e,r,n,s,a){this.text=e,this.to=a,this.done=!1,this.value=Ce,this.matchPos=K(e,s),this.re=new RegExp(r,ae+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.flat=W.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==e&&(this.re.lastIndex=e+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,s=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},this.matchPos=K(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=W.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Me.prototype[Symbol.iterator]=Le.prototype[Symbol.iterator]=function(){return this});function Mt(t){try{return new RegExp(t,ae),!0}catch{return!1}}function K(t,e){if(e>=t.length)return e;let r=t.lineAt(e),n;for(;e<r.to&&(n=r.text.charCodeAt(e-r.from))>=56320&&n<57344;)e++;return e}const Lt=t=>{let{state:e}=t,r=String(e.doc.lineAt(t.state.selection.main.head).number),{close:n,result:s}=Qe(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:e.phrase("go")});return s.then(a=>{let i=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!i){t.dispatch({effects:n});return}let o=e.doc.lineAt(e.selection.main.head),[,l,c,m,w]=i,k=m?+m.slice(1):0,f=c?+c:o.number;if(c&&w){let E=f/100;l&&(E=E*(l=="-"?-1:1)+o.number/e.doc.lines),f=Math.round(e.doc.lines*E)}else c&&l&&(f=f*(l=="-"?-1:1)+o.number);let T=e.doc.line(Math.max(1,Math.min(e.doc.lines,f))),A=S.cursor(T.from+Math.max(0,Math.min(k,T.length)));t.dispatch({effects:[n,g.scrollIntoView(A.from,{y:"center"})],selection:A})}),!0},Et=({state:t,dispatch:e})=>{let{selection:r}=t,n=S.create(r.ranges.map(s=>t.wordAt(s.head)||S.cursor(s.head)),r.mainIndex);return n.eq(r)?!1:(e(t.update({selection:n})),!0)};function qt(t,e){let{main:r,ranges:n}=t.selection,s=t.wordAt(r.head),a=s&&s.from==r.from&&s.to==r.to;for(let i=!1,o=new _(t.doc,e,n[n.length-1].to);;)if(o.next(),o.done){if(i)return null;o=new _(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),i=!0}else{if(i&&n.some(l=>l.from==o.value.from))continue;if(a){let l=t.wordAt(o.value.from);if(!l||l.from!=o.value.from||l.to!=o.value.to)continue}return o.value}}const Rt=({state:t,dispatch:e})=>{let{ranges:r}=t.selection;if(r.some(a=>a.from===a.to))return Et({state:t,dispatch:e});let n=t.sliceDoc(r[0].from,r[0].to);if(t.selection.ranges.some(a=>t.sliceDoc(a.from,a.to)!=n))return!1;let s=qt(t,n);return s?(e(t.update({selection:t.selection.addRange(S.range(s.from,s.to),!1),effects:g.scrollIntoView(s.to)})),!0):!1},R=He.define({combine(t){return Ye(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Kt(e),scrollToMatch:e=>g.scrollIntoView(e)})}});function At(t){return t?[R.of(t),se]:se}class Ee{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Mt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
|
|
2
2
|
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new _t(this):new Wt(this)}getCursor(e,r=0,n){let s=e.doc?e:we.create({doc:e});return n==null&&(n=s.doc.length),this.regexp?F(this,s,r,n):$(this,s,r,n)}}class qe{constructor(e){this.spec=e}}function $t(t,e,r){return(n,s,a,i)=>{if(r&&!r(n,s,a,i))return!1;let o=n>=i&&s<=i+a.length?a.slice(n-i,s-i):e.doc.sliceString(n,s);return t(o,e,n,s)}}function $(t,e,r,n){let s;return t.wholeWord&&(s=Ft(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(s=$t(t.test,e,s)),new _(e.doc,t.unquoted,r,n,t.caseSensitive?void 0:a=>a.toLowerCase(),s)}function Ft(t,e){return(r,n,s,a)=>((a>r||a+s.length<n)&&(a=Math.max(0,r-2),s=t.sliceString(a,Math.min(t.length,n+2))),(e(Q(s,r-a))!=M.Word||e(Z(s,r-a))!=M.Word)&&(e(Z(s,n-a))!=M.Word||e(Q(s,n-a))!=M.Word))}class Wt extends qe{constructor(e){super(e)}nextMatch(e,r,n){let s=$(this.spec,e,n,e.doc.length).nextOverlapping();if(s.done){let a=Math.min(e.doc.length,r+this.spec.unquoted.length);s=$(this.spec,e,0,a).nextOverlapping()}return s.done||s.value.from==r&&s.value.to==n?null:s.value}prevMatchInRange(e,r,n){for(let s=n;;){let a=Math.max(r,s-1e4-this.spec.unquoted.length),i=$(this.spec,e,a,s),o=null;for(;!i.nextOverlapping().done;)o=i.value;if(o)return o;if(a==r)return null;s-=1e4}}prevMatch(e,r,n){let s=this.prevMatchInRange(e,0,r);return s||(s=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=r||s.to!=n)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,r){let n=$(this.spec,e,0,e.doc.length),s=[];for(;!n.next().done;){if(s.length>=r)return null;s.push(n.value)}return s}highlight(e,r,n,s){let a=$(this.spec,e,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}function Pt(t,e,r){return(n,s,a)=>(!r||r(n,s,a))&&t(a[0],e,n,s)}function F(t,e,r,n){let s;return t.wholeWord&&(s=Dt(e.charCategorizer(e.selection.main.head))),t.test&&(s=Pt(t.test,e,s)),new Me(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:s},r,n)}function Q(t,e){return t.slice(ke(t,e,!1),e)}function Z(t,e){return t.slice(e,ke(t,e))}function Dt(t){return(e,r,n)=>!n[0].length||(t(Q(n.input,n.index))!=M.Word||t(Z(n.input,n.index))!=M.Word)&&(t(Z(n.input,n.index+n[0].length))!=M.Word||t(Q(n.input,n.index+n[0].length))!=M.Word)}class _t extends qe{nextMatch(e,r,n){let s=F(this.spec,e,n,e.doc.length).next();return s.done&&(s=F(this.spec,e,0,r).next()),s.done?null:s.value}prevMatchInRange(e,r,n){for(let s=1;;s++){let a=Math.max(r,n-s*1e4),i=F(this.spec,e,a,n),o=null;for(;!i.next().done;)o=i.value;if(o&&(a==r||o.from>a+10))return o;if(a==r)return null}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let s=n.length;s>0;s--){let a=+n.slice(0,s);if(a>0&&a<e.match.length)return e.match[a]+n.slice(s)}return r})}matchAll(e,r){let n=F(this.spec,e,0,e.doc.length),s=[];for(;!n.next().done;){if(s.length>=r)return null;s.push(n.value)}return s}highlight(e,r,n,s){let a=F(this.spec,e,Math.max(0,r-250),Math.min(n+250,e.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}const B=V.define(),ie=V.define(),L=Se.define({create(t){return new X(ne(t).create(),null)},update(t,e){for(let r of e.effects)r.is(B)?t=new X(r.value.create(),t.panel):r.is(ie)&&(t=new X(t.query,r.value?oe:null));return t},provide:t=>Ze.from(t,e=>e.panel)});class X{constructor(e,r){this.query=e,this.panel=r}}const Bt=q.mark({class:"cm-searchMatch"}),It=q.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Tt=Je.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(L))}update(t){let e=t.state.field(L);(e!=t.startState.field(L)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return q.none;let{view:r}=this,n=new Xe;for(let s=0,a=r.visibleRanges,i=a.length;s<i;s++){let{from:o,to:l}=a[s];for(;s<i-1&&l>a[s+1].from-500;)l=a[++s].to;t.highlight(r.state,o,l,(c,m)=>{let w=r.state.selection.ranges.some(k=>k.from==c&&k.to==m);n.add(c,m,w?It:Bt)})}return n.finish()}},{decorations:t=>t.decorations});function I(t){return e=>{let r=e.state.field(L,!1);return r&&r.query.spec.valid?t(e,r):$e(e)}}const G=I((t,{query:e})=>{let{to:r}=t.state.selection.main,n=e.nextMatch(t.state,r,r);if(!n)return!1;let s=S.single(n.from,n.to),a=t.state.facet(R);return t.dispatch({selection:s,effects:[le(t,n),a.scrollToMatch(s.main,t)],userEvent:"select.search"}),Ae(t),!0}),U=I((t,{query:e})=>{let{state:r}=t,{from:n}=r.selection.main,s=e.prevMatch(r,n,n);if(!s)return!1;let a=S.single(s.from,s.to),i=t.state.facet(R);return t.dispatch({selection:a,effects:[le(t,s),i.scrollToMatch(a.main,t)],userEvent:"select.search"}),Ae(t),!0}),jt=I((t,{query:e})=>{let r=e.matchAll(t.state,1e3);return!r||!r.length?!1:(t.dispatch({selection:S.create(r.map(n=>S.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),zt=({state:t,dispatch:e})=>{let r=t.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:s}=r.main,a=[],i=0;for(let o=new _(t.doc,t.sliceDoc(n,s));!o.next().done;){if(a.length>1e3)return!1;o.value.from==n&&(i=a.length),a.push(S.range(o.value.from,o.value.to))}return e(t.update({selection:S.create(a,i),userEvent:"select.search.matches"})),!0},pe=I((t,{query:e})=>{let{state:r}=t,{from:n,to:s}=r.selection.main;if(r.readOnly)return!1;let a=e.nextMatch(r,n,n);if(!a)return!1;let i=a,o=[],l,c,m=[];i.from==n&&i.to==s&&(c=r.toText(e.getReplacement(i)),o.push({from:i.from,to:i.to,insert:c}),i=e.nextMatch(r,i.from,i.to),m.push(g.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+".")));let w=t.state.changes(o);return i&&(l=S.single(i.from,i.to).map(w),m.push(le(t,i)),m.push(r.facet(R).scrollToMatch(l.main,t))),t.dispatch({changes:w,selection:l,effects:m,userEvent:"input.replace"}),!0}),Ot=I((t,{query:e})=>{if(t.state.readOnly)return!1;let r=e.matchAll(t.state,1e9).map(s=>{let{from:a,to:i}=s;return{from:a,to:i,insert:e.getReplacement(s)}});if(!r.length)return!1;let n=t.state.phrase("replaced $ matches",r.length)+".";return t.dispatch({changes:r,effects:g.announce.of(n),userEvent:"input.replace.all"}),!0});function oe(t){return t.state.facet(R).createPanel(t)}function ne(t,e){var r,n,s,a,i;let o=t.selection.main,l=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!l)return e;let c=t.facet(R);return new Ee({search:((r=e==null?void 0:e.literal)!==null&&r!==void 0?r:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e==null?void 0:e.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(s=e==null?void 0:e.literal)!==null&&s!==void 0?s:c.literal,regexp:(a=e==null?void 0:e.regexp)!==null&&a!==void 0?a:c.regexp,wholeWord:(i=e==null?void 0:e.wholeWord)!==null&&i!==void 0?i:c.wholeWord})}function Re(t){let e=ve(t,oe);return e&&e.dom.querySelector("[main-field]")}function Ae(t){let e=Re(t);e&&e==t.root.activeElement&&e.select()}const $e=t=>{let e=t.state.field(L,!1);if(e&&e.panel){let r=Re(t);if(r&&r!=t.root.activeElement){let n=ne(t.state,e.query.spec);n.valid&&t.dispatch({effects:B.of(n)}),r.focus(),r.select()}}else t.dispatch({effects:[ie.of(!0),e?B.of(ne(t.state,e.query.spec)):V.appendConfig.of(se)]});return!0},Fe=t=>{let e=t.state.field(L,!1);if(!e||!e.panel)return!1;let r=ve(t,oe);return r&&r.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:ie.of(!1)}),!0},Nt=[{key:"Mod-f",run:$e,scope:"editor search-panel"},{key:"F3",run:G,shift:U,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:G,shift:U,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Fe,scope:"editor search-panel"},{key:"Mod-Shift-l",run:zt},{key:"Mod-Alt-g",run:Lt},{key:"Mod-d",run:Rt,preventDefault:!0}];class Kt{constructor(e){this.view=e;let r=this.query=e.state.field(L).query.spec;this.commit=this.commit.bind(this),this.searchField=y("input",{value:r.search,placeholder:b(e,"Find"),"aria-label":b(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=y("input",{value:r.replace,placeholder:b(e,"Replace"),"aria-label":b(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=y("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=y("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=y("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(s,a,i){return y("button",{class:"cm-button",name:s,onclick:a,type:"button"},i)}this.dom=y("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,n("next",()=>G(e),[b(e,"next")]),n("prev",()=>U(e),[b(e,"previous")]),n("select",()=>jt(e),[b(e,"all")]),y("label",null,[this.caseField,b(e,"match case")]),y("label",null,[this.reField,b(e,"regexp")]),y("label",null,[this.wordField,b(e,"by word")]),...e.state.readOnly?[]:[y("br"),this.replaceField,n("replace",()=>pe(e),[b(e,"replace")]),n("replaceAll",()=>Ot(e),[b(e,"replace all")])],y("button",{name:"close",onclick:()=>Fe(e),"aria-label":b(e,"close"),type:"button"},["×"])])}commit(){let e=new Ee({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:B.of(e)}))}keydown(e){tt(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?U:G)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),pe(this.view))}update(e){for(let r of e.transactions)for(let n of r.effects)n.is(B)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(R).top}}function b(t,e){return t.state.phrase(e)}const z=30,O=/[\s\.,:;?!]/;function le(t,{from:e,to:r}){let n=t.state.doc.lineAt(e),s=t.state.doc.lineAt(r).to,a=Math.max(n.from,e-z),i=Math.min(s,r+z),o=t.state.sliceDoc(a,i);if(a!=n.from){for(let l=0;l<z;l++)if(!O.test(o[l+1])&&O.test(o[l])){o=o.slice(l);break}}if(i!=s){for(let l=o.length-1;l>o.length-z;l--)if(!O.test(o[l-1])&&O.test(o[l])){o=o.slice(0,l);break}}return g.announce.of(`${t.state.phrase("current match")}. ${o} ${t.state.phrase("on line")} ${n.number}.`)}const Qt=g.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),se=[L,Ge.low(Tt),Qt],me=[{name:"domain",detail:"business domain (namespace)"},{name:"owner",detail:"accountable owner — required to certify"},{name:"description",detail:"business-facing description"},{name:"status",detail:"draft | certified"},{name:"pattern",detail:"reusable block pattern"},{name:"grain",detail:'row grain, e.g. "one row per customer"'},{name:"outputs",detail:"declared output column names"},{name:"entities",detail:'business entities, e.g. ["order"]'},{name:"tags",detail:"discoverability tags"},{name:"llmContext",detail:"when an agent should use this block"},{name:"reviewCadence",detail:"how often to re-review"},{name:"sourceSystems",detail:"upstream source systems"},{name:"dimensions",detail:"queryable dimensions"},{name:"allowedFilters",detail:"filters an app may bind"},{name:"filterBindings",detail:"filter → column map (app-ready)",snippet:`filterBindings {
|
|
3
3
|
$0
|
|
4
4
|
}`},{name:"parameterPolicy",detail:"per-parameter reuse policy",snippet:`parameterPolicy {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,r as h,az as O,aA as x,aB as S,q as L,p as C}from"./index-
|
|
1
|
+
import{j as t,r as h,az as O,aA as x,aB as S,q as L,p as C}from"./index-9w93YPF9.js";import{R as N,u as T,a as D,d as z,M as _,i as A,B as F,T as b,H as m,c as v}from"./dagre.esm-BjYSO53F.js";function G(e,c,a={}){var s;if(e.length===0)return e;const n=new b.graphlib.Graph().setDefaultEdgeLabel(()=>({}));n.setGraph({rankdir:"LR",ranksep:60,nodesep:30,marginx:20,marginy:20});for(const o of e){const i={width:170,height:52};if(a.mode==="layered"&&((s=o.data)!=null&&s.layer)){const d=S.indexOf(o.data.layer);d>=0&&(i.rank=d)}n.setNode(o.id,i)}for(const o of c)n.setEdge(o.source,o.target);return b.layout(n),e.map(o=>{const i=n.node(o.id);return{...o,position:{x:i.x-85,y:i.y-26}}})}function B({data:e,selected:c}){const a=e.nodeType,n=e.isFocal,s=C[a]??"var(--color-text-tertiary)",o=L[a]??a.toUpperCase();return t.jsxs("div",{style:{minWidth:140,maxWidth:190,background:"var(--color-bg-card)",border:`2px solid ${n||c?"var(--color-accent-blue)":s}`,borderRadius:8,padding:"6px 8px",boxShadow:n?"0 0 0 2px color-mix(in srgb, var(--color-accent-blue) 25%, transparent)":"none"},children:[t.jsx(m,{type:"target",position:v.Left,style:{width:6,height:6,background:s,border:"none"}}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:2},children:[t.jsx("span",{style:{fontSize:8,fontWeight:700,letterSpacing:"0.04em",color:"var(--color-bg-card)",background:s,borderRadius:3,padding:"1px 4px"},children:o}),e.domain&&t.jsx("span",{style:{color:"var(--color-text-tertiary)",fontSize:9},children:e.domain})]}),t.jsx("div",{style:{color:"var(--color-text-primary)",fontSize:10,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:e.label,children:e.label}),t.jsx(m,{type:"source",position:v.Right,style:{width:6,height:6,background:s,border:"none"}})]})}const M={miniDagNode:B};function W({nodes:e,edges:c,focalNodeId:a,height:n=250,onNodeClick:s,interactive:o=!0,layoutMode:i="flow",fitViewPadding:d=.15}){const[E,f,R]=T([]),[w,y,j]=D([]),{fitView:p}=z(),u=h.useRef(null);return h.useEffect(()=>{const g=e.map(r=>({id:r.id,type:"miniDagNode",position:{x:0,y:0},data:{label:r.name,nodeType:r.type,domain:r.domain,layer:O(r),isFocal:r.id===a}})),l=c.map((r,k)=>({id:`mini-edge-${k}-${r.source}-${r.target}`,source:r.source,target:r.target,style:{stroke:x[r.type]??"#8b949e",strokeWidth:1.4},markerEnd:{type:_.ArrowClosed,color:x[r.type]??"#8b949e",width:10,height:10}}));f(G(g,l,{mode:i})),y(l),requestAnimationFrame(()=>{p({padding:d,duration:200})})},[e,c,a,i,d,f,y,p]),h.useEffect(()=>{if(!u.current)return;const g=u.current,l=new ResizeObserver(()=>{p({padding:d,duration:0})});return l.observe(g),()=>l.disconnect()},[p,d]),e.length===0?t.jsx("div",{style:{height:n,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--color-text-tertiary)",fontSize:11},children:"No lineage nodes to display"}):t.jsx("div",{ref:u,style:{height:n,width:"100%",borderRadius:8,overflow:"hidden",border:"1px solid var(--color-border-subtle)"},children:t.jsx(A,{nodes:E,edges:w,onNodesChange:o?R:void 0,onEdgesChange:o?j:void 0,onNodeClick:s?(g,l)=>s(l.id):void 0,nodeTypes:M,fitView:!0,fitViewOptions:{padding:d},minZoom:.25,proOptions:{hideAttribution:!0},nodesDraggable:o,nodesConnectable:!1,zoomOnScroll:o,panOnDrag:o,style:{background:"var(--color-bg-sunken)"},children:t.jsx(F,{color:"var(--color-border-subtle)",gap:20,size:1})})})}function I(e){return t.jsx(N,{children:t.jsx(W,{...e})})}export{I as M};
|
package/dist/assets/dql-notebook/assets/{NewBlockModal-DHn-CEEW.js → NewBlockModal-qdhzeJPF.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as w,t as z,r as l,V as O,j as t,a as D}from"./index-
|
|
1
|
+
import{u as w,t as z,r as l,V as O,j as t,a as D}from"./index-9w93YPF9.js";import"./react-CRB3T2We.js";function F(s,i,a,e){var d;const n=a.trim().replace(/\\/g,"/").replace(/^\/+|\/+$/g,""),p=`${n?`${n}/`:""}${e}.dql`;if(!i)return`blocks/${p}`;const r=s.find(g=>g.id===i),c=(d=r==null?void 0:r.sourcePath)==null?void 0:d.replace(/\/domain\.dql$/,"");return c?`${c}/blocks/${p}`:`blocks/${i}/${p}`}function v(s){return s.toLowerCase().replace(/[^a-z0-9\-_\s]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").slice(0,64)}function _(s){return s.trim()?/^[a-zA-Z0-9\-_ ]+$/.test(s)?null:"Only letters, numbers, hyphens, underscores, and spaces allowed.":"Name is required."}function R({onFileOpened:s}){const{state:i,dispatch:a}=w(),e=z[i.themeMode],[n,p]=l.useState(""),[r,c]=l.useState(i.newBlockModalDefaultType),[d,g]=l.useState(""),[x,E]=l.useState(""),[y,u]=l.useState(null),[m,h]=l.useState(!1),k=l.useRef(null);l.useEffect(()=>{var o;(o=k.current)==null||o.focus()},[]);const S=i.authoredDomains,L=O(S);l.useEffect(()=>{c(i.newBlockModalDefaultType)},[i.newBlockModalDefaultType]),l.useEffect(()=>{const o=b=>{b.key==="Escape"&&a({type:"CLOSE_NEW_BLOCK_MODAL"})};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[a]);const B=async()=>{var j;const o=_(n);if(o){u(o);return}h(!0),u(null);const b=v(n);try{const f=await D.createBlock(n.trim(),{blockType:r,...d?{domain:d}:{},...x.trim()?{folderPath:x.trim()}:{}}),C={name:`${b}.dql`,path:f.path,type:"block",folder:f.path.split("/").slice(0,-1).join("/"),isNew:!0};a({type:"FILE_ADDED",file:C}),a({type:"CLOSE_NEW_BLOCK_MODAL"}),s(C)}catch(f){(j=f.message)!=null&&j.includes("already exists")?u("A block with this name already exists."):u(f.message??"Failed to create block.")}finally{h(!1)}},$=o=>{o.target===o.currentTarget&&a({type:"CLOSE_NEW_BLOCK_MODAL"})};return t.jsx("div",{onClick:$,style:{position:"fixed",inset:0,background:e.modalOverlay,display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,backdropFilter:"blur(4px)"},children:t.jsxs("div",{style:{background:e.modalBg,border:`1px solid ${e.cellBorder}`,borderRadius:12,width:420,maxWidth:"calc(100vw - 48px)",boxShadow:"0 20px 60px rgba(0,0,0,0.5)",overflow:"hidden"},children:[t.jsxs("div",{style:{padding:"20px 24px 0",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[t.jsx("h2",{style:{fontSize:16,fontWeight:600,color:e.textPrimary,fontFamily:e.font,margin:0},children:"New Block"}),t.jsx("button",{onClick:()=>a({type:"CLOSE_NEW_BLOCK_MODAL"}),style:{background:"transparent",border:"none",cursor:"pointer",color:e.textMuted,fontSize:18,lineHeight:1,padding:"2px 4px",borderRadius:4},children:"×"})]}),t.jsxs("div",{style:{padding:"20px 24px 24px",display:"flex",flexDirection:"column",gap:16},children:[t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[t.jsxs("button",{type:"button",onClick:()=>c("custom"),style:{background:r==="custom"?`${e.accent}18`:e.btnBg,border:`1px solid ${r==="custom"?e.accent:e.btnBorder}`,borderRadius:8,color:r==="custom"?e.accent:e.textSecondary,cursor:"pointer",fontSize:12,fontWeight:700,fontFamily:e.font,padding:"10px 12px",textAlign:"left"},children:["SQL Block",t.jsx("span",{style:{display:"block",marginTop:3,color:e.textMuted,fontWeight:400,fontSize:11},children:"Build from dbt models, tables, and SELECT queries."})]}),t.jsxs("button",{type:"button",onClick:()=>c("semantic"),style:{background:r==="semantic"?`${e.accent}18`:e.btnBg,border:`1px solid ${r==="semantic"?e.accent:e.btnBorder}`,borderRadius:8,color:r==="semantic"?e.accent:e.textSecondary,cursor:"pointer",fontSize:12,fontWeight:700,fontFamily:e.font,padding:"10px 12px",textAlign:"left"},children:["Semantic Block",t.jsx("span",{style:{display:"block",marginTop:3,color:e.textMuted,fontWeight:400,fontSize:11},children:"Build from dbt/DQL metrics and dimensions."})]})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[t.jsx("label",{style:{fontSize:12,fontWeight:500,color:e.textSecondary,fontFamily:e.font},children:"Block Name"}),t.jsx("input",{ref:k,value:n,onChange:o=>{p(o.target.value),u(null)},onKeyDown:o=>{o.key==="Enter"&&B()},placeholder:"revenue-summary",style:{background:e.inputBg,border:`1px solid ${y?e.error:e.inputBorder}`,borderRadius:6,color:e.textPrimary,fontSize:13,fontFamily:e.font,padding:"8px 12px",outline:"none",transition:"border-color 0.15s"}}),y&&t.jsx("span",{style:{fontSize:11,color:e.error,fontFamily:e.font},children:y}),n&&!y&&t.jsxs("span",{style:{fontSize:11,color:e.textMuted,fontFamily:e.fontMono},children:["Git path: ",F(S,d,x,v(n))]})]}),t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[t.jsxs("label",{style:{display:"grid",gap:6,fontSize:12,fontWeight:500,color:e.textSecondary,fontFamily:e.font},children:["Domain",t.jsxs("select",{"aria-label":"Block domain",value:d,onChange:o=>g(o.target.value),style:{background:e.inputBg,border:`1px solid ${e.inputBorder}`,borderRadius:6,color:e.textPrimary,fontSize:13,fontFamily:e.font,padding:"8px 10px",outline:"none"},children:[t.jsx("option",{value:"",children:"Global / cross-domain"}),L.map(o=>t.jsx("option",{value:o.value,children:o.label},o.value))]})]}),t.jsxs("label",{style:{display:"grid",gap:6,fontSize:12,fontWeight:500,color:e.textSecondary,fontFamily:e.font},children:["Folder",t.jsx("input",{"aria-label":"Block folder",value:x,onChange:o=>E(o.target.value),placeholder:"reporting/monthly",style:{background:e.inputBg,border:`1px solid ${e.inputBorder}`,borderRadius:6,color:e.textPrimary,fontSize:13,fontFamily:e.fontMono,padding:"8px 10px",outline:"none"}})]})]}),t.jsx("div",{style:{fontSize:12,color:e.textMuted,fontFamily:e.font,lineHeight:1.5,padding:"8px 12px",background:e.pillBg,borderRadius:6},children:r==="semantic"?"Semantic blocks use governed metrics, dimensions, and chart intent. They do not start with raw SQL.":"SQL blocks are reusable SELECT queries stored in the blocks/ folder. Use them for dbt models, tables, and imported SQL."})]}),t.jsxs("div",{style:{padding:"14px 24px",borderTop:`1px solid ${e.cellBorder}`,display:"flex",justifyContent:"flex-end",gap:10},children:[t.jsx("button",{onClick:()=>a({type:"CLOSE_NEW_BLOCK_MODAL"}),style:{background:e.btnBg,border:`1px solid ${e.btnBorder}`,borderRadius:6,color:e.textSecondary,cursor:"pointer",fontSize:13,fontFamily:e.font,fontWeight:500,padding:"7px 16px"},children:"Cancel"}),t.jsx("button",{onClick:B,disabled:m||!n.trim(),style:{background:e.accent,border:`1px solid ${e.accent}`,borderRadius:6,color:"#ffffff",cursor:m||!n.trim()?"not-allowed":"pointer",fontSize:13,fontFamily:e.font,fontWeight:500,padding:"7px 20px",opacity:m||!n.trim()?.6:1,display:"flex",alignItems:"center",gap:6},children:m?"Creating...":"Create Block"})]})]})})}export{R as NewBlockModal};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as v,m as i,u as M,t as D,r as d,V as N,j as t,l as B,a as T}from"./index-
|
|
1
|
+
import{c as v,m as i,u as M,t as D,r as d,V as N,j as t,l as B,a as T}from"./index-9w93YPF9.js";import{B as k}from"./book-open-text-DULlwbj6.js";import{X as q}from"./x-CcYceFMz.js";import"./react-CRB3T2We.js";/**
|
|
2
2
|
* @license lucide-react v0.563.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|