reactjs-tiptap-editor 1.0.8 → 1.0.10

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.
Files changed (160) hide show
  1. package/lib/{ActionMenuButton-t7e5GCJp.cjs → ActionMenuButton-BPdRqzDX.cjs} +1 -1
  2. package/lib/{ActionMenuButton-Cc0vy5hy.js → ActionMenuButton-CKTxYtl7.js} +2 -2
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.js +7 -7
  5. package/lib/Blockquote.cjs +1 -1
  6. package/lib/Blockquote.js +3 -3
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +6 -6
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +3 -3
  11. package/lib/Clear.cjs +1 -1
  12. package/lib/Clear.js +3 -3
  13. package/lib/Code.cjs +1 -1
  14. package/lib/Code.js +6 -6
  15. package/lib/CodeBlock.cjs +1 -1
  16. package/lib/CodeBlock.js +4 -4
  17. package/lib/CodeView.cjs +1 -1
  18. package/lib/CodeView.js +3 -3
  19. package/lib/Color.cjs +1 -1
  20. package/lib/Color.js +5 -5
  21. package/lib/Column.cjs +1 -1
  22. package/lib/Column.js +8 -8
  23. package/lib/{Drawer-C6WTtcd0.js → Drawer-Cfx115up.js} +6 -6
  24. package/lib/{Drawer-DRdsK4f_.cjs → Drawer-hHj4Opkg.cjs} +1 -1
  25. package/lib/Drawer.cjs +1 -1
  26. package/lib/Drawer.js +3 -3
  27. package/lib/Emoji.cjs +1 -1
  28. package/lib/Emoji.js +10 -9
  29. package/lib/{Excalidraw-gJ99kWdS.cjs → Excalidraw-8pWJ17Ye.cjs} +1 -1
  30. package/lib/{Excalidraw-DjO5sCC_.js → Excalidraw-CO93Tsmb.js} +7 -7
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +2 -2
  33. package/lib/ExportPdf.cjs +2 -2
  34. package/lib/ExportPdf.js +26 -26
  35. package/lib/ExportWord.cjs +1 -1
  36. package/lib/ExportWord.js +3 -3
  37. package/lib/FontFamily.cjs +1 -1
  38. package/lib/FontFamily.js +5 -5
  39. package/lib/FontSize.cjs +1 -1
  40. package/lib/FontSize.js +5 -5
  41. package/lib/Heading.cjs +1 -1
  42. package/lib/Heading.js +5 -5
  43. package/lib/Highlight.cjs +1 -1
  44. package/lib/Highlight.js +5 -5
  45. package/lib/History.cjs +1 -1
  46. package/lib/History.js +4 -4
  47. package/lib/HorizontalRule.cjs +1 -1
  48. package/lib/HorizontalRule.js +3 -3
  49. package/lib/{Icon-prdLEHMN.js → Icon-D7GJZzoa.js} +1 -1
  50. package/lib/{Icon-DHNSWrSX.cjs → Icon-gtc3g-VK.cjs} +1 -1
  51. package/lib/{Iframe-CvymVtpM.cjs → Iframe-BmXO2c65.cjs} +1 -1
  52. package/lib/{Iframe-CERKUXQh.js → Iframe-DwhclppJ.js} +8 -8
  53. package/lib/Iframe.cjs +1 -1
  54. package/lib/Iframe.js +2 -2
  55. package/lib/Image.cjs +1 -1
  56. package/lib/Image.js +13 -13
  57. package/lib/ImageGif.cjs +1 -1
  58. package/lib/ImageGif.js +14 -14
  59. package/lib/ImportWord.cjs +1 -1
  60. package/lib/ImportWord.js +3 -3
  61. package/lib/{Indent-BfEOOT5B.js → Indent-BOsymiZ7.js} +5 -5
  62. package/lib/{Indent-CE6kk62r.cjs → Indent-DPkMWfcv.cjs} +1 -1
  63. package/lib/Indent.cjs +1 -1
  64. package/lib/Indent.js +2 -2
  65. package/lib/Italic.cjs +1 -1
  66. package/lib/Italic.js +3 -3
  67. package/lib/Katex-B1XbT8-X.cjs +4 -0
  68. package/lib/{Katex-5KNTSK8T.js → Katex-BYK-b9X2.js} +974 -941
  69. package/lib/Katex.cjs +1 -1
  70. package/lib/Katex.js +2 -2
  71. package/lib/LineHeight.cjs +1 -1
  72. package/lib/LineHeight.js +5 -5
  73. package/lib/Link.cjs +1 -1
  74. package/lib/Link.js +2 -2
  75. package/lib/{LinkEditBlock-D6z0Yohc.cjs → LinkEditBlock-4-iRXH7m.cjs} +1 -1
  76. package/lib/{LinkEditBlock-CFkyS2Ze.js → LinkEditBlock-DgrLUMsJ.js} +32 -32
  77. package/lib/Mention.cjs +1 -1
  78. package/lib/Mention.js +23 -22
  79. package/lib/Mermaid.cjs +1 -1
  80. package/lib/Mermaid.js +26 -26
  81. package/lib/MoreMark.cjs +1 -1
  82. package/lib/MoreMark.js +5 -5
  83. package/lib/OrderedList.cjs +1 -1
  84. package/lib/OrderedList.js +3 -3
  85. package/lib/SearchAndReplace.cjs +1 -1
  86. package/lib/SearchAndReplace.js +9 -9
  87. package/lib/SlashCommand.cjs +1 -1
  88. package/lib/SlashCommand.js +39 -266
  89. package/lib/SlashCommandNodeView-BpNNU7Sm.js +254 -0
  90. package/lib/SlashCommandNodeView-CQvMTXys.cjs +1 -0
  91. package/lib/Strike.cjs +1 -1
  92. package/lib/Strike.js +3 -3
  93. package/lib/{Table-CWbY_hqo.js → Table-CT9R9Sdq.js} +5 -5
  94. package/lib/{Table-D9pRzwFU.cjs → Table-LnWGm2m8.cjs} +1 -1
  95. package/lib/Table.cjs +1 -1
  96. package/lib/Table.js +1 -1
  97. package/lib/TaskList.cjs +1 -1
  98. package/lib/TaskList.js +3 -3
  99. package/lib/TextAlign.cjs +1 -1
  100. package/lib/TextAlign.js +5 -5
  101. package/lib/TextDirection.cjs +1 -1
  102. package/lib/TextDirection.js +5 -5
  103. package/lib/TextUnderline.cjs +1 -1
  104. package/lib/TextUnderline.js +3 -3
  105. package/lib/{Twitter-D7NK3MZe.cjs → Twitter-Bo4JkBTL.cjs} +1 -1
  106. package/lib/{Twitter-BV7HA-MO.js → Twitter-mowilxRd.js} +46 -46
  107. package/lib/Twitter.cjs +1 -1
  108. package/lib/Twitter.js +2 -2
  109. package/lib/Video.cjs +1 -1
  110. package/lib/Video.js +7 -7
  111. package/lib/bubble.cjs +4 -4
  112. package/lib/bubble.js +2045 -1931
  113. package/lib/{button-0963_Pa8.js → button-CBO-WDXK.js} +1 -1
  114. package/lib/{button-Bxfjx9_Y.cjs → button-wt49IYwP.cjs} +1 -1
  115. package/lib/{checkbox-D4p6-UMt.js → checkbox-D1h32VWM.js} +1 -1
  116. package/lib/{checkbox-Q6FcMQW5.cjs → checkbox-DUcLSGZD.cjs} +1 -1
  117. package/lib/{dialog-B-9_Z5j2.js → dialog-DSvgtlDI.js} +1 -1
  118. package/lib/{dialog-D-oYxagG.cjs → dialog-DY868Uji.cjs} +1 -1
  119. package/lib/{dropdown-menu-par18QL5.js → dropdown-menu-B88Qn2KR.js} +3 -2
  120. package/lib/dropdown-menu-BripAeGB.cjs +1 -0
  121. package/lib/extensions/Katex/Katex.d.ts +1 -1
  122. package/lib/extensions/SlashCommand/types.d.ts +1 -0
  123. package/lib/index-9A6-kVBM.js +1351 -0
  124. package/lib/{index-pgx8gyoC.js → index-BIqaogQg.js} +201 -199
  125. package/lib/{index-BFXkgG1P.cjs → index-BvIJKpX1.cjs} +2 -1
  126. package/lib/index-Cv9Z6dyV.cjs +1 -0
  127. package/lib/{index-EKFybgpP.js → index-DKt5wfAc.js} +1 -1
  128. package/lib/{index-BimeTI7q.js → index-DRHrDScg.js} +1 -1
  129. package/lib/{index-BQ6ZdLsu.js → index-DmPwbBqm.js} +1 -1
  130. package/lib/{index-CbIQPoF6.js → index-sVScpCFG.js} +20 -20
  131. package/lib/index.cjs +1 -1
  132. package/lib/index.js +5 -5
  133. package/lib/{input-CZUkD6wF.cjs → input-BeD5GdMv.cjs} +1 -1
  134. package/lib/{input-cclJoUeC.js → input-Bx4uo4gO.js} +1 -1
  135. package/lib/{isNumber-8HKEgTkA.js → isNumber-DF0fU3ob.js} +1 -1
  136. package/lib/{label-CFaBdRGz.cjs → label--161UPH6.cjs} +1 -1
  137. package/lib/{label-aveW7pdK.js → label-uKG7RzFU.js} +1 -1
  138. package/lib/{popover-D5YZPv2r.js → popover-BVX8otO9.js} +1 -1
  139. package/lib/{popover-BWYZO_fD.cjs → popover-Csk538NC.cjs} +1 -1
  140. package/lib/{separator-B978cwAm.cjs → separator-DLRVddHS.cjs} +1 -1
  141. package/lib/{separator-BHjFVmZr.js → separator-DtrEdjAF.js} +4 -4
  142. package/lib/{store-BsBiawfz.cjs → store-B8IkVz1J.cjs} +1 -1
  143. package/lib/{store-BsMMRKFd.js → store-CsIFDUKR.js} +1 -1
  144. package/lib/style.css +1 -1
  145. package/lib/{tabs-Bj8EvAkY.js → tabs-BKpr0QQB.js} +1 -1
  146. package/lib/{tabs-CUMyiV80.cjs → tabs-DOasUMDU.cjs} +1 -1
  147. package/lib/{textarea-CClyW-74.js → textarea-Ba9OOzba.js} +1 -1
  148. package/lib/{textarea-BKb7LDw1.cjs → textarea-D9egO4qC.cjs} +1 -1
  149. package/lib/{throttle-BIkZV3Y_.js → throttle-DsowOft0.js} +1 -1
  150. package/lib/updatePosition-Bbd8ETMv.js +16 -0
  151. package/lib/updatePosition-M2IyqkI1.cjs +1 -0
  152. package/lib/{useButtonProps-StwAz7Ha.js → useButtonProps-C_bqxmHi.js} +14 -14
  153. package/lib/{useButtonProps-B0riSJs9.cjs → useButtonProps-DEtmDVPr.cjs} +1 -1
  154. package/package.json +1 -1
  155. package/lib/Katex-CJ2Fmvut.cjs +0 -4
  156. package/lib/dropdown-menu-r8XibZQU.cjs +0 -1
  157. package/lib/floating-ui.dom-U1vPFQ5f.js +0 -1151
  158. package/lib/floating-ui.dom-VCrc58uF.cjs +0 -1
  159. package/lib/updatePosition-GLTrgcib.js +0 -215
  160. package/lib/updatePosition-u2mTh3mG.cjs +0 -1
