@blockslides/vue-3 0.2.0 → 0.3.0

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,4 +1,4 @@
1
- import { defineComponent as m, ref as f, onMounted as g, watch as F, onBeforeUnmount as y, openBlock as D, createElementBlock as _, createCommentVNode as A, nextTick as M, h as v } from "vue";
1
+ import { defineComponent as m, ref as f, onMounted as g, watch as D, onBeforeUnmount as y, openBlock as _, createElementBlock as A, createCommentVNode as F, nextTick as M, h as v } from "vue";
2
2
  import { BubbleMenuPlugin as E } from "@blockslides/extension-bubble-menu";
3
3
  import { NodeSelection as N } from "@blockslides/pm/state";
4
4
  import { buildMenuElement as C, DEFAULT_ALIGNMENTS as x, DEFAULT_FONT_SIZES as B, DEFAULT_FONTS as P, DEFAULT_HIGHLIGHT_PALETTE as j, DEFAULT_COLOR_PALETTE as L, DEFAULT_ITEMS as O } from "@blockslides/extension-bubble-menu-preset";
@@ -13,20 +13,20 @@ const z = {
13
13
  editor: {},
14
14
  updateDelay: {},
15
15
  resizeDelay: {},
16
- appendTo: { type: Function },
17
- shouldShow: { type: [Function, null] },
18
- getReferencedVirtualElement: { type: Function },
16
+ appendTo: {},
17
+ shouldShow: {},
18
+ getReferencedVirtualElement: {},
19
19
  options: {},
20
20
  items: {},
21
21
  className: {},
22
- injectStyles: { type: Boolean },
22
+ injectStyles: { type: Boolean, default: !0 },
23
23
  textColors: {},
24
24
  highlightColors: {},
25
25
  fonts: {},
26
26
  fontSizes: {},
27
27
  alignments: {},
28
- onTextAction: { type: Function },
29
- onImageReplace: { type: Function }
28
+ onTextAction: {},
29
+ onImageReplace: {}
30
30
  },
31
31
  setup(r) {
32
32
  const e = r, l = f(null);
@@ -49,9 +49,9 @@ const z = {
49
49
  onImageReplace: e.onImageReplace
50
50
  });
51
51
  l.value = a, o = s;
52
- const p = ({ state: d, editor: c }) => {
52
+ const d = ({ state: c, editor: p }) => {
53
53
  var b, T;
54
- const i = d.selection, h = i instanceof N && ["image", "imageBlock"].includes((T = (b = i.node) == null ? void 0 : b.type) == null ? void 0 : T.name) || c.isActive("image") || c.isActive("imageBlock");
54
+ const i = c.selection, h = i instanceof N && ["image", "imageBlock"].includes((T = (b = i.node) == null ? void 0 : b.type) == null ? void 0 : T.name) || p.isActive("image") || p.isActive("imageBlock");
55
55
  return !!(h || R(i) && !i.empty && !h);
56
56
  }, u = E({
57
57
  editor: t,
@@ -60,7 +60,7 @@ const z = {
60
60
  resizeDelay: e.resizeDelay,
61
61
  appendTo: e.appendTo,
62
62
  pluginKey: S,
63
- shouldShow: e.shouldShow ?? p,
63
+ shouldShow: e.shouldShow ?? d,
64
64
  getReferencedVirtualElement: e.getReferencedVirtualElement,
65
65
  options: e.options
66
66
  });
@@ -68,7 +68,7 @@ const z = {
68
68
  };
69
69
  return g(() => {
70
70
  n();
71
- }), F(
71
+ }), D(
72
72
  () => [
73
73
  e.editor,
74
74
  e.updateDelay,
@@ -94,7 +94,7 @@ const z = {
94
94
  ), y(() => {
95
95
  var t;
96
96
  e.editor && e.editor.unregisterPlugin(S), o && o(), (t = l.value) != null && t.parentNode && l.value.parentNode.removeChild(l.value);
97
- }), (t, a) => l.value ? (D(), _("div", z)) : A("", !0);
97
+ }), (t, a) => l.value ? (_(), A("div", z)) : F("", !0);
98
98
  }
