@aiquants/markdown-explorer 0.16.0 → 0.18.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 +121 -15
- package/README.md +47 -21
- package/dist/{EditSurface-DGMLY7Gh.js → EditSurface-B2bzY1b_.js} +3 -3
- package/dist/{EditSurface-CwKsTS11.cjs → EditSurface-BRuIjA9L.cjs} +1 -1
- package/dist/{ExplorerSplit-BLOaU5fE.cjs → ExplorerSplit-BE1VJuok.cjs} +1 -1
- package/dist/{ExplorerSplit-tUCp0XdJ.js → ExplorerSplit-qAKZsLZa.js} +3 -3
- package/dist/{MultiLayout-BBP2ajz8.cjs → MultiLayout-Bc6RYc3U.cjs} +1 -1
- package/dist/{MultiLayout-DYy66vcO.js → MultiLayout-rsmtFma5.js} +251 -247
- package/dist/NativeScrollBar-Dq3YeUVY.js +65 -0
- package/dist/NativeScrollBar-DqTkrnPZ.cjs +1 -0
- package/dist/{TreeLayout-CXX-rFO6.js → TreeLayout-BPa7NdeT.js} +3 -3
- package/dist/{TreeLayout-C8s5lBH_.cjs → TreeLayout-DXoEAcpD.cjs} +1 -1
- package/dist/core/geometry.d.cts +1 -1
- package/dist/core/geometry.d.ts +1 -1
- package/dist/core/labels.d.cts +11 -0
- package/dist/core/labels.d.ts +11 -0
- package/dist/{index-DTKGgaok.js → index-25s_q0vD.js} +829 -795
- package/dist/index-W3iAjkLb.cjs +13 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/{location-G7psbmv_.js → location-B-m9scLf.js} +82 -82
- package/dist/{location-D85EXiPt.cjs → location-BVEN_Ihk.cjs} +1 -1
- package/dist/{merge-BkFru0eg.js → merge-B9jrWxMa.js} +1 -1
- package/dist/{merge-SRws1-Zj.cjs → merge-DuTAponF.cjs} +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.js +1 -1
- package/dist/styles/markdown-explorer.css +1 -1
- package/dist/{useSplitPersistence-DRjsPZdH.cjs → useSplitPersistence-Ba-v64n-.cjs} +1 -1
- package/dist/{useSplitPersistence-B1b5Lg5E.js → useSplitPersistence-Cc4tDxB4.js} +1 -1
- package/docs/behavior/dom-hooks.md +5 -2
- package/docs/behavior/layout.md +78 -33
- package/docs/behavior/localization.md +11 -5
- package/package.json +5 -5
- package/dist/NativeScrollBar-BkFg1EcW.cjs +0 -1
- package/dist/NativeScrollBar-Dazd542j.js +0 -59
- package/dist/index-DffJZ8-y.cjs +0 -13
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { ScrollBar as m } from "@aiquants/virtualscroll";
|
|
3
|
+
import { useCallback as b, useMemo as S, useSyncExternalStore as h } from "react";
|
|
4
|
+
import { u as T } from "./index-25s_q0vD.js";
|
|
5
|
+
import { N as f } from "./scrollBarGeometry-DOBdGNV-.js";
|
|
6
|
+
import { T as d, N as v } from "./tapScrollCircle-u4EXeLhx.js";
|
|
7
|
+
const u = (e) => ({ scrollTop: e.scrollTop, scrollHeight: e.scrollHeight, clientHeight: e.clientHeight }), g = (e, t) => e.scrollTop === t.scrollTop && e.scrollHeight === t.scrollHeight && e.clientHeight === t.clientHeight, C = (e) => {
|
|
8
|
+
let t = u(e);
|
|
9
|
+
return {
|
|
10
|
+
getSnapshot: () => t,
|
|
11
|
+
subscribe: (s) => {
|
|
12
|
+
const r = () => {
|
|
13
|
+
const l = u(e);
|
|
14
|
+
g(t, l) || (t = l, s());
|
|
15
|
+
};
|
|
16
|
+
let n = 0;
|
|
17
|
+
const c = () => {
|
|
18
|
+
n === 0 && (n = requestAnimationFrame(() => {
|
|
19
|
+
n = 0, r();
|
|
20
|
+
}));
|
|
21
|
+
}, o = typeof ResizeObserver > "u" ? null : new ResizeObserver(c), i = () => {
|
|
22
|
+
if (o !== null) {
|
|
23
|
+
o.disconnect(), o.observe(e);
|
|
24
|
+
for (const l of e.children) o.observe(l);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
i();
|
|
28
|
+
const a = typeof MutationObserver > "u" ? null : new MutationObserver(() => {
|
|
29
|
+
i(), c();
|
|
30
|
+
});
|
|
31
|
+
return a?.observe(e, { childList: !0 }), e.addEventListener("scroll", r, { passive: !0 }), r(), () => {
|
|
32
|
+
e.removeEventListener("scroll", r), a?.disconnect(), o?.disconnect(), cancelAnimationFrame(n);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}, H = (e) => {
|
|
37
|
+
const t = S(() => C(e), [e]);
|
|
38
|
+
return h(t.subscribe, t.getSnapshot, t.getSnapshot);
|
|
39
|
+
}, L = (e, t) => {
|
|
40
|
+
const s = typeof t == "function" ? t(e.scrollTop) : t;
|
|
41
|
+
return e.scrollTo({ top: s, behavior: "instant" }), e.scrollTop;
|
|
42
|
+
}, M = ({ scroller: e, withCircle: t }) => {
|
|
43
|
+
const { locale: s } = T(), { scrollTop: r, scrollHeight: n, clientHeight: c } = H(e), o = b((i) => L(e, i), [e]);
|
|
44
|
+
return /* @__PURE__ */ p(
|
|
45
|
+
m,
|
|
46
|
+
{
|
|
47
|
+
contentSize: n,
|
|
48
|
+
viewportSize: c,
|
|
49
|
+
scrollPosition: r,
|
|
50
|
+
onScroll: o,
|
|
51
|
+
scrollBarWidth: f,
|
|
52
|
+
enableThumbDrag: !0,
|
|
53
|
+
enableTrackClick: !0,
|
|
54
|
+
enableArrowButtons: !0,
|
|
55
|
+
enableArrowButtonTabStops: !1,
|
|
56
|
+
tapScrollCircleOptions: t ? d : v,
|
|
57
|
+
locale: s
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
M as NativeScrollBar,
|
|
63
|
+
L as scrollScrollerTo,
|
|
64
|
+
H as useScrollerMetrics
|
|
65
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react/jsx-runtime"),h=require("@aiquants/virtualscroll"),a=require("react"),v=require("./index-W3iAjkLb.cjs"),g=require("./scrollBarGeometry-C46jBtmM.cjs"),S=require("./tapScrollCircle-C5DGI-0H.cjs"),p=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,f=e=>{let t=p(e);return{getSnapshot:()=>t,subscribe:s=>{const o=()=>{const i=p(e);m(t,i)||(t=i,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 i of e.children)r.observe(i)}};l();const u=typeof MutationObserver>"u"?null:new MutationObserver(()=>{l(),c()});return u?.observe(e,{childList:!0}),e.addEventListener("scroll",o,{passive:!0}),o(),()=>{e.removeEventListener("scroll",o),u?.disconnect(),r?.disconnect(),cancelAnimationFrame(n)}}}},b=e=>{const t=a.useMemo(()=>f(e),[e]);return a.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot)},d=(e,t)=>{const s=typeof t=="function"?t(e.scrollTop):t;return e.scrollTo({top:s,behavior:"instant"}),e.scrollTop},C=({scroller:e,withCircle:t})=>{const{locale:s}=v.useExplorer(),{scrollTop:o,scrollHeight:n,clientHeight:c}=b(e),r=a.useCallback(l=>d(e,l),[e]);return T.jsx(h.ScrollBar,{contentSize:n,viewportSize:c,scrollPosition:o,onScroll:r,scrollBarWidth:g.NATIVE_SCROLL_BAR_WIDTH,enableThumbDrag:!0,enableTrackClick:!0,enableArrowButtons:!0,enableArrowButtonTabStops:!1,tapScrollCircleOptions:t?S.TAP_SCROLL_CIRCLE:S.NO_TAP_SCROLL_CIRCLE,locale:s})};exports.NativeScrollBar=C;exports.scrollScrollerTo=d;exports.useScrollerMetrics=b;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as w, jsxs as _ } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as v, useCallback as m, useSyncExternalStore as C, useEffect as S, useState as M } from "react";
|
|
3
3
|
import { useLocation as A } from "react-router";
|
|
4
|
-
import { e as p, c as L } from "./location-
|
|
5
|
-
import { u as h, r as y, F as G, c as j, N as H, d as q, e as U, D as $, P as z, f as B } from "./index-
|
|
6
|
-
import { E as Y, a as J, b as K } from "./ExplorerSplit-
|
|
4
|
+
import { e as p, c as L } from "./location-B-m9scLf.js";
|
|
5
|
+
import { u as h, r as y, F as G, c as j, N as H, d as q, e as U, D as $, P as z, f as B } from "./index-25s_q0vD.js";
|
|
6
|
+
import { E as Y, a as J, b as K } from "./ExplorerSplit-qAKZsLZa.js";
|
|
7
7
|
const Q = (t, e) => t.claim !== e.claim || t.readme.status !== e.readme.status ? !1 : t.readme.status === "failed" && e.readme.status === "failed" ? t.readme.failure === e.readme.failure : t.readme.status === "ok" && e.readme.status === "ok" ? t.readme.readme === e.readme.readme : !0, V = (t, e, n) => {
|
|
8
8
|
let r = null;
|
|
9
9
|
return () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react/jsx-runtime"),u=require("react"),T=require("react-router"),p=require("./location-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react/jsx-runtime"),u=require("react"),T=require("react-router"),p=require("./location-BVEN_Ihk.cjs"),d=require("./index-W3iAjkLb.cjs"),x=require("./ExplorerSplit-BE1VJuok.cjs"),P=(t,e)=>t.claim!==e.claim||t.readme.status!==e.readme.status?!1:t.readme.status==="failed"&&e.readme.status==="failed"?t.readme.failure===e.readme.failure:t.readme.status==="ok"&&e.readme.status==="ok"?t.readme.readme===e.readme.readme:!0,F=(t,e,n)=>{let r=null;return()=>{const a=t.version(),c=t.read(e),o=c.status!=="pending";if(r!==null&&r.version===a&&r.tree===c&&r.settled===o)return r.state;const l=d.readFolderReadme(t,e,n),s=r!==null&&P(r.state,l)?r.state:l;return r={version:a,tree:c,settled:o,state:s},s}},_=(t,e,n)=>{let r=!0,a=null;const c=()=>{r&&n()},o=()=>{const s=t.read(e);s===a||s.status!=="pending"||(a=s,s.then(c,c))};o();const l=t.subscribe(()=>{o(),n()});return()=>{r=!1,l()}},j=()=>d.FOLDER_README_LOADING,q=(t,e)=>{const{trees:n}=d.useExplorer(),r=u.useMemo(()=>e===null?null:F(n,t,e),[n,t,e]),a=u.useCallback(f=>r===null?()=>{}:_(n,t,f),[r,n,t]),c=u.useCallback(()=>r===null?null:r(),[r]),o=u.useCallback(()=>r===null?null:j(),[r]),l=u.useSyncExternalStore(a,c,o),s=l?.claim===!0;return u.useEffect(()=>e===null?void 0:n.open(t),[n,t,e]),u.useEffect(()=>e===null||!s?void 0:n.claimChildren(t,new Map([[e,"direct"]])),[n,t,e,s]),l===null?null:l.readme},y=new Set,H=Object.freeze({kind:"loading"}),L=(t,e)=>e.status==="loading"?H:e.status==="failed"?{kind:"failure",folder:t,failure:e.failure,onRetry:e.retry}:{kind:"no-readme",folder:t},A=({location:t})=>{const{config:e}=d.useExplorer(),n=d.useExplorerNavigate(),{hash:r}=T.useLocation(),{source:a,doc:c,folder:o,overrides:l,markup:s}=t,[f,S]=u.useState(x.EMPTY_SELECTION),w=u.useMemo(()=>({gathered:f,onGatheredChange:S}),[f]),v=q(a,o),i=v===null?c:v.status==="ok"?v.readme:null,k=u.useMemo(()=>o===null||v===null?d.NO_DOCUMENT:L(o,v),[o,v]),h=u.useCallback(m=>n(p.explorerHref(e,{view:"tree",source:a,doc:m,overrides:l}),"browse"),[n,e,a,l]),O=u.useCallback(m=>n(p.explorerHref(e,{view:"tree",source:a,folder:m,overrides:l}),"browse"),[n,e,a,l]),g=u.useCallback(m=>n(p.explorerHref(e,{view:"tree",source:m,doc:c,folder:o,overrides:l,markup:s}),"switch-source"),[n,e,c,o,l,s]),C=u.useCallback(m=>n(`${p.explorerHref(e,{view:"tree",source:m,doc:c,folder:o,overrides:l,markup:s})}${r}`,"browse"),[n,e,c,o,l,s,r]),R=u.useCallback(m=>{const E=p.canonicalMultiDocuments(e,m);n(p.explorerHref(e,{view:"multi",source:a,docs:E,markup:s&&i!==null&&E.includes(i)?[i]:[]}),"switch-view")},[n,e,a,i,s]),M=u.useMemo(()=>({href:p.explorerHref(e,i===null?{view:"multi",source:a}:{view:"multi",source:a,docs:[i],markup:s?[i]:[]}),target:"multi"}),[e,a,i,s]),D=u.useMemo(()=>({kind:"page",view:"tree",overrides:l,embed:{}}),[l]),N=d.usePageMarkupToggle(t);return b.jsx(x.ExplorerSplit,{view:"tree",explorer:b.jsx(x.ExplorerPane,{mode:"tree",sourceId:a,currentPath:o===null?c:o,openPaths:y,onOpenDocument:h,onOpenFolder:O,currentFolder:o!==null,onSourceChange:g,onRevealSource:C,viewSwitch:M,tray:w,onOpenSelection:R}),content:b.jsxs("div",{className:"aqmx-document-column aqmx-tree-document",...d.CONTENT_PANE,children:[i===null?null:b.jsx(d.DocumentRefreshBar,{path:i,placement:d.PAGE_DOCUMENT_REFRESH,markup:N}),b.jsx(d.DocumentPane,{path:i,absence:k,markup:s,variant:D})]})})};exports.TreeLayout=A;
|
package/dist/core/geometry.d.cts
CHANGED
|
@@ -27,7 +27,7 @@ export declare const FIBONACCI_DURATIONS_MS: readonly [
|
|
|
27
27
|
233,
|
|
28
28
|
377
|
|
29
29
|
];
|
|
30
|
-
export declare const CONTROL_BLOCK_PIXELS =
|
|
30
|
+
export declare const CONTROL_BLOCK_PIXELS = 44;
|
|
31
31
|
export declare const COARSE_TARGET_PIXELS = 44;
|
|
32
32
|
export declare const FINE_TARGET_PIXELS = 24;
|
|
33
33
|
export declare const PANEL_MAX_BLOCK_RATIO: number;
|
package/dist/core/geometry.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export declare const FIBONACCI_DURATIONS_MS: readonly [
|
|
|
27
27
|
233,
|
|
28
28
|
377
|
|
29
29
|
];
|
|
30
|
-
export declare const CONTROL_BLOCK_PIXELS =
|
|
30
|
+
export declare const CONTROL_BLOCK_PIXELS = 44;
|
|
31
31
|
export declare const COARSE_TARGET_PIXELS = 44;
|
|
32
32
|
export declare const FINE_TARGET_PIXELS = 24;
|
|
33
33
|
export declare const PANEL_MAX_BLOCK_RATIO: number;
|
package/dist/core/labels.d.cts
CHANGED
|
@@ -207,15 +207,25 @@ export type MarkdownExplorerLabels = {
|
|
|
207
207
|
readonly viewerAlignCenter: string;
|
|
208
208
|
readonly viewerAlignRight: string;
|
|
209
209
|
readonly viewerMermaidInteractionMode: string;
|
|
210
|
+
readonly viewerMermaidInteractionModeTouch: string;
|
|
210
211
|
readonly viewerMermaidModeNone: string;
|
|
211
212
|
readonly viewerMermaidModeZoom: string;
|
|
212
213
|
readonly viewerMermaidModePan: string;
|
|
213
214
|
readonly viewerMermaidModePanShift: string;
|
|
214
215
|
readonly viewerMermaidModeBoth: string;
|
|
215
216
|
readonly viewerMermaidModeBothShift: string;
|
|
217
|
+
readonly viewerMermaidModeNoneTouch: string;
|
|
218
|
+
readonly viewerMermaidModeZoomTouch: string;
|
|
219
|
+
readonly viewerMermaidModePanTouch: string;
|
|
220
|
+
readonly viewerMermaidModeBothTouch: string;
|
|
216
221
|
readonly viewerMermaidZoomIn: string;
|
|
217
222
|
readonly viewerMermaidZoomOut: string;
|
|
218
223
|
readonly viewerMermaidResetView: string;
|
|
224
|
+
readonly viewerMermaidPanUp: string;
|
|
225
|
+
readonly viewerMermaidPanDown: string;
|
|
226
|
+
readonly viewerMermaidPanLeft: string;
|
|
227
|
+
readonly viewerMermaidPanRight: string;
|
|
228
|
+
readonly viewerMermaidDiagram: string;
|
|
219
229
|
readonly viewerMermaidRetry: string;
|
|
220
230
|
readonly viewerEmbeddedVideo: string;
|
|
221
231
|
readonly viewerEmbeddedPost: string;
|
|
@@ -237,6 +247,7 @@ export type MarkdownExplorerLabels = {
|
|
|
237
247
|
readonly panelSwitchToCustomDrag: string;
|
|
238
248
|
readonly panelSwitchToNormalDrag: string;
|
|
239
249
|
readonly panelCustomDragBadge: string;
|
|
250
|
+
readonly panelMove: string;
|
|
240
251
|
readonly panelMovePreviousColumn: string;
|
|
241
252
|
readonly panelMoveNextColumn: string;
|
|
242
253
|
readonly panelMoveUp: string;
|
package/dist/core/labels.d.ts
CHANGED
|
@@ -207,15 +207,25 @@ export type MarkdownExplorerLabels = {
|
|
|
207
207
|
readonly viewerAlignCenter: string;
|
|
208
208
|
readonly viewerAlignRight: string;
|
|
209
209
|
readonly viewerMermaidInteractionMode: string;
|
|
210
|
+
readonly viewerMermaidInteractionModeTouch: string;
|
|
210
211
|
readonly viewerMermaidModeNone: string;
|
|
211
212
|
readonly viewerMermaidModeZoom: string;
|
|
212
213
|
readonly viewerMermaidModePan: string;
|
|
213
214
|
readonly viewerMermaidModePanShift: string;
|
|
214
215
|
readonly viewerMermaidModeBoth: string;
|
|
215
216
|
readonly viewerMermaidModeBothShift: string;
|
|
217
|
+
readonly viewerMermaidModeNoneTouch: string;
|
|
218
|
+
readonly viewerMermaidModeZoomTouch: string;
|
|
219
|
+
readonly viewerMermaidModePanTouch: string;
|
|
220
|
+
readonly viewerMermaidModeBothTouch: string;
|
|
216
221
|
readonly viewerMermaidZoomIn: string;
|
|
217
222
|
readonly viewerMermaidZoomOut: string;
|
|
218
223
|
readonly viewerMermaidResetView: string;
|
|
224
|
+
readonly viewerMermaidPanUp: string;
|
|
225
|
+
readonly viewerMermaidPanDown: string;
|
|
226
|
+
readonly viewerMermaidPanLeft: string;
|
|
227
|
+
readonly viewerMermaidPanRight: string;
|
|
228
|
+
readonly viewerMermaidDiagram: string;
|
|
219
229
|
readonly viewerMermaidRetry: string;
|
|
220
230
|
readonly viewerEmbeddedVideo: string;
|
|
221
231
|
readonly viewerEmbeddedPost: string;
|
|
@@ -237,6 +247,7 @@ export type MarkdownExplorerLabels = {
|
|
|
237
247
|
readonly panelSwitchToCustomDrag: string;
|
|
238
248
|
readonly panelSwitchToNormalDrag: string;
|
|
239
249
|
readonly panelCustomDragBadge: string;
|
|
250
|
+
readonly panelMove: string;
|
|
240
251
|
readonly panelMovePreviousColumn: string;
|
|
241
252
|
readonly panelMoveNextColumn: string;
|
|
242
253
|
readonly panelMoveUp: string;
|