@lincyaw/aegis-ui 0.18.0 → 0.20.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 (80) hide show
  1. package/dist/components/ui/AnchoredPopover.cjs +1 -1
  2. package/dist/components/ui/AnchoredPopover.cjs.map +1 -1
  3. package/dist/components/ui/AnchoredPopover.d.ts +21 -1
  4. package/dist/components/ui/AnchoredPopover.js +106 -78
  5. package/dist/components/ui/AnchoredPopover.js.map +1 -1
  6. package/dist/components/ui/CodeBlock.cjs +2 -2
  7. package/dist/components/ui/CodeBlock.cjs.map +1 -1
  8. package/dist/components/ui/CodeBlock.d.ts +10 -1
  9. package/dist/components/ui/CodeBlock.js +65 -57
  10. package/dist/components/ui/CodeBlock.js.map +1 -1
  11. package/dist/components/ui/DataTable.cjs +1 -1
  12. package/dist/components/ui/DataTable.cjs.map +1 -1
  13. package/dist/components/ui/DataTable.d.ts +11 -1
  14. package/dist/components/ui/DataTable.js +78 -74
  15. package/dist/components/ui/DataTable.js.map +1 -1
  16. package/dist/components/ui/DetailBeside.cjs +1 -1
  17. package/dist/components/ui/DetailBeside.cjs.map +1 -1
  18. package/dist/components/ui/DetailBeside.d.ts +45 -11
  19. package/dist/components/ui/DetailBeside.js +118 -85
  20. package/dist/components/ui/DetailBeside.js.map +1 -1
  21. package/dist/components/ui/IdentityCell.cjs +1 -1
  22. package/dist/components/ui/IdentityCell.cjs.map +1 -1
  23. package/dist/components/ui/IdentityCell.d.ts +6 -1
  24. package/dist/components/ui/IdentityCell.js +17 -15
  25. package/dist/components/ui/IdentityCell.js.map +1 -1
  26. package/dist/components/ui/PaneLayout.cjs +1 -1
  27. package/dist/components/ui/PaneLayout.cjs.map +1 -1
  28. package/dist/components/ui/PaneLayout.d.ts +7 -2
  29. package/dist/components/ui/PaneLayout.js +20 -22
  30. package/dist/components/ui/PaneLayout.js.map +1 -1
  31. package/dist/components/ui/Select.cjs +1 -1
  32. package/dist/components/ui/Select.cjs.map +1 -1
  33. package/dist/components/ui/Select.d.ts +8 -2
  34. package/dist/components/ui/Select.js +44 -38
  35. package/dist/components/ui/Select.js.map +1 -1
  36. package/dist/components/ui/TimeDisplay.cjs +1 -1
  37. package/dist/components/ui/TimeDisplay.cjs.map +1 -1
  38. package/dist/components/ui/TimeDisplay.d.ts +11 -3
  39. package/dist/components/ui/TimeDisplay.js +39 -34
  40. package/dist/components/ui/TimeDisplay.js.map +1 -1
  41. package/dist/components/ui/Timeline.cjs +1 -1
  42. package/dist/components/ui/Timeline.cjs.map +1 -1
  43. package/dist/components/ui/Timeline.d.ts +17 -4
  44. package/dist/components/ui/Timeline.js +88 -67
  45. package/dist/components/ui/Timeline.js.map +1 -1
  46. package/dist/components/ui/Toolbar.cjs.map +1 -1
  47. package/dist/components/ui/Toolbar.d.ts +2 -1
  48. package/dist/components/ui/Toolbar.js.map +1 -1
  49. package/dist/components/ui/TraceTree.cjs +1 -1
  50. package/dist/components/ui/TraceTree.cjs.map +1 -1
  51. package/dist/components/ui/TraceTree.d.ts +7 -1
  52. package/dist/components/ui/TraceTree.js +127 -119
  53. package/dist/components/ui/TraceTree.js.map +1 -1
  54. package/dist/components/ui/index.d.ts +1 -1
  55. package/dist/components/ui/linkComponent.cjs +1 -1
  56. package/dist/components/ui/linkComponent.cjs.map +1 -1
  57. package/dist/components/ui/linkComponent.d.ts +6 -4
  58. package/dist/components/ui/linkComponent.js +12 -10
  59. package/dist/components/ui/linkComponent.js.map +1 -1
  60. package/dist/layouts/shell/AegisShell.cjs +1 -1
  61. package/dist/layouts/shell/AegisShell.cjs.map +1 -1
  62. package/dist/layouts/shell/AegisShell.js +24 -24
  63. package/dist/layouts/shell/AegisShell.js.map +1 -1
  64. package/dist/layouts/shell/RouterLink.cjs +1 -1
  65. package/dist/layouts/shell/RouterLink.cjs.map +1 -1
  66. package/dist/layouts/shell/RouterLink.js +14 -12
  67. package/dist/layouts/shell/RouterLink.js.map +1 -1
  68. package/dist/layouts/shell/types.d.ts +6 -0
  69. package/dist/lib/scrollView.cjs +1 -1
  70. package/dist/lib/scrollView.cjs.map +1 -1
  71. package/dist/lib/scrollView.d.ts +6 -0
  72. package/dist/lib/scrollView.js +26 -17
  73. package/dist/lib/scrollView.js.map +1 -1
  74. package/dist/locale/strings.cjs +1 -1
  75. package/dist/locale/strings.cjs.map +1 -1
  76. package/dist/locale/strings.d.ts +2 -0
  77. package/dist/locale/strings.js +7 -5
  78. package/dist/locale/strings.js.map +1 -1
  79. package/dist/style.css +1 -1
  80. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),e=require("react"),L=require("../../hooks/useIsomorphicLayoutEffect.cjs"),Q=require("../../hooks/useMediaQuery.cjs"),M=require("../../lib/scrollView.cjs");;/* empty css */const N=require("./selectedRowDetail.cjs"),A="(max-width: 768px)",O=e.createContext(null);function $(u,l,f,g,o){const p=o.top+g,a=u.top<p?u.top-p:Math.max(u.bottom-o.bottom,0);return Math.max(a,l+f-o.bottom)}function z({boxRef:u}){const l=e.useContext(O);return c.jsx("div",{ref:u,className:"aegis-detail-beside__inline",role:"group",children:l})}function F({columns:u,detail:l,children:f,revealKey:g,scrollContainer:o=null,className:p}){const a=Q.useMediaQuery(A),[P,x]=e.useState(!1),C=e.useRef(null),y=e.useRef(null),v=e.useRef(null),d=e.useRef(null),R=e.useRef(!1),E=e.useRef(0),w=e.useRef(g),j=e.useRef(void 0),B=e.useRef({children:f,detail:l}),i=e.useCallback(()=>{const t=d.current,s=v.current,r=y.current;if(t===null){r?.style.removeProperty("height");return}if(s===null)return;const n=t.getBoundingClientRect();if(r===null)s.style.setProperty("--aegis-detail-beside-row-height",`${String(n.height)}px`);else{const m=r.getBoundingClientRect().top;r.style.height=`${String(Math.max(n.top-m,0))}px`}},[]),h=e.useCallback(()=>{i();const t=d.current,s=v.current;if(t===null||s===null)return;const r=t.getBoundingClientRect(),n=y.current,m=$(r,n===null?r.bottom:n.getBoundingClientRect().top,s.getBoundingClientRect().height,parseFloat(getComputedStyle(s).scrollMarginTop),M.viewBoundsOf(o)),D=M.scrollerOf(o);Math.abs(m)>=1&&D.scrollBy({top:m,behavior:"instant"}),E.current=D.scrollTop},[i,o]),b=e.useCallback(()=>{j.current=w.current,R.current=!0,x(!0),queueMicrotask(()=>{h(),x(!1)})},[h]),S=e.useCallback(t=>{const s=t!==d.current;d.current=t,t===null?(R.current=!1,x(!1),i()):j.current!==w.current?b():(s&&(R.current=!1),i())},[i,b]),_=e.useCallback(()=>{x(!0)},[]);L.useIsomorphicLayoutEffect(()=>{const t=B.current.children!==f||B.current.detail!==l;B.current={children:f,detail:l},w.current=g,j.current!==g&&d.current!==null?b():(t&&(R.current=!1),i())}),L.useIsomorphicLayoutEffect(()=>{const t=C.current;if(t===null)return;const s=new ResizeObserver(()=>{R.current?h():i()});for(const n of a?[t]:[t,v.current])n!==null&&s.observe(n);const r=n=>{n.target instanceof Node&&d.current?.contains(n.target)&&b()};return t.addEventListener("click",r),()=>{s.disconnect(),t.removeEventListener("click",r)}},[a,i,h,b]),e.useEffect(()=>{const t=M.scrollerOf(o),s=o??window,r=()=>{Math.abs(t.scrollTop-E.current)>=1&&(R.current=!1)};return s.addEventListener("scroll",r,{passive:!0}),()=>{s.removeEventListener("scroll",r)}},[o]);const k=e.useMemo(()=>a?c.jsx(z,{boxRef:v}):null,[a]),I=e.useMemo(()=>({placeRow:S,awaitRow:_,inline:k}),[S,_,k]),q=c.jsx(N.SelectedRowDetailContext.Provider,{value:null,children:l}),T=["aegis-detail-beside",p??""].filter(Boolean).join(" ");return c.jsx(N.SelectedRowDetailContext.Provider,{value:I,children:c.jsx(O.Provider,{value:q,children:c.jsxs("div",{className:T,style:{"--aegis-detail-beside-columns":u},"aria-busy":P||void 0,children:[c.jsx("div",{ref:C,className:"aegis-detail-beside__list",children:f}),!a&&c.jsxs("div",{className:"aegis-detail-beside__side",children:[c.jsx("div",{ref:y}),c.jsx("div",{ref:v,className:"aegis-detail-beside__detail",children:q})]})]})})})}exports.DetailBeside=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),t=require("react"),H=require("../../hooks/useIsomorphicLayoutEffect.cjs"),Y=require("../../hooks/useMediaQuery.cjs"),E=require("../../lib/scrollView.cjs");;/* empty css */const U=require("./PaneLayout.cjs"),q=require("./selectedRowDetail.cjs"),G="(max-width: 768px)",D=t.createContext(null);function J(r,i,d,y,f){const a=f.top+y,c=r.top<a?r.top-a:Math.max(r.bottom-f.bottom,0);return Math.max(c,i+d-f.bottom)}function X({boxRef:r}){const i=t.useContext(D);return l.jsx("div",{ref:r,className:"aegis-detail-beside__inline",role:"group",children:i})}function Z(r){const{detail:i,children:d,revealKey:y}=r,f=r.layout==="panes",a=f||r.scrollContainer==="nearest",c=f||r.scrollContainer==="nearest"?null:r.scrollContainer??null,v=Y.useMediaQuery(G),[L,p]=t.useState(!1),h=t.useRef(null),P=t.useRef(null),m=t.useRef(null),B=t.useRef(null),N=t.useRef(null),g=t.useRef(null),R=t.useRef(!1),O=t.useRef(0),k=t.useRef(y),M=t.useRef(void 0),S=t.useRef({children:d,detail:i}),T=t.useRef(c),C=t.useCallback(()=>a&&h.current!==null?E.scrollingAncestorOf(h.current):c,[a,c]),I=t.useCallback(e=>{const n=C();if(n===null)e.style.removeProperty("--detail-beside-view-height"),e.style.removeProperty("--detail-beside-sticky-top");else{const{paddingTop:s,paddingBottom:o}=getComputedStyle(n),b=n.clientHeight-parseFloat(s)-parseFloat(o);e.style.setProperty("--detail-beside-view-height",`${String(b)}px`),e.style.setProperty("--detail-beside-sticky-top","0px")}},[C]),u=t.useCallback(()=>{const e=g.current,n=m.current,s=P.current;if(e===null){s?.style.removeProperty("height");return}if(n===null)return;const o=e.getBoundingClientRect();if(I(n),s===null)n.style.setProperty("--aegis-detail-beside-row-height",`${String(o.height)}px`);else{const b=s.getBoundingClientRect().top;s.style.height=`${String(Math.max(o.top-b,0))}px`}},[I]),w=t.useCallback(()=>{u();const e=g.current,n=h.current,s=m.current,o=B.current!==null;if(e===null||n===null||s===null&&!o)return;const b=C(),Q=e.getBoundingClientRect(),$=P.current,V=J(Q,$===null?Q.bottom:$.getBoundingClientRect().top,s===null?0:s.getBoundingClientRect().height,s===null?0:parseFloat(getComputedStyle(s).scrollMarginTop),E.viewBoundsOf(b)),_=E.scrollerOf(b);Math.abs(V)>=1&&_.scrollBy({top:V,behavior:"instant"}),N.current=_,O.current=_.scrollTop},[u,C]),x=t.useCallback(()=>{M.current=k.current,B.current?.parentElement?.scrollTo({top:0,behavior:"instant"}),R.current=!0,p(!0),queueMicrotask(()=>{w(),p(!1)})},[w]),z=t.useCallback(e=>{const n=e!==g.current;g.current=e,e===null?(R.current=!1,p(!1),u()):M.current!==k.current?x():(n&&(R.current=!1),u())},[u,x]),A=t.useCallback(()=>{p(!0)},[]);H.useIsomorphicLayoutEffect(()=>{const e=S.current.children!==d||S.current.detail!==i;S.current={children:d,detail:i},k.current=y;const n=T.current!==c;T.current=c,(n||M.current!==y)&&g.current!==null?x():(e&&(R.current=!1),u())}),H.useIsomorphicLayoutEffect(()=>{const e=h.current;if(e===null)return;const n=new ResizeObserver(()=>{R.current?w():u()});for(const o of v?[e]:[e,m.current])o!==null&&n.observe(o);const s=o=>{o.target instanceof Node&&g.current?.contains(o.target)&&x()};return e.addEventListener("click",s),()=>{n.disconnect(),e.removeEventListener("click",s)}},[v,u,w,x]),t.useEffect(()=>{const e=()=>{const o=N.current;o!==null&&Math.abs(o.scrollTop-O.current)>=1&&(R.current=!1)},n=a?document:c??window,s={capture:a,passive:!0};return n.addEventListener("scroll",e,s),()=>{n.removeEventListener("scroll",e,s)}},[a,c]);const F=t.useMemo(()=>v?l.jsx(X,{boxRef:m}):null,[v]),K=t.useMemo(()=>({placeRow:z,awaitRow:A,inline:F}),[z,A,F]),j=l.jsx(q.SelectedRowDetailContext.Provider,{value:null,children:i});if(r.layout==="panes")return l.jsx(q.SelectedRowDetailContext.Provider,{value:K,children:l.jsxs(D.Provider,{value:j,children:[l.jsx(U.Pane,{size:"fill",...r.listPane,children:l.jsx("div",{ref:h,className:"aegis-detail-beside__list","aria-busy":L||void 0,children:d})}),!v&&l.jsx(U.Pane,{size:"lg",...r.detailPane,children:l.jsx("div",{ref:B,children:j})})]})});const W=["aegis-detail-beside",r.className??""].filter(Boolean).join(" ");return l.jsx(q.SelectedRowDetailContext.Provider,{value:K,children:l.jsx(D.Provider,{value:j,children:l.jsxs("div",{className:W,style:{"--aegis-detail-beside-columns":r.columns},"aria-busy":L||void 0,children:[l.jsx("div",{ref:h,className:"aegis-detail-beside__list",children:d}),!v&&l.jsxs("div",{className:"aegis-detail-beside__side",children:[l.jsx("div",{ref:P}),l.jsx("div",{ref:m,className:"aegis-detail-beside__detail",children:j})]})]})})})}exports.DetailBeside=Z;
