@duckcodeailabs/dql-cli 1.13.1 → 1.13.3
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 +249 -7
- package/dist/apps-api.d.ts.map +1 -1
- package/dist/apps-api.js +2855 -160
- package/dist/apps-api.js.map +1 -1
- package/dist/assets/dql-notebook/assets/{AgentLogPage-D6fgEAEy.js → AgentLogPage-B3ugEb3H.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiBuildDialog-8miXFPse.js → AiBuildDialog-BK_TDNcM.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiBuildResult-DPJ_SI0R.js → AiBuildResult-Cob_Lj05.js} +8 -8
- package/dist/assets/dql-notebook/assets/{AiSidePanel-NVA6lZnn.js → AiSidePanel-CzIgxmP9.js} +1 -1
- package/dist/assets/dql-notebook/assets/AnalyticsHome-C2vJ2fxY.js +6 -0
- package/dist/assets/dql-notebook/assets/AppsView-DEWQ0sHT.js +5588 -0
- package/dist/assets/dql-notebook/assets/BlockStudio-CaDNTKMM.js +55 -0
- package/dist/assets/dql-notebook/assets/{BusinessArtifactView-DtRMiaF4.js → BusinessArtifactView-zwUOtddi.js} +1 -1
- package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-BlnhTMu3.js +22 -0
- package/dist/assets/dql-notebook/assets/{GitPage-CazC-eTR.js → GitPage-Coevr9NJ.js} +3 -3
- package/dist/assets/dql-notebook/assets/GlobalAiRail-BTZS11x5.js +1 -0
- package/dist/assets/dql-notebook/assets/GovernedContextPage-CjyyM_ne.js +7 -0
- package/dist/assets/dql-notebook/assets/{HelpDocsPage-DMHPsVqP.js → HelpDocsPage-C1UeP85v.js} +1 -1
- package/dist/assets/dql-notebook/assets/{HomePage-DcSI4dnU.js → HomePage-zGPFIvOY.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDAG-BJ6xz06u.js → LineageDAG-DbXnQWu3.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDetailView-8WrQm-MF.js → LineageDetailView-Ch1Db01I.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDrawer-hnqCW_t-.js → LineageDrawer-DLxqJO6D.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineagePathBreadcrumb-B4LZTUsl.js → LineagePathBreadcrumb-B2tNdkr_.js} +3 -3
- package/dist/assets/dql-notebook/assets/{MiniLineageGraph-CotnRuxa.js → MiniLineageGraph-0gY-ZwCy.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NewBlockModal-DHn-CEEW.js → NewBlockModal-DKVkXD20.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NewNotebookModal-BPGp-8oq.js → NewNotebookModal-BUIByvYT.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NotebookEditor-B0OTHM6W.js → NotebookEditor-D2fIUxjE.js} +5 -5
- package/dist/assets/dql-notebook/assets/{ReadinessPage-CoOIpxWq.js → ReadinessPage-Ci4LyNiQ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{SetupOnboarding-DxK_mFzf.js → SetupOnboarding-BF7ai_0t.js} +1 -1
- package/dist/assets/dql-notebook/assets/SkillsPage-BgYrgirJ.js +10 -0
- package/dist/assets/dql-notebook/assets/{TrustBadge-ZuD5N5Ww.js → TrustBadge-Bob1Laiq.js} +1 -1
- package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-IxDUKSG8.js +88 -0
- package/dist/assets/dql-notebook/assets/{answer-to-notebook-WAVAYjBv.js → answer-to-notebook-Dk42N0pU.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-left-L8odLbyN.js → arrow-left-DKuuTw9l.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-right-WIF1V9a9.js → arrow-right-TH8_ufKG.js} +1 -1
- package/dist/assets/dql-notebook/assets/{book-open-text-BpqWMa4m.js → book-open-text-B-dcHHn0.js} +1 -1
- package/dist/assets/dql-notebook/assets/{circle-x-CQBOM0b0.js → circle-x-BOc2KCZQ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{dagre.esm-DlZi7NR3.js → dagre.esm-CPT_vn5p.js} +1 -1
- package/dist/assets/dql-notebook/assets/{external-link-DYqdQIGp.js → external-link-DtOfpYc6.js} +1 -1
- package/dist/assets/dql-notebook/assets/{grip-vertical-HmUijbwN.js → grip-vertical-B8joDDH9.js} +1 -1
- package/dist/assets/dql-notebook/assets/index-B3shyZsg.css +1 -0
- package/dist/assets/dql-notebook/assets/index-DJRMz64S.js +635 -0
- package/dist/assets/dql-notebook/assets/link-2-DMZPHawg.js +6 -0
- package/dist/assets/dql-notebook/assets/{list-tree-DGKqCxmz.js → list-tree-Dw0qlxPK.js} +1 -1
- package/dist/assets/dql-notebook/assets/{minimize-2-C8dvqCxX.js → minimize-2-DUiSrPS3.js} +1 -1
- package/dist/assets/dql-notebook/assets/{panel-right-open-yuVkIo5n.js → panel-right-open-BrrFrRZQ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{bot-CLR1V6dO.js → play-Ced0HT9g.js} +7 -2
- package/dist/assets/dql-notebook/assets/{rotate-ccw-Di0kRnrM.js → rotate-ccw-D_9U9o7X.js} +1 -1
- package/dist/assets/dql-notebook/assets/{semantic-fields-BMQV0li8.js → semantic-fields-BlDOaonV.js} +1 -1
- package/dist/assets/dql-notebook/assets/{sliders-horizontal-alebptlJ.js → sliders-horizontal-BDt6KRGR.js} +1 -1
- package/dist/assets/dql-notebook/assets/{star-CgCQbnXc.js → star-CxUbF_BW.js} +1 -1
- package/dist/assets/dql-notebook/assets/{triangle-alert-SyuSZ4ht.js → triangle-alert-COWnsSdh.js} +1 -1
- package/dist/assets/dql-notebook/assets/upload-DSFC2kJX.js +6 -0
- package/dist/assets/dql-notebook/assets/usePersistedAgentThreadId-DYdx896E.js +32 -0
- package/dist/assets/dql-notebook/assets/{user-round-J4PQHxo9.js → user-round-Bfu7fosn.js} +1 -1
- package/dist/assets/dql-notebook/assets/{wand-sparkles-c4WDXTCk.js → wand-sparkles-DSpG0c0j.js} +1 -1
- package/dist/assets/dql-notebook/assets/{workflow-NtRLaq7n.js → workflow-B1_pj9gq.js} +1 -1
- package/dist/assets/dql-notebook/assets/{wrench-CS1f1Zv4.js → wrench-CvfM03KZ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{x-CbKEfe5m.js → x-B4coLiOl.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 +112 -19
- package/dist/local-runtime.d.ts.map +1 -1
- package/dist/local-runtime.js +2026 -694
- 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/BlockStudio--jNw9XUI.js +0 -60
- 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-Cpx47jCH.js +0 -634
- 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{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,aw as W,ax as R}from"./index-DJRMz64S.js";import{M as _}from"./MiniLineageGraph-0gY-ZwCy.js";import{LineageDAG as H}from"./LineageDAG-DbXnQWu3.js";import{A as F}from"./arrow-left-DKuuTw9l.js";import{L as G}from"./list-tree-Dw0qlxPK.js";import"./react-CRB3T2We.js";import"./dagre.esm-CPT_vn5p.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-DLxqJO6D.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,aw as Q,ax as Z}from"./index-DJRMz64S.js";import{M as ee}from"./MiniLineageGraph-0gY-ZwCy.js";import{P as te}from"./panel-right-open-BrrFrRZQ.js";import{X as B}from"./x-B4coLiOl.js";import{M as re}from"./minimize-2-DUiSrPS3.js";import{R as ie}from"./rotate-ccw-D_9U9o7X.js";import{G as ne}from"./grip-vertical-B8joDDH9.js";import{E as se}from"./external-link-DtOfpYc6.js";import"./react-CRB3T2We.js";import"./dagre.esm-CPT_vn5p.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,5 +1,5 @@
|
|
|
1
|
-
import{r as v,j as d,t as _e,Z as Be,_ as he,
|
|
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 {
|
|
1
|
+
import{r as v,j as d,t as _e,Z as Be,_ as he,as as Ie,a as Te,at as je,au as ze,av as Oe,R as ye,p as Ne,q as Ke}from"./index-DJRMz64S.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 R,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 Rt(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 qt=({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=Rt(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},q=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?[q.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
|
+
`: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 Re{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 Re{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 Re{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=R.mark({class:"cm-searchMatch"}),It=R.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 R.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(q);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(q);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(q).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(q).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(q);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 qe(t){let e=ve(t,oe);return e&&e.dom.querySelector("[main-field]")}function Ae(t){let e=qe(t);e&&e==t.root.activeElement&&e.select()}const $e=t=>{let e=t.state.field(L,!1);if(e&&e.panel){let r=qe(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:qt,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(q).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 {
|
|
5
5
|
$0
|
|
@@ -11,4 +11,4 @@ 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,
|
|
|
11
11
|
assert $0
|
|
12
12
|
}`},{name:"query",detail:"the SQL body",snippet:`query = """
|
|
13
13
|
$0
|
|
14
|
-
"""`}],Zt={chart:["bar","line","area","column","combo","pie","donut","scatter","histogram","heatmap","number","single_value","table"],viz:["bar","line","area","column","combo","pie","donut","scatter","histogram","heatmap","number","single_value","table"],type:["bar","line","area","column","combo","pie","donut","scatter","histogram","heatmap","number","single_value","table"],pattern:["metric_wrapper","entity_profile","entity_rollup","ranking","trend","bridge","drilldown","replacement","custom"],reviewCadence:["daily","weekly","monthly","quarterly","annually"],status:["draft","certified"],type_block:["custom","semantic"]};function Gt(t){return(t.match(/"""/g)??[]).length%2===1}function ge(t){return{label:t.name,type:"property",detail:t.detail,apply:t.snippet?Ut(t.snippet):`${t.name} = `}}function Ut(t){return(e,r,n,s)=>{const a=t.indexOf("$0"),i=t.replace("$0",""),o=a>=0?n+a:n+i.length;e.dispatch({changes:{from:n,to:s,insert:i},selection:{anchor:o}})}}const Vt=t=>{const e=t.state.doc.lineAt(t.pos),r=t.state.sliceDoc(0,t.pos),n=r.slice(e.from);if(Gt(r))return null;const s=/([a-zA-Z_]+)\s*=\s*"([^"]*)$/.exec(n);if(s){const i=Zt[s[1]];if(i){const o=t.pos-s[2].length,l=s[2].toLowerCase();return{from:o,options:i.filter(c=>!l||c.toLowerCase().includes(l)).map(c=>({label:c,type:"enum"})),validFor:/^[\w-]*$/}}return null}const a=t.matchBefore(/[a-zA-Z_]+/);if(a&&/^\s*[a-zA-Z_]+$/.test(n)){const i=a.text.toLowerCase();return{from:a.from,options:me.filter(o=>o.name.toLowerCase().startsWith(i)||o.name.toLowerCase().includes(i)).map(ge),validFor:/^[a-zA-Z_]*$/}}return t.explicit&&/^\s*$/.test(n)?{from:t.pos,options:me.map(ge)}:null},xe=new Map;async function ee(t,e,r){const n=`${t}:${r??""}:${e}`.toLowerCase(),s=xe.get(n);if(s&&s.expiresAt>Date.now())return s.items;const a=new URLSearchParams({kind:t,q:e,limit:"60"});r&&a.set("relation",r);const i=await fetch(`${window.location.origin}/api/editor/completions?${a}`);if(!i.ok)return[];const o=await i.json(),l=Array.isArray(o.completions)?o.completions:[];return xe.set(n,{items:l,expiresAt:Date.now()+2e4}),l}const Ht=async t=>{const e=t.state.sliceDoc(0,t.pos),r=/\b(?:from|join)\s+([\w."-]*)$/i.exec(e);if(r){const a=r[1].replace(/^"/,""),i=await ee("relation",a);return te(t.pos-r[1].length,i)}const n=/([A-Za-z_][\w]*)\.([A-Za-z_][\w]*)?$/.exec(e);if(n){const a=n[1],i=n[2]??"",o=Yt(e,a)??a,l=await ee("column",i,o.replace(/^"|"$/g,""));return te(t.pos-i.length,l)}const s=t.matchBefore(/[A-Za-z_][\w]*$/);if(t.explicit&&s){const a=await ee("column",s.text);return te(s.from,a)}return null};function te(t,e){return{from:t,options:e.map(r=>({label:r.label||r.name,apply:r.apply??r.name,detail:[r.detail,r.relation,r.governance].filter(Boolean).join(" · "),info:r.description,type:r.type==="column"?"property":r.type==="dataset"?"class":"variable",boost:r.governance==="semantic"||r.governance==="project_controlled"?20:0})),validFor:/^[\w."-]*$/}}function Yt(t,e){var n;return(n=new RegExp(`\\b(?:from|join)\\s+([\\w."-]+)(?:\\s+(?:as\\s+)?${Jt(e)})\\b`,"i").exec(t))==null?void 0:n[1]}function Jt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function be(t,e){const r=t?de({schema:t,upperCaseKeywords:!1}):de({upperCaseKeywords:!1}),n=[r,r.language.data.of({autocomplete:je}),r.language.data.of({autocomplete:Ht})];return e&&n.push(r.language.data.of({autocomplete:Vt})),n}function Xt(t){const e=t.match(/LINE\s+(\d+)/i);if(e){const s=parseInt(e[1],10),a=t.match(/\n(\s*)\^/),i=a?a[1].length+1:1;return{line:s,col:i}}const r=t.match(/at line\s+(\d+),?\s*column\s+(\d+)/i);if(r)return{line:parseInt(r[1],10),col:parseInt(r[2],10)};const n=t.match(/line\s+(\d+)/i);return n?{line:parseInt(n[1],10),col:1}:null}const N=V.define(),re=kt.define(),er=Se.define({create(){return q.none},update(t,e){for(const r of e.effects)if(r.is(N)){if(!r.value)return q.none;const{from:n,to:s,message:a}=r.value;return q.set([q.mark({class:"cm-sql-error",attributes:{title:a}}).range(n,s)])}return t},provide:t=>g.decorations.from(t)}),tr=Ct.define([{tag:u.keyword,color:"var(--sql-keyword)",fontWeight:"600"},{tag:[u.controlKeyword,u.moduleKeyword],color:"var(--sql-keyword)",fontWeight:"600"},{tag:[u.string,u.special(u.string)],color:"var(--sql-string)"},{tag:u.number,color:"var(--sql-number)"},{tag:u.bool,color:"var(--sql-number)",fontWeight:"600"},{tag:u.null,color:"var(--sql-number)",fontWeight:"600"},{tag:[u.comment,u.lineComment,u.blockComment,u.docComment],color:"var(--sql-comment)",fontStyle:"italic"},{tag:[u.function(u.variableName),u.function(u.propertyName)],color:"var(--sql-function)"},{tag:[u.typeName,u.className],color:"var(--sql-type)"},{tag:u.operator,color:"var(--sql-punctuation)"},{tag:u.punctuation,color:"var(--sql-punctuation)"},{tag:u.bracket,color:"var(--sql-punctuation)"},{tag:[u.variableName,u.name,u.propertyName,u.attributeName],color:"var(--sql-ident)"},{tag:u.invalid,color:"var(--color-status-error)"}]),rr=g.baseTheme({".cm-sql-error":{textDecoration:"underline wavy var(--color-status-error)",textUnderlineOffset:"3px",background:"color-mix(in srgb, var(--color-status-error) 10%, transparent)"}});function We(t){return g.theme({"&":{background:"transparent",color:"var(--color-text-primary)"},".cm-content":{caretColor:"var(--color-text-primary)"},".cm-cursor":{borderLeftColor:"var(--color-text-primary)"},".cm-selectionBackground":{background:"color-mix(in srgb, var(--color-accent-blue) 30%, transparent)"},"&.cm-focused .cm-selectionBackground":{background:"color-mix(in srgb, var(--color-accent-blue) 30%, transparent)"},".cm-gutters":{background:"transparent",color:"var(--color-text-tertiary)",border:"none",borderRight:"1px solid var(--color-border-subtle)"},".cm-activeLineGutter":{background:"transparent"},".cm-activeLine":{background:"transparent"},"&.cm-focused .cm-activeLineGutter":{background:"var(--color-bg-hover)"},"&.cm-focused .cm-activeLine":{background:"var(--color-bg-hover)"},".cm-matchingBracket":{background:"color-mix(in srgb, var(--color-accent-blue) 18%, transparent)",outline:"1px solid var(--color-accent-blue)"},".cm-foldPlaceholder":{background:"var(--color-bg-tertiary)",border:"1px solid var(--color-border-subtle)",color:"var(--color-text-secondary)",borderRadius:3,padding:"0 4px"},".cm-tooltip":{background:"var(--color-bg-card)",border:"1px solid var(--color-border-primary)",color:"var(--color-text-primary)",borderRadius:6,boxShadow:"0 4px 12px color-mix(in srgb, var(--color-bg-primary) 40%, transparent)"},".cm-tooltip.cm-tooltip-autocomplete":{"& > ul > li":{padding:"3px 8px"},"& > ul > li[aria-selected]":{background:"color-mix(in srgb, var(--color-accent-blue) 20%, transparent)",color:"var(--color-accent-blue)"}},".cm-searchMatch":{background:"color-mix(in srgb, var(--color-status-warning) 25%, transparent)",outline:"1px solid var(--color-status-warning)"},".cm-searchMatch.cm-searchMatch-selected":{background:"color-mix(in srgb, var(--color-status-warning) 50%, transparent)"},".cm-panels":{background:"var(--color-bg-secondary)",borderTop:"1px solid var(--color-border-subtle)"},".cm-panel":{padding:"6px 8px"},".cm-panel input":{background:"var(--color-bg-sunken)",border:"1px solid var(--color-border-subtle)",color:"var(--color-text-primary)",borderRadius:4,padding:"2px 6px",fontSize:12},".cm-panel button":{background:"var(--color-bg-tertiary)",border:"1px solid var(--color-border-subtle)",color:"var(--color-text-primary)",borderRadius:4,padding:"2px 8px",cursor:"pointer",fontSize:12,marginLeft:4}},{dark:t})}const nr=We(!0),sr=We(!1);function ar(t){return t==="midnight"||t==="obsidian"||t==="dark"}function ir({value:t,onChange:e,onRun:r,themeMode:n,autoFocus:s,schema:a,errorMessage:i,editorRef:o,wrap:l=!0,fillHeight:c=!1,dqlMode:m=!1}){const w=_e[n],k=v.useRef(null),f=v.useRef(null),[T,A]=v.useState(!1),E=v.useRef(r),ce=v.useRef(e),ue=v.useRef(new rt);return E.current=r,ce.current=e,v.useEffect(()=>{o&&(o.current={undo:()=>{f.current&&st(f.current)},redo:()=>{f.current&&nt(f.current)},resetTo:h=>{const p=f.current;p&&p.dispatch({changes:{from:0,to:p.state.doc.length,insert:h},annotations:re.of(!0)})}})}),v.useEffect(()=>{if(!k.current)return;const h=at.of([{key:"Shift-Enter",run:()=>(E.current(),!0)},{key:"Ctrl-Enter",mac:"Cmd-Enter",run:()=>(E.current(),!0)},{key:"Ctrl-/",mac:"Cmd-/",run:it},ot,...lt,...ct,...ut,...Nt,...ht,...dt]),p=g.updateListener.of(P=>{const D=P.transactions.some(De=>De.annotation(re));P.docChanged&&!D&&ce.current(P.state.doc.toString())}),x=g.domEventHandlers({focus:(P,D)=>{Oe(D)},blur:(P,D)=>{ze(D)}}),C=g.theme({"&":{background:"var(--color-bg-surface)",color:"var(--color-text-primary)",fontFamily:"var(--font-mono)",fontSize:"13px",minHeight:c?"100%":"80px",maxHeight:c?"none":"480px",...c?{height:"100%"}:{}},".cm-scroller":{overflow:"auto",fontFamily:"inherit",...c?{height:"100%"}:{}},".cm-content":{padding:"10px 0",minHeight:c?"100%":"80px",color:"var(--color-text-primary)"},"&.cm-focused":{outline:"none"},".cm-editor":{border:"none"},".cm-gutters":{minWidth:40},".cm-foldGutter":{cursor:"pointer"}}),j=be(a,m),H=[h,p,x,C,ue.current.of(j),ft({closeOnBlur:!1}),pt(),mt(),gt(),xt(),bt(),yt(),vt(),St(),...l?[g.lineWrapping]:[],At({top:!0}),er,rr,wt(tr),ar(n)?nr:sr],Pe=we.create({doc:t,extensions:H}),Y=new g({state:Pe,parent:k.current});return f.current=Y,s&&Y.focus(),()=>{Y.destroy(),f.current=null}},[n]),v.useEffect(()=>{const h=f.current;h&&h.dispatch({effects:ue.current.reconfigure(be(a,m))})},[a,m]),v.useEffect(()=>{const h=f.current;if(!h)return;const p=h.state.doc.toString();p!==t&&h.dispatch({changes:{from:0,to:p.length,insert:t},annotations:re.of(!0)})},[t]),v.useEffect(()=>{const h=f.current;if(!h)return;if(!i){h.dispatch({effects:N.of(null)});return}const p=Xt(i),x=h.state.doc;if(p&&p.line>=1&&p.line<=x.lines){const C=x.line(p.line),j=C.from+Math.max(0,p.col-1),H=Math.max(j+1,C.to);h.dispatch({effects:N.of({from:Math.min(j,x.length),to:Math.min(H,x.length),message:i})})}else if(x.lines>=1){const C=x.line(1);h.dispatch({effects:N.of({from:C.from,to:Math.max(C.from+1,C.to),message:i})})}},[i]),d.jsx("div",{onDragOver:h=>{h.dataTransfer.types.includes(he)&&(h.preventDefault(),A(!0))},onDragLeave:()=>A(!1),onDrop:h=>{const p=f.current;if(!p)return;const x=Be(h.dataTransfer.getData(he));x&&(h.preventDefault(),A(!1),Ie(p,x.reference,{x:h.clientX,y:h.clientY}),Te.trackUsage(x.name),window.dispatchEvent(new CustomEvent("dql:semantic-used",{detail:{name:x.name}})))},style:{background:"var(--color-bg-surface)",height:c?"100%":void 0,minHeight:c?0:80,border:T?`1px solid ${w.accent}`:"1px solid transparent",borderRadius:c?0:6,transition:"border-color 0.15s",overflow:"hidden"},children:d.jsx("div",{ref:k,style:{height:c?"100%":void 0,minHeight:c?0:80}})})}ir.displayName="SQLCellEditor";function or({path:t,onNodeClick:e,focalNodeId:r,t:n}){return t.nodes.length===0?null:d.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4,alignItems:"center"},children:t.nodes.map((s,a)=>d.jsxs(ye.Fragment,{children:[d.jsx(lr,{node:s,isFocal:s.id===r,onClick:e?()=>e(s.id):void 0,t:n}),a<t.nodes.length-1&&d.jsx("span",{style:{color:n.textMuted,fontSize:10,lineHeight:1},children:"→"})]},s.id))})}function hr({title:t,paths:e,onNodeClick:r,focalNodeId:n,maxVisible:s=4,t:a}){const[i,o]=ye.useState(!1),l=i?e:e.slice(0,s),c=e.length>s;return e.length===0?null:d.jsxs("div",{style:{border:`1px solid ${a.cellBorder}`,borderRadius:10,overflow:"hidden",background:a.inputBg},children:[d.jsxs("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${a.cellBorder}`,fontSize:11,fontWeight:700,color:a.textMuted,fontFamily:a.font,textTransform:"uppercase",letterSpacing:"0.04em",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[d.jsx("span",{children:t}),d.jsxs("span",{style:{fontWeight:400,fontSize:10},children:[e.length," path",e.length!==1?"s":""]})]}),d.jsxs("div",{style:{display:"grid",gap:8,padding:10},children:[l.map((m,w)=>d.jsx(or,{path:m,onNodeClick:r,focalNodeId:n,t:a},`path-${w}`)),c&&!i&&d.jsxs("button",{onClick:()=>o(!0),style:{background:"none",border:"none",color:a.accent,cursor:"pointer",fontSize:11,fontFamily:a.font,padding:"2px 0",textAlign:"left"},children:["Show ",e.length-s," more path",e.length-s!==1?"s":"","..."]})]})]})}function lr({node:t,isFocal:e,onClick:r,t:n}){const s=Ne[t.type]??"#8b949e",a=Ke[t.type]??t.type.slice(0,3).toUpperCase();return d.jsxs("button",{onClick:r,disabled:!r,style:{display:"inline-flex",alignItems:"center",gap:4,background:e?`${s}18`:n.pillBg??`${n.cellBg}`,border:`1px solid ${e?s:n.cellBorder}`,borderRadius:999,color:n.textPrimary,cursor:r?"pointer":"default",fontSize:10,fontFamily:n.font,padding:"3px 8px",transition:"border-color 0.15s",whiteSpace:"nowrap",maxWidth:180},title:`${t.type}: ${t.name}${t.domain?` (${t.domain})`:""}`,children:[d.jsx("span",{style:{fontSize:8,fontWeight:700,color:"#0d1117",background:s,borderRadius:3,padding:"1px 3px",flexShrink:0},children:a}),d.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name})]})}function dr({layerSummary:t,t:e}){const r=["source","transform","answer","consumption"];if(Object.values(t).reduce((i,o)=>i+o,0)===0)return null;const s={source:"#79c0ff",transform:"#ff7b72",answer:"#56d364",consumption:"#d2a8ff"},a={source:"Sources",transform:"Transform",answer:"Answer",consumption:"Consumption"};return d.jsx("div",{style:{display:"flex",gap:10,fontSize:10,color:e.textMuted,fontFamily:e.font},children:r.map(i=>{const o=t[i]??0;return o===0?null:d.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3},children:[d.jsx("span",{style:{width:8,height:8,borderRadius:2,background:s[i],display:"inline-block"}}),a[i],": ",o]},i)})})}export{or as L,ir as S,dr as a,hr as b};
|
|
14
|
+
"""`}],Zt={chart:["bar","line","area","column","combo","pie","donut","scatter","histogram","heatmap","number","single_value","table"],viz:["bar","line","area","column","combo","pie","donut","scatter","histogram","heatmap","number","single_value","table"],type:["bar","line","area","column","combo","pie","donut","scatter","histogram","heatmap","number","single_value","table"],pattern:["metric_wrapper","entity_profile","entity_rollup","ranking","trend","bridge","drilldown","replacement","custom"],reviewCadence:["daily","weekly","monthly","quarterly","annually"],status:["draft","certified"],type_block:["custom","semantic"]};function Gt(t){return(t.match(/"""/g)??[]).length%2===1}function ge(t){return{label:t.name,type:"property",detail:t.detail,apply:t.snippet?Ut(t.snippet):`${t.name} = `}}function Ut(t){return(e,r,n,s)=>{const a=t.indexOf("$0"),i=t.replace("$0",""),o=a>=0?n+a:n+i.length;e.dispatch({changes:{from:n,to:s,insert:i},selection:{anchor:o}})}}const Vt=t=>{const e=t.state.doc.lineAt(t.pos),r=t.state.sliceDoc(0,t.pos),n=r.slice(e.from);if(Gt(r))return null;const s=/([a-zA-Z_]+)\s*=\s*"([^"]*)$/.exec(n);if(s){const i=Zt[s[1]];if(i){const o=t.pos-s[2].length,l=s[2].toLowerCase();return{from:o,options:i.filter(c=>!l||c.toLowerCase().includes(l)).map(c=>({label:c,type:"enum"})),validFor:/^[\w-]*$/}}return null}const a=t.matchBefore(/[a-zA-Z_]+/);if(a&&/^\s*[a-zA-Z_]+$/.test(n)){const i=a.text.toLowerCase();return{from:a.from,options:me.filter(o=>o.name.toLowerCase().startsWith(i)||o.name.toLowerCase().includes(i)).map(ge),validFor:/^[a-zA-Z_]*$/}}return t.explicit&&/^\s*$/.test(n)?{from:t.pos,options:me.map(ge)}:null},xe=new Map;async function ee(t,e,r){const n=`${t}:${r??""}:${e}`.toLowerCase(),s=xe.get(n);if(s&&s.expiresAt>Date.now())return s.items;const a=new URLSearchParams({kind:t,q:e,limit:"60"});r&&a.set("relation",r);const i=await fetch(`${window.location.origin}/api/editor/completions?${a}`);if(!i.ok)return[];const o=await i.json(),l=Array.isArray(o.completions)?o.completions:[];return xe.set(n,{items:l,expiresAt:Date.now()+2e4}),l}const Ht=async t=>{const e=t.state.sliceDoc(0,t.pos),r=/\b(?:from|join)\s+([\w."-]*)$/i.exec(e);if(r){const a=r[1].replace(/^"/,""),i=await ee("relation",a);return te(t.pos-r[1].length,i)}const n=/([A-Za-z_][\w]*)\.([A-Za-z_][\w]*)?$/.exec(e);if(n){const a=n[1],i=n[2]??"",o=Yt(e,a)??a,l=await ee("column",i,o.replace(/^"|"$/g,""));return te(t.pos-i.length,l)}const s=t.matchBefore(/[A-Za-z_][\w]*$/);if(t.explicit&&s){const a=await ee("column",s.text);return te(s.from,a)}return null};function te(t,e){return{from:t,options:e.map(r=>({label:r.label||r.name,apply:r.apply??r.name,detail:[r.detail,r.relation,r.governance].filter(Boolean).join(" · "),info:r.description,type:r.type==="column"?"property":r.type==="dataset"?"class":"variable",boost:r.governance==="semantic"||r.governance==="project_controlled"?20:0})),validFor:/^[\w."-]*$/}}function Yt(t,e){var n;return(n=new RegExp(`\\b(?:from|join)\\s+([\\w."-]+)(?:\\s+(?:as\\s+)?${Jt(e)})\\b`,"i").exec(t))==null?void 0:n[1]}function Jt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function be(t,e){const r=t?de({schema:t,upperCaseKeywords:!1}):de({upperCaseKeywords:!1}),n=[r,r.language.data.of({autocomplete:je}),r.language.data.of({autocomplete:Ht})];return e&&n.push(r.language.data.of({autocomplete:Vt})),n}function Xt(t){const e=t.match(/LINE\s+(\d+)/i);if(e){const s=parseInt(e[1],10),a=t.match(/\n(\s*)\^/),i=a?a[1].length+1:1;return{line:s,col:i}}const r=t.match(/at line\s+(\d+),?\s*column\s+(\d+)/i);if(r)return{line:parseInt(r[1],10),col:parseInt(r[2],10)};const n=t.match(/line\s+(\d+)/i);return n?{line:parseInt(n[1],10),col:1}:null}const N=V.define(),re=kt.define(),er=Se.define({create(){return R.none},update(t,e){for(const r of e.effects)if(r.is(N)){if(!r.value)return R.none;const{from:n,to:s,message:a}=r.value;return R.set([R.mark({class:"cm-sql-error",attributes:{title:a}}).range(n,s)])}return t},provide:t=>g.decorations.from(t)}),tr=Ct.define([{tag:u.keyword,color:"var(--sql-keyword)",fontWeight:"600"},{tag:[u.controlKeyword,u.moduleKeyword],color:"var(--sql-keyword)",fontWeight:"600"},{tag:[u.string,u.special(u.string)],color:"var(--sql-string)"},{tag:u.number,color:"var(--sql-number)"},{tag:u.bool,color:"var(--sql-number)",fontWeight:"600"},{tag:u.null,color:"var(--sql-number)",fontWeight:"600"},{tag:[u.comment,u.lineComment,u.blockComment,u.docComment],color:"var(--sql-comment)",fontStyle:"italic"},{tag:[u.function(u.variableName),u.function(u.propertyName)],color:"var(--sql-function)"},{tag:[u.typeName,u.className],color:"var(--sql-type)"},{tag:u.operator,color:"var(--sql-punctuation)"},{tag:u.punctuation,color:"var(--sql-punctuation)"},{tag:u.bracket,color:"var(--sql-punctuation)"},{tag:[u.variableName,u.name,u.propertyName,u.attributeName],color:"var(--sql-ident)"},{tag:u.invalid,color:"var(--color-status-error)"}]),rr=g.baseTheme({".cm-sql-error":{textDecoration:"underline wavy var(--color-status-error)",textUnderlineOffset:"3px",background:"color-mix(in srgb, var(--color-status-error) 10%, transparent)"}});function We(t){return g.theme({"&":{background:"transparent",color:"var(--color-text-primary)"},".cm-content":{caretColor:"var(--color-text-primary)"},".cm-cursor":{borderLeftColor:"var(--color-text-primary)"},".cm-selectionBackground":{background:"color-mix(in srgb, var(--color-accent-blue) 30%, transparent)"},"&.cm-focused .cm-selectionBackground":{background:"color-mix(in srgb, var(--color-accent-blue) 30%, transparent)"},".cm-gutters":{background:"transparent",color:"var(--color-text-tertiary)",border:"none",borderRight:"1px solid var(--color-border-subtle)"},".cm-activeLineGutter":{background:"transparent"},".cm-activeLine":{background:"transparent"},"&.cm-focused .cm-activeLineGutter":{background:"var(--color-bg-hover)"},"&.cm-focused .cm-activeLine":{background:"var(--color-bg-hover)"},".cm-matchingBracket":{background:"color-mix(in srgb, var(--color-accent-blue) 18%, transparent)",outline:"1px solid var(--color-accent-blue)"},".cm-foldPlaceholder":{background:"var(--color-bg-tertiary)",border:"1px solid var(--color-border-subtle)",color:"var(--color-text-secondary)",borderRadius:3,padding:"0 4px"},".cm-tooltip":{background:"var(--color-bg-card)",border:"1px solid var(--color-border-primary)",color:"var(--color-text-primary)",borderRadius:6,boxShadow:"0 4px 12px color-mix(in srgb, var(--color-bg-primary) 40%, transparent)"},".cm-tooltip.cm-tooltip-autocomplete":{"& > ul > li":{padding:"3px 8px"},"& > ul > li[aria-selected]":{background:"color-mix(in srgb, var(--color-accent-blue) 20%, transparent)",color:"var(--color-accent-blue)"}},".cm-searchMatch":{background:"color-mix(in srgb, var(--color-status-warning) 25%, transparent)",outline:"1px solid var(--color-status-warning)"},".cm-searchMatch.cm-searchMatch-selected":{background:"color-mix(in srgb, var(--color-status-warning) 50%, transparent)"},".cm-panels":{background:"var(--color-bg-secondary)",borderTop:"1px solid var(--color-border-subtle)"},".cm-panel":{padding:"6px 8px"},".cm-panel input":{background:"var(--color-bg-sunken)",border:"1px solid var(--color-border-subtle)",color:"var(--color-text-primary)",borderRadius:4,padding:"2px 6px",fontSize:12},".cm-panel button":{background:"var(--color-bg-tertiary)",border:"1px solid var(--color-border-subtle)",color:"var(--color-text-primary)",borderRadius:4,padding:"2px 8px",cursor:"pointer",fontSize:12,marginLeft:4}},{dark:t})}const nr=We(!0),sr=We(!1);function ar(t){return t==="midnight"||t==="obsidian"||t==="dark"}function ir({value:t,onChange:e,onRun:r,themeMode:n,autoFocus:s,schema:a,errorMessage:i,editorRef:o,wrap:l=!0,fillHeight:c=!1,dqlMode:m=!1}){const w=_e[n],k=v.useRef(null),f=v.useRef(null),[T,A]=v.useState(!1),E=v.useRef(r),ce=v.useRef(e),ue=v.useRef(new rt);return E.current=r,ce.current=e,v.useEffect(()=>{o&&(o.current={undo:()=>{f.current&&st(f.current)},redo:()=>{f.current&&nt(f.current)},resetTo:h=>{const p=f.current;p&&p.dispatch({changes:{from:0,to:p.state.doc.length,insert:h},annotations:re.of(!0)})}})}),v.useEffect(()=>{if(!k.current)return;const h=at.of([{key:"Shift-Enter",run:()=>(E.current(),!0)},{key:"Ctrl-Enter",mac:"Cmd-Enter",run:()=>(E.current(),!0)},{key:"Ctrl-/",mac:"Cmd-/",run:it},ot,...lt,...ct,...ut,...Nt,...ht,...dt]),p=g.updateListener.of(P=>{const D=P.transactions.some(De=>De.annotation(re));P.docChanged&&!D&&ce.current(P.state.doc.toString())}),x=g.domEventHandlers({focus:(P,D)=>{Oe(D)},blur:(P,D)=>{ze(D)}}),C=g.theme({"&":{background:"var(--color-bg-surface)",color:"var(--color-text-primary)",fontFamily:"var(--font-mono)",fontSize:"13px",minHeight:c?"100%":"80px",maxHeight:c?"none":"480px",...c?{height:"100%"}:{}},".cm-scroller":{overflow:"auto",fontFamily:"inherit",...c?{height:"100%"}:{}},".cm-content":{padding:"10px 0",minHeight:c?"100%":"80px",color:"var(--color-text-primary)"},"&.cm-focused":{outline:"none"},".cm-editor":{border:"none"},".cm-gutters":{minWidth:40},".cm-foldGutter":{cursor:"pointer"}}),j=be(a,m),H=[h,p,x,C,ue.current.of(j),ft({closeOnBlur:!1}),pt(),mt(),gt(),xt(),bt(),yt(),vt(),St(),...l?[g.lineWrapping]:[],At({top:!0}),er,rr,wt(tr),ar(n)?nr:sr],Pe=we.create({doc:t,extensions:H}),Y=new g({state:Pe,parent:k.current});return f.current=Y,s&&Y.focus(),()=>{Y.destroy(),f.current=null}},[n]),v.useEffect(()=>{const h=f.current;h&&h.dispatch({effects:ue.current.reconfigure(be(a,m))})},[a,m]),v.useEffect(()=>{const h=f.current;if(!h)return;const p=h.state.doc.toString();p!==t&&h.dispatch({changes:{from:0,to:p.length,insert:t},annotations:re.of(!0)})},[t]),v.useEffect(()=>{const h=f.current;if(!h)return;if(!i){h.dispatch({effects:N.of(null)});return}const p=Xt(i),x=h.state.doc;if(p&&p.line>=1&&p.line<=x.lines){const C=x.line(p.line),j=C.from+Math.max(0,p.col-1),H=Math.max(j+1,C.to);h.dispatch({effects:N.of({from:Math.min(j,x.length),to:Math.min(H,x.length),message:i})})}else if(x.lines>=1){const C=x.line(1);h.dispatch({effects:N.of({from:C.from,to:Math.max(C.from+1,C.to),message:i})})}},[i]),d.jsx("div",{onDragOver:h=>{h.dataTransfer.types.includes(he)&&(h.preventDefault(),A(!0))},onDragLeave:()=>A(!1),onDrop:h=>{const p=f.current;if(!p)return;const x=Be(h.dataTransfer.getData(he));x&&(h.preventDefault(),A(!1),Ie(p,x.reference,{x:h.clientX,y:h.clientY}),Te.trackUsage(x.name),window.dispatchEvent(new CustomEvent("dql:semantic-used",{detail:{name:x.name}})))},style:{background:"var(--color-bg-surface)",height:c?"100%":void 0,minHeight:c?0:80,border:T?`1px solid ${w.accent}`:"1px solid transparent",borderRadius:c?0:6,transition:"border-color 0.15s",overflow:"hidden"},children:d.jsx("div",{ref:k,style:{height:c?"100%":void 0,minHeight:c?0:80}})})}ir.displayName="SQLCellEditor";function or({path:t,onNodeClick:e,focalNodeId:r,t:n}){return t.nodes.length===0?null:d.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4,alignItems:"center"},children:t.nodes.map((s,a)=>d.jsxs(ye.Fragment,{children:[d.jsx(lr,{node:s,isFocal:s.id===r,onClick:e?()=>e(s.id):void 0,t:n}),a<t.nodes.length-1&&d.jsx("span",{style:{color:n.textMuted,fontSize:10,lineHeight:1},children:"→"})]},s.id))})}function hr({title:t,paths:e,onNodeClick:r,focalNodeId:n,maxVisible:s=4,t:a}){const[i,o]=ye.useState(!1),l=i?e:e.slice(0,s),c=e.length>s;return e.length===0?null:d.jsxs("div",{style:{border:`1px solid ${a.cellBorder}`,borderRadius:10,overflow:"hidden",background:a.inputBg},children:[d.jsxs("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${a.cellBorder}`,fontSize:11,fontWeight:700,color:a.textMuted,fontFamily:a.font,textTransform:"uppercase",letterSpacing:"0.04em",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[d.jsx("span",{children:t}),d.jsxs("span",{style:{fontWeight:400,fontSize:10},children:[e.length," path",e.length!==1?"s":""]})]}),d.jsxs("div",{style:{display:"grid",gap:8,padding:10},children:[l.map((m,w)=>d.jsx(or,{path:m,onNodeClick:r,focalNodeId:n,t:a},`path-${w}`)),c&&!i&&d.jsxs("button",{onClick:()=>o(!0),style:{background:"none",border:"none",color:a.accent,cursor:"pointer",fontSize:11,fontFamily:a.font,padding:"2px 0",textAlign:"left"},children:["Show ",e.length-s," more path",e.length-s!==1?"s":"","..."]})]})]})}function lr({node:t,isFocal:e,onClick:r,t:n}){const s=Ne[t.type]??"#8b949e",a=Ke[t.type]??t.type.slice(0,3).toUpperCase();return d.jsxs("button",{onClick:r,disabled:!r,style:{display:"inline-flex",alignItems:"center",gap:4,background:e?`${s}18`:n.pillBg??`${n.cellBg}`,border:`1px solid ${e?s:n.cellBorder}`,borderRadius:999,color:n.textPrimary,cursor:r?"pointer":"default",fontSize:10,fontFamily:n.font,padding:"3px 8px",transition:"border-color 0.15s",whiteSpace:"nowrap",maxWidth:180},title:`${t.type}: ${t.name}${t.domain?` (${t.domain})`:""}`,children:[d.jsx("span",{style:{fontSize:8,fontWeight:700,color:"#0d1117",background:s,borderRadius:3,padding:"1px 3px",flexShrink:0},children:a}),d.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name})]})}function dr({layerSummary:t,t:e}){const r=["source","transform","answer","consumption"];if(Object.values(t).reduce((i,o)=>i+o,0)===0)return null;const s={source:"#79c0ff",transform:"#ff7b72",answer:"#56d364",consumption:"#d2a8ff"},a={source:"Sources",transform:"Transform",answer:"Answer",consumption:"Consumption"};return d.jsx("div",{style:{display:"flex",gap:10,fontSize:10,color:e.textMuted,fontFamily:e.font},children:r.map(i=>{const o=t[i]??0;return o===0?null:d.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3},children:[d.jsx("span",{style:{width:8,height:8,borderRadius:2,background:s[i],display:"inline-block"}}),a[i],": ",o]},i)})})}export{or as L,ir as S,dr as a,hr as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,r as h,
|
|
1
|
+
import{j as t,r as h,aB as O,aC as x,aD as S,q as C,p as L}from"./index-DJRMz64S.js";import{R as D,u as N,a as T,d as z,M as _,i as F,B as G,T as b,H as m,c as v}from"./dagre.esm-CPT_vn5p.js";function A(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=L[a]??"var(--color-text-tertiary)",o=C[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]=N([]),[w,y,j]=T([]),{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(A(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(F,{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(G,{color:"var(--color-border-subtle)",gap:20,size:1})})})}function I(e){return t.jsx(D,{children:t.jsx(W,{...e})})}export{I as M};
|
package/dist/assets/dql-notebook/assets/{NewBlockModal-DHn-CEEW.js → NewBlockModal-DKVkXD20.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-DJRMz64S.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-DJRMz64S.js";import{B as k}from"./book-open-text-B-dcHHn0.js";import{X as q}from"./x-B4coLiOl.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.
|