@augmentd-labs/canvas-web 2.26.35 → 2.26.37
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/dist/assets/CalendarApplet-BmrEfNPa.js +2 -0
- package/dist/assets/{FiltersApplet-NltVCRY8.js → FiltersApplet-BuOfikkU.js} +1 -1
- package/dist/assets/HomeFab-DtUgQqjj.js +3 -0
- package/dist/assets/{LensApplet-D-E4YyKz.js → LensApplet-DWoA0AeK.js} +1 -1
- package/dist/assets/{NotesApplet-DZ7lSkfC.js → NotesApplet-BnHiH-Vm.js} +1 -1
- package/dist/assets/{_agentId_-BuZ9wBek.js → _agentId_-Cm8yJTqD.js} +0 -0
- package/dist/assets/{_contextId_-DURo7ANU.js → _contextId_-LRp2S1tj.js} +1 -1
- package/dist/assets/{_workspaceName_-JpQwQGvI.js → _workspaceName_-BC1W0_NU.js} +1 -1
- package/dist/assets/{about-BpN8_1bC.js → about-aJJuQSFB.js} +1 -1
- package/dist/assets/{add-B7zdhw47.js → add-Ruml_x6t.js} +1 -1
- package/dist/assets/{agents-ChD6m_5J.js → agents-BWYACYNH.js} +1 -1
- package/dist/assets/{appearance-DEL04cKR.js → appearance-CSvWylrJ.js} +1 -1
- package/dist/assets/{apps-BYrwwspU.js → apps-CdUhD9HG.js} +1 -1
- package/dist/assets/content-app-view-AUB8kjjJ.js +1 -0
- package/dist/assets/{home-Bg5pLpIh.js → home-DwSabq_0.js} +1 -1
- package/dist/assets/index-AELn_vht.js +16 -0
- package/dist/assets/index-BAeuh9Mu.css +2 -0
- package/dist/assets/{key-bindings--OI4Iz7e.js → key-bindings-Cv7mVdte.js} +1 -1
- package/dist/assets/{registry-DQPkddij.js → registry-D1CIT_aZ.js} +2 -2
- package/dist/assets/{settings-B6TQfRMQ.js → settings-D8jDlO3y.js} +1 -1
- package/dist/assets/{settings-BgqCRJzb.js → settings-DaYH1KUc.js} +3 -3
- package/dist/assets/settings-DnXGDMuM.js +1 -0
- package/dist/assets/{settings-BQmgBTa-.js → settings-MRGmsYtV.js} +1 -1
- package/dist/assets/{share-target-BZmiLt2r.js → share-target-vNEvk9Rt.js} +1 -1
- package/dist/assets/{shared-qweQ1MKt.js → shared-C0dVLLZX.js} +1 -1
- package/dist/assets/{useAgentModels-Bda5ilvQ.js → useAgentModels-Dw4f4pZz.js} +1 -1
- package/dist/assets/workspaces-Ban7--8l.js +1 -0
- package/dist/index.html +3 -3
- package/dist/sw.js +1 -1
- package/package.json +2 -2
- package/dist/assets/CalendarApplet-gN_A0sQe.js +0 -2
- package/dist/assets/HomeFab-Cc33x4F2.js +0 -3
- package/dist/assets/content-app-view-Dcknmau8.js +0 -1
- package/dist/assets/index-C51Jk0Xq.css +0 -2
- package/dist/assets/index-VAgMESOp.js +0 -16
- package/dist/assets/settings-CljJz3ui.js +0 -1
- package/dist/assets/workspaces-BK7Rj72s.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{t as r}from"./api-CA6WiiYM.js";import{n as i}from"./page-header-DrDt1sQ2.js";import{t as a}from"./use-settings-back-DGmLAD63.js";var o=e(n(),1),s=t();function c(e){let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`}function l({name:e,version:t,detail:n}){return(0,s.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 px-4 py-2.5`,children:[(0,s.jsxs)(`div`,{className:`min-w-0`,children:[(0,s.jsx)(`div`,{className:`text-sm font-medium truncate`,children:e}),n&&(0,s.jsx)(`div`,{className:`text-xs text-muted-foreground truncate`,children:n})]}),(0,s.jsx)(`code`,{className:`text-xs text-muted-foreground shrink-0`,children:t})]})}function u(){let[e,t]=(0,o.useState)(null),[n,u]=(0,o.useState)(null);(0,o.useEffect)(()=>{let e=!0;return r.get(`/ping`,{skipAuth:!0}).then(n=>{e&&t(n??{})}).catch(t=>{e&&u(t instanceof Error?t.message:`Failed to reach the server`)}),()=>{e=!1}},[]);let d=[e?.commit?`commit ${e.commit.slice(0,7)}`:null,typeof e?.uptime==`number`?`up ${c(e.uptime)}`:null].filter(Boolean).join(` · `),f=Object.entries(e?.components??{}).sort(([e],[t])=>e.localeCompare(t));return(0,s.jsxs)(`div`,{className:`mx-auto max-w-4xl`,children:[(0,s.jsx)(i,{className:`mb-6`,title:`About`,onBack:a(),description:`Versions of every Canvas component this installation is running.`}),(0,s.jsxs)(`div`,{className:`space-y-6`,children:[(0,s.jsxs)(`section`,{className:`rounded-md border border-border divide-y divide-border`,children:[(0,s.jsx)(l,{name:`Canvas Web`,detail:`this interface`,version:`v2.26.
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{t as r}from"./api-CA6WiiYM.js";import{n as i}from"./page-header-DrDt1sQ2.js";import{t as a}from"./use-settings-back-DGmLAD63.js";var o=e(n(),1),s=t();function c(e){let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`}function l({name:e,version:t,detail:n}){return(0,s.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 px-4 py-2.5`,children:[(0,s.jsxs)(`div`,{className:`min-w-0`,children:[(0,s.jsx)(`div`,{className:`text-sm font-medium truncate`,children:e}),n&&(0,s.jsx)(`div`,{className:`text-xs text-muted-foreground truncate`,children:n})]}),(0,s.jsx)(`code`,{className:`text-xs text-muted-foreground shrink-0`,children:t})]})}function u(){let[e,t]=(0,o.useState)(null),[n,u]=(0,o.useState)(null);(0,o.useEffect)(()=>{let e=!0;return r.get(`/ping`,{skipAuth:!0}).then(n=>{e&&t(n??{})}).catch(t=>{e&&u(t instanceof Error?t.message:`Failed to reach the server`)}),()=>{e=!1}},[]);let d=[e?.commit?`commit ${e.commit.slice(0,7)}`:null,typeof e?.uptime==`number`?`up ${c(e.uptime)}`:null].filter(Boolean).join(` · `),f=Object.entries(e?.components??{}).sort(([e],[t])=>e.localeCompare(t));return(0,s.jsxs)(`div`,{className:`mx-auto max-w-4xl`,children:[(0,s.jsx)(i,{className:`mb-6`,title:`About`,onBack:a(),description:`Versions of every Canvas component this installation is running.`}),(0,s.jsxs)(`div`,{className:`space-y-6`,children:[(0,s.jsxs)(`section`,{className:`rounded-md border border-border divide-y divide-border`,children:[(0,s.jsx)(l,{name:`Canvas Web`,detail:`this interface`,version:`v2.26.37`}),e?.version&&(0,s.jsx)(l,{name:e.productName||e.appName||`Canvas Server`,detail:d||void 0,version:`v${e.version}`})]}),f.length>0&&(0,s.jsxs)(`section`,{children:[(0,s.jsx)(`h2`,{className:`mb-2 px-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Server components`}),(0,s.jsx)(`div`,{className:`rounded-md border border-border divide-y divide-border`,children:f.map(([e,t])=>(0,s.jsx)(l,{name:e,version:`v${t}`},e))})]}),n&&(0,s.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Server details unavailable: `,n]}),e?.sourceUrl&&(0,s.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.license?`Licensed ${e.license}. `:``,(0,s.jsx)(`a`,{href:e.sourceUrl,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`Get the source code`}),`.`]})]})]})}export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as e}from"./code-editor-BOIngd5F.js";import{_ as t,a as n,g as r}from"./chunk-62JRHF6Z-vspAGgtK.js";import{t as i}from"./HomeFab-
|
|
1
|
+
import{l as e}from"./code-editor-BOIngd5F.js";import{_ as t,a as n,g as r}from"./chunk-62JRHF6Z-vspAGgtK.js";import{t as i}from"./HomeFab-DtUgQqjj.js";var a=e(),o=[`note`,`todo`,`link`,`file`,`photo`];function s(){let{kind:e}=t(),s=r();return e===`sketch`?(0,a.jsx)(n,{to:`/apps/sketch?add=1`,replace:!0}):!e||!o.includes(e)?(0,a.jsx)(n,{to:`/home`,replace:!0}):(0,a.jsx)(i,{initialKind:e,onInitialCardClose:()=>s(`/home`)})}export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{g as r}from"./chunk-62JRHF6Z-vspAGgtK.js";import{I as i,It as a,Pt as o,Qr as s,Sr as c,rn as l,rt as u}from"./ui-CDoK3F3U.js";import{t as d}from"./button-SeUZ_Pvi.js";import{t as f}from"./input-BOtCd4HP.js";import{n as p}from"./use-toast-BlLDqSUO.js";import{t as m}from"./color-DFEH4BfK.js";import{J as h,L as g,Ot as _,et as v,tt as y}from"./index-VAgMESOp.js";import{n as b}from"./page-header-DrDt1sQ2.js";import{n as ee,r as x,t as te}from"./useAgentModels-Bda5ilvQ.js";import{t as ne}from"./form-panel-3p-ncEVK.js";import{t as re}from"./use-create-panel-DhSNIGtr.js";import{n as ie,t as ae}from"./useSocketSubscription-ifW-vnlb.js";var S=e(n(),1),C=t();function w({agent:e,onStart:t,onStop:n,onEnter:r}){let[o,f]=(0,S.useState)(!1),p=async()=>{f(!0);try{await t(e.name)}finally{f(!1)}},m=async()=>{f(!0);try{await n(e.name)}finally{f(!1)}},h=()=>{switch(e.status){case`active`:return(0,C.jsx)(c,{className:`h-4 w-4 text-success`});case`inactive`:return(0,C.jsx)(c,{className:`h-4 w-4 text-warning`});case`error`:return(0,C.jsx)(c,{className:`h-4 w-4 text-destructive`});default:return(0,C.jsx)(c,{className:`h-4 w-4 text-muted-foreground`})}},g=()=>{switch(e.llmProvider){case`anthropic`:return(0,C.jsx)(s,{className:`h-4 w-4 text-warning`});case`openai`:return(0,C.jsx)(s,{className:`h-4 w-4 text-success`});case`ollama`:return(0,C.jsx)(i,{className:`h-4 w-4 text-info`});default:return(0,C.jsx)(s,{className:`h-4 w-4 text-muted-foreground`})}},_=()=>{switch(e.status){case`active`:return`text-success bg-success-subtle border-success`;case`inactive`:return`text-warning bg-warning-subtle border-warning`;case`error`:return`text-destructive bg-destructive-subtle border-destructive`;case`available`:return`text-info bg-info-subtle border-info`;default:return`text-foreground bg-muted border-border`}},v=e.status===`available`||e.status===`inactive`,y=e.status===`active`;return(0,C.jsxs)(`div`,{className:`border rounded-lg p-4 space-y-4 hover:shadow-elevation-2 transition-shadow bg-card`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,C.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[g(),(0,C.jsx)(`h3`,{className:`text-lg font-semibold truncate`,children:e.label||e.name}),e.color&&(0,C.jsx)(`div`,{className:`w-4 h-4 rounded border flex-shrink-0`,style:{backgroundColor:e.color},title:`Color: ${e.color}`})]}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground font-mono`,children:e.name}),e.description&&(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:e.description})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[h(),(0,C.jsx)(`span`,{className:`px-2 py-1 rounded-full text-xs font-medium border ${_()}`,children:e.status})]})]}),(0,C.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 text-sm`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`Provider:`}),(0,C.jsx)(`div`,{className:`font-medium capitalize`,children:e.llmProvider})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`Model:`}),(0,C.jsx)(`div`,{className:`font-mono text-xs`,children:e.model})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`Created:`}),(0,C.jsx)(`div`,{children:new Date(e.createdAt).toLocaleDateString()})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`Last Access:`}),(0,C.jsx)(`div`,{children:e.lastAccessed?new Date(e.lastAccessed).toLocaleDateString():`Never`})]})]}),e.config.mcp?.servers&&e.config.mcp.servers.length>0&&(0,C.jsxs)(`div`,{className:`text-sm`,children:[(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`MCP Servers:`}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:e.config.mcp.servers.map((e,t)=>(0,C.jsx)(`span`,{className:`px-2 py-1 bg-secondary text-secondary-foreground rounded text-xs`,children:e.name},t))})]}),(0,C.jsxs)(`div`,{className:`flex gap-2 pt-2 border-t`,children:[v&&(0,C.jsxs)(d,{onClick:p,disabled:o,size:`sm`,variant:`outline`,className:`flex-1`,children:[(0,C.jsx)(a,{className:`mr-2 h-4 w-4`}),`Start`]}),y&&(0,C.jsxs)(d,{onClick:m,disabled:o,size:`sm`,variant:`outline`,className:`flex-1`,children:[(0,C.jsx)(u,{className:`mr-2 h-4 w-4`}),`Stop`]}),(0,C.jsxs)(d,{onClick:()=>r(e.name),size:`sm`,className:`flex-1`,children:[(0,C.jsx)(l,{className:`mr-2 h-4 w-4`}),`Chat`]})]})]})}function T(){let e={anthropic:`https://api.anthropic.com`,openai:`https://api.openai.com/v1`,ollama:`http://localhost:11434/v1`},t={anthropic:`claude-3-5-sonnet-20241022`,openai:`gpt-4o`,ollama:`qwen2.5-coder:latest`},[n,i]=(0,S.useState)([]),[a,s]=(0,S.useState)(!0),[c,l]=(0,S.useState)(null),[u,T]=(0,S.useState)(``),[E,D]=(0,S.useState)(``),[O,k]=(0,S.useState)(m()),[A,j]=(0,S.useState)(``),[M,oe]=(0,S.useState)(`anthropic`),[N,P]=(0,S.useState)(t.anthropic),[F,I]=(0,S.useState)({apiKey:``,baseUrl:e.anthropic,maxTokens:4096,temperature:.7,topP:1,frequencyPenalty:0,presencePenalty:0,numCtx:4096}),L=te(M,F.apiKey,F.baseUrl),R=L.models.find(e=>e.id===N),[z,B]=(0,S.useState)(``),[V,H]=(0,S.useState)(``),[U,W]=(0,S.useState)(``),[G,K]=(0,S.useState)(``),[q,J]=(0,S.useState)(!1),Y=_(),[X,Z]=re(),{showToast:Q}=p(),se=r(),$=ie();ae($,`agent`,{"agent:status:changed":e=>{i(t=>t.map(t=>t.id===e.agentId?{...t,status:e.status,isActive:e.isActive}:t))},"agent:created":e=>{i(t=>[...t,e.agent])},"agent:deleted":e=>{i(t=>t.filter(t=>t.id!==e.agentId))}});let ce=n=>{oe(n),P(t[n]),I({apiKey:``,baseUrl:e[n],maxTokens:4096,temperature:.7,topP:1,frequencyPenalty:0,presencePenalty:0,numCtx:4096})};(0,S.useEffect)(()=>((async()=>{try{s(!0);let e=await h();i(e),l(null)}catch(e){console.error(`Agent fetch error:`,e);let t=`Failed to fetch agents`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to fetch agents`}l(t),Q({title:`Error`,description:t,variant:`destructive`})}finally{s(!1)}})(),()=>{}),[$,Q]);let le=async t=>{if(t.preventDefault(),u.trim()){J(!0);try{let t=G.trim()||x(z,V,U),n={name:u,label:A||u,description:E||void 0,color:O,llmProvider:M,model:N,apiKey:F.apiKey.trim()||void 0,baseUrl:F.baseUrl.trim()||void 0,config:{type:M,model:N,identity:{role:z.trim()||void 0,identity:V.trim()||void 0,instructions:U.trim()||void 0},prompts:t?{system:t}:void 0,connectors:{[M]:{maxTokens:F.maxTokens,...M===`anthropic`?{}:{temperature:F.temperature},topP:F.topP,frequencyPenalty:F.frequencyPenalty,presencePenalty:F.presencePenalty,...M===`ollama`?{numCtx:F.numCtx}:{}}}},mcp:{enabled:!0,servers:[{name:`weather`,command:`node`,args:[`src/managers/agent/mcp-servers/weather.js`]}]}},r=await g(n);i(e=>[...e,r]),T(``),D(``),k(m()),j(``),K(``),B(``),H(``),W(``),I({apiKey:``,baseUrl:e[M],maxTokens:4096,temperature:.7,topP:1,frequencyPenalty:0,presencePenalty:0,numCtx:4096}),Q({title:`Success`,description:`Agent '${r.label||r.name}' created.`}),Z(!1)}catch(e){console.error(`Agent creation error:`,e);let t=`Failed to create agent`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to create agent`}Q({title:`Error`,description:t,variant:`destructive`})}finally{J(!1)}}},ue=async e=>{try{let t=await v(e);i(e=>e.map(e=>e.name===t.name?t:e)),Q({title:`Success`,description:`Agent '${t.label||t.name}' started.`})}catch(e){console.error(`Agent start error:`,e);let t=`Failed to start agent`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to start agent`}Q({title:`Error`,description:t,variant:`destructive`})}},de=async e=>{try{await y(e),i(t=>t.map(t=>t.name===e?{...t,status:`inactive`,isActive:!1}:t)),Q({title:`Success`,description:`Agent '${e}' stopped.`})}catch(e){console.error(`Agent stop error:`,e);let t=`Failed to stop agent`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to stop agent`}Q({title:`Error`,description:t,variant:`destructive`})}},fe=e=>{se(`/agents/${e}`)};return(0,C.jsxs)(`div`,{className:`space-y-6`,children:[(0,C.jsx)(b,{title:`AI Agents`,description:`Create and manage your AI agents with multiple LLM providers`,actions:!Y.local&&!X&&(0,C.jsxs)(d,{onClick:()=>Z(!0),className:`max-sm:h-9 max-sm:w-9 max-sm:p-0`,"aria-label":`Create agent`,title:`Create agent`,children:[(0,C.jsx)(o,{className:`h-4 w-4 sm:mr-2`}),(0,C.jsx)(`span`,{className:`max-sm:hidden`,children:`Create Agent`})]})}),!Y.local&&X&&(0,C.jsx)(ne,{title:`Create New Agent`,onClose:()=>Z(!1),children:(0,C.jsxs)(`form`,{onSubmit:le,className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,C.jsx)(f,{value:u,onChange:e=>T(e.target.value),placeholder:`Agent Name (e.g., 'my-assistant')`,disabled:q}),(0,C.jsx)(f,{value:A,onChange:e=>j(e.target.value),placeholder:`Agent Label (display name, optional)`,disabled:q})]}),(0,C.jsx)(f,{value:E,onChange:e=>D(e.target.value),placeholder:`Description (optional)`,disabled:q}),(0,C.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`agent-provider`,className:`text-sm font-medium`,children:`LLM Provider`}),(0,C.jsxs)(`select`,{id:`agent-provider`,value:M,onChange:e=>ce(e.target.value),className:`w-full mt-1 px-3 py-2 border border-input bg-background rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-ring`,disabled:q,children:[(0,C.jsx)(`option`,{value:`anthropic`,children:`Anthropic Claude`}),(0,C.jsx)(`option`,{value:`openai`,children:`OpenAI GPT`}),(0,C.jsx)(`option`,{value:`ollama`,children:`Ollama (Local)`})]})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`agent-model`,className:`text-sm font-medium`,children:`Model`}),(0,C.jsx)(ee,{id:`agent-model`,value:N,onChange:(e,t)=>{P(e),t?.maxTokens&&I(e=>({...e,maxTokens:t.maxTokens}))},...L,disabled:q})]})]}),(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsx)(`h3`,{className:`text-lg font-medium`,children:`Persona`}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`agent-role`,className:`text-sm font-medium`,children:`Role`}),(0,C.jsx)(f,{id:`agent-role`,value:z,onChange:e=>B(e.target.value),placeholder:`e.g. Software Engineer`,disabled:q})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`agent-identity`,className:`text-sm font-medium`,children:`Identity`}),(0,C.jsx)(`textarea`,{id:`agent-identity`,value:V,onChange:e=>H(e.target.value),placeholder:`Who this agent is…`,disabled:q,className:`w-full mt-1 px-3 py-2 border border-input bg-background rounded-md text-sm min-h-[80px] resize-y`})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`agent-instructions`,className:`text-sm font-medium`,children:`Instructions`}),(0,C.jsx)(`textarea`,{id:`agent-instructions`,value:U,onChange:e=>W(e.target.value),placeholder:`Behavioral instructions…`,disabled:q,className:`w-full mt-1 px-3 py-2 border border-input bg-background rounded-md text-sm min-h-[80px] resize-y`})]})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`system-prompt`,className:`text-sm font-medium`,children:`System Prompt (Optional Override)`}),(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Built from Role, Identity and Instructions unless you enter an override.`}),(0,C.jsx)(`textarea`,{id:`system-prompt`,value:G,onChange:e=>K(e.target.value),placeholder:x(z,V,U)||`System prompt sent to the LLM…`,className:`w-full mt-1 px-3 py-2 border border-input bg-background rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-ring min-h-[80px] resize-y`,disabled:q})]}),(0,C.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`api-key`,className:`text-sm font-medium`,children:`API Key (Optional)`}),(0,C.jsx)(f,{id:`api-key`,type:`password`,value:F.apiKey,onChange:e=>I(t=>({...t,apiKey:e.target.value})),placeholder:`Enter your API key`,disabled:q})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`baseUrl`,className:`text-sm font-medium`,children:`Base URL (Optional)`}),(0,C.jsx)(f,{id:`baseUrl`,value:F.baseUrl,onChange:e=>I(t=>({...t,baseUrl:e.target.value})),placeholder:e[M],disabled:q})]})]}),(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsx)(`h3`,{className:`text-lg font-medium`,children:`LLM Parameters`}),(0,C.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`max-tokens`,className:`text-sm font-medium`,children:`Max Output Tokens`}),(0,C.jsx)(f,{id:`max-tokens`,type:`number`,min:`1`,max:R?.maxTokens,value:F.maxTokens,onChange:e=>I(t=>({...t,maxTokens:parseInt(e.target.value)||4096})),disabled:q})]}),M!==`anthropic`&&(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`temperature`,className:`text-sm font-medium`,children:`Temperature`}),(0,C.jsx)(f,{id:`temperature`,type:`number`,min:`0`,max:`2`,step:`0.1`,value:F.temperature,onChange:e=>I(t=>({...t,temperature:Number.isNaN(e.target.valueAsNumber)?.7:e.target.valueAsNumber})),disabled:q})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`top-p`,className:`text-sm font-medium`,children:`Top P`}),(0,C.jsx)(f,{id:`top-p`,type:`number`,min:`0`,max:`1`,step:`0.1`,value:F.topP,onChange:e=>I(t=>({...t,topP:Number.isNaN(e.target.valueAsNumber)?1:e.target.valueAsNumber})),disabled:q})]}),M===`ollama`&&(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`num-ctx`,className:`text-sm font-medium`,children:`Context Length`}),(0,C.jsx)(f,{id:`num-ctx`,type:`number`,min:`1024`,max:R?.contextWindow,value:F.numCtx,onChange:e=>I(t=>({...t,numCtx:parseInt(e.target.value)||4096})),disabled:q})]})]}),M!==`ollama`&&(0,C.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`frequency-penalty`,className:`text-sm font-medium`,children:`Frequency Penalty`}),(0,C.jsx)(f,{id:`frequency-penalty`,type:`number`,min:`-2`,max:`2`,step:`0.1`,value:F.frequencyPenalty,onChange:e=>I(t=>({...t,frequencyPenalty:parseFloat(e.target.value)||0})),disabled:q})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`presence-penalty`,className:`text-sm font-medium`,children:`Presence Penalty`}),(0,C.jsx)(f,{id:`presence-penalty`,type:`number`,min:`-2`,max:`2`,step:`0.1`,value:F.presencePenalty,onChange:e=>I(t=>({...t,presencePenalty:parseFloat(e.target.value)||0})),disabled:q})]})]})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(`label`,{htmlFor:`agent-color`,className:`text-sm font-medium`,children:`Agent Color`}),(0,C.jsx)(f,{id:`agent-color`,type:`color`,value:O,onChange:e=>k(e.target.value),className:`h-10 w-16 p-1`,disabled:q}),(0,C.jsx)(d,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>k(m()),disabled:q,children:`Randomize`})]}),(0,C.jsxs)(d,{type:`submit`,disabled:q||!u.trim(),children:[(0,C.jsx)(o,{className:`mr-2 h-4 w-4`}),`Create Agent`]})]})}),(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Your Agents`}),a&&(0,C.jsx)(`p`,{className:`text-center text-muted-foreground`,children:`Loading agents...`}),c&&(0,C.jsx)(`div`,{className:`text-center text-destructive`,children:(0,C.jsx)(`p`,{children:c})}),!a&&!c&&n.length===0&&(0,C.jsx)(`p`,{className:`text-center text-muted-foreground`,children:`No agents found`}),n.length>0&&(0,C.jsx)(`div`,{className:`grid gap-4`,children:n.map(e=>(0,C.jsx)(w,{agent:e,onStart:ue,onStop:de,onEnter:fe},e.id))})]})]})}export{T as default};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{g as r}from"./chunk-62JRHF6Z-vspAGgtK.js";import{I as i,It as a,Pt as o,Qr as s,Sr as c,rn as l,rt as u}from"./ui-CDoK3F3U.js";import{t as d}from"./button-SeUZ_Pvi.js";import{t as f}from"./input-BOtCd4HP.js";import{n as p}from"./use-toast-BlLDqSUO.js";import{t as m}from"./color-DFEH4BfK.js";import{R as h,Y as g,kt as _,nt as v,tt as y}from"./index-AELn_vht.js";import{n as b}from"./page-header-DrDt1sQ2.js";import{n as ee,r as x,t as te}from"./useAgentModels-Dw4f4pZz.js";import{t as ne}from"./form-panel-3p-ncEVK.js";import{t as re}from"./use-create-panel-DhSNIGtr.js";import{n as ie,t as ae}from"./useSocketSubscription-ifW-vnlb.js";var S=e(n(),1),C=t();function w({agent:e,onStart:t,onStop:n,onEnter:r}){let[o,f]=(0,S.useState)(!1),p=async()=>{f(!0);try{await t(e.name)}finally{f(!1)}},m=async()=>{f(!0);try{await n(e.name)}finally{f(!1)}},h=()=>{switch(e.status){case`active`:return(0,C.jsx)(c,{className:`h-4 w-4 text-success`});case`inactive`:return(0,C.jsx)(c,{className:`h-4 w-4 text-warning`});case`error`:return(0,C.jsx)(c,{className:`h-4 w-4 text-destructive`});default:return(0,C.jsx)(c,{className:`h-4 w-4 text-muted-foreground`})}},g=()=>{switch(e.llmProvider){case`anthropic`:return(0,C.jsx)(s,{className:`h-4 w-4 text-warning`});case`openai`:return(0,C.jsx)(s,{className:`h-4 w-4 text-success`});case`ollama`:return(0,C.jsx)(i,{className:`h-4 w-4 text-info`});default:return(0,C.jsx)(s,{className:`h-4 w-4 text-muted-foreground`})}},_=()=>{switch(e.status){case`active`:return`text-success bg-success-subtle border-success`;case`inactive`:return`text-warning bg-warning-subtle border-warning`;case`error`:return`text-destructive bg-destructive-subtle border-destructive`;case`available`:return`text-info bg-info-subtle border-info`;default:return`text-foreground bg-muted border-border`}},v=e.status===`available`||e.status===`inactive`,y=e.status===`active`;return(0,C.jsxs)(`div`,{className:`border rounded-lg p-4 space-y-4 hover:shadow-elevation-2 transition-shadow bg-card`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,C.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[g(),(0,C.jsx)(`h3`,{className:`text-lg font-semibold truncate`,children:e.label||e.name}),e.color&&(0,C.jsx)(`div`,{className:`w-4 h-4 rounded border flex-shrink-0`,style:{backgroundColor:e.color},title:`Color: ${e.color}`})]}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground font-mono`,children:e.name}),e.description&&(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:e.description})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[h(),(0,C.jsx)(`span`,{className:`px-2 py-1 rounded-full text-xs font-medium border ${_()}`,children:e.status})]})]}),(0,C.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 text-sm`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`Provider:`}),(0,C.jsx)(`div`,{className:`font-medium capitalize`,children:e.llmProvider})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`Model:`}),(0,C.jsx)(`div`,{className:`font-mono text-xs`,children:e.model})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`Created:`}),(0,C.jsx)(`div`,{children:new Date(e.createdAt).toLocaleDateString()})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`Last Access:`}),(0,C.jsx)(`div`,{children:e.lastAccessed?new Date(e.lastAccessed).toLocaleDateString():`Never`})]})]}),e.config.mcp?.servers&&e.config.mcp.servers.length>0&&(0,C.jsxs)(`div`,{className:`text-sm`,children:[(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`MCP Servers:`}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:e.config.mcp.servers.map((e,t)=>(0,C.jsx)(`span`,{className:`px-2 py-1 bg-secondary text-secondary-foreground rounded text-xs`,children:e.name},t))})]}),(0,C.jsxs)(`div`,{className:`flex gap-2 pt-2 border-t`,children:[v&&(0,C.jsxs)(d,{onClick:p,disabled:o,size:`sm`,variant:`outline`,className:`flex-1`,children:[(0,C.jsx)(a,{className:`mr-2 h-4 w-4`}),`Start`]}),y&&(0,C.jsxs)(d,{onClick:m,disabled:o,size:`sm`,variant:`outline`,className:`flex-1`,children:[(0,C.jsx)(u,{className:`mr-2 h-4 w-4`}),`Stop`]}),(0,C.jsxs)(d,{onClick:()=>r(e.name),size:`sm`,className:`flex-1`,children:[(0,C.jsx)(l,{className:`mr-2 h-4 w-4`}),`Chat`]})]})]})}function T(){let e={anthropic:`https://api.anthropic.com`,openai:`https://api.openai.com/v1`,ollama:`http://localhost:11434/v1`},t={anthropic:`claude-3-5-sonnet-20241022`,openai:`gpt-4o`,ollama:`qwen2.5-coder:latest`},[n,i]=(0,S.useState)([]),[a,s]=(0,S.useState)(!0),[c,l]=(0,S.useState)(null),[u,T]=(0,S.useState)(``),[E,D]=(0,S.useState)(``),[O,k]=(0,S.useState)(m()),[A,j]=(0,S.useState)(``),[M,oe]=(0,S.useState)(`anthropic`),[N,P]=(0,S.useState)(t.anthropic),[F,I]=(0,S.useState)({apiKey:``,baseUrl:e.anthropic,maxTokens:4096,temperature:.7,topP:1,frequencyPenalty:0,presencePenalty:0,numCtx:4096}),L=te(M,F.apiKey,F.baseUrl),R=L.models.find(e=>e.id===N),[z,B]=(0,S.useState)(``),[V,H]=(0,S.useState)(``),[U,W]=(0,S.useState)(``),[G,K]=(0,S.useState)(``),[q,J]=(0,S.useState)(!1),Y=_(),[X,Z]=re(),{showToast:Q}=p(),se=r(),$=ie();ae($,`agent`,{"agent:status:changed":e=>{i(t=>t.map(t=>t.id===e.agentId?{...t,status:e.status,isActive:e.isActive}:t))},"agent:created":e=>{i(t=>[...t,e.agent])},"agent:deleted":e=>{i(t=>t.filter(t=>t.id!==e.agentId))}});let ce=n=>{oe(n),P(t[n]),I({apiKey:``,baseUrl:e[n],maxTokens:4096,temperature:.7,topP:1,frequencyPenalty:0,presencePenalty:0,numCtx:4096})};(0,S.useEffect)(()=>((async()=>{try{s(!0);let e=await g();i(e),l(null)}catch(e){console.error(`Agent fetch error:`,e);let t=`Failed to fetch agents`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to fetch agents`}l(t),Q({title:`Error`,description:t,variant:`destructive`})}finally{s(!1)}})(),()=>{}),[$,Q]);let le=async t=>{if(t.preventDefault(),u.trim()){J(!0);try{let t=G.trim()||x(z,V,U),n={name:u,label:A||u,description:E||void 0,color:O,llmProvider:M,model:N,apiKey:F.apiKey.trim()||void 0,baseUrl:F.baseUrl.trim()||void 0,config:{type:M,model:N,identity:{role:z.trim()||void 0,identity:V.trim()||void 0,instructions:U.trim()||void 0},prompts:t?{system:t}:void 0,connectors:{[M]:{maxTokens:F.maxTokens,...M===`anthropic`?{}:{temperature:F.temperature},topP:F.topP,frequencyPenalty:F.frequencyPenalty,presencePenalty:F.presencePenalty,...M===`ollama`?{numCtx:F.numCtx}:{}}}},mcp:{enabled:!0,servers:[{name:`weather`,command:`node`,args:[`src/managers/agent/mcp-servers/weather.js`]}]}},r=await h(n);i(e=>[...e,r]),T(``),D(``),k(m()),j(``),K(``),B(``),H(``),W(``),I({apiKey:``,baseUrl:e[M],maxTokens:4096,temperature:.7,topP:1,frequencyPenalty:0,presencePenalty:0,numCtx:4096}),Q({title:`Success`,description:`Agent '${r.label||r.name}' created.`}),Z(!1)}catch(e){console.error(`Agent creation error:`,e);let t=`Failed to create agent`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to create agent`}Q({title:`Error`,description:t,variant:`destructive`})}finally{J(!1)}}},ue=async e=>{try{let t=await y(e);i(e=>e.map(e=>e.name===t.name?t:e)),Q({title:`Success`,description:`Agent '${t.label||t.name}' started.`})}catch(e){console.error(`Agent start error:`,e);let t=`Failed to start agent`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to start agent`}Q({title:`Error`,description:t,variant:`destructive`})}},de=async e=>{try{await v(e),i(t=>t.map(t=>t.name===e?{...t,status:`inactive`,isActive:!1}:t)),Q({title:`Success`,description:`Agent '${e}' stopped.`})}catch(e){console.error(`Agent stop error:`,e);let t=`Failed to stop agent`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to stop agent`}Q({title:`Error`,description:t,variant:`destructive`})}},fe=e=>{se(`/agents/${e}`)};return(0,C.jsxs)(`div`,{className:`space-y-6`,children:[(0,C.jsx)(b,{title:`AI Agents`,description:`Create and manage your AI agents with multiple LLM providers`,actions:!Y.local&&!X&&(0,C.jsxs)(d,{onClick:()=>Z(!0),className:`max-sm:h-9 max-sm:w-9 max-sm:p-0`,"aria-label":`Create agent`,title:`Create agent`,children:[(0,C.jsx)(o,{className:`h-4 w-4 sm:mr-2`}),(0,C.jsx)(`span`,{className:`max-sm:hidden`,children:`Create Agent`})]})}),!Y.local&&X&&(0,C.jsx)(ne,{title:`Create New Agent`,onClose:()=>Z(!1),children:(0,C.jsxs)(`form`,{onSubmit:le,className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,C.jsx)(f,{value:u,onChange:e=>T(e.target.value),placeholder:`Agent Name (e.g., 'my-assistant')`,disabled:q}),(0,C.jsx)(f,{value:A,onChange:e=>j(e.target.value),placeholder:`Agent Label (display name, optional)`,disabled:q})]}),(0,C.jsx)(f,{value:E,onChange:e=>D(e.target.value),placeholder:`Description (optional)`,disabled:q}),(0,C.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`agent-provider`,className:`text-sm font-medium`,children:`LLM Provider`}),(0,C.jsxs)(`select`,{id:`agent-provider`,value:M,onChange:e=>ce(e.target.value),className:`w-full mt-1 px-3 py-2 border border-input bg-background rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-ring`,disabled:q,children:[(0,C.jsx)(`option`,{value:`anthropic`,children:`Anthropic Claude`}),(0,C.jsx)(`option`,{value:`openai`,children:`OpenAI GPT`}),(0,C.jsx)(`option`,{value:`ollama`,children:`Ollama (Local)`})]})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`agent-model`,className:`text-sm font-medium`,children:`Model`}),(0,C.jsx)(ee,{id:`agent-model`,value:N,onChange:(e,t)=>{P(e),t?.maxTokens&&I(e=>({...e,maxTokens:t.maxTokens}))},...L,disabled:q})]})]}),(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsx)(`h3`,{className:`text-lg font-medium`,children:`Persona`}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`agent-role`,className:`text-sm font-medium`,children:`Role`}),(0,C.jsx)(f,{id:`agent-role`,value:z,onChange:e=>B(e.target.value),placeholder:`e.g. Software Engineer`,disabled:q})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`agent-identity`,className:`text-sm font-medium`,children:`Identity`}),(0,C.jsx)(`textarea`,{id:`agent-identity`,value:V,onChange:e=>H(e.target.value),placeholder:`Who this agent is…`,disabled:q,className:`w-full mt-1 px-3 py-2 border border-input bg-background rounded-md text-sm min-h-[80px] resize-y`})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`agent-instructions`,className:`text-sm font-medium`,children:`Instructions`}),(0,C.jsx)(`textarea`,{id:`agent-instructions`,value:U,onChange:e=>W(e.target.value),placeholder:`Behavioral instructions…`,disabled:q,className:`w-full mt-1 px-3 py-2 border border-input bg-background rounded-md text-sm min-h-[80px] resize-y`})]})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`system-prompt`,className:`text-sm font-medium`,children:`System Prompt (Optional Override)`}),(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Built from Role, Identity and Instructions unless you enter an override.`}),(0,C.jsx)(`textarea`,{id:`system-prompt`,value:G,onChange:e=>K(e.target.value),placeholder:x(z,V,U)||`System prompt sent to the LLM…`,className:`w-full mt-1 px-3 py-2 border border-input bg-background rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-ring min-h-[80px] resize-y`,disabled:q})]}),(0,C.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`api-key`,className:`text-sm font-medium`,children:`API Key (Optional)`}),(0,C.jsx)(f,{id:`api-key`,type:`password`,value:F.apiKey,onChange:e=>I(t=>({...t,apiKey:e.target.value})),placeholder:`Enter your API key`,disabled:q})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`baseUrl`,className:`text-sm font-medium`,children:`Base URL (Optional)`}),(0,C.jsx)(f,{id:`baseUrl`,value:F.baseUrl,onChange:e=>I(t=>({...t,baseUrl:e.target.value})),placeholder:e[M],disabled:q})]})]}),(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsx)(`h3`,{className:`text-lg font-medium`,children:`LLM Parameters`}),(0,C.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`max-tokens`,className:`text-sm font-medium`,children:`Max Output Tokens`}),(0,C.jsx)(f,{id:`max-tokens`,type:`number`,min:`1`,max:R?.maxTokens,value:F.maxTokens,onChange:e=>I(t=>({...t,maxTokens:parseInt(e.target.value)||4096})),disabled:q})]}),M!==`anthropic`&&(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`temperature`,className:`text-sm font-medium`,children:`Temperature`}),(0,C.jsx)(f,{id:`temperature`,type:`number`,min:`0`,max:`2`,step:`0.1`,value:F.temperature,onChange:e=>I(t=>({...t,temperature:Number.isNaN(e.target.valueAsNumber)?.7:e.target.valueAsNumber})),disabled:q})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`top-p`,className:`text-sm font-medium`,children:`Top P`}),(0,C.jsx)(f,{id:`top-p`,type:`number`,min:`0`,max:`1`,step:`0.1`,value:F.topP,onChange:e=>I(t=>({...t,topP:Number.isNaN(e.target.valueAsNumber)?1:e.target.valueAsNumber})),disabled:q})]}),M===`ollama`&&(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`num-ctx`,className:`text-sm font-medium`,children:`Context Length`}),(0,C.jsx)(f,{id:`num-ctx`,type:`number`,min:`1024`,max:R?.contextWindow,value:F.numCtx,onChange:e=>I(t=>({...t,numCtx:parseInt(e.target.value)||4096})),disabled:q})]})]}),M!==`ollama`&&(0,C.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`frequency-penalty`,className:`text-sm font-medium`,children:`Frequency Penalty`}),(0,C.jsx)(f,{id:`frequency-penalty`,type:`number`,min:`-2`,max:`2`,step:`0.1`,value:F.frequencyPenalty,onChange:e=>I(t=>({...t,frequencyPenalty:parseFloat(e.target.value)||0})),disabled:q})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`presence-penalty`,className:`text-sm font-medium`,children:`Presence Penalty`}),(0,C.jsx)(f,{id:`presence-penalty`,type:`number`,min:`-2`,max:`2`,step:`0.1`,value:F.presencePenalty,onChange:e=>I(t=>({...t,presencePenalty:parseFloat(e.target.value)||0})),disabled:q})]})]})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(`label`,{htmlFor:`agent-color`,className:`text-sm font-medium`,children:`Agent Color`}),(0,C.jsx)(f,{id:`agent-color`,type:`color`,value:O,onChange:e=>k(e.target.value),className:`h-10 w-16 p-1`,disabled:q}),(0,C.jsx)(d,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>k(m()),disabled:q,children:`Randomize`})]}),(0,C.jsxs)(d,{type:`submit`,disabled:q||!u.trim(),children:[(0,C.jsx)(o,{className:`mr-2 h-4 w-4`}),`Create Agent`]})]})}),(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Your Agents`}),a&&(0,C.jsx)(`p`,{className:`text-center text-muted-foreground`,children:`Loading agents...`}),c&&(0,C.jsx)(`div`,{className:`text-center text-destructive`,children:(0,C.jsx)(`p`,{children:c})}),!a&&!c&&n.length===0&&(0,C.jsx)(`p`,{className:`text-center text-muted-foreground`,children:`No agents found`}),n.length>0&&(0,C.jsx)(`div`,{className:`grid gap-4`,children:n.map(e=>(0,C.jsx)(w,{agent:e,onStart:ue,onStop:de,onEnter:fe},e.id))})]})]})}export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{Wr as r,Xt as i,Yt as a,et as o}from"./ui-CDoK3F3U.js";import{t as s}from"./utils-2pl1SbIp.js";import{a as c,i as l,n as u,o as d,r as f,s as p,t as m}from"./document-open-mode-DoImW-xs.js";import{d as h,f as g,l as _,o as v,s as y,u as b}from"./use-menu-DIP1zh7I.js";import{t as x}from"./use-theme-DaxpiICf.js";import{St as S,a as C,bt as w,c as T,d as E,f as D,i as O,l as k,m as A,n as j,o as M,p as N,r as P,s as F,t as I,u as L,xt as R}from"./index-VAgMESOp.js";import{n as z}from"./page-header-DrDt1sQ2.js";import{t as B}from"./use-settings-back-DGmLAD63.js";var V=e(n(),1),H=t(),U={system:i,light:o,dark:a};function W(){let{theme:e,scheme:t,density:n,resolvedScheme:i,setTheme:a,setScheme:o,setDensity:C,reset:T}=x(),E=l(),O=u(),k=h(),j=p(),M=S(),P=g();return(0,H.jsxs)(`div`,{className:`space-y-8`,children:[(0,H.jsxs)(`section`,{children:[(0,H.jsx)(J,{title:`Theme`,description:`Palette, shape and typography. Each theme defines its own light and dark variants.`}),(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:A.map(t=>{let n=t.id===e;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>a(t.id),"aria-pressed":n,className:s(`focus-ring group flex flex-col gap-3 rounded-lg border p-4 text-left transition-colors`,n?`border-primary bg-accent`:`border-border hover:border-muted-foreground/40 hover:bg-accent/50`),children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium`,children:t.name}),n&&(0,H.jsx)(r,{className:`size-4 shrink-0 text-primary`})]}),(0,H.jsx)(`div`,{className:`flex gap-1.5`,"aria-hidden":!0,children:t.swatches.map(e=>(0,H.jsx)(`span`,{className:`size-6 rounded-full border border-border`,style:{backgroundColor:e}},e))}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.description})]},t.id)})})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(J,{title:`Colour scheme`,description:t===`system`?`Following your system setting, currently ${i}.`:`Overrides your system setting.`}),(0,H.jsx)(Y,{options:N.map(e=>{let t=U[e.id];return{id:e.id,label:e.name,icon:(0,H.jsx)(t,{className:`size-4 shrink-0`})}}),value:t,onChange:o})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(J,{title:`Density`,description:`Controls row height, hit-target size and shell spacing across the whole app.`}),(0,H.jsx)(Y,{options:D.map(e=>({id:e.id,label:e.name,title:e.description})),value:n,onChange:C}),(0,H.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:D.find(e=>e.id===n)?.description})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(J,{title:`Layout`,description:`How menus and content share the screen. Device-local, like the wallpaper.`}),(0,H.jsx)(Y,{options:y.map(e=>({id:e.id,label:e.name,title:e.description})),value:k,onChange:_}),(0,H.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:y.find(e=>e.id===k)?.description}),k===`strip`&&(0,H.jsxs)(`div`,{className:`mt-4`,children:[(0,H.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:`Navigation keys`}),(0,H.jsx)(Y,{options:v.map(e=>({id:e.id,label:e.name,title:e.description})),value:P,onChange:b}),(0,H.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[v.find(e=>e.id===P)?.description,` `,`Left and right walk the columns, up and down switch pin rows.`]})]})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(J,{title:`Tree style`,description:`How workspace and context trees are drawn in the menu. Device-local.`}),(0,H.jsx)(Y,{options:w.map(e=>({id:e.id,label:e.name,title:e.description})),value:M,onChange:R}),(0,H.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:w.find(e=>e.id===M)?.description})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(J,{title:`Open documents`,description:`Choose how documents open from lists, tiles and boards. Saved on this device.`}),(0,H.jsx)(Y,{options:[{id:`modal`,label:`Modal`},{id:`side`,label:`Side reading pane`}],value:O,onChange:m}),(0,H.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`The reading pane opens beside the content and updates as you select another document. On small screens it opens as a drawer.`})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(J,{title:`Always-on content area`,description:`Keep a reading pane beside document lists on tablets and desktops. Remember the selected item in each folder, or show the first available item.`}),(0,H.jsx)(Y,{options:[{id:`on`,label:`On`},{id:`off`,label:`Off`}],value:E?`on`:`off`,onChange:e=>f(e===`on`)}),(0,H.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`On by default. The reader uses roughly half the screen; drag its divider to resize. Phones keep tap-to-open navigation. When enabled, list selections use this pane regardless of the Open documents setting.`})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(J,{title:`Document tiles`,description:`Choose the photo and media layout for tile view. Saved on this device.`}),(0,H.jsx)(Y,{options:c,value:j,onChange:d})]}),(0,H.jsx)(G,{}),(0,H.jsx)(`section`,{children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>{T(),m(`modal`)},className:`focus-ring rounded-md text-sm text-muted-foreground underline-offset-4 hover:text-foreground hover:underline`,children:`Reset to defaults`})})]})}function G(){let[e,t]=(0,V.useState)(M),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(!0),[o,s]=(0,V.useState)(!1),c=(0,V.useRef)(!1);(0,V.useEffect)(()=>{let e=!1;return T().then(()=>{e||(t(M()),a(!1))}),()=>{e=!0}},[]);let l=async(e,n)=>{if(!c.current){c.current=!0,s(!0);try{let i=n?{...e,image:await F(n)}:e;await k(i),t(i),r(null)}catch(e){r(e instanceof Error&&e.name!==`QuotaExceededError`?e.message:`Could not store the wallpaper. Free some browser storage or try a smaller image.`)}finally{c.current=!1,s(!1)}}},u=t=>{t&&l(e,t)},d=e.image!==null&&P(e.image)===null,f=L(e.image);return(0,H.jsx)(`section`,{children:(0,H.jsxs)(`fieldset`,{disabled:i||o,className:`min-w-0`,children:[(0,H.jsx)(J,{title:`Wallpaper`,description:`Background image for the desk behind all panels. Without one, the theme's desk color shows (the default).`}),(0,H.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Wallpaper`,className:`grid grid-cols-3 gap-3 sm:grid-cols-4 lg:grid-cols-6`,children:[(0,H.jsx)(q,{label:`None`,isActive:e.image===null,onSelect:()=>l({...e,image:null}),children:(0,H.jsx)(`span`,{className:`flex size-full items-center justify-center surface-desk text-xs text-muted-foreground`,style:{backgroundImage:`none`},children:`None`})}),I.map(t=>(0,H.jsx)(q,{label:t.title,title:`${t.title} — suits the ${t.scheme} scheme`,isActive:P(e.image)===t.id,onSelect:()=>l({...e,image:O(t.id)}),children:(0,H.jsx)(`img`,{src:C(t),alt:``,loading:`lazy`,className:`size-full object-cover`,style:{backgroundColor:t.background}})},t.id)),d&&(0,H.jsx)(q,{label:`Your image`,isActive:!0,onSelect:()=>{},children:(0,H.jsx)(`img`,{src:e.image??void 0,alt:``,className:`size-full object-cover`})})]}),(0,H.jsx)(K,{}),(0,H.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`h-20 w-32 shrink-0 rounded-md border surface-desk`,style:f?{backgroundImage:f,backgroundSize:E(e.fit),backgroundPosition:`center`,backgroundRepeat:`no-repeat`}:void 0,"aria-hidden":!0}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsxs)(`label`,{className:`focus-ring inline-flex cursor-pointer items-center rounded-md border px-3 py-1.5 text-sm hover:bg-accent/50`,children:[d?`Change image…`:`Use your own image…`,(0,H.jsx)(`input`,{type:`file`,accept:`image/*,.gif`,className:`hidden`,onChange:e=>{u(e.target.files?.[0]),e.target.value=``}})]}),e.image&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>l({...e,image:null}),className:`focus-ring rounded-md border px-3 py-1.5 text-sm text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:`Remove`})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Images and animated GIFs up to 10 MB. Stored on this device.`}),(0,H.jsx)(Y,{options:j.map(e=>({id:e.id,label:e.label,title:e.description})),value:e.fit,onChange:t=>l({...e,fit:t})}),n&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:n}),o&&(0,H.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:`Saving wallpaper…`})]})]})]})})}function K(){let e=I.filter(e=>e.author!==`Canvas`);return e.length===0?null:(0,H.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:e.map((e,t)=>(0,H.jsxs)(`span`,{children:[t>0&&` · `,e.title,` © `,e.author,e.source&&(0,H.jsxs)(H.Fragment,{children:[` `,(0,H.jsx)(`a`,{href:e.source,target:`_blank`,rel:`noreferrer noopener`,className:`focus-ring underline underline-offset-2 hover:text-foreground`,children:new URL(e.source).hostname})]})]},e.id))})}function q({label:e,title:t,isActive:n,onSelect:i,children:a}){return(0,H.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"aria-label":e,title:t??e,onClick:i,className:s(`focus-ring group relative aspect-video overflow-hidden rounded-md border transition-colors`,n?`border-primary ring-1 ring-primary`:`border-border hover:border-muted-foreground/40`),children:[a,n&&(0,H.jsx)(`span`,{className:`absolute right-1 top-1 rounded-full bg-primary p-0.5 text-primary-foreground`,children:(0,H.jsx)(r,{className:`size-3`})})]})}function J({title:e,description:t}){return(0,H.jsxs)(`div`,{className:`mb-3`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold`,children:e}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]})}function Y({options:e,value:t,onChange:n}){return(0,H.jsx)(`div`,{role:`radiogroup`,className:`inline-flex flex-wrap gap-1 rounded-lg bg-muted p-1`,children:e.map(e=>{let r=e.id===t;return(0,H.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,title:e.title,onClick:()=>n(e.id),className:s(`focus-ring flex h-control items-center gap-2 rounded-md px-3 text-sm transition-colors`,r?`bg-card text-foreground shadow-elevation-1`:`text-muted-foreground hover:text-foreground`),children:[e.icon,e.label]},e.id)})})}function X(){return(0,H.jsxs)(`div`,{className:`mx-auto max-w-4xl`,children:[(0,H.jsx)(z,{className:`mb-6`,title:`Appearance`,onBack:B(),description:`Theme, colour scheme and density. Changes apply immediately and are remembered on this device.`}),(0,H.jsx)(W,{})]})}export{X as default};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{Wr as r,Xt as i,Yt as a,et as o}from"./ui-CDoK3F3U.js";import{t as s}from"./utils-2pl1SbIp.js";import{a as c,i as l,n as u,o as d,r as f,s as p,t as m}from"./document-open-mode-DoImW-xs.js";import{d as h,f as g,l as _,o as v,s as y,u as b}from"./use-menu-DIP1zh7I.js";import{t as x}from"./use-theme-DaxpiICf.js";import{Ct as S,St as C,a as w,c as T,d as E,f as D,i as O,l as k,m as A,n as j,o as M,p as N,r as P,s as F,t as I,u as L,xt as R}from"./index-AELn_vht.js";import{n as z}from"./page-header-DrDt1sQ2.js";import{t as B}from"./use-settings-back-DGmLAD63.js";var V=e(n(),1),H=t(),U={system:i,light:o,dark:a};function W(){let{theme:e,scheme:t,density:n,resolvedScheme:i,setTheme:a,setScheme:o,setDensity:w,reset:T}=x(),E=l(),O=u(),k=h(),j=p(),M=S(),P=g();return(0,H.jsxs)(`div`,{className:`space-y-8`,children:[(0,H.jsxs)(`section`,{children:[(0,H.jsx)(J,{title:`Theme`,description:`Palette, shape and typography. Each theme defines its own light and dark variants.`}),(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:A.map(t=>{let n=t.id===e;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>a(t.id),"aria-pressed":n,className:s(`focus-ring group flex flex-col gap-3 rounded-lg border p-4 text-left transition-colors`,n?`border-primary bg-accent`:`border-border hover:border-muted-foreground/40 hover:bg-accent/50`),children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium`,children:t.name}),n&&(0,H.jsx)(r,{className:`size-4 shrink-0 text-primary`})]}),(0,H.jsx)(`div`,{className:`flex gap-1.5`,"aria-hidden":!0,children:t.swatches.map(e=>(0,H.jsx)(`span`,{className:`size-6 rounded-full border border-border`,style:{backgroundColor:e}},e))}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.description})]},t.id)})})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(J,{title:`Colour scheme`,description:t===`system`?`Following your system setting, currently ${i}.`:`Overrides your system setting.`}),(0,H.jsx)(Y,{options:N.map(e=>{let t=U[e.id];return{id:e.id,label:e.name,icon:(0,H.jsx)(t,{className:`size-4 shrink-0`})}}),value:t,onChange:o})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(J,{title:`Density`,description:`Controls row height, hit-target size and shell spacing across the whole app.`}),(0,H.jsx)(Y,{options:D.map(e=>({id:e.id,label:e.name,title:e.description})),value:n,onChange:w}),(0,H.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:D.find(e=>e.id===n)?.description})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(J,{title:`Layout`,description:`How menus and content share the screen. Device-local, like the wallpaper.`}),(0,H.jsx)(Y,{options:y.map(e=>({id:e.id,label:e.name,title:e.description})),value:k,onChange:_}),(0,H.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:y.find(e=>e.id===k)?.description}),k===`strip`&&(0,H.jsxs)(`div`,{className:`mt-4`,children:[(0,H.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:`Navigation keys`}),(0,H.jsx)(Y,{options:v.map(e=>({id:e.id,label:e.name,title:e.description})),value:P,onChange:b}),(0,H.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[v.find(e=>e.id===P)?.description,` `,`Left and right walk the columns, up and down switch pin rows.`]})]})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(J,{title:`Tree style`,description:`How workspace and context trees are drawn in the menu. Device-local.`}),(0,H.jsx)(Y,{options:R.map(e=>({id:e.id,label:e.name,title:e.description})),value:M,onChange:C}),(0,H.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:R.find(e=>e.id===M)?.description})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(J,{title:`Open documents`,description:`Choose how documents open from lists, tiles and boards. Saved on this device.`}),(0,H.jsx)(Y,{options:[{id:`modal`,label:`Modal`},{id:`side`,label:`Side reading pane`}],value:O,onChange:m}),(0,H.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`The reading pane opens beside the content and updates as you select another document. On small screens it opens as a drawer.`})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(J,{title:`Always-on content area`,description:`Keep a reading pane beside document lists on tablets and desktops. Remember the selected item in each folder, or show the first available item.`}),(0,H.jsx)(Y,{options:[{id:`on`,label:`On`},{id:`off`,label:`Off`}],value:E?`on`:`off`,onChange:e=>f(e===`on`)}),(0,H.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`On by default. The reader uses roughly half the screen; drag its divider to resize. Phones keep tap-to-open navigation. When enabled, list selections use this pane regardless of the Open documents setting.`})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(J,{title:`Document tiles`,description:`Choose the photo and media layout for tile view. Saved on this device.`}),(0,H.jsx)(Y,{options:c,value:j,onChange:d})]}),(0,H.jsx)(G,{}),(0,H.jsx)(`section`,{children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>{T(),m(`modal`)},className:`focus-ring rounded-md text-sm text-muted-foreground underline-offset-4 hover:text-foreground hover:underline`,children:`Reset to defaults`})})]})}function G(){let[e,t]=(0,V.useState)(M),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(!0),[o,s]=(0,V.useState)(!1),c=(0,V.useRef)(!1);(0,V.useEffect)(()=>{let e=!1;return T().then(()=>{e||(t(M()),a(!1))}),()=>{e=!0}},[]);let l=async(e,n)=>{if(!c.current){c.current=!0,s(!0);try{let i=n?{...e,image:await F(n)}:e;await k(i),t(i),r(null)}catch(e){r(e instanceof Error&&e.name!==`QuotaExceededError`?e.message:`Could not store the wallpaper. Free some browser storage or try a smaller image.`)}finally{c.current=!1,s(!1)}}},u=t=>{t&&l(e,t)},d=e.image!==null&&P(e.image)===null,f=L(e.image);return(0,H.jsx)(`section`,{children:(0,H.jsxs)(`fieldset`,{disabled:i||o,className:`min-w-0`,children:[(0,H.jsx)(J,{title:`Wallpaper`,description:`Background image for the desk behind all panels. Without one, the theme's desk color shows (the default).`}),(0,H.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Wallpaper`,className:`grid grid-cols-3 gap-3 sm:grid-cols-4 lg:grid-cols-6`,children:[(0,H.jsx)(q,{label:`None`,isActive:e.image===null,onSelect:()=>l({...e,image:null}),children:(0,H.jsx)(`span`,{className:`flex size-full items-center justify-center surface-desk text-xs text-muted-foreground`,style:{backgroundImage:`none`},children:`None`})}),I.map(t=>(0,H.jsx)(q,{label:t.title,title:`${t.title} — suits the ${t.scheme} scheme`,isActive:P(e.image)===t.id,onSelect:()=>l({...e,image:O(t.id)}),children:(0,H.jsx)(`img`,{src:w(t),alt:``,loading:`lazy`,className:`size-full object-cover`,style:{backgroundColor:t.background}})},t.id)),d&&(0,H.jsx)(q,{label:`Your image`,isActive:!0,onSelect:()=>{},children:(0,H.jsx)(`img`,{src:e.image??void 0,alt:``,className:`size-full object-cover`})})]}),(0,H.jsx)(K,{}),(0,H.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`h-20 w-32 shrink-0 rounded-md border surface-desk`,style:f?{backgroundImage:f,backgroundSize:E(e.fit),backgroundPosition:`center`,backgroundRepeat:`no-repeat`}:void 0,"aria-hidden":!0}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsxs)(`label`,{className:`focus-ring inline-flex cursor-pointer items-center rounded-md border px-3 py-1.5 text-sm hover:bg-accent/50`,children:[d?`Change image…`:`Use your own image…`,(0,H.jsx)(`input`,{type:`file`,accept:`image/*,.gif`,className:`hidden`,onChange:e=>{u(e.target.files?.[0]),e.target.value=``}})]}),e.image&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>l({...e,image:null}),className:`focus-ring rounded-md border px-3 py-1.5 text-sm text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:`Remove`})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Images and animated GIFs up to 10 MB. Stored on this device.`}),(0,H.jsx)(Y,{options:j.map(e=>({id:e.id,label:e.label,title:e.description})),value:e.fit,onChange:t=>l({...e,fit:t})}),n&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:n}),o&&(0,H.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:`Saving wallpaper…`})]})]})]})})}function K(){let e=I.filter(e=>e.author!==`Canvas`);return e.length===0?null:(0,H.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:e.map((e,t)=>(0,H.jsxs)(`span`,{children:[t>0&&` · `,e.title,` © `,e.author,e.source&&(0,H.jsxs)(H.Fragment,{children:[` `,(0,H.jsx)(`a`,{href:e.source,target:`_blank`,rel:`noreferrer noopener`,className:`focus-ring underline underline-offset-2 hover:text-foreground`,children:new URL(e.source).hostname})]})]},e.id))})}function q({label:e,title:t,isActive:n,onSelect:i,children:a}){return(0,H.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"aria-label":e,title:t??e,onClick:i,className:s(`focus-ring group relative aspect-video overflow-hidden rounded-md border transition-colors`,n?`border-primary ring-1 ring-primary`:`border-border hover:border-muted-foreground/40`),children:[a,n&&(0,H.jsx)(`span`,{className:`absolute right-1 top-1 rounded-full bg-primary p-0.5 text-primary-foreground`,children:(0,H.jsx)(r,{className:`size-3`})})]})}function J({title:e,description:t}){return(0,H.jsxs)(`div`,{className:`mb-3`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold`,children:e}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]})}function Y({options:e,value:t,onChange:n}){return(0,H.jsx)(`div`,{role:`radiogroup`,className:`inline-flex flex-wrap gap-1 rounded-lg bg-muted p-1`,children:e.map(e=>{let r=e.id===t;return(0,H.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,title:e.title,onClick:()=>n(e.id),className:s(`focus-ring flex h-control items-center gap-2 rounded-md px-3 text-sm transition-colors`,r?`bg-card text-foreground shadow-elevation-1`:`text-muted-foreground hover:text-foreground`),children:[e.icon,e.label]},e.id)})})}function X(){return(0,H.jsxs)(`div`,{className:`mx-auto max-w-4xl`,children:[(0,H.jsx)(z,{className:`mb-6`,title:`Appearance`,onBack:B(),description:`Theme, colour scheme and density. Changes apply immediately and are remembered on this device.`}),(0,H.jsx)(W,{})]})}export{X as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{_ as r,r as i,v as a}from"./chunk-62JRHF6Z-vspAGgtK.js";import{t as o}from"./utils-2pl1SbIp.js";import{Cn as s,Nt as c}from"./workspace-BJELPCNs.js";import{p as l}from"./context-DZ1Hn7tt.js";import{t as u}from"./registry-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{_ as r,r as i,v as a}from"./chunk-62JRHF6Z-vspAGgtK.js";import{t as o}from"./utils-2pl1SbIp.js";import{Cn as s,Nt as c}from"./workspace-BJELPCNs.js";import{p as l}from"./context-DZ1Hn7tt.js";import{t as u}from"./registry-D1CIT_aZ.js";import{t as d}from"./applet-target-I8w6EPj0.js";var f=e(n(),1),p=t(),m=`universe`;function h(){let{appletId:e}=r(),[t,n]=a(),h=u.find(t=>t.id===e),g=t.get(`context`),_=t.get(`workspace`)||m,v=t.get(`path`)||`/`,y=t.get(`tree`)||`context`,b=t.get(`add`)===`1`,x=(0,f.useMemo)(()=>g?{mode:`context`,contextId:g}:{mode:`workspace`,workspaceName:_,path:v,treeName:y,treeType:s(y)},[g,_,v,y]),[S,C]=(0,f.useState)([]),[w,T]=(0,f.useState)([]);(0,f.useEffect)(()=>{c().then(C).catch(()=>C([])),l().then(T).catch(()=>T([]))},[]);let[E,D]=(0,f.useState)(v),[O,k]=(0,f.useState)(v);O!==v&&(k(v),D(v));let A=e=>{let r=new URLSearchParams(t);r.delete(`add`);for(let[t,n]of Object.entries(e))n===null?r.delete(t):r.set(t,n);n(r,{replace:!0})};if(!h)return(0,p.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-3 surface-desk`,children:[(0,p.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Unknown app`,e?` "${e}"`:``,`.`]}),(0,p.jsx)(`div`,{className:`flex gap-2`,children:u.map(e=>(0,p.jsx)(i,{to:`/apps/${e.id}`,className:`rounded-md border border-border px-3 py-1.5 text-sm hover:bg-muted`,children:e.label},e.id))})]});let j=g?`context`:`path`;return(0,p.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col surface-desk p-shell gap-shell`,children:[(0,p.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 rounded-xl border bg-card px-3 py-2 shadow-elevation-2`,children:[(0,p.jsx)(h.icon,{className:`h-4 w-4 text-muted-foreground`}),(0,p.jsx)(`span`,{className:`text-sm font-semibold`,children:h.label}),(0,p.jsx)(`div`,{className:`ml-2 flex overflow-hidden rounded-md border border-border`,children:[`path`,`context`].map(e=>(0,p.jsx)(`button`,{type:`button`,onClick:()=>{e!==j&&A(e===`path`?{context:null}:{context:w[0]?.id??``,workspace:null,path:null,tree:null})},className:o(`px-2.5 py-1 text-xs capitalize transition-colors`,j===e?`bg-foreground text-background`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:e},e))}),j===`path`?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`select`,{value:_,onChange:e=>A({workspace:e.target.value,path:`/`}),className:`h-7 rounded-md border border-input bg-transparent px-1.5 text-xs`,"aria-label":`Workspace`,children:[!S.some(e=>e.name===_)&&(0,p.jsx)(`option`,{value:_,children:_}),S.map(e=>(0,p.jsx)(`option`,{value:e.name,children:e.label||e.name},e.id))]}),(0,p.jsx)(`input`,{value:E,onChange:e=>D(e.target.value),onBlur:()=>{let e=E.trim()||`/`;e!==v&&A({path:e})},onKeyDown:e=>{e.key===`Enter`&&e.target.blur()},spellCheck:!1,placeholder:`/`,className:`h-7 w-40 rounded-md border border-input bg-transparent px-2 text-xs outline-none focus-visible:ring-1 focus-visible:ring-ring`,"aria-label":`Path`})]}):(0,p.jsxs)(`select`,{value:g??``,onChange:e=>A({context:e.target.value}),className:`h-7 max-w-56 rounded-md border border-input bg-transparent px-1.5 text-xs`,"aria-label":`Context`,children:[!g&&(0,p.jsx)(`option`,{value:``,children:`Pick a context…`}),w.map(e=>(0,p.jsxs)(`option`,{value:e.id,children:[e.id,e.url?` (${e.url})`:``]},e.id))]}),(0,p.jsx)(`div`,{className:`grow`})]}),(0,p.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border bg-card shadow-elevation-2`,children:j===`context`&&!g?(0,p.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-muted-foreground`,children:[`Pick a context above to bind `,h.label,` to it.`]}):(0,p.jsx)(d,{target:x,children:(0,p.jsx)(h.Component,{autoAdd:b},JSON.stringify(x))})})]})}export{h as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{h as r}from"./chunk-62JRHF6Z-vspAGgtK.js";import{Ct as i,Er as a,G as o,Jr as s,L as c,Lt as l,Pt as u,Rt as d,St as f,Vr as p,Wt as ee,X as m,Zr as h,bn as g,ct as _,hn as v,it as y,mt as b,ri as x,tt as S,xn as C,yn as w}from"./ui-CDoK3F3U.js";import{t as T}from"./utils-2pl1SbIp.js";import{An as E,Cn as D,Hn as O,K as te,zn as ne}from"./workspace-BJELPCNs.js";import{t as re}from"./TodosWidget-CYK5RbYD.js";import{d as ie,o as ae,u as oe}from"./ObjectPropertiesCard-BTTwYnN9.js";import{h as se,s as ce,t as le,u as ue}from"./document-list-CQ1_7Sja.js";import{n as de,r as fe}from"./use-toolbox-Ck_cLGgf.js";import{t as pe}from"./useToastHelpers-CRrpIIdY.js";import{n as me}from"./color-DFEH4BfK.js";import{t as k}from"./DocumentIcon-9i1uCMQa.js";import{r as he}from"./workspace-BydSRtST.js";import{t as ge}from"./registry-D1CIT_aZ.js";import{t as _e}from"./FileForm-C35drQ_R.js";import{t as ve}from"./applet-target-I8w6EPj0.js";var A=e(n(),1);function j(e){let{pathname:t}=r(),n=fe()?.setAgentView,i=JSON.stringify(e);(0,A.useEffect)(()=>(n?.({pathname:t,view:JSON.parse(i)}),()=>n?.(null)),[t,i,n])}function M(e,t,n,r){return structuredClone({...e,query:he(t,n,r),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone})}var N=t();function ye({target:e,children:t}){let[n,r]=(0,A.useState)([]),i=(0,A.useRef)(!1),[a,o]=(0,A.useState)(!1),[s,c]=(0,A.useState)(!1),[l,u]=(0,A.useState)(null),{showErrorToast:d}=pe();return(0,N.jsxs)(`div`,{className:`relative flex flex-col h-full min-h-0 bg-background ${a?`ring-2 ring-inset ring-primary`:``}`,onDragOverCapture:t=>{s||!e||!Array.from(t.dataTransfer.types).includes(`Files`)||(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=i.current?`none`:`copy`,o(!i.current))},onDragLeaveCapture:e=>{e.currentTarget.contains(e.relatedTarget)||o(!1)},onDropCapture:t=>{if(s||!e||!Array.from(t.dataTransfer.types).includes(`Files`))return;if(t.preventDefault(),t.stopPropagation(),o(!1),i.current){d(`Wait for the current upload to finish`);return}let n=Array.from(t.dataTransfer.files);if(!n.length){d(`Drop files rather than folders`);return}r(n),u(e),c(!0)},children:[t,a&&(0,N.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 z-30 flex items-center justify-center bg-background/80 text-sm font-medium`,children:[`Drop files to upload to `,e?.mode===`workspace`?e.path:`this context`]}),s&&(0,N.jsxs)(ue,{label:`Import files`,onClose:()=>{i.current||c(!1)},children:[(0,N.jsx)(`h2`,{className:`border-b px-4 py-3 text-sm font-medium`,children:`Import files`}),(0,N.jsx)(_e,{target:l,initialFiles:n,onClose:()=>c(!1),onBusyChange:e=>{i.current=e}})]})]})}function P({navigationTabs:e,navigationActions:t,onBack:n,accentColor:r,frameContent:a=!0,urlType:s,urlDisplay:c,contextPath:u,treeName:f,workspaceId:p,workspaceLabel:ee,workspaceIcon:h,documentSchema:_,documents:v,isLoading:y,totalCount:S,currentPage:C,pageSize:w,onPageChange:T,onPageSizeChange:E,onRemoveDocument:O,onDeleteDocument:te,onDestroyDocument:ne,onRemoveDocuments:re,onDeleteDocuments:ce,onDestroyDocuments:ue,onCopyDocuments:fe,onCutDocuments:pe,onPasteDocuments:me,onImportDocuments:k,onSelectionChange:he,pastedDocumentIds:ge,onPurgeDocuments:_e,disablePurgeDocuments:ve,canvasInfo:j,isCanvasPinned:M,onTogglePinCanvas:P,onSaveAsCanvas:F,onShareCanvas:I,onUnshareCanvas:L,onDeleteCanvas:R,isSharingCanvas:z,isDeletingCanvas:B,isCanvasShared:V,isCanvasLocked:H,backendSearchQueries:U,onBackendSearch:W,onRemoveBackendQuery:G,serverSort:be,onServerSortChange:xe,scope:K,onScopeChange:q,canSaveChanges:J,isSavingChanges:Y,onSaveChanges:X,onBrowseWorkspaces:Se,onBrowseTree:Ce,onNavigatePath:we,linkTree:Te,children:Z,contentBanner:Ee,folders:De,onOpenFolder:Oe}){let ke=s===`canvas`,Q=se(),{state:Ae,toggleView:je,hasActiveFilters:Me,openAddPicker:Ne}=de(),$=ae(),[Pe,Fe]=(0,A.useState)(``),Ie=JSON.stringify([p,f,u,_]),[Le,Re]=(0,A.useState)(Ie);Le!==Ie&&(Re(Ie),Fe(``));let ze=(0,N.jsxs)(N.Fragment,{children:[t,F&&(0,N.jsx)(`button`,{type:`button`,onClick:F,title:`Save as canvas`,"aria-label":`Save as canvas`,className:`flex h-control-sm w-control-sm shrink-0 items-center justify-center rounded-md border text-muted-foreground hover:bg-accent touch-target`,children:(0,N.jsx)(x,{className:`h-4 w-4`})})]});return(0,N.jsxs)(ye,{target:k&&p?{mode:`workspace`,workspaceName:p,path:u,treeName:f||`context`,treeType:D(f)}:null,children:[e&&!Q&&(0,N.jsx)(ie,{accentColor:r,children:e}),(0,N.jsxs)(`div`,{className:`canvas-surface-body${a&&!Q?` is-framed`:``}`,children:[(0,N.jsx)(oe,{workspaceIcon:h,workspace:ee||p||c.split(`://`)[0]||`Workspace`,actions:Q&&e?(0,N.jsxs)(`details`,{className:`relative shrink-0`,"aria-label":`Canvas views`,children:[(0,N.jsx)(`summary`,{className:`cursor-pointer rounded-md border px-2 py-1 text-xs`,title:`Choose or manage content views`,children:`Views`}),(0,N.jsx)(`div`,{className:`absolute right-0 top-full z-30 mt-2 min-w-64 max-w-[80vw] rounded-md border bg-background p-2 shadow-lg`,children:e})]}):void 0,tree:f?`${f}${s.endsWith(`-layer`)?`:layer`:``}`:s.replace(`-layer`,``),path:u,accentColor:r,onBack:$.location?$.location.section===`view`?$.close:()=>$.update?.({section:`view`}):n,section:$.location?`document/${$.location.documentId}/${$.location.section}`:void 0,onSection:$.location?()=>$.update?.({section:`view`}):void 0,onBrowseWorkspaces:Se,onBrowseTree:Ce,onNavigatePath:we,onFilter:()=>je(`tools`),filtersActive:Me,filtersOpen:Ae.t1Open&&Ae.t1View===`tools`,onAdd:e=>Ne({modal:e.shiftKey,fresh:!0}),search:W||!Z?{workspaceId:p,queries:U||[],onSearch:W??Fe,localOnly:!W,onRemoveQuery:G,scope:K,onScopeChange:q}:void 0,onDraftChange:Z?void 0:Fe}),ke&&j?(0,N.jsx)(N.Fragment,{children:(0,N.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2.5 border-b bg-muted/20 shrink-0 min-w-0`,children:[j.color&&(0,N.jsx)(`div`,{className:`w-1 h-6 rounded-full shrink-0`,style:{backgroundColor:j.color}}),(0,N.jsx)(g,{className:`w-4 h-4 shrink-0 text-primary`}),(0,N.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,N.jsx)(`span`,{className:`text-lg font-semibold leading-tight truncate`,children:j.label||c.split(`://`)[1]||`Canvas`}),j.description&&(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground truncate leading-tight`,children:j.description})]}),J&&X&&(0,N.jsxs)(`button`,{type:`button`,onClick:X,disabled:Y,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 text-xs border rounded-md hover:bg-accent transition-colors text-muted-foreground hover:text-foreground disabled:opacity-50`,title:`Save filters`,children:[(0,N.jsx)(i,{className:`w-3 h-3`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:Y?`Saving...`:`Save filters`})]}),P&&(0,N.jsxs)(`button`,{type:`button`,onClick:P,"aria-pressed":!!M,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 text-xs border rounded-md hover:bg-accent transition-colors text-muted-foreground hover:text-foreground`,title:M?`Unpin from home`:`Pin to home`,children:[M?(0,N.jsx)(d,{className:`w-3 h-3`}):(0,N.jsx)(l,{className:`w-3 h-3`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:M?`Unpin`:`Pin`})]}),I&&(0,N.jsxs)(`button`,{type:`button`,onClick:I,disabled:z||B,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 text-xs border rounded-md hover:bg-accent transition-colors text-muted-foreground hover:text-foreground disabled:opacity-50`,title:V?`Copy public link`:`Share canvas`,children:[(0,N.jsx)(b,{className:`w-3 h-3`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:z?`Sharing...`:V?`Copy link`:`Share`})]}),V&&L&&(0,N.jsxs)(`button`,{type:`button`,onClick:L,disabled:z||B,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 text-xs border rounded-md hover:bg-destructive/10 transition-colors text-muted-foreground hover:text-destructive disabled:opacity-50`,children:[(0,N.jsx)(o,{className:`w-3 h-3`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:`Unshare`})]}),R&&(0,N.jsxs)(`button`,{type:`button`,onClick:R,disabled:B||H&&!V,title:H&&!V?`Unlock this canvas before deleting it`:`Delete canvas`,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 text-xs border rounded-md hover:bg-destructive/10 transition-colors text-muted-foreground hover:text-destructive disabled:opacity-50`,children:[(0,N.jsx)(m,{className:`w-3 h-3`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:B?`Deleting…`:`Delete`})]})]})}):null,Z&&(F||t)&&(0,N.jsx)(`div`,{className:`flex items-center gap-2 border-b px-3 py-1`,children:ze}),(0,N.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:[Ee,Z||(0,N.jsx)(le,{readingPane:!0,externalSearchQuery:Pe,toolbarActions:ze,documents:_?v.filter(e=>e.schema===_):v,isLoading:y,folders:_?void 0:De,onOpenFolder:Oe,contextPath:u,treeName:f,workspaceId:p,totalCount:S,viewMode:_?`card`:`table`,allowViewToggle:!0,currentPage:C,pageSize:w,onPageChange:T,onPageSizeChange:E,onRemoveDocument:O,onDeleteDocument:te,onDestroyDocument:ne,onRemoveDocuments:re,onDeleteDocuments:ce,onDestroyDocuments:ue,onCopyDocuments:fe,onCutDocuments:pe,onPasteDocuments:me,onImportDocuments:k,onSelectionChange:he,pastedDocumentIds:ge,onPurgeDocuments:_?void 0:_e,disablePurgeDocuments:ve,backendSearchQueries:U,onBackendSearch:W,serverSort:be,onServerSortChange:xe,onRemoveBackendQuery:G,scope:K,onScopeChange:q,canSaveChanges:!ke&&J,isSavingChanges:Y,onSaveChanges:X,linkTree:Te},_??`documents`)]})]})]})}var F=[{id:`todos`,label:`Todo list`},{id:`todo-app`,label:`Todo App`},{id:`notes`,label:`Notes list`},{id:`notes-app`,label:`Notes App`},{id:`calendar`,label:`Calendar`},{id:`apps`,label:`Apps`},{id:`sketch`,label:`Sketch`},{id:`terminal`,label:`Terminal`}];function I(e){return e?.kind===`app`&&e.app===`notes`?`data/schema/note`:void 0}var L={id:`default`,name:`All`,kind:`documents`};function R(){return[{id:`emails`,label:`Emails`,schemas:[`data/schema/message`]},{id:`todos`,label:`Todos`,schemas:[`data/schema/task`]},{id:`notes`,label:`Notes`,schemas:[`data/schema/note`]},{id:`links`,label:`Links`,schemas:[`data/schema/tab`,`data/schema/link`]},{id:`files`,label:`Files`,schemas:[`data/schema/file`]}]}function z(e){let t=e?.views;if(!Array.isArray(t))return[L];let n=t.filter(e=>{let t=e;return!t||typeof t.id!=`string`||typeof t.name!=`string`?!1:t.kind===`documents`||t.kind===`columns`||t.kind===`app`&&(F.some(e=>e.id===t.app)||t.app===`filters`||t.app===`lens`)});return n.length>0?n:[L]}var B={todos:v,"todo-app":v,notes:S,"notes-app":S,calendar:s,filters:_,sketch:h,terminal:y,lens:f,apps:C};function V({views:e,activeId:t,onSelect:n,onSave:r,readOnly:i=!1,className:o,accentColor:s,onOpenToSide:l}){let[d,f]=(0,A.useState)(null),[p,m]=(0,A.useState)(``),[h,g]=(0,A.useState)(!1),[_,v]=(0,A.useState)(null),[y,b]=(0,A.useState)(null),x=(0,A.useRef)(null);(0,A.useEffect)(()=>{let e=x.current;if(!e)return;let t=t=>{if(t.ctrlKey||e.scrollWidth<=e.clientWidth)return;let n=Math.abs(t.deltaX)>Math.abs(t.deltaY)?t.deltaX:t.deltaY,r=t.deltaMode===1?16:t.deltaMode===2?e.clientWidth:1;t.preventDefault(),e.scrollLeft+=n*r};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]),(0,A.useEffect)(()=>{x.current?.querySelector(`[aria-pressed="true"], input`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[t,d]);let S=()=>{v(null),b(null)},C=()=>{if(_&&y&&_!==y.id){let t=e.find(e=>e.id===_),n=e.filter(e=>e.id!==_),i=n.findIndex(e=>e.id===y.id);t&&i>=0&&(n.splice(y.before?i:i+1,0,t),n.some((t,n)=>t.id!==e[n].id)&&r(n))}S()},E=()=>{if(!d)return;let t=p.trim();t&&r(e.map(e=>e.id===d?{...e,name:t}:e)),f(null)},D=(t,n)=>{g(!1);let i=`view-${Date.now().toString(36)}`,a=t===`columns`?`Board`:t===`app`?F.find(e=>e.id===n)?.label??`App`:`List`,o=t===`columns`?{id:i,name:a,kind:t,columns:R()}:t===`app`?{id:i,name:a,kind:t,app:n}:{id:i,name:a,kind:t};r([...e,o],i),f(i),m(a)},O=n=>{let i=e.filter(e=>e.id!==n);r(i.length>0?i:[L],n===t?i[0]?.id??L.id:void 0)};return(0,N.jsxs)(`div`,{className:T(`relative flex h-full min-w-0 items-end`,o),children:[(0,N.jsx)(`div`,{ref:x,className:`flex min-w-0 items-end gap-0.5 overflow-x-auto overscroll-x-contain pt-1 [scrollbar-width:none]`,children:e.map(r=>{let o=r.id===t,u=r.kind===`columns`?a:r.kind===`app`&&r.app?B[r.app]:w;return d===r.id?(0,N.jsx)(`input`,{autoFocus:!0,"aria-label":`Tab name`,value:p,onChange:e=>m(e.target.value),onBlur:E,onKeyDown:e=>{e.key===`Enter`&&E(),e.key===`Escape`&&f(null)},className:T(`relative h-[2.3rem] w-28 shrink-0 rounded-t-[.5rem] border-0 px-3 pb-1 text-xs outline-none ring-0`,o?T(`z-[2] bg-background font-medium`,s?me(s):`text-foreground`):`bg-muted text-muted-foreground`),style:{backgroundColor:o?s:void 0}},r.id):(0,N.jsxs)(`button`,{type:`button`,"aria-pressed":o,onClick:()=>n(r.id),onDoubleClick:()=>{i||(f(r.id),m(r.name))},title:i?r.name:`${r.name}: double-click to rename, drag to reorder`,draggable:!i,onDragStart:e=>{e.dataTransfer.setData(`text/plain`,r.name),e.dataTransfer.effectAllowed=`move`,v(r.id)},onDragOver:e=>{if(!_||_===r.id)return;e.preventDefault(),e.dataTransfer.dropEffect=`move`;let t=e.currentTarget.getBoundingClientRect(),n=e.clientX<t.left+t.width/2;b(e=>e?.id===r.id&&e.before===n?e:{id:r.id,before:n})},onDrop:e=>{e.preventDefault(),C()},onDragEnd:S,className:T(`group relative flex h-[2.3rem] shrink-0 items-center gap-1.5 rounded-t-[.5rem] border-0 px-3 pb-1 text-xs transition-colors`,o?T(`z-[2] bg-background font-medium`,s?me(s):`text-foreground`):`bg-muted text-muted-foreground hover:bg-accent hover:text-foreground`,_===r.id&&`opacity-50`),style:{backgroundColor:o?s:void 0,boxShadow:y?.id===r.id?`inset ${y.before?`2px`:`-2px`} 0 0 var(--primary)`:void 0},children:[(0,N.jsx)(u,{className:`h-3 w-3 shrink-0`}),(0,N.jsx)(`span`,{className:`max-w-32 truncate`,children:r.name}),l&&(0,N.jsx)(ee,{className:`h-3 w-3 shrink-0 opacity-0 transition-opacity hover:opacity-100 group-hover:opacity-60`,"aria-label":`Open to the side`,onClick:e=>{e.stopPropagation(),l(r.id)}}),!i&&e.length>1&&(0,N.jsx)(c,{className:T(`h-3 w-3 shrink-0 transition-opacity hover:text-destructive`,o?`opacity-60 hover:opacity-100`:`opacity-0 group-hover:opacity-100`),onClick:e=>{e.stopPropagation(),O(r.id)}})]},r.id)})}),!i&&(h?(0,N.jsxs)(`span`,{className:`absolute left-0 top-full z-30 flex w-full min-w-64 flex-wrap items-center gap-2 rounded-b-xl border bg-card p-2 shadow-lg`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>D(`documents`),className:`flex h-10 items-center gap-1.5 rounded-md border px-2 text-xs text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:[(0,N.jsx)(w,{className:`h-3 w-3`}),` List`]}),(0,N.jsxs)(`button`,{type:`button`,onClick:()=>D(`columns`),className:`flex h-10 items-center gap-1.5 rounded-md border px-2 text-xs text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:[(0,N.jsx)(a,{className:`h-3 w-3`}),` Board`]}),F.map(e=>{let t=B[e.id];return(0,N.jsxs)(`button`,{type:`button`,onClick:()=>D(`app`,e.id),className:`flex h-10 items-center gap-1.5 rounded-md border px-2 text-xs text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:[(0,N.jsx)(t,{className:`h-3 w-3`}),` `,e.label]},e.id)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>g(!1),className:`p-1 text-muted-foreground hover:text-foreground`,"aria-label":`Cancel`,children:(0,N.jsx)(c,{className:`h-3 w-3`})})]}):(0,N.jsx)(`button`,{type:`button`,onClick:()=>g(!0),title:`Add view`,"aria-label":`Add view`,className:`relative ml-1 flex h-[2.3rem] w-10 shrink-0 items-center justify-center rounded-md pb-1 text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:(0,N.jsx)(u,{className:`h-3.5 w-3.5`})}))]})}var H=[{id:`emails`,label:`Emails`,schemas:[`data/schema/message`]},{id:`todos`,label:`Todos`,schemas:[`data/schema/task`]},{id:`notes`,label:`Notes`,schemas:[`data/schema/note`]},{id:`links`,label:`Links`,schemas:[`data/schema/tab`,`data/schema/link`]},{id:`files`,label:`Files`,schemas:[`data/schema/file`]}];function U(e,t){return t.some(t=>e.schema===t||e.schema.startsWith(`${t}/`))}function W({documents:e,workspaceId:t,columns:n,onColumnsChange:r,readOnly:i=!1}){let[a,o]=(0,A.useState)(null),[s,l]=(0,A.useState)(!1),[d,f]=(0,A.useState)({}),[ee,m]=(0,A.useState)({}),h=(0,A.useRef)(null),[g,_]=(0,A.useState)(!1),v=(0,A.useCallback)(()=>{let e=h.current;e&&_(e.scrollWidth-e.clientWidth-e.scrollLeft>8)},[]);(0,A.useEffect)(()=>{let e=h.current;if(!e)return;let t=new ResizeObserver(()=>v());return t.observe(e),()=>t.disconnect()},[v]);let y=(e,t)=>{e.preventDefault();let i=e.currentTarget.parentElement;if(!i)return;let a=e.clientX,o=i.getBoundingClientRect().width,s=o,c=e=>{s=Math.min(900,Math.max(220,o+e.clientX-a)),m(e=>({...e,[t]:s}))},l=()=>{window.removeEventListener(`pointermove`,c),window.removeEventListener(`pointerup`,l),r(n.map(e=>e.id===t?{...e,width:Math.round(s)}:e))};window.addEventListener(`pointermove`,c),window.addEventListener(`pointerup`,l)},b=e=>{m(t=>{let n={...t};return delete n[e],n}),r(n.map(t=>t.id===e?{...t,width:void 0}:t))},x=e=>{let t=d[e];if(t===void 0)return;let i=n.find(t=>t.id===e);i&&(i.filter||``)!==t&&r(n.map(n=>n.id===e?{...n,filter:t||void 0}:n))},S=H.filter(e=>!n.some(t=>t.id===e.id));return(0,N.jsxs)(`div`,{className:`relative h-full`,children:[(0,N.jsx)(`div`,{ref:h,onScroll:v,className:`flex h-full snap-x snap-mandatory gap-3 overflow-x-auto overscroll-x-contain p-2`,"data-testid":`schema-columns-board`,children:n.map(t=>{let a=(d[t.id]??t.filter??``).toLowerCase(),s=e.filter(e=>U(e,t.schemas)).filter(e=>{if(!a)return!0;let t=E(e);return`${t.title}\n${t.preview}\n${t.subtitle}`.toLowerCase().includes(a)}),l=ee[t.id]??t.width;return(0,N.jsxs)(`div`,{className:`relative flex h-full min-h-0 min-w-0 shrink-0 grow-0 basis-full snap-start flex-col rounded-(--card-radius) border bg-muted/20 ${l?`sm:basis-[var(--col-w)]`:`sm:basis-[48%] lg:basis-[32%] xl:basis-[24%]`}`,style:l?{"--col-w":`${l}px`}:void 0,children:[!i&&(0,N.jsx)(`div`,{onPointerDown:e=>y(e,t.id),onDoubleClick:()=>b(t.id),title:`Drag to resize; double-click to reset`,className:`absolute right-0 inset-y-0 z-10 w-2 cursor-col-resize touch-none rounded-r-lg transition-colors hover:bg-primary/25 active:bg-primary/40 max-sm:hidden`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2 px-3 pb-1 pt-2.5 max-sm:pr-10`,children:[(0,N.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t.label}),(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s.length}),(0,N.jsx)(`span`,{className:`flex-1`}),!i&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>r(n.filter(e=>e.id!==t.id)),title:`Remove column`,className:`rounded-sm p-0.5 text-muted-foreground hover:text-destructive`,children:(0,N.jsx)(c,{className:`h-3.5 w-3.5`})})]}),(0,N.jsx)(`div`,{className:`px-3 pb-2`,children:(0,N.jsx)(`input`,{value:d[t.id]??t.filter??``,onChange:e=>f(n=>({...n,[t.id]:e.target.value})),onBlur:()=>x(t.id),onKeyDown:e=>{e.key===`Enter`&&x(t.id)},placeholder:`Filter…`,readOnly:i,className:`h-7 w-full rounded-md border border-input bg-background px-2 text-xs placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`})}),(0,N.jsxs)(`div`,{className:`flex-1 space-y-1.5 overflow-y-auto px-2 pb-2`,children:[s.map(e=>{let t=E(e);return(0,N.jsxs)(`button`,{type:`button`,onClick:()=>o(e),className:`w-full min-w-0 rounded-md border bg-card px-2.5 py-2 text-left transition-colors hover:bg-accent/50`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(k,{document:e,size:3.5}),(0,N.jsx)(`span`,{className:`truncate text-xs font-medium`,title:t.title,children:t.title})]}),t.preview&&(0,N.jsx)(`p`,{className:`mt-1 line-clamp-2 break-words text-[11px] leading-snug text-muted-foreground`,children:t.preview}),(0,N.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground/70`,children:new Date(e.updatedAt||e.createdAt).toLocaleDateString()})]},e.id)}),s.length===0&&(0,N.jsx)(`p`,{className:`px-2 py-3 text-center text-xs text-muted-foreground/60`,children:`Empty`})]})]},t.id)})}),(!i&&S.length>0||g)&&(0,N.jsxs)(`div`,{className:`pointer-events-none absolute inset-y-0 right-0 z-20 flex w-7 flex-col items-end bg-gradient-to-l from-background via-background/60 to-transparent py-2`,children:[!i&&S.length>0&&(0,N.jsxs)(`div`,{className:`pointer-events-auto relative`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),title:`Add column`,"aria-label":`Add column`,className:`flex h-7 w-6 items-center justify-center rounded-l-md border border-r-0 bg-background text-muted-foreground shadow-elevation-1 hover:bg-accent hover:text-foreground`,children:(0,N.jsx)(u,{className:`h-3.5 w-3.5`})}),s&&(0,N.jsxs)(`div`,{className:`absolute right-0 top-8 w-44 rounded-lg border bg-background p-2 shadow-elevation-2`,children:[(0,N.jsx)(`p`,{className:`px-2 pb-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:`Add column`}),S.map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>{l(!1),r([...n,{...e}])},className:`w-full rounded-md px-2 py-1.5 text-left text-xs text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:e.label},e.id)),(0,N.jsx)(`button`,{type:`button`,onClick:()=>l(!1),className:`mt-1 w-full rounded-md px-2 py-1.5 text-left text-xs text-muted-foreground/60 hover:bg-accent/50`,children:`Cancel`})]})]}),g&&(0,N.jsx)(p,{className:`my-auto h-4 w-4 self-center text-muted-foreground/70`,"aria-label":`More columns`})]}),(0,N.jsx)(ce,{document:a,isOpen:a!==null,onClose:()=>o(null),workspaceId:t})]})}function G(e,t,n,r,i){let a=`${e}\0${t}\0${n}\0${r.join(`,`)}\0${i??``}`,[o,s]=(0,A.useState)(0),[c,l]=(0,A.useState)(null);(0,A.useEffect)(()=>{let o=!1;return te(e,n,t,{limit:200,allOf:r,...i?{sortBy:i,order:`asc`}:{}}).then(e=>{o||l({key:a,docs:e.payload||[]})}).catch(()=>{o||l({key:a,docs:[]})}),()=>{o=!0}},[a,o]);let u=c?.key===a?c.docs:[],d=c?.key!==a;return(0,A.useEffect)(()=>{let e=()=>s(e=>e+1);return window.addEventListener(`workspace:documents:refresh`,e),()=>window.removeEventListener(`workspace:documents:refresh`,e)},[]),{docs:u,isLoading:d,refresh:(0,A.useCallback)(()=>s(e=>e+1),[])}}function be({workspaceId:e,treeName:t,path:n}){let{docs:r,isLoading:i,refresh:a}=G(e,t,n,[O],`tasks`),[o,s]=(0,A.useState)(!1),c=o?r.filter(e=>e.data?.status!==`completed`):r,l=r.filter(e=>{let t=e.data?.status;return t!==`completed`&&t!==`cancelled`}).length;return(0,N.jsxs)(`div`,{className:`mx-auto flex h-full w-full max-w-3xl flex-col p-4`,children:[(0,N.jsxs)(`div`,{className:`mb-2 flex shrink-0 items-center justify-between gap-2`,children:[(0,N.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[l,` open`]}),(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),`hide done`]})]}),(0,N.jsx)(`div`,{className:`min-h-0 flex-1 space-y-1 overflow-y-auto`,children:i?(0,N.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`Loading…`}):c.length===0?(0,N.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`No todos here.`}):c.map(t=>(0,N.jsx)(re,{doc:t,workspaceId:e,readOnly:!1,onChanged:a},t.id))})]})}var xe=[ne,`data/type/webapp`],K=`Other`;function q({workspaceId:e,treeName:t,path:n}){let{docs:r,isLoading:i}=G(e,t,n,xe),a=(0,A.useMemo)(()=>{let e=new Map;for(let t of r){let n=String(t.data?.category??``).trim(),r=n?n.toLowerCase():``,i=e.get(r)??[];i.push(t),e.set(r,i)}return[...e.entries()].map(([e,t])=>({key:e,label:e?String(t[0].data.category).trim():K,items:t.sort((e,t)=>Y(e).localeCompare(Y(t)))})).sort((e,t)=>!e.key-+!t.key||e.label.localeCompare(t.label))},[r]);return(0,N.jsx)(`div`,{className:`mx-auto h-full w-full max-w-5xl overflow-y-auto p-4`,children:i?(0,N.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`Loading…`}):a.length===0?(0,N.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`No web apps here. Add a link and tick “Web app”.`}):a.map(e=>(0,N.jsxs)(`section`,{className:`mb-6`,children:[(0,N.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:e.label}),(0,N.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(7rem,1fr))] gap-3`,children:e.items.map(e=>(0,N.jsx)(X,{doc:e},e.id))})]},e.key||K))})}function J(e){return String(e.data?.uri??``)}function Y(e){let t=String(e.data?.label??``).trim();if(t)return t;try{return new URL(J(e)).hostname.replace(/^www\./,``)}catch{return J(e)}}function X({doc:e}){let t=Y(e);return(0,N.jsxs)(`a`,{href:J(e),target:`_blank`,rel:`noopener noreferrer`,title:J(e),className:`flex flex-col items-center gap-2 rounded-lg border border-border bg-card p-3 text-center outline-none transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,N.jsx)(`span`,{className:`flex h-10 w-10 items-center justify-center rounded-md bg-primary/10 text-lg font-semibold text-primary`,children:t.charAt(0).toUpperCase()}),(0,N.jsx)(`span`,{className:`w-full truncate text-xs text-foreground`,children:t})]})}function Se({app:e,contextId:t,...n}){let r=t&&e!==`lens`?{mode:`context`,contextId:t}:{mode:`workspace`,workspaceName:n.workspaceId,treeName:n.treeName,path:n.path,treeType:D(n.treeName)},i=e===`todo-app`?`todo`:e===`notes-app`?`notes`:e,a=ge.find(e=>e.id===i);return(0,N.jsx)(ve,{target:r,children:e===`todos`?(0,N.jsx)(be,{...n}):e===`apps`?(0,N.jsx)(q,{...n}):a?(0,N.jsx)(a.Component,{}):null})}export{I as a,M as c,L as i,j as l,W as n,z as o,V as r,P as s,Se as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{r}from"./chunk-62JRHF6Z-vspAGgtK.js";import{Hn as i,Qt as a,Rt as o,Zt as s,an as c,bn as l,mr as u}from"./ui-CDoK3F3U.js";import{V as d,st as f}from"./workspace-BJELPCNs.js";import{n as p,r as m}from"./use-canvas-pins-DkWN9oEd.js";import{t as h}from"./useToastHelpers-CRrpIIdY.js";import{h as g}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{r}from"./chunk-62JRHF6Z-vspAGgtK.js";import{Hn as i,Qt as a,Rt as o,Zt as s,an as c,bn as l,mr as u}from"./ui-CDoK3F3U.js";import{V as d,st as f}from"./workspace-BJELPCNs.js";import{n as p,r as m}from"./use-canvas-pins-DkWN9oEd.js";import{t as h}from"./useToastHelpers-CRrpIIdY.js";import{h as g}from"./index-AELn_vht.js";import{t as _}from"./HomeFab-DtUgQqjj.js";var v=e(n(),1),y=t();function b(e){let t=`${e.workspaceName}\0${e.treeName}\0${e.path}`,[n,r]=(0,v.useState)(null);return(0,v.useEffect)(()=>{let n=!1;return f(e.workspaceName,e.treeName).then(i=>{n||r({key:t,node:d(i,e.path)})}).catch(()=>{n||r({key:t,node:null})}),()=>{n=!0}},[t,e.workspaceName,e.treeName,e.path]),!n||n.key!==t?{state:`loading`}:n.node?{state:`ready`,node:n.node}:{state:`missing`}}function x(e){let t=`/workspaces/${encodeURIComponent(e.workspaceName)}`,n=e.path.replace(/^\//,``);return e.treeName===`context`?`${t}/path/${n}`:`${t}/trees/${encodeURIComponent(e.treeName)}/path/${n}`}var S=`application/x-canvas-pin`;function C({pin:e,onUnpin:t,onMinimize:n,onDropPin:d}){let f=b(e),[p,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(null),C=!!d&&!p,w=e=>{let t=e.currentTarget.getBoundingClientRect();return e.clientX>t.left+t.width/2?`after`:`before`},T=C?{onDragOver:e=>{e.dataTransfer.types.includes(`application/x-canvas-pin`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,_(w(e)))},onDragLeave:()=>_(null),onDrop:t=>{let n=t.dataTransfer.getData(S);_(null),!(!n||n===e.id)&&(t.preventDefault(),d?.(n,w(t)===`after`))}}:{},E=f.state===`ready`?f.node:null,D=E?.label||e.label||e.path.split(`/`).filter(Boolean).pop()||`Canvas`,O=E?.color;return(0,v.useEffect)(()=>{if(!p)return;let e=e=>{e.key===`Escape`&&h(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p]),(0,y.jsxs)(`section`,{...T,className:p?`fixed inset-0 z-picker flex flex-col bg-background`:`flex flex-col rounded-(--card-radius) border bg-background overflow-hidden min-h-0 min-w-0 ${g?`ring-2 ring-primary/60`:``}`,children:[(0,y.jsxs)(`header`,{draggable:C,onDragStart:C?t=>{t.dataTransfer.setData(S,e.id),t.dataTransfer.effectAllowed=`move`}:void 0,className:`flex items-center gap-2 px-3 py-2 border-b bg-muted/20 shrink-0 min-w-0 ${C?`cursor-grab active:cursor-grabbing`:``}`,children:[C&&(0,y.jsx)(i,{className:`w-3.5 h-3.5 shrink-0 text-muted-foreground/60`,"aria-hidden":!0}),O&&(0,y.jsx)(`div`,{className:`w-1 h-5 rounded-full shrink-0`,style:{backgroundColor:O}}),(0,y.jsx)(l,{className:`w-4 h-4 shrink-0 text-primary`}),(0,y.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,y.jsx)(`span`,{className:`text-sm font-semibold leading-tight truncate`,children:D}),(0,y.jsxs)(`span`,{className:`text-[11px] text-muted-foreground truncate leading-tight font-mono`,children:[e.workspaceName,`://`,e.path.replace(/^\//,``)]})]}),n&&(0,y.jsx)(`button`,{type:`button`,onClick:n,title:`Minimize to tab bar`,"aria-label":`Minimize to tab bar`,className:`shrink-0 flex items-center justify-center w-7 h-7 rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:(0,y.jsx)(s,{className:`w-3.5 h-3.5`})}),(0,y.jsx)(`button`,{type:`button`,onClick:()=>h(e=>!e),"aria-pressed":p,title:p?`Restore tile (Esc)`:`Fill view area`,"aria-label":p?`Restore tile`:`Fill view area`,className:`shrink-0 flex items-center justify-center w-7 h-7 rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:p?(0,y.jsx)(a,{className:`w-3.5 h-3.5`}):(0,y.jsx)(c,{className:`w-3.5 h-3.5`})}),(0,y.jsx)(r,{to:x(e),title:`Open in workspace`,"aria-label":`Open in workspace`,className:`shrink-0 flex items-center justify-center w-7 h-7 rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:(0,y.jsx)(u,{className:`w-3.5 h-3.5`})}),(0,y.jsx)(`button`,{type:`button`,onClick:t,title:`Unpin from home`,"aria-label":`Unpin from home`,className:`shrink-0 flex items-center justify-center w-7 h-7 rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive transition-colors`,children:(0,y.jsx)(o,{className:`w-3.5 h-3.5`})})]}),(0,y.jsxs)(`div`,{className:`flex-1 min-h-0`,children:[f.state===`loading`&&(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:`Loading…`}),f.state===`missing`&&(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 px-4 text-center`,children:[(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This canvas is no longer available.`}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`It may have been renamed, moved or deleted.`}),(0,y.jsx)(`button`,{type:`button`,onClick:t,className:`mt-1 px-2.5 py-1 text-xs border rounded-md hover:bg-accent`,children:`Remove pin`})]}),f.state===`ready`&&(0,y.jsx)(m,{workspaceId:e.workspaceName,treeName:e.treeName,path:e.path,layerId:f.node.id,querySpec:f.node.querySpec,metadata:f.node.metadata,readOnly:!0})]})]})}function w(e){return e.label||e.path.split(`/`).filter(Boolean).pop()||`Canvas`}function T({pins:e,onRestore:t}){let[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(e.length);return i!==e.length&&(a(e.length),e.length===0&&r(!1)),e.length===0?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`pointer-events-none absolute bottom-0 left-0 right-0 z-40 max-md:hidden`,children:(0,y.jsx)(`div`,{className:`pointer-events-auto flex items-end gap-1 overflow-x-auto px-3 pr-28 pb-safe-bottom`,children:e.map(e=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id),title:`Restore ${w(e)}`,className:`flex max-w-[180px] shrink-0 items-center gap-1.5 rounded-t-lg border border-b-0 bg-background px-3 py-1.5 text-xs shadow-elevation-1 hover:bg-accent`,children:[(0,y.jsx)(l,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,y.jsx)(`span`,{className:`truncate`,children:w(e)})]},e.id))})}),n&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`fixed inset-0 z-drawer md:hidden`,onClick:()=>r(!1),"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`fixed bottom-rail-stack left-2 z-rail w-60 max-w-[calc(100vw-1rem)] rounded-xl border bg-card p-1.5 shadow-elevation-5 animate-fade-in md:hidden touch-target`,children:e.map(e=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id),className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm hover:bg-accent`,children:[(0,y.jsx)(l,{className:`h-4 w-4 shrink-0 text-primary`}),(0,y.jsx)(`span`,{className:`truncate`,children:w(e)})]},e.id))})]}),(0,y.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),"aria-label":n?`Close minimized canvases`:`Minimized canvases (${e.length})`,className:`fixed bottom-rail-inset left-16 z-nav flex h-12 w-12 items-center justify-center rounded-full bg-foreground text-background shadow-elevation-4 md:hidden`,children:[(0,y.jsx)(l,{className:`h-5 w-5`}),(0,y.jsx)(`span`,{className:`absolute -top-1 -right-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold`,children:e.length})]})]})}function E(){let{pins:e,unpin:t,movePin:n,setMinimized:r,isLoading:i}=p(),{showErrorToast:a}=h(),[o,s]=(0,v.useState)(new Set),c=(0,v.useRef)(e);(0,v.useEffect)(()=>{c.current=e},[e]);let l=e=>{r(e,!0).catch(()=>a(`Could not save minimized state`))},u=t=>{s(e=>{let n=new Set(e);return n.delete(t),n}),e.find(e=>e.id===t)?.minimized&&r(t,!1).catch(()=>a(`Could not save restored state`))},d=(0,v.useCallback)(e=>{s(e?new Set(c.current.filter(e=>!e.minimized).map(e=>e.id)):new Set)},[]),f=e.filter(e=>!g(e,o)),m=e.filter(e=>g(e,o)),b=(t,r,i)=>{let a=e.findIndex(e=>e.id===r.id);if(a===-1)return;let o=i?e[a+1]?.id??null:r.id;n(t,o)};return(0,y.jsxs)(`div`,{className:`relative h-full`,children:[(0,y.jsx)(`div`,{className:`h-full overflow-y-auto`,children:i?(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:`Loading…`}):(0,y.jsx)(`div`,{className:`grid gap-4 p-4 h-full grid-cols-[repeat(auto-fit,minmax(min(640px,100%),1fr))] auto-rows-fr ${m.length>0?`md:pb-12`:``}`,children:f.map(e=>(0,y.jsx)(C,{pin:e,onUnpin:()=>{t(e.id)},onMinimize:()=>l(e.id),onDropPin:(t,n)=>b(t,e,n)},e.id))})}),(0,y.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,children:(0,y.jsx)(_,{onCardsOpenChange:d})}),(0,y.jsx)(T,{pins:m,onRestore:u})]})}export{E as default};
|