@aiquants/markdown-explorer 0.21.0 → 0.23.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +27 -16
  3. package/dist/EditSurface-Bk4tdJ99.cjs +6 -0
  4. package/dist/EditSurface-Dhvw9IDD.js +975 -0
  5. package/dist/{ExplorerSplit-CdqEKz-I.cjs → ExplorerSplit-BAFiXU-V.cjs} +1 -1
  6. package/dist/{ExplorerSplit-3WMRDA7G.js → ExplorerSplit-Q5VqUBDE.js} +3 -3
  7. package/dist/{MultiLayout-BEg1X8Jx.cjs → MultiLayout-Bq_TS3ez.cjs} +1 -1
  8. package/dist/{MultiLayout-Gf1xT-Le.js → MultiLayout-DlATT7km.js} +22 -22
  9. package/dist/{NativeScrollBar-idIQsvCv.cjs → NativeScrollBar-A6-qEpz7.cjs} +1 -1
  10. package/dist/{NativeScrollBar-0cpp2OIu.js → NativeScrollBar-TsIcS3JZ.js} +1 -1
  11. package/dist/{TreeLayout-DJY_WqzP.cjs → TreeLayout-l-r2pPao.cjs} +1 -1
  12. package/dist/{TreeLayout-DzZCgMTt.js → TreeLayout-zrSo4MNZ.js} +3 -3
  13. package/dist/core/contracts.d.cts +7 -0
  14. package/dist/core/contracts.d.ts +7 -0
  15. package/dist/core/labels.d.cts +21 -27
  16. package/dist/core/labels.d.ts +21 -27
  17. package/dist/{dataRoute-CObbjNxG.js → dataRoute-Diu_7gle.js} +84 -83
  18. package/dist/dataRoute-vXGZMVB-.cjs +1 -0
  19. package/dist/index-BNFl3BsO.cjs +13 -0
  20. package/dist/{index-CJgHGeZs.js → index-Jz6zeO4O.js} +1500 -1529
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.d.cts +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +9 -9
  25. package/dist/{location-B-m9scLf.js → location-8Ho8ZNv_.js} +1 -1
  26. package/dist/{location-BVEN_Ihk.cjs → location-DN0AI4ir.cjs} +1 -1
  27. package/dist/{merge-BOcofJN5.js → merge-BzMpSaxx.js} +1 -1
  28. package/dist/{merge-BVk6pvO_.cjs → merge-DlPkU2Jc.cjs} +1 -1
  29. package/dist/{sanitizePolicy-BWQtWhsL.js → sanitizePolicy-BvhYIqVO.js} +1 -1
  30. package/dist/{sanitizePolicy-gEXeavb-.cjs → sanitizePolicy-Du3lFZd-.cjs} +1 -1
  31. package/dist/sanitizeWorker.cjs +1 -1
  32. package/dist/sanitizeWorker.js +1 -1
  33. package/dist/server/ports.d.cts +2 -1
  34. package/dist/server/ports.d.ts +2 -1
  35. package/dist/server.cjs +1 -1
  36. package/dist/server.js +524 -521
  37. package/dist/{useSplitPersistence-Ba-v64n-.cjs → useSplitPersistence-CR4Oxtaa.cjs} +1 -1
  38. package/dist/{useSplitPersistence-Cc4tDxB4.js → useSplitPersistence-HfAb8Kzh.js} +1 -1
  39. package/docs/behavior/dom-hooks.md +3 -3
  40. package/docs/behavior/layout.md +11 -5
  41. package/docs/behavior/localization.md +9 -7
  42. package/docs/behavior/security.md +1 -1
  43. package/docs/behavior/url-contract.md +2 -2
  44. package/package.json +5 -5
  45. package/dist/EditSurface-Bwl4S1vQ.cjs +0 -7
  46. package/dist/EditSurface-rKoy_ndP.js +0 -880
  47. package/dist/dataRoute-BONacTPi.cjs +0 -1
  48. package/dist/index-bMaSoQTe.cjs +0 -13
@@ -1,12 +1,12 @@
1
1
  import { jsxs as ie, jsx as N } from "react/jsx-runtime";
