md-editor-v3 6.5.3 → 6.5.4

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.
@@ -1,24 +1,24 @@
1
- import { defineComponent as z, inject as q, ref as D, watch as J, onMounted as K, createVNode as N, reactive as X, shallowRef as G, provide as V, computed as Y, onBeforeUnmount as Z, Fragment as ee } from "vue";
1
+ import { defineComponent as z, inject as q, ref as D, watch as J, onMounted as K, createVNode as M, reactive as X, shallowRef as G, provide as V, computed as Y, onBeforeUnmount as Z, Fragment as ee } from "vue";
2
2
  import { p as O } from "./config.mjs";
3
3
  import { b as $, f as j, G as U, P as te, S as le } from "./event-bus.mjs";
4
4
  import { g as ne } from "./index5.mjs";
5
5
  import { createSmoothScroll as oe, debounce as ie } from "@vavt/util";
6
- const ce = `.${O}-preview > [data-line]`, w = (e, l) => +getComputedStyle(e).getPropertyValue(l).replace("px", ""), ve = (e, l) => {
7
- const b = ie(() => {
6
+ const ce = `.${O}-preview > [data-line]`, w = (e, l) => +getComputedStyle(e).getPropertyValue(l).replace("px", ""), he = (e, l) => {
7
+ const I = ie(() => {
8
8
  e.removeEventListener("scroll", o), e.addEventListener("scroll", o), l.removeEventListener("scroll", o), l.addEventListener("scroll", o);
9
- }, 50), o = (E) => {
10
- const m = e.clientHeight, y = l.clientHeight, f = e.scrollHeight, s = l.scrollHeight, r = (f - m) / (s - y);
11
- E.target === e ? (l.removeEventListener("scroll", o), l.scrollTo({
12
- top: e.scrollTop / r
9
+ }, 50), o = (k) => {
10
+ const d = e.clientHeight, y = l.clientHeight, m = e.scrollHeight, a = l.scrollHeight, s = (m - d) / (a - y);
11
+ k.target === e ? (l.removeEventListener("scroll", o), l.scrollTo({
12
+ top: e.scrollTop / s
13
13
  // behavior: 'smooth'
14
- }), b()) : (e.removeEventListener("scroll", o), e.scrollTo({
15
- top: l.scrollTop * r
14
+ }), I()) : (e.removeEventListener("scroll", o), e.scrollTo({
15
+ top: l.scrollTop * s
16
16
  // behavior: 'smooth'
17
- }), b());
17
+ }), I());
18
18
  };
19
19
  return [
20
20
  () => {
21
- b().finally(() => {
21
+ I().finally(() => {
22
22
  e.dispatchEvent(new Event("scroll"));
23
23
  });
24
24
  },
@@ -26,37 +26,35 @@ const ce = `.${O}-preview > [data-line]`, w = (e, l) => +getComputedStyle(e).get
26
26
  e.removeEventListener("scroll", o), l.removeEventListener("scroll", o);
27
27
  }
28
28
  ];
29
- }, he = (e, l, b) => {
30
- const { view: o } = b, E = oe(), m = (i) => o.lineBlockAt(o.state.doc.line(i + 1).from).top, y = (i) => o.lineBlockAt(o.state.doc.line(i + 1).from).bottom;
31
- let f = [], s = [], r = [];
29
+ }, ge = (e, l, I) => {
30
+ const { view: o } = I, k = oe(), d = (c) => o.lineBlockAt(o.state.doc.line(c + 1).from).top, y = (c) => o.lineBlockAt(o.state.doc.line(c + 1).from).bottom;
31
+ let m = [], a = [], s = [];
32
32
  const L = () => {
33
- f = [], s = Array.from(
33
+ m = [], a = Array.from(
34
34
  l.querySelectorAll(ce)
35
- ), r = s.map((n) => Number(n.dataset.line));
36
- const i = [...r], { lines: h } = o.state.doc;
37
- i[0] !== 0 && i.unshift(0);
38
- let H = i.shift() || 0, t = i.shift() || h;
39
- for (let n = 0; n < h; n++)
40
- n === t && (H = n, t = i.shift() || h), f.push({
35
+ ), s = a.map((n) => Number(n.dataset.line));
36
+ const c = [...s], { lines: v } = o.state.doc;
37
+ c[0] !== 0 && c.unshift(0);
38
+ let H = c.shift() || 0, t = c.shift() || v;
39
+ for (let n = 0; n < v; n++)
40
+ n === t && (H = n, t = c.shift() || v), m.push({
41
41
  start: H,
42
42
  end: t - 1
43
43
  });
44
- }, R = (i, h) => {
44
+ }, R = (c, v) => {
45
45
  let H = 1;
46
- for (let t = s.length - 1; t - 1 >= 0; t--) {
47
- const n = s[t], a = s[t - 1];
48
- if (n.offsetTop + n.offsetHeight > h && a.offsetTop < h) {
49
- H = Number(a.dataset.line);
46
+ for (let t = a.length - 1; t - 1 >= 0; t--) {
47
+ const n = a[t];
48
+ if (n.offsetTop <= v) {
49
+ H = Number(n.dataset.line);
50
50
  break;
51
51
  }
52
52
  }
53
- for (let t = f.length - 1; t >= 0; t--) {
54
- const n = y(f[t].end), a = m(f[t].start);
55
- if (n > i && a <= i) {
56
- H = H < f[t].start ? H : f[t].start;
53
+ for (let t = m.length - 1; t >= 0; t--)
54
+ if (d(m[t].start) <= c) {
55
+ H = H < m[t].start ? H : m[t].start;
57
56
  break;
58
57
  }
59
- }
60
58
  return H;
61
59
  };
62
60
  let x = 0, B = 0;
@@ -64,95 +62,96 @@ const ce = `.${O}-preview > [data-line]`, w = (e, l) => +getComputedStyle(e).get
64
62
  if (B !== 0)
65
63
  return !1;
66
64
  x++;
67
- const { scrollDOM: i, contentHeight: h } = o;
68
- let H = w(l, "padding-block-start");
69
- const t = o.lineBlockAtHeight(i.scrollTop), { number: n } = o.state.doc.lineAt(t.from), a = f[n - 1];
70
- if (!a)
65
+ const { scrollDOM: c } = o;
66
+ let v = w(l, "padding-block-start");
67
+ const H = o.lineBlockAtHeight(c.scrollTop), { number: t } = o.state.doc.lineAt(H.from), n = m[t - 1];
68
+ if (!n)
71
69
  return !1;
72
- let u = 1;
73
- const k = l.querySelector(`[data-line="${a.start}"]`) || l.firstElementChild?.firstElementChild, d = l.querySelector(`[data-line="${a.end + 1}"]`) || l.lastElementChild?.lastElementChild, c = i.scrollHeight - i.clientHeight, I = l.scrollHeight - l.clientHeight;
74
- let g = m(a.start), v = y(a.end), C = k.offsetTop, S = d.offsetTop - C;
75
- g === 0 && (C = 0, k === d ? (H = 0, v = h - i.offsetHeight, S = I) : S = d.offsetTop), u = (i.scrollTop - g) / (v - g);
76
- const A = d == l.lastElementChild?.lastElementChild ? d.offsetTop + d.clientHeight : d.offsetTop;
77
- if (v >= c || A > I) {
78
- const p = R(c, I);
79
- g = m(p), u = (i.scrollTop - g) / (c - g);
80
- const F = l.querySelector(`[data-line="${p}"]`);
81
- g > 0 && F && (C = F.offsetTop), S = I - C + w(l, "padding-block-start");
70
+ let E = 1;
71
+ const f = l.querySelector(`[data-line="${n.start}"]`) || l.firstElementChild?.firstElementChild, u = l.querySelector(`[data-line="${n.end + 1}"]`) || l.lastElementChild?.lastElementChild, h = c.scrollHeight - c.clientHeight, i = l.scrollHeight - l.clientHeight;
72
+ let g = d(n.start), p = y(n.end), r = f.offsetTop, b = u.offsetTop - r;
73
+ g === 0 && (r = 0, f === u ? (v = 0, b = 0) : b = u.offsetTop), E = (c.scrollTop - g) / (p - g);
74
+ const A = u == l.lastElementChild?.lastElementChild ? u.offsetTop + u.clientHeight : u.offsetTop;
75
+ if (p >= h || A > i) {
76
+ const S = R(h, i);
77
+ g = d(S), E = (c.scrollTop - g) / (h - g);
78
+ const T = l.querySelector(`[data-line="${S}"]`);
79
+ g > 0 && T && (r = T.offsetTop), b = i - r + w(l, "padding-block-start");
82
80
  }
83
- const T = C - H + S * u;
84
- E(l, T, () => {
81
+ const F = r - v + b * E;
82
+ k(l, F, () => {
85
83
  x--;
86
84
  });
87
85
  }, P = () => {
88
86
  if (x !== 0)
89
87
  return;
90
88
  B++;
91
- const { scrollDOM: i } = o, h = l.scrollTop, H = l.scrollHeight, t = i.scrollHeight - i.clientHeight, n = l.scrollHeight - l.clientHeight;
92
- let a = l.firstElementChild?.firstElementChild, u = l.firstElementChild?.lastElementChild;
93
- if (r.length > 0) {
94
- let A = Math.ceil(
95
- r[r.length - 1] * (h / H)
96
- ), T = r.findLastIndex((p) => p <= A);
97
- T = T === -1 ? 0 : T, A = r[T];
98
- for (let p = T; p >= 0 && p < r.length; )
99
- if (s[p].offsetTop > h) {
100
- if (p - 1 >= 0) {
101
- p--;
89
+ const { scrollDOM: c } = o, v = l.scrollTop, H = l.scrollHeight, t = c.scrollHeight - c.clientHeight, n = l.scrollHeight - l.clientHeight;
90
+ let E = l.firstElementChild?.firstElementChild, f = l.firstElementChild?.lastElementChild;
91
+ if (s.length > 0) {
92
+ let S = Math.ceil(
93
+ s[s.length - 1] * (v / H)
94
+ ), T = s.findLastIndex((C) => C <= S);
95
+ T = T === -1 ? 0 : T, S = s[T];
96
+ for (let C = T; C >= 0 && C < s.length; )
97
+ if (a[C].offsetTop > v) {
98
+ if (C - 1 >= 0) {
99
+ C--;
102
100
  continue;
103
101
  }
104
- A = -1, T = -1;
102
+ S = -1, T = -1;
105
103
  break;
106
104
  } else {
107
- if (p + 1 < r.length && s[p + 1].offsetTop < h) {
108
- p++;
105
+ if (C + 1 < s.length && a[C + 1].offsetTop < v) {
106
+ C++;
109
107
  continue;
110
108
  }
111
- A = r[p], T = p;
109
+ S = s[C], T = C;
112
110
  break;
113
111
  }
114
112
  switch (T) {
115
113
  case -1: {
116
- a = l.firstElementChild?.firstElementChild, u = s[0];
114
+ E = l.firstElementChild?.firstElementChild, f = a[0];
117
115
  break;
118
116
  }
119
- case r.length - 1: {
120
- a = s[T], u = l.firstElementChild?.lastElementChild;
117
+ case s.length - 1: {
118
+ E = a[T], f = l.firstElementChild?.lastElementChild;
121
119
  break;
122
120
  }
123
121
  default:
124
- a = s[T], u = s[T + 1 === s.length ? T : T + 1];
122
+ E = a[T], f = a[T + 1];
125
123
  }
126
124
  }
127
- let k = a === l.firstElementChild?.firstElementChild ? 0 : a.offsetTop - w(a, "margin-block-start"), d = u.offsetTop, c = 0;
128
- const { start: I, end: g } = f[Number(a.dataset.line || 0)];
129
- let v = m(I);
130
- const C = m(
131
- g + 1 === o.state.doc.lines ? g : g + 1
125
+ let u = E === l.firstElementChild?.firstElementChild ? 0 : E.offsetTop - w(E, "margin-block-start"), h = f.offsetTop, i = 0;
126
+ const { start: g, end: p } = m[Number(E.dataset.line || 0)];
127
+ let r = d(g);
128
+ const b = d(
129
+ p + 1 === o.state.doc.lines ? p : p + 1
132
130
  );
133
- let S = 0;
134
- if (C > t || u.offsetTop + u.offsetHeight > n) {
135
- const A = R(t, n), T = l.querySelector(`[data-line="${A}"]`);
136
- k = T ? T.offsetTop - w(T, "margin-block-start") : k, v = m(A), c = (h - k) / (n - k), S = t - v;
137
- } else a === l.firstElementChild?.firstElementChild ? (a === u && (d = u.offsetTop + u.offsetHeight + w(u, "margin-block-end")), S = C, c = Math.max(h / d, 0)) : (c = Math.max(
138
- (h - k) / (d - k),
131
+ let A = 0;
132
+ const F = f == l.lastElementChild?.lastElementChild ? f.offsetTop + f.offsetHeight : f.offsetTop;
133
+ if (b > t || F > n) {
134
+ const S = R(t, n), T = l.querySelector(`[data-line="${S}"]`);
135
+ u = T ? T.offsetTop - w(T, "margin-block-start") : u, r = d(S), i = (v - u) / (n - u), A = t - r;
136
+ } else E === l.firstElementChild?.firstElementChild ? (E === f && (h = f.offsetTop + f.offsetHeight + w(f, "margin-block-end")), A = b, r = 0, i = Math.max(v / h, 0)) : (i = Math.max(
137
+ (v - u) / (h - u),
139
138
  0
140
- ), S = C - v);
141
- E(e, v + S * c, () => {
139
+ ), A = b - r);
140
+ k(e, r + A * i, () => {
142
141
  B--;
143
142
  });
144
- }, M = (i) => {
145
- const { scrollDOM: h, contentHeight: H } = o, t = h.clientHeight;
146
- if (H <= t || l.firstElementChild.clientHeight <= l.clientHeight || o.state.doc.lines <= f[f.length - 1]?.end)
143
+ }, N = (c) => {
144
+ const { scrollDOM: v, contentHeight: H } = o, t = v.clientHeight;
145
+ if (H <= t || l.firstElementChild.clientHeight <= l.clientHeight || o.state.doc.lines <= m[m.length - 1]?.end)
147
146
  return !1;
148
- i.target === e ? _() : P();
147
+ c.target === e ? _() : P();
149
148
  };
150
149
  return [
151
150
  () => {
152
- L(), e.addEventListener("scroll", M), l.addEventListener("scroll", M), e.dispatchEvent(new Event("scroll"));
151
+ L(), e.addEventListener("scroll", N), l.addEventListener("scroll", N), e.dispatchEvent(new Event("scroll"));
153
152
  },
154
153
  () => {
155
- e.removeEventListener("scroll", M), l.removeEventListener("scroll", M);
154
+ e.removeEventListener("scroll", N), l.removeEventListener("scroll", N);
156
155
  }
157
156
  ];
158
157
  }, se = {
@@ -182,14 +181,14 @@ const ce = `.${O}-preview > [data-line]`, w = (e, l) => +getComputedStyle(e).get
182
181
  }, Q = /* @__PURE__ */ z({
183
182
  props: se,
184
183
  setup(e) {
185
- const l = q("scrollElementRef"), b = q("roorNodeRef"), o = D();
186
- J(() => e.tocItem.active, (m) => {
187
- m && e.onActive(e.tocItem, o.value);
184
+ const l = q("scrollElementRef"), I = q("roorNodeRef"), o = D();
185
+ J(() => e.tocItem.active, (d) => {
186
+ d && e.onActive(e.tocItem, o.value);
188
187
  }), K(() => {
189
188
  e.tocItem.active && e.onActive(e.tocItem, o.value);
190
189
  });
191
- const E = (m) => {
192
- if (m.stopPropagation(), e.onClick(m, e.tocItem), m.defaultPrevented)
190
+ const k = (d) => {
191
+ if (d.stopPropagation(), e.onClick(d, e.tocItem), d.defaultPrevented)
193
192
  return;
194
193
  const y = e.mdHeadingId({
195
194
  text: e.tocItem.text,
@@ -197,32 +196,32 @@ const ce = `.${O}-preview > [data-line]`, w = (e, l) => +getComputedStyle(e).get
197
196
  index: e.tocItem.index,
198
197
  currentToken: e.tocItem.currentToken,
199
198
  nextToken: e.tocItem.nextToken
200
- }), f = b.value.getElementById(y), s = l.value;
201
- if (f && s) {
202
- let r = f.offsetParent, L = f.offsetTop;
203
- if (s.contains(r))
204
- for (; r && s != r; )
205
- L += r?.offsetTop, r = r?.offsetParent;
206
- const R = f.previousElementSibling;
199
+ }), m = I.value.getElementById(y), a = l.value;
200
+ if (m && a) {
201
+ let s = m.offsetParent, L = m.offsetTop;
202
+ if (a.contains(s))
203
+ for (; s && a != s; )
204
+ L += s?.offsetTop, s = s?.offsetParent;
205
+ const R = m.previousElementSibling;
207
206
  let x = 0;
208
- R || (x = w(f, "margin-block-start")), s?.scrollTo({
207
+ R || (x = w(m, "margin-block-start")), a?.scrollTo({
209
208
  top: L - e.scrollElementOffsetTop - x,
210
209
  behavior: "smooth"
211
210
  });
212
211
  }
213
212
  };
214
- return () => N("div", {
213
+ return () => M("div", {
215
214
  ref: o,
216
215
  class: [`${O}-catalog-link`, e.tocItem.active && `${O}-catalog-active`],
217
- onClick: E
218
- }, [N("span", {
216
+ onClick: k
217
+ }, [M("span", {
219
218
  title: e.tocItem.text
220
- }, [e.tocItem.text]), e.tocItem.children && e.tocItem.children.length > 0 && N("div", {
219
+ }, [e.tocItem.text]), e.tocItem.children && e.tocItem.children.length > 0 && M("div", {
221
220
  class: `${O}-catalog-wrapper`
222
- }, [e.tocItem.children.map((m) => N(Q, {
221
+ }, [e.tocItem.children.map((d) => M(Q, {
223
222
  mdHeadingId: e.mdHeadingId,
224
- key: `${e.tocItem.text}-link-${m.level}-${m.text}`,
225
- tocItem: m,
223
+ key: `${e.tocItem.text}-link-${d.level}-${d.text}`,
224
+ tocItem: d,
226
225
  onActive: e.onActive,
227
226
  onClick: e.onClick,
228
227
  scrollElementOffsetTop: e.scrollElementOffsetTop
@@ -316,147 +315,147 @@ const ce = `.${O}-preview > [data-line]`, w = (e, l) => +getComputedStyle(e).get
316
315
  props: re,
317
316
  emits: ["onClick", "onActive"],
318
317
  setup(e, l) {
319
- const b = e.editorId, o = `#${b}-preview-wrapper`, E = X({
318
+ const I = e.editorId, o = `#${I}-preview-wrapper`, k = X({
320
319
  list: [],
321
320
  show: !1,
322
321
  scrollElement: e.scrollElement || o
323
- }), m = G(), y = D(), f = D(), s = D(), r = D(), L = G(), R = D({});
324
- V("scrollElementRef", f), V("roorNodeRef", r);
322
+ }), d = G(), y = D(), m = D(), a = D(), s = D(), L = G(), R = D({});
323
+ V("scrollElementRef", m), V("roorNodeRef", s);
325
324
  const x = Y(() => {
326
325
  const t = [];
327
- return E.list.forEach((n, a) => {
326
+ return k.list.forEach((n, E) => {
328
327
  if (e.catalogMaxDepth && n.level > e.catalogMaxDepth)
329
328
  return;
330
329
  const {
331
- text: u,
332
- level: k,
333
- line: d
334
- } = n, c = {
335
- level: k,
336
- text: u,
337
- line: d,
338
- index: a + 1,
339
- active: m.value === n
330
+ text: f,
331
+ level: u,
332
+ line: h
333
+ } = n, i = {
334
+ level: u,
335
+ text: f,
336
+ line: h,
337
+ index: E + 1,
338
+ active: d.value === n
340
339
  };
341
340
  if (t.length === 0)
342
- t.push(c);
341
+ t.push(i);
343
342
  else {
344
- let I = t[t.length - 1];
345
- if (c.level > I.level)
346
- for (let g = I.level + 1; g <= 6; g++) {
343
+ let g = t[t.length - 1];
344
+ if (i.level > g.level)
345
+ for (let p = g.level + 1; p <= 6; p++) {
347
346
  const {
348
- children: v
349
- } = I;
350
- if (!v) {
351
- I.children = [c];
347
+ children: r
348
+ } = g;
349
+ if (!r) {
350
+ g.children = [i];
352
351
  break;
353
352
  }
354
- if (I = v[v.length - 1], c.level <= I.level) {
355
- v.push(c);
353
+ if (g = r[r.length - 1], i.level <= g.level) {
354
+ r.push(i);
356
355
  break;
357
356
  }
358
357
  }
359
358
  else
360
- t.push(c);
359
+ t.push(i);
361
360
  }
362
361
  }), t;
363
362
  }), B = () => {
364
- if (E.scrollElement instanceof HTMLElement)
365
- return E.scrollElement;
363
+ if (k.scrollElement instanceof HTMLElement)
364
+ return k.scrollElement;
366
365
  let t = document;
367
- return (E.scrollElement === o || e.isScrollElementInShadow) && (t = y.value?.getRootNode()), t.querySelector(E.scrollElement);
366
+ return (k.scrollElement === o || e.isScrollElementInShadow) && (t = y.value?.getRootNode()), t.querySelector(k.scrollElement);
368
367
  }, _ = (t) => {
369
368
  if (t.length === 0)
370
- return m.value = void 0, E.list = [], !1;
369
+ return d.value = void 0, k.list = [], !1;
371
370
  const {
372
371
  activeHead: n,
373
- activeIndex: a
374
- } = t.reduce((d, c, I) => {
375
- let g = 0;
372
+ activeIndex: E
373
+ } = t.reduce((h, i, g) => {
374
+ let p = 0;
376
375
  if (e.syncWith === "preview") {
377
- const v = r.value?.getElementById(e.mdHeadingId({
378
- text: c.text,
379
- level: c.level,
380
- index: I + 1,
381
- currentToken: c.currentToken,
382
- nextToken: c.nextToken
376
+ const r = s.value?.getElementById(e.mdHeadingId({
377
+ text: i.text,
378
+ level: i.level,
379
+ index: g + 1,
380
+ currentToken: i.currentToken,
381
+ nextToken: i.nextToken
383
382
  }));
384
- v instanceof HTMLElement && (g = ne(v, f.value));
383
+ r instanceof HTMLElement && (p = ne(r, m.value));
385
384
  } else {
386
- const v = L.value;
387
- if (v) {
388
- const C = v.lineBlockAt(v.state.doc.line(c.line + 1).from).top, S = v.scrollDOM.scrollTop;
389
- g = C - S;
385
+ const r = L.value;
386
+ if (r) {
387
+ const b = r.lineBlockAt(r.state.doc.line(i.line + 1).from).top, A = r.scrollDOM.scrollTop;
388
+ p = b - A;
390
389
  }
391
390
  }
392
- return g < e.offsetTop && g > d.minTop ? {
393
- activeHead: c,
394
- activeIndex: I,
395
- minTop: g
396
- } : d;
391
+ return p < e.offsetTop && p > h.minTop ? {
392
+ activeHead: i,
393
+ activeIndex: g,
394
+ minTop: p
395
+ } : h;
397
396
  }, {
398
397
  activeHead: t[0],
399
398
  activeIndex: 0,
400
399
  minTop: Number.MIN_SAFE_INTEGER
401
400
  });
402
- let u = n;
401
+ let f = n;
403
402
  const {
404
- catalogMaxDepth: k
403
+ catalogMaxDepth: u
405
404
  } = e;
406
- if (k && u.level > k) {
407
- for (let d = a; d >= 0; d--) {
408
- const c = t[d];
409
- if (c.level <= k) {
410
- u = c;
405
+ if (u && f.level > u) {
406
+ for (let h = E; h >= 0; h--) {
407
+ const i = t[h];
408
+ if (i.level <= u) {
409
+ f = i;
411
410
  break;
412
411
  }
413
412
  }
414
- if (u.level > k) {
415
- const d = t.find((c) => c.level <= k);
416
- d && (u = d);
413
+ if (f.level > u) {
414
+ const h = t.find((i) => i.level <= u);
415
+ h && (f = h);
417
416
  }
418
417
  }
419
- m.value = u, E.list = t;
418
+ d.value = f, k.list = t;
420
419
  }, P = (t, n) => {
421
420
  R.value.top = n.offsetTop + w(n, "padding-block-start") + "px", e.onActive?.(t, n), l.emit("onActive", t, n);
422
- }, M = () => {
423
- _(E.list);
424
- }, i = (t) => {
425
- if (s.value?.removeEventListener("scroll", M), e.syncWith === "editor")
426
- s.value = L.value?.scrollDOM;
421
+ }, N = () => {
422
+ _(k.list);
423
+ }, c = (t) => {
424
+ if (a.value?.removeEventListener("scroll", N), e.syncWith === "editor")
425
+ a.value = L.value?.scrollDOM;
427
426
  else {
428
427
  const n = B();
429
- f.value = n, s.value = n === document.documentElement ? document : n;
428
+ m.value = n, a.value = n === document.documentElement ? document : n;
430
429
  }
431
- _(t), s.value?.addEventListener("scroll", M);
432
- }, h = (t) => {
430
+ _(t), a.value?.addEventListener("scroll", N);
431
+ }, v = (t) => {
433
432
  L.value = t;
434
433
  };
435
434
  J([() => e.syncWith, L, () => e.catalogMaxDepth], () => {
436
- i(E.list);
435
+ c(k.list);
437
436
  }), K(() => {
438
- r.value = y.value.getRootNode(), $.on(b, {
437
+ s.value = y.value.getRootNode(), $.on(I, {
439
438
  name: j,
440
- callback: i
441
- }), $.on(b, {
439
+ callback: c
440
+ }), $.on(I, {
442
441
  name: U,
443
- callback: h
444
- }), $.emit(b, te), $.emit(b, le);
442
+ callback: v
443
+ }), $.emit(I, te), $.emit(I, le);
445
444
  }), Z(() => {
446
- $.remove(b, j, i), $.remove(b, U, h), s.value?.removeEventListener("scroll", M);
445
+ $.remove(I, j, c), $.remove(I, U, v), a.value?.removeEventListener("scroll", N);
447
446
  });
448
447
  const H = (t, n) => {
449
448
  e.onClick?.(t, n), l.emit("onClick", t, n);
450
449
  };
451
- return () => N("div", {
450
+ return () => M("div", {
452
451
  class: [`${O}-catalog`, e.theme === "dark" && `${O}-catalog-dark`, e.class || ""],
453
452
  ref: y
454
- }, [x.value.length > 0 && N(ee, null, [N("div", {
453
+ }, [x.value.length > 0 && M(ee, null, [M("div", {
455
454
  class: `${O}-catalog-indicator`,
456
455
  style: R.value
457
- }, null), N("div", {
456
+ }, null), M("div", {
458
457
  class: `${O}-catalog-container`
459
- }, [x.value.map((t) => N(Q, {
458
+ }, [x.value.map((t) => M(Q, {
460
459
  mdHeadingId: e.mdHeadingId,
461
460
  tocItem: t,
462
461
  key: `link-${t.level}-${t.text}`,
@@ -469,6 +468,6 @@ const ce = `.${O}-preview > [data-line]`, w = (e, l) => +getComputedStyle(e).get
469
468
  W.install = (e) => (e.component(W.name, W), e);
470
469
  export {
471
470
  W as M,
472
- ve as a,
473
- he as s
471
+ he as a,
472
+ ge as s
474
473
  };