@limetech/lime-elements 39.0.2 → 39.0.3
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/CHANGELOG.md +7 -0
- package/dist/cjs/limel-markdown.cjs.entry.js +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +1 -1
- package/dist/cjs/{markdown-parser-DnhdKhpI.js → markdown-parser-_1bsy-5h.js} +4 -4
- package/dist/collection/components/markdown/markdown-parser.js +4 -4
- package/dist/esm/limel-markdown.entry.js +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +1 -1
- package/dist/esm/{markdown-parser-CoBLYNGa.js → markdown-parser-DkmQCwAi.js} +4 -4
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-5536e886.entry.js → p-4beeec39.entry.js} +1 -1
- package/dist/lime-elements/{p-478d225c.entry.js → p-55596d9a.entry.js} +1 -1
- package/dist/lime-elements/{p-Db1TI5oK.js → p-Df0HAtSs.js} +1 -1
- package/package.json +1 -1
|
@@ -4,4 +4,4 @@ import{g as e}from"./p-BFTU3MAI.js";function t(e,t){return function(e){try{let t
|
|
|
4
4
|
* @version v0.2.1
|
|
5
5
|
* @link http://github.com/noeldelgado/parse-css-color/
|
|
6
6
|
* @license MIT
|
|
7
|
-
*/const Kp=["background-color","color","font-style","font-weight","text-decoration-color","text-decoration-line","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-decoration","width","height","min-width","min-height"];function Xp(e){var t;e.tagName&&(null===(t=e.properties)||void 0===t?void 0:t.style)&&(e.properties.style=function(e){try{const t=function(e){const t=Object.assign({},e);return delete t.background,"background"in e&&null!==(e=>{if("string"!=typeof e)return null;const t=xp.exec(e);if(t)return function(e){const[t,n,i,r]=Sp(e,{format:"array"});return Wp([null,t,n,i,r])}(t[0]);const n=Op.exec(e)||Lp.exec(e);if(n)return function([,e,t,n,i=1]){let r=e;return r=r.endsWith("turn")?360*parseFloat(r)/1:r.endsWith("rad")?Math.round(180*parseFloat(r)/Math.PI):parseFloat(r),{type:"hsl",values:[r,Vp(t),Vp(n)],alpha:Yp(null===i?1:i)}}(n);const i=Bp.exec(e)||Hp.exec(e)||Pp.exec(e)||Up.exec(e);if(i)return Wp(i);if(zp.exec(e))return Wp([null,0,0,0,0]);const r=wp[e.toLowerCase()];return r?Wp([null,r[0],r[1],r[2],1]):null})(e.background)&&(t["background-color"]=e.background),t}(vp(e));return Object.entries(t).filter((([e])=>Kp.includes(e))).map((([e,t])=>`${e}: ${t}`)).join("; ")}catch(t){return console.error("Failed to parse style value",e,t),""}}(e.properties.style))}const Qp=/\u00A0/g,$p=["200B","200C","200D","FEFF"],Zp=new Set(["audio","canvas","embed","iframe","img","input","object","svg","video"]),Jp=new Set(["br"]),em=(e,t)=>{if(e&&"object"==typeof e){if("element"===e.type&&"p"===e.tagName&&t&&tm(e)&&Array.isArray(t.children)){const n=t.children.indexOf(e);if(-1!==n)return void t.children.splice(n,1)}if(Array.isArray(e.children)&&0!==e.children.length)for(let t=e.children.length-1;t>=0;t--)em(e.children[t],e)}},tm=e=>!Array.isArray(e.children)||0===e.children.length||e.children.every((e=>nm(e))),nm=e=>{if(!e)return!0;if("text"===e.type)return im("string"==typeof e.value?e.value:"");if("comment"===e.type)return!0;if("element"===e.type){const t=e,n=t.tagName;return"string"!=typeof n||!Zp.has(n)&&(!!Jp.has(n)||!Array.isArray(t.children)||0===t.children.length||t.children.every((e=>nm(e))))}return!0},im=e=>{if(!e)return!0;const t=(e=>{let t=e;for(const e of $p){const n=String.fromCodePoint(Number.parseInt(e,16));t=t.split(n).join("")}return t})(e.replaceAll(Qp," "));return""===t.trim()};async function rm(e,n){var i;(null==n?void 0:n.forceHardLineBreaks)&&(e=e.replaceAll(/(?<!\\)([\n\r])/g," $1"));return(await j().use(Ht).use(Lr).use(Sn,{allowDangerousHtml:!0}).use(up).use((()=>e=>(mn(e,"element",(e=>{var n,i;if("a"===e.tagName){const r=null===(n=e.properties)||void 0===n?void 0:n.href,s=null===(i=e.properties)||void 0===i?void 0:i.title;if(!r)return;const a=t(r,s);e.properties.target=a.target,e.properties.rel=a.rel,e.properties.referrerpolicy=a.referrerpolicy}})),e))).use(xl,Object.assign({},am(null!==(i=null==n?void 0:n.whitelist)&&void 0!==i?i:[]))).use((()=>e=>{mn(e,"element",Xp)})).use(((e=!1)=>()=>e?e=>(em(e,null),e):e=>e)(null==n?void 0:n.removeEmptyParagraphs)).use(function(e=!1){return()=>e?e=>(mn(e,"element",(e=>{"img"===e.tagName&&(e.properties=e.properties||{},e.properties.loading="lazy",e.properties.src&&(e.properties["data-src"]=e.properties.src,e.properties.src=void 0))})),e):e=>e}(null==n?void 0:n.lazyLoadImages)).use(zc).process(e)).toString()}async function sm(e,t){return(await j().use(fl).use(xl,Object.assign({},am(null!=t?t:[]))).use((()=>e=>{mn(e,"element",Xp)})).use(zc).process(e)).toString()}function am(e){var t,n,i;const
|
|
7
|
+
*/const Kp=["background-color","color","font-style","font-weight","text-decoration-color","text-decoration-line","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-decoration","width","height","min-width","min-height"];function Xp(e){var t;e.tagName&&(null===(t=e.properties)||void 0===t?void 0:t.style)&&(e.properties.style=function(e){try{const t=function(e){const t=Object.assign({},e);return delete t.background,"background"in e&&null!==(e=>{if("string"!=typeof e)return null;const t=xp.exec(e);if(t)return function(e){const[t,n,i,r]=Sp(e,{format:"array"});return Wp([null,t,n,i,r])}(t[0]);const n=Op.exec(e)||Lp.exec(e);if(n)return function([,e,t,n,i=1]){let r=e;return r=r.endsWith("turn")?360*parseFloat(r)/1:r.endsWith("rad")?Math.round(180*parseFloat(r)/Math.PI):parseFloat(r),{type:"hsl",values:[r,Vp(t),Vp(n)],alpha:Yp(null===i?1:i)}}(n);const i=Bp.exec(e)||Hp.exec(e)||Pp.exec(e)||Up.exec(e);if(i)return Wp(i);if(zp.exec(e))return Wp([null,0,0,0,0]);const r=wp[e.toLowerCase()];return r?Wp([null,r[0],r[1],r[2],1]):null})(e.background)&&(t["background-color"]=e.background),t}(vp(e));return Object.entries(t).filter((([e])=>Kp.includes(e))).map((([e,t])=>`${e}: ${t}`)).join("; ")}catch(t){return console.error("Failed to parse style value",e,t),""}}(e.properties.style))}const Qp=/\u00A0/g,$p=["200B","200C","200D","FEFF"],Zp=new Set(["audio","canvas","embed","iframe","img","input","object","svg","video"]),Jp=new Set(["br"]),em=(e,t)=>{if(e&&"object"==typeof e){if("element"===e.type&&"p"===e.tagName&&t&&tm(e)&&Array.isArray(t.children)){const n=t.children.indexOf(e);if(-1!==n)return void t.children.splice(n,1)}if(Array.isArray(e.children)&&0!==e.children.length)for(let t=e.children.length-1;t>=0;t--)em(e.children[t],e)}},tm=e=>!Array.isArray(e.children)||0===e.children.length||e.children.every((e=>nm(e))),nm=e=>{if(!e)return!0;if("text"===e.type)return im("string"==typeof e.value?e.value:"");if("comment"===e.type)return!0;if("element"===e.type){const t=e,n=t.tagName;return"string"!=typeof n||!Zp.has(n)&&(!!Jp.has(n)||!Array.isArray(t.children)||0===t.children.length||t.children.every((e=>nm(e))))}return!0},im=e=>{if(!e)return!0;const t=(e=>{let t=e;for(const e of $p){const n=String.fromCodePoint(Number.parseInt(e,16));t=t.split(n).join("")}return t})(e.replaceAll(Qp," "));return""===t.trim()};async function rm(e,n){var i;(null==n?void 0:n.forceHardLineBreaks)&&(e=e.replaceAll(/(?<!\\)([\n\r])/g," $1"));return(await j().use(Ht).use(Lr).use(Sn,{allowDangerousHtml:!0}).use(up).use((()=>e=>(mn(e,"element",(e=>{var n,i;if("a"===e.tagName){const r=null===(n=e.properties)||void 0===n?void 0:n.href,s=null===(i=e.properties)||void 0===i?void 0:i.title;if(!r)return;const a=t(r,s);e.properties.target=a.target,e.properties.rel=a.rel,e.properties.referrerpolicy=a.referrerpolicy}})),e))).use(xl,Object.assign({},am(null!==(i=null==n?void 0:n.whitelist)&&void 0!==i?i:[]))).use((()=>e=>{mn(e,"element",Xp)})).use(((e=!1)=>()=>e?e=>(em(e,null),e):e=>e)(null==n?void 0:n.removeEmptyParagraphs)).use(function(e=!1){return()=>e?e=>(mn(e,"element",(e=>{"img"===e.tagName&&(e.properties=e.properties||{},e.properties.loading="lazy",e.properties.src&&(e.properties["data-src"]=e.properties.src,e.properties.src=void 0))})),e):e=>e}(null==n?void 0:n.lazyLoadImages)).use(zc).process(e)).toString()}async function sm(e,t){return(await j().use(fl).use(xl,Object.assign({},am(null!=t?t:[]))).use((()=>e=>{mn(e,"element",Xp)})).use(zc).process(e)).toString()}function am(e){var t,n,i,r;const s=[...null!==(t=bl.attributes["*"])&&void 0!==t?t:[]].filter((e=>"height"!==e));s.push("style");const a=Object.assign(Object.assign({},bl),{strip:[...null!==(n=bl.strip)&&void 0!==n?n:[],"style"],tagNames:[...bl.tagNames||[],...e.map((e=>e.tagName))],attributes:Object.assign(Object.assign({},bl.attributes),{p:[...null!==(i=bl.attributes.p)&&void 0!==i?i:[],["className","MsoNormal"]],a:[...null!==(r=bl.attributes.a)&&void 0!==r?r:[],"referrerpolicy"],"*":s})});for(const t of e)a.attributes[t.tagName]=t.attributes;return a}export{g as d,t as g,rm as m,sm as s}
|