ocean-brain 0.3.1 → 0.3.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.
Files changed (44) hide show
  1. package/dist/mcp.js +6 -6
  2. package/package.json +1 -1
  3. package/server/client/dist/assets/Calendar-DyXzs5M3.js +25 -0
  4. package/server/client/dist/assets/Graph-C8K4PJOn.js +1 -0
  5. package/server/client/dist/assets/{Image.es-Dnn4SMzG.js → Image.es-CFTbON7k.js} +1 -1
  6. package/server/client/dist/assets/{ModalActionRow-B3vNjcDc.js → ModalActionRow-Hg6MY61u.js} +1 -1
  7. package/server/client/dist/assets/Note-BbgZvrC3.js +1 -0
  8. package/server/client/dist/assets/Reminders-jFhljND4.js +1 -0
  9. package/server/client/dist/assets/Search-X6QIR_m2.js +1 -0
  10. package/server/client/dist/assets/SurfaceCard-BV6y4bCo.js +1 -0
  11. package/server/client/dist/assets/Tag-Ba2Dw4gH.js +1 -0
  12. package/server/client/dist/assets/TagNotes-BRJv6sDI.js +1 -0
  13. package/server/client/dist/assets/{Trash.es-DLiHgjNo.js → Trash.es-CPtRLE0y.js} +1 -1
  14. package/server/client/dist/assets/{image.api-CjJgNbC0.js → image.api-Dsrx9S-G.js} +1 -1
  15. package/server/client/dist/assets/index-BglnLSet.js +205 -0
  16. package/server/client/dist/assets/index-CD2bFEqK.css +1 -0
  17. package/server/client/dist/assets/index-DpqKngJz.js +1 -0
  18. package/server/client/dist/assets/manage-image-C6Y_0M5H.js +1 -0
  19. package/server/client/dist/assets/manage-image-detail-Dv3xofpe.js +1 -0
  20. package/server/client/dist/assets/mcp-BijQkpfY.js +1 -0
  21. package/server/client/dist/assets/placeholder-MNsco0AT.js +34 -0
  22. package/server/client/dist/assets/trash-CiFJm_PK.js +1 -0
  23. package/server/client/dist/assets/useReminderMutate-yJak8FzP.js +82 -0
  24. package/server/client/dist/index.html +2 -2
  25. package/server/dist/modules/blocknote.js +106 -31
  26. package/server/dist/modules/blocknote.js.map +1 -1
  27. package/server/client/dist/assets/Calendar-DynpmB3D.js +0 -25
  28. package/server/client/dist/assets/Callout-tNHgPhLM.js +0 -1
  29. package/server/client/dist/assets/Graph-DMXLUfCv.js +0 -1
  30. package/server/client/dist/assets/Note-PDMuj62M.js +0 -1
  31. package/server/client/dist/assets/Reminders-ComtTLuN.js +0 -1
  32. package/server/client/dist/assets/Search-BJeZTbVu.js +0 -1
  33. package/server/client/dist/assets/SurfaceCard-DAcVMY4f.js +0 -1
  34. package/server/client/dist/assets/Tag-BuNCDGD5.js +0 -1
  35. package/server/client/dist/assets/TagNotes-ajFOP5pZ.js +0 -1
  36. package/server/client/dist/assets/index-CDrZmLC2.js +0 -1
  37. package/server/client/dist/assets/index-DAZMX8bQ.css +0 -1
  38. package/server/client/dist/assets/index-DqFkOWbi.js +0 -205
  39. package/server/client/dist/assets/manage-image-CVyZTDT_.js +0 -1
  40. package/server/client/dist/assets/manage-image-detail-Bp17tylS.js +0 -1
  41. package/server/client/dist/assets/mcp-BpD7VH-d.js +0 -1
  42. package/server/client/dist/assets/placeholder-DSf4QF4v.js +0 -34
  43. package/server/client/dist/assets/trash-Ceb17h_s.js +0 -1
  44. package/server/client/dist/assets/useReminderMutate-CzyOQ_VB.js +0 -82
