@mpdev_ab/document-creator 0.1.1 → 0.2.1

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
- (function(g,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@tiptap/vue-3"),require("@tiptap/starter-kit"),require("@tiptap/extension-text-style"),require("@tiptap/extension-font-family"),require("@tiptap/extension-underline"),require("@tiptap/extension-subscript"),require("@tiptap/extension-superscript"),require("@tiptap/extension-color"),require("@tiptap/extension-text-align"),require("@tiptap/extension-link"),require("@tiptap/extension-placeholder"),require("@tiptap/extension-table"),require("@tiptap/extension-table-row"),require("@tiptap/extension-table-cell"),require("@tiptap/extension-table-header"),require("@tiptap/core"),require("@tiptap/extension-image")):typeof define=="function"&&define.amd?define(["exports","vue","@tiptap/vue-3","@tiptap/starter-kit","@tiptap/extension-text-style","@tiptap/extension-font-family","@tiptap/extension-underline","@tiptap/extension-subscript","@tiptap/extension-superscript","@tiptap/extension-color","@tiptap/extension-text-align","@tiptap/extension-link","@tiptap/extension-placeholder","@tiptap/extension-table","@tiptap/extension-table-row","@tiptap/extension-table-cell","@tiptap/extension-table-header","@tiptap/core","@tiptap/extension-image"],e):(g=typeof globalThis<"u"?globalThis:g||self,e(g.DocumentCreator={},g.Vue,g.vue3,g.StarterKit,g.extensionTextStyle,g.FontFamily,g.Underline,g.Subscript,g.Superscript,g.Color,g.TextAlign,g.Link,g.Placeholder,g.extensionTable,g.TableRow,g.TableCell,g.TableHeader,g.core,g.Image))})(this,(function(g,e,V,H,F,D,R,O,I,U,q,P,j,G,K,J,W,N,X){"use strict";const Y=N.Extension.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>{var o;return((o=t.style.fontSize)==null?void 0:o.replace(/['"]+/g,""))||null},renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:o})=>o().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),Z=N.Extension.create({name:"lineHeight",addOptions(){return{types:["heading","paragraph"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight||null,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({commands:o})=>this.options.types.every(n=>o.updateAttributes(n,{lineHeight:t})),unsetLineHeight:()=>({commands:t})=>this.options.types.every(o=>t.resetAttributes(o,"lineHeight"))}}}),Q=["src","alt"],v={key:0,class:"absolute -top-10 left-0 flex items-center gap-1 bg-white border border-gray-200 rounded shadow-md p-1 z-10"},_=["onClick"],ee=e.defineComponent({__name:"ImageResizePopover",props:V.nodeViewProps,setup(t){const o=t,n=e.ref(o.node.attrs.width||""),m=e.ref(o.node.attrs.alt||""),l=e.computed(()=>{const c={};return o.node.attrs.width&&(c.width=o.node.attrs.width),o.node.attrs.height&&(c.height=o.node.attrs.height),c}),s=e.computed(()=>{const c=o.node.attrs.align;return c==="center"?"mx-auto block":c==="right"?"ml-auto block":"block"});function f(){const c=o.getPos();c!=null&&o.editor.commands.setNodeSelection(c)}function r(c){o.updateAttributes({width:c}),n.value=c}function a(c){o.updateAttributes({align:c})}function i(){o.updateAttributes({alt:m.value})}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(V.NodeViewWrapper),{class:e.normalizeClass(["relative inline-block",s.value])},{default:e.withCtx(()=>[e.createElementVNode("img",{src:c.node.attrs.src,alt:c.node.attrs.alt||"",style:e.normalizeStyle(l.value),class:e.normalizeClass(["cursor-pointer max-w-full",c.selected?"ring-2 ring-blue-400":""]),onClick:f},null,14,Q),c.selected?(e.openBlock(),e.createElementBlock("div",v,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(["25%","50%","75%","100%"],h=>e.createElementVNode("button",{key:h,class:"px-2 py-0.5 text-xs rounded hover:bg-gray-100",onClick:w=>r(h)},e.toDisplayString(h),9,_)),64)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[0]||(d[0]=h=>n.value=h),class:"w-16 border border-gray-300 rounded px-1 py-0.5 text-xs",placeholder:"e.g. 100%",onKeydown:d[1]||(d[1]=e.withKeys(h=>r(n.value),["enter"]))},null,544),[[e.vModelText,n.value]]),d[9]||(d[9]=e.createElementVNode("span",{class:"w-px h-4 bg-gray-300 mx-1"},null,-1)),e.createElementVNode("button",{class:"px-1 py-0.5 text-xs rounded hover:bg-gray-100",title:"Align left",onClick:d[2]||(d[2]=h=>a("left"))},[...d[6]||(d[6]=[e.createElementVNode("svg",{class:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 6h18M3 12h10M3 18h14"})],-1)])]),e.createElementVNode("button",{class:"px-1 py-0.5 text-xs rounded hover:bg-gray-100",title:"Align center",onClick:d[3]||(d[3]=h=>a("center"))},[...d[7]||(d[7]=[e.createElementVNode("svg",{class:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 6h18M7 12h10M5 18h14"})],-1)])]),e.createElementVNode("button",{class:"px-1 py-0.5 text-xs rounded hover:bg-gray-100",title:"Align right",onClick:d[4]||(d[4]=h=>a("right"))},[...d[8]||(d[8]=[e.createElementVNode("svg",{class:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 6h18M11 12h10M7 18h14"})],-1)])]),d[10]||(d[10]=e.createElementVNode("span",{class:"w-px h-4 bg-gray-300 mx-1"},null,-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[5]||(d[5]=h=>m.value=h),class:"w-20 border border-gray-300 rounded px-1 py-0.5 text-xs",placeholder:"Alt text",onBlur:i,onKeydown:e.withKeys(i,["enter"])},null,544),[[e.vModelText,m.value]])])):e.createCommentVNode("",!0)]),_:1},8,["class"]))}}),te=X.extend({name:"image",addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),width:{default:null,parseHTML:o=>o.getAttribute("width")||o.style.width||null,renderHTML:o=>o.width?{style:`width: ${o.width}`}:{}},height:{default:null,parseHTML:o=>o.getAttribute("height")||o.style.height||null,renderHTML:o=>o.height?{style:`height: ${o.height}`}:{}},align:{default:null,parseHTML:o=>o.getAttribute("data-align")||null,renderHTML:o=>{if(!o.align)return{};const n={left:"margin-right: auto",center:"margin-left: auto; margin-right: auto",right:"margin-left: auto"};return{"data-align":o.align,style:`display: block; ${n[o.align]||""}`}}}}},addNodeView(){return V.VueNodeViewRenderer(ee)}}).configure({allowBase64:!0,inline:!1}),ne=N.Node.create({name:"video",group:"block",atom:!0,addAttributes(){return{src:{default:null},width:{default:"100%"},height:{default:"315"},frameborder:{default:"0"},allowfullscreen:{default:!0}}},parseHTML(){return[{tag:"iframe[src]"}]},renderHTML({HTMLAttributes:t}){return["div",{class:"video-wrapper"},["iframe",N.mergeAttributes(t)]]},addCommands(){return{setVideo:t=>({commands:o})=>o.insertContent({type:this.name,attrs:t})}}}),T={toolbar:"bg-white border-b border-gray-200 p-2 flex flex-wrap items-center gap-1",toolbarButton:"hover:bg-gray-100 rounded p-1.5 text-gray-600 cursor-pointer",toolbarButtonActive:"bg-blue-100 text-blue-600",editor:"bg-white min-h-[400px] p-4 prose max-w-none focus:outline-none",dropdown:"bg-white border border-gray-200 rounded shadow-lg py-1 z-50",modal:"bg-white rounded-lg shadow-xl p-6",saveButton:"bg-blue-600 text-white rounded px-4 py-2 hover:bg-blue-700"},$={maxSize:5*1024*1024,allowedTypes:["image/jpeg","image/png","image/gif"]},M=["Arial","Times New Roman","Courier New","Georgia","Verdana","Trebuchet MS","Comic Sans MS","Impact"],S=["8","10","12","14","16","18","20","24","28","32","36","48","72"],A=["1","1.15","1.5","2","2.5","3"];function oe(t){const o=e.ref([]),n=e.ref(!1),m=e.ref(null),l={"Content-Type":"application/json",...t.headers};async function s(){n.value=!0,m.value=null;try{const a=await fetch(t.loadTemplates,{headers:l});if(!a.ok)throw new Error(`Failed to load templates: ${a.statusText}`);o.value=await a.json()}catch(a){const i=a instanceof Error?a.message:"Unknown error";throw m.value=i,a}finally{n.value=!1}}async function f(a){const i=await fetch(t.saveTemplate,{method:"POST",headers:l,body:JSON.stringify(a)});if(!i.ok)throw new Error(`Failed to save template: ${i.statusText}`);return i.json()}async function r(a){const i=await fetch(`${t.deleteTemplate}/${a}`,{method:"DELETE",headers:l});if(!i.ok)throw new Error(`Failed to delete template: ${i.statusText}`)}return{templates:o,loading:n,error:m,loadTemplates:s,saveTemplate:f,deleteTemplate:r}}const L=Symbol("document-editor");function le(){const t=e.inject(L);if(!t)throw new Error("useDocumentEditor must be used within a DocumentEditor component");return{editor:t,getHTML:()=>{var o;return((o=t.value)==null?void 0:o.getHTML())??""},getText:()=>{var o;return((o=t.value)==null?void 0:o.getText())??""},setContent:o=>{var n;return(n=t.value)==null?void 0:n.commands.setContent(o)},focus:()=>{var o;return(o=t.value)==null?void 0:o.commands.focus()},isEmpty:()=>{var o;return((o=t.value)==null?void 0:o.isEmpty)??!0}}}const re=["title","disabled"],x=e.defineComponent({__name:"ToolbarButton",props:{theme:{},title:{},isActive:{type:Boolean},disabled:{type:Boolean}},emits:["click"],setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("button",{type:"button",class:e.normalizeClass([t.theme.toolbarButton,t.isActive&&t.theme.toolbarButtonActive]),title:t.title,disabled:t.disabled,onClick:n[0]||(n[0]=m=>o.$emit("click"))},[e.renderSlot(o.$slots,"default")],10,re))}}),ie=(t,o)=>{const n=t.__vccOpts||t;for(const[m,l]of o)n[m]=l;return n},ae={},se={class:"w-px h-6 bg-gray-300 mx-1"};function de(t,o){return e.openBlock(),e.createElementBlock("div",se)}const E=ie(ae,[["render",de]]),ce=["title"],B=e.defineComponent({__name:"ToolbarDropdown",props:{theme:{},label:{},title:{}},setup(t){const o=e.ref(!1),n=e.ref(null);function m(){o.value=!1}function l(s){n.value&&!n.value.contains(s.target)&&(o.value=!1)}return e.onMounted(()=>document.addEventListener("click",l)),e.onBeforeUnmount(()=>document.removeEventListener("click",l)),(s,f)=>(e.openBlock(),e.createElementBlock("div",{class:"relative",ref_key:"dropdownRef",ref:n},[e.createElementVNode("button",{type:"button",class:e.normalizeClass([t.theme.toolbarButton,"flex items-center gap-1 px-2 text-sm"]),title:t.title,onClick:f[0]||(f[0]=r=>o.value=!o.value)},[e.createElementVNode("span",null,e.toDisplayString(t.label),1),f[1]||(f[1]=e.createElementVNode("svg",{class:"w-3 h-3",viewBox:"0 0 12 12",fill:"currentColor"},[e.createElementVNode("path",{d:"M2 4l4 4 4-4",stroke:"currentColor","stroke-width":"1.5",fill:"none"})],-1))],10,ce),o.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([t.theme.dropdown,"absolute top-full left-0 mt-1 min-w-[150px] max-h-60 overflow-y-auto"])},[e.renderSlot(s.$slots,"default",{close:m})],2)):e.createCommentVNode("",!0)],512))}}),me=["onClick"],fe=e.defineComponent({__name:"HeadingPicker",props:{editor:{},theme:{}},setup(t){const o=t,n=[{label:"Paragraph",value:"paragraph",class:"text-sm"},{label:"Heading 1",value:1,class:"text-2xl font-bold"},{label:"Heading 2",value:2,class:"text-xl font-bold"},{label:"Heading 3",value:3,class:"text-lg font-bold"},{label:"Heading 4",value:4,class:"text-base font-semibold"},{label:"Heading 5",value:5,class:"text-sm font-semibold"},{label:"Heading 6",value:6,class:"text-xs font-semibold"}];function m(f){var r,a;return f.value==="paragraph"?(r=o.editor)==null?void 0:r.isActive("paragraph"):(a=o.editor)==null?void 0:a.isActive("heading",{level:f.value})}const l=e.computed(()=>{const f=n.find(r=>m(r));return(f==null?void 0:f.label)??"Paragraph"});function s(f){var r,a;f.value==="paragraph"?(r=o.editor)==null||r.chain().focus().setParagraph().run():(a=o.editor)==null||a.chain().focus().toggleHeading({level:f.value}).run()}return(f,r)=>(e.openBlock(),e.createBlock(B,{theme:t.theme,label:l.value,title:"Block type"},{default:e.withCtx(({close:a})=>[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(n,i=>e.createElementVNode("button",{key:i.value,class:e.normalizeClass(["block w-full text-left px-3 py-1.5 hover:bg-gray-100",i.class,m(i)?"bg-gray-50 font-semibold":""]),onClick:c=>{s(i),a()}},e.toDisplayString(i.label),11,me)),64))]),_:1},8,["theme","label"]))}}),pe=["onClick"],ue=e.defineComponent({__name:"FontFamilyPicker",props:{editor:{},theme:{}},setup(t){const o=t,n=M,m=e.computed(()=>{var l;for(const s of n)if((l=o.editor)!=null&&l.isActive("textStyle",{fontFamily:s}))return s;return"Font"});return(l,s)=>(e.openBlock(),e.createBlock(B,{theme:t.theme,label:m.value,title:"Font family"},{default:e.withCtx(({close:f})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),r=>(e.openBlock(),e.createElementBlock("button",{key:r,style:e.normalizeStyle({fontFamily:r}),class:e.normalizeClass(["block w-full text-left px-3 py-1.5 hover:bg-gray-100 text-sm",m.value===r?"bg-gray-50 font-semibold":""]),onClick:a=>{var i;(i=t.editor)==null||i.chain().focus().setFontFamily(r).run(),f()}},e.toDisplayString(r),15,pe))),128))]),_:1},8,["theme","label"]))}}),he=["onClick"],ge=e.defineComponent({__name:"FontSizePicker",props:{editor:{},theme:{}},setup(t){const o=t,n=S,m=e.computed(()=>{var l;for(const s of n)if((l=o.editor)!=null&&l.isActive("textStyle",{fontSize:s+"px"}))return s;return""});return(l,s)=>(e.openBlock(),e.createBlock(B,{theme:t.theme,label:m.value||"Size",title:"Font size"},{default:e.withCtx(({close:f})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),r=>(e.openBlock(),e.createElementBlock("button",{key:r,class:e.normalizeClass(["block w-full text-left px-3 py-1.5 hover:bg-gray-100 text-sm",m.value===r?"bg-gray-50 font-semibold":""]),onClick:a=>{var i;(i=t.editor)==null||i.chain().focus().setFontSize(r+"px").run(),f()}},e.toDisplayString(r),11,he))),128))]),_:1},8,["theme","label"]))}}),xe={class:"grid grid-cols-8 gap-1 mb-2"},ke=["title","onClick"],be={class:"flex items-center gap-2 pt-2 border-t border-gray-100"},ye=["value"],we=e.defineComponent({__name:"ColorPicker",props:{editor:{},theme:{}},setup(t){const o=t,n=e.ref(!1),m=e.ref(null),l=["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#ffffff","#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#0000ff","#9900ff","#ff00ff","#e6b8af","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#c9daf8","#cfe2f3","#d9d2e9","#ead1dc","#dd7e6b","#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#a4c2f4","#9fc5e8","#b4a7d6","#d5a6bd"],s=e.computed(()=>{var a;return((a=o.editor)==null?void 0:a.getAttributes("textStyle").color)||"#000000"});function f(a){var i;(i=o.editor)==null||i.chain().focus().setColor(a).run(),n.value=!1}function r(a){m.value&&!m.value.contains(a.target)&&(n.value=!1)}return e.onMounted(()=>document.addEventListener("click",r)),e.onBeforeUnmount(()=>document.removeEventListener("click",r)),(a,i)=>(e.openBlock(),e.createElementBlock("div",{class:"relative",ref_key:"pickerRef",ref:m},[e.createElementVNode("button",{type:"button",class:e.normalizeClass([t.theme.toolbarButton,"flex items-center gap-1 px-2"]),title:"Font color",onClick:i[0]||(i[0]=c=>n.value=!n.value)},[i[2]||(i[2]=e.createElementVNode("span",null,"A",-1)),e.createElementVNode("div",{class:"w-4 h-1 rounded",style:e.normalizeStyle({backgroundColor:s.value})},null,4)],2),n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([t.theme.dropdown,"absolute top-full left-0 mt-1 p-2 w-48"])},[e.createElementVNode("div",xe,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(l,c=>e.createElementVNode("button",{key:c,class:"w-5 h-5 rounded border border-gray-200 cursor-pointer hover:scale-110 transition-transform",style:e.normalizeStyle({backgroundColor:c}),title:c,onClick:d=>f(c)},null,12,ke)),64))]),e.createElementVNode("div",be,[i[3]||(i[3]=e.createElementVNode("label",{class:"text-xs text-gray-500"},"Custom:",-1)),e.createElementVNode("input",{type:"color",value:s.value,class:"w-6 h-6 cursor-pointer",onInput:i[1]||(i[1]=c=>f(c.target.value))},null,40,ye)])],2)):e.createCommentVNode("",!0)],512))}}),Ee=e.defineComponent({__name:"AlignmentButtons",props:{editor:{},theme:{}},setup(t){return(o,n)=>{var m,l,s,f;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(x,{theme:t.theme,title:"Align left","is-active":(m=t.editor)==null?void 0:m.isActive({textAlign:"left"}),onClick:n[0]||(n[0]=r=>{var a;return(a=t.editor)==null?void 0:a.chain().focus().setTextAlign("left").run()})},{default:e.withCtx(()=>[...n[4]||(n[4]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 6h18M3 12h10M3 18h14"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(x,{theme:t.theme,title:"Align center","is-active":(l=t.editor)==null?void 0:l.isActive({textAlign:"center"}),onClick:n[1]||(n[1]=r=>{var a;return(a=t.editor)==null?void 0:a.chain().focus().setTextAlign("center").run()})},{default:e.withCtx(()=>[...n[5]||(n[5]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 6h18M7 12h10M5 18h14"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(x,{theme:t.theme,title:"Align right","is-active":(s=t.editor)==null?void 0:s.isActive({textAlign:"right"}),onClick:n[2]||(n[2]=r=>{var a;return(a=t.editor)==null?void 0:a.chain().focus().setTextAlign("right").run()})},{default:e.withCtx(()=>[...n[6]||(n[6]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 6h18M11 12h10M7 18h14"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(x,{theme:t.theme,title:"Justify","is-active":(f=t.editor)==null?void 0:f.isActive({textAlign:"justify"}),onClick:n[3]||(n[3]=r=>{var a;return(a=t.editor)==null?void 0:a.chain().focus().setTextAlign("justify").run()})},{default:e.withCtx(()=>[...n[7]||(n[7]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 6h18M3 12h18M3 18h18"})],-1)])]),_:1},8,["theme","is-active"])],64)}}}),Ce=["onClick"],Ve=e.defineComponent({__name:"LineHeightPicker",props:{editor:{},theme:{}},setup(t){const o=t,n=A,m=e.computed(()=>{var l,s;return((l=o.editor)==null?void 0:l.getAttributes("paragraph").lineHeight)||((s=o.editor)==null?void 0:s.getAttributes("heading").lineHeight)||""});return(l,s)=>(e.openBlock(),e.createBlock(B,{theme:t.theme,label:m.value||"Height",title:"Line height"},{default:e.withCtx(({close:f})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),r=>(e.openBlock(),e.createElementBlock("button",{key:r,class:e.normalizeClass(["block w-full text-left px-3 py-1.5 hover:bg-gray-100 text-sm",m.value===r?"bg-gray-50 font-semibold":""]),onClick:a=>{var i;(i=t.editor)==null||i.chain().focus().setLineHeight(r).run(),f()}},e.toDisplayString(r),11,Ce))),128))]),_:1},8,["theme","label"]))}}),Ne={class:"flex gap-2"},Be=e.defineComponent({__name:"LinkButton",props:{editor:{},theme:{}},setup(t){const o=t,n=e.ref(!1),m=e.ref(""),l=e.ref(null),s=e.ref(null);function f(){var c;m.value=((c=o.editor)==null?void 0:c.getAttributes("link").href)||"",n.value=!n.value,n.value&&e.nextTick(()=>{var d;return(d=s.value)==null?void 0:d.focus()})}function r(){var c;m.value&&((c=o.editor)==null||c.chain().focus().extendMarkRange("link").setLink({href:m.value}).run()),n.value=!1}function a(){var c;(c=o.editor)==null||c.chain().focus().unsetLink().run(),n.value=!1}function i(c){l.value&&!l.value.contains(c.target)&&(n.value=!1)}return e.onMounted(()=>document.addEventListener("click",i)),e.onBeforeUnmount(()=>document.removeEventListener("click",i)),(c,d)=>{var h,w;return e.openBlock(),e.createElementBlock("div",{class:"relative",ref_key:"linkRef",ref:l},[e.createVNode(x,{theme:t.theme,title:"Link","is-active":(h=t.editor)==null?void 0:h.isActive("link"),onClick:f},{default:e.withCtx(()=>[...d[2]||(d[2]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e.createElementVNode("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})],-1)])]),_:1},8,["theme","is-active"]),n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([t.theme.dropdown,"absolute top-full left-0 mt-1 p-3 w-72"])},[d[3]||(d[3]=e.createElementVNode("label",{class:"block text-xs text-gray-500 mb-1"},"URL",-1)),e.withDirectives(e.createElementVNode("input",{ref_key:"urlInput",ref:s,"onUpdate:modelValue":d[0]||(d[0]=u=>m.value=u),type:"url",placeholder:"https://example.com",class:"w-full border border-gray-300 rounded px-2 py-1 text-sm mb-2",onKeydown:e.withKeys(r,["enter"])},null,544),[[e.vModelText,m.value]]),e.createElementVNode("div",Ne,[e.createElementVNode("button",{class:"px-3 py-1 text-sm bg-blue-600 text-white rounded hover:bg-blue-700",onClick:r}," Apply "),(w=t.editor)!=null&&w.isActive("link")?(e.openBlock(),e.createElementBlock("button",{key:0,class:"px-3 py-1 text-sm bg-red-100 text-red-600 rounded hover:bg-red-200",onClick:a}," Remove ")):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"px-3 py-1 text-sm text-gray-500 hover:text-gray-700",onClick:d[1]||(d[1]=u=>n.value=!1)}," Cancel ")])],2)):e.createCommentVNode("",!0)],512)}}}),Te=["accept"],$e=e.defineComponent({__name:"ImageUploadButton",props:{editor:{},theme:{},imageConfig:{}},emits:["error"],setup(t,{emit:o}){const n=t,m=o,l=e.ref(null),s=e.computed(()=>({...$,...n.imageConfig})),f=e.computed(()=>s.value.allowedTypes.join(","));function r(){var i;(i=l.value)==null||i.click()}function a(i){var w;const c=i.target,d=(w=c.files)==null?void 0:w[0];if(!d)return;if(!s.value.allowedTypes.includes(d.type)){m("error",{message:`File type ${d.type} is not allowed`,detail:{allowedTypes:s.value.allowedTypes}}),c.value="";return}if(d.size>s.value.maxSize){const u=(s.value.maxSize/1048576).toFixed(1);m("error",{message:`File size exceeds ${u}MB limit`,detail:{maxSize:s.value.maxSize,fileSize:d.size}}),c.value="";return}const h=new FileReader;h.onload=()=>{var p;const u=h.result;(p=n.editor)==null||p.chain().focus().setImage({src:u}).run()},h.readAsDataURL(d),c.value=""}return(i,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(x,{theme:t.theme,title:"Insert image",onClick:r},{default:e.withCtx(()=>[...c[0]||(c[0]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.createElementVNode("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.createElementVNode("path",{d:"M21 15l-5-5L5 21"})],-1)])]),_:1},8,["theme"]),e.createElementVNode("input",{ref_key:"fileInput",ref:l,type:"file",accept:f.value,class:"hidden",onChange:a},null,40,Te)],64))}}),Me={class:"mb-1 text-xs text-gray-500 text-center"},Se=["onMouseenter"],Ae=8,z=10,Le=e.defineComponent({__name:"TableGridPicker",props:{editor:{},theme:{}},setup(t){const o=t,n=e.ref(!1),m=e.ref(0),l=e.ref(0),s=e.ref(null);function f(a,i){var c;(c=o.editor)==null||c.chain().focus().insertTable({rows:a,cols:i,withHeaderRow:!0}).run(),n.value=!1,m.value=0,l.value=0}function r(a){s.value&&!s.value.contains(a.target)&&(n.value=!1)}return e.onMounted(()=>document.addEventListener("click",r)),e.onBeforeUnmount(()=>document.removeEventListener("click",r)),(a,i)=>(e.openBlock(),e.createElementBlock("div",{class:"relative",ref_key:"pickerRef",ref:s},[e.createVNode(x,{theme:t.theme,title:"Insert table",onClick:i[0]||(i[0]=c=>n.value=!n.value)},{default:e.withCtx(()=>[...i[2]||(i[2]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("rect",{x:"3",y:"3",width:"18",height:"18",rx:"1"}),e.createElementVNode("path",{d:"M3 9h18M3 15h18M9 3v18M15 3v18"})],-1)])]),_:1},8,["theme"]),n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([t.theme.dropdown,"absolute top-full left-0 mt-1 p-2"])},[e.createElementVNode("div",Me,e.toDisplayString(l.value>0?`${l.value} × ${m.value}`:"Select size"),1),e.createElementVNode("div",{class:"grid gap-0.5",style:e.normalizeStyle({gridTemplateColumns:`repeat(${z}, 1fr)`})},[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(Ae,c=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"row-"+c},[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(z,d=>e.createElementVNode("div",{key:"cell-"+c+"-"+d,class:e.normalizeClass(["w-5 h-5 border cursor-pointer",c<=m.value&&d<=l.value?"bg-blue-200 border-blue-300":"bg-white border-gray-300"]),onMouseenter:h=>{m.value=c,l.value=d},onClick:i[1]||(i[1]=h=>f(m.value,l.value))},null,42,Se)),64))],64))),64))],4)],2)):e.createCommentVNode("",!0)],512))}}),ze={class:"flex gap-2"},He=e.defineComponent({__name:"VideoEmbedButton",props:{editor:{},theme:{}},setup(t){const o=t,n=e.ref(!1),m=e.ref(""),l=e.ref(null);function s(a){const i=a.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/);if(i)return`https://www.youtube.com/embed/${i[1]}`;const c=a.match(/vimeo\.com\/(\d+)/);return c?`https://player.vimeo.com/video/${c[1]}`:a}function f(){var a;if(m.value){const i=s(m.value);(a=o.editor)==null||a.chain().focus().setVideo({src:i}).run()}n.value=!1,m.value=""}function r(a){l.value&&!l.value.contains(a.target)&&(n.value=!1)}return e.onMounted(()=>document.addEventListener("click",r)),e.onBeforeUnmount(()=>document.removeEventListener("click",r)),(a,i)=>(e.openBlock(),e.createElementBlock("div",{class:"relative",ref_key:"videoRef",ref:l},[e.createVNode(x,{theme:t.theme,title:"Embed video",onClick:i[0]||(i[0]=c=>n.value=!n.value)},{default:e.withCtx(()=>[...i[3]||(i[3]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("polygon",{points:"5,3 19,12 5,21"})],-1)])]),_:1},8,["theme"]),n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([t.theme.dropdown,"absolute top-full left-0 mt-1 p-3 w-80"])},[i[4]||(i[4]=e.createElementVNode("label",{class:"block text-xs text-gray-500 mb-1"},"Video URL (YouTube, Vimeo)",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i[1]||(i[1]=c=>m.value=c),type:"url",placeholder:"https://www.youtube.com/watch?v=...",class:"w-full border border-gray-300 rounded px-2 py-1 text-sm mb-2",onKeydown:e.withKeys(f,["enter"])},null,544),[[e.vModelText,m.value]]),e.createElementVNode("div",ze,[e.createElementVNode("button",{class:"px-3 py-1 text-sm bg-blue-600 text-white rounded hover:bg-blue-700",onClick:f}," Embed "),e.createElementVNode("button",{class:"px-3 py-1 text-sm text-gray-500 hover:text-gray-700",onClick:i[2]||(i[2]=c=>n.value=!1)}," Cancel ")])],2)):e.createCommentVNode("",!0)],512))}}),Fe=e.defineComponent({__name:"EditorToolbar",props:{editor:{},theme:{},imageConfig:{}},emits:["saveTemplate","loadTemplate","save","error"],setup(t){return(o,n)=>{var m,l,s,f,r,a,i,c,d,h,w;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(t.theme.toolbar)},[e.createVNode(x,{theme:t.theme,title:"Undo",onClick:n[0]||(n[0]=u=>{var p;return(p=t.editor)==null?void 0:p.chain().focus().undo().run()}),disabled:!((m=t.editor)!=null&&m.can().undo())},{default:e.withCtx(()=>[...n[16]||(n[16]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 10h10a5 5 0 0 1 0 10H9"}),e.createElementVNode("path",{d:"M3 10l4-4M3 10l4 4"})],-1)])]),_:1},8,["theme","disabled"]),e.createVNode(x,{theme:t.theme,title:"Redo",onClick:n[1]||(n[1]=u=>{var p;return(p=t.editor)==null?void 0:p.chain().focus().redo().run()}),disabled:!((l=t.editor)!=null&&l.can().redo())},{default:e.withCtx(()=>[...n[17]||(n[17]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M21 10H11a5 5 0 0 0 0 10h4"}),e.createElementVNode("path",{d:"M21 10l-4-4M21 10l-4 4"})],-1)])]),_:1},8,["theme","disabled"]),e.createVNode(E),e.createVNode(fe,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(E),e.createVNode(ue,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(ge,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(E),e.createVNode(x,{theme:t.theme,title:"Bold","is-active":(s=t.editor)==null?void 0:s.isActive("bold"),onClick:n[2]||(n[2]=u=>{var p;return(p=t.editor)==null?void 0:p.chain().focus().toggleBold().run()})},{default:e.withCtx(()=>[...n[18]||(n[18]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M6 4h8a4 4 0 0 1 0 8H6V4zm0 8h9a4.5 4.5 0 0 1 0 9H6v-9z"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(x,{theme:t.theme,title:"Italic","is-active":(f=t.editor)==null?void 0:f.isActive("italic"),onClick:n[3]||(n[3]=u=>{var p;return(p=t.editor)==null?void 0:p.chain().focus().toggleItalic().run()})},{default:e.withCtx(()=>[...n[19]||(n[19]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M10 4h4M14 4l-4 16M6 20h4"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(x,{theme:t.theme,title:"Underline","is-active":(r=t.editor)==null?void 0:r.isActive("underline"),onClick:n[4]||(n[4]=u=>{var p;return(p=t.editor)==null?void 0:p.chain().focus().toggleUnderline().run()})},{default:e.withCtx(()=>[...n[20]||(n[20]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M6 4v6a6 6 0 0 0 12 0V4M4 20h16"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(x,{theme:t.theme,title:"Strikethrough","is-active":(a=t.editor)==null?void 0:a.isActive("strike"),onClick:n[5]||(n[5]=u=>{var p;return(p=t.editor)==null?void 0:p.chain().focus().toggleStrike().run()})},{default:e.withCtx(()=>[...n[21]||(n[21]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M4 12h16M7 5c0 0 1-1 5-1s5 2 5 4-2 3-5 3M7 19c0 0 1 1 5 1s5-2 5-4"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(x,{theme:t.theme,title:"Subscript","is-active":(i=t.editor)==null?void 0:i.isActive("subscript"),onClick:n[6]||(n[6]=u=>{var p;return(p=t.editor)==null?void 0:p.chain().focus().toggleSubscript().run()})},{default:e.withCtx(()=>[...n[22]||(n[22]=[e.createElementVNode("span",{class:"text-xs font-semibold"},[e.createTextVNode("X"),e.createElementVNode("sub",null,"2")],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(x,{theme:t.theme,title:"Superscript","is-active":(c=t.editor)==null?void 0:c.isActive("superscript"),onClick:n[7]||(n[7]=u=>{var p;return(p=t.editor)==null?void 0:p.chain().focus().toggleSuperscript().run()})},{default:e.withCtx(()=>[...n[23]||(n[23]=[e.createElementVNode("span",{class:"text-xs font-semibold"},[e.createTextVNode("X"),e.createElementVNode("sup",null,"2")],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(we,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(E),e.createVNode(Ee,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(Ve,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(E),e.createVNode(x,{theme:t.theme,title:"Bullet list","is-active":(d=t.editor)==null?void 0:d.isActive("bulletList"),onClick:n[8]||(n[8]=u=>{var p;return(p=t.editor)==null?void 0:p.chain().focus().toggleBulletList().run()})},{default:e.withCtx(()=>[...n[24]||(n[24]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("circle",{cx:"4",cy:"6",r:"1.5",fill:"currentColor"}),e.createElementVNode("path",{d:"M9 6h12"}),e.createElementVNode("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),e.createElementVNode("path",{d:"M9 12h12"}),e.createElementVNode("circle",{cx:"4",cy:"18",r:"1.5",fill:"currentColor"}),e.createElementVNode("path",{d:"M9 18h12"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(x,{theme:t.theme,title:"Numbered list","is-active":(h=t.editor)==null?void 0:h.isActive("orderedList"),onClick:n[9]||(n[9]=u=>{var p;return(p=t.editor)==null?void 0:p.chain().focus().toggleOrderedList().run()})},{default:e.withCtx(()=>[...n[25]||(n[25]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("text",{x:"2",y:"8","font-size":"7",fill:"currentColor",stroke:"none"},"1"),e.createElementVNode("path",{d:"M9 6h12"}),e.createElementVNode("text",{x:"2",y:"14","font-size":"7",fill:"currentColor",stroke:"none"},"2"),e.createElementVNode("path",{d:"M9 12h12"}),e.createElementVNode("text",{x:"2",y:"20","font-size":"7",fill:"currentColor",stroke:"none"},"3"),e.createElementVNode("path",{d:"M9 18h12"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(x,{theme:t.theme,title:"Blockquote","is-active":(w=t.editor)==null?void 0:w.isActive("blockquote"),onClick:n[10]||(n[10]=u=>{var p;return(p=t.editor)==null?void 0:p.chain().focus().toggleBlockquote().run()})},{default:e.withCtx(()=>[...n[26]||(n[26]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor"},[e.createElementVNode("path",{d:"M3 3h8v8H3zM13 3h8v8h-8zM5 11l-2 6h4l2-6zM15 11l-2 6h4l2-6z",opacity:"0.6"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(x,{theme:t.theme,title:"Horizontal rule",onClick:n[11]||(n[11]=u=>{var p;return(p=t.editor)==null?void 0:p.chain().focus().setHorizontalRule().run()})},{default:e.withCtx(()=>[...n[27]||(n[27]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 12h18"})],-1)])]),_:1},8,["theme"]),e.createVNode(E),e.createVNode(Be,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode($e,{editor:t.editor,theme:t.theme,"image-config":t.imageConfig,onError:n[12]||(n[12]=u=>o.$emit("error",u))},null,8,["editor","theme","image-config"]),e.createVNode(Le,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(He,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(E),e.createVNode(x,{theme:t.theme,title:"Save as template",onClick:n[13]||(n[13]=u=>o.$emit("saveTemplate"))},{default:e.withCtx(()=>[...n[28]||(n[28]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),e.createElementVNode("polyline",{points:"17,21 17,13 7,13 7,21"}),e.createElementVNode("polyline",{points:"7,3 7,8 15,8"})],-1)])]),_:1},8,["theme"]),e.createVNode(x,{theme:t.theme,title:"Load template",onClick:n[14]||(n[14]=u=>o.$emit("loadTemplate"))},{default:e.withCtx(()=>[...n[29]||(n[29]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})],-1)])]),_:1},8,["theme"]),e.createVNode(E),e.createElementVNode("button",{class:e.normalizeClass(t.theme.saveButton),onClick:n[15]||(n[15]=u=>o.$emit("save"))}," Save ",2)],2)}}}),De={key:0,class:"bg-white border border-gray-200 rounded-lg shadow-lg p-2 flex flex-wrap gap-1 mb-1"},Re={class:"flex gap-1"},Oe={class:"flex gap-1"},Ie={class:"flex gap-1"},Ue={class:"flex gap-1 items-center"},qe=e.defineComponent({__name:"TablePopoverMenu",props:{editor:{}},setup(t){const o=t;function n(m){var l;(l=o.editor)==null||l.chain().focus().setCellAttribute("backgroundColor",m).run()}return(m,l)=>{var s;return(s=t.editor)!=null&&s.isActive("table")?(e.openBlock(),e.createElementBlock("div",De,[e.createElementVNode("div",Re,[e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-gray-100",onClick:l[0]||(l[0]=f=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().addRowBefore().run()})}," + Row Above "),e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-gray-100",onClick:l[1]||(l[1]=f=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().addRowAfter().run()})}," + Row Below "),e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-red-50 text-red-600",onClick:l[2]||(l[2]=f=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().deleteRow().run()})}," Delete Row ")]),l[12]||(l[12]=e.createElementVNode("span",{class:"w-px h-6 bg-gray-300"},null,-1)),e.createElementVNode("div",Oe,[e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-gray-100",onClick:l[3]||(l[3]=f=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().addColumnBefore().run()})}," + Col Left "),e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-gray-100",onClick:l[4]||(l[4]=f=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().addColumnAfter().run()})}," + Col Right "),e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-red-50 text-red-600",onClick:l[5]||(l[5]=f=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().deleteColumn().run()})}," Delete Col ")]),l[13]||(l[13]=e.createElementVNode("span",{class:"w-px h-6 bg-gray-300"},null,-1)),e.createElementVNode("div",Ie,[e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-gray-100",onClick:l[6]||(l[6]=f=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().mergeCells().run()})}," Merge "),e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-gray-100",onClick:l[7]||(l[7]=f=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().splitCell().run()})}," Split ")]),l[14]||(l[14]=e.createElementVNode("span",{class:"w-px h-6 bg-gray-300"},null,-1)),e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-gray-100",onClick:l[8]||(l[8]=f=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().toggleHeaderRow().run()})}," Toggle Header "),e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-red-50 text-red-600",onClick:l[9]||(l[9]=f=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().deleteTable().run()})}," Delete Table "),l[15]||(l[15]=e.createElementVNode("span",{class:"w-px h-6 bg-gray-300"},null,-1)),e.createElementVNode("div",Ue,[l[11]||(l[11]=e.createElementVNode("label",{class:"text-xs text-gray-500"},"Cell BG:",-1)),e.createElementVNode("input",{type:"color",class:"w-5 h-5 cursor-pointer",onInput:l[10]||(l[10]=f=>n(f.target.value))},null,32)])])):e.createCommentVNode("",!0)}}}),Pe={class:"mb-3"},je={class:"mb-4"},Ge={class:"flex gap-4"},Ke={class:"flex items-center gap-2 text-sm"},Je={class:"flex items-center gap-2 text-sm"},We={class:"flex justify-end gap-2"},Xe=["disabled"],Ye=e.defineComponent({__name:"SaveTemplateModal",props:{theme:{}},emits:["save"],setup(t,{expose:o,emit:n}){const m=n,l=e.ref(!1),s=e.ref(""),f=e.ref("document");function r(){s.value="",f.value="document",l.value=!0}function a(){l.value=!1}function i(){m("save",{name:s.value.trim(),type:f.value}),a()}return o({open:r,close:a}),(c,d)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:e.withModifiers(a,["self"])},[e.createElementVNode("div",{class:e.normalizeClass([t.theme.modal,"w-96"])},[d[7]||(d[7]=e.createElementVNode("h2",{class:"text-lg font-semibold mb-4"},"Save as Template",-1)),e.createElementVNode("div",Pe,[d[3]||(d[3]=e.createElementVNode("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Template Name",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[0]||(d[0]=h=>s.value=h),type:"text",class:"w-full border border-gray-300 rounded px-3 py-2 text-sm",placeholder:"My Template"},null,512),[[e.vModelText,s.value]])]),e.createElementVNode("div",je,[d[6]||(d[6]=e.createElementVNode("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Type",-1)),e.createElementVNode("div",Ge,[e.createElementVNode("label",Ke,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[1]||(d[1]=h=>f.value=h),type:"radio",value:"document"},null,512),[[e.vModelRadio,f.value]]),d[4]||(d[4]=e.createTextVNode(" Full Document ",-1))]),e.createElementVNode("label",Je,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[2]||(d[2]=h=>f.value=h),type:"radio",value:"snippet"},null,512),[[e.vModelRadio,f.value]]),d[5]||(d[5]=e.createTextVNode(" Snippet ",-1))])])]),e.createElementVNode("div",We,[e.createElementVNode("button",{class:"px-4 py-2 text-sm text-gray-600 hover:text-gray-800",onClick:a},"Cancel"),e.createElementVNode("button",{class:e.normalizeClass(t.theme.saveButton),disabled:!s.value.trim(),onClick:i},"Save",10,Xe)])],2)])):e.createCommentVNode("",!0)]))}}),Ze={key:0,class:"text-center py-8 text-gray-500"},Qe={key:1,class:"text-center py-8 text-gray-500"},ve={key:2,class:"overflow-y-auto flex-1 -mx-6 px-6"},_e=["onClick"],et={class:"font-medium text-sm"},tt=["onClick"],nt=e.defineComponent({__name:"LoadTemplateModal",props:{theme:{},templates:{},loading:{type:Boolean}},emits:["select","delete","load"],setup(t,{expose:o,emit:n}){const m=n,l=e.ref(!1);function s(){l.value=!0,m("load")}function f(){l.value=!1}function r(i){m("select",i),f()}function a(i){confirm(`Delete template "${i.name}"?`)&&m("delete",i)}return o({open:s,close:f}),(i,c)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:e.withModifiers(f,["self"])},[e.createElementVNode("div",{class:e.normalizeClass([t.theme.modal,"w-[500px] max-h-[80vh] flex flex-col"])},[c[0]||(c[0]=e.createElementVNode("h2",{class:"text-lg font-semibold mb-4"},"Load Template",-1)),t.loading?(e.openBlock(),e.createElementBlock("div",Ze,"Loading templates...")):t.templates.length===0?(e.openBlock(),e.createElementBlock("div",Qe,"No templates found")):(e.openBlock(),e.createElementBlock("div",ve,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.templates,d=>(e.openBlock(),e.createElementBlock("div",{key:d.id,class:"flex items-center justify-between p-3 border border-gray-200 rounded mb-2 hover:bg-gray-50 cursor-pointer group",onClick:h=>r(d)},[e.createElementVNode("div",null,[e.createElementVNode("div",et,e.toDisplayString(d.name),1),e.createElementVNode("span",{class:e.normalizeClass(["inline-block text-xs px-2 py-0.5 rounded mt-1",d.type==="document"?"bg-blue-100 text-blue-700":"bg-green-100 text-green-700"])},e.toDisplayString(d.type==="document"?"Document":"Snippet"),3)]),e.createElementVNode("button",{class:"text-red-400 hover:text-red-600 opacity-0 group-hover:opacity-100 text-sm px-2",onClick:e.withModifiers(h=>a(d),["stop"])}," Delete ",8,tt)],8,_e))),128))])),e.createElementVNode("div",{class:"flex justify-end pt-4"},[e.createElementVNode("button",{class:"px-4 py-2 text-sm text-gray-600 hover:text-gray-800",onClick:f},"Cancel")])],2)])):e.createCommentVNode("",!0)]))}}),ot={class:"border border-gray-200 rounded-lg overflow-hidden"},lt=e.defineComponent({__name:"DocumentEditor",props:{modelValue:{},mode:{default:"document"},templateMeta:{},api:{},image:{},theme:{},placeholder:{default:""},readonly:{type:Boolean,default:!1}},emits:["update:modelValue","save","error"],setup(t,{emit:o}){const n=t,m=o,l=e.computed(()=>({...T,...n.theme})),s=V.useEditor({content:n.modelValue,editable:!n.readonly,extensions:[H,F.TextStyle,D,Y,R,O,I,U.configure({types:["textStyle"]}),q.configure({types:["heading","paragraph"]}),Z,P.configure({openOnClick:!1,HTMLAttributes:{target:"_blank",rel:"noopener noreferrer"}}),te,G.Table.configure({resizable:!0}),K,J,W,ne,j.configure({placeholder:n.placeholder||"Start typing..."})],onUpdate:()=>{var u;m("update:modelValue",((u=s.value)==null?void 0:u.getHTML())??"")}});e.provide(L,s),e.watch(()=>n.modelValue,u=>{var p,k;((p=s.value)==null?void 0:p.getHTML())!==u&&((k=s.value)==null||k.commands.setContent(u,{emitUpdate:!1}))}),e.watch(()=>n.readonly,u=>{var p;(p=s.value)==null||p.setEditable(!u)});function f(u){m("error",u)}const r=oe(n.api),a=e.ref(null),i=e.ref(null);async function c(u){var p,k,b;try{const y=((p=s.value)==null?void 0:p.getHTML())??"",C=u.type==="snippet"&&((k=s.value)!=null&&k.state.selection.content())&&((b=s.value)==null?void 0:b.state.selection.content().content.textBetween(0,s.value.state.selection.content().content.size))||y;await r.saveTemplate({name:u.name,type:u.type,content:C})}catch(y){const C=y instanceof Error?y.message:"Unknown error";m("error",{message:C,detail:y})}}function d(u){var p,k,b,y;if(u.type==="document"){if(((p=s.value)==null?void 0:p.getHTML())!=="<p></p>"&&((k=s.value)==null?void 0:k.getHTML())!==""&&!confirm("Replace current content with this template?"))return;(b=s.value)==null||b.commands.setContent(u.content)}else(y=s.value)==null||y.commands.insertContent(u.content)}async function h(u){try{await r.deleteTemplate(u.id),await r.loadTemplates()}catch(p){const k=p instanceof Error?p.message:"Unknown error";m("error",{message:k,detail:p})}}async function w(){var u;try{const p=((u=s.value)==null?void 0:u.getHTML())??"",k=n.mode==="template"?n.api.saveTemplate:n.api.saveDocument,b=n.mode==="template"?{...n.templateMeta,content:p}:{content:p},y=await fetch(k,{method:"POST",headers:{"Content-Type":"application/json",...n.api.headers},body:JSON.stringify(b)});if(!y.ok)throw new Error(`Save failed: ${y.statusText}`);const C=await y.json();m("save",C)}catch(p){const k=p instanceof Error?p.message:"Unknown error";m("error",{message:k,detail:p})}}return(u,p)=>(e.openBlock(),e.createElementBlock("div",ot,[n.readonly?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(Fe,{editor:e.unref(s),theme:l.value,"image-config":n.image,onSaveTemplate:p[0]||(p[0]=k=>{var b;return(b=a.value)==null?void 0:b.open()}),onLoadTemplate:p[1]||(p[1]=k=>{var b;return(b=i.value)==null?void 0:b.open()}),onSave:w,onError:f},null,8,["editor","theme","image-config"]),e.createVNode(qe,{editor:e.unref(s)},null,8,["editor"])],64)),e.createVNode(e.unref(V.EditorContent),{editor:e.unref(s),class:e.normalizeClass(l.value.editor)},null,8,["editor","class"]),e.createVNode(Ye,{ref_key:"saveTemplateModal",ref:a,theme:l.value,onSave:c},null,8,["theme"]),e.createVNode(nt,{ref_key:"loadTemplateModal",ref:i,theme:l.value,templates:e.unref(r).templates.value,loading:e.unref(r).loading.value,onLoad:p[2]||(p[2]=k=>e.unref(r).loadTemplates()),onSelect:d,onDelete:h},null,8,["theme","templates","loading"])]))}});g.DEFAULT_IMAGE_CONFIG=$,g.DEFAULT_THEME=T,g.DocumentEditor=lt,g.FONT_SIZES=S,g.LINE_HEIGHTS=A,g.WEB_SAFE_FONTS=M,g.useDocumentEditor=le,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(x,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@tiptap/vue-3"),require("@tiptap/starter-kit"),require("@tiptap/extension-text-style"),require("@tiptap/extension-font-family"),require("@tiptap/extension-underline"),require("@tiptap/extension-subscript"),require("@tiptap/extension-superscript"),require("@tiptap/extension-color"),require("@tiptap/extension-text-align"),require("@tiptap/extension-link"),require("@tiptap/extension-placeholder"),require("@tiptap/extension-table"),require("@tiptap/extension-table-row"),require("@tiptap/extension-table-cell"),require("@tiptap/extension-table-header"),require("@tiptap/core"),require("@tiptap/extension-image")):typeof define=="function"&&define.amd?define(["exports","vue","@tiptap/vue-3","@tiptap/starter-kit","@tiptap/extension-text-style","@tiptap/extension-font-family","@tiptap/extension-underline","@tiptap/extension-subscript","@tiptap/extension-superscript","@tiptap/extension-color","@tiptap/extension-text-align","@tiptap/extension-link","@tiptap/extension-placeholder","@tiptap/extension-table","@tiptap/extension-table-row","@tiptap/extension-table-cell","@tiptap/extension-table-header","@tiptap/core","@tiptap/extension-image"],e):(x=typeof globalThis<"u"?globalThis:x||self,e(x.DocumentCreator={},x.Vue,x.vue3,x.StarterKit,x.extensionTextStyle,x.FontFamily,x.Underline,x.Subscript,x.Superscript,x.Color,x.TextAlign,x.Link,x.Placeholder,x.extensionTable,x.TableRow,x.TableCell,x.TableHeader,x.core,x.Image))})(this,(function(x,e,y,A,z,H,F,D,R,I,O,U,q,P,j,G,K,V,W){"use strict";const J=V.Extension.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>{var o;return((o=t.style.fontSize)==null?void 0:o.replace(/['"]+/g,""))||null},renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:o})=>o().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),X=V.Extension.create({name:"lineHeight",addOptions(){return{types:["heading","paragraph"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight||null,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({commands:o})=>this.options.types.every(n=>o.updateAttributes(n,{lineHeight:t})),unsetLineHeight:()=>({commands:t})=>this.options.types.every(o=>t.resetAttributes(o,"lineHeight"))}}}),Y=["src","alt"],Z={key:0,class:"absolute -top-10 left-0 flex items-center gap-1 bg-white border border-gray-200 rounded shadow-md p-1 z-10"},Q=["onClick"],v=e.defineComponent({__name:"ImageResizePopover",props:y.nodeViewProps,setup(t){const o=t,n=e.ref(o.node.attrs.width||""),c=e.ref(o.node.attrs.alt||""),l=e.computed(()=>{const d={};return o.node.attrs.width&&(d.width=o.node.attrs.width),o.node.attrs.height&&(d.height=o.node.attrs.height),d}),s=e.computed(()=>{const d=o.node.attrs.align;return d==="center"?"mx-auto block":d==="right"?"ml-auto block":"block"});function m(){const d=o.getPos();d!=null&&o.editor.commands.setNodeSelection(d)}function r(d){o.updateAttributes({width:d}),n.value=d}function f(d){o.updateAttributes({align:d})}function i(){o.updateAttributes({alt:c.value})}return(d,a)=>(e.openBlock(),e.createBlock(e.unref(y.NodeViewWrapper),{class:e.normalizeClass(["relative inline-block",s.value])},{default:e.withCtx(()=>[e.createElementVNode("img",{src:d.node.attrs.src,alt:d.node.attrs.alt||"",style:e.normalizeStyle(l.value),class:e.normalizeClass(["cursor-pointer max-w-full",d.selected?"ring-2 ring-blue-400":""]),onClick:m},null,14,Y),d.selected?(e.openBlock(),e.createElementBlock("div",Z,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(["25%","50%","75%","100%"],p=>e.createElementVNode("button",{key:p,class:"px-2 py-0.5 text-xs rounded hover:bg-gray-100",onClick:g=>r(p)},e.toDisplayString(p),9,Q)),64)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=p=>n.value=p),class:"w-16 border border-gray-300 rounded px-1 py-0.5 text-xs",placeholder:"e.g. 100%",onKeydown:a[1]||(a[1]=e.withKeys(p=>r(n.value),["enter"]))},null,544),[[e.vModelText,n.value]]),a[9]||(a[9]=e.createElementVNode("span",{class:"w-px h-4 bg-gray-300 mx-1"},null,-1)),e.createElementVNode("button",{class:"px-1 py-0.5 text-xs rounded hover:bg-gray-100",title:"Align left",onClick:a[2]||(a[2]=p=>f("left"))},[...a[6]||(a[6]=[e.createElementVNode("svg",{class:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 6h18M3 12h10M3 18h14"})],-1)])]),e.createElementVNode("button",{class:"px-1 py-0.5 text-xs rounded hover:bg-gray-100",title:"Align center",onClick:a[3]||(a[3]=p=>f("center"))},[...a[7]||(a[7]=[e.createElementVNode("svg",{class:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 6h18M7 12h10M5 18h14"})],-1)])]),e.createElementVNode("button",{class:"px-1 py-0.5 text-xs rounded hover:bg-gray-100",title:"Align right",onClick:a[4]||(a[4]=p=>f("right"))},[...a[8]||(a[8]=[e.createElementVNode("svg",{class:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 6h18M11 12h10M7 18h14"})],-1)])]),a[10]||(a[10]=e.createElementVNode("span",{class:"w-px h-4 bg-gray-300 mx-1"},null,-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[5]||(a[5]=p=>c.value=p),class:"w-20 border border-gray-300 rounded px-1 py-0.5 text-xs",placeholder:"Alt text",onBlur:i,onKeydown:e.withKeys(i,["enter"])},null,544),[[e.vModelText,c.value]])])):e.createCommentVNode("",!0)]),_:1},8,["class"]))}}),_=W.extend({name:"image",addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),width:{default:null,parseHTML:o=>o.getAttribute("width")||o.style.width||null,renderHTML:o=>o.width?{style:`width: ${o.width}`}:{}},height:{default:null,parseHTML:o=>o.getAttribute("height")||o.style.height||null,renderHTML:o=>o.height?{style:`height: ${o.height}`}:{}},align:{default:null,parseHTML:o=>o.getAttribute("data-align")||null,renderHTML:o=>{if(!o.align)return{};const n={left:"margin-right: auto",center:"margin-left: auto; margin-right: auto",right:"margin-left: auto"};return{"data-align":o.align,style:`display: block; ${n[o.align]||""}`}}}}},addNodeView(){return y.VueNodeViewRenderer(v)}}).configure({allowBase64:!0,inline:!1}),ee=V.Node.create({name:"video",group:"block",atom:!0,addAttributes(){return{src:{default:null},width:{default:"100%"},height:{default:"315"},frameborder:{default:"0"},allowfullscreen:{default:!0}}},parseHTML(){return[{tag:"iframe[src]"}]},renderHTML({HTMLAttributes:t}){return["div",{class:"video-wrapper"},["iframe",V.mergeAttributes(t)]]},addCommands(){return{setVideo:t=>({commands:o})=>o.insertContent({type:this.name,attrs:t})}}}),N={toolbar:"bg-white border-b border-gray-200 p-2 flex flex-wrap items-center gap-1",toolbarButton:"hover:bg-gray-100 rounded p-1.5 text-gray-600 cursor-pointer",toolbarButtonActive:"bg-blue-100 text-blue-600",editor:"bg-white min-h-[400px] p-4 prose max-w-none focus:outline-none",dropdown:"bg-white border border-gray-200 rounded shadow-lg py-1 z-50",modal:"bg-white rounded-lg shadow-xl p-6",saveButton:"bg-blue-600 text-white rounded px-4 py-2 hover:bg-blue-700"},B={maxSize:5*1024*1024,allowedTypes:["image/jpeg","image/png","image/gif"]},$=["Arial","Times New Roman","Courier New","Georgia","Verdana","Trebuchet MS","Comic Sans MS","Impact"],M=["8","10","12","14","16","18","20","24","28","32","36","48","72"],T=["1","1.15","1.5","2","2.5","3"],S=Symbol("document-editor");function te(){const t=e.inject(S);if(!t)throw new Error("useDocumentEditor must be used within a DocumentEditor component");return{editor:t,getHTML:()=>{var o;return((o=t.value)==null?void 0:o.getHTML())??""},getText:()=>{var o;return((o=t.value)==null?void 0:o.getText())??""},setContent:o=>{var n;return(n=t.value)==null?void 0:n.commands.setContent(o)},focus:()=>{var o;return(o=t.value)==null?void 0:o.commands.focus()},isEmpty:()=>{var o;return((o=t.value)==null?void 0:o.isEmpty)??!0}}}const ne=["title","disabled"],k=e.defineComponent({__name:"ToolbarButton",props:{theme:{},title:{},isActive:{type:Boolean},disabled:{type:Boolean}},emits:["click"],setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("button",{type:"button",class:e.normalizeClass([t.theme.toolbarButton,t.isActive&&t.theme.toolbarButtonActive]),title:t.title,disabled:t.disabled,onClick:n[0]||(n[0]=c=>o.$emit("click"))},[e.renderSlot(o.$slots,"default")],10,ne))}}),oe=(t,o)=>{const n=t.__vccOpts||t;for(const[c,l]of o)n[c]=l;return n},le={},re={class:"w-px h-6 bg-gray-300 mx-1"};function ie(t,o){return e.openBlock(),e.createElementBlock("div",re)}const b=oe(le,[["render",ie]]),ae=["title"],C=e.defineComponent({__name:"ToolbarDropdown",props:{theme:{},label:{},title:{}},setup(t){const o=e.ref(!1),n=e.ref(null);function c(){o.value=!1}function l(s){n.value&&!n.value.contains(s.target)&&(o.value=!1)}return e.onMounted(()=>document.addEventListener("click",l)),e.onBeforeUnmount(()=>document.removeEventListener("click",l)),(s,m)=>(e.openBlock(),e.createElementBlock("div",{class:"relative",ref_key:"dropdownRef",ref:n},[e.createElementVNode("button",{type:"button",class:e.normalizeClass([t.theme.toolbarButton,"flex items-center gap-1 px-2 text-sm"]),title:t.title,onClick:m[0]||(m[0]=r=>o.value=!o.value)},[e.createElementVNode("span",null,e.toDisplayString(t.label),1),m[1]||(m[1]=e.createElementVNode("svg",{class:"w-3 h-3",viewBox:"0 0 12 12",fill:"currentColor"},[e.createElementVNode("path",{d:"M2 4l4 4 4-4",stroke:"currentColor","stroke-width":"1.5",fill:"none"})],-1))],10,ae),o.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([t.theme.dropdown,"absolute top-full left-0 mt-1 min-w-[150px] max-h-60 overflow-y-auto"])},[e.renderSlot(s.$slots,"default",{close:c})],2)):e.createCommentVNode("",!0)],512))}}),se=["onClick"],de=e.defineComponent({__name:"HeadingPicker",props:{editor:{},theme:{}},setup(t){const o=t,n=[{label:"Paragraph",value:"paragraph",class:"text-sm"},{label:"Heading 1",value:1,class:"text-2xl font-bold"},{label:"Heading 2",value:2,class:"text-xl font-bold"},{label:"Heading 3",value:3,class:"text-lg font-bold"},{label:"Heading 4",value:4,class:"text-base font-semibold"},{label:"Heading 5",value:5,class:"text-sm font-semibold"},{label:"Heading 6",value:6,class:"text-xs font-semibold"}];function c(m){var r,f;return m.value==="paragraph"?(r=o.editor)==null?void 0:r.isActive("paragraph"):(f=o.editor)==null?void 0:f.isActive("heading",{level:m.value})}const l=e.computed(()=>{const m=n.find(r=>c(r));return(m==null?void 0:m.label)??"Paragraph"});function s(m){var r,f;m.value==="paragraph"?(r=o.editor)==null||r.chain().focus().setParagraph().run():(f=o.editor)==null||f.chain().focus().toggleHeading({level:m.value}).run()}return(m,r)=>(e.openBlock(),e.createBlock(C,{theme:t.theme,label:l.value,title:"Block type"},{default:e.withCtx(({close:f})=>[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(n,i=>e.createElementVNode("button",{key:i.value,class:e.normalizeClass(["block w-full text-left px-3 py-1.5 hover:bg-gray-100",i.class,c(i)?"bg-gray-50 font-semibold":""]),onClick:d=>{s(i),f()}},e.toDisplayString(i.label),11,se)),64))]),_:1},8,["theme","label"]))}}),ce=["onClick"],me=e.defineComponent({__name:"FontFamilyPicker",props:{editor:{},theme:{}},setup(t){const o=t,n=$,c=e.computed(()=>{var l;for(const s of n)if((l=o.editor)!=null&&l.isActive("textStyle",{fontFamily:s}))return s;return"Font"});return(l,s)=>(e.openBlock(),e.createBlock(C,{theme:t.theme,label:c.value,title:"Font family"},{default:e.withCtx(({close:m})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),r=>(e.openBlock(),e.createElementBlock("button",{key:r,style:e.normalizeStyle({fontFamily:r}),class:e.normalizeClass(["block w-full text-left px-3 py-1.5 hover:bg-gray-100 text-sm",c.value===r?"bg-gray-50 font-semibold":""]),onClick:f=>{var i;(i=t.editor)==null||i.chain().focus().setFontFamily(r).run(),m()}},e.toDisplayString(r),15,ce))),128))]),_:1},8,["theme","label"]))}}),fe=["onClick"],pe=e.defineComponent({__name:"FontSizePicker",props:{editor:{},theme:{}},setup(t){const o=t,n=M,c=e.computed(()=>{var l;for(const s of n)if((l=o.editor)!=null&&l.isActive("textStyle",{fontSize:s+"px"}))return s;return""});return(l,s)=>(e.openBlock(),e.createBlock(C,{theme:t.theme,label:c.value||"Size",title:"Font size"},{default:e.withCtx(({close:m})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),r=>(e.openBlock(),e.createElementBlock("button",{key:r,class:e.normalizeClass(["block w-full text-left px-3 py-1.5 hover:bg-gray-100 text-sm",c.value===r?"bg-gray-50 font-semibold":""]),onClick:f=>{var i;(i=t.editor)==null||i.chain().focus().setFontSize(r+"px").run(),m()}},e.toDisplayString(r),11,fe))),128))]),_:1},8,["theme","label"]))}}),ue={class:"grid grid-cols-8 gap-1 mb-2"},he=["title","onClick"],ge={class:"flex items-center gap-2 pt-2 border-t border-gray-100"},xe=["value"],ke=e.defineComponent({__name:"ColorPicker",props:{editor:{},theme:{}},setup(t){const o=t,n=e.ref(!1),c=e.ref(null),l=["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#ffffff","#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#0000ff","#9900ff","#ff00ff","#e6b8af","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#c9daf8","#cfe2f3","#d9d2e9","#ead1dc","#dd7e6b","#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#a4c2f4","#9fc5e8","#b4a7d6","#d5a6bd"],s=e.computed(()=>{var f;return((f=o.editor)==null?void 0:f.getAttributes("textStyle").color)||"#000000"});function m(f){var i;(i=o.editor)==null||i.chain().focus().setColor(f).run(),n.value=!1}function r(f){c.value&&!c.value.contains(f.target)&&(n.value=!1)}return e.onMounted(()=>document.addEventListener("click",r)),e.onBeforeUnmount(()=>document.removeEventListener("click",r)),(f,i)=>(e.openBlock(),e.createElementBlock("div",{class:"relative",ref_key:"pickerRef",ref:c},[e.createElementVNode("button",{type:"button",class:e.normalizeClass([t.theme.toolbarButton,"flex items-center gap-1 px-2"]),title:"Font color",onClick:i[0]||(i[0]=d=>n.value=!n.value)},[i[2]||(i[2]=e.createElementVNode("span",null,"A",-1)),e.createElementVNode("div",{class:"w-4 h-1 rounded",style:e.normalizeStyle({backgroundColor:s.value})},null,4)],2),n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([t.theme.dropdown,"absolute top-full left-0 mt-1 p-2 w-48"])},[e.createElementVNode("div",ue,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(l,d=>e.createElementVNode("button",{key:d,class:"w-5 h-5 rounded border border-gray-200 cursor-pointer hover:scale-110 transition-transform",style:e.normalizeStyle({backgroundColor:d}),title:d,onClick:a=>m(d)},null,12,he)),64))]),e.createElementVNode("div",ge,[i[3]||(i[3]=e.createElementVNode("label",{class:"text-xs text-gray-500"},"Custom:",-1)),e.createElementVNode("input",{type:"color",value:s.value,class:"w-6 h-6 cursor-pointer",onInput:i[1]||(i[1]=d=>m(d.target.value))},null,40,xe)])],2)):e.createCommentVNode("",!0)],512))}}),be=e.defineComponent({__name:"AlignmentButtons",props:{editor:{},theme:{}},setup(t){return(o,n)=>{var c,l,s,m;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(k,{theme:t.theme,title:"Align left","is-active":(c=t.editor)==null?void 0:c.isActive({textAlign:"left"}),onClick:n[0]||(n[0]=r=>{var f;return(f=t.editor)==null?void 0:f.chain().focus().setTextAlign("left").run()})},{default:e.withCtx(()=>[...n[4]||(n[4]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 6h18M3 12h10M3 18h14"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(k,{theme:t.theme,title:"Align center","is-active":(l=t.editor)==null?void 0:l.isActive({textAlign:"center"}),onClick:n[1]||(n[1]=r=>{var f;return(f=t.editor)==null?void 0:f.chain().focus().setTextAlign("center").run()})},{default:e.withCtx(()=>[...n[5]||(n[5]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 6h18M7 12h10M5 18h14"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(k,{theme:t.theme,title:"Align right","is-active":(s=t.editor)==null?void 0:s.isActive({textAlign:"right"}),onClick:n[2]||(n[2]=r=>{var f;return(f=t.editor)==null?void 0:f.chain().focus().setTextAlign("right").run()})},{default:e.withCtx(()=>[...n[6]||(n[6]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 6h18M11 12h10M7 18h14"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(k,{theme:t.theme,title:"Justify","is-active":(m=t.editor)==null?void 0:m.isActive({textAlign:"justify"}),onClick:n[3]||(n[3]=r=>{var f;return(f=t.editor)==null?void 0:f.chain().focus().setTextAlign("justify").run()})},{default:e.withCtx(()=>[...n[7]||(n[7]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 6h18M3 12h18M3 18h18"})],-1)])]),_:1},8,["theme","is-active"])],64)}}}),ye=["onClick"],Ee=e.defineComponent({__name:"LineHeightPicker",props:{editor:{},theme:{}},setup(t){const o=t,n=T,c=e.computed(()=>{var l,s;return((l=o.editor)==null?void 0:l.getAttributes("paragraph").lineHeight)||((s=o.editor)==null?void 0:s.getAttributes("heading").lineHeight)||""});return(l,s)=>(e.openBlock(),e.createBlock(C,{theme:t.theme,label:c.value||"Height",title:"Line height"},{default:e.withCtx(({close:m})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),r=>(e.openBlock(),e.createElementBlock("button",{key:r,class:e.normalizeClass(["block w-full text-left px-3 py-1.5 hover:bg-gray-100 text-sm",c.value===r?"bg-gray-50 font-semibold":""]),onClick:f=>{var i;(i=t.editor)==null||i.chain().focus().setLineHeight(r).run(),m()}},e.toDisplayString(r),11,ye))),128))]),_:1},8,["theme","label"]))}}),Ve={class:"flex gap-2"},Ce=e.defineComponent({__name:"LinkButton",props:{editor:{},theme:{}},setup(t){const o=t,n=e.ref(!1),c=e.ref(""),l=e.ref(null),s=e.ref(null);function m(){var d;c.value=((d=o.editor)==null?void 0:d.getAttributes("link").href)||"",n.value=!n.value,n.value&&e.nextTick(()=>{var a;return(a=s.value)==null?void 0:a.focus()})}function r(){var d;c.value&&((d=o.editor)==null||d.chain().focus().extendMarkRange("link").setLink({href:c.value}).run()),n.value=!1}function f(){var d;(d=o.editor)==null||d.chain().focus().unsetLink().run(),n.value=!1}function i(d){l.value&&!l.value.contains(d.target)&&(n.value=!1)}return e.onMounted(()=>document.addEventListener("click",i)),e.onBeforeUnmount(()=>document.removeEventListener("click",i)),(d,a)=>{var p,g;return e.openBlock(),e.createElementBlock("div",{class:"relative",ref_key:"linkRef",ref:l},[e.createVNode(k,{theme:t.theme,title:"Link","is-active":(p=t.editor)==null?void 0:p.isActive("link"),onClick:m},{default:e.withCtx(()=>[...a[2]||(a[2]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e.createElementVNode("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})],-1)])]),_:1},8,["theme","is-active"]),n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([t.theme.dropdown,"absolute top-full left-0 mt-1 p-3 w-72"])},[a[3]||(a[3]=e.createElementVNode("label",{class:"block text-xs text-gray-500 mb-1"},"URL",-1)),e.withDirectives(e.createElementVNode("input",{ref_key:"urlInput",ref:s,"onUpdate:modelValue":a[0]||(a[0]=h=>c.value=h),type:"url",placeholder:"https://example.com",class:"w-full border border-gray-300 rounded px-2 py-1 text-sm mb-2",onKeydown:e.withKeys(r,["enter"])},null,544),[[e.vModelText,c.value]]),e.createElementVNode("div",Ve,[e.createElementVNode("button",{class:"px-3 py-1 text-sm bg-blue-600 text-white rounded hover:bg-blue-700",onClick:r}," Apply "),(g=t.editor)!=null&&g.isActive("link")?(e.openBlock(),e.createElementBlock("button",{key:0,class:"px-3 py-1 text-sm bg-red-100 text-red-600 rounded hover:bg-red-200",onClick:f}," Remove ")):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"px-3 py-1 text-sm text-gray-500 hover:text-gray-700",onClick:a[1]||(a[1]=h=>n.value=!1)}," Cancel ")])],2)):e.createCommentVNode("",!0)],512)}}}),we=["accept"],Ne=e.defineComponent({__name:"ImageUploadButton",props:{editor:{},theme:{},imageConfig:{}},emits:["error"],setup(t,{emit:o}){const n=t,c=o,l=e.ref(null),s=e.computed(()=>({...B,...n.imageConfig})),m=e.computed(()=>s.value.allowedTypes.join(","));function r(){var i;(i=l.value)==null||i.click()}function f(i){var g;const d=i.target,a=(g=d.files)==null?void 0:g[0];if(!a)return;if(!s.value.allowedTypes.includes(a.type)){c("error",{message:`File type ${a.type} is not allowed`,detail:{allowedTypes:s.value.allowedTypes}}),d.value="";return}if(a.size>s.value.maxSize){const h=(s.value.maxSize/1048576).toFixed(1);c("error",{message:`File size exceeds ${h}MB limit`,detail:{maxSize:s.value.maxSize,fileSize:a.size}}),d.value="";return}const p=new FileReader;p.onload=()=>{var u;const h=p.result;(u=n.editor)==null||u.chain().focus().setImage({src:h}).run()},p.readAsDataURL(a),d.value=""}return(i,d)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(k,{theme:t.theme,title:"Insert image",onClick:r},{default:e.withCtx(()=>[...d[0]||(d[0]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.createElementVNode("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.createElementVNode("path",{d:"M21 15l-5-5L5 21"})],-1)])]),_:1},8,["theme"]),e.createElementVNode("input",{ref_key:"fileInput",ref:l,type:"file",accept:m.value,class:"hidden",onChange:f},null,40,we)],64))}}),Be={class:"mb-1 text-xs text-gray-500 text-center"},$e=["onMouseenter"],Me=8,L=10,Te=e.defineComponent({__name:"TableGridPicker",props:{editor:{},theme:{}},setup(t){const o=t,n=e.ref(!1),c=e.ref(0),l=e.ref(0),s=e.ref(null);function m(f,i){var d;(d=o.editor)==null||d.chain().focus().insertTable({rows:f,cols:i,withHeaderRow:!0}).run(),n.value=!1,c.value=0,l.value=0}function r(f){s.value&&!s.value.contains(f.target)&&(n.value=!1)}return e.onMounted(()=>document.addEventListener("click",r)),e.onBeforeUnmount(()=>document.removeEventListener("click",r)),(f,i)=>(e.openBlock(),e.createElementBlock("div",{class:"relative",ref_key:"pickerRef",ref:s},[e.createVNode(k,{theme:t.theme,title:"Insert table",onClick:i[0]||(i[0]=d=>n.value=!n.value)},{default:e.withCtx(()=>[...i[2]||(i[2]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("rect",{x:"3",y:"3",width:"18",height:"18",rx:"1"}),e.createElementVNode("path",{d:"M3 9h18M3 15h18M9 3v18M15 3v18"})],-1)])]),_:1},8,["theme"]),n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([t.theme.dropdown,"absolute top-full left-0 mt-1 p-2"])},[e.createElementVNode("div",Be,e.toDisplayString(l.value>0?`${l.value} × ${c.value}`:"Select size"),1),e.createElementVNode("div",{class:"grid gap-0.5",style:e.normalizeStyle({gridTemplateColumns:`repeat(${L}, 1fr)`})},[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(Me,d=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"row-"+d},[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(L,a=>e.createElementVNode("div",{key:"cell-"+d+"-"+a,class:e.normalizeClass(["w-5 h-5 border cursor-pointer",d<=c.value&&a<=l.value?"bg-blue-200 border-blue-300":"bg-white border-gray-300"]),onMouseenter:p=>{c.value=d,l.value=a},onClick:i[1]||(i[1]=p=>m(c.value,l.value))},null,42,$e)),64))],64))),64))],4)],2)):e.createCommentVNode("",!0)],512))}}),Se={class:"flex gap-2"},Le=e.defineComponent({__name:"VideoEmbedButton",props:{editor:{},theme:{}},setup(t){const o=t,n=e.ref(!1),c=e.ref(""),l=e.ref(null);function s(f){const i=f.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/);if(i)return`https://www.youtube.com/embed/${i[1]}`;const d=f.match(/vimeo\.com\/(\d+)/);return d?`https://player.vimeo.com/video/${d[1]}`:f}function m(){var f;if(c.value){const i=s(c.value);(f=o.editor)==null||f.chain().focus().setVideo({src:i}).run()}n.value=!1,c.value=""}function r(f){l.value&&!l.value.contains(f.target)&&(n.value=!1)}return e.onMounted(()=>document.addEventListener("click",r)),e.onBeforeUnmount(()=>document.removeEventListener("click",r)),(f,i)=>(e.openBlock(),e.createElementBlock("div",{class:"relative",ref_key:"videoRef",ref:l},[e.createVNode(k,{theme:t.theme,title:"Embed video",onClick:i[0]||(i[0]=d=>n.value=!n.value)},{default:e.withCtx(()=>[...i[3]||(i[3]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("polygon",{points:"5,3 19,12 5,21"})],-1)])]),_:1},8,["theme"]),n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([t.theme.dropdown,"absolute top-full left-0 mt-1 p-3 w-80"])},[i[4]||(i[4]=e.createElementVNode("label",{class:"block text-xs text-gray-500 mb-1"},"Video URL (YouTube, Vimeo)",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i[1]||(i[1]=d=>c.value=d),type:"url",placeholder:"https://www.youtube.com/watch?v=...",class:"w-full border border-gray-300 rounded px-2 py-1 text-sm mb-2",onKeydown:e.withKeys(m,["enter"])},null,544),[[e.vModelText,c.value]]),e.createElementVNode("div",Se,[e.createElementVNode("button",{class:"px-3 py-1 text-sm bg-blue-600 text-white rounded hover:bg-blue-700",onClick:m}," Embed "),e.createElementVNode("button",{class:"px-3 py-1 text-sm text-gray-500 hover:text-gray-700",onClick:i[2]||(i[2]=d=>n.value=!1)}," Cancel ")])],2)):e.createCommentVNode("",!0)],512))}}),Ae=e.defineComponent({__name:"EditorToolbar",props:{editor:{},theme:{},imageConfig:{}},emits:["saveTemplate","loadTemplate","save","error"],setup(t){return(o,n)=>{var c,l,s,m,r,f,i,d,a,p,g;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(t.theme.toolbar)},[e.createVNode(k,{theme:t.theme,title:"Undo",onClick:n[0]||(n[0]=h=>{var u;return(u=t.editor)==null?void 0:u.chain().focus().undo().run()}),disabled:!((c=t.editor)!=null&&c.can().undo())},{default:e.withCtx(()=>[...n[16]||(n[16]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 10h10a5 5 0 0 1 0 10H9"}),e.createElementVNode("path",{d:"M3 10l4-4M3 10l4 4"})],-1)])]),_:1},8,["theme","disabled"]),e.createVNode(k,{theme:t.theme,title:"Redo",onClick:n[1]||(n[1]=h=>{var u;return(u=t.editor)==null?void 0:u.chain().focus().redo().run()}),disabled:!((l=t.editor)!=null&&l.can().redo())},{default:e.withCtx(()=>[...n[17]||(n[17]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M21 10H11a5 5 0 0 0 0 10h4"}),e.createElementVNode("path",{d:"M21 10l-4-4M21 10l-4 4"})],-1)])]),_:1},8,["theme","disabled"]),e.createVNode(b),e.createVNode(de,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(b),e.createVNode(me,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(pe,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(b),e.createVNode(k,{theme:t.theme,title:"Bold","is-active":(s=t.editor)==null?void 0:s.isActive("bold"),onClick:n[2]||(n[2]=h=>{var u;return(u=t.editor)==null?void 0:u.chain().focus().toggleBold().run()})},{default:e.withCtx(()=>[...n[18]||(n[18]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M6 4h8a4 4 0 0 1 0 8H6V4zm0 8h9a4.5 4.5 0 0 1 0 9H6v-9z"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(k,{theme:t.theme,title:"Italic","is-active":(m=t.editor)==null?void 0:m.isActive("italic"),onClick:n[3]||(n[3]=h=>{var u;return(u=t.editor)==null?void 0:u.chain().focus().toggleItalic().run()})},{default:e.withCtx(()=>[...n[19]||(n[19]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M10 4h4M14 4l-4 16M6 20h4"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(k,{theme:t.theme,title:"Underline","is-active":(r=t.editor)==null?void 0:r.isActive("underline"),onClick:n[4]||(n[4]=h=>{var u;return(u=t.editor)==null?void 0:u.chain().focus().toggleUnderline().run()})},{default:e.withCtx(()=>[...n[20]||(n[20]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M6 4v6a6 6 0 0 0 12 0V4M4 20h16"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(k,{theme:t.theme,title:"Strikethrough","is-active":(f=t.editor)==null?void 0:f.isActive("strike"),onClick:n[5]||(n[5]=h=>{var u;return(u=t.editor)==null?void 0:u.chain().focus().toggleStrike().run()})},{default:e.withCtx(()=>[...n[21]||(n[21]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M4 12h16M7 5c0 0 1-1 5-1s5 2 5 4-2 3-5 3M7 19c0 0 1 1 5 1s5-2 5-4"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(k,{theme:t.theme,title:"Subscript","is-active":(i=t.editor)==null?void 0:i.isActive("subscript"),onClick:n[6]||(n[6]=h=>{var u;return(u=t.editor)==null?void 0:u.chain().focus().toggleSubscript().run()})},{default:e.withCtx(()=>[...n[22]||(n[22]=[e.createElementVNode("span",{class:"text-xs font-semibold"},[e.createTextVNode("X"),e.createElementVNode("sub",null,"2")],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(k,{theme:t.theme,title:"Superscript","is-active":(d=t.editor)==null?void 0:d.isActive("superscript"),onClick:n[7]||(n[7]=h=>{var u;return(u=t.editor)==null?void 0:u.chain().focus().toggleSuperscript().run()})},{default:e.withCtx(()=>[...n[23]||(n[23]=[e.createElementVNode("span",{class:"text-xs font-semibold"},[e.createTextVNode("X"),e.createElementVNode("sup",null,"2")],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(ke,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(b),e.createVNode(be,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(Ee,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(b),e.createVNode(k,{theme:t.theme,title:"Bullet list","is-active":(a=t.editor)==null?void 0:a.isActive("bulletList"),onClick:n[8]||(n[8]=h=>{var u;return(u=t.editor)==null?void 0:u.chain().focus().toggleBulletList().run()})},{default:e.withCtx(()=>[...n[24]||(n[24]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("circle",{cx:"4",cy:"6",r:"1.5",fill:"currentColor"}),e.createElementVNode("path",{d:"M9 6h12"}),e.createElementVNode("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),e.createElementVNode("path",{d:"M9 12h12"}),e.createElementVNode("circle",{cx:"4",cy:"18",r:"1.5",fill:"currentColor"}),e.createElementVNode("path",{d:"M9 18h12"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(k,{theme:t.theme,title:"Numbered list","is-active":(p=t.editor)==null?void 0:p.isActive("orderedList"),onClick:n[9]||(n[9]=h=>{var u;return(u=t.editor)==null?void 0:u.chain().focus().toggleOrderedList().run()})},{default:e.withCtx(()=>[...n[25]||(n[25]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("text",{x:"2",y:"8","font-size":"7",fill:"currentColor",stroke:"none"},"1"),e.createElementVNode("path",{d:"M9 6h12"}),e.createElementVNode("text",{x:"2",y:"14","font-size":"7",fill:"currentColor",stroke:"none"},"2"),e.createElementVNode("path",{d:"M9 12h12"}),e.createElementVNode("text",{x:"2",y:"20","font-size":"7",fill:"currentColor",stroke:"none"},"3"),e.createElementVNode("path",{d:"M9 18h12"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(k,{theme:t.theme,title:"Blockquote","is-active":(g=t.editor)==null?void 0:g.isActive("blockquote"),onClick:n[10]||(n[10]=h=>{var u;return(u=t.editor)==null?void 0:u.chain().focus().toggleBlockquote().run()})},{default:e.withCtx(()=>[...n[26]||(n[26]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor"},[e.createElementVNode("path",{d:"M3 3h8v8H3zM13 3h8v8h-8zM5 11l-2 6h4l2-6zM15 11l-2 6h4l2-6z",opacity:"0.6"})],-1)])]),_:1},8,["theme","is-active"]),e.createVNode(k,{theme:t.theme,title:"Horizontal rule",onClick:n[11]||(n[11]=h=>{var u;return(u=t.editor)==null?void 0:u.chain().focus().setHorizontalRule().run()})},{default:e.withCtx(()=>[...n[27]||(n[27]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M3 12h18"})],-1)])]),_:1},8,["theme"]),e.createVNode(b),e.createVNode(Ce,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(Ne,{editor:t.editor,theme:t.theme,"image-config":t.imageConfig,onError:n[12]||(n[12]=h=>o.$emit("error",h))},null,8,["editor","theme","image-config"]),e.createVNode(Te,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(Le,{editor:t.editor,theme:t.theme},null,8,["editor","theme"]),e.createVNode(b),e.createVNode(k,{theme:t.theme,title:"Save as template",onClick:n[13]||(n[13]=h=>o.$emit("saveTemplate"))},{default:e.withCtx(()=>[...n[28]||(n[28]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),e.createElementVNode("polyline",{points:"17,21 17,13 7,13 7,21"}),e.createElementVNode("polyline",{points:"7,3 7,8 15,8"})],-1)])]),_:1},8,["theme"]),e.createVNode(k,{theme:t.theme,title:"Load template",onClick:n[14]||(n[14]=h=>o.$emit("loadTemplate"))},{default:e.withCtx(()=>[...n[29]||(n[29]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})],-1)])]),_:1},8,["theme"]),e.createVNode(b),e.createElementVNode("button",{class:e.normalizeClass(t.theme.saveButton),onClick:n[15]||(n[15]=h=>o.$emit("save"))}," Save ",2)],2)}}}),ze={key:0,class:"bg-white border border-gray-200 rounded-lg shadow-lg p-2 flex flex-wrap gap-1 mb-1"},He={class:"flex gap-1"},Fe={class:"flex gap-1"},De={class:"flex gap-1"},Re={class:"flex gap-1 items-center"},Ie=e.defineComponent({__name:"TablePopoverMenu",props:{editor:{}},setup(t){const o=t;function n(c){var l;(l=o.editor)==null||l.chain().focus().setCellAttribute("backgroundColor",c).run()}return(c,l)=>{var s;return(s=t.editor)!=null&&s.isActive("table")?(e.openBlock(),e.createElementBlock("div",ze,[e.createElementVNode("div",He,[e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-gray-100",onClick:l[0]||(l[0]=m=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().addRowBefore().run()})}," + Row Above "),e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-gray-100",onClick:l[1]||(l[1]=m=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().addRowAfter().run()})}," + Row Below "),e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-red-50 text-red-600",onClick:l[2]||(l[2]=m=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().deleteRow().run()})}," Delete Row ")]),l[12]||(l[12]=e.createElementVNode("span",{class:"w-px h-6 bg-gray-300"},null,-1)),e.createElementVNode("div",Fe,[e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-gray-100",onClick:l[3]||(l[3]=m=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().addColumnBefore().run()})}," + Col Left "),e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-gray-100",onClick:l[4]||(l[4]=m=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().addColumnAfter().run()})}," + Col Right "),e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-red-50 text-red-600",onClick:l[5]||(l[5]=m=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().deleteColumn().run()})}," Delete Col ")]),l[13]||(l[13]=e.createElementVNode("span",{class:"w-px h-6 bg-gray-300"},null,-1)),e.createElementVNode("div",De,[e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-gray-100",onClick:l[6]||(l[6]=m=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().mergeCells().run()})}," Merge "),e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-gray-100",onClick:l[7]||(l[7]=m=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().splitCell().run()})}," Split ")]),l[14]||(l[14]=e.createElementVNode("span",{class:"w-px h-6 bg-gray-300"},null,-1)),e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-gray-100",onClick:l[8]||(l[8]=m=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().toggleHeaderRow().run()})}," Toggle Header "),e.createElementVNode("button",{class:"px-2 py-1 text-xs rounded hover:bg-red-50 text-red-600",onClick:l[9]||(l[9]=m=>{var r;return(r=t.editor)==null?void 0:r.chain().focus().deleteTable().run()})}," Delete Table "),l[15]||(l[15]=e.createElementVNode("span",{class:"w-px h-6 bg-gray-300"},null,-1)),e.createElementVNode("div",Re,[l[11]||(l[11]=e.createElementVNode("label",{class:"text-xs text-gray-500"},"Cell BG:",-1)),e.createElementVNode("input",{type:"color",class:"w-5 h-5 cursor-pointer",onInput:l[10]||(l[10]=m=>n(m.target.value))},null,32)])])):e.createCommentVNode("",!0)}}}),Oe={class:"mb-3"},Ue={class:"mb-4"},qe={class:"flex gap-4"},Pe={class:"flex items-center gap-2 text-sm"},je={class:"flex items-center gap-2 text-sm"},Ge={class:"flex justify-end gap-2"},Ke=["disabled"],We=e.defineComponent({__name:"SaveTemplateModal",props:{theme:{}},emits:["save"],setup(t,{expose:o,emit:n}){const c=n,l=e.ref(!1),s=e.ref(""),m=e.ref("document");function r(){s.value="",m.value="document",l.value=!0}function f(){l.value=!1}function i(){c("save",{name:s.value.trim(),type:m.value}),f()}return o({open:r,close:f}),(d,a)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:e.withModifiers(f,["self"])},[e.createElementVNode("div",{class:e.normalizeClass([t.theme.modal,"w-96"])},[a[7]||(a[7]=e.createElementVNode("h2",{class:"text-lg font-semibold mb-4"},"Save as Template",-1)),e.createElementVNode("div",Oe,[a[3]||(a[3]=e.createElementVNode("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Template Name",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=p=>s.value=p),type:"text",class:"w-full border border-gray-300 rounded px-3 py-2 text-sm",placeholder:"My Template"},null,512),[[e.vModelText,s.value]])]),e.createElementVNode("div",Ue,[a[6]||(a[6]=e.createElementVNode("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Type",-1)),e.createElementVNode("div",qe,[e.createElementVNode("label",Pe,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[1]||(a[1]=p=>m.value=p),type:"radio",value:"document"},null,512),[[e.vModelRadio,m.value]]),a[4]||(a[4]=e.createTextVNode(" Full Document ",-1))]),e.createElementVNode("label",je,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[2]||(a[2]=p=>m.value=p),type:"radio",value:"snippet"},null,512),[[e.vModelRadio,m.value]]),a[5]||(a[5]=e.createTextVNode(" Snippet ",-1))])])]),e.createElementVNode("div",Ge,[e.createElementVNode("button",{class:"px-4 py-2 text-sm text-gray-600 hover:text-gray-800",onClick:f},"Cancel"),e.createElementVNode("button",{class:e.normalizeClass(t.theme.saveButton),disabled:!s.value.trim(),onClick:i},"Save",10,Ke)])],2)])):e.createCommentVNode("",!0)]))}}),Je={key:0,class:"text-center py-8 text-gray-500"},Xe={key:1,class:"text-center py-8 text-gray-500"},Ye={key:2,class:"overflow-y-auto flex-1 -mx-6 px-6"},Ze=["onClick"],Qe={class:"font-medium text-sm"},ve=["onClick"],_e=e.defineComponent({__name:"LoadTemplateModal",props:{theme:{},templates:{},loading:{type:Boolean}},emits:["select","delete","load"],setup(t,{expose:o,emit:n}){const c=n,l=e.ref(!1);function s(){l.value=!0,c("load")}function m(){l.value=!1}function r(i){c("select",i),m()}function f(i){confirm(`Delete template "${i.name}"?`)&&c("delete",i)}return o({open:s,close:m}),(i,d)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:e.withModifiers(m,["self"])},[e.createElementVNode("div",{class:e.normalizeClass([t.theme.modal,"w-[500px] max-h-[80vh] flex flex-col"])},[d[0]||(d[0]=e.createElementVNode("h2",{class:"text-lg font-semibold mb-4"},"Load Template",-1)),t.loading?(e.openBlock(),e.createElementBlock("div",Je,"Loading templates...")):t.templates.length===0?(e.openBlock(),e.createElementBlock("div",Xe,"No templates found")):(e.openBlock(),e.createElementBlock("div",Ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.templates,a=>(e.openBlock(),e.createElementBlock("div",{key:a.id,class:"flex items-center justify-between p-3 border border-gray-200 rounded mb-2 hover:bg-gray-50 cursor-pointer group",onClick:p=>r(a)},[e.createElementVNode("div",null,[e.createElementVNode("div",Qe,e.toDisplayString(a.name),1),e.createElementVNode("span",{class:e.normalizeClass(["inline-block text-xs px-2 py-0.5 rounded mt-1",a.type==="document"?"bg-blue-100 text-blue-700":"bg-green-100 text-green-700"])},e.toDisplayString(a.type==="document"?"Document":"Snippet"),3)]),e.createElementVNode("button",{class:"text-red-400 hover:text-red-600 opacity-0 group-hover:opacity-100 text-sm px-2",onClick:e.withModifiers(p=>f(a),["stop"])}," Delete ",8,ve)],8,Ze))),128))])),e.createElementVNode("div",{class:"flex justify-end pt-4"},[e.createElementVNode("button",{class:"px-4 py-2 text-sm text-gray-600 hover:text-gray-800",onClick:m},"Cancel")])],2)])):e.createCommentVNode("",!0)]))}}),et={class:"border border-gray-200 rounded-lg overflow-hidden"},tt=e.defineComponent({__name:"DocumentEditor",props:{modelValue:{},templates:{},templatesLoading:{type:Boolean},image:{},theme:{},placeholder:{default:""},readonly:{type:Boolean,default:!1}},emits:["update:modelValue","save","saveTemplate","loadTemplates","deleteTemplate","error"],setup(t,{emit:o}){const n=t,c=o,l=e.computed(()=>({...N,...n.theme})),s=y.useEditor({content:n.modelValue,editable:!n.readonly,extensions:[A,z.TextStyle,H,J,F,D,R,I.configure({types:["textStyle"]}),O.configure({types:["heading","paragraph"]}),X,U.configure({openOnClick:!1,HTMLAttributes:{target:"_blank",rel:"noopener noreferrer"}}),_,P.Table.configure({resizable:!0}),j,G,K,ee,q.configure({placeholder:n.placeholder||"Start typing..."})],onUpdate:()=>{var p;c("update:modelValue",((p=s.value)==null?void 0:p.getHTML())??"")}});e.provide(S,s),e.watch(()=>n.modelValue,p=>{var g,h;((g=s.value)==null?void 0:g.getHTML())!==p&&((h=s.value)==null||h.commands.setContent(p,{emitUpdate:!1}))}),e.watch(()=>n.readonly,p=>{var g;(g=s.value)==null||g.setEditable(!p)});function m(p){c("error",p)}const r=e.ref(null),f=e.ref(null);function i(p){var u,E,w;const g=((u=s.value)==null?void 0:u.getHTML())??"",h=p.type==="snippet"&&((E=s.value)!=null&&E.state.selection.content())&&((w=s.value)==null?void 0:w.state.selection.content().content.textBetween(0,s.value.state.selection.content().content.size))||g;c("saveTemplate",{name:p.name,type:p.type,content:h})}function d(p){var g,h,u,E;if(p.type==="document"){if(((g=s.value)==null?void 0:g.getHTML())!=="<p></p>"&&((h=s.value)==null?void 0:h.getHTML())!==""&&!confirm("Replace current content with this template?"))return;(u=s.value)==null||u.commands.setContent(p.content)}else(E=s.value)==null||E.commands.insertContent(p.content)}function a(){var g;const p=((g=s.value)==null?void 0:g.getHTML())??"";c("save",p)}return(p,g)=>(e.openBlock(),e.createElementBlock("div",et,[n.readonly?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(Ae,{editor:e.unref(s),theme:l.value,"image-config":n.image,onSaveTemplate:g[0]||(g[0]=h=>{var u;return(u=r.value)==null?void 0:u.open()}),onLoadTemplate:g[1]||(g[1]=h=>{var u;return(u=f.value)==null?void 0:u.open()}),onSave:a,onError:m},null,8,["editor","theme","image-config"]),e.createVNode(Ie,{editor:e.unref(s)},null,8,["editor"])],64)),e.createVNode(e.unref(y.EditorContent),{editor:e.unref(s),class:e.normalizeClass(l.value.editor)},null,8,["editor","class"]),e.createVNode(We,{ref_key:"saveTemplateModal",ref:r,theme:l.value,onSave:i},null,8,["theme"]),e.createVNode(_e,{ref_key:"loadTemplateModal",ref:f,theme:l.value,templates:n.templates??[],loading:n.templatesLoading??!1,onLoad:g[2]||(g[2]=h=>c("loadTemplates")),onSelect:d,onDelete:g[3]||(g[3]=h=>c("deleteTemplate",h))},null,8,["theme","templates","loading"])]))}});x.DEFAULT_IMAGE_CONFIG=B,x.DEFAULT_THEME=N,x.DocumentEditor=tt,x.FONT_SIZES=M,x.LINE_HEIGHTS=T,x.WEB_SAFE_FONTS=$,x.useDocumentEditor=te,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})}));
@@ -4,18 +4,31 @@ declare const _default: import('vue').DefineComponent<DocumentEditorProps, {}, {
4
4
  message: string;
5
5
  detail: unknown;
6
6
  }) => any;
7
- save: (response: unknown) => any;
7
+ saveTemplate: (data: {
8
+ name: string;
9
+ type: "document" | "snippet";
10
+ content: string;
11
+ }) => any;
12
+ save: (html: string) => any;
8
13
  "update:modelValue": (value: string) => any;
14
+ loadTemplates: () => any;
15
+ deleteTemplate: (template: Template) => any;
9
16
  }, string, import('vue').PublicProps, Readonly<DocumentEditorProps> & Readonly<{
10
17
  onError?: ((error: {
11
18
  message: string;
12
19
  detail: unknown;
13
20
  }) => any) | undefined;
14
- onSave?: ((response: unknown) => any) | undefined;
21
+ onSaveTemplate?: ((data: {
22
+ name: string;
23
+ type: "document" | "snippet";
24
+ content: string;
25
+ }) => any) | undefined;
26
+ onSave?: ((html: string) => any) | undefined;
15
27
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
28
+ onLoadTemplates?: (() => any) | undefined;
29
+ onDeleteTemplate?: ((template: Template) => any) | undefined;
16
30
  }>, {
17
31
  placeholder: string;
18
- mode: "document" | "template";
19
32
  readonly: boolean;
20
33
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
21
34
  saveTemplateModal: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
@@ -1,14 +1,3 @@
1
- export interface TemplateMeta {
2
- name: string;
3
- type: 'document' | 'snippet';
4
- }
5
- export interface ApiConfig {
6
- saveDocument: string;
7
- saveTemplate: string;
8
- loadTemplates: string;
9
- deleteTemplate: string;
10
- headers?: Record<string, string>;
11
- }
12
1
  export interface ImageConfig {
13
2
  maxSize?: number;
14
3
  allowedTypes?: string[];
@@ -24,9 +13,8 @@ export interface ThemeConfig {
24
13
  }
25
14
  export interface DocumentEditorProps {
26
15
  modelValue: string;
27
- mode?: 'document' | 'template';
28
- templateMeta?: TemplateMeta;
29
- api: ApiConfig;
16
+ templates?: Template[];
17
+ templatesLoading?: boolean;
30
18
  image?: ImageConfig;
31
19
  theme?: Partial<ThemeConfig>;
32
20
  placeholder?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpdev_ab/document-creator",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -14,7 +14,8 @@
14
14
  "types": "./dist/index.d.ts",
15
15
  "import": "./dist/document-creator.js",
16
16
  "require": "./dist/document-creator.umd.cjs"
17
- }
17
+ },
18
+ "./style.css": "./dist/document-creator.css"
18
19
  },
19
20
  "scripts": {
20
21
  "dev": "vite",
@@ -1,19 +0,0 @@
1
- import { ApiConfig, Template } from '../types';
2
- export declare function useTemplateApi(api: ApiConfig): {
3
- templates: import('vue').Ref<{
4
- id: string | number;
5
- name: string;
6
- type: "document" | "snippet";
7
- content: string;
8
- }[], Template[] | {
9
- id: string | number;
10
- name: string;
11
- type: "document" | "snippet";
12
- content: string;
13
- }[]>;
14
- loading: import('vue').Ref<boolean, boolean>;
15
- error: import('vue').Ref<string | null, string | null>;
16
- loadTemplates: () => Promise<void>;
17
- saveTemplate: (template: Omit<Template, "id">) => Promise<any>;
18
- deleteTemplate: (id: string | number) => Promise<void>;
19
- };