2
2
  //# sourceMappingURL=DetailBeside.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"DetailBeside.cjs","sources":["../../../src/components/ui/DetailBeside.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type ReactNode,\n type RefObject,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect';\nimport { useMediaQuery } from '../../hooks/useMediaQuery';\nimport {\n type ViewBounds,\n scrollerOf,\n viewBoundsOf,\n} from '../../lib/scrollView';\nimport './DetailBeside.css';\nimport {\n type SelectedRowDetail,\n SelectedRowDetailContext,\n} from './selectedRowDetail';\n\nexport interface DetailBesideProps {\n /**\n * `grid-template-columns` of the list and the detail above 768 px, e.g.\n * `'3fr 2fr'`.\n */\n columns: string;\n /**\n * The selected item's detail: one element, such as a `Panel` titled with\n * the item's name. It is never taller than the view, so a long Panel\n * scrolls its body. Render it anew from the host's data whenever that\n * data changes: that render tells DetailBeside the change was new data,\n * so the page stays where it is. A detail that fetches its own data and\n * redraws without this host rendering leaves the page following the row,\n * and its next change of size scrolls the page.\n */\n detail: ReactNode;\n /**\n * The list: a `TraceTree`, `FileTree`, `DataTable`, `TreeTable` or\n * `ServiceMap`, in a Panel say. The detail follows the row it draws\n * selected. Like `detail`, render it anew from the host's data whenever\n * that data changes, so the page stays where it is on new data; a list\n * that fetches its own data and redraws without this host rendering\n * leaves the page following the row, and its next change of size scrolls\n * the page.\n */\n children: ReactNode;\n /**\n * The selection as the page's address names it, or null where the\n * address names none and the list shows a default. It changes only by\n * the viewer's doing: a click, a key, a link, back or forward. The page\n * scrolls to the selected row when this changes, and on the first\n * placement after mount; a row that comes into place for new data, such\n * as a default the data moved, is only levelled with.\n */\n revealKey: string | null;\n /** The element that scrolls the page; omitted or null means the viewport. */\n scrollContainer?: HTMLElement | null;\n className?: string;\n}\n\nconst NARROW_QUERY = '(max-width: 768px)';\n\n/**\n * The detail as the inline slot draws it. It is kept out of the context the\n * lists read, so a new detail re-renders the slot and not the list.\n */\nconst DetailContext = createContext<ReactNode>(null);\n\n/**\n * How far to scroll so the row is in the view, clear of the `inset` at the\n * view's top, and the detail, whose top can rise no higher than `ceiling`,\n * fits above the view's bottom.\n */\nfunction revealDistance(\n row: DOMRect,\n ceiling: number,\n height: number,\n inset: number,\n view: ViewBounds,\n): number {\n const top = view.top + inset;\n const toRow =\n row.top < top ? row.top - top : Math.max(row.bottom - view.bottom, 0);\n return Math.max(toRow, ceiling + height - view.bottom);\n}\n\n/** The detail right after the selected row, at 768 px and below. */\nfunction InlineDetail({ boxRef }: { boxRef: RefObject<HTMLDivElement> }) {\n const detail = useContext(DetailContext);\n return (\n <div ref={boxRef} className=\"aegis-detail-beside__inline\" role=\"group\">\n {detail}\n </div>\n );\n}\n\n/**\n * A tree, table or map with the selected item's detail beside it. Above\n * 768 px the detail stands in a column on the right, level with the\n * selected row: when the row is too low for it, its bottom meets the\n * view's bottom, and while the page scrolls it stays in the view below\n * the header; while the list draws no row selected, it stands at the\n * column's top. At 768 px and below the list draws the detail right after\n * the selected row, the rows that follow under it; a map draws it over\n * the map, under the node. When the page opens with a selection,\n * `revealKey` changes or the viewer clicks the selected row, the page\n * scrolls at once, as little as it takes to show the row and the detail\n * whole, and again whenever the list or the detail changes size, until the\n * viewer scrolls or the host renders a new list or detail. Any other\n * placement, such as new data moving the selection or the rows, levels\n * the detail with its row by the same rule and leaves the page where it\n * is; the browser's scroll anchoring can still move it when rows arrive\n * above the view, unless the host sets `overflow-anchor: none` on its\n * scroller. The wrapper is `aria-busy` while a selected row it reveals is\n * still on its way.\n */\nexport function DetailBeside({\n columns,\n detail,\n children,\n revealKey,\n scrollContainer = null,\n className,\n}: DetailBesideProps) {\n const narrow = useMediaQuery(NARROW_QUERY);\n const [busy, setBusy] = useState(false);\n const listRef = useRef<HTMLDivElement>(null);\n const spacerRef = useRef<HTMLDivElement>(null);\n const detailRef = useRef<HTMLDivElement>(null);\n const rowRef = useRef<HTMLElement | null>(null);\n /** Whether the page is still where the last reveal left it. */\n const followRef = useRef(false);\n const revealedAtRef = useRef(0);\n /** The latest render's revealKey, and the last reveal's: undefined before the first. */\n const revealKeyRef = useRef(revealKey);\n const revealedKeyRef = useRef<string | null | undefined>(undefined);\n /** The latest render's list and detail, which change when the host renders them anew. */\n const shownRef = useRef({ children, detail });\n\n /**\n * Sets the detail level with the row: above 768 px through the spacer's\n * height, at and below by telling the inline detail how tall the row is.\n * While the list draws no row selected, such as when a filter or a closed\n * parent hides it, the detail stands at the top of its column.\n */\n const place = useCallback(() => {\n const row = rowRef.current;\n const box = detailRef.current;\n const spacer = spacerRef.current;\n if (row === null) {\n spacer?.style.removeProperty('height');\n return;\n }\n if (box === null) {\n return;\n }\n const rowBox = row.getBoundingClientRect();\n if (spacer === null) {\n box.style.setProperty(\n '--aegis-detail-beside-row-height',\n `${String(rowBox.height)}px`,\n );\n } else {\n const top = spacer.getBoundingClientRect().top;\n spacer.style.height = `${String(Math.max(rowBox.top - top, 0))}px`;\n }\n }, []);\n\n /** Places the row and scrolls as little as it takes to show it and its detail whole. */\n const reveal = useCallback(() => {\n place();\n const row = rowRef.current;\n const box = detailRef.current;\n if (row === null || box === null) {\n return;\n }\n const rowBox = row.getBoundingClientRect();\n const spacer = spacerRef.current;\n const distance = revealDistance(\n rowBox,\n spacer === null ? rowBox.bottom : spacer.getBoundingClientRect().top,\n box.getBoundingClientRect().height,\n parseFloat(getComputedStyle(box).scrollMarginTop),\n viewBoundsOf(scrollContainer),\n );\n const scroller = scrollerOf(scrollContainer);\n if (Math.abs(distance) >= 1) {\n scroller.scrollBy({ top: distance, behavior: 'instant' });\n }\n revealedAtRef.current = scroller.scrollTop;\n }, [place, scrollContainer]);\n\n // A list places its row while React attaches refs, before the detail's\n // own ref is in and before the re-renders its layout effects ask for,\n // so the reveal waits for the commit to finish.\n const revealSoon = useCallback(() => {\n revealedKeyRef.current = revealKeyRef.current;\n followRef.current = true;\n setBusy(true);\n queueMicrotask(() => {\n reveal();\n setBusy(false);\n });\n }, [reveal]);\n\n // A row placed while a reveal is due is revealed; any other is levelled\n // with, and a new one ends following.\n const placeRow = useCallback(\n (row: HTMLElement | null) => {\n const fresh = row !== rowRef.current;\n rowRef.current = row;\n if (row === null) {\n followRef.current = false;\n setBusy(false);\n place();\n } else if (revealedKeyRef.current !== revealKeyRef.current) {\n revealSoon();\n } else {\n if (fresh) {\n followRef.current = false;\n }\n place();\n }\n },\n [place, revealSoon],\n );\n\n const awaitRow = useCallback(() => {\n setBusy(true);\n }, []);\n\n // Runs after the lists have placed their rows in this commit, so a new\n // revealKey reveals the row it selects. A render by the host without one\n // ends following.\n useIsomorphicLayoutEffect(() => {\n const rendered =\n shownRef.current.children !== children ||\n shownRef.current.detail !== detail;\n shownRef.current = { children, detail };\n revealKeyRef.current = revealKey;\n if (revealedKeyRef.current !== revealKey && rowRef.current !== null) {\n revealSoon();\n } else {\n if (rendered) {\n followRef.current = false;\n }\n place();\n }\n });\n\n useIsomorphicLayoutEffect(() => {\n const list = listRef.current;\n if (list === null) {\n return undefined;\n }\n const observer = new ResizeObserver(() => {\n if (followRef.current) {\n reveal();\n } else {\n place();\n }\n });\n // At 768 px and below the detail lies inside the list.\n for (const box of narrow ? [list] : [list, detailRef.current]) {\n if (box !== null) {\n observer.observe(box);\n }\n }\n const activate = (event: MouseEvent): void => {\n if (\n event.target instanceof Node &&\n rowRef.current?.contains(event.target)\n ) {\n revealSoon();\n }\n };\n list.addEventListener('click', activate);\n return () => {\n observer.disconnect();\n list.removeEventListener('click', activate);\n };\n }, [narrow, place, reveal, revealSoon]);\n\n useEffect(() => {\n const scroller = scrollerOf(scrollContainer);\n const target = scrollContainer ?? window;\n const scrolled = (): void => {\n if (Math.abs(scroller.scrollTop - revealedAtRef.current) >= 1) {\n followRef.current = false;\n }\n };\n target.addEventListener('scroll', scrolled, { passive: true });\n return () => {\n target.removeEventListener('scroll', scrolled);\n };\n }, [scrollContainer]);\n\n const inline = useMemo(\n () => (narrow ? <InlineDetail boxRef={detailRef} /> : null),\n [narrow],\n );\n const slot = useMemo(\n (): SelectedRowDetail => ({ placeRow, awaitRow, inline }),\n [placeRow, awaitRow, inline],\n );\n const isolated = (\n <SelectedRowDetailContext.Provider value={null}>\n {detail}\n </SelectedRowDetailContext.Provider>\n );\n\n const cls = ['aegis-detail-beside', className ?? '']\n .filter(Boolean)\n .join(' ');\n\n return (\n <SelectedRowDetailContext.Provider value={slot}>\n <DetailContext.Provider value={isolated}>\n <div\n className={cls}\n style={{ '--aegis-detail-beside-columns': columns } as CSSProperties}\n aria-busy={busy || undefined}\n >\n <div ref={listRef} className=\"aegis-detail-beside__list\">\n {children}\n </div>\n {!narrow && (\n <div className=\"aegis-detail-beside__side\">\n <div ref={spacerRef} />\n <div ref={detailRef} className=\"aegis-detail-beside__detail\">\n {isolated}\n </div>\n </div>\n )}\n </div>\n </DetailContext.Provider>\n </SelectedRowDetailContext.Provider>\n );\n}\n"],"names":["NARROW_QUERY","DetailContext","createContext","revealDistance","row","ceiling","height","inset","view","top","toRow","InlineDetail","boxRef","detail","useContext","jsx","DetailBeside","columns","children","revealKey","scrollContainer","className","narrow","useMediaQuery","busy","setBusy","useState","listRef","useRef","spacerRef","detailRef","rowRef","followRef","revealedAtRef","revealKeyRef","revealedKeyRef","shownRef","place","useCallback","box","spacer","rowBox","reveal","distance","viewBoundsOf","scroller","scrollerOf","revealSoon","placeRow","fresh","awaitRow","useIsomorphicLayoutEffect","rendered","list","observer","activate","event","useEffect","target","scrolled","inline","useMemo","slot","isolated","SelectedRowDetailContext","cls","jsxs"],"mappings":"6VAkEMA,EAAe,qBAMfC,EAAgBC,EAAAA,cAAyB,IAAI,EAOnD,SAASC,EACPC,EACAC,EACAC,EACAC,EACAC,EACQ,CACR,MAAMC,EAAMD,EAAK,IAAMD,EACjBG,EACJN,EAAI,IAAMK,EAAML,EAAI,IAAMK,EAAM,KAAK,IAAIL,EAAI,OAASI,EAAK,OAAQ,CAAC,EACtE,OAAO,KAAK,IAAIE,EAAOL,EAAUC,EAASE,EAAK,MAAM,CACvD,CAGA,SAASG,EAAa,CAAE,OAAAC,GAAiD,CACvE,MAAMC,EAASC,EAAAA,WAAWb,CAAa,EACvC,OACEc,MAAC,OAAI,IAAKH,EAAQ,UAAU,8BAA8B,KAAK,QAC5D,SAAAC,CAAA,CACH,CAEJ,CAsBO,SAASG,EAAa,CAC3B,QAAAC,EACA,OAAAJ,EACA,SAAAK,EACA,UAAAC,EACA,gBAAAC,EAAkB,KAClB,UAAAC,CACF,EAAsB,CACpB,MAAMC,EAASC,EAAAA,cAAcvB,CAAY,EACnC,CAACwB,EAAMC,CAAO,EAAIC,EAAAA,SAAS,EAAK,EAChCC,EAAUC,EAAAA,OAAuB,IAAI,EACrCC,EAAYD,EAAAA,OAAuB,IAAI,EACvCE,EAAYF,EAAAA,OAAuB,IAAI,EACvCG,EAASH,EAAAA,OAA2B,IAAI,EAExCI,EAAYJ,EAAAA,OAAO,EAAK,EACxBK,EAAgBL,EAAAA,OAAO,CAAC,EAExBM,EAAe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c,CAAA,CAAW,QACpB,MAAA,CAAI,IAAKC,EAAW,UAAU,8BAC5B,SAAAiC,CAAA,CACH,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,EAGN,CAAA,CACF,CAEJ"}