@@ -1 +0,0 @@
1
- import{j as e}from"./note-vendor-BofYbzmZ.js";import{k as x,q as m,ag as p,G as y,w as j,I,P as E,Q as A,E as N,L as M,ah as v,B as G,f as S,S as l,e as w,a9 as T}from"./index-DqFkOWbi.js";import"./graph-vendor-CUxe67Lr.js";import{I as _}from"./Image-ZxF459sC.js";import{S as b}from"./SurfaceCard-DAcVMY4f.js";import{f as P,d as R}from"./image.api-CjJgNbC0.js";import{c as k,n as q}from"./Trash.es-DLiHgjNo.js";import"./note-core-BCgMq5QA.js";const C=r=>{const{data:n}=x({queryKey:m.images.list(r.searchParams),async queryFn(){const t=await P({offset:r.searchParams.offset,limit:r.searchParams.limit});if(t.type==="error")throw t;return t.allImages}});return r.render(n)},L=240,Q=20,D=4,d=w(T),J=()=>{const r=p(),n=y(),t=d.useNavigate(),{page:o}=d.useSearch(),{containerRef:u,limit:i}=j({minItemWidth:L,gap:Q,rows:D}),h=I({mutationFn:R,onSuccess:a=>{if(a.type==="error")throw a;n.invalidateQueries({queryKey:m.images.listAll(),exact:!1})}}),f=async a=>{await r("Are you really sure?")&&h.mutate(a)};return e.jsx(E,{title:"Images",variant:"subtle",description:"Manage images uploaded to your notes",children:e.jsx("div",{ref:u,children:e.jsx(A,{fallback:e.jsxs("div",{className:"grid-auto-cards grid gap-4",children:[e.jsx(l,{height:"200px"}),e.jsx(l,{height:"200px"}),e.jsx(l,{height:"200px"})]}),errorTitle:"Failed to load images",errorDescription:"Retry loading uploaded image metadata.",resetKeys:[o,i],children:e.jsx(C,{searchParams:{offset:(o-1)*i,limit:i},render:({images:a,totalCount:c})=>a.length===0?e.jsx(N,{title:"There are no images",description:"Try drag and drop an image on the note editor."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid-auto-cards grid gap-4",children:a.map(s=>e.jsxs(b,{flush:!0,children:[e.jsx(M,{to:v,params:{id:s.id},className:"block overflow-hidden",children:e.jsx(_,{className:"h-48 w-full object-cover transition-transform duration-200 hover:scale-[1.02]",src:s.url,alt:s.id})}),e.jsxs("div",{className:"flex items-center justify-between border-t border-border-subtle px-3 py-2.5",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-medium text-fg-tertiary",children:[e.jsx(k,{className:"h-3.5 w-3.5"}),s.referenceCount]}),e.jsx(G,{variant:"ghost",size:"icon-sm",disabled:s.referenceCount>0,onClick:()=>f(s.id),children:e.jsx(q,{className:"h-4 w-4"})})]})]},s.id))}),c&&i<c&&e.jsx(S,{page:o,last:Math.ceil(c/i),onChange:s=>{t({search:g=>({...g,page:s})})}})]})})})})})};export{J as default};
@@ -1 +0,0 @@
1
- import{j as e}from"./note-vendor-BofYbzmZ.js";import{p as b,ai as y,L as f,N as C,x as E,aj as A,ag as v,A as w,G as I,u as h,q as d,ak as M,P as T,a9 as u,b as S,al as Z,B as p,am as _,e as D,ah as F}from"./index-DqFkOWbi.js";import{I as R}from"./Image-ZxF459sC.js";import{S as x}from"./SurfaceCard-DAcVMY4f.js";import{a}from"./graph-vendor-CUxe67Lr.js";import{a as q,d as G}from"./image.api-CjJgNbC0.js";import{c as z,n as k}from"./Trash.es-DLiHgjNo.js";import{I as B}from"./Image.es-Dnn4SMzG.js";import"./note-core-BCgMq5QA.js";const O=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M178,36c-20.09,0-37.92,7.93-50,21.56C115.92,43.93,98.09,36,78,36a66.08,66.08,0,0,0-66,66c0,72.34,105.81,130.14,110.31,132.57a12,12,0,0,0,11.38,0C138.19,232.14,244,174.34,244,102A66.08,66.08,0,0,0,178,36Zm-5.49,142.36A328.69,328.69,0,0,1,128,210.16a328.69,328.69,0,0,1-44.51-31.8C61.82,159.77,36,131.42,36,102A42,42,0,0,1,78,60c17.8,0,32.7,9.4,38.89,24.54a12,12,0,0,0,22.22,0C145.3,69.4,160.2,60,178,60a42,42,0,0,1,42,42C220,131.42,194.18,159.77,172.51,178.36Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M232,102c0,66-104,122-104,122S24,168,24,102A54,54,0,0,1,78,48c22.59,0,41.94,12.31,50,32,8.06-19.69,27.41-32,50-32A54,54,0,0,1,232,102Z",opacity:"0.2"}),a.createElement("path",{d:"M178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,70,103.79,126.66,108.21,129a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40ZM128,214.8C109.74,204.16,32,155.69,32,102A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46C224,155.61,146.24,204.15,128,214.8Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M240,102c0,70-103.79,126.66-108.21,129a8,8,0,0,1-7.58,0C119.79,228.66,16,172,16,102A62.07,62.07,0,0,1,78,40c20.65,0,38.73,8.88,50,23.89C139.27,48.88,157.35,40,178,40A62.07,62.07,0,0,1,240,102Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M178,42c-21,0-39.26,9.47-50,25.34C117.26,51.47,99,42,78,42a60.07,60.07,0,0,0-60,60c0,29.2,18.2,59.59,54.1,90.31a334.68,334.68,0,0,0,53.06,37,6,6,0,0,0,5.68,0,334.68,334.68,0,0,0,53.06-37C219.8,161.59,238,131.2,238,102A60.07,60.07,0,0,0,178,42ZM128,217.11C111.59,207.64,30,157.72,30,102A48.05,48.05,0,0,1,78,54c20.28,0,37.31,10.83,44.45,28.27a6,6,0,0,0,11.1,0C140.69,64.83,157.72,54,178,54a48.05,48.05,0,0,1,48,48C226,157.72,144.41,207.64,128,217.11Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,70,103.79,126.66,108.21,129a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40ZM128,214.8C109.74,204.16,32,155.69,32,102A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46C224,155.61,146.24,204.15,128,214.8Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M178,44c-21.44,0-39.92,10.19-50,27.07C117.92,54.19,99.44,44,78,44a58.07,58.07,0,0,0-58,58c0,28.59,18,58.47,53.4,88.79a333.81,333.81,0,0,0,52.7,36.73,4,4,0,0,0,3.8,0,333.81,333.81,0,0,0,52.7-36.73C218,160.47,236,130.59,236,102A58.07,58.07,0,0,0,178,44ZM128,219.42c-14-8-100-59.35-100-117.42A50.06,50.06,0,0,1,78,52c21.11,0,38.85,11.31,46.3,29.51a4,4,0,0,0,7.4,0C139.15,63.31,156.89,52,178,52a50.06,50.06,0,0,1,50,50C228,160,142,211.46,128,219.42Z"}))]]),j=a.forwardRef((i,c)=>a.createElement(b,{ref:c,...i,weights:O}));j.displayName="HeartIcon";const L=j;function U({id:i,title:c,tags:s,createdAt:o,updatedAt:m}){const n=new Date(Number(o)),r=y(Number(m));return e.jsx("div",{className:"border-b-2 border-dashed border-border-subtle last:border-b-0",children:e.jsxs("div",{className:"py-4 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg-tertiary text-xs font-medium",children:r}),e.jsxs("span",{className:"text-fg-placeholder text-xs",children:["(",n.toDateString(),")"]})]}),e.jsx(f,{className:"font-bold text-fg-default hover:text-accent-primary transition-colors",to:C,params:{id:i},children:c||"Untitled"}),s&&s.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map(l=>e.jsx(f,{to:E,params:{id:l.id},search:{page:1},children:e.jsx(A,{name:l.name})},l.id))})]})})}const g=D(F),Y=()=>{const i=v(),c=w(),{id:s}=g.useParams(),o=g.useNavigate(),m=I(),{data:n}=h({queryKey:d.images.detail(s??""),async queryFn(){const t=await q(s);if(t.type==="error")throw t;return t.image},enabled:!!s}),{data:r}=h({queryKey:d.images.notes(s??""),async queryFn(){const t=await M(n.url);if(t.type==="error")throw t;return t.imageNotes},enabled:!!n}),l=!r||(r?.length||0)>0,N=async()=>{if(!l&&await i("Are you really sure?")){const t=await G(s);if(t.type==="error"){c(t.errors[0].message);return}if(!t.deleteImage){c("Failed to delete image");return}o({to:u,search:{page:1}})}};return e.jsxs(T,{title:"Image Detail",variant:"none",children:[e.jsxs(f,{to:u,search:{page:1},className:"mb-4 inline-flex items-center gap-1 text-sm font-medium text-fg-secondary transition-colors hover:text-fg-default",children:[e.jsx(S,{size:16}),"Back to Images"]}),e.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row",children:[n&&e.jsx("div",{className:"w-full lg:w-[400px] lg:flex-shrink-0",children:e.jsxs(x,{flush:!0,children:[e.jsx("div",{className:"flex items-center justify-center bg-muted/20 p-4",children:e.jsx(R,{className:"max-h-80 w-auto max-w-full rounded-[14px] object-contain",src:n.url})}),e.jsxs("div",{className:"flex flex-col gap-3 border-t border-border-subtle p-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{size:14,className:"text-fg-tertiary"}),e.jsxs("span",{className:"text-sm font-medium text-fg-secondary",children:[r?.length||0," ",(r?.length||0)===1?"reference":"references"]})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Z,{content:l?"Cannot delete while referenced by notes":"Delete this image",side:"bottom",children:e.jsxs(p,{variant:"soft-danger",size:"sm",className:"flex-1",disabled:l,onClick:N,children:[e.jsx(k,{size:16}),e.jsx("span",{children:"Delete"})]})}),e.jsxs(p,{variant:"primary",size:"sm",className:"flex-1",onClick:async()=>{await _("heroBanner",n.url),await m.invalidateQueries({queryKey:d.ui.heroBanner(),exact:!0})},children:[e.jsx(L,{size:16,className:"text-fg-secondary"}),e.jsx("span",{children:"Set hero banner"})]})]})]})]})}),e.jsx("div",{className:"flex-1 min-w-0",children:r&&r.length>0?e.jsxs(x,{children:[e.jsx("p",{className:"mb-3 border-b border-border-subtle pb-2 text-sm font-semibold text-fg-default",children:"Referenced Notes"}),e.jsx("ul",{className:"flex flex-col",children:r.map(t=>e.jsx("li",{children:e.jsx(U,{...t})},t.id))})]}):e.jsxs(x,{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(B,{size:28,className:"mb-2 text-fg-disabled"}),e.jsx("p",{className:"text-sm font-semibold text-fg-secondary",children:"No notes reference this image"}),e.jsx("p",{className:"mt-1 text-sm text-fg-secondary",children:"This image can be safely deleted"})]})})]})]})};export{Y as default};
@@ -1 +0,0 @@
1
- import{j as e}from"./note-vendor-BofYbzmZ.js";import{ac as r,A as j,G as N,u as M,I as i,P as C,ad as S,B as h,X as f,Z as w,Y as P}from"./index-DqFkOWbi.js";import{a as g}from"./graph-vendor-CUxe67Lr.js";import{S as c}from"./SurfaceCard-DAcVMY4f.js";import"./note-core-BCgMq5QA.js";const T=async()=>{const{data:s}=await r.get("/api/mcp-admin/status");return s},A=async s=>{const{data:a}=await r.post("/api/mcp-admin/enabled",{enabled:s});return a},F=async()=>{const{data:s}=await r.post("/api/mcp-admin/token/rotate");return s},q=async()=>{const{data:s}=await r.post("/api/mcp-admin/token/revoke");return s},n=["mcp-admin","status"],I=s=>JSON.stringify({mcpServers:{"ocean-brain":{command:"npx",args:["-y","ocean-brain","mcp","--server",s,"--token-file","/path/to/token.txt"]}}},null,2),L=s=>JSON.stringify({mcpServers:{"ocean-brain":{command:"npx",args:["-y","ocean-brain","mcp","--server",s,"--token","your-token-here"]}}},null,2),B=()=>{const s=j(),a=N(),[o,y]=g.useState(()=>window.location.origin),[l,d]=g.useState(""),{data:u,isLoading:v}=M({queryKey:n,queryFn:T}),m=i({mutationFn:A,onSuccess:t=>{a.setQueryData(n,t),s(t.enabled?"MCP access enabled.":"MCP access disabled.")}}),x=i({mutationFn:F,onSuccess:async({token:t})=>{d(t),s("A new MCP token has been issued."),await a.invalidateQueries({queryKey:n})}}),p=i({mutationFn:q,onSuccess:t=>{d(""),a.setQueryData(n,t),s("The active MCP token has been revoked.")}}),b=u?.enabled??!1,k=!v&&!m.isPending;return e.jsx(C,{title:"MCP",variant:"subtle",description:"Manage MCP access and issue a single service token",children:e.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[e.jsx(c,{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-subheading font-semibold text-fg-default",children:"MCP Access"}),e.jsx("p",{className:"text-label font-medium text-fg-tertiary",children:"Allow or block MCP requests at the server level."})]}),e.jsx("div",{className:"inline-flex items-center",children:e.jsx(S,{"aria-label":"Allow MCP access",checked:b,disabled:!k,onCheckedChange:()=>{m.mutate(!b)}})})]})}),e.jsxs(c,{className:"space-y-4",children:[e.jsxs("div",{className:"border-b border-border-subtle pb-4",children:[e.jsx("h2",{className:"text-subheading font-semibold text-fg-default",children:"Token Management"}),e.jsx("p",{className:"text-label font-medium text-fg-tertiary",children:"Ocean Brain supports one active MCP token at a time. Rotating immediately invalidates the previous one."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(h,{onClick:()=>x.mutate(void 0),isLoading:x.isPending,children:"Rotate token"}),e.jsx(h,{variant:"soft-danger",onClick:()=>p.mutate(),isLoading:p.isPending,disabled:!u?.hasActiveToken,children:"Revoke token"})]}),l&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"issued-mcp-token",children:"Issued Token"}),e.jsx(w,{id:"issued-mcp-token",rows:3,readOnly:!0,value:l})]})]}),e.jsxs(c,{className:"space-y-4",children:[e.jsxs("div",{className:"border-b border-border-subtle pb-4",children:[e.jsx("h2",{className:"text-subheading font-semibold text-fg-default",children:"Connection Guide"}),e.jsx("p",{className:"text-label font-medium text-fg-tertiary",children:"How to connect your MCP client to this server."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"mcp-server-url",children:"Server URL"}),e.jsx(P,{id:"mcp-server-url",value:o,onChange:t=>y(t.target.value)})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-body font-semibold text-fg-default",children:["Token file"," ",e.jsx("span",{className:"text-label font-medium text-fg-tertiary",children:"(recommended — keeps token out of config)"})]}),e.jsx("pre",{className:"overflow-x-auto rounded-[14px] border border-border-subtle bg-surface px-4 py-3 text-xs text-fg-secondary",children:I(o)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-body font-semibold text-fg-default",children:["Inline token"," ",e.jsx("span",{className:"text-label font-medium text-fg-tertiary",children:"(quick local testing)"})]}),e.jsx("pre",{className:"overflow-x-auto rounded-[14px] border border-border-subtle bg-surface px-4 py-3 text-xs text-fg-secondary",children:L(o)})]})]})]})]})})};export{B as default};
@@ -1,34 +0,0 @@
1
- import{j as e}from"./note-vendor-BofYbzmZ.js";import{p as D,g as y,A as I,G as O,q as x,an as $,u as H,I as P,P as q,B as f,_ as Z,ao as F,ap as v,o as k,M as p,X as g,Y as j,F as Q,f as T,e as K,aa as B}from"./index-DqFkOWbi.js";import{a as t}from"./graph-vendor-CUxe67Lr.js";import{C as U}from"./Callout-tNHgPhLM.js";import{n as X,M as G}from"./ModalActionRow-B3vNjcDc.js";import{S as C}from"./SurfaceCard-DAcVMY4f.js";import"./note-core-BCgMq5QA.js";const Y=new Map([["bold",t.createElement(t.Fragment,null,t.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",t.createElement(t.Fragment,null,t.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),t.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",t.createElement(t.Fragment,null,t.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",t.createElement(t.Fragment,null,t.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",t.createElement(t.Fragment,null,t.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",t.createElement(t.Fragment,null,t.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),A=t.forwardRef((l,r)=>t.createElement(D,{ref:r,...l,weights:Y}));A.displayName="CaretUpIcon";const z=A,S=["id","name","template","replacement","createdAt","updatedAt"],J=new Set(S),V=`query FetchPlaceholders(
2
- $searchFilter: SearchFilterInput,
3
- $pagination: PaginationInput
4
- ) {
5
- allPlaceholders(
6
- searchFilter: $searchFilter,
7
- pagination: $pagination
8
- ) {
9
- totalCount
10
- placeholders {
11
- __PLACEHOLDER_FIELDS__ }
12
- }
13
- }`,W=l=>{const r=l&&l.length>0?l.filter(n=>J.has(n)):S;return Array.from(new Set(r)).map(n=>" "+n).join(`
14
- `)+`
15
- `},ee=async({limit:l=25,offset:r=0,query:d="",fields:n}={})=>{const h=W(n),c=V.replace("__PLACEHOLDER_FIELDS__",h);return y(c,{searchFilter:{query:d},pagination:{limit:l,offset:r}})},te=l=>y(`mutation CreatePlaceholder(
16
- $name: String!,
17
- $template: String!,
18
- $replacement: String!
19
- ) {
20
- createPlaceholder(
21
- name: $name,
22
- template: $template,
23
- replacement: $replacement
24
- ) {
25
- id
26
- name
27
- template
28
- replacement
29
- createdAt
30
- updatedAt
31
- }
32
- }`,l),ae=l=>y(`mutation DeletePlaceholder($id: ID!) {
33
- deletePlaceholder(id: $id)
34
- }`,{id:l}),L=K(B),de=()=>{const l=I(),r=O(),d=L.useNavigate(),{page:n}=L.useSearch(),[h,c]=t.useState(!1),[u,b]=t.useState(!1),[s,m]=t.useState({name:"",template:"",replacement:""}),i=25,_=x.placeholders.list({limit:i,offset:(n-1)*i}),[w]=t.useState($),{data:o,isLoading:N}=H({queryKey:_,queryFn:async()=>{const a=await ee({offset:(n-1)*i,limit:i});if(a.type==="error")throw a;return a.allPlaceholders}}),E=P({mutationFn:te,onSuccess:async()=>{l("Placeholder added successfully"),c(!1),m({name:"",template:"",replacement:""}),await r.invalidateQueries({queryKey:x.placeholders.listAll(),exact:!1})}}),M=P({mutationFn:ae,onSuccess:async()=>{l("Placeholder deleted successfully"),await r.invalidateQueries({queryKey:x.placeholders.listAll(),exact:!1})}});return e.jsxs(q,{title:"Placeholders",variant:"subtle",description:"Manage template variables for note cloning",children:[e.jsx(U,{className:"mb-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{children:"Placeholders will be replaced with new note data during cloning."}),e.jsx(f,{variant:"subtle",size:"icon-sm",onClick:()=>c(!0),children:e.jsx(X,{width:20,height:20})})]})}),e.jsxs("div",{className:"mt-3 flex flex-col gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>b(!u),className:"focus-ring-soft surface-base flex items-center justify-between gap-2 rounded-[18px] px-4 py-3 text-left text-sm font-semibold text-fg-default transition-colors hover:bg-hover-subtle",children:[e.jsx("div",{children:"System Placeholders"}),e.jsx("div",{className:"flex h-6 w-6 items-center justify-center text-fg-tertiary",children:u?e.jsx(z,{}):e.jsx(Z,{})})]}),u&&e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:w.map(a=>e.jsxs(C,{children:[e.jsx("div",{className:"text-sm font-semibold text-fg-default",children:a.name}),e.jsxs("div",{className:"text-xs font-medium text-fg-tertiary",children:[F,a.template,v," = '",a.replacement,"'"]})]},a.name))}),!N&&o?.placeholders&&o.placeholders.length>0&&e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:o.placeholders.map(a=>e.jsxs(C,{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm font-semibold text-fg-default",children:a.name}),e.jsx("button",{type:"button",className:"focus-ring-soft inline-flex h-8 w-8 items-center justify-center rounded-[10px] text-fg-tertiary transition-colors hover:bg-hover-subtle hover:text-fg-default",onClick:()=>M.mutate(a.id.toString()),children:e.jsx(k,{})})]}),e.jsxs("div",{className:"text-xs font-medium text-fg-tertiary",children:[F,a.template,v," = '",a.replacement,"'"]})]},a.id))})]}),e.jsxs(p,{isOpen:h,onClose:()=>c(!1),children:[e.jsx(p.Header,{title:"Add Placeholder",onClose:()=>c(!1)}),e.jsx(p.Body,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(g,{htmlFor:"name",children:"Name:"}),e.jsx(j,{id:"name",type:"text",value:s.name,onChange:a=>m({...s,name:a.target.value}),placeholder:"Description of this placeholder"}),e.jsx(g,{htmlFor:"template",children:"Placeholder:"}),e.jsx(j,{id:"template",type:"text",value:s.template,onChange:a=>m({...s,template:a.target.value}),placeholder:"note_app"}),e.jsx(g,{htmlFor:"replacement",children:"Replacement:"}),e.jsx(j,{id:"replacement",type:"text",value:s.replacement,onChange:a=>m({...s,replacement:a.target.value}),placeholder:"Ocean Brain"})]})}),e.jsx(p.Footer,{children:e.jsxs(G,{children:[e.jsx(f,{variant:"ghost",onClick:()=>c(!1),children:"Cancel"}),e.jsx(f,{variant:"primary",isLoading:E.isPending,onClick:()=>{if(!s.name||!s.template||!s.replacement){l("All fields are required");return}E.mutate({name:s.name,template:s.template,replacement:s.replacement})},children:"Add"})]})})]}),e.jsx(Q,{fallback:null,children:o?.totalCount&&i<o.totalCount&&e.jsx(T,{page:n,last:Math.ceil(o.totalCount/i),onChange:a=>{d({search:R=>({...R,page:a})})}})})]})};export{de as default};
@@ -1 +0,0 @@
1
- import{j as e}from"./note-vendor-BofYbzmZ.js";import{P as x,Q as p,S as d,e as f,a3 as y,G as g,A as j,k as b,ae as v,q as i,I as N,af as T,N as S,F as q,a4 as E,B as R,f as Q,E as w,d as C}from"./index-DqFkOWbi.js";import"./graph-vendor-CUxe67Lr.js";import{S as K}from"./SurfaceCard-DAcVMY4f.js";import"./note-core-BCgMq5QA.js";const a=25,c=f(y),m=t=>C(t).format("YYYY-MM-DD HH:mm"),k=()=>{const{page:t}=c.useSearch(),u=c.useNavigate(),r=g(),h=j(),{data:l}=b({queryKey:i.notes.trash({limit:a,offset:(t-1)*a}),queryFn:async()=>{const s=await v({limit:a,offset:(t-1)*a});if(s.type==="error")throw s;return s.trashedNotes}}),o=N({mutationFn:T,onSuccess:async s=>{if(s.type==="error")throw s;await Promise.all([r.invalidateQueries({queryKey:i.notes.all(),exact:!1}),r.invalidateQueries({queryKey:i.tags.all(),exact:!1}),r.invalidateQueries({queryKey:i.reminders.all(),exact:!1}),r.invalidateQueries({queryKey:i.images.all(),exact:!1}),r.invalidateQueries({queryKey:["calendar"],exact:!1})]),h("The note has been restored."),u({to:S,params:{id:s.restoreTrashedNote.id}})},onError:()=>{h("Failed to restore the note.")}});return e.jsx(q,{fallback:e.jsx(w,{title:"Trash is empty",description:"Deleted notes stay here until you restore them or retention cleanup removes them."}),children:l.notes.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid gap-4",children:l.notes.map(s=>e.jsx(K,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-subheading font-semibold text-fg-default",children:s.title}),s.pinned&&e.jsxs("span",{className:"text-label inline-flex items-center gap-1 rounded-full border border-border-subtle bg-hover-subtle px-2 py-0.5 font-medium text-fg-secondary",children:[e.jsx(E,{className:"h-3.5 w-3.5"}),"Pinned"]})]}),e.jsxs("div",{className:"text-meta text-fg-secondary",children:["Deleted ",m(s.deletedAt)]}),e.jsxs("div",{className:"text-label text-fg-tertiary",children:["Last edited ",m(s.updatedAt)]}),s.tagNames.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:s.tagNames.map(n=>e.jsx("span",{className:"text-label rounded-full border border-border-subtle bg-hover-subtle px-2 py-0.5 font-medium text-fg-secondary",children:n},`${s.id}-${n}`))})]}),e.jsx(R,{variant:"subtle",isLoading:o.isPending&&o.variables===s.id,onClick:()=>o.mutate(s.id),children:"Restore"})]})},s.id))}),l.totalCount>a&&e.jsx(Q,{page:t,last:Math.ceil(l.totalCount/a),onChange:s=>{u({search:n=>({...n,page:s})})}})]})})},Y=()=>{const{page:t}=c.useSearch();return e.jsx(x,{title:"Trash",variant:"subtle",description:"Restore notes removed from your active workspace before retention cleanup clears them",children:e.jsx(p,{fallback:e.jsxs("div",{className:"grid gap-4",children:[e.jsx(d,{height:"128px"}),e.jsx(d,{height:"128px"}),e.jsx(d,{height:"128px"})]}),errorTitle:"Failed to load trash",errorDescription:"Retry loading deleted notes.",resetKeys:[t],children:e.jsx(k,{})})})};export{Y as default};
@@ -1,82 +0,0 @@
1
- import{a as n}from"./graph-vendor-CUxe67Lr.js";import{p as f,g as c,k as R,q as a,A as V,G as $}from"./index-DqFkOWbi.js";import{j as y}from"./note-vendor-BofYbzmZ.js";const h=new Map([["bold",n.createElement(n.Fragment,null,n.createElement("path",{d:"M216.49,79.52l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40V216a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V88A12,12,0,0,0,216.49,79.52ZM160,57l23,23H160ZM60,212V44h76V92a12,12,0,0,0,12,12h48V212Z"}))],["duotone",n.createElement(n.Fragment,null,n.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),n.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"}))],["fill",n.createElement(n.Fragment,null,n.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM152,88V44l44,44Z"}))],["light",n.createElement(n.Fragment,null,n.createElement("path",{d:"M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40V216a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM200,218H56a2,2,0,0,1-2-2V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216A2,2,0,0,1,200,218Z"}))],["regular",n.createElement(n.Fragment,null,n.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"}))],["thin",n.createElement(n.Fragment,null,n.createElement("path",{d:"M210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40V216a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V88A4,4,0,0,0,210.83,85.17ZM156,41.65,198.34,84H156ZM200,220H56a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52V216A4,4,0,0,1,200,220Z"}))]]),g=n.forwardRef((e,t)=>n.createElement(f,{ref:t,...e,weights:h}));g.displayName="FileIcon";const w=g,A=(e={})=>({limit:e.limit??10,offset:e.offset??0}),H=async(e,t)=>c(`
2
- query FetchNoteReminders($noteId: ID!, $pagination: PaginationInput) {
3
- noteReminders(noteId: $noteId, pagination: $pagination) {
4
- totalCount
5
- reminders {
6
- id
7
- noteId
8
- reminderDate
9
- priority
10
- content
11
- completed
12
- createdAt
13
- updatedAt
14
- }
15
- }
16
- }
17
- `,{noteId:e,pagination:A(t)}),D=async e=>c(`
18
- query FetchUpcomingReminders($pagination: PaginationInput) {
19
- upcomingReminders(pagination: $pagination) {
20
- totalCount
21
- reminders {
22
- id
23
- noteId
24
- reminderDate
25
- priority
26
- content
27
- completed
28
- createdAt
29
- updatedAt
30
- note {
31
- id
32
- title
33
- }
34
- }
35
- }
36
- }
37
- `,{pagination:A(e)}),M=async e=>{const{noteId:t,reminderDate:o,priority:s="medium",content:i}=e;return c(`
38
- mutation CreateReminder($noteId: ID!, $reminderDate: String!, $priority: ReminderPriority, $content: String) {
39
- createReminder(
40
- noteId: $noteId,
41
- reminderDate: $reminderDate,
42
- priority: $priority,
43
- content: $content
44
- ) {
45
- id
46
- noteId
47
- reminderDate
48
- completed
49
- priority
50
- createdAt
51
- updatedAt
52
- }
53
- }
54
- `,{noteId:t,reminderDate:o.toISOString(),priority:s,content:i})},Z=async({id:e,reminderDate:t,completed:o,priority:s,content:i})=>{const r={id:e};return t&&(r.reminderDate=t.toISOString()),o!==void 0&&(r.completed=o),s&&(r.priority=s),i!==void 0&&(r.content=i),c(`
55
- mutation UpdateReminder(
56
- $id: ID!,
57
- $reminderDate: String,
58
- $completed: Boolean,
59
- $priority: ReminderPriority,
60
- $content: String
61
- ) {
62
- updateReminder(
63
- id: $id,
64
- reminderDate: $reminderDate,
65
- completed: $completed,
66
- priority: $priority,
67
- content: $content
68
- ) {
69
- id
70
- noteId
71
- reminderDate
72
- completed
73
- priority
74
- createdAt
75
- updatedAt
76
- }
77
- }
78
- `,r)},I=async e=>c(`
79
- mutation DeleteReminder($id: ID!) {
80
- deleteReminder(id: $id)
81
- }
82
- `,{id:e});function v({noteId:e,searchParams:t,render:o}){const{data:s}=R({queryKey:e?a.reminders.note(e,t):a.reminders.upcoming(t),queryFn:async()=>{if(e){const r=await H(e,t);if(r.type==="error")throw r;return r.noteReminders}const i=await D(t);if(i.type==="error")throw i;return i.upcomingReminders}});return y.jsx(y.Fragment,{children:o(s)})}function Q(){const e=V(),t=$(),o=n.useCallback(async(r,m,l="medium",d,u)=>{const p=await M({noteId:r,reminderDate:m,priority:l,content:u});if(p.type==="error"){e(p.errors[0].message);return}await Promise.all([t.invalidateQueries({queryKey:a.reminders.noteAllPages(r),exact:!1}),t.invalidateQueries({queryKey:a.reminders.upcomingAllPages(),exact:!1}),t.invalidateQueries({queryKey:a.reminders.inDateRangeAll(),exact:!1})]),d&&d()},[t,e]),s=n.useCallback(async(r,m,l,d)=>{const u=await Z({id:r,...l});if(u.type==="error"){e(u.errors[0].message);return}await Promise.all([t.invalidateQueries({queryKey:a.reminders.noteAllPages(m),exact:!1}),t.invalidateQueries({queryKey:a.reminders.upcomingAllPages(),exact:!1}),t.invalidateQueries({queryKey:a.reminders.inDateRangeAll(),exact:!1})]),d&&d()},[t,e]),i=n.useCallback(async(r,m,l)=>{const d=await I(r);if(d.type==="error"){e(d.errors[0].message);return}await Promise.all([t.invalidateQueries({queryKey:a.reminders.noteAllPages(m),exact:!1}),t.invalidateQueries({queryKey:a.reminders.upcomingAllPages(),exact:!1}),t.invalidateQueries({queryKey:a.reminders.inDateRangeAll(),exact:!1})]),l&&l()},[t,e]);return{onCreate:o,onUpdate:s,onDelete:i}}export{v as R,w as s,Q as u};