@aiquants/markdown-explorer 0.12.1 → 0.14.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 +30 -1
- package/README.md +21 -12
- package/dist/EditSurface-BLlu5zEt.cjs +2 -0
- package/dist/EditSurface-CF2io496.js +705 -0
- package/dist/{ExplorerSplit-BjjqNRtj.js → ExplorerSplit-BPLECNpv.js} +109 -109
- package/dist/{ExplorerSplit-CqmbUSZ7.cjs → ExplorerSplit-Cjvy0JHP.cjs} +1 -1
- package/dist/{MultiLayout-BZbEl73E.cjs → MultiLayout-BjA0k-5n.cjs} +1 -1
- package/dist/{MultiLayout-BYXoD1aS.js → MultiLayout-D8F0BfxA.js} +25 -25
- package/dist/{NativeScrollBar-RP37nwmY.js → NativeScrollBar-BFF12oEd.js} +1 -1
- package/dist/{NativeScrollBar-B7jTbQmn.cjs → NativeScrollBar-BUWXPvTV.cjs} +1 -1
- package/dist/{TreeLayout-CEp5oKly.cjs → TreeLayout-CQUpgsxz.cjs} +1 -1
- package/dist/{TreeLayout-Uo6RG7lq.js → TreeLayout-rhyVTfrI.js} +3 -3
- package/dist/core/contracts.d.cts +7 -1
- package/dist/core/contracts.d.ts +7 -1
- package/dist/core/labels.d.cts +14 -1
- package/dist/core/labels.d.ts +14 -1
- package/dist/core/revalidation.d.cts +1 -2
- package/dist/core/revalidation.d.ts +1 -2
- package/dist/{dataRoute-CH3yOKR0.cjs → dataRoute-BONacTPi.cjs} +1 -1
- package/dist/{dataRoute-Pm_0ue_4.js → dataRoute-CObbjNxG.js} +14 -12
- package/dist/index-Dn7cYy-4.cjs +13 -0
- package/dist/index-v997iKxe.js +3464 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +21 -21
- package/dist/{location-BUNWJ4eB.cjs → location-D6RE3wAN.cjs} +1 -1
- package/dist/{location-DWd6SQhN.js → location-IRD9h42r.js} +1 -1
- package/dist/{merge-DRGBbLuR.cjs → merge-BFk7nT59.cjs} +1 -1
- package/dist/{merge-q-5i8qsn.js → merge-Bi2VedIr.js} +1 -1
- package/dist/{sanitizePolicy-djLC3fRN.js → sanitizePolicy-DlrakwA4.js} +1 -1
- package/dist/{sanitizePolicy-BfUlXI5E.cjs → sanitizePolicy-DrIMuYCb.cjs} +1 -1
- package/dist/sanitizeWorker.cjs +1 -1
- package/dist/sanitizeWorker.js +1 -1
- package/dist/server/ports.d.cts +3 -0
- package/dist/server/ports.d.ts +3 -0
- package/dist/server.cjs +1 -1
- package/dist/server.js +93 -83
- package/dist/styles/markdown-explorer.css +1 -1
- package/docs/behavior/dom-hooks.md +6 -5
- package/docs/behavior/layout.md +10 -3
- package/package.json +6 -5
- package/dist/EditSurface-By6NPcD7.js +0 -633
- package/dist/EditSurface-BztcpQPW.cjs +0 -2
- package/dist/index-CGBl3fYT.cjs +0 -13
- package/dist/index-CjCr8czx.js +0 -3356
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as m, jsxs as
|
|
2
|
-
import { u as D, F as Nt,
|
|
1
|
+
import { jsx as m, jsxs as O, Fragment as Xe } from "react/jsx-runtime";
|
|
2
|
+
import { u as D, F as Nt, H as Oe, G as Ye, J as Lt, s as Ae, K as kt, M as Ot, j as At, N as Pt, O as qt, Q as Ct } from "./index-v997iKxe.js";
|
|
3
3
|
import * as p from "react";
|
|
4
4
|
import { use as be, createContext as Pe, useState as q, useCallback as w, useMemo as F, useRef as g, useLayoutEffect as I, useEffect as _, useSyncExternalStore as Ee, Suspense as Qe, useId as ye } from "react";
|
|
5
|
-
import { C as Ft, k as Mt, l as Je, v as _t, m as It, n as Dt, E as Ht, o as Be, q as $t, s as Zt, S as ve, t as Bt, F as zt, A as Vt } from "./location-
|
|
5
|
+
import { C as Ft, k as Mt, l as Je, v as _t, m as It, n as Dt, E as Ht, o as Be, q as $t, s as Zt, S as ve, t as Bt, F as zt, A as Vt } from "./location-IRD9h42r.js";
|
|
6
6
|
import { useDirectoryTreeState as jt, DirectoryTree as Kt } from "@aiquants/directory-tree";
|
|
7
|
-
import { T as
|
|
8
|
-
import { s as
|
|
9
|
-
import { PanelGroup as
|
|
7
|
+
import { T as Gt } from "./tapScrollCircle-u4EXeLhx.js";
|
|
8
|
+
import { s as Ut } from "./storage-BSthKLSG.js";
|
|
9
|
+
import { PanelGroup as Wt, Panel as ze, PanelResizeHandle as Xt } from "@aiquants/resize-panels";
|
|
10
10
|
import { useLocation as Yt } from "react-router";
|
|
11
11
|
function Qt({
|
|
12
12
|
title: e,
|
|
@@ -97,7 +97,7 @@ function an({
|
|
|
97
97
|
}
|
|
98
98
|
const ln = /* @__PURE__ */ p.forwardRef(an), on = () => {
|
|
99
99
|
const { notices: e } = D(), t = be(e);
|
|
100
|
-
return t.length === 0 ? null : /* @__PURE__ */ m("div", { className: "aqmx-explorer-notices", children: t.map((n) => /* @__PURE__ */
|
|
100
|
+
return t.length === 0 ? null : /* @__PURE__ */ m("div", { className: "aqmx-explorer-notices", children: t.map((n) => /* @__PURE__ */ O("div", { className: "aqmx-callout", "data-aqmx-tone": n.tone, "data-testid": "markdown-explorer-notice", "data-aqmx-notice": n.id, children: [
|
|
101
101
|
/* @__PURE__ */ m("p", { className: "aqmx-callout-title", children: n.title }),
|
|
102
102
|
n.body === void 0 ? null : /* @__PURE__ */ m("p", { className: "aqmx-callout-body", children: n.body }),
|
|
103
103
|
n.action === void 0 ? null : (
|
|
@@ -309,7 +309,7 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
309
309
|
o((f) => f.state === "running" && f.opened === i ? f : { state: "running", opened: i });
|
|
310
310
|
}, []);
|
|
311
311
|
return F(() => ({ status: r, start: c, end: l, advance: a }), [r, c, l, a]);
|
|
312
|
-
}, je = ["pointerdown", "wheel", "touchstart", "keydown", "focusin"], kn = 8, Ke = { least: Number.POSITIVE_INFINITY, stalled: 0 },
|
|
312
|
+
}, je = ["pointerdown", "wheel", "touchstart", "keydown", "focusin"], kn = 8, Ke = { least: Number.POSITIVE_INFINITY, stalled: 0 }, On = ({ tree: e, container: t, path: n, chain: r, rows: o, cancel: c, displayed: l, placement: a }) => {
|
|
313
313
|
const s = g(null), d = g(!0), u = g(Ke), i = g(null), f = g(null), h = g(r), v = g(a);
|
|
314
314
|
I(() => {
|
|
315
315
|
h.current = r, v.current = a;
|
|
@@ -332,8 +332,8 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
332
332
|
}
|
|
333
333
|
if (e.current?.scrollToPath(b, { align: "nearest" }) === !0) {
|
|
334
334
|
i.current?.phase === "opening" && E();
|
|
335
|
-
const { least:
|
|
336
|
-
u.current = R <
|
|
335
|
+
const { least: A, stalled: H } = u.current;
|
|
336
|
+
u.current = R < A ? { least: R, stalled: 0 } : { least: A, stalled: H + 1 }, u.current.stalled < kn && C();
|
|
337
337
|
return;
|
|
338
338
|
}
|
|
339
339
|
const y = i.current;
|
|
@@ -366,8 +366,8 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
366
366
|
const b = h.current;
|
|
367
367
|
if (L && b !== null) {
|
|
368
368
|
const R = new AbortController(), y = { phase: "asking", controller: R };
|
|
369
|
-
i.current = y, b.ancestors(n, R.signal).then((
|
|
370
|
-
i.current === y && (
|
|
369
|
+
i.current = y, b.ancestors(n, R.signal).then((A) => {
|
|
370
|
+
i.current === y && (A === null ? i.current = null : (i.current = { phase: "opening", folders: A }, h.current?.open(A)), T());
|
|
371
371
|
});
|
|
372
372
|
}
|
|
373
373
|
T();
|
|
@@ -382,7 +382,7 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
382
382
|
_(() => {
|
|
383
383
|
M.current && !l && E(), M.current = l;
|
|
384
384
|
}, [l, E]);
|
|
385
|
-
},
|
|
385
|
+
}, An = "--aqmx-tree-line", Pn = Object.freeze(["(forced-colors: active)", "(prefers-color-scheme: dark)"]), qn = "data-aqmx-tree-probe", Cn = Object.freeze({ rowHeight: Ft, lineColor: null }), Fn = /^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/u, Mn = (e) => {
|
|
386
386
|
const t = Fn.exec(e);
|
|
387
387
|
return t === null ? e : `#${t.slice(1).map((n) => Number(n).toString(16).padStart(2, "0")).join("")}`;
|
|
388
388
|
}, _n = (e, t) => {
|
|
@@ -391,7 +391,7 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
391
391
|
const o = e.current;
|
|
392
392
|
if (o === null) return;
|
|
393
393
|
const c = () => {
|
|
394
|
-
const s = Math.round(o.getBoundingClientRect().height), d = getComputedStyle(o), u = d.getPropertyValue(
|
|
394
|
+
const s = Math.round(o.getBoundingClientRect().height), d = getComputedStyle(o), u = d.getPropertyValue(An).trim() === "" ? null : Mn(d.color);
|
|
395
395
|
r((i) => {
|
|
396
396
|
const f = Number.isFinite(s) && s > 0 ? s : i.rowHeight;
|
|
397
397
|
return i.rowHeight === f && i.lineColor === u ? i : { rowHeight: f, lineColor: u };
|
|
@@ -422,17 +422,17 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
422
422
|
enableArrowButtons: !0,
|
|
423
423
|
enableArrowButtonTabStops: !1,
|
|
424
424
|
enableScrollToTopBottomButtons: !0,
|
|
425
|
-
tapScrollCircleOptions:
|
|
425
|
+
tapScrollCircleOptions: Gt
|
|
426
426
|
},
|
|
427
427
|
behaviorOptions: { enablePointerDrag: !0 }
|
|
428
428
|
}, $n = { hoverClassName: "", directorySelectedClassName: "", itemSelectedClassName: "" }, Zn = { color: "inherit" }, Bn = { paddingBlock: 0 }, zn = /* @__PURE__ */ new Set(), Vn = /* @__PURE__ */ new Map(), jn = { color: "var(--aqmx-tree-line)" }, Kn = (e) => {
|
|
429
429
|
const t = e instanceof Element ? e.closest(`[${se}]`) : null;
|
|
430
430
|
return t === null || t.getAttribute("data-entry-type") !== "file" ? null : t.getAttribute(se);
|
|
431
|
-
}, ot = (e, t, n, r) => n === "folder-limit" ? e.expandAllFolderLimit(r, t.maxFolders, e.expandAll) : e.expandAllDepthLimit(r, t.maxDepth),
|
|
431
|
+
}, ot = (e, t, n, r) => n === "folder-limit" ? e.expandAllFolderLimit(r, t.maxFolders, e.expandAll) : e.expandAllDepthLimit(r, t.maxDepth), Gn = (e, t, n) => n.kind === "done" ? e.expandAllDone(n.opened, n.failed, n.complete) : ot(e, t, n.kind, n.opened), st = () => {
|
|
432
432
|
const { labels: e } = D();
|
|
433
|
-
return /* @__PURE__ */
|
|
433
|
+
return /* @__PURE__ */ O("div", { className: "aqmx-explorer-loading", "aria-busy": "true", "data-testid": "markdown-explorer-tree-loading", children: [
|
|
434
434
|
/* @__PURE__ */ m("p", { className: "aqmx-explorer-loading-text", children: e.treeLoading }),
|
|
435
|
-
/* @__PURE__ */
|
|
435
|
+
/* @__PURE__ */ O("div", { className: "aqmx-skeleton", "aria-hidden": "true", children: [
|
|
436
436
|
/* @__PURE__ */ m("span", {}),
|
|
437
437
|
/* @__PURE__ */ m("span", {}),
|
|
438
438
|
/* @__PURE__ */ m("span", {}),
|
|
@@ -440,19 +440,19 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
440
440
|
/* @__PURE__ */ m("span", {})
|
|
441
441
|
] })
|
|
442
442
|
] });
|
|
443
|
-
},
|
|
443
|
+
}, Un = () => {
|
|
444
444
|
const { labels: e } = D();
|
|
445
|
-
return /* @__PURE__ */
|
|
445
|
+
return /* @__PURE__ */ O("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-tree-empty", children: [
|
|
446
446
|
/* @__PURE__ */ m(cn, { className: "aqmx-explorer-empty-icon", "aria-hidden": "true" }),
|
|
447
447
|
/* @__PURE__ */ m("p", { className: "aqmx-empty-title", children: e.treeEmptyTitle }),
|
|
448
448
|
/* @__PURE__ */ m("p", { className: "aqmx-explorer-empty-body", children: e.treeEmptyBody })
|
|
449
449
|
] });
|
|
450
|
-
},
|
|
450
|
+
}, Wn = ({ name: e, onRetry: t }) => {
|
|
451
451
|
const { labels: n } = D(), r = ye();
|
|
452
|
-
return /* @__PURE__ */
|
|
452
|
+
return /* @__PURE__ */ O("span", { className: "aqmx-explorer-folder-failed", children: [
|
|
453
453
|
/* @__PURE__ */ m("span", { className: "aqmx-explorer-folder-name", children: e }),
|
|
454
454
|
/* @__PURE__ */ m("span", { id: r, className: "aqmx-explorer-folder-error", children: n.folderLoadFailed }),
|
|
455
|
-
/* @__PURE__ */
|
|
455
|
+
/* @__PURE__ */ O(
|
|
456
456
|
"button",
|
|
457
457
|
{
|
|
458
458
|
type: "button",
|
|
@@ -468,13 +468,13 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
468
468
|
o.key !== "Escape" && o.stopPropagation();
|
|
469
469
|
},
|
|
470
470
|
children: [
|
|
471
|
-
/* @__PURE__ */ m(
|
|
471
|
+
/* @__PURE__ */ m(Oe, { className: "aqmx-explorer-folder-retry-icon", "aria-hidden": "true" }),
|
|
472
472
|
/* @__PURE__ */ m("span", { className: "aqmx-explorer-folder-retry-text", children: n.retry })
|
|
473
473
|
]
|
|
474
474
|
}
|
|
475
475
|
)
|
|
476
476
|
] });
|
|
477
|
-
},
|
|
477
|
+
}, Xn = ({
|
|
478
478
|
entries: e,
|
|
479
479
|
version: t,
|
|
480
480
|
mode: n,
|
|
@@ -492,7 +492,7 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
492
492
|
expandAll: v,
|
|
493
493
|
revealCancel: E
|
|
494
494
|
}) => {
|
|
495
|
-
const { trees: S, documents: C, labels: T, locale: L, theme: Z, data: M, config: k, sources: b, reveals: R } = D(), y = be(qe), [
|
|
495
|
+
const { trees: S, documents: C, labels: T, locale: L, theme: Z, data: M, config: k, sources: b, reveals: R } = D(), y = be(qe), [A] = q(hn), H = g(null), { rowHeight: de, lineColor: W } = _n(H, Z), { isExpanded: B, toggle: ee, expandMultiple: K, collapseMultiple: ae, expanded: V, isPending: le } = u, { alwaysExpanded: X, sortMode: $, folderPlacement: G } = o, { direct: ue, markDirect: U, unmarkDirect: ce, pruneDirect: me } = f, { running: oe, advance: he } = v, fe = g(null), te = g(null), N = F(() => Mt({ sortMode: $, folderPlacement: G }), [$, G]), Y = F(() => xn(N), [N]), z = w((x) => S.children(r, x), [S, r]), ne = F(() => gn(e), [e]), re = w((x) => !pe(x) && (B(x) || X && !ne.has(x)), [B, X, ne]), Q = g({ shownExpanded: re, isExpanded: B, unloadedFolders: ne, entries: e, childrenOf: z });
|
|
496
496
|
I(() => {
|
|
497
497
|
Q.current = { shownExpanded: re, isExpanded: B, unloadedFolders: ne, entries: e, childrenOf: z };
|
|
498
498
|
}, [re, B, ne, e, z]);
|
|
@@ -507,9 +507,9 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
507
507
|
Me(mn(x));
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
|
-
Q.current.isExpanded(x) ? ce([x]) : Q.current.unloadedFolders.has(x) &&
|
|
510
|
+
Q.current.isExpanded(x) ? ce([x]) : Q.current.unloadedFolders.has(x) && U(x), ee(x);
|
|
511
511
|
},
|
|
512
|
-
[Me,
|
|
512
|
+
[Me, U, ce, ee]
|
|
513
513
|
), Re = w(
|
|
514
514
|
(x) => {
|
|
515
515
|
const P = x.filter((j) => !pe(j));
|
|
@@ -524,18 +524,18 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
524
524
|
[K, Re]
|
|
525
525
|
), _e = w(
|
|
526
526
|
(x) => /* @__PURE__ */ m(
|
|
527
|
-
|
|
527
|
+
Wn,
|
|
528
528
|
{
|
|
529
529
|
name: x.name,
|
|
530
530
|
onRetry: () => {
|
|
531
|
-
|
|
531
|
+
U(x.path), S.retryChildren(r, x.path), Q.current.shownExpanded(x.path) || K([x.path]);
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
534
|
),
|
|
535
|
-
[S, r,
|
|
536
|
-
), Ie = n === "multi" ? l : zn, { loopFolderName: De } = T, xt = F(() =>
|
|
537
|
-
for (const x of He.current) Q.current.unloadedFolders.has(x) &&
|
|
538
|
-
}, [
|
|
535
|
+
[S, r, U, K]
|
|
536
|
+
), Ie = n === "multi" ? l : zn, { loopFolderName: De } = T, xt = F(() => A(e, { openPaths: Ie, childrenOf: z, renderFailedFolder: _e, loopFolderName: De }), [A, e, Ie, z, _e, De, t]), wt = Lt(C, Kn), He = g([]), xe = w(() => {
|
|
537
|
+
for (const x of He.current) Q.current.unloadedFolders.has(x) && U(x);
|
|
538
|
+
}, [U]), { maxDepth: Se } = k.revealDocument, $e = g(d);
|
|
539
539
|
I(() => {
|
|
540
540
|
$e.current = d;
|
|
541
541
|
}, [d]);
|
|
@@ -560,7 +560,7 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
560
560
|
);
|
|
561
561
|
_(() => xe(), [xe, ne]);
|
|
562
562
|
const vt = F(() => [e, t, V], [e, t, V]), bt = w((x) => te.current === null ? Number.POSITIVE_INFINITY : Dn(te.current, x), []);
|
|
563
|
-
|
|
563
|
+
On({ tree: fe, container: te, path: c.path, chain: c.openFolders ? gt : null, rows: vt, cancel: E, displayed: y, placement: bt });
|
|
564
564
|
const Ze = w((x) => ue.has(x), [ue]), we = F(() => wn(e, { isShownExpanded: re, childrenOf: z, compare: N, isDirect: Ze }), [e, re, z, N, Ze, t]), ge = y && h;
|
|
565
565
|
I(() => {
|
|
566
566
|
i(e);
|
|
@@ -587,8 +587,8 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
587
587
|
scrollToBottom: T.treeScrollToBottom
|
|
588
588
|
}),
|
|
589
589
|
[T]
|
|
590
|
-
), Tt =
|
|
591
|
-
return /* @__PURE__ */
|
|
590
|
+
), Tt = W === null ? { showTreeLines: !1 } : { showTreeLines: o.lines, lineColor: W };
|
|
591
|
+
return /* @__PURE__ */ O("div", { ref: te, className: "aqmx-explorer-tree", "data-testid": "markdown-explorer-tree", ...wt, children: [
|
|
592
592
|
/* @__PURE__ */ m("span", { ref: H, className: "aqmx-explorer-tree-probe", "aria-hidden": "true", [qn]: "" }),
|
|
593
593
|
/* @__PURE__ */ m(
|
|
594
594
|
Kt,
|
|
@@ -643,8 +643,8 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
643
643
|
return () => clearTimeout(d);
|
|
644
644
|
}, [r, e, o]);
|
|
645
645
|
const a = r && e === 0 ? o : e;
|
|
646
|
-
return a === 0 && r ? null : /* @__PURE__ */
|
|
647
|
-
a > 0 ? /* @__PURE__ */ m(
|
|
646
|
+
return a === 0 && r ? null : /* @__PURE__ */ O("p", { className: "aqmx-explorer-tree-progress", "data-testid": "markdown-explorer-tree-progress", "data-aqmx-loading": String(a), "data-aqmx-expand-all": t.state, children: [
|
|
647
|
+
a > 0 ? /* @__PURE__ */ m(Oe, { className: "aqmx-explorer-tree-progress-icon", "aria-hidden": "true" }) : null,
|
|
648
648
|
/* @__PURE__ */ m("span", { children: t.state === "running" ? n.expandAllProgress(t.opened, a) : n.foldersLoading(a) })
|
|
649
649
|
] });
|
|
650
650
|
}, Qn = ({ stop: e, opened: t, budget: n }) => {
|
|
@@ -652,7 +652,7 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
652
652
|
return /* @__PURE__ */ m("p", { className: "aqmx-explorer-expand-all-stop", "data-testid": "markdown-explorer-expand-all-stop", "data-aqmx-stop": e, children: ot(r, n, e, t) });
|
|
653
653
|
}, Jn = ({ entries: e, ...t }) => {
|
|
654
654
|
const { trees: n } = D(), r = Ee(n.subscribe, n.version, n.version), { sourceId: o } = t, [c] = q(dn), l = F(() => c(e, (a) => n.children(o, a)), [c, e, n, o, r]);
|
|
655
|
-
return l.length === 0 ? /* @__PURE__ */ m(
|
|
655
|
+
return l.length === 0 ? /* @__PURE__ */ m(Un, {}) : /* @__PURE__ */ m(Xn, { entries: l, version: r, ...t });
|
|
656
656
|
}, er = ({ result: e, onRetry: t, ...n }) => {
|
|
657
657
|
const { renderTreeFailure: r } = D(), o = be(e);
|
|
658
658
|
if (o.status === "deferred") return /* @__PURE__ */ m(st, {});
|
|
@@ -660,7 +660,7 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
660
660
|
const c = r?.(o.failure);
|
|
661
661
|
return /* @__PURE__ */ m("div", { className: "aqmx-explorer-tree-message", "data-testid": "markdown-explorer-tree-failure", "data-aqmx-failure": o.failure.reason, children: c !== void 0 ? c : /* @__PURE__ */ m(Nt, { failure: o.failure, alert: !0, onRetry: t, testId: null }) });
|
|
662
662
|
}, tr = ({ onControls: e, ...t }) => {
|
|
663
|
-
const { trees: n, storageNamespace: r, labels: o, announcer: c, config: l } = D(), { sourceId: a } = t, s = jt({ storageKey:
|
|
663
|
+
const { trees: n, storageNamespace: r, labels: o, announcer: c, config: l } = D(), { sourceId: a } = t, s = jt({ storageKey: Ut(r).treeExpansion(a) });
|
|
664
664
|
Ee(n.subscribe, n.version, n.version);
|
|
665
665
|
const d = n.read(a), u = w(() => n.retry(a), [n, a]);
|
|
666
666
|
I(() => n.open(a), [n, a]);
|
|
@@ -668,26 +668,26 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
|
|
|
668
668
|
I(() => {
|
|
669
669
|
T.current = f;
|
|
670
670
|
}, [f]);
|
|
671
|
-
const L = l.expandAll, Z = w(() => c.announce(o.expandAllStarted), [c, o]), M = w(($) => c.announce(
|
|
672
|
-
|
|
671
|
+
const L = l.expandAll, Z = w(() => c.announce(o.expandAllStarted), [c, o]), M = w(($) => c.announce(Gn(o, L, $)), [c, o, L]), k = Ln({ budget: L, expandMultiple: h, onStart: Z, onFinish: M }), { status: b, start: R, end: y, advance: A } = k, H = b.state === "running", de = F(() => ({ running: H, advance: A }), [H, A]), W = g(null), [B, ee] = q(!1), K = w(($) => {
|
|
672
|
+
W.current = $, ee($ !== null);
|
|
673
673
|
}, []);
|
|
674
674
|
_(
|
|
675
675
|
() => n.subscribeChildrenFailures(($) => {
|
|
676
|
-
const
|
|
677
|
-
|
|
676
|
+
const G = $.sourceId === a && W.current !== null ? nt(W.current, $.path) : null;
|
|
677
|
+
G !== null && c.announce({ list: o.foldersLoadFailedNamed, item: G.name });
|
|
678
678
|
}),
|
|
679
679
|
[n, a, c, o]
|
|
680
680
|
);
|
|
681
|
-
const { clearDirect: ae } = i, [V, le] = q(0),
|
|
681
|
+
const { clearDirect: ae } = i, [V, le] = q(0), X = w(() => {
|
|
682
682
|
le(($) => $ + 1), y(), ae(), S(T.current), v();
|
|
683
683
|
}, [y, ae, v]);
|
|
684
684
|
return _(() => {
|
|
685
|
-
e({ collapseAll:
|
|
686
|
-
}, [e,
|
|
685
|
+
e({ collapseAll: X, expandAll: B ? R : null, expanding: H });
|
|
686
|
+
}, [e, X, R, B, H]), _(() => () => e(null), [e]), _(() => {
|
|
687
687
|
B || y();
|
|
688
|
-
}, [B, y]), /* @__PURE__ */
|
|
688
|
+
}, [B, y]), /* @__PURE__ */ O(Xe, { children: [
|
|
689
689
|
b.state === "stopped" ? /* @__PURE__ */ m(Qn, { stop: b.stop, opened: b.opened, budget: L }) : null,
|
|
690
|
-
/* @__PURE__ */
|
|
690
|
+
/* @__PURE__ */ O("div", { className: "aqmx-explorer-tree-area", children: [
|
|
691
691
|
/* @__PURE__ */ m(Qe, { fallback: /* @__PURE__ */ m(st, {}), children: /* @__PURE__ */ m(er, { result: d, onRetry: u, expansion: s, onShown: K, marks: i, claimsHeld: C, expandAll: de, revealCancel: V, ...t }) }),
|
|
692
692
|
/* @__PURE__ */ m(Yn, { pending: n.pendingChildren(a), status: b })
|
|
693
693
|
] })
|
|
@@ -714,10 +714,10 @@ function nr({
|
|
|
714
714
|
clipRule: "evenodd"
|
|
715
715
|
}));
|
|
716
716
|
}
|
|
717
|
-
const ct = /* @__PURE__ */ p.forwardRef(nr),
|
|
717
|
+
const ct = /* @__PURE__ */ p.forwardRef(nr), Ge = "markdown-explorer-selection-remove", rr = ({ selection: e, onRemove: t, onClear: n, onOpenSelection: r, onLeave: o }) => {
|
|
718
718
|
const { labels: c } = D(), l = ye(), a = g(null), s = [...e], d = (i, f) => {
|
|
719
719
|
if (f.ownerDocument.activeElement === f) {
|
|
720
|
-
const h = a.current === null ? [] : [...a.current.querySelectorAll(`[data-testid="${
|
|
720
|
+
const h = a.current === null ? [] : [...a.current.querySelectorAll(`[data-testid="${Ge}"]`)], v = h.indexOf(f), E = [h[v + 1], h[v - 1]].find((S) => S !== void 0);
|
|
721
721
|
E === void 0 ? o() : E.focus();
|
|
722
722
|
}
|
|
723
723
|
t(i);
|
|
@@ -725,12 +725,12 @@ const ct = /* @__PURE__ */ p.forwardRef(nr), Ue = "markdown-explorer-selection-r
|
|
|
725
725
|
const i = a.current;
|
|
726
726
|
i !== null && i.contains(i.ownerDocument.activeElement) && o(), n();
|
|
727
727
|
};
|
|
728
|
-
return /* @__PURE__ */
|
|
729
|
-
/* @__PURE__ */
|
|
728
|
+
return /* @__PURE__ */ O("section", { ref: a, className: "aqmx-explorer-tray", "aria-labelledby": l, "data-testid": "markdown-explorer-selection-tray", children: [
|
|
729
|
+
/* @__PURE__ */ O("div", { className: "aqmx-explorer-tray-header", children: [
|
|
730
730
|
/* @__PURE__ */ m("p", { id: l, className: "aqmx-explorer-tray-title", children: c.selectionTitle(s.length) }),
|
|
731
731
|
/* @__PURE__ */ m("button", { type: "button", className: "aqmx-explorer-tray-button", "data-testid": "markdown-explorer-selection-clear", onClick: u, children: c.clearSelection })
|
|
732
732
|
] }),
|
|
733
|
-
/* @__PURE__ */ m("ul", { className: "aqmx-explorer-tray-list", children: s.map(([i, f]) => /* @__PURE__ */
|
|
733
|
+
/* @__PURE__ */ m("ul", { className: "aqmx-explorer-tray-list", children: s.map(([i, f]) => /* @__PURE__ */ O("li", { className: "aqmx-explorer-tray-item", children: [
|
|
734
734
|
/* @__PURE__ */ m("span", { className: "aqmx-explorer-tray-name", title: i, children: f }),
|
|
735
735
|
/* @__PURE__ */ m(
|
|
736
736
|
"button",
|
|
@@ -739,7 +739,7 @@ const ct = /* @__PURE__ */ p.forwardRef(nr), Ue = "markdown-explorer-selection-r
|
|
|
739
739
|
className: "aqmx-icon-button aqmx-explorer-tray-remove",
|
|
740
740
|
"aria-label": c.removeFromSelection(f),
|
|
741
741
|
title: c.removeFromSelection(f),
|
|
742
|
-
"data-testid":
|
|
742
|
+
"data-testid": Ge,
|
|
743
743
|
"data-aqmx-path": i,
|
|
744
744
|
onClick: (h) => d(i, h.currentTarget),
|
|
745
745
|
children: /* @__PURE__ */ m(ct, { "aria-hidden": "true" })
|
|
@@ -1003,7 +1003,7 @@ function Lr({
|
|
|
1003
1003
|
}));
|
|
1004
1004
|
}
|
|
1005
1005
|
const kr = /* @__PURE__ */ p.forwardRef(Lr);
|
|
1006
|
-
function
|
|
1006
|
+
function Or({
|
|
1007
1007
|
title: e,
|
|
1008
1008
|
titleId: t,
|
|
1009
1009
|
...n
|
|
@@ -1022,7 +1022,7 @@ function Ar({
|
|
|
1022
1022
|
d: "M5.625 3.75a2.625 2.625 0 1 0 0 5.25h12.75a2.625 2.625 0 0 0 0-5.25H5.625ZM3.75 11.25a.75.75 0 0 0 0 1.5h16.5a.75.75 0 0 0 0-1.5H3.75ZM3 15.75a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1-.75-.75ZM3.75 18.75a.75.75 0 0 0 0 1.5h16.5a.75.75 0 0 0 0-1.5H3.75Z"
|
|
1023
1023
|
}));
|
|
1024
1024
|
}
|
|
1025
|
-
const
|
|
1025
|
+
const Ar = /* @__PURE__ */ p.forwardRef(Or), Pr = Object.freeze({
|
|
1026
1026
|
sortMode: dr,
|
|
1027
1027
|
folderPlacement: Sr,
|
|
1028
1028
|
selectionMode: mr,
|
|
@@ -1031,7 +1031,7 @@ const Or = /* @__PURE__ */ p.forwardRef(Ar), Pr = Object.freeze({
|
|
|
1031
1031
|
alwaysExpanded: cr,
|
|
1032
1032
|
revealDocument: kt,
|
|
1033
1033
|
removeRootIndent: pr,
|
|
1034
|
-
lines:
|
|
1034
|
+
lines: Ar,
|
|
1035
1035
|
expandIcons: xr,
|
|
1036
1036
|
directoryIcons: Nr,
|
|
1037
1037
|
fileIcons: yr
|
|
@@ -1066,7 +1066,7 @@ const Or = /* @__PURE__ */ p.forwardRef(Ar), Pr = Object.freeze({
|
|
|
1066
1066
|
u.preventDefault(), s(n.length - 1);
|
|
1067
1067
|
break;
|
|
1068
1068
|
case "Escape":
|
|
1069
|
-
|
|
1069
|
+
Ae(u), o();
|
|
1070
1070
|
break;
|
|
1071
1071
|
case "Tab":
|
|
1072
1072
|
o();
|
|
@@ -1077,7 +1077,7 @@ const Or = /* @__PURE__ */ p.forwardRef(Ar), Pr = Object.freeze({
|
|
|
1077
1077
|
);
|
|
1078
1078
|
return /* @__PURE__ */ m("div", { ref: c, id: e, role: "menu", "aria-label": l.treeSettings, className: "aqmx-explorer-menu", "data-testid": "markdown-explorer-tree-settings-menu", children: n.map((u, i) => {
|
|
1079
1079
|
const f = Pr[u.key], h = dt(l, u), v = Je(l, t, u.key), E = t[u.key], S = typeof E == "boolean" ? { role: "menuitemcheckbox", "aria-checked": E, "aria-label": h } : { role: "menuitem", "aria-label": `${h}: ${v}` };
|
|
1080
|
-
return /* @__PURE__ */
|
|
1080
|
+
return /* @__PURE__ */ O(
|
|
1081
1081
|
"button",
|
|
1082
1082
|
{
|
|
1083
1083
|
ref: (C) => {
|
|
@@ -1121,7 +1121,7 @@ const Or = /* @__PURE__ */ p.forwardRef(Ar), Pr = Object.freeze({
|
|
|
1121
1121
|
);
|
|
1122
1122
|
const f = w(
|
|
1123
1123
|
(v) => {
|
|
1124
|
-
v.key !== "Escape" || !c || (
|
|
1124
|
+
v.key !== "Escape" || !c || (Ae(v), i());
|
|
1125
1125
|
},
|
|
1126
1126
|
[c, i]
|
|
1127
1127
|
), h = w(
|
|
@@ -1154,7 +1154,7 @@ const Or = /* @__PURE__ */ p.forwardRef(Ar), Pr = Object.freeze({
|
|
|
1154
1154
|
}, Fr = () => {
|
|
1155
1155
|
const { treeSettings: e } = D();
|
|
1156
1156
|
return { settings: Ee(e.subscribe, e.getSnapshot, e.getServerSnapshot), advance: e.advance };
|
|
1157
|
-
},
|
|
1157
|
+
}, Ue = /* @__PURE__ */ new Set(), Mr = '[role="tree"] [role="treeitem"][tabindex="0"]', _r = "[data-directory-tree-tab-stop]", oa = (e) => {
|
|
1158
1158
|
const { mode: t, sourceId: n, currentPath: r, openPaths: o, onOpenDocument: c, onSourceChange: l, onRevealSource: a, viewSwitch: s } = e, { labels: d, sources: u, trees: i, documents: f, announcer: h, reveals: v } = D(), { settings: E, advance: S } = Fr(), C = F(() => _t(t === "tree"), [t]), T = t === "tree" && E.selectionMode === "multiple";
|
|
1159
1159
|
or(T);
|
|
1160
1160
|
const L = e.mode === "tree" ? e.tray.onGatheredChange : null, Z = e.mode === "tree" ? e.onOpenSelection : void 0, M = e.mode === "tree" && T ? e.tray.gathered : Le, k = w(
|
|
@@ -1163,57 +1163,57 @@ const Or = /* @__PURE__ */ p.forwardRef(Ar), Pr = Object.freeze({
|
|
|
1163
1163
|
return Y.selectionMode !== "multiple" && L?.(Le), Y;
|
|
1164
1164
|
},
|
|
1165
1165
|
[S, L]
|
|
1166
|
-
), b = Cr({ settings: E, descriptors: C, onAdvance: k }), R = w((N) => L?.((Y) => ar(Y, N)), [L]), y = w((N) => L?.((Y) => lr(Y, N)), [L]),
|
|
1166
|
+
), b = Cr({ settings: E, descriptors: C, onAdvance: k }), R = w((N) => L?.((Y) => ar(Y, N)), [L]), y = w((N) => L?.((Y) => lr(Y, N)), [L]), A = w(() => L?.(Le), [L]), H = g(null), de = w(() => {
|
|
1167
1167
|
const N = H.current;
|
|
1168
1168
|
if (N === null) return;
|
|
1169
1169
|
[Mr, _r, '[data-testid="markdown-explorer-tree-settings"]'].map((z) => N.querySelector(z)).find((z) => z !== null)?.focus();
|
|
1170
|
-
}, []),
|
|
1170
|
+
}, []), W = F(() => new Set(M.keys()), [M]), B = F(() => r === null ? Ue : /* @__PURE__ */ new Set([r]), [r]), ee = F(() => {
|
|
1171
1171
|
if (t === "multi") return { mode: "multiple", items: o, shownPath: null, onChange: null };
|
|
1172
1172
|
switch (E.selectionMode) {
|
|
1173
1173
|
case "single":
|
|
1174
1174
|
return { mode: "single", items: B, shownPath: r, onChange: null };
|
|
1175
1175
|
case "multiple":
|
|
1176
|
-
return { mode: "multiple", items:
|
|
1176
|
+
return { mode: "multiple", items: W, shownPath: r, onChange: R };
|
|
1177
1177
|
case "none":
|
|
1178
|
-
return { mode: "none", items:
|
|
1178
|
+
return { mode: "none", items: Ue, shownPath: null, onChange: null };
|
|
1179
1179
|
}
|
|
1180
|
-
}, [t, o, E.selectionMode, B, r,
|
|
1180
|
+
}, [t, o, E.selectionMode, B, r, W, R]), K = F(() => E.revealDocument ? { path: r, openFolders: !0 } : { path: ee.shownPath, openFolders: !1 }, [E.revealDocument, r, ee.shownPath]), ae = w(
|
|
1181
1181
|
(N) => {
|
|
1182
1182
|
r !== null && v.settle(r), l(N);
|
|
1183
1183
|
},
|
|
1184
1184
|
[r, v, l]
|
|
1185
|
-
), [V, le] = q(null), [
|
|
1186
|
-
if (!
|
|
1187
|
-
|
|
1185
|
+
), [V, le] = q(null), [X, $] = q(!1), [G, ue] = q(null), U = g(!1), ce = w(async () => {
|
|
1186
|
+
if (!U.current) {
|
|
1187
|
+
U.current = !0, $(!0), ue(null);
|
|
1188
1188
|
try {
|
|
1189
1189
|
const N = await i.refresh(n);
|
|
1190
1190
|
if (N.status === "superseded") return;
|
|
1191
1191
|
f.invalidate(), N.status === "failed" ? ue({ sourceId: n, failure: N.failure }) : h.announce(d.treeRefreshed);
|
|
1192
1192
|
} finally {
|
|
1193
|
-
|
|
1193
|
+
U.current = !1, $(!1);
|
|
1194
1194
|
}
|
|
1195
1195
|
}
|
|
1196
1196
|
}, [i, f, n, h, d]), me = V === null ? null : V.expandAll, oe = V?.expanding === !0, he = u.find((N) => N.id === n), fe = s.target === "multi" ? ln : rn, te = s.target === "multi" ? d.switchToMulti : d.switchToTree;
|
|
1197
|
-
return /* @__PURE__ */
|
|
1198
|
-
/* @__PURE__ */
|
|
1197
|
+
return /* @__PURE__ */ O("nav", { ref: H, "aria-label": d.explorerRegion, className: "aqmx-explorer", "data-testid": "markdown-explorer-explorer", "data-aqmx-mode": t, children: [
|
|
1198
|
+
/* @__PURE__ */ O("div", { className: "aqmx-explorer-header", children: [
|
|
1199
1199
|
u.length > 1 ? /* @__PURE__ */ m("select", { className: "aqmx-explorer-source", "aria-label": d.sourceLabel, title: he?.label, value: n, onChange: (N) => ae(N.currentTarget.value), "data-testid": "markdown-explorer-source-select", children: u.map((N) => /* @__PURE__ */ m("option", { value: N.id, children: N.label }, N.id)) }) : null,
|
|
1200
|
-
/* @__PURE__ */
|
|
1201
|
-
/* @__PURE__ */ m(
|
|
1202
|
-
/* @__PURE__ */
|
|
1200
|
+
/* @__PURE__ */ O("div", { className: "aqmx-explorer-actions", children: [
|
|
1201
|
+
/* @__PURE__ */ m(Ot, { to: s.href, navigation: "switch-view", className: "aqmx-icon-button", "aria-label": te, title: te, "data-testid": "markdown-explorer-view-switch", "data-aqmx-target": s.target, children: /* @__PURE__ */ m(fe, { "aria-hidden": "true" }) }),
|
|
1202
|
+
/* @__PURE__ */ O(
|
|
1203
1203
|
"button",
|
|
1204
1204
|
{
|
|
1205
1205
|
type: "button",
|
|
1206
1206
|
className: "aqmx-icon-button aqmx-labelled-button",
|
|
1207
1207
|
title: d.refreshTree,
|
|
1208
|
-
"aria-disabled":
|
|
1209
|
-
"aria-busy":
|
|
1210
|
-
"data-aqmx-busy":
|
|
1208
|
+
"aria-disabled": X,
|
|
1209
|
+
"aria-busy": X,
|
|
1210
|
+
"data-aqmx-busy": X ? "true" : void 0,
|
|
1211
1211
|
"data-testid": "markdown-explorer-refresh",
|
|
1212
1212
|
onClick: () => {
|
|
1213
1213
|
ce();
|
|
1214
1214
|
},
|
|
1215
1215
|
children: [
|
|
1216
|
-
/* @__PURE__ */ m(
|
|
1216
|
+
/* @__PURE__ */ m(Oe, { "aria-hidden": "true" }),
|
|
1217
1217
|
/* @__PURE__ */ m("span", { children: d.refreshTreeLabel })
|
|
1218
1218
|
]
|
|
1219
1219
|
}
|
|
@@ -1237,11 +1237,11 @@ const Or = /* @__PURE__ */ p.forwardRef(Ar), Pr = Object.freeze({
|
|
|
1237
1237
|
b.trigger
|
|
1238
1238
|
] })
|
|
1239
1239
|
] }),
|
|
1240
|
-
/* @__PURE__ */
|
|
1241
|
-
|
|
1240
|
+
/* @__PURE__ */ O("div", { className: "aqmx-explorer-body", "data-aqmx-explorer-body": "", children: [
|
|
1241
|
+
G !== null && G.sourceId === n ? /* @__PURE__ */ m("p", { role: "alert", className: "aqmx-explorer-refresh-failure", "data-testid": "markdown-explorer-refresh-failure", "data-aqmx-failure": G.failure.reason, children: d.treeRefreshFailed(At(d, G.failure.reason)) }) : null,
|
|
1242
1242
|
/* @__PURE__ */ m(Qe, { fallback: null, children: /* @__PURE__ */ m(on, {}) }),
|
|
1243
1243
|
/* @__PURE__ */ m(tr, { mode: t, sourceId: n, settings: E, reveal: K, openPaths: o, selection: ee, onOpenDocument: c, onRevealSource: a, onControls: le }, n),
|
|
1244
|
-
T && M.size > 0 ? /* @__PURE__ */ m(rr, { selection: M, onRemove: y, onClear:
|
|
1244
|
+
T && M.size > 0 ? /* @__PURE__ */ m(rr, { selection: M, onRemove: y, onClear: A, onOpenSelection: Z, onLeave: de }) : null,
|
|
1245
1245
|
b.menu
|
|
1246
1246
|
] })
|
|
1247
1247
|
] });
|
|
@@ -1281,22 +1281,22 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1281
1281
|
y !== null && (s && !y.open ? (y.showModal(), C.current?.focus()) : !s && y.open && (y.close(), t.current?.focus()), r(s ? T.current : null));
|
|
1282
1282
|
}, [s, t, r]), I(() => () => r(null), [r]);
|
|
1283
1283
|
const M = w((y) => {
|
|
1284
|
-
y.key !== "Escape" || y.defaultPrevented || (
|
|
1284
|
+
y.key !== "Escape" || y.defaultPrevented || (Ae(y), d(!1));
|
|
1285
1285
|
}, []), k = w((y) => {
|
|
1286
1286
|
L.current = y.target === y.currentTarget;
|
|
1287
1287
|
}, []), b = w((y) => {
|
|
1288
|
-
const
|
|
1289
|
-
L.current = !1,
|
|
1288
|
+
const A = L.current;
|
|
1289
|
+
L.current = !1, A && y.target === y.currentTarget && d(!1);
|
|
1290
1290
|
}, []), R = w(() => {
|
|
1291
1291
|
d(!1);
|
|
1292
1292
|
}, []);
|
|
1293
|
-
return /* @__PURE__ */
|
|
1294
|
-
/* @__PURE__ */ m("div", { className: "aqmx-sheet-bar", inert: n, children: /* @__PURE__ */
|
|
1293
|
+
return /* @__PURE__ */ O(Xe, { children: [
|
|
1294
|
+
/* @__PURE__ */ m("div", { className: "aqmx-sheet-bar", inert: n, children: /* @__PURE__ */ O("button", { ref: t, type: "button", className: "aqmx-sheet-toggle", "aria-haspopup": "dialog", "aria-expanded": s, "aria-controls": Z, "data-testid": "markdown-explorer-sheet-toggle", onClick: () => d(!0), children: [
|
|
1295
1295
|
/* @__PURE__ */ m(Br, { "aria-hidden": "true" }),
|
|
1296
1296
|
/* @__PURE__ */ m("span", { children: c.showExplorer })
|
|
1297
1297
|
] }) }),
|
|
1298
|
-
/* @__PURE__ */ m("dialog", { ref: S, id: Z, className: "aqmx-sheet", "aria-label": c.explorerRegion, "data-testid": "markdown-explorer-sheet", onKeyDown: M, onPointerDown: k, onClick: b, onClose: R, children: /* @__PURE__ */
|
|
1299
|
-
/* @__PURE__ */
|
|
1298
|
+
/* @__PURE__ */ m("dialog", { ref: S, id: Z, className: "aqmx-sheet", "aria-label": c.explorerRegion, "data-testid": "markdown-explorer-sheet", onKeyDown: M, onPointerDown: k, onClick: b, onClose: R, children: /* @__PURE__ */ O("div", { className: "aqmx-sheet-panel", children: [
|
|
1299
|
+
/* @__PURE__ */ O("div", { className: "aqmx-sheet-header", children: [
|
|
1300
1300
|
/* @__PURE__ */ m("div", { ref: T, className: "aqmx-sheet-notice-slot" }),
|
|
1301
1301
|
/* @__PURE__ */ m("button", { ref: C, type: "button", className: "aqmx-sheet-close", "aria-label": c.hideExplorer, title: c.hideExplorer, "data-testid": "markdown-explorer-sheet-close", onClick: () => d(!1), children: /* @__PURE__ */ m(ct, { "aria-hidden": "true" }) })
|
|
1302
1302
|
] }),
|
|
@@ -1304,19 +1304,19 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1304
1304
|
/* @__PURE__ */ m(qt, { holds: s, testId: "markdown-explorer-sheet-announcer" })
|
|
1305
1305
|
] }) })
|
|
1306
1306
|
] });
|
|
1307
|
-
}, Vr = Pe(null), Ce = "aqmx-explorer", mt = "aqmx-content", Fe = '[role="tree"] [role="treeitem"]', jr = `${Fe}[tabindex="0"]`, Kr = "[data-directory-tree-tab-stop]",
|
|
1307
|
+
}, Vr = Pe(null), Ce = "aqmx-explorer", mt = "aqmx-content", Fe = '[role="tree"] [role="treeitem"]', jr = `${Fe}[tabindex="0"]`, Kr = "[data-directory-tree-tab-stop]", Gr = (e, t) => {
|
|
1308
1308
|
for (const n of e.querySelectorAll(`[data-panel-id="${Ce}"] ${Fe}`)) if (n.getAttribute(se) === t) return n;
|
|
1309
1309
|
return null;
|
|
1310
|
-
},
|
|
1310
|
+
}, We = (e, t) => ({
|
|
1311
1311
|
inlineSize: e > 0 ? e : null,
|
|
1312
1312
|
rootFontPixels: t > 0 ? t : Vt
|
|
1313
|
-
}),
|
|
1314
|
-
const [n, r] = q(() =>
|
|
1313
|
+
}), Ur = (e, t) => {
|
|
1314
|
+
const [n, r] = q(() => We(0, 0));
|
|
1315
1315
|
return I(() => {
|
|
1316
1316
|
const o = e.current, c = t.current;
|
|
1317
1317
|
if (o === null || c === null) throw new Error("[markdown-explorer] the split frame is not mounted");
|
|
1318
1318
|
const l = { frame: o.getBoundingClientRect().width, rem: c.getBoundingClientRect().width }, a = () => {
|
|
1319
|
-
const d =
|
|
1319
|
+
const d = We(l.frame, l.rem);
|
|
1320
1320
|
r((u) => u.inlineSize === d.inlineSize && u.rootFontPixels === d.rootFontPixels ? u : d);
|
|
1321
1321
|
};
|
|
1322
1322
|
a();
|
|
@@ -1329,7 +1329,7 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1329
1329
|
});
|
|
1330
1330
|
return s.observe(o), s.observe(c), () => s.disconnect();
|
|
1331
1331
|
}, [e, t]), n;
|
|
1332
|
-
}, ft = (e) => `aqmx-split-handle-${e}`,
|
|
1332
|
+
}, ft = (e) => `aqmx-split-handle-${e}`, Wr = (e, { frameRef: t, sheetToggleRef: n, handleId: r }) => {
|
|
1333
1333
|
const o = g(!1), c = g(null), l = g(!1);
|
|
1334
1334
|
I(() => {
|
|
1335
1335
|
const s = t.current;
|
|
@@ -1371,7 +1371,7 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1371
1371
|
if (a.current !== e || !o.current) return;
|
|
1372
1372
|
const u = c.current, i = `[data-panel-id="${Ce}"]`;
|
|
1373
1373
|
d([
|
|
1374
|
-
u === null ? null :
|
|
1374
|
+
u === null ? null : Gr(s, u),
|
|
1375
1375
|
s.querySelector(`${i} ${jr}`),
|
|
1376
1376
|
s.querySelector(`${i} ${Kr}`),
|
|
1377
1377
|
s.querySelector(`[data-resize-handle-id="${r}"]`)
|
|
@@ -1379,13 +1379,13 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1379
1379
|
});
|
|
1380
1380
|
}, [e, t, n, r]);
|
|
1381
1381
|
}, sa = ({ view: e, explorer: t, content: n, contentCoversPage: r = !1, sheetDismissals: o = 0, onDraggingChange: c }) => {
|
|
1382
|
-
const l = g(null), [a, s] = q(null), d = g(null), u = g(null), { inlineSize: i, rootFontPixels: f } =
|
|
1383
|
-
return
|
|
1382
|
+
const l = g(null), [a, s] = q(null), d = g(null), u = g(null), { inlineSize: i, rootFontPixels: f } = Ur(l, d), h = i !== null && i < It(f);
|
|
1383
|
+
return Wr(h, { frameRef: l, sheetToggleRef: u, handleId: ft(e) }), /* @__PURE__ */ O("div", { ref: l, className: "aqmx-split-frame", "data-aqmx-explorer-mode": h ? "sheet" : "split", children: [
|
|
1384
1384
|
/* @__PURE__ */ m("span", { ref: d, className: "aqmx-rem-probe", "aria-hidden": "true", "data-aqmx-rem-probe": "" }),
|
|
1385
1385
|
h ? /* @__PURE__ */ m(zr, { explorer: t, toggleRef: u, covered: r, onNoticeSlotChange: s, dismissals: o }) : null,
|
|
1386
|
-
/* @__PURE__ */ m(Vr, { value: h ? a : null, children: /* @__PURE__ */ m(
|
|
1386
|
+
/* @__PURE__ */ m(Vr, { value: h ? a : null, children: /* @__PURE__ */ m(Xr, { view: e, sheet: h, explorer: t, content: n, contentCoversPage: r, onDraggingChange: c, explorerMinPixels: Dt(f) }) })
|
|
1387
1387
|
] });
|
|
1388
|
-
},
|
|
1388
|
+
}, Xr = ({
|
|
1389
1389
|
view: e,
|
|
1390
1390
|
sheet: t,
|
|
1391
1391
|
explorer: n,
|
|
@@ -1401,9 +1401,9 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1401
1401
|
const T = w(() => {
|
|
1402
1402
|
const b = i.current;
|
|
1403
1403
|
if (b === null || b.length !== 2) return;
|
|
1404
|
-
const [R = 0, y = 0] = b,
|
|
1405
|
-
if (
|
|
1406
|
-
const H = Math.min(Be, R /
|
|
1404
|
+
const [R = 0, y = 0] = b, A = R + y;
|
|
1405
|
+
if (A <= 0 || R <= 0) return;
|
|
1406
|
+
const H = Math.min(Be, R / A * 100);
|
|
1407
1407
|
a.update(e === "tree" ? { treeExplorer: H } : { multiExplorer: H });
|
|
1408
1408
|
}, [a, e]), L = w(() => {
|
|
1409
1409
|
f.current !== null && clearTimeout(f.current), f.current = setTimeout(() => {
|
|
@@ -1419,8 +1419,8 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1419
1419
|
const Z = $r(), M = w(
|
|
1420
1420
|
(b, R) => {
|
|
1421
1421
|
i.current = b;
|
|
1422
|
-
const [y = 0,
|
|
1423
|
-
b.length === 2 &&
|
|
1422
|
+
const [y = 0, A = 0] = b;
|
|
1423
|
+
b.length === 2 && A > 0 && S(y <= 0), R.source === "keyboard" ? L() : R.source === "pointer" && (h.current = !0);
|
|
1424
1424
|
},
|
|
1425
1425
|
[L]
|
|
1426
1426
|
), k = w(
|
|
@@ -1433,7 +1433,7 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1433
1433
|
},
|
|
1434
1434
|
[c, L]
|
|
1435
1435
|
);
|
|
1436
|
-
return /* @__PURE__ */
|
|
1436
|
+
return /* @__PURE__ */ O(Wt, { id: `aqmx-split-${e}`, direction: "horizontal", onLayout: M, className: "aqmx-split", "data-aqmx-split": e, children: [
|
|
1437
1437
|
t ? null : /* @__PURE__ */ m(
|
|
1438
1438
|
ze,
|
|
1439
1439
|
{
|
|
@@ -1449,7 +1449,7 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1449
1449
|
}
|
|
1450
1450
|
),
|
|
1451
1451
|
t ? null : /* @__PURE__ */ m(
|
|
1452
|
-
|
|
1452
|
+
Xt,
|
|
1453
1453
|
{
|
|
1454
1454
|
id: ft(e),
|
|
1455
1455
|
thickness: Z ? Bt : zt,
|