@limetech/lime-elements 39.44.4 → 39.44.5

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-B85MJLTf.js";import{s as t,v as n,f as r,g as i,h as o,E
4
4
  * @version v0.2.1
5
5
  * @link http://github.com/noeldelgado/parse-css-color/
6
6
  * @license MIT
7
- */const Tl=["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 xl(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=tl.exec(e);if(t)return function(e){const[t,n,r,i]=el(e,{format:"array"});return Sl([null,t,n,r,i])}(t[0]);const n=cl.exec(e)||sl.exec(e);if(n)return function([,e,t,n,r=1]){let i=e;return i=i.endsWith("turn")?360*parseFloat(i)/1:i.endsWith("rad")?Math.round(180*parseFloat(i)/Math.PI):parseFloat(i),{type:"hsl",values:[i,wl(t),wl(n)],alpha:El(null===r?1:r)}}(n);const r=gl.exec(e)||bl.exec(e)||hl.exec(e)||dl.exec(e);if(r)return Sl(r);if(kl.exec(e))return Sl([null,0,0,0,0]);const i=Zs[e.toLowerCase()];return i?Sl([null,i[0],i[1],i[2],1]):null})(e.background)&&(t["background-color"]=e.background),t}(function(e){let t=null;if(!e||"string"!=typeof e)return t;const n=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(e){var t=e.match(Hs);t&&(n+=t.length);var i=e.lastIndexOf("\n");r=~i?e.length-i:r+e.length}function o(){var e={line:n,column:r};return function(t){return t.position=new a(e),c(),t}}function a(e){this.start=e,this.end={line:n,column:r},this.source=t.source}function s(i){var o=new Error(t.source+":"+n+":"+r+": "+i);if(o.reason=i,o.filename=t.source,o.line=n,o.column=r,o.source=e,!t.silent)throw o}function l(t){var n=t.exec(e);if(n){var r=n[0];return i(r),e=e.slice(r.length),n}}function c(){l(zs)}function u(e){var t;for(e=e||[];t=h();)!1!==t&&e.push(t);return e}function h(){var t=o();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;Ws!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(Ws===e.charAt((n+=2)-1))return s("End of comment missing");var a=e.slice(2,n-2);return r+=2,i(a),e=e.slice(n),r+=2,t({type:"comment",comment:a})}}function f(){var e=o(),t=l(js);if(t){if(h(),!l(Vs))return s("property missing ':'");var n=l(Gs),r=e({type:"declaration",property:Qs(t[0].replace(Us,Ws)),value:n?Qs(n[0].replace(Us,Ws)):Ws});return l($s),r}}return a.prototype.content=e,c(),function(){var e,t=[];for(u(t);e=f();)!1!==e&&(t.push(e),u(t));return t}()}(e);return n.forEach((e=>{if("declaration"!==e.type)return;const{property:n,value:r}=e;r&&(t=t||{},t[n]=r)})),t}(e));return Object.entries(t).filter((([e])=>Tl.includes(e))).map((([e,t])=>`${e}: ${t}`)).join("; ")}catch(t){return console.error("Failed to parse style value",e,t),""}}(e.properties.style))}const Cl=/\u00A0/g,Al=["200B","200C","200D","FEFF"],Dl=new Set(["audio","canvas","embed","iframe","img","input","object","svg","video"]),Rl=new Set(["br"]),_l=(e,t)=>{if(e&&"object"==typeof e){if("element"===e.type&&"p"===e.tagName&&t&&Ll(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--)_l(e.children[t],e)}},Ll=e=>!Array.isArray(e.children)||0===e.children.length||e.children.every((e=>Nl(e))),Nl=e=>{if(!e)return!0;if("text"===e.type)return Ol("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||!Il(n)&&(!!Rl.has(n)||!Array.isArray(t.children)||0===t.children.length||t.children.every((e=>Nl(e))))}return!0},Il=e=>Dl.has(e)||(e=>e.includes("-"))(e),Ol=e=>{if(!e)return!0;const t=(e=>{let t=e;for(const e of Al){const n=String.fromCodePoint(Number.parseInt(e,16));t=t.split(n).join("")}return t})(e.replaceAll(Cl," "));return""===t.trim()};async function Ml(e,t){var r;(null==t?void 0:t.forceHardLineBreaks)&&(e=e.replaceAll(/(?<!\\)([\n\r])/g," $1"));return(await h().use(ct).use(br).use(Rt,{allowDangerousHtml:!0}).use(qs).use((()=>e=>(n(e,"element",(e=>{var t,n;if("a"===e.tagName){const r=null===(t=e.properties)||void 0===t?void 0:t.href,i=null===(n=e.properties)||void 0===n?void 0:n.title;if(!r)return;const o=m(r,i);e.properties.target=o.target,e.properties.rel=o.rel,e.properties.referrerpolicy=o.referrerpolicy}})),e))).use(f,ql(null!==(r=null==t?void 0:t.whitelist)&&void 0!==r?r:[])).use((()=>e=>{n(e,"element",xl)})).use(((e=!1)=>()=>e?e=>(_l(e,null),e):e=>e)(null==t?void 0:t.removeEmptyParagraphs)).use(function(e=!1){return()=>e?e=>(n(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==t?void 0:t.lazyLoadImages)).use(d).process(e)).toString()}async function Pl(e,t){return(await h().use(p).use(f,ql(null!=t?t:[])).use((()=>e=>{n(e,"element",xl)})).use(d).process(e)).toString()}function ql(e){var t,n,r,i;const o=[...null!==(t=g.attributes["*"])&&void 0!==t?t:[]].filter((e=>"height"!==e));o.push("style");const a=Object.assign(Object.assign({},g),{clobberPrefix:"",strip:[...null!==(n=g.strip)&&void 0!==n?n:[],"style"],tagNames:[...g.tagNames||[],...e.map((e=>e.tagName))],attributes:Object.assign(Object.assign({},g.attributes),{p:[...null!==(r=g.attributes.p)&&void 0!==r?r:[],["className","MsoNormal"]],a:[...null!==(i=g.attributes.a)&&void 0!==i?i:[],"referrerpolicy"],"*":o})});for(const t of e)a.attributes[t.tagName]=t.attributes;return a}export{m as g,Ml as m,Pl as s}
7
+ */const Tl=["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 xl(e){var t;e.tagName&&(null===(t=e.properties)||void 0===t?void 0:t.style)&&(e.properties.style=function(e,t){try{const n=function(e){const t=Object.assign({},e);return delete t.background,"background"in e&&null!==(e=>{if("string"!=typeof e)return null;const t=tl.exec(e);if(t)return function(e){const[t,n,r,i]=el(e,{format:"array"});return Sl([null,t,n,r,i])}(t[0]);const n=cl.exec(e)||sl.exec(e);if(n)return function([,e,t,n,r=1]){let i=e;return i=i.endsWith("turn")?360*parseFloat(i)/1:i.endsWith("rad")?Math.round(180*parseFloat(i)/Math.PI):parseFloat(i),{type:"hsl",values:[i,wl(t),wl(n)],alpha:El(null===r?1:r)}}(n);const r=gl.exec(e)||bl.exec(e)||hl.exec(e)||dl.exec(e);if(r)return Sl(r);if(kl.exec(e))return Sl([null,0,0,0,0]);const i=Zs[e.toLowerCase()];return i?Sl([null,i[0],i[1],i[2],1]):null})(e.background)&&(t["background-color"]=e.background),t}(function(e){let t=null;if(!e||"string"!=typeof e)return t;const n=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(e){var t=e.match(Hs);t&&(n+=t.length);var i=e.lastIndexOf("\n");r=~i?e.length-i:r+e.length}function o(){var e={line:n,column:r};return function(t){return t.position=new a(e),c(),t}}function a(e){this.start=e,this.end={line:n,column:r},this.source=t.source}function s(i){var o=new Error(t.source+":"+n+":"+r+": "+i);if(o.reason=i,o.filename=t.source,o.line=n,o.column=r,o.source=e,!t.silent)throw o}function l(t){var n=t.exec(e);if(n){var r=n[0];return i(r),e=e.slice(r.length),n}}function c(){l(zs)}function u(e){var t;for(e=e||[];t=h();)!1!==t&&e.push(t);return e}function h(){var t=o();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;Ws!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(Ws===e.charAt((n+=2)-1))return s("End of comment missing");var a=e.slice(2,n-2);return r+=2,i(a),e=e.slice(n),r+=2,t({type:"comment",comment:a})}}function f(){var e=o(),t=l(js);if(t){if(h(),!l(Vs))return s("property missing ':'");var n=l(Gs),r=e({type:"declaration",property:Qs(t[0].replace(Us,Ws)),value:n?Qs(n[0].replace(Us,Ws)):Ws});return l($s),r}}return a.prototype.content=e,c(),function(){var e,t=[];for(u(t);e=f();)!1!==e&&(t.push(e),u(t));return t}()}(e);return n.forEach((e=>{if("declaration"!==e.type)return;const{property:n,value:r}=e;r&&(t=t||{},t[n]=r)})),t}(e));return Object.entries(n).filter((([e])=>Tl.includes(e))).filter((([e,n])=>!function(e,t,n){return"table"===e&&"width"===t&&function(e){return 0===Number.parseFloat(e)}(n)}(t,e,n))).map((([e,t])=>`${e}: ${t}`)).join("; ")}catch(t){return console.error("Failed to parse style value",e,t),""}}(e.properties.style,e.tagName))}const Cl=/\u00A0/g,Al=["200B","200C","200D","FEFF"],Dl=new Set(["audio","canvas","embed","iframe","img","input","object","svg","video"]),Rl=new Set(["br"]),_l=(e,t)=>{if(e&&"object"==typeof e){if("element"===e.type&&"p"===e.tagName&&t&&Ll(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--)_l(e.children[t],e)}},Ll=e=>!Array.isArray(e.children)||0===e.children.length||e.children.every((e=>Nl(e))),Nl=e=>{if(!e)return!0;if("text"===e.type)return Ol("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||!Il(n)&&(!!Rl.has(n)||!Array.isArray(t.children)||0===t.children.length||t.children.every((e=>Nl(e))))}return!0},Il=e=>Dl.has(e)||(e=>e.includes("-"))(e),Ol=e=>{if(!e)return!0;const t=(e=>{let t=e;for(const e of Al){const n=String.fromCodePoint(Number.parseInt(e,16));t=t.split(n).join("")}return t})(e.replaceAll(Cl," "));return""===t.trim()};async function Ml(e,t){var r;(null==t?void 0:t.forceHardLineBreaks)&&(e=e.replaceAll(/(?<!\\)([\n\r])/g," $1"));return(await h().use(ct).use(br).use(Rt,{allowDangerousHtml:!0}).use(qs).use((()=>e=>(n(e,"element",(e=>{var t,n;if("a"===e.tagName){const r=null===(t=e.properties)||void 0===t?void 0:t.href,i=null===(n=e.properties)||void 0===n?void 0:n.title;if(!r)return;const o=m(r,i);e.properties.target=o.target,e.properties.rel=o.rel,e.properties.referrerpolicy=o.referrerpolicy}})),e))).use(f,ql(null!==(r=null==t?void 0:t.whitelist)&&void 0!==r?r:[])).use((()=>e=>{n(e,"element",xl)})).use(((e=!1)=>()=>e?e=>(_l(e,null),e):e=>e)(null==t?void 0:t.removeEmptyParagraphs)).use(function(e=!1){return()=>e?e=>(n(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==t?void 0:t.lazyLoadImages)).use(d).process(e)).toString()}async function Pl(e,t){return(await h().use(p).use(f,ql(null!=t?t:[])).use((()=>e=>{n(e,"element",xl)})).use(d).process(e)).toString()}function ql(e){var t,n,r,i;const o=[...null!==(t=g.attributes["*"])&&void 0!==t?t:[]].filter((e=>"height"!==e));o.push("style");const a=Object.assign(Object.assign({},g),{clobberPrefix:"",strip:[...null!==(n=g.strip)&&void 0!==n?n:[],"style"],tagNames:[...g.tagNames||[],"colgroup","col",...e.map((e=>e.tagName))],attributes:Object.assign(Object.assign({},g.attributes),{p:[...null!==(r=g.attributes.p)&&void 0!==r?r:[],["className","MsoNormal"]],a:[...null!==(i=g.attributes.a)&&void 0!==i?i:[],"referrerpolicy"],"*":o})});for(const t of e)a.attributes[t.tagName]=t.attributes;return a}export{m as g,Ml as m,Pl as s}
@@ -21,6 +21,7 @@ import { CustomElementDefinition } from '../../global/shared-types/custom-elemen
21
21
  * @exampleComponent limel-example-markdown-code
22
22
  * @exampleComponent limel-example-markdown-footnotes
23
23
  * @exampleComponent limel-example-markdown-tables
24
+ * @exampleComponent limel-example-markdown-html-tables
24
25
  * @exampleComponent limel-example-markdown-html
25
26
  * @exampleComponent limel-example-markdown-keys
26
27
  * @exampleComponent limel-example-markdown-blockquotes
@@ -8,14 +8,18 @@ export declare function sanitizeStyle(node: any): void;
8
8
  * Applies a whitelist to the CSS properties in the input string.
9
9
  * Any CSS properties not in the whitelist will be removed.
10
10
  *
11
+ * A zero width is also removed from `table` elements. Some HTML sources
12
+ * (e.g. Google Sheets) set `width: 0px` on the table element and define
13
+ * the real column widths in `colgroup`; a zero width forces the table
14
+ * down to its min-content size, crushing every column to its longest
15
+ * word. A zero width on a table can only ever harm rendering, since
16
+ * auto layout already floors the table at min-content.
17
+ *
11
18
  * @param styleValue - a string with CSS properties and values
19
+ * @param tagName - tag name of the element the style belongs to
12
20
  * @returns a sanitized version of the input string
13
21
  */
14
- /**
15
- *
16
- * @param styleValue
17
- */
18
- export declare function sanitizeStyleValue(styleValue: string): string;
22
+ export declare function sanitizeStyleValue(styleValue: string, tagName?: string): string;
19
23
  /**
20
24
  * Returns a copy of the input object with the `background` property removed.
21
25
  * If the `background` property's value was a valid CSS color value, the
@@ -2542,6 +2542,7 @@ export namespace Components {
2542
2542
  * @exampleComponent limel-example-markdown-code
2543
2543
  * @exampleComponent limel-example-markdown-footnotes
2544
2544
  * @exampleComponent limel-example-markdown-tables
2545
+ * @exampleComponent limel-example-markdown-html-tables
2545
2546
  * @exampleComponent limel-example-markdown-html
2546
2547
  * @exampleComponent limel-example-markdown-keys
2547
2548
  * @exampleComponent limel-example-markdown-blockquotes
@@ -5670,6 +5671,7 @@ declare global {
5670
5671
  * @exampleComponent limel-example-markdown-code
5671
5672
  * @exampleComponent limel-example-markdown-footnotes
5672
5673
  * @exampleComponent limel-example-markdown-tables
5674
+ * @exampleComponent limel-example-markdown-html-tables
5673
5675
  * @exampleComponent limel-example-markdown-html
5674
5676
  * @exampleComponent limel-example-markdown-keys
5675
5677
  * @exampleComponent limel-example-markdown-blockquotes
@@ -9219,6 +9221,7 @@ declare namespace LocalJSX {
9219
9221
  * @exampleComponent limel-example-markdown-code
9220
9222
  * @exampleComponent limel-example-markdown-footnotes
9221
9223
  * @exampleComponent limel-example-markdown-tables
9224
+ * @exampleComponent limel-example-markdown-html-tables
9222
9225
  * @exampleComponent limel-example-markdown-html
9223
9226
  * @exampleComponent limel-example-markdown-keys
9224
9227
  * @exampleComponent limel-example-markdown-blockquotes
@@ -12451,6 +12454,7 @@ declare module "@stencil/core" {
12451
12454
  * @exampleComponent limel-example-markdown-code
12452
12455
  * @exampleComponent limel-example-markdown-footnotes
12453
12456
  * @exampleComponent limel-example-markdown-tables
12457
+ * @exampleComponent limel-example-markdown-html-tables
12454
12458
  * @exampleComponent limel-example-markdown-html
12455
12459
  * @exampleComponent limel-example-markdown-keys
12456
12460
  * @exampleComponent limel-example-markdown-blockquotes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-elements",
3
- "version": "39.44.4",
3
+ "version": "39.44.5",
4
4
  "description": "Lime Elements",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -63,7 +63,7 @@
63
63
  "@rollup/plugin-node-resolve": "^13.3.0",
64
64
  "@stencil/core": "^4.43.5",
65
65
  "@stencil/sass": "^3.3.3",
66
- "@stencil/vitest": "^1.12.1",
66
+ "@stencil/vitest": "^1.14.0",
67
67
  "@types/codemirror": "^5.60.17",
68
68
  "@types/html-escaper": "^3.0.4",
69
69
  "@types/lodash-es": "^4.17.12",