@aiquants/markdown-explorer 0.34.0 → 0.35.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 +515 -0
- package/README.md +90 -39
- package/dist/EditSurface-CLG70Vnn.cjs +6 -0
- package/dist/EditSurface-D2j1kCEE.js +990 -0
- package/dist/ExplorerSplit-CfP1smbT.js +1589 -0
- package/dist/ExplorerSplit-D_0VohOv.cjs +2 -0
- package/dist/{MultiLayout-kcZyVnvK.js → MultiLayout-BeJ5Lubb.js} +249 -248
- package/dist/MultiLayout-CxV5SI7f.cjs +1 -0
- package/dist/{NativeScrollBar-UNed10Na.js → NativeScrollBar-BM5NULzg.js} +2 -2
- package/dist/{NativeScrollBar-pUbA4Zq3.cjs → NativeScrollBar-RWXpVhbI.cjs} +1 -1
- package/dist/TreeLayout-AxLw-36S.js +103 -0
- package/dist/TreeLayout-Bg2YH-EY.cjs +1 -0
- package/dist/client/MarkdownExplorer.d.cts +14 -1
- package/dist/client/MarkdownExplorer.d.ts +14 -1
- package/dist/client/edit/lineEndings.d.cts +4 -0
- package/dist/client/edit/lineEndings.d.ts +4 -0
- package/dist/client/hostContract.d.cts +67 -0
- package/dist/client/hostContract.d.ts +67 -0
- package/dist/core/config.d.cts +7 -0
- package/dist/core/config.d.ts +7 -0
- package/dist/core/contracts.d.cts +10 -4
- package/dist/core/contracts.d.ts +10 -4
- package/dist/core/draftAnswer.d.cts +23 -0
- package/dist/core/draftAnswer.d.ts +23 -0
- package/dist/core/labels.d.cts +68 -0
- package/dist/core/labels.d.ts +68 -0
- package/dist/core/location.d.cts +1 -2
- package/dist/core/location.d.ts +1 -2
- package/dist/core/ownUrls.d.cts +15 -0
- package/dist/core/ownUrls.d.ts +15 -0
- package/dist/core/treeSettings.d.cts +3 -2
- package/dist/core/treeSettings.d.ts +3 -2
- package/dist/core/viewSettings.d.cts +3 -1
- package/dist/core/viewSettings.d.ts +3 -1
- package/dist/describeValue-CLlVRO8d.js +17 -0
- package/dist/describeValue-Ccvhbt36.cjs +1 -0
- package/dist/explorerCore-DLpDuSev.js +998 -0
- package/dist/explorerCore-DYrxS9ez.cjs +1 -0
- package/dist/index-C1YMH-yI.js +5816 -0
- package/dist/index-LQWQfpAf.cjs +18 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +49 -44
- package/dist/licenses/@heroicons/react/LICENSE +21 -0
- package/dist/licenses/entities/LICENSE +11 -0
- package/dist/licenses/parse5/LICENSE +19 -0
- package/dist/location--KvTA0Ri.js +726 -0
- package/dist/location-D8DyDkuA.cjs +1 -0
- package/dist/lru-DC8GBmkX.js +39 -0
- package/dist/lru-SGmUyBQU.cjs +1 -0
- package/dist/{merge-C1MWvhCS.js → merge-Bb_HpPhe.js} +1 -1
- package/dist/{merge-BziXxZkE.cjs → merge-DQUYEGCx.cjs} +1 -1
- package/dist/nestingGuardWorker.js +5511 -0
- package/dist/ownUrls-B259RGgd.cjs +1 -0
- package/dist/ownUrls-Dh5g6ZJi.js +370 -0
- package/dist/sanitizeJob-BYRk17nr.js +21 -0
- package/dist/sanitizeJob-Cs9o3Vpl.cjs +1 -0
- package/dist/sanitizePolicy-CEMdaLUB.js +139 -0
- package/dist/sanitizePolicy-CiQfnxyd.cjs +2 -0
- package/dist/sanitizeWorker.cjs +1 -1
- package/dist/sanitizeWorker.js +134 -139
- package/dist/sanitizerService-BY4CPCoA.cjs +1 -0
- package/dist/sanitizerService-KWXv7bPm.js +240 -0
- package/dist/server/assetResponse.d.cts +60 -0
- package/dist/server/assetResponse.d.ts +60 -0
- package/dist/server/browser/browserPlatform.d.cts +12 -0
- package/dist/server/browser/browserPlatform.d.ts +12 -0
- package/dist/server/createMarkdownExplorer.d.cts +0 -10
- package/dist/server/createMarkdownExplorer.d.ts +0 -10
- package/dist/server/explorerCore.d.cts +12 -0
- package/dist/server/explorerCore.d.ts +12 -0
- package/dist/server/fileSystemSource.d.cts +1 -0
- package/dist/server/fileSystemSource.d.ts +1 -0
- package/dist/server/inProcessFetch.d.cts +5 -0
- package/dist/server/inProcessFetch.d.ts +5 -0
- package/dist/server/platform.d.cts +18 -0
- package/dist/server/platform.d.ts +18 -0
- package/dist/server/ports.d.cts +36 -5
- package/dist/server/ports.d.ts +36 -5
- package/dist/server/sanitizeProtocol.d.cts +3 -0
- package/dist/server/sanitizeProtocol.d.ts +3 -0
- package/dist/server/sanitizer.d.cts +5 -40
- package/dist/server/sanitizer.d.ts +5 -40
- package/dist/server/sanitizerOptions.d.cts +24 -0
- package/dist/server/sanitizerOptions.d.ts +24 -0
- package/dist/server/sanitizerService.d.cts +41 -0
- package/dist/server/sanitizerService.d.ts +41 -0
- package/dist/server/{workerPool.d.cts → workerJobs.d.cts} +0 -16
- package/dist/server/{workerPool.d.ts → workerJobs.d.ts} +0 -16
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +3 -1
- package/dist/server.d.ts +3 -1
- package/dist/server.js +270 -1343
- package/dist/serverBrowser.cjs +1 -0
- package/dist/serverBrowser.d.cts +1 -0
- package/dist/serverBrowser.d.ts +1 -0
- package/dist/serverBrowser.js +120 -0
- package/dist/serverCore.cjs +1 -0
- package/dist/serverCore.d.cts +14 -0
- package/dist/serverCore.d.ts +14 -0
- package/dist/serverCore.js +46 -0
- package/dist/storage-BpYsprog.cjs +1 -0
- package/dist/{storage-CmGHg7OA.js → storage-D1uSw-xj.js} +19 -18
- package/dist/storage.cjs +1 -1
- package/dist/storage.js +1 -1
- package/dist/styles/markdown-explorer.css +1 -1
- package/dist/{tapScrollCircle-D_BpaLwY.js → tapScrollCircle-BEydRn0y.js} +1 -1
- package/dist/{tapScrollCircle-DigcJCsu.cjs → tapScrollCircle-DdX0Wri0.cjs} +1 -1
- package/dist/testing.cjs +1 -0
- package/dist/testing.d.cts +6 -0
- package/dist/testing.d.ts +6 -0
- package/dist/testing.js +4 -0
- package/dist/useSplitPersistence-B2Fj508K.cjs +1 -0
- package/dist/useSplitPersistence-Fkqak8G8.js +44 -0
- package/docs/behavior/dom-hooks.md +2 -0
- package/docs/behavior/hosting.md +123 -0
- package/docs/behavior/layout.md +5 -3
- package/docs/behavior/localization.md +25 -8
- package/docs/behavior/security.md +32 -13
- package/docs/behavior/url-contract.md +4 -3
- package/package.json +48 -10
- package/dist/EditSurface-CF82jZQg.cjs +0 -6
- package/dist/EditSurface-CqHk2R3k.js +0 -982
- package/dist/ExplorerSplit-D325YGEf.cjs +0 -1
- package/dist/ExplorerSplit-DGH9bckm.js +0 -1500
- package/dist/MultiLayout-CzR7yJ0m.cjs +0 -1
- package/dist/TreeLayout-BnIU87HX.js +0 -96
- package/dist/TreeLayout-DtvIpuOe.cjs +0 -1
- package/dist/dataRoute-D6KiSHIc.js +0 -298
- package/dist/dataRoute-DwYtgyt6.cjs +0 -1
- package/dist/index-BDCbvHDs.cjs +0 -15
- package/dist/index-DR31S_-4.js +0 -5012
- package/dist/location-C44b9H1S.js +0 -676
- package/dist/location-hGLhCCg4.cjs +0 -1
- package/dist/sanitizePolicy-CwvyPpp5.js +0 -98
- package/dist/sanitizePolicy-T5T-3vV5.cjs +0 -1
- package/dist/storage-DM0EvkVf.cjs +0 -1
- package/dist/useSplitPersistence-DCeYbJMx.js +0 -38
- package/dist/useSplitPersistence-QGcvyMAa.cjs +0 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { S as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
1
|
+
import { jsxs as ae, jsx as A } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Xe, use as Ae, useRef as q, useState as $, useLayoutEffect as F, useMemo as D, useSyncExternalStore as Ze, useCallback as R, memo as Qe, useEffect as U, useImperativeHandle as en } from "react";
|
|
3
|
+
import { d as J } from "./describeValue-CLlVRO8d.js";
|
|
4
|
+
import { n as ue, e as Me, q as nn, P as tn, s as on } from "./location--KvTA0Ri.js";
|
|
5
|
+
import { R as rn, u as X, S as ln, U as sn, D as an, j as cn, g as un, V, J as dn, i as ke, W as mn, N as fn, X as Ie, Y as pn, Z as gn, _ as Le, $ as hn, a0 as Re, a1 as vn } from "./index-C1YMH-yI.js";
|
|
6
|
+
import { S as wn, a as yn, b as Sn } from "./ExplorerSplit-CfP1smbT.js";
|
|
7
|
+
import { SCROLL_AREA_SELECTOR as De, SCROLL_ROOT_SELECTOR as oe, PANEL_ACTION_ATTRIBUTE as ve, generateColumnIds as xn, sortColumnIds as _e, generateColumnId as ze, NO_PANEL_DRAG_ATTRIBUTE as En, useDragDropColumns as On, DEFAULT_DEBUG_CONFIG as we, DragDropLayout as Pn } from "@aiquants/drag-drop-panels";
|
|
8
|
+
import { useNavigate as bn, useLocation as Cn } from "react-router";
|
|
9
|
+
import { s as Tn, r as Nn, w as An } from "./storage-D1uSw-xj.js";
|
|
10
|
+
import { l as Mn, i as kn } from "./ownUrls-Dh5g6ZJi.js";
|
|
11
|
+
import { createPortal as In } from "react-dom";
|
|
12
|
+
import { HostedScrollArea as Ln } from "@aiquants/markdown";
|
|
13
|
+
const Rn = () => {
|
|
13
14
|
const e = /* @__PURE__ */ new Map();
|
|
14
15
|
return {
|
|
15
16
|
hold: (n, t) => {
|
|
@@ -22,35 +23,35 @@ const Ln = () => {
|
|
|
22
23
|
return e.delete(n), t === void 0 ? null : t;
|
|
23
24
|
}
|
|
24
25
|
};
|
|
25
|
-
},
|
|
26
|
-
const e =
|
|
26
|
+
}, He = Xe(null), de = () => {
|
|
27
|
+
const e = Ae(He);
|
|
27
28
|
if (e === null) throw new Error("[markdown-explorer] multi-view panels must be rendered inside the multi-view stage");
|
|
28
29
|
return e;
|
|
29
|
-
},
|
|
30
|
+
}, Dn = (e, n) => {
|
|
30
31
|
const t = e.pendingHashes.get(n);
|
|
31
32
|
return t === void 0 ? null : t;
|
|
32
|
-
},
|
|
33
|
-
let n =
|
|
34
|
-
for (const t of
|
|
35
|
-
n = (n ^ BigInt(t)) *
|
|
36
|
-
return Number(n &
|
|
37
|
-
},
|
|
38
|
-
const t =
|
|
33
|
+
}, _n = 0xcbf29ce484222325n, zn = 0x100000001b3n, Hn = (1n << 64n) - 1n, Bn = (1n << 53n) - 1n, qn = new TextEncoder(), Fn = (e) => {
|
|
34
|
+
let n = _n;
|
|
35
|
+
for (const t of qn.encode(e))
|
|
36
|
+
n = (n ^ BigInt(t)) * zn & Hn;
|
|
37
|
+
return Number(n & Bn);
|
|
38
|
+
}, re = 256, Vn = (e) => `aqmx-p-${Fn(e).toString(36)}`, Be = (e, n) => {
|
|
39
|
+
const t = Vn(e);
|
|
39
40
|
let o = t;
|
|
40
41
|
for (let r = 2; n.has(o); r += 1) o = `${t}-${String(r)}`;
|
|
41
42
|
return o;
|
|
42
|
-
},
|
|
43
|
+
}, $n = /* @__PURE__ */ new Map(), Un = (e, n = $n) => {
|
|
43
44
|
const t = new Set(e.flatMap((r) => n.get(r) ?? [])), o = /* @__PURE__ */ new Map();
|
|
44
45
|
for (const r of e) {
|
|
45
|
-
const l = n.get(r) ??
|
|
46
|
+
const l = n.get(r) ?? Be(r, t);
|
|
46
47
|
t.add(l), o.set(r, l);
|
|
47
48
|
}
|
|
48
49
|
return o;
|
|
49
|
-
},
|
|
50
|
+
}, qe = (e, n, t) => {
|
|
50
51
|
const o = e.columnOf.get(n);
|
|
51
52
|
return o === void 0 ? void 0 : Math.min(t - 1, Math.max(0, o));
|
|
52
|
-
},
|
|
53
|
-
const [t, ...o] =
|
|
53
|
+
}, Fe = (e, n) => {
|
|
54
|
+
const [t, ...o] = ue(n.logical, n.visible);
|
|
54
55
|
if (t === void 0) throw new RangeError("[markdown-explorer] there must be at least one visible column");
|
|
55
56
|
const r = ([d, p]) => e.slice(d, p).reduce((i, y) => i + y.length, 0);
|
|
56
57
|
let l = t;
|
|
@@ -58,15 +59,15 @@ const Ln = () => {
|
|
|
58
59
|
let a = l[0];
|
|
59
60
|
for (let d = l[0]; d < l[1]; d += 1) (e[d]?.length ?? 0) < (e[a]?.length ?? 0) && (a = d);
|
|
60
61
|
return a;
|
|
61
|
-
},
|
|
62
|
+
}, le = (e, n) => {
|
|
62
63
|
const t = Array.from({ length: n.logical }, () => []), o = [];
|
|
63
64
|
for (const r of e.docs) {
|
|
64
|
-
const l =
|
|
65
|
+
const l = qe(e, r, n.logical);
|
|
65
66
|
l === void 0 ? o.push(r) : t[l]?.push(r);
|
|
66
67
|
}
|
|
67
|
-
for (const r of o) t[
|
|
68
|
+
for (const r of o) t[Fe(t, n)]?.push(r);
|
|
68
69
|
return t;
|
|
69
|
-
},
|
|
70
|
+
}, jn = (e, n) => ue(e.length, n).map(([t, o]) => e.slice(t, o).flat()), Gn = (e, n, t) => {
|
|
70
71
|
const [o, r] = n, l = r - o, a = e.length, d = Array.from({ length: l }, (w, u) => {
|
|
71
72
|
const v = [0];
|
|
72
73
|
for (const g of e) v.push((v.at(-1) ?? 0) + (t(g) === o + u ? 1 : 0));
|
|
@@ -86,24 +87,24 @@ const Ln = () => {
|
|
|
86
87
|
b[w - 1] = e.slice(u, k), k = u;
|
|
87
88
|
}
|
|
88
89
|
return b;
|
|
89
|
-
},
|
|
90
|
+
}, Ve = (e, n) => {
|
|
90
91
|
const t = n.flat(), o = new Map(e.columnOf);
|
|
91
92
|
for (const [r, l] of n.entries())
|
|
92
93
|
for (const a of l)
|
|
93
94
|
o.delete(a), o.set(a, r);
|
|
94
95
|
for (const r of o.keys()) {
|
|
95
|
-
if (o.size <=
|
|
96
|
+
if (o.size <= re) break;
|
|
96
97
|
o.delete(r);
|
|
97
98
|
}
|
|
98
99
|
return { docs: t, columnOf: o };
|
|
99
|
-
},
|
|
100
|
+
}, Yn = (e, n, t, o) => {
|
|
100
101
|
if (e.docs.includes(n)) return { state: e, outcome: "existing" };
|
|
101
102
|
if (e.docs.length >= o) return { state: e, outcome: "rejected" };
|
|
102
|
-
const r =
|
|
103
|
+
const r = le(e, t), l = qe(e, n, t.logical) ?? Fe(r, t);
|
|
103
104
|
r[l]?.push(n);
|
|
104
105
|
const a = new Map(e.panelIds);
|
|
105
|
-
return a.set(n,
|
|
106
|
-
},
|
|
106
|
+
return a.set(n, Be(n, new Set(a.values()))), { state: { ...e, ...Ve(e, r), panelIds: a }, outcome: "opened" };
|
|
107
|
+
}, $e = (e, n) => {
|
|
107
108
|
if (!e.docs.includes(n)) return e;
|
|
108
109
|
const t = new Set(e.hidden);
|
|
109
110
|
t.delete(n);
|
|
@@ -111,12 +112,12 @@ const Ln = () => {
|
|
|
111
112
|
o.delete(n);
|
|
112
113
|
const r = new Map(e.panelIds);
|
|
113
114
|
return r.delete(n), { ...e, docs: e.docs.filter((l) => l !== n), hidden: t, markup: o, panelIds: r, maximized: e.maximized === n ? null : e.maximized };
|
|
114
|
-
},
|
|
115
|
-
if (e.hidden.has(n)) return { state:
|
|
116
|
-
if (e.docs.includes(n)) return { state:
|
|
117
|
-
const r =
|
|
115
|
+
}, Wn = (e, n, t, o) => {
|
|
116
|
+
if (e.hidden.has(n)) return { state: Ue(e, n, !1), outcome: "shown" };
|
|
117
|
+
if (e.docs.includes(n)) return { state: $e(e, n), outcome: "closed" };
|
|
118
|
+
const r = Yn(e, n, t, o);
|
|
118
119
|
return { state: r.state, outcome: r.outcome === "rejected" ? "rejected" : "opened" };
|
|
119
|
-
},
|
|
120
|
+
}, Kn = (e, n, t) => {
|
|
120
121
|
if (n === t || !e.docs.includes(n)) return { state: e, outcome: "ignored" };
|
|
121
122
|
if (e.docs.includes(t)) return { state: e, outcome: "existing" };
|
|
122
123
|
const o = new Map(e.columnOf), r = o.get(n);
|
|
@@ -124,41 +125,41 @@ const Ln = () => {
|
|
|
124
125
|
const l = new Set(e.hidden);
|
|
125
126
|
l.delete(n);
|
|
126
127
|
const a = new Map(e.panelIds), d = a.get(n);
|
|
127
|
-
if (d === void 0) throw new Error(`[markdown-explorer] the open document ${
|
|
128
|
+
if (d === void 0) throw new Error(`[markdown-explorer] the open document ${J(n)} has no panel id`);
|
|
128
129
|
a.delete(n), a.set(t, d);
|
|
129
130
|
const p = new Set(e.markup);
|
|
130
131
|
return p.delete(n), {
|
|
131
132
|
state: { docs: e.docs.map((i) => i === n ? t : i), maximized: e.maximized === n ? t : e.maximized, columnOf: o, hidden: l, markup: p, panelIds: a },
|
|
132
133
|
outcome: "navigated"
|
|
133
134
|
};
|
|
134
|
-
},
|
|
135
|
+
}, Ue = (e, n, t) => {
|
|
135
136
|
if (!e.docs.includes(n) || e.hidden.has(n) === t) return e;
|
|
136
137
|
const o = new Set(e.hidden);
|
|
137
138
|
return t ? o.add(n) : o.delete(n), { ...e, hidden: o, maximized: t && e.maximized === n ? null : e.maximized };
|
|
138
|
-
},
|
|
139
|
+
}, Jn = (e, n, t) => {
|
|
139
140
|
if (!e.docs.includes(n) || e.markup.has(n) === t) return e;
|
|
140
141
|
const o = new Set(e.markup);
|
|
141
142
|
return t ? o.add(n) : o.delete(n), { ...e, markup: o };
|
|
142
|
-
},
|
|
143
|
+
}, Xn = (e, n) => {
|
|
143
144
|
if (e.maximized === n || n !== null && !e.docs.includes(n)) return e;
|
|
144
145
|
if (n === null || !e.hidden.has(n)) return { ...e, maximized: n };
|
|
145
146
|
const t = new Set(e.hidden);
|
|
146
147
|
return t.delete(n), { ...e, maximized: n, hidden: t };
|
|
147
|
-
},
|
|
148
|
-
const o =
|
|
148
|
+
}, Zn = (e, n, t) => {
|
|
149
|
+
const o = le(e, t), r = /* @__PURE__ */ new Map();
|
|
149
150
|
for (const [i, y] of o.entries())
|
|
150
151
|
for (const E of y) r.set(E, i);
|
|
151
|
-
const l = new Set(e.docs), a = /* @__PURE__ */ new Set(), d =
|
|
152
|
+
const l = new Set(e.docs), a = /* @__PURE__ */ new Set(), d = ue(t.logical, t.visible), p = Array.from({ length: t.logical }, () => []);
|
|
152
153
|
for (const [i, y] of d.entries()) {
|
|
153
154
|
const E = (n[i] ?? []).filter((b) => l.has(b) && !a.has(b));
|
|
154
155
|
for (const b of E) a.add(b);
|
|
155
|
-
for (const [b, k] of
|
|
156
|
+
for (const [b, k] of Gn(E, y, (w) => r.get(w)).entries())
|
|
156
157
|
p[y[0] + b]?.push(...k);
|
|
157
158
|
}
|
|
158
159
|
for (const i of e.docs)
|
|
159
160
|
a.has(i) || p[r.get(i) ?? 0]?.push(i);
|
|
160
|
-
return p.every((i, y) => i.length === o[y]?.length && i.every((E, b) => o[y]?.[b] === E)) ? e : { ...e, ...
|
|
161
|
-
},
|
|
161
|
+
return p.every((i, y) => i.length === o[y]?.length && i.every((E, b) => o[y]?.[b] === E)) ? e : { ...e, ...Ve(e, p) };
|
|
162
|
+
}, se = (e, n) => {
|
|
162
163
|
const t = [...new Set(e.docs)].slice(0, n), o = new Set(t), r = e.maximized !== null && o.has(e.maximized) ? e.maximized : null;
|
|
163
164
|
return {
|
|
164
165
|
docs: t,
|
|
@@ -166,20 +167,20 @@ const Ln = () => {
|
|
|
166
167
|
columnOf: e.stored.columnOf,
|
|
167
168
|
hidden: new Set([...e.stored.hidden].filter((l) => o.has(l) && l !== r)),
|
|
168
169
|
markup: new Set(e.markup.filter((l) => o.has(l))),
|
|
169
|
-
panelIds:
|
|
170
|
+
panelIds: Un(t, e.panelIds)
|
|
170
171
|
};
|
|
171
|
-
},
|
|
172
|
+
}, ye = (e, n) => {
|
|
172
173
|
if (e.docs.every((o) => e.columnOf.has(o))) return e;
|
|
173
174
|
const t = new Map(e.columnOf);
|
|
174
|
-
for (const [o, r] of
|
|
175
|
+
for (const [o, r] of le(e, n).entries())
|
|
175
176
|
for (const l of r)
|
|
176
177
|
t.delete(l), t.set(l, o);
|
|
177
178
|
for (const o of t.keys()) {
|
|
178
|
-
if (t.size <=
|
|
179
|
+
if (t.size <= re) break;
|
|
179
180
|
t.delete(o);
|
|
180
181
|
}
|
|
181
182
|
return { ...e, columnOf: t };
|
|
182
|
-
},
|
|
183
|
+
}, je = 1, Y = Object.freeze({ columnOf: /* @__PURE__ */ new Map(), hidden: /* @__PURE__ */ new Set() }), Qn = (e, n) => {
|
|
183
184
|
if (e === null || e === "") return Y;
|
|
184
185
|
let t;
|
|
185
186
|
try {
|
|
@@ -189,30 +190,30 @@ const Ln = () => {
|
|
|
189
190
|
}
|
|
190
191
|
if (t === null || typeof t != "object" || Array.isArray(t)) return Y;
|
|
191
192
|
const o = t;
|
|
192
|
-
if (o.v !==
|
|
193
|
+
if (o.v !== je) return Y;
|
|
193
194
|
const r = /* @__PURE__ */ new Map();
|
|
194
195
|
if (Array.isArray(o.columnOf))
|
|
195
|
-
for (const a of o.columnOf.slice(-
|
|
196
|
+
for (const a of o.columnOf.slice(-re))
|
|
196
197
|
Array.isArray(a) && a.length === 2 && typeof a[0] == "string" && a[0] !== "" && Number.isInteger(a[1]) && a[1] >= 0 && a[1] < n && (r.delete(a[0]), r.set(a[0], a[1]));
|
|
197
198
|
const l = new Set(Array.isArray(o.hidden) ? o.hidden.filter((a) => typeof a == "string" && a !== "") : []);
|
|
198
199
|
return { columnOf: r, hidden: l };
|
|
199
|
-
},
|
|
200
|
-
v:
|
|
201
|
-
columnOf: [...e.columnOf.entries()].slice(-
|
|
200
|
+
}, et = (e) => JSON.stringify({
|
|
201
|
+
v: je,
|
|
202
|
+
columnOf: [...e.columnOf.entries()].slice(-re),
|
|
202
203
|
hidden: e.docs.filter((n) => e.hidden.has(n))
|
|
203
|
-
}),
|
|
204
|
+
}), me = (e, n) => {
|
|
204
205
|
const t = e.get(n);
|
|
205
|
-
return t === void 0 ?
|
|
206
|
-
},
|
|
206
|
+
return t === void 0 ? Mn(n) : t;
|
|
207
|
+
}, Z = (e) => {
|
|
207
208
|
const n = /* @__PURE__ */ new Map();
|
|
208
209
|
for (const [t, o] of e.panelIds) n.set(o, t);
|
|
209
210
|
return n;
|
|
210
|
-
},
|
|
211
|
-
if (!
|
|
212
|
-
},
|
|
213
|
-
const { maxPanels: r, columns: l } = e.multiView, a =
|
|
211
|
+
}, Se = (e) => {
|
|
212
|
+
if (!kn(e)) throw new RangeError(`[markdown-explorer] not an acceptable document path: ${J(e)}`);
|
|
213
|
+
}, nt = ({ config: e, location: n, writeUrl: t, persist: o }) => {
|
|
214
|
+
const { maxPanels: r, columns: l } = e.multiView, a = rn(), d = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
214
215
|
let i = {
|
|
215
|
-
layout:
|
|
216
|
+
layout: se({ docs: n.docs, maximized: n.maximized, markup: n.markup, stored: Y }, r),
|
|
216
217
|
source: n.source,
|
|
217
218
|
visibleColumns: l,
|
|
218
219
|
ready: !1,
|
|
@@ -220,7 +221,7 @@ const Ln = () => {
|
|
|
220
221
|
titles: /* @__PURE__ */ new Map(),
|
|
221
222
|
pendingHashes: /* @__PURE__ */ new Map()
|
|
222
223
|
}, y = !1;
|
|
223
|
-
const E = (s) => y ?
|
|
224
|
+
const E = (s) => y ? ye(s, { logical: l, visible: i.visibleColumns }) : s, b = (s, h) => Me(e, { view: "multi", source: s, docs: h.docs, maximized: h.maximized, markup: h.markup }), k = (s) => ({ docs: s.docs, maximized: s.maximized, markup: [...s.markup] });
|
|
224
225
|
let w = b(n.source, n), u = n.source, v = w;
|
|
225
226
|
const g = [], O = [];
|
|
226
227
|
let C = null;
|
|
@@ -231,7 +232,7 @@ const Ln = () => {
|
|
|
231
232
|
i = { ...i, ...s }, a.emit();
|
|
232
233
|
}, c = () => {
|
|
233
234
|
if (!i.ready) return;
|
|
234
|
-
const s =
|
|
235
|
+
const s = et(i.layout);
|
|
235
236
|
s !== C && (C = s, o(s));
|
|
236
237
|
}, f = (s, h, P) => {
|
|
237
238
|
const I = b(s, k(h));
|
|
@@ -247,22 +248,22 @@ const Ln = () => {
|
|
|
247
248
|
getSnapshot: () => i,
|
|
248
249
|
subscribe: a.subscribe,
|
|
249
250
|
toggle: (s) => {
|
|
250
|
-
|
|
251
|
-
const { state: h, outcome: P } =
|
|
251
|
+
Se(s);
|
|
252
|
+
const { state: h, outcome: P } = Wn(i.layout, s, L(), r);
|
|
252
253
|
return T(h), P;
|
|
253
254
|
},
|
|
254
|
-
close: (s) => T(
|
|
255
|
+
close: (s) => T($e(i.layout, s)),
|
|
255
256
|
navigate: (s, h) => {
|
|
256
|
-
|
|
257
|
-
const { state: P, outcome: I } =
|
|
257
|
+
Se(h);
|
|
258
|
+
const { state: P, outcome: I } = Kn(i.layout, s, h);
|
|
258
259
|
if (I !== "navigated") return I;
|
|
259
260
|
const S = P.panelIds.get(h);
|
|
260
261
|
return S !== void 0 && (d.delete(S), p.delete(S)), T(P), I;
|
|
261
262
|
},
|
|
262
|
-
setHidden: (s, h) => T(
|
|
263
|
-
maximize: (s) => T(
|
|
264
|
-
setMarkup: (s, h) => T(
|
|
265
|
-
arrange: (s) => T(
|
|
263
|
+
setHidden: (s, h) => T(Ue(i.layout, s, h)),
|
|
264
|
+
maximize: (s) => T(Xn(i.layout, s)),
|
|
265
|
+
setMarkup: (s, h) => T(Jn(i.layout, s, h)),
|
|
266
|
+
arrange: (s) => T(Zn(i.layout, s, { logical: l, visible: s.length })),
|
|
266
267
|
changeSource: (s) => {
|
|
267
268
|
f(s, i.layout, "push");
|
|
268
269
|
},
|
|
@@ -279,19 +280,19 @@ const Ln = () => {
|
|
|
279
280
|
if (P >= 0)
|
|
280
281
|
return g.splice(0, P + 1), s.source !== i.source && N({ source: s.source }), M(), !1;
|
|
281
282
|
g.length = 0, w = h, u = s.source;
|
|
282
|
-
const I = E(
|
|
283
|
+
const I = E(se({ docs: s.docs, maximized: s.maximized, markup: s.markup, stored: { columnOf: i.layout.columnOf, hidden: i.layout.hidden }, panelIds: i.layout.panelIds }, r));
|
|
283
284
|
return N({ layout: I, source: s.source, ...m(I) }), c(), M(), !0;
|
|
284
285
|
},
|
|
285
286
|
whenUrlRendered: (s) => {
|
|
286
287
|
O.push(s), M();
|
|
287
288
|
},
|
|
288
289
|
loadStored: (s) => {
|
|
289
|
-
N({ layout: E(
|
|
290
|
+
N({ layout: E(se({ docs: i.layout.docs, maximized: i.layout.maximized, markup: [...i.layout.markup], stored: s, panelIds: i.layout.panelIds }, r)), ready: !0 }), c();
|
|
290
291
|
},
|
|
291
292
|
setVisibleColumns: (s) => {
|
|
292
|
-
if (!Number.isInteger(s) || s < 1 || s > l) throw new RangeError(`[markdown-explorer] visible columns must be an integer in 1..${String(l)}; got ${
|
|
293
|
+
if (!Number.isInteger(s) || s < 1 || s > l) throw new RangeError(`[markdown-explorer] visible columns must be an integer in 1..${String(l)}; got ${J(s)}`);
|
|
293
294
|
y = !0;
|
|
294
|
-
const h =
|
|
295
|
+
const h = ye(i.layout, { logical: l, visible: s });
|
|
295
296
|
s === i.visibleColumns && h === i.layout || (N({ visibleColumns: s, layout: h }), h !== i.layout && c());
|
|
296
297
|
},
|
|
297
298
|
setSplitDragging: (s) => {
|
|
@@ -300,7 +301,7 @@ const Ln = () => {
|
|
|
300
301
|
setTitle: (s, h) => {
|
|
301
302
|
!i.layout.docs.includes(s) || i.titles.get(s) === h || N({ titles: new Map(i.titles).set(s, h) });
|
|
302
303
|
},
|
|
303
|
-
titleOf: (s) =>
|
|
304
|
+
titleOf: (s) => me(i.titles, s),
|
|
304
305
|
setPendingHash: (s, h) => {
|
|
305
306
|
const P = i.pendingHashes.get(s);
|
|
306
307
|
if (h === null || h === "") {
|
|
@@ -328,33 +329,33 @@ const Ln = () => {
|
|
|
328
329
|
};
|
|
329
330
|
}, _ = (e, n) => {
|
|
330
331
|
const t = () => n(e.getSnapshot());
|
|
331
|
-
return
|
|
332
|
-
},
|
|
333
|
-
const { config: n, storageNamespace: t } =
|
|
334
|
-
() =>
|
|
332
|
+
return Ze(e.subscribe, t, t);
|
|
333
|
+
}, tt = (e) => {
|
|
334
|
+
const { config: n, storageNamespace: t } = X(), o = bn(), r = q(o), l = Tn(t).multiLayout, [a] = $(
|
|
335
|
+
() => nt({
|
|
335
336
|
config: n,
|
|
336
337
|
location: e,
|
|
337
338
|
writeUrl: (i, y) => {
|
|
338
|
-
r.current(i,
|
|
339
|
+
r.current(i, ln(y === "replace" ? "browse" : "switch-source"));
|
|
339
340
|
},
|
|
340
|
-
persist: (i) =>
|
|
341
|
+
persist: (i) => An(l, i)
|
|
341
342
|
})
|
|
342
343
|
);
|
|
343
344
|
F(() => {
|
|
344
345
|
r.current = o;
|
|
345
346
|
}, [o]);
|
|
346
|
-
const d =
|
|
347
|
+
const d = Cn(), p = D(() => ({ location: e, navigated: d }), [e, d]);
|
|
347
348
|
return F(() => {
|
|
348
349
|
a.observeLocation(p.location);
|
|
349
350
|
}, [a, p]), F(() => {
|
|
350
|
-
a.loadStored(
|
|
351
|
+
a.loadStored(Qn(Nn(l), n.multiView.columns));
|
|
351
352
|
}, [a, l, n]), a;
|
|
352
|
-
},
|
|
353
|
-
const n = e.closest(
|
|
353
|
+
}, ot = (e) => {
|
|
354
|
+
const n = e.closest(De);
|
|
354
355
|
if (n === null) throw new Error("[markdown-explorer] a panel's document region is not inside the panel's scroll area");
|
|
355
356
|
return n;
|
|
356
|
-
},
|
|
357
|
-
const { store: l, followLink: a, revealInPanel: d, keepAtStartInPanel: p } =
|
|
357
|
+
}, rt = ({ docPath: e, panelId: n, maximized: t, title: o, onContentShown: r }) => {
|
|
358
|
+
const { store: l, followLink: a, revealInPanel: d, keepAtStartInPanel: p } = de(), { announcer: i } = X(), y = _(l, (c) => Dn(c, n)), E = _(l, (c) => c.layout.markup.has(e)), b = R((c, f) => a(n, e, c, f), [a, n, e]), k = R(() => l.setPendingHash(n, null), [l, n]), w = D(() => ({ read: (c) => l.imageViewOf(n, c), save: (c, f) => l.saveImageView(n, c, f) }), [l, n]), u = R(
|
|
358
359
|
(c, f) => {
|
|
359
360
|
f.kind !== "failure" && l.setTitle(c, f.name), r(c);
|
|
360
361
|
},
|
|
@@ -366,7 +367,7 @@ const Ln = () => {
|
|
|
366
367
|
[l, i]
|
|
367
368
|
), g = D(
|
|
368
369
|
() => ({
|
|
369
|
-
scrollerOf:
|
|
370
|
+
scrollerOf: ot,
|
|
370
371
|
reveal: (c) => d(n, c),
|
|
371
372
|
keepAtStart: (c, f) => p(n, c, f)
|
|
372
373
|
}),
|
|
@@ -375,64 +376,64 @@ const Ln = () => {
|
|
|
375
376
|
() => ({ kind: "panel", maximized: t, onDocumentLink: b, pendingHash: y, onHashConsumed: k, announceFailure: v, paneScroll: g }),
|
|
376
377
|
[t, b, y, k, v, g]
|
|
377
378
|
), C = D(() => ({ kind: "panel", documentName: o, maximized: t }), [o, t]), M = R(() => l.setMarkup(e, !l.getSnapshot().layout.markup.has(e)), [l, e]), N = D(() => ({ shown: E, toggle: M }), [E, M]);
|
|
378
|
-
return /* @__PURE__ */
|
|
379
|
-
/* @__PURE__ */ A(
|
|
380
|
-
/* @__PURE__ */ A(
|
|
379
|
+
return /* @__PURE__ */ ae(sn, { value: w, children: [
|
|
380
|
+
/* @__PURE__ */ A(an, { path: e, placement: C, markup: N, maximize: null }),
|
|
381
|
+
/* @__PURE__ */ A(cn, { path: e, absence: un, markup: E, variant: O, onDocumentShown: u })
|
|
381
382
|
] });
|
|
382
|
-
},
|
|
383
|
-
const t = e.querySelector(
|
|
383
|
+
}, xe = () => typeof HTMLElement < "u" && typeof HTMLElement.prototype.showPopover == "function" && typeof HTMLElement.prototype.hidePopover == "function", fe = "data-aqmx-column-probe", ee = "data-panel-id", ce = "--aqmx-multi-panel-chrome", lt = (e) => e === "normal" ? 0 : V(e), st = (e, n) => {
|
|
384
|
+
const t = e.querySelector(oe)?.firstElementChild, o = e.querySelector(`[${fe}]`), r = o instanceof HTMLElement ? o.getBoundingClientRect().width : Number.NaN;
|
|
384
385
|
if (!(t instanceof HTMLElement))
|
|
385
386
|
return { plan: { trackInlineSize: Number.NaN, gap: Number.NaN, minColumnInlineSize: r, logicalColumns: n }, stageBlockSize: Number.NaN };
|
|
386
387
|
const l = getComputedStyle(t), a = t.clientWidth - V(l.paddingLeft) - V(l.paddingRight), d = t.clientHeight - V(l.paddingTop) - V(l.paddingBottom);
|
|
387
|
-
return { plan: { trackInlineSize: a, gap:
|
|
388
|
-
},
|
|
388
|
+
return { plan: { trackInlineSize: a, gap: lt(l.columnGap), minColumnInlineSize: r, logicalColumns: n }, stageBlockSize: d };
|
|
389
|
+
}, it = (e, n) => {
|
|
389
390
|
if (e.getClientRects().length === 0) return Number.NaN;
|
|
390
391
|
const t = getComputedStyle(e);
|
|
391
392
|
return n.getBoundingClientRect().top - e.getBoundingClientRect().top + V(t.paddingBottom) + V(t.borderBottomWidth);
|
|
392
|
-
},
|
|
393
|
+
}, ne = "data-aqmx-panel-frame", Ee = "--aqmx-multi-panel-pinned-block-size", at = (e) => {
|
|
393
394
|
const { docPath: n, panelId: t } = e;
|
|
394
395
|
if (typeof n != "string" || typeof t != "string") throw new TypeError("[markdown-explorer] a multi-view panel needs string docPath and panelId props");
|
|
395
396
|
return { docPath: n, panelId: t };
|
|
396
|
-
},
|
|
397
|
+
}, ct = (e) => {
|
|
397
398
|
const n = getComputedStyle(e), t = Number.parseFloat(n.lineHeight);
|
|
398
399
|
return Number.isFinite(t) ? t : Number.parseFloat(n.fontSize);
|
|
399
|
-
},
|
|
400
|
-
const n = e.closest(
|
|
400
|
+
}, ut = (e, n, t) => e.deltaMode === WheelEvent.DOM_DELTA_PAGE ? e.deltaY * n.clientHeight : e.deltaMode !== WheelEvent.DOM_DELTA_LINE ? e.deltaY : e.deltaY * t(n), W = (e) => {
|
|
401
|
+
const n = e.closest(De);
|
|
401
402
|
return n instanceof HTMLElement ? n : null;
|
|
402
|
-
},
|
|
403
|
+
}, Ge = (e) => {
|
|
403
404
|
const n = e.firstElementChild;
|
|
404
405
|
return n instanceof HTMLElement && getComputedStyle(n).position === "sticky" ? n : null;
|
|
405
|
-
},
|
|
406
|
-
const t = n.getBoundingClientRect().top, o =
|
|
406
|
+
}, Ye = (e, n) => {
|
|
407
|
+
const t = n.getBoundingClientRect().top, o = Ge(e);
|
|
407
408
|
return o === null ? t : Math.max(t, o.getBoundingClientRect().bottom);
|
|
408
|
-
},
|
|
409
|
+
}, Oe = (e, n) => {
|
|
409
410
|
let t = 0, o = e.length;
|
|
410
411
|
for (; t < o; ) {
|
|
411
412
|
const r = t + o >>> 1;
|
|
412
413
|
(e[r]?.getBoundingClientRect().bottom ?? Number.NEGATIVE_INFINITY) > n ? o = r : t = r + 1;
|
|
413
414
|
}
|
|
414
415
|
return t < e.length ? t : -1;
|
|
415
|
-
},
|
|
416
|
-
const t =
|
|
416
|
+
}, dt = (e, n) => {
|
|
417
|
+
const t = Ye(e, n), o = [];
|
|
417
418
|
let r = e;
|
|
418
|
-
for (let a =
|
|
419
|
+
for (let a = Oe([...r.children], t); a >= 0; a = Oe([...r.children], t)) {
|
|
419
420
|
const d = r.children[a];
|
|
420
421
|
if (d === void 0) break;
|
|
421
422
|
o.push(a), r = d;
|
|
422
423
|
}
|
|
423
424
|
const l = r.getBoundingClientRect();
|
|
424
425
|
return { scrollTop: n.scrollTop, anchor: o.length === 0 ? null : { path: o, offset: l.top - t, height: l.height } };
|
|
425
|
-
},
|
|
426
|
+
}, Pe = (e, n, t) => {
|
|
426
427
|
if (n.scrollTop = t.scrollTop, t.anchor === null) return;
|
|
427
428
|
let o = e;
|
|
428
429
|
for (const p of t.anchor.path) o = o?.children[p];
|
|
429
430
|
if (o === void 0) return;
|
|
430
431
|
const r = o.getBoundingClientRect(), { offset: l, height: a } = t.anchor, d = l < 0 && a > 0 ? l / a * r.height : l;
|
|
431
|
-
n.scrollTop += r.top -
|
|
432
|
-
},
|
|
433
|
-
const n = e.getAttribute(
|
|
434
|
-
return JSON.stringify(n === null ? [e.tagName, ...
|
|
435
|
-
},
|
|
432
|
+
n.scrollTop += r.top - Ye(e, n) - d;
|
|
433
|
+
}, mt = Object.freeze(["data-testid", "aria-label", "title", "href", "id", "name"]), We = (e) => {
|
|
434
|
+
const n = e.getAttribute(ve);
|
|
435
|
+
return JSON.stringify(n === null ? [e.tagName, ...mt.map((t) => e.getAttribute(t))] : [e.tagName, ve, n]);
|
|
436
|
+
}, ft = (e, n) => {
|
|
436
437
|
if (n === null || !e.contains(n)) return null;
|
|
437
438
|
const t = [];
|
|
438
439
|
for (let o = n; o !== e; ) {
|
|
@@ -440,26 +441,26 @@ const Ln = () => {
|
|
|
440
441
|
if (r === null) return null;
|
|
441
442
|
t.unshift([...r.children].indexOf(o)), o = r;
|
|
442
443
|
}
|
|
443
|
-
return { path: t, signature:
|
|
444
|
-
},
|
|
444
|
+
return { path: t, signature: We(n) };
|
|
445
|
+
}, pt = (e, n, t) => {
|
|
445
446
|
let o = e;
|
|
446
447
|
for (const r of t.path) o = o?.children[r];
|
|
447
|
-
o instanceof HTMLElement &&
|
|
448
|
-
},
|
|
448
|
+
o instanceof HTMLElement && We(o) === t.signature && mn(o) || n.focus({ preventScroll: !0 });
|
|
449
|
+
}, gt = (e, n, t) => {
|
|
449
450
|
if (e.shiftKey || Math.abs(e.deltaX) > Math.abs(e.deltaY)) return;
|
|
450
|
-
const o = e.ctrlKey || e.metaKey, r = o ? W(n) : n.closest(
|
|
451
|
+
const o = e.ctrlKey || e.metaKey, r = o ? W(n) : n.closest(oe);
|
|
451
452
|
if (!(r instanceof HTMLElement)) return;
|
|
452
|
-
const l =
|
|
453
|
-
(o ||
|
|
454
|
-
},
|
|
453
|
+
const l = ut(e, r, t);
|
|
454
|
+
(o || ht(r, l)) && (e.preventDefault(), r.scrollTop += l);
|
|
455
|
+
}, ht = (e, n) => n < 0 ? e.scrollTop > 0 : n > 0 ? Math.ceil(e.scrollTop + e.clientHeight) < e.scrollHeight : !1, vt = (e) => e.scrollHeight > e.clientHeight, wt = (e, n, t) => {
|
|
455
456
|
let o = Number.NaN, r = Number.NaN;
|
|
456
|
-
const l =
|
|
457
|
-
const i =
|
|
457
|
+
const l = Ge(t), a = () => {
|
|
458
|
+
const i = it(e, n);
|
|
458
459
|
if (!Number.isFinite(i)) return;
|
|
459
460
|
const y = l === null ? 0 : l.getBoundingClientRect().height;
|
|
460
|
-
y !== r && (r = y, t.style.setProperty(
|
|
461
|
+
y !== r && (r = y, t.style.setProperty(Ee, `${String(y)}px`));
|
|
461
462
|
const E = i + y;
|
|
462
|
-
E !== o && (o = E, e.style.setProperty(
|
|
463
|
+
E !== o && (o = E, e.style.setProperty(ce, `${String(E)}px`));
|
|
463
464
|
};
|
|
464
465
|
a();
|
|
465
466
|
let d = null;
|
|
@@ -469,22 +470,22 @@ const Ln = () => {
|
|
|
469
470
|
}));
|
|
470
471
|
});
|
|
471
472
|
return p?.observe(e), p?.observe(n), l !== null && p?.observe(l), () => {
|
|
472
|
-
p?.disconnect(), d !== null && cancelAnimationFrame(d), e.style.removeProperty(
|
|
473
|
+
p?.disconnect(), d !== null && cancelAnimationFrame(d), e.style.removeProperty(ce), t.style.removeProperty(Ee);
|
|
473
474
|
};
|
|
474
|
-
},
|
|
475
|
-
const { docPath: n, panelId: t } =
|
|
475
|
+
}, yt = (e) => {
|
|
476
|
+
const { docPath: n, panelId: t } = at(e), { store: o, Body: r, maximize: l, focusCarry: a } = de(), d = _(o, (u) => u.layout.maximized === n), p = _(o, (u) => me(u.titles, n)), i = q(null), y = q(null), E = q(null), b = q(null);
|
|
476
477
|
U(() => {
|
|
477
478
|
const u = i.current, v = u === null ? null : W(u);
|
|
478
479
|
if (u === null || v === null || d) return;
|
|
479
480
|
const g = /* @__PURE__ */ new Map(), O = (f) => {
|
|
480
481
|
const m = g.get(f);
|
|
481
482
|
if (m !== void 0) return m;
|
|
482
|
-
const T =
|
|
483
|
+
const T = ct(f);
|
|
483
484
|
return g.set(f, T), T;
|
|
484
|
-
}, C = (f) =>
|
|
485
|
+
}, C = (f) => gt(f, u, O);
|
|
485
486
|
let M = !1;
|
|
486
487
|
const N = () => {
|
|
487
|
-
const f =
|
|
488
|
+
const f = vt(v);
|
|
488
489
|
f !== M && (M = f, f ? u.addEventListener("wheel", C, { capture: !0, passive: !1 }) : u.removeEventListener("wheel", C, { capture: !0 }));
|
|
489
490
|
};
|
|
490
491
|
N();
|
|
@@ -493,14 +494,14 @@ const Ln = () => {
|
|
|
493
494
|
c?.disconnect(), u.removeEventListener("wheel", C, { capture: !0 });
|
|
494
495
|
};
|
|
495
496
|
}, [d]), F(() => {
|
|
496
|
-
const u = i.current, v = u === null ? null : W(u), g = u === null ? null : u.closest(`[${
|
|
497
|
+
const u = i.current, v = u === null ? null : W(u), g = u === null ? null : u.closest(`[${ee}]`);
|
|
497
498
|
if (!(u === null || v === null || !(g instanceof HTMLElement)))
|
|
498
|
-
return
|
|
499
|
+
return wt(g, v, u);
|
|
499
500
|
}, []), F(() => {
|
|
500
501
|
const u = i.current, v = u === null ? null : W(u);
|
|
501
502
|
if (u === null || v === null) return;
|
|
502
503
|
const g = (f) => {
|
|
503
|
-
|
|
504
|
+
Pe(u, v, f), b.current = v.scrollTop;
|
|
504
505
|
}, O = o.readingPositionOf(t, n);
|
|
505
506
|
y.current = O === null ? null : { doc: n, position: O }, O !== null && g(O);
|
|
506
507
|
let C = null, M = u.getBoundingClientRect().width;
|
|
@@ -510,7 +511,7 @@ const Ln = () => {
|
|
|
510
511
|
const f = b.current;
|
|
511
512
|
if (b.current = null, f !== null && v.scrollTop === f || u.getBoundingClientRect().width !== M) return;
|
|
512
513
|
const m = E.current;
|
|
513
|
-
m !== null && o.saveReadingPosition(t, m,
|
|
514
|
+
m !== null && o.saveReadingPosition(t, m, dt(u, v));
|
|
514
515
|
}));
|
|
515
516
|
};
|
|
516
517
|
v.addEventListener("scroll", N, { passive: !0 });
|
|
@@ -525,11 +526,11 @@ const Ln = () => {
|
|
|
525
526
|
v.removeEventListener("scroll", N), c?.disconnect(), C !== null && cancelAnimationFrame(C);
|
|
526
527
|
};
|
|
527
528
|
}, [o, t, n]), F(() => {
|
|
528
|
-
const u = i.current, v = u === null ? null : u.closest(`[${
|
|
529
|
+
const u = i.current, v = u === null ? null : u.closest(`[${ee}]`);
|
|
529
530
|
if (u === null || v === null) return;
|
|
530
531
|
const g = a.take(t);
|
|
531
|
-
return g !== null &&
|
|
532
|
-
const O =
|
|
532
|
+
return g !== null && pt(v, u, g), () => {
|
|
533
|
+
const O = ft(v, v.ownerDocument.activeElement);
|
|
533
534
|
O !== null && a.hold(t, O);
|
|
534
535
|
};
|
|
535
536
|
}, [a, t]);
|
|
@@ -539,10 +540,10 @@ const Ln = () => {
|
|
|
539
540
|
const O = E.current;
|
|
540
541
|
E.current = u;
|
|
541
542
|
const C = y.current;
|
|
542
|
-
y.current = null, C !== null && C.doc === u ? (
|
|
543
|
+
y.current = null, C !== null && C.doc === u ? (Pe(v, g, C.position), b.current = g.scrollTop) : O !== null && O !== u && (g.scrollTop = 0);
|
|
543
544
|
}, []), w = R(
|
|
544
545
|
(u) => {
|
|
545
|
-
|
|
546
|
+
dn(u.target) || l(n);
|
|
546
547
|
},
|
|
547
548
|
[l, n]
|
|
548
549
|
);
|
|
@@ -558,28 +559,28 @@ const Ln = () => {
|
|
|
558
559
|
"data-aqmx-panel-frame": t,
|
|
559
560
|
"data-aqmx-maximized": d ? "true" : "false",
|
|
560
561
|
"data-testid": "markdown-explorer-panel-frame",
|
|
561
|
-
...d ?
|
|
562
|
+
...d ? ke : {},
|
|
562
563
|
onDoubleClick: d ? void 0 : w,
|
|
563
564
|
children: /* @__PURE__ */ A(r, { docPath: n, panelId: t, maximized: d, title: p, onContentShown: k })
|
|
564
565
|
}
|
|
565
566
|
)
|
|
566
567
|
);
|
|
567
|
-
},
|
|
568
|
+
}, St = Qe(yt), Q = (e, n) => {
|
|
568
569
|
const t = e.panelIds.get(n);
|
|
569
|
-
if (t === void 0) throw new Error(`[markdown-explorer] the open document ${
|
|
570
|
+
if (t === void 0) throw new Error(`[markdown-explorer] the open document ${J(n)} has no panel id`);
|
|
570
571
|
return t;
|
|
571
|
-
},
|
|
572
|
-
const t =
|
|
573
|
-
return Object.fromEntries(t.map((o, r) => [
|
|
574
|
-
},
|
|
575
|
-
const t =
|
|
576
|
-
return
|
|
572
|
+
}, be = (e) => Object.fromEntries(xn(e).map((n) => [n, []])), xt = (e, n) => {
|
|
573
|
+
const t = jn(le(e, n), n.visible);
|
|
574
|
+
return Object.fromEntries(t.map((o, r) => [ze(r), o.map((l) => Q(e, l))]));
|
|
575
|
+
}, Et = (e, n) => {
|
|
576
|
+
const t = Z(e);
|
|
577
|
+
return _e(Object.keys(n)).map(
|
|
577
578
|
(o) => (n[o] ?? []).flatMap((r) => {
|
|
578
579
|
const l = t.get(r);
|
|
579
580
|
return l === void 0 ? [] : [l];
|
|
580
581
|
})
|
|
581
582
|
);
|
|
582
|
-
},
|
|
583
|
+
}, Ot = (e) => ({
|
|
583
584
|
switchToCustomDragMode: e.panelSwitchToCustomDrag,
|
|
584
585
|
switchToNormalDragMode: e.panelSwitchToNormalDrag,
|
|
585
586
|
hidePanel: e.panelHide,
|
|
@@ -603,62 +604,62 @@ const Ln = () => {
|
|
|
603
604
|
emptyColumn: e.multiColumnEmpty,
|
|
604
605
|
dropZone: e.multiColumnRegion,
|
|
605
606
|
dropHere: e.panelDropHere
|
|
606
|
-
}),
|
|
607
|
+
}), Pt = "--aqmx-multi-stage-bar-gutter", bt = Object.freeze({ [Pt]: `${String(fn)}px` }), Ct = Object.freeze({ blockSize: "100%", paddingInlineEnd: gn }), Tt = Object.freeze({ [En]: "", style: Object.freeze({ display: "flex" }) }), Nt = (e) => /* @__PURE__ */ A("div", { ...Tt, children: /* @__PURE__ */ A(Ie, { scroller: e, kind: "content" }) }), At = ({ props: e, children: n }) => /* @__PURE__ */ A(Ln, { scrollerProps: { ...e, style: Ct }, renderScrollBar: Nt, barInlineSize: pn, children: n }), Mt = (e) => /* @__PURE__ */ A(Ie, { scroller: e, kind: "stage" }), pe = "--aqmx-stage-block", kt = "--aqmx-multi-panel-body-floor", It = `calc(var(${pe}) * ${String(on)})`, Lt = `max(calc(var(${pe}) * ${String(tn)}), calc(var(${ce}) + var(${kt})))`, Rt = (e, n) => {
|
|
607
608
|
const t = Object.entries(e);
|
|
608
609
|
return t.length !== Object.keys(n).length ? !1 : t.every(([o, r]) => {
|
|
609
610
|
const l = n[o];
|
|
610
611
|
return l !== void 0 && l.length === r.length && l.every((a, d) => r[d] === a);
|
|
611
612
|
});
|
|
612
613
|
}, K = (e, n, t, o) => {
|
|
613
|
-
|
|
614
|
-
const r = e.querySelector(`[${
|
|
614
|
+
Le(e);
|
|
615
|
+
const r = e.querySelector(`[${ee}="${n}"]`);
|
|
615
616
|
if (!(r instanceof HTMLElement)) return;
|
|
616
|
-
const l = t !== null && r.contains(t) ? t : null, a = [{ element: r, boundary: r.closest(
|
|
617
|
-
l !== null && a.push({ element: l, boundary: r }),
|
|
617
|
+
const l = t !== null && r.contains(t) ? t : null, a = [{ element: r, boundary: r.closest(oe) }];
|
|
618
|
+
l !== null && a.push({ element: l, boundary: r }), hn(
|
|
618
619
|
e,
|
|
619
|
-
() => r.isConnected ? (r.scrollIntoView(
|
|
620
|
+
() => r.isConnected ? (r.scrollIntoView(Re), l?.isConnected !== !0 ? r : (o(l), l)) : null,
|
|
620
621
|
a
|
|
621
622
|
);
|
|
622
|
-
},
|
|
623
|
-
e.scrollIntoView(
|
|
624
|
-
},
|
|
623
|
+
}, te = (e) => {
|
|
624
|
+
e.scrollIntoView(Re);
|
|
625
|
+
}, Ke = (e, n) => {
|
|
626
|
+
const t = e.querySelector(`[${ne}="${n}"]`);
|
|
627
|
+
return t instanceof HTMLElement ? (K(e, n, null, te), t.focus({ preventScroll: !0 }), !0) : !1;
|
|
628
|
+
}, ge = (e, n) => {
|
|
625
629
|
const t = e.querySelector(`[${ee}="${n}"]`);
|
|
626
|
-
return t instanceof HTMLElement ? (K(e, n, null, ne), t.focus({ preventScroll: !0 }), !0) : !1;
|
|
627
|
-
}, pe = (e, n) => {
|
|
628
|
-
const t = e.querySelector(`[${Q}="${n}"]`);
|
|
629
630
|
return t instanceof HTMLElement && t.contains(e.ownerDocument.activeElement);
|
|
630
|
-
},
|
|
631
|
-
if (!
|
|
632
|
-
const t = [...e.querySelectorAll(`[${
|
|
631
|
+
}, Ce = (e, n) => {
|
|
632
|
+
if (!ge(e, n)) return null;
|
|
633
|
+
const t = [...e.querySelectorAll(`[${ne}]`)].map((a) => a.getAttribute(ne)), o = t.indexOf(n), r = t[o + 1];
|
|
633
634
|
if (o >= 0 && typeof r == "string") return { kind: "panel", panelId: r };
|
|
634
635
|
const l = t[o - 1];
|
|
635
636
|
return o > 0 && typeof l == "string" ? { kind: "panel", panelId: l } : { kind: "stage" };
|
|
636
|
-
},
|
|
637
|
+
}, Te = (e, n) => {
|
|
637
638
|
requestAnimationFrame(() => {
|
|
638
639
|
const t = e.current;
|
|
639
|
-
t !== null && (n.kind === "panel" &&
|
|
640
|
+
t !== null && (n.kind === "panel" && Ke(t, n.panelId) || t.focus({ preventScroll: !0 }));
|
|
640
641
|
});
|
|
641
|
-
},
|
|
642
|
+
}, Je = (e, n) => {
|
|
642
643
|
requestAnimationFrame(() => {
|
|
643
644
|
const t = e.current;
|
|
644
|
-
t !== null &&
|
|
645
|
+
t !== null && Ke(t, n);
|
|
645
646
|
});
|
|
646
|
-
},
|
|
647
|
+
}, Dt = (e, n, t) => {
|
|
647
648
|
requestAnimationFrame(() => {
|
|
648
649
|
const o = e.current;
|
|
649
650
|
if (o === null) return;
|
|
650
651
|
const { activeElement: r, body: l } = o.ownerDocument;
|
|
651
|
-
if (K(o, n, t &&
|
|
652
|
-
const a = o.querySelector(`[${
|
|
652
|
+
if (K(o, n, t && ge(o, n) ? r : null, te), !t || r !== null && r !== l && r.isConnected) return;
|
|
653
|
+
const a = o.querySelector(`[${ne}="${n}"]`);
|
|
653
654
|
a instanceof HTMLElement && a.focus({ preventScroll: !0 });
|
|
654
655
|
});
|
|
655
|
-
},
|
|
656
|
-
const { config: t, labels: o, announcer: r, edits: l } =
|
|
656
|
+
}, _t = ({ store: e, stageRef: n }) => {
|
|
657
|
+
const { config: t, labels: o, announcer: r, edits: l } = X(), { maximize: a } = de(), d = t.multiView.columns, p = _(e, (S) => S.layout), i = _(e, (S) => S.visibleColumns), y = _(e, (S) => S.titles), E = _(e, (S) => S.layout.maximized !== null || S.splitDragging), [b, k] = $(!1), [w] = $(() => be(i)), u = D(() => Ot(o), [o]), v = R(
|
|
657
658
|
(S) => {
|
|
658
|
-
e.arrange(
|
|
659
|
+
e.arrange(Et(e.getSnapshot().layout, S));
|
|
659
660
|
},
|
|
660
661
|
[e]
|
|
661
|
-
), g =
|
|
662
|
+
), g = On({ initialColumnPanels: w, initialPanelVisibility: {}, debugConfig: we, onColumnPanelsChange: v }), { columnPanels: O, setColumnPanels: C } = g, M = q(E), N = q(O);
|
|
662
663
|
F(() => {
|
|
663
664
|
M.current = E, N.current = O;
|
|
664
665
|
}, [E, O]);
|
|
@@ -666,9 +667,9 @@ const Ln = () => {
|
|
|
666
667
|
(S) => {
|
|
667
668
|
const x = n.current;
|
|
668
669
|
if (x === null) return;
|
|
669
|
-
const { plan: B, stageBlockSize: z } =
|
|
670
|
-
if (Number.isFinite(z) && z > 0 && x.style.setProperty(
|
|
671
|
-
const H =
|
|
670
|
+
const { plan: B, stageBlockSize: z } = st(x, d);
|
|
671
|
+
if (Number.isFinite(z) && z > 0 && x.style.setProperty(pe, `${String(z)}px`), M.current && !S) return;
|
|
672
|
+
const H = nn(e.getSnapshot().visibleColumns, B);
|
|
672
673
|
H !== null && e.setVisibleColumns(H);
|
|
673
674
|
},
|
|
674
675
|
[e, n, d]
|
|
@@ -683,47 +684,47 @@ const Ln = () => {
|
|
|
683
684
|
x === null && (x = requestAnimationFrame(() => {
|
|
684
685
|
x = null, c(!1);
|
|
685
686
|
}));
|
|
686
|
-
}), z = S.querySelector(
|
|
687
|
+
}), z = S.querySelector(oe)?.firstElementChild, H = S.querySelector(`[${fe}]`);
|
|
687
688
|
return z instanceof Element && B.observe(z), H instanceof Element && B.observe(H), () => {
|
|
688
689
|
B.disconnect(), x !== null && cancelAnimationFrame(x);
|
|
689
690
|
};
|
|
690
691
|
}, [n, c]), U(() => {
|
|
691
692
|
E || c(!1);
|
|
692
693
|
}, [E, c]);
|
|
693
|
-
const f = D(() => b ?
|
|
694
|
+
const f = D(() => b ? xt(p, { logical: d, visible: i }) : be(i), [b, p, d, i]);
|
|
694
695
|
F(() => {
|
|
695
|
-
|
|
696
|
+
Rt(N.current, f) || C(f);
|
|
696
697
|
}, [f, C]);
|
|
697
|
-
const m = D(() =>
|
|
698
|
+
const m = D(() => _e(Object.keys(O)).map((S) => ({ id: S, key: S, className: "aqmx-multi-column" })), [O]), T = D(
|
|
698
699
|
() => p.docs.map((S) => {
|
|
699
|
-
const x =
|
|
700
|
-
return { id: x, component:
|
|
700
|
+
const x = Q(p, S);
|
|
701
|
+
return { id: x, component: St, title: me(y, S), props: { docPath: S, panelId: x }, minHeight: It, maxHeight: Lt };
|
|
701
702
|
}),
|
|
702
703
|
[p, y]
|
|
703
|
-
), L = D(() => Object.fromEntries(p.docs.map((S) => [
|
|
704
|
+
), L = D(() => Object.fromEntries(p.docs.map((S) => [Q(p, S), !p.hidden.has(S)])), [p]), s = p.maximized === null ? null : Q(p, p.maximized), h = R(
|
|
704
705
|
(S) => {
|
|
705
706
|
const { layout: x } = e.getSnapshot();
|
|
706
|
-
for (const [B, z] of
|
|
707
|
+
for (const [B, z] of Z(x)) {
|
|
707
708
|
const H = S[B];
|
|
708
709
|
if (H === void 0 || H !== x.hidden.has(z)) continue;
|
|
709
710
|
const j = e.titleOf(z);
|
|
710
711
|
if (H) {
|
|
711
712
|
if (!e.setHidden(z, !1)) continue;
|
|
712
|
-
r.announce(o.panelShown(j)),
|
|
713
|
+
r.announce(o.panelShown(j)), Je(n, B);
|
|
713
714
|
continue;
|
|
714
715
|
}
|
|
715
|
-
const G = n.current,
|
|
716
|
-
e.setHidden(z, !0) && (r.announce(o.panelHidden(j)),
|
|
716
|
+
const G = n.current, he = G === null ? null : Ce(G, B);
|
|
717
|
+
e.setHidden(z, !0) && (r.announce(o.panelHidden(j)), he !== null && Te(n, he));
|
|
717
718
|
}
|
|
718
719
|
},
|
|
719
720
|
[e, n, r, o]
|
|
720
721
|
), P = R(
|
|
721
722
|
(S) => {
|
|
722
|
-
const x =
|
|
723
|
+
const x = Z(e.getSnapshot().layout).get(S);
|
|
723
724
|
if (x === void 0) return;
|
|
724
725
|
const B = () => {
|
|
725
|
-
const H = e.titleOf(x), j = n.current, G = j === null ? null :
|
|
726
|
-
e.close(x) && (r.announce(o.panelClosed(H)), G !== null &&
|
|
726
|
+
const H = e.titleOf(x), j = n.current, G = j === null ? null : Ce(j, S);
|
|
727
|
+
e.close(x) && (r.announce(o.panelClosed(H)), G !== null && Te(n, G));
|
|
727
728
|
}, z = l.unsavedAmong([x]);
|
|
728
729
|
z.length === 0 ? B() : l.askToDiscard(z).then((H) => {
|
|
729
730
|
H && B();
|
|
@@ -736,13 +737,13 @@ const Ln = () => {
|
|
|
736
737
|
a(null);
|
|
737
738
|
return;
|
|
738
739
|
}
|
|
739
|
-
const x =
|
|
740
|
+
const x = Z(e.getSnapshot().layout).get(S);
|
|
740
741
|
x !== void 0 && a(x);
|
|
741
742
|
},
|
|
742
743
|
[e, a]
|
|
743
744
|
);
|
|
744
745
|
return /* @__PURE__ */ A("div", { className: "aqmx-multi-layout", "aria-busy": !b, children: /* @__PURE__ */ A(
|
|
745
|
-
|
|
746
|
+
Pn,
|
|
746
747
|
{
|
|
747
748
|
columns: m,
|
|
748
749
|
panels: T,
|
|
@@ -754,7 +755,7 @@ const Ln = () => {
|
|
|
754
755
|
dragOverPosition: g.dragOverPosition,
|
|
755
756
|
originalPanelPosition: g.originalPanelPosition,
|
|
756
757
|
dragModes: g.dragModes,
|
|
757
|
-
debugConfig:
|
|
758
|
+
debugConfig: we,
|
|
758
759
|
panelSizes: g.panelSizes,
|
|
759
760
|
customDrag: g.customDrag,
|
|
760
761
|
setPanelRef: g.setPanelRef,
|
|
@@ -774,11 +775,11 @@ const Ln = () => {
|
|
|
774
775
|
dragHandle: "header",
|
|
775
776
|
labels: u,
|
|
776
777
|
panelClassName: "aqmx-multi-panel",
|
|
777
|
-
renderPanelScrollArea:
|
|
778
|
-
renderStageScrollBar:
|
|
778
|
+
renderPanelScrollArea: At,
|
|
779
|
+
renderStageScrollBar: Mt
|
|
779
780
|
}
|
|
780
781
|
) });
|
|
781
|
-
},
|
|
782
|
+
}, ie = { blockStart: "--aqmx-multi-toast-block-start", inlineEnd: "--aqmx-multi-toast-inline-end", room: "--aqmx-multi-toast-room" }, zt = (e, n) => {
|
|
782
783
|
const t = n.getBoundingClientRect(), o = [t.left + 1, t.left + t.width / 2, t.right - 1], r = [t.top + 1, t.top + t.height / 2, t.bottom - 1];
|
|
783
784
|
return o.some(
|
|
784
785
|
(l) => r.some((a) => {
|
|
@@ -786,16 +787,16 @@ const Ln = () => {
|
|
|
786
787
|
return p !== -1 && i !== -1 && i < p;
|
|
787
788
|
})
|
|
788
789
|
);
|
|
789
|
-
},
|
|
790
|
+
}, Ht = (e, n) => {
|
|
790
791
|
const t = n.getBoundingClientRect(), o = n.ownerDocument.documentElement.clientWidth, r = getComputedStyle(n).direction === "rtl";
|
|
791
|
-
return e.style.setProperty(
|
|
792
|
+
return e.style.setProperty(ie.blockStart, `${String(t.top)}px`), e.style.setProperty(ie.inlineEnd, `${String(r ? t.left : o - t.right)}px`), e.style.setProperty(ie.room, `${String(t.width)}px`), e.showPopover(), () => {
|
|
792
793
|
e.isConnected && e.hidePopover();
|
|
793
794
|
};
|
|
794
|
-
},
|
|
795
|
-
const { config: l, labels: a, announcer: d, edits: p } =
|
|
795
|
+
}, Bt = ({ store: e, body: n, limitNotice: t, onLimitNoticeCovered: o, ref: r }) => {
|
|
796
|
+
const { config: l, labels: a, announcer: d, edits: p } = X(), i = q(null), y = q(null), E = _(e, (c) => c.ready), b = _(e, (c) => c.layout.docs.length > 0), k = _(e, (c) => c.visibleColumns), w = Ae(wn), u = R(
|
|
796
797
|
(c) => {
|
|
797
|
-
const { layout: f } = e.getSnapshot(), m = f.maximized, T = c === null && m !== null ? f.panelIds.get(m) : void 0, L = i.current, s = T !== void 0 && L !== null &&
|
|
798
|
-
e.maximize(c) && (c !== null ? d.announce(a.panelMaximized(e.titleOf(c))) : m !== null && d.announce(a.panelRestored(e.titleOf(m))), T !== void 0 &&
|
|
798
|
+
const { layout: f } = e.getSnapshot(), m = f.maximized, T = c === null && m !== null ? f.panelIds.get(m) : void 0, L = i.current, s = T !== void 0 && L !== null && ge(L, T);
|
|
799
|
+
e.maximize(c) && (c !== null ? d.announce(a.panelMaximized(e.titleOf(c))) : m !== null && d.announce(a.panelRestored(e.titleOf(m))), T !== void 0 && Dt(i, T, s));
|
|
799
800
|
},
|
|
800
801
|
[e, d, a]
|
|
801
802
|
), v = R(
|
|
@@ -818,15 +819,15 @@ const Ln = () => {
|
|
|
818
819
|
}
|
|
819
820
|
if (s !== "existing") return;
|
|
820
821
|
const { layout: h } = e.getSnapshot(), P = h.panelIds.get(m);
|
|
821
|
-
P !== void 0 && (d.announce(a.panelAlreadyOpen(e.titleOf(m))), h.maximized === null ? e.setHidden(m, !1) : u(m), e.setPendingHash(P, T),
|
|
822
|
+
P !== void 0 && (d.announce(a.panelAlreadyOpen(e.titleOf(m))), h.maximized === null ? e.setHidden(m, !1) : u(m), e.setPendingHash(P, T), Je(i, P));
|
|
822
823
|
},
|
|
823
824
|
[e, d, a, u, p]
|
|
824
825
|
);
|
|
825
826
|
F(() => {
|
|
826
|
-
if (t === null || w !== null || !
|
|
827
|
+
if (t === null || w !== null || !xe()) return;
|
|
827
828
|
const c = y.current, f = i.current;
|
|
828
829
|
if (c === null || f === null) throw new Error("[markdown-explorer] the panel-limit notice and the stage must be mounted together");
|
|
829
|
-
return
|
|
830
|
+
return Ht(c, f);
|
|
830
831
|
}, [t, w]), U(() => {
|
|
831
832
|
const c = y.current;
|
|
832
833
|
if (t === null || c === null) return;
|
|
@@ -835,19 +836,19 @@ const Ln = () => {
|
|
|
835
836
|
const T = (L) => {
|
|
836
837
|
const s = L.target;
|
|
837
838
|
s instanceof Element && (m !== null && cancelAnimationFrame(m), m = requestAnimationFrame(() => {
|
|
838
|
-
m = null, f.activeElement === s && c.isConnected &&
|
|
839
|
+
m = null, f.activeElement === s && c.isConnected && zt(c, s) && o();
|
|
839
840
|
}));
|
|
840
841
|
};
|
|
841
842
|
return f.addEventListener("focusin", T, !0), () => {
|
|
842
843
|
f.removeEventListener("focusin", T, !0), m !== null && cancelAnimationFrame(m);
|
|
843
844
|
};
|
|
844
|
-
}, [t, w, o]),
|
|
845
|
+
}, [t, w, o]), en(
|
|
845
846
|
r,
|
|
846
847
|
() => ({
|
|
847
848
|
bringIntoView: (c) => {
|
|
848
849
|
requestAnimationFrame(() => {
|
|
849
850
|
const f = i.current, m = e.getSnapshot().layout.panelIds.get(c);
|
|
850
|
-
f !== null && m !== void 0 && K(f, m, null,
|
|
851
|
+
f !== null && m !== void 0 && K(f, m, null, te);
|
|
851
852
|
});
|
|
852
853
|
}
|
|
853
854
|
}),
|
|
@@ -855,40 +856,40 @@ const Ln = () => {
|
|
|
855
856
|
), U(() => {
|
|
856
857
|
const c = i.current;
|
|
857
858
|
return () => {
|
|
858
|
-
c !== null &&
|
|
859
|
+
c !== null && Le(c);
|
|
859
860
|
};
|
|
860
861
|
}, []);
|
|
861
862
|
const g = R((c, f) => {
|
|
862
863
|
const m = i.current;
|
|
863
|
-
m !== null && K(m, c, f,
|
|
864
|
+
m !== null && K(m, c, f, te);
|
|
864
865
|
}, []), O = R((c, f, m) => {
|
|
865
866
|
const T = i.current;
|
|
866
|
-
T !== null && K(T, c, m, (L) =>
|
|
867
|
-
}, []), [C] = $(
|
|
867
|
+
T !== null && K(T, c, m, (L) => vn(f, L));
|
|
868
|
+
}, []), [C] = $(Rn), M = D(() => ({ store: e, Body: n, followLink: v, maximize: u, revealInPanel: g, keepAtStartInPanel: O, focusCarry: C }), [e, n, v, u, g, O, C]), N = D(() => Array.from({ length: l.multiView.columns }, (c, f) => ze(f)), [l]);
|
|
868
869
|
return (
|
|
869
|
-
/* @__PURE__ */
|
|
870
|
-
/* @__PURE__ */ A("span", { className: "aqmx-multi-probe", "aria-hidden": "true", [
|
|
871
|
-
b ? E ? /* @__PURE__ */ A(
|
|
870
|
+
/* @__PURE__ */ ae("section", { ref: i, className: "aqmx-multi-stage", style: bt, tabIndex: -1, "aria-label": a.multiRegion, "aria-busy": b && !E, "data-testid": "markdown-explorer-stage", "data-aqmx-visible-columns": k, ...ke, children: [
|
|
871
|
+
/* @__PURE__ */ A("span", { className: "aqmx-multi-probe", "aria-hidden": "true", [fe]: "" }),
|
|
872
|
+
b ? E ? /* @__PURE__ */ A(He, { value: M, children: /* @__PURE__ */ A(_t, { store: e, stageRef: i }) }) : /* @__PURE__ */ A("div", { className: "aqmx-multi-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-stage-skeleton", children: N.map((c) => /* @__PURE__ */ ae("div", { className: "aqmx-skeleton aqmx-multi-skeleton-column", children: [
|
|
872
873
|
/* @__PURE__ */ A("span", {}),
|
|
873
874
|
/* @__PURE__ */ A("span", {}),
|
|
874
875
|
/* @__PURE__ */ A("span", {})
|
|
875
876
|
] }, c)) }) : /* @__PURE__ */ A("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-multi-empty", children: /* @__PURE__ */ A("p", { className: "aqmx-empty-title", children: a.multiEmpty }) }),
|
|
876
|
-
t === null ? null : w !== null ?
|
|
877
|
+
t === null ? null : w !== null ? In(
|
|
877
878
|
/* @__PURE__ */ A("div", { ref: y, className: "aqmx-toast aqmx-multi-toast", "data-testid": "markdown-explorer-panel-limit", children: t }),
|
|
878
879
|
w
|
|
879
880
|
) : (
|
|
880
|
-
/* @__PURE__ */ A("div", { ref: y, popover:
|
|
881
|
+
/* @__PURE__ */ A("div", { ref: y, popover: xe() ? "manual" : void 0, className: "aqmx-toast aqmx-multi-toast", "data-testid": "markdown-explorer-panel-limit", children: t })
|
|
881
882
|
)
|
|
882
883
|
] })
|
|
883
884
|
);
|
|
884
|
-
},
|
|
885
|
+
}, qt = 3e3, Ft = (e, n) => {
|
|
885
886
|
if (n !== null) return n;
|
|
886
887
|
const [t] = e;
|
|
887
888
|
return t === void 0 ? null : t;
|
|
888
|
-
},
|
|
889
|
+
}, Ne = (e, n, t) => {
|
|
889
890
|
const o = new Set(e), r = n.filter((a) => !o.has(a)), l = r.length > 0 ? r.at(-1) : t !== null && n.includes(t) ? t : n.at(-1);
|
|
890
891
|
return l === void 0 ? null : l;
|
|
891
|
-
},
|
|
892
|
+
}, Vt = (e, n, t) => {
|
|
892
893
|
switch (n) {
|
|
893
894
|
case "opened":
|
|
894
895
|
return e.panelOpened(t);
|
|
@@ -898,12 +899,12 @@ const Ln = () => {
|
|
|
898
899
|
return e.panelClosed(t);
|
|
899
900
|
default: {
|
|
900
901
|
const o = n;
|
|
901
|
-
throw new RangeError(`[markdown-explorer] unknown toggle outcome ${
|
|
902
|
+
throw new RangeError(`[markdown-explorer] unknown toggle outcome ${J(o)}`);
|
|
902
903
|
}
|
|
903
904
|
}
|
|
904
|
-
},
|
|
905
|
-
const { config: n, labels: t, announcer: o } =
|
|
906
|
-
i.docs !== l && y({ docs: l, latest:
|
|
905
|
+
}, no = ({ location: e }) => {
|
|
906
|
+
const { config: n, labels: t, announcer: o } = X(), r = tt(e), l = _(r, (m) => m.layout.docs), a = _(r, (m) => m.layout.maximized), d = _(r, (m) => m.layout.markup), p = _(r, (m) => m.source), [i, y] = $(() => ({ docs: l, latest: Ne([], l, null) }));
|
|
907
|
+
i.docs !== l && y({ docs: l, latest: Ne(i.docs, l, i.latest) });
|
|
907
908
|
const E = a !== null ? a : i.latest, [b, k] = $(!1), w = q(null), [u, v] = $(0), g = q(null), O = q(null);
|
|
908
909
|
F(() => {
|
|
909
910
|
const m = g.current;
|
|
@@ -917,14 +918,14 @@ const Ln = () => {
|
|
|
917
918
|
const C = R(() => {
|
|
918
919
|
w.current !== null && clearTimeout(w.current), k(!0), w.current = setTimeout(() => {
|
|
919
920
|
w.current = null, k(!1);
|
|
920
|
-
},
|
|
921
|
+
}, qt);
|
|
921
922
|
}, []), M = R(() => {
|
|
922
923
|
w.current !== null && clearTimeout(w.current), w.current = null, k(!1);
|
|
923
924
|
}, []), N = R(
|
|
924
925
|
(m) => {
|
|
925
926
|
const T = r.titleOf(m), L = r.toggle(m);
|
|
926
927
|
L === "rejected" && C();
|
|
927
|
-
const s = L === "rejected" ? t.panelLimit(n.multiView.maxPanels) :
|
|
928
|
+
const s = L === "rejected" ? t.panelLimit(n.multiView.maxPanels) : Vt(t, L, T);
|
|
928
929
|
if (L === "shown") {
|
|
929
930
|
g.current = { doc: m, announcement: s }, v((h) => h + 1);
|
|
930
931
|
return;
|
|
@@ -935,15 +936,15 @@ const Ln = () => {
|
|
|
935
936
|
},
|
|
936
937
|
[r, C, o, t, n]
|
|
937
938
|
), c = D(() => new Set(l), [l]), f = D(() => {
|
|
938
|
-
const m =
|
|
939
|
-
return { href:
|
|
939
|
+
const m = Ft(l, a);
|
|
940
|
+
return { href: Me(n, { view: "tree", source: p, doc: m, markup: m !== null && d.has(m) }), target: "tree" };
|
|
940
941
|
}, [n, p, l, a, d]);
|
|
941
942
|
return /* @__PURE__ */ A(
|
|
942
|
-
|
|
943
|
+
yn,
|
|
943
944
|
{
|
|
944
945
|
view: "multi",
|
|
945
|
-
explorer: /* @__PURE__ */ A(
|
|
946
|
-
content: /* @__PURE__ */ A(
|
|
946
|
+
explorer: /* @__PURE__ */ A(Sn, { mode: "multi", sourceId: p, currentPath: E, openPaths: c, onOpenDocument: N, onSourceChange: r.changeSource, onRevealSource: r.revealSource, viewSwitch: f }),
|
|
947
|
+
content: /* @__PURE__ */ A(Bt, { ref: O, store: r, body: rt, limitNotice: b ? t.panelLimit(n.multiView.maxPanels) : null, onLimitNoticeCovered: M }),
|
|
947
948
|
contentCoversPage: a !== null,
|
|
948
949
|
sheetDismissals: u,
|
|
949
950
|
onDraggingChange: r.setSplitDragging
|
|
@@ -951,8 +952,8 @@ const Ln = () => {
|
|
|
951
952
|
);
|
|
952
953
|
};
|
|
953
954
|
export {
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
955
|
+
no as MultiLayout,
|
|
956
|
+
qt as PANEL_LIMIT_NOTICE_MS,
|
|
957
|
+
Ne as latestOpenedDocument,
|
|
958
|
+
Ft as treeSwitchDocument
|
|
958
959
|
};
|