@openparachute/app 0.22.10 → 0.22.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/.parachute/info +1 -1
- package/dist/assets/{Account-DYfzZj5S.js → Account-CdkJMAPi.js} +1 -1
- package/dist/assets/Activity-DqsfIB-3.js +1 -0
- package/dist/assets/{AddVault-DKBqKeyq.js → AddVault-D1K_D6Y0.js} +1 -1
- package/dist/assets/{AddVaultChooser-BW2Q-Yue.js → AddVaultChooser-DCs3tJPw.js} +1 -1
- package/dist/assets/{AddVaultCreate-CtO9yrS5.js → AddVaultCreate-B3yMKaiU.js} +1 -1
- package/dist/assets/Calendar-DcVL4_q0.js +1 -0
- package/dist/assets/{CheckEmail-CIv1Gt1o.js → CheckEmail-taTm_0KJ.js} +1 -1
- package/dist/assets/{ConnectAI-BL20KQ5Y.js → ConnectAI-CsKHus0o.js} +1 -1
- package/dist/assets/DayView-BTm_sLsN.js +1 -0
- package/dist/assets/{Export-BynzqvGJ.js → Export-pVqCJjpd.js} +1 -1
- package/dist/assets/{Import-6SmwJlgO.js → Import-DDHJzkGw.js} +1 -1
- package/dist/assets/{NoteEditor-OPipzN_Z.js → NoteEditor-h3CHfMT1.js} +1 -1
- package/dist/assets/{NoteNew-Dy1AbHxm.js → NoteNew-DUVNgXN7.js} +2 -2
- package/dist/assets/{NoteRenderer-BXeTxHnB.js → NoteRenderer-BzRFYOTP.js} +1 -1
- package/dist/assets/NoteView-GsOFyCey.js +3 -0
- package/dist/assets/{OAuthCallback-D35vvyoO.js → OAuthCallback-BoeL9Unb.js} +1 -1
- package/dist/assets/{PinArchiveButtons-DyFdYBrq.js → PinArchiveButtons-DBJ9XC87.js} +1 -1
- package/dist/assets/{Settings-UmrOUQH_.js → Settings-C14K5QIf.js} +1 -1
- package/dist/assets/{TagPage-B7bGWyY4.js → TagPage-Dth86gwn.js} +1 -1
- package/dist/assets/{TagSchemaEditor-Bas3UMIJ.js → TagSchemaEditor-DrsKXHjg.js} +1 -1
- package/dist/assets/{Tags-CTF2n8-H.js → Tags-BAMUSxtu.js} +1 -1
- package/dist/assets/{VaultGraph-BLefh0Zh.js → VaultGraph-CUiB0dxf.js} +3 -3
- package/dist/assets/{Vaults-tXitT9QI.js → Vaults-YV2Gt5rq.js} +1 -1
- package/dist/assets/{ViewNew-DRZyYhEC.js → ViewNew--9bYKDKm.js} +1 -1
- package/dist/assets/ViewSurface-BhLi1m3l.js +1 -0
- package/dist/assets/Welcome-CG-4UtgI.js +1 -0
- package/dist/assets/{WizardShell-B0Fjh0Vt.js → WizardShell-BPt_HrH0.js} +1 -1
- package/dist/assets/{attachment-upload-B8YiOVGU.js → attachment-upload-DbV0j1WH.js} +1 -1
- package/dist/assets/{history-Ce29a331.js → history-Dwz434D-.js} +1 -1
- package/dist/assets/index-B9w7QdRL.css +1 -0
- package/dist/assets/index-CpyANXLa.js +66 -0
- package/dist/assets/{provenance-DDSHYRnT.js → provenance-O7CbiScI.js} +1 -1
- package/dist/assets/{react-force-graph-2d-G4yaBBi0.js → react-force-graph-2d-CQUSRInM.js} +1 -1
- package/dist/assets/{transcribe-default-B7i-j3pr.js → transcribe-default-DIcTpM6A.js} +1 -1
- package/dist/assets/{useAttachmentUploader-C78HTrMx.js → useAttachmentUploader-t5hlKCgS.js} +2 -2
- package/dist/index.html +2 -2
- package/dist/sw.js +1 -1
- package/meta.json +1 -1
- package/package.json +3 -2
- package/dist/assets/Activity-CKF0o1vW.js +0 -1
- package/dist/assets/Calendar-DFuh1M3x.js +0 -1
- package/dist/assets/DayView-Dr2pAVmN.js +0 -1
- package/dist/assets/NoteView-B0eNsUUX.js +0 -3
- package/dist/assets/ViewSurface-DzU1BogH.js +0 -1
- package/dist/assets/Welcome-yAs98HfO.js +0 -1
- package/dist/assets/index-H6VNro-x.js +0 -66
- package/dist/assets/index-rEtUY3V3.css +0 -1
package/dist/index.html
CHANGED
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
} catch (e) {}
|
|
23
23
|
})();
|
|
24
24
|
</script>
|
|
25
|
-
<script type="module" crossorigin src="/assets/index-
|
|
26
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
25
|
+
<script type="module" crossorigin src="/assets/index-CpyANXLa.js"></script>
|
|
26
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B9w7QdRL.css">
|
|
27
27
|
<link rel="manifest" href="/manifest.webmanifest"></head>
|
|
28
28
|
<body>
|
|
29
29
|
<div id="root"></div>
|
package/dist/sw.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
if(!self.define){let s,e={};const l=(l,i)=>(l=new URL(l+".js",i).href,e[l]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()}).then(()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s}));self.define=(i,n)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let a={};const u=s=>l(s,r),o={module:{uri:r},exports:a,require:u};e[r]=Promise.all(i.map(s=>o[s]||u(s))).then(s=>(n(...s),a))}}define(["./workbox-9c191d2f"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"pwa-64x64.png",revision:"6f10cd3ce8dd36cf6af65fd22310235f"},{url:"pwa-512x512.png",revision:"f748457107f68f1ca3c1c546ef9921e7"},{url:"pwa-192x192.png",revision:"536b2ea22e7195eefa8806a1d7d993da"},{url:"maskable-icon-512x512.png",revision:"f748457107f68f1ca3c1c546ef9921e7"},{url:"manifest.webmanifest",revision:"5171a09ae3e50605a6503e2bebd6866b"},{url:"index.html",revision:"
|
|
1
|
+
if(!self.define){let s,e={};const l=(l,i)=>(l=new URL(l+".js",i).href,e[l]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()}).then(()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s}));self.define=(i,n)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let a={};const u=s=>l(s,r),o={module:{uri:r},exports:a,require:u};e[r]=Promise.all(i.map(s=>o[s]||u(s))).then(s=>(n(...s),a))}}define(["./workbox-9c191d2f"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"pwa-64x64.png",revision:"6f10cd3ce8dd36cf6af65fd22310235f"},{url:"pwa-512x512.png",revision:"f748457107f68f1ca3c1c546ef9921e7"},{url:"pwa-192x192.png",revision:"536b2ea22e7195eefa8806a1d7d993da"},{url:"maskable-icon-512x512.png",revision:"f748457107f68f1ca3c1c546ef9921e7"},{url:"manifest.webmanifest",revision:"5171a09ae3e50605a6503e2bebd6866b"},{url:"index.html",revision:"f01524dda24d66eed941b5a70fbbe641"},{url:"icon.svg",revision:"53c7d88dbec013463a85d68375229bcb"},{url:"favicon.ico",revision:"8b16a7348bc587d1c91324487d988e81"},{url:"apple-touch-icon-180x180.png",revision:"010679b40baa6da053a041cfc7fc7657"},{url:"assets/workbox-window.prod.es5-BBnX5xw4.js",revision:null},{url:"assets/useAttachmentUploader-t5hlKCgS.js",revision:null},{url:"assets/url-QSQwrjSV.js",revision:null},{url:"assets/types-BaJkUfo6.js",revision:null},{url:"assets/transcribe-default-DIcTpM6A.js",revision:null},{url:"assets/react-force-graph-2d-CQUSRInM.js",revision:null},{url:"assets/provenance-O7CbiScI.js",revision:null},{url:"assets/index-CpyANXLa.js",revision:null},{url:"assets/index-B9w7QdRL.css",revision:null},{url:"assets/history-Dwz434D-.js",revision:null},{url:"assets/fraunces-vietnamese-opsz-normal-Czevyj-6.woff2",revision:null},{url:"assets/fraunces-vietnamese-opsz-italic-DxWqP7Ku.woff2",revision:null},{url:"assets/fraunces-latin-opsz-normal-DihXLNYH.woff2",revision:null},{url:"assets/fraunces-latin-opsz-italic-lSdLDfvT.woff2",revision:null},{url:"assets/fraunces-latin-ext-opsz-normal-CJcjJNj7.woff2",revision:null},{url:"assets/fraunces-latin-ext-opsz-italic-CGbN9UgK.woff2",revision:null},{url:"assets/figtree-latin-wght-normal-D_ZTVpCC.woff2",revision:null},{url:"assets/figtree-latin-ext-wght-normal-DCwSJGxG.woff2",revision:null},{url:"assets/editor-mode-D9fveTEx.js",revision:null},{url:"assets/attachment-upload-DbV0j1WH.js",revision:null},{url:"assets/WizardShell-BPt_HrH0.js",revision:null},{url:"assets/Welcome-CG-4UtgI.js",revision:null},{url:"assets/ViewSurface-BhLi1m3l.js",revision:null},{url:"assets/ViewNew--9bYKDKm.js",revision:null},{url:"assets/Vaults-YV2Gt5rq.js",revision:null},{url:"assets/VaultGraph-CUiB0dxf.js",revision:null},{url:"assets/Tags-BAMUSxtu.js",revision:null},{url:"assets/TagSchemaEditor-DrsKXHjg.js",revision:null},{url:"assets/TagPage-Dth86gwn.js",revision:null},{url:"assets/Settings-C14K5QIf.js",revision:null},{url:"assets/PinArchiveButtons-DBJ9XC87.js",revision:null},{url:"assets/OAuthCallback-BoeL9Unb.js",revision:null},{url:"assets/NoteView-GsOFyCey.js",revision:null},{url:"assets/NoteRenderer-BzRFYOTP.js",revision:null},{url:"assets/NoteNew-DUVNgXN7.js",revision:null},{url:"assets/NoteEditor-h3CHfMT1.js",revision:null},{url:"assets/Import-DDHJzkGw.js",revision:null},{url:"assets/Export-pVqCJjpd.js",revision:null},{url:"assets/DayView-BTm_sLsN.js",revision:null},{url:"assets/ConnectAI-CsKHus0o.js",revision:null},{url:"assets/CheckEmail-taTm_0KJ.js",revision:null},{url:"assets/Calendar-DcVL4_q0.js",revision:null},{url:"assets/AddVaultCreate-B3yMKaiU.js",revision:null},{url:"assets/AddVaultChooser-DCs3tJPw.js",revision:null},{url:"assets/AddVault-D1K_D6Y0.js",revision:null},{url:"assets/Activity-DqsfIB-3.js",revision:null},{url:"assets/Account-CdkJMAPi.js",revision:null},{url:"apple-touch-icon-180x180.png",revision:"010679b40baa6da053a041cfc7fc7657"},{url:"favicon.ico",revision:"8b16a7348bc587d1c91324487d988e81"},{url:"icon.svg",revision:"53c7d88dbec013463a85d68375229bcb"},{url:"maskable-icon-512x512.png",revision:"f748457107f68f1ca3c1c546ef9921e7"},{url:"pwa-192x192.png",revision:"536b2ea22e7195eefa8806a1d7d993da"},{url:"pwa-512x512.png",revision:"f748457107f68f1ca3c1c546ef9921e7"},{url:"pwa-64x64.png",revision:"6f10cd3ce8dd36cf6af65fd22310235f"},{url:"manifest.webmanifest",revision:"5171a09ae3e50605a6503e2bebd6866b"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("/index.html"),{denylist:[/^\/api\//,/^\/oauth\/(?!callback)/,/^\/\.well-known\//,/^\/signup/,/^\/login/,/^\/logout/,/^\/auth\//,/^\/console/,/^\/admin/,/^\/account\//,/^\/billing/,/^\/unsubscribe/,/^\/health/,/^\/vault\//,/^\/u\//]}))});
|
package/meta.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "parachute",
|
|
4
4
|
"displayName": "Parachute",
|
|
5
5
|
"tagline": "The Parachute app — your parachute's front door.",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.22.12",
|
|
7
7
|
"path": "/surface/parachute",
|
|
8
8
|
"iconUrl": "icon.svg",
|
|
9
9
|
"scopes_required": ["vault:*:read", "vault:*:write"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openparachute/app",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Parachute — the super-surface. A single-page app for interfacing with your Parachute: name a vault, capture and browse notes, connect your AI, and manage the cloud + hub via their APIs. Seeded from notes-ui; the calm centered arrival + warm home lead the experience.",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -19,11 +19,12 @@
|
|
|
19
19
|
"files": ["dist", "meta.json", "README.md", "LICENSE", "CHANGELOG.md"],
|
|
20
20
|
"scripts": {
|
|
21
21
|
"dev": "vite",
|
|
22
|
-
"build": "tsc -b && vite build",
|
|
22
|
+
"build": "bun run sync-meta-version && tsc -b && vite build",
|
|
23
23
|
"preview": "vite preview",
|
|
24
24
|
"test": "vitest run",
|
|
25
25
|
"test:watch": "vitest",
|
|
26
26
|
"test:smoke": "bun scripts/verify-dist.ts",
|
|
27
|
+
"sync-meta-version": "bun scripts/sync-meta-version.ts",
|
|
27
28
|
"bigvault": "bun scripts/bigvault/bigvault.ts",
|
|
28
29
|
"lint": "biome check .",
|
|
29
30
|
"lint:fix": "biome check --write .",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as x,t as f,r as l,j as e,N as g,v as y,E as j,L as u,w as N,x as b,V as v}from"./index-H6VNro-x.js";const h=1440*60*1e3,w=5e3;function E(a,n=30,s=new Date){const r=s.getTime()-n*h,i=[];for(const t of a){const c=t.path??t.id,d=Date.parse(t.createdAt);if(Number.isFinite(d)&&d>=r&&i.push({id:`${t.id}:created`,noteId:t.id,noteName:c,kind:"created",at:t.createdAt,preview:t.preview,tags:t.tags}),t.updatedAt){const o=Date.parse(t.updatedAt);Number.isFinite(o)&&o>=r&&Number.isFinite(d)&&o-d>w&&i.push({id:`${t.id}:updated`,noteId:t.id,noteName:c,kind:"updated",at:t.updatedAt,preview:t.preview,tags:t.tags})}}return i.sort((t,c)=>Date.parse(c.at)-Date.parse(t.at)),i}const k=["today","yesterday","thisWeek","older"],D={today:"Today",yesterday:"Yesterday",thisWeek:"This week",older:"Older"};function A(a,n=new Date){const s=Date.parse(a);if(!Number.isFinite(s))return null;const r=m(n),i=m(new Date(s)),t=Math.round((r.getTime()-i.getTime())/h);return t<0||t===0?"today":t===1?"yesterday":t<7?"thisWeek":"older"}function m(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate())}function S(a,n=new Date){const s={today:[],yesterday:[],thisWeek:[],older:[]};for(const r of a){const i=A(r.at,n);i&&s[i].push(r)}return s}const p=50;function R(){const a=x(o=>o.getActiveVault()),n=f(),[s,r]=l.useState(p),i=l.useMemo(()=>n.data?E(n.data):[],[n.data]),t=l.useMemo(()=>i.slice(0,s),[i,s]),c=l.useMemo(()=>S(t),[t]),d=i.length-t.length;return a?e.jsxs("div",{className:"page-prose",children:[e.jsxs("header",{className:"mb-8",children:[e.jsx("p",{className:"eyebrow mb-1",children:"Activity"}),e.jsx("h1",{className:"page-title",children:"Recent changes"}),e.jsx("p",{className:"mt-2 text-fg-muted",children:"Last 30 days, newest first. Deletions aren't tracked yet."})]}),n.isPending?e.jsx(F,{}):n.isError?e.jsx(L,{error:n.error}):i.length===0?e.jsx(C,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-8",children:k.map(o=>c[o].length>0?e.jsx(T,{title:D[o],events:c[o]},o):null)}),d>0?e.jsx("div",{className:"mt-8 flex justify-center",children:e.jsxs("button",{type:"button",onClick:()=>r(o=>o+p),className:"btn btn-secondary btn-touch",children:["Load more (",d," remaining)"]})}):null]})]}):e.jsx(g,{to:"/",replace:!0})}function T({title:a,events:n}){return e.jsxs("section",{children:[e.jsxs("h2",{className:"eyebrow mb-3",children:[a," (",n.length,")"]}),e.jsx("ol",{className:"card shadow-soft divide-y divide-border rounded-xl",children:n.map(s=>e.jsx("li",{children:e.jsxs(u,{to:`/n/${encodeURIComponent(s.noteId)}`,className:"focus-ring block px-5 py-4 transition-colors hover:bg-bg-soft",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx(B,{kind:s.kind}),e.jsx("span",{className:"truncate font-mono text-sm text-fg",children:s.noteName})]}),e.jsx("span",{className:"shrink-0 text-xs text-fg-dim",children:b(s.at)})]}),s.preview?e.jsx("p",{className:"mt-1 truncate text-sm text-fg-muted",children:s.preview}):null,s.tags&&s.tags.length>0?e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:s.tags.map(r=>e.jsxs("span",{className:"chip chip-tag max-w-full break-all",children:["#",r]},r))}):null]})},s.id))})]})}function B({kind:a}){return a==="created"?e.jsx("span",{className:"chip chip-tag shrink-0",children:"Created"}):e.jsx("span",{className:"chip shrink-0",children:"Edited"})}function C(){return e.jsx(N,{title:"No activity in the last 30 days.",action:e.jsx(u,{to:"/new",className:"btn btn-primary",children:"New note"})})}function F(){return e.jsx("div",{className:"space-y-3","aria-busy":"true",children:[0,1,2,3,4].map(a=>e.jsx(y,{className:"h-16 rounded-xl"},a))})}function L({error:a}){const n=a instanceof v;return e.jsx(j,{title:n?"Session expired":"Could not load activity",message:a.message,action:n?e.jsx(u,{to:"/add",className:"btn btn-primary",children:"Reconnect vault"}):void 0})}export{R as Activity};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as k,y as E,M as y,O as f,t as A,Q as K,r as j,R as S,T,j as e,N as P,U as N,W as l,X as V,L as c,V as C}from"./index-H6VNro-x.js";const R=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],x=5;function W(){const a=k(t=>t.getActiveVault()),[o]=E(),i=o.get("month"),r=y(i)??y(f()),s=A(),h=K(),v=j.useMemo(()=>S(r.year,r.month),[r.year,r.month]),$=j.useMemo(()=>{const t=new Map;if(!s.data)return t;for(const n of s.data){const d=T(n.createdAt);d&&t.set(d,(t.get(d)??0)+1)}return t},[s.data]);if(!a)return e.jsx(P,{to:"/",replace:!0});const u=N(r.year,r.month,-1),p=N(r.year,r.month,1),g=`${u.year}-${l(u.month)}`,b=`${p.year}-${l(p.month)}`,M=f(),w=`${r.year}-${l(r.month)}`===M;return e.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-6 md:px-6 md:py-10",children:[e.jsxs("header",{className:"mb-6 flex flex-wrap items-baseline justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wider text-fg-dim",children:"Calendar"}),e.jsx("h1",{className:"font-serif text-3xl tracking-tight",children:V(r.year,r.month)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[e.jsxs(c,{to:`/calendar?month=${g}`,className:"rounded-lg border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent","aria-label":"Previous month",children:["← ",g]}),w?null:e.jsx(c,{to:"/calendar",className:"rounded-lg border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent",children:"This month"}),e.jsxs(c,{to:`/calendar?month=${b}`,className:"rounded-lg border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent","aria-label":"Next month",children:[b," →"]}),e.jsx(c,{to:`/today?date=${h}`,className:"rounded-lg border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent",children:"Today"})]})]}),s.isError?e.jsx(F,{error:s.error}):e.jsxs("div",{className:"rounded-md border border-border bg-card","aria-busy":s.isPending,children:[e.jsx("div",{className:"grid grid-cols-7 border-b border-border text-xs uppercase tracking-wider text-fg-dim",children:R.map(t=>e.jsx("div",{className:"px-2 py-2 text-center",children:t},t))}),e.jsx("div",{className:"grid grid-cols-7",children:v.map(t=>{const n=`${t.getFullYear()}-${l(t.getMonth()+1)}-${l(t.getDate())}`,d=t.getMonth()+1===r.month,m=$.get(n)??0,D=n===h;return e.jsxs(c,{to:`/today?date=${n}`,className:`flex min-h-20 flex-col border-b border-r border-border p-1.5 text-xs hover:bg-bg/60 focus:bg-bg/60 focus:outline-none ${d?"":"opacity-40"}`,"aria-label":`${n} — ${m} notes`,children:[e.jsx("span",{className:`mb-1 inline-flex h-6 w-6 items-center justify-center rounded-full tabular-nums ${D?"bg-accent text-(--color-on-accent)":"text-fg"}`,children:t.getDate()}),m>0?e.jsx(_,{count:m}):e.jsx("span",{className:"sr-only",children:"no notes"})]},n)})})]}),e.jsx("p",{className:"mt-3 text-xs text-fg-dim",children:"Each dot is a note created on that day. Click any day to open /today."})]})}function _({count:a}){const o=Math.min(a,x),i=a>x?a-x:0;return e.jsxs("span",{className:"flex flex-wrap items-center gap-0.5",children:[Array.from({length:o}).map((r,s)=>e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-accent","aria-hidden":"true"},s)),i>0?e.jsxs("span",{className:"ml-0.5 text-[10px] text-fg-dim",children:["+",i]}):null]})}function F({error:a}){const o=a instanceof C;return e.jsxs("div",{className:"rounded-md border border-red-500/30 bg-red-500/5 p-6",children:[e.jsx("p",{className:"mb-2 font-medium text-red-400",children:o?"Session expired":"Could not load notes"}),e.jsx("p",{className:"mb-4 text-sm text-fg-muted",children:a.message}),o?e.jsx(c,{to:"/add",className:"inline-block rounded-lg bg-accent px-4 py-2 text-sm font-medium text-(--color-on-accent) hover:bg-accent-hover",children:"Reconnect vault"}):null]})}export{W as Calendar};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as g,y as w,j as e,N as p,Q as k,Z as E,t as S,r as A,T as y,L as c,_ as b,$ as D,a0 as R,v as T,E as V,w as $,a1 as L,a2 as B,a3 as C,a4 as K,V as P}from"./index-H6VNro-x.js";import{u as O}from"./history-Ce29a331.js";function Z(){const s=g(t=>t.getActiveVault()),[a]=w(),n=a.get("date");return s?n===null?e.jsx(p,{to:"/",replace:!0}):e.jsx(F,{dateParam:n}):e.jsx(p,{to:"/",replace:!0})}function F({dateParam:s}){const a=O("/"),n=k(),t=s||n,r=E(t),o=S(),i=A.useMemo(()=>{const m=[],x=[];if(!o.data||!r)return{created:m,edited:x};for(const l of o.data){const j=y(l.createdAt),v=y(l.updatedAt??l.createdAt);j===t&&m.push(l),v===t&&j!==t&&x.push(l)}return{created:m,edited:x}},[o.data,r,t]);if(!r)return e.jsxs("div",{className:"page-prose",children:[e.jsxs("p",{className:"text-sm text-danger",children:["Invalid date in URL: ",t]}),e.jsx(c,{to:"/",className:"text-sm text-accent hover:underline",children:"Back to today"})]});const d=t===n,u=b(t,-1),h=b(t,1),f=t.slice(0,7);return e.jsxs("div",{className:"page-prose",children:[e.jsx("nav",{className:"mb-6 text-sm text-fg-dim",children:e.jsx("button",{type:"button",onClick:a,className:"hover:text-accent",children:"← Back"})}),e.jsxs("header",{className:"mb-6 flex flex-wrap items-baseline justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow",children:d?"Today":"On"}),e.jsx("h1",{className:"page-title",children:D(t)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[e.jsxs(c,{to:`/today?date=${u}`,className:"btn btn-secondary btn-sm","aria-label":"Previous day",children:["← ",u]}),d?null:e.jsx(c,{to:"/",className:"btn btn-secondary btn-sm",children:"Today"}),e.jsxs(c,{to:`/today?date=${h}`,className:"btn btn-secondary btn-sm","aria-label":"Next day",children:[h," →"]}),e.jsx(c,{to:`/calendar?month=${f}`,className:"btn btn-secondary btn-sm",children:"Calendar"}),e.jsx(c,{to:"/new",className:"btn btn-primary btn-sm",children:"+ New note"})]})]}),o.isPending?e.jsx(I,{}):o.isError&&!o.data?e.jsx(M,{error:o.error}):i.created.length===0&&i.edited.length===0?e.jsx(H,{isToday:d,targetKey:t}):e.jsxs("div",{className:"space-y-8",children:[o.isError?e.jsx(R,{}):null,i.created.length>0?e.jsx(N,{title:d?"Created today":`Created on ${t}`,notes:i.created}):null,i.edited.length>0?e.jsx(N,{title:d?"Edited today":`Edited on ${t}`,notes:i.edited}):null]})]})}function N({title:s,notes:a}){const n=g(r=>r.getActiveVault()),{roles:t}=L((n==null?void 0:n.id)??null);return e.jsxs("section",{children:[e.jsxs(B,{children:[s," (",a.length,")"]}),e.jsx(C,{children:a.map(r=>e.jsx(K,{note:r,pinnedTag:t.pinned,archivedTag:t.archived},r.id))})]})}function H({isToday:s,targetKey:a}){return e.jsx($,{title:s?"Nothing yet today — start capturing.":`Nothing on ${a}.`,action:s?e.jsx(c,{to:"/new",className:"btn btn-primary",children:"New note"}):void 0})}function I(){return e.jsx("div",{className:"space-y-3","aria-busy":"true",children:[0,1,2,3].map(s=>e.jsx(T,{className:"h-14 rounded-xl"},s))})}function M({error:s}){const a=s instanceof P;return e.jsx(V,{title:a?"Session expired":"Could not load notes",message:s.message,action:a?e.jsx(c,{to:"/add",className:"btn btn-primary",children:"Reconnect vault"}):void 0})}export{Z as DayView};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/react-force-graph-2d-G4yaBBi0.js","assets/index-H6VNro-x.js","assets/index-rEtUY3V3.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a5 as w,a as k,av as $,r as d,aM as U,j as t,af as A,aN as D,L as p,aO as V,aP as O,aQ as _,aR as H,aS as z,ae as G,aT as W,N as K,a0 as Q,v as g,a1 as Y,aU as q,aw as X,ag as T,aV as Z,aW as J,aX as ee,am as te,aY as se,E as ne,w as re,aZ as F,x as L,Y as ae,a_ as ie,V as oe,a7 as le}from"./index-H6VNro-x.js";import{P as ce,D as de}from"./PinArchiveButtons-DyFdYBrq.js";import{b as ue,N as me}from"./NoteRenderer-BXeTxHnB.js";function xe(e,n){const s=w(),r=k(u=>u.activeVaultId),i=$(),[l,a]=d.useState(!1),o=n&&!he(n)?n.path:void 0;return d.useEffect(()=>{if(a(!1),!s||!r||!e||!o)return;let u=!0;const m=()=>{u&&i.invalidateQueries({queryKey:["note",r,e]})},c=fe(s,o,{onUpsert:m,onRemove:m,onStatus:h=>{u&&a(h==="open")}});return()=>{u=!1,a(!1),c()}},[s,r,e,o,i]),{isLive:l}}function he(e){return U(e.id)}function fe(e,n,s){return e.subscribe({path:n},{onSnapshot:()=>{},onUpsert:()=>s.onUpsert(),onRemove:()=>s.onRemove(),onStatus:s.onStatus})}const pe=1,ge=3,be=1;function je(e,n){const s=new Map,r=new Map;for(const l of n.values())for(const a of l.links??[]){if(a.sourceId===a.targetId||!n.has(a.sourceId)||!n.has(a.targetId))continue;const o=`${a.sourceId}|${a.targetId}|${a.relationship}`;s.has(o)||(s.set(o,{source:a.sourceId,target:a.targetId,relationship:a.relationship}),r.set(a.sourceId,(r.get(a.sourceId)??0)+1),r.set(a.targetId,(r.get(a.targetId)??0)+1))}return{nodes:[...n.values()].map(l=>{var a;return{id:l.id,path:l.path,tags:l.tags,summary:typeof((a=l.metadata)==null?void 0:a.summary)=="string"?l.metadata.summary:void 0,isAnchor:l.id===e,linkCount:r.get(l.id)??0}}),edges:[...s.values()]}}async function Ne(e,n,s,r){const i=new Map;i.set(e.id,e);let l=[e];for(let a=1;a<=n;a++){const o=new Set;for(const c of l)for(const h of c.links??[]){const f=h.sourceId===c.id?h.targetId:h.sourceId;f!==c.id&&(i.has(f)||o.add(f))}if(o.size===0)break;const u=await Promise.all([...o].map(c=>s(c).catch(()=>null)));if(r!=null&&r.cancelled)return i;const m=[];for(const c of u)c&&!i.has(c.id)&&(i.set(c.id,c),m.push(c));l=m}return i}function ve(e,n,s){const[r,i]=d.useState(null),[l,a]=d.useState(!1);return d.useEffect(()=>{if(!e||!n){i(null),a(!1);return}const o={cancelled:!1};return a(!0),Ne(n,s,u=>e.getNote(u,{includeLinks:!0}),o).then(u=>{o.cancelled||(i(je(n.id,u)),a(!1))}).catch(()=>{o.cancelled||a(!1)}),()=>{o.cancelled=!0}},[e,n,s]),{data:r,isLoading:l}}const ye=d.lazy(()=>O(()=>import("./react-force-graph-2d-G4yaBBi0.js"),__vite__mapDeps([0,1,2])));function we({anchor:e}){const[n,s]=d.useState(!0),[r,i]=d.useState(be),l=w(),{data:a,isLoading:o}=ve(l,n?e:void 0,r);return t.jsxs("section",{className:"mt-10 border-t border-border pt-6",children:[t.jsxs("header",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("button",{type:"button",onClick:()=>s(u=>!u),"aria-expanded":n,className:"font-serif text-xl text-fg hover:text-accent",children:[n?"▾":"▸"," Neighborhood"]}),n&&a?t.jsxs("span",{className:"text-xs text-fg-dim",children:[a.nodes.length," ",a.nodes.length===1?"note":"notes"]}):null]}),n?t.jsx(ke,{depth:r,onChange:i}):null]}),n?t.jsx(Ce,{data:a,isLoading:o}):null]})}function ke({depth:e,onChange:n}){const s=[];for(let r=pe;r<=ge;r++)s.push(r);return t.jsxs("fieldset",{className:"flex items-center gap-1 text-xs text-fg-dim",children:[t.jsx("legend",{className:"mr-1 inline-block",children:"Hops"}),s.map(r=>t.jsx("button",{type:"button","aria-pressed":r===e,onClick:()=>n(r),className:r===e?"rounded border border-accent bg-accent/10 px-2 py-0.5 text-accent":"rounded border border-border bg-card px-2 py-0.5 hover:text-accent",children:r},r))]})}function Ce({data:e,isLoading:n}){const[s,r]=d.useState(null),i=d.useRef(null);if(d.useEffect(()=>{s&&e&&!e.nodes.some(m=>m.id===s)&&r(null)},[e,s]),!e&&n)return t.jsx(B,{});if(!e)return null;if(e.nodes.length<=1)return t.jsx("div",{className:"rounded-md border border-border bg-card p-6 text-center text-sm text-fg-dim",children:"This note has no neighbors yet."});const l=e.nodes.filter(m=>!m.isAnchor),a=s?e.nodes.find(m=>m.id===s)??null:null,o=m=>{i.current=document.activeElement??null,r(m)},u=m=>{var c,h;r(null),m!=null&&m.restoreFocus&&((h=(c=i.current)==null?void 0:c.focus)==null||h.call(c))};return t.jsxs(t.Fragment,{children:[t.jsx(Te,{data:e,onSelect:o}),a?t.jsx(Ee,{node:a,onClose:u},a.id):null,t.jsx(Ie,{neighbors:l,selectedId:s,onSelect:o})]})}function Ie({neighbors:e,selectedId:n,onSelect:s}){return e.length===0?null:t.jsxs("div",{className:"mt-4",children:[t.jsx("h3",{className:"eyebrow mb-2",children:"Neighbors"}),t.jsx("ul",{className:"flex flex-wrap gap-2",children:e.map(r=>{const i=V(r.path??r.id);return t.jsx("li",{children:t.jsx("button",{type:"button",onClick:()=>s(r.id),"aria-haspopup":"dialog","aria-pressed":n===r.id,"aria-label":`Preview ${i}`,className:`btn btn-sm btn-touch max-w-full ${n===r.id?"btn-primary":"btn-secondary"}`,children:t.jsx("span",{className:"truncate",children:i})})},r.id)})})]})}function Ee({node:e,onClose:n}){var a;const s=A(e.id),r=d.useRef(null);d.useEffect(()=>{var o;(o=r.current)==null||o.focus()},[]);const i=D({id:e.id,path:e.path,content:(a=s.data)==null?void 0:a.content}),l=Re(s.data);return t.jsxs("div",{role:"dialog",ref:r,"aria-label":"Note preview",tabIndex:-1,"data-testid":"neighbor-preview",onKeyDown:o=>{o.key==="Escape"&&n({restoreFocus:!0})},onBlur:o=>{o.currentTarget.contains(o.relatedTarget)||n()},className:"focus-ring card mt-3 p-4",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx("h3",{className:"min-w-0 truncate font-serif text-lg text-fg",children:i}),t.jsx("button",{type:"button",onClick:()=>n({restoreFocus:!0}),"aria-label":"Close preview",className:"shrink-0 text-fg-dim hover:text-accent",children:"✕"})]}),e.tags&&e.tags.length>0?t.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:e.tags.map(o=>t.jsxs("span",{className:"chip chip-tag max-w-full break-all",children:["#",o]},o))}):null,t.jsx(Se,{isPaused:s.fetchStatus==="paused",isPending:s.isPending,isError:s.isError,snippet:l}),t.jsx("div",{className:"mt-3",children:t.jsx(p,{to:`/n/${encodeURIComponent(e.id)}`,className:"btn btn-primary btn-touch",children:"Open note"})})]})}function Se({isPaused:e,isPending:n,isError:s,snippet:r}){return e&&n?t.jsx("p",{className:"mt-2 text-sm text-fg-dim",children:"Preview unavailable offline."}):n?t.jsx("p",{className:"mt-2 text-sm text-fg-dim",children:"Loading preview…"}):s?t.jsx("p",{className:"mt-2 text-sm text-fg-dim",children:"Couldn't load preview."}):r?t.jsx("p",{className:"mt-2 text-sm text-fg-muted",children:r}):t.jsx("p",{className:"mt-2 text-sm text-fg-dim",children:"No preview text."})}function Re(e){if(!e)return null;const n=(e.preview??_(e.content??"")).trim();return n?n.length>200?`${n.slice(0,200).trimEnd()}…`:n:null}function B(){return t.jsx("div",{"aria-busy":"true",className:"h-[24rem] w-full animate-pulse rounded-md border border-border bg-card"})}function Te({data:e,onSelect:n}){const s=d.useRef(null),[r,i]=d.useState({w:600,h:384});d.useEffect(()=>{const a=s.current;if(!a)return;const o=()=>{const m=a.getBoundingClientRect();i({w:Math.max(320,Math.floor(m.width)),h:384})};o();const u=new ResizeObserver(o);return u.observe(a),()=>u.disconnect()},[]);const l=d.useMemo(()=>({nodes:e.nodes.map(a=>({...a})),links:e.edges.map(a=>({source:a.source,target:a.target,rel:a.relationship}))}),[e]);return t.jsx("div",{ref:s,"data-testid":"neighborhood-graph-canvas",className:"overflow-hidden rounded-md border border-border bg-card",children:t.jsx(d.Suspense,{fallback:t.jsx(B,{}),children:t.jsx(ye,{graphData:l,width:r.w,height:r.h,nodeLabel:a=>Le(a),nodeVal:a=>{const o=a;return o.isAnchor?8:3+Math.min(o.linkCount,8)},nodeColor:a=>a.isAnchor?"#c9b170":"#8a9a7a",linkColor:()=>"rgba(160, 160, 160, 0.4)",linkDirectionalArrowLength:3,linkDirectionalArrowRelPos:1,cooldownTicks:80,onNodeClick:a=>{n(a.id)}})})})}function Le(e){const n=[e.path??e.id];return e.tags&&e.tags.length>0&&n.push(`tags: ${e.tags.join(", ")}`),e.summary&&n.push(e.summary),n.join(`
|
|
3
|
-
`)}function Pe({content:e,attachments:n,onRetry:s,retrying:r=!1}){const i={content:e,attachments:n},l=H(i);if(l==="pending"){const a=z(i);return t.jsxs("output",{"aria-live":"polite",className:"mb-4 inline-flex items-center gap-2 rounded-md border border-sky-500/30 bg-sky-500/5 px-3 py-1.5 text-xs text-sky-300",children:[t.jsx("span",{"aria-hidden":!0,className:"inline-block h-2 w-2 animate-pulse rounded-full bg-sky-400"}),"Transcribing…",a?t.jsxs("span",{className:"text-sky-300/80",children:["part ",Math.min(a.done+1,a.total)," of ",a.total]}):null]})}return l==="failed"?t.jsxs("output",{className:"mb-4 inline-flex flex-wrap items-center gap-2 rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-1.5 text-xs text-amber-200",children:[t.jsx("span",{children:"Transcription unavailable — open the audio below and add a note by hand."}),s?t.jsx("button",{type:"button",onClick:s,disabled:r,className:"rounded border border-amber-500/40 px-2 py-0.5 font-medium text-amber-100 hover:bg-amber-500/15 disabled:opacity-50",children:r?"Retrying…":"Retry"}):null]}):l==="voice-limit"?t.jsx("output",{className:"mb-4 inline-flex items-center gap-2 rounded-md border border-border bg-bg/40 px-3 py-1.5 text-xs text-fg-muted",children:"Monthly voice limit reached — transcription resumes next month. The audio is saved below."}):null}function Ze(){const{id:e}=G(),n=k(r=>r.getActiveVault()),s=A(e);return xe(e,s.data),d.useEffect(()=>{n&&e&&W(n.id,e)},[n,e]),n?t.jsxs("div",{className:"page",children:[t.jsx("nav",{className:"mb-6 text-sm text-fg-dim",children:t.jsx(p,{to:"/notes",className:"focus-ring hover:text-accent",children:"← All notes"})}),s.isPending?t.jsx(He,{}):s.data?t.jsxs(t.Fragment,{children:[s.isError?t.jsx(Q,{}):null,t.jsx(Ae,{note:s.data,cacheId:e})]}):s.isError?t.jsx(Qe,{error:s.error,retry:()=>s.refetch()}):t.jsx(Ke,{id:e??""})]}):t.jsx(K,{to:"/",replace:!0})}function Ae({note:e,cacheId:n}){var S,R;const s=k(x=>x.getActiveVault()),{roles:r}=Y((s==null?void 0:s.id)??null),i=q(),{mirror:l}=X(),a=l.state==="offline",o=e.contentEvicted===!0,u=d.useMemo(()=>ue(e),[e]),m=T(x=>x.on),c=T(x=>x.setOn);d.useEffect(()=>{if(!m)return;const x=y=>{y.key==="Escape"&&c(!1)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[m,c]);const h=e.path??e.id,f=Z(e.content),b=f!==null?{kind:"title",text:f}:e.path?J(e.path):{kind:"title",text:e.id},j=d.useMemo(()=>f!==null?{...e,content:ee(e.content??"")}:e,[e,f]),C=typeof((S=e.metadata)==null?void 0:S.summary)=="string"?e.metadata.summary:null,I=d.useMemo(()=>(e.links??[]).filter(x=>x.targetId===e.id&&x.sourceId!==e.id&&x.sourceNote),[e]),E=d.useMemo(()=>{const x=new Set,y=[];for(const N of e.links??[])N.sourceId!==e.id||N.targetId===e.id||N.targetNote&&(x.has(N.targetId)||(x.add(N.targetId),y.push(N)));return y},[e]);return t.jsxs("article",{className:"grid gap-10 lg:grid-cols-[minmax(0,1fr)_18rem]",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("header",{className:"mb-8 border-b border-border pb-5",children:[t.jsx("h1",{className:b.kind==="timestamp"?"page-title title-timestamp":"page-title",children:b.text}),a?t.jsx(Ge,{}):null,e.tags&&e.tags.length>0?t.jsx(Me,{tags:e.tags}):null,C?t.jsx("p",{className:"mt-3 text-fg-muted",children:C}):null,t.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[t.jsx(p,{to:`/n/${encodeURIComponent(e.id)}/edit`,className:"btn btn-secondary btn-touch",children:"Edit"}),t.jsx(ce,{note:e,keyboard:!0}),t.jsx(de,{note:e}),t.jsxs("button",{type:"button",onClick:()=>c(!0),className:"btn btn-ghost btn-touch",title:"Focus (⌘.)",children:[t.jsx(te,{width:16,height:16}),"Focus"]}),se(e,r.view)?t.jsx(p,{to:`/views/${encodeURIComponent(e.id)}`,className:"btn btn-secondary btn-touch",children:"Open as view"}):null]}),t.jsx(Ue,{value:h,isPath:!!e.path})]}),t.jsx(Pe,{content:e.content??"",attachments:e.attachments,onRetry:()=>i.mutate({cacheId:n??e.id,serverId:e.id}),retrying:i.isPending}),o?t.jsx(We,{preview:e.preview}):(R=j.content)!=null&&R.trim()?t.jsx(me,{note:j,resolve:u}):f===null?t.jsx(ze,{noteId:e.id}):null,e.attachments&&e.attachments.length>0?t.jsxs("section",{className:"mt-10 border-t border-border pt-6",children:[t.jsx("h2",{className:"mb-3 font-serif text-xl",children:"Attachments"}),t.jsx("div",{className:"space-y-6",children:e.attachments.map(x=>t.jsx(De,{attachment:x},x.id))})]}):null,t.jsx(we,{anchor:e})]}),t.jsxs("aside",{className:"space-y-6 text-sm lg:sticky lg:top-24 lg:self-start",children:[t.jsx(Fe,{note:e}),E.length>0?t.jsx(P,{title:"Outbound",links:E,peer:"target"}):null,I.length>0?t.jsx(P,{title:"Inbound",links:I,peer:"source"}):null]})]})}function Fe({note:e}){const n=e.createdAt,s=e.updatedAt,r=Object.entries(e.metadata??{}).filter(([i])=>i!=="summary");return t.jsxs("section",{className:"card shadow-soft p-4",children:[t.jsx("h2",{className:"eyebrow mb-2",children:"Metadata"}),t.jsxs("dl",{className:"space-y-1.5 text-sm",children:[e.path?t.jsx(v,{label:"Title",value:t.jsx("span",{className:"font-mono text-xs break-all",children:e.path})}):null,t.jsx(v,{label:"ID",value:t.jsx("span",{className:"font-mono text-xs break-all",children:e.id})}),t.jsx(v,{label:"Created",value:t.jsx("time",{title:n,children:L(n)})}),s?t.jsx(v,{label:"Updated",value:t.jsx("time",{title:s,children:L(s)})}):null,e.path?t.jsx(v,{label:"Path",value:t.jsx(ae,{value:e.path,label:"note path",className:"mt-1"})}):null,r.map(([i,l])=>t.jsx(v,{label:i,value:t.jsx("span",{className:"break-all text-fg-muted",children:String(l)})},i))]}),e.path?t.jsx(Be,{path:e.path}):null,t.jsx(ie,{note:e,variant:"detail",className:"mt-3"})]})}function Be({path:e}){const{copied:n,copy:s}=F();return t.jsx("button",{type:"button",onClick:()=>s(e),className:"btn btn-secondary btn-touch mt-3 w-full","aria-label":"Copy reference to this note",children:n?"Copied ✓":"Copy reference"})}function v({label:e,value:n}){return t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("dt",{className:"eyebrow",children:e}),t.jsx("dd",{children:n})]})}function Me({tags:e}){return t.jsx("div",{className:"mt-2 flex flex-wrap gap-1","aria-label":"Tags",children:e.map(n=>t.jsxs(p,{to:`/tags/${encodeURIComponent(n)}`,className:"chip chip-tag focus-ring max-w-full break-all",children:["#",n]},n))})}function $e(e){return t.jsxs("svg",{width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[t.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),t.jsx("path",{d:"M5 15H4.5A1.5 1.5 0 0 1 3 13.5v-9A1.5 1.5 0 0 1 4.5 3h9A1.5 1.5 0 0 1 15 4.5V5"})]})}function Ue({value:e,isPath:n}){const{copied:s,copy:r}=F();return t.jsxs("button",{type:"button",onClick:()=>r(e),"aria-label":n?"Copy path":"Copy note id",className:"focus-ring group mt-4 flex max-w-full items-center gap-1.5 rounded text-fg-dim transition-colors hover:text-fg-muted",children:[t.jsx($e,{className:"shrink-0 opacity-70 transition-opacity group-hover:opacity-100"}),t.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:e}),s?t.jsx("span",{className:"shrink-0 text-xs text-fg-muted",children:"Copied"}):null]})}function P({title:e,links:n,peer:s}){return t.jsxs("section",{className:"card shadow-soft p-4",children:[t.jsxs("h2",{className:"eyebrow mb-2 tabular-nums",children:[e," (",n.length,")"]}),t.jsx("ul",{className:"space-y-1.5",children:n.map(r=>{var o;const i=s==="source"?r.sourceNote:r.targetNote;if(!i)return null;const l=i.path??i.id,a=typeof((o=i.metadata)==null?void 0:o.summary)=="string"?i.metadata.summary:null;return t.jsx("li",{children:t.jsxs(p,{to:`/n/${encodeURIComponent(i.id)}`,className:"block rounded px-1 py-0.5 hover:bg-bg/50",children:[t.jsx("div",{className:"truncate font-mono text-xs text-fg-muted hover:text-accent",children:l}),a?t.jsx("div",{className:"mt-0.5 line-clamp-2 text-xs text-fg-dim",children:a}):null]})},`${r.sourceId}->${r.targetId}:${r.relationship}`)})})]})}function De({attachment:e}){const n=e.filename;if(!n||!e.url)return t.jsx("figure",{className:"card shadow-soft p-3",children:t.jsx(M,{})});const s=(e.mimeType??"").toLowerCase();return t.jsxs("figure",{className:"card shadow-soft p-3",children:[t.jsxs("figcaption",{className:"mb-2 flex items-baseline justify-between gap-3",children:[t.jsx("span",{className:"truncate font-mono text-xs text-fg-muted",children:n}),typeof e.size=="number"?t.jsx("span",{className:"shrink-0 text-xs text-fg-dim",children:_e(e.size)}):null]}),t.jsx(Ve,{attachment:e,mime:s,filename:n})]})}function M(){return t.jsxs("div",{className:"flex items-center gap-2 text-sm text-fg-dim","aria-busy":"true",children:[t.jsx(g,{className:"h-4 w-32"}),t.jsx("span",{children:"Processing…"})]})}function Ve({attachment:e,mime:n,filename:s}){const r=w(),[i,l]=d.useState(null),[a,o]=d.useState(null),u=Oe(n,s),m=u!=="other",c=e.url;if(d.useEffect(()=>{if(!m||!c||!r)return;let f=!1,b=null;return o(null),r.fetchAttachmentBlob(c).then(j=>{f||(b=URL.createObjectURL(j),l(b))}).catch(j=>{f||o(j instanceof Error?j.message:"Failed to load attachment")}),()=>{f=!0,b&&URL.revokeObjectURL(b)}},[m,c,r]),!c)return t.jsx(M,{});if(a)return t.jsx("p",{className:"text-sm text-danger",children:a});if(m&&!i)return t.jsx(g,{className:"h-32 w-full"});const h=i??c;return u==="image"?t.jsx("img",{src:h,alt:s,className:"max-h-[32rem] rounded"}):u==="audio"?t.jsx("audio",{controls:!0,src:h,className:"w-full"}):u==="video"?t.jsx("video",{controls:!0,src:h,className:"w-full rounded"}):u==="pdf"?t.jsxs(t.Fragment,{children:[t.jsx("iframe",{src:h,title:s,className:"h-[40rem] w-full rounded border border-border"}),t.jsxs("a",{href:h,download:s,className:"mt-2 inline-block text-sm text-accent hover:underline",children:["Download ",s]})]}):t.jsxs("a",{href:h,download:s,className:"text-sm text-accent hover:underline",children:["Download ",s]})}function Oe(e,n){if(e.startsWith("image/"))return"image";if(e.startsWith("audio/"))return"audio";if(e.startsWith("video/"))return"video";if(e==="application/pdf")return"pdf";const s=n.toLowerCase().split(".").pop()??"";return["png","jpg","jpeg","gif","webp","svg"].includes(s)?"image":["mp3","wav","ogg","m4a","flac"].includes(s)?"audio":["mp4","webm","mov"].includes(s)?"video":s==="pdf"?"pdf":"other"}function _e(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function He(){return t.jsxs("div",{className:"grid gap-10 lg:grid-cols-[minmax(0,1fr)_18rem]","aria-busy":"true",children:[t.jsxs("div",{className:"min-w-0 space-y-3",children:[t.jsx(g,{className:"h-3 w-32"}),t.jsx(g,{className:"h-8 w-2/3"}),t.jsx(g,{className:"h-4 w-full"}),t.jsx("div",{className:"mt-6 space-y-2",children:[0,1,2,3,4,5].map(e=>t.jsx(g,{className:"h-3",width:`${70+e*13%25}%`},e))})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(g,{className:"h-32"}),t.jsx(g,{className:"h-24"})]})]})}function ze({noteId:e}){return t.jsxs("p",{className:"my-8 font-serif text-lg italic text-fg-muted",children:["Nothing here yet."," ",t.jsx(p,{to:`/n/${encodeURIComponent(e)}/edit`,className:"not-italic text-accent hover:underline",children:"Start writing →"})]})}function Ge(){return t.jsx("p",{className:"mt-2",children:t.jsx("span",{className:"chip bg-bg-soft text-fg-muted",title:"Served from your offline copy",children:"Saved copy"})})}function We({preview:e}){return t.jsxs("div",{className:"my-8",children:[e?t.jsx("p",{className:"mb-4 text-fg-muted",children:e}):null,t.jsx("p",{className:"font-serif text-lg italic text-fg-muted",children:"Connect to load this note."})]})}function Ke({id:e}){return t.jsx(re,{title:t.jsx("span",{className:"font-serif text-xl text-fg",children:"Note not found"}),description:t.jsxs(t.Fragment,{children:["No note with id ",t.jsx("span",{className:"font-mono",children:e})," in this vault."]}),action:t.jsx(p,{to:"/notes",className:"text-sm text-accent hover:underline",children:"Back to all notes"})})}function Qe({error:e,retry:n}){const s=e instanceof oe,r=e instanceof le,i=s?"Session expired":r?"Note not found":"Could not load note",l=s?e.message:r?"Couldn't find this note. It may have been deleted, or the link may be wrong.":"Something went wrong loading this note. You can try again, or head back to your notes.";return t.jsx(ne,{title:i,message:t.jsxs(t.Fragment,{children:[l,s?null:t.jsxs("details",{className:"mt-3",children:[t.jsx("summary",{className:"cursor-pointer text-xs text-fg-dim hover:text-fg-muted",children:"Technical detail"}),t.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-xs text-fg-dim",children:e.message})]})]}),retry:s?void 0:n,action:s?t.jsx(p,{to:"/add",className:"btn btn-primary",children:"Reconnect vault"}):t.jsx(p,{to:"/notes",className:"btn btn-secondary btn-touch",children:"Back to notes"})})}export{Ze as NoteView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as n,bG as Xe,r as g,bH as V,bI as C,L as R,a_ as Ke,x as Ze,av as et,aj as Se,a6 as Ce,Q as B,bs as O,bJ as $e,bK as Te,bL as tt,bM as Ee,R as nt,w as F,X as st,U as xe,$ as X,bN as De,bO as at,bP as rt,bQ as it,bR as lt,bS as ot,bT as Pe,a as Me,a1 as ct,y as dt,bU as ut,bV as mt,bW as pe,ae as xt,bX as pt,N as ht,E as _e,bY as ft,bZ as Le,b_ as bt,b$ as Y,v as k,c0 as gt,c1 as yt,c2 as jt,at as vt,c3 as Nt,c4 as wt,a3 as he,a4 as fe,c5 as kt,bF as St}from"./index-H6VNro-x.js";import{T as Ct}from"./TagSchemaEditor-Bas3UMIJ.js";const $t="—",Ae=/^https?:\/\//i;function Be(e){return typeof e=="string"&&Ae.test(e)}const be=24;function Tt(e){try{const t=new URL(e);let s=`${t.pathname}${t.search}${t.hash}`;return s==="/"&&(s=""),s.length>be&&(s=`${s.slice(0,be-1)}…`),{host:t.host,rest:s}}catch{return{host:e.replace(Ae,""),rest:""}}}function Et({value:e,schema:t}){if(e==null||e==="")return $t;if(typeof e=="boolean")return e?n.jsx("span",{className:"text-grass",children:"✓"}):n.jsx("span",{className:"text-fg-dim",children:"✕"});if((t==null?void 0:t.type)==="date"&&typeof e=="string")return Xe(e);if(Be(e)){const{host:s,rest:a}=Tt(e);return n.jsxs("span",{className:"min-w-0 truncate text-accent underline underline-offset-2",title:e,children:[s,a?n.jsx("span",{className:"opacity-70",children:a}):null]})}return typeof e=="number"?n.jsx("span",{className:"tabular-nums",children:String(e)}):String(e)}function I(e,t){if(t&&t.length>0||e!=null&&e.enum&&e.enum.length>0)return"enum";switch(e==null?void 0:e.type){case"date":return"date";case"boolean":return"boolean";case"number":return"number";default:return"string"}}const Dt="focus-ring inline-flex max-w-[9rem] items-center rounded px-1 py-0.5 text-[0.6875rem] hover:text-accent disabled:opacity-50";function Pt(e){if(typeof e!="string")return"";const t=e.match(/^\d{4}-\d{2}-\d{2}/);return t?t[0]:""}function Z({field:e,schema:t,value:s,onCommit:a,disabled:r=!1,options:i,includeClear:l=!1,trigger:o}){const u=I(t,i),[c,p]=g.useState(!1),x=s==null||s==="",d=(o==null?void 0:o.label)??n.jsx(Et,{value:s,schema:t}),h=(o==null?void 0:o.ariaLabel)??`Edit ${e}`,j=(o==null?void 0:o.className)??`${Dt} ${x&&!(o!=null&&o.label)?"text-fg-dim":"text-fg"}`;if(u==="boolean"){const v=(o==null?void 0:o.ariaLabel)??`Edit ${e} (${s===!0?"checked":"unchecked"})`;return n.jsx("button",{type:"button",disabled:r,"aria-label":v,onClick:()=>a(s!==!0),className:j,children:d})}const y=u==="enum"?i??((t==null?void 0:t.enum)??[]).map(v=>({value:v,label:v})):[],f=l&&!x,b=v=>{p(!1),a(v)};return n.jsxs("div",{className:"relative",children:[n.jsx("button",{type:"button",disabled:r,"aria-haspopup":u==="enum"?"menu":"dialog","aria-expanded":c,"aria-label":h,title:o!=null&&o.label?void 0:`Edit ${e}`,onClick:()=>p(v=>!v),className:j,children:d}),c?n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button","aria-hidden":"true",tabIndex:-1,className:"fixed inset-0 z-10 cursor-default",onClick:()=>p(!1)}),u==="enum"?n.jsxs("div",{role:"menu","aria-label":h,className:"card absolute right-0 z-20 mt-1 flex min-w-[10rem] flex-col gap-0.5 p-1 shadow-lg",children:[y.map(v=>n.jsxs("button",{type:"button",role:"menuitem",onClick:()=>b(v.value),className:`focus-ring flex items-center gap-1.5 rounded px-2 py-1.5 text-left text-sm hover:bg-bg-soft ${v.muted?"text-fg-dim":"text-fg"}`,children:[v.value===null||v.value===void 0||v.value===""?null:n.jsx("span",{"aria-hidden":"true",className:`tint-dot tint-${V(String(v.value))}`}),v.label]},v.value===null?"__clear__":String(v.value))),f?n.jsx("button",{type:"button",role:"menuitem",onClick:()=>b(null),className:"focus-ring rounded px-2 py-1.5 text-left text-sm text-fg-dim hover:bg-bg-soft",children:"Clear"}):null]}):n.jsx(Mt,{kind:u,value:s,ariaLabel:h,onCommit:b,onCancel:()=>p(!1)})]}):null]})}function Mt({kind:e,value:t,ariaLabel:s,onCommit:a,onCancel:r}){const i=e==="date"?Pt(t):t==null?"":String(t),[l,o]=g.useState(i),u=()=>{const c=l.trim();if(c==="")return a(null);if(e==="number"){const p=Number(c);return Number.isFinite(p)?a(p):r()}a(c)};return n.jsxs("div",{role:"dialog","aria-label":s,className:"card absolute right-0 z-20 mt-1 flex min-w-[10rem] items-center gap-1 p-1 shadow-lg",children:[n.jsx("input",{autoFocus:!0,type:e==="date"?"date":e==="number"?"number":"text",value:l,"aria-label":s,onChange:c=>o(c.target.value),onKeyDown:c=>{c.key==="Enter"?(c.preventDefault(),u()):c.key==="Escape"&&(c.preventDefault(),r())},className:"w-full rounded border border-border bg-bg/40 px-1.5 py-1 text-xs text-fg focus:border-accent focus:outline-none"}),n.jsx("button",{type:"button",onClick:u,"aria-label":"Save",className:"focus-ring rounded px-1.5 py-1 text-xs text-accent hover:bg-bg-soft",children:"✓"}),Be(t)?n.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer","aria-label":"Open link",title:"Open link",className:"focus-ring rounded px-1.5 py-1 text-xs text-accent hover:bg-bg-soft",children:"↗"}):null]})}function _t(e){for(const t of e.attachments??[]){const s=typeof t.url=="string"?t.url:null;if(typeof t.mimeType=="string"&&t.mimeType.startsWith("image/")&&s&&/^https?:\/\//i.test(s))return s}return null}function q({note:e,pinnedTag:t,archivedTag:s,variant:a="compact",overlay:r,footer:i,drag:l}){const o=C(e),u=e.updatedAt??e.createdAt,c=(e.tags??[]).includes(t),p=(e.tags??[]).includes(s),x=a==="gallery"?_t(e):null,[d,h]=g.useState(!1),j=x&&!d,y=(l==null?void 0:l.canDrag)??!1,f=n.jsxs(R,{to:`/n/${encodeURIComponent(e.id)}`,draggable:y?!1:void 0,"data-note-id":e.id,className:`focus-ring card group flex flex-col overflow-hidden rounded-xl shadow-sm transition hover:border-accent hover:shadow-md ${p?"opacity-60 italic":""}`,children:[a==="gallery"?n.jsx("div",{className:"aspect-[3/2] w-full overflow-hidden bg-bg-soft",children:j?n.jsx("img",{src:x,alt:"",loading:"lazy",onError:()=>h(!0),className:"h-full w-full object-cover"}):n.jsx("div",{"aria-hidden":"true",className:"flex h-full w-full items-end p-3 text-fg-dim",children:n.jsx("span",{className:"line-clamp-3 text-sm text-fg-muted",children:e.preview??""})})}):null,n.jsxs("div",{className:"flex flex-1 flex-col gap-1 p-3",children:[n.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[n.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[c?n.jsx("span",{className:"shrink-0 text-accent","aria-label":"pinned",title:"pinned",children:"★"}):null,n.jsx("span",{className:o.kind==="timestamp"?"min-w-0 truncate text-sm title-timestamp":"min-w-0 truncate text-sm font-medium text-fg",children:o.text})]}),n.jsx(Ke,{note:e})]}),e.preview&&!(a==="gallery"&&!j)?n.jsx("p",{className:"line-clamp-2 text-xs text-fg-muted",children:e.preview}):null,n.jsx("span",{className:"mt-auto pt-1 text-[0.6875rem] tabular-nums text-fg-dim",children:Ze(u)})]})]});return!r&&!i&&!y?f:n.jsxs("div",{className:y?"relative flex flex-col cursor-grab":"relative flex flex-col",...(l==null?void 0:l.sourceProps)??{},children:[f,r?n.jsx("div",{className:"absolute right-2 top-2",children:r}):null,i?n.jsx("div",{className:"mt-1",children:i}):null]})}function Lt(e,t,s){const a={...e.metadata??{}};return s===null?delete a[t]:a[t]=s,{...e,metadata:a}}function At(e,t,s,a){return e&&e.map(r=>r.id===t?Lt(r,s,a):r)}function Bt(e,t){const s=et(),a=Se(e);return{move:g.useCallback(async(i,l,o)=>{const u=s.getQueryData(t);s.setQueryData(t,c=>At(c,e,i,l));try{const c=await a.mutateAsync({metadata:{[i]:l},...o?{if_updated_at:o}:{force:!0}}),p=c==null?void 0:c.updatedAt;p&&s.setQueryData(t,x=>x==null?void 0:x.map(d=>d.id===e?{...d,updatedAt:p}:d))}catch(c){throw s.setQueryData(t,u),c}},[s,t,e,a]),isPending:a.isPending}}const Ft=1800,Q="field-write-flash",Vt=700;function Rt(e){return e===null?null:typeof e=="boolean"?e?"Yes":"No":String(e)}function Ot(e){if(typeof document>"u")return;const t=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\]/g,"\\$&");for(const s of document.querySelectorAll(`[data-note-id="${t}"]`))s.classList.remove(Q),s.offsetWidth,s.classList.add(Q),window.setTimeout(()=>s.classList.remove(Q),Vt)}function z(e,t){const s=Ce(c=>c.push),{move:a,isPending:r}=Bt(e.id,t),i=e.id,l=e.updatedAt,o=C(e).text;return{write:g.useCallback(async(c,p,x)=>{try{await a(c,p,l)}catch(h){const j=(x==null?void 0:x.errorPrefix)??`Couldn't update ${c} on "${o}"`;s(`${j}: ${h instanceof Error?h.message:"unknown error"}`,"error");return}const d=(x==null?void 0:x.valueLabel)??Rt(p);s(d===null?`✓ ${c} cleared`:`✓ ${c} → ${d}`,"success",{durationMs:Ft}),Ot(i)},[a,l,o,i,s]),isPending:r}}function Fe(e){if(e==null)return null;const t=typeof e;return t==="string"||t==="number"||t==="boolean"?e:null}function P({note:e,fields:t,viewResultsKey:s,omit:a}){const{write:r,isPending:i}=z(e,s),l=a&&a.length>0?t.filter(o=>!a.includes(o.name)):t;return l.length===0?null:n.jsx("div",{className:"flex flex-wrap items-center gap-1.5 px-3 pb-2.5 pt-0.5",children:l.map(o=>{var p;const u=Fe((p=e.metadata)==null?void 0:p[o.name]),c=I(o.schema)==="enum"&&u!==null&&u!==""?V(String(u)):null;return n.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full border py-0.5 pl-2 pr-1 text-[0.6875rem] leading-none ${c?`chip-tinted tint-${c}`:"border-border bg-bg-soft/60"}`,children:[c?n.jsx("span",{"aria-hidden":"true",className:"tint-dot"}):null,n.jsx("span",{className:"text-fg-dim",children:o.name}),n.jsx(Z,{field:o.name,schema:o.schema,value:u,disabled:i,includeClear:!0,onCommit:x=>void r(o.name,x)})]},o.name)})})}function It(e,t){var a;const s=(a=e.metadata)==null?void 0:a[t];if(s==null)return null;if(typeof s=="string"){const r=s.trim();return r===""?null:r}return typeof s=="number"||typeof s=="boolean"?String(s):null}const qt={status:["active","incubating","dormant","paused","archived","done","shipped","dropped"],priority:["high","medium","low"]};function zt(e,t){var a;const s=(a=t==null?void 0:t[e])==null?void 0:a.enum;return s&&s.length>0?s:qt[e]??[]}function Gt(e,t,s=[]){var p;const a=new Map,r=new Map,i=[];for(const x of e){const d=It(x,t);if(d===null){i.push(x);continue}const h=a.get(d);h?h.push(x):(a.set(d,[x]),r.set(d,(p=x.metadata)==null?void 0:p[t]))}const l=s.filter(x=>a.has(x)),o=new Set(l),u=[...a.keys()].filter(x=>!o.has(x)).sort((x,d)=>x.localeCompare(d)),c=[...l,...u].map(x=>({key:x,label:x,notes:a.get(x)??[],uncategorized:!1,value:r.get(x)}));return i.length>0&&c.push({key:"",label:`No ${t}`,notes:i,uncategorized:!0,value:null}),c}function Ut(e){if(typeof e!="string")return null;const t=e.trim();if(!t)return null;const s=t.match(/^(\d{4})-(\d{2})-(\d{2})/);if(s){const r=new Date(Number(s[1]),Number(s[2])-1,Number(s[3]));return Number.isNaN(r.getTime())?null:r}const a=new Date(t);return Number.isNaN(a.getTime())?null:a}function Yt(e,t){var i;const s=new Map,a=[],r=new Map;for(const l of e){const o=Ut((i=l.metadata)==null?void 0:i[t]);if(!o){a.push(l);continue}r.set(l.id,o);const u=B(o),c=s.get(u);c?c.push(l):s.set(u,[l])}return{byDay:s,undated:a,dates:r}}function Qt(e){const t=new Map,s=[],a=new Map;for(const r of e){const i=r.createdAt?new Date(r.createdAt):null;if(!i||Number.isNaN(i.getTime())){s.push(r);continue}a.set(r.id,i);const l=B(i),o=t.get(l);o?o.push(r):t.set(l,[r])}return{byDay:t,undated:s,dates:a}}function ge(e,t=new Date){let s=null;for(const r of e)(!s||r.getTime()>s.getTime())&&(s=r);const a=s??t;return{year:a.getFullYear(),month:a.getMonth()+1}}function Ht({notes:e,laneBy:t,subjectTag:s,roles:a,viewResultsKey:r,fields:i=[]}){const l=O(s??null),o=g.useMemo(()=>{var y,f,b,v;const c=Gt(e,t,zt(t,(y=l.data)==null?void 0:y.fields)),p=((v=(b=(f=l.data)==null?void 0:f.fields)==null?void 0:b[t])==null?void 0:v.enum)??[];if(p.length===0)return c;const x=new Map(c.filter(m=>!m.uncategorized).map(m=>[m.key,m])),d=p.map(m=>x.get(m)??{key:m,label:m,notes:[],uncategorized:!1,value:m}),h=new Set(p),j=c.filter(m=>m.uncategorized||!h.has(m.key));return[...d,...j]},[e,t,l.data]),u=$e();return n.jsx("div",{className:"overflow-x-auto pb-2",children:n.jsx("div",{className:"flex items-start gap-4",children:o.map(c=>n.jsx(Wt,{lane:c,dropRegistry:u,children:c.notes.map(p=>n.jsx(Xt,{note:p,laneBy:t,lanes:o,currentLane:c,roles:a,viewResultsKey:r,fields:i,dropRegistry:u},p.id))},c.uncategorized?"__uncategorized__":c.key))})})}function Wt({lane:e,dropRegistry:t,children:s}){const a=g.useCallback(l=>t.dispatch(l,e),[t,e]),{isOver:r,targetProps:i}=Te(a);return n.jsxs("section",{"aria-label":e.label,className:`flex w-72 shrink-0 flex-col gap-2 rounded-2xl border border-border-light bg-bg-soft p-2 ${r?"outline-2 outline-offset-2 outline-accent/50":""}`,...i,children:[n.jsxs("header",{className:"flex items-baseline justify-between gap-2 px-1.5 pt-1",children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[e.uncategorized?null:n.jsx("span",{"aria-hidden":"true",className:`tint-dot tint-${V(e.key)}`}),n.jsx("span",{className:`min-w-0 truncate text-sm font-semibold ${e.uncategorized?"text-fg-dim":"text-fg"}`,children:e.label})]}),n.jsx("span",{className:"shrink-0 rounded-full bg-bg px-2 text-xs tabular-nums text-fg-dim",children:e.notes.length})]}),n.jsx("div",{className:"flex flex-col gap-2",children:e.notes.length===0?n.jsx("p",{className:"py-4 text-center text-xs italic text-fg-dim",children:tt()?"Drop here":"No notes"}):s})]})}function ye(e,t){return e.uncategorized||t.uncategorized?e.uncategorized&&t.uncategorized:e.key===t.key}const Jt="focus-ring rounded-full border border-border bg-bg-soft/90 px-2 py-0.5 text-[0.6875rem] font-medium text-fg-dim backdrop-blur transition-colors hover:text-accent disabled:opacity-50";function Xt({note:e,laneBy:t,lanes:s,currentLane:a,roles:r,viewResultsKey:i,fields:l,dropRegistry:o}){const{write:u,isPending:c}=z(e,i),p=g.useMemo(()=>s.filter(f=>!ye(f,a)),[s,a]),x=g.useMemo(()=>p.map(f=>({value:f.value,label:f.label,muted:f.uncategorized})),[p]),d=g.useCallback(async(f,b)=>{await u(t,f,{valueLabel:b,errorPrefix:`Couldn't move "${C(e).text}"`})},[u,t,e]),h=async f=>{const b=x.find(v=>v.value===f);await d(f,b==null?void 0:b.label)},j=Ee(e.id),y=g.useCallback(f=>{c||ye(f,a)||d(f.value,f.label)},[c,a,d]);return g.useEffect(()=>o.register(e.id,y),[o,e.id,y]),n.jsx(q,{note:e,pinnedTag:r.pinned,archivedTag:r.archived,drag:j,overlay:p.length>0?n.jsx(Z,{field:t,value:a.value,options:x,disabled:c,onCommit:f=>void h(f),trigger:{label:"Move",ariaLabel:`Move to another ${t}`,className:Jt}}):null,footer:l.length>0?n.jsx(P,{note:e,fields:l,viewResultsKey:i,omit:p.length>0?[t]:void 0}):null})}const Kt=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],H=2;function Zt({notes:e,dateField:t,roles:s,viewResultsKey:a,fields:r=[]}){const i=g.useMemo(()=>t===null?Qt(e):Yt(e,t),[e,t]),[l,o]=g.useState(()=>ge(i.dates.values())),[u,c]=g.useState(null),p=g.useMemo(()=>nt(l.year,l.month),[l]),x=B(),d=$e();if(i.byDay.size===0)return n.jsxs("div",{className:"space-y-4",children:[n.jsx(F,{title:"Nothing on the calendar yet",description:t===null?void 0:`Give a note a ${t} date below and it lands on the grid.`}),t===null?null:n.jsx(je,{notes:i.undated,dateField:t,roles:s,viewResultsKey:a,fields:r})]});const h=y=>{c(null),o(y)},j=u?i.byDay.get(u)??[]:[];return n.jsxs("div",{className:"space-y-3",children:[n.jsxs("header",{className:"flex flex-wrap items-baseline justify-between gap-3",children:[n.jsx("h2",{className:"font-serif text-2xl tracking-tight text-fg",children:st(l.year,l.month)}),n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[n.jsx("button",{type:"button",onClick:()=>h(xe(l.year,l.month,-1)),className:"chip","aria-label":"Previous month",children:"← Prev"}),n.jsx("button",{type:"button",onClick:()=>h(ge(i.dates.values())),className:"chip",children:"Latest"}),n.jsx("button",{type:"button",onClick:()=>h(xe(l.year,l.month,1)),className:"chip","aria-label":"Next month",children:"Next →"})]})]}),n.jsxs("div",{className:"overflow-hidden rounded-md border border-border bg-card",children:[n.jsx("div",{className:"grid grid-cols-7 border-b border-border bg-bg-soft text-2xs uppercase tracking-wider text-fg-dim",children:Kt.map(y=>n.jsx("div",{className:"px-2 py-2 text-center",children:y},y))}),n.jsx("div",{className:"grid grid-cols-7",children:p.map(y=>{const f=B(y),b=y.getMonth()+1===l.month,v=i.byDay.get(f)??[],m=f===x,N=f===u;return n.jsx(en,{dayKey:f,dayNumber:y.getDate(),inMonth:b,isToday:m,isSelected:N,notes:v,onSelect:()=>c(f),dateField:t,viewResultsKey:a,dropRegistry:d},f)})})]}),u&&j.length>0?n.jsxs("section",{"aria-label":`Notes on ${X(u)}`,className:"space-y-2",children:[n.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[n.jsx("p",{className:"eyebrow",children:X(u)}),n.jsx("button",{type:"button",onClick:()=>c(null),className:"text-xs text-fg-dim hover:text-accent focus-ring rounded",children:"Clear"})]}),n.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(min(100%,16rem),1fr))] gap-2",children:j.map(y=>n.jsx(q,{note:y,pinnedTag:s.pinned,archivedTag:s.archived,footer:r.length>0?n.jsx(P,{note:y,fields:r,viewResultsKey:a}):null},y.id))})]}):null,t===null?n.jsx("p",{className:"text-xs text-fg-dim",children:"Showing by created date — set a date field to schedule."}):n.jsx(je,{notes:i.undated,dateField:t,roles:s,viewResultsKey:a,fields:r})]})}function en({dayKey:e,dayNumber:t,inMonth:s,isToday:a,isSelected:r,notes:i,onSelect:l,dateField:o,viewResultsKey:u,dropRegistry:c}){const p=i.length>0,x=o!==null,d=g.useCallback(m=>c.dispatch(m,e),[c,e]),{isOver:h,targetProps:j}=Te(d),y=x&&s?j:{},f=n.jsx("span",{className:`mb-1 inline-flex h-6 w-6 items-center justify-center rounded-full font-serif tabular-nums ${a?"bg-accent text-(--color-on-accent)":"text-fg"}`,children:t}),b=n.jsxs("span",{className:"flex flex-col gap-0.5",children:[i.slice(0,H).map(m=>o===null?n.jsx(tn,{note:m},m.id):n.jsx(nn,{note:m,dayKey:e,dateField:o,viewResultsKey:u,dropRegistry:c},m.id)),i.length>H?n.jsxs("span",{className:"text-[10px] text-fg-dim",children:["+",i.length-H," more"]}):null]}),v=`flex min-h-24 flex-col border-b border-r border-border p-1.5 text-left text-xs ${s?"":"opacity-40"} ${r?"bg-accent/5":""} ${x&&s&&h?"bg-accent/5 outline-2 -outline-offset-2 outline-accent/60":""}`;return p?n.jsxs("button",{type:"button",onClick:l,"aria-label":`${X(e)} — ${i.length} notes`,className:`${v} hover:bg-bg/60 focus:bg-bg/60 focus:outline-none`,"data-day":e,...y,children:[f,b]}):n.jsxs("div",{className:v,"data-day":e,...y,children:[f,n.jsx("span",{className:"sr-only",children:"no notes"})]})}const K="truncate rounded-md border border-border bg-card px-1.5 py-0.5 text-[10px] leading-tight text-fg shadow-sm";function tn({note:e}){return n.jsx("span",{"data-note-id":e.id,className:K,children:C(e).text})}function nn({note:e,dayKey:t,dateField:s,viewResultsKey:a,dropRegistry:r}){const{write:i,isPending:l}=z(e,a),o=Ee(e.id),u=g.useCallback(c=>{l||c===t||i(s,c,{errorPrefix:`Couldn't move "${C(e).text}"`})},[l,t,s,i,e]);return g.useEffect(()=>r.register(e.id,u),[r,e.id,u]),n.jsx("span",{"data-note-id":e.id,className:o.canDrag?`${K} cursor-grab`:K,...o.sourceProps,children:C(e).text})}function je({notes:e,dateField:t,roles:s,viewResultsKey:a,fields:r}){if(e.length===0)return null;const i=r.find(o=>o.name===t)??{name:t,schema:{type:"date"}},l=/date/i.test(t)?t:`${t} date`;return n.jsxs("section",{"aria-label":`Not on the calendar — no ${l}`,className:"space-y-2",children:[n.jsx("p",{className:"eyebrow",children:"Not on the calendar yet"}),n.jsxs("p",{className:"text-xs text-fg-dim",children:[e.length," ",e.length===1?"note has":"notes have"," no ",l," — set one to place ",e.length===1?"it":"them","."]}),n.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(min(100%,16rem),1fr))] gap-2",children:e.map(o=>n.jsx(q,{note:o,pinnedTag:s.pinned,archivedTag:s.archived,footer:n.jsx(P,{note:o,fields:[i],viewResultsKey:a})},o.id))})]})}const sn="border-[color-mix(in_srgb,var(--color-accent)_40%,var(--color-border))]";function Ve({label:e,value:t,icon:s,ariaLabel:a,haspopup:r="menu",open:i,dirty:l=!1,onClick:o}){return n.jsxs("button",{type:"button","aria-haspopup":r,"aria-expanded":i,"aria-label":a,onClick:o,className:`focus-ring inline-flex min-h-8 items-center gap-1.5 rounded-full border bg-card px-3 py-1 transition-colors duration-(--dur-quick) ease-out hover:border-accent/50 ${l?sn:"border-border"}`,children:[s?n.jsx("span",{"aria-hidden":"true",className:"flex-none text-fg-muted",children:s}):null,e?n.jsx("span",{className:"text-2xs uppercase tracking-[0.08em] text-fg-dim",children:e}):null,n.jsx("span",{className:"text-xs font-medium text-fg",children:t}),n.jsx("span",{"aria-hidden":"true",className:"text-2xs text-fg-dim",children:"▾"})]})}function ee({label:e,value:t,icon:s,ariaLabel:a,menuLabel:r,options:i,sections:l,current:o,onSelect:u,note:c,actions:p,busy:x=!1,dirty:d=!1}){const[h,j]=g.useState(!1);g.useEffect(()=>{if(!h)return;const m=N=>{N.key==="Escape"&&j(!1)};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[h]);const y=m=>{j(!1),u(m)},f=m=>{j(!1),m.onSelect()},b=m=>{const N=m.value===o;return n.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":N,onClick:()=>y(m.value),className:`focus-ring flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left text-sm hover:bg-bg-soft ${N?"text-fg":"text-fg-muted"}`,children:[m.glyph?n.jsx("span",{"aria-hidden":"true",className:"flex-none",children:m.glyph}):null,n.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[n.jsx("span",{className:m.hint?"shrink-0":"min-w-0 shrink truncate",children:m.label??m.value}),m.hint?n.jsx("span",{"aria-hidden":"true",className:"min-w-0 shrink truncate text-2xs text-fg-dim",children:m.hint}):null]}),N?n.jsx("span",{"aria-hidden":"true",className:"text-accent",children:"✓"}):null]},m.value)},v=l?l.reduce((m,N)=>m+N.options.length,0):(i==null?void 0:i.length)??0;return n.jsxs("div",{className:"relative",children:[n.jsx(Ve,{label:e,value:t,icon:s,ariaLabel:a,open:h,dirty:d,onClick:()=>j(m=>!m)}),h?n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button","aria-hidden":"true",tabIndex:-1,onClick:()=>j(!1),className:"enter-fade fixed inset-0 z-30 cursor-default bg-black/40 sm:bg-transparent"}),n.jsxs("div",{role:"menu","aria-label":r,className:"card enter-rise fixed inset-x-0 bottom-0 z-40 max-h-[70dvh] overflow-y-auto rounded-b-none p-1.5 pb-[calc(0.375rem+env(safe-area-inset-bottom))] shadow-lift sm:absolute sm:top-full sm:right-auto sm:bottom-auto sm:mt-1 sm:max-h-80 sm:w-56 sm:rounded-b-[var(--radius-2xl)] sm:pb-1.5",children:[n.jsx("p",{"aria-hidden":"true",className:"eyebrow px-2 pt-1.5 pb-1",children:r}),l?l.map((m,N)=>n.jsxs("div",{className:N>0?"mt-1 border-t border-border-light pt-1":void 0,children:[m.heading?n.jsx("p",{"aria-hidden":"true",className:"px-2 pt-1 pb-0.5 text-2xs uppercase tracking-[0.08em] text-fg-dim",children:m.heading}):null,m.options.map(b)]},m.heading??N)):i==null?void 0:i.map(b),c?n.jsx("p",{className:"px-2 pt-1.5 pb-1 text-xs text-fg-dim",children:c}):null,p&&p.length>0?n.jsx("div",{className:v>0?"mt-1 border-t border-border-light pt-1":void 0,children:p.map(m=>n.jsxs("button",{type:"button",role:"menuitem",disabled:x,onClick:()=>f(m),className:"focus-ring flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left text-sm text-fg-muted hover:bg-bg-soft disabled:opacity-50",children:[m.glyph?n.jsx("span",{"aria-hidden":"true",className:"flex-none",children:m.glyph}):null,n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-fg",children:m.label}),m.hint?n.jsx("span",{className:"block truncate text-2xs text-fg-dim",children:m.hint}):null]})]},m.key))}):null]})]}):null]})}function ve(e){switch(I(e)){case"enum":case"boolean":return"●";case"date":return"📅";case"number":return"#";default:return"Aa"}}function an({fields:e,schemaFields:t,onChange:s,dirty:a=!1}){const[r,i]=g.useState(!1);g.useEffect(()=>{if(!r)return;const d=h=>{h.key==="Escape"&&i(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[r]);const l=e.map(d=>d.name),o=Object.keys(t).filter(d=>!l.includes(d));if(l.length===0&&o.length===0)return null;const u=l.length===1,c=d=>{u||s(l.filter(h=>h!==d))},p=d=>s([...l,d]),x=(d,h)=>{const j=[...l],[y]=j.splice(d,1);j.splice(d+h,0,y),s(j)};return n.jsxs("div",{className:"relative",children:[n.jsx(Ve,{label:"Fields",value:String(l.length),haspopup:"dialog",open:r,dirty:a,onClick:()=>i(d=>!d)}),r?n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button","aria-hidden":"true",tabIndex:-1,onClick:()=>i(!1),className:"enter-fade fixed inset-0 z-30 cursor-default bg-black/40 sm:bg-transparent"}),n.jsxs("div",{role:"dialog","aria-label":"Fields",className:"card enter-rise fixed inset-x-0 bottom-0 z-40 max-h-[70dvh] overflow-y-auto rounded-b-none p-1.5 pb-[calc(0.375rem+env(safe-area-inset-bottom))] shadow-lift sm:absolute sm:top-full sm:right-auto sm:bottom-auto sm:mt-1 sm:max-h-80 sm:w-60 sm:rounded-b-[var(--radius-2xl)] sm:pb-1.5",children:[n.jsx("p",{className:"eyebrow px-2 pt-1.5 pb-1",children:"Fields"}),n.jsxs("ul",{className:"flex flex-col gap-0.5",children:[e.map((d,h)=>n.jsxs("li",{className:"flex items-center gap-1 rounded-lg px-2 py-1 hover:bg-bg-soft",children:[n.jsxs("label",{className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 text-sm text-fg",children:[n.jsx("input",{type:"checkbox",checked:!0,disabled:u,onChange:()=>c(d.name)}),n.jsx("span",{"aria-hidden":"true",className:"w-4 flex-none text-center text-2xs text-fg-dim",children:ve(d.schema)}),n.jsx("span",{className:"truncate",children:d.name})]}),n.jsx("button",{type:"button","aria-label":`Move ${d.name} up`,disabled:h===0,onClick:()=>x(h,-1),className:"focus-ring rounded px-1.5 py-0.5 text-sm text-fg-muted hover:bg-bg-soft hover:text-fg disabled:opacity-30",children:"↑"}),n.jsx("button",{type:"button","aria-label":`Move ${d.name} down`,disabled:h===l.length-1,onClick:()=>x(h,1),className:"focus-ring rounded px-1.5 py-0.5 text-sm text-fg-muted hover:bg-bg-soft hover:text-fg disabled:opacity-30",children:"↓"})]},d.name)),o.map(d=>n.jsx("li",{className:"flex items-center gap-1 rounded-lg px-2 py-1 hover:bg-bg-soft",children:n.jsxs("label",{className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 text-sm text-fg-muted",children:[n.jsx("input",{type:"checkbox",checked:!1,onChange:()=>p(d)}),n.jsx("span",{"aria-hidden":"true",className:"w-4 flex-none text-center text-2xs text-fg-dim",children:ve(t[d])}),n.jsx("span",{className:"truncate",children:d})]})},d))]}),u?n.jsx("p",{className:"px-2 pt-1.5 pb-1 text-xs text-fg-dim",children:"Views show at least one field."}):null]})]}):null]})}function rn({notes:e,roles:t,viewResultsKey:s,fields:a=[]}){return n.jsx("div",{"aria-label":"Gallery",className:"grid grid-cols-[repeat(auto-fill,minmax(min(100%,13rem),1fr))] gap-4",children:e.map(r=>n.jsx(q,{note:r,variant:"gallery",pinnedTag:t.pinned,archivedTag:t.archived,footer:a.length>0?n.jsx(P,{note:r,fields:a,viewResultsKey:s}):null},r.id))})}const W={list:"List",board:"Board",calendar:"Calendar",gallery:"Gallery",table:"Table"};function Ne({kind:e}){switch(e){case"board":return n.jsx(ot,{width:14,height:14});case"calendar":return n.jsx(lt,{width:14,height:14});case"gallery":return n.jsx(it,{width:14,height:14});case"table":return n.jsx(rt,{width:14,height:14});default:return n.jsx(at,{width:14,height:14})}}function ln({kind:e,onSwitch:t,dirty:s=!1}){return n.jsx(ee,{ariaLabel:`Lens: ${W[e]}`,menuLabel:"Lens",icon:n.jsx(Ne,{kind:e}),value:W[e],options:De.map(a=>({value:a,label:W[a],glyph:n.jsx(Ne,{kind:a})})),current:e,onSelect:t,dirty:s})}function on(e,t,s){const a=e.filter(s).map(r=>r.name);return t&&!a.includes(t)&&a.unshift(t),a}const cn="This view isn't scoped to one tag, so there's no schema to add a field to — add a single tag to the query, or open a tag's view.";function Re(e,t,s){return[{key:"__add_field__",label:e,hint:t,onSelect:s}]}const we="Date fields plot on the Calendar lens (By date) — not offered here.";function J(e,t){return{value:e,hint:t,glyph:n.jsx("span",{className:`tint-dot tint-${V(e)}`})}}function dn(e){const t=[],s=[],a=[];for(const r of e){const i=I(r.schema);i==="date"?a.push(r):i==="enum"?t.push(r):s.push(r)}return{valueBearing:t,other:s,dateFields:a}}function un(e){return(e.enum??[]).join(" · ")}function mn(e,t,s,a,r){if(e)return t>0?we:void 0;if(!s)return cn;if(r)return`#${s} has no fields yet — add one to give this board its columns:`;if(!a)return we}function xn({value:e,fields:t,onChange:s,dirty:a=!1,createTag:r=null,schemaReady:i=!0,onAddField:l}){const{valueBearing:o,other:u,dateFields:c}=dn(t),p=new Set([...o,...u].map(f=>f.name)),x=e!==void 0&&!p.has(e)?e:void 0,d=[];x!==void 0&&d.push({options:[J(x)]}),o.length>0&&d.push({heading:"Fields with values",options:o.map(f=>J(f.name,un(f.schema)))}),u.length>0&&d.push({heading:"Other fields · one column per value",options:u.map(f=>J(f.name))});const h=d.length>0,j=t.length===0,y=j&&!!r&&i&&!!l;return n.jsx(ee,{label:"Group by",menuLabel:"Group by",value:e??"—",sections:d,current:e,onSelect:s,note:mn(h,c.length,r,j,y),actions:y?Re("Add a field to group by…","You name it; give it values to get columns.",l):void 0,dirty:a})}function pn({value:e,fields:t,onChange:s,dirty:a=!1,createTag:r=null,schemaReady:i=!0,onAddField:l}){const o=on(t,e,c=>c.schema.type==="date"),u=o.length===0&&!!r&&i&&!!l;return n.jsx(ee,{label:"By date",menuLabel:"By date",value:e??"created",options:o.map(c=>({value:c})),current:e,onSelect:s,note:o.length===0&&u?`Showing by created date. #${r} has no date field — add one to plot and drag by it:`:e===void 0?"Showing by created date":void 0,actions:u?Re("Add a date field…","You name it; it holds a date on each note.",l):void 0,dirty:a})}function hn({notes:e,roles:t,viewResultsKey:s,fields:a=[]}){return n.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card shadow-sm",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full min-w-[36rem] border-collapse text-sm",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"border-b border-border text-left",children:[n.jsx("th",{scope:"col",className:"sticky left-0 z-[1] bg-bg-soft px-3 py-2 text-2xs font-semibold uppercase tracking-[0.08em] text-fg-dim",children:"Note"}),a.map(r=>n.jsx("th",{scope:"col",className:`whitespace-nowrap bg-bg-soft px-3 py-2 text-2xs font-semibold uppercase tracking-[0.08em] text-fg-dim ${r.schema.type==="number"?"text-right":""}`,children:r.name},r.name))]})}),n.jsx("tbody",{children:e.map(r=>n.jsx(fn,{note:r,fields:a,roles:t,viewResultsKey:s},r.id))})]})})})}function fn({note:e,fields:t,roles:s,viewResultsKey:a}){const{write:r,isPending:i}=z(e,a),l=C(e),o=(e.tags??[]).includes(s.pinned),u=(e.tags??[]).includes(s.archived);return n.jsxs("tr",{"data-note-id":e.id,className:`group border-b border-border-light last:border-b-0 hover:bg-bg-soft/60 ${u?"opacity-60 italic":""}`,children:[n.jsx("th",{scope:"row",className:"group-hover:after:opacity-100 sticky left-0 z-[1] bg-card px-3 py-1.5 text-left font-normal after:pointer-events-none after:absolute after:inset-0 after:-z-10 after:bg-bg-soft/60 after:opacity-0",children:n.jsxs(R,{to:`/n/${encodeURIComponent(e.id)}`,className:"focus-ring inline-flex max-w-[16rem] items-baseline gap-1.5 hover:text-accent",children:[o?n.jsx("span",{className:"shrink-0 text-accent","aria-label":"pinned",title:"pinned",children:"★"}):null,n.jsx("span",{className:l.kind==="timestamp"?"min-w-0 truncate title-timestamp":"min-w-0 truncate font-medium text-fg",children:l.text})]})}),t.map(c=>{var p;return n.jsx("td",{className:`px-3 py-1 align-middle ${c.schema.type==="number"?"text-right":""}`,children:n.jsx(Z,{field:c.name,schema:c.schema,value:Fe((p=e.metadata)==null?void 0:p[c.name]),disabled:i,includeClear:!0,onCommit:x=>void r(c.name,x)})},c.name)})]})}function Oe(e){return e.kind!==void 0||e.groupBy!==void 0||e.dateField!==void 0||e.fields!==void 0}function bn(e){const t=new URLSearchParams;return e.kind&&t.set("kind",e.kind),e.groupBy&&t.set("group",e.groupBy),e.dateField&&t.set("date",e.dateField),e.fields&&e.fields.length>0&&t.set("fields",e.fields.join(",")),t}function gn(e){const t={},s=e.get("kind");s&&De.includes(s)&&(t.kind=s);const a=e.get("group");a&&(t.groupBy=a);const r=e.get("date");r&&(t.dateField=r);const i=e.get("fields");if(i){const l=i.split(",").map(o=>o.trim()).filter(Boolean);l.length>0&&(t.fields=l)}return t}function te(e,t){return Oe(t)?{...e,kind:t.kind??e.kind,groupBy:t.groupBy??e.groupBy,dateField:t.dateField??e.dateField,fields:t.fields??e.fields}:e}function yn(e,t){return e===void 0||t===void 0?e===t:e.length===t.length&&e.every((s,a)=>s===t[a])}function ke(e,t){const s={};return t.kind!==void 0&&t.kind!==e.kind&&(s.kind=t.kind),t.groupBy!==void 0&&t.groupBy!==e.groupBy&&(s.groupBy=t.groupBy),t.dateField!==void 0&&t.dateField!==e.dateField&&(s.dateField=t.dateField),t.fields!==void 0&&!yn(t.fields,e.fields)&&(s.fields=t.fields),s}function jn(e){var t;return(t=e.find(s=>{var a;return(((a=s.schema.enum)==null?void 0:a.length)??0)>0}))==null?void 0:t.name}function vn(e){var t;return(t=e.find(s=>s.schema.type==="date"))==null?void 0:t.name}function Nn(e,t,s,a){const r={...t,kind:s};if(s==="board"){if(!(t.groupBy??e.groupBy)){const i=jn(a);i&&(r.groupBy=i)}}else e.groupBy===void 0&&(r.groupBy=void 0);if(s==="calendar"){if(!(t.dateField??e.dateField)){const i=vn(a);i&&(r.dateField=i)}}else e.dateField===void 0&&(r.dateField=void 0);return r}function wn(e,t,s){const r={kind:te(e,t).kind};return s!==null&&(r.query=JSON.stringify(s)),t.groupBy!==void 0&&(r.group_by=t.groupBy),t.dateField!==void 0&&(r.date_field=t.dateField),t.fields!==void 0&&(r.fields=JSON.stringify(t.fields)),r}function kn(e,t){const s={kind:e.kind};return t!==null&&(s.query=JSON.stringify(t)),e.groupBy!==void 0&&(s.group_by=e.groupBy),e.dateField!==void 0&&(s.date_field=e.dateField),e.fields!==void 0&&(s.fields=JSON.stringify(e.fields)),s}const Sn={type:"string"};function M(e){const t=Pe(e);return t.length===1?t[0]:null}function Cn(e,t){return e.fields&&e.fields.length>0?e.fields.map(a=>({name:a,schema:(t==null?void 0:t[a])??Sn})):M(e.query)&&t?Object.entries(t).map(([a,r])=>({name:a,schema:r})):[]}function $n(e){const t=e?M(e.query):null,s=O(t);return g.useMemo(()=>e?Cn(e,Ie(s.data)):[],[e,s.data])}function Ie(e){return(e==null?void 0:e.fields)??null}function Tn(e){const t=e?M(e.query):null,s=O(t);return g.useMemo(()=>Ie(s.data)??{},[s.data])}function En(e){const t=e?M(e.query):null,s=O(t);return t?s.isSuccess:!0}function Dn(e,t,s=[]){if(s.includes(t))return{pinned:[],rest:e};const a=[],r=[];for(const i of e)(i.tags??[]).includes(t)?a.push(i):r.push(i);return{pinned:a,rest:r}}function qe(){return n.jsx("nav",{className:"mb-6 text-sm text-fg-dim",children:n.jsx(R,{to:"/notes",className:"focus-ring hover:text-accent",children:"← All notes"})})}function Wn(){const{id:e}=xt(),t=Me(a=>a.getActiveVault()),s=pt(e);return t?s.data?n.jsx(Mn,{note:s.data}):n.jsxs("div",{className:"page",children:[n.jsx(qe,{}),s.isPending?n.jsx(Pn,{}):s.isError?n.jsx(_e,{title:"Couldn't load this view",message:s.error instanceof Error?s.error.message:void 0,retry:()=>s.refetch()}):n.jsx(F,{title:"View not found",description:"It may have been deleted or moved."})]}):n.jsx(ht,{to:"/",replace:!0})}function Pn(){return n.jsxs("div",{className:"space-y-4","aria-busy":"true",children:[n.jsx(k,{height:32,width:"40%"}),n.jsx(k,{height:20,width:"60%"}),n.jsxs("div",{className:"space-y-2 pt-4",children:[n.jsx(k,{height:56}),n.jsx(k,{height:56}),n.jsx(k,{height:56})]})]})}function Mn({note:e}){const t=g.useMemo(()=>Nt(e),[e]);return n.jsx(_n,{def:t,backingNote:e,nav:n.jsx(qe,{})})}function _n({def:e,backingNote:t,pageSize:s,total:a,nav:r}){var de;const i=Me(w=>w.getActiveVault()),{roles:l}=ct((i==null?void 0:i.id)??null),o=typeof s=="number"&&s>0,[u,c]=g.useState(0),[p,x]=dt(),d=g.useMemo(()=>ut(p),[p]),h=g.useMemo(()=>ke(e,gn(p)),[e,p]),j=(w,E)=>{const $=bn(w);for(const[L,A]of wt(E))$.append(L,A);x($,{replace:!0})},y=w=>j(h,w),f=w=>{j(ke(e,w),d)},b=g.useMemo(()=>te(e,h),[e,h]),v=g.useMemo(()=>JSON.stringify({q:b.query,r:d}),[b.query,d]);g.useEffect(()=>{c(0)},[v]);const m=g.useMemo(()=>!o||!b.query?b:{...b,query:{...b.query,offset:u,limit:s+1}},[o,b,u,s]),N=mt(m,d,{live:!o}),S=g.useMemo(()=>o&&N.data?N.data.slice(0,s):N.data,[o,N.data,s]),ne=(S==null?void 0:S.length)??0,se=o?(((de=N.data)==null?void 0:de.length)??0)>s:!1,ze=pe(d),Ge=o&&!se?u+ne:void 0,Ue=ze?void 0:a,T=$n(b),Ye=Tn(b),ae=[...b.problems,...N.problems],re=g.useMemo(()=>S?Dn(S,l.pinned,Pe(b.query)):{pinned:[],rest:[]},[S,l.pinned,b.query]),Qe=t!==null,ie=(Oe(h)||pe(d))&&Qe,[He,le]=g.useState(!1),oe=()=>x(new URLSearchParams,{replace:!0}),_=g.useMemo(()=>M(b.query),[b.query]),ce=En(b),[G,U]=g.useState(null),We=w=>{var A,ue;const E=G;if(!E)return;const $=Object.entries(w),L=E==="date"?(A=$.find(([,D])=>D.type==="date"))==null?void 0:A[0]:(ue=$.find(([,D])=>{var me;return(((me=D.enum)==null?void 0:me.length)??0)>0})??$.find(([,D])=>D.type!=="date"))==null?void 0:ue[0];L&&f({...h,[E==="group"?"groupBy":"dateField"]:L})},Je=b.kind==="board"||b.kind==="table";return n.jsxs("div",{className:Je?"page page-wide":"page",children:[r,n.jsxs("article",{className:ie?"pb-20":void 0,children:[n.jsx(An,{def:b,backingNote:t,count:Ue}),n.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-x-2 gap-y-2 py-1",children:[n.jsx(ln,{kind:b.kind,onSwitch:w=>f(Nn(e,h,w,T)),dirty:e.kind!==b.kind}),b.kind==="board"?n.jsx(xn,{value:b.groupBy,fields:T,onChange:w=>f({...h,groupBy:w}),dirty:e.groupBy!==b.groupBy,createTag:_,schemaReady:ce,onAddField:()=>U("group")}):null,b.kind==="calendar"?n.jsx(pn,{value:b.dateField,fields:T,onChange:w=>f({...h,dateField:w}),dirty:e.dateField!==b.dateField,createTag:_,schemaReady:ce,onAddField:()=>U("date")}):null,n.jsx(an,{fields:T,schemaFields:Ye,onChange:w=>f({...h,fields:w}),dirty:e.fields!==b.fields})]}),n.jsx(On,{def:e,refinements:d,onChange:y}),ae.length>0?n.jsx(Fn,{problems:ae}):null,n.jsx("div",{className:"mt-6",children:n.jsx(Vn,{def:b,data:S,isPending:N.isPending,isError:N.isError,error:N.error,retry:N.refetch,viewResultsKey:N.queryKey,fields:T,pinned:re.pinned,rest:re.rest,roles:l})}),o?n.jsx(Bn,{offset:u,shown:ne,total:Ge,hasPrev:u>0,hasNext:se,onPrev:()=>c(w=>Math.max(0,w-s)),onNext:()=>c(w=>w+s)}):null,ie?n.jsx(Ln,{onSave:()=>le(!0),onRevert:oe}):null,He&&t?n.jsx(Un,{note:t,def:e,draft:h,refinements:d,roles:l,onClose:()=>le(!1),onSaved:oe}):null,G&&_?n.jsx(Ct,{tagName:_,intent:G,onSaved:We,onClose:()=>U(null)}):null]})]})}function Ln({onSave:e,onRevert:t}){const s=gt(a=>a.setShown);return g.useEffect(()=>(s(!0),()=>s(!1)),[s]),n.jsx("div",{"aria-label":"View modified",className:"glass-panel fixed inset-x-0 bottom-[calc(3.5rem+env(safe-area-inset-bottom))] z-20 border-t border-border lg:bottom-0 lg:pb-[env(safe-area-inset-bottom)]",children:n.jsxs("div",{className:"mx-auto flex w-full max-w-(--w-page) items-center justify-between gap-3 px-5 py-2.5 md:px-10",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[n.jsx("span",{"aria-hidden":"true",className:"view-modified-pulse h-2 w-2 shrink-0 rounded-full bg-accent"}),n.jsxs("p",{className:"min-w-0 text-sm text-fg-muted",children:[n.jsx("span",{className:"font-medium text-fg",children:"View modified"})," — you're exploring. Save to keep this layout."]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{type:"button",onClick:t,className:"btn btn-secondary btn-touch",children:"Revert"}),n.jsx("button",{type:"button",onClick:e,className:"btn btn-primary btn-touch",children:"Save"})]})]})})}function An({def:e,backingNote:t,count:s}){return n.jsxs("header",{className:"mb-4 flex flex-wrap items-center justify-between gap-3 border-b border-border pb-5",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[n.jsx(ft,{kind:e.kind,hueTag:Le(e.query)}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("h1",{className:"page-title truncate",children:e.title}),typeof s=="number"?n.jsx("p",{className:"text-sm text-fg-dim",children:s===1?"1 note":`${s.toLocaleString()} notes`}):null]})]}),t?n.jsx(R,{to:`/n/${encodeURIComponent(t.id)}/edit`,className:"btn btn-secondary btn-touch",children:"Edit view note"}):null]})}function Bn({offset:e,shown:t,total:s,hasPrev:a,hasNext:r,onPrev:i,onNext:l}){const o=t>0?e+1:0,u=e+t;return!a&&!r?null:n.jsxs("div",{className:"mt-6 flex items-center justify-between text-fg-dim text-sm",children:[n.jsx("span",{children:t>0?typeof s=="number"?`Showing ${o}–${u} of ${s.toLocaleString()}`:`Showing ${o}–${u}`:""}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{type:"button",disabled:!a,onClick:i,className:"btn btn-secondary btn-touch",children:"Previous"}),n.jsx("button",{type:"button",disabled:!r,onClick:l,className:"btn btn-secondary btn-touch",children:"Next"})]})]})}function Fn({problems:e}){return n.jsx("output",{"aria-live":"polite",className:"mt-4 block rounded-lg border border-[--color-warning] bg-[--color-warning-soft] p-3 text-sm text-fg",children:n.jsx("ul",{className:"list-disc space-y-1 pl-5",children:e.map((t,s)=>n.jsx("li",{children:t.message},`${t.code}-${s}`))})})}function Vn({def:e,data:t,isPending:s,isError:a,error:r,retry:i,viewResultsKey:l,fields:o,pinned:u,rest:c,roles:p}){if(e.query===null)return n.jsx(F,{title:"Nothing is being shown",description:"Fix the view's query to see results."});if(s)return n.jsxs("div",{className:"space-y-2","aria-busy":"true",children:[n.jsx(k,{height:56}),n.jsx(k,{height:56}),n.jsx(k,{height:56})]});if(a)return n.jsx(_e,{title:"Couldn't run this view",message:r instanceof Error?r.message:void 0,retry:i});if(!t||u.length===0&&c.length===0)return n.jsx(F,{title:"No notes match this view yet."});const x=[...u,...c];switch(e.kind){case"board":if(e.groupBy)return n.jsx(Ht,{notes:x,laneBy:e.groupBy,subjectTag:Le(e.query),roles:p,viewResultsKey:l,fields:o});break;case"gallery":return n.jsx(rn,{notes:x,roles:p,viewResultsKey:l,fields:o});case"table":return n.jsx(hn,{notes:x,roles:p,viewResultsKey:l,fields:o});case"calendar":return n.jsx(Zt,{notes:x,dateField:e.dateField||null,roles:p,viewResultsKey:l,fields:o})}return n.jsx(Rn,{pinned:u,rest:c,roles:p,viewResultsKey:l,fields:o})}function Rn({pinned:e,rest:t,roles:s,viewResultsKey:a,fields:r}){const i=l=>r.length>0?n.jsx(P,{note:l,fields:r,viewResultsKey:a}):null;return n.jsxs("div",{className:"space-y-6",children:[e.length>0?n.jsxs("section",{"aria-label":"Pinned",children:[n.jsx("p",{className:"eyebrow mb-2",children:"Pinned"}),n.jsx(he,{"aria-label":"Pinned notes",children:e.map(l=>n.jsx(fe,{note:l,pinnedTag:s.pinned,archivedTag:s.archived,footer:i(l)},l.id))})]}):null,t.length>0?n.jsx("section",{"aria-label":"Results",children:n.jsx(he,{"aria-label":"View results",children:t.map(l=>n.jsx(fe,{note:l,pinnedTag:s.pinned,archivedTag:s.archived,footer:i(l)},l.id))})}):null]})}function On({def:e,refinements:t,onChange:s}){const a=g.useMemo(()=>bt(e.query),[e.query]),r=i=>{const l=t.removeExcludes.includes(i);s({...t,removeExcludes:l?t.removeExcludes.filter(o=>o!==i):[...t.removeExcludes,i]})};return n.jsxs("div",{className:"flex flex-wrap items-center gap-2 py-2",children:[a.map(i=>n.jsx(In,{chip:i,toggled:i.kind==="exclude"&&!!i.value&&t.removeExcludes.includes(i.value),onToggle:i.kind==="exclude"&&i.value?()=>r(i.value):void 0},`${i.kind}-${i.value??i.label}`)),t.addTags.map(i=>n.jsx(Y,{label:`+#${i}`,onRemove:()=>s({...t,addTags:t.addTags.filter(l=>l!==i)})},`add-${i}`)),t.search?n.jsx(Y,{label:`"${t.search}"`,onRemove:()=>s({...t,search:void 0})}):null,t.sort?n.jsx(Y,{label:`sorted by ${t.sort==="desc"?"newest":"oldest"}`,onRemove:()=>s({...t,sort:void 0})}):null,n.jsx(qn,{onAdd:i=>s({...t,addTags:[...t.addTags,i]})}),n.jsx(zn,{value:t.search??"",onChange:i=>s({...t,search:i||void 0})}),n.jsx(Gn,{value:t.sort,onChange:i=>s({...t,sort:i})})]})}function In({chip:e,toggled:t,onToggle:s}){return s?n.jsx("button",{type:"button",onClick:s,"aria-pressed":!t,title:t?"Excluded again — tap to peek":"Tap to peek at these too",className:`chip ${t?"opacity-50 line-through":""}`,children:e.label}):n.jsx("span",{className:"chip",children:e.label})}function qn({onAdd:e}){const[t,s]=g.useState(""),a=()=>{const r=t.trim().replace(/^#/,"");r&&(e(r),s(""))};return n.jsx("input",{type:"text",value:t,onChange:r=>s(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),a())},placeholder:"+ tag","aria-label":"Add a tag filter",className:"w-24 rounded-full border border-border bg-bg/40 px-2.5 py-1 text-xs text-fg focus:border-accent focus:outline-none"})}function zn({value:e,onChange:t}){return n.jsx("input",{type:"search",value:e,onChange:s=>t(s.target.value),placeholder:"Search…","aria-label":"Search within this view",className:"w-32 rounded-full border border-border bg-bg/40 px-2.5 py-1 text-xs text-fg focus:border-accent focus:outline-none"})}function Gn({value:e,onChange:t}){return n.jsx("button",{type:"button",onClick:()=>t(e==="desc"?"asc":e==="asc"?void 0:"desc"),className:"chip","aria-label":"Cycle sort order",children:e==="desc"?"Newest first":e==="asc"?"Oldest first":"Sort"})}function Un({note:e,def:t,draft:s,refinements:a,roles:r,onClose:i,onSaved:l}){const o=Ce(m=>m.push),u=yt(),c=jt(e,u),[p,x]=g.useState(c),[d,h]=g.useState(`${t.title} (copy)`),[j,y]=g.useState(!1),f=Se(e.id),b=vt(),v=async()=>{y(!0);try{const m=kt(t.query,a);p==="update"?(await f.mutateAsync({metadata:wn(t,s,m),...e.updatedAt?{if_updated_at:e.updatedAt}:{force:!0}}),o(`Updated "${t.title}".`,"success")):(await b.mutateAsync({content:"",path:St(d),tags:[r.view],metadata:kn(te(t,s),m)}),o(`Saved "${d}".`,"success")),l(),i()}catch(m){o(`Could not save: ${m.message}`,"error")}finally{y(!1)}};return n.jsx("div",{className:"dialog-overlay",role:"dialog","aria-labelledby":"save-view-title",onMouseDown:m=>{m.target===m.currentTarget&&i()},children:n.jsxs("div",{className:"dialog-panel max-w-md",children:[n.jsx("h2",{id:"save-view-title",className:"mb-3 font-serif text-xl text-fg",children:"Save this view"}),n.jsxs("div",{className:"mb-4 space-y-2",children:[n.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[n.jsx("input",{type:"radio",name:"save-mode",checked:p==="update",onChange:()=>x("update")}),"Update this view"]}),n.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[n.jsx("input",{type:"radio",name:"save-mode",checked:p==="fork",onChange:()=>x("fork")}),"Save as new view"]})]}),p==="fork"?n.jsxs("label",{className:"mb-4 block text-sm",children:[n.jsx("span",{className:"mb-1 block text-fg-muted",children:"Name"}),n.jsx("input",{type:"text",value:d,onChange:m=>h(m.target.value),className:"w-full rounded-lg border border-border bg-bg/40 px-2.5 py-1.5 text-sm text-fg focus:border-accent focus:outline-none"})]}):null,n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:i,className:"btn btn-secondary btn-touch",children:"Cancel"}),n.jsx("button",{type:"button",onClick:()=>void v(),disabled:j||p==="fork"&&!d.trim(),className:"btn btn-primary btn-touch",children:j?"Saving…":"Save"})]})]})})}export{_n as ViewCanvas,Wn as ViewSurface};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as w,y,r as i,g as N,l as v,bz as S,o as j,k,j as e,N as b,P as h,L as C}from"./index-H6VNro-x.js";import{W as p}from"./WizardShell-B0Fjh0Vt.js";import{f as z}from"./provenance-DDSHYRnT.js";import"./history-Ce29a331.js";function K(){const r=w(),[a]=y(),[t,n]=i.useState({kind:"checking"}),[l,f]=i.useState(0),d=i.useRef(null),m=i.useRef(null),x=a.get("new")==="1";if(i.useEffect(()=>{if(x)return;const s=`${l}|${a.toString()}`;if(d.current===s)return;d.current=s,n(c=>c.kind==="checking"?c:{kind:"checking"});const o=a.get("pick")==="1";(async()=>{let c;try{c=await N()}catch{n({kind:"redirect"});return}if(!c.signed_in){n({kind:"redirect"});return}try{const{vaults:u}=await v();if(o&&u.length>0){n({kind:"picker",email:c.email,vaults:u});return}const g=S(u);g.kind==="first-vault"?n({kind:"first-vault"}):g.kind==="welcome-back"?n({kind:"welcome-back",email:c.email,vault:g.vault}):n({kind:"picker",email:c.email,vaults:g.vaults})}catch(u){n({kind:"net-error",message:u instanceof Error?u.message:"Unknown error"})}})()},[l,a,x]),i.useEffect(()=>{if(t.kind!=="welcome-back"||t.error||m.current===t.vault.name)return;m.current=t.vault.name;const s=t.vault.name;(async()=>{try{await j(s),k(s),r("/",{replace:!0})}catch(o){m.current=null,n(c=>c.kind==="welcome-back"&&c.vault.name===s?{...c,error:o instanceof Error?o.message:"Couldn't open your vault."}:c)}})()},[t,r]),x)return e.jsx(b,{to:"/add-vault/create",replace:!0});switch(t.kind){case"checking":return e.jsx(E,{});case"redirect":return e.jsx(b,{to:a.get("link")==="expired"?"/?link=expired":"/",replace:!0});case"first-vault":return e.jsx(b,{to:"/add-vault/create?first=1",replace:!0});case"net-error":return e.jsx(O,{message:t.message,onRetry:()=>{n({kind:"checking"}),f(s=>s+1)}});case"welcome-back":return e.jsx(V,{email:t.email,vaultName:t.vault.name,error:t.error,onRetry:()=>n(s=>s.kind==="welcome-back"?{...s,error:void 0}:s)});case"picker":return e.jsx(W,{email:t.email,vaults:t.vaults,onOpenVault:async s=>{await j(s.name),k(s.name),r("/")},onCreateNew:()=>{r("/add-vault/create")}});default:return null}}function E(){return e.jsxs(p,{escape:{kind:"none"},children:[e.jsx(h,{size:72,className:"mx-auto mb-4 animate-pulse"}),e.jsx("p",{className:"eyebrow mb-3",children:"One moment"}),e.jsxs("h1",{className:"hero-title mb-2",style:{fontSize:"clamp(1.8rem, 4vw, 2.3rem)"},children:["Signing you ",e.jsx("span",{className:"accent-word",children:"in…"})]}),e.jsx("output",{"aria-live":"polite",className:"font-round text-sm text-fg-muted",children:"Checking your vaults…"})]})}function O({message:r,onRetry:a}){return e.jsxs(p,{escape:{kind:"back",to:"/"},children:[e.jsx(h,{size:56,className:"mx-auto mb-6"}),e.jsx("p",{className:"eyebrow mb-3",children:"Almost there"}),e.jsxs("h1",{className:"hero-title mb-4",style:{fontSize:"clamp(1.8rem, 4vw, 2.2rem)"},children:["You're signed in — we just couldn't fetch your ",e.jsx("span",{className:"accent-word",children:"vaults."})]}),e.jsx("p",{className:"mx-auto mb-6 max-w-sm text-fg-muted",children:r}),e.jsx("button",{type:"button",onClick:a,className:"btn btn-primary btn-lg justify-center rounded-full px-6 shadow-soft",children:"Try again"})]})}function V({email:r,vaultName:a,error:t,onRetry:n}){return t?e.jsxs(p,{escape:{kind:"back",to:"/"},children:[e.jsx(h,{size:60,className:"mx-auto mb-6"}),e.jsx("p",{className:"eyebrow mb-3",children:"One moment"}),e.jsxs("h1",{className:"hero-title mb-4",style:{fontSize:"clamp(1.6rem, 3.5vw, 2.1rem)"},children:["Couldn't open ",e.jsxs("span",{className:"accent-word",children:[a,"."]})]}),e.jsx("p",{className:"mx-auto mb-6 max-w-sm text-fg-muted",children:t}),e.jsx("button",{type:"button",onClick:n,className:"btn btn-primary btn-lg justify-center rounded-full px-6 shadow-soft",children:"Try again"})]}):e.jsxs(p,{escape:{kind:"none"},children:[e.jsx(h,{size:76,className:"mx-auto mb-4 animate-pulse"}),e.jsx("p",{className:"eyebrow mb-3",children:"Welcome back"}),e.jsxs("h1",{className:"hero-title mb-3",style:{fontSize:"clamp(1.8rem, 4vw, 2.1rem)"},children:["Opening ",e.jsxs("span",{className:"accent-word",children:[a,"…"]})]}),e.jsxs("output",{"aria-live":"polite",className:"mx-auto max-w-sm text-fg-muted",children:["Signed in as ",r??"you"," — opening ",a,"…"]})]})}function R({vault:r,busy:a,onOpen:t}){const n=z(r.usage),l=r.url?r.url.replace(/^https?:\/\//,""):"";return e.jsxs("li",{className:"card flex items-center gap-4 rounded-2xl p-4 shadow-soft",children:[e.jsx("span",{"aria-hidden":"true",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg bg-grass-soft text-base",children:"🌱"}),e.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-serif text-lg text-fg",children:r.name}),e.jsx("span",{className:"chip",children:"☁ Cloud"})]}),l?e.jsx("p",{className:"mt-0.5 truncate note-id",children:l}):null,n?e.jsx("p",{className:"mt-0.5 font-round text-xs text-fg-muted",children:n}):null]}),e.jsx("button",{type:"button",onClick:t,disabled:a,className:"btn btn-primary btn-touch shrink-0 rounded-full",children:a?"Opening…":"Open →"})]})}function W({email:r,vaults:a,onOpenVault:t,onCreateNew:n}){const[l,f]=i.useState(null),[d,m]=i.useState(null);async function x(s){if(!l){f(s.name),m(null);try{await t(s)}catch(o){f(null),m(o instanceof Error?o.message:"Couldn't open that vault.")}}}return e.jsxs(p,{wide:!0,escape:{kind:"back",to:"/"},children:[e.jsx(h,{size:56,className:"mx-auto mb-6"}),e.jsx("p",{className:"eyebrow mb-3",children:"Which vault"}),e.jsxs("h1",{className:"hero-title mb-3",style:{fontSize:"clamp(1.8rem, 4vw, 2.4rem)"},children:["Which vault ",e.jsx("span",{className:"accent-word",children:"today?"})]}),e.jsxs("p",{className:"mx-auto mb-8 max-w-sm text-fg-muted",children:["Signed in as ",r??"you"," · ",a.length," vault",a.length===1?"":"s"," on Cloud"]}),e.jsx("ul",{className:"mx-auto flex max-w-md flex-col gap-3",children:a.map(s=>e.jsx(R,{vault:s,busy:l===s.name,onOpen:()=>x(s)},s.name))}),d?e.jsx("p",{className:"mx-auto mt-6 max-w-sm rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:d}):null,e.jsxs("p",{className:"mt-8 font-round text-sm text-fg-muted",children:[e.jsx("button",{type:"button",onClick:n,className:"font-semibold text-accent hover:underline",children:"+ Create a new vault"})," ","·"," ",e.jsx(C,{to:"/add",className:"font-semibold hover:underline",style:{color:"var(--color-sky)"},children:"Connect a self-hosted vault"})]})]})}export{K as Welcome};
|