ocean-brain 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/package.json +1 -1
  2. package/server/client/dist/assets/Calendar-ST5q_8KT.js +48 -0
  3. package/server/client/dist/assets/Callout-CrWW3bg0.js +1 -0
  4. package/server/client/dist/assets/Graph-CzJjt6rP.js +1 -0
  5. package/server/client/dist/assets/Image-Dxg1qqZw.js +1 -0
  6. package/server/client/dist/assets/Image.es-DZ0H6wH1.js +1 -0
  7. package/server/client/dist/assets/Note-Bu7fN3B6.js +6 -0
  8. package/server/client/dist/assets/Note-CCvXqPzv.css +1 -0
  9. package/server/client/dist/assets/Plus.es-CS3WVMDq.js +1 -0
  10. package/server/client/dist/assets/PriorityLegend-D61iBwNW.js +1 -0
  11. package/server/client/dist/assets/Reminders-BjirJMOR.css +1 -0
  12. package/server/client/dist/assets/Reminders-DjWRombU.js +1 -0
  13. package/server/client/dist/assets/Search-BANPp2ZV.js +1 -0
  14. package/server/client/dist/assets/Tag-DbKSLTj0.js +1 -0
  15. package/server/client/dist/assets/TagNotes-B6s7jtL7.js +1 -0
  16. package/server/client/dist/assets/graph-vendor-CUxe67Lr.js +46 -0
  17. package/server/client/dist/assets/image.api-rBH0OSWJ.js +17 -0
  18. package/server/client/dist/assets/index-BzWwEDoL.js +1 -0
  19. package/server/client/dist/assets/index-CF5_ZCYN.js +162 -0
  20. package/server/client/dist/assets/index-DjZk2Gpg.css +1 -0
  21. package/server/client/dist/assets/manage-image-detail-DOx6QsCl.js +1 -0
  22. package/server/client/dist/assets/manage-image-g-MC6Fkc.js +1 -0
  23. package/server/client/dist/assets/{note-core-DTIu0anW.js → note-core-BCgMq5QA.js} +7 -7
  24. package/server/client/dist/assets/note-vendor-BofYbzmZ.js +54 -0
  25. package/server/client/dist/assets/placeholder-DV3u6MrA.js +34 -0
  26. package/server/client/dist/assets/useReminderMutate-CU-UinGn.js +82 -0
  27. package/server/client/dist/index.html +5 -4
  28. package/server/client/dist/assets/index-BJgBFWwL.css +0 -1
  29. package/server/client/dist/assets/index-DvNRv9YC.js +0 -391
  30. package/server/client/dist/assets/note-vendor-CUVHa9LU.js +0 -54