2
2
  import { createContext as Je, use as ke, useRef as q, useState as $, useLayoutEffect as F, useMemo as D, useSyncExternalStore as Xe, useCallback as R, memo as Ze, useEffect as U, useImperativeHandle as Qe } from "react";
3
- import { k as ce, e as Ae, l as en, P as nn, m as tn } from "./location-B-m9scLf.js";
4
- import { H as on, u as J, I as rn, J as ln, D as sn, f as an, N as cn, K as V, e as Le, L as un, M as Ie } from "./index-CJgHGeZs.js";
5
- import { S as dn, a as mn, b as fn } from "./ExplorerSplit-3WMRDA7G.js";
3
+ import { k as ce, e as Ae, l as en, P as nn, m as tn } from "./location-8Ho8ZNv_.js";
4
+ import { H as on, u as J, I as rn, J as ln, D as sn, f as an, N as cn, K as V, e as Le, L as un, M as Ie } from "./index-Jz6zeO4O.js";
5
+ import { S as dn, a as mn, b as fn } from "./ExplorerSplit-Q5VqUBDE.js";
6
6
  import { SCROLL_AREA_SELECTOR as Re, SCROLL_ROOT_SELECTOR as te, PANEL_ACTION_ATTRIBUTE as he, generateColumnIds as pn, sortColumnIds as De, generateColumnId as _e, NO_PANEL_DRAG_ATTRIBUTE as gn, useDragDropColumns as hn, DEFAULT_DEBUG_CONFIG as ve, DragDropLayout as vn } from "@aiquants/drag-drop-panels";
7
7
  import { useNavigate as wn, useLocation as yn } from "react-router";
8
8
  import { s as Sn, r as xn, w as En } from "./storage-CmGHg7OA.js";
9
- import { F as On, i as bn } from "./dataRoute-CObbjNxG.js";
9
+ import { G as On, i as bn } from "./dataRoute-Diu_7gle.js";
10
10
  import { createPortal as Pn } from "react-dom";
11
11
  import { HostedScrollArea as Cn } from "@aiquants/markdown";
12
12
  import { N as Tn } from "./scrollBarGeometry-DOBdGNV-.js";