99
99
  }), q = m({
100
100
  name: "BubbleMenu",
@@ -141,10 +141,10 @@ const z = {
141
141
  options: t,
142
142
  pluginKey: a,
143
143
  resizeDelay: s,
144
- appendTo: p,
144
+ appendTo: d,
145
145
  shouldShow: u,
146
- getReferencedVirtualElement: d,
147
- updateDelay: c
146
+ getReferencedVirtualElement: c,
147
+ updateDelay: p
148
148
  } = r, i = o.value;
149
149
  i && (i.style.visibility = "hidden", i.style.position = "absolute", i.remove(), M(() => {
150
150
  n.registerPlugin(
@@ -154,10 +154,10 @@ const z = {
154
154
  options: t,
155
155
  pluginKey: a,
156
156
  resizeDelay: s,
157
- appendTo: p,
157
+ appendTo: d,
158
158
  shouldShow: u,
159
- getReferencedVirtualElement: d,
160
- updateDelay: c
159
+ getReferencedVirtualElement: c,
160
+ updateDelay: p
161
161
  })
162
162
  );
163
163
  }));
@@ -199,7 +199,7 @@ const z = {
199
199
  setup(r, { slots: e, attrs: l }) {
200
200
  const o = f(null);
201
201
  return g(() => {
202
- const { pluginKey: n, editor: t, options: a, appendTo: s, shouldShow: p } = r, u = o.value;
202
+ const { pluginKey: n, editor: t, options: a, appendTo: s, shouldShow: d } = r, u = o.value;
203
203
  u && (u.style.visibility = "hidden", u.style.position = "absolute", u.remove(), t.registerPlugin(
204
204
  w({
205
205
  pluginKey: n,
@@ -207,7 +207,7 @@ const z = {
207
207
  element: u,
208
208
  options: a,
209
209
  appendTo: s,
210
- shouldShow: p
210
+ shouldShow: d
211
211
  })
212
212
  ));
213
213
  }), y(() => {
@@ -0,0 +1 @@
1
+ "use strict";const t=require("vue"),T=require("@blockslides/extension-bubble-menu"),S=require("@blockslides/pm/state"),c=require("@blockslides/extension-bubble-menu-preset"),v=require("@blockslides/core"),E=require("@blockslides/extension-floating-menu"),M={key:0,style:{display:"none"}},b="bubbleMenuPreset",D=t.defineComponent({__name:"BubbleMenuPreset",props:{editor:{},updateDelay:{},resizeDelay:{},appendTo:{},shouldShow:{},getReferencedVirtualElement:{},options:{},items:{},className:{},injectStyles:{type:Boolean,default:!0},textColors:{},highlightColors:{},fonts:{},fontSizes:{},alignments:{},onTextAction:{},onImageReplace:{}},setup(s){const e=s,u=t.ref(null);let i;const o=()=>{const n=e.editor;if(!n||n.isDestroyed)return;i&&(i(),i=void 0);const{element:a,cleanup:d}=c.buildMenuElement(n,{items:e.items??c.DEFAULT_ITEMS,className:e.className??"",injectStyles:e.injectStyles!==!1,textColors:e.textColors??c.DEFAULT_COLOR_PALETTE,highlightColors:e.highlightColors??c.DEFAULT_HIGHLIGHT_PALETTE,fonts:e.fonts??c.DEFAULT_FONTS,fontSizes:e.fontSizes??c.DEFAULT_FONT_SIZES,alignments:e.alignments??c.DEFAULT_ALIGNMENTS,onTextAction:e.onTextAction,onImageReplace:e.onImageReplace});u.value=a,i=d;const p=({state:g,editor:f})=>{var y,h;const l=g.selection,m=l instanceof S.NodeSelection&&["image","imageBlock"].includes((h=(y=l.node)==null?void 0:y.type)==null?void 0:h.name)||f.isActive("image")||f.isActive("imageBlock");return!!(m||v.isTextSelection(l)&&!l.empty&&!m)},r=T.BubbleMenuPlugin({editor:n,element:a,updateDelay:e.updateDelay,resizeDelay:e.resizeDelay,appendTo:e.appendTo,pluginKey:b,shouldShow:e.shouldShow??p,getReferencedVirtualElement:e.getReferencedVirtualElement,options:e.options});n.registerPlugin(r)};return t.onMounted(()=>{o()}),t.watch(()=>[e.editor,e.updateDelay,e.resizeDelay,e.appendTo,e.shouldShow,e.getReferencedVirtualElement,e.options,e.items,e.className,e.injectStyles,e.textColors,e.highlightColors,e.fonts,e.fontSizes,e.alignments,e.onTextAction,e.onImageReplace],()=>{o()}),t.onBeforeUnmount(()=>{var n;e.editor&&e.editor.unregisterPlugin(b),i&&i(),(n=u.value)!=null&&n.parentNode&&u.value.parentNode.removeChild(u.value)}),(n,a)=>u.value?(t.openBlock(),t.createElementBlock("div",M)):t.createCommentVNode("",!0)}}),_=t.defineComponent({name:"BubbleMenu",inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(s,{slots:e,attrs:u}){const i=t.ref(null);return t.onMounted(()=>{const{editor:o,options:n,pluginKey:a,resizeDelay:d,appendTo:p,shouldShow:r,getReferencedVirtualElement:g,updateDelay:f}=s,l=i.value;l&&(l.style.visibility="hidden",l.style.position="absolute",l.remove(),t.nextTick(()=>{o.registerPlugin(T.BubbleMenuPlugin({editor:o,element:l,options:n,pluginKey:a,resizeDelay:d,appendTo:p,shouldShow:r,getReferencedVirtualElement:g,updateDelay:f}))}))}),t.onBeforeUnmount(()=>{const{pluginKey:o,editor:n}=s;n.unregisterPlugin(o)}),()=>{var o;return t.h("div",{ref:i,...u},(o=e.default)==null?void 0:o.call(e))}}}),F=t.defineComponent({name:"FloatingMenu",inheritAttrs:!1,props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null}},setup(s,{slots:e,attrs:u}){const i=t.ref(null);return t.onMounted(()=>{const{pluginKey:o,editor:n,options:a,appendTo:d,shouldShow:p}=s,r=i.value;r&&(r.style.visibility="hidden",r.style.position="absolute",r.remove(),n.registerPlugin(E.FloatingMenuPlugin({pluginKey:o,editor:n,element:r,options:a,appendTo:d,shouldShow:p})))}),t.onBeforeUnmount(()=>{const{pluginKey:o,editor:n}=s;n.unregisterPlugin(o)}),()=>{var o;return t.h("div",{ref:i,...u},(o=e.default)==null?void 0:o.call(e))}}});exports.BubbleMenu=_;exports.FloatingMenu=F;exports._sfc_main=D;
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@blockslides/core"),o=require("vue"),j=require("@blockslides/ai-context"),O=require("@blockslides/extension-kit"),f=require("./FloatingMenu-By8Qi7tW.cjs");function x(r){return o.customRef((e,t)=>({get(){return e(),r},set(n){r=n,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}class _ extends g.Editor{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=x(this.view.state),this.reactiveExtensionStorage=x(this.extensionStorage),this.on("beforeTransaction",({nextState:t})=>{this.reactiveState.value=t,this.reactiveExtensionStorage.value=this.extensionStorage}),o.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,t){const n=super.registerPlugin(e,t);return this.reactiveState&&(this.reactiveState.value=n),n}unregisterPlugin(e){const t=super.unregisterPlugin(e);return this.reactiveState&&t&&(this.reactiveState.value=t),t}}const P=o.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(r){const e=o.ref(),t=o.getCurrentInstance();return o.watchEffect(()=>{const n=r.editor;n&&n.options.element&&e.value&&o.nextTick(()=>{var s;if(!e.value||!((s=n.view.dom)!=null&&s.parentNode))return;const i=o.unref(e.value);e.value.append(...n.view.dom.parentNode.childNodes),n.contentComponent=t.ctx._,t&&(n.appContext={...t.appContext,provides:t.provides}),n.setOptions({element:i}),n.createNodeViews()})}),o.onBeforeUnmount(()=>{const n=r.editor;n&&(n.contentComponent=null,n.appContext=null)}),{rootEl:e}},render(){return o.h("div",{ref:r=>{this.rootEl=r}})}}),V=o.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return o.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),B=o.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var r,e;return o.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(r=this.$slots).default)==null?void 0:e.call(r))}}),M=(r={})=>{console.log("[useEditor] THE OPTIONS ARE:",r),console.log("[useEditor] Creating editor with options:",r),console.log("[useEditor] options.enableCoreExtensions:",r.enableCoreExtensions),console.log("[useEditor] options.injectCSS:",r.injectCSS);const e=o.shallowRef();return o.onMounted(()=>{var t;console.log("[useEditor] onMounted - Creating Editor instance"),console.log("[useEditor] onMounted - options:",r),console.log("[useEditor] onMounted - options.enableCoreExtensions:",r.enableCoreExtensions),e.value=new _(r),console.log("[useEditor] Editor instance created:",e.value),console.log("[useEditor] Editor view:",(t=e.value)==null?void 0:t.view)}),o.onBeforeUnmount(()=>{var i,s,d,a;console.log("[useEditor] onBeforeUnmount - Cleaning up editor");const t=(s=(i=e.value)==null?void 0:i.view.dom)==null?void 0:s.parentNode,n=t==null?void 0:t.cloneNode(!0);(d=t==null?void 0:t.parentNode)==null||d.replaceChild(n,t),(a=e.value)==null||a.destroy()}),e},q=()=>({type:"doc",content:[{type:"slide",attrs:{size:"16x9",className:"",id:"slide-1",backgroundMode:"none",backgroundColor:null,backgroundImage:null,backgroundOverlayColor:null,backgroundOverlayOpacity:null},content:[{type:"column",attrs:{align:"center",padding:"lg",margin:null,gap:"md",backgroundColor:"#ffffff",backgroundImage:null,borderRadius:null,border:null,fill:!0,width:null,height:null,justify:"center"},content:[{type:"heading",attrs:{align:null,padding:null,margin:null,gap:null,backgroundColor:null,backgroundImage:null,borderRadius:null,border:null,fill:null,width:null,height:null,justify:null,id:"1fc4664c-333d-4203-a3f1-3ad27a54c535","data-toc-id":"1fc4664c-333d-4203-a3f1-3ad27a54c535",level:1},content:[{type:"text",text:"Lorem ipsum dolor sit amet"}]},{type:"paragraph",attrs:{align:null,padding:null,margin:null,gap:null,backgroundColor:null,backgroundImage:null,borderRadius:null,border:null,fill:null,width:null,height:null,justify:null},content:[{type:"text",text:"Consectetur adipiscing elit. Sed do eiusmod tempor incididunt. "}]}]}]}]}),D=r=>({showPresets:!0,presets:r,presetBackground:"#0f172a",presetForeground:"#e5e7eb"}),R={renderMode:"dynamic",hoverOutline:{color:"#3b82f6",width:"1.5px",offset:"4px"},hoverOutlineCascade:!1},k=(r={})=>{console.log("[useSlideEditor] Called with props:",r);const{content:e,onChange:t,extensions:n,extensionKitOptions:i,presetTemplates:s,onEditorReady:d,theme:a="light",editorProps:u,onUpdate:c,...h}=r;console.log("[useSlideEditor] editorOptions:",h),console.log("[useSlideEditor] editorOptions.enableCoreExtensions:",h.enableCoreExtensions),console.log("[useSlideEditor] editorOptions.injectCSS:",h.injectCSS),console.log("[useSlideEditor] Content:",e),console.log("[useSlideEditor] ExtensionKitOptions:",i);const S=o.computed(()=>s??j.templatesV1.listPresetTemplates()),y=o.computed(()=>{const l=(i==null?void 0:i.addSlideButton)===!1?!1:{...D(S.value),...(i==null?void 0:i.addSlideButton)??{}},p=(i==null?void 0:i.slide)===!1?!1:{...R,...(i==null?void 0:i.slide)??{}},b={...i,addSlideButton:l,slide:p};return console.log("[useSlideEditor] mergedExtensionKitOptions:",b),console.log("[useSlideEditor] addSlideButton config:",b.addSlideButton),console.log("[useSlideEditor] presets:",S.value),b}),v=o.computed(()=>{console.log("[useSlideEditor] Configuring ExtensionKit with options:",y.value);const l=O.ExtensionKit.configure(y.value);console.log("[useSlideEditor] ExtensionKit configured:",l),console.log("[useSlideEditor] ExtensionKit name:",l.name);const p=n?[l,...n]:[l];return console.log("[useSlideEditor] Final extensions array:",p),p}),w=e??q();console.log("[useSlideEditor] Initial content resolved:",w),console.log("[useSlideEditor] Resolved extensions:",v.value);const m={content:w,extensions:v.value,theme:a,editorProps:{attributes:{autocomplete:"off",autocorrect:"off",autocapitalize:"off",class:"min-h-full min-w-full",...(u==null?void 0:u.attributes)??{}},...u},...h,onUpdate:l=>{console.log("[useSlideEditor] onUpdate called");const p=l.editor.getJSON();t==null||t(p,l.editor),c==null||c(l)}};console.log("[useSlideEditor] Final editor config:",m),console.log("[useSlideEditor] Final editor config enableCoreExtensions:",m.enableCoreExtensions),console.log("[useSlideEditor] Final editor config injectCSS:",m.injectCSS);const E=M(m);return console.log("[useSlideEditor] Editor ref created:",E),o.watch(E,l=>{console.log("[useSlideEditor] Editor watch triggered, newEditor:",l),l&&!l.isDestroyed?(console.log("[useSlideEditor] ✅ Calling onEditorReady"),d==null||d(l)):console.log("[useSlideEditor] ❌ Editor not ready or destroyed")},{immediate:!0}),{editor:E,presets:S}},A={class:"bs-viewport"},F=o.defineComponent({__name:"SlideEditor",props:{bubbleMenuPreset:{type:[Boolean,Object],default:!0},className:{},style:{},content:{},onChange:{},extensions:{},extensionKitOptions:{},presetTemplates:{},onEditorReady:{},element:{},theme:{},injectCSS:{type:Boolean},injectNonce:{},autofocus:{type:[String,Number,Boolean,null]},editable:{type:Boolean},editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:{type:[Array,Boolean]},enablePasteRules:{type:[Array,Boolean]},enableCoreExtensions:{type:[Boolean,Object]},enableContentCheck:{type:Boolean},emitContentError:{type:Boolean},onBeforeCreate:{},onCreate:{},onMount:{},onUnmount:{},onContentError:{},onUpdate:{},onSelectionUpdate:{},onTransaction:{},onFocus:{},onBlur:{},onDestroy:{},onPaste:{},onDrop:{},onDelete:{}},setup(r){console.log("[SlideEditor.vue] Component loading");const e=r;console.log("[SlideEditor.vue] Props:",e),console.log("[SlideEditor.vue] Props.enableCoreExtensions:",e.enableCoreExtensions),console.log("[SlideEditor.vue] Props.injectCSS:",e.injectCSS);const{bubbleMenuPreset:t,className:n,style:i,...s}=e;console.log("[SlideEditor.vue] Hook props:",s),console.log("[SlideEditor.vue] hookProps.enableCoreExtensions:",s.enableCoreExtensions),console.log("[SlideEditor.vue] hookProps.injectCSS:",s.injectCSS);const{editor:d,presets:a}=k(s);console.log("[SlideEditor.vue] Editor from useSlideEditor:",d);const u=o.computed(()=>e.bubbleMenuPreset===!1?null:e.bubbleMenuPreset===!0?{}:e.bubbleMenuPreset);return o.watch(d,c=>{console.log("[SlideEditor.vue] Editor watch - newEditor:",c),console.log("[SlideEditor.vue] Editor exists:",!!c)},{immediate:!0}),o.onMounted(()=>{console.log("[SlideEditor.vue] Component mounted"),console.log("[SlideEditor.vue] Editor value:",d.value)}),(c,h)=>o.unref(d)?(o.openBlock(),o.createElementBlock("div",{key:0,class:o.normalizeClass(o.unref(n)),style:o.normalizeStyle(o.unref(i))},[o.createElementVNode("div",A,[o.createVNode(o.unref(P),{editor:o.unref(d)},null,8,["editor"]),u.value?(o.openBlock(),o.createBlock(f._sfc_main,o.mergeProps({key:0,editor:o.unref(d)},u.value),null,16,["editor"])):o.createCommentVNode("",!0)])],6)):o.createCommentVNode("",!0)}});class C{constructor(e,{props:t={},editor:n}){this.destroyed=!1,this.editor=n,this.component=o.markRaw(e),this.el=document.createElement("div"),this.props=o.reactive(t),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var e,t,n,i;return(t=(e=this.renderedComponent.vNode)==null?void 0:e.component)!=null&&t.exposed?this.renderedComponent.vNode.component.exposed:(i=(n=this.renderedComponent.vNode)==null?void 0:n.component)==null?void 0:i.proxy}renderComponent(){if(this.destroyed)return this.renderedComponent;let e=o.h(this.component,this.props);return this.editor.appContext&&(e.appContext=this.editor.appContext),typeof document<"u"&&this.el&&o.render(e,this.el),{vNode:e,destroy:()=>{this.el&&o.render(null,this.el),this.el=null,e=null},el:this.el?this.el.firstElementChild:null}}updateProps(e={}){this.destroyed||(Object.entries(e).forEach(([t,n])=>{this.props[t]=n}),this.renderComponent())}destroy(){this.destroyed||(this.destroyed=!0,this.renderedComponent.destroy())}}const U={editor:{type:Object,required:!0},mark:{type:Object,required:!0},extension:{type:Object,required:!0},inline:{type:Boolean,required:!0},view:{type:Object,required:!0},updateAttributes:{type:Function,required:!0},HTMLAttributes:{type:Object,required:!0}},I=o.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return o.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});class N extends g.MarkView{constructor(e,t,n){super(e,t,n);const i={...t,updateAttributes:this.updateAttributes.bind(this)},s=o.defineComponent({extends:{...e},props:Object.keys(i),template:this.component.template,setup:d=>{var a;return(a=e.setup)==null?void 0:a.call(e,d,{expose:()=>{}})},__scopeId:e.__scopeId,__cssModules:e.__cssModules,__name:e.__name,__file:e.__file});this.renderer=new C(s,{editor:this.editor,props:i})}get dom(){return this.renderer.element}get contentDOM(){return this.dom.querySelector("[data-mark-view-content]")}updateAttributes(e){const t=o.toRaw(this.mark);super.updateAttributes(e,t)}destroy(){this.renderer.destroy()}}function T(r,e={}){return t=>t.editor.contentComponent?new N(r,t,e):{}}const W={editor:{type:Object,required:!0},node:{type:Object,required:!0},decorations:{type:Object,required:!0},selected:{type:Boolean,required:!0},extension:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},view:{type:Object,required:!0},innerDecorations:{type:Object,required:!0},HTMLAttributes:{type:Object,required:!0}};class L extends g.NodeView{constructor(){super(...arguments),this.cachedExtensionWithSyncedStorage=null}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,i,s){return i==="storage"?e.storage[t.name]??{}:Reflect.get(n,i,s)}})}return this.cachedExtensionWithSyncedStorage}mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(i={})=>this.updateAttributes(i),deleteNode:()=>this.deleteNode()},t=this.onDragStart.bind(this);this.decorationClasses=o.ref(this.getDecorationClasses());const n=o.defineComponent({extends:{...this.component},props:Object.keys(e),template:this.component.template,setup:i=>{var s,d;return o.provide("onDragStart",t),o.provide("decorationClasses",this.decorationClasses),(d=(s=this.component).setup)==null?void 0:d.call(s,i,{expose:()=>{}})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new C(n,{editor:this.editor,props:e})}get dom(){if(!this.renderer.element||!this.renderer.element.hasAttribute("data-node-view-wrapper"))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:e,to:t}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(e<=n&&t>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,n){const i=s=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(s)};if(typeof this.options.update=="function"){const s=this.node,d=this.decorations,a=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.options.update({oldNode:s,oldDecorations:d,newNode:e,newDecorations:t,oldInnerDecorations:a,innerDecorations:n,updateProps:()=>i({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return e.type!==this.node.type?!1:(e===this.node&&this.decorations===t&&this.innerDecorations===n||(this.node=e,this.decorations=t,this.innerDecorations=n,i({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.flatMap(e=>e.type.attrs.class).join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}}function z(r,e){return t=>{if(!t.editor.contentComponent)return{};const n=typeof r=="function"&&"__vccOpts"in r?r.__vccOpts:r;return new L(n,t,e)}}exports.BubbleMenu=f.BubbleMenu;exports.BubbleMenuPreset=f._sfc_main;exports.FloatingMenu=f.FloatingMenu;exports.Editor=_;exports.EditorContent=P;exports.MarkViewContent=I;exports.NodeViewContent=V;exports.NodeViewWrapper=B;exports.SlideEditor=F;exports.VueMarkView=N;exports.VueMarkViewRenderer=T;exports.VueNodeViewRenderer=z;exports.VueRenderer=C;exports.markViewProps=U;exports.nodeViewProps=W;exports.useEditor=M;exports.useSlideEditor=k;Object.keys(g).forEach(r=>{r!=="default"&&!Object.prototype.hasOwnProperty.call(exports,r)&&Object.defineProperty(exports,r,{enumerable:!0,get:()=>g[r]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@blockslides/core"),r=require("vue"),V=require("@blockslides/ai-context"),P=require("@blockslides/extension-kit"),h=require("./FloatingMenu-Un--4r7A.cjs");function w(s){return r.customRef((e,t)=>({get(){return e(),s},set(n){s=n,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}class S extends c.Editor{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=w(this.view.state),this.reactiveExtensionStorage=w(this.extensionStorage),this.on("beforeTransaction",({nextState:t})=>{this.reactiveState.value=t,this.reactiveExtensionStorage.value=this.extensionStorage}),r.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,t){const n=super.registerPlugin(e,t);return this.reactiveState&&(this.reactiveState.value=n),n}unregisterPlugin(e){const t=super.unregisterPlugin(e);return this.reactiveState&&t&&(this.reactiveState.value=t),t}}const C=r.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(s){const e=r.ref(),t=r.getCurrentInstance();return r.watchEffect(()=>{const n=s.editor;n&&n.options.element&&e.value&&r.nextTick(()=>{var i;if(!e.value||!((i=n.view.dom)!=null&&i.parentNode))return;const o=r.unref(e.value);e.value.append(...n.view.dom.parentNode.childNodes),n.contentComponent=t.ctx._,t&&(n.appContext={...t.appContext,provides:t.provides}),n.setOptions({element:o}),n.createNodeViews()})}),r.onBeforeUnmount(()=>{const n=s.editor;n&&(n.contentComponent=null,n.appContext=null)}),{rootEl:e}},render(){return r.h("div",{ref:s=>{this.rootEl=s}})}}),E=r.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return r.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),O=r.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var s,e;return r.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(s=this.$slots).default)==null?void 0:e.call(s))}}),x=(s={})=>{const e=r.shallowRef();return r.onMounted(()=>{e.value=new S(s)}),r.onBeforeUnmount(()=>{var o,i,d,a;const t=(i=(o=e.value)==null?void 0:o.view.dom)==null?void 0:i.parentNode,n=t==null?void 0:t.cloneNode(!0);(d=t==null?void 0:t.parentNode)==null||d.replaceChild(n,t),(a=e.value)==null||a.destroy()}),e},j=()=>({type:"doc",content:[{type:"slide",attrs:{size:"16x9",className:"",id:"slide-1",backgroundMode:"none",backgroundColor:null,backgroundImage:null,backgroundOverlayColor:null,backgroundOverlayOpacity:null},content:[{type:"column",attrs:{align:"center",padding:"lg",margin:null,gap:"md",backgroundColor:"#ffffff",backgroundImage:null,borderRadius:null,border:null,fill:!0,width:null,height:null,justify:"center"},content:[{type:"heading",attrs:{align:null,padding:null,margin:null,gap:null,backgroundColor:null,backgroundImage:null,borderRadius:null,border:null,fill:null,width:null,height:null,justify:null,id:"1fc4664c-333d-4203-a3f1-3ad27a54c535","data-toc-id":"1fc4664c-333d-4203-a3f1-3ad27a54c535",level:1},content:[{type:"text",text:"Lorem ipsum dolor sit amet"}]},{type:"paragraph",attrs:{align:null,padding:null,margin:null,gap:null,backgroundColor:null,backgroundImage:null,borderRadius:null,border:null,fill:null,width:null,height:null,justify:null},content:[{type:"text",text:"Consectetur adipiscing elit. Sed do eiusmod tempor incididunt. "}]}]}]}]}),q=s=>({showPresets:!0,presets:s,presetBackground:"#0f172a",presetForeground:"#e5e7eb"}),D={renderMode:"dynamic",hoverOutline:{color:"#3b82f6",width:"1.5px",offset:"4px"},hoverOutlineCascade:!1},_=(s={})=>{const{content:e,onChange:t,extensions:n,extensionKitOptions:o,presetTemplates:i,onEditorReady:d,theme:a="light",editorProps:l,onUpdate:p,editorOptions:y={}}=s,b=r.computed(()=>i??V.templatesV1.listPresetTemplates()),k=r.computed(()=>{const u=(o==null?void 0:o.addSlideButton)===!1?!1:{...q(b.value),...(o==null?void 0:o.addSlideButton)??{}},m=(o==null?void 0:o.slide)===!1?!1:{...D,...(o==null?void 0:o.slide)??{}};return{...o,addSlideButton:u,slide:m}}),f=r.computed(()=>{const u=P.ExtensionKit.configure(k.value);return n?[u,...n]:[u]}),M=e??j();console.log("resolvedExtensions",f.value,f),console.log("editorOptions (as single prop):",y);const v=x({content:M,extensions:f.value,theme:a,editorProps:{attributes:{autocomplete:"off",autocorrect:"off",autocapitalize:"off",class:"min-h-full min-w-full",...(l==null?void 0:l.attributes)??{}},...l},...y,onUpdate:u=>{const m=u.editor.getJSON();t==null||t(m,u.editor),p==null||p(u)}});return r.watch(v,u=>{u&&!u.isDestroyed?d==null||d(u):console.log("[useSlideEditor] ❌ Editor not ready or destroyed")},{immediate:!0}),{editor:v,presets:b}},B={class:"bs-viewport"},A=r.defineComponent({__name:"SlideEditor",props:{bubbleMenuPreset:{type:[Boolean,Object],default:!0},className:{},style:{},content:{},onChange:{},extensions:{},extensionKitOptions:{},presetTemplates:{},onEditorReady:{},theme:{},editorProps:{},onUpdate:{},editorOptions:{}},setup(s){const e=s,{bubbleMenuPreset:t,className:n,style:o,...i}=e,{editor:d}=_(i),a=r.computed(()=>e.bubbleMenuPreset===!1?null:e.bubbleMenuPreset===!0?{}:e.bubbleMenuPreset);return(l,p)=>r.unref(d)?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(r.unref(n)),style:r.normalizeStyle(r.unref(o))},[r.createElementVNode("div",B,[r.createVNode(r.unref(C),{editor:r.unref(d)},null,8,["editor"]),a.value?(r.openBlock(),r.createBlock(h._sfc_main,r.mergeProps({key:0,editor:r.unref(d)},a.value),null,16,["editor"])):r.createCommentVNode("",!0)])],6)):r.createCommentVNode("",!0)}});class g{constructor(e,{props:t={},editor:n}){this.destroyed=!1,this.editor=n,this.component=r.markRaw(e),this.el=document.createElement("div"),this.props=r.reactive(t),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var e,t,n,o;return(t=(e=this.renderedComponent.vNode)==null?void 0:e.component)!=null&&t.exposed?this.renderedComponent.vNode.component.exposed:(o=(n=this.renderedComponent.vNode)==null?void 0:n.component)==null?void 0:o.proxy}renderComponent(){if(this.destroyed)return this.renderedComponent;let e=r.h(this.component,this.props);return this.editor.appContext&&(e.appContext=this.editor.appContext),typeof document<"u"&&this.el&&r.render(e,this.el),{vNode:e,destroy:()=>{this.el&&r.render(null,this.el),this.el=null,e=null},el:this.el?this.el.firstElementChild:null}}updateProps(e={}){this.destroyed||(Object.entries(e).forEach(([t,n])=>{this.props[t]=n}),this.renderComponent())}destroy(){this.destroyed||(this.destroyed=!0,this.renderedComponent.destroy())}}const R={editor:{type:Object,required:!0},mark:{type:Object,required:!0},extension:{type:Object,required:!0},inline:{type:Boolean,required:!0},view:{type:Object,required:!0},updateAttributes:{type:Function,required:!0},HTMLAttributes:{type:Object,required:!0}},W=r.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return r.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});class N extends c.MarkView{constructor(e,t,n){super(e,t,n);const o={...t,updateAttributes:this.updateAttributes.bind(this)},i=r.defineComponent({extends:{...e},props:Object.keys(o),template:this.component.template,setup:d=>{var a;return(a=e.setup)==null?void 0:a.call(e,d,{expose:()=>{}})},__scopeId:e.__scopeId,__cssModules:e.__cssModules,__name:e.__name,__file:e.__file});this.renderer=new g(i,{editor:this.editor,props:o})}get dom(){return this.renderer.element}get contentDOM(){return this.dom.querySelector("[data-mark-view-content]")}updateAttributes(e){const t=r.toRaw(this.mark);super.updateAttributes(e,t)}destroy(){this.renderer.destroy()}}function F(s,e={}){return t=>t.editor.contentComponent?new N(s,t,e):{}}const I={editor:{type:Object,required:!0},node:{type:Object,required:!0},decorations:{type:Object,required:!0},selected:{type:Boolean,required:!0},extension:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},view:{type:Object,required:!0},innerDecorations:{type:Object,required:!0},HTMLAttributes:{type:Object,required:!0}};class T extends c.NodeView{constructor(){super(...arguments),this.cachedExtensionWithSyncedStorage=null}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,o,i){return o==="storage"?e.storage[t.name]??{}:Reflect.get(n,o,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(o={})=>this.updateAttributes(o),deleteNode:()=>this.deleteNode()},t=this.onDragStart.bind(this);this.decorationClasses=r.ref(this.getDecorationClasses());const n=r.defineComponent({extends:{...this.component},props:Object.keys(e),template:this.component.template,setup:o=>{var i,d;return r.provide("onDragStart",t),r.provide("decorationClasses",this.decorationClasses),(d=(i=this.component).setup)==null?void 0:d.call(i,o,{expose:()=>{}})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new g(n,{editor:this.editor,props:e})}get dom(){if(!this.renderer.element||!this.renderer.element.hasAttribute("data-node-view-wrapper"))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:e,to:t}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(e<=n&&t>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,n){const o=i=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(i)};if(typeof this.options.update=="function"){const i=this.node,d=this.decorations,a=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.options.update({oldNode:i,oldDecorations:d,newNode:e,newDecorations:t,oldInnerDecorations:a,innerDecorations:n,updateProps:()=>o({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return e.type!==this.node.type?!1:(e===this.node&&this.decorations===t&&this.innerDecorations===n||(this.node=e,this.decorations=t,this.innerDecorations=n,o({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.flatMap(e=>e.type.attrs.class).join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}}function U(s,e){return t=>{if(!t.editor.contentComponent)return{};const n=typeof s=="function"&&"__vccOpts"in s?s.__vccOpts:s;return new T(n,t,e)}}exports.BubbleMenu=h.BubbleMenu;exports.BubbleMenuPreset=h._sfc_main;exports.FloatingMenu=h.FloatingMenu;exports.Editor=S;exports.EditorContent=C;exports.MarkViewContent=W;exports.NodeViewContent=E;exports.NodeViewWrapper=O;exports.SlideEditor=A;exports.VueMarkView=N;exports.VueMarkViewRenderer=F;exports.VueNodeViewRenderer=U;exports.VueRenderer=g;exports.markViewProps=R;exports.nodeViewProps=I;exports.useEditor=x;exports.useSlideEditor=_;Object.keys(c).forEach(s=>{s!=="default"&&!Object.prototype.hasOwnProperty.call(exports,s)&&Object.defineProperty(exports,s,{enumerable:!0,get:()=>c[s]})});
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
- import { Editor as D, MarkView as A, NodeView as R } from "@blockslides/core";
1
+ import { Editor as V, MarkView as j, NodeView as q } from "@blockslides/core";
2
2
  export * from "@blockslides/core";
3
- import { markRaw as j, customRef as F, defineComponent as p, h as m, ref as M, getCurrentInstance as I, watchEffect as U, nextTick as T, unref as c, onBeforeUnmount as O, shallowRef as W, onMounted as B, computed as S, watch as V, openBlock as w, createElementBlock as L, normalizeStyle as z, normalizeClass as H, createElementVNode as $, createVNode as J, createBlock as K, mergeProps as G, createCommentVNode as _, reactive as Q, render as P, toRaw as X, provide as k } from "vue";
4
- import { templatesV1 as Y } from "@blockslides/ai-context";
5
- import { ExtensionKit as Z } from "@blockslides/extension-kit";
6
- import { _ as ee } from "./FloatingMenu-BKkixozS.js";
7
- import { B as ke, F as Ne } from "./FloatingMenu-BKkixozS.js";
8
- function N(r) {
9
- return F((e, t) => ({
3
+ import { markRaw as N, customRef as D, defineComponent as u, h as p, ref as k, getCurrentInstance as A, watchEffect as B, nextTick as R, unref as l, onBeforeUnmount as P, shallowRef as W, onMounted as I, computed as m, watch as F, openBlock as S, createElementBlock as T, normalizeStyle as U, normalizeClass as L, createElementVNode as z, createVNode as H, createBlock as $, mergeProps as J, createCommentVNode as w, reactive as G, render as x, toRaw as Q, provide as C } from "vue";
4
+ import { templatesV1 as X } from "@blockslides/ai-context";
5
+ import { ExtensionKit as Y } from "@blockslides/extension-kit";
6
+ import { _ as Z } from "./FloatingMenu-AygIYJQV.js";
7
+ import { B as Ne, F as ke } from "./FloatingMenu-AygIYJQV.js";
8
+ function _(o) {
9
+ return D((e, t) => ({
10
10
  get() {
11
- return e(), r;
11
+ return e(), o;
12
12
  },
13
- set(o) {
14
- r = o, requestAnimationFrame(() => {
13
+ set(r) {
14
+ o = r, requestAnimationFrame(() => {
15
15
  requestAnimationFrame(() => {
16
16
  t();
17
17
  });
@@ -19,11 +19,11 @@ function N(r) {
19
19
  }
20
20
  }));
21
21
  }
22
- class te extends D {
22
+ class K extends V {
23
23
  constructor(e = {}) {
24
- return super(e), this.contentComponent = null, this.appContext = null, this.reactiveState = N(this.view.state), this.reactiveExtensionStorage = N(this.extensionStorage), this.on("beforeTransaction", ({ nextState: t }) => {
24
+ return super(e), this.contentComponent = null, this.appContext = null, this.reactiveState = _(this.view.state), this.reactiveExtensionStorage = _(this.extensionStorage), this.on("beforeTransaction", ({ nextState: t }) => {
25
25
  this.reactiveState.value = t, this.reactiveExtensionStorage.value = this.extensionStorage;
26
- }), j(this);
26
+ }), N(this);
27
27
  }
28
28
  get state() {
29
29
  return this.reactiveState ? this.reactiveState.value : this.view.state;
@@ -35,8 +35,8 @@ class te extends D {
35
35
  * Register a ProseMirror plugin.
36
36
  */
37
37
  registerPlugin(e, t) {
38
- const o = super.registerPlugin(e, t);
39
- return this.reactiveState && (this.reactiveState.value = o), o;
38
+ const r = super.registerPlugin(e, t);
39
+ return this.reactiveState && (this.reactiveState.value = r), r;
40
40
  }
41
41
  /**
42
42
  * Unregister a ProseMirror plugin.
@@ -46,7 +46,7 @@ class te extends D {
46
46
  return this.reactiveState && t && (this.reactiveState.value = t), t;
47
47
  }
48
48
  }
49
- const oe = p({
49
+ const ee = u({
50
50
  name: "EditorContent",
51
51
  props: {
52
52
  editor: {
@@ -54,38 +54,38 @@ const oe = p({
54
54
  type: Object
55
55
  }
56
56
  },
57
- setup(r) {
58
- const e = M(), t = I();
59
- return U(() => {
60
- const o = r.editor;
61
- o && o.options.element && e.value && T(() => {
62
- var i;
63
- if (!e.value || !((i = o.view.dom) != null && i.parentNode))
57
+ setup(o) {
58
+ const e = k(), t = A();
59
+ return B(() => {
60
+ const r = o.editor;
61
+ r && r.options.element && e.value && R(() => {
62
+ var s;
63
+ if (!e.value || !((s = r.view.dom) != null && s.parentNode))
64
64
  return;
65
- const n = c(e.value);
66
- e.value.append(...o.view.dom.parentNode.childNodes), o.contentComponent = t.ctx._, t && (o.appContext = {
65
+ const n = l(e.value);
66
+ e.value.append(...r.view.dom.parentNode.childNodes), r.contentComponent = t.ctx._, t && (r.appContext = {
67
67
  ...t.appContext,
68
68
  // Vue internally uses prototype chain to forward/shadow injects across the entire component chain
69
69
  // so don't use object spread operator or 'Object.assign' and just set `provides` as is on editor's appContext
70
70
  // @ts-expect-error forward instance's 'provides' into appContext
71
71
  provides: t.provides
72
- }), o.setOptions({
72
+ }), r.setOptions({
73
73
  element: n
74
- }), o.createNodeViews();
74
+ }), r.createNodeViews();
75
75
  });
76
- }), O(() => {
77
- const o = r.editor;
78
- o && (o.contentComponent = null, o.appContext = null);
76
+ }), P(() => {
77
+ const r = o.editor;
78
+ r && (r.contentComponent = null, r.appContext = null);
79
79
  }), { rootEl: e };
80
80
  },
81
81
  render() {
82
- return m("div", {
83
- ref: (r) => {
84
- this.rootEl = r;
82
+ return p("div", {
83
+ ref: (o) => {
84
+ this.rootEl = o;
85
85
  }
86
86
  });
87
87
  }
88
- }), fe = p({
88
+ }), me = u({
89
89
  name: "NodeViewContent",
90
90
  props: {
91
91
  as: {
@@ -94,14 +94,14 @@ const oe = p({
94
94
  }
95
95
  },
96
96
  render() {
97
- return m(this.as, {
97
+ return p(this.as, {
98
98
  style: {
99
99
  whiteSpace: "pre-wrap"
100
100
  },
101
101
  "data-node-view-content": ""
102
102
  });
103
103
  }
104
- }), Se = p({
104
+ }), fe = u({
105
105
  name: "NodeViewWrapper",
106
106
  props: {
107
107
  as: {
@@ -111,8 +111,8 @@ const oe = p({
111
111
  },
112
112
  inject: ["onDragStart", "decorationClasses"],
113
113
  render() {
114
- var r, e;
115
- return m(
114
+ var o, e;
115
+ return p(
116
116
  this.as,
117
117
  {
118
118
  // @ts-ignore
@@ -124,20 +124,17 @@ const oe = p({
124
124
  // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)
125
125
  onDragstart: this.onDragStart
126
126
  },
127
- (e = (r = this.$slots).default) == null ? void 0 : e.call(r)
127
+ (e = (o = this.$slots).default) == null ? void 0 : e.call(o)
128
128
  );
129
129
  }
130
- }), ne = (r = {}) => {
131
- console.log("[useEditor] THE OPTIONS ARE:", r), console.log("[useEditor] Creating editor with options:", r), console.log("[useEditor] options.enableCoreExtensions:", r.enableCoreExtensions), console.log("[useEditor] options.injectCSS:", r.injectCSS);
130
+ }), te = (o = {}) => {
132
131
  const e = W();
133
- return B(() => {
134
- var t;
135
- console.log("[useEditor] onMounted - Creating Editor instance"), console.log("[useEditor] onMounted - options:", r), console.log("[useEditor] onMounted - options.enableCoreExtensions:", r.enableCoreExtensions), e.value = new te(r), console.log("[useEditor] Editor instance created:", e.value), console.log("[useEditor] Editor view:", (t = e.value) == null ? void 0 : t.view);
136
- }), O(() => {
137
- var n, i, s, l;
138
- console.log("[useEditor] onBeforeUnmount - Cleaning up editor");
139
- const t = (i = (n = e.value) == null ? void 0 : n.view.dom) == null ? void 0 : i.parentNode, o = t == null ? void 0 : t.cloneNode(!0);
140
- (s = t == null ? void 0 : t.parentNode) == null || s.replaceChild(o, t), (l = e.value) == null || l.destroy();
132
+ return I(() => {
133
+ e.value = new K(o);
134
+ }), P(() => {
135
+ var n, s, i, d;
136
+ const t = (s = (n = e.value) == null ? void 0 : n.view.dom) == null ? void 0 : s.parentNode, r = t == null ? void 0 : t.cloneNode(!0);
137
+ (i = t == null ? void 0 : t.parentNode) == null || i.replaceChild(r, t), (d = e.value) == null || d.destroy();
141
138
  }), e;
142
139
  }, re = () => ({
143
140
  /**
@@ -229,84 +226,77 @@ const oe = p({
229
226
  ]
230
227
  }
231
228
  ]
232
- }), ie = (r) => ({
229
+ }), ne = (o) => ({
233
230
  showPresets: !0,
234
- presets: r,
231
+ presets: o,
235
232
  presetBackground: "#0f172a",
236
233
  presetForeground: "#e5e7eb"
237
- }), se = {
234
+ }), oe = {
238
235
  renderMode: "dynamic",
239
236
  hoverOutline: { color: "#3b82f6", width: "1.5px", offset: "4px" },
240
237
  hoverOutlineCascade: !1
241
- }, de = (r = {}) => {
242
- console.log("[useSlideEditor] Called with props:", r);
238
+ }, se = (o = {}) => {
243
239
  const {
244
240
  content: e,
245
241
  onChange: t,
246
- extensions: o,
242
+ extensions: r,
247
243
  extensionKitOptions: n,
248
- presetTemplates: i,
249
- onEditorReady: s,
250
- theme: l = "light",
251
- editorProps: a,
252
- onUpdate: u,
253
- ...g
254
- } = r;
255
- console.log("[useSlideEditor] editorOptions:", g), console.log("[useSlideEditor] editorOptions.enableCoreExtensions:", g.enableCoreExtensions), console.log("[useSlideEditor] editorOptions.injectCSS:", g.injectCSS), console.log("[useSlideEditor] Content:", e), console.log("[useSlideEditor] ExtensionKitOptions:", n);
256
- const E = S(
257
- () => i ?? Y.listPresetTemplates()
258
- ), v = S(() => {
259
- const d = (n == null ? void 0 : n.addSlideButton) === !1 ? !1 : {
260
- ...ie(E.value),
244
+ presetTemplates: s,
245
+ onEditorReady: i,
246
+ theme: d = "light",
247
+ editorProps: c,
248
+ onUpdate: h,
249
+ editorOptions: y = {}
250
+ } = o, b = m(
251
+ () => s ?? X.listPresetTemplates()
252
+ ), M = m(() => {
253
+ const a = (n == null ? void 0 : n.addSlideButton) === !1 ? !1 : {
254
+ ...ne(b.value),
261
255
  ...(n == null ? void 0 : n.addSlideButton) ?? {}
262
- }, h = (n == null ? void 0 : n.slide) === !1 ? !1 : {
263
- ...se,
256
+ }, g = (n == null ? void 0 : n.slide) === !1 ? !1 : {
257
+ ...oe,
264
258
  ...(n == null ? void 0 : n.slide) ?? {}
265
- }, y = {
259
+ };
260
+ return {
266
261
  ...n,
267
- addSlideButton: d,
268
- slide: h
262
+ addSlideButton: a,
263
+ slide: g
269
264
  };
270
- return console.log("[useSlideEditor] mergedExtensionKitOptions:", y), console.log("[useSlideEditor] addSlideButton config:", y.addSlideButton), console.log("[useSlideEditor] presets:", E.value), y;
271
- }), C = S(() => {
272
- console.log("[useSlideEditor] Configuring ExtensionKit with options:", v.value);
273
- const d = Z.configure(v.value);
274
- console.log("[useSlideEditor] ExtensionKit configured:", d), console.log("[useSlideEditor] ExtensionKit name:", d.name);
275
- const h = o ? [d, ...o] : [d];
276
- return console.log("[useSlideEditor] Final extensions array:", h), h;
277
- }), x = e ?? re();
278
- console.log("[useSlideEditor] Initial content resolved:", x), console.log("[useSlideEditor] Resolved extensions:", C.value);
279
- const f = {
280
- content: x,
281
- extensions: C.value,
282
- theme: l,
283
- editorProps: {
284
- attributes: {
285
- autocomplete: "off",
286
- autocorrect: "off",
287
- autocapitalize: "off",
288
- class: "min-h-full min-w-full",
289
- ...(a == null ? void 0 : a.attributes) ?? {}
265
+ }), f = m(() => {
266
+ const a = Y.configure(M.value);
267
+ return r ? [a, ...r] : [a];
268
+ }), O = e ?? re();
269
+ console.log("resolvedExtensions", f.value, f), console.log("editorOptions (as single prop):", y);
270
+ const v = te(
271
+ {
272
+ content: O,
273
+ extensions: f.value,
274
+ theme: d,
275
+ editorProps: {
276
+ attributes: {
277
+ autocomplete: "off",
278
+ autocorrect: "off",
279
+ autocapitalize: "off",
280
+ class: "min-h-full min-w-full",
281
+ ...(c == null ? void 0 : c.attributes) ?? {}
282
+ },
283
+ ...c
290
284
  },
291
- ...a
292
- },
293
- ...g,
294
- onUpdate: (d) => {
295
- console.log("[useSlideEditor] onUpdate called");
296
- const h = d.editor.getJSON();
297
- t == null || t(h, d.editor), u == null || u(d);
285
+ ...y,
286
+ onUpdate: (a) => {
287
+ const g = a.editor.getJSON();
288
+ t == null || t(g, a.editor), h == null || h(a);
289
+ }
298
290
  }
299
- };
300
- console.log("[useSlideEditor] Final editor config:", f), console.log("[useSlideEditor] Final editor config enableCoreExtensions:", f.enableCoreExtensions), console.log("[useSlideEditor] Final editor config injectCSS:", f.injectCSS);
301
- const b = ne(f);
302
- return console.log("[useSlideEditor] Editor ref created:", b), V(
303
- b,
304
- (d) => {
305
- console.log("[useSlideEditor] Editor watch triggered, newEditor:", d), d && !d.isDestroyed ? (console.log("[useSlideEditor] ✅ Calling onEditorReady"), s == null || s(d)) : console.log("[useSlideEditor] ❌ Editor not ready or destroyed");
291
+ );
292
+ return F(
293
+ v,
294
+ (a) => {
295
+ a && !a.isDestroyed ? i == null || i(a) : console.log("[useSlideEditor] ❌ Editor not ready or destroyed");
306
296
  },
307
297
  { immediate: !0 }
308
- ), { editor: b, presets: E };
309
- }, le = { class: "bs-viewport" }, Ee = /* @__PURE__ */ p({
298
+ ), { editor: v, presets: b };
299
+ }, ie = { class: "bs-viewport" }, ge = /* @__PURE__ */ u({
310
300
  __name: "SlideEditor",
311
301
  props: {
312
302
  bubbleMenuPreset: { type: [Boolean, Object], default: !0 },
@@ -318,97 +308,62 @@ const oe = p({
318
308
  extensionKitOptions: {},
319
309
  presetTemplates: {},
320
310
  onEditorReady: {},
321
- element: {},
322
311
  theme: {},
323
- injectCSS: { type: Boolean },
324
- injectNonce: {},
325
- autofocus: { type: [String, Number, Boolean, null] },
326
- editable: { type: Boolean },
327
312
  editorProps: {},
328
- parseOptions: {},
329
- coreExtensionOptions: {},
330
- enableInputRules: { type: [Array, Boolean] },
331
- enablePasteRules: { type: [Array, Boolean] },
332
- enableCoreExtensions: { type: [Boolean, Object] },
333
- enableContentCheck: { type: Boolean },
334
- emitContentError: { type: Boolean },
335
- onBeforeCreate: {},
336
- onCreate: {},
337
- onMount: {},
338
- onUnmount: {},
339
- onContentError: {},
340
313
  onUpdate: {},
341
- onSelectionUpdate: {},
342
- onTransaction: {},
343
- onFocus: {},
344
- onBlur: {},
345
- onDestroy: {},
346
- onPaste: {},
347
- onDrop: {},
348
- onDelete: {}
314
+ editorOptions: {}
349
315
  },
350
- setup(r) {
351
- console.log("[SlideEditor.vue] Component loading");
352
- const e = r;
353
- console.log("[SlideEditor.vue] Props:", e), console.log("[SlideEditor.vue] Props.enableCoreExtensions:", e.enableCoreExtensions), console.log("[SlideEditor.vue] Props.injectCSS:", e.injectCSS);
354
- const {
316
+ setup(o) {
317
+ const e = o, {
355
318
  bubbleMenuPreset: t,
356
- className: o,
319
+ className: r,
357
320
  style: n,
358
- ...i
359
- } = e;
360
- console.log("[SlideEditor.vue] Hook props:", i), console.log("[SlideEditor.vue] hookProps.enableCoreExtensions:", i.enableCoreExtensions), console.log("[SlideEditor.vue] hookProps.injectCSS:", i.injectCSS);
361
- const { editor: s, presets: l } = de(i);
362
- console.log("[SlideEditor.vue] Editor from useSlideEditor:", s);
363
- const a = S(() => e.bubbleMenuPreset === !1 ? null : e.bubbleMenuPreset === !0 ? {} : e.bubbleMenuPreset);
364
- return V(s, (u) => {
365
- console.log("[SlideEditor.vue] Editor watch - newEditor:", u), console.log("[SlideEditor.vue] Editor exists:", !!u);
366
- }, { immediate: !0 }), B(() => {
367
- console.log("[SlideEditor.vue] Component mounted"), console.log("[SlideEditor.vue] Editor value:", s.value);
368
- }), (u, g) => c(s) ? (w(), L("div", {
321
+ ...s
322
+ } = e, { editor: i } = se(s), d = m(() => e.bubbleMenuPreset === !1 ? null : e.bubbleMenuPreset === !0 ? {} : e.bubbleMenuPreset);
323
+ return (c, h) => l(i) ? (S(), T("div", {
369
324
  key: 0,
370
- class: H(c(o)),
371
- style: z(c(n))
325
+ class: L(l(r)),
326
+ style: U(l(n))
372
327
  }, [
373
- $("div", le, [
374
- J(c(oe), { editor: c(s) }, null, 8, ["editor"]),
375
- a.value ? (w(), K(ee, G({
328
+ z("div", ie, [
329
+ H(l(ee), { editor: l(i) }, null, 8, ["editor"]),
330
+ d.value ? (S(), $(Z, J({
376
331
  key: 0,
377
- editor: c(s)
378
- }, a.value), null, 16, ["editor"])) : _("", !0)
332
+ editor: l(i)
333
+ }, d.value), null, 16, ["editor"])) : w("", !0)
379
334
  ])
380
- ], 6)) : _("", !0);
335
+ ], 6)) : w("", !0);
381
336
  }
382
337
  });
383
- class q {
384
- constructor(e, { props: t = {}, editor: o }) {
385
- this.destroyed = !1, this.editor = o, this.component = j(e), this.el = document.createElement("div"), this.props = Q(t), this.renderedComponent = this.renderComponent();
338
+ class E {
339
+ constructor(e, { props: t = {}, editor: r }) {
340
+ this.destroyed = !1, this.editor = r, this.component = N(e), this.el = document.createElement("div"), this.props = G(t), this.renderedComponent = this.renderComponent();
386
341
  }
387
342
  get element() {
388
343
  return this.renderedComponent.el;
389
344
  }
390
345
  get ref() {
391
- var e, t, o, n;
392
- return (t = (e = this.renderedComponent.vNode) == null ? void 0 : e.component) != null && t.exposed ? this.renderedComponent.vNode.component.exposed : (n = (o = this.renderedComponent.vNode) == null ? void 0 : o.component) == null ? void 0 : n.proxy;
346
+ var e, t, r, n;
347
+ return (t = (e = this.renderedComponent.vNode) == null ? void 0 : e.component) != null && t.exposed ? this.renderedComponent.vNode.component.exposed : (n = (r = this.renderedComponent.vNode) == null ? void 0 : r.component) == null ? void 0 : n.proxy;
393
348
  }
394
349
  renderComponent() {
395
350
  if (this.destroyed)
396
351
  return this.renderedComponent;
397
- let e = m(this.component, this.props);
398
- return this.editor.appContext && (e.appContext = this.editor.appContext), typeof document < "u" && this.el && P(e, this.el), { vNode: e, destroy: () => {
399
- this.el && P(null, this.el), this.el = null, e = null;
352
+ let e = p(this.component, this.props);
353
+ return this.editor.appContext && (e.appContext = this.editor.appContext), typeof document < "u" && this.el && x(e, this.el), { vNode: e, destroy: () => {
354
+ this.el && x(null, this.el), this.el = null, e = null;
400
355
  }, el: this.el ? this.el.firstElementChild : null };
401
356
  }
402
357
  updateProps(e = {}) {
403
- this.destroyed || (Object.entries(e).forEach(([t, o]) => {
404
- this.props[t] = o;
358
+ this.destroyed || (Object.entries(e).forEach(([t, r]) => {
359
+ this.props[t] = r;
405
360
  }), this.renderComponent());
406
361
  }
407
362
  destroy() {
408
363
  this.destroyed || (this.destroyed = !0, this.renderedComponent.destroy());
409
364
  }
410
365
  }
411
- const be = {
366
+ const ye = {
412
367
  editor: {
413
368
  type: Object,
414
369
  required: !0
@@ -437,7 +392,7 @@ const be = {
437
392
  type: Object,
438
393
  required: !0
439
394
  }
440
- }, ye = p({
395
+ }, be = u({
441
396
  name: "MarkViewContent",
442
397
  props: {
443
398
  as: {
@@ -446,7 +401,7 @@ const be = {
446
401
  }
447
402
  },
448
403
  render() {
449
- return m(this.as, {
404
+ return p(this.as, {
450
405
  style: {
451
406
  whiteSpace: "inherit"
452
407
  },
@@ -454,16 +409,16 @@ const be = {
454
409
  });
455
410
  }
456
411
  });
457
- class ae extends A {
458
- constructor(e, t, o) {
459
- super(e, t, o);
460
- const n = { ...t, updateAttributes: this.updateAttributes.bind(this) }, i = p({
412
+ class de extends j {
413
+ constructor(e, t, r) {
414
+ super(e, t, r);
415
+ const n = { ...t, updateAttributes: this.updateAttributes.bind(this) }, s = u({
461
416
  extends: { ...e },
462
417
  props: Object.keys(n),
463
418
  template: this.component.template,
464
- setup: (s) => {
465
- var l;
466
- return (l = e.setup) == null ? void 0 : l.call(e, s, {
419
+ setup: (i) => {
420
+ var d;
421
+ return (d = e.setup) == null ? void 0 : d.call(e, i, {
467
422
  expose: () => {
468
423
  }
469
424
  });
@@ -474,7 +429,7 @@ class ae extends A {
474
429
  __name: e.__name,
475
430
  __file: e.__file
476
431
  });
477
- this.renderer = new q(i, {
432
+ this.renderer = new E(s, {
478
433
  editor: this.editor,
479
434
  props: n
480
435
  });
@@ -486,17 +441,17 @@ class ae extends A {
486
441
  return this.dom.querySelector("[data-mark-view-content]");
487
442
  }
488
443
  updateAttributes(e) {
489
- const t = X(this.mark);
444
+ const t = Q(this.mark);
490
445
  super.updateAttributes(e, t);
491
446
  }
492
447
  destroy() {
493
448
  this.renderer.destroy();
494
449
  }
495
450
  }
496
- function ve(r, e = {}) {
497
- return (t) => t.editor.contentComponent ? new ae(r, t, e) : {};
451
+ function ve(o, e = {}) {
452
+ return (t) => t.editor.contentComponent ? new de(o, t, e) : {};
498
453
  }
499
- const Ce = {
454
+ const Se = {
500
455
  editor: {
501
456
  type: Object,
502
457
  required: !0
@@ -542,7 +497,7 @@ const Ce = {
542
497
  required: !0
543
498
  }
544
499
  };
545
- class ue extends R {
500
+ class ae extends q {
546
501
  constructor() {
547
502
  super(...arguments), this.cachedExtensionWithSyncedStorage = null;
548
503
  }
@@ -555,8 +510,8 @@ class ue extends R {
555
510
  if (!this.cachedExtensionWithSyncedStorage) {
556
511
  const e = this.editor, t = this.extension;
557
512
  this.cachedExtensionWithSyncedStorage = new Proxy(t, {
558
- get(o, n, i) {
559
- return n === "storage" ? e.storage[t.name] ?? {} : Reflect.get(o, n, i);
513
+ get(r, n, s) {
514
+ return n === "storage" ? e.storage[t.name] ?? {} : Reflect.get(r, n, s);
560
515
  }
561
516
  });
562
517
  }
@@ -576,14 +531,14 @@ class ue extends R {
576
531
  updateAttributes: (n = {}) => this.updateAttributes(n),
577
532
  deleteNode: () => this.deleteNode()
578
533
  }, t = this.onDragStart.bind(this);
579
- this.decorationClasses = M(this.getDecorationClasses());
580
- const o = p({
534
+ this.decorationClasses = k(this.getDecorationClasses());
535
+ const r = u({
581
536
  extends: { ...this.component },
582
537
  props: Object.keys(e),
583
538
  template: this.component.template,
584
539
  setup: (n) => {
585
- var i, s;
586
- return k("onDragStart", t), k("decorationClasses", this.decorationClasses), (s = (i = this.component).setup) == null ? void 0 : s.call(i, n, {
540
+ var s, i;
541
+ return C("onDragStart", t), C("decorationClasses", this.decorationClasses), (i = (s = this.component).setup) == null ? void 0 : i.call(s, n, {
587
542
  expose: () => {
588
543
  }
589
544
  });
@@ -604,7 +559,7 @@ class ue extends R {
604
559
  // eslint-disable-next-line
605
560
  __file: this.component.__file
606
561
  });
607
- this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.renderer = new q(o, {
562
+ this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.renderer = new E(r, {
608
563
  editor: this.editor,
609
564
  props: e
610
565
  });
@@ -630,9 +585,9 @@ class ue extends R {
630
585
  * If it is, call `selectNode`, otherwise call `deselectNode`.
631
586
  */
632
587
  handleSelectionUpdate() {
633
- const { from: e, to: t } = this.editor.state.selection, o = this.getPos();
634
- if (typeof o == "number")
635
- if (e <= o && t >= o + this.node.nodeSize) {
588
+ const { from: e, to: t } = this.editor.state.selection, r = this.getPos();
589
+ if (typeof r == "number")
590
+ if (e <= r && t >= r + this.node.nodeSize) {
636
591
  if (this.renderer.props.selected)
637
592
  return;
638
593
  this.selectNode();
@@ -646,23 +601,23 @@ class ue extends R {
646
601
  * On update, update the Vue component.
647
602
  * To prevent unnecessary updates, the `update` option can be used.
648
603
  */
649
- update(e, t, o) {
650
- const n = (i) => {
651
- this.decorationClasses.value = this.getDecorationClasses(), this.renderer.updateProps(i);
604
+ update(e, t, r) {
605
+ const n = (s) => {
606
+ this.decorationClasses.value = this.getDecorationClasses(), this.renderer.updateProps(s);
652
607
  };
653
608
  if (typeof this.options.update == "function") {
654
- const i = this.node, s = this.decorations, l = this.innerDecorations;
655
- return this.node = e, this.decorations = t, this.innerDecorations = o, this.options.update({
656
- oldNode: i,
657
- oldDecorations: s,
609
+ const s = this.node, i = this.decorations, d = this.innerDecorations;
610
+ return this.node = e, this.decorations = t, this.innerDecorations = r, this.options.update({
611
+ oldNode: s,
612
+ oldDecorations: i,
658
613
  newNode: e,
659
614
  newDecorations: t,
660
- oldInnerDecorations: l,
661
- innerDecorations: o,
662
- updateProps: () => n({ node: e, decorations: t, innerDecorations: o, extension: this.extensionWithSyncedStorage })
615
+ oldInnerDecorations: d,
616
+ innerDecorations: r,
617
+ updateProps: () => n({ node: e, decorations: t, innerDecorations: r, extension: this.extensionWithSyncedStorage })
663
618
  });
664
619
  }
665
- return e.type !== this.node.type ? !1 : (e === this.node && this.decorations === t && this.innerDecorations === o || (this.node = e, this.decorations = t, this.innerDecorations = o, n({ node: e, decorations: t, innerDecorations: o, extension: this.extensionWithSyncedStorage })), !0);
620
+ return e.type !== this.node.type ? !1 : (e === this.node && this.decorations === t && this.innerDecorations === r || (this.node = e, this.decorations = t, this.innerDecorations = r, n({ node: e, decorations: t, innerDecorations: r, extension: this.extensionWithSyncedStorage })), !0);
666
621
  }
667
622
  /**
668
623
  * Select the node.
@@ -689,30 +644,30 @@ class ue extends R {
689
644
  this.renderer.destroy(), this.editor.off("selectionUpdate", this.handleSelectionUpdate);
690
645
  }
691
646
  }
692
- function xe(r, e) {
647
+ function we(o, e) {
693
648
  return (t) => {
694
649
  if (!t.editor.contentComponent)
695
650
  return {};
696
- const o = typeof r == "function" && "__vccOpts" in r ? r.__vccOpts : r;
697
- return new ue(o, t, e);
651
+ const r = typeof o == "function" && "__vccOpts" in o ? o.__vccOpts : o;
652
+ return new ae(r, t, e);
698
653
  };
699
654
  }
700
655
  export {
701
- ke as BubbleMenu,
702
- ee as BubbleMenuPreset,
703
- te as Editor,
704
- oe as EditorContent,
705
- Ne as FloatingMenu,
706
- ye as MarkViewContent,
707
- fe as NodeViewContent,
708
- Se as NodeViewWrapper,
709
- Ee as SlideEditor,
710
- ae as VueMarkView,
656
+ Ne as BubbleMenu,
657
+ Z as BubbleMenuPreset,
658
+ K as Editor,
659
+ ee as EditorContent,
660
+ ke as FloatingMenu,
661
+ be as MarkViewContent,
662
+ me as NodeViewContent,
663
+ fe as NodeViewWrapper,
664
+ ge as SlideEditor,
665
+ de as VueMarkView,
711
666
  ve as VueMarkViewRenderer,
712
- xe as VueNodeViewRenderer,
713
- q as VueRenderer,
714
- be as markViewProps,
715
- Ce as nodeViewProps,
716
- ne as useEditor,
717
- de as useSlideEditor
667
+ we as VueNodeViewRenderer,
668
+ E as VueRenderer,
669
+ ye as markViewProps,
670
+ Se as nodeViewProps,
671
+ te as useEditor,
672
+ se as useSlideEditor
718
673
  };
package/dist/menus.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./FloatingMenu-By8Qi7tW.cjs");exports.BubbleMenu=e.BubbleMenu;exports.BubbleMenuPreset=e._sfc_main;exports.FloatingMenu=e.FloatingMenu;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./FloatingMenu-Un--4r7A.cjs");exports.BubbleMenu=e.BubbleMenu;exports.BubbleMenuPreset=e._sfc_main;exports.FloatingMenu=e.FloatingMenu;
package/dist/menus.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as a, _ as b, F as n } from "./FloatingMenu-BKkixozS.js";
1
+ import { B as a, _ as b, F as n } from "./FloatingMenu-AygIYJQV.js";
2
2
  export {
3
3
  a as BubbleMenu,
4
4
  b as BubbleMenuPreset,
@@ -3,7 +3,7 @@ import { AnyExtension, Editor, JSONContent, EditorOptions } from '../../core/src
3
3
  import { ExtensionKitOptions } from '../../extension-kit/src';
4
4
 
5
5
  type PresetTemplates = ReturnType<typeof templatesV1.listPresetTemplates>;
6
- export interface UseSlideEditorProps extends Omit<Partial<EditorOptions>, 'extensions'> {
6
+ export interface UseSlideEditorProps {
7
7
  /**
8
8
  * Initial content for the editor. If omitted, a single preset slide is used.
9
9
  */
@@ -28,6 +28,23 @@ export interface UseSlideEditorProps extends Omit<Partial<EditorOptions>, 'exten
28
28
  * Called once when an editor instance is ready.
29
29
  */
30
30
  onEditorReady?: (editor: Editor) => void;
31
+ /**
32
+ * Editor theme for UI styling
33
+ */
34
+ theme?: EditorOptions['theme'];
35
+ /**
36
+ * The editor's props
37
+ */
38
+ editorProps?: EditorOptions['editorProps'];
39
+ /**
40
+ * Called on every update
41
+ */
42
+ onUpdate?: EditorOptions['onUpdate'];
43
+ /**
44
+ * Additional editor options to pass through to the core editor.
45
+ * This allows passing any EditorOptions without Vue auto-initializing them.
46
+ */
47
+ editorOptions?: Partial<EditorOptions>;
31
48
  }
32
49
  export declare const useSlideEditor: (props?: UseSlideEditorProps) => {
33
50
  editor: import('vue').ShallowRef<import('./Editor.js').Editor | undefined, import('./Editor.js').Editor | undefined>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blockslides/vue-3",
3
3
  "description": "Vue 3 components for blockslides",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "homepage": "https://github.com/keivanmojmali/blockslides",
6
6
  "keywords": [
7
7
  "blockslides",
@@ -36,13 +36,17 @@
36
36
  "src",
37
37
  "dist"
38
38
  ],
39
+ "dependencies": {
40
+ "@blockslides/ai-context": "^0.3.1",
41
+ "@blockslides/extension-kit": "^0.7.2"
42
+ },
39
43
  "devDependencies": {
40
44
  "@floating-ui/dom": "^1.0.0",
41
45
  "@vitejs/plugin-vue": "^5.0.0",
42
46
  "vite": "^5.0.0",
43
47
  "vite-plugin-dts": "^3.0.0",
44
48
  "vue": "^3.5.13",
45
- "@blockslides/core": "^0.3.2",
49
+ "@blockslides/core": "^0.3.3",
46
50
  "@blockslides/pm": "^0.1.1"
47
51
  },
48
52
  "optionalDependencies": {
@@ -52,7 +56,7 @@
52
56
  "peerDependencies": {
53
57
  "@floating-ui/dom": "^1.0.0",
54
58
  "vue": "^3.0.0",
55
- "@blockslides/core": "^0.3.2",
59
+ "@blockslides/core": "^0.3.3",
56
60
  "@blockslides/pm": "^0.1.1"
57
61
  },
58
62
  "repository": {
@@ -1 +0,0 @@
1
- "use strict";const t=require("vue"),T=require("@blockslides/extension-bubble-menu"),S=require("@blockslides/pm/state"),c=require("@blockslides/extension-bubble-menu-preset"),v=require("@blockslides/core"),E=require("@blockslides/extension-floating-menu"),F={key:0,style:{display:"none"}},b="bubbleMenuPreset",M=t.defineComponent({__name:"BubbleMenuPreset",props:{editor:{},updateDelay:{},resizeDelay:{},appendTo:{type:Function},shouldShow:{type:[Function,null]},getReferencedVirtualElement:{type:Function},options:{},items:{},className:{},injectStyles:{type:Boolean},textColors:{},highlightColors:{},fonts:{},fontSizes:{},alignments:{},onTextAction:{type:Function},onImageReplace:{type:Function}},setup(s){const e=s,u=t.ref(null);let i;const o=()=>{const n=e.editor;if(!n||n.isDestroyed)return;i&&(i(),i=void 0);const{element:a,cleanup:d}=c.buildMenuElement(n,{items:e.items??c.DEFAULT_ITEMS,className:e.className??"",injectStyles:e.injectStyles!==!1,textColors:e.textColors??c.DEFAULT_COLOR_PALETTE,highlightColors:e.highlightColors??c.DEFAULT_HIGHLIGHT_PALETTE,fonts:e.fonts??c.DEFAULT_FONTS,fontSizes:e.fontSizes??c.DEFAULT_FONT_SIZES,alignments:e.alignments??c.DEFAULT_ALIGNMENTS,onTextAction:e.onTextAction,onImageReplace:e.onImageReplace});u.value=a,i=d;const p=({state:f,editor:g})=>{var y,h;const l=f.selection,m=l instanceof S.NodeSelection&&["image","imageBlock"].includes((h=(y=l.node)==null?void 0:y.type)==null?void 0:h.name)||g.isActive("image")||g.isActive("imageBlock");return!!(m||v.isTextSelection(l)&&!l.empty&&!m)},r=T.BubbleMenuPlugin({editor:n,element:a,updateDelay:e.updateDelay,resizeDelay:e.resizeDelay,appendTo:e.appendTo,pluginKey:b,shouldShow:e.shouldShow??p,getReferencedVirtualElement:e.getReferencedVirtualElement,options:e.options});n.registerPlugin(r)};return t.onMounted(()=>{o()}),t.watch(()=>[e.editor,e.updateDelay,e.resizeDelay,e.appendTo,e.shouldShow,e.getReferencedVirtualElement,e.options,e.items,e.className,e.injectStyles,e.textColors,e.highlightColors,e.fonts,e.fontSizes,e.alignments,e.onTextAction,e.onImageReplace],()=>{o()}),t.onBeforeUnmount(()=>{var n;e.editor&&e.editor.unregisterPlugin(b),i&&i(),(n=u.value)!=null&&n.parentNode&&u.value.parentNode.removeChild(u.value)}),(n,a)=>u.value?(t.openBlock(),t.createElementBlock("div",F)):t.createCommentVNode("",!0)}}),D=t.defineComponent({name:"BubbleMenu",inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(s,{slots:e,attrs:u}){const i=t.ref(null);return t.onMounted(()=>{const{editor:o,options:n,pluginKey:a,resizeDelay:d,appendTo:p,shouldShow:r,getReferencedVirtualElement:f,updateDelay:g}=s,l=i.value;l&&(l.style.visibility="hidden",l.style.position="absolute",l.remove(),t.nextTick(()=>{o.registerPlugin(T.BubbleMenuPlugin({editor:o,element:l,options:n,pluginKey:a,resizeDelay:d,appendTo:p,shouldShow:r,getReferencedVirtualElement:f,updateDelay:g}))}))}),t.onBeforeUnmount(()=>{const{pluginKey:o,editor:n}=s;n.unregisterPlugin(o)}),()=>{var o;return t.h("div",{ref:i,...u},(o=e.default)==null?void 0:o.call(e))}}}),_=t.defineComponent({name:"FloatingMenu",inheritAttrs:!1,props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null}},setup(s,{slots:e,attrs:u}){const i=t.ref(null);return t.onMounted(()=>{const{pluginKey:o,editor:n,options:a,appendTo:d,shouldShow:p}=s,r=i.value;r&&(r.style.visibility="hidden",r.style.position="absolute",r.remove(),n.registerPlugin(E.FloatingMenuPlugin({pluginKey:o,editor:n,element:r,options:a,appendTo:d,shouldShow:p})))}),t.onBeforeUnmount(()=>{const{pluginKey:o,editor:n}=s;n.unregisterPlugin(o)}),()=>{var o;return t.h("div",{ref:i,...u},(o=e.default)==null?void 0:o.call(e))}}});exports.BubbleMenu=D;exports.FloatingMenu=_;exports._sfc_main=M;