@record-evolution/widget-markdown 1.0.9 → 1.0.11
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/widget-markdown.js
CHANGED
|
@@ -5550,7 +5550,7 @@ te.registerLanguage("css", Ii);
|
|
|
5550
5550
|
te.registerLanguage("plaintext", vi);
|
|
5551
5551
|
let le = class extends qe {
|
|
5552
5552
|
constructor() {
|
|
5553
|
-
super(), this.version = "1.0.
|
|
5553
|
+
super(), this.version = "1.0.11", this.marked = new Yn(
|
|
5554
5554
|
hi({
|
|
5555
5555
|
emptyLangClass: "hljs",
|
|
5556
5556
|
langPrefix: "hljs language-",
|
|
@@ -5568,8 +5568,7 @@ let le = class extends qe {
|
|
|
5568
5568
|
this.registerTheme(this.theme);
|
|
5569
5569
|
}
|
|
5570
5570
|
registerTheme(t) {
|
|
5571
|
-
|
|
5572
|
-
this.themeBgColor = n || this.theme?.theme_object?.backgroundColor, this.themeTitleColor = e || this.theme?.theme_object?.title?.textStyle?.color, this.themeSubtitleColor = e || this.theme?.theme_object?.title?.subtextStyle?.color || this.themeTitleColor;
|
|
5571
|
+
this.themeBgColor = `var(--re-tile-background-color, ${this.theme?.theme_object?.backgroundColor || "transparent"})`, this.themeTitleColor = `var(--re-text-color, ${this.theme?.theme_object?.title?.textStyle?.color || "inherit"})`, this.themeSubtitleColor = `var(--re-text-color, ${this.theme?.theme_object?.title?.subtextStyle?.color || this.theme?.theme_object?.title?.textStyle?.color || "inherit"})`;
|
|
5573
5572
|
}
|
|
5574
5573
|
/**
|
|
5575
5574
|
* Converts {{variableName}} to spans with data attributes for efficient updating.
|
|
@@ -5582,22 +5581,28 @@ let le = class extends qe {
|
|
|
5582
5581
|
* Updates variable spans in the rendered DOM without recreating the entire structure.
|
|
5583
5582
|
*/
|
|
5584
5583
|
updated(t) {
|
|
5585
|
-
super.updated(t), t.has("inputData")
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
if (s == null)
|
|
5590
|
-
n.textContent = "";
|
|
5591
|
-
else if (typeof s == "object")
|
|
5592
|
-
try {
|
|
5593
|
-
n.textContent = JSON.stringify(s);
|
|
5594
|
-
} catch {
|
|
5595
|
-
n.textContent = "";
|
|
5596
|
-
}
|
|
5597
|
-
else
|
|
5598
|
-
n.textContent = String(s);
|
|
5584
|
+
if (super.updated(t), t.has("inputData")) {
|
|
5585
|
+
if (!this.inputData?.verticalScroll) {
|
|
5586
|
+
const n = this.shadowRoot?.querySelector(".wrapper");
|
|
5587
|
+
n && (n.scrollTop = 0);
|
|
5599
5588
|
}
|
|
5600
|
-
|
|
5589
|
+
this.shadowRoot?.querySelectorAll(".md-var")?.forEach((n) => {
|
|
5590
|
+
const o = n.getAttribute("data-var");
|
|
5591
|
+
if (o) {
|
|
5592
|
+
const s = this.inputData?.data?.find((i) => i.label === o)?.value;
|
|
5593
|
+
if (s == null)
|
|
5594
|
+
n.textContent = "";
|
|
5595
|
+
else if (typeof s == "object")
|
|
5596
|
+
try {
|
|
5597
|
+
n.textContent = JSON.stringify(s);
|
|
5598
|
+
} catch {
|
|
5599
|
+
n.textContent = "";
|
|
5600
|
+
}
|
|
5601
|
+
else
|
|
5602
|
+
n.textContent = String(s);
|
|
5603
|
+
}
|
|
5604
|
+
});
|
|
5605
|
+
}
|
|
5601
5606
|
}
|
|
5602
5607
|
render() {
|
|
5603
5608
|
const t = String(this.inputData?.markdown ?? "");
|
|
@@ -5607,7 +5612,11 @@ let le = class extends qe {
|
|
|
5607
5612
|
this.cachedHtmlTemplate = this.marked.parse(e);
|
|
5608
5613
|
}
|
|
5609
5614
|
return fo`
|
|
5610
|
-
<div
|
|
5615
|
+
<div
|
|
5616
|
+
class="wrapper"
|
|
5617
|
+
?scrollable=${this.inputData?.verticalScroll}
|
|
5618
|
+
style="background-color: ${this.themeBgColor}"
|
|
5619
|
+
>
|
|
5611
5620
|
<div class="paging markdown-body" ?active=${this.inputData?.markdown}>
|
|
5612
5621
|
${To(this.cachedHtmlTemplate ?? "")}
|
|
5613
5622
|
</div>
|
|
@@ -5636,7 +5645,10 @@ le.styles = [
|
|
|
5636
5645
|
flex-direction: column;
|
|
5637
5646
|
width: 100%;
|
|
5638
5647
|
height: 100%;
|
|
5639
|
-
overflow: auto;
|
|
5648
|
+
overflow-x: auto;
|
|
5649
|
+
/* Vertical scrolling is opt-in via the verticalScroll setting; by
|
|
5650
|
+
default overlong content is clipped rather than scrollable. */
|
|
5651
|
+
overflow-y: hidden;
|
|
5640
5652
|
padding: 1cqh 1cqw;
|
|
5641
5653
|
box-sizing: border-box;
|
|
5642
5654
|
/* Derive scrollbar colors from the (inherited) text color so they
|
|
@@ -5664,6 +5676,10 @@ le.styles = [
|
|
|
5664
5676
|
background-color: color-mix(in srgb, currentColor 55%, transparent);
|
|
5665
5677
|
}
|
|
5666
5678
|
|
|
5679
|
+
.wrapper[scrollable] {
|
|
5680
|
+
overflow-y: auto;
|
|
5681
|
+
}
|
|
5682
|
+
|
|
5667
5683
|
h2 {
|
|
5668
5684
|
margin: 0;
|
|
5669
5685
|
padding: 0px;
|
|
@@ -5710,7 +5726,7 @@ ye([
|
|
|
5710
5726
|
Ye()
|
|
5711
5727
|
], le.prototype, "lastMarkdown", 2);
|
|
5712
5728
|
le = ye([
|
|
5713
|
-
Pi("widget-markdown-1.0.
|
|
5729
|
+
Pi("widget-markdown-1.0.11")
|
|
5714
5730
|
], le);
|
|
5715
5731
|
export {
|
|
5716
5732
|
le as WidgetMarkdown
|