@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.
@@ -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 r=[...null!==(t=bl.attributes["*"])&&void 0!==t?t:[]].filter((e=>"height"!==e));r.push("style");const s=Object.assign(Object.assign({},bl),{tagNames:[...bl.tagNames||[],...e.map((e=>e.tagName))],attributes:Object.assign(Object.assign({},bl.attributes),{p:[...null!==(n=bl.attributes.p)&&void 0!==n?n:[],["className","MsoNormal"]],a:[...null!==(i=bl.attributes.a)&&void 0!==i?i:[],"referrerpolicy"],"*":r})});for(const t of e)s.attributes[t.tagName]=t.attributes;return s}export{g as d,t as g,rm as m,sm as s}
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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-elements",
3
- "version": "39.0.2",
3
+ "version": "39.0.3",
4
4
  "description": "Lime Elements",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",