@augmentd-labs/canvas-web 2.26.10 → 2.26.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{EditorOverlay-DqlaCJe7.js → EditorOverlay-V80099Ju.js} +1 -1
- package/dist/assets/{MarkdownEditor-By8nDUtG.js → MarkdownEditor-CB8zhARt.js} +2 -2
- package/dist/assets/{NextShell-DNv3mVFo.js → NextShell-DopBDMF8.js} +1 -1
- package/dist/assets/{SketchEditor-CRJF-Jp4.js → SketchEditor-DHl4hUwl.js} +1 -1
- package/dist/assets/{TextDocumentEditor-BKueFXia.js → TextDocumentEditor-tZq2zx1j.js} +1 -1
- package/dist/assets/{alert-dialog-CDKOX-MP.js → alert-dialog-BDwriJIW.js} +1 -1
- package/dist/assets/{blobs-B3DY8Rsp.js → blobs-BK6-mKQR.js} +1 -1
- package/dist/assets/document-list-DFyWTgB-.js +19 -0
- package/dist/assets/document-list-r-TfV16D.css +1 -0
- package/dist/assets/index-DqL81tH2.js +40 -0
- package/dist/assets/index-VRpQX_cE.css +2 -0
- package/dist/assets/{subtree-transfer-dialog-CSjPDp4d.js → subtree-transfer-dialog-Ca1CCxIf.js} +1 -1
- package/dist/assets/{text-documents-D4tmVh-7.js → text-documents-CmVlLSiW.js} +2 -2
- package/dist/assets/{ui-NWo4bzrd.js → ui-zR-lMEcp.js} +1 -1
- package/dist/assets/{useAddTarget-Bprwjjdn.js → useAddTarget-DJfPFrxr.js} +1 -1
- package/dist/assets/{workspace-BYMC2sfI.js → workspace-20BTA60d.js} +1 -1
- package/dist/index.html +10 -10
- package/dist/sw.js +1 -1
- package/package.json +2 -2
- package/dist/assets/document-list-Czq5vO7b.js +0 -19
- package/dist/assets/document-list-DA2cbw9T.css +0 -1
- package/dist/assets/index-BIaKTlod.css +0 -2
- package/dist/assets/index-CD9Vf1gH.js +0 -40
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BQnKd3jw.js";import{yt as r}from"./react-BzqgEMSQ.js";import{En as i,Yt as a,
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BQnKd3jw.js";import{yt as r}from"./react-BzqgEMSQ.js";import{En as i,Yt as a,li as o,nn as s}from"./ui-zR-lMEcp.js";import{t as c}from"./utils-2pl1SbIp.js";import{x as l}from"./alert-dialog-BDwriJIW.js";var u=e(n(),1),d=e(r(),1),f=t();function p({title:e,onClose:t,onDetails:n,actions:r,children:p}){let[m,h]=(0,u.useState)(!0);return(0,d.createPortal)((0,f.jsx)(`div`,{className:c(`fixed inset-0 z-fullscreen flex bg-scrim`,m?`p-0`:`p-4 md:p-10`),children:(0,f.jsxs)(`div`,{className:c(`flex min-h-0 w-full flex-col overflow-hidden bg-background surface-glass`,m?``:`rounded-lg border shadow-elevation-4`),children:[(0,f.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center gap-2 border-b px-3`,children:[(0,f.jsx)(l,{variant:`ghost`,size:`sm`,onClick:t,"aria-label":`Back`,title:`Back`,children:(0,f.jsx)(o,{className:`h-4 w-4`})}),e,(0,f.jsx)(`div`,{className:`flex-1`}),n&&(0,f.jsxs)(l,{variant:`ghost`,size:`sm`,onClick:n,title:`Edit details (title, tags, comment)`,children:[(0,f.jsx)(i,{className:`mr-1.5 h-4 w-4`}),` Details`]}),(0,f.jsx)(l,{variant:`ghost`,size:`sm`,onClick:()=>h(e=>!e),title:m?`Restore`:`Maximize`,"aria-label":m?`Restore`:`Maximize`,children:m?(0,f.jsx)(a,{className:`h-4 w-4`}):(0,f.jsx)(s,{className:`h-4 w-4`})}),r]}),(0,f.jsx)(`div`,{className:`min-h-0 flex-1`,children:p})]})}),window.document.body)}export{p as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,r as t,t as n}from"./rolldown-runtime-C0FnF6B9.js";import{l as r,u as i}from"./code-editor-BQnKd3jw.js";import{$ as a,A as o,B as s,C as c,D as l,E as u,F as d,G as f,H as p,I as m,J as h,K as g,L as _,M as v,N as y,O as b,P as ee,Q as x,R as S,S as te,T as ne,U as C,V as re,W as ie,X as w,Y as T,Z as ae,_ as oe,at as se,b as ce,c as le,d as E,et as ue,f as de,g as fe,h as pe,it as me,j as he,k as ge,l as _e,m as D,nt as ve,ot as O,p as k,q as ye,rt as A,tt as be,v as xe,w as Se,x as Ce,y as we,z as Te}from"./react-BzqgEMSQ.js";import{Fn as Ee,
|
|
1
|
+
import{o as e,r as t,t as n}from"./rolldown-runtime-C0FnF6B9.js";import{l as r,u as i}from"./code-editor-BQnKd3jw.js";import{$ as a,A as o,B as s,C as c,D as l,E as u,F as d,G as f,H as p,I as m,J as h,K as g,L as _,M as v,N as y,O as b,P as ee,Q as x,R as S,S as te,T as ne,U as C,V as re,W as ie,X as w,Y as T,Z as ae,_ as oe,at as se,b as ce,c as le,d as E,et as ue,f as de,g as fe,h as pe,it as me,j as he,k as ge,l as _e,m as D,nt as ve,ot as O,p as k,q as ye,rt as A,tt as be,v as xe,w as Se,x as Ce,y as we,z as Te}from"./react-BzqgEMSQ.js";import{Fn as Ee,Kt as De,Pn as Oe,dn as ke,ei as Ae,et as je,mn as Me,pn as Ne,wn as Pe,wr as Fe}from"./ui-zR-lMEcp.js";import{t as Ie}from"./utils-2pl1SbIp.js";import{a as Le,i as Re,n as ze,o as Be,r as Ve,t as He}from"./punycode.es6-ZbLrB_Dn.js";import{t as Ue}from"./use-theme-Bd8sb5Ox.js";var We=(e,t)=>{if(e===`slot`)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);return[e,r,n]},Ge=e(i(),1),Ke=(e,t)=>{let{state:n}=e,{selection:r}=n;if(!r.empty)return!1;let{$from:i}=r;if(i.parentOffset!==0)return!1;let a=i.depth-1;if(a<0)return!1;let o=i.node(a),s=i.index(a);if(s===0)return!1;if(o.type===t)return e.commands.lift(t.name);let c=o.child(s-1);if(c.type!==t||!c.lastChild?.isTextblock)return!1;let l=i.before()-1-1;return e.commands.command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=i.parent.content,r=new O(n,0,0);return e.replace(l,i.after(),r),e.setSelection(x.create(e.doc,l+n.size)),e.scrollIntoView(),t(e),!0})},qe=/^\s*>\s$/,Je=D.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return We(`blockquote`,{...S(this.options.HTMLAttributes,e),children:We(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
|
|
2
2
|
`).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
|
|
3
3
|
`))}),n.join(`
|
|
4
4
|
>
|
|
@@ -88,6 +88,6 @@ ${t.innerHTML}
|
|
|
88
88
|
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:()=>-1,tokenize:(e,t,n)=>{let r=e.split(`
|
|
89
89
|
`),[i,a]=vp(r);if(i.length===0)return;let o=xp(i,i[0].indent,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,typeMarker:i[0]?.type,items:o,raw:r.slice(0,a).join(`
|
|
90
90
|
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Cp,this.editor.getAttributes(wp)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new h({props:{handlePaste:(e,t)=>{if((t.clipboardData?.getData(`text/html`))?.trim())return!1;let n=t.clipboardData?.getData(`text/plain`);if(!n)return!1;let r=bp(n);if(!r)return!1;try{let t=e.state.schema.nodeFromJSON(r),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],t=C({find:Tp,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=C({find:Tp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(wp)}),joinPredicate:e,editor:this.editor})),[t]}}),Op=/^\s*(\[([( |x])?\])\s$/,kp=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`,Ap=(e,t,n)=>{var r;return(n==null||(r=n.checkboxLabel)==null?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||`empty task item`}`},jp=D.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>e.querySelector(`div`)??e}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,S(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{let n=`- [${e.attrs?.checked?`x`:` `}] `;return re(e,t,n)},addExtensions(){return this.options.nested?[If(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),s=document.createElement(`span`),c=document.createElement(`input`),l=document.createElement(`div`);s.style.cssText=kp;let u=e=>{let t=Ap(e,e.attrs.checked,this.options.a11y);c.setAttribute(`aria-label`,t),s.textContent=t};u(e),a.contentEditable=`false`,c.type=`checkbox`,c.addEventListener(`mousedown`,e=>e.preventDefault()),c.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,c.checked=e.attrs.checked,a.append(c,s),i.append(a,l),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let d=new Set(Object.keys(t));return{dom:i,contentDOM:l,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,c.checked=e.attrs.checked,u(e);let t=r.extensionManager.attributes,n=o(e,t),a=new Set(Object.keys(n)),s=this.options.HTMLAttributes;return d.forEach(e=>{a.has(e)||(e in s?i.setAttribute(e,s[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in s?i.setAttribute(e,s[e]):i.removeAttribute(e):i.setAttribute(e,t)}),d=a,!0}}}},addInputRules(){return[C({find:Op,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),Mp=D.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,S(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
91
|
-
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=s(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=s(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});E.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(Mf.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(tp.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(up.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Dp.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(jp.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Mp.configure(this.options.taskList)),e}});function Np(e){return e.storage.markdown?.getMarkdown()??``}var $=r(),Pp=`canvas.ui.markdown.theme`;function Fp(){try{let e=localStorage.getItem(Pp);return e===`light`||e===`dark`?e:null}catch{return null}}function Ip({active:e,onClick:t,title:n,children:r}){return(0,$.jsx)(`button`,{type:`button`,title:n,"aria-label":n,onClick:t,className:Ie(`flex h-7 w-7 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground`,e&&`bg-muted text-foreground`),children:r})}function Lp({editor:e,scheme:t,toggleScheme:n}){return(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-0.5 border-b border-input px-1 py-1`,children:[(0,$.jsx)(Ip,{title:`Bold`,active:e.isActive(`bold`),onClick:()=>e.chain().focus().toggleBold().run(),children:(0,$.jsx)(
|
|
91
|
+
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=s(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=s(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});E.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(Mf.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(tp.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(up.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Dp.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(jp.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Mp.configure(this.options.taskList)),e}});function Np(e){return e.storage.markdown?.getMarkdown()??``}var $=r(),Pp=`canvas.ui.markdown.theme`;function Fp(){try{let e=localStorage.getItem(Pp);return e===`light`||e===`dark`?e:null}catch{return null}}function Ip({active:e,onClick:t,title:n,children:r}){return(0,$.jsx)(`button`,{type:`button`,title:n,"aria-label":n,onClick:t,className:Ie(`flex h-7 w-7 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground`,e&&`bg-muted text-foreground`),children:r})}function Lp({editor:e,scheme:t,toggleScheme:n}){return(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-0.5 border-b border-input px-1 py-1`,children:[(0,$.jsx)(Ip,{title:`Bold`,active:e.isActive(`bold`),onClick:()=>e.chain().focus().toggleBold().run(),children:(0,$.jsx)(Ae,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(Ip,{title:`Italic`,active:e.isActive(`italic`),onClick:()=>e.chain().focus().toggleItalic().run(),children:(0,$.jsx)(Pe,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(Ip,{title:`Code`,active:e.isActive(`code`),onClick:()=>e.chain().focus().toggleCode().run(),children:(0,$.jsx)(Fe,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`span`,{className:`mx-1 h-4 w-px bg-input`}),(0,$.jsx)(Ip,{title:`Heading 1`,active:e.isActive(`heading`,{level:1}),onClick:()=>e.chain().focus().toggleHeading({level:1}).run(),children:(0,$.jsx)(Ee,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(Ip,{title:`Heading 2`,active:e.isActive(`heading`,{level:2}),onClick:()=>e.chain().focus().toggleHeading({level:2}).run(),children:(0,$.jsx)(Oe,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`span`,{className:`mx-1 h-4 w-px bg-input`}),(0,$.jsx)(Ip,{title:`Bullet list`,active:e.isActive(`bulletList`),onClick:()=>e.chain().focus().toggleBulletList().run(),children:(0,$.jsx)(ke,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(Ip,{title:`Numbered list`,active:e.isActive(`orderedList`),onClick:()=>e.chain().focus().toggleOrderedList().run(),children:(0,$.jsx)(Ne,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`span`,{className:`mx-1 h-4 w-px bg-input`}),(0,$.jsx)(Ip,{title:`Link`,active:e.isActive(`link`),onClick:()=>{let t=e.getAttributes(`link`).href,n=window.prompt(`Link URL`,t??`https://`);if(n!==null){if(n===``){e.chain().focus().extendMarkRange(`link`).unsetLink().run();return}e.chain().focus().extendMarkRange(`link`).setLink({href:n}).run()}},children:(0,$.jsx)(Me,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`span`,{className:`flex-1`}),(0,$.jsx)(Ip,{title:`Switch editor to ${t===`dark`?`light`:`dark`} theme`,onClick:n,children:t===`dark`?(0,$.jsx)(je,{className:`h-3.5 w-3.5`}):(0,$.jsx)(De,{className:`h-3.5 w-3.5`})})]})}function Rp({value:e,onChange:t,placeholder:n,fill:r=!1,format:i=`markdown`,editable:a=!0}){let o=e=>i===`html`?e.getHTML():Np(e),{resolvedScheme:s}=Ue(),[c,l]=(0,Ge.useState)(Fp),u=c??s,d=()=>{let e=u===`dark`?`light`:`dark`;l(e);try{localStorage.setItem(Pp,e)}catch{}},f=_e({extensions:[ao.configure({link:{openOnClick:!1,autolink:!0}}),Of.configure({table:{resizable:!1}}),Mp,jp.configure({nested:!0}),yu.configure({html:i===`html`,transformPastedText:!0})],content:e,editorProps:{attributes:{class:`canvas-no-drag markdown-body md-editor-content min-h-[8rem] px-3 py-2 text-sm outline-none`,"data-placeholder":n??``}},onUpdate:({editor:e})=>{t(o(e),e.getText({blockSeparator:`
|
|
92
92
|
|
|
93
93
|
`}))}});return(0,Ge.useEffect)(()=>{!f||f.isDestroyed||e!==o(f)&&!(i===`html`&&!e&&f.isEmpty)&&f.commands.setContent(e||``,{emitUpdate:!1})},[e,f]),(0,Ge.useEffect)(()=>{f&&!f.isDestroyed&&f.isEditable!==a&&f.setEditable(a)},[f,a]),f?(0,$.jsxs)(`div`,{"data-scheme":u,className:Ie(`md-editor rounded-md border border-input bg-background text-foreground focus-within:ring-1 focus-within:ring-ring`,r&&`flex h-full min-h-0 flex-col`),children:[(0,$.jsx)(Lp,{editor:f,scheme:u,toggleScheme:d}),(0,$.jsx)(`div`,{className:Ie(`overflow-y-auto flex flex-col [&>div]:flex-1 [&_.ProseMirror]:h-full`,r?`min-h-0 flex-1`:`resize-y min-h-[8rem] max-h-[70vh]`),onClick:()=>f.chain().focus().run(),children:(0,$.jsx)(le,{editor:f})})]}):null}export{Rp as MarkdownEditor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BQnKd3jw.js";import{Pt as r}from"./workspace-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BQnKd3jw.js";import{Pt as r}from"./workspace-20BTA60d.js";var i=e(n(),1),a=t(),o=[`Inbox sweep`,`Canvas edge notes`,`Release 2.7`];function s(){let[e,t]=(0,i.useState)(`none`),[n,s]=(0,i.useState)(null);(0,i.useEffect)(()=>{e===`workspaces`&&n===null&&r().then(s).catch(()=>s([]))},[e,n]);let c=e=>t(t=>t===e?`none`:e);return(0,a.jsxs)(`div`,{className:`next-shell`,children:[(0,a.jsx)(`div`,{className:`next-wallpaper`,"aria-hidden":!0,children:(0,a.jsx)(`i`,{})}),(0,a.jsxs)(`div`,{className:`relative flex h-full flex-col items-center justify-center gap-3 select-none`,children:[(0,a.jsx)(`p`,{className:`text-2xl font-light tracking-wide text-white/80`,children:`Canvas`}),(0,a.jsx)(`p`,{className:`text-sm text-white/40`,children:`say something, or tap the orb. Swipe up for canvases (soon)`})]}),e===`tasks`&&(0,a.jsxs)(`div`,{className:`next-glass absolute bottom-24 left-6 w-64 rounded-2xl p-3`,children:[(0,a.jsx)(`p`,{className:`px-2 pb-2 text-[11px] uppercase tracking-widest text-white/40`,children:`Pinned`}),(0,a.jsx)(`div`,{className:`flex flex-col gap-1`,children:o.map(e=>(0,a.jsx)(`button`,{type:`button`,className:`rounded-xl px-3 py-2 text-left text-sm text-white/85 transition-colors hover:bg-white/10`,children:e},e))})]}),e===`workspaces`&&(0,a.jsxs)(`div`,{className:`next-glass absolute bottom-24 right-6 w-72 rounded-2xl p-3`,children:[(0,a.jsx)(`p`,{className:`px-2 pb-2 text-[11px] uppercase tracking-widest text-white/40`,children:`Workspaces`}),(0,a.jsxs)(`div`,{className:`flex max-h-80 flex-col gap-1 overflow-y-auto`,children:[n===null&&(0,a.jsx)(`p`,{className:`px-3 py-2 text-sm text-white/50`,children:`Loading…`}),n?.map(e=>(0,a.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm text-white/85 transition-colors hover:bg-white/10`,children:[(0,a.jsx)(`span`,{className:`h-2.5 w-2.5 shrink-0 rounded-full`,style:{backgroundColor:e.color||`rgb(255 255 255 / 0.35)`}}),(0,a.jsx)(`span`,{className:`truncate`,children:e.label||e.name})]},e.id)),n?.length===0&&(0,a.jsx)(`p`,{className:`px-3 py-2 text-sm text-white/50`,children:`No workspaces`})]})]}),(0,a.jsxs)(`div`,{className:`absolute bottom-6 right-6 flex items-center gap-3`,children:[e!==`none`&&(0,a.jsx)(`button`,{type:`button`,onClick:()=>c(e===`tasks`?`workspaces`:`tasks`),className:`next-glass rounded-full px-4 py-2 text-xs text-white/70`,children:e===`tasks`?`workspaces`:`pinned`}),(0,a.jsx)(`button`,{type:`button`,onClick:()=>c(`tasks`),"aria-label":`Toolbox`,className:`next-orb flex h-14 w-14 items-center justify-center rounded-full`,children:(0,a.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-white/85`})})]})]})}export{s as default};
|