@aiquants/markdown-explorer 0.10.0 → 0.12.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 +26 -1
- package/README.md +66 -6
- package/dist/EditSurface-BTAhzvHi.js +509 -0
- package/dist/EditSurface-Dfj6Sxxb.cjs +2 -0
- package/dist/ExplorerSplit-DekOjAUZ.cjs +1 -0
- package/dist/{ExplorerSplit-D0zf7Cr_.js → ExplorerSplit-MPHjw3nW.js} +251 -248
- package/dist/{MultiLayout-Jy9BKofx.js → MultiLayout-DtSW4rEQ.js} +4 -4
- package/dist/{MultiLayout-Bq10p3a3.cjs → MultiLayout-HMzVDYWq.cjs} +1 -1
- package/dist/{NativeScrollBar-Dt6xH5Mb.cjs → NativeScrollBar-B0AkVF3E.cjs} +1 -1
- package/dist/{NativeScrollBar-CyiyL47o.js → NativeScrollBar-CNQr7JY1.js} +1 -1
- package/dist/{TreeLayout-8pRo1ANN.js → TreeLayout-CJO9tOPq.js} +3 -3
- package/dist/{TreeLayout-kVWFEKJD.cjs → TreeLayout-_XQR-9tV.cjs} +1 -1
- package/dist/client/MarkdownExplorer.d.cts +3 -2
- package/dist/client/MarkdownExplorer.d.ts +3 -2
- package/dist/core/contracts.d.cts +17 -0
- package/dist/core/contracts.d.ts +17 -0
- package/dist/core/labels.d.cts +2 -0
- package/dist/core/labels.d.ts +2 -0
- package/dist/core/treeSettings.d.cts +2 -1
- package/dist/core/treeSettings.d.ts +2 -1
- package/dist/dataRoute-CH3yOKR0.cjs +1 -0
- package/dist/dataRoute-Pm_0ue_4.js +279 -0
- package/dist/index-DpIVKG8Y.cjs +13 -0
- package/dist/{index-CfcJEnrC.js → index-o6OpR4ND.js} +967 -907
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/location-BUNWJ4eB.cjs +1 -0
- package/dist/{location-Dc1qNEGm.js → location-DWd6SQhN.js} +123 -112
- package/dist/{merge-D0aGvFKC.cjs → merge-Bs7o3GyP.cjs} +1 -1
- package/dist/{merge-SRCxtHk2.js → merge-DDJaJmMU.js} +1 -1
- package/dist/sanitizePolicy-BfUlXI5E.cjs +1 -0
- package/dist/sanitizePolicy-djLC3fRN.js +96 -0
- package/dist/sanitizeWorker.cjs +1 -1
- package/dist/sanitizeWorker.js +143 -226
- package/dist/server.cjs +1 -1
- package/dist/server.js +548 -540
- package/docs/behavior/dom-hooks.md +2 -2
- package/docs/behavior/localization.md +1 -0
- package/docs/behavior/security.md +2 -0
- package/package.json +3 -3
- package/dist/EditSurface-1Jf0CG-f.js +0 -371
- package/dist/EditSurface-B-l3Do_C.cjs +0 -2
- package/dist/ExplorerSplit-WX8afxrQ.cjs +0 -1
- package/dist/dataRoute-8pyILcjL.cjs +0 -1
- package/dist/dataRoute-Csl1WBDz.js +0 -278
- package/dist/index-sNJrKoGN.cjs +0 -13
- package/dist/location-CRYkEWiC.cjs +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as m, jsxs as
|
|
2
|
-
import { u as D, F as Nt,
|
|
1
|
+
import { jsx as m, jsxs as A, Fragment as Ge } from "react/jsx-runtime";
|
|
2
|
+
import { u as D, F as Nt, r as Ae, q as Ye, s as Lt, m as Oe, t as kt, w as At, h as Ot, x as Pt, y as qt, z as Ct } from "./index-o6OpR4ND.js";
|
|
3
3
|
import * as p from "react";
|
|
4
|
-
import { use as be, createContext as
|
|
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-
|
|
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-DWd6SQhN.js";
|
|
6
6
|
import { useDirectoryTreeState as jt, DirectoryTree as Kt } from "@aiquants/directory-tree";
|
|
7
7
|
import { T as Ut } from "./tapScrollCircle-u4EXeLhx.js";
|
|
8
8
|
import { s as Wt } from "./storage-BSthKLSG.js";
|
|
@@ -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__ */ A("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 : (
|
|
@@ -126,7 +126,7 @@ function sn({
|
|
|
126
126
|
clipRule: "evenodd"
|
|
127
127
|
}));
|
|
128
128
|
}
|
|
129
|
-
const cn = /* @__PURE__ */ p.forwardRef(sn), qe =
|
|
129
|
+
const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt = "\0", dn = () => {
|
|
130
130
|
const e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = (l) => {
|
|
131
131
|
const a = e.get(l);
|
|
132
132
|
if (a !== void 0) return a;
|
|
@@ -135,19 +135,19 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
135
135
|
}, o = (l, a, s) => {
|
|
136
136
|
let d = !1;
|
|
137
137
|
const u = l.map((f) => {
|
|
138
|
-
const h =
|
|
138
|
+
const h = c(f, a, s);
|
|
139
139
|
return h !== f && (d = !0), h;
|
|
140
140
|
});
|
|
141
141
|
if (!d) return l;
|
|
142
|
-
const
|
|
143
|
-
return
|
|
144
|
-
},
|
|
142
|
+
const i = n.get(l);
|
|
143
|
+
return i !== void 0 && i.length === u.length && i.every((f, h) => f === u[h]) ? i : (n.set(l, u), u);
|
|
144
|
+
}, c = (l, a, s) => {
|
|
145
145
|
if (l.type !== "directory") return l;
|
|
146
146
|
if (s.has(l.path)) return r(l);
|
|
147
|
-
const d = l.lazy === !0 ? a(l.path) : void 0, u = d?.status === "loaded",
|
|
148
|
-
if (
|
|
147
|
+
const d = l.lazy === !0 ? a(l.path) : void 0, u = d?.status === "loaded", i = u ? d.entries : l.children;
|
|
148
|
+
if (i === void 0) return l;
|
|
149
149
|
s.add(l.path);
|
|
150
|
-
const f = o(
|
|
150
|
+
const f = o(i, a, s);
|
|
151
151
|
if (s.delete(l.path), !u && f === l.children) return l;
|
|
152
152
|
const h = t.get(l);
|
|
153
153
|
if (h !== void 0 && h.state === d && h.children === f) return h.grafted;
|
|
@@ -156,8 +156,8 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
156
156
|
};
|
|
157
157
|
return (l, a) => o(l, a, /* @__PURE__ */ new Set());
|
|
158
158
|
}, un = (e, t) => `${et}${e}${tt}${t}`, pe = (e) => e.startsWith(et), mn = (e) => e.slice(e.lastIndexOf(tt) + 1), se = "data-aqmx-path", fn = (e, t, n, r, o) => {
|
|
159
|
-
const
|
|
160
|
-
return n && (
|
|
159
|
+
const c = { aqmxPath: e.path };
|
|
160
|
+
return e.modifiedAt !== void 0 && (c.aqmxModifiedAt = e.modifiedAt), n && (c.aqmxOpen = !0), (r === "loading" || r === "failed") && (c.aqmxChildren = r), {
|
|
161
161
|
name: e.name,
|
|
162
162
|
type: e.type,
|
|
163
163
|
absolutePath: e.path,
|
|
@@ -165,40 +165,43 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
165
165
|
mimeType: e.mimeType,
|
|
166
166
|
children: t,
|
|
167
167
|
label: o,
|
|
168
|
-
data:
|
|
168
|
+
data: c
|
|
169
169
|
};
|
|
170
170
|
}, pn = (e, t, n, r) => {
|
|
171
171
|
const o = un(t, e.path);
|
|
172
172
|
return { name: n, type: "directory", absolutePath: o, relativePath: o, children: r, data: { aqmxLoop: e.path } };
|
|
173
173
|
}, hn = () => {
|
|
174
174
|
const e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = [], o = (a, s, d) => {
|
|
175
|
-
const u = a.map((f) => f.type === "loop" ?
|
|
176
|
-
return
|
|
177
|
-
},
|
|
175
|
+
const u = a.map((f) => f.type === "loop" ? c(f, s, d) : l(f, s)), i = n.get(a);
|
|
176
|
+
return i !== void 0 && i.length === u.length && i.every((f, h) => f === u[h]) ? i : (n.set(a, u), u);
|
|
177
|
+
}, c = (a, s, d) => {
|
|
178
178
|
const u = t.get(a);
|
|
179
179
|
if (u !== void 0 && u.parentKey === d && u.loopFolderName === s.loopFolderName) return u.row;
|
|
180
|
-
const
|
|
181
|
-
return t.set(a, { row:
|
|
180
|
+
const i = pn(a, d, s.loopFolderName(a.name), r);
|
|
181
|
+
return t.set(a, { row: i, parentKey: d, loopFolderName: s.loopFolderName }), i;
|
|
182
182
|
}, l = (a, s) => {
|
|
183
|
-
const d = a.type === "directory" ? a.children === void 0 ? r : o(a.children, s, a.path) : void 0, u = s.openPaths.has(a.path),
|
|
184
|
-
if (h !== void 0 && h.open === u && h.childrenStatus ===
|
|
183
|
+
const d = a.type === "directory" ? a.children === void 0 ? r : o(a.children, s, a.path) : void 0, u = s.openPaths.has(a.path), i = a.type === "directory" && a.lazy === !0 ? s.childrenOf(a.path)?.status : void 0, f = i === "failed" ? s.renderFailedFolder : void 0, h = e.get(a);
|
|
184
|
+
if (h !== void 0 && h.open === u && h.childrenStatus === i && h.children === d && h.renderFailedFolder === f)
|
|
185
185
|
return h.row;
|
|
186
|
-
const v = fn(a, d, u,
|
|
187
|
-
return e.set(a, { row: v, open: u, childrenStatus:
|
|
186
|
+
const v = fn(a, d, u, i, f === void 0 ? void 0 : f(a));
|
|
187
|
+
return e.set(a, { row: v, open: u, childrenStatus: i, children: d, renderFailedFolder: f }), v;
|
|
188
188
|
};
|
|
189
189
|
return (a, s) => o(a, s, "");
|
|
190
190
|
}, xn = (e) => {
|
|
191
191
|
if (e === void 0) return;
|
|
192
|
-
const t = (n) =>
|
|
192
|
+
const t = (n) => {
|
|
193
|
+
const r = n.data?.aqmxModifiedAt;
|
|
194
|
+
return typeof r == "number" ? { name: n.name, path: n.absolutePath, type: n.type, modifiedAt: r } : { name: n.name, path: n.absolutePath, type: n.type };
|
|
195
|
+
};
|
|
193
196
|
return (n, r) => e(t(n), t(r));
|
|
194
|
-
},
|
|
197
|
+
}, ke = (e, t) => {
|
|
195
198
|
const n = e.filter((r) => r.type === "directory");
|
|
196
199
|
return t === void 0 ? n : n.sort(t);
|
|
197
200
|
}, wn = (e, t) => {
|
|
198
201
|
const n = /* @__PURE__ */ new Map();
|
|
199
202
|
let r = 0;
|
|
200
|
-
const o = (
|
|
201
|
-
for (const l of
|
|
203
|
+
const o = (c) => {
|
|
204
|
+
for (const l of ke(c, t.compare))
|
|
202
205
|
if (t.isShownExpanded(l.path)) {
|
|
203
206
|
if (l.lazy !== !0) {
|
|
204
207
|
l.children !== void 0 && o(l.children);
|
|
@@ -224,21 +227,21 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
224
227
|
return null;
|
|
225
228
|
}, vn = (e, t, n, r) => {
|
|
226
229
|
let o = e;
|
|
227
|
-
for (const
|
|
228
|
-
const l = o.find((a) => a.type === "directory" && a.path ===
|
|
230
|
+
for (const c of t) {
|
|
231
|
+
const l = o.find((a) => a.type === "directory" && a.path === c);
|
|
229
232
|
if (l === void 0) return "missing";
|
|
230
233
|
if (l.lazy === !0) return r.childrenOf(l.path)?.status === "failed" ? "failed" : "loading";
|
|
231
234
|
if (!r.isShownExpanded(l.path)) return "loading";
|
|
232
235
|
o = l.children ?? [];
|
|
233
236
|
}
|
|
234
|
-
return o.some((
|
|
237
|
+
return o.some((c) => c.type === "file" && c.path === n) ? "ready" : "missing";
|
|
235
238
|
}, Ve = /* @__PURE__ */ new Set(), bn = (e, t) => e.has(t) ? e : new Set(e).add(t), En = (e, t) => {
|
|
236
239
|
if (!t.some((r) => e.has(r))) return e;
|
|
237
240
|
const n = new Set(t);
|
|
238
241
|
return new Set([...e].filter((r) => !n.has(r)));
|
|
239
242
|
}, yn = (e, t) => [...e].every((n) => t.has(n)) ? e : new Set([...e].filter((n) => t.has(n))), Rn = () => {
|
|
240
|
-
const [e, t] = q(Ve), n = w((l) => t((a) => bn(a, l)), []), r = w((l) => t((a) => En(a, l)), []), o = w((l) => t((a) => yn(a, l)), []),
|
|
241
|
-
return F(() => ({ direct: e, markDirect: n, unmarkDirect: r, pruneDirect: o, clearDirect:
|
|
243
|
+
const [e, t] = q(Ve), n = w((l) => t((a) => bn(a, l)), []), r = w((l) => t((a) => En(a, l)), []), o = w((l) => t((a) => yn(a, l)), []), c = w(() => t(Ve), []);
|
|
244
|
+
return F(() => ({ direct: e, markDirect: n, unmarkDirect: r, pruneDirect: o, clearDirect: c }), [e, n, r, o, c]);
|
|
242
245
|
}, Sn = (e) => ({
|
|
243
246
|
budget: e,
|
|
244
247
|
handled: /* @__PURE__ */ new Set(),
|
|
@@ -250,9 +253,9 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
250
253
|
issuedAgainst: null
|
|
251
254
|
}), Tn = (e, t) => {
|
|
252
255
|
const n = [];
|
|
253
|
-
let r =
|
|
256
|
+
let r = ke(t.entries, t.compare);
|
|
254
257
|
for (let o = 1; r.length > 0; o += 1) {
|
|
255
|
-
const
|
|
258
|
+
const c = [];
|
|
256
259
|
for (const l of r) {
|
|
257
260
|
const { path: a } = l;
|
|
258
261
|
if (t.isShownExpanded(a))
|
|
@@ -272,9 +275,9 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
272
275
|
}
|
|
273
276
|
n.push(a), e.opened += 1;
|
|
274
277
|
}
|
|
275
|
-
l.lazy !== !0 && l.children !== void 0 &&
|
|
278
|
+
l.lazy !== !0 && l.children !== void 0 && c.push(...ke(l.children, t.compare));
|
|
276
279
|
}
|
|
277
|
-
r =
|
|
280
|
+
r = c;
|
|
278
281
|
}
|
|
279
282
|
return n;
|
|
280
283
|
}, rt = (e, t) => e.every((n) => n.type !== "directory" || t(n.path) && (n.lazy === !0 || n.children === void 0 || rt(n.children, t))), Nn = (e, t) => {
|
|
@@ -283,12 +286,12 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
283
286
|
let n = 0;
|
|
284
287
|
for (const r of e.loads) t.childrenOf(r)?.status === "failed" && (n += 1);
|
|
285
288
|
return { kind: "done", opened: e.opened, failed: n, complete: rt(t.entries, t.isShownExpanded) };
|
|
286
|
-
}, Ne = Object.freeze({ state: "idle" }),
|
|
289
|
+
}, Ne = Object.freeze({ state: "idle" }), Ln = (e) => {
|
|
287
290
|
const t = g(null), n = g(e), [r, o] = q(Ne);
|
|
288
291
|
I(() => {
|
|
289
292
|
n.current = e;
|
|
290
293
|
});
|
|
291
|
-
const
|
|
294
|
+
const c = w(() => {
|
|
292
295
|
t.current === null && (t.current = Sn(n.current.budget), o({ state: "running", opened: 0 }));
|
|
293
296
|
}, []), l = w(() => {
|
|
294
297
|
t.current = null, o(Ne);
|
|
@@ -302,38 +305,38 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
302
305
|
o(f.kind === "done" ? Ne : { state: "stopped", stop: f.kind, opened: f.opened }), n.current.onFinish(f);
|
|
303
306
|
return;
|
|
304
307
|
}
|
|
305
|
-
const { opened:
|
|
306
|
-
o((f) => f.state === "running" && f.opened ===
|
|
308
|
+
const { opened: i } = d;
|
|
309
|
+
o((f) => f.state === "running" && f.opened === i ? f : { state: "running", opened: i });
|
|
307
310
|
}, []);
|
|
308
|
-
return F(() => ({ status: r, start:
|
|
309
|
-
}, je = ["pointerdown", "wheel", "touchstart", "keydown", "focusin"],
|
|
310
|
-
const s = g(null), d = g(!0), u = g(Ke),
|
|
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 }, An = ({ tree: e, container: t, path: n, chain: r, rows: o, cancel: c, displayed: l, placement: a }) => {
|
|
313
|
+
const s = g(null), d = g(!0), u = g(Ke), i = g(null), f = g(null), h = g(r), v = g(a);
|
|
311
314
|
I(() => {
|
|
312
315
|
h.current = r, v.current = a;
|
|
313
316
|
}, [r, a]);
|
|
314
317
|
const E = w(() => {
|
|
315
|
-
const
|
|
316
|
-
|
|
318
|
+
const k = i.current;
|
|
319
|
+
k !== null && (i.current = null, k.phase === "asking" ? k.controller.abort() : h.current?.open(null));
|
|
317
320
|
}, []), S = w(() => {
|
|
318
321
|
s.current = null, E();
|
|
319
322
|
}, [E]), C = w(() => {
|
|
320
|
-
const
|
|
321
|
-
s.current === null || f.current !== null ||
|
|
323
|
+
const k = t.current;
|
|
324
|
+
s.current === null || f.current !== null || k === null || k.getClientRects().length === 0 || (f.current = requestAnimationFrame(() => {
|
|
322
325
|
f.current = null;
|
|
323
326
|
const b = s.current;
|
|
324
327
|
if (b === null) return;
|
|
325
328
|
const R = v.current(b);
|
|
326
329
|
if (R === 0) {
|
|
327
|
-
d.current = !0,
|
|
330
|
+
d.current = !0, i.current?.phase === "opening" && E();
|
|
328
331
|
return;
|
|
329
332
|
}
|
|
330
333
|
if (e.current?.scrollToPath(b, { align: "nearest" }) === !0) {
|
|
331
|
-
|
|
332
|
-
const { least:
|
|
333
|
-
u.current = R <
|
|
334
|
+
i.current?.phase === "opening" && E();
|
|
335
|
+
const { least: O, stalled: H } = u.current;
|
|
336
|
+
u.current = R < O ? { least: R, stalled: 0 } : { least: O, stalled: H + 1 }, u.current.stalled < kn && C();
|
|
334
337
|
return;
|
|
335
338
|
}
|
|
336
|
-
const y =
|
|
339
|
+
const y = i.current;
|
|
337
340
|
if (y === null) {
|
|
338
341
|
s.current = null;
|
|
339
342
|
return;
|
|
@@ -344,42 +347,42 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
344
347
|
d.current = !1, u.current = Ke, C();
|
|
345
348
|
}, [C]);
|
|
346
349
|
_(() => {
|
|
347
|
-
const
|
|
348
|
-
if (
|
|
350
|
+
const k = t.current;
|
|
351
|
+
if (k === null) return;
|
|
349
352
|
const b = typeof ResizeObserver > "u" ? null : new ResizeObserver(T);
|
|
350
|
-
b?.observe(
|
|
351
|
-
for (const R of je)
|
|
353
|
+
b?.observe(k);
|
|
354
|
+
for (const R of je) k.addEventListener(R, S, { passive: !0 });
|
|
352
355
|
return () => {
|
|
353
356
|
b?.disconnect();
|
|
354
|
-
for (const R of je)
|
|
357
|
+
for (const R of je) k.removeEventListener(R, S);
|
|
355
358
|
f.current !== null && cancelAnimationFrame(f.current), f.current = null, E();
|
|
356
359
|
};
|
|
357
360
|
}, [t, T, S, E]);
|
|
358
|
-
const
|
|
361
|
+
const L = r !== null;
|
|
359
362
|
_(() => {
|
|
360
|
-
const
|
|
361
|
-
if (S(), n === null ||
|
|
363
|
+
const k = t.current;
|
|
364
|
+
if (S(), n === null || k === null || k.contains(k.ownerDocument.activeElement)) return;
|
|
362
365
|
s.current = n;
|
|
363
366
|
const b = h.current;
|
|
364
|
-
if (
|
|
367
|
+
if (L && b !== null) {
|
|
365
368
|
const R = new AbortController(), y = { phase: "asking", controller: R };
|
|
366
|
-
|
|
367
|
-
|
|
369
|
+
i.current = y, b.ancestors(n, R.signal).then((O) => {
|
|
370
|
+
i.current === y && (O === null ? i.current = null : (i.current = { phase: "opening", folders: O }, h.current?.open(O)), T());
|
|
368
371
|
});
|
|
369
372
|
}
|
|
370
373
|
T();
|
|
371
|
-
}, [n,
|
|
372
|
-
(
|
|
374
|
+
}, [n, L, t, S, T]), _(() => {
|
|
375
|
+
(i.current?.phase === "opening" || s.current !== null && !d.current) && T();
|
|
373
376
|
}, [o, T]);
|
|
374
|
-
const Z = g(
|
|
377
|
+
const Z = g(c);
|
|
375
378
|
_(() => {
|
|
376
|
-
Z.current !==
|
|
377
|
-
}, [
|
|
379
|
+
Z.current !== c && (Z.current = c, S());
|
|
380
|
+
}, [c, S]);
|
|
378
381
|
const M = g(l);
|
|
379
382
|
_(() => {
|
|
380
383
|
M.current && !l && E(), M.current = l;
|
|
381
384
|
}, [l, E]);
|
|
382
|
-
},
|
|
385
|
+
}, On = "--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) => {
|
|
383
386
|
const t = Fn.exec(e);
|
|
384
387
|
return t === null ? e : `#${t.slice(1).map((n) => Number(n).toString(16).padStart(2, "0")).join("")}`;
|
|
385
388
|
}, _n = (e, t) => {
|
|
@@ -387,26 +390,26 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
387
390
|
return I(() => {
|
|
388
391
|
const o = e.current;
|
|
389
392
|
if (o === null) return;
|
|
390
|
-
const
|
|
391
|
-
const s = Math.round(o.getBoundingClientRect().height), d = getComputedStyle(o), u = d.getPropertyValue(
|
|
392
|
-
r((
|
|
393
|
-
const f = Number.isFinite(s) && s > 0 ? s :
|
|
394
|
-
return
|
|
393
|
+
const c = () => {
|
|
394
|
+
const s = Math.round(o.getBoundingClientRect().height), d = getComputedStyle(o), u = d.getPropertyValue(On).trim() === "" ? null : Mn(d.color);
|
|
395
|
+
r((i) => {
|
|
396
|
+
const f = Number.isFinite(s) && s > 0 ? s : i.rowHeight;
|
|
397
|
+
return i.rowHeight === f && i.lineColor === u ? i : { rowHeight: f, lineColor: u };
|
|
395
398
|
});
|
|
396
399
|
};
|
|
397
|
-
|
|
398
|
-
const l =
|
|
399
|
-
for (const s of l) s.addEventListener("change",
|
|
400
|
-
const a = typeof ResizeObserver > "u" ? null : new ResizeObserver(
|
|
400
|
+
c();
|
|
401
|
+
const l = Pn.map((s) => window.matchMedia(s));
|
|
402
|
+
for (const s of l) s.addEventListener("change", c);
|
|
403
|
+
const a = typeof ResizeObserver > "u" ? null : new ResizeObserver(c);
|
|
401
404
|
return a?.observe(o), () => {
|
|
402
|
-
for (const s of l) s.removeEventListener("change",
|
|
405
|
+
for (const s of l) s.removeEventListener("change", c);
|
|
403
406
|
a?.disconnect();
|
|
404
407
|
};
|
|
405
408
|
}, [e, t]), n;
|
|
406
409
|
}, at = "markdown-explorer-tree-scroll", In = 0.5, lt = (e, t) => [...e.querySelectorAll(`[role="treeitem"][${se}]`)].find((n) => n.getAttribute(se) === t), Dn = (e, t) => {
|
|
407
410
|
const n = lt(e, t), r = n?.closest(`[data-testid="${at}"]`);
|
|
408
411
|
if (n === void 0 || r === null || r === void 0) return Number.POSITIVE_INFINITY;
|
|
409
|
-
const o = r.getBoundingClientRect(),
|
|
412
|
+
const o = r.getBoundingClientRect(), c = n.getBoundingClientRect(), l = o.top - c.top, a = c.height > o.height ? Math.abs(l) : Math.max(0, l) + Math.max(0, c.bottom - o.bottom);
|
|
410
413
|
return a <= In ? 0 : a;
|
|
411
414
|
}, Hn = {
|
|
412
415
|
testId: at,
|
|
@@ -427,9 +430,9 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
427
430
|
return t === null || t.getAttribute("data-entry-type") !== "file" ? null : t.getAttribute(se);
|
|
428
431
|
}, ot = (e, t, n, r) => n === "folder-limit" ? e.expandAllFolderLimit(r, t.maxFolders, e.expandAll) : e.expandAllDepthLimit(r, t.maxDepth), Un = (e, t, n) => n.kind === "done" ? e.expandAllDone(n.opened, n.failed, n.complete) : ot(e, t, n.kind, n.opened), st = () => {
|
|
429
432
|
const { labels: e } = D();
|
|
430
|
-
return /* @__PURE__ */
|
|
433
|
+
return /* @__PURE__ */ A("div", { className: "aqmx-explorer-loading", "aria-busy": "true", "data-testid": "markdown-explorer-tree-loading", children: [
|
|
431
434
|
/* @__PURE__ */ m("p", { className: "aqmx-explorer-loading-text", children: e.treeLoading }),
|
|
432
|
-
/* @__PURE__ */
|
|
435
|
+
/* @__PURE__ */ A("div", { className: "aqmx-skeleton", "aria-hidden": "true", children: [
|
|
433
436
|
/* @__PURE__ */ m("span", {}),
|
|
434
437
|
/* @__PURE__ */ m("span", {}),
|
|
435
438
|
/* @__PURE__ */ m("span", {}),
|
|
@@ -439,17 +442,17 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
439
442
|
] });
|
|
440
443
|
}, Wn = () => {
|
|
441
444
|
const { labels: e } = D();
|
|
442
|
-
return /* @__PURE__ */
|
|
445
|
+
return /* @__PURE__ */ A("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-tree-empty", children: [
|
|
443
446
|
/* @__PURE__ */ m(cn, { className: "aqmx-explorer-empty-icon", "aria-hidden": "true" }),
|
|
444
447
|
/* @__PURE__ */ m("p", { className: "aqmx-empty-title", children: e.treeEmptyTitle }),
|
|
445
448
|
/* @__PURE__ */ m("p", { className: "aqmx-explorer-empty-body", children: e.treeEmptyBody })
|
|
446
449
|
] });
|
|
447
450
|
}, Xn = ({ name: e, onRetry: t }) => {
|
|
448
451
|
const { labels: n } = D(), r = ye();
|
|
449
|
-
return /* @__PURE__ */
|
|
452
|
+
return /* @__PURE__ */ A("span", { className: "aqmx-explorer-folder-failed", children: [
|
|
450
453
|
/* @__PURE__ */ m("span", { className: "aqmx-explorer-folder-name", children: e }),
|
|
451
454
|
/* @__PURE__ */ m("span", { id: r, className: "aqmx-explorer-folder-error", children: n.folderLoadFailed }),
|
|
452
|
-
/* @__PURE__ */
|
|
455
|
+
/* @__PURE__ */ A(
|
|
453
456
|
"button",
|
|
454
457
|
{
|
|
455
458
|
type: "button",
|
|
@@ -458,14 +461,14 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
458
461
|
"data-testid": "markdown-explorer-folder-retry",
|
|
459
462
|
onClick: (o) => {
|
|
460
463
|
o.stopPropagation();
|
|
461
|
-
const
|
|
464
|
+
const c = o.currentTarget, l = c.ownerDocument.activeElement === c ? c.closest('[role="treeitem"]') : null;
|
|
462
465
|
l instanceof HTMLElement && Ye(l), t();
|
|
463
466
|
},
|
|
464
467
|
onKeyDown: (o) => {
|
|
465
468
|
o.key !== "Escape" && o.stopPropagation();
|
|
466
469
|
},
|
|
467
470
|
children: [
|
|
468
|
-
/* @__PURE__ */ m(
|
|
471
|
+
/* @__PURE__ */ m(Ae, { className: "aqmx-explorer-folder-retry-icon", "aria-hidden": "true" }),
|
|
469
472
|
/* @__PURE__ */ m("span", { className: "aqmx-explorer-folder-retry-text", children: n.retry })
|
|
470
473
|
]
|
|
471
474
|
}
|
|
@@ -477,25 +480,25 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
477
480
|
mode: n,
|
|
478
481
|
sourceId: r,
|
|
479
482
|
settings: o,
|
|
480
|
-
reveal:
|
|
483
|
+
reveal: c,
|
|
481
484
|
openPaths: l,
|
|
482
485
|
selection: a,
|
|
483
486
|
onOpenDocument: s,
|
|
484
487
|
onRevealSource: d,
|
|
485
488
|
expansion: u,
|
|
486
|
-
onShown:
|
|
489
|
+
onShown: i,
|
|
487
490
|
marks: f,
|
|
488
491
|
claimsHeld: h,
|
|
489
492
|
expandAll: v,
|
|
490
493
|
revealCancel: E
|
|
491
494
|
}) => {
|
|
492
|
-
const { trees: S, documents: C, labels: T, locale:
|
|
495
|
+
const { trees: S, documents: C, labels: T, locale: L, theme: Z, data: M, config: k, sources: b, reveals: R } = D(), y = be(qe), [O] = q(hn), H = g(null), { rowHeight: de, lineColor: X } = _n(H, Z), { isExpanded: B, toggle: ee, expandMultiple: K, collapseMultiple: ae, expanded: V, isPending: le } = u, { alwaysExpanded: G, sortMode: $, folderPlacement: U } = o, { direct: ue, markDirect: W, unmarkDirect: ce, pruneDirect: me } = f, { running: oe, advance: he } = v, fe = g(null), te = g(null), N = F(() => Mt({ sortMode: $, folderPlacement: U }), [$, U]), 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) || G && !ne.has(x)), [B, G, ne]), Q = g({ shownExpanded: re, isExpanded: B, unloadedFolders: ne, entries: e, childrenOf: z });
|
|
493
496
|
I(() => {
|
|
494
497
|
Q.current = { shownExpanded: re, isExpanded: B, unloadedFolders: ne, entries: e, childrenOf: z };
|
|
495
498
|
}, [re, B, ne, e, z]);
|
|
496
499
|
const Me = w((x) => {
|
|
497
500
|
fe.current?.scrollToPath(x, { align: "nearest" }), requestAnimationFrame(() => {
|
|
498
|
-
const
|
|
501
|
+
const P = te.current, j = P === null ? void 0 : lt(P, x);
|
|
499
502
|
j !== void 0 && Ye(j);
|
|
500
503
|
});
|
|
501
504
|
}, []), pt = w(
|
|
@@ -509,14 +512,14 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
509
512
|
[Me, W, ce, ee]
|
|
510
513
|
), Re = w(
|
|
511
514
|
(x) => {
|
|
512
|
-
const
|
|
513
|
-
|
|
515
|
+
const P = x.filter((j) => !pe(j));
|
|
516
|
+
P.length !== 0 && (ce(P), ae(P));
|
|
514
517
|
},
|
|
515
518
|
[ce, ae]
|
|
516
519
|
), ht = w(
|
|
517
520
|
(x) => {
|
|
518
|
-
const
|
|
519
|
-
|
|
521
|
+
const P = x.filter((j) => !pe(j));
|
|
522
|
+
P.length !== 0 && (P.length < x.length && P.every((j) => Q.current.shownExpanded(j)) ? Re(P) : K(P));
|
|
520
523
|
},
|
|
521
524
|
[K, Re]
|
|
522
525
|
), _e = w(
|
|
@@ -530,38 +533,38 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
530
533
|
}
|
|
531
534
|
),
|
|
532
535
|
[S, r, W, K]
|
|
533
|
-
), Ie = n === "multi" ? l : zn, { loopFolderName: De } = T, xt = F(() =>
|
|
536
|
+
), Ie = n === "multi" ? l : zn, { loopFolderName: De } = T, xt = F(() => O(e, { openPaths: Ie, childrenOf: z, renderFailedFolder: _e, loopFolderName: De }), [O, e, Ie, z, _e, De, t]), wt = Lt(C, Kn), He = g([]), xe = w(() => {
|
|
534
537
|
for (const x of He.current) Q.current.unloadedFolders.has(x) && W(x);
|
|
535
|
-
}, [W]), { maxDepth: Se } =
|
|
538
|
+
}, [W]), { maxDepth: Se } = k.revealDocument, $e = g(d);
|
|
536
539
|
I(() => {
|
|
537
540
|
$e.current = d;
|
|
538
541
|
}, [d]);
|
|
539
542
|
const gt = F(
|
|
540
543
|
() => ({
|
|
541
|
-
ancestors: async (x,
|
|
544
|
+
ancestors: async (x, P) => {
|
|
542
545
|
const j = R.take(r, x);
|
|
543
546
|
if (j !== null) return j;
|
|
544
547
|
if (!R.mayMove(x)) {
|
|
545
|
-
const ie = await M.ancestors(r, x,
|
|
548
|
+
const ie = await M.ancestors(r, x, P);
|
|
546
549
|
return ie.status !== "ok" || ie.ancestors === null || ie.ancestors.length > Se ? null : ie.ancestors;
|
|
547
550
|
}
|
|
548
|
-
const J = await M.reveal(r, x,
|
|
549
|
-
return J.status !== "ok" || J.source === null || J.ancestors.length > Se ? null : J.source === r ? J.ancestors : (
|
|
551
|
+
const J = await M.reveal(r, x, P);
|
|
552
|
+
return J.status !== "ok" || J.source === null || J.ancestors.length > Se ? null : J.source === r ? J.ancestors : (P.aborted || !b.some((ie) => ie.id === J.source) || (R.move(J.source, x, J.ancestors), $e.current(J.source)), null);
|
|
550
553
|
},
|
|
551
554
|
open: (x) => {
|
|
552
555
|
He.current = x ?? [], x !== null && (xe(), K([...x]));
|
|
553
556
|
},
|
|
554
|
-
progress: (x,
|
|
557
|
+
progress: (x, P) => vn(Q.current.entries, x, P, { isShownExpanded: Q.current.shownExpanded, childrenOf: Q.current.childrenOf })
|
|
555
558
|
}),
|
|
556
559
|
[M, r, b, R, Se, xe, K]
|
|
557
560
|
);
|
|
558
561
|
_(() => xe(), [xe, ne]);
|
|
559
562
|
const vt = F(() => [e, t, V], [e, t, V]), bt = w((x) => te.current === null ? Number.POSITIVE_INFINITY : Dn(te.current, x), []);
|
|
560
|
-
|
|
563
|
+
An({ tree: fe, container: te, path: c.path, chain: c.openFolders ? gt : null, rows: vt, cancel: E, displayed: y, placement: bt });
|
|
561
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;
|
|
562
565
|
I(() => {
|
|
563
|
-
|
|
564
|
-
}, [e,
|
|
566
|
+
i(e);
|
|
567
|
+
}, [e, i]), I(() => () => i(null), [i]), _(() => S.claimChildren(r, ge ? we.folders : Vn), [S, r, ge, we]), _(() => me(ne), [me, ne]), _(() => {
|
|
565
568
|
ge && oe && he({ entries: e, isShownExpanded: re, childrenOf: z, compare: N, expanded: V, waiting: we.waiting, expansionPending: le });
|
|
566
569
|
}, [ge, oe, he, e, re, z, N, V, we, le]);
|
|
567
570
|
const Et = w(
|
|
@@ -570,8 +573,8 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
570
573
|
},
|
|
571
574
|
[R, s]
|
|
572
575
|
), { onChange: Te } = a, yt = F(
|
|
573
|
-
() => Te === null ? void 0 : (x,
|
|
574
|
-
pe(x.absolutePath) || Te({ path: x.absolutePath, name: x.name, selected:
|
|
576
|
+
() => Te === null ? void 0 : (x, P) => {
|
|
577
|
+
pe(x.absolutePath) || Te({ path: x.absolutePath, name: x.name, selected: P });
|
|
575
578
|
},
|
|
576
579
|
[Te]
|
|
577
580
|
), Rt = F(() => new Set(a.items), [a.items]), St = F(
|
|
@@ -585,7 +588,7 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
585
588
|
}),
|
|
586
589
|
[T]
|
|
587
590
|
), Tt = X === null ? { showTreeLines: !1 } : { showTreeLines: o.lines, lineColor: X };
|
|
588
|
-
return /* @__PURE__ */
|
|
591
|
+
return /* @__PURE__ */ A("div", { ref: te, className: "aqmx-explorer-tree", "data-testid": "markdown-explorer-tree", ...wt, children: [
|
|
589
592
|
/* @__PURE__ */ m("span", { ref: H, className: "aqmx-explorer-tree-probe", "aria-hidden": "true", [qn]: "" }),
|
|
590
593
|
/* @__PURE__ */ m(
|
|
591
594
|
Kt,
|
|
@@ -618,74 +621,74 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Ae(!0), et = "\0loop\0", tt =
|
|
|
618
621
|
},
|
|
619
622
|
virtualScroll: Hn,
|
|
620
623
|
sort: Y,
|
|
621
|
-
locale:
|
|
624
|
+
locale: L,
|
|
622
625
|
labels: St
|
|
623
626
|
}
|
|
624
627
|
)
|
|
625
628
|
] });
|
|
626
629
|
}, Yn = ({ pending: e, status: t }) => {
|
|
627
|
-
const { labels: n } = D(), r = t.state !== "running", [o,
|
|
630
|
+
const { labels: n } = D(), r = t.state !== "running", [o, c] = q(0), l = g(!0);
|
|
628
631
|
I(() => {
|
|
629
632
|
const s = l.current;
|
|
630
633
|
if (l.current = r, !r || e > 0 && !s) {
|
|
631
|
-
|
|
634
|
+
c(0);
|
|
632
635
|
return;
|
|
633
636
|
}
|
|
634
637
|
if (e > 0) {
|
|
635
|
-
|
|
638
|
+
c(e);
|
|
636
639
|
return;
|
|
637
640
|
}
|
|
638
641
|
if (o === 0) return;
|
|
639
|
-
const d = setTimeout(() =>
|
|
642
|
+
const d = setTimeout(() => c(0), 0);
|
|
640
643
|
return () => clearTimeout(d);
|
|
641
644
|
}, [r, e, o]);
|
|
642
645
|
const a = r && e === 0 ? o : e;
|
|
643
|
-
return a === 0 && r ? null : /* @__PURE__ */
|
|
644
|
-
a > 0 ? /* @__PURE__ */ m(
|
|
646
|
+
return a === 0 && r ? null : /* @__PURE__ */ A("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(Ae, { className: "aqmx-explorer-tree-progress-icon", "aria-hidden": "true" }) : null,
|
|
645
648
|
/* @__PURE__ */ m("span", { children: t.state === "running" ? n.expandAllProgress(t.opened, a) : n.foldersLoading(a) })
|
|
646
649
|
] });
|
|
647
650
|
}, Qn = ({ stop: e, opened: t, budget: n }) => {
|
|
648
651
|
const { labels: r } = D();
|
|
649
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) });
|
|
650
653
|
}, Jn = ({ entries: e, ...t }) => {
|
|
651
|
-
const { trees: n } = D(), r = Ee(n.subscribe, n.version, n.version), { sourceId: o } = t, [
|
|
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]);
|
|
652
655
|
return l.length === 0 ? /* @__PURE__ */ m(Wn, {}) : /* @__PURE__ */ m(Gn, { entries: l, version: r, ...t });
|
|
653
656
|
}, er = ({ result: e, onRetry: t, ...n }) => {
|
|
654
657
|
const { renderTreeFailure: r } = D(), o = be(e);
|
|
655
658
|
if (o.status === "deferred") return /* @__PURE__ */ m(st, {});
|
|
656
659
|
if (o.status === "ok") return /* @__PURE__ */ m(Jn, { entries: o.entries, ...n });
|
|
657
|
-
const
|
|
658
|
-
return /* @__PURE__ */ m("div", { className: "aqmx-explorer-tree-message", "data-testid": "markdown-explorer-tree-failure", "data-aqmx-failure": o.failure.reason, children:
|
|
660
|
+
const c = r?.(o.failure);
|
|
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 }) });
|
|
659
662
|
}, tr = ({ onControls: e, ...t }) => {
|
|
660
|
-
const { trees: n, storageNamespace: r, labels: o, announcer:
|
|
663
|
+
const { trees: n, storageNamespace: r, labels: o, announcer: c, config: l } = D(), { sourceId: a } = t, s = jt({ storageKey: Wt(r).treeExpansion(a) });
|
|
661
664
|
Ee(n.subscribe, n.version, n.version);
|
|
662
665
|
const d = n.read(a), u = w(() => n.retry(a), [n, a]);
|
|
663
666
|
I(() => n.open(a), [n, a]);
|
|
664
|
-
const
|
|
667
|
+
const i = Rn(), { expanded: f, expandMultiple: h, collapseAll: v } = s, [E, S] = q(null), C = E !== f, T = g(f);
|
|
665
668
|
I(() => {
|
|
666
669
|
T.current = f;
|
|
667
670
|
}, [f]);
|
|
668
|
-
const
|
|
671
|
+
const L = l.expandAll, Z = w(() => c.announce(o.expandAllStarted), [c, o]), M = w(($) => c.announce(Un(o, L, $)), [c, o, L]), k = Ln({ budget: L, expandMultiple: h, onStart: Z, onFinish: M }), { status: b, start: R, end: y, advance: O } = k, H = b.state === "running", de = F(() => ({ running: H, advance: O }), [H, O]), X = g(null), [B, ee] = q(!1), K = w(($) => {
|
|
669
672
|
X.current = $, ee($ !== null);
|
|
670
673
|
}, []);
|
|
671
674
|
_(
|
|
672
675
|
() => n.subscribeChildrenFailures(($) => {
|
|
673
676
|
const U = $.sourceId === a && X.current !== null ? nt(X.current, $.path) : null;
|
|
674
|
-
U !== null &&
|
|
677
|
+
U !== null && c.announce({ list: o.foldersLoadFailedNamed, item: U.name });
|
|
675
678
|
}),
|
|
676
|
-
[n, a,
|
|
679
|
+
[n, a, c, o]
|
|
677
680
|
);
|
|
678
|
-
const { clearDirect: ae } =
|
|
681
|
+
const { clearDirect: ae } = i, [V, le] = q(0), G = w(() => {
|
|
679
682
|
le(($) => $ + 1), y(), ae(), S(T.current), v();
|
|
680
683
|
}, [y, ae, v]);
|
|
681
684
|
return _(() => {
|
|
682
685
|
e({ collapseAll: G, expandAll: B ? R : null, expanding: H });
|
|
683
686
|
}, [e, G, R, B, H]), _(() => () => e(null), [e]), _(() => {
|
|
684
687
|
B || y();
|
|
685
|
-
}, [B, y]), /* @__PURE__ */
|
|
686
|
-
b.state === "stopped" ? /* @__PURE__ */ m(Qn, { stop: b.stop, opened: b.opened, budget:
|
|
687
|
-
/* @__PURE__ */
|
|
688
|
-
/* @__PURE__ */ m(Qe, { fallback: /* @__PURE__ */ m(st, {}), children: /* @__PURE__ */ m(er, { result: d, onRetry: u, expansion: s, onShown: K, marks:
|
|
688
|
+
}, [B, y]), /* @__PURE__ */ A(Ge, { children: [
|
|
689
|
+
b.state === "stopped" ? /* @__PURE__ */ m(Qn, { stop: b.stop, opened: b.opened, budget: L }) : null,
|
|
690
|
+
/* @__PURE__ */ A("div", { className: "aqmx-explorer-tree-area", children: [
|
|
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 }) }),
|
|
689
692
|
/* @__PURE__ */ m(Yn, { pending: n.pendingChildren(a), status: b })
|
|
690
693
|
] })
|
|
691
694
|
] });
|
|
@@ -712,40 +715,40 @@ function nr({
|
|
|
712
715
|
}));
|
|
713
716
|
}
|
|
714
717
|
const ct = /* @__PURE__ */ p.forwardRef(nr), Ue = "markdown-explorer-selection-remove", rr = ({ selection: e, onRemove: t, onClear: n, onOpenSelection: r, onLeave: o }) => {
|
|
715
|
-
const { labels:
|
|
718
|
+
const { labels: c } = D(), l = ye(), a = g(null), s = [...e], d = (i, f) => {
|
|
716
719
|
if (f.ownerDocument.activeElement === f) {
|
|
717
720
|
const h = a.current === null ? [] : [...a.current.querySelectorAll(`[data-testid="${Ue}"]`)], v = h.indexOf(f), E = [h[v + 1], h[v - 1]].find((S) => S !== void 0);
|
|
718
721
|
E === void 0 ? o() : E.focus();
|
|
719
722
|
}
|
|
720
|
-
t(
|
|
723
|
+
t(i);
|
|
721
724
|
}, u = () => {
|
|
722
|
-
const
|
|
723
|
-
|
|
725
|
+
const i = a.current;
|
|
726
|
+
i !== null && i.contains(i.ownerDocument.activeElement) && o(), n();
|
|
724
727
|
};
|
|
725
|
-
return /* @__PURE__ */
|
|
726
|
-
/* @__PURE__ */
|
|
727
|
-
/* @__PURE__ */ m("p", { id: l, className: "aqmx-explorer-tray-title", children:
|
|
728
|
-
/* @__PURE__ */ m("button", { type: "button", className: "aqmx-explorer-tray-button", "data-testid": "markdown-explorer-selection-clear", onClick: u, children:
|
|
728
|
+
return /* @__PURE__ */ A("section", { ref: a, className: "aqmx-explorer-tray", "aria-labelledby": l, "data-testid": "markdown-explorer-selection-tray", children: [
|
|
729
|
+
/* @__PURE__ */ A("div", { className: "aqmx-explorer-tray-header", children: [
|
|
730
|
+
/* @__PURE__ */ m("p", { id: l, className: "aqmx-explorer-tray-title", children: c.selectionTitle(s.length) }),
|
|
731
|
+
/* @__PURE__ */ m("button", { type: "button", className: "aqmx-explorer-tray-button", "data-testid": "markdown-explorer-selection-clear", onClick: u, children: c.clearSelection })
|
|
729
732
|
] }),
|
|
730
|
-
/* @__PURE__ */ m("ul", { className: "aqmx-explorer-tray-list", children: s.map(([
|
|
731
|
-
/* @__PURE__ */ m("span", { className: "aqmx-explorer-tray-name", title:
|
|
733
|
+
/* @__PURE__ */ m("ul", { className: "aqmx-explorer-tray-list", children: s.map(([i, f]) => /* @__PURE__ */ A("li", { className: "aqmx-explorer-tray-item", children: [
|
|
734
|
+
/* @__PURE__ */ m("span", { className: "aqmx-explorer-tray-name", title: i, children: f }),
|
|
732
735
|
/* @__PURE__ */ m(
|
|
733
736
|
"button",
|
|
734
737
|
{
|
|
735
738
|
type: "button",
|
|
736
739
|
className: "aqmx-icon-button aqmx-explorer-tray-remove",
|
|
737
|
-
"aria-label":
|
|
738
|
-
title:
|
|
740
|
+
"aria-label": c.removeFromSelection(f),
|
|
741
|
+
title: c.removeFromSelection(f),
|
|
739
742
|
"data-testid": Ue,
|
|
740
|
-
"data-aqmx-path":
|
|
741
|
-
onClick: (h) => d(
|
|
743
|
+
"data-aqmx-path": i,
|
|
744
|
+
onClick: (h) => d(i, h.currentTarget),
|
|
742
745
|
children: /* @__PURE__ */ m(ct, { "aria-hidden": "true" })
|
|
743
746
|
}
|
|
744
747
|
)
|
|
745
|
-
] },
|
|
746
|
-
r === void 0 ? null : /* @__PURE__ */ m("button", { type: "button", className: "aqmx-explorer-tray-open", "data-testid": "markdown-explorer-selection-open", onClick: () => r(s.map(([
|
|
748
|
+
] }, i)) }),
|
|
749
|
+
r === void 0 ? null : /* @__PURE__ */ m("button", { type: "button", className: "aqmx-explorer-tray-open", "data-testid": "markdown-explorer-selection-open", onClick: () => r(s.map(([i]) => i)), children: c.openSelectionInMulti(s.length) })
|
|
747
750
|
] });
|
|
748
|
-
},
|
|
751
|
+
}, Le = /* @__PURE__ */ new Map(), ar = (e, t) => {
|
|
749
752
|
if (t.selected === e.has(t.path)) return e;
|
|
750
753
|
const n = new Map(e);
|
|
751
754
|
return t.selected ? n.set(t.path, t.name) : n.delete(t.path), n;
|
|
@@ -753,7 +756,7 @@ const ct = /* @__PURE__ */ p.forwardRef(nr), Ue = "markdown-explorer-selection-r
|
|
|
753
756
|
if (!e.has(t)) return e;
|
|
754
757
|
const n = new Map(e);
|
|
755
758
|
return n.delete(t), n;
|
|
756
|
-
}, it =
|
|
759
|
+
}, it = Pe(null), or = (e) => {
|
|
757
760
|
const t = be(it);
|
|
758
761
|
I(() => {
|
|
759
762
|
if (t !== null)
|
|
@@ -978,7 +981,7 @@ function Tr({
|
|
|
978
981
|
}));
|
|
979
982
|
}
|
|
980
983
|
const Nr = /* @__PURE__ */ p.forwardRef(Tr);
|
|
981
|
-
function
|
|
984
|
+
function Lr({
|
|
982
985
|
title: e,
|
|
983
986
|
titleId: t,
|
|
984
987
|
...n
|
|
@@ -999,8 +1002,8 @@ function kr({
|
|
|
999
1002
|
clipRule: "evenodd"
|
|
1000
1003
|
}));
|
|
1001
1004
|
}
|
|
1002
|
-
const
|
|
1003
|
-
function
|
|
1005
|
+
const kr = /* @__PURE__ */ p.forwardRef(Lr);
|
|
1006
|
+
function Ar({
|
|
1004
1007
|
title: e,
|
|
1005
1008
|
titleId: t,
|
|
1006
1009
|
...n
|
|
@@ -1019,16 +1022,16 @@ function Or({
|
|
|
1019
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"
|
|
1020
1023
|
}));
|
|
1021
1024
|
}
|
|
1022
|
-
const
|
|
1025
|
+
const Or = /* @__PURE__ */ p.forwardRef(Ar), Pr = Object.freeze({
|
|
1023
1026
|
sortMode: dr,
|
|
1024
1027
|
folderPlacement: Sr,
|
|
1025
1028
|
selectionMode: mr,
|
|
1026
1029
|
doubleClickAction: br,
|
|
1027
|
-
expandIconSize:
|
|
1030
|
+
expandIconSize: kr,
|
|
1028
1031
|
alwaysExpanded: cr,
|
|
1029
|
-
revealDocument:
|
|
1032
|
+
revealDocument: kt,
|
|
1030
1033
|
removeRootIndent: pr,
|
|
1031
|
-
lines:
|
|
1034
|
+
lines: Or,
|
|
1032
1035
|
expandIcons: xr,
|
|
1033
1036
|
directoryIcons: Nr,
|
|
1034
1037
|
fileIcons: yr
|
|
@@ -1036,25 +1039,25 @@ const Pr = /* @__PURE__ */ p.forwardRef(Or), Ar = Object.freeze({
|
|
|
1036
1039
|
const n = e[t.labelKey];
|
|
1037
1040
|
if (typeof n != "string") throw new TypeError(`[markdown-explorer] the tree setting ${t.key} must name a string label; labels.${t.labelKey} is a ${typeof n}`);
|
|
1038
1041
|
return n;
|
|
1039
|
-
}, qr = ({ id: e, settings: t, descriptors: n, onAdvance: r, onClose: o, ref:
|
|
1042
|
+
}, qr = ({ id: e, settings: t, descriptors: n, onAdvance: r, onClose: o, ref: c }) => {
|
|
1040
1043
|
const { labels: l } = D(), a = g([]);
|
|
1041
1044
|
_(() => {
|
|
1042
1045
|
a.current[0]?.focus();
|
|
1043
1046
|
}, []);
|
|
1044
1047
|
const s = w(
|
|
1045
1048
|
(u) => {
|
|
1046
|
-
const
|
|
1047
|
-
a.current[(u %
|
|
1049
|
+
const i = n.length;
|
|
1050
|
+
a.current[(u % i + i) % i]?.focus();
|
|
1048
1051
|
},
|
|
1049
1052
|
[n.length]
|
|
1050
1053
|
), d = w(
|
|
1051
|
-
(u,
|
|
1054
|
+
(u, i) => {
|
|
1052
1055
|
switch (u.key) {
|
|
1053
1056
|
case "ArrowDown":
|
|
1054
|
-
u.preventDefault(), s(
|
|
1057
|
+
u.preventDefault(), s(i + 1);
|
|
1055
1058
|
break;
|
|
1056
1059
|
case "ArrowUp":
|
|
1057
|
-
u.preventDefault(), s(
|
|
1060
|
+
u.preventDefault(), s(i - 1);
|
|
1058
1061
|
break;
|
|
1059
1062
|
case "Home":
|
|
1060
1063
|
u.preventDefault(), s(0);
|
|
@@ -1063,7 +1066,7 @@ const Pr = /* @__PURE__ */ p.forwardRef(Or), Ar = Object.freeze({
|
|
|
1063
1066
|
u.preventDefault(), s(n.length - 1);
|
|
1064
1067
|
break;
|
|
1065
1068
|
case "Escape":
|
|
1066
|
-
|
|
1069
|
+
Oe(u), o();
|
|
1067
1070
|
break;
|
|
1068
1071
|
case "Tab":
|
|
1069
1072
|
o();
|
|
@@ -1072,13 +1075,13 @@ const Pr = /* @__PURE__ */ p.forwardRef(Or), Ar = Object.freeze({
|
|
|
1072
1075
|
},
|
|
1073
1076
|
[n.length, s, o]
|
|
1074
1077
|
);
|
|
1075
|
-
return /* @__PURE__ */ m("div", { ref:
|
|
1076
|
-
const f =
|
|
1077
|
-
return /* @__PURE__ */
|
|
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
|
+
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__ */ A(
|
|
1078
1081
|
"button",
|
|
1079
1082
|
{
|
|
1080
1083
|
ref: (C) => {
|
|
1081
|
-
a.current[
|
|
1084
|
+
a.current[i] = C;
|
|
1082
1085
|
},
|
|
1083
1086
|
type: "button",
|
|
1084
1087
|
tabIndex: -1,
|
|
@@ -1088,7 +1091,7 @@ const Pr = /* @__PURE__ */ p.forwardRef(Or), Ar = Object.freeze({
|
|
|
1088
1091
|
"data-testid": "markdown-explorer-tree-settings-item",
|
|
1089
1092
|
"data-aqmx-setting": u.key,
|
|
1090
1093
|
onClick: () => r(u),
|
|
1091
|
-
onKeyDown: (C) => d(C,
|
|
1094
|
+
onKeyDown: (C) => d(C, i),
|
|
1092
1095
|
children: [
|
|
1093
1096
|
/* @__PURE__ */ m(f, { className: "aqmx-explorer-menu-icon", "aria-hidden": "true" }),
|
|
1094
1097
|
/* @__PURE__ */ m("span", { className: "aqmx-explorer-menu-name", children: h }),
|
|
@@ -1099,18 +1102,18 @@ const Pr = /* @__PURE__ */ p.forwardRef(Or), Ar = Object.freeze({
|
|
|
1099
1102
|
);
|
|
1100
1103
|
}) });
|
|
1101
1104
|
}, Cr = ({ settings: e, descriptors: t, onAdvance: n }) => {
|
|
1102
|
-
const { labels: r, announcer: o } = D(), [
|
|
1105
|
+
const { labels: r, announcer: o } = D(), [c, l] = q(!1), a = g(null), s = g(null), d = g(null), u = ye(), i = w(() => {
|
|
1103
1106
|
a.current?.focus(), l(!1);
|
|
1104
1107
|
}, []);
|
|
1105
1108
|
_(() => {
|
|
1106
|
-
if (!
|
|
1109
|
+
if (!c) return;
|
|
1107
1110
|
const v = (E) => {
|
|
1108
1111
|
E.target instanceof Node && (a.current?.contains(E.target) === !0 || s.current?.contains(E.target) === !0) || (l(!1), d.current !== null && window.clearTimeout(d.current), d.current = window.setTimeout(() => {
|
|
1109
1112
|
d.current = null, (document.activeElement === null || document.activeElement === document.body) && a.current?.focus();
|
|
1110
1113
|
}, 0));
|
|
1111
1114
|
};
|
|
1112
1115
|
return document.addEventListener("pointerdown", v), () => document.removeEventListener("pointerdown", v);
|
|
1113
|
-
}, [
|
|
1116
|
+
}, [c]), _(
|
|
1114
1117
|
() => () => {
|
|
1115
1118
|
d.current !== null && window.clearTimeout(d.current);
|
|
1116
1119
|
},
|
|
@@ -1118,9 +1121,9 @@ const Pr = /* @__PURE__ */ p.forwardRef(Or), Ar = Object.freeze({
|
|
|
1118
1121
|
);
|
|
1119
1122
|
const f = w(
|
|
1120
1123
|
(v) => {
|
|
1121
|
-
v.key !== "Escape" || !
|
|
1124
|
+
v.key !== "Escape" || !c || (Oe(v), i());
|
|
1122
1125
|
},
|
|
1123
|
-
[
|
|
1126
|
+
[c, i]
|
|
1124
1127
|
), h = w(
|
|
1125
1128
|
(v) => {
|
|
1126
1129
|
const E = n(v.key);
|
|
@@ -1136,8 +1139,8 @@ const Pr = /* @__PURE__ */ p.forwardRef(Or), Ar = Object.freeze({
|
|
|
1136
1139
|
type: "button",
|
|
1137
1140
|
className: "aqmx-icon-button",
|
|
1138
1141
|
"aria-haspopup": "menu",
|
|
1139
|
-
"aria-expanded":
|
|
1140
|
-
"aria-controls":
|
|
1142
|
+
"aria-expanded": c,
|
|
1143
|
+
"aria-controls": c ? u : void 0,
|
|
1141
1144
|
"aria-label": r.treeSettings,
|
|
1142
1145
|
title: r.treeSettings,
|
|
1143
1146
|
"data-testid": "markdown-explorer-tree-settings",
|
|
@@ -1146,21 +1149,21 @@ const Pr = /* @__PURE__ */ p.forwardRef(Or), Ar = Object.freeze({
|
|
|
1146
1149
|
children: /* @__PURE__ */ m(gr, { "aria-hidden": "true" })
|
|
1147
1150
|
}
|
|
1148
1151
|
),
|
|
1149
|
-
menu:
|
|
1152
|
+
menu: c ? /* @__PURE__ */ m(qr, { ref: s, id: u, settings: e, descriptors: t, onAdvance: h, onClose: i }) : null
|
|
1150
1153
|
};
|
|
1151
1154
|
}, Fr = () => {
|
|
1152
1155
|
const { treeSettings: e } = D();
|
|
1153
1156
|
return { settings: Ee(e.subscribe, e.getSnapshot, e.getServerSnapshot), advance: e.advance };
|
|
1154
1157
|
}, We = /* @__PURE__ */ new Set(), Mr = '[role="tree"] [role="treeitem"][tabindex="0"]', _r = "[data-directory-tree-tab-stop]", oa = (e) => {
|
|
1155
|
-
const { mode: t, sourceId: n, currentPath: r, openPaths: o, onOpenDocument:
|
|
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";
|
|
1156
1159
|
or(T);
|
|
1157
|
-
const
|
|
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(
|
|
1158
1161
|
(N) => {
|
|
1159
1162
|
const Y = S(N);
|
|
1160
|
-
return Y.selectionMode !== "multiple" &&
|
|
1163
|
+
return Y.selectionMode !== "multiple" && L?.(Le), Y;
|
|
1161
1164
|
},
|
|
1162
|
-
[S,
|
|
1163
|
-
), b = Cr({ settings: E, descriptors: C, onAdvance:
|
|
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]), O = w(() => L?.(Le), [L]), H = g(null), de = w(() => {
|
|
1164
1167
|
const N = H.current;
|
|
1165
1168
|
if (N === null) return;
|
|
1166
1169
|
[Mr, _r, '[data-testid="markdown-explorer-tree-settings"]'].map((z) => N.querySelector(z)).find((z) => z !== null)?.focus();
|
|
@@ -1183,20 +1186,20 @@ const Pr = /* @__PURE__ */ p.forwardRef(Or), Ar = Object.freeze({
|
|
|
1183
1186
|
if (!W.current) {
|
|
1184
1187
|
W.current = !0, $(!0), ue(null);
|
|
1185
1188
|
try {
|
|
1186
|
-
const N = await
|
|
1189
|
+
const N = await i.refresh(n);
|
|
1187
1190
|
if (N.status === "superseded") return;
|
|
1188
1191
|
f.invalidate(), N.status === "failed" ? ue({ sourceId: n, failure: N.failure }) : h.announce(d.treeRefreshed);
|
|
1189
1192
|
} finally {
|
|
1190
1193
|
W.current = !1, $(!1);
|
|
1191
1194
|
}
|
|
1192
1195
|
}
|
|
1193
|
-
}, [
|
|
1194
|
-
return /* @__PURE__ */
|
|
1195
|
-
/* @__PURE__ */
|
|
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__ */ A("nav", { ref: H, "aria-label": d.explorerRegion, className: "aqmx-explorer", "data-testid": "markdown-explorer-explorer", "data-aqmx-mode": t, children: [
|
|
1198
|
+
/* @__PURE__ */ A("div", { className: "aqmx-explorer-header", children: [
|
|
1196
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,
|
|
1197
|
-
/* @__PURE__ */
|
|
1198
|
-
/* @__PURE__ */ m(
|
|
1199
|
-
/* @__PURE__ */
|
|
1200
|
+
/* @__PURE__ */ A("div", { className: "aqmx-explorer-actions", children: [
|
|
1201
|
+
/* @__PURE__ */ m(At, { 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__ */ A(
|
|
1200
1203
|
"button",
|
|
1201
1204
|
{
|
|
1202
1205
|
type: "button",
|
|
@@ -1210,7 +1213,7 @@ const Pr = /* @__PURE__ */ p.forwardRef(Or), Ar = Object.freeze({
|
|
|
1210
1213
|
ce();
|
|
1211
1214
|
},
|
|
1212
1215
|
children: [
|
|
1213
|
-
/* @__PURE__ */ m(
|
|
1216
|
+
/* @__PURE__ */ m(Ae, { "aria-hidden": "true" }),
|
|
1214
1217
|
/* @__PURE__ */ m("span", { children: d.refreshTreeLabel })
|
|
1215
1218
|
]
|
|
1216
1219
|
}
|
|
@@ -1234,11 +1237,11 @@ const Pr = /* @__PURE__ */ p.forwardRef(Or), Ar = Object.freeze({
|
|
|
1234
1237
|
b.trigger
|
|
1235
1238
|
] })
|
|
1236
1239
|
] }),
|
|
1237
|
-
/* @__PURE__ */
|
|
1238
|
-
U !== null && U.sourceId === n ? /* @__PURE__ */ m("p", { role: "alert", className: "aqmx-explorer-refresh-failure", "data-testid": "markdown-explorer-refresh-failure", "data-aqmx-failure": U.failure.reason, children: d.treeRefreshFailed(
|
|
1240
|
+
/* @__PURE__ */ A("div", { className: "aqmx-explorer-body", "data-aqmx-explorer-body": "", children: [
|
|
1241
|
+
U !== null && U.sourceId === n ? /* @__PURE__ */ m("p", { role: "alert", className: "aqmx-explorer-refresh-failure", "data-testid": "markdown-explorer-refresh-failure", "data-aqmx-failure": U.failure.reason, children: d.treeRefreshFailed(Ot(d, U.failure.reason)) }) : null,
|
|
1239
1242
|
/* @__PURE__ */ m(Qe, { fallback: null, children: /* @__PURE__ */ m(on, {}) }),
|
|
1240
|
-
/* @__PURE__ */ m(tr, { mode: t, sourceId: n, settings: E, reveal: K, openPaths: o, selection: ee, onOpenDocument:
|
|
1241
|
-
T && M.size > 0 ? /* @__PURE__ */ m(rr, { selection: M, onRemove: y, onClear:
|
|
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: O, onOpenSelection: Z, onLeave: de }) : null,
|
|
1242
1245
|
b.menu
|
|
1243
1246
|
] })
|
|
1244
1247
|
] });
|
|
@@ -1268,40 +1271,40 @@ function Zr({
|
|
|
1268
1271
|
}));
|
|
1269
1272
|
}
|
|
1270
1273
|
const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t, covered: n, onNoticeSlotChange: r, dismissals: o }) => {
|
|
1271
|
-
const { labels:
|
|
1272
|
-
u.navigated !== l && (
|
|
1274
|
+
const { labels: c } = D(), l = Yt(), { location: a } = Pt(), [s, d] = q(!1), [u, i] = q({ navigated: l, source: a.source }), [f, h] = q(!1);
|
|
1275
|
+
u.navigated !== l && (i({ navigated: l, source: a.source }), u.source === a.source && !f && d(!1));
|
|
1273
1276
|
const [v, E] = q(o);
|
|
1274
1277
|
v !== o && (E(o), d(!1));
|
|
1275
|
-
const S = g(null), C = g(null), T = g(null),
|
|
1278
|
+
const S = g(null), C = g(null), T = g(null), L = g(!1), Z = ye();
|
|
1276
1279
|
I(() => {
|
|
1277
1280
|
const y = S.current;
|
|
1278
1281
|
y !== null && (s && !y.open ? (y.showModal(), C.current?.focus()) : !s && y.open && (y.close(), t.current?.focus()), r(s ? T.current : null));
|
|
1279
1282
|
}, [s, t, r]), I(() => () => r(null), [r]);
|
|
1280
1283
|
const M = w((y) => {
|
|
1281
|
-
y.key !== "Escape" || y.defaultPrevented || (
|
|
1282
|
-
}, []),
|
|
1283
|
-
|
|
1284
|
+
y.key !== "Escape" || y.defaultPrevented || (Oe(y), d(!1));
|
|
1285
|
+
}, []), k = w((y) => {
|
|
1286
|
+
L.current = y.target === y.currentTarget;
|
|
1284
1287
|
}, []), b = w((y) => {
|
|
1285
|
-
const
|
|
1286
|
-
|
|
1288
|
+
const O = L.current;
|
|
1289
|
+
L.current = !1, O && y.target === y.currentTarget && d(!1);
|
|
1287
1290
|
}, []), R = w(() => {
|
|
1288
1291
|
d(!1);
|
|
1289
1292
|
}, []);
|
|
1290
|
-
return /* @__PURE__ */
|
|
1291
|
-
/* @__PURE__ */ m("div", { className: "aqmx-sheet-bar", inert: n, children: /* @__PURE__ */
|
|
1293
|
+
return /* @__PURE__ */ A(Ge, { children: [
|
|
1294
|
+
/* @__PURE__ */ m("div", { className: "aqmx-sheet-bar", inert: n, children: /* @__PURE__ */ A("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: [
|
|
1292
1295
|
/* @__PURE__ */ m(Br, { "aria-hidden": "true" }),
|
|
1293
|
-
/* @__PURE__ */ m("span", { children:
|
|
1296
|
+
/* @__PURE__ */ m("span", { children: c.showExplorer })
|
|
1294
1297
|
] }) }),
|
|
1295
|
-
/* @__PURE__ */ m("dialog", { ref: S, id: Z, className: "aqmx-sheet", "aria-label":
|
|
1296
|
-
/* @__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__ */ A("div", { className: "aqmx-sheet-panel", children: [
|
|
1299
|
+
/* @__PURE__ */ A("div", { className: "aqmx-sheet-header", children: [
|
|
1297
1300
|
/* @__PURE__ */ m("div", { ref: T, className: "aqmx-sheet-notice-slot" }),
|
|
1298
|
-
/* @__PURE__ */ m("button", { ref: C, type: "button", className: "aqmx-sheet-close", "aria-label":
|
|
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" }) })
|
|
1299
1302
|
] }),
|
|
1300
1303
|
/* @__PURE__ */ m("div", { className: "aqmx-sheet-body", children: /* @__PURE__ */ m(qe, { value: s, children: /* @__PURE__ */ m(it, { value: h, children: e }) }) }),
|
|
1301
1304
|
/* @__PURE__ */ m(qt, { holds: s, testId: "markdown-explorer-sheet-announcer" })
|
|
1302
1305
|
] }) })
|
|
1303
1306
|
] });
|
|
1304
|
-
}, Vr =
|
|
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]", Ur = (e, t) => {
|
|
1305
1308
|
for (const n of e.querySelectorAll(`[data-panel-id="${Ce}"] ${Fe}`)) if (n.getAttribute(se) === t) return n;
|
|
1306
1309
|
return null;
|
|
1307
1310
|
}, Xe = (e, t) => ({
|
|
@@ -1310,32 +1313,32 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1310
1313
|
}), Wr = (e, t) => {
|
|
1311
1314
|
const [n, r] = q(() => Xe(0, 0));
|
|
1312
1315
|
return I(() => {
|
|
1313
|
-
const o = e.current,
|
|
1314
|
-
if (o === null ||
|
|
1315
|
-
const l = { frame: o.getBoundingClientRect().width, rem:
|
|
1316
|
+
const o = e.current, c = t.current;
|
|
1317
|
+
if (o === null || c === null) throw new Error("[markdown-explorer] the split frame is not mounted");
|
|
1318
|
+
const l = { frame: o.getBoundingClientRect().width, rem: c.getBoundingClientRect().width }, a = () => {
|
|
1316
1319
|
const d = Xe(l.frame, l.rem);
|
|
1317
1320
|
r((u) => u.inlineSize === d.inlineSize && u.rootFontPixels === d.rootFontPixels ? u : d);
|
|
1318
1321
|
};
|
|
1319
1322
|
a();
|
|
1320
1323
|
const s = new ResizeObserver((d) => {
|
|
1321
1324
|
for (const u of d) {
|
|
1322
|
-
const [
|
|
1323
|
-
|
|
1325
|
+
const [i] = u.borderBoxSize;
|
|
1326
|
+
i !== void 0 && (u.target === o && (l.frame = i.inlineSize), u.target === c && (l.rem = i.inlineSize));
|
|
1324
1327
|
}
|
|
1325
1328
|
a();
|
|
1326
1329
|
});
|
|
1327
|
-
return s.observe(o), s.observe(
|
|
1330
|
+
return s.observe(o), s.observe(c), () => s.disconnect();
|
|
1328
1331
|
}, [e, t]), n;
|
|
1329
1332
|
}, ft = (e) => `aqmx-split-handle-${e}`, Xr = (e, { frameRef: t, sheetToggleRef: n, handleId: r }) => {
|
|
1330
|
-
const o = g(!1),
|
|
1333
|
+
const o = g(!1), c = g(null), l = g(!1);
|
|
1331
1334
|
I(() => {
|
|
1332
1335
|
const s = t.current;
|
|
1333
1336
|
if (s === null) throw new Error("[markdown-explorer] the split frame is not mounted");
|
|
1334
|
-
const d = (
|
|
1335
|
-
const f =
|
|
1336
|
-
o.current = f !== null && f.closest(`[data-panel-id="${mt}"]`) === null, !l.current && (
|
|
1337
|
-
}, u = (
|
|
1338
|
-
|
|
1337
|
+
const d = (i) => {
|
|
1338
|
+
const f = i.target instanceof Element ? i.target : null;
|
|
1339
|
+
o.current = f !== null && f.closest(`[data-panel-id="${mt}"]`) === null, !l.current && (c.current = f?.closest(`${Fe}[${se}]`)?.getAttribute(se) ?? null);
|
|
1340
|
+
}, u = (i) => {
|
|
1341
|
+
i.relatedTarget instanceof Node && !s.contains(i.relatedTarget) && (o.current = !1);
|
|
1339
1342
|
};
|
|
1340
1343
|
return s.addEventListener("focusin", d), s.addEventListener("focusout", u), () => {
|
|
1341
1344
|
s.removeEventListener("focusin", d), s.removeEventListener("focusout", u);
|
|
@@ -1348,8 +1351,8 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1348
1351
|
const s = t.current;
|
|
1349
1352
|
if (s === null || !o.current) return;
|
|
1350
1353
|
const d = (u) => {
|
|
1351
|
-
const { activeElement:
|
|
1352
|
-
if (
|
|
1354
|
+
const { activeElement: i, body: f } = s.ownerDocument;
|
|
1355
|
+
if (i !== null && i !== f) return;
|
|
1353
1356
|
const h = u.find((v) => v !== null);
|
|
1354
1357
|
if (h != null) {
|
|
1355
1358
|
l.current = !0;
|
|
@@ -1366,21 +1369,21 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1366
1369
|
}
|
|
1367
1370
|
queueMicrotask(() => {
|
|
1368
1371
|
if (a.current !== e || !o.current) return;
|
|
1369
|
-
const u =
|
|
1372
|
+
const u = c.current, i = `[data-panel-id="${Ce}"]`;
|
|
1370
1373
|
d([
|
|
1371
1374
|
u === null ? null : Ur(s, u),
|
|
1372
|
-
s.querySelector(`${
|
|
1373
|
-
s.querySelector(`${
|
|
1375
|
+
s.querySelector(`${i} ${jr}`),
|
|
1376
|
+
s.querySelector(`${i} ${Kr}`),
|
|
1374
1377
|
s.querySelector(`[data-resize-handle-id="${r}"]`)
|
|
1375
1378
|
]);
|
|
1376
1379
|
});
|
|
1377
1380
|
}, [e, t, n, r]);
|
|
1378
|
-
}, sa = ({ view: e, explorer: t, content: n, contentCoversPage: r = !1, sheetDismissals: o = 0, onDraggingChange:
|
|
1379
|
-
const l = g(null), [a, s] = q(null), d = g(null), u = g(null), { inlineSize:
|
|
1380
|
-
return Xr(h, { frameRef: l, sheetToggleRef: u, handleId: ft(e) }), /* @__PURE__ */
|
|
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 } = Wr(l, d), h = i !== null && i < It(f);
|
|
1383
|
+
return Xr(h, { frameRef: l, sheetToggleRef: u, handleId: ft(e) }), /* @__PURE__ */ A("div", { ref: l, className: "aqmx-split-frame", "data-aqmx-explorer-mode": h ? "sheet" : "split", children: [
|
|
1381
1384
|
/* @__PURE__ */ m("span", { ref: d, className: "aqmx-rem-probe", "aria-hidden": "true", "data-aqmx-rem-probe": "" }),
|
|
1382
1385
|
h ? /* @__PURE__ */ m(zr, { explorer: t, toggleRef: u, covered: r, onNoticeSlotChange: s, dismissals: o }) : null,
|
|
1383
|
-
/* @__PURE__ */ m(Vr, { value: h ? a : null, children: /* @__PURE__ */ m(Gr, { view: e, sheet: h, explorer: t, content: n, contentCoversPage: r, onDraggingChange:
|
|
1386
|
+
/* @__PURE__ */ m(Vr, { value: h ? a : null, children: /* @__PURE__ */ m(Gr, { view: e, sheet: h, explorer: t, content: n, contentCoversPage: r, onDraggingChange: c, explorerMinPixels: Dt(f) }) })
|
|
1384
1387
|
] });
|
|
1385
1388
|
}, Gr = ({
|
|
1386
1389
|
view: e,
|
|
@@ -1388,21 +1391,21 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1388
1391
|
explorer: n,
|
|
1389
1392
|
content: r,
|
|
1390
1393
|
contentCoversPage: o,
|
|
1391
|
-
onDraggingChange:
|
|
1394
|
+
onDraggingChange: c,
|
|
1392
1395
|
explorerMinPixels: l
|
|
1393
1396
|
}) => {
|
|
1394
|
-
const { viewSettings: a, labels: s } = D(), u = Ct((b) => e === "tree" ? b.treeExplorer : b.multiExplorer) ?? (e === "tree" ? $t : Zt),
|
|
1397
|
+
const { viewSettings: a, labels: s } = D(), u = Ct((b) => e === "tree" ? b.treeExplorer : b.multiExplorer) ?? (e === "tree" ? $t : Zt), i = g(null), f = g(null), h = g(!1), v = g(!1), [E, S] = q(!1), C = g(c);
|
|
1395
1398
|
I(() => {
|
|
1396
|
-
C.current =
|
|
1397
|
-
}, [
|
|
1399
|
+
C.current = c;
|
|
1400
|
+
}, [c]);
|
|
1398
1401
|
const T = w(() => {
|
|
1399
|
-
const b =
|
|
1402
|
+
const b = i.current;
|
|
1400
1403
|
if (b === null || b.length !== 2) return;
|
|
1401
|
-
const [R = 0, y = 0] = b,
|
|
1402
|
-
if (
|
|
1403
|
-
const H = Math.min(Be, R /
|
|
1404
|
+
const [R = 0, y = 0] = b, O = R + y;
|
|
1405
|
+
if (O <= 0 || R <= 0) return;
|
|
1406
|
+
const H = Math.min(Be, R / O * 100);
|
|
1404
1407
|
a.update(e === "tree" ? { treeExplorer: H } : { multiExplorer: H });
|
|
1405
|
-
}, [a, e]),
|
|
1408
|
+
}, [a, e]), L = w(() => {
|
|
1406
1409
|
f.current !== null && clearTimeout(f.current), f.current = setTimeout(() => {
|
|
1407
1410
|
f.current = null, T();
|
|
1408
1411
|
}, Ht);
|
|
@@ -1415,22 +1418,22 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1415
1418
|
);
|
|
1416
1419
|
const Z = $r(), M = w(
|
|
1417
1420
|
(b, R) => {
|
|
1418
|
-
|
|
1419
|
-
const [y = 0,
|
|
1420
|
-
b.length === 2 &&
|
|
1421
|
+
i.current = b;
|
|
1422
|
+
const [y = 0, O = 0] = b;
|
|
1423
|
+
b.length === 2 && O > 0 && S(y <= 0), R.source === "keyboard" ? L() : R.source === "pointer" && (h.current = !0);
|
|
1421
1424
|
},
|
|
1422
|
-
[
|
|
1423
|
-
),
|
|
1425
|
+
[L]
|
|
1426
|
+
), k = w(
|
|
1424
1427
|
(b) => {
|
|
1425
|
-
if (v.current = b,
|
|
1428
|
+
if (v.current = b, c?.(b), b) {
|
|
1426
1429
|
h.current = !1;
|
|
1427
1430
|
return;
|
|
1428
1431
|
}
|
|
1429
|
-
h.current && (h.current = !1,
|
|
1432
|
+
h.current && (h.current = !1, L());
|
|
1430
1433
|
},
|
|
1431
|
-
[
|
|
1434
|
+
[c, L]
|
|
1432
1435
|
);
|
|
1433
|
-
return /* @__PURE__ */
|
|
1436
|
+
return /* @__PURE__ */ A(Xt, { id: `aqmx-split-${e}`, direction: "horizontal", onLayout: M, className: "aqmx-split", "data-aqmx-split": e, children: [
|
|
1434
1437
|
t ? null : /* @__PURE__ */ m(
|
|
1435
1438
|
ze,
|
|
1436
1439
|
{
|
|
@@ -1453,7 +1456,7 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1453
1456
|
indicator: { visible: !0, thickness: ve.gripThickness, length: ve.gripLength, barThickness: ve.barThickness, barLength: ve.barLength },
|
|
1454
1457
|
title: s.resizeExplorer,
|
|
1455
1458
|
"aria-label": s.resizeExplorer,
|
|
1456
|
-
onDragging:
|
|
1459
|
+
onDragging: k,
|
|
1457
1460
|
inert: o,
|
|
1458
1461
|
className: "aqmx-split-handle"
|
|
1459
1462
|
}
|
|
@@ -1462,7 +1465,7 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1462
1465
|
] });
|
|
1463
1466
|
};
|
|
1464
1467
|
export {
|
|
1465
|
-
|
|
1468
|
+
Le as E,
|
|
1466
1469
|
Vr as S,
|
|
1467
1470
|
sa as a,
|
|
1468
1471
|
oa as b
|