@limetech/lime-elements 40.5.4 → 40.6.0
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 +11 -0
- package/dist/cjs/{index-ETPz91V5.js → index-zZvs6xK-.js} +9382 -9504
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-file-viewer.cjs.entry.js +1 -1
- package/dist/cjs/limel-markdown.cjs.entry.js +28 -4
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/markdown-exporter-9p7d3Q76.js +6210 -0
- package/dist/cjs/{markdown-parser-YH5HSSgF.js → markdown-parser-Cgv5Y9Z4.js} +579 -848
- package/dist/collection/components/markdown/markdown-exporter.js +186 -0
- package/dist/collection/components/markdown/markdown-parser.js +2 -3
- package/dist/collection/components/markdown/markdown.js +54 -2
- package/dist/esm/{index-CbciMfiU.js → index-BN64nlbO.js} +9369 -9505
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-file-viewer.entry.js +1 -1
- package/dist/esm/limel-markdown.entry.js +28 -4
- package/dist/esm/limel-prosemirror-adapter.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/markdown-exporter--3_MaqwD.js +6208 -0
- package/dist/esm/{markdown-parser-DrxxGLF5.js → markdown-parser-DCf-3dKZ.js} +506 -791
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-05afb316.entry.js → p-20658306.entry.js} +1 -1
- package/dist/lime-elements/p-BPzhuHcl.js +1 -0
- package/dist/lime-elements/p-CC4Usa-Q.js +7 -0
- package/dist/lime-elements/p-_UXAljNc.js +1 -0
- package/dist/lime-elements/p-dc9cd793.entry.js +1 -0
- package/dist/lime-elements/{p-10594468.entry.js → p-dd62042a.entry.js} +1 -1
- package/dist/types/components/markdown/markdown-exporter.d.ts +15 -0
- package/dist/types/components/markdown/markdown.d.ts +19 -0
- package/dist/types/components.d.ts +10 -0
- package/dist/types/global/shared-types/custom-element.types.d.ts +25 -0
- package/package.json +7 -1
- package/dist/lime-elements/p-6d5b23ad.entry.js +0 -1
- package/dist/lime-elements/p-C9xHOCE_.js +0 -7
- package/dist/lime-elements/p-DMNtoJ8I.js +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CustomElementDefinition } from '../../global/shared-types/custom-element.types';
|
|
2
|
+
/**
|
|
3
|
+
* Convert rendered markdown content back to markdown, replacing each
|
|
4
|
+
* whitelisted custom element with the markdown it describes itself as.
|
|
5
|
+
*
|
|
6
|
+
* Elements that do not implement {@link MarkdownDescribable} are
|
|
7
|
+
* converted like any unknown element: their light DOM children are kept,
|
|
8
|
+
* and an element without children disappears.
|
|
9
|
+
*
|
|
10
|
+
* @param container - The element holding the rendered content.
|
|
11
|
+
* @param whitelist - The custom elements allowed in the content.
|
|
12
|
+
* @returns The content as GitHub Flavored Markdown.
|
|
13
|
+
*/
|
|
14
|
+
export declare function exportMarkdown(container: HTMLElement, whitelist: CustomElementDefinition[]): Promise<string>;
|
|
15
|
+
//# sourceMappingURL=markdown-exporter.d.ts.map
|
|
@@ -32,6 +32,7 @@ import { CustomElementDefinition } from '../../global/shared-types/custom-elemen
|
|
|
32
32
|
* @exampleComponent limel-example-markdown-custom-component-with-json-props
|
|
33
33
|
* @exampleComponent limel-example-markdown-remove-empty-paragraphs
|
|
34
34
|
* @exampleComponent limel-example-markdown-adapt-color-contrast
|
|
35
|
+
* @exampleComponent limel-example-markdown-to-markdown
|
|
35
36
|
* @exampleComponent limel-example-markdown-composite
|
|
36
37
|
*/
|
|
37
38
|
export declare class Markdown {
|
|
@@ -87,11 +88,29 @@ export declare class Markdown {
|
|
|
87
88
|
* drives the surrounding text color.
|
|
88
89
|
*/
|
|
89
90
|
adaptColorContrast: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Returns the content as markdown, with every whitelisted custom
|
|
93
|
+
* element replaced by the markdown it describes itself as.
|
|
94
|
+
*
|
|
95
|
+
* Use this to hand the content to a target that cannot render custom
|
|
96
|
+
* elements, such as the clipboard. An element describes itself by
|
|
97
|
+
* implementing `MarkdownDescribable`; elements that do not keep
|
|
98
|
+
* their child content, or are removed if they have none.
|
|
99
|
+
*
|
|
100
|
+
* The markdown is generated from the rendered content, so it may be
|
|
101
|
+
* formatted differently from `value`.
|
|
102
|
+
*
|
|
103
|
+
* @alpha
|
|
104
|
+
* @returns The content as markdown.
|
|
105
|
+
*/
|
|
106
|
+
toMarkdown(): Promise<string>;
|
|
90
107
|
textChanged(): Promise<void>;
|
|
108
|
+
private renderMarkdown;
|
|
91
109
|
handleWhitelistChange(): Promise<void>;
|
|
92
110
|
handleRemoveEmptyParagraphsChange(): Promise<void>;
|
|
93
111
|
handleAdaptColorContrastChange(): Promise<void>;
|
|
94
112
|
private rootElement;
|
|
113
|
+
private rendering?;
|
|
95
114
|
private imageIntersectionObserver;
|
|
96
115
|
private cachedConsumerWhitelist?;
|
|
97
116
|
private cachedCombinedWhitelist?;
|
|
@@ -2562,6 +2562,7 @@ export namespace Components {
|
|
|
2562
2562
|
* @exampleComponent limel-example-markdown-custom-component-with-json-props
|
|
2563
2563
|
* @exampleComponent limel-example-markdown-remove-empty-paragraphs
|
|
2564
2564
|
* @exampleComponent limel-example-markdown-adapt-color-contrast
|
|
2565
|
+
* @exampleComponent limel-example-markdown-to-markdown
|
|
2565
2566
|
* @exampleComponent limel-example-markdown-composite
|
|
2566
2567
|
*/
|
|
2567
2568
|
interface LimelMarkdown {
|
|
@@ -2580,6 +2581,12 @@ export namespace Components {
|
|
|
2580
2581
|
* @default true
|
|
2581
2582
|
*/
|
|
2582
2583
|
"removeEmptyParagraphs": boolean;
|
|
2584
|
+
/**
|
|
2585
|
+
* Returns the content as markdown, with every whitelisted custom element replaced by the markdown it describes itself as. Use this to hand the content to a target that cannot render custom elements, such as the clipboard. An element describes itself by implementing `MarkdownDescribable`; elements that do not keep their child content, or are removed if they have none. The markdown is generated from the rendered content, so it may be formatted differently from `value`.
|
|
2586
|
+
* @alpha
|
|
2587
|
+
* @returns The content as markdown.
|
|
2588
|
+
*/
|
|
2589
|
+
"toMarkdown": () => Promise<string>;
|
|
2583
2590
|
/**
|
|
2584
2591
|
* The input text. Treated as GitHub Flavored Markdown, with the addition that any included HTML will be parsed and rendered as HTML, rather than as text.
|
|
2585
2592
|
* @default ''
|
|
@@ -5802,6 +5809,7 @@ declare global {
|
|
|
5802
5809
|
* @exampleComponent limel-example-markdown-custom-component-with-json-props
|
|
5803
5810
|
* @exampleComponent limel-example-markdown-remove-empty-paragraphs
|
|
5804
5811
|
* @exampleComponent limel-example-markdown-adapt-color-contrast
|
|
5812
|
+
* @exampleComponent limel-example-markdown-to-markdown
|
|
5805
5813
|
* @exampleComponent limel-example-markdown-composite
|
|
5806
5814
|
*/
|
|
5807
5815
|
interface HTMLLimelMarkdownElement extends Components.LimelMarkdown, HTMLStencilElement {
|
|
@@ -9437,6 +9445,7 @@ declare namespace LocalJSX {
|
|
|
9437
9445
|
* @exampleComponent limel-example-markdown-custom-component-with-json-props
|
|
9438
9446
|
* @exampleComponent limel-example-markdown-remove-empty-paragraphs
|
|
9439
9447
|
* @exampleComponent limel-example-markdown-adapt-color-contrast
|
|
9448
|
+
* @exampleComponent limel-example-markdown-to-markdown
|
|
9440
9449
|
* @exampleComponent limel-example-markdown-composite
|
|
9441
9450
|
*/
|
|
9442
9451
|
interface LimelMarkdown {
|
|
@@ -12799,6 +12808,7 @@ declare module "@stencil/core" {
|
|
|
12799
12808
|
* @exampleComponent limel-example-markdown-custom-component-with-json-props
|
|
12800
12809
|
* @exampleComponent limel-example-markdown-remove-empty-paragraphs
|
|
12801
12810
|
* @exampleComponent limel-example-markdown-adapt-color-contrast
|
|
12811
|
+
* @exampleComponent limel-example-markdown-to-markdown
|
|
12802
12812
|
* @exampleComponent limel-example-markdown-composite
|
|
12803
12813
|
*/
|
|
12804
12814
|
"limel-markdown": LocalJSX.IntrinsicElements["limel-markdown"] & JSXBase.HTMLAttributes<HTMLLimelMarkdownElement>;
|
|
@@ -20,4 +20,29 @@ export type CustomElement = Omit<CustomElementDefinition, 'attributes'> & {
|
|
|
20
20
|
*/
|
|
21
21
|
attributes: Record<string, any>;
|
|
22
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* A custom element that can describe itself as markdown.
|
|
25
|
+
*
|
|
26
|
+
* `limel-markdown` calls `toMarkdown` on every whitelisted element that
|
|
27
|
+
* implements it when its own `toMarkdown` is called, and puts the result
|
|
28
|
+
* in the element's place. Use it to give targets that cannot render the
|
|
29
|
+
* element, such as the clipboard, a markdown form of what it shows.
|
|
30
|
+
*
|
|
31
|
+
* The returned markdown takes the element's place as is, without
|
|
32
|
+
* escaping. An element that is rendered inline, such as a chip, should
|
|
33
|
+
* return inline markdown, such as a link.
|
|
34
|
+
*
|
|
35
|
+
* Implement `toMarkdown` as a method of the element's class, since
|
|
36
|
+
* `limel-markdown` looks for it on the class of each whitelisted tag.
|
|
37
|
+
*
|
|
38
|
+
* @alpha
|
|
39
|
+
*/
|
|
40
|
+
export interface MarkdownDescribable {
|
|
41
|
+
/**
|
|
42
|
+
* Describe the element as markdown.
|
|
43
|
+
*
|
|
44
|
+
* @returns The markdown that represents the element.
|
|
45
|
+
*/
|
|
46
|
+
toMarkdown(): Promise<string>;
|
|
47
|
+
}
|
|
23
48
|
//# sourceMappingURL=custom-element.types.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limetech/lime-elements",
|
|
3
|
-
"version": "40.
|
|
3
|
+
"version": "40.6.0",
|
|
4
4
|
"description": "Lime Elements",
|
|
5
5
|
"author": "Lime Technologies",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -80,12 +80,15 @@
|
|
|
80
80
|
"flatpickr": "^4.6.13",
|
|
81
81
|
"glob": "^13.0.6",
|
|
82
82
|
"globals": "^17.12.0",
|
|
83
|
+
"hast-util-from-dom": "^5.0.1",
|
|
84
|
+
"hast-util-to-mdast": "^10.1.2",
|
|
83
85
|
"html-escaper": "^3.0.3",
|
|
84
86
|
"jsonlint-mod": "^1.7.6",
|
|
85
87
|
"jsx-dom": "^8.1.6",
|
|
86
88
|
"kompendium": "npm:@limetech/kompendium@^1.3.0",
|
|
87
89
|
"lodash-es": "^4.17.23",
|
|
88
90
|
"material-components-web": "^13.0.0",
|
|
91
|
+
"mdast-util-to-markdown": "^2.1.3",
|
|
89
92
|
"moment": "^2.30.1",
|
|
90
93
|
"morphdom": "^2.7.8",
|
|
91
94
|
"number-abbreviate": "^2.0.0",
|
|
@@ -102,11 +105,14 @@
|
|
|
102
105
|
"react-dom": "^19.3.0",
|
|
103
106
|
"rehype-parse": "^9.0.1",
|
|
104
107
|
"rehype-raw": "^7.0.0",
|
|
108
|
+
"rehype-remark": "^10.0.1",
|
|
105
109
|
"rehype-sanitize": "^6.0.0",
|
|
106
110
|
"rehype-stringify": "^10.0.1",
|
|
111
|
+
"remark-breaks": "^4.0.0",
|
|
107
112
|
"remark-gfm": "^4.0.1",
|
|
108
113
|
"remark-parse": "^11.0.0",
|
|
109
114
|
"remark-rehype": "^11.1.1",
|
|
115
|
+
"remark-stringify": "^11.0.0",
|
|
110
116
|
"replace-in-file": "^8.4.0",
|
|
111
117
|
"shelljs": "0.10.0",
|
|
112
118
|
"shx": "^0.4.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,h as t,H as r}from"./p-Bnc9lzk2.js";import{m as o}from"./p-C9xHOCE_.js";import{g as a}from"./p-Dnt5w_Bp.js";import{d as n}from"./p-DMNtoJ8I.js";import{a as l}from"./p-Dgcw_h7C.js";import"./p-B85MJLTf.js";class i{constructor(e){this.handleIntersection=e=>{for(const t of e)if(t.isIntersecting){const e=t.target,r=e.dataset.src;r&&(e.setAttribute("src",r),delete e.dataset.src),this.observer.unobserve(e)}},this.observer=new IntersectionObserver(this.handleIntersection);const t=e.querySelectorAll("img");for(const e of t)this.observer.observe(e)}disconnect(){this.observer.disconnect()}}var s;const d=new Map(Object.entries(null!==(s=n.protocols)&&void 0!==s?s:{}).map((([e,t])=>[e,new Set(t)])));function m(e,t){for(const r of t){const t=e.getAttribute(r);if(!t)continue;const o=c(t);if(void 0!==o){const t=f(o);e[b(r)]=t}}}function c(e){const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t)}catch(e){try{const e=t.replaceAll(""",'"').replaceAll(""",'"').replaceAll(""",'"').replaceAll("'","'").replaceAll("'","'").replaceAll("'","'").replaceAll("&","&");return JSON.parse(e)}catch(e){return}}}function h(e,t){const r=e.trim(),o=r.indexOf(":");if(-1===o||/[?#/]/.test(r.slice(0,o)))return!0;const a=r.slice(0,o).toLowerCase();return t.has(a)}function f(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(f);const t=Object.assign({},e);for(const e of Object.keys(t)){const r=d.get(e);r&&"string"==typeof t[e]&&!h(t[e],r)?(console.warn(`limel-markdown: Removed unsafe URL from "${e}" during sanitization.`),delete t[e]):"object"==typeof t[e]&&null!==t[e]&&(t[e]=f(t[e]))}return t}function b(e){return e.replaceAll(/-([a-z])/g,((e,t)=>t.toUpperCase()))}var u,g="undefined"==typeof document?void 0:document,p=!!g&&"content"in g.createElement("template"),v=!!g&&g.createRange&&"createContextualFragment"in g.createRange();function w(e,t){var r,o,a=e.nodeName,n=t.nodeName;return a===n||(r=a.charCodeAt(0),o=n.charCodeAt(0),r<=90&&o>=97?a===n.toUpperCase():o<=90&&r>=97&&n===a.toUpperCase())}function k(e,t,r){e[r]!==t[r]&&(e[r]=t[r],e[r]?e.setAttribute(r,""):e.removeAttribute(r))}var y={OPTION:function(e,t){var r=e.parentNode;if(r){var o=r.nodeName.toUpperCase();"OPTGROUP"===o&&(o=(r=r.parentNode)&&r.nodeName.toUpperCase()),"SELECT"!==o||r.hasAttribute("multiple")||(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),r.selectedIndex=-1)}k(e,t,"selected")},INPUT:function(e,t){k(e,t,"checked"),k(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var r=t.value;e.value!==r&&(e.value=r);var o=e.firstChild;if(o){var a=o.nodeValue;if(a==r||!r&&a==e.placeholder)return;o.nodeValue=r}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var r,o,a=-1,n=0,l=e.firstChild;l;)if("OPTGROUP"===(o=l.nodeName&&l.nodeName.toUpperCase()))(l=(r=l).firstChild)||(l=r.nextSibling,r=null);else{if("OPTION"===o){if(l.hasAttribute("selected")){a=n;break}n++}!(l=l.nextSibling)&&r&&(l=r.nextSibling,r=null)}e.selectedIndex=a}}};function j(){}function x(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}var z=function(e,t,r){if(r||(r={}),"string"==typeof t)if("#document"===e.nodeName||"HTML"===e.nodeName){var o=t;(t=g.createElement("html")).innerHTML=o}else if("BODY"===e.nodeName){var a=t;(t=g.createElement("html")).innerHTML=a;var n=t.querySelector("body");n&&(t=n)}else l=(l=t).trim(),t=p?function(e){var t=g.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}(l):v?function(e){return u||(u=g.createRange()).selectNode(g.body),u.createContextualFragment(e).childNodes[0]}(l):function(e){var t=g.createElement("body");return t.innerHTML=e,t.childNodes[0]}(l);else 11===t.nodeType&&(t=t.firstElementChild);var l,i=r.getNodeKey||x,s=r.onBeforeNodeAdded||j,d=r.onNodeAdded||j,m=r.onBeforeElUpdated||j,c=r.onElUpdated||j,h=r.onBeforeNodeDiscarded||j,f=r.onNodeDiscarded||j,b=r.onBeforeElChildrenUpdated||j,k=r.skipFromChildren||j,z=r.addChild||function(e,t){return e.appendChild(t)},C=!0===r.childrenOnly,O=Object.create(null),N=[];function T(e){N.push(e)}function q(e,t){if(1===e.nodeType)for(var r=e.firstChild;r;){var o=void 0;t&&(o=i(r))?T(o):(f(r),r.firstChild&&q(r,t)),r=r.nextSibling}}function E(e,t,r){!1!==h(e)&&(t&&t.removeChild(e),f(e),q(e,r))}function P(e){if(1===e.nodeType||11===e.nodeType)for(var t=e.firstChild;t;){var r=i(t);r&&(O[r]=t),P(t),t=t.nextSibling}}function H(e){d(e);for(var t=e.firstChild;t;){var r=t.nextSibling,o=i(t);if(o){var a=O[o];a&&w(t,a)?(t.parentNode.replaceChild(a,t),M(a,t)):H(t)}else H(t);t=r}}function M(e,t,r){var o=i(t);if(o&&delete O[o],!r){var a=m(e,t);if(!1===a)return;if(a instanceof HTMLElement&&P(e=a),function(e,t){var r,o,a,n,l=t.attributes;if(11!==t.nodeType&&11!==e.nodeType){for(var i=l.length-1;i>=0;i--)o=(r=l[i]).name,n=r.value,(a=r.namespaceURI)?e.getAttributeNS(a,o=r.localName||o)!==n&&("xmlns"===r.prefix&&(o=r.name),e.setAttributeNS(a,o,n)):e.getAttribute(o)!==n&&e.setAttribute(o,n);for(var s=e.attributes,d=s.length-1;d>=0;d--)o=(r=s[d]).name,(a=r.namespaceURI)?t.hasAttributeNS(a,o=r.localName||o)||e.removeAttributeNS(a,o):t.hasAttribute(o)||e.removeAttribute(o)}}(e,t),c(e),!1===b(e,t))return}"TEXTAREA"!==e.nodeName?function(e,t){var r,o,a,n,l,d=k(e,t),m=t.firstChild,c=e.firstChild;e:for(;m;){for(n=m.nextSibling,r=i(m);!d&&c;){if(a=c.nextSibling,m.isSameNode&&m.isSameNode(c)){m=n,c=a;continue e}o=i(c);var h=c.nodeType,f=void 0;if(h===m.nodeType&&(1===h?(r?r!==o&&((l=O[r])?a===l?f=!1:(e.insertBefore(l,c),o?T(o):E(c,e,!0),o=i(c=l)):f=!1):o&&(f=!1),(f=!1!==f&&w(c,m))&&M(c,m)):3!==h&&8!=h||(f=!0,c.nodeValue!==m.nodeValue&&(c.nodeValue=m.nodeValue))),f){m=n,c=a;continue e}o?T(o):E(c,e,!0),c=a}if(r&&(l=O[r])&&w(l,m))d||z(e,l),M(l,m);else{var b=s(m);!1!==b&&(b&&(m=b),m.actualize&&(m=m.actualize(e.ownerDocument||g)),z(e,m),H(m))}m=n,c=a}!function(e,t,r){for(;t;){var o=t.nextSibling;(r=i(t))?T(r):E(t,e,!0),t=o}}(e,c,o);var u=y[e.nodeName];u&&u(e,t)}(e,t):y.TEXTAREA(e,t)}P(e);var I,L,S=e,R=S.nodeType,A=t.nodeType;if(!C)if(1===R)1===A?w(e,t)||(f(e),S=function(e,t){for(var r=e.firstChild;r;){var o=r.nextSibling;t.appendChild(r),r=o}return t}(e,(I=t.nodeName,(L=t.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==L?g.createElementNS(L,I):g.createElement(I)))):S=t;else if(3===R||8===R){if(A===R)return S.nodeValue!==t.nodeValue&&(S.nodeValue=t.nodeValue),S;S=t}if(S===t)f(e);else{if(t.isSameNode&&t.isSameNode(S))return;if(M(S,t,C),N)for(var D=0,B=N.length;D<B;D++){var U=O[N[D]];U&&E(U,U.parentNode,!1)}}return!C&&S!==e&&e.parentNode&&(S.actualize&&(S=S.actualize(e.ownerDocument||g)),e.parentNode.replaceChild(S,e)),S};const C=[{tagName:"limel-chip",attributes:["text","icon","link","badge","disabled","readonly","selected","type","size"]},{tagName:"limel-icon",attributes:["name","size","badge"]},{tagName:"limel-badge",attributes:["label"]},{tagName:"limel-callout",attributes:["heading","icon","type"]},{tagName:"limel-linear-progress",attributes:["value","indeterminate"]},{tagName:"limel-circular-progress",attributes:["value","max-value","prefix","suffix","size","display-percentage-colors"]},{tagName:"limel-spinner",attributes:["size"]},{tagName:"limel-info-tile",attributes:["value","icon","label","prefix","suffix","badge"]}],O=class{constructor(t){e(this,t),this.value="",this.whitelist=a.markdownWhitelist,this.lazyLoadImages=!1,this.removeEmptyParagraphs=!0,this.adaptColorContrast=!1,this.imageIntersectionObserver=null}async textChanged(){try{this.cleanupImageIntersectionObserver(),this.cachedCombinedWhitelist&&this.whitelist===this.cachedConsumerWhitelist||(this.cachedConsumerWhitelist=this.whitelist,this.cachedCombinedWhitelist=function(e,t){if(!(null==t?void 0:t.length))return e.map((e=>Object.assign(Object.assign({},e),{attributes:[...e.attributes]})));const r=new Map;for(const o of[...e,...t]){const e=r.get(o.tagName);if(e)for(const t of o.attributes)e.add(t);else r.set(o.tagName,new Set(o.attributes))}return[...r.entries()].map((([e,t])=>({tagName:e,attributes:[...t]})))}(C,this.whitelist));const e=this.cachedCombinedWhitelist,t=await o(this.value,{forceHardLineBreaks:!0,whitelist:e,lazyLoadImages:this.lazyLoadImages,removeEmptyParagraphs:this.removeEmptyParagraphs});!function(e,t=""){try{z(e,`<div>${t}</div>`,{childrenOnly:!0})}catch(r){console.warn("morphdom failed, falling back to innerHTML:",r),e.innerHTML=t}}(this.rootElement,t),function(e,t){if(e&&(null==t?void 0:t.length))for(const r of t){const t=e.querySelectorAll(r.tagName);for(const e of t)m(e,r.attributes)}}(this.rootElement,e),this.adaptColorContrast&&l(this.rootElement),this.setupImageIntersectionObserver()}catch(e){console.error(e)}}handleWhitelistChange(){return this.textChanged()}handleRemoveEmptyParagraphsChange(){return this.textChanged()}handleAdaptColorContrastChange(){return this.textChanged()}async componentDidLoad(){this.textChanged()}disconnectedCallback(){this.cleanupImageIntersectionObserver()}render(){return t(r,{key:"d10bcceddc2844e43817d406965155f282e21549"},t("div",{key:"4253c517b72dbd21081e5fe26aaa0e75a91cb7db",id:"markdown",ref:e=>this.rootElement=e}))}setupImageIntersectionObserver(){this.lazyLoadImages&&(this.imageIntersectionObserver=new i(this.rootElement))}cleanupImageIntersectionObserver(){this.imageIntersectionObserver&&(this.imageIntersectionObserver.disconnect(),this.imageIntersectionObserver=null)}static get watchers(){return{value:[{textChanged:0}],whitelist:[{handleWhitelistChange:0}],removeEmptyParagraphs:[{handleRemoveEmptyParagraphsChange:0}],adaptColorContrast:[{handleAdaptColorContrastChange:0}]}}};O.style='@charset "UTF-8";pre,pre p,code{font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-size:0.75rem}pre{max-width:100%;white-space:pre-wrap;word-wrap:break-word}code{letter-spacing:-0.0125rem;color:rgb(var(--contrast-1300));tab-size:4;hyphens:none;display:inline;border-radius:0.25rem;padding:0.03125rem 0.25rem;background-color:rgb(var(--contrast-600))}pre>code{display:block;margin:0.5rem 0;padding:0.5rem 0.75rem}h1{font-size:1.5rem}h2{font-size:1.25rem}h3{font-size:1.125rem}h4{font-size:1rem}h5{font-size:var(--limel-theme-default-font-size)}h6{font-size:0.75rem}h1,h2{margin-top:0.5rem;margin-bottom:0.5rem;letter-spacing:-0.03125rem;font-weight:500}h3,h4{margin-top:0.75rem;margin-bottom:0.25rem;font-weight:600}h5,h6{margin-top:0.5rem;margin-bottom:0.125rem;font-weight:600}h1,h2,h3,h4,h5,h6{word-break:break-word;hyphens:auto;-webkit-hyphens:auto}h1 code,h2 code,h3 code,h4 code,h5 code,h6 code{font-size:inherit}:not([contenteditable=true]) h1,:not([contenteditable=true]) h2,:not([contenteditable=true]) h3,:not([contenteditable=true]) h4,:not([contenteditable=true]) h5,:not([contenteditable=true]) h6{text-wrap:balance}[contenteditable=true] h1,[contenteditable=true] h2,[contenteditable=true] h3,[contenteditable=true] h4,[contenteditable=true] h5,[contenteditable=true] h6{text-wrap:initial}:host(limel-markdown.truncate-paragraphs) p{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}p,li{font-size:var(--limel-theme-default-font-size);word-break:break-word}a{word-break:break-all}p{margin-top:0;margin-bottom:0.5rem}p:last-child{margin-bottom:0}a{transition:color 0.2s ease;color:var(--markdown-hyperlink-color, rgb(var(--color-blue-dark)));text-decoration:none}a:hover{color:var(--markdown-hyperlink-color--hovered, rgb(var(--color-blue-default)))}hr{margin:1.75rem 0 2rem 0;border-width:0;border-top:1px solid rgb(var(--contrast-500))}ul{list-style:none}ul>li{margin-left:0.75rem}ul>li:before{content:"";position:absolute;left:-0.5rem;top:0.5rem;width:0.25rem;height:0.25rem;border-radius:50%;background-color:rgb(var(--contrast-700));display:block}ol{margin-top:0.25rem;padding-left:1rem}ul{margin-top:0.25rem;padding-left:0}ul ul,ul ol,ol ol,ol ul{margin-left:0}li{position:relative;margin-bottom:0.25rem}:host(limel-markdown:not(.no-table-styles)) table{table-layout:auto;min-width:100%;border-collapse:collapse;border-spacing:0;background:transparent;margin:0.75rem 0}:host(limel-markdown:not(.no-table-styles)) tbody{border:1px solid rgb(var(--contrast-400));border-radius:0.25rem}:host(limel-markdown:not(.no-table-styles)) th,:host(limel-markdown:not(.no-table-styles)) td{text-align:left;vertical-align:top;transition:background-color 0.2s ease;font-size:var(--limel-theme-default-font-size)}:host(limel-markdown:not(.no-table-styles)) th p,:host(limel-markdown:not(.no-table-styles)) th li,:host(limel-markdown:not(.no-table-styles)) th a,:host(limel-markdown:not(.no-table-styles)) td p,:host(limel-markdown:not(.no-table-styles)) td li,:host(limel-markdown:not(.no-table-styles)) td a{word-break:normal;overflow-wrap:normal}:host(limel-markdown:not(.no-table-styles)) td{padding:0.5rem 0.375rem 0.75rem 0.375rem}:host(limel-markdown:not(.no-table-styles)) tr th{background-color:rgb(var(--contrast-400));padding:0.25rem 0.375rem;font-weight:normal}:host(limel-markdown:not(.no-table-styles)) tr th:only-child{text-align:center}:host(limel-markdown:not(.no-table-styles)) tbody tr:nth-child(odd) td{background-color:rgb(var(--contrast-200))}:host(limel-markdown:not(.no-table-styles)) tbody tr:hover td{background-color:rgb(var(--contrast-300))}table{display:block;box-sizing:border-box;overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}blockquote{position:relative;max-width:100%;margin:0.75rem 0;padding:0.5rem;border-left:0.25rem solid rgb(var(--contrast-500));background-color:rgb(var(--contrast-200))}blockquote:before,blockquote:after{position:absolute;line-height:0;font-size:2rem;opacity:0.4}blockquote:before{content:"“";left:-0.5rem;top:0.5rem}blockquote:after{content:"”";right:-0.25rem;bottom:-0.25rem}blockquote blockquote{padding-top:0;padding-right:0;padding-bottom:0;padding-left:0.25rem;border-color:rgb(var(--contrast-700));border-left-width:1px}blockquote blockquote:before,blockquote blockquote:after{display:none}blockquote:has(>blockquote){padding-left:0.25rem;padding-bottom:0}dl{display:grid;grid-template-columns:1fr 2fr;grid-template-rows:1fr;margin-bottom:2rem;border:1px solid rgb(var(--contrast-400));border-radius:0.375rem;background-color:rgb(var(--contrast-200))}dl dt,dl dd{padding:0.375rem 0.5rem;font-size:var(--limel-theme-default-font-size);margin:0}dl dt:nth-of-type(even),dl dd:nth-of-type(even){background-color:rgb(var(--contrast-300))}dl dt:first-child{border-top-left-radius:0.375rem}dl dt:last-child{border-bottom-left-radius:0.375rem}dl dd:first-child{border-top-right-radius:0.375rem}dl dd:last-child{border-bottom-right-radius:0.375rem}img{max-width:100%;border-radius:0.25rem}kbd{display:inline-block;font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-weight:600;color:rgb(var(--contrast-1100));white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:normal;border-radius:0.125rem;border-style:solid;border-color:rgb(var(--contrast-500));border-width:0 1px 0.1875rem 1px;padding:0.0625rem 0.375rem;margin:0 0.25rem;background-color:rgb(var(--contrast-200));box-shadow:var(--button-shadow-normal), 0 0.625rem 0.375rem -0.5rem rgb(var(--color-black), 0.02), 0 0.025rem 0.5rem 0 rgb(var(--contrast-100)) inset}:host(limel-markdown.adjust-for-table-cell) img{max-height:1.25rem;vertical-align:middle}:host(limel-markdown.adjust-for-table-cell) p{display:inline}:host(limel-markdown.adjust-for-table-cell) h1,:host(limel-markdown.adjust-for-table-cell) h2,:host(limel-markdown.adjust-for-table-cell) h3,:host(limel-markdown.adjust-for-table-cell) h4,:host(limel-markdown.adjust-for-table-cell) h5,:host(limel-markdown.adjust-for-table-cell) h6{display:inline-block;vertical-align:bottom;font-size:var(--limel-theme-default-font-size);margin:0 0.25rem 0 0;letter-spacing:normal;font-weight:500}:host(limel-markdown.adjust-for-table-cell) h1:before,:host(limel-markdown.adjust-for-table-cell) h2:before,:host(limel-markdown.adjust-for-table-cell) h3:before,:host(limel-markdown.adjust-for-table-cell) h4:before,:host(limel-markdown.adjust-for-table-cell) h5:before,:host(limel-markdown.adjust-for-table-cell) h6:before{opacity:0.6;vertical-align:middle;font-size:0.5rem;border-radius:0.25rem 0 0 0.25rem;padding:0.25rem;padding-right:2rem;margin-right:-1.75rem;background:linear-gradient(to right, rgb(var(--contrast-800), 0.6), rgb(var(--contrast-800), 0))}:host(limel-markdown.adjust-for-table-cell) h1:before{content:"H1"}:host(limel-markdown.adjust-for-table-cell) h2:before{content:"H2"}:host(limel-markdown.adjust-for-table-cell) h3:before{content:"H3"}:host(limel-markdown.adjust-for-table-cell) h4:before{content:"H4"}:host(limel-markdown.adjust-for-table-cell) h5:before{content:"H5"}:host(limel-markdown.adjust-for-table-cell) h6:before{content:"H6"}:host(limel-markdown.adjust-for-table-cell) pre{margin:0}:host(limel-markdown.adjust-for-table-cell) pre>code{padding:0.125rem;margin:0}:host(limel-markdown.adjust-for-table-cell) dl{margin:0}:host(limel-markdown.adjust-for-table-cell) dl dt,:host(limel-markdown.adjust-for-table-cell) dl dd{padding:0.00625rem 0.125rem}*,*::before,*::after{box-sizing:border-box}* :where(:not(img,video,svg,canvas,iframe)),*::before :where(:not(img,video,svg,canvas,iframe)),*::after :where(:not(img,video,svg,canvas,iframe)){min-width:0;min-height:0}hr{border-top:1px solid rgb(var(--contrast-700))}.MsoNormal{margin:0}:host(limel-markdown.reset-img-height) #markdown img{height:auto !important}';export{O as limel_markdown}
|