@mrakomor/core 0.0.9 → 0.0.11

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 (49) hide show
  1. package/dist/blockChrome.cjs +3 -0
  2. package/dist/blockChrome.mjs +2 -2
  3. package/dist/blockInsertMenu.cjs +1 -0
  4. package/dist/blockInsertMenu.mjs +1 -1
  5. package/dist/chunk-2VURZA2E.mjs +1 -0
  6. package/dist/chunk-5VPYPKGA.mjs +1 -0
  7. package/dist/chunk-BCE45I7Q.mjs +2 -0
  8. package/dist/chunk-K2DMHAUD.mjs +1 -0
  9. package/dist/chunk-N4I2WZWF.mjs +1 -0
  10. package/dist/chunk-NR2BAMSW.mjs +2 -0
  11. package/dist/chunk-SCFD3XBH.mjs +1 -0
  12. package/dist/chunk-T7OO472O.mjs +1 -0
  13. package/dist/{chunk-WX7ESURF.mjs → chunk-VYTSZ4S6.mjs} +1 -1
  14. package/dist/chunk-YO4ZA6PJ.mjs +2 -0
  15. package/dist/chunk-ZDMD7SRT.mjs +4 -0
  16. package/dist/clipboard.cjs +5 -0
  17. package/dist/clipboard.mjs +3 -3
  18. package/dist/footer.cjs +5 -0
  19. package/dist/footer.mjs +2 -2
  20. package/dist/headline.cjs +5 -0
  21. package/dist/headline.mjs +1 -1
  22. package/dist/help.cjs +2 -0
  23. package/dist/help.mjs +2 -2
  24. package/dist/index.cjs +7 -0
  25. package/dist/index.mjs +4 -4
  26. package/dist/link.cjs +3 -0
  27. package/dist/link.mjs +2 -2
  28. package/dist/list.cjs +5 -0
  29. package/dist/list.mjs +1 -1
  30. package/dist/paragraph.cjs +5 -0
  31. package/dist/paragraph.mjs +1 -1
  32. package/dist/slashCommand.cjs +3 -0
  33. package/dist/slashCommand.mjs +1 -1
  34. package/dist/tooltip.cjs +2 -0
  35. package/dist/tooltip.mjs +2 -2
  36. package/dist/tts.cjs +9 -0
  37. package/dist/tts.mjs +3 -3
  38. package/package.json +67 -27
  39. package/dist/chunk-4NSVB4MI.mjs +0 -1
  40. package/dist/chunk-6XPPNCKR.mjs +0 -1
  41. package/dist/chunk-7UI6TZPX.mjs +0 -1
  42. package/dist/chunk-F67KYIDS.mjs +0 -2
  43. package/dist/chunk-JFLCNBDM.mjs +0 -3
  44. package/dist/chunk-P6HMUYFA.mjs +0 -1
  45. package/dist/chunk-PMR6XOZ6.mjs +0 -2
  46. package/dist/chunk-QWAQBTXR.mjs +0 -1
  47. package/dist/chunk-XQCH2FNS.mjs +0 -1
  48. package/dist/chunk-XVWRPXC2.mjs +0 -2
  49. package/dist/chunk-ZDZQ2RVJ.mjs +0 -1
