wysimark-lite 0.25.31 → 0.25.32

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.
package/dist/index.js CHANGED
@@ -5,7 +5,8 @@
5
5
 
6
6
  `}function yn(e){return e.url}function kn(e){if(e.url.startsWith("$"))return"";let{hostname:t}=Ne(e.url);if(t.match(/[.]portive[.]com$/i)&&e.width&&e.height)return`${e.url}?size=${e.width}x${e.height}`}function vn(e){if(e.width&&e.height&&e.srcWidth&&e.srcHeight)return`${e.url}#srcSize=${e.srcWidth}x${e.srcHeight}&size=${e.width}x${e.height}`}var cd=[kn,vn,yn];function Pt(e){for(let t of cd){let o=t(e);if(typeof o=="string")return o===""?"":`![${e.alt}](${o}${typeof e.title=="string"?` "${e.title}"`:""})`}throw new Error("Shouldn't get here")}function Tn(e){let t=Pt(e);return t?`${t}
7
7
 
8
- `:""}import{Element as hd,Text as gd}from"slate";function wn(e,t){let o=t.filter(n=>!e.includes(n));return{orderedMarksToAdd:jr(o)}}function In(e,t){let o=[...e],r=e.filter(i=>!t.includes(i)),n=[];for(let i=0;i<e.length&&r.length!==0;i++){let a=o.pop();if(a===void 0)throw new Error("This shouldn't happen unless we made a mistake in the algorithm");n.push(a);let l=r.indexOf(a);l!==-1&&r.splice(l,1)}return{orderedMarksToRemove:n,nextOrderedMarks:o}}function Co(e,t){let{orderedMarksToRemove:o,nextOrderedMarks:r}=In(e,t),{orderedMarksToAdd:n}=wn(r,t);return{remove:o,add:n,nextOrderedMarks:[...r,...n]}}import{Element as dd}from"slate";function Mn({node:e,nextNode:t,nodes:o,index:r}){return!U(e)||!z(e)||e.code||!U(t)||!z(t)||t.code?!1:(o.splice(r,2,{text:`${e.text}${t.text}`}),!0)}function Pn({node:e,nodes:t,prevNode:o,index:r}){if(!re(e)||e.type!=="anchor")return!1;let n=e.children[0];return U(n)&&z(n)?(e.children.splice(0,1),U(o)&&z(o)?o.text=`${o.text}${n.text}`:t.splice(r,0,{text:n.text}),!0):!1}function Cn({node:e,nodes:t,nextNode:o,index:r}){if(!re(e)||e.type!=="anchor")return!1;let n=e.children[e.children.length-1];return U(n)&&z(n)?(e.children.splice(e.children.length-1,1),U(o)&&z(o)?o.text=`${n.text}${o.text}`:t.splice(r+1,0,{text:n.text}),!0):!1}function Sn({node:e}){return!re(e)||e.type!=="line"||e.children.length>0?!1:(e.children.push({text:""}),!0)}function Rn({node:e,nodes:t,index:o}){if(!U(e)||z(e)||e.code)return!1;let r=e.text.match(/^(\s*)(.*?)(\s*)$/);if(!r||r[1].length===0&&r[3].length===0)return!1;let n=[{text:r[1]},{...e,text:r[2]},{text:r[3]}].filter(i=>i.text!=="");return t.splice(o,1,...n),!0}function Ln({index:e,nodes:t,node:o,parent:r}){return e!==t.length-1||t.length<=1||!U(o)||!z(o)?!1:r&&re(r)&&r.type==="line"?(t.splice(t.length-1,1),!0):!1}function Bn({index:e,nodes:t,node:o,parent:r}){return e!==0||t.length===0||!U(o)||!z(o)?!1:r&&re(r)&&r.type==="line"?(t.splice(0,1),!0):!1}var zn=[Rn,Pn,Cn,Mn,Bn,Ln,Sn];function Dn(e){for(let t of zn)if(t(e))return!0;return!1}var pd=72;function So(e,t){let o=!1,r,n=0,i=(e.length+1)*pd;do{if(r=!1,n=n+1,n>i)throw new Error(`There have been ${n} normalization passes (72x the number of nodes at this level). This likely indicates a bug in the code.`);e:for(let a=0;a<e.length;a++){let l=e[a];if(re(l)&&So(l.children,l)){r=!0,o=!0;break e}let m=e[a-1],s=e[a+1];if(Dn({parent:t,node:l,prevNode:m,nextNode:s,index:a,nodes:e})){r=!0,o=!0;break e}}}while(r);return o}var $n=e=>e.map(t=>dd.isElement(t)&&t.type==="anchor"?{...t,children:$n(t.children)}:t);function Nn(e){let t={type:"line",children:$n(e)};return So([t],void 0),t.children}import{Text as fd}from"slate";function Hn(e){let t=0;for(let o of e.text.matchAll(/[`]+/g))t=Math.max(t,o[0].length);return t===0?`\`${e.text.replace(/[`]/g,"\\`")}\``:`${"`".repeat(t+1)} ${e.text} ${"`".repeat(t+1)}`}function ud(e){return e.replace(/"/g,'\\"')}function An(e){let t=Mo(e.children);return e.href.startsWith("$")?G(e.children,t,t):typeof e.title=="string"&&e.title.length>0?`[${G(e.children,t,t)}](${e.href} "${ud(e.title)}")`:`[${G(e.children,t,t)}](${e.href})`}function On(e){return Yr(e.text)}function Un(e){if(fd.isText(e))return e.code?Hn(e):On(e);switch(e.type){case"anchor":return An(e);case"image-inline":return Pt(e);default:be(e)}}function G(e,t=[],o=[]){let r=Nn(e),n=[],i=Co(t,Io(r[0]));for(let a=0;a<r.length;a++){let l=r[a];if(gd.isText(l)&&z(l)){n.push(l.text);continue}n.push(qr(i.add)),n.push(Un(l));let m=bd(r,a,o),s=Co(i.nextOrderedMarks,m);n.push(Qr(s.remove)),i=s}return n.join("")}function bd(e,t,o){for(let r=t+1;r<e.length;r++){let n=e[r];if(!z(n)&&!(hd.isElement(n)&&n.type==="image-inline"))return Io(n)}return o}function Vn(e){let t=[];return t.push(Fn(e.children[0])),t.push(Ed(e.columns)),e.children.slice(1).forEach(o=>{t.push(Fn(o))}),`${t.join(`
8
+ `:""}import{Element as hd,Text as gd}from"slate";function wn(e,t){let o=t.filter(n=>!e.includes(n));return{orderedMarksToAdd:jr(o)}}function In(e,t){let o=[...e],r=e.filter(i=>!t.includes(i)),n=[];for(let i=0;i<e.length&&r.length!==0;i++){let a=o.pop();if(a===void 0)throw new Error("This shouldn't happen unless we made a mistake in the algorithm");n.push(a);let l=r.indexOf(a);l!==-1&&r.splice(l,1)}return{orderedMarksToRemove:n,nextOrderedMarks:o}}function Co(e,t){let{orderedMarksToRemove:o,nextOrderedMarks:r}=In(e,t),{orderedMarksToAdd:n}=wn(r,t);return{remove:o,add:n,nextOrderedMarks:[...r,...n]}}import{Element as dd}from"slate";function Mn({node:e,nextNode:t,nodes:o,index:r}){return!U(e)||!z(e)||e.code||!U(t)||!z(t)||t.code?!1:(o.splice(r,2,{text:`${e.text}${t.text}`}),!0)}function Pn({node:e,nodes:t,prevNode:o,index:r}){if(!re(e)||e.type!=="anchor")return!1;let n=e.children[0];return U(n)&&z(n)?(e.children.splice(0,1),U(o)&&z(o)?o.text=`${o.text}${n.text}`:t.splice(r,0,{text:n.text}),!0):!1}function Cn({node:e,nodes:t,nextNode:o,index:r}){if(!re(e)||e.type!=="anchor")return!1;let n=e.children[e.children.length-1];return U(n)&&z(n)?(e.children.splice(e.children.length-1,1),U(o)&&z(o)?o.text=`${n.text}${o.text}`:t.splice(r+1,0,{text:n.text}),!0):!1}function Sn({node:e}){return!re(e)||e.type!=="line"||e.children.length>0?!1:(e.children.push({text:""}),!0)}function Rn({node:e,nodes:t,index:o}){if(!U(e)||z(e)||e.code)return!1;let r=e.text.match(/^(\s*)(.*?)(\s*)$/);if(!r||r[1].length===0&&r[3].length===0)return!1;let n=[{text:r[1]},{...e,text:r[2]},{text:r[3]}].filter(i=>i.text!=="");return t.splice(o,1,...n),!0}function Ln({index:e,nodes:t,node:o,parent:r}){return e!==t.length-1||t.length<=1||!U(o)||!z(o)?!1:r&&re(r)&&r.type==="line"?(t.splice(t.length-1,1),!0):!1}function Bn({index:e,nodes:t,node:o,parent:r}){return e!==0||t.length===0||!U(o)||!z(o)?!1:r&&re(r)&&r.type==="line"?(t.splice(0,1),!0):!1}var zn=[Rn,Pn,Cn,Mn,Bn,Ln,Sn];function Dn(e){for(let t of zn)if(t(e))return!0;return!1}var pd=72;function So(e,t){let o=!1,r,n=0,i=(e.length+1)*pd;do{if(r=!1,n=n+1,n>i)throw new Error(`There have been ${n} normalization passes (72x the number of nodes at this level). This likely indicates a bug in the code.`);e:for(let a=0;a<e.length;a++){let l=e[a];if(re(l)&&So(l.children,l)){r=!0,o=!0;break e}let m=e[a-1],s=e[a+1];if(Dn({parent:t,node:l,prevNode:m,nextNode:s,index:a,nodes:e})){r=!0,o=!0;break e}}}while(r);return o}var $n=e=>e.map(t=>dd.isElement(t)&&t.type==="anchor"?{...t,children:$n(t.children)}:t);function Nn(e){let t={type:"line",children:$n(e)};return So([t],void 0),t.children}import{Text as fd}from"slate";function Hn(e){let t=0;for(let o of e.text.matchAll(/[`]+/g))t=Math.max(t,o[0].length);return t===0?`\`${e.text.replace(/[`]/g,"\\`")}\``:`${"`".repeat(t+1)} ${e.text} ${"`".repeat(t+1)}`}function ud(e){return e.replace(/"/g,'\\"')}function An(e){let t=Mo(e.children);return e.href.startsWith("$")?G(e.children,t,t):typeof e.title=="string"&&e.title.length>0?`[${G(e.children,t,t)}](${e.href} "${ud(e.title)}")`:`[${G(e.children,t,t)}](${e.href})`}function On(e){return Yr(e.text).replace(/\n/g,`
9
+ `)}function Un(e){if(fd.isText(e))return e.code?Hn(e):On(e);switch(e.type){case"anchor":return An(e);case"image-inline":return Pt(e);default:be(e)}}function G(e,t=[],o=[]){let r=Nn(e),n=[],i=Co(t,Io(r[0]));for(let a=0;a<r.length;a++){let l=r[a];if(gd.isText(l)&&z(l)){n.push(l.text);continue}n.push(qr(i.add)),n.push(Un(l));let m=bd(r,a,o),s=Co(i.nextOrderedMarks,m);n.push(Qr(s.remove)),i=s}return n.join("")}function bd(e,t,o){for(let r=t+1;r<e.length;r++){let n=e[r];if(!z(n)&&!(hd.isElement(n)&&n.type==="image-inline"))return Io(n)}return o}function Vn(e){let t=[];return t.push(Fn(e.children[0])),t.push(Ed(e.columns)),e.children.slice(1).forEach(o=>{t.push(Fn(o))}),`${t.join(`
9
10
  `)}
10
11
 
11
12
  `}function Ed(e){return e.every(o=>o.align==="left")?`|${e.map(()=>"---").join("|")}|`:`|${e.map(o=>xd(o.align)).join("|")}|`}function xd(e){switch(e){case"left":return":---";case"center":return":---:";case"right":return"---:"}}function Fn(e){return It(e,"table-row"),`|${e.children.map(yd).join("|")}|`}function yd(e){return It(e,"table-cell"),Fr(e.children.length===1,`Expected table-cell to have one child but is ${JSON.stringify(e.children)}`),e.children.map(kd).join("")}function kd(e){return It(e,"table-content"),G(e.children)}var Ro=4;function Kn(e,t){switch(e.type){case"anchor":return`[${G(e.children)}](${e.href})`;case"block-quote":return`${Ct(e.children).split(`
@@ -987,15 +988,6 @@
987
988
 
988
989
  &:not(.--collapsible)&.--empty {
989
990
  min-height: 1em;
990
- border-left: 2px solid rgba(0, 127, 255, 0.15);
991
- border-radius: 0;
992
- margin-left: 2px;
993
- &:hover {
994
- border-left-color: rgba(0, 127, 255, 0.4);
995
- }
996
- &.--selected {
997
- border-left-color: rgba(0, 127, 255, 0.5);
998
- }
999
991
  }
1000
992
 
1001
993
  &.--collapsible&.--empty {
package/dist/index.mjs CHANGED
@@ -1448,7 +1448,8 @@ function serializeAnchor(anchor) {
1448
1448
 
1449
1449
  // src/convert/serialize/serialize-line/segment/serialize-non-code-text.ts
1450
1450
  function serializeNonCodeText(text) {
1451
- return escapeText(text.text);
1451
+ const escaped = escapeText(text.text);
1452
+ return escaped.replace(/\n/g, " \n");
1452
1453
  }
1453
1454
 
1454
1455
  // src/convert/serialize/serialize-line/segment/serialize-segment.ts
@@ -5713,15 +5714,6 @@ var $Paragraph = styled26("p")`
5713
5714
 
5714
5715
  &:not(.--collapsible)&.--empty {
5715
5716
  min-height: 1em;
5716
- border-left: 2px solid rgba(0, 127, 255, 0.15);
5717
- border-radius: 0;
5718
- margin-left: 2px;
5719
- &:hover {
5720
- border-left-color: rgba(0, 127, 255, 0.4);
5721
- }
5722
- &.--selected {
5723
- border-left-color: rgba(0, 127, 255, 0.5);
5724
- }
5725
5717
  }
5726
5718
 
5727
5719
  &.--collapsible&.--empty {