ocean-brain 0.6.1 → 0.6.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 (39) hide show
  1. package/package.json +1 -1
  2. package/server/client/dist/assets/{Calendar-BJHLksEZ.js → Calendar-DbPut8EU.js} +1 -1
  3. package/server/client/dist/assets/{Callout-wFx9oCas.js → Callout-DfX-gIUB.js} +1 -1
  4. package/server/client/dist/assets/{Graph-9piERaNR.js → Graph-yHE9m5fy.js} +1 -1
  5. package/server/client/dist/assets/{Image.es-Be7par_j.js → Image.es-CtMc7BW4.js} +1 -1
  6. package/server/client/dist/assets/{Note-CC9ybxXL.js → Note-BECn-AoI.js} +2 -2
  7. package/server/client/dist/assets/{Plus.es-BKm7uDYu.js → Plus.es-BGVIIQtM.js} +1 -1
  8. package/server/client/dist/assets/{Reminders-DRxA8v98.js → Reminders-CvEJf0eQ.js} +1 -1
  9. package/server/client/dist/assets/{Search-BunSQrqv.js → Search-CKZhztuV.js} +1 -1
  10. package/server/client/dist/assets/{SurfaceCard-FhlC8VSR.js → SurfaceCard-Bnfo5EOl.js} +1 -1
  11. package/server/client/dist/assets/{Tag-z_crJ5JP.js → Tag-C4oAwjs0.js} +1 -1
  12. package/server/client/dist/assets/{TagNotes-D7wIJ4jy.js → TagNotes-Rl1ZSJP6.js} +1 -1
  13. package/server/client/dist/assets/{Trash.es-ByMVwx0d.js → Trash.es-BcwUz2yM.js} +1 -1
  14. package/server/client/dist/assets/ViewNotes-B9Yc0A87.js +1 -0
  15. package/server/client/dist/assets/ViewSectionTableRenderer-C5yJBO7C.js +102 -0
  16. package/server/client/dist/assets/Views-Bqq0pUEE.js +1 -0
  17. package/server/client/dist/assets/{image.api-B5Qi-Txv.js → image.api-CuGTgzyQ.js} +1 -1
  18. package/server/client/dist/assets/{index-nYj7BL3a.js → index-B43ulIPo.js} +3 -3
  19. package/server/client/dist/assets/{index-cHJQCo8V.js → index-BQDR6hIA.js} +1 -1
  20. package/server/client/dist/assets/{index-Cd81UxEh.css → index-CDjYEIVf.css} +1 -1
  21. package/server/client/dist/assets/{manage-image-glbtBibn.js → manage-image-Bs4Kmevx.js} +1 -1
  22. package/server/client/dist/assets/{manage-image-detail-DcZggB1M.js → manage-image-detail-WARala-v.js} +1 -1
  23. package/server/client/dist/assets/{mcp-BBUpQdS9.js → mcp-C0Z3vKBa.js} +1 -1
  24. package/server/client/dist/assets/{placeholder-B_qb_qkc.js → placeholder-D080guzn.js} +3 -3
  25. package/server/client/dist/assets/{properties-CiyQv6Tb.js → properties-DbnmfbT5.js} +1 -1
  26. package/server/client/dist/assets/trash-D5ZiZfTk.js +1 -0
  27. package/server/client/dist/assets/{useReminderMutate-CSKliBcc.js → useReminderMutate-h7d_S_X2.js} +2 -2
  28. package/server/client/dist/index.html +2 -2
  29. package/server/dist/features/view/graphql/view.type-defs.js +22 -0
  30. package/server/dist/features/view/graphql/view.type-defs.js.map +1 -1
  31. package/server/dist/features/view/services/workspace.js +77 -16
  32. package/server/dist/features/view/services/workspace.js.map +1 -1
  33. package/server/dist/modules/blocknote.js +103 -7
  34. package/server/dist/modules/blocknote.js.map +1 -1
  35. package/server/prisma/schema.prisma +1 -0
  36. package/server/client/dist/assets/ViewNotes-Duo9XmcJ.js +0 -1
  37. package/server/client/dist/assets/Views-D4Z_O9Kd.js +0 -1
  38. package/server/client/dist/assets/trash-CQnj4Rmv.js +0 -1
  39. package/server/client/dist/assets/view-dashboard-B5fKgvk_.js +0 -99