@@ -1 +0,0 @@
1
- "use strict";const Tt=["top","right","bottom","left"],wt=["start","end"],xt=Tt.reduce((t,e)=>t.concat(e,e+"-"+wt[0],e+"-"+wt[1]),[]),I=Math.min,L=Math.max,nt=Math.round,X=t=>({x:t,y:t}),Xt={left:"right",right:"left",bottom:"top",top:"bottom"},It={start:"end",end:"start"};function ft(t,e,o){return L(t,I(e,o))}function j(t,e){return typeof t=="function"?t(e):t}function W(t){return t.split("-")[0]}function N(t){return t.split("-")[1]}function Lt(t){return t==="x"?"y":"x"}function dt(t){return t==="y"?"height":"width"}const Yt=new Set(["top","bottom"]);function _(t){return Yt.has(W(t))?"y":"x"}function mt(t){return Lt(_(t))}function Dt(t,e,o){o===void 0&&(o=!1);const n=N(t),i=mt(t),s=dt(i);let r=i==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(r=it(r)),[r,it(r)]}function jt(t){const e=it(t);return[ot(t),e,ot(e)]}function ot(t){return t.replace(/start|end/g,e=>It[e])}const yt=["left","right"],bt=["right","left"],zt=["top","bottom"],Kt=["bottom","top"];function qt(t,e,o){switch(t){case"top":case"bottom":return o?e?bt:yt:e?yt:bt;case"left":case"right":return e?zt:Kt;default:return[]}}function Gt(t,e,o,n){const i=N(t);let s=qt(W(t),o==="start",n);return i&&(s=s.map(r=>r+"-"+i),e&&(s=s.concat(s.map(ot)))),s}function it(t){return t.replace(/left|right|bottom|top/g,e=>Xt[e])}function Jt(t){return{top:0,right:0,bottom:0,left:0,...t}}function ht(t){return typeof t!="number"?Jt(t):{top:t,right:t,bottom:t,left:t}}function J(t){const{x:e,y:o,width:n,height:i}=t;return{width:n,height:i,top:o,left:e,right:e+n,bottom:o+i,x:e,y:o}}function vt(t,e,o){let{reference:n,floating:i}=t;const s=_(e),r=mt(e),c=dt(r),f=W(e),u=s==="y",a=n.x+n.width/2-i.width/2,l=n.y+n.height/2-i.height/2,m=n[c]/2-i[c]/2;let d;switch(f){case"top":d={x:a,y:n.y-i.height};break;case"bottom":d={x:a,y:n.y+n.height};break;case"right":d={x:n.x+n.width,y:l};break;case"left":d={x:n.x-i.width,y:l};break;default:d={x:n.x,y:n.y}}switch(N(e)){case"start":d[r]-=m*(o&&u?-1:1);break;case"end":d[r]+=m*(o&&u?-1:1);break}return d}const Qt=async(t,e,o)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:r}=o,c=s.filter(Boolean),f=await(r.isRTL==null?void 0:r.isRTL(e));let u=await r.getElementRects({reference:t,floating:e,strategy:i}),{x:a,y:l}=vt(u,n,f),m=n,d={},h=0;for(let g=0;g<c.length;g++){const{name:p,fn:y}=c[g],{x,y:b,data:A,reset:v}=await y({x:a,y:l,initialPlacement:n,placement:m,strategy:i,middlewareData:d,rects:u,platform:r,elements:{reference:t,floating:e}});a=x??a,l=b??l,d={...d,[p]:{...d[p],...A}},v&&h<=50&&(h++,typeof v=="object"&&(v.placement&&(m=v.placement),v.rects&&(u=v.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:i}):v.rects),{x:a,y:l}=vt(u,m,f)),g=-1)}return{x:a,y:l,placement:m,strategy:i,middlewareData:d}};async function Q(t,e){var o;e===void 0&&(e={});const{x:n,y:i,platform:s,rects:r,elements:c,strategy:f}=t,{boundary:u="clippingAncestors",rootBoundary:a="viewport",elementContext:l="floating",altBoundary:m=!1,padding:d=0}=j(e,t),h=ht(d),p=c[m?l==="floating"?"reference":"floating":l],y=J(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(p)))==null||o?p:p.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:a,strategy:f})),x=l==="floating"?{x:n,y:i,width:r.floating.width,height:r.floating.height}:r.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),A=await(s.isElement==null?void 0:s.isElement(b))?await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1}:{x:1,y:1},v=J(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:b,strategy:f}):x);return{top:(y.top-v.top+h.top)/A.y,bottom:(v.bottom-y.bottom+h.bottom)/A.y,left:(y.left-v.left+h.left)/A.x,right:(v.right-y.right+h.right)/A.x}}const Ut=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:n,placement:i,rects:s,platform:r,elements:c,middlewareData:f}=e,{element:u,padding:a=0}=j(t,e)||{};if(u==null)return{};const l=ht(a),m={x:o,y:n},d=mt(i),h=dt(d),g=await r.getDimensions(u),p=d==="y",y=p?"top":"left",x=p?"bottom":"right",b=p?"clientHeight":"clientWidth",A=s.reference[h]+s.reference[d]-m[d]-s.floating[h],v=m[d]-s.reference[d],C=await(r.getOffsetParent==null?void 0:r.getOffsetParent(u));let S=C?C[b]:0;(!S||!await(r.isElement==null?void 0:r.isElement(C)))&&(S=c.floating[b]||s.floating[h]);const F=A/2-v/2,P=S/2-g[h]/2-1,w=I(l[y],P),O=I(l[x],P),T=w,D=S-g[h]-O,R=S/2-g[h]/2+F,$=ft(T,R,D),M=!f.arrow&&N(i)!=null&&R!==$&&s.reference[h]/2-(R<T?w:O)-g[h]/2<0,E=M?R<T?R-T:R-D:0;return{[d]:m[d]+E,data:{[d]:$,centerOffset:R-$-E,...M&&{alignmentOffset:E}},reset:M}}});function Zt(t,e,o){return(t?[...o.filter(i=>N(i)===t),...o.filter(i=>N(i)!==t)]:o.filter(i=>W(i)===i)).filter(i=>t?N(i)===t||(e?ot(i)!==i:!1):!0)}const te=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(e){var o,n,i;const{rects:s,middlewareData:r,placement:c,platform:f,elements:u}=e,{crossAxis:a=!1,alignment:l,allowedPlacements:m=xt,autoAlignment:d=!0,...h}=j(t,e),g=l!==void 0||m===xt?Zt(l||null,d,m):m,p=await Q(e,h),y=((o=r.autoPlacement)==null?void 0:o.index)||0,x=g[y];if(x==null)return{};const b=Dt(x,s,await(f.isRTL==null?void 0:f.isRTL(u.floating)));if(c!==x)return{reset:{placement:g[0]}};const A=[p[W(x)],p[b[0]],p[b[1]]],v=[...((n=r.autoPlacement)==null?void 0:n.overflows)||[],{placement:x,overflows:A}],C=g[y+1];if(C)return{data:{index:y+1,overflows:v},reset:{placement:C}};const S=v.map(w=>{const O=N(w.placement);return[w.placement,O&&a?w.overflows.slice(0,2).reduce((T,D)=>T+D,0):w.overflows[0],w.overflows]}).sort((w,O)=>w[1]-O[1]),P=((i=S.filter(w=>w[2].slice(0,N(w[0])?2:3).every(O=>O<=0))[0])==null?void 0:i[0])||S[0][0];return P!==c?{data:{index:y+1,overflows:v},reset:{placement:P}}:{}}}},ee=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;const{placement:i,middlewareData:s,rects:r,initialPlacement:c,platform:f,elements:u}=e,{mainAxis:a=!0,crossAxis:l=!0,fallbackPlacements:m,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...p}=j(t,e);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const y=W(i),x=_(c),b=W(c)===c,A=await(f.isRTL==null?void 0:f.isRTL(u.floating)),v=m||(b||!g?[it(c)]:jt(c)),C=h!=="none";!m&&C&&v.push(...Gt(c,g,h,A));const S=[c,...v],F=await Q(e,p),P=[];let w=((n=s.flip)==null?void 0:n.overflows)||[];if(a&&P.push(F[y]),l){const R=Dt(i,r,A);P.push(F[R[0]],F[R[1]])}if(w=[...w,{placement:i,overflows:P}],!P.every(R=>R<=0)){var O,T;const R=(((O=s.flip)==null?void 0:O.index)||0)+1,$=S[R];if($&&(!(l==="alignment"?x!==_($):!1)||w.every(k=>_(k.placement)===x?k.overflows[0]>0:!0)))return{data:{index:R,overflows:w},reset:{placement:$}};let M=(T=w.filter(E=>E.overflows[0]<=0).sort((E,k)=>E.overflows[1]-k.overflows[1])[0])==null?void 0:T.placement;if(!M)switch(d){case"bestFit":{var D;const E=(D=w.filter(k=>{if(C){const K=_(k.placement);return K===x||K==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(K=>K>0).reduce((K,_t)=>K+_t,0)]).sort((k,K)=>k[1]-K[1])[0])==null?void 0:D[0];E&&(M=E);break}case"initialPlacement":M=c;break}if(i!==M)return{reset:{placement:M}}}return{}}}};function At(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Ot(t){return Tt.some(e=>t[e]>=0)}const ne=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:o}=e,{strategy:n="referenceHidden",...i}=j(t,e);switch(n){case"referenceHidden":{const s=await Q(e,{...i,elementContext:"reference"}),r=At(s,o.reference);return{data:{referenceHiddenOffsets:r,referenceHidden:Ot(r)}}}case"escaped":{const s=await Q(e,{...i,altBoundary:!0}),r=At(s,o.floating);return{data:{escapedOffsets:r,escaped:Ot(r)}}}default:return{}}}}};function Et(t){const e=I(...t.map(s=>s.left)),o=I(...t.map(s=>s.top)),n=L(...t.map(s=>s.right)),i=L(...t.map(s=>s.bottom));return{x:e,y:o,width:n-e,height:i-o}}function oe(t){const e=t.slice().sort((i,s)=>i.y-s.y),o=[];let n=null;for(let i=0;i<e.length;i++){const s=e[i];!n||s.y-n.y>n.height/2?o.push([s]):o[o.length-1].push(s),n=s}return o.map(i=>J(Et(i)))}const ie=function(t){return t===void 0&&(t={}),{name:"inline",options:t,async fn(e){const{placement:o,elements:n,rects:i,platform:s,strategy:r}=e,{padding:c=2,x:f,y:u}=j(t,e),a=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(n.reference))||[]),l=oe(a),m=J(Et(a)),d=ht(c);function h(){if(l.length===2&&l[0].left>l[1].right&&f!=null&&u!=null)return l.find(p=>f>p.left-d.left&&f<p.right+d.right&&u>p.top-d.top&&u<p.bottom+d.bottom)||m;if(l.length>=2){if(_(o)==="y"){const w=l[0],O=l[l.length-1],T=W(o)==="top",D=w.top,R=O.bottom,$=T?w.left:O.left,M=T?w.right:O.right,E=M-$,k=R-D;return{top:D,bottom:R,left:$,right:M,width:E,height:k,x:$,y:D}}const p=W(o)==="left",y=L(...l.map(w=>w.right)),x=I(...l.map(w=>w.left)),b=l.filter(w=>p?w.left===x:w.right===y),A=b[0].top,v=b[b.length-1].bottom,C=x,S=y,F=S-C,P=v-A;return{top:A,bottom:v,left:C,right:S,width:F,height:P,x:C,y:A}}return m}const g=await s.getElementRects({reference:{getBoundingClientRect:h},floating:n.floating,strategy:r});return i.reference.x!==g.reference.x||i.reference.y!==g.reference.y||i.reference.width!==g.reference.width||i.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},se=new Set(["left","top"]);async function re(t,e){const{placement:o,platform:n,elements:i}=t,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),r=W(o),c=N(o),f=_(o)==="y",u=se.has(r)?-1:1,a=s&&f?-1:1,l=j(e,t);let{mainAxis:m,crossAxis:d,alignmentAxis:h}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return c&&typeof h=="number"&&(d=c==="end"?h*-1:h),f?{x:d*a,y:m*u}:{x:m*u,y:d*a}}const ce=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:i,y:s,placement:r,middlewareData:c}=e,f=await re(e,t);return r===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:i+f.x,y:s+f.y,data:{...f,placement:r}}}}},le=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:n,placement:i}=e,{mainAxis:s=!0,crossAxis:r=!1,limiter:c={fn:p=>{let{x:y,y:x}=p;return{x:y,y:x}}},...f}=j(t,e),u={x:o,y:n},a=await Q(e,f),l=_(W(i)),m=Lt(l);let d=u[m],h=u[l];if(s){const p=m==="y"?"top":"left",y=m==="y"?"bottom":"right",x=d+a[p],b=d-a[y];d=ft(x,d,b)}if(r){const p=l==="y"?"top":"left",y=l==="y"?"bottom":"right",x=h+a[p],b=h-a[y];h=ft(x,h,b)}const g=c.fn({...e,[m]:d,[l]:h});return{...g,data:{x:g.x-o,y:g.y-n,enabled:{[m]:s,[l]:r}}}}}},ae=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var o,n;const{placement:i,rects:s,platform:r,elements:c}=e,{apply:f=()=>{},...u}=j(t,e),a=await Q(e,u),l=W(i),m=N(i),d=_(i)==="y",{width:h,height:g}=s.floating;let p,y;l==="top"||l==="bottom"?(p=l,y=m===(await(r.isRTL==null?void 0:r.isRTL(c.floating))?"start":"end")?"left":"right"):(y=l,p=m==="end"?"top":"bottom");const x=g-a.top-a.bottom,b=h-a.left-a.right,A=I(g-a[p],x),v=I(h-a[y],b),C=!e.middlewareData.shift;let S=A,F=v;if((o=e.middlewareData.shift)!=null&&o.enabled.x&&(F=b),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(S=x),C&&!m){const w=L(a.left,0),O=L(a.right,0),T=L(a.top,0),D=L(a.bottom,0);d?F=h-2*(w!==0||O!==0?w+O:L(a.left,a.right)):S=g-2*(T!==0||D!==0?T+D:L(a.top,a.bottom))}await f({...e,availableWidth:F,availableHeight:S});const P=await r.getDimensions(c.floating);return h!==P.width||g!==P.height?{reset:{rects:!0}}:{}}}};function st(){return typeof window<"u"}function Z(t){return kt(t)?(t.nodeName||"").toLowerCase():"#document"}function B(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function z(t){var e;return(e=(kt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function kt(t){return st()?t instanceof Node||t instanceof B(t).Node:!1}function V(t){return st()?t instanceof Element||t instanceof B(t).Element:!1}function Y(t){return st()?t instanceof HTMLElement||t instanceof B(t).HTMLElement:!1}function Rt(t){return!st()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof B(t).ShadowRoot}const fe=new Set(["inline","contents"]);function et(t){const{overflow:e,overflowX:o,overflowY:n,display:i}=H(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&!fe.has(i)}const ue=new Set(["table","td","th"]);function de(t){return ue.has(Z(t))}const me=[":popover-open",":modal"];function rt(t){return me.some(e=>{try{return t.matches(e)}catch{return!1}})}const he=["transform","translate","scale","rotate","perspective"],ge=["transform","translate","scale","rotate","perspective","filter"],pe=["paint","layout","strict","content"];function gt(t){const e=pt(),o=V(t)?H(t):t;return he.some(n=>o[n]?o[n]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!e&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!e&&(o.filter?o.filter!=="none":!1)||ge.some(n=>(o.willChange||"").includes(n))||pe.some(n=>(o.contain||"").includes(n))}function we(t){let e=q(t);for(;Y(e)&&!U(e);){if(gt(e))return e;if(rt(e))return null;e=q(e)}return null}function pt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const xe=new Set(["html","body","#document"]);function U(t){return xe.has(Z(t))}function H(t){return B(t).getComputedStyle(t)}function ct(t){return V(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function q(t){if(Z(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Rt(t)&&t.host||z(t);return Rt(e)?e.host:e}function Bt(t){const e=q(t);return U(e)?t.ownerDocument?t.ownerDocument.body:t.body:Y(e)&&et(e)?e:Bt(e)}function Ft(t,e,o){var n;e===void 0&&(e=[]);const i=Bt(t),s=i===((n=t.ownerDocument)==null?void 0:n.body),r=B(i);return s?(ut(r),e.concat(r,r.visualViewport||[],et(i)?i:[],[])):e.concat(i,Ft(i,[]))}function ut(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Mt(t){const e=H(t);let o=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=Y(t),s=i?t.offsetWidth:o,r=i?t.offsetHeight:n,c=nt(o)!==s||nt(n)!==r;return c&&(o=s,n=r),{width:o,height:n,$:c}}function Wt(t){return V(t)?t:t.contextElement}function G(t){const e=Wt(t);if(!Y(e))return X(1);const o=e.getBoundingClientRect(),{width:n,height:i,$:s}=Mt(e);let r=(s?nt(o.width):o.width)/n,c=(s?nt(o.height):o.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const ye=X(0);function $t(t){const e=B(t);return!pt()||!e.visualViewport?ye:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function be(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==B(t)?!1:e}function tt(t,e,o,n){e===void 0&&(e=!1),o===void 0&&(o=!1);const i=t.getBoundingClientRect(),s=Wt(t);let r=X(1);e&&(n?V(n)&&(r=G(n)):r=G(t));const c=be(s,o,n)?$t(s):X(0);let f=(i.left+c.x)/r.x,u=(i.top+c.y)/r.y,a=i.width/r.x,l=i.height/r.y;if(s){const m=B(s),d=n&&V(n)?B(n):n;let h=m,g=ut(h);for(;g&&n&&d!==h;){const p=G(g),y=g.getBoundingClientRect(),x=H(g),b=y.left+(g.clientLeft+parseFloat(x.paddingLeft))*p.x,A=y.top+(g.clientTop+parseFloat(x.paddingTop))*p.y;f*=p.x,u*=p.y,a*=p.x,l*=p.y,f+=b,u+=A,h=B(g),g=ut(h)}}return J({width:a,height:l,x:f,y:u})}function lt(t,e){const o=ct(t).scrollLeft;return e?e.left+o:tt(z(t)).left+o}function Nt(t,e){const o=t.getBoundingClientRect(),n=o.left+e.scrollLeft-lt(t,o),i=o.top+e.scrollTop;return{x:n,y:i}}function ve(t){let{elements:e,rect:o,offsetParent:n,strategy:i}=t;const s=i==="fixed",r=z(n),c=e?rt(e.floating):!1;if(n===r||c&&s)return o;let f={scrollLeft:0,scrollTop:0},u=X(1);const a=X(0),l=Y(n);if((l||!l&&!s)&&((Z(n)!=="body"||et(r))&&(f=ct(n)),Y(n))){const d=tt(n);u=G(n),a.x=d.x+n.clientLeft,a.y=d.y+n.clientTop}const m=r&&!l&&!s?Nt(r,f):X(0);return{width:o.width*u.x,height:o.height*u.y,x:o.x*u.x-f.scrollLeft*u.x+a.x+m.x,y:o.y*u.y-f.scrollTop*u.y+a.y+m.y}}function Ae(t){return Array.from(t.getClientRects())}function Oe(t){const e=z(t),o=ct(t),n=t.ownerDocument.body,i=L(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=L(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let r=-o.scrollLeft+lt(t);const c=-o.scrollTop;return H(n).direction==="rtl"&&(r+=L(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:r,y:c}}const St=25;function Re(t,e){const o=B(t),n=z(t),i=o.visualViewport;let s=n.clientWidth,r=n.clientHeight,c=0,f=0;if(i){s=i.width,r=i.height;const a=pt();(!a||a&&e==="fixed")&&(c=i.offsetLeft,f=i.offsetTop)}const u=lt(n);if(u<=0){const a=n.ownerDocument,l=a.body,m=getComputedStyle(l),d=a.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,h=Math.abs(n.clientWidth-l.clientWidth-d);h<=St&&(s-=h)}else u<=St&&(s+=u);return{width:s,height:r,x:c,y:f}}const Se=new Set(["absolute","fixed"]);function Ce(t,e){const o=tt(t,!0,e==="fixed"),n=o.top+t.clientTop,i=o.left+t.clientLeft,s=Y(t)?G(t):X(1),r=t.clientWidth*s.x,c=t.clientHeight*s.y,f=i*s.x,u=n*s.y;return{width:r,height:c,x:f,y:u}}function Ct(t,e,o){let n;if(e==="viewport")n=Re(t,o);else if(e==="document")n=Oe(z(t));else if(V(e))n=Ce(e,o);else{const i=$t(t);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return J(n)}function Vt(t,e){const o=q(t);return o===e||!V(o)||U(o)?!1:H(o).position==="fixed"||Vt(o,e)}function Pe(t,e){const o=e.get(t);if(o)return o;let n=Ft(t,[]).filter(c=>V(c)&&Z(c)!=="body"),i=null;const s=H(t).position==="fixed";let r=s?q(t):t;for(;V(r)&&!U(r);){const c=H(r),f=gt(r);!f&&c.position==="fixed"&&(i=null),(s?!f&&!i:!f&&c.position==="static"&&!!i&&Se.has(i.position)||et(r)&&!f&&Vt(t,r))?n=n.filter(a=>a!==r):i=c,r=q(r)}return e.set(t,n),n}function Te(t){let{element:e,boundary:o,rootBoundary:n,strategy:i}=t;const r=[...o==="clippingAncestors"?rt(e)?[]:Pe(e,this._c):[].concat(o),n],c=r[0],f=r.reduce((u,a)=>{const l=Ct(e,a,i);return u.top=L(l.top,u.top),u.right=I(l.right,u.right),u.bottom=I(l.bottom,u.bottom),u.left=L(l.left,u.left),u},Ct(e,c,i));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function Le(t){const{width:e,height:o}=Mt(t);return{width:e,height:o}}function De(t,e,o){const n=Y(e),i=z(e),s=o==="fixed",r=tt(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const f=X(0);function u(){f.x=lt(i)}if(n||!n&&!s)if((Z(e)!=="body"||et(i))&&(c=ct(e)),n){const d=tt(e,!0,s,e);f.x=d.x+e.clientLeft,f.y=d.y+e.clientTop}else i&&u();s&&!n&&i&&u();const a=i&&!n&&!s?Nt(i,c):X(0),l=r.left+c.scrollLeft-f.x-a.x,m=r.top+c.scrollTop-f.y-a.y;return{x:l,y:m,width:r.width,height:r.height}}function at(t){return H(t).position==="static"}function Pt(t,e){if(!Y(t)||H(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return z(t)===o&&(o=o.ownerDocument.body),o}function Ht(t,e){const o=B(t);if(rt(t))return o;if(!Y(t)){let i=q(t);for(;i&&!U(i);){if(V(i)&&!at(i))return i;i=q(i)}return o}let n=Pt(t,e);for(;n&&de(n)&&at(n);)n=Pt(n,e);return n&&U(n)&&at(n)&&!gt(n)?o:n||we(t)||o}const Ee=async function(t){const e=this.getOffsetParent||Ht,o=this.getDimensions,n=await o(t.floating);return{reference:De(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function ke(t){return H(t).direction==="rtl"}const Be={convertOffsetParentRelativeRectToViewportRelativeRect:ve,getDocumentElement:z,getClippingRect:Te,getOffsetParent:Ht,getElementRects:Ee,getClientRects:Ae,getDimensions:Le,getScale:G,isElement:V,isRTL:ke},Fe=ce,Me=te,We=le,$e=ee,Ne=ae,Ve=ne,He=Ut,_e=ie,Xe=(t,e,o)=>{const n=new Map,i={platform:Be,...o},s={...i.platform,_c:n};return Qt(t,e,{...i,platform:s})};exports.arrow=He;exports.autoPlacement=Me;exports.computePosition=Xe;exports.flip=$e;exports.hide=Ve;exports.inline=_e;exports.offset=Fe;exports.shift=We;exports.size=Ne;
@@ -1,215 +0,0 @@
1
- import { PluginKey as L, Plugin as z } from "@tiptap/pm/state";
2
- import { DecorationSet as G, Decoration as H } from "@tiptap/pm/view";
3
- import { e as J, f as Q } from "./index-CbIQPoF6.js";
4
- import { c as V, s as W, f as X } from "./floating-ui.dom-U1vPFQ5f.js";
5
- function Y(g) {
6
- var a;
7
- const { char: I, allowSpaces: w, allowToIncludeChar: y, allowedPrefixes: m, startOfLine: k, $position: v } = g, B = w && !y, h = J(I), O = new RegExp(`\\s${h}$`), S = k ? "^" : "", M = y ? "" : h, C = B ? new RegExp(`${S}${h}.*?(?=\\s${M}|$)`, "gm") : new RegExp(`${S}(?:^)?${h}[^\\s${M}]*`, "gm"), $ = ((a = v.nodeBefore) == null ? void 0 : a.isText) && v.nodeBefore.text;
8
- if (!$)
9
- return null;
10
- const F = v.pos - $.length, l = Array.from($.matchAll(C)).pop();
11
- if (!l || l.input === void 0 || l.index === void 0)
12
- return null;
13
- const e = l.input.slice(Math.max(0, l.index - 1), l.index), K = new RegExp(`^[${m == null ? void 0 : m.join("")}\0]?$`).test(e);
14
- if (m !== null && !K)
15
- return null;
16
- const q = F + l.index;
17
- let x = q + l[0].length;
18
- return B && O.test($.slice(x - 1, x + 1)) && (l[0] += " ", x += 1), q < v.pos && x >= v.pos ? {
19
- range: {
20
- from: q,
21
- to: x
22
- },
23
- query: l[0].slice(I.length),
24
- text: l[0]
25
- } : null;
26
- }
27
- var Z = new L("suggestion");
28
- function tt({
29
- pluginKey: g = Z,
30
- editor: a,
31
- char: I = "@",
32
- allowSpaces: w = !1,
33
- allowToIncludeChar: y = !1,
34
- allowedPrefixes: m = [" "],
35
- startOfLine: k = !1,
36
- decorationTag: v = "span",
37
- decorationClass: B = "suggestion",
38
- decorationContent: h = "",
39
- decorationEmptyClass: O = "is-empty",
40
- command: S = () => null,
41
- items: M = () => [],
42
- render: C = () => ({}),
43
- allow: $ = () => !0,
44
- findSuggestionMatch: F = Y
45
- }) {
46
- let l;
47
- const e = C == null ? void 0 : C(), K = () => {
48
- const n = a.state.selection.$anchor.pos, r = a.view.coordsAtPos(n), { top: i, right: s, bottom: o, left: c } = r;
49
- try {
50
- return new DOMRect(c, i, s - c, o - i);
51
- } catch {
52
- return null;
53
- }
54
- }, q = (n, r) => r ? () => {
55
- const i = g.getState(a.state), s = i == null ? void 0 : i.decorationId, o = n.dom.querySelector(`[data-decoration-id="${s}"]`);
56
- return (o == null ? void 0 : o.getBoundingClientRect()) || null;
57
- } : K;
58
- function x(n, r) {
59
- var i;
60
- try {
61
- const o = g.getState(n.state), c = o != null && o.decorationId ? n.dom.querySelector(`[data-decoration-id="${o.decorationId}"]`) : null, d = {
62
- // @ts-ignore editor is available in closure
63
- editor: a,
64
- range: (o == null ? void 0 : o.range) || { from: 0, to: 0 },
65
- query: (o == null ? void 0 : o.query) || null,
66
- text: (o == null ? void 0 : o.text) || null,
67
- items: [],
68
- command: (p) => S({ editor: a, range: (o == null ? void 0 : o.range) || { from: 0, to: 0 }, props: p }),
69
- decorationNode: c,
70
- clientRect: q(n, c)
71
- };
72
- (i = e == null ? void 0 : e.onExit) == null || i.call(e, d);
73
- } catch {
74
- }
75
- const s = n.state.tr.setMeta(r, { exit: !0 });
76
- n.dispatch(s);
77
- }
78
- const N = new z({
79
- key: g,
80
- view() {
81
- return {
82
- update: async (n, r) => {
83
- var i, s, o, c, d, p, E;
84
- const t = (i = this.key) == null ? void 0 : i.getState(r), f = (s = this.key) == null ? void 0 : s.getState(n.state), u = t.active && f.active && t.range.from !== f.range.from, R = !t.active && f.active, b = t.active && !f.active, P = !R && !b && t.query !== f.query, D = R || u && P, A = P || u, T = b || u && P;
85
- if (!D && !A && !T)
86
- return;
87
- const _ = T && !D ? t : f, j = n.dom.querySelector(`[data-decoration-id="${_.decorationId}"]`);
88
- l = {
89
- editor: a,
90
- range: _.range,
91
- query: _.query,
92
- text: _.text,
93
- items: [],
94
- command: (U) => S({
95
- editor: a,
96
- range: _.range,
97
- props: U
98
- }),
99
- decorationNode: j,
100
- clientRect: q(n, j)
101
- }, D && ((o = e == null ? void 0 : e.onBeforeStart) == null || o.call(e, l)), A && ((c = e == null ? void 0 : e.onBeforeUpdate) == null || c.call(e, l)), (A || D) && (l.items = await M({
102
- editor: a,
103
- query: _.query
104
- })), T && ((d = e == null ? void 0 : e.onExit) == null || d.call(e, l)), A && ((p = e == null ? void 0 : e.onUpdate) == null || p.call(e, l)), D && ((E = e == null ? void 0 : e.onStart) == null || E.call(e, l));
105
- },
106
- destroy: () => {
107
- var n;
108
- l && ((n = e == null ? void 0 : e.onExit) == null || n.call(e, l));
109
- }
110
- };
111
- },
112
- state: {
113
- // Initialize the plugin's internal state.
114
- init() {
115
- return {
116
- active: !1,
117
- range: {
118
- from: 0,
119
- to: 0
120
- },
121
- query: null,
122
- text: null,
123
- composing: !1
124
- };
125
- },
126
- // Apply changes to the plugin state from a view transaction.
127
- apply(n, r, i, s) {
128
- const { isEditable: o } = a, { composing: c } = a.view, { selection: d } = n, { empty: p, from: E } = d, t = { ...r }, f = n.getMeta(g);
129
- if (f && f.exit)
130
- return t.active = !1, t.decorationId = null, t.range = { from: 0, to: 0 }, t.query = null, t.text = null, t;
131
- if (t.composing = c, o && (p || a.view.composing)) {
132
- (E < r.range.from || E > r.range.to) && !c && !r.composing && (t.active = !1);
133
- const u = F({
134
- char: I,
135
- allowSpaces: w,
136
- allowToIncludeChar: y,
137
- allowedPrefixes: m,
138
- startOfLine: k,
139
- $position: d.$from
140
- }), R = `id_${Math.floor(Math.random() * 4294967295)}`;
141
- u && $({
142
- editor: a,
143
- state: s,
144
- range: u.range,
145
- isActive: r.active
146
- }) ? (t.active = !0, t.decorationId = r.decorationId ? r.decorationId : R, t.range = u.range, t.query = u.query, t.text = u.text) : t.active = !1;
147
- } else
148
- t.active = !1;
149
- return t.active || (t.decorationId = null, t.range = { from: 0, to: 0 }, t.query = null, t.text = null), t;
150
- }
151
- },
152
- props: {
153
- // Call the keydown hook if suggestion is active.
154
- handleKeyDown(n, r) {
155
- var i, s, o, c;
156
- const { active: d, range: p } = N.getState(n.state);
157
- if (!d)
158
- return !1;
159
- if (r.key === "Escape" || r.key === "Esc") {
160
- const t = N.getState(n.state), f = (i = l == null ? void 0 : l.decorationNode) != null ? i : null, u = f ?? (t != null && t.decorationId ? n.dom.querySelector(`[data-decoration-id="${t.decorationId}"]`) : null);
161
- if (((s = e == null ? void 0 : e.onKeyDown) == null ? void 0 : s.call(e, { view: n, event: r, range: t.range })) || !1)
162
- return !0;
163
- const b = {
164
- editor: a,
165
- range: t.range,
166
- query: t.query,
167
- text: t.text,
168
- items: [],
169
- command: (P) => S({ editor: a, range: t.range, props: P }),
170
- decorationNode: u,
171
- // If we have a cached decoration node, use it for the clientRect
172
- // to avoid another DOM lookup. If not, leave clientRect null and
173
- // let consumer decide if they want to query.
174
- clientRect: u ? () => u.getBoundingClientRect() || null : null
175
- };
176
- return (o = e == null ? void 0 : e.onExit) == null || o.call(e, b), x(n, g), !0;
177
- }
178
- return ((c = e == null ? void 0 : e.onKeyDown) == null ? void 0 : c.call(e, { view: n, event: r, range: p })) || !1;
179
- },
180
- // Setup decorator on the currently active suggestion.
181
- decorations(n) {
182
- const { active: r, range: i, decorationId: s, query: o } = N.getState(n);
183
- if (!r)
184
- return null;
185
- const c = !(o != null && o.length), d = [B];
186
- return c && d.push(O), G.create(n.doc, [
187
- H.inline(i.from, i.to, {
188
- nodeName: v,
189
- class: d.join(" "),
190
- "data-decoration-id": s,
191
- "data-decoration-content": h
192
- })
193
- ]);
194
- }
195
- }
196
- });
197
- return N;
198
- }
199
- var lt = tt;
200
- function rt(g, a) {
201
- V({
202
- getBoundingClientRect: () => Q(g.view, g.state.selection.from, g.state.selection.to)
203
- }, a, {
204
- placement: "bottom-start",
205
- strategy: "absolute",
206
- middleware: [W(), X()]
207
- }).then(({ x: w, y, strategy: m }) => {
208
- a.style.width = "max-content", a.style.position = m, a.style.left = `${w}px`, a.style.top = `${y}px`;
209
- });
210
- }
211
- export {
212
- tt as S,
213
- lt as i,
214
- rt as u
215
- };
@@ -1 +0,0 @@
1
- "use strict";const z=require("@tiptap/pm/state"),L=require("@tiptap/pm/view"),G=require("./index-BBNITgNi.cjs"),U=require("./floating-ui.dom-VCrc58uF.cjs");function Q(f){var l;const{char:y,allowSpaces:I,allowToIncludeChar:h,allowedPrefixes:m,startOfLine:k,$position:v}=f,B=I&&!h,q=G.escapeForRegEx(y),O=new RegExp(`\\s${q}$`),S=k?"^":"",M=h?"":q,C=B?new RegExp(`${S}${q}.*?(?=\\s${M}|$)`,"gm"):new RegExp(`${S}(?:^)?${q}[^\\s${M}]*`,"gm"),$=((l=v.nodeBefore)==null?void 0:l.isText)&&v.nodeBefore.text;if(!$)return null;const F=v.pos-$.length,a=Array.from($.matchAll(C)).pop();if(!a||a.input===void 0||a.index===void 0)return null;const e=a.input.slice(Math.max(0,a.index-1),a.index),K=new RegExp(`^[${m==null?void 0:m.join("")}\0]?$`).test(e);if(m!==null&&!K)return null;const _=F+a.index;let x=_+a[0].length;return B&&O.test($.slice(x-1,x+1))&&(a[0]+=" ",x+=1),_<v.pos&&x>=v.pos?{range:{from:_,to:x},query:a[0].slice(y.length),text:a[0]}:null}var V=new z.PluginKey("suggestion");function H({pluginKey:f=V,editor:l,char:y="@",allowSpaces:I=!1,allowToIncludeChar:h=!1,allowedPrefixes:m=[" "],startOfLine:k=!1,decorationTag:v="span",decorationClass:B="suggestion",decorationContent:q="",decorationEmptyClass:O="is-empty",command:S=()=>null,items:M=()=>[],render:C=()=>({}),allow:$=()=>!0,findSuggestionMatch:F=Q}){let a;const e=C==null?void 0:C(),K=()=>{const n=l.state.selection.$anchor.pos,i=l.view.coordsAtPos(n),{top:r,right:s,bottom:o,left:c}=i;try{return new DOMRect(c,r,s-c,o-r)}catch{return null}},_=(n,i)=>i?()=>{const r=f.getState(l.state),s=r==null?void 0:r.decorationId,o=n.dom.querySelector(`[data-decoration-id="${s}"]`);return(o==null?void 0:o.getBoundingClientRect())||null}:K;function x(n,i){var r;try{const o=f.getState(n.state),c=o!=null&&o.decorationId?n.dom.querySelector(`[data-decoration-id="${o.decorationId}"]`):null,d={editor:l,range:(o==null?void 0:o.range)||{from:0,to:0},query:(o==null?void 0:o.query)||null,text:(o==null?void 0:o.text)||null,items:[],command:p=>S({editor:l,range:(o==null?void 0:o.range)||{from:0,to:0},props:p}),decorationNode:c,clientRect:_(n,c)};(r=e==null?void 0:e.onExit)==null||r.call(e,d)}catch{}const s=n.state.tr.setMeta(i,{exit:!0});n.dispatch(s)}const N=new z.Plugin({key:f,view(){return{update:async(n,i)=>{var r,s,o,c,d,p,E;const t=(r=this.key)==null?void 0:r.getState(i),g=(s=this.key)==null?void 0:s.getState(n.state),u=t.active&&g.active&&t.range.from!==g.range.from,R=!t.active&&g.active,b=t.active&&!g.active,P=!R&&!b&&t.query!==g.query,D=R||u&&P,A=P||u,T=b||u&&P;if(!D&&!A&&!T)return;const w=T&&!D?t:g,j=n.dom.querySelector(`[data-decoration-id="${w.decorationId}"]`);a={editor:l,range:w.range,query:w.query,text:w.text,items:[],command:J=>S({editor:l,range:w.range,props:J}),decorationNode:j,clientRect:_(n,j)},D&&((o=e==null?void 0:e.onBeforeStart)==null||o.call(e,a)),A&&((c=e==null?void 0:e.onBeforeUpdate)==null||c.call(e,a)),(A||D)&&(a.items=await M({editor:l,query:w.query})),T&&((d=e==null?void 0:e.onExit)==null||d.call(e,a)),A&&((p=e==null?void 0:e.onUpdate)==null||p.call(e,a)),D&&((E=e==null?void 0:e.onStart)==null||E.call(e,a))},destroy:()=>{var n;a&&((n=e==null?void 0:e.onExit)==null||n.call(e,a))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(n,i,r,s){const{isEditable:o}=l,{composing:c}=l.view,{selection:d}=n,{empty:p,from:E}=d,t={...i},g=n.getMeta(f);if(g&&g.exit)return t.active=!1,t.decorationId=null,t.range={from:0,to:0},t.query=null,t.text=null,t;if(t.composing=c,o&&(p||l.view.composing)){(E<i.range.from||E>i.range.to)&&!c&&!i.composing&&(t.active=!1);const u=F({char:y,allowSpaces:I,allowToIncludeChar:h,allowedPrefixes:m,startOfLine:k,$position:d.$from}),R=`id_${Math.floor(Math.random()*4294967295)}`;u&&$({editor:l,state:s,range:u.range,isActive:i.active})?(t.active=!0,t.decorationId=i.decorationId?i.decorationId:R,t.range=u.range,t.query=u.query,t.text=u.text):t.active=!1}else t.active=!1;return t.active||(t.decorationId=null,t.range={from:0,to:0},t.query=null,t.text=null),t}},props:{handleKeyDown(n,i){var r,s,o,c;const{active:d,range:p}=N.getState(n.state);if(!d)return!1;if(i.key==="Escape"||i.key==="Esc"){const t=N.getState(n.state),g=(r=a==null?void 0:a.decorationNode)!=null?r:null,u=g??(t!=null&&t.decorationId?n.dom.querySelector(`[data-decoration-id="${t.decorationId}"]`):null);if(((s=e==null?void 0:e.onKeyDown)==null?void 0:s.call(e,{view:n,event:i,range:t.range}))||!1)return!0;const b={editor:l,range:t.range,query:t.query,text:t.text,items:[],command:P=>S({editor:l,range:t.range,props:P}),decorationNode:u,clientRect:u?()=>u.getBoundingClientRect()||null:null};return(o=e==null?void 0:e.onExit)==null||o.call(e,b),x(n,f),!0}return((c=e==null?void 0:e.onKeyDown)==null?void 0:c.call(e,{view:n,event:i,range:p}))||!1},decorations(n){const{active:i,range:r,decorationId:s,query:o}=N.getState(n);if(!i)return null;const c=!(o!=null&&o.length),d=[B];return c&&d.push(O),L.DecorationSet.create(n.doc,[L.Decoration.inline(r.from,r.to,{nodeName:v,class:d.join(" "),"data-decoration-id":s,"data-decoration-content":q})])}}});return N}var W=H;function X(f,l){const y={getBoundingClientRect:()=>G.posToDOMRect(f.view,f.state.selection.from,f.state.selection.to)};U.computePosition(y,l,{placement:"bottom-start",strategy:"absolute",middleware:[U.shift(),U.flip()]}).then(({x:I,y:h,strategy:m})=>{l.style.width="max-content",l.style.position=m,l.style.left=`${I}px`,l.style.top=`${h}px`})}exports.Suggestion=H;exports.index_default=W;exports.updatePosition=X;