1
+ {"version":3,"file":"DetailBeside.cjs","sources":["../../../src/components/ui/DetailBeside.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type ReactNode,\n type RefObject,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect';\nimport { useMediaQuery } from '../../hooks/useMediaQuery';\nimport {\n type ViewBounds,\n scrollerOf,\n scrollingAncestorOf,\n viewBoundsOf,\n} from '../../lib/scrollView';\nimport './DetailBeside.css';\nimport { Pane, type PaneProps } from './PaneLayout';\nimport {\n type SelectedRowDetail,\n SelectedRowDetailContext,\n} from './selectedRowDetail';\n\ninterface DetailBesideBaseProps {\n /**\n * The selected item's detail: one element, such as a `Panel` titled with\n * the item's name. Render it anew from the host's data whenever that\n * data changes: that render tells DetailBeside the change was new data,\n * so the page stays where it is. A detail that fetches its own data and\n * redraws without this host rendering leaves the page following the row,\n * and its next change of size scrolls the page.\n */\n detail: ReactNode;\n /**\n * The list: a `TraceTree`, `FileTree`, `DataTable`, `TreeTable` or\n * `ServiceMap`, in a Panel say. The detail follows the row it draws\n * selected. Like `detail`, render it anew from the host's data whenever\n * that data changes, so the page stays where it is on new data; a list\n * that fetches its own data and redraws without this host rendering\n * leaves the page following the row, and its next change of size scrolls\n * the page.\n */\n children: ReactNode;\n /**\n * The selection as the page's address names it, or null where the\n * address names none and the list shows a default. It changes only by\n * the viewer's doing: a click, a key, a link, back or forward. The page\n * scrolls to the selected row when this changes, and on the first\n * placement after mount; a row that comes into place for new data, such\n * as a default the data moved, is only levelled with.\n */\n revealKey: string | null;\n}\n\n/** The column form: the list and the detail in a grid of their own. */\nexport interface DetailBesideColumnsProps extends DetailBesideBaseProps {\n layout?: 'columns';\n /**\n * `grid-template-columns` of the list and the detail above 768 px, e.g.\n * `'3fr 2fr'`. The detail is never taller than the view, so a long Panel\n * scrolls its body.\n */\n columns: string;\n /**\n * The element that scrolls the page; omitted or null means the viewport.\n * `nearest` is the nearest element around the list that scrolls, found at\n * each reveal, such as the `Pane` the DetailBeside is set in. Inside an\n * element the detail is never taller than that element's view.\n */\n scrollContainer?: HTMLElement | null | 'nearest';\n className?: string;\n}\n\n/** A `Pane` of the pane form, as `Pane` takes it but for its content. */\nexport type DetailBesidePane = Omit<PaneProps, 'children'>;\n\n/**\n * The pane form: the list and the detail as two `Pane`s, set directly in a\n * `PaneLayout` after any panes that come before the list.\n */\nexport interface DetailBesidePanesProps extends DetailBesideBaseProps {\n layout: 'panes';\n /** The list's pane; `size` defaults to `fill`. */\n listPane?: DetailBesidePane;\n /** The detail's pane above 768 px; `size` defaults to `lg`. */\n detailPane?: DetailBesidePane;\n}\n\nexport type DetailBesideProps =\n | DetailBesideColumnsProps\n | DetailBesidePanesProps;\n\nconst NARROW_QUERY = '(max-width: 768px)';\n\n/**\n * The detail as the inline slot draws it. It is kept out of the context the\n * lists read, so a new detail re-renders the slot and not the list.\n */\nconst DetailContext = createContext<ReactNode>(null);\n\n/**\n * How far to scroll so the row is in the view, clear of the `inset` at the\n * view's top, and the detail, whose top can rise no higher than `ceiling`,\n * fits above the view's bottom.\n */\nfunction revealDistance(\n row: DOMRect,\n ceiling: number,\n height: number,\n inset: number,\n view: ViewBounds,\n): number {\n const top = view.top + inset;\n const toRow =\n row.top < top ? row.top - top : Math.max(row.bottom - view.bottom, 0);\n return Math.max(toRow, ceiling + height - view.bottom);\n}\n\n/** The detail right after the selected row, at 768 px and below. */\nfunction InlineDetail({ boxRef }: { boxRef: RefObject<HTMLDivElement> }) {\n const detail = useContext(DetailContext);\n return (\n <div ref={boxRef} className=\"aegis-detail-beside__inline\" role=\"group\">\n {detail}\n </div>\n );\n}\n\n/**\n * A tree, table or map with the selected item's detail beside it. Above\n * 768 px the detail stands in a column on the right, level with the\n * selected row: when the row is too low for it, its bottom meets the\n * view's bottom, and while the page scrolls it stays in the view below\n * the header; while the list draws no row selected, it stands at the\n * column's top. At 768 px and below the list draws the detail right after\n * the selected row, the rows that follow under it; a map draws it over\n * the map, under the node. When the page opens with a selection,\n * `revealKey` changes or the viewer clicks the selected row, the page\n * scrolls at once, as little as it takes to show the row and the detail\n * whole, and again whenever the list or the detail changes size, until the\n * viewer scrolls or the host renders a new list or detail. Any other\n * placement, such as new data moving the selection or the rows, levels\n * the detail with its row by the same rule and leaves the page where it\n * is; the browser's scroll anchoring can still move it when rows arrive\n * above the view, unless the host sets `overflow-anchor: none` on its\n * scroller. The wrapper is `aria-busy` while a selected row it reveals is\n * still on its way.\n *\n * With `layout=\"panes\"` the list and the detail are two `Pane`s of the\n * `PaneLayout` it is set in, divided by a hairline, and each scrolls on its\n * own. Above 768 px the detail stands at its pane's top, and a reveal\n * scrolls the list's pane to the row and the detail's pane to its top. At\n * 768 px and below there is only the list's pane, which draws the detail\n * right after the selected row as the column form does, and a reveal\n * scrolls the nearest scroller around it, the stacked `PaneLayout` in a\n * bleed page. The list is `aria-busy` while a selected row is on its way.\n */\nexport function DetailBeside(props: DetailBesideProps) {\n const { detail, children, revealKey } = props;\n const panes = props.layout === 'panes';\n /** Whether the scroller is whichever holds the list, found when needed. */\n const nearest = panes || props.scrollContainer === 'nearest';\n const scrollContainer =\n panes || props.scrollContainer === 'nearest'\n ? null\n : (props.scrollContainer ?? null);\n const narrow = useMediaQuery(NARROW_QUERY);\n const [busy, setBusy] = useState(false);\n const listRef = useRef<HTMLDivElement>(null);\n const spacerRef = useRef<HTMLDivElement>(null);\n const detailRef = useRef<HTMLDivElement>(null);\n /** Above 768 px in the pane form, the detail's box, whose parent is its pane. */\n const detailPaneRef = useRef<HTMLDivElement>(null);\n /** The scroller of the last reveal, whose scroll by the viewer ends following. */\n const scrollerRef = useRef<HTMLElement | null>(null);\n const rowRef = useRef<HTMLElement | null>(null);\n /** Whether the page is still where the last reveal left it. */\n const followRef = useRef(false);\n const revealedAtRef = useRef(0);\n /** The latest render's revealKey, and the last reveal's: undefined before the first. */\n const revealKeyRef = useRef(revealKey);\n const revealedKeyRef = useRef<string | null | undefined>(undefined);\n /** The latest render's list and detail, which change when the host renders them anew. */\n const shownRef = useRef({ children, detail });\n /** The scroll container of the latest render; a new one is revealed in anew. */\n const containerRef = useRef(scrollContainer);\n\n /** The element that scrolls the list, or null for the viewport. */\n const scrollerOfList = useCallback(\n (): HTMLElement | null =>\n nearest && listRef.current !== null\n ? scrollingAncestorOf(listRef.current)\n : scrollContainer,\n [nearest, scrollContainer],\n );\n\n /** Bounds the detail by the view of the element that scrolls it. */\n const fitView = useCallback(\n (box: HTMLElement) => {\n const scroller = scrollerOfList();\n if (scroller === null) {\n box.style.removeProperty('--detail-beside-view-height');\n box.style.removeProperty('--detail-beside-sticky-top');\n } else {\n // A sticky box sticks inside the scroller's padding.\n const { paddingTop, paddingBottom } = getComputedStyle(scroller);\n const height =\n scroller.clientHeight -\n parseFloat(paddingTop) -\n parseFloat(paddingBottom);\n box.style.setProperty(\n '--detail-beside-view-height',\n `${String(height)}px`,\n );\n box.style.setProperty('--detail-beside-sticky-top', '0px');\n }\n },\n [scrollerOfList],\n );\n\n /**\n * Sets the detail level with the row: above 768 px through the spacer's\n * height, at and below by telling the inline detail how tall the row is.\n * While the list draws no row selected, such as when a filter or a closed\n * parent hides it, the detail stands at the top of its column.\n */\n const place = useCallback(() => {\n const row = rowRef.current;\n const box = detailRef.current;\n const spacer = spacerRef.current;\n if (row === null) {\n spacer?.style.removeProperty('height');\n return;\n }\n if (box === null) {\n return;\n }\n const rowBox = row.getBoundingClientRect();\n fitView(box);\n if (spacer === null) {\n box.style.setProperty(\n '--aegis-detail-beside-row-height',\n `${String(rowBox.height)}px`,\n );\n } else {\n const top = spacer.getBoundingClientRect().top;\n spacer.style.height = `${String(Math.max(rowBox.top - top, 0))}px`;\n }\n }, [fitView]);\n\n /** Places the row and scrolls as little as it takes to show it and its detail whole. */\n const reveal = useCallback(() => {\n place();\n const row = rowRef.current;\n const list = listRef.current;\n const box = detailRef.current;\n // The detail's own pane, above 768 px, leaves only the row to show.\n const besidePane = detailPaneRef.current !== null;\n if (row === null || list === null || (box === null && !besidePane)) {\n return;\n }\n const container = scrollerOfList();\n const rowBox = row.getBoundingClientRect();\n const spacer = spacerRef.current;\n const distance = revealDistance(\n rowBox,\n spacer === null ? rowBox.bottom : spacer.getBoundingClientRect().top,\n box === null ? 0 : box.getBoundingClientRect().height,\n box === null ? 0 : parseFloat(getComputedStyle(box).scrollMarginTop),\n viewBoundsOf(container),\n );\n const scroller = scrollerOf(container);\n if (Math.abs(distance) >= 1) {\n scroller.scrollBy({ top: distance, behavior: 'instant' });\n }\n scrollerRef.current = scroller;\n revealedAtRef.current = scroller.scrollTop;\n }, [place, scrollerOfList]);\n\n // A list places its row while React attaches refs, before the detail's\n // own ref is in and before the re-renders its layout effects ask for,\n // so the reveal waits for the commit to finish.\n const revealSoon = useCallback(() => {\n revealedKeyRef.current = revealKeyRef.current;\n detailPaneRef.current?.parentElement?.scrollTo({\n top: 0,\n behavior: 'instant',\n });\n followRef.current = true;\n setBusy(true);\n queueMicrotask(() => {\n reveal();\n setBusy(false);\n });\n }, [reveal]);\n\n // A row placed while a reveal is due is revealed; any other is levelled\n // with, and a new one ends following.\n const placeRow = useCallback(\n (row: HTMLElement | null) => {\n const fresh = row !== rowRef.current;\n rowRef.current = row;\n if (row === null) {\n followRef.current = false;\n setBusy(false);\n place();\n } else if (revealedKeyRef.current !== revealKeyRef.current) {\n revealSoon();\n } else {\n if (fresh) {\n followRef.current = false;\n }\n place();\n }\n },\n [place, revealSoon],\n );\n\n const awaitRow = useCallback(() => {\n setBusy(true);\n }, []);\n\n // Runs after the lists have placed their rows in this commit, so a new\n // revealKey reveals the row it selects. A render by the host without one\n // ends following.\n useIsomorphicLayoutEffect(() => {\n const rendered =\n shownRef.current.children !== children ||\n shownRef.current.detail !== detail;\n shownRef.current = { children, detail };\n revealKeyRef.current = revealKey;\n const moved = containerRef.current !== scrollContainer;\n containerRef.current = scrollContainer;\n if (\n (moved || revealedKeyRef.current !== revealKey) &&\n rowRef.current !== null\n ) {\n revealSoon();\n } else {\n if (rendered) {\n followRef.current = false;\n }\n place();\n }\n });\n\n useIsomorphicLayoutEffect(() => {\n const list = listRef.current;\n if (list === null) {\n return undefined;\n }\n const observer = new ResizeObserver(() => {\n if (followRef.current) {\n reveal();\n } else {\n place();\n }\n });\n // At 768 px and below the detail lies inside the list.\n for (const box of narrow ? [list] : [list, detailRef.current]) {\n if (box !== null) {\n observer.observe(box);\n }\n }\n const activate = (event: MouseEvent): void => {\n if (\n event.target instanceof Node &&\n rowRef.current?.contains(event.target)\n ) {\n revealSoon();\n }\n };\n list.addEventListener('click', activate);\n return () => {\n observer.disconnect();\n list.removeEventListener('click', activate);\n };\n }, [narrow, place, reveal, revealSoon]);\n\n useEffect(() => {\n const scrolled = (): void => {\n const scroller = scrollerRef.current;\n if (\n scroller !== null &&\n Math.abs(scroller.scrollTop - revealedAtRef.current) >= 1\n ) {\n followRef.current = false;\n }\n };\n // A nearest scroller is whichever holds the list, found at each\n // reveal; scroll events do not bubble, but they pass the document.\n const target = nearest ? document : (scrollContainer ?? window);\n const options = { capture: nearest, passive: true };\n target.addEventListener('scroll', scrolled, options);\n return () => {\n target.removeEventListener('scroll', scrolled, options);\n };\n }, [nearest, scrollContainer]);\n\n const inline = useMemo(\n () => (narrow ? <InlineDetail boxRef={detailRef} /> : null),\n [narrow],\n );\n const slot = useMemo(\n (): SelectedRowDetail => ({ placeRow, awaitRow, inline }),\n [placeRow, awaitRow, inline],\n );\n const isolated = (\n <SelectedRowDetailContext.Provider value={null}>\n {detail}\n </SelectedRowDetailContext.Provider>\n );\n\n if (props.layout === 'panes') {\n return (\n <SelectedRowDetailContext.Provider value={slot}>\n <DetailContext.Provider value={isolated}>\n <Pane size=\"fill\" {...props.listPane}>\n <div\n ref={listRef}\n className=\"aegis-detail-beside__list\"\n aria-busy={busy || undefined}\n >\n {children}\n </div>\n </Pane>\n {!narrow && (\n <Pane size=\"lg\" {...props.detailPane}>\n <div ref={detailPaneRef}>{isolated}</div>\n </Pane>\n )}\n </DetailContext.Provider>\n </SelectedRowDetailContext.Provider>\n );\n }\n\n const cls = ['aegis-detail-beside', props.className ?? '']\n .filter(Boolean)\n .join(' ');\n\n return (\n <SelectedRowDetailContext.Provider value={slot}>\n <DetailContext.Provider value={isolated}>\n <div\n className={cls}\n style={\n {\n '--aegis-detail-beside-columns': props.columns,\n } as CSSProperties\n }\n aria-busy={busy || undefined}\n >\n <div ref={listRef} className=\"aegis-detail-beside__list\">\n {children}\n </div>\n {!narrow && (\n <div className=\"aegis-detail-beside__side\">\n <div ref={spacerRef} />\n <div ref={detailRef} className=\"aegis-detail-beside__detail\">\n {isolated}\n </div>\n </div>\n )}\n </div>\n </DetailContext.Provider>\n </SelectedRowDetailContext.Provider>\n );\n}\n"],"names":["NARROW_QUERY","DetailContext","createContext","revealDistance","row","ceiling","height","inset","view","top","toRow","InlineDetail","boxRef","detail","useContext","jsx","DetailBeside","props","children","revealKey","panes","nearest","scrollContainer","narrow","useMediaQuery","busy","setBusy","useState","listRef","useRef","spacerRef","detailRef","detailPaneRef","scrollerRef","rowRef","followRef","revealedAtRef","revealKeyRef","revealedKeyRef","shownRef","containerRef","scrollerOfList","useCallback","scrollingAncestorOf","fitView","box","scroller","paddingTop","paddingBottom","place","spacer","rowBox","reveal","list","besidePane","container","distance","viewBoundsOf","scrollerOf","revealSoon","placeRow","fresh","awaitRow","useIsomorphicLayoutEffect","rendered","moved","observer","activate","event","useEffect","scrolled","target","options","inline","useMemo","slot","isolated","SelectedRowDetailContext","jsxs","Pane","cls"],"mappings":"2XAiGMA,EAAe,qBAMfC,EAAgBC,EAAAA,cAAyB,IAAI,EAOnD,SAASC,EACPC,EACAC,EACAC,EACAC,EACAC,EACQ,CACR,MAAM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AA,CAAI,IAAKe,CAAA,CAAW,QACpB,MAAA,CAAI,IAAKC,EAAW,UAAU,8BAC5B,SAAA6C,CAAA,CACH,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,EAGN,CAAA,CACF,CAEJ"}
@@ -1,14 +1,9 @@
1
1
  import { ReactNode } from 'react';
