@aiquants/markdown-explorer 0.33.0 → 0.34.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 +280 -0
- package/README.md +31 -18
- package/dist/{EditSurface-BPqqykro.cjs → EditSurface-CF82jZQg.cjs} +5 -5
- package/dist/{EditSurface-CWq35IWQ.js → EditSurface-CqHk2R3k.js} +73 -63
- package/dist/ExplorerSplit-D325YGEf.cjs +1 -0
- package/dist/ExplorerSplit-DGH9bckm.js +1500 -0
- package/dist/MultiLayout-CzR7yJ0m.cjs +1 -0
- package/dist/{MultiLayout-DYNGlNy0.js → MultiLayout-kcZyVnvK.js} +176 -176
- package/dist/NativeScrollBar-UNed10Na.js +62 -0
- package/dist/NativeScrollBar-pUbA4Zq3.cjs +1 -0
- package/dist/TreeLayout-BnIU87HX.js +96 -0
- package/dist/TreeLayout-DtvIpuOe.cjs +1 -0
- package/dist/core/geometry.d.cts +1 -0
- package/dist/core/geometry.d.ts +1 -0
- package/dist/core/labels.d.cts +10 -0
- package/dist/core/labels.d.ts +10 -0
- package/dist/core/location.d.cts +2 -0
- package/dist/core/location.d.ts +2 -0
- package/dist/core/viewSettings.d.cts +2 -0
- package/dist/core/viewSettings.d.ts +2 -0
- package/dist/{dataRoute-DLhQfdoW.js → dataRoute-D6KiSHIc.js} +20 -20
- package/dist/index-BDCbvHDs.cjs +15 -0
- package/dist/{index-CO-RgTml.js → index-DR31S_-4.js} +2029 -1929
- package/dist/index.cjs +1 -1
- package/dist/index.js +17 -17
- package/dist/{location-perTmwct.js → location-C44b9H1S.js} +291 -278
- package/dist/location-hGLhCCg4.cjs +1 -0
- package/dist/{merge-DZI4pkWI.cjs → merge-BziXxZkE.cjs} +1 -1
- package/dist/{merge-D7L_pINl.js → merge-C1MWvhCS.js} +1 -1
- package/dist/{sanitizePolicy-By0tKOpZ.js → sanitizePolicy-CwvyPpp5.js} +1 -1
- package/dist/sanitizeWorker.js +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.js +4 -4
- package/dist/styles/markdown-explorer.css +1 -1
- package/dist/tapScrollCircle-D_BpaLwY.js +14 -0
- package/dist/tapScrollCircle-DigcJCsu.cjs +1 -0
- package/dist/useSplitPersistence-DCeYbJMx.js +38 -0
- package/dist/useSplitPersistence-QGcvyMAa.cjs +1 -0
- package/docs/behavior/dom-hooks.md +12 -3
- package/docs/behavior/layout.md +64 -16
- package/docs/behavior/localization.md +4 -3
- package/docs/behavior/security.md +2 -1
- package/docs/behavior/url-contract.md +11 -5
- package/package.json +11 -11
- package/dist/ExplorerSplit-BRY4uy6x.js +0 -1493
- package/dist/ExplorerSplit-CQxr6b0v.cjs +0 -1
- package/dist/MultiLayout-TXbet9k3.cjs +0 -1
- package/dist/NativeScrollBar-BsWdvkHa.js +0 -64
- package/dist/NativeScrollBar-UpjxjLlB.cjs +0 -1
- package/dist/TreeLayout-BQEgZhz9.js +0 -72
- package/dist/TreeLayout-C0O1OGi4.cjs +0 -1
- package/dist/index-DSkK8iLE.cjs +0 -15
- package/dist/location-BxiJRTyw.cjs +0 -1
- package/dist/tapScrollCircle-CRKZremf.js +0 -12
- package/dist/tapScrollCircle-Cbf17x8g.cjs +0 -1
- package/dist/useSplitPersistence-Du01PHNg.js +0 -42
- package/dist/useSplitPersistence-pPmE4GTT.cjs +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsxs as ie, jsx as
|
|
2
|
-
import { createContext as Je, use as Ne, useRef as q, useState as $, useLayoutEffect as F, useMemo as D, useSyncExternalStore as Xe, useCallback as
|
|
3
|
-
import { n as ce, e as
|
|
4
|
-
import {
|
|
5
|
-
import { S as
|
|
6
|
-
import { SCROLL_AREA_SELECTOR as
|
|
7
|
-
import { useNavigate as
|
|
8
|
-
import { s as
|
|
9
|
-
import {
|
|
10
|
-
import { createPortal as
|
|
11
|
-
import { HostedScrollArea as
|
|
12
|
-
const
|
|
1
|
+
import { jsxs as ie, jsx as A } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Je, use as Ne, useRef as q, useState as $, useLayoutEffect as F, useMemo as D, useSyncExternalStore as Xe, useCallback as R, memo as Ze, useEffect as U, useImperativeHandle as Qe } from "react";
|
|
3
|
+
import { n as ce, e as Ae, o as en, P as nn, q as tn } from "./location-C44b9H1S.js";
|
|
4
|
+
import { Q as on, u as J, R as rn, S as ln, D as sn, j as an, g as cn, U as V, I as un, i as Me, V as dn, N as mn, W as ke, X as fn, Y as pn, Z as Ie, _ as gn, $ as Le, a0 as hn } from "./index-DR31S_-4.js";
|
|
5
|
+
import { S as vn, a as wn, b as yn } from "./ExplorerSplit-DGH9bckm.js";
|
|
6
|
+
import { SCROLL_AREA_SELECTOR as Re, SCROLL_ROOT_SELECTOR as te, PANEL_ACTION_ATTRIBUTE as he, generateColumnIds as Sn, sortColumnIds as De, generateColumnId as _e, NO_PANEL_DRAG_ATTRIBUTE as xn, useDragDropColumns as En, DEFAULT_DEBUG_CONFIG as ve, DragDropLayout as On } from "@aiquants/drag-drop-panels";
|
|
7
|
+
import { useNavigate as Pn, useLocation as bn } from "react-router";
|
|
8
|
+
import { s as Cn, r as Tn, w as Nn } from "./storage-CmGHg7OA.js";
|
|
9
|
+
import { l as An, i as Mn } from "./dataRoute-D6KiSHIc.js";
|
|
10
|
+
import { createPortal as kn } from "react-dom";
|
|
11
|
+
import { HostedScrollArea as In } from "@aiquants/markdown";
|
|
12
|
+
const Ln = () => {
|
|
13
13
|
const e = /* @__PURE__ */ new Map();
|
|
14
14
|
return {
|
|
15
15
|
hold: (n, t) => {
|
|
@@ -29,17 +29,17 @@ const In = () => {
|
|
|
29
29
|
}, Rn = (e, n) => {
|
|
30
30
|
const t = e.pendingHashes.get(n);
|
|
31
31
|
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
|
-
}, oe = 256,
|
|
38
|
-
const t =
|
|
32
|
+
}, Dn = 0xcbf29ce484222325n, _n = 0x100000001b3n, zn = (1n << 64n) - 1n, Hn = (1n << 53n) - 1n, Bn = new TextEncoder(), qn = (e) => {
|
|
33
|
+
let n = Dn;
|
|
34
|
+
for (const t of Bn.encode(e))
|
|
35
|
+
n = (n ^ BigInt(t)) * _n & zn;
|
|
36
|
+
return Number(n & Hn);
|
|
37
|
+
}, oe = 256, Fn = (e) => `aqmx-p-${qn(e).toString(36)}`, He = (e, n) => {
|
|
38
|
+
const t = Fn(e);
|
|
39
39
|
let o = t;
|
|
40
40
|
for (let r = 2; n.has(o); r += 1) o = `${t}-${String(r)}`;
|
|
41
41
|
return o;
|
|
42
|
-
},
|
|
42
|
+
}, Vn = /* @__PURE__ */ new Map(), $n = (e, n = Vn) => {
|
|
43
43
|
const t = new Set(e.flatMap((r) => n.get(r) ?? [])), o = /* @__PURE__ */ new Map();
|
|
44
44
|
for (const r of e) {
|
|
45
45
|
const l = n.get(r) ?? He(r, t);
|
|
@@ -66,7 +66,7 @@ const In = () => {
|
|
|
66
66
|
}
|
|
67
67
|
for (const r of o) t[qe(t, n)]?.push(r);
|
|
68
68
|
return t;
|
|
69
|
-
},
|
|
69
|
+
}, Un = (e, n) => ce(e.length, n).map(([t, o]) => e.slice(t, o).flat()), jn = (e, n, t) => {
|
|
70
70
|
const [o, r] = n, l = r - o, a = e.length, d = Array.from({ length: l }, (w, u) => {
|
|
71
71
|
const v = [0];
|
|
72
72
|
for (const g of e) v.push((v.at(-1) ?? 0) + (t(g) === o + u ? 1 : 0));
|
|
@@ -96,7 +96,7 @@ const In = () => {
|
|
|
96
96
|
o.delete(r);
|
|
97
97
|
}
|
|
98
98
|
return { docs: t, columnOf: o };
|
|
99
|
-
},
|
|
99
|
+
}, Gn = (e, n, t, o) => {
|
|
100
100
|
if (e.docs.includes(n)) return { state: e, outcome: "existing" };
|
|
101
101
|
if (e.docs.length >= o) return { state: e, outcome: "rejected" };
|
|
102
102
|
const r = re(e, t), l = Be(e, n, t.logical) ?? qe(r, t);
|
|
@@ -111,12 +111,12 @@ const In = () => {
|
|
|
111
111
|
o.delete(n);
|
|
112
112
|
const r = new Map(e.panelIds);
|
|
113
113
|
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
|
-
},
|
|
114
|
+
}, Yn = (e, n, t, o) => {
|
|
115
115
|
if (e.hidden.has(n)) return { state: $e(e, n, !1), outcome: "shown" };
|
|
116
116
|
if (e.docs.includes(n)) return { state: Ve(e, n), outcome: "closed" };
|
|
117
|
-
const r =
|
|
117
|
+
const r = Gn(e, n, t, o);
|
|
118
118
|
return { state: r.state, outcome: r.outcome === "rejected" ? "rejected" : "opened" };
|
|
119
|
-
},
|
|
119
|
+
}, Wn = (e, n, t) => {
|
|
120
120
|
if (n === t || !e.docs.includes(n)) return { state: e, outcome: "ignored" };
|
|
121
121
|
if (e.docs.includes(t)) return { state: e, outcome: "existing" };
|
|
122
122
|
const o = new Map(e.columnOf), r = o.get(n);
|
|
@@ -135,16 +135,16 @@ const In = () => {
|
|
|
135
135
|
if (!e.docs.includes(n) || e.hidden.has(n) === t) return e;
|
|
136
136
|
const o = new Set(e.hidden);
|
|
137
137
|
return t ? o.add(n) : o.delete(n), { ...e, hidden: o, maximized: t && e.maximized === n ? null : e.maximized };
|
|
138
|
-
},
|
|
138
|
+
}, Kn = (e, n, t) => {
|
|
139
139
|
if (!e.docs.includes(n) || e.markup.has(n) === t) return e;
|
|
140
140
|
const o = new Set(e.markup);
|
|
141
141
|
return t ? o.add(n) : o.delete(n), { ...e, markup: o };
|
|
142
|
-
},
|
|
142
|
+
}, Jn = (e, n) => {
|
|
143
143
|
if (e.maximized === n || n !== null && !e.docs.includes(n)) return e;
|
|
144
144
|
if (n === null || !e.hidden.has(n)) return { ...e, maximized: n };
|
|
145
145
|
const t = new Set(e.hidden);
|
|
146
146
|
return t.delete(n), { ...e, maximized: n, hidden: t };
|
|
147
|
-
},
|
|
147
|
+
}, Xn = (e, n, t) => {
|
|
148
148
|
const o = re(e, t), r = /* @__PURE__ */ new Map();
|
|
149
149
|
for (const [i, y] of o.entries())
|
|
150
150
|
for (const E of y) r.set(E, i);
|
|
@@ -152,7 +152,7 @@ const In = () => {
|
|
|
152
152
|
for (const [i, y] of d.entries()) {
|
|
153
153
|
const E = (n[i] ?? []).filter((b) => l.has(b) && !a.has(b));
|
|
154
154
|
for (const b of E) a.add(b);
|
|
155
|
-
for (const [b, k] of
|
|
155
|
+
for (const [b, k] of jn(E, y, (w) => r.get(w)).entries())
|
|
156
156
|
p[y[0] + b]?.push(...k);
|
|
157
157
|
}
|
|
158
158
|
for (const i of e.docs)
|
|
@@ -166,7 +166,7 @@ const In = () => {
|
|
|
166
166
|
columnOf: e.stored.columnOf,
|
|
167
167
|
hidden: new Set([...e.stored.hidden].filter((l) => o.has(l) && l !== r)),
|
|
168
168
|
markup: new Set(e.markup.filter((l) => o.has(l))),
|
|
169
|
-
panelIds:
|
|
169
|
+
panelIds: $n(t, e.panelIds)
|
|
170
170
|
};
|
|
171
171
|
}, we = (e, n) => {
|
|
172
172
|
if (e.docs.every((o) => e.columnOf.has(o))) return e;
|
|
@@ -179,7 +179,7 @@ const In = () => {
|
|
|
179
179
|
t.delete(o);
|
|
180
180
|
}
|
|
181
181
|
return { ...e, columnOf: t };
|
|
182
|
-
}, Ue = 1, Y = Object.freeze({ columnOf: /* @__PURE__ */ new Map(), hidden: /* @__PURE__ */ new Set() }),
|
|
182
|
+
}, Ue = 1, Y = Object.freeze({ columnOf: /* @__PURE__ */ new Map(), hidden: /* @__PURE__ */ new Set() }), Zn = (e, n) => {
|
|
183
183
|
if (e === null || e === "") return Y;
|
|
184
184
|
let t;
|
|
185
185
|
try {
|
|
@@ -196,20 +196,20 @@ const In = () => {
|
|
|
196
196
|
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
197
|
const l = new Set(Array.isArray(o.hidden) ? o.hidden.filter((a) => typeof a == "string" && a !== "") : []);
|
|
198
198
|
return { columnOf: r, hidden: l };
|
|
199
|
-
},
|
|
199
|
+
}, Qn = (e) => JSON.stringify({
|
|
200
200
|
v: Ue,
|
|
201
201
|
columnOf: [...e.columnOf.entries()].slice(-oe),
|
|
202
202
|
hidden: e.docs.filter((n) => e.hidden.has(n))
|
|
203
203
|
}), de = (e, n) => {
|
|
204
204
|
const t = e.get(n);
|
|
205
|
-
return t === void 0 ?
|
|
205
|
+
return t === void 0 ? An(n) : t;
|
|
206
206
|
}, X = (e) => {
|
|
207
207
|
const n = /* @__PURE__ */ new Map();
|
|
208
208
|
for (const [t, o] of e.panelIds) n.set(o, t);
|
|
209
209
|
return n;
|
|
210
210
|
}, ye = (e) => {
|
|
211
211
|
if (!Mn(e)) throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(e.slice(0, 80))}`);
|
|
212
|
-
},
|
|
212
|
+
}, et = ({ config: e, location: n, writeUrl: t, persist: o }) => {
|
|
213
213
|
const { maxPanels: r, columns: l } = e.multiView, a = on(), d = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
214
214
|
let i = {
|
|
215
215
|
layout: le({ docs: n.docs, maximized: n.maximized, markup: n.markup, stored: Y }, r),
|
|
@@ -220,18 +220,18 @@ const In = () => {
|
|
|
220
220
|
titles: /* @__PURE__ */ new Map(),
|
|
221
221
|
pendingHashes: /* @__PURE__ */ new Map()
|
|
222
222
|
}, y = !1;
|
|
223
|
-
const E = (s) => y ? we(s, { logical: l, visible: i.visibleColumns }) : s, b = (s, h) =>
|
|
223
|
+
const E = (s) => y ? we(s, { logical: l, visible: i.visibleColumns }) : s, b = (s, h) => Ae(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
224
|
let w = b(n.source, n), u = n.source, v = w;
|
|
225
225
|
const g = [], O = [];
|
|
226
226
|
let C = null;
|
|
227
|
-
const
|
|
227
|
+
const M = () => {
|
|
228
228
|
if (!(g.length > 0))
|
|
229
229
|
for (const s of O.splice(0)) s();
|
|
230
230
|
}, N = (s) => {
|
|
231
231
|
i = { ...i, ...s }, a.emit();
|
|
232
232
|
}, c = () => {
|
|
233
233
|
if (!i.ready) return;
|
|
234
|
-
const s =
|
|
234
|
+
const s = Qn(i.layout);
|
|
235
235
|
s !== C && (C = s, o(s));
|
|
236
236
|
}, f = (s, h, P) => {
|
|
237
237
|
const I = b(s, k(h));
|
|
@@ -242,27 +242,27 @@ const In = () => {
|
|
|
242
242
|
for (const x of [...p.keys()]) h.has(x) || p.delete(x);
|
|
243
243
|
const P = new Set(s.docs), I = [...i.titles.keys()].every((x) => P.has(x)) ? i.titles : new Map([...i.titles].filter(([x]) => P.has(x))), S = [...i.pendingHashes.keys()].every((x) => h.has(x)) ? i.pendingHashes : new Map([...i.pendingHashes].filter(([x]) => h.has(x)));
|
|
244
244
|
return { titles: I, pendingHashes: S };
|
|
245
|
-
}, T = (s) => s === i.layout ? !1 : (N({ layout: s, ...m(s) }), f(u, s, "replace"), c(), !0),
|
|
245
|
+
}, T = (s) => s === i.layout ? !1 : (N({ layout: s, ...m(s) }), f(u, s, "replace"), c(), !0), L = () => ({ logical: l, visible: i.visibleColumns });
|
|
246
246
|
return {
|
|
247
247
|
getSnapshot: () => i,
|
|
248
248
|
subscribe: a.subscribe,
|
|
249
249
|
toggle: (s) => {
|
|
250
250
|
ye(s);
|
|
251
|
-
const { state: h, outcome: P } =
|
|
251
|
+
const { state: h, outcome: P } = Yn(i.layout, s, L(), r);
|
|
252
252
|
return T(h), P;
|
|
253
253
|
},
|
|
254
254
|
close: (s) => T(Ve(i.layout, s)),
|
|
255
255
|
navigate: (s, h) => {
|
|
256
256
|
ye(h);
|
|
257
|
-
const { state: P, outcome: I } =
|
|
257
|
+
const { state: P, outcome: I } = Wn(i.layout, s, h);
|
|
258
258
|
if (I !== "navigated") return I;
|
|
259
259
|
const S = P.panelIds.get(h);
|
|
260
260
|
return S !== void 0 && (d.delete(S), p.delete(S)), T(P), I;
|
|
261
261
|
},
|
|
262
262
|
setHidden: (s, h) => T($e(i.layout, s, h)),
|
|
263
|
-
maximize: (s) => T(
|
|
264
|
-
setMarkup: (s, h) => T(
|
|
265
|
-
arrange: (s) => T(
|
|
263
|
+
maximize: (s) => T(Jn(i.layout, s)),
|
|
264
|
+
setMarkup: (s, h) => T(Kn(i.layout, s, h)),
|
|
265
|
+
arrange: (s) => T(Xn(i.layout, s, { logical: l, visible: s.length })),
|
|
266
266
|
changeSource: (s) => {
|
|
267
267
|
f(s, i.layout, "push");
|
|
268
268
|
},
|
|
@@ -272,18 +272,18 @@ const In = () => {
|
|
|
272
272
|
observeLocation: (s) => {
|
|
273
273
|
const h = b(s.source, s);
|
|
274
274
|
if (h === w)
|
|
275
|
-
return g.length = 0, v = h, s.source !== i.source && N({ source: s.source }),
|
|
275
|
+
return g.length = 0, v = h, s.source !== i.source && N({ source: s.source }), M(), !1;
|
|
276
276
|
if (h === v) return !1;
|
|
277
277
|
v = h;
|
|
278
278
|
const P = g.indexOf(h);
|
|
279
279
|
if (P >= 0)
|
|
280
|
-
return g.splice(0, P + 1), s.source !== i.source && N({ source: s.source }),
|
|
280
|
+
return g.splice(0, P + 1), s.source !== i.source && N({ source: s.source }), M(), !1;
|
|
281
281
|
g.length = 0, w = h, u = s.source;
|
|
282
282
|
const I = E(le({ docs: s.docs, maximized: s.maximized, markup: s.markup, stored: { columnOf: i.layout.columnOf, hidden: i.layout.hidden }, panelIds: i.layout.panelIds }, r));
|
|
283
|
-
return N({ layout: I, source: s.source, ...m(I) }), c(),
|
|
283
|
+
return N({ layout: I, source: s.source, ...m(I) }), c(), M(), !0;
|
|
284
284
|
},
|
|
285
285
|
whenUrlRendered: (s) => {
|
|
286
|
-
O.push(s),
|
|
286
|
+
O.push(s), M();
|
|
287
287
|
},
|
|
288
288
|
loadStored: (s) => {
|
|
289
289
|
N({ layout: E(le({ docs: i.layout.docs, maximized: i.layout.maximized, markup: [...i.layout.markup], stored: s, panelIds: i.layout.panelIds }, r)), ready: !0 }), c();
|
|
@@ -329,44 +329,44 @@ const In = () => {
|
|
|
329
329
|
}, _ = (e, n) => {
|
|
330
330
|
const t = () => n(e.getSnapshot());
|
|
331
331
|
return Xe(e.subscribe, t, t);
|
|
332
|
-
},
|
|
333
|
-
const { config: n, storageNamespace: t } = J(), o =
|
|
334
|
-
() =>
|
|
332
|
+
}, nt = (e) => {
|
|
333
|
+
const { config: n, storageNamespace: t } = J(), o = Pn(), r = q(o), l = Cn(t).multiLayout, [a] = $(
|
|
334
|
+
() => et({
|
|
335
335
|
config: n,
|
|
336
336
|
location: e,
|
|
337
337
|
writeUrl: (i, y) => {
|
|
338
338
|
r.current(i, rn(y === "replace" ? "browse" : "switch-source"));
|
|
339
339
|
},
|
|
340
|
-
persist: (i) =>
|
|
340
|
+
persist: (i) => Nn(l, i)
|
|
341
341
|
})
|
|
342
342
|
);
|
|
343
343
|
F(() => {
|
|
344
344
|
r.current = o;
|
|
345
345
|
}, [o]);
|
|
346
|
-
const d =
|
|
346
|
+
const d = bn(), p = D(() => ({ location: e, navigated: d }), [e, d]);
|
|
347
347
|
return F(() => {
|
|
348
348
|
a.observeLocation(p.location);
|
|
349
349
|
}, [a, p]), F(() => {
|
|
350
|
-
a.loadStored(
|
|
350
|
+
a.loadStored(Zn(Tn(l), n.multiView.columns));
|
|
351
351
|
}, [a, l, n]), a;
|
|
352
|
-
},
|
|
353
|
-
const n = e.closest(
|
|
352
|
+
}, tt = (e) => {
|
|
353
|
+
const n = e.closest(Re);
|
|
354
354
|
if (n === null) throw new Error("[markdown-explorer] a panel's document region is not inside the panel's scroll area");
|
|
355
355
|
return n;
|
|
356
|
-
},
|
|
357
|
-
const { store: l, followLink: a, revealInPanel: d, keepAtStartInPanel: p } = ue(), { announcer: i } = J(), y = _(l, (c) => Rn(c, n)), E = _(l, (c) => c.layout.markup.has(e)), b =
|
|
356
|
+
}, ot = ({ docPath: e, panelId: n, maximized: t, title: o, onContentShown: r }) => {
|
|
357
|
+
const { store: l, followLink: a, revealInPanel: d, keepAtStartInPanel: p } = ue(), { announcer: i } = J(), y = _(l, (c) => Rn(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
358
|
(c, f) => {
|
|
359
359
|
f.kind !== "failure" && l.setTitle(c, f.name), r(c);
|
|
360
360
|
},
|
|
361
361
|
[l, r]
|
|
362
|
-
), v =
|
|
362
|
+
), v = R(
|
|
363
363
|
(c) => {
|
|
364
364
|
l.whenUrlRendered(() => i.announce(c));
|
|
365
365
|
},
|
|
366
366
|
[l, i]
|
|
367
367
|
), g = D(
|
|
368
368
|
() => ({
|
|
369
|
-
scrollerOf:
|
|
369
|
+
scrollerOf: tt,
|
|
370
370
|
reveal: (c) => d(n, c),
|
|
371
371
|
keepAtStart: (c, f) => p(n, c, f)
|
|
372
372
|
}),
|
|
@@ -374,30 +374,30 @@ const In = () => {
|
|
|
374
374
|
), O = D(
|
|
375
375
|
() => ({ kind: "panel", maximized: t, onDocumentLink: b, pendingHash: y, onHashConsumed: k, announceFailure: v, paneScroll: g }),
|
|
376
376
|
[t, b, y, k, v, g]
|
|
377
|
-
), C = D(() => ({ kind: "panel", documentName: o, maximized: t }), [o, t]),
|
|
377
|
+
), 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
378
|
return /* @__PURE__ */ ie(ln, { value: w, children: [
|
|
379
|
-
/* @__PURE__ */
|
|
380
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ A(sn, { path: e, placement: C, markup: N, maximize: null }),
|
|
380
|
+
/* @__PURE__ */ A(an, { path: e, absence: cn, markup: E, variant: O, onDocumentShown: u })
|
|
381
381
|
] });
|
|
382
|
-
}, Se = () => typeof HTMLElement < "u" && typeof HTMLElement.prototype.showPopover == "function" && typeof HTMLElement.prototype.hidePopover == "function", me = "data-aqmx-column-probe", Q = "data-panel-id", ae = "--aqmx-multi-panel-chrome",
|
|
382
|
+
}, Se = () => typeof HTMLElement < "u" && typeof HTMLElement.prototype.showPopover == "function" && typeof HTMLElement.prototype.hidePopover == "function", me = "data-aqmx-column-probe", Q = "data-panel-id", ae = "--aqmx-multi-panel-chrome", rt = (e) => e === "normal" ? 0 : V(e), lt = (e, n) => {
|
|
383
383
|
const t = e.querySelector(te)?.firstElementChild, o = e.querySelector(`[${me}]`), r = o instanceof HTMLElement ? o.getBoundingClientRect().width : Number.NaN;
|
|
384
384
|
if (!(t instanceof HTMLElement))
|
|
385
385
|
return { plan: { trackInlineSize: Number.NaN, gap: Number.NaN, minColumnInlineSize: r, logicalColumns: n }, stageBlockSize: Number.NaN };
|
|
386
386
|
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
|
-
},
|
|
387
|
+
return { plan: { trackInlineSize: a, gap: rt(l.columnGap), minColumnInlineSize: r, logicalColumns: n }, stageBlockSize: d };
|
|
388
|
+
}, st = (e, n) => {
|
|
389
389
|
if (e.getClientRects().length === 0) return Number.NaN;
|
|
390
390
|
const t = getComputedStyle(e);
|
|
391
391
|
return n.getBoundingClientRect().top - e.getBoundingClientRect().top + V(t.paddingBottom) + V(t.borderBottomWidth);
|
|
392
|
-
}, ee = "data-aqmx-panel-frame", xe = "--aqmx-multi-panel-pinned-block-size",
|
|
392
|
+
}, ee = "data-aqmx-panel-frame", xe = "--aqmx-multi-panel-pinned-block-size", it = (e) => {
|
|
393
393
|
const { docPath: n, panelId: t } = e;
|
|
394
394
|
if (typeof n != "string" || typeof t != "string") throw new TypeError("[markdown-explorer] a multi-view panel needs string docPath and panelId props");
|
|
395
395
|
return { docPath: n, panelId: t };
|
|
396
|
-
},
|
|
396
|
+
}, at = (e) => {
|
|
397
397
|
const n = getComputedStyle(e), t = Number.parseFloat(n.lineHeight);
|
|
398
398
|
return Number.isFinite(t) ? t : Number.parseFloat(n.fontSize);
|
|
399
|
-
},
|
|
400
|
-
const n = e.closest(
|
|
399
|
+
}, ct = (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) => {
|
|
400
|
+
const n = e.closest(Re);
|
|
401
401
|
return n instanceof HTMLElement ? n : null;
|
|
402
402
|
}, je = (e) => {
|
|
403
403
|
const n = e.firstElementChild;
|
|
@@ -412,7 +412,7 @@ const In = () => {
|
|
|
412
412
|
(e[r]?.getBoundingClientRect().bottom ?? Number.NEGATIVE_INFINITY) > n ? o = r : t = r + 1;
|
|
413
413
|
}
|
|
414
414
|
return t < e.length ? t : -1;
|
|
415
|
-
},
|
|
415
|
+
}, ut = (e, n) => {
|
|
416
416
|
const t = Ge(e, n), o = [];
|
|
417
417
|
let r = e;
|
|
418
418
|
for (let a = Ee([...r.children], t); a >= 0; a = Ee([...r.children], t)) {
|
|
@@ -429,10 +429,10 @@ const In = () => {
|
|
|
429
429
|
if (o === void 0) return;
|
|
430
430
|
const r = o.getBoundingClientRect(), { offset: l, height: a } = t.anchor, d = l < 0 && a > 0 ? l / a * r.height : l;
|
|
431
431
|
n.scrollTop += r.top - Ge(e, n) - d;
|
|
432
|
-
},
|
|
432
|
+
}, dt = Object.freeze(["data-testid", "aria-label", "title", "href", "id", "name"]), Ye = (e) => {
|
|
433
433
|
const n = e.getAttribute(he);
|
|
434
|
-
return JSON.stringify(n === null ? [e.tagName, ...
|
|
435
|
-
},
|
|
434
|
+
return JSON.stringify(n === null ? [e.tagName, ...dt.map((t) => e.getAttribute(t))] : [e.tagName, he, n]);
|
|
435
|
+
}, mt = (e, n) => {
|
|
436
436
|
if (n === null || !e.contains(n)) return null;
|
|
437
437
|
const t = [];
|
|
438
438
|
for (let o = n; o !== e; ) {
|
|
@@ -441,20 +441,20 @@ const In = () => {
|
|
|
441
441
|
t.unshift([...r.children].indexOf(o)), o = r;
|
|
442
442
|
}
|
|
443
443
|
return { path: t, signature: Ye(n) };
|
|
444
|
-
},
|
|
444
|
+
}, ft = (e, n, t) => {
|
|
445
445
|
let o = e;
|
|
446
446
|
for (const r of t.path) o = o?.children[r];
|
|
447
447
|
o instanceof HTMLElement && Ye(o) === t.signature && dn(o) || n.focus({ preventScroll: !0 });
|
|
448
|
-
},
|
|
448
|
+
}, pt = (e, n, t) => {
|
|
449
449
|
if (e.shiftKey || Math.abs(e.deltaX) > Math.abs(e.deltaY)) return;
|
|
450
450
|
const o = e.ctrlKey || e.metaKey, r = o ? W(n) : n.closest(te);
|
|
451
451
|
if (!(r instanceof HTMLElement)) return;
|
|
452
|
-
const l =
|
|
453
|
-
(o ||
|
|
454
|
-
},
|
|
452
|
+
const l = ct(e, r, t);
|
|
453
|
+
(o || gt(r, l)) && (e.preventDefault(), r.scrollTop += l);
|
|
454
|
+
}, gt = (e, n) => n < 0 ? e.scrollTop > 0 : n > 0 ? Math.ceil(e.scrollTop + e.clientHeight) < e.scrollHeight : !1, ht = (e) => e.scrollHeight > e.clientHeight, vt = (e, n, t) => {
|
|
455
455
|
let o = Number.NaN, r = Number.NaN;
|
|
456
456
|
const l = je(t), a = () => {
|
|
457
|
-
const i =
|
|
457
|
+
const i = st(e, n);
|
|
458
458
|
if (!Number.isFinite(i)) return;
|
|
459
459
|
const y = l === null ? 0 : l.getBoundingClientRect().height;
|
|
460
460
|
y !== r && (r = y, t.style.setProperty(xe, `${String(y)}px`));
|
|
@@ -471,21 +471,21 @@ const In = () => {
|
|
|
471
471
|
return p?.observe(e), p?.observe(n), l !== null && p?.observe(l), () => {
|
|
472
472
|
p?.disconnect(), d !== null && cancelAnimationFrame(d), e.style.removeProperty(ae), t.style.removeProperty(xe);
|
|
473
473
|
};
|
|
474
|
-
},
|
|
475
|
-
const { docPath: n, panelId: t } =
|
|
474
|
+
}, wt = (e) => {
|
|
475
|
+
const { docPath: n, panelId: t } = it(e), { store: o, Body: r, maximize: l, focusCarry: a } = ue(), d = _(o, (u) => u.layout.maximized === n), p = _(o, (u) => de(u.titles, n)), i = q(null), y = q(null), E = q(null), b = q(null);
|
|
476
476
|
U(() => {
|
|
477
477
|
const u = i.current, v = u === null ? null : W(u);
|
|
478
478
|
if (u === null || v === null || d) return;
|
|
479
479
|
const g = /* @__PURE__ */ new Map(), O = (f) => {
|
|
480
480
|
const m = g.get(f);
|
|
481
481
|
if (m !== void 0) return m;
|
|
482
|
-
const T =
|
|
482
|
+
const T = at(f);
|
|
483
483
|
return g.set(f, T), T;
|
|
484
|
-
}, C = (f) =>
|
|
485
|
-
let
|
|
484
|
+
}, C = (f) => pt(f, u, O);
|
|
485
|
+
let M = !1;
|
|
486
486
|
const N = () => {
|
|
487
|
-
const f =
|
|
488
|
-
f !==
|
|
487
|
+
const f = ht(v);
|
|
488
|
+
f !== M && (M = f, f ? u.addEventListener("wheel", C, { capture: !0, passive: !1 }) : u.removeEventListener("wheel", C, { capture: !0 }));
|
|
489
489
|
};
|
|
490
490
|
N();
|
|
491
491
|
const c = typeof ResizeObserver > "u" ? null : new ResizeObserver(N);
|
|
@@ -495,7 +495,7 @@ const In = () => {
|
|
|
495
495
|
}, [d]), F(() => {
|
|
496
496
|
const u = i.current, v = u === null ? null : W(u), g = u === null ? null : u.closest(`[${Q}]`);
|
|
497
497
|
if (!(u === null || v === null || !(g instanceof HTMLElement)))
|
|
498
|
-
return
|
|
498
|
+
return vt(g, v, u);
|
|
499
499
|
}, []), F(() => {
|
|
500
500
|
const u = i.current, v = u === null ? null : W(u);
|
|
501
501
|
if (u === null || v === null) return;
|
|
@@ -503,21 +503,21 @@ const In = () => {
|
|
|
503
503
|
Oe(u, v, f), b.current = v.scrollTop;
|
|
504
504
|
}, O = o.readingPositionOf(t, n);
|
|
505
505
|
y.current = O === null ? null : { doc: n, position: O }, O !== null && g(O);
|
|
506
|
-
let C = null,
|
|
506
|
+
let C = null, M = u.getBoundingClientRect().width;
|
|
507
507
|
const N = () => {
|
|
508
508
|
C === null && (C = requestAnimationFrame(() => {
|
|
509
509
|
C = null;
|
|
510
510
|
const f = b.current;
|
|
511
|
-
if (b.current = null, f !== null && v.scrollTop === f || u.getBoundingClientRect().width !==
|
|
511
|
+
if (b.current = null, f !== null && v.scrollTop === f || u.getBoundingClientRect().width !== M) return;
|
|
512
512
|
const m = E.current;
|
|
513
|
-
m !== null && o.saveReadingPosition(t, m,
|
|
513
|
+
m !== null && o.saveReadingPosition(t, m, ut(u, v));
|
|
514
514
|
}));
|
|
515
515
|
};
|
|
516
516
|
v.addEventListener("scroll", N, { passive: !0 });
|
|
517
517
|
const c = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
|
|
518
518
|
const f = u.getBoundingClientRect().width;
|
|
519
|
-
if (f ===
|
|
520
|
-
|
|
519
|
+
if (f === M) return;
|
|
520
|
+
M = f;
|
|
521
521
|
const m = o.readingPositionOf(t, n);
|
|
522
522
|
m !== null && g(m);
|
|
523
523
|
});
|
|
@@ -528,26 +528,26 @@ const In = () => {
|
|
|
528
528
|
const u = i.current, v = u === null ? null : u.closest(`[${Q}]`);
|
|
529
529
|
if (u === null || v === null) return;
|
|
530
530
|
const g = a.take(t);
|
|
531
|
-
return g !== null &&
|
|
532
|
-
const O =
|
|
531
|
+
return g !== null && ft(v, u, g), () => {
|
|
532
|
+
const O = mt(v, v.ownerDocument.activeElement);
|
|
533
533
|
O !== null && a.hold(t, O);
|
|
534
534
|
};
|
|
535
535
|
}, [a, t]);
|
|
536
|
-
const k =
|
|
536
|
+
const k = R((u) => {
|
|
537
537
|
const v = i.current, g = v === null ? null : W(v);
|
|
538
538
|
if (v === null || g === null) return;
|
|
539
539
|
const O = E.current;
|
|
540
540
|
E.current = u;
|
|
541
541
|
const C = y.current;
|
|
542
542
|
y.current = null, C !== null && C.doc === u ? (Oe(v, g, C.position), b.current = g.scrollTop) : O !== null && O !== u && (g.scrollTop = 0);
|
|
543
|
-
}, []), w =
|
|
543
|
+
}, []), w = R(
|
|
544
544
|
(u) => {
|
|
545
545
|
un(u.target) || l(n);
|
|
546
546
|
},
|
|
547
547
|
[l, n]
|
|
548
548
|
);
|
|
549
549
|
return (
|
|
550
|
-
/* @__PURE__ */
|
|
550
|
+
/* @__PURE__ */ A(
|
|
551
551
|
"div",
|
|
552
552
|
{
|
|
553
553
|
ref: i,
|
|
@@ -558,20 +558,20 @@ const In = () => {
|
|
|
558
558
|
"data-aqmx-panel-frame": t,
|
|
559
559
|
"data-aqmx-maximized": d ? "true" : "false",
|
|
560
560
|
"data-testid": "markdown-explorer-panel-frame",
|
|
561
|
-
...d ?
|
|
561
|
+
...d ? Me : {},
|
|
562
562
|
onDoubleClick: d ? void 0 : w,
|
|
563
|
-
children: /* @__PURE__ */
|
|
563
|
+
children: /* @__PURE__ */ A(r, { docPath: n, panelId: t, maximized: d, title: p, onContentShown: k })
|
|
564
564
|
}
|
|
565
565
|
)
|
|
566
566
|
);
|
|
567
|
-
},
|
|
567
|
+
}, yt = Ze(wt), Z = (e, n) => {
|
|
568
568
|
const t = e.panelIds.get(n);
|
|
569
569
|
if (t === void 0) throw new Error(`[markdown-explorer] the open document ${JSON.stringify(n)} has no panel id`);
|
|
570
570
|
return t;
|
|
571
|
-
}, Pe = (e) => Object.fromEntries(
|
|
572
|
-
const t =
|
|
571
|
+
}, Pe = (e) => Object.fromEntries(Sn(e).map((n) => [n, []])), St = (e, n) => {
|
|
572
|
+
const t = Un(re(e, n), n.visible);
|
|
573
573
|
return Object.fromEntries(t.map((o, r) => [_e(r), o.map((l) => Z(e, l))]));
|
|
574
|
-
},
|
|
574
|
+
}, xt = (e, n) => {
|
|
575
575
|
const t = X(e);
|
|
576
576
|
return De(Object.keys(n)).map(
|
|
577
577
|
(o) => (n[o] ?? []).flatMap((r) => {
|
|
@@ -579,7 +579,7 @@ const In = () => {
|
|
|
579
579
|
return l === void 0 ? [] : [l];
|
|
580
580
|
})
|
|
581
581
|
);
|
|
582
|
-
},
|
|
582
|
+
}, Et = (e) => ({
|
|
583
583
|
switchToCustomDragMode: e.panelSwitchToCustomDrag,
|
|
584
584
|
switchToNormalDragMode: e.panelSwitchToNormalDrag,
|
|
585
585
|
hidePanel: e.panelHide,
|
|
@@ -603,7 +603,7 @@ const In = () => {
|
|
|
603
603
|
emptyColumn: e.multiColumnEmpty,
|
|
604
604
|
dropZone: e.multiColumnRegion,
|
|
605
605
|
dropHere: e.panelDropHere
|
|
606
|
-
}),
|
|
606
|
+
}), Ot = "--aqmx-multi-stage-bar-gutter", Pt = Object.freeze({ [Ot]: `${String(mn)}px` }), bt = Object.freeze({ blockSize: "100%", paddingInlineEnd: pn }), Ct = Object.freeze({ [xn]: "", style: Object.freeze({ display: "flex" }) }), Tt = (e) => /* @__PURE__ */ A("div", { ...Ct, children: /* @__PURE__ */ A(ke, { scroller: e, kind: "content" }) }), Nt = ({ props: e, children: n }) => /* @__PURE__ */ A(In, { scrollerProps: { ...e, style: bt }, renderScrollBar: Tt, barInlineSize: fn, children: n }), At = (e) => /* @__PURE__ */ A(ke, { scroller: e, kind: "stage" }), fe = "--aqmx-stage-block", Mt = "--aqmx-multi-panel-body-floor", kt = `calc(var(${fe}) * ${String(tn)})`, It = `max(calc(var(${fe}) * ${String(nn)}), calc(var(${ae}) + var(${Mt})))`, Lt = (e, n) => {
|
|
607
607
|
const t = Object.entries(e);
|
|
608
608
|
return t.length !== Object.keys(n).length ? !1 : t.every(([o, r]) => {
|
|
609
609
|
const l = n[o];
|
|
@@ -614,13 +614,13 @@ const In = () => {
|
|
|
614
614
|
const r = e.querySelector(`[${Q}="${n}"]`);
|
|
615
615
|
if (!(r instanceof HTMLElement)) return;
|
|
616
616
|
const l = t !== null && r.contains(t) ? t : null, a = [{ element: r, boundary: r.closest(te) }];
|
|
617
|
-
l !== null && a.push({ element: l, boundary: r }),
|
|
617
|
+
l !== null && a.push({ element: l, boundary: r }), gn(
|
|
618
618
|
e,
|
|
619
|
-
() => r.isConnected ? (r.scrollIntoView(
|
|
619
|
+
() => r.isConnected ? (r.scrollIntoView(Le), l?.isConnected !== !0 ? r : (o(l), l)) : null,
|
|
620
620
|
a
|
|
621
621
|
);
|
|
622
622
|
}, ne = (e) => {
|
|
623
|
-
e.scrollIntoView(
|
|
623
|
+
e.scrollIntoView(Le);
|
|
624
624
|
}, We = (e, n) => {
|
|
625
625
|
const t = e.querySelector(`[${ee}="${n}"]`);
|
|
626
626
|
return t instanceof HTMLElement ? (K(e, n, null, ne), t.focus({ preventScroll: !0 }), !0) : !1;
|
|
@@ -652,22 +652,22 @@ const In = () => {
|
|
|
652
652
|
const a = o.querySelector(`[${ee}="${n}"]`);
|
|
653
653
|
a instanceof HTMLElement && a.focus({ preventScroll: !0 });
|
|
654
654
|
});
|
|
655
|
-
},
|
|
656
|
-
const { config: t, labels: o, announcer: r, edits: l } = J(), { maximize: a } = ue(), 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] = $(() => Pe(i)), u = D(() =>
|
|
655
|
+
}, Dt = ({ store: e, stageRef: n }) => {
|
|
656
|
+
const { config: t, labels: o, announcer: r, edits: l } = J(), { maximize: a } = ue(), 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] = $(() => Pe(i)), u = D(() => Et(o), [o]), v = R(
|
|
657
657
|
(S) => {
|
|
658
|
-
e.arrange(
|
|
658
|
+
e.arrange(xt(e.getSnapshot().layout, S));
|
|
659
659
|
},
|
|
660
660
|
[e]
|
|
661
|
-
), g =
|
|
661
|
+
), g = En({ initialColumnPanels: w, initialPanelVisibility: {}, debugConfig: ve, onColumnPanelsChange: v }), { columnPanels: O, setColumnPanels: C } = g, M = q(E), N = q(O);
|
|
662
662
|
F(() => {
|
|
663
|
-
|
|
663
|
+
M.current = E, N.current = O;
|
|
664
664
|
}, [E, O]);
|
|
665
|
-
const c =
|
|
665
|
+
const c = R(
|
|
666
666
|
(S) => {
|
|
667
667
|
const x = n.current;
|
|
668
668
|
if (x === null) return;
|
|
669
|
-
const { plan: B, stageBlockSize: z } =
|
|
670
|
-
if (Number.isFinite(z) && z > 0 && x.style.setProperty(fe, `${String(z)}px`),
|
|
669
|
+
const { plan: B, stageBlockSize: z } = lt(x, d);
|
|
670
|
+
if (Number.isFinite(z) && z > 0 && x.style.setProperty(fe, `${String(z)}px`), M.current && !S) return;
|
|
671
671
|
const H = en(e.getSnapshot().visibleColumns, B);
|
|
672
672
|
H !== null && e.setVisibleColumns(H);
|
|
673
673
|
},
|
|
@@ -690,17 +690,17 @@ const In = () => {
|
|
|
690
690
|
}, [n, c]), U(() => {
|
|
691
691
|
E || c(!1);
|
|
692
692
|
}, [E, c]);
|
|
693
|
-
const f = D(() => b ?
|
|
693
|
+
const f = D(() => b ? St(p, { logical: d, visible: i }) : Pe(i), [b, p, d, i]);
|
|
694
694
|
F(() => {
|
|
695
|
-
|
|
695
|
+
Lt(N.current, f) || C(f);
|
|
696
696
|
}, [f, C]);
|
|
697
697
|
const m = D(() => De(Object.keys(O)).map((S) => ({ id: S, key: S, className: "aqmx-multi-column" })), [O]), T = D(
|
|
698
698
|
() => p.docs.map((S) => {
|
|
699
699
|
const x = Z(p, S);
|
|
700
|
-
return { id: x, component:
|
|
700
|
+
return { id: x, component: yt, title: de(y, S), props: { docPath: S, panelId: x }, minHeight: kt, maxHeight: It };
|
|
701
701
|
}),
|
|
702
702
|
[p, y]
|
|
703
|
-
),
|
|
703
|
+
), L = D(() => Object.fromEntries(p.docs.map((S) => [Z(p, S), !p.hidden.has(S)])), [p]), s = p.maximized === null ? null : Z(p, p.maximized), h = R(
|
|
704
704
|
(S) => {
|
|
705
705
|
const { layout: x } = e.getSnapshot();
|
|
706
706
|
for (const [B, z] of X(x)) {
|
|
@@ -717,7 +717,7 @@ const In = () => {
|
|
|
717
717
|
}
|
|
718
718
|
},
|
|
719
719
|
[e, n, r, o]
|
|
720
|
-
), P =
|
|
720
|
+
), P = R(
|
|
721
721
|
(S) => {
|
|
722
722
|
const x = X(e.getSnapshot().layout).get(S);
|
|
723
723
|
if (x === void 0) return;
|
|
@@ -730,7 +730,7 @@ const In = () => {
|
|
|
730
730
|
});
|
|
731
731
|
},
|
|
732
732
|
[e, n, r, o, l]
|
|
733
|
-
), I =
|
|
733
|
+
), I = R(
|
|
734
734
|
(S) => {
|
|
735
735
|
if (S === null) {
|
|
736
736
|
a(null);
|
|
@@ -741,14 +741,14 @@ const In = () => {
|
|
|
741
741
|
},
|
|
742
742
|
[e, a]
|
|
743
743
|
);
|
|
744
|
-
return /* @__PURE__ */
|
|
745
|
-
|
|
744
|
+
return /* @__PURE__ */ A("div", { className: "aqmx-multi-layout", "aria-busy": !b, children: /* @__PURE__ */ A(
|
|
745
|
+
On,
|
|
746
746
|
{
|
|
747
747
|
columns: m,
|
|
748
748
|
panels: T,
|
|
749
749
|
columnPanels: O,
|
|
750
750
|
onColumnPanelsChange: v,
|
|
751
|
-
panelVisibility:
|
|
751
|
+
panelVisibility: L,
|
|
752
752
|
onPanelVisibilityChange: h,
|
|
753
753
|
dragState: g.dragState,
|
|
754
754
|
dragOverPosition: g.dragOverPosition,
|
|
@@ -774,11 +774,11 @@ const In = () => {
|
|
|
774
774
|
dragHandle: "header",
|
|
775
775
|
labels: u,
|
|
776
776
|
panelClassName: "aqmx-multi-panel",
|
|
777
|
-
renderPanelScrollArea:
|
|
778
|
-
renderStageScrollBar:
|
|
777
|
+
renderPanelScrollArea: Nt,
|
|
778
|
+
renderStageScrollBar: At
|
|
779
779
|
}
|
|
780
780
|
) });
|
|
781
|
-
}, se = { blockStart: "--aqmx-multi-toast-block-start", inlineEnd: "--aqmx-multi-toast-inline-end", room: "--aqmx-multi-toast-room" },
|
|
781
|
+
}, se = { blockStart: "--aqmx-multi-toast-block-start", inlineEnd: "--aqmx-multi-toast-inline-end", room: "--aqmx-multi-toast-room" }, _t = (e, n) => {
|
|
782
782
|
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
783
|
return o.some(
|
|
784
784
|
(l) => r.some((a) => {
|
|
@@ -786,27 +786,27 @@ const In = () => {
|
|
|
786
786
|
return p !== -1 && i !== -1 && i < p;
|
|
787
787
|
})
|
|
788
788
|
);
|
|
789
|
-
},
|
|
789
|
+
}, zt = (e, n) => {
|
|
790
790
|
const t = n.getBoundingClientRect(), o = n.ownerDocument.documentElement.clientWidth, r = getComputedStyle(n).direction === "rtl";
|
|
791
791
|
return e.style.setProperty(se.blockStart, `${String(t.top)}px`), e.style.setProperty(se.inlineEnd, `${String(r ? t.left : o - t.right)}px`), e.style.setProperty(se.room, `${String(t.width)}px`), e.showPopover(), () => {
|
|
792
792
|
e.isConnected && e.hidePopover();
|
|
793
793
|
};
|
|
794
|
-
},
|
|
795
|
-
const { config: l, labels: a, announcer: d, edits: p } = J(), 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 = Ne(
|
|
794
|
+
}, Ht = ({ store: e, body: n, limitNotice: t, onLimitNoticeCovered: o, ref: r }) => {
|
|
795
|
+
const { config: l, labels: a, announcer: d, edits: p } = J(), 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 = Ne(vn), u = R(
|
|
796
796
|
(c) => {
|
|
797
|
-
const { layout: f } = e.getSnapshot(), m = f.maximized, T = c === null && m !== null ? f.panelIds.get(m) : void 0,
|
|
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 && pe(L, T);
|
|
798
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 && Rt(i, T, s));
|
|
799
799
|
},
|
|
800
800
|
[e, d, a]
|
|
801
|
-
), v =
|
|
801
|
+
), v = R(
|
|
802
802
|
(c, f, m, T) => {
|
|
803
803
|
if (m === f) {
|
|
804
804
|
e.setPendingHash(c, T);
|
|
805
805
|
return;
|
|
806
806
|
}
|
|
807
|
-
const
|
|
808
|
-
if (
|
|
809
|
-
p.askToDiscard(
|
|
807
|
+
const L = p.unsavedAmong([f]);
|
|
808
|
+
if (L.length > 0) {
|
|
809
|
+
p.askToDiscard(L).then((I) => {
|
|
810
810
|
I && v(c, f, m, T);
|
|
811
811
|
});
|
|
812
812
|
return;
|
|
@@ -826,16 +826,16 @@ const In = () => {
|
|
|
826
826
|
if (t === null || w !== null || !Se()) return;
|
|
827
827
|
const c = y.current, f = i.current;
|
|
828
828
|
if (c === null || f === null) throw new Error("[markdown-explorer] the panel-limit notice and the stage must be mounted together");
|
|
829
|
-
return
|
|
829
|
+
return zt(c, f);
|
|
830
830
|
}, [t, w]), U(() => {
|
|
831
831
|
const c = y.current;
|
|
832
832
|
if (t === null || c === null) return;
|
|
833
833
|
const { ownerDocument: f } = c;
|
|
834
834
|
let m = null;
|
|
835
|
-
const T = (
|
|
836
|
-
const s =
|
|
835
|
+
const T = (L) => {
|
|
836
|
+
const s = L.target;
|
|
837
837
|
s instanceof Element && (m !== null && cancelAnimationFrame(m), m = requestAnimationFrame(() => {
|
|
838
|
-
m = null, f.activeElement === s && c.isConnected &&
|
|
838
|
+
m = null, f.activeElement === s && c.isConnected && _t(c, s) && o();
|
|
839
839
|
}));
|
|
840
840
|
};
|
|
841
841
|
return f.addEventListener("focusin", T, !0), () => {
|
|
@@ -858,37 +858,37 @@ const In = () => {
|
|
|
858
858
|
c !== null && Ie(c);
|
|
859
859
|
};
|
|
860
860
|
}, []);
|
|
861
|
-
const g =
|
|
861
|
+
const g = R((c, f) => {
|
|
862
862
|
const m = i.current;
|
|
863
863
|
m !== null && K(m, c, f, ne);
|
|
864
|
-
}, []), O =
|
|
864
|
+
}, []), O = R((c, f, m) => {
|
|
865
865
|
const T = i.current;
|
|
866
|
-
T !== null && K(T, c, m, (
|
|
867
|
-
}, []), [C] = $(
|
|
866
|
+
T !== null && K(T, c, m, (L) => hn(f, L));
|
|
867
|
+
}, []), [C] = $(Ln), 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) => _e(f)), [l]);
|
|
868
868
|
return (
|
|
869
|
-
/* @__PURE__ */ ie("section", { ref: i, className: "aqmx-multi-stage", style:
|
|
870
|
-
/* @__PURE__ */
|
|
871
|
-
b ? E ? /* @__PURE__ */
|
|
872
|
-
/* @__PURE__ */
|
|
873
|
-
/* @__PURE__ */
|
|
874
|
-
/* @__PURE__ */
|
|
875
|
-
] }, c)) }) : /* @__PURE__ */
|
|
876
|
-
t === null ? null : w !== null ?
|
|
877
|
-
/* @__PURE__ */
|
|
869
|
+
/* @__PURE__ */ ie("section", { ref: i, className: "aqmx-multi-stage", style: Pt, tabIndex: -1, "aria-label": a.multiRegion, "aria-busy": b && !E, "data-testid": "markdown-explorer-stage", "data-aqmx-visible-columns": k, ...Me, children: [
|
|
870
|
+
/* @__PURE__ */ A("span", { className: "aqmx-multi-probe", "aria-hidden": "true", [me]: "" }),
|
|
871
|
+
b ? E ? /* @__PURE__ */ A(ze, { value: M, children: /* @__PURE__ */ A(Dt, { 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__ */ ie("div", { className: "aqmx-skeleton aqmx-multi-skeleton-column", children: [
|
|
872
|
+
/* @__PURE__ */ A("span", {}),
|
|
873
|
+
/* @__PURE__ */ A("span", {}),
|
|
874
|
+
/* @__PURE__ */ A("span", {})
|
|
875
|
+
] }, 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 ? kn(
|
|
877
|
+
/* @__PURE__ */ A("div", { ref: y, className: "aqmx-toast aqmx-multi-toast", "data-testid": "markdown-explorer-panel-limit", children: t }),
|
|
878
878
|
w
|
|
879
879
|
) : (
|
|
880
|
-
/* @__PURE__ */
|
|
880
|
+
/* @__PURE__ */ A("div", { ref: y, popover: Se() ? "manual" : void 0, className: "aqmx-toast aqmx-multi-toast", "data-testid": "markdown-explorer-panel-limit", children: t })
|
|
881
881
|
)
|
|
882
882
|
] })
|
|
883
883
|
);
|
|
884
|
-
},
|
|
884
|
+
}, Bt = 3e3, qt = (e, n) => {
|
|
885
885
|
if (n !== null) return n;
|
|
886
886
|
const [t] = e;
|
|
887
887
|
return t === void 0 ? null : t;
|
|
888
888
|
}, Te = (e, n, t) => {
|
|
889
889
|
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
890
|
return l === void 0 ? null : l;
|
|
891
|
-
},
|
|
891
|
+
}, Ft = (e, n, t) => {
|
|
892
892
|
switch (n) {
|
|
893
893
|
case "opened":
|
|
894
894
|
return e.panelOpened(t);
|
|
@@ -901,8 +901,8 @@ const In = () => {
|
|
|
901
901
|
throw new RangeError(`[markdown-explorer] unknown toggle outcome ${JSON.stringify(o)}`);
|
|
902
902
|
}
|
|
903
903
|
}
|
|
904
|
-
},
|
|
905
|
-
const { config: n, labels: t, announcer: o } = J(), r =
|
|
904
|
+
}, Qt = ({ location: e }) => {
|
|
905
|
+
const { config: n, labels: t, announcer: o } = J(), r = nt(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: Te([], l, null) }));
|
|
906
906
|
i.docs !== l && y({ docs: l, latest: Te(i.docs, l, i.latest) });
|
|
907
907
|
const E = a !== null ? a : i.latest, [b, k] = $(!1), w = q(null), [u, v] = $(0), g = q(null), O = q(null);
|
|
908
908
|
F(() => {
|
|
@@ -914,36 +914,36 @@ const In = () => {
|
|
|
914
914
|
},
|
|
915
915
|
[]
|
|
916
916
|
);
|
|
917
|
-
const C =
|
|
917
|
+
const C = R(() => {
|
|
918
918
|
w.current !== null && clearTimeout(w.current), k(!0), w.current = setTimeout(() => {
|
|
919
919
|
w.current = null, k(!1);
|
|
920
|
-
},
|
|
921
|
-
}, []),
|
|
920
|
+
}, Bt);
|
|
921
|
+
}, []), M = R(() => {
|
|
922
922
|
w.current !== null && clearTimeout(w.current), w.current = null, k(!1);
|
|
923
|
-
}, []), N =
|
|
923
|
+
}, []), N = R(
|
|
924
924
|
(m) => {
|
|
925
|
-
const T = r.titleOf(m),
|
|
926
|
-
|
|
927
|
-
const s =
|
|
928
|
-
if (
|
|
925
|
+
const T = r.titleOf(m), L = r.toggle(m);
|
|
926
|
+
L === "rejected" && C();
|
|
927
|
+
const s = L === "rejected" ? t.panelLimit(n.multiView.maxPanels) : Ft(t, L, T);
|
|
928
|
+
if (L === "shown") {
|
|
929
929
|
g.current = { doc: m, announcement: s }, v((h) => h + 1);
|
|
930
930
|
return;
|
|
931
931
|
}
|
|
932
932
|
r.whenUrlRendered(() => {
|
|
933
|
-
o.announce(s),
|
|
933
|
+
o.announce(s), L === "opened" && O.current?.bringIntoView(m);
|
|
934
934
|
});
|
|
935
935
|
},
|
|
936
936
|
[r, C, o, t, n]
|
|
937
937
|
), c = D(() => new Set(l), [l]), f = D(() => {
|
|
938
|
-
const m =
|
|
939
|
-
return { href:
|
|
938
|
+
const m = qt(l, a);
|
|
939
|
+
return { href: Ae(n, { view: "tree", source: p, doc: m, markup: m !== null && d.has(m) }), target: "tree" };
|
|
940
940
|
}, [n, p, l, a, d]);
|
|
941
|
-
return /* @__PURE__ */
|
|
942
|
-
|
|
941
|
+
return /* @__PURE__ */ A(
|
|
942
|
+
wn,
|
|
943
943
|
{
|
|
944
944
|
view: "multi",
|
|
945
|
-
explorer: /* @__PURE__ */
|
|
946
|
-
content: /* @__PURE__ */
|
|
945
|
+
explorer: /* @__PURE__ */ A(yn, { mode: "multi", sourceId: p, currentPath: E, openPaths: c, onOpenDocument: N, onSourceChange: r.changeSource, onRevealSource: r.revealSource, viewSwitch: f }),
|
|
946
|
+
content: /* @__PURE__ */ A(Ht, { ref: O, store: r, body: ot, limitNotice: b ? t.panelLimit(n.multiView.maxPanels) : null, onLimitNoticeCovered: M }),
|
|
947
947
|
contentCoversPage: a !== null,
|
|
948
948
|
sheetDismissals: u,
|
|
949
949
|
onDraggingChange: r.setSplitDragging
|
|
@@ -951,8 +951,8 @@ const In = () => {
|
|
|
951
951
|
);
|
|
952
952
|
};
|
|
953
953
|
export {
|
|
954
|
-
|
|
955
|
-
|
|
954
|
+
Qt as MultiLayout,
|
|
955
|
+
Bt as PANEL_LIMIT_NOTICE_MS,
|
|
956
956
|
Te as latestOpenedDocument,
|
|
957
|
-
|
|
957
|
+
qt as treeSwitchDocument
|
|
958
958
|
};
|