markstream-angular 0.0.1-alpha.3 → 0.0.1-alpha.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.
Files changed (2) hide show
  1. package/dist/index.js +119 -114
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CommonModule as S } from "@angular/common";
2
2
  import { Input as l, Component as x, ChangeDetectionStrategy as b, forwardRef as p, inject as Q, ChangeDetectorRef as De, ViewChild as j, ViewContainerRef as fi, ElementRef as lo, Renderer2 as pi, Directive as gi, HostListener as co, EventEmitter as ut, Output as Ct } from "@angular/core";
3
3
  import { parseMarkdownToStructure as Zr, getMarkdown as Yr } from "stream-markdown-parser";
4
- const Rt = /<\/?([A-Z][\w:-]*)(?:\s[^<>]*)?>/gi;
4
+ const $t = /<\/?([A-Z][\w:-]*)(?:\s[^<>]*)?>/gi;
5
5
  function Jr(e, t, r) {
6
6
  const o = bi(r), n = new Set(o);
7
7
  if (!t || n.size === 0 || !Array.isArray(e) || e.length === 0)
@@ -30,7 +30,7 @@ function Jr(e, t, r) {
30
30
  function yi(e, t) {
31
31
  const r = [], o = [];
32
32
  let n;
33
- for (Rt.lastIndex = 0; (n = Rt.exec(e)) !== null; ) {
33
+ for ($t.lastIndex = 0; (n = $t.exec(e)) !== null; ) {
34
34
  const i = n[0], s = zt(n[1]);
35
35
  if (!s || !t.has(s))
36
36
  continue;
@@ -38,14 +38,14 @@ function yi(e, t) {
38
38
  r.push({
39
39
  tag: s,
40
40
  start: n.index,
41
- openEnd: Rt.lastIndex
41
+ openEnd: $t.lastIndex
42
42
  });
43
43
  continue;
44
44
  }
45
45
  const c = vi(r, s);
46
46
  if (c < 0)
47
47
  continue;
48
- const [d] = r.splice(c, 1), u = n.index, h = Rt.lastIndex;
48
+ const [d] = r.splice(c, 1), u = n.index, h = $t.lastIndex;
49
49
  o.push({
50
50
  tag: s,
51
51
  start: d.start,
@@ -173,16 +173,16 @@ function Mi(e) {
173
173
  function Oi(e) {
174
174
  return Array.isArray(e) ? e : [];
175
175
  }
176
- const rr = "__global__", $r = "__MARKSTREAM_ANGULAR_CUSTOM_COMPONENTS_STORE__", X = (() => {
176
+ const rr = "__global__", Rr = "__MARKSTREAM_ANGULAR_CUSTOM_COMPONENTS_STORE__", X = (() => {
177
177
  const e = globalThis;
178
- if (e[$r])
179
- return e[$r];
178
+ if (e[Rr])
179
+ return e[Rr];
180
180
  const t = {
181
181
  scopedComponents: {},
182
182
  revision: 0,
183
183
  listeners: /* @__PURE__ */ new Set()
184
184
  };
185
- return e[$r] = t, t;
185
+ return e[Rr] = t, t;
186
186
  })();
187
187
  function en() {
188
188
  X.revision += 1;
@@ -275,7 +275,7 @@ function Ii(e, t = {}, r) {
275
275
  events: t
276
276
  };
277
277
  }
278
- function $i(e) {
278
+ function Ri(e) {
279
279
  if (Array.isArray(e.nodes))
280
280
  return e.nodes;
281
281
  const t = C(e.content);
@@ -296,7 +296,7 @@ function $i(e) {
296
296
  r
297
297
  );
298
298
  }
299
- function $(e) {
299
+ function R(e) {
300
300
  return Array.isArray(e) ? e.filter((t) => !!t && typeof t == "object") : [];
301
301
  }
302
302
  function C(e) {
@@ -307,12 +307,12 @@ function ho(e) {
307
307
  return [];
308
308
  const t = /* @__PURE__ */ new Set(), r = [];
309
309
  for (const o of e) {
310
- const n = Ri(o);
310
+ const n = $i(o);
311
311
  !n || t.has(n) || (t.add(n), r.push(n));
312
312
  }
313
313
  return r;
314
314
  }
315
- function Ri(e) {
315
+ function $i(e) {
316
316
  const t = C(e).trim();
317
317
  if (!t)
318
318
  return "";
@@ -373,7 +373,7 @@ var zi = Object.defineProperty, Wi = Object.getOwnPropertyDescriptor, nr = (e, t
373
373
  };
374
374
  let ze = class {
375
375
  get children() {
376
- return $(this.node?.children);
376
+ return R(this.node?.children);
377
377
  }
378
378
  get cite() {
379
379
  const e = this.node?.cite;
@@ -469,7 +469,7 @@ function yo() {
469
469
  }
470
470
  };
471
471
  }
472
- let pe = null, Rr = !1, ht = null, In = !1;
472
+ let pe = null, $r = !1, ht = null, In = !1;
473
473
  async function Xi(e) {
474
474
  if (In)
475
475
  return;
@@ -496,14 +496,14 @@ async function vo() {
496
496
  return pe;
497
497
  if (ht)
498
498
  return await ht;
499
- if (Rr)
499
+ if ($r)
500
500
  return null;
501
501
  ht = (async () => {
502
502
  try {
503
503
  const e = await import("stream-monaco");
504
- return pe = e?.default ?? e, await Xi(pe), await Gi(pe) ? pe : (pe = null, Rr = !0, null);
504
+ return pe = e?.default ?? e, await Xi(pe), await Gi(pe) ? pe : (pe = null, $r = !0, null);
505
505
  } catch {
506
- return Rr = !0, null;
506
+ return $r = !0, null;
507
507
  }
508
508
  })();
509
509
  try {
@@ -527,7 +527,7 @@ const ye = `
527
527
  <path d="M12 9v2.5" />
528
528
  <path d="M12 11.5l-3.5 3.5" />
529
529
  <path d="M12 11.5l3.5 3.5" />
530
- </svg>`, $n = `
530
+ </svg>`, Rn = `
531
531
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
532
532
  <path d="M8 7l-4 5l4 5" />
533
533
  <path d="M16 7l4 5l-4 5" />
@@ -542,7 +542,7 @@ const ye = `
542
542
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
543
543
  <path d="M9 4c-2 0-3 1.5-3 3.5v2c0 1.1-.4 1.8-1.5 2.5C5.6 12.7 6 13.4 6 14.5v2C6 18.5 7 20 9 20" />
544
544
  <path d="M15 4c2 0 3 1.5 3 3.5v2c0 1.1.4 1.8 1.5 2.5c-1.1.7-1.5 1.4-1.5 2.5v2c0 2-1 3.5-3 3.5" />
545
- </svg>`, Rn = `
545
+ </svg>`, $n = `
546
546
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
547
547
  <path d="M5 6h14" />
548
548
  <path d="M12 6v12" />
@@ -581,17 +581,17 @@ const ye = `
581
581
  typescript: "TypeScript",
582
582
  vue: "Vue"
583
583
  }, ts = {
584
- "": Rn,
585
- html: $n,
584
+ "": $n,
585
+ html: Rn,
586
586
  javascript: ye,
587
587
  json: Ji,
588
588
  jsx: ye,
589
589
  markdown: Yi,
590
590
  mermaid: Zi,
591
- plain: Rn,
591
+ plain: $n,
592
592
  python: ye,
593
593
  shell: ye,
594
- svg: $n,
594
+ svg: Rn,
595
595
  tsx: ye,
596
596
  typescript: ye
597
597
  };
@@ -1717,13 +1717,13 @@ let We = class {
1717
1717
  this.trackByIndex = (e) => `${this.indexKey || "definition-list"}-${e}`;
1718
1718
  }
1719
1719
  get items() {
1720
- return $(this.node?.items);
1720
+ return R(this.node?.items);
1721
1721
  }
1722
1722
  termFor(e) {
1723
- return $(e?.term);
1723
+ return R(e?.term);
1724
1724
  }
1725
1725
  definitionFor(e) {
1726
- return $(e?.definition);
1726
+ return R(e?.definition);
1727
1727
  }
1728
1728
  itemPrefix(e, t) {
1729
1729
  return `${this.indexKey || "definition-list"}-${e}-${t}`;
@@ -1860,7 +1860,7 @@ var Os = Object.defineProperty, Es = Object.getOwnPropertyDescriptor, ir = (e, t
1860
1860
  };
1861
1861
  let qe = class {
1862
1862
  get children() {
1863
- return $(this.node?.children);
1863
+ return R(this.node?.children);
1864
1864
  }
1865
1865
  get nestedPrefix() {
1866
1866
  return `${this.indexKey || "emphasis"}-em`;
@@ -1899,7 +1899,7 @@ var Ds = Object.defineProperty, Is = Object.getOwnPropertyDescriptor, sr = (e, t
1899
1899
  };
1900
1900
  let Ve = class {
1901
1901
  get children() {
1902
- return $(this.node?.children);
1902
+ return R(this.node?.children);
1903
1903
  }
1904
1904
  get hasChildren() {
1905
1905
  return this.children.length > 0;
@@ -1962,10 +1962,10 @@ Ve = sr([
1962
1962
  changeDetection: b.OnPush
1963
1963
  })
1964
1964
  ], Ve);
1965
- var $s = Object.defineProperty, Rs = Object.getOwnPropertyDescriptor, Po = (e, t, r, o) => {
1966
- for (var n = o > 1 ? void 0 : o ? Rs(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1965
+ var Rs = Object.defineProperty, $s = Object.getOwnPropertyDescriptor, Po = (e, t, r, o) => {
1966
+ for (var n = o > 1 ? void 0 : o ? $s(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1967
1967
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
1968
- return o && n && $s(t, r, n), n;
1968
+ return o && n && Rs(t, r, n), n;
1969
1969
  };
1970
1970
  let Vt = class {
1971
1971
  get id() {
@@ -2007,7 +2007,7 @@ let Ue = class {
2007
2007
  return `fnref--${C(this.node?.id)}`;
2008
2008
  }
2009
2009
  get children() {
2010
- return $(this.node?.children);
2010
+ return R(this.node?.children);
2011
2011
  }
2012
2012
  get nestedPrefix() {
2013
2013
  return `${this.indexKey || "footnote"}-children`;
@@ -2148,7 +2148,7 @@ let Xe = class {
2148
2148
  return e && typeof e == "object" ? e : null;
2149
2149
  }
2150
2150
  get children() {
2151
- return $(this.node?.children);
2151
+ return R(this.node?.children);
2152
2152
  }
2153
2153
  get nestedPrefix() {
2154
2154
  return `${this.indexKey || "heading"}-${this.level}`;
@@ -2198,7 +2198,7 @@ var qs = Object.defineProperty, Vs = Object.getOwnPropertyDescriptor, cr = (e, t
2198
2198
  };
2199
2199
  let Ge = class {
2200
2200
  get children() {
2201
- return $(this.node?.children);
2201
+ return R(this.node?.children);
2202
2202
  }
2203
2203
  get nestedPrefix() {
2204
2204
  return `${this.indexKey || "highlight"}-highlight`;
@@ -2572,7 +2572,7 @@ async function Oo() {
2572
2572
  return typeof t == "function" && t.prototype && t.prototype.render ? r = t : e?.Infographic ? r = e.Infographic : t && t.Infographic && (r = t.Infographic), Ar = r, r;
2573
2573
  }).catch((e) => (console.warn("[markstream-angular] Failed to load @antv/infographic", e), null)), await At));
2574
2574
  }
2575
- var sa = Object.defineProperty, aa = Object.getOwnPropertyDescriptor, $e = (e, t, r, o) => {
2575
+ var sa = Object.defineProperty, aa = Object.getOwnPropertyDescriptor, Re = (e, t, r, o) => {
2576
2576
  for (var n = o > 1 ? void 0 : o ? aa(t, r) : t, i = e.length - 1, s; i >= 0; i--)
2577
2577
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
2578
2578
  return o && n && sa(t, r, n), n;
@@ -2745,25 +2745,25 @@ let re = class {
2745
2745
  });
2746
2746
  }
2747
2747
  };
2748
- $e([
2748
+ Re([
2749
2749
  j("previewHost")
2750
2750
  ], re.prototype, "previewHost", 2);
2751
- $e([
2751
+ Re([
2752
2752
  j("modalHost")
2753
2753
  ], re.prototype, "modalHost", 2);
2754
- $e([
2754
+ Re([
2755
2755
  l({ required: !0 })
2756
2756
  ], re.prototype, "node", 2);
2757
- $e([
2757
+ Re([
2758
2758
  l()
2759
2759
  ], re.prototype, "context", 2);
2760
- $e([
2760
+ Re([
2761
2761
  l()
2762
2762
  ], re.prototype, "props", 2);
2763
- $e([
2763
+ Re([
2764
2764
  co("window:keydown", ["$event"])
2765
2765
  ], re.prototype, "handleWindowKeydown", 1);
2766
- re = $e([
2766
+ re = Re([
2767
2767
  x({
2768
2768
  selector: "markstream-angular-infographic-block-node",
2769
2769
  standalone: !0,
@@ -2984,7 +2984,7 @@ var da = Object.defineProperty, ua = Object.getOwnPropertyDescriptor, hr = (e, t
2984
2984
  };
2985
2985
  let Je = class {
2986
2986
  get children() {
2987
- return $(this.node?.children);
2987
+ return R(this.node?.children);
2988
2988
  }
2989
2989
  get nestedPrefix() {
2990
2990
  return `${this.indexKey || "insert"}-insert`;
@@ -3047,12 +3047,12 @@ function se(e) {
3047
3047
  const t = e[0];
3048
3048
  return t === "t" || t === "b" ? "y" : "x";
3049
3049
  }
3050
- function $o(e) {
3050
+ function Ro(e) {
3051
3051
  return Do(se(e));
3052
3052
  }
3053
3053
  function ma(e, t, r) {
3054
3054
  r === void 0 && (r = !1);
3055
- const o = fr(e), n = $o(e), i = Io(n);
3055
+ const o = fr(e), n = Ro(e), i = Io(n);
3056
3056
  let s = n === "x" ? o === (r ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
3057
3057
  return t.reference[i] > t.floating[i] && (s = Yt(s)), [s, Yt(s)];
3058
3058
  }
@@ -3125,7 +3125,7 @@ function Fn(e, t, r) {
3125
3125
  reference: o,
3126
3126
  floating: n
3127
3127
  } = e;
3128
- const i = se(t), s = $o(t), a = Io(s), c = Se(t), d = i === "y", u = o.x + o.width / 2 - n.width / 2, h = o.y + o.height / 2 - n.height / 2, m = o[a] / 2 - n[a] / 2;
3128
+ const i = se(t), s = Ro(t), a = Io(s), c = Se(t), d = i === "y", u = o.x + o.width / 2 - n.width / 2, h = o.y + o.height / 2 - n.height / 2, m = o[a] / 2 - n[a] / 2;
3129
3129
  let f;
3130
3130
  switch (c) {
3131
3131
  case "top":
@@ -3194,7 +3194,7 @@ async function ba(e, t) {
3194
3194
  y: n,
3195
3195
  width: s.floating.width,
3196
3196
  height: s.floating.height
3197
- } : s.reference, E = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(a.floating)), R = await (i.isElement == null ? void 0 : i.isElement(E)) ? await (i.getScale == null ? void 0 : i.getScale(E)) || {
3197
+ } : s.reference, E = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(a.floating)), $ = await (i.isElement == null ? void 0 : i.isElement(E)) ? await (i.getScale == null ? void 0 : i.getScale(E)) || {
3198
3198
  x: 1,
3199
3199
  y: 1
3200
3200
  } : {
@@ -3207,10 +3207,10 @@ async function ba(e, t) {
3207
3207
  strategy: c
3208
3208
  }) : M);
3209
3209
  return {
3210
- top: (v.top - z.top + g.top) / R.y,
3211
- bottom: (z.bottom - v.bottom + g.bottom) / R.y,
3212
- left: (v.left - z.left + g.left) / R.x,
3213
- right: (z.right - v.right + g.right) / R.x
3210
+ top: (v.top - z.top + g.top) / $.y,
3211
+ bottom: (z.bottom - v.bottom + g.bottom) / $.y,
3212
+ left: (v.left - z.left + g.left) / $.x,
3213
+ right: (z.right - v.right + g.right) / $.x
3214
3214
  };
3215
3215
  }
3216
3216
  const ka = 50, Ca = async (e, t, r) => {
@@ -3241,7 +3241,7 @@ const ka = 50, Ca = async (e, t, r) => {
3241
3241
  fn: M
3242
3242
  } = T, {
3243
3243
  x: E,
3244
- y: R,
3244
+ y: $,
3245
3245
  data: z,
3246
3246
  reset: H
3247
3247
  } = await M({
@@ -3258,7 +3258,7 @@ const ka = 50, Ca = async (e, t, r) => {
3258
3258
  floating: t
3259
3259
  }
3260
3260
  });
3261
- u = E ?? u, h = R ?? h, g[v] = {
3261
+ u = E ?? u, h = $ ?? h, g[v] = {
3262
3262
  ...g[v],
3263
3263
  ...z
3264
3264
  }, H && f < ka && (f++, typeof H == "object" && (H.placement && (m = H.placement), H.rects && (d = H.rects === !0 ? await s.getElementRects({
@@ -3301,18 +3301,18 @@ const ka = 50, Ca = async (e, t, r) => {
3301
3301
  } = mr(e, t);
3302
3302
  if ((r = i.arrow) != null && r.alignmentOffset)
3303
3303
  return {};
3304
- const v = Se(n), M = se(a), E = Se(a) === a, R = await (c.isRTL == null ? void 0 : c.isRTL(d.floating)), z = m || (E || !y ? [Yt(a)] : fa(a)), H = g !== "none";
3305
- !m && H && z.push(...va(a, y, g, R));
3306
- const Ae = [a, ...z], Dr = await c.detectOverflow(t, T), $t = [];
3304
+ const v = Se(n), M = se(a), E = Se(a) === a, $ = await (c.isRTL == null ? void 0 : c.isRTL(d.floating)), z = m || (E || !y ? [Yt(a)] : fa(a)), H = g !== "none";
3305
+ !m && H && z.push(...va(a, y, g, $));
3306
+ const Ae = [a, ...z], Dr = await c.detectOverflow(t, T), Rt = [];
3307
3307
  let Ne = ((o = i.flip) == null ? void 0 : o.overflows) || [];
3308
- if (u && $t.push(Dr[v]), h) {
3309
- const me = ma(n, s, R);
3310
- $t.push(Dr[me[0]], Dr[me[1]]);
3308
+ if (u && Rt.push(Dr[v]), h) {
3309
+ const me = ma(n, s, $);
3310
+ Rt.push(Dr[me[0]], Dr[me[1]]);
3311
3311
  }
3312
3312
  if (Ne = [...Ne, {
3313
3313
  placement: n,
3314
- overflows: $t
3315
- }], !$t.every((me) => me <= 0)) {
3314
+ overflows: Rt
3315
+ }], !Rt.every((me) => me <= 0)) {
3316
3316
  var Sn, Mn;
3317
3317
  const me = (((Sn = i.flip) == null ? void 0 : Sn.index) || 0) + 1, Ir = Ae[me];
3318
3318
  if (Ir && (!(h === "alignment" ? M !== se(Ir) : !1) || // We leave the current main axis only if every placement on that axis
@@ -3440,12 +3440,12 @@ const Sa = function(e) {
3440
3440
  }, h = await i.detectOverflow(t, d), m = se(Se(n)), f = Do(m);
3441
3441
  let g = u[f], y = u[m];
3442
3442
  if (s) {
3443
- const v = f === "y" ? "top" : "left", M = f === "y" ? "bottom" : "right", E = g + h[v], R = g - h[M];
3444
- g = Ln(E, g, R);
3443
+ const v = f === "y" ? "top" : "left", M = f === "y" ? "bottom" : "right", E = g + h[v], $ = g - h[M];
3444
+ g = Ln(E, g, $);
3445
3445
  }
3446
3446
  if (a) {
3447
- const v = m === "y" ? "top" : "left", M = m === "y" ? "bottom" : "right", E = y + h[v], R = y - h[M];
3448
- y = Ln(E, y, R);
3447
+ const v = m === "y" ? "top" : "left", M = m === "y" ? "bottom" : "right", E = y + h[v], $ = y - h[M];
3448
+ y = Ln(E, y, $);
3449
3449
  }
3450
3450
  const T = c.fn({
3451
3451
  ...t,
@@ -3470,7 +3470,7 @@ function pr() {
3470
3470
  return typeof window < "u";
3471
3471
  }
3472
3472
  function ct(e) {
3473
- return Ro(e) ? (e.nodeName || "").toLowerCase() : "#document";
3473
+ return $o(e) ? (e.nodeName || "").toLowerCase() : "#document";
3474
3474
  }
3475
3475
  function K(e) {
3476
3476
  var t;
@@ -3478,9 +3478,9 @@ function K(e) {
3478
3478
  }
3479
3479
  function ee(e) {
3480
3480
  var t;
3481
- return (t = (Ro(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
3481
+ return (t = ($o(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
3482
3482
  }
3483
- function Ro(e) {
3483
+ function $o(e) {
3484
3484
  return pr() ? e instanceof Node || e instanceof K(e).Node : !1;
3485
3485
  }
3486
3486
  function G(e) {
@@ -3608,15 +3608,15 @@ function Ke(e) {
3608
3608
  y: a
3609
3609
  };
3610
3610
  }
3611
- const $a = /* @__PURE__ */ J(0);
3611
+ const Ra = /* @__PURE__ */ J(0);
3612
3612
  function Lo(e) {
3613
3613
  const t = K(e);
3614
- return !mn() || !t.visualViewport ? $a : {
3614
+ return !mn() || !t.visualViewport ? Ra : {
3615
3615
  x: t.visualViewport.offsetLeft,
3616
3616
  y: t.visualViewport.offsetTop
3617
3617
  };
3618
3618
  }
3619
- function Ra(e, t, r) {
3619
+ function $a(e, t, r) {
3620
3620
  return t === void 0 && (t = !1), !r || t && r !== K(e) ? !1 : t;
3621
3621
  }
3622
3622
  function Me(e, t, r, o) {
@@ -3624,14 +3624,14 @@ function Me(e, t, r, o) {
3624
3624
  const n = e.getBoundingClientRect(), i = fn(e);
3625
3625
  let s = J(1);
3626
3626
  t && (o ? G(o) && (s = Ke(o)) : s = Ke(e));
3627
- const a = Ra(i, r, o) ? Lo(i) : J(0);
3627
+ const a = $a(i, r, o) ? Lo(i) : J(0);
3628
3628
  let c = (n.left + a.x) / s.x, d = (n.top + a.y) / s.y, u = n.width / s.x, h = n.height / s.y;
3629
3629
  if (i) {
3630
3630
  const m = K(i), f = o && G(o) ? K(o) : o;
3631
3631
  let g = m, y = zr(g);
3632
3632
  for (; y && o && f !== g; ) {
3633
- const T = Ke(y), v = y.getBoundingClientRect(), M = Z(y), E = v.left + (y.clientLeft + parseFloat(M.paddingLeft)) * T.x, R = v.top + (y.clientTop + parseFloat(M.paddingTop)) * T.y;
3634
- c *= T.x, d *= T.y, u *= T.x, h *= T.y, c += E, d += R, g = K(y), y = zr(g);
3633
+ const T = Ke(y), v = y.getBoundingClientRect(), M = Z(y), E = v.left + (y.clientLeft + parseFloat(M.paddingLeft)) * T.x, $ = v.top + (y.clientTop + parseFloat(M.paddingTop)) * T.y;
3634
+ c *= T.x, d *= T.y, u *= T.x, h *= T.y, c += E, d += $, g = K(y), y = zr(g);
3635
3635
  }
3636
3636
  }
3637
3637
  return Jt({
@@ -3893,17 +3893,17 @@ function Ua(e, t) {
3893
3893
  rootMargin: -g + "px " + -y + "px " + -T + "px " + -v + "px",
3894
3894
  threshold: ke(0, Gt(1, c)) || 1
3895
3895
  };
3896
- let R = !0;
3896
+ let $ = !0;
3897
3897
  function z(H) {
3898
3898
  const Ae = H[0].intersectionRatio;
3899
3899
  if (Ae !== c) {
3900
- if (!R)
3900
+ if (!$)
3901
3901
  return s();
3902
3902
  Ae ? s(!1, Ae) : o = setTimeout(() => {
3903
3903
  s(!1, 1e-7);
3904
3904
  }, 1e3);
3905
3905
  }
3906
- Ae === 1 && !Ko(d, e.getBoundingClientRect()) && s(), R = !1;
3906
+ Ae === 1 && !Ko(d, e.getBoundingClientRect()) && s(), $ = !1;
3907
3907
  }
3908
3908
  try {
3909
3909
  r = new IntersectionObserver(z, {
@@ -4126,7 +4126,7 @@ let Oe = class {
4126
4126
  return this.context?.showTooltips !== !1;
4127
4127
  }
4128
4128
  get children() {
4129
- return $(this.node?.children);
4129
+ return R(this.node?.children);
4130
4130
  }
4131
4131
  get hasChildren() {
4132
4132
  return this.children.length > 0;
@@ -4239,7 +4239,7 @@ var il = Object.defineProperty, sl = Object.getOwnPropertyDescriptor, Dt = (e, t
4239
4239
  };
4240
4240
  let ue = class {
4241
4241
  get children() {
4242
- return $(this.node?.children);
4242
+ return R(this.node?.children);
4243
4243
  }
4244
4244
  get nestedPrefix() {
4245
4245
  return `${this.indexKey || "list-item"}-item`;
@@ -4290,7 +4290,7 @@ let et = class {
4290
4290
  return Number(this.node?.start) || 1;
4291
4291
  }
4292
4292
  get items() {
4293
- return $(this.node?.items);
4293
+ return R(this.node?.items);
4294
4294
  }
4295
4295
  itemPrefix(e) {
4296
4296
  return `${this.indexKey || "list"}-${e}`;
@@ -4961,7 +4961,7 @@ function Ed() {
4961
4961
  L = null;
4962
4962
  }
4963
4963
  }
4964
- var _l = Object.defineProperty, Sl = Object.getOwnPropertyDescriptor, Re = (e, t, r, o) => {
4964
+ var _l = Object.defineProperty, Sl = Object.getOwnPropertyDescriptor, $e = (e, t, r, o) => {
4965
4965
  for (var n = o > 1 ? void 0 : o ? Sl(t, r) : t, i = e.length - 1, s; i >= 0; i--)
4966
4966
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
4967
4967
  return o && n && _l(t, r, n), n;
@@ -5150,6 +5150,11 @@ let ne = class {
5150
5150
  } catch (r) {
5151
5151
  if (this.destroyed || t !== this.renderToken)
5152
5152
  return;
5153
+ const o = this.mergedProps.onRenderError;
5154
+ if (typeof o == "function" && this.previewHost?.nativeElement && o(r, this.code, this.previewHost.nativeElement) === !0) {
5155
+ this.svgMarkup = "";
5156
+ return;
5157
+ }
5153
5158
  this.svgMarkup = "", this.showSource = !0, this.error = r instanceof Error ? r.message : "Failed to render Mermaid diagram.", this.syncSvgHosts();
5154
5159
  } finally {
5155
5160
  t === this.renderToken && (this.rendering = !1, this.cdr.markForCheck());
@@ -5236,25 +5241,25 @@ ${e}`;
5236
5241
  });
5237
5242
  }
5238
5243
  };
5239
- Re([
5244
+ $e([
5240
5245
  j("previewHost")
5241
5246
  ], ne.prototype, "previewHost", 2);
5242
- Re([
5247
+ $e([
5243
5248
  j("modalHost")
5244
5249
  ], ne.prototype, "modalHost", 2);
5245
- Re([
5250
+ $e([
5246
5251
  l({ required: !0 })
5247
5252
  ], ne.prototype, "node", 2);
5248
- Re([
5253
+ $e([
5249
5254
  l()
5250
5255
  ], ne.prototype, "context", 2);
5251
- Re([
5256
+ $e([
5252
5257
  l()
5253
5258
  ], ne.prototype, "props", 2);
5254
- Re([
5259
+ $e([
5255
5260
  co("window:keydown", ["$event"])
5256
5261
  ], ne.prototype, "handleWindowKeydown", 1);
5257
- ne = Re([
5262
+ ne = $e([
5258
5263
  x({
5259
5264
  selector: "markstream-angular-mermaid-block-node",
5260
5265
  standalone: !0,
@@ -5408,7 +5413,7 @@ let tt = class {
5408
5413
  this.segments = [], this.trackByIndex = (e) => `${this.indexKey || "paragraph"}-${e}`;
5409
5414
  }
5410
5415
  get children() {
5411
- return $(this.node?.children);
5416
+ return R(this.node?.children);
5412
5417
  }
5413
5418
  ngOnChanges() {
5414
5419
  this.segments = ji(this.children);
@@ -5499,7 +5504,7 @@ function ni(e, t) {
5499
5504
  function Pn(e) {
5500
5505
  return String(e?.tag || "").trim().toLowerCase() || Bi(e?.content);
5501
5506
  }
5502
- function $l(e) {
5507
+ function Rl(e) {
5503
5508
  const t = Pn(e);
5504
5509
  return t ? {
5505
5510
  ...e,
@@ -5508,7 +5513,7 @@ function $l(e) {
5508
5513
  content: Hi(e?.content, t)
5509
5514
  } : e;
5510
5515
  }
5511
- function Rl(e, t) {
5516
+ function $l(e, t) {
5512
5517
  const r = Pn(e);
5513
5518
  return r ? {
5514
5519
  ...e,
@@ -5529,7 +5534,7 @@ var Nl = Object.defineProperty, Ll = Object.getOwnPropertyDescriptor, br = (e, t
5529
5534
  };
5530
5535
  let rt = class {
5531
5536
  get children() {
5532
- return $(this.node?.children);
5537
+ return R(this.node?.children);
5533
5538
  }
5534
5539
  get nestedPrefix() {
5535
5540
  return `${this.indexKey || "strikethrough"}-strike`;
@@ -5568,7 +5573,7 @@ var Bl = Object.defineProperty, Hl = Object.getOwnPropertyDescriptor, kr = (e, t
5568
5573
  };
5569
5574
  let nt = class {
5570
5575
  get children() {
5571
- return $(this.node?.children);
5576
+ return R(this.node?.children);
5572
5577
  }
5573
5578
  get nestedPrefix() {
5574
5579
  return `${this.indexKey || "strong"}-strong`;
@@ -5607,7 +5612,7 @@ var Fl = Object.defineProperty, Kl = Object.getOwnPropertyDescriptor, Cr = (e, t
5607
5612
  };
5608
5613
  let ot = class {
5609
5614
  get children() {
5610
- return $(this.node?.children);
5615
+ return R(this.node?.children);
5611
5616
  }
5612
5617
  get nestedPrefix() {
5613
5618
  return `${this.indexKey || "subscript"}-sub`;
@@ -5646,7 +5651,7 @@ var jl = Object.defineProperty, zl = Object.getOwnPropertyDescriptor, Pr = (e, t
5646
5651
  };
5647
5652
  let it = class {
5648
5653
  get children() {
5649
- return $(this.node?.children);
5654
+ return R(this.node?.children);
5650
5655
  }
5651
5656
  get nestedPrefix() {
5652
5657
  return `${this.indexKey || "superscript"}-sup`;
@@ -5692,13 +5697,13 @@ let st = class {
5692
5697
  return e && typeof e == "object" ? e : null;
5693
5698
  }
5694
5699
  get rows() {
5695
- return $(this.node?.rows);
5700
+ return R(this.node?.rows);
5696
5701
  }
5697
5702
  cellsFor(e) {
5698
- return $(e?.cells);
5703
+ return R(e?.cells);
5699
5704
  }
5700
5705
  childrenFor(e) {
5701
- return $(e?.children);
5706
+ return R(e?.children);
5702
5707
  }
5703
5708
  alignment(e) {
5704
5709
  return C(e?.align);
@@ -5776,7 +5781,7 @@ var Xl = Object.defineProperty, Gl = Object.getOwnPropertyDescriptor, _r = (e, t
5776
5781
  };
5777
5782
  let at = class {
5778
5783
  get children() {
5779
- return $(this.node?.children);
5784
+ return R(this.node?.children);
5780
5785
  }
5781
5786
  get nestedPrefix() {
5782
5787
  return `${this.indexKey || "vmr"}-container`;
@@ -5836,7 +5841,7 @@ let he = class {
5836
5841
  return r ? e?.[r] ?? null : null;
5837
5842
  }
5838
5843
  get customNode() {
5839
- return $l(this.node);
5844
+ return Rl(this.node);
5840
5845
  }
5841
5846
  get codeMode() {
5842
5847
  return ni(this.node, this.context);
@@ -5845,7 +5850,7 @@ let he = class {
5845
5850
  return Pn(this.node);
5846
5851
  }
5847
5852
  get htmlRenderNode() {
5848
- return Rl(this.node, this.resolvedType);
5853
+ return $l(this.node, this.resolvedType);
5849
5854
  }
5850
5855
  get fallbackNode() {
5851
5856
  return this.node;
@@ -6146,7 +6151,7 @@ let lt = class {
6146
6151
  return C(this.node?.title) || Li(this.kind);
6147
6152
  }
6148
6153
  get children() {
6149
- return $(this.node?.children);
6154
+ return R(this.node?.children);
6150
6155
  }
6151
6156
  get nestedPrefix() {
6152
6157
  return `${this.indexKey || "admonition"}-children`;
@@ -6505,10 +6510,10 @@ async function uc(e, t, r, o) {
6505
6510
  throw new TypeError("D2 instance is missing compile/render methods.");
6506
6511
  const m = await h.compile(c), f = m?.diagram ?? m, g = m?.renderOptions ?? m?.options ?? {}, y = r.d2ThemeId ?? g.themeID, T = r.d2DarkThemeId ?? g.darkThemeID, v = { ...g };
6507
6512
  if (v.themeID = r.isDark && T != null ? T : y, v.darkThemeID = null, v.darkThemeOverrides = null, r.isDark) {
6508
- const R = g.themeOverrides && typeof g.themeOverrides == "object" ? g.themeOverrides : null;
6513
+ const $ = g.themeOverrides && typeof g.themeOverrides == "object" ? g.themeOverrides : null;
6509
6514
  v.themeOverrides = {
6510
6515
  ...rc,
6511
- ...R || {}
6516
+ ...$ || {}
6512
6517
  };
6513
6518
  }
6514
6519
  const M = await h.render(f, v);
@@ -6810,7 +6815,7 @@ let w = class {
6810
6815
  },
6811
6816
  r,
6812
6817
  this.textStreamState
6813
- ), this.parsedNodes = $i(this), this.trimMeasuredState();
6818
+ ), this.parsedNodes = Ri(this), this.trimMeasuredState();
6814
6819
  const o = this.parsedNodes.length;
6815
6820
  this.focusIndex = Math.max(0, Math.min(this.focusIndex, Math.max(0, o - 1))), this.virtualizationEnabled ? (this.renderedCount = o, this.liveRange = no(o, this.focusIndex, this.resolvedMaxLiveNodes, this.resolvedLiveNodeBuffer)) : (this.liveRange = { start: 0, end: o }, this.renderedCount = this.incrementalRenderingActive ? Math.min(o, this.resolvedInitialBatchSize) : o), this.deferNodesActive || this.nodeVisibility.clear(), this.refreshVisibleEntries(), this.cdr.markForCheck(), this.schedulePostRenderWork(), this.incrementalRenderingActive && this.renderedCount < o && this.scheduleBatchStep();
6816
6821
  }
@@ -7267,11 +7272,11 @@ function Id(e, t = {}) {
7267
7272
  const r = Er(t);
7268
7273
  return Dc(e, r);
7269
7274
  }
7270
- function $d(e, t = {}) {
7275
+ function Rd(e, t = {}) {
7271
7276
  const r = Er(t);
7272
7277
  return D(e, r);
7273
7278
  }
7274
- function Rd(e, t = {}) {
7279
+ function $d(e, t = {}) {
7275
7280
  const r = Er(t);
7276
7281
  return ai(e, r);
7277
7282
  }
@@ -7390,9 +7395,9 @@ function ai(e, t) {
7390
7395
  case "emoji":
7391
7396
  return N(P(e.raw || e.markup || e.content || e.name));
7392
7397
  case "math_inline":
7393
- return $c(e);
7394
- case "math_block":
7395
7398
  return Rc(e);
7399
+ case "math_block":
7400
+ return $c(e);
7396
7401
  case "reference":
7397
7402
  return `<sup class="markstream-nested-reference">[${N(P(e.id))}]</sup>`;
7398
7403
  case "html_inline":
@@ -7406,10 +7411,10 @@ function Ic(e, t) {
7406
7411
  const r = P(e.href), o = P(e.title), n = I(e.children).length > 0 ? D(I(e.children), t) : N(P(e.text || r)), i = o ? ` title="${B(o)}"` : "";
7407
7412
  return `<a${r ? ` href="${B(r)}"` : ""}${i} target="_blank" rel="noreferrer noopener">${n}</a>`;
7408
7413
  }
7409
- function $c(e) {
7414
+ function Rc(e) {
7410
7415
  return `<span class="markstream-nested-math" data-display="inline"><span class="markstream-nested-math__source">${N(P(e.content || e.markup || e.raw))}</span><span class="markstream-nested-math__render" aria-hidden="true"></span></span>`;
7411
7416
  }
7412
- function Rc(e) {
7417
+ function $c(e) {
7413
7418
  return `<div class="markstream-nested-math-block"><pre class="markstream-nested-math-block__source"><code>${N(P(e.content || e.markup || e.raw))}</code></pre><div class="markstream-nested-math-block__render" aria-hidden="true"></div></div>`;
7414
7419
  }
7415
7420
  function Ac(e) {
@@ -8053,12 +8058,12 @@ export {
8053
8058
  sd as removeCustomComponents,
8054
8059
  hl as renderKaTeXInWorker,
8055
8060
  wn as renderKaTeXWithBackpressure,
8056
- Rd as renderMarkdownNodeToHtml,
8057
- $d as renderMarkdownNodesToHtml,
8061
+ $d as renderMarkdownNodeToHtml,
8062
+ Rd as renderMarkdownNodesToHtml,
8058
8063
  Dd as renderMarkdownToHtml,
8059
8064
  Id as renderNestedMarkdownToHtml,
8060
8065
  ns as resolveMonacoLanguageId,
8061
- $i as resolveParsedNodes,
8066
+ Ri as resolveParsedNodes,
8062
8067
  un as sanitizeHtmlContent,
8063
8068
  id as setCustomComponents,
8064
8069
  xo as setD2Loader,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "markstream-angular",
3
3
  "type": "module",
4
- "version": "0.0.1-alpha.3",
4
+ "version": "0.0.1-alpha.5",
5
5
  "description": "Experimental Angular Markdown renderer for Markstream, built on stream-markdown AST and a stable HTML baseline renderer.",
6
6
  "author": "Simon He",
7
7
  "license": "MIT",
@@ -68,7 +68,7 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@floating-ui/dom": "^1.7.6",
71
- "stream-markdown-parser": "0.0.72"
71
+ "stream-markdown-parser": "0.0.74"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@types/node": "^18.19.130",