2
- export interface DetailBesideProps {
3
- /**
4
- * `grid-template-columns` of the list and the detail above 768 px, e.g.
5
- * `'3fr 2fr'`.
6
- */
7
- columns: string;
2
+ import { PaneProps } from './PaneLayout';
3
+ interface DetailBesideBaseProps {
8
4
  /**
9
5
  * The selected item's detail: one element, such as a `Panel` titled with
10
- * the item's name. It is never taller than the view, so a long Panel
11
- * scrolls its body. Render it anew from the host's data whenever that
6
+ * the item's name. Render it anew from the host's data whenever that
12
7
  * data changes: that render tells DetailBeside the change was new data,
13
8
  * so the page stays where it is. A detail that fetches its own data and
14
9
  * redraws without this host rendering leaves the page following the row,
@@ -34,10 +29,39 @@ export interface DetailBesideProps {
34
29
  * as a default the data moved, is only levelled with.
35
30
  */
36
31
  revealKey: string | null;
37
- /** The element that scrolls the page; omitted or null means the viewport. */
38
- scrollContainer?: HTMLElement | null;
32
+ }
33
+ /** The column form: the list and the detail in a grid of their own. */
34
+ export interface DetailBesideColumnsProps extends DetailBesideBaseProps {
35
+ layout?: 'columns';
36
+ /**
37
+ * `grid-template-columns` of the list and the detail above 768 px, e.g.
38
+ * `'3fr 2fr'`. The detail is never taller than the view, so a long Panel
39
+ * scrolls its body.
40
+ */
41
+ columns: string;
42
+ /**
43
+ * The element that scrolls the page; omitted or null means the viewport.
44
+ * `nearest` is the nearest element around the list that scrolls, found at
45
+ * each reveal, such as the `Pane` the DetailBeside is set in. Inside an
46
+ * element the detail is never taller than that element's view.
47
+ */
48
+ scrollContainer?: HTMLElement | null | 'nearest';
39
49
  className?: string;
40
50
  }
51
+ /** A `Pane` of the pane form, as `Pane` takes it but for its content. */
52
+ export type DetailBesidePane = Omit<PaneProps, 'children'>;
53
+ /**
54
+ * The pane form: the list and the detail as two `Pane`s, set directly in a
55
+ * `PaneLayout` after any panes that come before the list.
56
+ */
57
+ export interface DetailBesidePanesProps extends DetailBesideBaseProps {
58
+ layout: 'panes';
59
+ /** The list's pane; `size` defaults to `fill`. */
60
+ listPane?: DetailBesidePane;
61
+ /** The detail's pane above 768 px; `size` defaults to `lg`. */
62
+ detailPane?: DetailBesidePane;
63
+ }
64
+ export type DetailBesideProps = DetailBesideColumnsProps | DetailBesidePanesProps;
41
65
  /**
42
66
  * A tree, table or map with the selected item's detail beside it. Above
43
67
  * 768 px the detail stands in a column on the right, level with the
@@ -57,5 +81,15 @@ export interface DetailBesideProps {
57
81
  * above the view, unless the host sets `overflow-anchor: none` on its
58
82
  * scroller. The wrapper is `aria-busy` while a selected row it reveals is
59
83
  * still on its way.
84
+ *
85
+ * With `layout="panes"` the list and the detail are two `Pane`s of the
86
+ * `PaneLayout` it is set in, divided by a hairline, and each scrolls on its
87
+ * own. Above 768 px the detail stands at its pane's top, and a reveal
88
+ * scrolls the list's pane to the row and the detail's pane to its top. At
89
+ * 768 px and below there is only the list's pane, which draws the detail
90
+ * right after the selected row as the column form does, and a reveal
91
+ * scrolls the nearest scroller around it, the stacked `PaneLayout` in a
92
+ * bleed page. The list is `aria-busy` while a selected row is on its way.
60
93
  */
61
- export declare function DetailBeside({ columns, detail, children, revealKey, scrollContainer, className, }: DetailBesideProps): import("react/jsx-runtime").JSX.Element;
94
+ export declare function DetailBeside(props: DetailBesideProps): import("react/jsx-runtime").JSX.Element;
95
+ export {};
@@ -1,121 +1,154 @@
1
- import { jsx as i, jsxs as k } from "react/jsx-runtime";
2
- import { useState as z, useRef as s, useCallback as h, useEffect as F, useMemo as O, useContext as U, createContext as W } from "react";
3
- import { useIsomorphicLayoutEffect as j } from "../../hooks/useIsomorphicLayoutEffect.js";
4
- import { useMediaQuery as Y } from "../../hooks/useMediaQuery.js";
5
- import { viewBoundsOf as G, scrollerOf as T } from "../../lib/scrollView.js";
1
+ import { jsx as o, jsxs as L } from "react/jsx-runtime";
2
+ import { useState as J, useRef as s, useCallback as f, useEffect as X, useMemo as V, useContext as Z, createContext as ee } from "react";
3
+ import { useIsomorphicLayoutEffect as W } from "../../hooks/useIsomorphicLayoutEffect.js";
4
+ import { useMediaQuery as te } from "../../hooks/useMediaQuery.js";
5
+ import { scrollingAncestorOf as ne, viewBoundsOf as re, scrollerOf as le } from "../../lib/scrollView.js";
6
6
  /* empty css */
7
- import { SelectedRowDetailContext as A } from "./selectedRowDetail.js";
8
- const H = "(max-width: 768px)", I = W(null);
9
- function J(u, c, f, m, o) {
10
- const b = o.top + m, a = u.top < b ? u.top - b : Math.max(u.bottom - o.bottom, 0);
11
- return Math.max(a, c + f - o.bottom);
7
+ import { Pane as Y } from "./PaneLayout.js";
8
+ import { SelectedRowDetailContext as O } from "./selectedRowDetail.js";
9
+ const oe = "(max-width: 768px)", D = ee(null);
10
+ function se(r, c, d, b, v) {
11
+ const a = v.top + b, i = r.top < a ? r.top - a : Math.max(r.bottom - v.bottom, 0);
12
+ return Math.max(i, c + d - v.bottom);
12
13
  }
13
- function K({ boxRef: u }) {
14
- const c = U(I);
15
- return /* @__PURE__ */ i("div", { ref: u, className: "aegis-detail-beside__inline", role: "group", children: c });
14
+ function ie({ boxRef: r }) {
15
+ const c = Z(D);
16
+ return /* @__PURE__ */ o("div", { ref: r, className: "aegis-detail-beside__inline", role: "group", children: c });
16
17
  }
17
- function oe({
18
- columns: u,
19
- detail: c,
20
- children: f,
21
- revealKey: m,
22
- scrollContainer: o = null,
23
- className: b
24
- }) {
25
- const a = Y(H), [Q, R] = z(!1), E = s(null), y = s(null), g = s(null), d = s(null), p = s(!1), N = s(0), B = s(m), M = s(void 0), _ = s({ children: f, detail: c }), l = h(() => {
26
- const e = d.current, t = g.current, r = y.current;
18
+ function ge(r) {
19
+ const { detail: c, children: d, revealKey: b } = r, v = r.layout === "panes", a = v || r.scrollContainer === "nearest", i = v || r.scrollContainer === "nearest" ? null : r.scrollContainer ?? null, m = te(oe), [T, w] = J(!1), h = s(null), _ = s(null), R = s(null), M = s(null), j = s(null), g = s(null), p = s(!1), z = s(0), N = s(b), E = s(void 0), S = s({ children: d, detail: c }), A = s(i), C = f(
20
+ () => a && h.current !== null ? ne(h.current) : i,
21
+ [a, i]
22
+ ), F = f(
23
+ (e) => {
24
+ const t = C();
25
+ if (t === null)
26
+ e.style.removeProperty("--detail-beside-view-height"), e.style.removeProperty("--detail-beside-sticky-top");
27
+ else {
28
+ const { paddingTop: n, paddingBottom: l } = getComputedStyle(t), y = t.clientHeight - parseFloat(n) - parseFloat(l);
29
+ e.style.setProperty(
30
+ "--detail-beside-view-height",
31
+ `${String(y)}px`
32
+ ), e.style.setProperty("--detail-beside-sticky-top", "0px");
33
+ }
34
+ },
35
+ [C]
36
+ ), u = f(() => {
37
+ const e = g.current, t = R.current, n = _.current;
27
38
  if (e === null) {
28
- r?.style.removeProperty("height");
39
+ n?.style.removeProperty("height");
29
40
  return;
30
41
  }
31
42
  if (t === null)
32
43
  return;
33
- const n = e.getBoundingClientRect();
34
- if (r === null)
44
+ const l = e.getBoundingClientRect();
45
+ if (F(t), n === null)
35
46
  t.style.setProperty(
36
47
  "--aegis-detail-beside-row-height",
37
- `${String(n.height)}px`
48
+ `${String(l.height)}px`
38
49
  );
39
50
  else {
40
- const w = r.getBoundingClientRect().top;
41
- r.style.height = `${String(Math.max(n.top - w, 0))}px`;
51
+ const y = n.getBoundingClientRect().top;
52
+ n.style.height = `${String(Math.max(l.top - y, 0))}px`;
42
53
  }
43
- }, []), x = h(() => {
44
- l();
45
- const e = d.current, t = g.current;
46
- if (e === null || t === null)
54
+ }, [F]), P = f(() => {
55
+ u();
56
+ const e = g.current, t = h.current, n = R.current, l = M.current !== null;
57
+ if (e === null || t === null || n === null && !l)
47
58
  return;
48
- const r = e.getBoundingClientRect(), n = y.current, w = J(
49
- r,
50
- n === null ? r.bottom : n.getBoundingClientRect().top,
51
- t.getBoundingClientRect().height,
52
- parseFloat(getComputedStyle(t).scrollMarginTop),
53
- G(o)
54
- ), P = T(o);
55
- Math.abs(w) >= 1 && P.scrollBy({ top: w, behavior: "instant" }), N.current = P.scrollTop;
56
- }, [l, o]), v = h(() => {
57
- M.current = B.current, p.current = !0, R(!0), queueMicrotask(() => {
58
- x(), R(!1);
59
+ const y = C(), q = e.getBoundingClientRect(), H = _.current, U = se(
60
+ q,
61
+ H === null ? q.bottom : H.getBoundingClientRect().top,
62
+ n === null ? 0 : n.getBoundingClientRect().height,
63
+ n === null ? 0 : parseFloat(getComputedStyle(n).scrollMarginTop),
64
+ re(y)
65
+ ), k = le(y);
66
+ Math.abs(U) >= 1 && k.scrollBy({ top: U, behavior: "instant" }), j.current = k, z.current = k.scrollTop;
67
+ }, [u, C]), x = f(() => {
68
+ E.current = N.current, M.current?.parentElement?.scrollTo({
69
+ top: 0,
70
+ behavior: "instant"
71
+ }), p.current = !0, w(!0), queueMicrotask(() => {
72
+ P(), w(!1);
59
73
  });
60
- }, [x]), C = h(
74
+ }, [P]), K = f(
61
75
  (e) => {
62
- const t = e !== d.current;
63
- d.current = e, e === null ? (p.current = !1, R(!1), l()) : M.current !== B.current ? v() : (t && (p.current = !1), l());
76
+ const t = e !== g.current;
77
+ g.current = e, e === null ? (p.current = !1, w(!1), u()) : E.current !== N.current ? x() : (t && (p.current = !1), u());
64
78
  },
65
- [l, v]
66
- ), S = h(() => {
67
- R(!0);
79
+ [u, x]
80
+ ), $ = f(() => {
81
+ w(!0);
68
82
  }, []);
69
- j(() => {
70
- const e = _.current.children !== f || _.current.detail !== c;
71
- _.current = { children: f, detail: c }, B.current = m, M.current !== m && d.current !== null ? v() : (e && (p.current = !1), l());
72
- }), j(() => {
73
- const e = E.current;
83
+ W(() => {
84
+ const e = S.current.children !== d || S.current.detail !== c;
85
+ S.current = { children: d, detail: c }, N.current = b;
86
+ const t = A.current !== i;
87
+ A.current = i, (t || E.current !== b) && g.current !== null ? x() : (e && (p.current = !1), u());
88
+ }), W(() => {
89
+ const e = h.current;
74
90
  if (e === null)
75
91
  return;
76
92
  const t = new ResizeObserver(() => {
77
- p.current ? x() : l();
93
+ p.current ? P() : u();
78
94
  });
79
- for (const n of a ? [e] : [e, g.current])
80
- n !== null && t.observe(n);
81
- const r = (n) => {
82
- n.target instanceof Node && d.current?.contains(n.target) && v();
83
- };
84
- return e.addEventListener("click", r), () => {
85
- t.disconnect(), e.removeEventListener("click", r);
95
+ for (const l of m ? [e] : [e, R.current])
96
+ l !== null && t.observe(l);
97
+ const n = (l) => {
98
+ l.target instanceof Node && g.current?.contains(l.target) && x();
86
99
  };
87
- }, [a, l, x, v]), F(() => {
88
- const e = T(o), t = o ?? window, r = () => {
89
- Math.abs(e.scrollTop - N.current) >= 1 && (p.current = !1);
100
+ return e.addEventListener("click", n), () => {
101
+ t.disconnect(), e.removeEventListener("click", n);
90
102
  };
91
- return t.addEventListener("scroll", r, { passive: !0 }), () => {
92
- t.removeEventListener("scroll", r);
103
+ }, [m, u, P, x]), X(() => {
104
+ const e = () => {
105
+ const l = j.current;
106
+ l !== null && Math.abs(l.scrollTop - z.current) >= 1 && (p.current = !1);
107
+ }, t = a ? document : i ?? window, n = { capture: a, passive: !0 };
108
+ return t.addEventListener("scroll", e, n), () => {
109
+ t.removeEventListener("scroll", e, n);
93
110
  };
94
- }, [o]);
95
- const D = O(
96
- () => a ? /* @__PURE__ */ i(K, { boxRef: g }) : null,
97
- [a]
98
- ), $ = O(
99
- () => ({ placeRow: C, awaitRow: S, inline: D }),
100
- [C, S, D]
101
- ), L = /* @__PURE__ */ i(A.Provider, { value: null, children: c }), q = ["aegis-detail-beside", b ?? ""].filter(Boolean).join(" ");
102
- return /* @__PURE__ */ i(A.Provider, { value: $, children: /* @__PURE__ */ i(I.Provider, { value: L, children: /* @__PURE__ */ k(
111
+ }, [a, i]);
112
+ const I = V(
113
+ () => m ? /* @__PURE__ */ o(ie, { boxRef: R }) : null,
114
+ [m]
115
+ ), Q = V(
116
+ () => ({ placeRow: K, awaitRow: $, inline: I }),
117
+ [K, $, I]
118
+ ), B = /* @__PURE__ */ o(O.Provider, { value: null, children: c });
119
+ if (r.layout === "panes")
120
+ return /* @__PURE__ */ o(O.Provider, { value: Q, children: /* @__PURE__ */ L(D.Provider, { value: B, children: [
121
+ /* @__PURE__ */ o(Y, { size: "fill", ...r.listPane, children: /* @__PURE__ */ o(
122
+ "div",
123
+ {
124
+ ref: h,
125
+ className: "aegis-detail-beside__list",
126
+ "aria-busy": T || void 0,
127
+ children: d
128
+ }
129
+ ) }),
130
+ !m && /* @__PURE__ */ o(Y, { size: "lg", ...r.detailPane, children: /* @__PURE__ */ o("div", { ref: M, children: B }) })
131
+ ] }) });
132
+ const G = ["aegis-detail-beside", r.className ?? ""].filter(Boolean).join(" ");
133
+ return /* @__PURE__ */ o(O.Provider, { value: Q, children: /* @__PURE__ */ o(D.Provider, { value: B, children: /* @__PURE__ */ L(
103
134
  "div",
104
135
  {
105
- className: q,
106
- style: { "--aegis-detail-beside-columns": u },
107
- "aria-busy": Q || void 0,
136
+ className: G,
137
+ style: {
138
+ "--aegis-detail-beside-columns": r.columns
139
+ },
140
+ "aria-busy": T || void 0,
108
141
  children: [
109
- /* @__PURE__ */ i("div", { ref: E, className: "aegis-detail-beside__list", children: f }),
110
- !a && /* @__PURE__ */ k("div", { className: "aegis-detail-beside__side", children: [
111
- /* @__PURE__ */ i("div", { ref: y }),
112
- /* @__PURE__ */ i("div", { ref: g, className: "aegis-detail-beside__detail", children: L })
142
+ /* @__PURE__ */ o("div", { ref: h, className: "aegis-detail-beside__list", children: d }),
143
+ !m && /* @__PURE__ */ L("div", { className: "aegis-detail-beside__side", children: [
144
+ /* @__PURE__ */ o("div", { ref: _ }),
145
+ /* @__PURE__ */ o("div", { ref: R, className: "aegis-detail-beside__detail", children: B })
113
146
  ] })
114
147
  ]
115
148
  }
116
149
  ) }) });
117
150
  }
118
151
  export {
119
- oe as DetailBeside
152
+ ge as DetailBeside
120
153
  };
121
154
  //# sourceMappingURL=DetailBeside.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DetailBeside.js","sources":["../../../src/components/ui/DetailBeside.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type ReactNode,\n type RefObject,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect';\nimport { useMediaQuery } from '../../hooks/useMediaQuery';\nimport {\n type ViewBounds,\n scrollerOf,\n viewBoundsOf,\n} from '../../lib/scrollView';\nimport './DetailBeside.css';\nimport {\n type SelectedRowDetail,\n SelectedRowDetailContext,\n} from './selectedRowDetail';\n\nexport interface DetailBesideProps {\n /**\n * `grid-template-columns` of the list and the detail above 768 px, e.g.\n * `'3fr 2fr'`.\n */\n columns: string;\n /**\n * The selected item's detail: one element, such as a `Panel` titled with\n * the item's name. It is never taller than the view, so a long Panel\n * scrolls its body. Render it anew from the host's data whenever that\n * data changes: that render tells DetailBeside the change was new data,\n * so the page stays where it is. A detail that fetches its own data and\n * redraws without this host rendering leaves the page following the row,\n * and its next change of size scrolls the page.\n */\n detail: ReactNode;\n /**\n * The list: a `TraceTree`, `FileTree`, `DataTable`, `TreeTable` or\n * `ServiceMap`, in a Panel say. The detail follows the row it draws\n * selected. Like `detail`, render it anew from the host's data whenever\n * that data changes, so the page stays where it is on new data; a list\n * that fetches its own data and redraws without this host rendering\n * leaves the page following the row, and its next change of size scrolls\n * the page.\n */\n children: ReactNode;\n /**\n * The selection as the page's address names it, or null where the\n * address names none and the list shows a default. It changes only by\n * the viewer's doing: a click, a key, a link, back or forward. The page\n * scrolls to the selected row when this changes, and on the first\n * placement after mount; a row that comes into place for new data, such\n * as a default the data moved, is only levelled with.\n */\n revealKey: string | null;\n /** The element that scrolls the page; omitted or null means the viewport. */\n scrollContainer?: HTMLElement | null;\n className?: string;\n}\n\nconst NARROW_QUERY = '(max-width: 768px)';\n\n/**\n * The detail as the inline slot draws it. It is kept out of the context the\n * lists read, so a new detail re-renders the slot and not the list.\n */\nconst DetailContext = createContext<ReactNode>(null);\n\n/**\n * How far to scroll so the row is in the view, clear of the `inset` at the\n * view's top, and the detail, whose top can rise no higher than `ceiling`,\n * fits above the view's bottom.\n */\nfunction revealDistance(\n row: DOMRect,\n ceiling: number,\n height: number,\n inset: number,\n view: ViewBounds,\n): number {\n const top = view.top + inset;\n const toRow =\n row.top < top ? row.top - top : Math.max(row.bottom - view.bottom, 0);\n return Math.max(toRow, ceiling + height - view.bottom);\n}\n\n/** The detail right after the selected row, at 768 px and below. */\nfunction InlineDetail({ boxRef }: { boxRef: RefObject<HTMLDivElement> }) {\n const detail = useContext(DetailContext);\n return (\n <div ref={boxRef} className=\"aegis-detail-beside__inline\" role=\"group\">\n {detail}\n </div>\n );\n}\n\n/**\n * A tree, table or map with the selected item's detail beside it. Above\n * 768 px the detail stands in a column on the right, level with the\n * selected row: when the row is too low for it, its bottom meets the\n * view's bottom, and while the page scrolls it stays in the view below\n * the header; while the list draws no row selected, it stands at the\n * column's top. At 768 px and below the list draws the detail right after\n * the selected row, the rows that follow under it; a map draws it over\n * the map, under the node. When the page opens with a selection,\n * `revealKey` changes or the viewer clicks the selected row, the page\n * scrolls at once, as little as it takes to show the row and the detail\n * whole, and again whenever the list or the detail changes size, until the\n * viewer scrolls or the host renders a new list or detail. Any other\n * placement, such as new data moving the selection or the rows, levels\n * the detail with its row by the same rule and leaves the page where it\n * is; the browser's scroll anchoring can still move it when rows arrive\n * above the view, unless the host sets `overflow-anchor: none` on its\n * scroller. The wrapper is `aria-busy` while a selected row it reveals is\n * still on its way.\n */\nexport function DetailBeside({\n columns,\n detail,\n children,\n revealKey,\n scrollContainer = null,\n className,\n}: DetailBesideProps) {\n const narrow = useMediaQuery(NARROW_QUERY);\n const [busy, setBusy] = useState(false);\n const listRef = useRef<HTMLDivElement>(null);\n const spacerRef = useRef<HTMLDivElement>(null);\n const detailRef = useRef<HTMLDivElement>(null);\n const rowRef = useRef<HTMLElement | null>(null);\n /** Whether the page is still where the last reveal left it. */\n const followRef = useRef(false);\n const revealedAtRef = useRef(0);\n /** The latest render's revealKey, and the last reveal's: undefined before the first. */\n const revealKeyRef = useRef(revealKey);\n const revealedKeyRef = useRef<string | null | undefined>(undefined);\n /** The latest render's list and detail, which change when the host renders them anew. */\n const shownRef = useRef({ children, detail });\n\n /**\n * Sets the detail level with the row: above 768 px through the spacer's\n * height, at and below by telling the inline detail how tall the row is.\n * While the list draws no row selected, such as when a filter or a closed\n * parent hides it, the detail stands at the top of its column.\n */\n const place = useCallback(() => {\n const row = rowRef.current;\n const box = detailRef.current;\n const spacer = spacerRef.current;\n if (row === null) {\n spacer?.style.removeProperty('height');\n return;\n }\n if (box === null) {\n return;\n }\n const rowBox = row.getBoundingClientRect();\n if (spacer === null) {\n box.style.setProperty(\n '--aegis-detail-beside-row-height',\n `${String(rowBox.height)}px`,\n );\n } else {\n const top = spacer.getBoundingClientRect().top;\n spacer.style.height = `${String(Math.max(rowBox.top - top, 0))}px`;\n }\n }, []);\n\n /** Places the row and scrolls as little as it takes to show it and its detail whole. */\n const reveal = useCallback(() => {\n place();\n const row = rowRef.current;\n const box = detailRef.current;\n if (row === null || box === null) {\n return;\n }\n const rowBox = row.getBoundingClientRect();\n const spacer = spacerRef.current;\n const distance = revealDistance(\n rowBox,\n spacer === null ? rowBox.bottom : spacer.getBoundingClientRect().top,\n box.getBoundingClientRect().height,\n parseFloat(getComputedStyle(box).scrollMarginTop),\n viewBoundsOf(scrollContainer),\n );\n const scroller = scrollerOf(scrollContainer);\n if (Math.abs(distance) >= 1) {\n scroller.scrollBy({ top: distance, behavior: 'instant' });\n }\n revealedAtRef.current = scroller.scrollTop;\n }, [place, scrollContainer]);\n\n // A list places its row while React attaches refs, before the detail's\n // own ref is in and before the re-renders its layout effects ask for,\n // so the reveal waits for the commit to finish.\n const revealSoon = useCallback(() => {\n revealedKeyRef.current = revealKeyRef.current;\n followRef.current = true;\n setBusy(true);\n queueMicrotask(() => {\n reveal();\n setBusy(false);\n });\n }, [reveal]);\n\n // A row placed while a reveal is due is revealed; any other is levelled\n // with, and a new one ends following.\n const placeRow = useCallback(\n (row: HTMLElement | null) => {\n const fresh = row !== rowRef.current;\n rowRef.current = row;\n if (row === null) {\n followRef.current = false;\n setBusy(false);\n place();\n } else if (revealedKeyRef.current !== revealKeyRef.current) {\n revealSoon();\n } else {\n if (fresh) {\n followRef.current = false;\n }\n place();\n }\n },\n [place, revealSoon],\n );\n\n const awaitRow = useCallback(() => {\n setBusy(true);\n }, []);\n\n // Runs after the lists have placed their rows in this commit, so a new\n // revealKey reveals the row it selects. A render by the host without one\n // ends following.\n useIsomorphicLayoutEffect(() => {\n const rendered =\n shownRef.current.children !== children ||\n shownRef.current.detail !== detail;\n shownRef.current = { children, detail };\n revealKeyRef.current = revealKey;\n if (revealedKeyRef.current !== revealKey && rowRef.current !== null) {\n revealSoon();\n } else {\n if (rendered) {\n followRef.current = false;\n }\n place();\n }\n });\n\n useIsomorphicLayoutEffect(() => {\n const list = listRef.current;\n if (list === null) {\n return undefined;\n }\n const observer = new ResizeObserver(() => {\n if (followRef.current) {\n reveal();\n } else {\n place();\n }\n });\n // At 768 px and below the detail lies inside the list.\n for (const box of narrow ? [list] : [list, detailRef.current]) {\n if (box !== null) {\n observer.observe(box);\n }\n }\n const activate = (event: MouseEvent): void => {\n if (\n event.target instanceof Node &&\n rowRef.current?.contains(event.target)\n ) {\n revealSoon();\n }\n };\n list.addEventListener('click', activate);\n return () => {\n observer.disconnect();\n list.removeEventListener('click', activate);\n };\n }, [narrow, place, reveal, revealSoon]);\n\n useEffect(() => {\n const scroller = scrollerOf(scrollContainer);\n const target = scrollContainer ?? window;\n const scrolled = (): void => {\n if (Math.abs(scroller.scrollTop - revealedAtRef.current) >= 1) {\n followRef.current = false;\n }\n };\n target.addEventListener('scroll', scrolled, { passive: true });\n return () => {\n target.removeEventListener('scroll', scrolled);\n };\n }, [scrollContainer]);\n\n const inline = useMemo(\n () => (narrow ? <InlineDetail boxRef={detailRef} /> : null),\n [narrow],\n );\n const slot = useMemo(\n (): SelectedRowDetail => ({ placeRow, awaitRow, inline }),\n [placeRow, awaitRow, inline],\n );\n const isolated = (\n <SelectedRowDetailContext.Provider value={null}>\n {detail}\n </SelectedRowDetailContext.Provider>\n );\n\n const cls = ['aegis-detail-beside', className ?? '']\n .filter(Boolean)\n .join(' ');\n\n return (\n <SelectedRowDetailContext.Provider value={slot}>\n <DetailContext.Provider value={isolated}>\n <div\n className={cls}\n style={{ '--aegis-detail-beside-columns': columns } as CSSProperties}\n aria-busy={busy || undefined}\n >\n <div ref={listRef} className=\"aegis-detail-beside__list\">\n {children}\n </div>\n {!narrow && (\n <div className=\"aegis-detail-beside__side\">\n <div ref={spacerRef} />\n <div ref={detailRef} className=\"aegis-detail-beside__detail\">\n {isolated}\n </div>\n </div>\n )}\n </div>\n </DetailContext.Provider>\n </SelectedRowDetailContext.Provider>\n );\n}\n"],"names":["NARROW_QUERY","DetailContext","createContext","revealDistance","row","ceiling","height","inset","view","top","toRow","InlineDetail","boxRef","detail","useContext","jsx","DetailBeside","columns","children","revealKey","scrollContainer","className","narrow","useMediaQuery","busy","setBusy","useState","listRef","useRef","spacerRef","detailRef","rowRef","followRef","revealedAtRef","revealKeyRef","revealedKeyRef","shownRef","place","useCallback","box","spacer","rowBox","reveal","distance","viewBoundsOf","scroller","scrollerOf","revealSoon","placeRow","fresh","awaitRow","useIsomorphicLayoutEffect","rendered","list","observer","activate","event","useEffect","target","scrolled","inline","useMemo","slot","isolated","SelectedRowDetailContext","cls","jsxs"],"mappings":";;;;;;;AAkEA,MAAMA,IAAe,sBAMfC,IAAgBC,EAAyB,IAAI;AAOnD,SAASC,EACPC,GACAC,GACAC,GACAC,GACAC,GACQ;AACR,QAAMC,IAAMD,EAAK,MAAMD,GACjBG,IACJN,EAAI,MAAMK,IAAML,EAAI,MAAMK,IAAM,KAAK,IAAIL,EAAI,SAASI,EAAK,QAAQ,C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AAAA,EACF,GAAG,CAACvC,CAAe,CAAC;AAEpB,QAAMwC,IAASC;AAAA,IACb,MAAOvC,IAAS,gBAAAP,EAACJ,GAAA,EAAa,QAAQmB,GAAW,IAAK;AAAA,IACtD,CAACR,CAAM;AAAA,EAAA,GAEHwC,IAAOD;AAAA,IACX,OAA0B,EAAE,UAAAb,GAAU,UAAAE,GAAU,QAAAU;IAChD,CAACZ,GAAUE,GAAUU,CAAM;AAAA,EAAA,GAEvBG,IACJ,gBAAAhD,EAACiD,EAAyB,UAAzB,EAAkC,OAAO,MACvC,UAAAnD,GACH,GAGIoD,IAAM,CAAC,uBAAuB5C,KAAa,EAAE,EAChD,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,SACE,gBAAAN,EAACiD,EAAyB,UAAzB,EAAkC,OAAOF,GACxC,UAAA,gBAAA/C,EAACd,EAAc,UAAd,EAAuB,OAAO8D,GAC7B,UAAA,gBAAAG;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWD;AAAA,MACX,OAAO,EAAE,iCAAiChD,EAAA;AAAA,MAC1C,aAAWO,KAAQ;AAAA,MAEnB,UAAA;AAAA,QAAA,gBAAAT,EAAC,OAAA,EAAI,KAAKY,GAAS,WAAU,6BAC1B,UAAAT,GACH;AAAA,QACC,CAACI,KACA,gBAAA4C,EAAC,OAAA,EAAI,WAAU,6BACb,UAAA;AAAA,UAAA,gBAAAnD,EAAC,OAAA,EAAI,KAAKc,EAAA,CAAW;AAAA,4BACpB,OAAA,EAAI,KAAKC,GAAW,WAAU,+BAC5B,UAAAiC,EAAA,CACH;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAGN,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"DetailBeside.js","sources":["../../../src/components/ui/DetailBeside.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type ReactNode,\n type RefObject,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect';\nimport { useMediaQuery } from '../../hooks/useMediaQuery';\nimport {\n type ViewBounds,\n scrollerOf,\n scrollingAncestorOf,\n viewBoundsOf,\n} from '../../lib/scrollView';\nimport './DetailBeside.css';\nimport { Pane, type PaneProps } from './PaneLayout';\nimport {\n type SelectedRowDetail,\n SelectedRowDetailContext,\n} from './selectedRowDetail';\n\ninterface DetailBesideBaseProps {\n /**\n * The selected item's detail: one element, such as a `Panel` titled with\n * the item's name. Render it anew from the host's data whenever that\n * data changes: that render tells DetailBeside the change was new data,\n * so the page stays where it is. A detail that fetches its own data and\n * redraws without this host rendering leaves the page following the row,\n * and its next change of size scrolls the page.\n */\n detail: ReactNode;\n /**\n * The list: a `TraceTree`, `FileTree`, `DataTable`, `TreeTable` or\n * `ServiceMap`, in a Panel say. The detail follows the row it draws\n * selected. Like `detail`, render it anew from the host's data whenever\n * that data changes, so the page stays where it is on new data; a list\n * that fetches its own data and redraws without this host rendering\n * leaves the page following the row, and its next change of size scrolls\n * the page.\n */\n children: ReactNode;\n /**\n * The selection as the page's address names it, or null where the\n * address names none and the list shows a default. It changes only by\n * the viewer's doing: a click, a key, a link, back or forward. The page\n * scrolls to the selected row when this changes, and on the first\n * placement after mount; a row that comes into place for new data, such\n * as a default the data moved, is only levelled with.\n */\n revealKey: string | null;\n}\n\n/** The column form: the list and the detail in a grid of their own. */\nexport interface DetailBesideColumnsProps extends DetailBesideBaseProps {\n layout?: 'columns';\n /**\n * `grid-template-columns` of the list and the detail above 768 px, e.g.\n * `'3fr 2fr'`. The detail is never taller than the view, so a long Panel\n * scrolls its body.\n */\n columns: string;\n /**\n * The element that scrolls the page; omitted or null means the viewport.\n * `nearest` is the nearest element around the list that scrolls, found at\n * each reveal, such as the `Pane` the DetailBeside is set in. Inside an\n * element the detail is never taller than that element's view.\n */\n scrollContainer?: HTMLElement | null | 'nearest';\n className?: string;\n}\n\n/** A `Pane` of the pane form, as `Pane` takes it but for its content. */\nexport type DetailBesidePane = Omit<PaneProps, 'children'>;\n\n/**\n * The pane form: the list and the detail as two `Pane`s, set directly in a\n * `PaneLayout` after any panes that come before the list.\n */\nexport interface DetailBesidePanesProps extends DetailBesideBaseProps {\n layout: 'panes';\n /** The list's pane; `size` defaults to `fill`. */\n listPane?: DetailBesidePane;\n /** The detail's pane above 768 px; `size` defaults to `lg`. */\n detailPane?: DetailBesidePane;\n}\n\nexport type DetailBesideProps =\n | DetailBesideColumnsProps\n | DetailBesidePanesProps;\n\nconst NARROW_QUERY = '(max-width: 768px)';\n\n/**\n * The detail as the inline slot draws it. It is kept out of the context the\n * lists read, so a new detail re-renders the slot and not the list.\n */\nconst DetailContext = createContext<ReactNode>(null);\n\n/**\n * How far to scroll so the row is in the view, clear of the `inset` at the\n * view's top, and the detail, whose top can rise no higher than `ceiling`,\n * fits above the view's bottom.\n */\nfunction revealDistance(\n row: DOMRect,\n ceiling: number,\n height: number,\n inset: number,\n view: ViewBounds,\n): number {\n const top = view.top + inset;\n const toRow =\n row.top < top ? row.top - top : Math.max(row.bottom - view.bottom, 0);\n return Math.max(toRow, ceiling + height - view.bottom);\n}\n\n/** The detail right after the selected row, at 768 px and below. */\nfunction InlineDetail({ boxRef }: { boxRef: RefObject<HTMLDivElement> }) {\n const detail = useContext(DetailContext);\n return (\n <div ref={boxRef} className=\"aegis-detail-beside__inline\" role=\"group\">\n {detail}\n </div>\n );\n}\n\n/**\n * A tree, table or map with the selected item's detail beside it. Above\n * 768 px the detail stands in a column on the right, level with the\n * selected row: when the row is too low for it, its bottom meets the\n * view's bottom, and while the page scrolls it stays in the view below\n * the header; while the list draws no row selected, it stands at the\n * column's top. At 768 px and below the list draws the detail right after\n * the selected row, the rows that follow under it; a map draws it over\n * the map, under the node. When the page opens with a selection,\n * `revealKey` changes or the viewer clicks the selected row, the page\n * scrolls at once, as little as it takes to show the row and the detail\n * whole, and again whenever the list or the detail changes size, until the\n * viewer scrolls or the host renders a new list or detail. Any other\n * placement, such as new data moving the selection or the rows, levels\n * the detail with its row by the same rule and leaves the page where it\n * is; the browser's scroll anchoring can still move it when rows arrive\n * above the view, unless the host sets `overflow-anchor: none` on its\n * scroller. The wrapper is `aria-busy` while a selected row it reveals is\n * still on its way.\n *\n * With `layout=\"panes\"` the list and the detail are two `Pane`s of the\n * `PaneLayout` it is set in, divided by a hairline, and each scrolls on its\n * own. Above 768 px the detail stands at its pane's top, and a reveal\n * scrolls the list's pane to the row and the detail's pane to its top. At\n * 768 px and below there is only the list's pane, which draws the detail\n * right after the selected row as the column form does, and a reveal\n * scrolls the nearest scroller around it, the stacked `PaneLayout` in a\n * bleed page. The list is `aria-busy` while a selected row is on its way.\n */\nexport function DetailBeside(props: DetailBesideProps) {\n const { detail, children, revealKey } = props;\n const panes = props.layout === 'panes';\n /** Whether the scroller is whichever holds the list, found when needed. */\n const nearest = panes || props.scrollContainer === 'nearest';\n const scrollContainer =\n panes || props.scrollContainer === 'nearest'\n ? null\n : (props.scrollContainer ?? null);\n const narrow = useMediaQuery(NARROW_QUERY);\n const [busy, setBusy] = useState(false);\n const listRef = useRef<HTMLDivElement>(null);\n const spacerRef = useRef<HTMLDivElement>(null);\n const detailRef = useRef<HTMLDivElement>(null);\n /** Above 768 px in the pane form, the detail's box, whose parent is its pane. */\n const detailPaneRef = useRef<HTMLDivElement>(null);\n /** The scroller of the last reveal, whose scroll by the viewer ends following. */\n const scrollerRef = useRef<HTMLElement | null>(null);\n const rowRef = useRef<HTMLElement | null>(null);\n /** Whether the page is still where the last reveal left it. */\n const followRef = useRef(false);\n const revealedAtRef = useRef(0);\n /** The latest render's revealKey, and the last reveal's: undefined before the first. */\n const revealKeyRef = useRef(revealKey);\n const revealedKeyRef = useRef<string | null | undefined>(undefined);\n /** The latest render's list and detail, which change when the host renders them anew. */\n const shownRef = useRef({ children, detail });\n /** The scroll container of the latest render; a new one is revealed in anew. */\n const containerRef = useRef(scrollContainer);\n\n /** The element that scrolls the list, or null for the viewport. */\n const scrollerOfList = useCallback(\n (): HTMLElement | null =>\n nearest && listRef.current !== null\n ? scrollingAncestorOf(listRef.current)\n : scrollContainer,\n [nearest, scrollContainer],\n );\n\n /** Bounds the detail by the view of the element that scrolls it. */\n const fitView = useCallback(\n (box: HTMLElement) => {\n const scroller = scrollerOfList();\n if (scroller === null) {\n box.style.removeProperty('--detail-beside-view-height');\n box.style.removeProperty('--detail-beside-sticky-top');\n } else {\n // A sticky box sticks inside the scroller's padding.\n const { paddingTop, paddingBottom } = getComputedStyle(scroller);\n const height =\n scroller.clientHeight -\n parseFloat(paddingTop) -\n parseFloat(paddingBottom);\n box.style.setProperty(\n '--detail-beside-view-height',\n `${String(height)}px`,\n );\n box.style.setProperty('--detail-beside-sticky-top', '0px');\n }\n },\n [scrollerOfList],\n );\n\n /**\n * Sets the detail level with the row: above 768 px through the spacer's\n * height, at and below by telling the inline detail how tall the row is.\n * While the list draws no row selected, such as when a filter or a closed\n * parent hides it, the detail stands at the top of its column.\n */\n const place = useCallback(() => {\n const row = rowRef.current;\n const box = detailRef.current;\n const spacer = spacerRef.current;\n if (row === null) {\n spacer?.style.removeProperty('height');\n return;\n }\n if (box === null) {\n return;\n }\n const rowBox = row.getBoundingClientRect();\n fitView(box);\n if (spacer === null) {\n box.style.setProperty(\n '--aegis-detail-beside-row-height',\n `${String(rowBox.height)}px`,\n );\n } else {\n const top = spacer.getBoundingClientRect().top;\n spacer.style.height = `${String(Math.max(rowBox.top - top, 0))}px`;\n }\n }, [fitView]);\n\n /** Places the row and scrolls as little as it takes to show it and its detail whole. */\n const reveal = useCallback(() => {\n place();\n const row = rowRef.current;\n const list = listRef.current;\n const box = detailRef.current;\n // The detail's own pane, above 768 px, leaves only the row to show.\n const besidePane = detailPaneRef.current !== null;\n if (row === null || list === null || (box === null && !besidePane)) {\n return;\n }\n const container = scrollerOfList();\n const rowBox = row.getBoundingClientRect();\n const spacer = spacerRef.current;\n const distance = revealDistance(\n rowBox,\n spacer === null ? rowBox.bottom : spacer.getBoundingClientRect().top,\n box === null ? 0 : box.getBoundingClientRect().height,\n box === null ? 0 : parseFloat(getComputedStyle(box).scrollMarginTop),\n viewBoundsOf(container),\n );\n const scroller = scrollerOf(container);\n if (Math.abs(distance) >= 1) {\n scroller.scrollBy({ top: distance, behavior: 'instant' });\n }\n scrollerRef.current = scroller;\n revealedAtRef.current = scroller.scrollTop;\n }, [place, scrollerOfList]);\n\n // A list places its row while React attaches refs, before the detail's\n // own ref is in and before the re-renders its layout effects ask for,\n // so the reveal waits for the commit to finish.\n const revealSoon = useCallback(() => {\n revealedKeyRef.current = revealKeyRef.current;\n detailPaneRef.current?.parentElement?.scrollTo({\n top: 0,\n behavior: 'instant',\n });\n followRef.current = true;\n setBusy(true);\n queueMicrotask(() => {\n reveal();\n setBusy(false);\n });\n }, [reveal]);\n\n // A row placed while a reveal is due is revealed; any other is levelled\n // with, and a new one ends following.\n const placeRow = useCallback(\n (row: HTMLElement | null) => {\n const fresh = row !== rowRef.current;\n rowRef.current = row;\n if (row === null) {\n followRef.current = false;\n setBusy(false);\n place();\n } else if (revealedKeyRef.current !== revealKeyRef.current) {\n revealSoon();\n } else {\n if (fresh) {\n followRef.current = false;\n }\n place();\n }\n },\n [place, revealSoon],\n );\n\n const awaitRow = useCallback(() => {\n setBusy(true);\n }, []);\n\n // Runs after the lists have placed their rows in this commit, so a new\n // revealKey reveals the row it selects. A render by the host without one\n // ends following.\n useIsomorphicLayoutEffect(() => {\n const rendered =\n shownRef.current.children !== children ||\n shownRef.current.detail !== detail;\n shownRef.current = { children, detail };\n revealKeyRef.current = revealKey;\n const moved = containerRef.current !== scrollContainer;\n containerRef.current = scrollContainer;\n if (\n (moved || revealedKeyRef.current !== revealKey) &&\n rowRef.current !== null\n ) {\n revealSoon();\n } else {\n if (rendered) {\n followRef.current = false;\n }\n place();\n }\n });\n\n useIsomorphicLayoutEffect(() => {\n const list = listRef.current;\n if (list === null) {\n return undefined;\n }\n const observer = new ResizeObserver(() => {\n if (followRef.current) {\n reveal();\n } else {\n place();\n }\n });\n // At 768 px and below the detail lies inside the list.\n for (const box of narrow ? [list] : [list, detailRef.current]) {\n if (box !== null) {\n observer.observe(box);\n }\n }\n const activate = (event: MouseEvent): void => {\n if (\n event.target instanceof Node &&\n rowRef.current?.contains(event.target)\n ) {\n revealSoon();\n }\n };\n list.addEventListener('click', activate);\n return () => {\n observer.disconnect();\n list.removeEventListener('click', activate);\n };\n }, [narrow, place, reveal, revealSoon]);\n\n useEffect(() => {\n const scrolled = (): void => {\n const scroller = scrollerRef.current;\n if (\n scroller !== null &&\n Math.abs(scroller.scrollTop - revealedAtRef.current) >= 1\n ) {\n followRef.current = false;\n }\n };\n // A nearest scroller is whichever holds the list, found at each\n // reveal; scroll events do not bubble, but they pass the document.\n const target = nearest ? document : (scrollContainer ?? window);\n const options = { capture: nearest, passive: true };\n target.addEventListener('scroll', scrolled, options);\n return () => {\n target.removeEventListener('scroll', scrolled, options);\n };\n }, [nearest, scrollContainer]);\n\n const inline = useMemo(\n () => (narrow ? <InlineDetail boxRef={detailRef} /> : null),\n [narrow],\n );\n const slot = useMemo(\n (): SelectedRowDetail => ({ placeRow, awaitRow, inline }),\n [placeRow, awaitRow, inline],\n );\n const isolated = (\n <SelectedRowDetailContext.Provider value={null}>\n {detail}\n </SelectedRowDetailContext.Provider>\n );\n\n if (props.layout === 'panes') {\n return (\n <SelectedRowDetailContext.Provider value={slot}>\n <DetailContext.Provider value={isolated}>\n <Pane size=\"fill\" {...props.listPane}>\n <div\n ref={listRef}\n className=\"aegis-detail-beside__list\"\n aria-busy={busy || undefined}\n >\n {children}\n </div>\n </Pane>\n {!narrow && (\n <Pane size=\"lg\" {...props.detailPane}>\n <div ref={detailPaneRef}>{isolated}</div>\n </Pane>\n )}\n </DetailContext.Provider>\n </SelectedRowDetailContext.Provider>\n );\n }\n\n const cls = ['aegis-detail-beside', props.className ?? '']\n .filter(Boolean)\n .join(' ');\n\n return (\n <SelectedRowDetailContext.Provider value={slot}>\n <DetailContext.Provider value={isolated}>\n <div\n className={cls}\n style={\n {\n '--aegis-detail-beside-columns': props.columns,\n } as CSSProperties\n }\n aria-busy={busy || undefined}\n >\n <div ref={listRef} className=\"aegis-detail-beside__list\">\n {children}\n </div>\n {!narrow && (\n <div className=\"aegis-detail-beside__side\">\n <div ref={spacerRef} />\n <div ref={detailRef} className=\"aegis-detail-beside__detail\">\n {isolated}\n </div>\n </div>\n )}\n </div>\n </DetailContext.Provider>\n </SelectedRowDetailContext.Provider>\n );\n}\n"],"names":["NARROW_QUERY","DetailContext","createContext","revealDistance","row","ceiling","height","inset","view","top","toRow","InlineDetail","boxRef","detail","useContext","jsx","DetailBeside","props","children","revealKey","panes","nearest","scrollContainer","narrow","useMediaQuery","busy","setBusy","useState","listRef","useRef","spacerRef","detailRef","detailPaneRef","scrollerRef","rowRef","followRef","revealedAtRef","revealKeyRef","revealedKeyRef","shownRef","containerRef","scrollerOfList","useCallback","scrollingAncestorOf","fitView","box","scroller","paddingTop","paddingBottom","place","spacer","rowBox","reveal","list","besidePane","container","distance","viewBoundsOf","scrollerOf","revealSoon","placeRow","fresh","awaitRow","useIsomorphicLayoutEffect","rendered","moved","observer","activate","event","useEffect","scrolled","target","options","inline","useMemo","slot","isolated","SelectedRowDetailContext","jsxs","Pane","cls"],"mappings":";;;;;;;;AAiGA,MAAMA,KAAe,sBAMfC,IAAgBC,GAAyB,IAAI;AAOnD,SAASC,GACPC,GACAC,GACAC,GACAC,GACAC,GACQ;AACR,QAAMC,IAAMD,EAAK,MAAMD,GACjBG,IACJN,EAAI,MAAMK,IAAML,EAAI,MAAMK,IAAM,KAAK,IAAIL,EAAI,SAASI,EAAK,QAAQ,CAAC;AACtE,SAAO,KAAK,IAAIE,GAAOL,IAAUC,IAASE,EAAK,MAAM;AACvD;AAGA,SAASG,GAAa,EAAE,QAAAC,KAAiD;AACvE,QAAMC,IAASC,EAAWb,CAAa;AACvC,SACE,gBAAAc,EAAC,SAAI,KAAKH,GAAQ,WAA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BAAA/D,EAAC,OAAA,EAAI,KAAKe,EAAA,CAAW;AAAA,4BACpB,OAAA,EAAI,KAAKC,GAAW,WAAU,+BAC5B,UAAA6C,EAAA,CACH;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAGN,EAAA,CACF;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("./Avatar.cjs");;/* empty css */const m=require("./linkComponent.cjs");function y({name:i,secondary:l,avatar:n=!1,colorSlot:s,to:t,linkComponent:a,inline:c=!1,wrap:r=!1,className:d}){const o=a??m.DefaultLink,u=["aegis-identity-cell",c?"aegis-identity-cell--inline":"",r?"aegis-identity-cell--wrap":"",d??""].filter(Boolean).join(" ");return e.jsxs("span",{className:u,children:[n?e.jsx("span",{className:"aegis-identity-cell__avatar","aria-hidden":"true",children:e.jsx(g.Avatar,{name:i,size:"sm",colorSlot:s})}):null,e.jsxs("span",{className:"aegis-identity-cell__text",title:i,children:[t===void 0?e.jsx("span",{className:"aegis-identity-cell__name",children:i}):e.jsx(o,{to:t,className:"aegis-identity-cell__name aegis-identity-cell__name--link",children:i}),l?e.jsx("span",{className:"aegis-identity-cell__secondary",title:typeof l=="string"?l:void 0,children:l}):null]})]})}exports.IdentityCell=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./Avatar.cjs");;/* empty css */const y=require("./linkComponent.cjs");function _({name:i,secondary:l,avatar:n=!1,colorSlot:s,to:t,ariaLabel:a,linkComponent:c,inline:r=!1,wrap:d=!1,className:o}){const u=c??y.DefaultLink,g=["aegis-identity-cell",r?"aegis-identity-cell--inline":"",d?"aegis-identity-cell--wrap":"",o??""].filter(Boolean).join(" ");return e.jsxs("span",{className:g,children:[n?e.jsx("span",{className:"aegis-identity-cell__avatar","aria-hidden":"true",children:e.jsx(m.Avatar,{name:i,size:"sm",colorSlot:s})}):null,e.jsxs("span",{className:"aegis-identity-cell__text",title:i,children:[t===void 0?e.jsx("span",{className:"aegis-identity-cell__name",children:i}):e.jsx(u,{to:t,className:"aegis-identity-cell__name aegis-identity-cell__name--link","aria-label":a,children:i}),l?e.jsx("span",{className:"aegis-identity-cell__secondary",title:typeof l=="string"?l:void 0,children:l}):null]})]})}exports.IdentityCell=_;
2
2
  //# sourceMappingURL=IdentityCell.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"IdentityCell.cjs","sources":["../../../src/components/ui/IdentityCell.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { Avatar, type AvatarColorSlot } from './Avatar';\nimport './IdentityCell.css';\nimport { DefaultLink, type LinkComponent } from './linkComponent';\n\ninterface IdentityCellProps {\n /** Primary line, e.g. a model or task name. Truncates; the full name shows on hover. */\n name: string;\n /** Muted `--font-mono` line under the name for an id or path, e.g. `source / task`; a string shows in full on hover. */\n secondary?: ReactNode;\n /** Leads with an Avatar of the name's initials. */\n avatar?: boolean;\n /** Avatar colour from the chart series colours, so it matches that series. */\n colorSlot?: AvatarColorSlot;\n /** Makes the name a link to this destination. */\n to?: string;\n /** Renders the link. Defaults to an `<a href>`; routed apps pass their Link adapter. */\n linkComponent?: LinkComponent;\n /** Puts the secondary text beside the name on one line. */\n inline?: boolean;\n /** Wraps the name and the secondary text, breaking anywhere, instead of truncating, so a long\n * name never widens the card or list it sits in. */\n wrap?: boolean;\n className?: string;\n}\n\nexport function IdentityCell({\n name,\n secondary,\n avatar = false,\n colorSlot,\n to,\n linkComponent,\n inline = false,\n wrap = false,\n className,\n}: IdentityCellProps) {\n const LinkImpl = linkComponent ?? DefaultLink;\n const cls = [\n 'aegis-identity-cell',\n inline ? 'aegis-identity-cell--inline' : '',\n wrap ? 'aegis-identity-cell--wrap' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <span className={cls}>\n {avatar ? (\n <span className=\"aegis-identity-cell__avatar\" aria-hidden=\"true\">\n <Avatar name={name} size=\"sm\" colorSlot={colorSlot} />\n </span>\n ) : null}\n <span className=\"aegis-identity-cell__text\" title={name}>\n {to === undefined ? (\n <span className=\"aegis-identity-cell__name\">{name}</span>\n ) : (\n <LinkImpl\n to={to}\n className=\"aegis-identity-cell__name aegis-identity-cell__name--link\"\n >\n {name}\n </LinkImpl>\n )}\n {secondary ? (\n <span\n className=\"aegis-identity-cell__secondary\"\n title={typeof secondary === 'string' ? secondary : undefined}\n >\n {secondary}\n </span>\n ) : null}\n </span>\n </span>\n );\n}\n"],"names":["IdentityCell","name","secondary","avatar","colorSlot","to","linkComponent","inline","wrap","className","LinkImpl","DefaultLink","cls","jsxs","jsx","Avatar"],"mappings":"wNA2BO,SAASA,EAAa,CAC3B,KAAAC,EACA,UAAAC,EACA,OAAAC,EAAS,GACT,UAAAC,EACA,GAAAC,EAAA,cACAC,EACA,OAAAC,EAAS,GACT,KAAAC,EAAO,GACP,UAAAC,CACF,EAAsB,CACpB,MAAMC,EAAWJ,GAAiBK,EAAAA,YAC5BC,EAAM,CACV,sBACAL,EAAS,8BAAgC,GACzCC,EAAO,4BAA8B,GACrCC,GAAa,EAAA,EAEZ,OAAO,OAAO,EACd,KAAK,GAAG,EAEX,OACEI,EAAAA,KAAC,OAAA,CAAK,UAAWD,EACd,SAAA,CAAAT,EACCW,EAAAA,IAAC,OAAA,CAAK,UAAU,8BAA8B,cAAY,OACxD,SAAAA,EAAAA,IAACC,EAAAA,OAAA,CAAO,KAAAd,EAAY,KAAK,KAAK,UAAAG,CAAA,CAAsB,EACtD,EACE,KACJS,EAAAA,KAAC,OAAA,CAAK,UAAU,4BAA4B,MAAOZ,EAChD,SAAA,CAAAI,IAAO,OACNS,EAAAA,IAAC,OAAA,CAAK,UAAU,4BAA6B,WAAK,EAElDA,EAAAA,IAACJ,EAAA,CACC,GAAAL,EACA,UAAU,4DAET,SAAAJ,CAAA,CAAA,EAGJC,EACCY,EAAAA,IAAC,OAAA,CACC,UAAU,iCACV,MAAO,OAAOZ,GAAc,SAAWA,EAAY,OAElD,SAAAA,CAAA,CAAA,EAED,IAAA,CAAA,CACN,CAAA,EACF,CAEJ"}
1
+ {"version":3,"file":"IdentityCell.cjs","sources":["../../../src/components/ui/IdentityCell.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { Avatar, type AvatarColorSlot } from './Avatar';\nimport './IdentityCell.css';\nimport { DefaultLink, type LinkComponent } from './linkComponent';\n\ninterface IdentityCellProps {\n /** Primary line, e.g. a model or task name. Truncates; the full name shows on hover. */\n name: string;\n /** Muted `--font-mono` line under the name for an id or path, e.g. `source / task`; a string shows in full on hover. */\n secondary?: ReactNode;\n /** Leads with an Avatar of the name's initials. */\n avatar?: boolean;\n /** Avatar colour from the chart series colours, so it matches that series. */\n colorSlot?: AvatarColorSlot;\n /** Makes the name a link to this destination. */\n to?: string;\n /**\n * The link's accessible name when the name shown is short, e.g. \"Expand\n * trace\" for a link that shows \"Expand\".\n */\n ariaLabel?: string;\n /** Renders the link. Defaults to an `<a href>`; routed apps pass their Link adapter. */\n linkComponent?: LinkComponent;\n /** Puts the secondary text beside the name on one line. */\n inline?: boolean;\n /** Wraps the name and the secondary text, breaking anywhere, instead of truncating, so a long\n * name never widens the card or list it sits in. */\n wrap?: boolean;\n className?: string;\n}\n\nexport function IdentityCell({\n name,\n secondary,\n avatar = false,\n colorSlot,\n to,\n ariaLabel,\n linkComponent,\n inline = false,\n wrap = false,\n className,\n}: IdentityCellProps) {\n const LinkImpl = linkComponent ?? DefaultLink;\n const cls = [\n 'aegis-identity-cell',\n inline ? 'aegis-identity-cell--inline' : '',\n wrap ? 'aegis-identity-cell--wrap' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <span className={cls}>\n {avatar ? (\n <span className=\"aegis-identity-cell__avatar\" aria-hidden=\"true\">\n <Avatar name={name} size=\"sm\" colorSlot={colorSlot} />\n </span>\n ) : null}\n <span className=\"aegis-identity-cell__text\" title={name}>\n {to === undefined ? (\n <span className=\"aegis-identity-cell__name\">{name}</span>\n ) : (\n <LinkImpl\n to={to}\n className=\"aegis-identity-cell__name aegis-identity-cell__name--link\"\n aria-label={ariaLabel}\n >\n {name}\n </LinkImpl>\n )}\n {secondary ? (\n <span\n className=\"aegis-identity-cell__secondary\"\n title={typeof secondary === 'string' ? secondary : undefined}\n >\n {secondary}\n </span>\n ) : null}\n </span>\n </span>\n );\n}\n"],"names":["IdentityCell","name","secondary","avatar","colorSlot","to","ariaLabel","linkComponent","inline","wrap","className","LinkImpl","DefaultLink","cls","jsxs","jsx","Avatar"],"mappings":"wNAgCO,SAASA,EAAa,CAC3B,KAAAC,EACA,UAAAC,EACA,OAAAC,EAAS,GACT,UAAAC,EACA,GAAAC,EACA,UAAAC,EAAA,cACAC,EACA,OAAAC,EAAS,GACT,KAAAC,EAAO,GACP,UAAAC,CACF,EAAsB,CACpB,MAAMC,EAAWJ,GAAiBK,EAAAA,YAC5BC,EAAM,CACV,sBACAL,EAAS,8BAAgC,GACzCC,EAAO,4BAA8B,GACrCC,GAAa,EAAA,EAEZ,OAAO,OAAO,EACd,KAAK,GAAG,EAEX,OACEI,EAAAA,KAAC,OAAA,CAAK,UAAWD,EACd,SAAA,CAAAV,EACCY,EAAAA,IAAC,OAAA,CAAK,UAAU,8BAA8B,cAAY,OACxD,SAAAA,EAAAA,IAACC,EAAAA,OAAA,CAAO,KAAAf,EAAY,KAAK,KAAK,UAAAG,CAAA,CAAsB,EACtD,EACE,KACJU,EAAAA,KAAC,OAAA,CAAK,UAAU,4BAA4B,MAAOb,EAChD,SAAA,CAAAI,IAAO,OACNU,EAAAA,IAAC,OAAA,CAAK,UAAU,4BAA6B,WAAK,EAElDA,EAAAA,IAACJ,EAAA,CACC,GAAAN,EACA,UAAU,4DACV,aAAYC,EAEX,SAAAL,CAAA,CAAA,EAGJC,EACCa,EAAAA,IAAC,OAAA,CACC,UAAU,iCACV,MAAO,OAAOb,GAAc,SAAWA,EAAY,OAElD,SAAAA,CAAA,CAAA,EAED,IAAA,CAAA,CACN,CAAA,EACF,CAEJ"}