@augmentd-labs/canvas-web 2.14.12 → 2.14.14

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.
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Ct as t,wt as n,xt as r}from"./react-DQazvoR7.js";import{Dn as i,Xt as a,di as o,rn as s}from"./ui-zmK8CGjz.js";import{t as c}from"./utils-2pl1SbIp.js";import{In as l}from"./workspace-CjMTaoMZ.js";var u=e(n(),1),d=e(t(),1),f=r();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
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Ct as t,wt as n,xt as r}from"./react-DQazvoR7.js";import{Dn as i,Xt as a,fi as o,rn as s}from"./ui-BX_B5WCf.js";import{t as c}from"./utils-2pl1SbIp.js";import{In as l}from"./workspace-DVALUg0S.js";var u=e(n(),1),d=e(t(),1),f=r();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{$ as r,A as i,B as a,C as o,D as s,E as c,F as l,G as u,H as d,I as f,J as p,K as m,L as h,M as g,N as _,O as v,P as y,Q as b,R as x,S as ee,T as te,U as S,V as ne,W as re,X as C,Y as w,Z as ie,_ as ae,at as oe,b as se,c as ce,d as T,et as le,f as ue,g as de,h as fe,it as pe,j as me,k as he,l as ge,m as E,nt as _e,ot as D,p as O,q as ve,rt as k,tt as ye,v as be,w as xe,wt as Se,x as Ce,xt as we,y as Te,z as Ee}from"./react-DQazvoR7.js";import{Er as De,Fn as Oe,In as ke,Tn as Ae,fn as je,hn as Me,mn as Ne,ni as Pe,qt as Fe,tt as Ie}from"./ui-zmK8CGjz.js";import{t as Le}from"./utils-2pl1SbIp.js";import{t as Re}from"./use-theme-pnVLU4Kg.js";import{a as ze,i as Be,n as Ve,o as He,r as Ue,t as We}from"./punycode.es6-ZbLrB_Dn.js";var Ge=(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]},Ke=e(Se(),1),qe=(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 D(n,0,0);return e.replace(l,i.after(),r),e.setSelection(b.create(e.doc,l+n.size)),e.scrollIntoView(),t(e),!0})},Je=/^\s*>\s$/,Ye=E.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return Ge(`blockquote`,{...x(this.options.HTMLAttributes,e),children:Ge(`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(`
1
+ import{o as e,r as t,t as n}from"./rolldown-runtime-C0FnF6B9.js";import{$ as r,A as i,B as a,C as o,D as s,E as c,F as l,G as u,H as d,I as f,J as p,K as m,L as h,M as g,N as _,O as v,P as y,Q as b,R as x,S as ee,T as te,U as S,V as ne,W as re,X as C,Y as w,Z as ie,_ as ae,at as oe,b as se,c as ce,d as T,et as le,f as ue,g as de,h as fe,it as pe,j as me,k as he,l as ge,m as E,nt as _e,ot as D,p as O,q as ve,rt as k,tt as ye,v as be,w as xe,wt as Se,x as Ce,xt as we,y as Te,z as Ee}from"./react-DQazvoR7.js";import{Dr as De,In as Oe,Ln as ke,Tn as Ae,fn as je,hn as Me,mn as Ne,qt as Pe,ri as Fe,tt as Ie}from"./ui-BX_B5WCf.js";import{t as Le}from"./utils-2pl1SbIp.js";import{t as Re}from"./use-theme-pnVLU4Kg.js";import{a as ze,i as Be,n as Ve,o as He,r as Ue,t as We}from"./punycode.es6-ZbLrB_Dn.js";var Ge=(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]},Ke=e(Se(),1),qe=(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 D(n,0,0);return e.replace(l,i.after(),r),e.setSelection(b.create(e.doc,l+n.size)),e.scrollIntoView(),t(e),!0})},Je=/^\s*>\s$/,Ye=E.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return Ge(`blockquote`,{...x(this.options.HTMLAttributes,e),children:Ge(`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 p({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=S({find:Tp,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=S({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=E.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`,x(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 ne(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 a=document.createElement(`li`),o=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),o.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])=>{a.setAttribute(e,t)}),a.dataset.checked=e.attrs.checked,c.checked=e.attrs.checked,o.append(c,s),a.append(o,l),Object.entries(t).forEach(([e,t])=>{a.setAttribute(e,t)});let d=new Set(Object.keys(t));return{dom:a,contentDOM:l,update:e=>{if(e.type!==this.type)return!1;a.dataset.checked=e.attrs.checked,c.checked=e.attrs.checked,u(e);let t=r.extensionManager.attributes,n=i(e,t),o=new Set(Object.keys(n)),s=this.options.HTMLAttributes;return d.forEach(e=>{o.has(e)||(e in s?a.setAttribute(e,s[e]):a.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in s?a.setAttribute(e,s[e]):a.removeAttribute(e):a.setAttribute(e,t)}),d=o,!0}}}},addInputRules(){return[S({find:Op,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),Mp=E.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`,x(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=a(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=a(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()}}});T.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 $=we(),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:Le(`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)(Pe,{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)(Ae,{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)(De,{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)(ke,{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)(je,{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)(Ie,{className:`h-3.5 w-3.5`}):(0,$.jsx)(Fe,{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}=Re(),[c,l]=(0,Ke.useState)(Fp),u=c??s,d=()=>{let e=u===`dark`?`light`:`dark`;l(e);try{localStorage.setItem(Pp,e)}catch{}},f=ge({extensions:[ao.configure({link:{openOnClick:!1,autolink:!0}}),Of.configure({table:{resizable:!1}}),Mp,jp.configure({nested:!0}),...i===`markdown`?[yu.configure({html:!1,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:`
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=a(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=a(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()}}});T.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 $=we(),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:Le(`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)(Fe,{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)(Ae,{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)(De,{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)(ke,{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)(je,{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)(Ie,{className:`h-3.5 w-3.5`}):(0,$.jsx)(Pe,{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}=Re(),[c,l]=(0,Ke.useState)(Fp),u=c??s,d=()=>{let e=u===`dark`?`light`:`dark`;l(e);try{localStorage.setItem(Pp,e)}catch{}},f=ge({extensions:[ao.configure({link:{openOnClick:!1,autolink:!0}}),Of.configure({table:{resizable:!1}}),Mp,jp.configure({nested:!0}),...i===`markdown`?[yu.configure({html:!1,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,Ke.useEffect)(()=>{!f||f.isDestroyed||e!==o(f)&&!(i===`html`&&!e&&f.isEmpty)&&f.commands.setContent(e||``,{emitUpdate:!1})},[e,f]),(0,Ke.useEffect)(()=>{f&&!f.isDestroyed&&f.isEditable!==a&&f.setEditable(a)},[f,a]),f?(0,$.jsxs)(`div`,{"data-scheme":u,className:Le(`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:Le(`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)(ce,{editor:f})})]}):null}export{Rp as MarkdownEditor};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{wt as t,xt as n}from"./react-DQazvoR7.js";import{Dt as r}from"./workspace-CjMTaoMZ.js";var i=e(t(),1),a=n(),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};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{wt as t,xt as n}from"./react-DQazvoR7.js";import{Dt as r}from"./workspace-DVALUg0S.js";var i=e(t(),1),a=n(),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};