@duckcodeailabs/dql-cli 1.13.0 → 1.13.1

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.
Files changed (79) hide show
  1. package/dist/args.d.ts +2 -0
  2. package/dist/args.d.ts.map +1 -1
  3. package/dist/args.js +3 -0
  4. package/dist/args.js.map +1 -1
  5. package/dist/assets/dql-notebook/assets/{AgentAnswerCard-Cp0eh6zU.js → AgentAnswerCard-c8QUo6NH.js} +4 -4
  6. package/dist/assets/dql-notebook/assets/{AgentLogPage-CBGEoGmU.js → AgentLogPage-D6fgEAEy.js} +1 -1
  7. package/dist/assets/dql-notebook/assets/{AiBuildDialog-CwAD3tXE.js → AiBuildDialog-8miXFPse.js} +1 -1
  8. package/dist/assets/dql-notebook/assets/{AiBuildResult-CyqTuQe5.js → AiBuildResult-DPJ_SI0R.js} +3 -3
  9. package/dist/assets/dql-notebook/assets/{AiSidePanel-DjB8PWHG.js → AiSidePanel-NVA6lZnn.js} +1 -1
  10. package/dist/assets/dql-notebook/assets/{AnalyticsHome-B7BkvA-R.js → AnalyticsHome-DgwnRW71.js} +2 -2
  11. package/dist/assets/dql-notebook/assets/AppsView-B6LYUpgm.js +4578 -0
  12. package/dist/assets/dql-notebook/assets/BlockStudio--jNw9XUI.js +60 -0
  13. package/dist/assets/dql-notebook/assets/{BusinessArtifactView-C4SZVNW-.js → BusinessArtifactView-DtRMiaF4.js} +1 -1
  14. package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-DhBsLCYr.js +22 -0
  15. package/dist/assets/dql-notebook/assets/{GitPage-BfVD4tVq.js → GitPage-CazC-eTR.js} +1 -1
  16. package/dist/assets/dql-notebook/assets/GlobalAiRail-1Tgweuu2.js +1 -0
  17. package/dist/assets/dql-notebook/assets/GovernedContextPage-C7qGrH3d.js +16 -0
  18. package/dist/assets/dql-notebook/assets/{HelpDocsPage-BDPNVot1.js → HelpDocsPage-DMHPsVqP.js} +1 -1
  19. package/dist/assets/dql-notebook/assets/{HomePage-DiOnRhEG.js → HomePage-DcSI4dnU.js} +1 -1
  20. package/dist/assets/dql-notebook/assets/{LineageDAG-BiUFX2KL.js → LineageDAG-BJ6xz06u.js} +1 -1
  21. package/dist/assets/dql-notebook/assets/{LineageDetailView-CfbSvlPJ.js → LineageDetailView-8WrQm-MF.js} +1 -1
  22. package/dist/assets/dql-notebook/assets/{LineageDrawer-CgTScaGB.js → LineageDrawer-hnqCW_t-.js} +1 -1
  23. package/dist/assets/dql-notebook/assets/{LineagePathBreadcrumb-D7ZA7k68.js → LineagePathBreadcrumb-B4LZTUsl.js} +1 -1
  24. package/dist/assets/dql-notebook/assets/{MiniLineageGraph-GkD4y17x.js → MiniLineageGraph-CotnRuxa.js} +1 -1
  25. package/dist/assets/dql-notebook/assets/{NewBlockModal-B9TfRjt7.js → NewBlockModal-DHn-CEEW.js} +1 -1
  26. package/dist/assets/dql-notebook/assets/{NewNotebookModal-BbO9NKUl.js → NewNotebookModal-BPGp-8oq.js} +1 -1
  27. package/dist/assets/dql-notebook/assets/{NotebookEditor-CuMpvXR9.js → NotebookEditor-B0OTHM6W.js} +26 -31
  28. package/dist/assets/dql-notebook/assets/{ReadinessPage-BROJ9YBM.js → ReadinessPage-CoOIpxWq.js} +1 -1
  29. package/dist/assets/dql-notebook/assets/{SetupOnboarding-BCcZlpuQ.js → SetupOnboarding-DxK_mFzf.js} +1 -1
  30. package/dist/assets/dql-notebook/assets/{TrustBadge-vQQh8d0D.js → TrustBadge-ZuD5N5Ww.js} +1 -1
  31. package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-duFXXNV_.js +88 -0
  32. package/dist/assets/dql-notebook/assets/{answer-to-notebook-DuqCcDDl.js → answer-to-notebook-WAVAYjBv.js} +1 -1
  33. package/dist/assets/dql-notebook/assets/{arrow-left-CMe1kkOL.js → arrow-left-L8odLbyN.js} +1 -1
  34. package/dist/assets/dql-notebook/assets/{arrow-right-DvB_DONr.js → arrow-right-WIF1V9a9.js} +1 -1
  35. package/dist/assets/dql-notebook/assets/{book-open-text-CJ3NAvrs.js → book-open-text-BpqWMa4m.js} +1 -1
  36. package/dist/assets/dql-notebook/assets/{bot-CV8DYRrt.js → bot-CLR1V6dO.js} +1 -1
  37. package/dist/assets/dql-notebook/assets/{circle-x-BCgtha1W.js → circle-x-CQBOM0b0.js} +1 -1
  38. package/dist/assets/dql-notebook/assets/{dagre.esm-GKp7qoUL.js → dagre.esm-DlZi7NR3.js} +1 -1
  39. package/dist/assets/dql-notebook/assets/{external-link-C-PXokWV.js → external-link-DYqdQIGp.js} +1 -1
  40. package/dist/assets/dql-notebook/assets/{grip-vertical-B4EHbGXW.js → grip-vertical-HmUijbwN.js} +1 -1
  41. package/dist/assets/dql-notebook/assets/{index-1mIC_XX4.js → index-Cpx47jCH.js} +43 -43
  42. package/dist/assets/dql-notebook/assets/{list-tree-BRFpEmvV.js → list-tree-DGKqCxmz.js} +1 -1
  43. package/dist/assets/dql-notebook/assets/{minimize-2-CDwSCGlO.js → minimize-2-C8dvqCxX.js} +1 -1
  44. package/dist/assets/dql-notebook/assets/{panel-right-open-CunA1xO7.js → panel-right-open-yuVkIo5n.js} +1 -1
  45. package/dist/assets/dql-notebook/assets/{rotate-ccw-DOrfTZk8.js → rotate-ccw-Di0kRnrM.js} +1 -1
  46. package/dist/assets/dql-notebook/assets/{semantic-fields-AfQvjt5R.js → semantic-fields-BMQV0li8.js} +1 -1
  47. package/dist/assets/dql-notebook/assets/sliders-horizontal-alebptlJ.js +6 -0
  48. package/dist/assets/dql-notebook/assets/{star-DDhv4e8M.js → star-CgCQbnXc.js} +1 -1
  49. package/dist/assets/dql-notebook/assets/{triangle-alert-2ZXx8wAu.js → triangle-alert-SyuSZ4ht.js} +1 -1
  50. package/dist/assets/dql-notebook/assets/upload-BPhfea_E.js +11 -0
  51. package/dist/assets/dql-notebook/assets/usePersistedAgentThreadId-Bnl9gWhj.js +28 -0
  52. package/dist/assets/dql-notebook/assets/{user-round-BA074kiQ.js → user-round-J4PQHxo9.js} +1 -1
  53. package/dist/assets/dql-notebook/assets/{wand-sparkles-CEYHLt9b.js → wand-sparkles-c4WDXTCk.js} +1 -1
  54. package/dist/assets/dql-notebook/assets/{workflow-CZtyrcR-.js → workflow-NtRLaq7n.js} +1 -1
  55. package/dist/assets/dql-notebook/assets/{wrench-Ong23-wu.js → wrench-CS1f1Zv4.js} +1 -1
  56. package/dist/assets/dql-notebook/assets/{x-CSo1M3tu.js → x-CbKEfe5m.js} +1 -1
  57. package/dist/assets/dql-notebook/index.html +1 -1
  58. package/dist/commands/model.d.ts.map +1 -1
  59. package/dist/commands/model.js +62 -1
  60. package/dist/commands/model.js.map +1 -1
  61. package/dist/index.js +3 -0
  62. package/dist/index.js.map +1 -1
  63. package/dist/local-runtime.d.ts +10 -0
  64. package/dist/local-runtime.d.ts.map +1 -1
  65. package/dist/local-runtime.js +1061 -17
  66. package/dist/local-runtime.js.map +1 -1
  67. package/dist/package.json +10 -10
  68. package/package.json +10 -10
  69. package/dist/assets/dql-notebook/assets/AppsView-CUrqtEGC.js +0 -4583
  70. package/dist/assets/dql-notebook/assets/BlockStudio-Bl0aGQJR.js +0 -60
  71. package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-B0uxitnx.js +0 -22
  72. package/dist/assets/dql-notebook/assets/GlobalAiRail-DUwdy3fB.js +0 -1
  73. package/dist/assets/dql-notebook/assets/GovernedContextPage-D9f26ZFb.js +0 -7
  74. package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-Dj4AXAhT.js +0 -83
  75. package/dist/assets/dql-notebook/assets/chevron-up-HxU1l85K.js +0 -6
  76. package/dist/assets/dql-notebook/assets/link-2-BLx-goet.js +0 -6
  77. package/dist/assets/dql-notebook/assets/maximize-2-CCd5uRIZ.js +0 -6
  78. package/dist/assets/dql-notebook/assets/pencil-D_I14Wyk.js +0 -6
  79. package/dist/assets/dql-notebook/assets/usePersistedAgentThreadId-3rzkZrqc.js +0 -18