@@ -0,0 +1,34 @@
1
+ import{j as e}from"./note-vendor-BofYbzmZ.js";import{a4 as O,c as E,Y as D,a1 as I,q as x,ah as $,u as H,a9 as P,P as q,B as g,O as k,ai as F,aj as C,ak as Z,M as p,I as f,J as j,F as Q,h as T,f as K,a6 as B}from"./index-CF5_ZCYN.js";import{a}from"./graph-vendor-CUxe67Lr.js";import{C as U}from"./Callout-CrWW3bg0.js";import{n as X}from"./Plus.es-CS3WVMDq.js";import"./note-core-BCgMq5QA.js";const Y=new Map([["bold",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}))]]),L=a.forwardRef((l,r)=>a.createElement(O,{ref:r,...l,weights:Y}));L.displayName="CaretUpIcon";const G=L,b=["id","name","template","replacement","createdAt","updatedAt"],J=new Set(b),z=`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
+ }`,V=l=>{const r=l&&l.length>0?l.filter(n=>J.has(n)):b;return Array.from(new Set(r)).map(n=>" "+n).join(`
14
+ `)+`
15
+ `},W=async({limit:l=25,offset:r=0,query:d="",fields:n}={})=>{const h=V(n),c=z.replace("__PLACEHOLDER_FIELDS__",h);return E(c,{searchFilter:{query:d},pagination:{limit:l,offset:r}})},ee=l=>E(`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=>E(`mutation DeletePlaceholder($id: ID!) {
33
+ deletePlaceholder(id: $id)
34
+ }`,{id:l}),_="bg-subtle flex flex-col gap-1 p-4 rounded-[10px_3px_11px_3px/3px_8px_3px_10px] border-2 border-border-secondary font-bold",v=K(B),oe=()=>{const l=D(),r=I(),d=v.useNavigate(),{page:n}=v.useSearch(),[h,c]=a.useState(!1),[u,A]=a.useState(!1),[s,m]=a.useState({name:"",template:"",replacement:""}),o=25,S=x.placeholders.list({limit:o,offset:(n-1)*o}),[N]=a.useState($),{data:i,isLoading:w}=H({queryKey:S,queryFn:async()=>{const t=await W({offset:(n-1)*o,limit:o});if(t.type==="error")throw t;return t.allPlaceholders}}),y=P({mutationFn:ee,onSuccess:async()=>{l("Placeholder added successfully"),c(!1),m({name:"",template:"",replacement:""}),await r.invalidateQueries({queryKey:x.placeholders.listAll(),exact:!1})}}),R=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 gap-2 items-center justify-between",children:[e.jsx("span",{children:"Placeholders will be replaced with new note data during cloning."}),e.jsx(g,{onClick:()=>c(!0),children:e.jsx(X,{width:20,height:20})})]})}),e.jsxs("div",{className:"flex flex-col gap-3 mt-3",children:[e.jsxs("button",{type:"button",onClick:()=>A(!u),className:"bg-subtle flex gap-2 items-center justify-between p-4 rounded-[10px_3px_11px_3px/3px_8px_3px_10px] border-2 border-border-secondary font-bold",children:[e.jsx("div",{children:"System Placeholders"}),e.jsx("div",{className:"w-6 h-6",children:u?e.jsx(G,{}):e.jsx(k,{})})]}),u&&e.jsx("div",{className:"grid gap-3 grid-cols-1 md:grid-cols-2 lg:grid-cols-3",children:N.map(t=>e.jsxs("div",{className:_,children:[e.jsx("div",{className:"text-sm",children:t.name}),e.jsxs("div",{className:"text-fg-tertiary text-xs font-medium",children:[F,t.template,C," → '",t.replacement,"'"]})]},t.name))}),!w&&i?.placeholders&&i.placeholders.length>0&&e.jsx("div",{className:"grid gap-3 grid-cols-1 md:grid-cols-2 lg:grid-cols-3",children:i.placeholders.map(t=>e.jsxs("div",{className:`${_} relative`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm",children:t.name}),e.jsx("button",{type:"button",className:"w-5 h-5 hover:text-red-500 transition-colors",onClick:()=>R.mutate(t.id.toString()),children:e.jsx(Z,{})})]}),e.jsxs("div",{className:"text-fg-tertiary text-xs font-medium",children:[F,t.template,C," → '",t.replacement,"'"]})]},t.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(f,{htmlFor:"name",children:"Name:"}),e.jsx(j,{id:"name",type:"text",value:s.name,onChange:t=>m({...s,name:t.target.value}),placeholder:"Description of this placeholder"}),e.jsx(f,{htmlFor:"template",children:"Placeholder:"}),e.jsx(j,{id:"template",type:"text",value:s.template,onChange:t=>m({...s,template:t.target.value}),placeholder:"note_app"}),e.jsx(f,{htmlFor:"replacement",children:"Replacement:"}),e.jsx(j,{id:"replacement",type:"text",value:s.replacement,onChange:t=>m({...s,replacement:t.target.value}),placeholder:"Ocean Brain"})]})}),e.jsx(p.Footer,{children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{variant:"ghost",onClick:()=>c(!1),children:"Cancel"}),e.jsx(g,{isLoading:y.isPending,onClick:()=>{if(!s.name||!s.template||!s.replacement){l("All fields are required");return}y.mutate({name:s.name,template:s.template,replacement:s.replacement})},children:"Add"})]})})]}),e.jsx(Q,{fallback:null,children:i?.totalCount&&o<i.totalCount&&e.jsx(T,{page:n,last:Math.ceil(i.totalCount/o),onChange:t=>{d({search:M=>({...M,page:t})})}})})]})};export{oe as default};
@@ -0,0 +1,82 @@
1
+ import{j as y}from"./note-vendor-BofYbzmZ.js";import{c as u,l as f,q as n,Y as R,a1 as $}from"./index-CF5_ZCYN.js";import{a as l}from"./graph-vendor-CUxe67Lr.js";const g=(e={})=>({limit:e.limit??10,offset:e.offset??0}),D=async(e,t)=>u(`
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:g(t)}),A=async e=>u(`
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:g(e)}),q=async e=>{const{noteId:t,reminderDate:a,priority:o="medium",content:i}=e;return u(`
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:a.toISOString(),priority:o,content:i})},I=async({id:e,reminderDate:t,completed:a,priority:o,content:i})=>{const r={id:e};return t&&(r.reminderDate=t.toISOString()),a!==void 0&&(r.completed=a),o&&(r.priority=o),i!==void 0&&(r.content=i),u(`
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)},x=async e=>u(`
79
+ mutation DeleteReminder($id: ID!) {
80
+ deleteReminder(id: $id)
81
+ }
82
+ `,{id:e});function P({noteId:e,searchParams:t,render:a}){const{data:o}=f({queryKey:e?n.reminders.note(e,t):n.reminders.upcoming(t),queryFn:async()=>{if(e){const r=await D(e,t);if(r.type==="error")throw r;return r.noteReminders}const i=await A(t);if(i.type==="error")throw i;return i.upcomingReminders}});return y.jsx(y.Fragment,{children:a(o)})}function w(){const e=R(),t=$(),a=l.useCallback(async(r,m,d="medium",s,c)=>{const p=await q({noteId:r,reminderDate:m,priority:d,content:c});if(p.type==="error"){e(p.errors[0].message);return}await Promise.all([t.invalidateQueries({queryKey:n.reminders.noteAllPages(r),exact:!1}),t.invalidateQueries({queryKey:n.reminders.upcomingAllPages(),exact:!1}),t.invalidateQueries({queryKey:n.reminders.inDateRangeAll(),exact:!1})]),s&&s()},[t,e]),o=l.useCallback(async(r,m,d,s)=>{const c=await I({id:r,...d});if(c.type==="error"){e(c.errors[0].message);return}await Promise.all([t.invalidateQueries({queryKey:n.reminders.noteAllPages(m),exact:!1}),t.invalidateQueries({queryKey:n.reminders.upcomingAllPages(),exact:!1}),t.invalidateQueries({queryKey:n.reminders.inDateRangeAll(),exact:!1})]),s&&s()},[t,e]),i=l.useCallback(async(r,m,d)=>{const s=await x(r);if(s.type==="error"){e(s.errors[0].message);return}await Promise.all([t.invalidateQueries({queryKey:n.reminders.noteAllPages(m),exact:!1}),t.invalidateQueries({queryKey:n.reminders.upcomingAllPages(),exact:!1}),t.invalidateQueries({queryKey:n.reminders.inDateRangeAll(),exact:!1})]),d&&d()},[t,e]);return{onCreate:a,onUpdate:o,onDelete:i}}export{P as R,w as u};
@@ -6,10 +6,11 @@
6
6
  <link rel="icon" type="image/png" href="/icon.png" />
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
8
  <title>Ocean Brain</title>
9
- <script type="module" crossorigin src="/assets/index-DvNRv9YC.js"></script>
10
- <link rel="modulepreload" crossorigin href="/assets/note-core-DTIu0anW.js">
11
- <link rel="modulepreload" crossorigin href="/assets/note-vendor-CUVHa9LU.js">
12
- <link rel="stylesheet" crossorigin href="/assets/index-BJgBFWwL.css">
9
+ <script type="module" crossorigin src="/assets/index-CF5_ZCYN.js"></script>
10
+ <link rel="modulepreload" crossorigin href="/assets/graph-vendor-CUxe67Lr.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/note-core-BCgMq5QA.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/note-vendor-BofYbzmZ.js">
13
+ <link rel="stylesheet" crossorigin href="/assets/index-DjZk2Gpg.css">
13
14
  </head>
14
15
 
15
16
  <body>