@@ -145,7 +145,7 @@ const Nn = () => {
145
145
  if (n === null || !e.hidden.has(n)) return { ...e, maximized: n };
146
146
  const t = new Set(e.hidden);
147
147
  return t.delete(n), { ...e, maximized: n, hidden: t };
148
- }, Yn = (e, n, t) => {
148
+ }, Gn = (e, n, t) => {
149
149
  const o = re(e, t), r = /* @__PURE__ */ new Map();
150
150
  for (const [s, v] of o.entries())
151
151
  for (const S of v) r.set(S, s);
@@ -180,17 +180,17 @@ const Nn = () => {
180
180
  t.delete(o);
181
181
  }
182
182
  return { ...e, columnOf: t };
183
- }, Ue = 1, G = Object.freeze({ columnOf: /* @__PURE__ */ new Map(), hidden: /* @__PURE__ */ new Set() }), Gn = (e, n) => {
184
- if (e === null || e === "") return G;
183
+ }, Ue = 1, Y = Object.freeze({ columnOf: /* @__PURE__ */ new Map(), hidden: /* @__PURE__ */ new Set() }), Yn = (e, n) => {
184
+ if (e === null || e === "") return Y;
185
185
  let t;
186
186
  try {
187
187
  t = JSON.parse(e);
188
188
  } catch {
189
- return G;
189
+ return Y;
190
190
  }
191
- if (t === null || typeof t != "object" || Array.isArray(t)) return G;
191
+ if (t === null || typeof t != "object" || Array.isArray(t)) return Y;
192
192
  const o = t;
193
- if (o.v !== Ue) return G;
193
+ if (o.v !== Ue) return Y;
194
194
  const r = /* @__PURE__ */ new Map();
195
195
  if (Array.isArray(o.columnOf))
196
196
  for (const a of o.columnOf.slice(-oe))
@@ -213,7 +213,7 @@ const Nn = () => {
213
213
  }, Kn = ({ config: e, location: n, writeUrl: t, persist: o }) => {
214
214
  const { maxPanels: r, columns: l } = e.multiView, a = on(), c = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
215
215
  let s = {
216
- layout: le({ docs: n.docs, maximized: n.maximized, markup: n.markup, stored: G }, r),
216
+ layout: le({ docs: n.docs, maximized: n.maximized, markup: n.markup, stored: Y }, r),
217
217
  source: n.source,
218
218
  visibleColumns: l,
219
219
  ready: !1,
@@ -263,7 +263,7 @@ const Nn = () => {
263
263
  setHidden: (i, p) => k($e(s.layout, i, p)),
264
264
  maximize: (i) => k(jn(s.layout, i)),
265
265
  setMarkup: (i, p) => k(Un(s.layout, i, p)),
266
- arrange: (i) => k(Yn(s.layout, i, { logical: l, visible: i.length })),
266
+ arrange: (i) => k(Gn(s.layout, i, { logical: l, visible: i.length })),
267
267
  changeSource: (i) => {
268
268
  g(i, s.layout, "push");
269
269
  },
@@ -348,7 +348,7 @@ const Nn = () => {
348
348
  return F(() => {
349
349
  a.observeLocation(m.location);
350
350
  }, [a, m]), F(() => {
351
- a.loadStored(Gn(xn(l), n.multiView.columns));
351
+ a.loadStored(Yn(xn(l), n.multiView.columns));
352
352
  }, [a, l, n]), a;
353
353
  }, Xn = (e) => {
354
354
  const n = e.closest(Re);
@@ -396,7 +396,7 @@ const Nn = () => {
396
396
  }, je = (e) => {
397
397
  const n = e.firstElementChild;
398
398
  return n instanceof HTMLElement && getComputedStyle(n).position === "sticky" ? n : null;
399
- }, Ye = (e, n) => {
399
+ }, Ge = (e, n) => {
400
400
  const t = n.getBoundingClientRect().top, o = je(e);
401
401
  return o === null ? t : Math.max(t, o.getBoundingClientRect().bottom);
402
402
  }, Ee = (e, n) => {
@@ -407,7 +407,7 @@ const Nn = () => {
407
407
  }
408
408
  return t < e.length ? t : -1;
409
409
  }, lt = (e, n) => {
410
- const t = Ye(e, n), o = [];
410
+ const t = Ge(e, n), o = [];
411
411
  let r = e;
412
412
  for (let a = Ee([...r.children], t); a >= 0; a = Ee([...r.children], t)) {
413
413
  const c = r.children[a];
@@ -422,8 +422,8 @@ const Nn = () => {
422
422
  for (const m of t.anchor.path) o = o?.children[m];
423
423
  if (o === void 0) return;
424
424
  const r = o.getBoundingClientRect(), { offset: l, height: a } = t.anchor, c = l < 0 && a > 0 ? l / a * r.height : l;
425
- n.scrollTop += r.top - Ye(e, n) - c;
426
- }, st = Object.freeze(["data-testid", "aria-label", "title", "href", "id", "name"]), Ge = (e) => {
425
+ n.scrollTop += r.top - Ge(e, n) - c;
426
+ }, st = Object.freeze(["data-testid", "aria-label", "title", "href", "id", "name"]), Ye = (e) => {
427
427
  const n = e.getAttribute(he);
428
428
  return JSON.stringify(n === null ? [e.tagName, ...st.map((t) => e.getAttribute(t))] : [e.tagName, he, n]);
429
429
  }, it = (e, n) => {
@@ -434,11 +434,11 @@ const Nn = () => {
434
434
  if (r === null) return null;
435
435
  t.unshift([...r.children].indexOf(o)), o = r;
436
436
  }
437
- return { path: t, signature: Ge(n) };
437
+ return { path: t, signature: Ye(n) };
438
438
  }, at = (e, n, t) => {
439
439
  let o = e;
440
440
  for (const r of t.path) o = o?.children[r];
441
- o instanceof HTMLElement && Ge(o) === t.signature && un(o) || n.focus({ preventScroll: !0 });
441
+ o instanceof HTMLElement && Ye(o) === t.signature && un(o) || n.focus({ preventScroll: !0 });
442
442
  }, ct = (e, n, t) => {
443
443
  if (e.shiftKey || Math.abs(e.deltaX) > Math.abs(e.deltaY)) return;
444
444
  const o = e.ctrlKey || e.metaKey, r = o ? W(n) : n.closest(te);
@@ -724,7 +724,7 @@ const Nn = () => {
724
724
  r.announce(o.panelShown(j)), Ke(n, B);
725
725
  continue;
726
726
  }
727
- const Y = n.current, ge = Y === null ? null : Te(Y, B);
727
+ const G = n.current, ge = G === null ? null : Te(G, B);
728
728
  e.setHidden(z, !0) && (r.announce(o.panelHidden(j)), ge !== null && Ne(n, ge));
729
729
  }
730
730
  },
@@ -734,8 +734,8 @@ const Nn = () => {
734
734
  const b = X(e.getSnapshot().layout).get(E);
735
735
  if (b === void 0) return;
736
736
  const B = () => {
737
- const H = e.titleOf(b), j = n.current, Y = j === null ? null : Te(j, E);
738
- e.close(b) && (r.announce(o.panelClosed(H)), Y !== null && Ne(n, Y));
737
+ const H = e.titleOf(b), j = n.current, G = j === null ? null : Te(j, E);
738
+ e.close(b) && (r.announce(o.panelClosed(H)), G !== null && Ne(n, G));
739
739
  }, z = l.unsavedAmong([b]);
740
740
  z.length === 0 ? B() : l.askToDiscard(z).then((H) => {
741
741
  H && B();
@@ -1 +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-bMaSoQTe.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
+ "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-BNFl3BsO.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,7 +1,7 @@
1
1
  import { jsx as p } from "react/jsx-runtime";
2
2
  import { ScrollBar as m } from "@aiquants/virtualscroll";
3
3
  import { useCallback as b, useMemo as S, useSyncExternalStore as h } from "react";
4
- import { u as T } from "./index-CJgHGeZs.js";
4
+ import { u as T } from "./index-Jz6zeO4O.js";
5
5
  import { N as f } from "./scrollBarGeometry-DOBdGNV-.js";
6
6
  import { T as d, N as v } from "./tapScrollCircle-u4EXeLhx.js";
7
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) => {
@@ -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-BVEN_Ihk.cjs"),d=require("./index-bMaSoQTe.cjs"),x=require("./ExplorerSplit-CdqEKz-I.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;
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-DN0AI4ir.cjs"),d=require("./index-BNFl3BsO.cjs"),x=require("./ExplorerSplit-BAFiXU-V.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;
@@ -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-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-CJgHGeZs.js";
6
- import { E as Y, a as J, b as K } from "./ExplorerSplit-3WMRDA7G.js";
4
+ import { e as p, c as L } from "./location-8Ho8ZNv_.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-Jz6zeO4O.js";
6
+ import { E as Y, a as J, b as K } from "./ExplorerSplit-Q5VqUBDE.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 () => {
@@ -21,6 +21,11 @@ export declare const EXPLORER_MEDIA_TYPES: readonly [
21
21
  "pdf"
22
22
  ];
23
23
  export type ExplorerMediaType = (typeof EXPLORER_MEDIA_TYPES)[number];
24
+ export declare const EXPLORER_IMAGE_TYPES: readonly [
25
+ "raster",
26
+ "svg"
27
+ ];
28
+ export type ExplorerImageType = (typeof EXPLORER_IMAGE_TYPES)[number];
24
29
  export declare const EXPLORER_NOTICE_TONES: readonly [
25
30
  "info",
26
31
  "warning",
@@ -128,6 +133,7 @@ export type ExplorerDocument = {
128
133
  readonly kind: "image";
129
134
  readonly name: string;
130
135
  readonly url: string;
136
+ readonly imageType: ExplorerImageType;
131
137
  } | {
132
138
  readonly kind: "media";
133
139
  readonly name: string;
@@ -217,6 +223,7 @@ export type ExplorerSourceSummary = {
217
223
  export declare const isExplorerFailureReason: (value: unknown) => value is ExplorerFailureReason;
218
224
  export declare const isExplorerEntryType: (value: unknown) => value is ExplorerEntryType;
219
225
  export declare const isExplorerMediaType: (value: unknown) => value is ExplorerMediaType;
226
+ export declare const isExplorerImageType: (value: unknown) => value is ExplorerImageType;
220
227
  export declare const isExplorerNoticeTone: (value: unknown) => value is ExplorerNoticeTone;
221
228
  export declare const isExplorerDocumentKind: (value: unknown) => value is ExplorerDocumentKind;
222
229
  export declare const isExplorerFailureCode: (code: unknown) => code is string;
@@ -21,6 +21,11 @@ export declare const EXPLORER_MEDIA_TYPES: readonly [
21
21
  "pdf"
22
22
  ];
23
23
  export type ExplorerMediaType = (typeof EXPLORER_MEDIA_TYPES)[number];
24
+ export declare const EXPLORER_IMAGE_TYPES: readonly [
25
+ "raster",
26
+ "svg"
27
+ ];
28
+ export type ExplorerImageType = (typeof EXPLORER_IMAGE_TYPES)[number];
24
29
  export declare const EXPLORER_NOTICE_TONES: readonly [
25
30
  "info",
26
31
  "warning",
@@ -128,6 +133,7 @@ export type ExplorerDocument = {
128
133
  readonly kind: "image";
129
134
  readonly name: string;
130
135
  readonly url: string;
136
+ readonly imageType: ExplorerImageType;
131
137
  } | {
132
138
  readonly kind: "media";
133
139
  readonly name: string;
@@ -217,6 +223,7 @@ export type ExplorerSourceSummary = {
217
223
  export declare const isExplorerFailureReason: (value: unknown) => value is ExplorerFailureReason;
218
224
  export declare const isExplorerEntryType: (value: unknown) => value is ExplorerEntryType;
219
225
  export declare const isExplorerMediaType: (value: unknown) => value is ExplorerMediaType;
226
+ export declare const isExplorerImageType: (value: unknown) => value is ExplorerImageType;
220
227
  export declare const isExplorerNoticeTone: (value: unknown) => value is ExplorerNoticeTone;
221
228
  export declare const isExplorerDocumentKind: (value: unknown) => value is ExplorerDocumentKind;
222
229
  export declare const isExplorerFailureCode: (code: unknown) => code is string;
@@ -1,10 +1,16 @@
1
+ import { SpreadsheetBlockLabelKey } from "@aiquants/markdown/code-blocks";
1
2
  export declare const MARKDOWN_EXPLORER_LOCALES: readonly [
2
3
  "en",
3
4
  "ja"
4
5
  ];
5
6
  export type MarkdownExplorerLocale = (typeof MARKDOWN_EXPLORER_LOCALES)[number];
6
7
  export declare const DEFAULT_MARKDOWN_EXPLORER_LOCALE: MarkdownExplorerLocale;
7
- export type MarkdownExplorerLabels = {
8
+ export type MarkdownExplorerSpreadsheetLabels = {
9
+ readonly [K in SpreadsheetBlockLabelKey as `viewerSpreadsheet${Capitalize<K>}`]: string;
10
+ };
11
+ type SpreadsheetLabelKey = keyof MarkdownExplorerSpreadsheetLabels;
12
+ export declare const spreadsheetLabelKeyOf: (key: SpreadsheetBlockLabelKey) => SpreadsheetLabelKey;
13
+ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
8
14
  readonly explorerRegion: string;
9
15
  readonly sourceLabel: string;
10
16
  readonly refreshTreeLabel: string;
@@ -18,6 +24,7 @@ export type MarkdownExplorerLabels = {
18
24
  readonly documentRefreshFailed: (reason: string) => string;
19
25
  readonly showMarkupLabel: string;
20
26
  readonly showMarkup: string;
27
+ readonly showSvgMarkup: string;
21
28
  readonly showMarkupNamed: (name: string) => string;
22
29
  readonly editDocumentLabel: string;
23
30
  readonly editDocument: string;
@@ -82,6 +89,7 @@ export type MarkdownExplorerLabels = {
82
89
  readonly previewRegion: string;
83
90
  readonly previewUpdating: string;
84
91
  readonly previewFailed: (reason: string) => string;
92
+ readonly previewTablePending: string;
85
93
  readonly expandAll: string;
86
94
  readonly collapseAll: string;
87
95
  readonly treeSettings: string;
@@ -230,32 +238,17 @@ export type MarkdownExplorerLabels = {
230
238
  readonly viewerEmbeddedVideo: string;
231
239
  readonly viewerEmbeddedPost: string;
232
240
  readonly viewerEmbeddedFrame: string;
233
- readonly viewerSpreadsheetTable: string;
234
- readonly viewerSpreadsheetZoomIn: string;
235
- readonly viewerSpreadsheetZoomOut: string;
236
- readonly viewerSpreadsheetResetZoom: string;
237
- readonly viewerSpreadsheetHighlight: string;
238
- readonly viewerSpreadsheetCopyAll: string;
239
- readonly viewerSpreadsheetSaveTsv: string;
240
- readonly viewerSpreadsheetSaveMenu: string;
241
- readonly viewerSpreadsheetSaveTsvWithBom: string;
242
- readonly viewerSpreadsheetFullscreen: string;
243
- readonly viewerSpreadsheetExitFullscreen: string;
244
- readonly viewerSpreadsheetFullscreenDialog: string;
245
- readonly viewerSpreadsheetSize: string;
246
- readonly viewerSpreadsheetFileName: string;
247
- readonly viewerSpreadsheetCopied: string;
248
- readonly viewerSpreadsheetCopyFailed: string;
249
- readonly viewerSpreadsheetCellAnnouncement: string;
250
- readonly viewerSpreadsheetEmptyCell: string;
251
- readonly viewerSpreadsheetSelectionAnnouncement: string;
252
- readonly viewerSpreadsheetReadOnly: string;
253
- readonly viewerSpreadsheetFormatRefused: string;
254
- readonly viewerSpreadsheetFenceRefused: string;
255
- readonly viewerSpreadsheetEditConflict: string;
256
- readonly viewerSpreadsheetOptionsError: string;
257
- readonly viewerSpreadsheetLoadFailed: string;
258
- readonly viewerSpreadsheetRetry: string;
241
+ readonly viewerBlockFailed: string;
242
+ readonly viewerSvgImageToolbar: string;
243
+ readonly viewerSvgImageSource: string;
244
+ readonly viewerSvgImageSourceRegion: string;
245
+ readonly viewerSvgImageLoading: string;
246
+ readonly viewerSvgImageFailed: string;
247
+ readonly viewerSvgImageRetry: string;
248
+ readonly viewerSvgImageTruncated: string;
249
+ readonly viewerSvgImageCopy: string;
250
+ readonly viewerSvgImageCopied: string;
251
+ readonly viewerSvgImageCopyFailed: string;
259
252
  readonly multiRegion: string;
260
253
  readonly multiEmpty: string;
261
254
  readonly panelLimit: (max: number) => string;
@@ -297,3 +290,4 @@ export declare const MARKDOWN_EXPLORER_LABEL_KEYS: readonly MarkdownExplorerLabe
297
290
  export declare const resolveMarkdownExplorerLocale: (locale: unknown) => MarkdownExplorerLocale;
298
291
  export declare const resolveMarkdownExplorerLabels: (locale: unknown, overrides: unknown) => MarkdownExplorerLabels;
299
292
  export declare const areLabelOverridesEqual: (previous: unknown, next: unknown) => boolean;
293
+ export {};
@@ -1,10 +1,16 @@
1
+ import { SpreadsheetBlockLabelKey } from "@aiquants/markdown/code-blocks";
1
2
  export declare const MARKDOWN_EXPLORER_LOCALES: readonly [
2
3
  "en",
3
4
  "ja"
4
5
  ];
5
6
  export type MarkdownExplorerLocale = (typeof MARKDOWN_EXPLORER_LOCALES)[number];
6
7
  export declare const DEFAULT_MARKDOWN_EXPLORER_LOCALE: MarkdownExplorerLocale;
7
- export type MarkdownExplorerLabels = {
8
+ export type MarkdownExplorerSpreadsheetLabels = {
9
+ readonly [K in SpreadsheetBlockLabelKey as `viewerSpreadsheet${Capitalize<K>}`]: string;
10
+ };
11
+ type SpreadsheetLabelKey = keyof MarkdownExplorerSpreadsheetLabels;
12
+ export declare const spreadsheetLabelKeyOf: (key: SpreadsheetBlockLabelKey) => SpreadsheetLabelKey;
13
+ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
8
14
  readonly explorerRegion: string;
9
15
  readonly sourceLabel: string;
10
16
  readonly refreshTreeLabel: string;
@@ -18,6 +24,7 @@ export type MarkdownExplorerLabels = {
18
24
  readonly documentRefreshFailed: (reason: string) => string;
19
25
  readonly showMarkupLabel: string;
20
26
  readonly showMarkup: string;
27
+ readonly showSvgMarkup: string;
21
28
  readonly showMarkupNamed: (name: string) => string;
22
29
  readonly editDocumentLabel: string;
23
30
  readonly editDocument: string;
@@ -82,6 +89,7 @@ export type MarkdownExplorerLabels = {
82
89
  readonly previewRegion: string;
83
90
  readonly previewUpdating: string;
84
91
  readonly previewFailed: (reason: string) => string;
92
+ readonly previewTablePending: string;
85
93
  readonly expandAll: string;
86
94
  readonly collapseAll: string;
87
95
  readonly treeSettings: string;
@@ -230,32 +238,17 @@ export type MarkdownExplorerLabels = {
230
238
  readonly viewerEmbeddedVideo: string;
231
239
  readonly viewerEmbeddedPost: string;
232
240
  readonly viewerEmbeddedFrame: string;
233
- readonly viewerSpreadsheetTable: string;
234
- readonly viewerSpreadsheetZoomIn: string;
235
- readonly viewerSpreadsheetZoomOut: string;
236
- readonly viewerSpreadsheetResetZoom: string;
237
- readonly viewerSpreadsheetHighlight: string;
238
- readonly viewerSpreadsheetCopyAll: string;
239
- readonly viewerSpreadsheetSaveTsv: string;
240
- readonly viewerSpreadsheetSaveMenu: string;
241
- readonly viewerSpreadsheetSaveTsvWithBom: string;
242
- readonly viewerSpreadsheetFullscreen: string;
243
- readonly viewerSpreadsheetExitFullscreen: string;
244
- readonly viewerSpreadsheetFullscreenDialog: string;
245
- readonly viewerSpreadsheetSize: string;
246
- readonly viewerSpreadsheetFileName: string;
247
- readonly viewerSpreadsheetCopied: string;
248
- readonly viewerSpreadsheetCopyFailed: string;
249
- readonly viewerSpreadsheetCellAnnouncement: string;
250
- readonly viewerSpreadsheetEmptyCell: string;
251
- readonly viewerSpreadsheetSelectionAnnouncement: string;
252
- readonly viewerSpreadsheetReadOnly: string;
253
- readonly viewerSpreadsheetFormatRefused: string;
254
- readonly viewerSpreadsheetFenceRefused: string;
255
- readonly viewerSpreadsheetEditConflict: string;
256
- readonly viewerSpreadsheetOptionsError: string;
257
- readonly viewerSpreadsheetLoadFailed: string;
258
- readonly viewerSpreadsheetRetry: string;
241
+ readonly viewerBlockFailed: string;
242
+ readonly viewerSvgImageToolbar: string;
243
+ readonly viewerSvgImageSource: string;
244
+ readonly viewerSvgImageSourceRegion: string;
245
+ readonly viewerSvgImageLoading: string;
246
+ readonly viewerSvgImageFailed: string;
247
+ readonly viewerSvgImageRetry: string;
248
+ readonly viewerSvgImageTruncated: string;
249
+ readonly viewerSvgImageCopy: string;
250
+ readonly viewerSvgImageCopied: string;
251
+ readonly viewerSvgImageCopyFailed: string;
259
252
  readonly multiRegion: string;
260
253
  readonly multiEmpty: string;
261
254
  readonly panelLimit: (max: number) => string;
@@ -297,3 +290,4 @@ export declare const MARKDOWN_EXPLORER_LABEL_KEYS: readonly MarkdownExplorerLabe
297
290
  export declare const resolveMarkdownExplorerLocale: (locale: unknown) => MarkdownExplorerLocale;
298
291
  export declare const resolveMarkdownExplorerLabels: (locale: unknown, overrides: unknown) => MarkdownExplorerLabels;
299
292
  export declare const areLabelOverridesEqual: (previous: unknown, next: unknown) => boolean;
293
+ export {};