@aiquants/markdown-explorer 0.34.0 → 0.36.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 +608 -0
- package/README.md +121 -41
- package/dist/EditSurface-B70iRFkG.cjs +6 -0
- package/dist/EditSurface-BCFJRyIM.js +990 -0
- package/dist/ExplorerSplit-BNrHrIus.cjs +2 -0
- package/dist/ExplorerSplit-Bgccz2nm.js +1589 -0
- package/dist/MultiLayout-Bo9LAXiY.cjs +1 -0
- package/dist/{MultiLayout-kcZyVnvK.js → MultiLayout-Dy5TIC2t.js} +249 -248
- package/dist/{NativeScrollBar-pUbA4Zq3.cjs → NativeScrollBar-Bj-LKej0.cjs} +1 -1
- package/dist/{NativeScrollBar-UNed10Na.js → NativeScrollBar-DpZMYhmf.js} +2 -2
- package/dist/TreeLayout-DsSKW_Qj.js +103 -0
- package/dist/TreeLayout-T8sc_wg7.cjs +1 -0
- package/dist/client/MarkdownExplorer.d.cts +14 -1
- package/dist/client/MarkdownExplorer.d.ts +14 -1
- package/dist/client/edit/lineEndings.d.cts +4 -0
- package/dist/client/edit/lineEndings.d.ts +4 -0
- package/dist/client/hostContract.d.cts +67 -0
- package/dist/client/hostContract.d.ts +67 -0
- package/dist/core/config.d.cts +13 -0
- package/dist/core/config.d.ts +13 -0
- package/dist/core/contracts.d.cts +31 -4
- package/dist/core/contracts.d.ts +31 -4
- package/dist/core/dataRoute.d.cts +5 -1
- package/dist/core/dataRoute.d.ts +5 -1
- package/dist/core/documentId.d.cts +6 -0
- package/dist/core/documentId.d.ts +6 -0
- package/dist/core/draftAnswer.d.cts +23 -0
- package/dist/core/draftAnswer.d.ts +23 -0
- package/dist/core/labels.d.cts +78 -0
- package/dist/core/labels.d.ts +78 -0
- package/dist/core/location.d.cts +22 -2
- package/dist/core/location.d.ts +22 -2
- package/dist/core/ownUrls.d.cts +15 -0
- package/dist/core/ownUrls.d.ts +15 -0
- package/dist/core/treeSettings.d.cts +3 -2
- package/dist/core/treeSettings.d.ts +3 -2
- package/dist/core/viewSettings.d.cts +3 -1
- package/dist/core/viewSettings.d.ts +3 -1
- package/dist/describeValue-CLlVRO8d.js +17 -0
- package/dist/describeValue-Ccvhbt36.cjs +1 -0
- package/dist/explorerCore-B3RGmMG6.js +1083 -0
- package/dist/explorerCore-CUkyKtm8.cjs +1 -0
- package/dist/index-D0l_BJqb.js +5980 -0
- package/dist/index-lpL7GltU.cjs +18 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +8 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.js +53 -43
- package/dist/licenses/@heroicons/react/LICENSE +21 -0
- package/dist/licenses/entities/LICENSE +11 -0
- package/dist/licenses/parse5/LICENSE +19 -0
- package/dist/location-Dh6K-y7w.js +761 -0
- package/dist/location-DrOP6t1F.cjs +1 -0
- package/dist/lru-DC8GBmkX.js +39 -0
- package/dist/lru-SGmUyBQU.cjs +1 -0
- package/dist/{merge-C1MWvhCS.js → merge-BwcqBd4c.js} +1 -1
- package/dist/{merge-BziXxZkE.cjs → merge-Dckw7r9T.cjs} +1 -1
- package/dist/nestingGuardWorker.js +5511 -0
- package/dist/ownUrls-BTPGNhBt.cjs +1 -0
- package/dist/ownUrls-DD0cSCsF.js +409 -0
- package/dist/sanitizeJob-BYqzjFJC.js +21 -0
- package/dist/sanitizeJob-CudE1RUP.cjs +1 -0
- package/dist/sanitizePolicy-C-ehd0J_.cjs +2 -0
- package/dist/sanitizePolicy-DAPnUUVm.js +139 -0
- package/dist/sanitizeWorker.cjs +1 -1
- package/dist/sanitizeWorker.js +134 -139
- package/dist/sanitizerService-B8v4ap9t.js +240 -0
- package/dist/sanitizerService-DomN7lwC.cjs +1 -0
- package/dist/server/assetResponse.d.cts +60 -0
- package/dist/server/assetResponse.d.ts +60 -0
- package/dist/server/browser/browserPlatform.d.cts +12 -0
- package/dist/server/browser/browserPlatform.d.ts +12 -0
- package/dist/server/createMarkdownExplorer.d.cts +0 -10
- package/dist/server/createMarkdownExplorer.d.ts +0 -10
- package/dist/server/errors.d.cts +1 -1
- package/dist/server/errors.d.ts +1 -1
- package/dist/server/explorerCore.d.cts +12 -0
- package/dist/server/explorerCore.d.ts +12 -0
- package/dist/server/fileSystemSource.d.cts +1 -0
- package/dist/server/fileSystemSource.d.ts +1 -0
- package/dist/server/inProcessFetch.d.cts +5 -0
- package/dist/server/inProcessFetch.d.ts +5 -0
- package/dist/server/platform.d.cts +18 -0
- package/dist/server/platform.d.ts +18 -0
- package/dist/server/ports.d.cts +55 -5
- package/dist/server/ports.d.ts +55 -5
- package/dist/server/sanitizeProtocol.d.cts +3 -0
- package/dist/server/sanitizeProtocol.d.ts +3 -0
- package/dist/server/sanitizer.d.cts +5 -40
- package/dist/server/sanitizer.d.ts +5 -40
- package/dist/server/sanitizerOptions.d.cts +24 -0
- package/dist/server/sanitizerOptions.d.ts +24 -0
- package/dist/server/sanitizerService.d.cts +41 -0
- package/dist/server/sanitizerService.d.ts +41 -0
- package/dist/server/{workerPool.d.cts → workerJobs.d.cts} +0 -16
- package/dist/server/{workerPool.d.ts → workerJobs.d.ts} +0 -16
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +3 -1
- package/dist/server.d.ts +3 -1
- package/dist/server.js +270 -1343
- package/dist/serverBrowser.cjs +1 -0
- package/dist/serverBrowser.d.cts +1 -0
- package/dist/serverBrowser.d.ts +1 -0
- package/dist/serverBrowser.js +120 -0
- package/dist/serverCore.cjs +1 -0
- package/dist/serverCore.d.cts +14 -0
- package/dist/serverCore.d.ts +14 -0
- package/dist/serverCore.js +46 -0
- package/dist/storage-BpYsprog.cjs +1 -0
- package/dist/{storage-CmGHg7OA.js → storage-D1uSw-xj.js} +19 -18
- package/dist/storage.cjs +1 -1
- package/dist/storage.js +1 -1
- package/dist/styles/markdown-explorer.css +1 -1
- package/dist/{tapScrollCircle-DigcJCsu.cjs → tapScrollCircle-DyLInGck.cjs} +1 -1
- package/dist/{tapScrollCircle-D_BpaLwY.js → tapScrollCircle-smKLgRa2.js} +1 -1
- package/dist/testing.cjs +1 -0
- package/dist/testing.d.cts +11 -0
- package/dist/testing.d.ts +11 -0
- package/dist/testing.js +82 -0
- package/dist/useSplitPersistence-BUa_KMsV.cjs +1 -0
- package/dist/useSplitPersistence-pnb21dsr.js +44 -0
- package/docs/behavior/dom-hooks.md +5 -1
- package/docs/behavior/hosting.md +123 -0
- package/docs/behavior/layout.md +5 -3
- package/docs/behavior/localization.md +25 -8
- package/docs/behavior/security.md +55 -15
- package/docs/behavior/url-contract.md +30 -3
- package/package.json +48 -10
- package/dist/EditSurface-CF82jZQg.cjs +0 -6
- package/dist/EditSurface-CqHk2R3k.js +0 -982
- package/dist/ExplorerSplit-D325YGEf.cjs +0 -1
- package/dist/ExplorerSplit-DGH9bckm.js +0 -1500
- package/dist/MultiLayout-CzR7yJ0m.cjs +0 -1
- package/dist/TreeLayout-BnIU87HX.js +0 -96
- package/dist/TreeLayout-DtvIpuOe.cjs +0 -1
- package/dist/dataRoute-D6KiSHIc.js +0 -298
- package/dist/dataRoute-DwYtgyt6.cjs +0 -1
- package/dist/index-BDCbvHDs.cjs +0 -15
- package/dist/index-DR31S_-4.js +0 -5012
- package/dist/location-C44b9H1S.js +0 -676
- package/dist/location-hGLhCCg4.cjs +0 -1
- package/dist/sanitizePolicy-CwvyPpp5.js +0 -98
- package/dist/sanitizePolicy-T5T-3vV5.cjs +0 -1
- package/dist/storage-DM0EvkVf.cjs +0 -1
- package/dist/useSplitPersistence-DCeYbJMx.js +0 -38
- package/dist/useSplitPersistence-QGcvyMAa.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),T=require("@aiquants/virtualscroll"),S=require("react"),u=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),T=require("@aiquants/virtualscroll"),S=require("react"),u=require("./index-lpL7GltU.cjs"),d=require("./tapScrollCircle-DyLInGck.cjs"),v=e=>({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight}),m=(e,t)=>e.scrollTop===t.scrollTop&&e.scrollHeight===t.scrollHeight&&e.clientHeight===t.clientHeight,g=e=>{let t=v(e);return{getSnapshot:()=>t,subscribe:s=>{const o=()=>{const a=v(e);m(t,a)||(t=a,s())};let n=0;const c=()=>{n===0&&(n=requestAnimationFrame(()=>{n=0,o()}))},r=typeof ResizeObserver>"u"?null:new ResizeObserver(c),l=()=>{if(r!==null){r.disconnect(),r.observe(e);for(const a of e.children)r.observe(a)}};l();const i=typeof MutationObserver>"u"?null:new MutationObserver(()=>{l(),c()});return i?.observe(e,{childList:!0}),e.addEventListener("scroll",o,{passive:!0}),o(),()=>{e.removeEventListener("scroll",o),i?.disconnect(),r?.disconnect(),cancelAnimationFrame(n)}}}},b=e=>{const t=S.useMemo(()=>g(e),[e]);return S.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot)},h=(e,t)=>{const s=typeof t=="function"?t(e.scrollTop):t;return e.scrollTo({top:s,behavior:"instant"}),e.scrollTop},f=({scroller:e,kind:t})=>{const{locale:s}=u.useExplorer(),o=u.useCoarsePointer(),{scrollTop:n,scrollHeight:c,clientHeight:r}=b(e),l=S.useCallback(i=>h(e,i),[e]);return p.jsx("div",{className:"aqmx-native-scroll-bar",children:p.jsx(T.ScrollBar,{contentSize:c,viewportSize:r,scrollPosition:n,onScroll:l,scrollBarWidth:u.NATIVE_SCROLL_BAR_WIDTH,...u.scrollBarControlsFor(o),enableArrowButtonTabStops:!1,tapScrollCircleOptions:t==="content"?d.tapScrollCircleFor(o):d.NO_TAP_SCROLL_CIRCLE,locale:s})})};exports.NativeScrollBar=f;exports.scrollScrollerTo=h;exports.useScrollerMetrics=b;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as u } from "react/jsx-runtime";
|
|
2
2
|
import { ScrollBar as m } from "@aiquants/virtualscroll";
|
|
3
3
|
import { useCallback as S, useMemo as d, useSyncExternalStore as h } from "react";
|
|
4
|
-
import { u as b, c as v, N as f, s as T } from "./index-
|
|
5
|
-
import { NO_TAP_SCROLL_CIRCLE as g, tapScrollCircleFor as H } from "./tapScrollCircle-
|
|
4
|
+
import { u as b, c as v, N as f, s as T } from "./index-D0l_BJqb.js";
|
|
5
|
+
import { NO_TAP_SCROLL_CIRCLE as g, tapScrollCircleFor as H } from "./tapScrollCircle-smKLgRa2.js";
|
|
6
6
|
const p = (e) => ({ scrollTop: e.scrollTop, scrollHeight: e.scrollHeight, clientHeight: e.clientHeight }), C = (e, t) => e.scrollTop === t.scrollTop && e.scrollHeight === t.scrollHeight && e.clientHeight === t.clientHeight, O = (e) => {
|
|
7
7
|
let t = p(e);
|
|
8
8
|
return {
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx as h, jsxs as j } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as d, useMemo as v, useEffect as g, useSyncExternalStore as q, useState as H, useRef as U, useLayoutEffect as $ } from "react";
|
|
3
|
+
import { useLocation as B } from "react-router";
|
|
4
|
+
import { e as f, c as Y } from "./location-Dh6K-y7w.js";
|
|
5
|
+
import { u as S, f as R, r as J, F as K, g as Q, h as V, i as W, D as X, P as Z, j as I } from "./index-D0l_BJqb.js";
|
|
6
|
+
import { isMaximizeEscape as ee } from "@aiquants/drag-drop-panels";
|
|
7
|
+
import { l as te } from "./ownUrls-DD0cSCsF.js";
|
|
8
|
+
import { E as ne, a as re, b as se } from "./ExplorerSplit-Bgccz2nm.js";
|
|
9
|
+
const ae = (e) => {
|
|
10
|
+
const { config: r, labels: n, announcer: t } = S(), c = R(), s = d(() => {
|
|
11
|
+
const u = e.doc !== null ? e.doc : e.folder;
|
|
12
|
+
if (u === null) throw new RangeError("[markdown-explorer] a tree view without a document or a folder has nothing to maximize");
|
|
13
|
+
c(f(r, { ...e, maximized: !e.maximized }), "browse");
|
|
14
|
+
const a = te(u);
|
|
15
|
+
t.announce(e.maximized ? n.documentRestored(a) : n.documentMaximized(a));
|
|
16
|
+
}, [r, c, e, t, n]);
|
|
17
|
+
return v(() => ({ maximized: e.maximized, toggle: s }), [e.maximized, s]);
|
|
18
|
+
}, oe = (e, r) => {
|
|
19
|
+
g(() => {
|
|
20
|
+
if (!e) return;
|
|
21
|
+
const n = (t) => {
|
|
22
|
+
ee(t) && (t.preventDefault(), r());
|
|
23
|
+
};
|
|
24
|
+
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
25
|
+
}, [e, r]);
|
|
26
|
+
}, ue = (e, r) => e.claim !== r.claim || e.readme.status !== r.readme.status ? !1 : e.readme.status === "failed" && r.readme.status === "failed" ? e.readme.failure === r.readme.failure : e.readme.status === "ok" && r.readme.status === "ok" ? e.readme.readme === r.readme.readme : !0, ie = (e, r, n) => {
|
|
27
|
+
let t = null;
|
|
28
|
+
return () => {
|
|
29
|
+
const c = e.version(), s = e.read(r), u = s.status !== "pending";
|
|
30
|
+
if (t !== null && t.version === c && t.tree === s && t.settled === u) return t.state;
|
|
31
|
+
const a = J(e, r, n), o = t !== null && ue(t.state, a) ? t.state : a;
|
|
32
|
+
return t = { version: c, tree: s, settled: u, state: o }, o;
|
|
33
|
+
};
|
|
34
|
+
}, ce = (e, r, n) => {
|
|
35
|
+
let t = !0, c = null;
|
|
36
|
+
const s = () => {
|
|
37
|
+
t && n();
|
|
38
|
+
}, u = () => {
|
|
39
|
+
const o = e.read(r);
|
|
40
|
+
o === c || o.status !== "pending" || (c = o, o.then(s, s));
|
|
41
|
+
};
|
|
42
|
+
u();
|
|
43
|
+
const a = e.subscribe(() => {
|
|
44
|
+
u(), n();
|
|
45
|
+
});
|
|
46
|
+
return () => {
|
|
47
|
+
t = !1, a();
|
|
48
|
+
};
|
|
49
|
+
}, le = () => K, me = (e, r) => {
|
|
50
|
+
const { trees: n } = S(), t = v(() => r === null ? null : ie(n, e, r), [n, e, r]), c = d((m) => t === null ? () => {
|
|
51
|
+
} : ce(n, e, m), [t, n, e]), s = d(() => t === null ? null : t(), [t]), u = d(() => t === null ? null : le(), [t]), a = q(c, s, u), o = a?.claim === !0;
|
|
52
|
+
return g(() => r === null ? void 0 : n.open(e), [n, e, r]), g(() => r === null || !o ? void 0 : n.claimChildren(e, /* @__PURE__ */ new Map([[r, "direct"]])), [n, e, r, o]), a === null ? null : a.readme;
|
|
53
|
+
}, de = /* @__PURE__ */ new Set(), pe = Object.freeze({ kind: "loading" }), fe = (e, r) => r.status === "loading" ? pe : r.status === "failed" ? { kind: "failure", folder: e, failure: r.failure, onRetry: r.retry } : { kind: "no-readme", folder: e }, be = ({ location: e, opening: r }) => {
|
|
54
|
+
const { config: n } = S(), t = R(), { hash: c } = B(), { source: s, doc: u, folder: a, overrides: o, markup: m, maximized: p } = e, [k, M] = H(ne), N = v(() => ({ gathered: k, onGatheredChange: M }), [k]), w = me(s, a), l = w === null ? u : w.status === "ok" ? w.readme : null, b = v(() => r !== null ? r : a === null || w === null ? Q : fe(a, w), [r, a, w]), E = p && (l !== null || b.kind === "loading"), P = d((i) => t(f(n, { view: "tree", source: s, doc: i, overrides: o }), "browse"), [t, n, s, o]), F = d((i) => t(f(n, { view: "tree", source: s, folder: i, overrides: o }), "browse"), [t, n, s, o]), T = d(
|
|
55
|
+
(i) => {
|
|
56
|
+
const x = i.kind === "folder" ? { folder: i.path } : i.kind === "document" ? { doc: i.path } : {};
|
|
57
|
+
t(f(n, { view: "tree", source: s, ...x, overrides: o }), "close-folder");
|
|
58
|
+
},
|
|
59
|
+
[t, n, s, o]
|
|
60
|
+
), C = d((i) => t(f(n, { view: "tree", source: i, doc: u, folder: a, overrides: o, markup: m, maximized: p }), "switch-source"), [t, n, u, a, o, m, p]), L = d((i) => t(`${f(n, { view: "tree", source: i, doc: u, folder: a, overrides: o, markup: m, maximized: p })}${c}`, "browse"), [t, n, u, a, o, m, p, c]), _ = d(
|
|
61
|
+
(i) => {
|
|
62
|
+
const x = Y(n, i);
|
|
63
|
+
t(f(n, { view: "multi", source: s, docs: x, markup: m && l !== null && x.includes(l) ? [l] : [] }), "switch-view");
|
|
64
|
+
},
|
|
65
|
+
[t, n, s, l, m]
|
|
66
|
+
), y = v(() => ({ href: f(n, l === null ? { view: "multi", source: s } : { view: "multi", source: s, docs: [l], markup: m ? [l] : [] }), target: "multi" }), [n, s, l, m]), z = U(p);
|
|
67
|
+
$(() => {
|
|
68
|
+
z.current = p;
|
|
69
|
+
}, [p]);
|
|
70
|
+
const O = d(() => z.current, []), A = v(() => ({ kind: "page", view: "tree", overrides: o, embed: {}, maximized: O }), [o, O]), G = V(e), D = ae(e);
|
|
71
|
+
return oe(E, D.toggle), /* @__PURE__ */ h(
|
|
72
|
+
re,
|
|
73
|
+
{
|
|
74
|
+
view: "tree",
|
|
75
|
+
contentCoversPage: E,
|
|
76
|
+
explorer: /* @__PURE__ */ h(
|
|
77
|
+
se,
|
|
78
|
+
{
|
|
79
|
+
mode: "tree",
|
|
80
|
+
sourceId: s,
|
|
81
|
+
currentPath: a === null ? u : a,
|
|
82
|
+
openPaths: de,
|
|
83
|
+
onOpenDocument: P,
|
|
84
|
+
onOpenFolder: F,
|
|
85
|
+
onCloseFolder: T,
|
|
86
|
+
currentFolder: a !== null,
|
|
87
|
+
onSourceChange: C,
|
|
88
|
+
onRevealSource: L,
|
|
89
|
+
viewSwitch: y,
|
|
90
|
+
tray: N,
|
|
91
|
+
onOpenSelection: _
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
content: /* @__PURE__ */ j("div", { className: "aqmx-document-column aqmx-tree-document", "data-aqmx-maximized": E ? "true" : "false", ...W, children: [
|
|
95
|
+
l === null ? null : /* @__PURE__ */ h(X, { path: l, placement: Z, markup: G, maximize: D }),
|
|
96
|
+
/* @__PURE__ */ h(I, { path: l, absence: b, markup: m, variant: A })
|
|
97
|
+
] })
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
be as TreeLayout
|
|
103
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),o=require("react"),H=require("react-router"),x=require("./location-DrOP6t1F.cjs"),d=require("./index-lpL7GltU.cjs"),_=require("@aiquants/drag-drop-panels"),j=require("./ownUrls-BTPGNhBt.cjs"),k=require("./ExplorerSplit-BNrHrIus.cjs"),A=e=>{const{config:r,labels:n,announcer:t}=d.useExplorer(),i=d.useExplorerNavigate(),s=o.useCallback(()=>{const u=e.doc!==null?e.doc:e.folder;if(u===null)throw new RangeError("[markdown-explorer] a tree view without a document or a folder has nothing to maximize");i(x.explorerHref(r,{...e,maximized:!e.maximized}),"browse");const a=j.lastPathSegment(u);t.announce(e.maximized?n.documentRestored(a):n.documentMaximized(a))},[r,i,e,t,n]);return o.useMemo(()=>({maximized:e.maximized,toggle:s}),[e.maximized,s])},G=(e,r)=>{o.useEffect(()=>{if(!e)return;const n=t=>{_.isMaximizeEscape(t)&&(t.preventDefault(),r())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e,r])},U=(e,r)=>e.claim!==r.claim||e.readme.status!==r.readme.status?!1:e.readme.status==="failed"&&r.readme.status==="failed"?e.readme.failure===r.readme.failure:e.readme.status==="ok"&&r.readme.status==="ok"?e.readme.readme===r.readme.readme:!0,B=(e,r,n)=>{let t=null;return()=>{const i=e.version(),s=e.read(r),u=s.status!=="pending";if(t!==null&&t.version===i&&t.tree===s&&t.settled===u)return t.state;const a=d.readFolderReadme(e,r,n),l=t!==null&&U(t.state,a)?t.state:a;return t={version:i,tree:s,settled:u,state:l},l}},Y=(e,r,n)=>{let t=!0,i=null;const s=()=>{t&&n()},u=()=>{const l=e.read(r);l===i||l.status!=="pending"||(i=l,l.then(s,s))};u();const a=e.subscribe(()=>{u(),n()});return()=>{t=!1,a()}},J=()=>d.FOLDER_README_LOADING,K=(e,r)=>{const{trees:n}=d.useExplorer(),t=o.useMemo(()=>r===null?null:B(n,e,r),[n,e,r]),i=o.useCallback(p=>t===null?()=>{}:Y(n,e,p),[t,n,e]),s=o.useCallback(()=>t===null?null:t(),[t]),u=o.useCallback(()=>t===null?null:J(),[t]),a=o.useSyncExternalStore(i,s,u),l=a?.claim===!0;return o.useEffect(()=>r===null?void 0:n.open(e),[n,e,r]),o.useEffect(()=>r===null||!l?void 0:n.claimChildren(e,new Map([[r,"direct"]])),[n,e,r,l]),a===null?null:a.readme},Q=new Set,V=Object.freeze({kind:"loading"}),W=(e,r)=>r.status==="loading"?V:r.status==="failed"?{kind:"failure",folder:e,failure:r.failure,onRetry:r.retry}:{kind:"no-readme",folder:e},X=({location:e,opening:r})=>{const{config:n}=d.useExplorer(),t=d.useExplorerNavigate(),{hash:i}=H.useLocation(),{source:s,doc:u,folder:a,overrides:l,markup:p,maximized:f}=e,[g,M]=o.useState(k.EMPTY_SELECTION),O=o.useMemo(()=>({gathered:g,onGatheredChange:M}),[g]),w=K(s,a),m=w===null?u:w.status==="ok"?w.readme:null,h=o.useMemo(()=>r!==null?r:a===null||w===null?d.NO_DOCUMENT:W(a,w),[r,a,w]),b=f&&(m!==null||h.kind==="loading"),R=o.useCallback(c=>t(x.explorerHref(n,{view:"tree",source:s,doc:c,overrides:l}),"browse"),[t,n,s,l]),D=o.useCallback(c=>t(x.explorerHref(n,{view:"tree",source:s,folder:c,overrides:l}),"browse"),[t,n,s,l]),N=o.useCallback(c=>{const E=c.kind==="folder"?{folder:c.path}:c.kind==="document"?{doc:c.path}:{};t(x.explorerHref(n,{view:"tree",source:s,...E,overrides:l}),"close-folder")},[t,n,s,l]),P=o.useCallback(c=>t(x.explorerHref(n,{view:"tree",source:c,doc:u,folder:a,overrides:l,markup:p,maximized:f}),"switch-source"),[t,n,u,a,l,p,f]),T=o.useCallback(c=>t(`${x.explorerHref(n,{view:"tree",source:c,doc:u,folder:a,overrides:l,markup:p,maximized:f})}${i}`,"browse"),[t,n,u,a,l,p,f,i]),q=o.useCallback(c=>{const E=x.canonicalMultiDocuments(n,c);t(x.explorerHref(n,{view:"multi",source:s,docs:E,markup:p&&m!==null&&E.includes(m)?[m]:[]}),"switch-view")},[t,n,s,m,p]),y=o.useMemo(()=>({href:x.explorerHref(n,m===null?{view:"multi",source:s}:{view:"multi",source:s,docs:[m],markup:p?[m]:[]}),target:"multi"}),[n,s,m,p]),S=o.useRef(f);o.useLayoutEffect(()=>{S.current=f},[f]);const C=o.useCallback(()=>S.current,[]),F=o.useMemo(()=>({kind:"page",view:"tree",overrides:l,embed:{},maximized:C}),[l,C]),L=d.usePageMarkupToggle(e),z=A(e);return G(b,z.toggle),v.jsx(k.ExplorerSplit,{view:"tree",contentCoversPage:b,explorer:v.jsx(k.ExplorerPane,{mode:"tree",sourceId:s,currentPath:a===null?u:a,openPaths:Q,onOpenDocument:R,onOpenFolder:D,onCloseFolder:N,currentFolder:a!==null,onSourceChange:P,onRevealSource:T,viewSwitch:y,tray:O,onOpenSelection:q}),content:v.jsxs("div",{className:"aqmx-document-column aqmx-tree-document","data-aqmx-maximized":b?"true":"false",...d.CONTENT_PANE,children:[m===null?null:v.jsx(d.DocumentRefreshBar,{path:m,placement:d.PAGE_DOCUMENT_REFRESH,markup:L,maximize:z}),v.jsx(d.DocumentPane,{path:m,absence:h,markup:p,variant:F})]})})};exports.TreeLayout=X;
|
|
@@ -4,6 +4,7 @@ import { ExplorerConfig, ExplorerView } from "../core/config.cjs";
|
|
|
4
4
|
import { ExplorerDraftConverter, ExplorerFailure, ExplorerPageData } from "../core/contracts.cjs";
|
|
5
5
|
import { MarkdownExplorerLabelOverrides, MarkdownExplorerLocale } from "../core/labels.cjs";
|
|
6
6
|
import { ExplorerTheme } from "../core/theme.cjs";
|
|
7
|
+
import { ExplorerAccountState, ExplorerDraftChange, ExplorerHostChange, ExplorerHostChangePolicy, MarkdownExplorerHandle } from "./hostContract.cjs";
|
|
7
8
|
export type ExplorerFrameRenderer = (frame: {
|
|
8
9
|
readonly view: ExplorerView;
|
|
9
10
|
readonly children: ReactNode;
|
|
@@ -21,8 +22,20 @@ export type MarkdownExplorerProps = {
|
|
|
21
22
|
readonly onMathDiagnostics?: (path: string, diagnostics: readonly MarkdownMathDiagnostic[]) => void;
|
|
22
23
|
readonly onEditGrant?: (href: string) => Promise<boolean>;
|
|
23
24
|
readonly draftConverter?: ExplorerDraftConverter;
|
|
25
|
+
readonly fetch?: typeof fetch;
|
|
26
|
+
readonly persistSettings?: (serialized: string) => void;
|
|
27
|
+
readonly subscribeHostChanges?: (listener: (change: ExplorerHostChange) => void) => () => void;
|
|
28
|
+
readonly hostChangePolicy?: ExplorerHostChangePolicy;
|
|
29
|
+
readonly ref?: Ref<MarkdownExplorerHandle>;
|
|
30
|
+
readonly guardUnload?: boolean;
|
|
31
|
+
readonly onReload?: () => void;
|
|
32
|
+
readonly onSessionEnded?: () => Promise<boolean>;
|
|
33
|
+
readonly onDraftChange?: (change: ExplorerDraftChange) => void;
|
|
34
|
+
readonly accountState?: ExplorerAccountState;
|
|
35
|
+
readonly confirmUnversionedSaves?: boolean;
|
|
36
|
+
readonly paletteKey?: string;
|
|
24
37
|
};
|
|
25
|
-
export declare const MarkdownExplorer: ({ data: pageData, config, storageNamespace, locale: localeProp, labels: labelOverrides, theme: themeProp, renderFrame, renderTreeFailure, lockDocumentScroll, onMathDiagnostics, onEditGrant, draftConverter: draftConverterProp, }: MarkdownExplorerProps) => ReactElement;
|
|
38
|
+
export declare const MarkdownExplorer: ({ data: pageData, config, storageNamespace, locale: localeProp, labels: labelOverrides, theme: themeProp, renderFrame, renderTreeFailure, lockDocumentScroll, onMathDiagnostics, onEditGrant, draftConverter: draftConverterProp, fetch: fetchProp, persistSettings, subscribeHostChanges, hostChangePolicy, ref, guardUnload, onReload: onReloadProp, onSessionEnded: onSessionEndedProp, onDraftChange, accountState, confirmUnversionedSaves, paletteKey, }: MarkdownExplorerProps) => ReactElement;
|
|
26
39
|
export type ExplorerRootProps = {
|
|
27
40
|
readonly ref?: Ref<HTMLDivElement>;
|
|
28
41
|
readonly theme: ExplorerTheme;
|
|
@@ -4,6 +4,7 @@ import { ExplorerConfig, ExplorerView } from "../core/config.js";
|
|
|
4
4
|
import { ExplorerDraftConverter, ExplorerFailure, ExplorerPageData } from "../core/contracts.js";
|
|
5
5
|
import { MarkdownExplorerLabelOverrides, MarkdownExplorerLocale } from "../core/labels.js";
|
|
6
6
|
import { ExplorerTheme } from "../core/theme.js";
|
|
7
|
+
import { ExplorerAccountState, ExplorerDraftChange, ExplorerHostChange, ExplorerHostChangePolicy, MarkdownExplorerHandle } from "./hostContract.js";
|
|
7
8
|
export type ExplorerFrameRenderer = (frame: {
|
|
8
9
|
readonly view: ExplorerView;
|
|
9
10
|
readonly children: ReactNode;
|
|
@@ -21,8 +22,20 @@ export type MarkdownExplorerProps = {
|
|
|
21
22
|
readonly onMathDiagnostics?: (path: string, diagnostics: readonly MarkdownMathDiagnostic[]) => void;
|
|
22
23
|
readonly onEditGrant?: (href: string) => Promise<boolean>;
|
|
23
24
|
readonly draftConverter?: ExplorerDraftConverter;
|
|
25
|
+
readonly fetch?: typeof fetch;
|
|
26
|
+
readonly persistSettings?: (serialized: string) => void;
|
|
27
|
+
readonly subscribeHostChanges?: (listener: (change: ExplorerHostChange) => void) => () => void;
|
|
28
|
+
readonly hostChangePolicy?: ExplorerHostChangePolicy;
|
|
29
|
+
readonly ref?: Ref<MarkdownExplorerHandle>;
|
|
30
|
+
readonly guardUnload?: boolean;
|
|
31
|
+
readonly onReload?: () => void;
|
|
32
|
+
readonly onSessionEnded?: () => Promise<boolean>;
|
|
33
|
+
readonly onDraftChange?: (change: ExplorerDraftChange) => void;
|
|
34
|
+
readonly accountState?: ExplorerAccountState;
|
|
35
|
+
readonly confirmUnversionedSaves?: boolean;
|
|
36
|
+
readonly paletteKey?: string;
|
|
24
37
|
};
|
|
25
|
-
export declare const MarkdownExplorer: ({ data: pageData, config, storageNamespace, locale: localeProp, labels: labelOverrides, theme: themeProp, renderFrame, renderTreeFailure, lockDocumentScroll, onMathDiagnostics, onEditGrant, draftConverter: draftConverterProp, }: MarkdownExplorerProps) => ReactElement;
|
|
38
|
+
export declare const MarkdownExplorer: ({ data: pageData, config, storageNamespace, locale: localeProp, labels: labelOverrides, theme: themeProp, renderFrame, renderTreeFailure, lockDocumentScroll, onMathDiagnostics, onEditGrant, draftConverter: draftConverterProp, fetch: fetchProp, persistSettings, subscribeHostChanges, hostChangePolicy, ref, guardUnload, onReload: onReloadProp, onSessionEnded: onSessionEndedProp, onDraftChange, accountState, confirmUnversionedSaves, paletteKey, }: MarkdownExplorerProps) => ReactElement;
|
|
26
39
|
export type ExplorerRootProps = {
|
|
27
40
|
readonly ref?: Ref<HTMLDivElement>;
|
|
28
41
|
readonly theme: ExplorerTheme;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ExplorerFailureReason } from "../core/contracts.cjs";
|
|
2
|
+
import { LineEnding } from "./edit/lineEndings.cjs";
|
|
3
|
+
export type MarkdownExplorerHandle = {
|
|
4
|
+
readonly flushUnsaved: () => readonly string[];
|
|
5
|
+
readonly confirmDiscard: (paths: readonly string[]) => Promise<boolean>;
|
|
6
|
+
readonly restoreDrafts: (drafts: readonly ExplorerUnsavedDraft[]) => Promise<ExplorerDraftRestore>;
|
|
7
|
+
readonly announce: (text: string) => void;
|
|
8
|
+
readonly owns: (element: Element) => boolean;
|
|
9
|
+
readonly reportMediaFailure: (failure: ExplorerMediaFailure) => void;
|
|
10
|
+
};
|
|
11
|
+
export type ExplorerHostChange = {
|
|
12
|
+
readonly sourceIds: readonly string[];
|
|
13
|
+
readonly paths: readonly string[];
|
|
14
|
+
};
|
|
15
|
+
export type ExplorerMediaFailure = {
|
|
16
|
+
readonly url: string;
|
|
17
|
+
readonly final: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type ExplorerUnsavedDraft = {
|
|
20
|
+
readonly path: string;
|
|
21
|
+
readonly base: {
|
|
22
|
+
readonly text: string;
|
|
23
|
+
readonly version: string | null;
|
|
24
|
+
};
|
|
25
|
+
readonly draft: string;
|
|
26
|
+
readonly lineEnding: LineEnding;
|
|
27
|
+
};
|
|
28
|
+
export type ExplorerDraftChange = {
|
|
29
|
+
readonly kept: readonly ExplorerUnsavedDraft[];
|
|
30
|
+
readonly ended: readonly string[];
|
|
31
|
+
};
|
|
32
|
+
export type ExplorerDraftRestore = {
|
|
33
|
+
readonly restored: readonly string[];
|
|
34
|
+
readonly failed: readonly {
|
|
35
|
+
readonly path: string;
|
|
36
|
+
readonly reason: ExplorerFailureReason;
|
|
37
|
+
}[];
|
|
38
|
+
};
|
|
39
|
+
export declare const EXPLORER_HOST_CHANGE_POLICIES: readonly [
|
|
40
|
+
"reload",
|
|
41
|
+
"notify"
|
|
42
|
+
];
|
|
43
|
+
export type ExplorerHostChangePolicy = (typeof EXPLORER_HOST_CHANGE_POLICIES)[number];
|
|
44
|
+
export declare const EXPLORER_ACCOUNT_STATES: readonly [
|
|
45
|
+
"signed-in",
|
|
46
|
+
"signed-out"
|
|
47
|
+
];
|
|
48
|
+
export type ExplorerAccountState = (typeof EXPLORER_ACCOUNT_STATES)[number];
|
|
49
|
+
export type ExplorerHostOptions = {
|
|
50
|
+
readonly fetch: unknown;
|
|
51
|
+
readonly persistSettings: unknown;
|
|
52
|
+
readonly subscribeHostChanges: unknown;
|
|
53
|
+
readonly onReload: unknown;
|
|
54
|
+
readonly onSessionEnded: unknown;
|
|
55
|
+
readonly onDraftChange: unknown;
|
|
56
|
+
readonly guardUnload: unknown;
|
|
57
|
+
readonly confirmUnversionedSaves: unknown;
|
|
58
|
+
readonly hostChangePolicy: unknown;
|
|
59
|
+
readonly accountState: unknown;
|
|
60
|
+
readonly paletteKey: unknown;
|
|
61
|
+
};
|
|
62
|
+
export declare const assertExplorerHostOptions: (options: ExplorerHostOptions) => void;
|
|
63
|
+
export declare const assertExplorerPaths: (name: string, paths: unknown) => asserts paths is readonly string[];
|
|
64
|
+
export declare const assertExplorerHostChange: (change: unknown) => asserts change is ExplorerHostChange;
|
|
65
|
+
export declare const assertExplorerUnsavedDrafts: (drafts: unknown) => asserts drafts is readonly ExplorerUnsavedDraft[];
|
|
66
|
+
export declare const assertExplorerAnnouncement: (text: unknown) => asserts text is string;
|
|
67
|
+
export declare const assertExplorerMediaFailure: (failure: unknown) => asserts failure is ExplorerMediaFailure;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ExplorerFailureReason } from "../core/contracts.js";
|
|
2
|
+
import { LineEnding } from "./edit/lineEndings.js";
|
|
3
|
+
export type MarkdownExplorerHandle = {
|
|
4
|
+
readonly flushUnsaved: () => readonly string[];
|
|
5
|
+
readonly confirmDiscard: (paths: readonly string[]) => Promise<boolean>;
|
|
6
|
+
readonly restoreDrafts: (drafts: readonly ExplorerUnsavedDraft[]) => Promise<ExplorerDraftRestore>;
|
|
7
|
+
readonly announce: (text: string) => void;
|
|
8
|
+
readonly owns: (element: Element) => boolean;
|
|
9
|
+
readonly reportMediaFailure: (failure: ExplorerMediaFailure) => void;
|
|
10
|
+
};
|
|
11
|
+
export type ExplorerHostChange = {
|
|
12
|
+
readonly sourceIds: readonly string[];
|
|
13
|
+
readonly paths: readonly string[];
|
|
14
|
+
};
|
|
15
|
+
export type ExplorerMediaFailure = {
|
|
16
|
+
readonly url: string;
|
|
17
|
+
readonly final: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type ExplorerUnsavedDraft = {
|
|
20
|
+
readonly path: string;
|
|
21
|
+
readonly base: {
|
|
22
|
+
readonly text: string;
|
|
23
|
+
readonly version: string | null;
|
|
24
|
+
};
|
|
25
|
+
readonly draft: string;
|
|
26
|
+
readonly lineEnding: LineEnding;
|
|
27
|
+
};
|
|
28
|
+
export type ExplorerDraftChange = {
|
|
29
|
+
readonly kept: readonly ExplorerUnsavedDraft[];
|
|
30
|
+
readonly ended: readonly string[];
|
|
31
|
+
};
|
|
32
|
+
export type ExplorerDraftRestore = {
|
|
33
|
+
readonly restored: readonly string[];
|
|
34
|
+
readonly failed: readonly {
|
|
35
|
+
readonly path: string;
|
|
36
|
+
readonly reason: ExplorerFailureReason;
|
|
37
|
+
}[];
|
|
38
|
+
};
|
|
39
|
+
export declare const EXPLORER_HOST_CHANGE_POLICIES: readonly [
|
|
40
|
+
"reload",
|
|
41
|
+
"notify"
|
|
42
|
+
];
|
|
43
|
+
export type ExplorerHostChangePolicy = (typeof EXPLORER_HOST_CHANGE_POLICIES)[number];
|
|
44
|
+
export declare const EXPLORER_ACCOUNT_STATES: readonly [
|
|
45
|
+
"signed-in",
|
|
46
|
+
"signed-out"
|
|
47
|
+
];
|
|
48
|
+
export type ExplorerAccountState = (typeof EXPLORER_ACCOUNT_STATES)[number];
|
|
49
|
+
export type ExplorerHostOptions = {
|
|
50
|
+
readonly fetch: unknown;
|
|
51
|
+
readonly persistSettings: unknown;
|
|
52
|
+
readonly subscribeHostChanges: unknown;
|
|
53
|
+
readonly onReload: unknown;
|
|
54
|
+
readonly onSessionEnded: unknown;
|
|
55
|
+
readonly onDraftChange: unknown;
|
|
56
|
+
readonly guardUnload: unknown;
|
|
57
|
+
readonly confirmUnversionedSaves: unknown;
|
|
58
|
+
readonly hostChangePolicy: unknown;
|
|
59
|
+
readonly accountState: unknown;
|
|
60
|
+
readonly paletteKey: unknown;
|
|
61
|
+
};
|
|
62
|
+
export declare const assertExplorerHostOptions: (options: ExplorerHostOptions) => void;
|
|
63
|
+
export declare const assertExplorerPaths: (name: string, paths: unknown) => asserts paths is readonly string[];
|
|
64
|
+
export declare const assertExplorerHostChange: (change: unknown) => asserts change is ExplorerHostChange;
|
|
65
|
+
export declare const assertExplorerUnsavedDrafts: (drafts: unknown) => asserts drafts is readonly ExplorerUnsavedDraft[];
|
|
66
|
+
export declare const assertExplorerAnnouncement: (text: unknown) => asserts text is string;
|
|
67
|
+
export declare const assertExplorerMediaFailure: (failure: unknown) => asserts failure is ExplorerMediaFailure;
|
package/dist/core/config.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EmbedProviderId, LinkCardSize, MarkdownEmbeds } from "@aiquants/markdown/embeds";
|
|
2
2
|
import { MarkdownStyleOption } from "@aiquants/markdown/viewer-settings";
|
|
3
|
+
import { ExplorerOwnUrls } from "./ownUrls.cjs";
|
|
3
4
|
import { TreeSettings } from "./treeSettings.cjs";
|
|
4
5
|
export type ExplorerViewSlugs = {
|
|
5
6
|
readonly tree: string;
|
|
@@ -13,6 +14,9 @@ export type ExplorerConfigInput = {
|
|
|
13
14
|
readonly dataPath: string;
|
|
14
15
|
readonly settingsCookie: string;
|
|
15
16
|
readonly views?: Partial<ExplorerViewSlugs>;
|
|
17
|
+
readonly documentIds?: {
|
|
18
|
+
readonly slug: string;
|
|
19
|
+
};
|
|
16
20
|
readonly multiView?: {
|
|
17
21
|
readonly maxPanels?: number;
|
|
18
22
|
readonly columns?: number;
|
|
@@ -27,6 +31,8 @@ export type ExplorerConfigInput = {
|
|
|
27
31
|
readonly documentStyles?: readonly ExplorerDocumentStyle[];
|
|
28
32
|
readonly defaultDocumentStyle?: string;
|
|
29
33
|
readonly iframeHosts?: readonly string[];
|
|
34
|
+
readonly appOrigins?: readonly string[];
|
|
35
|
+
readonly mediaDataPath?: string;
|
|
30
36
|
readonly embeds?: {
|
|
31
37
|
readonly providers?: readonly EmbedProviderId[];
|
|
32
38
|
readonly linkCards?: boolean;
|
|
@@ -44,6 +50,9 @@ export type ExplorerConfig = {
|
|
|
44
50
|
readonly dataPath: string;
|
|
45
51
|
readonly settingsCookie: string;
|
|
46
52
|
readonly views: ExplorerViewSlugs;
|
|
53
|
+
readonly documentIds: {
|
|
54
|
+
readonly slug: string;
|
|
55
|
+
} | null;
|
|
47
56
|
readonly multiView: {
|
|
48
57
|
readonly maxPanels: number;
|
|
49
58
|
readonly columns: number;
|
|
@@ -58,6 +67,8 @@ export type ExplorerConfig = {
|
|
|
58
67
|
readonly documentStyles: readonly ExplorerDocumentStyle[];
|
|
59
68
|
readonly defaultDocumentStyle: string;
|
|
60
69
|
readonly iframeHosts: readonly string[];
|
|
70
|
+
readonly appOrigins: readonly string[];
|
|
71
|
+
readonly mediaDataPath: string | null;
|
|
61
72
|
readonly embeds: MarkdownEmbeds;
|
|
62
73
|
readonly defaultTreeSettings: TreeSettings;
|
|
63
74
|
readonly legacyTextEncoding: string | null;
|
|
@@ -102,6 +113,7 @@ export declare const WORKBOOK_BYTE_LIMITS: Readonly<{
|
|
|
102
113
|
min: 1;
|
|
103
114
|
max: number;
|
|
104
115
|
}>;
|
|
116
|
+
export declare const assertMountPath: (name: string, value: unknown) => void;
|
|
105
117
|
export declare const defineExplorerConfig: (input: ExplorerConfigInput) => ExplorerConfig;
|
|
106
118
|
export declare const revalidateExplorerConfig: (config: ExplorerConfig) => ExplorerConfig;
|
|
107
119
|
export declare const isExplorerSourceId: (value: unknown) => value is string;
|
|
@@ -110,3 +122,4 @@ export type ExplorerLocationConfig = ExplorerConfig & {
|
|
|
110
122
|
};
|
|
111
123
|
export declare const withExplorerSources: (config: ExplorerConfig, sourceIds: readonly string[]) => ExplorerLocationConfig;
|
|
112
124
|
export declare const documentStyleNames: (config: ExplorerConfig) => readonly string[];
|
|
125
|
+
export declare const ownUrlsOf: (config: ExplorerConfig) => ExplorerOwnUrls;
|
package/dist/core/config.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EmbedProviderId, LinkCardSize, MarkdownEmbeds } from "@aiquants/markdown/embeds";
|
|
2
2
|
import { MarkdownStyleOption } from "@aiquants/markdown/viewer-settings";
|
|
3
|
+
import { ExplorerOwnUrls } from "./ownUrls.js";
|
|
3
4
|
import { TreeSettings } from "./treeSettings.js";
|
|
4
5
|
export type ExplorerViewSlugs = {
|
|
5
6
|
readonly tree: string;
|
|
@@ -13,6 +14,9 @@ export type ExplorerConfigInput = {
|
|
|
13
14
|
readonly dataPath: string;
|
|
14
15
|
readonly settingsCookie: string;
|
|
15
16
|
readonly views?: Partial<ExplorerViewSlugs>;
|
|
17
|
+
readonly documentIds?: {
|
|
18
|
+
readonly slug: string;
|
|
19
|
+
};
|
|
16
20
|
readonly multiView?: {
|
|
17
21
|
readonly maxPanels?: number;
|
|
18
22
|
readonly columns?: number;
|
|
@@ -27,6 +31,8 @@ export type ExplorerConfigInput = {
|
|
|
27
31
|
readonly documentStyles?: readonly ExplorerDocumentStyle[];
|
|
28
32
|
readonly defaultDocumentStyle?: string;
|
|
29
33
|
readonly iframeHosts?: readonly string[];
|
|
34
|
+
readonly appOrigins?: readonly string[];
|
|
35
|
+
readonly mediaDataPath?: string;
|
|
30
36
|
readonly embeds?: {
|
|
31
37
|
readonly providers?: readonly EmbedProviderId[];
|
|
32
38
|
readonly linkCards?: boolean;
|
|
@@ -44,6 +50,9 @@ export type ExplorerConfig = {
|
|
|
44
50
|
readonly dataPath: string;
|
|
45
51
|
readonly settingsCookie: string;
|
|
46
52
|
readonly views: ExplorerViewSlugs;
|
|
53
|
+
readonly documentIds: {
|
|
54
|
+
readonly slug: string;
|
|
55
|
+
} | null;
|
|
47
56
|
readonly multiView: {
|
|
48
57
|
readonly maxPanels: number;
|
|
49
58
|
readonly columns: number;
|
|
@@ -58,6 +67,8 @@ export type ExplorerConfig = {
|
|
|
58
67
|
readonly documentStyles: readonly ExplorerDocumentStyle[];
|
|
59
68
|
readonly defaultDocumentStyle: string;
|
|
60
69
|
readonly iframeHosts: readonly string[];
|
|
70
|
+
readonly appOrigins: readonly string[];
|
|
71
|
+
readonly mediaDataPath: string | null;
|
|
61
72
|
readonly embeds: MarkdownEmbeds;
|
|
62
73
|
readonly defaultTreeSettings: TreeSettings;
|
|
63
74
|
readonly legacyTextEncoding: string | null;
|
|
@@ -102,6 +113,7 @@ export declare const WORKBOOK_BYTE_LIMITS: Readonly<{
|
|
|
102
113
|
min: 1;
|
|
103
114
|
max: number;
|
|
104
115
|
}>;
|
|
116
|
+
export declare const assertMountPath: (name: string, value: unknown) => void;
|
|
105
117
|
export declare const defineExplorerConfig: (input: ExplorerConfigInput) => ExplorerConfig;
|
|
106
118
|
export declare const revalidateExplorerConfig: (config: ExplorerConfig) => ExplorerConfig;
|
|
107
119
|
export declare const isExplorerSourceId: (value: unknown) => value is string;
|
|
@@ -110,3 +122,4 @@ export type ExplorerLocationConfig = ExplorerConfig & {
|
|
|
110
122
|
};
|
|
111
123
|
export declare const withExplorerSources: (config: ExplorerConfig, sourceIds: readonly string[]) => ExplorerLocationConfig;
|
|
112
124
|
export declare const documentStyleNames: (config: ExplorerConfig) => readonly string[];
|
|
125
|
+
export declare const ownUrlsOf: (config: ExplorerConfig) => ExplorerOwnUrls;
|
|
@@ -111,6 +111,21 @@ export type ExplorerRevealResult = {
|
|
|
111
111
|
readonly status: "error";
|
|
112
112
|
readonly failure: ExplorerFailure;
|
|
113
113
|
};
|
|
114
|
+
export type ExplorerIssuedDocumentId = {
|
|
115
|
+
readonly status: "ok";
|
|
116
|
+
readonly id: string;
|
|
117
|
+
} | {
|
|
118
|
+
readonly status: "error";
|
|
119
|
+
readonly failure: ExplorerFailure;
|
|
120
|
+
};
|
|
121
|
+
export type ExplorerResolvedDocumentId = {
|
|
122
|
+
readonly status: "ok";
|
|
123
|
+
readonly path: string;
|
|
124
|
+
readonly source: string;
|
|
125
|
+
} | {
|
|
126
|
+
readonly status: "error";
|
|
127
|
+
readonly failure: ExplorerFailure;
|
|
128
|
+
};
|
|
114
129
|
export type ExplorerHeading = {
|
|
115
130
|
readonly text: string;
|
|
116
131
|
readonly depth: number;
|
|
@@ -120,13 +135,16 @@ export type ExplorerFailureDocument = {
|
|
|
120
135
|
readonly kind: "failure";
|
|
121
136
|
readonly failure: ExplorerFailure;
|
|
122
137
|
};
|
|
123
|
-
export type
|
|
138
|
+
export type ExplorerFileText = {
|
|
124
139
|
readonly kind: "text";
|
|
125
140
|
readonly name: string;
|
|
126
141
|
readonly text: string;
|
|
127
142
|
readonly truncated: boolean;
|
|
128
143
|
readonly url: string;
|
|
129
144
|
};
|
|
145
|
+
export type ExplorerTextDocument = ExplorerFileText & {
|
|
146
|
+
readonly lang: string;
|
|
147
|
+
};
|
|
130
148
|
export type ExplorerExternalEdit = {
|
|
131
149
|
readonly kind: "external";
|
|
132
150
|
readonly href: string;
|
|
@@ -149,6 +167,7 @@ export type ExplorerDocument = {
|
|
|
149
167
|
readonly name: string;
|
|
150
168
|
readonly htmlContent: string;
|
|
151
169
|
readonly headings: readonly ExplorerHeading[];
|
|
170
|
+
readonly lang: string;
|
|
152
171
|
readonly edit: ExplorerDocumentEdit | null;
|
|
153
172
|
} | ExplorerTextDocument | {
|
|
154
173
|
readonly kind: "image";
|
|
@@ -165,7 +184,7 @@ export type ExplorerDocument = {
|
|
|
165
184
|
readonly name: string;
|
|
166
185
|
readonly url: string;
|
|
167
186
|
} | ExplorerFailureDocument;
|
|
168
|
-
export type ExplorerTextAnswer =
|
|
187
|
+
export type ExplorerTextAnswer = ExplorerFileText | ExplorerFailureDocument;
|
|
169
188
|
export type ExplorerGrantRequired = {
|
|
170
189
|
readonly kind: "grant";
|
|
171
190
|
readonly href: string;
|
|
@@ -194,7 +213,7 @@ export type ExplorerPreviewAnswer = {
|
|
|
194
213
|
readonly htmlContent: string;
|
|
195
214
|
readonly headings: readonly ExplorerHeading[];
|
|
196
215
|
} | ExplorerFailureDocument;
|
|
197
|
-
export type
|
|
216
|
+
export type ExplorerPreviewDraft = {
|
|
198
217
|
readonly path: string;
|
|
199
218
|
readonly text: string;
|
|
200
219
|
};
|
|
@@ -206,7 +225,7 @@ export type ExplorerDraftAnswer = {
|
|
|
206
225
|
readonly kind: "unavailable";
|
|
207
226
|
};
|
|
208
227
|
export type ExplorerDraftConverter = {
|
|
209
|
-
readonly convert: (draft:
|
|
228
|
+
readonly convert: (draft: ExplorerPreviewDraft, signal: AbortSignal) => Promise<ExplorerDraftAnswer>;
|
|
210
229
|
readonly prepare?: () => void;
|
|
211
230
|
};
|
|
212
231
|
export type ExplorerRevision = {
|
|
@@ -255,8 +274,12 @@ export declare const entryViolation: (value: unknown) => string | null;
|
|
|
255
274
|
export declare const isExplorerChildrenResult: (value: unknown) => value is ExplorerChildrenResult;
|
|
256
275
|
export declare const isExplorerAncestorsResult: (value: unknown) => value is ExplorerAncestorsResult;
|
|
257
276
|
export declare const isExplorerRevealResult: (value: unknown) => value is ExplorerRevealResult;
|
|
277
|
+
export declare const isExplorerIssuedDocumentId: (value: unknown) => value is ExplorerIssuedDocumentId;
|
|
278
|
+
export declare const isExplorerResolvedDocumentId: (value: unknown) => value is ExplorerResolvedDocumentId;
|
|
258
279
|
export declare const isExplorerTreeResult: (value: unknown) => value is ExplorerTreeResult;
|
|
259
280
|
export declare const headingViolation: (value: unknown) => string | null;
|
|
281
|
+
export declare const isExplorerDocumentLang: (value: unknown) => value is string;
|
|
282
|
+
export declare const documentLangRefusal: (kind: "markdown" | "text", value: unknown) => string;
|
|
260
283
|
export declare const documentViolation: (value: unknown) => string | null;
|
|
261
284
|
export declare const isExplorerDocument: (value: unknown) => value is ExplorerDocument;
|
|
262
285
|
export declare const isExplorerTextAnswer: (value: unknown) => value is ExplorerTextAnswer;
|
|
@@ -288,4 +311,8 @@ export type ExplorerPageData = {
|
|
|
288
311
|
} | null;
|
|
289
312
|
readonly documents: readonly ExplorerSeededDocument[];
|
|
290
313
|
readonly notices: Promise<readonly ExplorerNotice[]>;
|
|
314
|
+
readonly documentId: {
|
|
315
|
+
readonly id: string | null;
|
|
316
|
+
readonly failure: ExplorerFailure;
|
|
317
|
+
} | null;
|
|
291
318
|
};
|
package/dist/core/contracts.d.ts
CHANGED
|
@@ -111,6 +111,21 @@ export type ExplorerRevealResult = {
|
|
|
111
111
|
readonly status: "error";
|
|
112
112
|
readonly failure: ExplorerFailure;
|
|
113
113
|
};
|
|
114
|
+
export type ExplorerIssuedDocumentId = {
|
|
115
|
+
readonly status: "ok";
|
|
116
|
+
readonly id: string;
|
|
117
|
+
} | {
|
|
118
|
+
readonly status: "error";
|
|
119
|
+
readonly failure: ExplorerFailure;
|
|
120
|
+
};
|
|
121
|
+
export type ExplorerResolvedDocumentId = {
|
|
122
|
+
readonly status: "ok";
|
|
123
|
+
readonly path: string;
|
|
124
|
+
readonly source: string;
|
|
125
|
+
} | {
|
|
126
|
+
readonly status: "error";
|
|
127
|
+
readonly failure: ExplorerFailure;
|
|
128
|
+
};
|
|
114
129
|
export type ExplorerHeading = {
|
|
115
130
|
readonly text: string;
|
|
116
131
|
readonly depth: number;
|
|
@@ -120,13 +135,16 @@ export type ExplorerFailureDocument = {
|
|
|
120
135
|
readonly kind: "failure";
|
|
121
136
|
readonly failure: ExplorerFailure;
|
|
122
137
|
};
|
|
123
|
-
export type
|
|
138
|
+
export type ExplorerFileText = {
|
|
124
139
|
readonly kind: "text";
|
|
125
140
|
readonly name: string;
|
|
126
141
|
readonly text: string;
|
|
127
142
|
readonly truncated: boolean;
|
|
128
143
|
readonly url: string;
|
|
129
144
|
};
|
|
145
|
+
export type ExplorerTextDocument = ExplorerFileText & {
|
|
146
|
+
readonly lang: string;
|
|
147
|
+
};
|
|
130
148
|
export type ExplorerExternalEdit = {
|
|
131
149
|
readonly kind: "external";
|
|
132
150
|
readonly href: string;
|
|
@@ -149,6 +167,7 @@ export type ExplorerDocument = {
|
|
|
149
167
|
readonly name: string;
|
|
150
168
|
readonly htmlContent: string;
|
|
151
169
|
readonly headings: readonly ExplorerHeading[];
|
|
170
|
+
readonly lang: string;
|
|
152
171
|
readonly edit: ExplorerDocumentEdit | null;
|
|
153
172
|
} | ExplorerTextDocument | {
|
|
154
173
|
readonly kind: "image";
|
|
@@ -165,7 +184,7 @@ export type ExplorerDocument = {
|
|
|
165
184
|
readonly name: string;
|
|
166
185
|
readonly url: string;
|
|
167
186
|
} | ExplorerFailureDocument;
|
|
168
|
-
export type ExplorerTextAnswer =
|
|
187
|
+
export type ExplorerTextAnswer = ExplorerFileText | ExplorerFailureDocument;
|
|
169
188
|
export type ExplorerGrantRequired = {
|
|
170
189
|
readonly kind: "grant";
|
|
171
190
|
readonly href: string;
|
|
@@ -194,7 +213,7 @@ export type ExplorerPreviewAnswer = {
|
|
|
194
213
|
readonly htmlContent: string;
|
|
195
214
|
readonly headings: readonly ExplorerHeading[];
|
|
196
215
|
} | ExplorerFailureDocument;
|
|
197
|
-
export type
|
|
216
|
+
export type ExplorerPreviewDraft = {
|
|
198
217
|
readonly path: string;
|
|
199
218
|
readonly text: string;
|
|
200
219
|
};
|
|
@@ -206,7 +225,7 @@ export type ExplorerDraftAnswer = {
|
|
|
206
225
|
readonly kind: "unavailable";
|
|
207
226
|
};
|
|
208
227
|
export type ExplorerDraftConverter = {
|
|
209
|
-
readonly convert: (draft:
|
|
228
|
+
readonly convert: (draft: ExplorerPreviewDraft, signal: AbortSignal) => Promise<ExplorerDraftAnswer>;
|
|
210
229
|
readonly prepare?: () => void;
|
|
211
230
|
};
|
|
212
231
|
export type ExplorerRevision = {
|
|
@@ -255,8 +274,12 @@ export declare const entryViolation: (value: unknown) => string | null;
|
|
|
255
274
|
export declare const isExplorerChildrenResult: (value: unknown) => value is ExplorerChildrenResult;
|
|
256
275
|
export declare const isExplorerAncestorsResult: (value: unknown) => value is ExplorerAncestorsResult;
|
|
257
276
|
export declare const isExplorerRevealResult: (value: unknown) => value is ExplorerRevealResult;
|
|
277
|
+
export declare const isExplorerIssuedDocumentId: (value: unknown) => value is ExplorerIssuedDocumentId;
|
|
278
|
+
export declare const isExplorerResolvedDocumentId: (value: unknown) => value is ExplorerResolvedDocumentId;
|
|
258
279
|
export declare const isExplorerTreeResult: (value: unknown) => value is ExplorerTreeResult;
|
|
259
280
|
export declare const headingViolation: (value: unknown) => string | null;
|
|
281
|
+
export declare const isExplorerDocumentLang: (value: unknown) => value is string;
|
|
282
|
+
export declare const documentLangRefusal: (kind: "markdown" | "text", value: unknown) => string;
|
|
260
283
|
export declare const documentViolation: (value: unknown) => string | null;
|
|
261
284
|
export declare const isExplorerDocument: (value: unknown) => value is ExplorerDocument;
|
|
262
285
|
export declare const isExplorerTextAnswer: (value: unknown) => value is ExplorerTextAnswer;
|
|
@@ -288,4 +311,8 @@ export type ExplorerPageData = {
|
|
|
288
311
|
} | null;
|
|
289
312
|
readonly documents: readonly ExplorerSeededDocument[];
|
|
290
313
|
readonly notices: Promise<readonly ExplorerNotice[]>;
|
|
314
|
+
readonly documentId: {
|
|
315
|
+
readonly id: string | null;
|
|
316
|
+
readonly failure: ExplorerFailure;
|
|
317
|
+
} | null;
|
|
291
318
|
};
|