@@ -1 +1 @@
1
- import{j as e}from"./note-vendor-uuJO2MTD.js";import{a6 as j,aL as p,q as y,av as N,a0 as P,P as c,ac as h,aM as T,a1 as v,G as q,i as d,j as w,ad as k}from"./index-nYj7BL3a.js";import"./graph-vendor-CUxe67Lr.js";import"./note-core-DMZcZ4yV.js";const R=s=>{const{data:r}=j({queryKey:y.notes.tagList(s.searchParams),async queryFn(){const t=await p({query:s.searchParams.query,offset:s.searchParams.offset,limit:s.searchParams.limit});if(t.type==="error")throw t;return t.tagNotes}});return s.render(r)},g=w(k);function M(){const s=g.useNavigate(),{id:r}=g.useParams(),{page:t}=g.useSearch(),i=25,{onDelete:u,onPinned:m,deleteWarningDialog:x}=N();return e.jsxs(P,{fallback:e.jsx(c,{title:"Tagged Notes",heading:e.jsx(d,{width:148,height:24,className:"rounded-full"}),description:e.jsx(d,{width:196,height:16,className:"rounded-full"}),variant:"default",children:e.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[e.jsx(d,{height:"112px"}),e.jsx(d,{height:"112px"}),e.jsx(d,{height:"112px"})]})}),errorTitle:"Failed to load tagged notes",errorDescription:"Retry loading notes for this tag",resetKeys:[r,t,i],children:[e.jsx(R,{searchParams:{query:r,offset:(t-1)*i,limit:i},render:({notes:o,totalCount:n})=>{const l=o.flatMap(a=>a.tags).find(a=>a.id===r)?.name;return e.jsx(c,{title:l??"Tagged Notes",heading:l?n>0?`${l} (${n})`:l:"Tagged Notes",description:"Browse every note linked to this tag",variant:"default",children:e.jsx(h,{fallback:e.jsx(q,{title:"No tagged notes yet",description:"Notes tagged with this label will appear here"}),children:o.length>0&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid-auto-cards grid gap-5",children:o.map(a=>e.jsx(T,{...a,onPinned:()=>m(a.id,a.pinned),onDelete:()=>u(a.id)},a.id))}),e.jsx(h,{fallback:null,children:n&&i<n&&e.jsx(v,{page:t,last:Math.ceil(n/i),onChange:a=>{s({search:f=>({...f,page:a})})}})})]})})})}}),x]})}export{M as default};
1
+ import{j as e}from"./note-vendor-uuJO2MTD.js";import{a6 as j,aL as p,q as y,av as N,a0 as P,P as c,ac as h,aM as T,a1 as v,J as q,i as d,j as w,ad as k}from"./index-B43ulIPo.js";import"./graph-vendor-CUxe67Lr.js";import"./note-core-DMZcZ4yV.js";const R=s=>{const{data:r}=j({queryKey:y.notes.tagList(s.searchParams),async queryFn(){const t=await p({query:s.searchParams.query,offset:s.searchParams.offset,limit:s.searchParams.limit});if(t.type==="error")throw t;return t.tagNotes}});return s.render(r)},g=w(k);function M(){const s=g.useNavigate(),{id:r}=g.useParams(),{page:t}=g.useSearch(),i=25,{onDelete:u,onPinned:m,deleteWarningDialog:x}=N();return e.jsxs(P,{fallback:e.jsx(c,{title:"Tagged Notes",heading:e.jsx(d,{width:148,height:24,className:"rounded-full"}),description:e.jsx(d,{width:196,height:16,className:"rounded-full"}),variant:"default",children:e.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[e.jsx(d,{height:"112px"}),e.jsx(d,{height:"112px"}),e.jsx(d,{height:"112px"})]})}),errorTitle:"Failed to load tagged notes",errorDescription:"Retry loading notes for this tag",resetKeys:[r,t,i],children:[e.jsx(R,{searchParams:{query:r,offset:(t-1)*i,limit:i},render:({notes:o,totalCount:n})=>{const l=o.flatMap(a=>a.tags).find(a=>a.id===r)?.name;return e.jsx(c,{title:l??"Tagged Notes",heading:l?n>0?`${l} (${n})`:l:"Tagged Notes",description:"Browse every note linked to this tag",variant:"default",children:e.jsx(h,{fallback:e.jsx(q,{title:"No tagged notes yet",description:"Notes tagged with this label will appear here"}),children:o.length>0&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid-auto-cards grid gap-5",children:o.map(a=>e.jsx(T,{...a,onPinned:()=>m(a.id,a.pinned),onDelete:()=>u(a.id)},a.id))}),e.jsx(h,{fallback:null,children:n&&i<n&&e.jsx(v,{page:t,last:Math.ceil(n/i),onChange:a=>{s({search:f=>({...f,page:a})})}})})]})})})}}),x]})}export{M as default};
@@ -1 +1 @@
1
- import{a}from"./graph-vendor-CUxe67Lr.js";import{p as l}from"./index-nYj7BL3a.js";const r=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M117.18,188.74a12,12,0,0,1,0,17l-5.12,5.12A58.26,58.26,0,0,1,70.6,228h0A58.62,58.62,0,0,1,29.14,127.92L63.89,93.17a58.64,58.64,0,0,1,98.56,28.11,12,12,0,1,1-23.37,5.44,34.65,34.65,0,0,0-58.22-16.58L46.11,144.89A34.62,34.62,0,0,0,70.57,204h0a34.41,34.41,0,0,0,24.49-10.14l5.11-5.12A12,12,0,0,1,117.18,188.74ZM226.83,45.17a58.65,58.65,0,0,0-82.93,0l-5.11,5.11a12,12,0,0,0,17,17l5.12-5.12a34.63,34.63,0,1,1,49,49L175.1,145.86A34.39,34.39,0,0,1,150.61,156h0a34.63,34.63,0,0,1-33.69-26.72,12,12,0,0,0-23.38,5.44A58.64,58.64,0,0,0,150.56,180h.05a58.28,58.28,0,0,0,41.47-17.17l34.75-34.75a58.62,58.62,0,0,0,0-82.91Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M218.34,119.6,183.6,154.34a46.58,46.58,0,0,1-44.31,12.26c-.31.34-.62.67-.95,1L103.6,202.34A46.63,46.63,0,1,1,37.66,136.4L72.4,101.66A46.6,46.6,0,0,1,116.71,89.4c.31-.34.62-.67,1-1L152.4,53.66a46.63,46.63,0,0,1,65.94,65.94Z",opacity:"0.2"}),a.createElement("path",{d:"M240,88.23a54.43,54.43,0,0,1-16,37L189.25,160a54.27,54.27,0,0,1-38.63,16h-.05A54.63,54.63,0,0,1,96,119.84a8,8,0,0,1,16,.45A38.62,38.62,0,0,0,150.58,160h0a38.39,38.39,0,0,0,27.31-11.31l34.75-34.75a38.63,38.63,0,0,0-54.63-54.63l-11,11A8,8,0,0,1,135.7,59l11-11A54.65,54.65,0,0,1,224,48,54.86,54.86,0,0,1,240,88.23ZM109,185.66l-11,11A38.41,38.41,0,0,1,70.6,208h0a38.63,38.63,0,0,1-27.29-65.94L78,107.31A38.63,38.63,0,0,1,144,135.71a8,8,0,0,0,7.78,8.22H152a8,8,0,0,0,8-7.78A54.86,54.86,0,0,0,144,96a54.65,54.65,0,0,0-77.27,0L32,130.75A54.62,54.62,0,0,0,70.56,224h0a54.28,54.28,0,0,0,38.64-16l11-11A8,8,0,0,0,109,185.66Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM115.7,192.49a43.31,43.31,0,0,1-55-66.43l25.37-25.37a43.35,43.35,0,0,1,61.25,0,42.9,42.9,0,0,1,9.95,15.43,8,8,0,1,1-15,5.6A27.33,27.33,0,0,0,97.37,112L72,137.37a27.32,27.32,0,0,0,34.68,41.91,8,8,0,1,1,9,13.21Zm79.61-62.55-25.37,25.37A43,43,0,0,1,139.32,168h0a43.35,43.35,0,0,1-40.53-28.12,8,8,0,1,1,15-5.6A27.35,27.35,0,0,0,139.28,152h0a27.14,27.14,0,0,0,19.32-8L184,118.63a27.32,27.32,0,0,0-34.68-41.91,8,8,0,1,1-9-13.21,43.32,43.32,0,0,1,55,66.43Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M238,88.18a52.42,52.42,0,0,1-15.4,35.66l-34.75,34.75A52.28,52.28,0,0,1,150.62,174h-.05A52.63,52.63,0,0,1,98,119.9a6,6,0,0,1,6-5.84h.17a6,6,0,0,1,5.83,6.16A40.62,40.62,0,0,0,150.58,162h0a40.4,40.4,0,0,0,28.73-11.9l34.75-34.74A40.63,40.63,0,0,0,156.63,57.9l-11,11a6,6,0,0,1-8.49-8.49l11-11a52.62,52.62,0,0,1,74.43,0A52.83,52.83,0,0,1,238,88.18Zm-127.62,98.9-11,11A40.36,40.36,0,0,1,70.6,210h0a40.63,40.63,0,0,1-28.7-69.36L76.62,105.9A40.63,40.63,0,0,1,146,135.77a6,6,0,0,0,5.83,6.16H152a6,6,0,0,0,6-5.84A52.63,52.63,0,0,0,68.14,97.42L33.38,132.16A52.63,52.63,0,0,0,70.56,222h0a52.26,52.26,0,0,0,37.22-15.42l11-11a6,6,0,1,0-8.49-8.48Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M240,88.23a54.43,54.43,0,0,1-16,37L189.25,160a54.27,54.27,0,0,1-38.63,16h-.05A54.63,54.63,0,0,1,96,119.84a8,8,0,0,1,16,.45A38.62,38.62,0,0,0,150.58,160h0a38.39,38.39,0,0,0,27.31-11.31l34.75-34.75a38.63,38.63,0,0,0-54.63-54.63l-11,11A8,8,0,0,1,135.7,59l11-11A54.65,54.65,0,0,1,224,48,54.86,54.86,0,0,1,240,88.23ZM109,185.66l-11,11A38.41,38.41,0,0,1,70.6,208h0a38.63,38.63,0,0,1-27.29-65.94L78,107.31A38.63,38.63,0,0,1,144,135.71a8,8,0,0,0,16,.45A54.86,54.86,0,0,0,144,96a54.65,54.65,0,0,0-77.27,0L32,130.75A54.62,54.62,0,0,0,70.56,224h0a54.28,54.28,0,0,0,38.64-16l11-11A8,8,0,0,0,109,185.66Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M236,88.12a50.44,50.44,0,0,1-14.81,34.31l-34.75,34.74A50.33,50.33,0,0,1,150.62,172h-.05A50.63,50.63,0,0,1,100,120a4,4,0,0,1,4-3.89h.11a4,4,0,0,1,3.89,4.11A42.64,42.64,0,0,0,150.58,164h0a42.32,42.32,0,0,0,30.14-12.49l34.75-34.74a42.63,42.63,0,1,0-60.29-60.28l-11,11a4,4,0,0,1-5.66-5.65l11-11A50.64,50.64,0,0,1,236,88.12ZM111.78,188.49l-11,11A42.33,42.33,0,0,1,70.6,212h0a42.63,42.63,0,0,1-30.11-72.77l34.75-34.74A42.63,42.63,0,0,1,148,135.82a4,4,0,0,0,8,.23A50.64,50.64,0,0,0,69.55,98.83L34.8,133.57A50.63,50.63,0,0,0,70.56,220h0a50.33,50.33,0,0,0,35.81-14.83l11-11a4,4,0,1,0-5.65-5.66Z"}))]]),m=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),n=a.forwardRef((e,t)=>a.createElement(l,{ref:t,...e,weights:r}));n.displayName="LinkIcon";const V=n,h=a.forwardRef((e,t)=>a.createElement(l,{ref:t,...e,weights:m}));h.displayName="TrashIcon";const Z=h;export{V as c,Z as n};
1
+ import{a}from"./graph-vendor-CUxe67Lr.js";import{p as l}from"./index-B43ulIPo.js";const r=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M117.18,188.74a12,12,0,0,1,0,17l-5.12,5.12A58.26,58.26,0,0,1,70.6,228h0A58.62,58.62,0,0,1,29.14,127.92L63.89,93.17a58.64,58.64,0,0,1,98.56,28.11,12,12,0,1,1-23.37,5.44,34.65,34.65,0,0,0-58.22-16.58L46.11,144.89A34.62,34.62,0,0,0,70.57,204h0a34.41,34.41,0,0,0,24.49-10.14l5.11-5.12A12,12,0,0,1,117.18,188.74ZM226.83,45.17a58.65,58.65,0,0,0-82.93,0l-5.11,5.11a12,12,0,0,0,17,17l5.12-5.12a34.63,34.63,0,1,1,49,49L175.1,145.86A34.39,34.39,0,0,1,150.61,156h0a34.63,34.63,0,0,1-33.69-26.72,12,12,0,0,0-23.38,5.44A58.64,58.64,0,0,0,150.56,180h.05a58.28,58.28,0,0,0,41.47-17.17l34.75-34.75a58.62,58.62,0,0,0,0-82.91Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M218.34,119.6,183.6,154.34a46.58,46.58,0,0,1-44.31,12.26c-.31.34-.62.67-.95,1L103.6,202.34A46.63,46.63,0,1,1,37.66,136.4L72.4,101.66A46.6,46.6,0,0,1,116.71,89.4c.31-.34.62-.67,1-1L152.4,53.66a46.63,46.63,0,0,1,65.94,65.94Z",opacity:"0.2"}),a.createElement("path",{d:"M240,88.23a54.43,54.43,0,0,1-16,37L189.25,160a54.27,54.27,0,0,1-38.63,16h-.05A54.63,54.63,0,0,1,96,119.84a8,8,0,0,1,16,.45A38.62,38.62,0,0,0,150.58,160h0a38.39,38.39,0,0,0,27.31-11.31l34.75-34.75a38.63,38.63,0,0,0-54.63-54.63l-11,11A8,8,0,0,1,135.7,59l11-11A54.65,54.65,0,0,1,224,48,54.86,54.86,0,0,1,240,88.23ZM109,185.66l-11,11A38.41,38.41,0,0,1,70.6,208h0a38.63,38.63,0,0,1-27.29-65.94L78,107.31A38.63,38.63,0,0,1,144,135.71a8,8,0,0,0,7.78,8.22H152a8,8,0,0,0,8-7.78A54.86,54.86,0,0,0,144,96a54.65,54.65,0,0,0-77.27,0L32,130.75A54.62,54.62,0,0,0,70.56,224h0a54.28,54.28,0,0,0,38.64-16l11-11A8,8,0,0,0,109,185.66Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM115.7,192.49a43.31,43.31,0,0,1-55-66.43l25.37-25.37a43.35,43.35,0,0,1,61.25,0,42.9,42.9,0,0,1,9.95,15.43,8,8,0,1,1-15,5.6A27.33,27.33,0,0,0,97.37,112L72,137.37a27.32,27.32,0,0,0,34.68,41.91,8,8,0,1,1,9,13.21Zm79.61-62.55-25.37,25.37A43,43,0,0,1,139.32,168h0a43.35,43.35,0,0,1-40.53-28.12,8,8,0,1,1,15-5.6A27.35,27.35,0,0,0,139.28,152h0a27.14,27.14,0,0,0,19.32-8L184,118.63a27.32,27.32,0,0,0-34.68-41.91,8,8,0,1,1-9-13.21,43.32,43.32,0,0,1,55,66.43Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M238,88.18a52.42,52.42,0,0,1-15.4,35.66l-34.75,34.75A52.28,52.28,0,0,1,150.62,174h-.05A52.63,52.63,0,0,1,98,119.9a6,6,0,0,1,6-5.84h.17a6,6,0,0,1,5.83,6.16A40.62,40.62,0,0,0,150.58,162h0a40.4,40.4,0,0,0,28.73-11.9l34.75-34.74A40.63,40.63,0,0,0,156.63,57.9l-11,11a6,6,0,0,1-8.49-8.49l11-11a52.62,52.62,0,0,1,74.43,0A52.83,52.83,0,0,1,238,88.18Zm-127.62,98.9-11,11A40.36,40.36,0,0,1,70.6,210h0a40.63,40.63,0,0,1-28.7-69.36L76.62,105.9A40.63,40.63,0,0,1,146,135.77a6,6,0,0,0,5.83,6.16H152a6,6,0,0,0,6-5.84A52.63,52.63,0,0,0,68.14,97.42L33.38,132.16A52.63,52.63,0,0,0,70.56,222h0a52.26,52.26,0,0,0,37.22-15.42l11-11a6,6,0,1,0-8.49-8.48Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M240,88.23a54.43,54.43,0,0,1-16,37L189.25,160a54.27,54.27,0,0,1-38.63,16h-.05A54.63,54.63,0,0,1,96,119.84a8,8,0,0,1,16,.45A38.62,38.62,0,0,0,150.58,160h0a38.39,38.39,0,0,0,27.31-11.31l34.75-34.75a38.63,38.63,0,0,0-54.63-54.63l-11,11A8,8,0,0,1,135.7,59l11-11A54.65,54.65,0,0,1,224,48,54.86,54.86,0,0,1,240,88.23ZM109,185.66l-11,11A38.41,38.41,0,0,1,70.6,208h0a38.63,38.63,0,0,1-27.29-65.94L78,107.31A38.63,38.63,0,0,1,144,135.71a8,8,0,0,0,16,.45A54.86,54.86,0,0,0,144,96a54.65,54.65,0,0,0-77.27,0L32,130.75A54.62,54.62,0,0,0,70.56,224h0a54.28,54.28,0,0,0,38.64-16l11-11A8,8,0,0,0,109,185.66Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M236,88.12a50.44,50.44,0,0,1-14.81,34.31l-34.75,34.74A50.33,50.33,0,0,1,150.62,172h-.05A50.63,50.63,0,0,1,100,120a4,4,0,0,1,4-3.89h.11a4,4,0,0,1,3.89,4.11A42.64,42.64,0,0,0,150.58,164h0a42.32,42.32,0,0,0,30.14-12.49l34.75-34.74a42.63,42.63,0,1,0-60.29-60.28l-11,11a4,4,0,0,1-5.66-5.65l11-11A50.64,50.64,0,0,1,236,88.12ZM111.78,188.49l-11,11A42.33,42.33,0,0,1,70.6,212h0a42.63,42.63,0,0,1-30.11-72.77l34.75-34.74A42.63,42.63,0,0,1,148,135.82a4,4,0,0,0,8,.23A50.64,50.64,0,0,0,69.55,98.83L34.8,133.57A50.63,50.63,0,0,0,70.56,220h0a50.33,50.33,0,0,0,35.81-14.83l11-11a4,4,0,1,0-5.65-5.66Z"}))]]),m=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),n=a.forwardRef((e,t)=>a.createElement(l,{ref:t,...e,weights:r}));n.displayName="LinkIcon";const V=n,h=a.forwardRef((e,t)=>a.createElement(l,{ref:t,...e,weights:m}));h.displayName="TrashIcon";const Z=h;export{V as c,Z as n};
@@ -0,0 +1 @@
1
+ import{j as t}from"./note-vendor-uuJO2MTD.js";import{P as g,J as V,a0 as $,i as n,j as K,V as A,k as D,av as I,a6 as N,q as u,ac as S,a1 as M,aM as O,T as Q,m as L}from"./index-B43ulIPo.js";import{a as W}from"./graph-vendor-CUxe67Lr.js";import{A as _,f as J,h as U,V as z,c as B,u as G,d as H}from"./ViewSectionTableRenderer-C5yJBO7C.js";import"./note-core-DMZcZ4yV.js";const m=K(A);function X(){const o=m.useNavigate(),l=D(),P=L(),{page:c,sectionId:i}=m.useSearch(),{onDelete:C,onPinned:T,deleteWarningDialog:q}=I(),[y,p]=W.useState(!1),r=25,{data:s}=N({queryKey:u.views.section(i),async queryFn(){const e=await _(i);if(e.type==="error")throw e;if(!e.viewSection)throw new Error("View section not found.");return e.viewSection}}),{data:a}=N({queryKey:u.views.sectionNotes(i,{limit:r,offset:(c-1)*r}),async queryFn(){const e=await J(i,{limit:r,offset:(c-1)*r});if(e.type==="error")throw e;return e.viewSectionNotes}}),h=s.title,d=s.tagNames,F=s.mode,x=s.propertyFilters,R=d.length>0,w=x.length>0,v=d.length>1?` · ${U(F)}`:"",k=R?w?`Property and tag filters${v}`:`Tag filters${v}`:w?"Property filters":"All notes",j=t.jsx(S,{fallback:null,children:a.totalCount&&r<a.totalCount&&t.jsx(M,{page:c,last:Math.ceil(a.totalCount/r),onChange:e=>{o({search:f=>({...f,page:e})})}})}),E=async e=>{if(y)return;const f=s.sortBy===e?s.sortOrder==="asc"?"desc":"asc":e==="title"?"asc":"desc";p(!0);const b=await G(s.id,H(s,{sortBy:e,sortOrder:f}));if(b.type==="error"){P(b.errors[0]?.message??"Failed to update table sort."),p(!1);return}await l.invalidateQueries({queryKey:u.views.all(),exact:!1}),p(!1)};return t.jsxs(g,{title:h,heading:a.totalCount>0?`${h} (${a.totalCount})`:h,description:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Q,{as:"span",variant:"meta",tone:"tertiary",children:k}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[d.map(e=>t.jsx("span",{className:"inline-flex items-center rounded-full border border-border-subtle bg-hover-subtle px-2.5 py-1 text-xs font-medium text-fg-secondary",children:e},e)),x.map(e=>t.jsx("span",{className:"inline-flex items-center rounded-full border border-border-subtle bg-hover-subtle px-2.5 py-1 text-xs font-medium text-fg-secondary",children:B(e)},`${e.key}-${e.operator}-${e.value??""}`)),d.length===0&&x.length===0&&t.jsx("span",{className:"inline-flex items-center rounded-full border border-border-subtle bg-hover-subtle px-2.5 py-1 text-xs font-medium text-fg-secondary",children:"All notes"})]})]}),children:[t.jsx(S,{fallback:t.jsx(V,{title:"No notes match this saved view",description:"Adjust this view's filters or keep writing until matching notes appear."}),children:a.notes.length>0&&s.displayType==="table"?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(z,{section:s,notes:a.notes,isPending:!1,isError:!1,onRetry:()=>{l.invalidateQueries({queryKey:u.views.sectionNotes(i,{limit:r,offset:(c-1)*r})})},onSortChange:E,isSortPending:y}),j]}):a.notes.length>0?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx("div",{className:"grid-auto-cards grid gap-5",children:a.notes.map(e=>t.jsx(O,{...e,onPinned:()=>T(e.id,e.pinned),onDelete:()=>C(e.id)},e.id))}),j]}):null}),q]})}function ae(){const{sectionId:o,page:l}=m.useSearch();return o?t.jsx($,{fallback:t.jsx(g,{title:"View Notes",heading:t.jsx(n,{width:180,height:24,className:"rounded-full"}),description:t.jsx(n,{width:220,height:16,className:"rounded-full"}),children:t.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[t.jsx(n,{height:"112px"}),t.jsx(n,{height:"112px"}),t.jsx(n,{height:"112px"})]})}),errorTitle:"Failed to load view notes",errorDescription:"Retry loading notes for this saved view section",resetKeys:[l,o],children:t.jsx(X,{})}):t.jsx(g,{title:"View Notes",description:"Saved view note lists require a section id.",children:t.jsx(V,{title:"No section selected",description:"Return to Views and open a section from there."})})}export{ae as default};
@@ -0,0 +1,102 @@
1
+ import{h as o,a4 as S,T as l,B as $,N as g,L as A,t as f}from"./index-B43ulIPo.js";import{j as r}from"./note-vendor-uuJO2MTD.js";import"./graph-vendor-CUxe67Lr.js";const x=`
2
+ id
3
+ tabId
4
+ title
5
+ displayType
6
+ displayOptions {
7
+ tableColumns
8
+ }
9
+ tagNames
10
+ mode
11
+ propertyFilters {
12
+ key
13
+ name
14
+ valueType
15
+ operator
16
+ value
17
+ }
18
+ sortBy
19
+ sortOrder
20
+ limit
21
+ order
22
+ `;function M(){return o(`query FetchViewWorkspace {
23
+ viewWorkspace {
24
+ activeTabId
25
+ tabs {
26
+ id
27
+ title
28
+ order
29
+ sections {
30
+ ${x}
31
+ }
32
+ }
33
+ }
34
+ }`)}function U(e){return o(`query FetchViewSection($id: ID!) {
35
+ viewSection(id: $id) {
36
+ ${x}
37
+ }
38
+ }`,{id:e})}function z(e,{limit:t=25,offset:a=0}={}){return o(`query FetchViewSectionNotes($id: ID!, $pagination: PaginationInput) {
39
+ viewSectionNotes(id: $id, pagination: $pagination) {
40
+ totalCount
41
+ notes {
42
+ id
43
+ title
44
+ pinned
45
+ tags {
46
+ id
47
+ name
48
+ }
49
+ createdAt
50
+ updatedAt
51
+ properties {
52
+ key
53
+ name
54
+ value
55
+ valueType
56
+ option { id label value color order }
57
+ createdAt
58
+ updatedAt
59
+ }
60
+ }
61
+ }
62
+ }`,{id:e,pagination:{limit:t,offset:a}})}function H(e){return o(`mutation CreateViewTab($title: String!) {
63
+ createViewTab(title: $title) {
64
+ id
65
+ }
66
+ }`,{title:e})}function K(e,t){return o(`mutation UpdateViewTab($id: ID!, $title: String!) {
67
+ updateViewTab(id: $id, title: $title) {
68
+ id
69
+ }
70
+ }`,{id:e,title:t})}function Q(e){return o(`mutation DeleteViewTab($id: ID!) {
71
+ deleteViewTab(id: $id)
72
+ }`,{id:e})}function Y(e){return o(`mutation SetActiveViewTab($id: ID!) {
73
+ setActiveViewTab(id: $id) {
74
+ activeTabId
75
+ tabs {
76
+ id
77
+ title
78
+ order
79
+ sections {
80
+ ${x}
81
+ }
82
+ }
83
+ }
84
+ }`,{id:e})}function G(e){return o(`mutation ReorderViewTabs($tabIds: [ID!]!) {
85
+ reorderViewTabs(tabIds: $tabIds) {
86
+ id
87
+ }
88
+ }`,{tabIds:e})}function J(e,t){return o(`mutation CreateViewSection($tabId: ID!, $input: ViewSectionInput!) {
89
+ createViewSection(tabId: $tabId, input: $input) {
90
+ id
91
+ }
92
+ }`,{tabId:e,input:t})}function X(e,t){return o(`mutation UpdateViewSection($id: ID!, $input: ViewSectionInput!) {
93
+ updateViewSection(id: $id, input: $input) {
94
+ id
95
+ }
96
+ }`,{id:e,input:t})}function Z(e){return o(`mutation DeleteViewSection($id: ID!) {
97
+ deleteViewSection(id: $id)
98
+ }`,{id:e})}function ee(e,t){return o(`mutation ReorderViewSections($tabId: ID!, $sectionIds: [ID!]!) {
99
+ reorderViewSections(tabId: $tabId, sectionIds: $sectionIds) {
100
+ id
101
+ }
102
+ }`,{tabId:e,sectionIds:t})}const y=["title","tags","properties","createdAt","updatedAt"],te={activeTabId:null,tabs:[]},C=e=>{const t=e.trim();return t?t.startsWith("@")?t:t.startsWith("#")?`@${t.slice(1)}`:`@${t}`:""},w=(e,t,a)=>{if(t===a)return e;const s=e.findIndex(u=>u.id===t),n=e.findIndex(u=>u.id===a);if(s<0||n<0)return e;const c=[...e],[m]=c.splice(s,1);return c.splice(n,0,m),c},re=e=>{const t=e.flatMap(a=>typeof a=="string"?a.split(","):[]);return Array.from(new Set(t.map(C).filter(Boolean)))},ae=e=>e.tabs.length===0?null:e.activeTabId?e.tabs.find(t=>t.id===e.activeTabId)??e.tabs[0]??null:e.tabs[0]??null,se=(e,t)=>e.tabs.some(a=>a.id===t)?{...e,activeTabId:t}:e,ie=(e,t,a)=>({...e,tabs:w(e.tabs,t,a)}),ne=(e,t,a,s)=>({...e,tabs:e.tabs.map(n=>n.id===t?{...n,sections:w(n.sections,a,s)}:n)}),de=e=>e==="or"?"OR — any selected tag":"AND — all selected tags",oe=e=>e==="or"?"OR":"AND",D=e=>{switch(e){case"notEquals":return"is not";case"contains":return"contains";case"notContains":return"does not contain";case"before":return"before";case"after":return"after";case"exists":return"is set";case"notExists":return"is empty";default:return"is"}},le=e=>{switch(e){case"table":return"Table";case"calendar":return"Unavailable";default:return"List"}},E=e=>{switch(e){case"tags":return"Tags";case"properties":return"Properties";case"createdAt":return"Created";case"updatedAt":return"Updated";default:return"Title"}},v=e=>{const t=new Set(y),a=(e??[]).filter(n=>t.has(n)),s=Array.from(new Set(a));return s.length===0?[...y]:s.includes("title")?s:["title",...s]},O=e=>({tableColumns:v(e?.tableColumns)}),ce=e=>{const t=D(e.operator);return e.operator==="exists"||e.operator==="notExists"?`${e.name} ${t}`:`${e.name} ${t} ${e.value??""}`.trim()},ue=(e,t={})=>{const a={...e,...t};return{title:a.title,displayType:a.displayType,displayOptions:O(a.displayOptions),tagNames:a.tagNames,mode:a.mode,propertyFilters:a.propertyFilters.map(s=>({key:s.key,valueType:s.valueType,operator:s.operator,value:s.value})),sortBy:a.sortBy,sortOrder:a.sortOrder,limit:a.limit}},pe=e=>({page:1,sectionId:e.id}),L=e=>e.valueType==="select"?e.option?.label??e.value:e.valueType==="boolean"?e.value==="true"?"True":"False":e.value,W=e=>(e.properties??[]).slice(0,3),T={title:280,tags:190,properties:260,createdAt:132,updatedAt:132},k={title:"title",createdAt:"createdAt",updatedAt:"updatedAt"},B=e=>{const t=e.reduce((a,s)=>a+T[s],0);return Math.max(520,t)},_=(e,t={})=>{if(e.tags.length===0)return t.hideEmpty?null:r.jsx("span",{className:"text-fg-tertiary",children:"—"});const a=e.tags.slice(0,3),s=e.tags.length-a.length;return r.jsxs("div",{className:"flex min-w-0 max-w-full gap-1.5 overflow-hidden",children:[a.map(n=>r.jsx("span",{className:"inline-flex max-w-[132px] shrink-0 items-center rounded-full border border-border-subtle bg-transparent px-2 py-0.5 text-xs font-medium text-fg-secondary",children:r.jsx("span",{className:"truncate",children:n.name})},n.id)),s>0&&r.jsxs("span",{className:"inline-flex items-center rounded-full border border-border-subtle bg-subtle px-2 py-0.5 text-xs font-medium text-fg-tertiary",children:["+",s]})]})},F=(e,t={})=>{const a=W(e);if(a.length===0)return t.hideEmpty?null:r.jsx("span",{className:"text-fg-tertiary",children:"—"});const s=(e.properties?.length??0)-a.length;return r.jsxs("div",{className:"flex min-w-0 max-w-full gap-1.5 overflow-hidden",children:[a.map(n=>r.jsxs("span",{className:"inline-flex max-w-[190px] shrink-0 items-center gap-1 rounded-full border border-border-subtle bg-subtle px-2 py-0.5 text-xs font-medium text-fg-secondary",children:[r.jsx("span",{className:"max-w-[76px] shrink-0 truncate text-fg-tertiary",children:n.name}),r.jsx("span",{className:"min-w-0 truncate",children:L(n)||"—"})]},n.key)),s>0&&r.jsxs("span",{className:"inline-flex items-center rounded-full border border-border-subtle bg-subtle px-2 py-0.5 text-xs font-medium text-fg-tertiary",children:["+",s]})]})};function be({section:e,notes:t,isPending:a,isError:s,onRetry:n,onSortChange:c,isSortPending:m}){const u=S(),p=v(e.displayOptions?.tableColumns),N=B(p),V=i=>{u({to:g,params:{id:i}})},j=i=>{const d=k[i],b=E(i),h=d?e.sortBy===d:!1;return r.jsx("th",{"aria-sort":h?e.sortOrder==="asc"?"ascending":"descending":void 0,className:"px-3 py-2.5 text-xs font-semibold text-fg-tertiary",children:d?r.jsxs("button",{type:"button",className:"focus-ring-soft -ml-1 inline-flex items-center gap-1 rounded-[8px] px-1 py-0.5 outline-none transition-colors hover:bg-hover-subtle hover:text-fg-secondary disabled:cursor-wait disabled:opacity-60",disabled:m,onClick:()=>c(d),children:[r.jsx("span",{children:b}),r.jsx("span",{"aria-hidden":"true",className:"text-[10px] text-fg-tertiary",children:h?e.sortOrder==="asc"?"↑":"↓":"↕"})]}):b},i)},I=(i,d)=>{switch(d){case"tags":return r.jsx("td",{className:"px-3 py-2.5 align-middle",children:_(i)},d);case"properties":return r.jsx("td",{className:"px-3 py-2.5 align-middle",children:F(i)},d);case"createdAt":return r.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 align-middle",children:r.jsx(l,{as:"span",variant:"meta",tone:"tertiary",children:f(Number(i.createdAt))})},d);case"updatedAt":return r.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 align-middle",children:r.jsx(l,{as:"span",variant:"meta",tone:"tertiary",children:f(Number(i.updatedAt))})},d);default:return r.jsx("td",{className:"px-3 py-2.5 align-middle",children:r.jsx(l,{as:"div",variant:"body",weight:"semibold",className:"line-clamp-1",children:r.jsx(A,{to:g,params:{id:i.id},className:"focus-ring-soft rounded-[6px] outline-none transition-colors hover:text-fg-default/85",onClick:b=>b.stopPropagation(),children:i.title||"Untitled"})})},d)}};return a?r.jsxs("div",{className:"overflow-hidden rounded-[16px] border border-border-subtle",children:[r.jsx("div",{className:"h-11 animate-pulse bg-hover-subtle"}),r.jsx("div",{className:"h-14 animate-pulse border-t border-border-subtle bg-elevated"}),r.jsx("div",{className:"h-14 animate-pulse border-t border-border-subtle bg-elevated"}),r.jsx("div",{className:"h-14 animate-pulse border-t border-border-subtle bg-elevated"})]}):s?r.jsxs("div",{className:"rounded-[16px] border border-border-subtle bg-hover-subtle/70 p-4",children:[r.jsx(l,{as:"p",variant:"body",weight:"semibold",children:"Failed to load this table"}),r.jsx(l,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Retry to refresh this saved query."}),r.jsx("div",{className:"mt-3",children:r.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:n,children:"Retry"})})]}):t.length===0?r.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle px-4 py-5",children:[r.jsx(l,{as:"p",variant:"body",weight:"semibold",children:"No rows yet"}),r.jsx(l,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Add matching notes, or edit this view query."})]}):r.jsx("div",{className:"overflow-x-auto rounded-[16px] border border-border-subtle bg-elevated",children:r.jsxs("table",{className:"w-full table-fixed border-collapse text-left",style:{minWidth:N},children:[r.jsx("caption",{className:"sr-only",children:"View query results as a table"}),r.jsx("colgroup",{children:p.map(i=>r.jsx("col",{style:{width:T[i]}},i))}),r.jsx("thead",{className:"bg-subtle/80",children:r.jsx("tr",{className:"border-b border-border-subtle",children:p.map(j)})}),r.jsx("tbody",{className:"bg-elevated",children:t.map(i=>r.jsx("tr",{className:"h-12 cursor-pointer border-b border-border-subtle/70 transition-colors last:border-b-0 hover:bg-hover-subtle",onClick:()=>V(i.id),children:p.map(d=>I(i,d))},i.id))})]})})}export{U as A,y as D,te as E,be as V,le as a,pe as b,ce as c,ue as d,D as e,z as f,oe as g,de as h,O as i,v as j,E as k,M as l,ae as m,re as n,Y as o,G as p,ne as q,ie as r,se as s,ee as t,X as u,H as v,K as w,Q as x,J as y,Z as z};
@@ -0,0 +1 @@
1
+ import{j as e}from"./note-vendor-uuJO2MTD.js";import{p as Qe,T as l,B as N,L as le,N as Ze,t as Ye,k as Fe,u as X,q as E,V as de,D as Ee,l as De,m as Ae,M as R,n as V,I as oe,o as ce,r as J,v as Ge,S as _,e as v,w as Je,x as Le,y as Xe,z as et,A as tt,E as ue,F as st,K as at,G as rt,H as nt,P as it,i as ae,J as me,O as pe,Q as lt,R as xe,U as he,W as ot,X as dt,Y as ct,Z as ze,_ as Oe,c as ee,$ as Re}from"./index-B43ulIPo.js";import{a as i}from"./graph-vendor-CUxe67Lr.js";import{V as ut,b as mt,f as pt,g as xt,a as qe,c as ht,u as Ie,d as gt,n as ge,e as bt,h as be,i as ft,j as Me,k as vt,D as yt,l as jt,m as wt,E as Nt,s as Tt,o as St,r as Ct,p as kt,q as Vt,t as Ft,v as Et,w as Dt,x as At,y as Lt,z as zt}from"./ViewSectionTableRenderer-C5yJBO7C.js";import{S as K}from"./SurfaceCard-Bnfo5EOl.js";import{n as re}from"./Plus.es-BGVIIQtM.js";import"./note-core-DMZcZ4yV.js";const Ot=new Map([["bold",i.createElement(i.Fragment,null,i.createElement("path",{d:"M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z"}))],["duotone",i.createElement(i.Fragment,null,i.createElement("path",{d:"M216,128l-72,72V56Z",opacity:"0.2"}),i.createElement("path",{d:"M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z"}))],["fill",i.createElement(i.Fragment,null,i.createElement("path",{d:"M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z"}))],["light",i.createElement(i.Fragment,null,i.createElement("path",{d:"M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z"}))],["regular",i.createElement(i.Fragment,null,i.createElement("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"}))],["thin",i.createElement(i.Fragment,null,i.createElement("path",{d:"M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z"}))]]),Pe=i.forwardRef((t,n)=>i.createElement(Qe,{ref:n,...t,weights:Ot}));Pe.displayName="ArrowRightIcon";const Rt=Pe,qt="flex items-start justify-between gap-3 rounded-[14px] border border-border-subtle/70 px-3 py-2.5 transition-colors hover:border-border-secondary hover:bg-hover-subtle";function It({notes:t,isPending:n,isError:r,onRetry:p}){return n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-14 animate-pulse rounded-[14px] bg-hover-subtle"}),e.jsx("div",{className:"h-14 animate-pulse rounded-[14px] bg-hover-subtle"}),e.jsx("div",{className:"h-14 animate-pulse rounded-[14px] bg-hover-subtle"})]}):r?e.jsxs("div",{className:"rounded-[16px] border border-border-subtle bg-hover-subtle/70 p-4",children:[e.jsx(l,{as:"p",variant:"body",weight:"semibold",children:"Failed to load this section"}),e.jsx(l,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Retry to refresh this saved query."}),e.jsx("div",{className:"mt-3",children:e.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:p,children:"Retry"})})]}):t.length===0?e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle px-4 py-5",children:[e.jsx(l,{as:"p",variant:"body",weight:"semibold",children:"No notes match yet"}),e.jsx(l,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Add matching notes, or edit this view query."})]}):e.jsx(e.Fragment,{children:t.map(u=>e.jsxs(le,{to:Ze,params:{id:u.id},className:qt,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(l,{as:"div",variant:"body",weight:"semibold",className:"line-clamp-1",children:u.title||"Untitled"}),e.jsxs(l,{as:"div",variant:"meta",tone:"tertiary",className:"mt-1",children:["Updated ",Ye(Number(u.updatedAt))]})]}),e.jsx(Rt,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary"})]},u.id))})}function Mt({onEdit:t}){return e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle bg-subtle/40 px-4 py-5",children:[e.jsx(l,{as:"p",variant:"body",weight:"semibold",children:"This display type is unavailable"}),e.jsx(l,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Switch this section to List or Table to preview the saved query here."}),e.jsx("div",{className:"mt-3",children:e.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:t,children:"Change display"})})]})}function Pt({section:t,notes:n,isPending:r,isError:p,onRetry:u,onEdit:x,onSortChange:b,isSortPending:g}){return t.displayType==="table"?e.jsx(ut,{section:t,notes:n,isPending:r,isError:p,onRetry:u,onSortChange:b,isSortPending:g}):t.displayType==="calendar"?e.jsx(Mt,{onEdit:x}):e.jsx(It,{notes:n,isPending:r,isError:p,onRetry:u})}function _t({section:t,onEdit:n,onDelete:r,dragHandle:p}){const u=Fe(),x=Ae(),[b,g]=i.useState(!1),F=mt(t),{data:T,isPending:q,isError:j,refetch:m}=X({queryKey:E.views.sectionNotes(t.id,{limit:t.limit,offset:0}),async queryFn(){const h=await pt(t.id,{limit:t.limit,offset:0});if(h.type==="error")throw h;return h.viewSectionNotes}}),D=T?.notes??[],W=T?.totalCount??0,A=xt(t.mode),L=t.tagNames.length>0||t.propertyFilters.length>0,H=async h=>{if(b)return;const z=t.sortBy===h?t.sortOrder==="asc"?"desc":"asc":h==="title"?"asc":"desc";g(!0);const S=await Ie(t.id,gt(t,{sortBy:h,sortOrder:z}));if(S.type==="error"){x(S.errors[0]?.message??"Failed to update table sort."),g(!1);return}await u.invalidateQueries({queryKey:E.views.all(),exact:!1}),g(!1)};return e.jsxs(K,{className:"flex h-full flex-col gap-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[p&&e.jsx("div",{className:"-mr-1 shrink-0 self-center",children:p}),e.jsx("div",{className:"min-w-0",children:e.jsx(l,{as:"h2",variant:"subheading",weight:"semibold",tracking:"tight",className:"min-w-0",children:e.jsx(le,{to:de,search:F,className:"truncate hover:text-fg-default/85",children:t.title})})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[e.jsx("span",{className:"inline-flex items-center rounded-full border border-border-subtle/80 bg-elevated px-2.5 py-1 text-xs font-medium text-fg-secondary",children:qe(t.displayType)}),t.tagNames.map((h,z)=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[z>0&&e.jsx("span",{className:"px-0.5 text-[10px] font-semibold tracking-[0.08em] text-fg-tertiary/85",children:A}),e.jsx("span",{className:"inline-flex items-center rounded-full border border-border-subtle/80 bg-transparent px-2.5 py-1 text-xs font-medium text-fg-secondary",children:h})]},h)),t.propertyFilters.map(h=>e.jsx("span",{className:"inline-flex items-center rounded-full border border-border-subtle/80 bg-subtle px-2.5 py-1 text-xs font-medium text-fg-secondary",children:ht(h)},`${h.key}-${h.operator}-${h.value??""}`)),!L&&e.jsx("span",{className:"inline-flex items-center rounded-full border border-border-subtle/80 bg-transparent px-2.5 py-1 text-xs font-medium text-fg-tertiary",children:"All notes"})]})]}),e.jsx("div",{className:"shrink-0",children:e.jsx(Ee,{button:e.jsx(De,{label:"Section actions"}),items:[{name:"Edit section",onClick:n},{type:"separator"},{name:"Delete section",onClick:r}]})})]}),e.jsx("div",{className:"flex flex-1 flex-col gap-2.5",children:e.jsx(Pt,{section:t,notes:D,isPending:q,isError:j,onRetry:()=>{m()},onEdit:n,onSortChange:H,isSortPending:b})}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-border-subtle/70 pt-4",children:[e.jsx(l,{as:"p",variant:"meta",tone:"tertiary",children:q?"Loading notes...":`Showing ${D.length} of ${W} notes`}),e.jsx(N,{asChild:!0,variant:"subtle",size:"sm",children:e.jsx(le,{to:de,search:F,children:"Open results"})})]})]})}const ne="__choose_property__",Wt=["title","tags","properties","createdAt","updatedAt"],fe=t=>String(t?.limit??5),ve=t=>t?.displayType==="table"?"table":"list",ye=t=>Me(t?.displayOptions?.tableColumns??yt),je=t=>t?.mode??"and",we=t=>t?t.tagNames.join(", "):"",Ne=t=>t?.title??"",Te=t=>t?.sortBy??"updatedAt",Se=t=>t?.sortOrder??"desc",_e=t=>`property-filter-${Date.now()}-${t}`,Ce=t=>(t?.propertyFilters??[]).map((n,r)=>({id:_e(r),key:n.key,operator:n.operator,value:n.value??""})),ke=t=>t?t.valueType==="date"||t.valueType==="number"?["equals","notEquals","before","after","exists","notExists"]:t.valueType==="text"||t.valueType==="url"?["equals","notEquals","contains","notContains","exists","notExists"]:["equals","notEquals","exists","notExists"]:["exists","notExists"],Ve=t=>t?"equals":"exists",Ht=t=>t?t.valueType==="boolean"?"true":t.valueType==="select"?t.options[0]?.value??"":"":"",ie=t=>t!=="exists"&&t!=="notExists",We=t=>t==="contains"||t==="notContains",$t=(t,n)=>t.valueType==="date"?"date":t.valueType==="number"?"number":t.valueType==="url"&&!We(n)?"url":"text",Kt=(t,n)=>{if(t.valueType==="url")return We(n)?"example.com":"https://example.com";if(t.valueType==="text")return"Value"};function Ut({open:t,mode:n,initialSection:r=null,availableTags:p,availableProperties:u,isTagsLoading:x=!1,isPropertiesLoading:b=!1,onClose:g,onSubmit:F}){const[T,q]=i.useState(Ne(r)),[j,m]=i.useState(ve(r)),[D,W]=i.useState(ye(r)),[A,L]=i.useState(we(r)),[H,h]=i.useState(je(r)),[z,S]=i.useState(Te(r)),[C,Y]=i.useState(Se(r)),[U,G]=i.useState(fe(r)),[O,$]=i.useState(Ce(r)),[te,B]=i.useState((r?.tagNames.length??0)>0),[Q,s]=i.useState(""),d=i.useMemo(()=>new Map(u.map(a=>[a.key,a])),[u]);i.useEffect(()=>{t&&(q(Ne(r)),m(ve(r)),W(ye(r)),L(we(r)),h(je(r)),S(Te(r)),Y(Se(r)),G(fe(r)),$(Ce(r)),B((r?.tagNames.length??0)>0),s(""))},[r,t]);const y=ge([A]),w=te||y.length>0,I=y.length===0&&O.length===0,M=a=>{a!=="title"&&(W(c=>{if(c.includes(a)){const k=c.filter(o=>o!==a);return k.length>0?k:c}return Me([...c,a])}),s(""))},He=a=>{const c=y.includes(a)?y.filter(k=>k!==a):[...y,a];L(c.join(", ")),s("")},$e=()=>{B(!0),s("")},Ke=()=>{L(""),h("and"),B(!1),s("")},Ue=()=>{if(u.length===0){s("Create a shared property before adding a filter.");return}$(a=>[...a,{id:_e(a.length),key:"",operator:"exists",value:""}]),s("")},Z=(a,c)=>{$(k=>k.map(o=>{if(o.id!==a)return o;const P={...o,...c},f=d.get(P.key);return ke(f).includes(P.operator)||(P.operator=Ve(f)),"key"in c&&(P.value=Ht(f),P.operator=Ve(f)),P})),s("")},Be=a=>{$(c=>c.filter(k=>k.id!==a)),s("")};return e.jsxs(R,{isOpen:t,onClose:g,variant:"form",className:"sm:max-w-[720px]",children:[e.jsx(R.Header,{title:n==="create"?"Create view":"Edit view",onClose:g}),e.jsx(R.Body,{children:e.jsxs("form",{id:"view-section-form",className:"flex flex-col gap-5",onSubmit:a=>{a.preventDefault();const c=ge([A]);if(w&&c.length===0){s("Choose at least one tag, or remove this tag filter.");return}if(O.find(f=>!f.key||!d.has(f.key))){s("Choose a property for every filter.");return}const o=O.map(f=>{const se=d.get(f.key);return{key:se?.key??f.key,valueType:se?.valueType??"text",operator:f.operator,value:ie(f.operator)?f.value:null}});if(o.some(f=>ie(f.operator)&&!f.value?.trim())){s("Fill every filter value, or switch it to is set / is empty.");return}F({title:T,displayType:j,displayOptions:ft({tableColumns:D}),tagNames:c,mode:H,propertyFilters:o,sortBy:z,sortOrder:C,limit:Number(U)})},children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(V,{htmlFor:"view-section-title",size:"md",children:"View name"}),e.jsx(oe,{id:"view-section-title",value:T,onChange:a=>q(a.target.value),placeholder:"Doing notes",autoFocus:!0})]}),e.jsxs("section",{className:"flex flex-col gap-3 rounded-[18px] border border-border-subtle bg-elevated px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(V,{size:"md",children:"Display"}),e.jsx(l,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Show the same query as a compact list or a table."})]}),e.jsx(l,{as:"span",variant:"meta",tone:"tertiary",children:qe(j)})]}),e.jsxs(ce,{type:"single",value:j,onValueChange:a=>{(a==="list"||a==="table")&&m(a)},variant:"quiet",size:"sm",className:"self-start",children:[e.jsx(J,{value:"list","aria-label":"Show as list",children:"List"}),e.jsx(J,{value:"table","aria-label":"Show as table",children:"Table"})]}),j==="table"?e.jsxs("div",{className:"rounded-[16px] border border-border-subtle bg-subtle/45 p-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx(V,{size:"sm",children:"Table columns"}),e.jsxs(l,{as:"span",variant:"meta",tone:"tertiary",children:[D.length," shown"]})]}),e.jsx("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:Wt.map(a=>{const c=vt(a);return e.jsxs("div",{className:"flex items-center gap-2 rounded-[12px] border border-border-subtle bg-elevated px-3 py-2",children:[e.jsx(Ge,{size:"sm",checked:D.includes(a),disabled:a==="title","aria-label":`Show ${c} column`,onChange:()=>M(a)}),e.jsx(l,{as:"span",variant:"label",tone:"secondary",children:c})]},a)})}),e.jsx(l,{as:"p",variant:"meta",tone:"tertiary",className:"mt-2",children:"Title is always shown because it opens the note."})]}):null]}),e.jsxs("section",{className:"flex flex-col gap-3 rounded-[20px] border border-border-subtle bg-subtle/40 p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(V,{size:"md",children:"Filters"}),e.jsx(l,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Use properties for structured fields, and tags for loose topics or context."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(N,{type:"button",variant:"subtle",size:"sm",onClick:Ue,children:"Add property filter"}),!w&&e.jsx(N,{type:"button",variant:"subtle",size:"sm",onClick:$e,children:"Add tag filter"})]})]}),O.length===0&&!w?e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle bg-elevated/60 px-4 py-3",children:[e.jsx(l,{as:"p",variant:"label",tone:"default",children:I?"All notes":"No filters"}),e.jsx(l,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Add a property filter, a tag filter, or leave this view open to all notes."})]}):null,O.length>0?e.jsx("div",{className:"flex flex-col gap-2.5",children:O.map(a=>{const c=d.get(a.key),k=ke(c);return e.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-border-subtle bg-elevated p-3 md:grid-cols-[minmax(0,1fr)_minmax(10.5rem,12rem)_minmax(0,1fr)_auto] md:items-center",children:[e.jsxs(_,{value:a.key||ne,ariaLabel:"Property filter property",className:"w-full min-w-0",onValueChange:o=>{o!==ne&&Z(a.id,{key:o})},children:[e.jsx(v,{value:ne,disabled:!0,children:"Choose property"}),u.map(o=>e.jsx(v,{value:o.key,children:o.name},o.key))]}),e.jsx(_,{value:a.operator,disabled:!c,ariaLabel:"Property filter operator",className:"w-full min-w-0",onValueChange:o=>Z(a.id,{operator:o}),children:k.map(o=>e.jsx(v,{value:o,children:bt(o)},o))}),ie(a.operator)&&c?c.valueType==="select"?e.jsx(_,{value:a.value,ariaLabel:"Property filter value",className:"w-full min-w-0",onValueChange:o=>Z(a.id,{value:o}),children:c.options.map(o=>e.jsx(v,{value:o.value,children:o.label},o.value))}):c.valueType==="boolean"?e.jsxs(_,{value:a.value||"true",ariaLabel:"Property filter value",className:"w-full min-w-0",onValueChange:o=>Z(a.id,{value:o}),children:[e.jsx(v,{value:"true",children:"True"}),e.jsx(v,{value:"false",children:"False"})]}):e.jsx(oe,{type:$t(c,a.operator),value:a.value,onChange:o=>Z(a.id,{value:o.target.value}),placeholder:Kt(c,a.operator),"aria-label":"Property filter value"}):e.jsx(l,{as:"span",variant:"label",tone:"tertiary",children:c?"No value needed":"Choose a property first"}),e.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:()=>Be(a.id),children:"Remove"})]},a.id)})}):null,w?e.jsxs("div",{className:"flex flex-col gap-3 rounded-[16px] border border-border-subtle bg-elevated p-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(l,{as:"p",variant:"label",tone:"default",children:"Tag filter"}),e.jsx(l,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Match notes by selected tags."})]}),e.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:Ke,children:"Remove"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(V,{htmlFor:"view-section-tags",size:"sm",children:"Tag names"}),e.jsx(Je,{id:"view-section-tags",value:A,onChange:a=>{L(a.target.value),s("")},placeholder:"@OceanBrain, @todo",size:"sm"}),e.jsx(l,{as:"p",variant:"meta",tone:"tertiary",children:"You can use tags only, properties only, both together, or no filters."})]}),y.length>1?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(V,{size:"sm",children:"Tag match"}),e.jsxs(ce,{type:"single",value:H,onValueChange:a=>{(a==="and"||a==="or")&&h(a)},variant:"quiet",size:"sm",className:"self-start",children:[e.jsx(J,{value:"and","aria-label":be("and"),children:"AND"}),e.jsx(J,{value:"or","aria-label":be("or"),children:"OR"})]}),e.jsx(l,{as:"p",variant:"meta",tone:"tertiary",children:"AND requires every selected tag. OR accepts any selected tag."})]}):null,e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(V,{size:"sm",children:"Existing tags"}),e.jsx(l,{as:"span",variant:"meta",tone:"tertiary",children:x?"Loading...":`${p.length} available`})]}),p.length>0?e.jsx("div",{className:"max-h-44 overflow-y-auto rounded-[16px] border border-border-subtle bg-hover-subtle/60 p-3",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(a=>{const c=y.includes(a.name);return e.jsx("button",{type:"button",className:`inline-flex items-center rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ${c?"border-border-secondary bg-elevated text-fg-default":"border-border-subtle bg-transparent text-fg-secondary hover:border-border-secondary hover:bg-elevated hover:text-fg-default"}`,onClick:()=>He(a.name),children:a.name},a.id)})})}):e.jsx(l,{as:"p",variant:"meta",tone:"tertiary",children:"No tags yet. You can still type tag names manually."})]}):null,e.jsx(l,{as:"p",variant:"meta",tone:Q?"default":"tertiary",className:Q?"text-fg-error":void 0,children:Q||(b||x?"Loading filter options...":`${u.length} properties · ${p.length} tags available`)})]}),e.jsxs("details",{className:"group rounded-[18px] border border-border-subtle bg-elevated px-4 py-3",children:[e.jsx("summary",{className:"cursor-pointer list-none",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(l,{as:"span",variant:"label",tone:"default",children:"Sort and limit"}),e.jsx(l,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Defaults to recently updated notes."})]}),e.jsxs(l,{as:"span",variant:"meta",tone:"tertiary",children:[U," notes"]})]})}),e.jsxs("div",{className:"mt-4 grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(V,{htmlFor:"view-section-sort-by",size:"sm",children:"Sort by"}),e.jsxs(_,{value:z,onValueChange:a=>S(a),children:[e.jsx(v,{value:"updatedAt",children:"Updated time"}),e.jsx(v,{value:"createdAt",children:"Created time"}),e.jsx(v,{value:"title",children:"Title"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(V,{htmlFor:"view-section-sort-order",size:"sm",children:"Order"}),e.jsxs(_,{value:C,onValueChange:a=>Y(a),children:[e.jsx(v,{value:"desc",children:"Descending"}),e.jsx(v,{value:"asc",children:"Ascending"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(V,{htmlFor:"view-section-limit",size:"sm",children:"Max notes"}),e.jsxs(_,{value:U,onValueChange:G,children:[e.jsx(v,{value:"3",children:"3 notes"}),e.jsx(v,{value:"5",children:"5 notes"}),e.jsx(v,{value:"8",children:"8 notes"}),e.jsx(v,{value:"10",children:"10 notes"}),e.jsx(v,{value:"12",children:"12 notes"})]})]})]})]})]})}),e.jsx(R.Footer,{children:e.jsxs(Le,{children:[e.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:g,children:"Cancel"}),e.jsx(N,{type:"submit",size:"sm",form:"view-section-form",children:n==="create"?"Create view":"Save view"})]})})]})}function Bt({open:t,mode:n,initialTitle:r="",onClose:p,onSubmit:u}){const[x,b]=i.useState(r);return i.useEffect(()=>{t&&b(r)},[r,t]),e.jsxs(R,{isOpen:t,onClose:p,variant:"form",className:"sm:max-w-[480px]",children:[e.jsx(R.Header,{title:n==="create"?"Create view tab":"Rename view tab",onClose:p}),e.jsx(R.Body,{children:e.jsxs("form",{id:"view-tab-form",className:"flex flex-col gap-4",onSubmit:g=>{g.preventDefault(),u(x)},children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(V,{htmlFor:"view-tab-title",size:"md",children:"Tab name"}),e.jsx(oe,{id:"view-tab-title",value:x,onChange:g=>b(g.target.value),placeholder:"Now",autoFocus:!0})]}),e.jsx(l,{as:"p",variant:"meta",tone:"tertiary",children:"Each tab is one saved view inside the Views page."})]})}),e.jsx(R.Footer,{children:e.jsxs(Le,{children:[e.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:p,children:"Cancel"}),e.jsx(N,{type:"submit",size:"sm",form:"view-tab-form",children:n==="create"?"Create tab":"Save tab"})]})})]})}const Qt="Save reusable note queries with tags, shared properties, and sorting.",Zt="focus-ring-soft inline-flex h-8 w-8 items-center justify-center rounded-[10px] text-fg-default/70 outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default touch-none",Yt="group relative -mb-px flex h-10 min-w-[92px] max-w-[118px] shrink-0 items-center gap-0.5 rounded-t-[12px] border border-b-0 px-1.5 transition-[background-color,border-color,color,box-shadow]",Gt="focus-ring-soft inline-flex min-w-0 flex-1 items-center gap-1 rounded-[9px] px-0.5 py-1.5 text-[13px] font-medium outline-none",Jt="focus-ring-soft inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-[8px] text-current/55 outline-none transition-[background-color,color,opacity] hover:bg-hover-subtle hover:text-current touch-none",Xt="focus-ring-soft relative mb-0.5 inline-flex h-9 shrink-0 items-center gap-1 rounded-[10px] px-2.5 text-[13px] font-medium text-fg-secondary outline-none transition-colors hover:bg-hover-subtle/85 hover:text-fg-default",es=({tab:t,isActive:n,onSelect:r})=>{const{attributes:p,listeners:u,setNodeRef:x,setActivatorNodeRef:b,transform:g,transition:F,isDragging:T}=ze({id:t.id});return e.jsxs("div",{ref:x,style:{transform:Re.Translate.toString(g),transition:F,opacity:T?.6:1},className:ee(Yt,n?"z-10 border-border-secondary/75 bg-elevated text-fg-default shadow-[0_10px_18px_-20px_rgba(15,18,24,0.24)]":"border-transparent bg-hover-subtle/45 text-fg-secondary hover:bg-hover-subtle/75 hover:text-fg-default"),children:[e.jsx("button",{type:"button",ref:b,"aria-label":`Reorder view tab ${t.title}`,...p,...u,className:ee(Jt,T?"cursor-grabbing opacity-100":"cursor-grab opacity-70 group-hover:opacity-100"),children:e.jsx(Oe,{className:"size-4"})}),e.jsxs("button",{type:"button",role:"tab","aria-selected":n,className:ee(Gt,n?"text-fg-default":"text-fg-secondary group-hover:text-fg-default"),onClick:r,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.title}),e.jsx("span",{className:"inline-flex min-w-4 shrink-0 items-center justify-center rounded-full bg-hover-subtle/75 px-1 py-0 text-[10px] leading-4 text-current/70",children:t.sections.length})]})]})},ts=({section:t,onEdit:n,onDelete:r})=>{const{attributes:p,listeners:u,setNodeRef:x,setActivatorNodeRef:b,transform:g,transition:F,isDragging:T}=ze({id:t.id});return e.jsx("div",{ref:x,style:{transform:Re.Translate.toString(g),transition:F,opacity:T?.6:1},children:e.jsx(_t,{section:t,onEdit:n,onDelete:r,dragHandle:e.jsx("button",{type:"button",ref:b,"aria-label":`Reorder section ${t.title}`,...p,...u,className:ee(Zt,T?"cursor-grabbing":"cursor-grab"),children:e.jsx(Oe,{className:"size-4"})})})})};function ds(){const t=Xe(),n=Ae(),r=Fe(),[p,u]=i.useState(null),[x,b]=i.useState(null),{data:g,isPending:F,isError:T,refetch:q}=X({queryKey:E.views.workspace(),async queryFn(){const s=await jt();if(s.type==="error")throw s;return s.viewWorkspace}}),j=g??Nt,m=wt(j),{data:D,isPending:W}=X({queryKey:E.tags.list({limit:200}),async queryFn(){const s=await et({limit:200});if(s.type==="error")throw s;return s.allTags}}),A=tt(ue(rt,{activationConstraint:{distance:8}}),ue(at,{coordinateGetter:st})),L=D?.tags??[],{data:H,isPending:h}=X({queryKey:E.notes.propertyKeys({limit:100}),async queryFn(){const s=await nt({limit:100});if(s.type==="error")throw s;return s.notePropertyKeys}}),z=H?.keys??[],S=s=>{r.setQueryData(E.views.workspace(),s)},C=async()=>{await r.invalidateQueries({queryKey:E.views.all(),exact:!1})},Y=async({active:s,over:d})=>{if(!d||s.id===d.id)return;const y=r.getQueryData(E.views.workspace())??j,w=Ct(y,String(s.id),String(d.id));S(w);const I=await kt(w.tabs.map(M=>M.id));if(I.type==="error"){S(y),n(I.errors[0].message);return}await C()},U=async({active:s,over:d})=>{if(!m||!d||s.id===d.id)return;const y=r.getQueryData(E.views.workspace())??j,w=Vt(y,m.id,String(s.id),String(d.id));S(w);const I=await Ft(m.id,w.tabs.find(M=>M.id===m.id)?.sections.map(M=>M.id)??[]);if(I.type==="error"){S(y),n(I.errors[0].message);return}await C()},G=async s=>{const d=await Et(s);if(d.type==="error"){n(d.errors[0].message);return}await C(),u(null)},O=async s=>{if(!m)return;const d=await Dt(m.id,s);if(d.type==="error"){n(d.errors[0].message);return}await C(),u(null)},$=async()=>{if(!m||!await t("Delete this view tab and all of its sections?"))return;const s=await At(m.id);if(s.type==="error"){n(s.errors[0].message);return}await C()},te=async s=>{if(!m)return;const d=await Lt(m.id,s);if(d.type==="error"){n(d.errors[0].message);return}await C(),b(null)},B=async s=>{if(!m||!x||x.mode!=="edit")return;const d=await Ie(x.section.id,s);if(d.type==="error"){n(d.errors[0].message);return}await C(),b(null)},Q=async s=>{if(!m||!await t("Delete this section from the current view tab?"))return;const d=await zt(s);if(d.type==="error"){n(d.errors[0].message);return}await C()};return e.jsxs(e.Fragment,{children:[e.jsx(it,{title:"Views",description:Qt,children:F&&!g?e.jsx(K,{className:"px-6 py-8 sm:px-8 sm:py-10",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(ae,{height:20,width:180,className:"rounded-full"}),e.jsx(ae,{height:16,width:260,className:"rounded-full"}),e.jsx(ae,{height:44,width:140,className:"rounded-[12px]"})]})}):T?e.jsxs(K,{className:"px-6 py-8 sm:px-8 sm:py-10",children:[e.jsx(l,{as:"p",variant:"body",weight:"semibold",children:"Failed to load saved views"}),e.jsx(l,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Retry loading your saved view tabs."}),e.jsx("div",{className:"mt-4",children:e.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:()=>{q()},children:"Retry"})})]}):j.tabs.length===0?e.jsxs(K,{className:"px-6 py-8 sm:px-8 sm:py-10",children:[e.jsx(me,{title:"Create your first view tab",description:"Start with a saved view tab, then add sections that query notes by tags, properties, or both."}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsxs(N,{type:"button",onClick:()=>u({mode:"create"}),children:[e.jsx(re,{className:"h-4 w-4"}),"Create first tab"]})})]}):e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx("div",{className:"border-b border-border-secondary/75",children:e.jsx(pe,{sensors:A,collisionDetection:xe,modifiers:[lt],onDragEnd:Y,children:e.jsxs("div",{className:"flex items-end gap-1 overflow-x-auto overflow-y-hidden pb-px",children:[e.jsx(he,{items:j.tabs.map(s=>s.id),strategy:ot,children:e.jsx("div",{role:"tablist","aria-label":"Views tab list",className:"flex min-w-0 items-end gap-1",children:j.tabs.map(s=>e.jsx(es,{tab:s,isActive:s.id===m?.id,onSelect:async()=>{const d=r.getQueryData(E.views.workspace())??j,y=Tt(d,s.id);S(y);const w=await St(s.id);if(w.type==="error"){S(d),n(w.errors[0].message);return}S(w.setActiveViewTab)}},s.id))})}),e.jsxs("button",{type:"button",className:Xt,onClick:()=>u({mode:"create"}),children:[e.jsx(re,{className:"size-4"}),"Add tab"]})]})})}),m&&e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs(K,{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{children:[e.jsx(l,{as:"h2",variant:"heading",weight:"bold",tracking:"tight",children:m.title}),e.jsx(l,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:m.sections.length>0?`${m.sections.length} section${m.sections.length===1?"":"s"} in this view`:"Add sections to build this view"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs(N,{type:"button",size:"sm",onClick:()=>b({mode:"create"}),children:[e.jsx(re,{className:"h-4 w-4"}),"Add section"]}),e.jsx(Ee,{button:e.jsx(De,{label:"View tab actions"}),items:[{name:"Rename",onClick:()=>u({mode:"edit",tab:m})},{type:"separator"},{name:"Delete tab",onClick:()=>{$()}}]})]})]}),m.sections.length===0?e.jsx(K,{className:"px-6 py-8 sm:px-8 sm:py-10",children:e.jsx(me,{title:"Add the first section to this tab",description:"Sections can pull notes by tags, properties, or both."})}):e.jsx("div",{className:"flex flex-col",children:e.jsx(pe,{sensors:A,collisionDetection:xe,modifiers:[dt],onDragEnd:U,children:e.jsx(he,{items:m.sections.map(s=>s.id),strategy:ct,children:e.jsx("div",{className:"flex flex-col gap-4",children:m.sections.map(s=>e.jsx(ts,{section:s,onEdit:()=>b({mode:"edit",section:s}),onDelete:()=>{Q(s.id)}},s.id))})})})})]})]})}),e.jsx(Bt,{open:p!==null,mode:p?.mode??"create",initialTitle:p?.mode==="edit"?p.tab.title:"",onClose:()=>u(null),onSubmit:s=>{if(p?.mode==="edit"){O(s);return}G(s)}}),e.jsx(Ut,{open:x!==null,mode:x?.mode??"create",initialSection:x?.mode==="edit"?x.section:null,availableTags:L,availableProperties:z,isTagsLoading:W,isPropertiesLoading:h,onClose:()=>b(null),onSubmit:s=>{if(x?.mode==="edit"){B(s);return}te(s)}})]})}export{ds as default};
@@ -1,4 +1,4 @@
1
- import{h as t,aR as n}from"./index-nYj7BL3a.js";function o({limit:a=50,offset:e=0}={}){return t(`query FetchImages($pagination: PaginationInput) {
1
+ import{h as t,aR as n}from"./index-B43ulIPo.js";function o({limit:a=50,offset:e=0}={}){return t(`query FetchImages($pagination: PaginationInput) {
2
2
  allImages(pagination: $pagination) {
3
3
  totalCount
4
4
  images {