@@ -1 +1 @@
1
- import{j as t,r as h,az as O,aA as x,aB as S,q as L,p as C}from"./index-1mIC_XX4.js";import{R as N,u as T,a as D,d as z,M as _,i as A,B as F,T as b,H as m,c as v}from"./dagre.esm-GKp7qoUL.js";function G(e,c,a={}){var s;if(e.length===0)return e;const n=new b.graphlib.Graph().setDefaultEdgeLabel(()=>({}));n.setGraph({rankdir:"LR",ranksep:60,nodesep:30,marginx:20,marginy:20});for(const o of e){const i={width:170,height:52};if(a.mode==="layered"&&((s=o.data)!=null&&s.layer)){const d=S.indexOf(o.data.layer);d>=0&&(i.rank=d)}n.setNode(o.id,i)}for(const o of c)n.setEdge(o.source,o.target);return b.layout(n),e.map(o=>{const i=n.node(o.id);return{...o,position:{x:i.x-85,y:i.y-26}}})}function B({data:e,selected:c}){const a=e.nodeType,n=e.isFocal,s=C[a]??"var(--color-text-tertiary)",o=L[a]??a.toUpperCase();return t.jsxs("div",{style:{minWidth:140,maxWidth:190,background:"var(--color-bg-card)",border:`2px solid ${n||c?"var(--color-accent-blue)":s}`,borderRadius:8,padding:"6px 8px",boxShadow:n?"0 0 0 2px color-mix(in srgb, var(--color-accent-blue) 25%, transparent)":"none"},children:[t.jsx(m,{type:"target",position:v.Left,style:{width:6,height:6,background:s,border:"none"}}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:2},children:[t.jsx("span",{style:{fontSize:8,fontWeight:700,letterSpacing:"0.04em",color:"var(--color-bg-card)",background:s,borderRadius:3,padding:"1px 4px"},children:o}),e.domain&&t.jsx("span",{style:{color:"var(--color-text-tertiary)",fontSize:9},children:e.domain})]}),t.jsx("div",{style:{color:"var(--color-text-primary)",fontSize:10,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:e.label,children:e.label}),t.jsx(m,{type:"source",position:v.Right,style:{width:6,height:6,background:s,border:"none"}})]})}const M={miniDagNode:B};function W({nodes:e,edges:c,focalNodeId:a,height:n=250,onNodeClick:s,interactive:o=!0,layoutMode:i="flow",fitViewPadding:d=.15}){const[E,f,R]=T([]),[w,y,j]=D([]),{fitView:p}=z(),u=h.useRef(null);return h.useEffect(()=>{const g=e.map(r=>({id:r.id,type:"miniDagNode",position:{x:0,y:0},data:{label:r.name,nodeType:r.type,domain:r.domain,layer:O(r),isFocal:r.id===a}})),l=c.map((r,k)=>({id:`mini-edge-${k}-${r.source}-${r.target}`,source:r.source,target:r.target,style:{stroke:x[r.type]??"#8b949e",strokeWidth:1.4},markerEnd:{type:_.ArrowClosed,color:x[r.type]??"#8b949e",width:10,height:10}}));f(G(g,l,{mode:i})),y(l),requestAnimationFrame(()=>{p({padding:d,duration:200})})},[e,c,a,i,d,f,y,p]),h.useEffect(()=>{if(!u.current)return;const g=u.current,l=new ResizeObserver(()=>{p({padding:d,duration:0})});return l.observe(g),()=>l.disconnect()},[p,d]),e.length===0?t.jsx("div",{style:{height:n,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--color-text-tertiary)",fontSize:11},children:"No lineage nodes to display"}):t.jsx("div",{ref:u,style:{height:n,width:"100%",borderRadius:8,overflow:"hidden",border:"1px solid var(--color-border-subtle)"},children:t.jsx(A,{nodes:E,edges:w,onNodesChange:o?R:void 0,onEdgesChange:o?j:void 0,onNodeClick:s?(g,l)=>s(l.id):void 0,nodeTypes:M,fitView:!0,fitViewOptions:{padding:d},minZoom:.25,proOptions:{hideAttribution:!0},nodesDraggable:o,nodesConnectable:!1,zoomOnScroll:o,panOnDrag:o,style:{background:"var(--color-bg-sunken)"},children:t.jsx(F,{color:"var(--color-border-subtle)",gap:20,size:1})})})}function I(e){return t.jsx(N,{children:t.jsx(W,{...e})})}export{I as M};
1
+ import{j as t,r as h,az as O,aA as x,aB as S,q as L,p as C}from"./index-Cpx47jCH.js";import{R as N,u as T,a as D,d as z,M as _,i as A,B as F,T as b,H as m,c as v}from"./dagre.esm-DlZi7NR3.js";function G(e,c,a={}){var s;if(e.length===0)return e;const n=new b.graphlib.Graph().setDefaultEdgeLabel(()=>({}));n.setGraph({rankdir:"LR",ranksep:60,nodesep:30,marginx:20,marginy:20});for(const o of e){const i={width:170,height:52};if(a.mode==="layered"&&((s=o.data)!=null&&s.layer)){const d=S.indexOf(o.data.layer);d>=0&&(i.rank=d)}n.setNode(o.id,i)}for(const o of c)n.setEdge(o.source,o.target);return b.layout(n),e.map(o=>{const i=n.node(o.id);return{...o,position:{x:i.x-85,y:i.y-26}}})}function B({data:e,selected:c}){const a=e.nodeType,n=e.isFocal,s=C[a]??"var(--color-text-tertiary)",o=L[a]??a.toUpperCase();return t.jsxs("div",{style:{minWidth:140,maxWidth:190,background:"var(--color-bg-card)",border:`2px solid ${n||c?"var(--color-accent-blue)":s}`,borderRadius:8,padding:"6px 8px",boxShadow:n?"0 0 0 2px color-mix(in srgb, var(--color-accent-blue) 25%, transparent)":"none"},children:[t.jsx(m,{type:"target",position:v.Left,style:{width:6,height:6,background:s,border:"none"}}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:2},children:[t.jsx("span",{style:{fontSize:8,fontWeight:700,letterSpacing:"0.04em",color:"var(--color-bg-card)",background:s,borderRadius:3,padding:"1px 4px"},children:o}),e.domain&&t.jsx("span",{style:{color:"var(--color-text-tertiary)",fontSize:9},children:e.domain})]}),t.jsx("div",{style:{color:"var(--color-text-primary)",fontSize:10,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:e.label,children:e.label}),t.jsx(m,{type:"source",position:v.Right,style:{width:6,height:6,background:s,border:"none"}})]})}const M={miniDagNode:B};function W({nodes:e,edges:c,focalNodeId:a,height:n=250,onNodeClick:s,interactive:o=!0,layoutMode:i="flow",fitViewPadding:d=.15}){const[E,f,R]=T([]),[w,y,j]=D([]),{fitView:p}=z(),u=h.useRef(null);return h.useEffect(()=>{const g=e.map(r=>({id:r.id,type:"miniDagNode",position:{x:0,y:0},data:{label:r.name,nodeType:r.type,domain:r.domain,layer:O(r),isFocal:r.id===a}})),l=c.map((r,k)=>({id:`mini-edge-${k}-${r.source}-${r.target}`,source:r.source,target:r.target,style:{stroke:x[r.type]??"#8b949e",strokeWidth:1.4},markerEnd:{type:_.ArrowClosed,color:x[r.type]??"#8b949e",width:10,height:10}}));f(G(g,l,{mode:i})),y(l),requestAnimationFrame(()=>{p({padding:d,duration:200})})},[e,c,a,i,d,f,y,p]),h.useEffect(()=>{if(!u.current)return;const g=u.current,l=new ResizeObserver(()=>{p({padding:d,duration:0})});return l.observe(g),()=>l.disconnect()},[p,d]),e.length===0?t.jsx("div",{style:{height:n,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--color-text-tertiary)",fontSize:11},children:"No lineage nodes to display"}):t.jsx("div",{ref:u,style:{height:n,width:"100%",borderRadius:8,overflow:"hidden",border:"1px solid var(--color-border-subtle)"},children:t.jsx(A,{nodes:E,edges:w,onNodesChange:o?R:void 0,onEdgesChange:o?j:void 0,onNodeClick:s?(g,l)=>s(l.id):void 0,nodeTypes:M,fitView:!0,fitViewOptions:{padding:d},minZoom:.25,proOptions:{hideAttribution:!0},nodesDraggable:o,nodesConnectable:!1,zoomOnScroll:o,panOnDrag:o,style:{background:"var(--color-bg-sunken)"},children:t.jsx(F,{color:"var(--color-border-subtle)",gap:20,size:1})})})}function I(e){return t.jsx(N,{children:t.jsx(W,{...e})})}export{I as M};
@@ -1 +1 @@
1
- import{u as w,t as z,r as l,V as O,j as t,a as D}from"./index-1mIC_XX4.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
+ import{u as w,t as z,r as l,V as O,j as t,a as D}from"./index-Cpx47jCH.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-1mIC_XX4.js";import{B as k}from"./book-open-text-CJ3NAvrs.js";import{X as q}from"./x-CSo1M3tu.js";import"./react-CRB3T2We.js";/**
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-Cpx47jCH.js";import{B as k}from"./book-open-text-BpqWMa4m.js";import{X as q}from"./x-CbKEfe5m.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.