package/dist/tts.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import {a as a$5}from'./chunk-PMR6XOZ6.mjs';import {a}from'./chunk-XVWRPXC2.mjs';import {a as a$2,b as b$2}from'./chunk-F67KYIDS.mjs';import {a as a$3,b as b$1}from'./chunk-QWAQBTXR.mjs';import'./chunk-P6HMUYFA.mjs';import {a as a$6}from'./chunk-6XPPNCKR.mjs';import {d as d$1,c,b as b$3}from'./chunk-WX7ESURF.mjs';import'./chunk-7UI6TZPX.mjs';import {a as a$1}from'./chunk-P7IKAZYZ.mjs';import {u as u$1,n,v as v$1,e,f as f$2,g,h,i as i$1}from'./chunk-JFLCNBDM.mjs';import'./chunk-B6JJAATK.mjs';import {a as a$4,f as f$1}from'./chunk-XQCH2FNS.mjs';import {n as n$1}from'./chunk-ZDZQ2RVJ.mjs';var i=class extends a{static getStateSchema(t){return d$1(t,{component:this.NAMESPACE,properties:{text:a$1.string().default(t?.textContent??t?.innerText??""),entityRanges:c()}})}getInlineStyleComponents(){return []}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}parseFromHTML(t){return u$1(this,t)}_buildContent(t){return n(t,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}getFormattingTarget(t){return v$1(this.element)}},f=class extends i{static get NAMESPACE(){return e}static get LABEL(){return "H1"}constructor(t){super(t),this._level=1;}},m=class extends i{static get NAMESPACE(){return f$2}static get LABEL(){return "H2"}constructor(t){super(t),this._level=2;}},u=class extends i{static get NAMESPACE(){return g}static get LABEL(){return "H3"}constructor(t){super(t),this._level=3;}},d=class extends i{static get NAMESPACE(){return h}static get LABEL(){return "H4"}constructor(t){super(t),this._level=4;}},b=class extends i{static get NAMESPACE(){return i$1}static get LABEL(){return "H5"}constructor(t){super(t),this._level=5;}};function j(){return {resolveConfig:e=>(e.blockComponents.push(m,u,d),e),resolveComponent:e=>{if(e===f.NAMESPACE)return f;if(e===m.NAMESPACE)return m;if(e===u.NAMESPACE)return u;if(e===d.NAMESPACE)return d;if(e===b.NAMESPACE)return b}}}var O=e=>a$1.object({componentId:a$1.string().default(()=>a$4()),depth:a$1.number().default(0),text:a$1.string().default(""),entityRanges:c()}).default({}),v=class e extends a$2{static getStateSchema(t){let r=a$3(t);return a$1.object({component:a$1.string().default(e.NAMESPACE),componentId:a$1.string().default(t?.getAttribute("data-componentid")||a$4()),properties:a$1.object({items:a$1.array(O()).default([O().parse()]).transform(b$1)}).default({}),settings:a$1.object({style:a$1.enum(["ORDERED","UNORDERED"]).default(r??"UNORDERED")}).default({})}).default({})}getInlineStyleComponents(){return []}parseFromHTML(t){return this.constructor.getStateSchema(t).parse(super.parseFromHTML(t))}};function F(){return b$2(v)}var l=class e extends a$5{static getStateSchema(t){return d$1(t,{component:e.NAMESPACE,properties:{entityRanges:c(),text:a$1.string().default(t?.innerText??t?.textContent??"")}})}getInlineStyleComponents(){return []}};function $(){return {resolveConfig:e=>(e.blockComponents.push(l),e),resolveComponent:e=>{if(e===l.NAMESPACE)return l}}}(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/tts/TtsVoice.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(a){return a.getAttribute("data-mrakomor-css-path")===e});if(!t){var r=document.createElement("style");r.setAttribute("data-mrakomor-css",""),r.setAttribute("data-mrakomor-css-path",e),r.textContent=`.atom-tts-voice{position:relative;border-radius:2px;display:inline-block}.atom-tts-voice:before{content:attr(data-voice-label);position:absolute;top:-1.1em;left:0;font-size:10px;line-height:1;white-space:nowrap;padding:1px 4px;border-radius:3px;pointer-events:none;font-weight:600}.tts-voice--man{background:#e8f0fe;color:#174ea6}.tts-voice--man:before{background:#1a73e8;color:#fff}.tts-voice--woman{background:#f3e8fd;color:#5e35b1}.tts-voice--woman:before{background:#7b1fa2;color:#fff}.tts-voice-toolbar{display:flex;flex-direction:column;gap:6px}.tts-voice-toolbar__row{display:flex;align-items:center;flex-wrap:wrap;gap:4px;min-width:0}.tts-voice-toolbar__voice{flex-shrink:0;border:1px solid #dadce0;border-radius:4px;padding:4px 8px;font-size:12px;background:#fff;color:#333}.tts-voice-toolbar__voice--man{border-color:#1a73e8;color:#174ea6}.tts-voice-toolbar__voice--woman{border-color:#7b1fa2;color:#5e35b1}.tts-voice-toolbar__voice--active{font-weight:600}.tts-voice-toolbar__voice--man.tts-voice-toolbar__voice--active{background:#e8f0fe}.tts-voice-toolbar__voice--woman.tts-voice-toolbar__voice--active{background:#f3e8fd}.tts-voice-toolbar__sep{width:1px;height:18px;background:#e0e0e0;flex-shrink:0;margin:0 2px}.tts-voice-toolbar__btn{display:flex;align-items:center;justify-content:center;flex-shrink:0;background:none;border:none;cursor:pointer;padding:4px;border-radius:4px;color:#555}.tts-voice-toolbar__btn:hover{background:#f0f0f0;color:#222}.tts-voice-toolbar__btn--danger:hover{color:#d32f2f;background:#fdecea}
2
- `,document.head.appendChild(r);}}})();var E=[{id:"Jarda",label:"Voice Jarda",gender:"man"},{id:"Pavel",label:"Voice Pavel",gender:"man"},{id:"Radek",label:"Voice Radek",gender:"man"},{id:"Magda",label:"Voice Magda",gender:"woman"},{id:"Marketa",label:"Voice Marketa",gender:"woman"},{id:"Silva",label:"Voice Silva",gender:"woman"}],J='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>';function x(e){return E.find(t=>t.id===e)??E[0]}var p=class e extends a$6{static get NAMESPACE(){return "atom.tts.Voice"}static get LABEL(){return "VOICE"}static match(t){return t?.entity?.type===e.NAMESPACE||t?.nodeName==="SPAN"&&t?.getAttribute?.("data-entity-type")===e.NAMESPACE}static getStateSchema(t){let r;if(t?.getAttribute?.("data-state"))try{r=JSON.parse(t.getAttribute("data-state"));}catch{}let a=r?.entity?.data?.voice??t?.getAttribute?.("data-voice")??"";return b$3({type:e.NAMESPACE,data:a$1.object({voice:a$1.string().default(a)}).default({}),length:r?.length??0,offset:r?.offset??0}).default({})}#e({entity:t,length:r,offset:a}){let h=t.peek()?.data?.voice??"";return n$1("div",{className:"tts-voice-toolbar"},[n$1("div",{className:"tts-voice-toolbar__row"},[...E.map(n=>n$1("button",{type:"button",className:`tts-voice-toolbar__voice tts-voice-toolbar__voice--${n.gender}${h===n.id?" tts-voice-toolbar__voice--active":""}`,title:n.label,onClick:()=>{t.set({...t.peek(),data:{voice:n.id}}),this.mrakomor.command.closeDialog();}},n.label)),n$1("span",{className:"tts-voice-toolbar__sep"}),n$1("button",{type:"button",className:"tts-voice-toolbar__btn tts-voice-toolbar__btn--danger",title:"Remove TTS voice",$dangerouslySetInnerHTML:J,onClick:()=>{this.mrakomor.command.removeEntityRange?.({state:{entity:t.peek(),length:r.peek(),offset:a.peek()},blockElement:f$1(this.element)});}})])])}#t(t){this.mrakomor.command.openDialog({element:this.element,children:this.#e(t)});}onMount(){let{entity:t}=this.props;t.peek()?.data?.voice||this.#t(this.props);}render(){let{entity:t,length:r,offset:a,children:h}=this.props;return n$1("span",{className:()=>{let n=t.get()?.data?.voice??"";return `atom-tts-voice tts-voice--${x(n||"man1").gender}`},"data-entity-type":this.constructor.NAMESPACE,"data-voice":()=>t.get()?.data?.voice??"","data-voice-label":()=>{let n=t.get()?.data?.voice??"";return n?x(n).label:""},$ref:this.element,onClick:n=>{n.preventDefault(),this.#t({entity:t,length:r,offset:a});},"data-state":()=>JSON.stringify({entity:t.get(),length:r.get(),offset:a.get()})},h)}};function U(){return {resolveConfig:e=>(e.entityRanges.push(p),e),resolveComponent:e=>{if(e===p.NAMESPACE)return p}}}
3
- export{i as TtsHeadlineComponent,v as TtsList,l as TtsParagraph,p as TtsVoice,E as VOICES,x as getVoice,j as ttsHeadlinePlugin,F as ttsListPlugin,$ as ttsParagraphPlugin,U as ttsVoicePlugin};
1
+ import {a as a$4}from'./chunk-NR2BAMSW.mjs';import {a}from'./chunk-YO4ZA6PJ.mjs';import {c as c$1,a as a$2,b as b$1,d as d$2}from'./chunk-BCE45I7Q.mjs';import'./chunk-2VURZA2E.mjs';import {a as a$5}from'./chunk-N4I2WZWF.mjs';import {d as d$1,c,b as b$2}from'./chunk-VYTSZ4S6.mjs';import'./chunk-T7OO472O.mjs';import {a as a$1}from'./chunk-P7IKAZYZ.mjs';import {z as z$1,s as s$1,e,f as f$2,g as g$1,h as h$1,i}from'./chunk-ZDMD7SRT.mjs';import'./chunk-B6JJAATK.mjs';import {a as a$3,f as f$1}from'./chunk-SCFD3XBH.mjs';import {o,c as c$2}from'./chunk-K2DMHAUD.mjs';var s=class extends a{static getStateSchema(t){return d$1(t,{component:this.NAMESPACE,properties:{text:a$1.string().default(t?.textContent??t?.innerText??""),entityRanges:c()}})}getInlineStyleComponents(){return []}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}parseFromHTML(t){return z$1(this,t)}_buildContent(t){return s$1(t,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}},h=class extends s{static get NAMESPACE(){return e}static get LABEL(){return "H1"}constructor(t){super(t),this._level=1;}},u=class extends s{static get NAMESPACE(){return f$2}static get LABEL(){return "H2"}constructor(t){super(t),this._level=2;}},d=class extends s{static get NAMESPACE(){return g$1}static get LABEL(){return "H3"}constructor(t){super(t),this._level=3;}},g=class extends s{static get NAMESPACE(){return h$1}static get LABEL(){return "H4"}constructor(t){super(t),this._level=4;}},b=class extends s{static get NAMESPACE(){return i}static get LABEL(){return "H5"}constructor(t){super(t),this._level=5;}};function $(){return {resolveConfig:e=>(e.blockComponents.push(u,d,g),e),resolveComponent:e=>{if(e===h.NAMESPACE)return h;if(e===u.NAMESPACE)return u;if(e===d.NAMESPACE)return d;if(e===g.NAMESPACE)return g;if(e===b.NAMESPACE)return b}}}var j=e=>a$1.object({componentId:a$1.string().default(()=>a$3()),depth:a$1.number().default(0),text:a$1.string().default(""),entityRanges:c()}).default({}),E=class e extends c$1{static getStateSchema(t){let o=a$2(t);return a$1.object({component:a$1.string().default(e.NAMESPACE),componentId:a$1.string().default(t?.getAttribute("data-componentid")||a$3()),properties:a$1.object({items:a$1.array(j()).default([j().parse()]).transform(b$1)}).default({}),settings:a$1.object({style:a$1.enum(["ORDERED","UNORDERED"]).default(o??"UNORDERED")}).default({})}).default({})}getInlineStyleComponents(){return []}parseFromHTML(t){return this.constructor.getStateSchema(t).parse(super.parseFromHTML(t))}};function F(){return d$2(E)}var p=class e extends a$4{static getStateSchema(t){return d$1(t,{component:e.NAMESPACE,properties:{entityRanges:c(),text:a$1.string().default(t?.innerText??t?.textContent??"")}})}getInlineStyleComponents(){return []}};function J(){return {resolveConfig:e=>(e.blockComponents.push(p),e),resolveComponent:e=>{if(e===p.NAMESPACE)return p}}}(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/tts/TtsVoice.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(i){return i.getAttribute("data-mrakomor-css-path")===e});if(!t){var o=document.createElement("style");o.setAttribute("data-mrakomor-css",""),o.setAttribute("data-mrakomor-css-path",e),o.textContent=`.atom-tts-voice{position:relative;border-radius:2px;display:inline-block}.atom-tts-voice:before{content:attr(data-voice-label);position:absolute;top:-1.1em;left:0;font-size:10px;line-height:1;white-space:nowrap;padding:1px 4px;border-radius:3px;pointer-events:none;font-weight:600}.tts-voice--man,.tts-voice--woman{background:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 14%,white);color:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 75%,black)}.tts-voice--man:before,.tts-voice--woman:before{background:var(--tts-voice-color, #1a73e8);color:#fff}.tts-voice-toolbar{display:flex;flex-direction:column;gap:6px}.tts-voice-toolbar__row{display:flex;align-items:center;flex-wrap:wrap;gap:4px;min-width:0}.tts-voice-toolbar__voice{flex-shrink:0;border:1px solid #dadce0;border-radius:4px;padding:4px 8px;font-size:12px;background:#fff;color:#333}.tts-voice-toolbar__voice--man,.tts-voice-toolbar__voice--woman{border-color:var(--tts-voice-color, #1a73e8);color:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 75%,black)}.tts-voice-toolbar__voice--active{font-weight:600}.tts-voice-toolbar__voice--man.tts-voice-toolbar__voice--active,.tts-voice-toolbar__voice--woman.tts-voice-toolbar__voice--active{background:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 16%,white)}.tts-voice-toolbar__sep{width:1px;height:18px;background:#e0e0e0;flex-shrink:0;margin:0 2px}.tts-voice-toolbar__btn{display:flex;align-items:center;justify-content:center;flex-shrink:0;background:none;border:none;cursor:pointer;padding:4px;border-radius:4px;color:#555}.tts-voice-toolbar__btn:hover{background:#f0f0f0;color:#222}.tts-voice-toolbar__btn--danger:hover{color:#d32f2f;background:#fdecea}
2
+ `,document.head.appendChild(o);}}})();var f=[{id:"Jarda",label:"Voice Jarda",gender:"man",color:"#1a73e8"},{id:"Pavel",label:"Voice Pavel",gender:"man",color:"#1e8e3e"},{id:"Radek",label:"Voice Radek",gender:"man",color:"#00838f"},{id:"Magda",label:"Voice Magda",gender:"woman",color:"#7b1fa2"},{id:"Marketa",label:"Voice Marketa",gender:"woman",color:"#d81b60"},{id:"Silva",label:"Voice Silva",gender:"woman",color:"#c62828"}],U='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>';function x(e){return f.find(t=>t.id===e)??f[0]}function q(e){let t=f.find(a=>a.id===e);if(t)return t.color;let o=0;for(let a=0;a<e.length;a++)o=o*31+e.charCodeAt(a)|0;return `hsl(${Math.abs(o)%360}, 65%, 45%)`}var m=class e extends a$5{#t;static get NAMESPACE(){return "atom.tts.Voice"}static get LABEL(){return "VOICE"}static match(t){return t?.entity?.type===e.NAMESPACE||t?.nodeName==="SPAN"&&t?.getAttribute?.("data-entity-type")===e.NAMESPACE}static getStateSchema(t){let o;if(t?.getAttribute?.("data-state"))try{o=JSON.parse(t.getAttribute("data-state"));}catch{}let i=o?.entity?.data?.voice??t?.getAttribute?.("data-voice")??"";return b$2({type:e.NAMESPACE,data:a$1.object({voice:a$1.string().default(i)}).default({}),length:o?.length??0,offset:o?.offset??0}).default({})}#o({entity:t,length:o$1,offset:i}){let a=t.peek()?.data?.voice??"";return o("div",{className:"tts-voice-toolbar"},[o("div",{className:"tts-voice-toolbar__row"},[...f.map(n=>o("button",{type:"button",className:`tts-voice-toolbar__voice tts-voice-toolbar__voice--${n.gender}${a===n.id?" tts-voice-toolbar__voice--active":""}`,$ref:S=>S?.style.setProperty("--tts-voice-color",n.color),title:n.label,onClick:()=>{t.set({...t.peek(),data:{voice:n.id}}),this.mrakomor.command.closeDialog();}},n.label)),o("span",{className:"tts-voice-toolbar__sep"}),o("button",{type:"button",className:"tts-voice-toolbar__btn tts-voice-toolbar__btn--danger",title:"Remove TTS voice",$dangerouslySetInnerHTML:U,onClick:()=>{this.mrakomor.command.removeEntityRange?.({state:{entity:t.peek(),length:o$1.peek(),offset:i.peek()},blockElement:f$1(this.element)});}})])])}#e(t){this.mrakomor.command.openDialog({element:this.element,children:this.#o(t)});}onMount(){let{entity:t}=this.props;t.peek()?.data?.voice||this.#e(this.props),this.#t=c$2(()=>{let o=t.get()?.data?.voice??"";this.element.current?.style.setProperty("--tts-voice-color",q(o));});}onUnmount(){this.#t?.();}render(){let{entity:t,length:o$1,offset:i,children:a}=this.props;return o("span",{className:()=>{let n=t.get()?.data?.voice??"";return `atom-tts-voice tts-voice--${x(n||"man1").gender}`},"data-entity-type":this.constructor.NAMESPACE,"data-voice":()=>t.get()?.data?.voice??"","data-voice-label":()=>{let n=t.get()?.data?.voice??"";return n?x(n).label:""},$ref:this.element,onClick:n=>{n.preventDefault(),this.#e({entity:t,length:o$1,offset:i});},"data-state":()=>JSON.stringify({entity:t.get(),length:o$1.get(),offset:i.get()})},a)}};function z(){return {resolveConfig:e=>(e.entityRanges.push(m),e),resolveComponent:e=>{if(e===m.NAMESPACE)return m}}}
3
+ export{s as TtsHeadlineComponent,E as TtsList,p as TtsParagraph,m as TtsVoice,f as VOICES,x as getVoice,$ as ttsHeadlinePlugin,F as ttsListPlugin,J as ttsParagraphPlugin,z as ttsVoicePlugin};
package/package.json CHANGED
@@ -1,46 +1,86 @@
1
1
  {
2
2
  "name": "@mrakomor/core",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "",
5
5
  "imports": {
6
6
  "#src/*.mjs": "./src/*.mjs",
7
7
  "#src/*": "./src/*"
8
8
  },
9
+ "main": "./dist/index.cjs",
10
+ "module": "./dist/index.mjs",
9
11
  "exports": {
10
- ".": "./dist/index.mjs",
11
- "./paragraph": "./dist/paragraph.mjs",
12
- "./headline": "./dist/headline.mjs",
13
- "./list": "./dist/list.mjs",
14
- "./link": "./dist/link.mjs",
15
- "./tooltip": "./dist/tooltip.mjs",
16
- "./blockChrome": "./dist/blockChrome.mjs",
17
- "./blockInsertMenu": "./dist/blockInsertMenu.mjs",
18
- "./slashCommand": "./dist/slashCommand.mjs",
19
- "./clipboard": "./dist/clipboard.mjs",
20
- "./footer": "./dist/footer.mjs",
21
- "./help": "./dist/help.mjs",
22
- "./tts": "./dist/tts.mjs"
12
+ ".": {
13
+ "import": "./dist/index.mjs",
14
+ "require": "./dist/index.cjs"
15
+ },
16
+ "./paragraph": {
17
+ "import": "./dist/paragraph.mjs",
18
+ "require": "./dist/paragraph.cjs"
19
+ },
20
+ "./headline": {
21
+ "import": "./dist/headline.mjs",
22
+ "require": "./dist/headline.cjs"
23
+ },
24
+ "./list": {
25
+ "import": "./dist/list.mjs",
26
+ "require": "./dist/list.cjs"
27
+ },
28
+ "./link": {
29
+ "import": "./dist/link.mjs",
30
+ "require": "./dist/link.cjs"
31
+ },
32
+ "./tooltip": {
33
+ "import": "./dist/tooltip.mjs",
34
+ "require": "./dist/tooltip.cjs"
35
+ },
36
+ "./blockChrome": {
37
+ "import": "./dist/blockChrome.mjs",
38
+ "require": "./dist/blockChrome.cjs"
39
+ },
40
+ "./blockInsertMenu": {
41
+ "import": "./dist/blockInsertMenu.mjs",
42
+ "require": "./dist/blockInsertMenu.cjs"
43
+ },
44
+ "./slashCommand": {
45
+ "import": "./dist/slashCommand.mjs",
46
+ "require": "./dist/slashCommand.cjs"
47
+ },
48
+ "./clipboard": {
49
+ "import": "./dist/clipboard.mjs",
50
+ "require": "./dist/clipboard.cjs"
51
+ },
52
+ "./footer": {
53
+ "import": "./dist/footer.mjs",
54
+ "require": "./dist/footer.cjs"
55
+ },
56
+ "./help": {
57
+ "import": "./dist/help.mjs",
58
+ "require": "./dist/help.cjs"
59
+ },
60
+ "./tts": {
61
+ "import": "./dist/tts.mjs",
62
+ "require": "./dist/tts.cjs"
63
+ }
23
64
  },
24
65
  "files": [
25
66
  "dist"
26
67
  ],
27
68
  "sideEffects": [
28
69
  "**/*.css",
29
- "./dist/chunk-4NSVB4MI.mjs",
30
- "./dist/chunk-6XPPNCKR.mjs",
31
- "./dist/chunk-7UI6TZPX.mjs",
70
+ "./dist/chunk-2VURZA2E.mjs",
71
+ "./dist/chunk-5VPYPKGA.mjs",
32
72
  "./dist/chunk-B6JJAATK.mjs",
33
- "./dist/chunk-F67KYIDS.mjs",
34
- "./dist/chunk-JFLCNBDM.mjs",
35
- "./dist/chunk-P6HMUYFA.mjs",
73
+ "./dist/chunk-BCE45I7Q.mjs",
74
+ "./dist/chunk-K2DMHAUD.mjs",
75
+ "./dist/chunk-N4I2WZWF.mjs",
76
+ "./dist/chunk-NR2BAMSW.mjs",
36
77
  "./dist/chunk-P7IKAZYZ.mjs",
37
- "./dist/chunk-PMR6XOZ6.mjs",
38
- "./dist/chunk-QWAQBTXR.mjs",
78
+ "./dist/chunk-SCFD3XBH.mjs",
79
+ "./dist/chunk-T7OO472O.mjs",
80
+ "./dist/chunk-VYTSZ4S6.mjs",
39
81
  "./dist/chunk-WQWE5UCN.mjs",
40
- "./dist/chunk-WX7ESURF.mjs",
41
- "./dist/chunk-XQCH2FNS.mjs",
42
- "./dist/chunk-XVWRPXC2.mjs",
43
- "./dist/chunk-ZDZQ2RVJ.mjs"
82
+ "./dist/chunk-YO4ZA6PJ.mjs",
83
+ "./dist/chunk-ZDMD7SRT.mjs"
44
84
  ],
45
85
  "scripts": {
46
86
  "preversion": "npm run build && npm run lint && npm test && npm run types",
@@ -68,7 +108,7 @@
68
108
  "access": "public"
69
109
  },
70
110
  "dependencies": {
71
- "@esmj/dom": "^0.3.1",
111
+ "@esmj/dom": "^0.4.1",
72
112
  "@esmj/emitter": "^0.4.3",
73
113
  "@esmj/observable": "^0.2.2",
74
114
  "@esmj/schema": "^0.9.2"
@@ -1 +0,0 @@
1
- import {q}from'./chunk-ZDZQ2RVJ.mjs';function i(o,t,n,m){let e=o.getRoot()?.querySelector(t);if(!e)return {container:null,dispose:null};let r=document.createElement("div");r.className=n,e.append(r);let c=q(r,m);return {container:r,dispose:c??null}}function s(o,t,n){return i(o,".mrakomor-tools-container",t,n)}function l(o,t,n){return i(o,".mrakomor-footer-end",t,n)}export{s as a,l as b};
@@ -1 +0,0 @@
1
- import {a as a$1}from'./chunk-7UI6TZPX.mjs';import {a}from'./chunk-P7IKAZYZ.mjs';import {o,j,e,n}from'./chunk-ZDZQ2RVJ.mjs';var i=class extends o{static get nodeName(){return "span"}static get NAMESPACE(){return "namespace.EntityRangeElement"}static match(t){return t?.nodeName===this.nodeName.toUpperCase()||t?.entity?.type===this.NAMESPACE}static getStateSchema(t){return a.any()}constructor(t){super(t),this.mrakomor=j(a$1),this.element=e(null);}render(){return n(this.constructor.nodeName,{},this.props.children)}};export{i as a};
@@ -1 +0,0 @@
1
- import {h}from'./chunk-ZDZQ2RVJ.mjs';var e=h();export{e as a};
@@ -1,2 +0,0 @@
1
- import {a as a$1,b as b$2,k,c,d,j,h,g,e,f as f$1,i as i$1}from'./chunk-QWAQBTXR.mjs';import {a}from'./chunk-P6HMUYFA.mjs';import {b as b$3,a as a$6}from'./chunk-WX7ESURF.mjs';import {a as a$2}from'./chunk-P7IKAZYZ.mjs';import {b as b$1,j as j$1,l,k as k$1}from'./chunk-JFLCNBDM.mjs';import {a as a$5}from'./chunk-B6JJAATK.mjs';import {a as a$3,i,d as d$1,f,t,r}from'./chunk-XQCH2FNS.mjs';import {n,p,a as a$4,m}from'./chunk-ZDZQ2RVJ.mjs';(function(){if(!(typeof document>"u")){var l="mrakomor/core/plugin/list/List.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(r){return r.getAttribute("data-mrakomor-css-path")===l});if(!t){var e=document.createElement("style");e.setAttribute("data-mrakomor-css",""),e.setAttribute("data-mrakomor-css-path",l),e.textContent=`.molecule-list-list{margin:0 0 1em;padding-inline-start:1.5em}.molecule-list-list li{margin:.25em 0;outline:none}.molecule-list-list li:focus{outline:none}.molecule-list-list li[data-depth="1"]{margin-inline-start:1.5em}.molecule-list-list li[data-depth="2"]{margin-inline-start:3em}.molecule-list-list li[data-depth="3"]{margin-inline-start:4.5em}
2
- `,document.head.appendChild(e);}}})();var S=l=>a$2.object({componentId:a$2.string().default(()=>l?.getAttribute?.("data-componentid")||a$3()),depth:a$2.number().default(0),text:a$2.string().default(""),inlineStyleRanges:a$2.array(a$6()).default([]),entityRanges:a$2.array(b$3()).default([])}).default({}),b=class l extends a{static get NAMESPACE(){return b$1}static get LABEL(){return "List"}static get GROUP(){return "lists"}getInlineStyleComponents(){return this.props?.inlineStyles?.get()??this.mrakomor.getConfig()?.inlineStyles??[]}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}static getStateSchema(t){let e=a$1(t);return a$2.object({component:a$2.string().default(l.NAMESPACE),componentId:a$2.string().default(t?.getAttribute("data-componentid")||a$3()),properties:a$2.object({items:a$2.array(S()).default([S().parse()]).transform(b$2)}).default({}),settings:a$2.object({style:a$2.enum(["ORDERED","UNORDERED"]).default(e??"UNORDERED")}).default({})}).default({})}parseFromHTML(t){if(!t)return this.constructor.getStateSchema(t).parse();let e=structuredClone(this.constructor.getStateSchema(t).parse()),r={inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()},n=[...t.querySelectorAll("li")];return e.properties.items=n.length?n.map(s=>S(s).parse(k(s,r))):[S().parse()],e.settings={...e.settings,style:t.nodeName==="OL"?"ORDERED":t.nodeName==="UL"?"UNORDERED":this.state?.peek()?.settings?.style??e.settings?.style??"UNORDERED"},e}getFormattingTarget(t){let e=t??i(),r=c(this.element,e);if(!r)return null;let n=d(this.element,r);return n<0?null:{element:r,read(s){let o=s.properties?.items?.[n];return {inlineStyleRanges:o?.inlineStyleRanges,entityRanges:o?.entityRanges}},write(s,{inlineStyleRanges:o,entityRanges:m}){let i=s.properties?.items?.[n];i&&(o!==void 0&&(i.inlineStyleRanges=o),m!==void 0&&(i.entityRanges=m));}}}_commitState(t){let e=this.mrakomor.getContent(),r=e.findIndex(n=>n.componentId===t.componentId);r!==-1&&(e.splice(r,1,t),this.mrakomor.setContent(e));}_buildItemContent(t){return j(t,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}render(){let t=this.constructor.NAMESPACE.toLowerCase().replaceAll(".","-"),e=this.state.peek(),r=e.settings?.style==="ORDERED"?"ol":"ul";return n(r,{className:t,"data-componentid":e.componentId,$ref:n=>{this.element=n;}},p(()=>this.state.get().properties?.items??[],(n,s)=>n.componentId??String(s),(n$1,s)=>n("li",{contentEditable:true,[d$1]:true,"data-componentid":()=>n$1.get().componentId,"data-item-index":()=>{let o=n$1.get()?.componentId,i=(this.state.get().properties?.items??[]).findIndex(c=>c.componentId===o);return String(i>=0?i:s)},"data-depth":()=>String(n$1.get()?.depth??0),$dangerouslySetInnerHTML:()=>{let o=n$1.get(),m=o?.text??"";return j$1(m)?a$4(()=>this._buildItemContent(o)):"<br>"}})))}onKeydown(t){if(t.key==="Enter"){this.#e(t);return}t.key==="Backspace"&&this.#n(t);}setCursor(t){let e=this.getState()?.properties?.items??[],r$1=e.length-1;if(r$1<0)return;let n=typeof t=="number"?t:j$1(e[r$1]?.text).length,s=()=>{let o=this.element?.querySelector(`li[data-item-index="${r$1}"]`);o?.isConnected&&r(o,n);};s(),m(s);}#t(t$1){let e=this.getState(),r$1=[...e.properties.items??[]],n=r$1[t$1];if(!n)return;if((n.depth??0)>0){r$1[t$1]={...n,depth:n.depth-1},this._commitState({...e,properties:{...e.properties,items:r$1}});let u=()=>{let p=this.element?.querySelector(`li[data-item-index="${t$1}"]`);p?.isConnected&&r(p,0);};u(),m(u);return}let s=f(this.element),o=this.mrakomor._getBlockElementIndex(s),m$1=s?.previousElementSibling??null,i=m$1?this.mrakomor._getBlockElementIndex(m$1):-1;if(t$1===0&&i>=0&&o===i+1){let u=this.mrakomor.getContent(),p=h(u,i,o);if(p){this.mrakomor._setContentState(p.content.map(G=>this.mrakomor.normalizeComponentState(G))),t(m$1)?.setCursor?.(p.cursor);return}}let{blocks:c,paragraphIndex:d}=g(e,t$1);this.mrakomor.command.replaceBlockElement({blockElement:f(this.element),blocks:c,cursor:0,cursorBlockIndex:d});}#e(t){t.preventDefault();let e$1=i(),r$1=c(this.element,e$1);if(!r$1)return;let n=d(this.element,r$1),s=e(r$1,e$1),o=this.getState(),m$1=[...o.properties.items??[]],i$1=m$1[n];if(!i$1)return;if(!j$1(i$1.text)){this.#t(n);return}let{before:c$1,after:d$1}=f$1(i$1,s);m$1.splice(n,1,c$1,d$1),this._commitState({...o,properties:{...o.properties,items:m$1}}),m(()=>{let u=this.element?.querySelector(`li[data-item-index="${n+1}"]`);u&&r(u,0);});}#n(t){let e$1=i(),r=c(this.element,e$1);if(!r||!e$1.collapsed)return;let n=d(this.element,r);e(r,e$1)===0&&(t.preventDefault(),this.#t(n));}};function K(l$1){let{mrakomor:t$1,blockElement:e,previousBlockElement:r}=l$1;if(!t$1||!e||!r)return;let n=t$1._getBlockElementIndex(r),s=t$1._getBlockElementIndex(e);if(n===-1||s===-1)return;let o=t$1.getContent(),m=o[n],i=o[s];if(!l(m)||!k$1(i))return;let c=i$1(o,n,s);c&&(l$1.preventDefault(),t$1._setContentState(c.content.map(d=>t$1.normalizeComponentState(d))),t(r)?.setCursor?.(c.cursor));}function V(l){return {resolveConfig:t=>(t.blockComponents.push({component:l,label:"UL",keywords:["ul","unordered","bullet"],order:100,settings:{style:"UNORDERED"}},{component:l,label:"OL",keywords:["ol","ordered","number"],order:101,settings:{style:"ORDERED"}}),t),resolveComponent:t=>{if(t===l.NAMESPACE)return l},registerCommands(t){t.emitter.on(a$5.MERGE_BLOCK_ELEMENT,K);}}}function st(){return V(b)}export{b as a,V as b,st as c};
@@ -1,3 +0,0 @@
1
- import {a as a$1,j,i,n}from'./chunk-XQCH2FNS.mjs';import {q,n as n$1}from'./chunk-ZDZQ2RVJ.mjs';var d="molecule.paragraph.Paragraph",O="molecule.list.List",F="molecule.external.ExternalComponent",v="namespace.unknown.UnknownComponent",X="molecule.headline.H1",K="molecule.headline.H2",z="molecule.headline.H3",G="molecule.headline.H4",U="molecule.headline.H5",A="molecule.headline.";function a(t){return t===`
2
- `||t===`\r
3
- `?"":t??""}function N(t){let e=t?.component??"";return e===d||e.startsWith(A)}function Q(t){return Array.isArray(t?.properties?.items)}function V(t,e){return N(t)&&N(e)&&t.component===e.component}function L(t,e){let n=new Set([0,e]);for(let o of t)n.add(o.offset),n.add(o.offset+o.length);return [...n].sort((o,r)=>o-r)}function C(t,e,n){return t.filter(o=>o.offset<=e&&o.offset+o.length>=n)}function T(t,e,n,{inlineStyleComponents:o,entityRangeComponents:r}){let s=t;for(let i of e){let f=o.find(c=>c.match(i));f&&(s=n$1(f,{},s));}for(let i of n){let f=r.find(c=>c.match(i));f&&(s=n$1(f,i,s));}return s}function Y(t,{inlineStyleComponents:e,entityRangeComponents:n}){let o=document.createDocumentFragment(),r=a(t.properties.text),s=t.properties.inlineStyleRanges??[],i=t.properties.entityRanges??[];if(!r)return o;let f=L([...s,...i],r.length);for(let c=0;c<f.length-1;c+=1){let l=f[c],p=f[c+1];if(l>=p)continue;let g=r.slice(l,p),H=T(g,C(s,l,p),C(i,l,p),{inlineStyleComponents:e,entityRangeComponents:n});q(o,H);}return o}function u(t,e,n,{inlineStyleComponents:o,entityRangeComponents:r}){let s=n;for(let i of t){if(i.nodeType===Node.TEXT_NODE){s+=i.textContent.length;continue}if(i.nodeType!==Node.ELEMENT_NODE||i.nodeName==="BR")continue;let f=o.find(l=>l.match(i));if(f){let l=i.textContent.length;e.properties.inlineStyleRanges.push({style:f.style,offset:s,length:l}),s=u(i.childNodes,e,s,{inlineStyleComponents:o,entityRangeComponents:r});continue}let c=r.find(l=>l.match(i));if(c){let l=i.textContent.length;e.properties.entityRanges.push({...c.getStateSchema(i).parse(),offset:s,length:l}),s=u(i.childNodes,e,s,{inlineStyleComponents:o,entityRangeComponents:r});continue}s=u(i.childNodes,e,s,{inlineStyleComponents:o,entityRangeComponents:r});}return s}function I(t,e){let n=a(t.properties.text),o=a(e.properties.text);return {state:{...t,properties:{...e.properties,...t.properties,text:n+o,inlineStyleRanges:[...t.properties.inlineStyleRanges??[],...(e.properties.inlineStyleRanges??[]).map(r=>({...r,offset:r.offset+n.length}))],entityRanges:[...t.properties.entityRanges??[],...(e.properties.entityRanges??[]).map(r=>({...r,offset:r.offset+n.length}))]},settings:{...e.settings,...t.settings}},cursor:n.length}}function Z(t,{startIndex:e,endIndex:n,startOffset:o,endOffset:r}){let s=[...t],i=s[e],f=s[n],{originalLineState:c}=y(i,o),{newLineState:l}=y(f,r),{state:p,cursor:g}=I(c,l);return s.splice(e,n-e+1,p),{content:s,cursor:g,resultIndex:e}}function P(t,e){return (t??[]).filter(n=>n.offset<e).map(n=>({...n,length:Math.min(n.length,e-n.offset)}))}function M(t,e){return (t??[]).filter(n=>n.offset+n.length>e).map(n=>({...n,offset:Math.max(0,n.offset-e),length:n.offset+n.length-Math.max(n.offset,e)}))}function y(t,e){let n=structuredClone(t),o=structuredClone(t);return n.properties.text=t.properties.text.slice(0,e),o.properties.text=t.properties.text.slice(e),n.properties.inlineStyleRanges=P(t.properties.inlineStyleRanges,e),o.properties.inlineStyleRanges=M(t.properties.inlineStyleRanges,e),n.properties.entityRanges=P(t.properties.entityRanges,e),o.properties.entityRanges=M(t.properties.entityRanges,e),o.componentId=a$1(),{originalLineState:n,newLineState:o}}function $(t,e,{namespace:n=t.constructor.NAMESPACE}={}){if(e.key!=="Enter")return false;e.preventDefault();let{originalLineState:o,newLineState:r}=y(t.getState(),j(t.element));return t.mrakomor.command.insertBlockElement({range:i(),cursor:0,newLineState:r,originalLineState:o,namespace:n}),true}function b(t,e){if(e.key!=="Enter")return false;e.preventDefault();let n=d,o=t.mrakomor.resolveComponentConstructor(n);return t.mrakomor.command.insertBlockElement({range:i(),cursor:0,newLineState:t.mrakomor.normalizeComponentState(o.getStateSchema().parse({})),namespace:n}),true}function ee(t,e){let n=t.constructor;if(!e)return n.getStateSchema(e).parse();let o=structuredClone(n.getStateSchema(e).parse());return u(e.childNodes,o,0,{inlineStyleComponents:t.getInlineStyleComponents(),entityRangeComponents:t.getEntityRangeComponents()}),o.properties.text=a(o.properties.text),o}function te(t){return t?{element:t,read(e){return {inlineStyleRanges:e.properties?.inlineStyleRanges,entityRanges:e.properties?.entityRanges}},write(e,{inlineStyleRanges:n,entityRanges:o}){n!==void 0&&(e.properties.inlineStyleRanges=n),o!==void 0&&(e.properties.entityRanges=o);}}:null}function _(t,e){let n$1=n(t,e.startContainer,e.startOffset),o=n(t,e.endContainer,e.endOffset);return {offset:n$1,length:Math.max(0,o-n$1)}}function B(t,{style:e,offset:n,length:o}){let r=t??[],s=n+o,i=r.find(f=>f.style===e&&f.offset<=n&&f.offset+f.length>=s);return i?r.filter(f=>f!==i):[...r,{style:e,offset:n,length:o}]}function w(t,e){return t.offset<e.offset+e.length&&e.offset<t.offset+t.length}function k(t,e){let n=e.offset+e.length,o=[];for(let r of t){if(!w(r,e)){o.push(r);continue}r.offset<e.offset&&o.push({...r,length:e.offset-r.offset});let s=r.offset+r.length;s>n&&o.push({...r,offset:n,length:s-n});}return o}function D(t,e){let n=t??[],o=e?.length??0;if(o===0)return null;let r=e.offset??0,s=e.entity?.type,i=n.find(f=>f.offset===r&&f.length===o&&f.entity?.type===s);return i?n.filter(f=>f!==i):[...k(n,e),e]}function ne(t,e,{style:n,range:o}){if(!t||!e?.element||!o)return null;let r=e.read(t);if(r?.inlineStyleRanges===void 0)return null;let{offset:s,length:i}=_(e.element,o);return i===0?null:(e.write(t,{inlineStyleRanges:B(r.inlineStyleRanges??[],{style:n,offset:s,length:i})}),t)}function oe(t,e,{state:n,namespace:o,range:r}){if(!t||!e?.element||!r)return null;let s=e.read(t);if(s?.entityRanges===void 0)return null;let i={...n,entity:{type:o,...n?.entity},..._(e.element,r)},f=D(s.entityRanges??[],i);return f===null?null:(e.write(t,{entityRanges:f}),t)}export{d as a,O as b,F as c,v as d,X as e,K as f,z as g,G as h,U as i,a as j,N as k,Q as l,V as m,Y as n,u as o,I as p,Z as q,y as r,$ as s,b as t,ee as u,te as v,_ as w,ne as x,oe as y};
@@ -1 +0,0 @@
1
- import {a}from'./chunk-7UI6TZPX.mjs';import {a as a$1}from'./chunk-P7IKAZYZ.mjs';import {j}from'./chunk-JFLCNBDM.mjs';import {a as a$2}from'./chunk-B6JJAATK.mjs';import {r}from'./chunk-XQCH2FNS.mjs';import {m,o,j as j$1}from'./chunk-ZDZQ2RVJ.mjs';var s=class extends o{state;element;mrakomor;constructor(t){super(t);let{state:e,observeDOMChanges:n=true}=t??{};this.state=e,this.element=null,this.mrakomor=j$1(a),this._stale=false,this._observer=null,this._offInputStale=null,this._onInputMarkStale=null,this._observeDOMChanges=n;}static get NAMESPACE(){return "namespace.AbstractComponent"}static getStateSchema(){return a$1.object({component:a$1.string().default(this.NAMESPACE),properties:a$1.object().default({}),settings:a$1.object().default({})}).default({})}static getPropsSchema(){return a$1.object({state:this.getStateSchema(),observeDOMChanges:a$1.boolean().default(true)}).default({})}parseFromHTML(t){return this.constructor.getStateSchema(t).parse()}getState(){if(this._stale){let t=this.element;return this.parseFromHTML(t)}return this.state.peek()}isStale(){return this._stale}#t(){this._stale=true;}onMount(){!this.element||!this._observeDOMChanges||(this._observer=new MutationObserver(()=>{this.#t();}),this._observer.observe(this.element,{subtree:true,characterData:true,characterDataOldValue:true,childList:true,attributes:true,attributeOldValue:true}),this._onInputMarkStale=t=>{let e=t.target;e instanceof Node&&this.element?.contains(e)&&this.#t();},this.mrakomor?.emitter&&(this._offInputStale=this.mrakomor.emitter.on(a$2.INPUT,this._onInputMarkStale)));}onUnmount(){this._observer&&(this._observer.disconnect(),this._observer=null),this._offInputStale?.(),this._offInputStale=null,this._onInputMarkStale=null,this._stale=false;}};var c=class extends s{static get NAMESPACE(){return "namespace.block.BlockComponent"}static get LABEL(){return ""}static get KEYWORDS(){return []}static get GROUP(){return "blocks"}isAtomic(){return false}setCursor(t){let e=()=>{if(!this.element?.isConnected)return;let n=typeof t=="number"?t:j(this.getState()?.properties?.text).length;r(this.element,n);};e(),m(e);}onKeydown(t){}getFormattingTarget(t){return null}};export{c as a};
@@ -1,2 +0,0 @@
1
- import {a}from'./chunk-P6HMUYFA.mjs';import {d,a as a$3,b}from'./chunk-WX7ESURF.mjs';import {a as a$2}from'./chunk-P7IKAZYZ.mjs';import {a as a$1,u,n as n$1,j,v,s}from'./chunk-JFLCNBDM.mjs';import {d as d$1}from'./chunk-XQCH2FNS.mjs';import {n as n$2,a as a$4}from'./chunk-ZDZQ2RVJ.mjs';(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/paragraph/Paragraph.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(a){return a.getAttribute("data-mrakomor-css-path")===e});if(!t){var r=document.createElement("style");r.setAttribute("data-mrakomor-css",""),r.setAttribute("data-mrakomor-css-path",e),r.textContent=`.mrakomor-content p{margin-top:0}
2
- `,document.head.appendChild(r);}}})();var n=class e extends a{static get NAMESPACE(){return a$1}static get LABEL(){return "P"}static get KEYWORDS(){return ["p","paragraph","text"]}getInlineStyleComponents(){return this.props?.inlineStyles?.get()??this.mrakomor.getConfig()?.inlineStyles??[]}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}static getStateSchema(t){return d(t,{component:e.NAMESPACE,properties:{entityRanges:a$2.array(b()).default([]),inlineStyleRanges:a$2.array(a$3()).default([]),text:a$2.string().default(t?.innerText??t?.textContent??"")}})}parseFromHTML(t){return u(this,t)}_buildContent(t){return n$1(t,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}render(){let t=this.constructor.NAMESPACE.toLowerCase().replaceAll(".","-");return n$2("p",{className:t,"data-componentid":this.state.peek().componentId,contentEditable:true,[d$1]:true,$ref:r=>{this.element=r;},$dangerouslySetInnerHTML:()=>{let r=this.state.get(),a=r.properties?.text??"";return j(a)?a$4(()=>this._buildContent(r)):"<br>"}})}getFormattingTarget(t){return v(this.element)}onKeydown(t){s(this,t);}};function L(){return {resolveConfig:e=>(e.blockComponents.push(n),e),resolveComponent:e=>{if(e===n.NAMESPACE)return n}}}export{n as a,L as b};
@@ -1 +0,0 @@
1
- import {r,a as a$1,j as j$1,p,l,k,n as n$1,o}from'./chunk-JFLCNBDM.mjs';import {a,n}from'./chunk-XQCH2FNS.mjs';function M(e){if(e?.nodeName==="OL")return "ORDERED";if(e?.nodeName==="UL")return "UNORDERED"}function O(e=[]){let n=new Set;return e.map(t=>{if(t?.componentId&&!n.has(t.componentId))return n.add(t.componentId),t;let r=a();return n.add(r),{...t,componentId:r}})}function P(e,n){if(!e||!n)return null;let t=n.startContainer;for(t.nodeType===Node.TEXT_NODE&&(t=t.parentElement);t&&t!==e;){if(t.nodeName==="LI"&&e.contains(t))return t;t=t.parentElement;}return null}function U(e,n){if(!n)return -1;let t=n.getAttribute?.("data-item-index");if(t!=null&&t!==""){let r=Number(t);if(!Number.isNaN(r))return r}return [...e.querySelectorAll("li")].indexOf(n)}function F(e,n$1){return !e||!n$1?0:n(e,n$1.startContainer,n$1.startOffset)}function q(e,n){let t={properties:{text:e.text??"",inlineStyleRanges:e.inlineStyleRanges??[],entityRanges:e.entityRanges??[]}},{originalLineState:r$1,newLineState:s}=r(t,n);return {before:{componentId:e.componentId,depth:e.depth??0,text:r$1.properties.text,inlineStyleRanges:r$1.properties.inlineStyleRanges??[],entityRanges:r$1.properties.entityRanges??[]},after:{componentId:a(),depth:e.depth??0,text:s.properties.text,inlineStyleRanges:s.properties.inlineStyleRanges??[],entityRanges:s.properties.entityRanges??[]}}}function H(e,n){let t=e.properties?.items??[],r=t[n];if(!r)return {blocks:[e],paragraphIndex:0};let s=t.slice(0,n),i=t.slice(n+1),l={component:a$1,componentId:a(),properties:{text:r.text??"",inlineStyleRanges:r.inlineStyleRanges??[],entityRanges:r.entityRanges??[]},settings:{}},o=[];return s.length&&o.push({...e,properties:{...e.properties,items:s}}),o.push(l),i.length&&o.push({...e,componentId:s.length?a():e.componentId,properties:{...e.properties,items:i}}),{blocks:o,paragraphIndex:s.length?1:0}}function C(e){return l(e)?e.settings?.style==="ORDERED"?"ORDERED":"UNORDERED":null}function T(e,n){let t=C(e),r=C(n);return t!=null&&t===r}function _(e,n,t){if(n<0||t!==n+1||t>=e.length)return null;let r=e[n],s=e[t];if(!T(r,s))return null;let i=[...r.properties?.items??[]],l=[...s.properties?.items??[]];if(l.length===0){let a=[...e];a.splice(t,1);let p=i.length-1,c=p>=0?j$1(i[p]?.text).length:0;return {content:a,listIndex:n,cursor:c}}let[o,...g]=l,u=0;if(i.length===0)i.push(o,...g),u=0;else {let a=i.length-1,p$1=i[a],c={properties:{text:p$1.text??"",inlineStyleRanges:p$1.inlineStyleRanges??[],entityRanges:p$1.entityRanges??[]}},d={properties:{text:o.text??"",inlineStyleRanges:o.inlineStyleRanges??[],entityRanges:o.entityRanges??[]}},{state:x,cursor:D}=p(c,d);i[a]={...p$1,text:x.properties.text,inlineStyleRanges:x.properties.inlineStyleRanges,entityRanges:x.properties.entityRanges},g.length&&i.push(...g),u=D;}let R={...r,properties:{...r.properties,items:O(i)}},y=[...e];return y[n]=R,y.splice(t,1),{content:y,listIndex:n,cursor:u}}function j(e,n,t){if(n<0||t!==n+1||t>=e.length)return null;let r=e[n],s=e[t];if(!l(r)||!k(s))return null;let i=r.properties?.items??[],l$1=i.length-1;if(l$1<0)return null;let o=i[l$1],g={properties:{text:o.text??"",inlineStyleRanges:o.inlineStyleRanges??[],entityRanges:o.entityRanges??[]}},u={properties:{text:s.properties?.text??"",inlineStyleRanges:s.properties?.inlineStyleRanges??[],entityRanges:s.properties?.entityRanges??[]}},{state:R,cursor:y}=p(g,u),a={...r,properties:{...r.properties,items:i.map((c,d)=>d===l$1?{...c,text:R.properties.text,inlineStyleRanges:R.properties.inlineStyleRanges,entityRanges:R.properties.entityRanges}:c)}},p$1=[...e];return p$1[n]=a,p$1.splice(t,1),{content:p$1,listIndex:n,cursor:y}}function z(e,n){return n$1({properties:{text:e?.text??"",inlineStyleRanges:e?.inlineStyleRanges??[],entityRanges:e?.entityRanges??[]}},n)}function G(e,n){let t=Number(e.getAttribute("data-depth")??0)||0,r={properties:{text:j$1(e.innerText??e.textContent??""),inlineStyleRanges:[],entityRanges:[]}};return o(e.childNodes,r,0,n),{componentId:e.getAttribute("data-componentid")||void 0,depth:t,text:j$1(r.properties.text),inlineStyleRanges:r.properties.inlineStyleRanges,entityRanges:r.properties.entityRanges}}export{M as a,O as b,P as c,U as d,F as e,q as f,H as g,_ as h,j as i,z as j,G as k};
@@ -1 +0,0 @@
1
- import {f as f$1}from'./chunk-ZDZQ2RVJ.mjs';var g=m(),C=m(),R=m(),k=Array.from({length:256},(t,e)=>(e<=15?"0":"")+e.toString(16));function m(){return Math.floor(Math.random()*16777215)}function I(){return C=(C+1)%16777215,C}function H(){let t=Math.floor(Date.now()/1e3);t=parseInt(t,10)%4294967295;let e=I(),n=String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,t&255,g>>16&255,g>>8&255,g&255,R>>8&255,R&255,e>>16&255,e>>8&255,e&255),o="";for(let l=0;l<n.length;l++)o+=k[n.charCodeAt(l)];return o}var E=Symbol("block-element"),M=Symbol("block-element-body"),O=Symbol("selectable-element");function h(t,e){let n=t;for(n?.nodeType===Node.TEXT_NODE&&(n=n.parentElement);n&&n[e]===void 0;)n=n.parentElement;return n??null}function T(t){return t?h(t.startContainer,E):null}function b(t){return h(t,E)}function y(t){return t?h(t.startContainer,O):null}function B(t){return h(t,O)}function x(){return window.getSelection()}function N(){let t=x();return t.rangeCount>0?t.getRangeAt(0).cloneRange():null}function X(){let t=N();if(!t)return 0;t.collapse(true);let e=y(t),n=T(t),o=e??s(n);return d(o,t.startContainer,t.startOffset)}var f=null;function v(){f=A();}function _(){f&&D(f);}function W(){f&&(f={start:f.end,end:f.end,element:f.element},_());}function w(t,e){let n=y(e);return n||(s(t)??t?.childNodes?.[0]??null)}function d(t,e,n){if(!t)return 0;if(e===t){if(e.nodeType===Node.TEXT_NODE)return n;let c=0,u=t.childNodes,a=Math.min(n,u.length);for(let i=0;i<a;i++)c+=u[i].textContent.length;return c}if(e.nodeType===Node.ELEMENT_NODE&&!t.contains(e))return 0;let o=0,l=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),r=l.nextNode();for(;r;){if(r===e)return o+n;o+=r.textContent.length,r=l.nextNode();}return o}function A(){let t=N();if(!t)return null;let e=T(t),n=w(e,t);return {start:d(n,t.startContainer,t.startOffset),end:d(n,t.endContainer,t.endOffset),element:e,selectableElement:n}}function j(t=N()){if(!t||t.collapsed)return null;let e=b(t.startContainer),n=b(t.endContainer);if(!e||!n)return null;let o=B(t.startContainer)??s(e),l=B(t.endContainer)??s(n);return {startBlock:e,endBlock:n,startOffset:d(o,t.startContainer,t.startOffset),endOffset:d(l,t.endContainer,t.endOffset)}}function D(t){if(!t)return;let{start:e,end:n,element:o,selectableElement:l}=t,r=l?.isConnected&&l||s(o)||o?.childNodes?.[0];if(!r)return;let c=S(r,e),u=S(r,n),a=document.createRange();a.setStart(c.startContainer,c.startOffset),a.setEnd(u.endContainer,u.endOffset);let i=x();i.removeAllRanges(),i.addRange(a);}function S(t,e){let n=document.createRange();if(!t)return n;if(e<=0)return n.setStart(t,0),n.collapse(true),n;let o=0,l=[t];for(;l.length>0;){let r=l.pop();if(r.nodeType===Node.TEXT_NODE){let c=r.textContent.length;if(o+c>=e)return n.setEnd(r,e-o),n.setStart(r,e-o),n;o+=c;}else if(r.childNodes&&r.childNodes.length>0)for(let c=r.childNodes.length-1;c>=0;c--)l.push(r.childNodes[c]);}return n.setEnd(t,t.childNodes.length),n.setStart(t,t.childNodes.length),n}function K(t,e){let n=S(t,e),o=x();o.removeAllRanges(),o.addRange(n);}function s(t){if(!t)return null;let e=L(t);return e?.firstElementChild??e?.firstChild}function F(t){if(!t?.[E])return null;let e=s(t);return e?f$1(e)?.classInstance:null}function L(t){if(!t)return null;for(let e of t.children)if(e[M])return e;return null}function Y(t,e,n,o=12){let l=t.getBoundingClientRect(),r=typeof e?.getBoundingClientRect=="function"?e.getBoundingClientRect():e??{left:0,top:0},c=n?.offsetHeight??40;return {x:r.left-l.left,y:r.top-l.top-c-o}}function q(t,e){let n=t.getBoundingClientRect(),o=e?.offsetWidth??420,l=e?.offsetHeight??320,r=16;return {x:Math.max(r,(n.width-o)/2),y:Math.max(r,(n.height-l)/2)}}export{H as a,E as b,M as c,O as d,T as e,b as f,y as g,B as h,N as i,X as j,v as k,_ as l,W as m,d as n,A as o,j as p,D as q,K as r,s,F as t,L as u,Y as v,q as w};
@@ -1,2 +0,0 @@
1
- import {a as a$1}from'./chunk-P6HMUYFA.mjs';import {d}from'./chunk-WX7ESURF.mjs';import {a as a$2}from'./chunk-P7IKAZYZ.mjs';import {j,s as s$1,a as a$4,e,f as f$1,g,h,i as i$2}from'./chunk-JFLCNBDM.mjs';import {d as d$1,i as i$1,f,s as s$2,r}from'./chunk-XQCH2FNS.mjs';import {n,a as a$3,m}from'./chunk-ZDZQ2RVJ.mjs';(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/headline/Headline.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(n){return n.getAttribute("data-mrakomor-css-path")===e});if(!t){var r=document.createElement("style");r.setAttribute("data-mrakomor-css",""),r.setAttribute("data-mrakomor-css-path",e),r.textContent=`.mrakomor-content h1,.mrakomor-content h2,.mrakomor-content h3,.mrakomor-content h4,.mrakomor-content h5{margin-top:0}
2
- `,document.head.appendChild(r);}}})();var o=class extends a$1{constructor(t){super(t),this._level=1;}static getStateSchema(t){return d(t,{component:this.NAMESPACE,properties:{text:a$2.string().default(t?.textContent??t?.innerText??"")}})}parseFromHTML(t){if(!t)return this.constructor.getStateSchema(t).parse();let r=structuredClone(this.constructor.getStateSchema(t).parse());return r.properties.text=j(r.properties.text),r}_buildContent(t){return t.properties?.text??""}render(){let t=this.constructor.NAMESPACE.toLowerCase().replaceAll(".","-");return n(`h${this._level}`,{className:t,"data-componentid":this.state.peek().componentId,contentEditable:true,[d$1]:true,$ref:r=>{this.element=r;},$dangerouslySetInnerHTML:()=>{let r=this.state.get(),n=r.properties?.text??"";return j(n)?a$3(()=>this._buildContent(r)):"<br>"}})}onKeydown(t){if(t.key==="Backspace"){this.#t(t);return}s$1(this,t,{namespace:a$4});}#t(t){if(!i$1()?.collapsed)return;let n=f(this.element);if(n?.previousElementSibling||j(this.getState()?.properties?.text))return;t.preventDefault(),this.mrakomor.command.transformBlockElement({blockElement:n,namespace:a$4});let l=()=>{let b=this.mrakomor.getRoot()?.querySelector(".mrakomor-content .mrakomor-block-element"),p=s$2(b);p?.isConnected&&r(p,0);};l(),m(l);}},s=class extends o{static get NAMESPACE(){return e}static get LABEL(){return "H1"}static get KEYWORDS(){return ["h1","title","heading"]}constructor(t){super(t),this._level=1;}},c=class extends o{static get NAMESPACE(){return f$1}static get LABEL(){return "H2"}static get KEYWORDS(){return ["h2","heading"]}constructor(t){super(t),this._level=2;}},i=class extends o{static get NAMESPACE(){return g}static get LABEL(){return "H3"}static get KEYWORDS(){return ["h3","heading"]}constructor(t){super(t),this._level=3;}},a=class extends o{static get NAMESPACE(){return h}static get LABEL(){return "H4"}static get KEYWORDS(){return ["h4","heading"]}constructor(t){super(t),this._level=4;}},u=class extends o{static get NAMESPACE(){return i$2}static get LABEL(){return "H5"}static get KEYWORDS(){return ["h5","heading"]}constructor(t){super(t),this._level=5;}};function w(){return {resolveConfig:e=>(e.blockComponents.push(s,c,i,a,u),e),resolveComponent:e=>{if(e===s.NAMESPACE)return s;if(e===c.NAMESPACE)return c;if(e===i.NAMESPACE)return i;if(e===a.NAMESPACE)return a;if(e===u.NAMESPACE)return u}}}export{o as a,w as b};
@@ -1 +0,0 @@
1
- var ie=class{next(...e){}error(...e){}complete(...e){}},X=class{#e=new Set;pipe(...e){return e.reduce((t,n)=>n(t),this)}next(...e){Array.from(this.#e).forEach(t=>{typeof t=="function"?t(...e):t.next(...e);});}error(...e){Array.from(this.#e).forEach(t=>{t?.error?.(...e),this.unsubscribe(t);});}complete(...e){Array.from(this.#e).forEach(t=>{t?.complete?.(...e),this.unsubscribe(t);});}subscribe(e){return this.#e.add(e),{unsubscribe:()=>{this.unsubscribe(e);}}}unsubscribe(e){this.#e.delete(e);}};var D=Symbol("@esmj/signals:type"),j=Symbol("@esmj/signals:name");var h=null,W=false,Y=[];function k(e){let t=h;h=null;let n=e();return h=t,n}function qe(){W=false;let e=ce();for(let n of e)n.get();let t=Y;Y=[];for(let n of t)n();}function ue(){W||(W=true,queueMicrotask(qe));}function G(e){Y.push(e),ue();}var le=Symbol("@esmj/signals:internal observable"),y=Symbol("@esmj/signals:original function"),De=class extends X{#e=new Set;#r=null;constructor(e){super(),this.#r=e,this.pipe(t=>{let n=t.subscribe.bind(t),r=t.unsubscribe.bind(t);return t.subscribe=s=>{n(s),this.#e.add(s);},t.unsubscribe=s=>{r(s),this.#e.delete(s);},t});}watch(e){if(typeof e.next!="function"&&(e.next=()=>k(()=>{this.#e.add(e),this.#r();}),e.next[y]=void 0),e instanceof he&&e.next[y]===void 0){let t=e.next.bind(e);e.next=()=>k(()=>{this.#e.add(e),t(),this.#r();}),e.next[y]=t;}return this.subscribe(e)}getPending(){let e=[];for(let t of this.#e){if(!t.get[y]){let n=t.get,r=n.bind(t);t.get=()=>k(()=>(this.#e.delete(t),r())),t.get[y]=n;}e.push(t);}return e}unwatch(e){return e.next=e.next[y]?e.next[y]:e.next,e.get=e.get[y]?e.get[y]:e.get,this.#e.delete(e),this.unsubscribe(e)}},P=null;function ae(e){P=new De(e);}ae(()=>{ue();});function ce(){return P.getPending()}function fe(e){return P.watch(e)}function de(e){return P.unwatch(e)}var b=Symbol("@esmj/signals:no error"),he=class pe extends ie{#e=true;#r=false;#n=null;#s=this.#d();#a=null;#l=null;#i=0;#o=new Map;#t=b;constructor(t,n){super(),this.#a=t,this.#l=n,this.debug=n?.debug,this[D]="computed",this[j]=n?.debug??null,this.get=this.get.bind(this);}#c(){for(let{unsubscribe:t}of this.#s.dependencies.values())t();this.#s.dependencies.clear();}#d(){return {dependencies:new Map,sourceRevisions:new Map,observer:this}}getRevision(){return this.#i}getDebugInfo(){return {name:this[j],dirty:this.#e,revision:this.#i,sourceDependencies:[...this.#o.keys()]}}#f(){for(let[t,n]of this.#o)if(t instanceof pe&&k(()=>t.get()),t.getRevision()!==n)return true;return false}next(){this.#e=true,this.#n[le].next();}get(){if(this.#r)throw new Error("Cycle detected in computed signal");if(this.#n||(this.#n=v(this.#u(),this.#l)),(this.#e||this.#t!==b)&&(this.#o.size===0||this.#f()?this.#u():this.#e=false),h&&h.sourceRevisions.set(this,this.#i),this.#t!==b)throw this.#t;return this.#n.get()}peek(){if(this.#n||(this.#n=v(this.#u(),this.#l)),(this.#e||this.#t!==b)&&(this.#o.size===0||this.#f()?this.#u():this.#e=false),this.#t!==b)throw this.#t;return this.#n.peek()}#u(){this.#r=true,this.#e=false,this.#t=b,this.#c(),this.#s.sourceRevisions.clear();let t=h;h=this.#s;let n;try{n=this.#a();}catch(r){this.#t=r;}return h=t,this.#o=this.#s.sourceRevisions,this.#s.sourceRevisions=new Map,this.#r=false,n instanceof Promise&&(n=n.then(r=>{this.#t=b,this.#n.set(r);}).catch(r=>{this.#t=r;})),this.#t===b&&this.#n&&this.#n.set(n),this.#i++,n}destroy(){this.#c(),this.#o.clear(),this.#e=true,this.#t=b;}};function C(e,t){return new he(e,t)}function g(e,t){let n,{debug:r,...s}={},o=C(()=>{n?.(),n=e();},{equals:()=>false,...s});o.get(),fe(o);let i=()=>{n?.(),o.destroy(),de(o);};return i[Symbol.dispose]=i,i[D]="effect",i[j]=r??null,i.__RX_COMPUTED__=o,i}function v(e,t={}){let n=t?.equals??Object.is,r=0,s=new X;function o(){return h&&(h.dependencies.set(s,s.subscribe(h.observer)),h.sourceRevisions.set(c,r)),e}function i(){return e}function u(f){if(!n(e,f)){e=f,r++,s.next();}return e}function l(){return r}let c={get:o,set:u,peek:i,getRevision:l,[le]:s,[D]:"signal",[j]:t?.debug??null};return c}function R(){return Date.now().toString(32).substring(5)+Math.random().toString(32).substring(2)}var ve=Symbol("node-component"),F=Symbol("node-internal"),Ce=Symbol("keep-literal");function Pe(e){let t=()=>e;return t[Ce]=true,t}function Fe(e){let t=null,n=()=>t,r=o=>(t=o??null,typeof e=="function"&&e(t),t),s={get:n,set:r,[Symbol.toPrimitive](){return t?String(t):""}};return Object.defineProperty(s,"current",{get(){return t},set(o){r(o);},enumerable:true,configurable:false}),new Proxy(s,{get(o,i,u){if(Reflect.has(o,i))return Reflect.get(o,i,u);if(!t)return;let l=t[i];return typeof l=="function"?l.bind(t):l},set(o,i,u,l){return Reflect.has(o,i)||!t?Reflect.set(o,i,u,l):(t[i]=u,true)},has(o,i){return Reflect.has(o,i)||!!t&&i in t}})}var ke=null;function m(){return ke}function I(e){ke=e;}function Ne(e){return e?.[ve]||null}function ge(e,t){e[ve]=t;}function _(e,t={disposers:[],id:R()}){return e?.[F]?e[F]:(e&&(e[F]=t),t)}function Ie(e){return e[F]}function w(e,t){let n=Ie(e);n||(n=_(e)),n.disposers.push(t);}function T(e,t,n){e.has(t)||e.set(t,[]),e.get(t).push(n);}function x(e,t){let n=m();I(e);try{return t()}finally{I(n);}}var U=new Map,$=new Map,me=new Map;function Me(e){let t=Object.create(null);for(let n of Object.keys(e)){let r=e[n];n==="children"?t[n]=r:r?.[Ce]?t[n]=r():r!=null&&typeof r.get=="function"?t[n]=r:typeof r=="function"?t[n]=C(r):t[n]=v(r);}return t}function B(e,t){if(e===t)return true;if(e==null||t==null||typeof e!="object"||typeof t!="object")return false;let n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?false:n.every(s=>{let o=Object.getOwnPropertyDescriptor(e,s),i=Object.getOwnPropertyDescriptor(t,s);if(!o||!i)return false;let u="value"in o?o.value:o.get?.call(e),l="value"in i?i.value:i.get?.call(t);return B(u,l)})}function _e(e){return {id:Symbol("context-id"),defaultValue:e}}function Ue(e,t){let n=m();n&&n.contexts.set(e.id,t);}function Be(e){let t=m();return t?.contexts?.has(e.id)?t.contexts.get(e.id):e.defaultValue}function He(e){let t=m();if(!t){console.warn("onMount called outside of a component context");return}T(U,t.id,e);}function ze(e){let t=m();if(!t){console.warn("onUnmount called outside of a component context");return}T($,t.id,e);}function Ve(e){G(()=>{setTimeout(e,0);});}function A(e){let t=e.componentId,n=U.get(t);if(n){U.delete(t);for(let r of n){let s=r();typeof s=="function"&&T($,t,s);}}}function Xe(e){let t=$.get(e);if(t){$.delete(e);for(let n of t)n();}}function We(e){let t=me.get(e);if(t){me.delete(e);for(let n of t)n();}}function L(e){if(!e)return;let t=_(e);if(t?.disposers?.length){for(let r of t.disposers)try{r();}catch(s){console.error("[esmj-dom] cleanupTree: disposer threw, cleanup continues",s);}t.disposers=[];}let n=Ne(e);if(n&&(Xe(n.componentId),We(n.componentId)),e.childNodes){let r=e.firstChild;for(;r;){let s=r.nextSibling;L(r),r=s;}}}function N(e){return e!=null&&typeof e=="object"&&typeof e.$constructor=="function"}function Ye(e){return typeof e=="function"&&typeof e.prototype?.render=="function"}function Ge(e,t,n){let r=R(),s={componentId:r,$children:n,element:null,classInstance:null,$constructor(){let o={...Me(t??{}),children:n},i=m(),u={disposers:[],id:r,contexts:new Map(i?.contexts)};I(u);let l;if(Ye(e)){s.ClassConstructor=e;let f=new e(o);s.classInstance=f,typeof f.onMount=="function"&&T(U,r,()=>{f.onMount?.();}),typeof f.onUnmount=="function"&&T($,r,()=>{f.onUnmount?.();}),l=f.render();}else l=e(o);I(i);let c=Je(l);if(s.element=c,c instanceof DocumentFragment&&c.childNodes.length)for(let f of c.childNodes)_(f,u),ge(f,s);else _(c,u),c instanceof Node&&ge(c,s);return c}};return s}function Z(e,t){let n=t.$constructor();n instanceof Node&&e.appendChild(n),queueMicrotask(()=>{A(t);});}function Je(e){return e instanceof Node?e:N(e)?e.$constructor():typeof e=="string"||typeof e=="number"?document.createTextNode(String(e)):document.createTextNode("")}var ye={className:"class",htmlFor:"for"},be=new Set(["value","defaultValue","checked","selected","indeterminate"]),Ke=new Set(["srcdoc"]),Ze=new Set(["href","src","action","formaction","xlink:href"]),Qe=new Set(["securitypolicyviolation"]),et=new Set(["contenteditable","draggable","spellcheck"]);function O(e){return e!=null&&typeof e=="object"&&typeof e.get=="function"&&!(e instanceof Node)}var je=Symbol("Fragment");function tt(e,t,n){if(e===je){let s=document.createDocumentFragment();return K(s,xe(n)),s}if(typeof e=="function")return Ge(e,t||{},n);typeof e!="string"&&(n=t,t=e,e="div"),t=t||{};let r=document.createElement(e);return t.id&&r.setAttribute("id",t.id),ot(r,t),K(r,xe(n)),r}function J(e,t){t instanceof DocumentFragment?e.replaceChildren(t):e.innerHTML=t??"";}function nt(e){return typeof e!="string"?false:e.replace(/[\p{White_Space}\p{Cc}]+/gu,"").toLowerCase().startsWith("javascript:")}function rt(e,t){if(typeof e!="string")return false;let n=e.toLowerCase();return Ke.has(n)?true:Ze.has(n)&&t!==null&&t!==void 0&&nt(String(t))}function Ee(e){return typeof e!="string"?e:ye[e]?ye[e]:e}function st(e,t){let n=Ee(e),r=typeof n=="string"?n.toLowerCase():String(n).toLowerCase();return et.has(r)&&(t===true||t===false||t==="true"||t==="false")?String(t):t==null||t===false?null:t}function we(e,t,n){let r=st(t,n);if(r===null){e.removeAttribute(t);return}if(rt(t,r)){e.removeAttribute(t),console.warn(`[esmj-dom] Blocked unsafe attribute "${String(t)}" on <${e.tagName.toLowerCase()}>`);return}e.setAttribute(t,r);}function ot(e,t){let n=m();for(let[r,s]of Reflect.ownKeys(t).map(o=>[o,t[o]]))if(r!=="id"){if(r=Ee(r),r==="$ref"){typeof s=="function"?s(e):typeof s=="object"&&s!==null&&(s.current=e);continue}if(r==="$dangerouslySetInnerHTML"){if(O(s)){let o=g(()=>{x(n,()=>{J(e,s.get());});});w(e,o);}else if(typeof s=="function"){let o=g(()=>{x(n,()=>{J(e,s());});});w(e,o);}else J(e,s);continue}if(r==="style"){if(O(s)){let o=g(()=>{x(n,()=>{Object.assign(e.style,s.get());});});w(e,o);}else typeof s=="object"&&s!==null?Object.assign(e.style,s):e.setAttribute("style",s);continue}if(typeof r=="string"&&r.startsWith("on")&&typeof s=="function"){let o=r.slice(2).toLowerCase();if(Qe.has(o)){console.warn(`[esmj-dom] Blocked unsafe event binding "${r}" on <${e.tagName.toLowerCase()}>`);continue}e.addEventListener(o,s);continue}if(O(s)||typeof s=="function"){let o=r,i=g(()=>{x(n,()=>{let u=typeof s=="function"?s():s.get();be.has(o)?e[o]=u??"":we(e,o,u);});});w(e,i);continue}be.has(r)||typeof r=="symbol"?e[r]=s??"":we(e,r,s);}}function xe(e){return e==null?[]:Array.isArray(e)?e.flat(Number.POSITIVE_INFINITY):[e]}function K(e,t){for(let n of t)Re(e,n);}function Re(e,t){if(!(t==null||t===false||t===true)){if(t instanceof Node){e.appendChild(t);return}if(typeof t=="string"||typeof t=="number"){e.appendChild(document.createTextNode(String(t)));return}if(typeof t=="function"){Se(e,t);return}if(N(t)){Z(e,t);return}if(O(t)){Se(e,()=>t.get());return}if(Array.isArray(t)){K(e,t);return}e.appendChild(document.createTextNode(String(t)));}}function Q(e){let t=null,n=e;return N(e)&&(t=e,n=e.$constructor()),n instanceof DocumentFragment?{nodes:Array.from(n.childNodes),instance:t}:n instanceof Node?{nodes:[n],instance:t}:n==null||n===false||n===true?{nodes:[],instance:t}:{nodes:[document.createTextNode(String(n))],instance:t}}function ee(e,t=true){for(let n of e)t&&L(n),n.remove();}function Se(e,t){let n=m(),r=document.createComment("");e.appendChild(r);let s=[],o=g(()=>{x(n,()=>{let i=t(),{nodes:u,instance:l}=Q(i);ee(s),u.length&&r.after(...u),l&&queueMicrotask(()=>A(l)),s=u;});});w(e,o);}var jt=class{constructor(e){this.props=e;}};function Et(e,t,n,r){let{equals:s=B}=r??{},o=document.createElement("span");o.style.display="contents",o.setAttribute("data-each",R());let i=m(),u=[],l=new Map,c=C(()=>e()),f=g(()=>{let q=c.get(),H=[],te=[],ne=new Set;for(let a=0;a<q.length;a++){let d=q[a],p=t(d,a);if(ne.has(p)){console.error(`Each: duplicate key "${String(p)}" detected; ignoring later item at index ${a}`);continue}ne.add(p),H.push(d),te.push(p);}let z=new Map(u.map(a=>[a.key,a])),M=[];for(let a=0;a<H.length;a++){let d=te[a],p=H[a],S=z.get(d);if(S)l.get(d).set(p),M.push(S),z.delete(d);else {let re=v(p,{equals:s});l.set(d,re);let Oe={...re,set(){}},se={key:d,nodes:[]};x(i,()=>{let Te=n(Oe,a),{nodes:$e,instance:oe}=Q(Te);se.nodes=$e,oe&&queueMicrotask(()=>A(oe));}),M.push(se);}}for(let[a,d]of z)ee(d.nodes),l.delete(a);let V=null;for(let a=M.length-1;a>=0;a--){let d=M[a].nodes;for(let p=d.length-1;p>=0;p--){let S=d[p];(S.parentNode!==o||S.nextSibling!==V)&&o.insertBefore(S,V),V=S;}}u=M;});return w(o,f),o}function Rt(e,t){if(typeof e=="string"&&(e=document.querySelector(e)),!e)throw new Error("mount: container not found");e instanceof DocumentFragment||(L(e),e.innerHTML=""),N(t)?Z(e,t):t instanceof Node?e.appendChild(t):e.appendChild(document.createTextNode(String(t)));}function Ot(e){if(typeof e=="string"&&(e=document.querySelector(e)),!e)throw new Error("unmount: container not found");L(e),e.innerHTML="";}function Tt(e,t){let n=null;if(N(t)?(n=t.$constructor(),queueMicrotask(()=>A(t))):t instanceof Node?n=t:n=document.createTextNode(String(t)),n instanceof HTMLElement){let r=C(()=>!!e()),s=g(()=>{n.style.display=r.get()?"":"none";});w(n,s);}return n}export{k as a,C as b,v as c,Pe as d,Fe as e,Ne as f,B as g,_e as h,Ue as i,Be as j,He as k,ze as l,Ve as m,tt as n,jt as o,Et as p,Rt as q,Ot as r,Tt as s};