@lincyaw/aegis-ui 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/AnchoredPopover.cjs +1 -1
- package/dist/components/ui/AnchoredPopover.cjs.map +1 -1
- package/dist/components/ui/AnchoredPopover.d.ts +15 -1
- package/dist/components/ui/AnchoredPopover.js +104 -78
- package/dist/components/ui/AnchoredPopover.js.map +1 -1
- package/dist/components/ui/CodeBlock.cjs +2 -2
- package/dist/components/ui/CodeBlock.cjs.map +1 -1
- package/dist/components/ui/CodeBlock.d.ts +10 -1
- package/dist/components/ui/CodeBlock.js +65 -57
- package/dist/components/ui/CodeBlock.js.map +1 -1
- package/dist/components/ui/DetailBeside.cjs +1 -1
- package/dist/components/ui/DetailBeside.cjs.map +1 -1
- package/dist/components/ui/DetailBeside.d.ts +38 -9
- package/dist/components/ui/DetailBeside.js +104 -85
- package/dist/components/ui/DetailBeside.js.map +1 -1
- package/dist/components/ui/index.d.ts +1 -1
- package/dist/lib/scrollView.cjs +1 -1
- package/dist/lib/scrollView.cjs.map +1 -1
- package/dist/lib/scrollView.d.ts +6 -0
- package/dist/lib/scrollView.js +26 -17
- package/dist/lib/scrollView.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,98 +1,106 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as m, useState as
|
|
3
|
-
import { usePrimitiveSurface as
|
|
4
|
-
import { useCopyToClipboard as
|
|
1
|
+
import { jsxs as p, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as m, useState as I, useCallback as _, useMemo as B, useEffect as J } from "react";
|
|
3
|
+
import { usePrimitiveSurface as Q } from "../../agent/core/usePrimitiveSurface.js";
|
|
4
|
+
import { useCopyToClipboard as U } from "../../hooks/useCopyToClipboard.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import { CopyGlyph as
|
|
7
|
-
import { useStrings as
|
|
8
|
-
function
|
|
6
|
+
import { CopyGlyph as V } from "./CopyGlyph.js";
|
|
7
|
+
import { useStrings as W } from "../../locale/useStrings.js";
|
|
8
|
+
function ne({
|
|
9
9
|
code: a,
|
|
10
|
-
language:
|
|
11
|
-
showLineNumbers:
|
|
12
|
-
maxHeight:
|
|
13
|
-
className:
|
|
14
|
-
surface:
|
|
15
|
-
selectedLines:
|
|
16
|
-
onSelectLines:
|
|
10
|
+
language: b = "text",
|
|
11
|
+
showLineNumbers: j = !1,
|
|
12
|
+
maxHeight: k,
|
|
13
|
+
className: O,
|
|
14
|
+
surface: T,
|
|
15
|
+
selectedLines: y,
|
|
16
|
+
onSelectLines: f,
|
|
17
|
+
onSelectedLinesAnchor: C
|
|
17
18
|
}) {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
{ code: a, language:
|
|
19
|
+
const v = m(null), g = m(null), w = m(null), [A, D] = I(null), n = y === void 0 ? A : y, N = f !== void 0, E = j || N, P = Q(
|
|
20
|
+
T,
|
|
21
|
+
{ code: a, language: b },
|
|
21
22
|
"code",
|
|
22
|
-
|
|
23
|
-
), { copied:
|
|
24
|
-
|
|
25
|
-
}, [
|
|
26
|
-
`),
|
|
23
|
+
v
|
|
24
|
+
), { copied: R, copy: S } = U(1500), r = W(), q = _(() => {
|
|
25
|
+
S(a);
|
|
26
|
+
}, [S, a]), i = a.split(`
|
|
27
|
+
`), F = String(i.length).length, d = _(
|
|
27
28
|
(t) => ({
|
|
28
29
|
getBoundingClientRect: () => {
|
|
29
|
-
const o =
|
|
30
|
+
const o = g.current?.querySelectorAll(
|
|
30
31
|
".aegis-code-block__line"
|
|
31
|
-
), e = o?.[t.start - 1]?.getBoundingClientRect(),
|
|
32
|
-
return !e || !
|
|
32
|
+
), e = o?.[t.start - 1]?.getBoundingClientRect(), s = o?.[t.end - 1]?.getBoundingClientRect();
|
|
33
|
+
return !e || !s ? new DOMRect() : new DOMRect(
|
|
33
34
|
e.left,
|
|
34
35
|
e.top,
|
|
35
36
|
e.width,
|
|
36
|
-
|
|
37
|
+
s.bottom - e.top
|
|
37
38
|
);
|
|
38
39
|
},
|
|
39
|
-
contains: (o) =>
|
|
40
|
+
contains: (o) => g.current?.contains(o) ?? !1
|
|
40
41
|
}),
|
|
41
42
|
[]
|
|
42
|
-
),
|
|
43
|
+
), G = _(
|
|
43
44
|
(t, o) => {
|
|
44
|
-
const e = o.shiftKey ?
|
|
45
|
-
e === null && (
|
|
45
|
+
const e = o.shiftKey ? w.current : null, l = n?.start === t && n.end === t && e === null ? null : e === null ? { start: t, end: t } : { start: Math.min(e, t), end: Math.max(e, t) };
|
|
46
|
+
e === null && (w.current = l ? t : null), D(l), f?.(l, l ? d(l) : null);
|
|
46
47
|
},
|
|
47
|
-
[
|
|
48
|
-
),
|
|
49
|
-
() =>
|
|
50
|
-
[
|
|
51
|
-
),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
[n, f, d]
|
|
49
|
+
), u = n && n.start <= i.length ? n.start : null, h = n && u !== null ? Math.min(n.end, i.length) : null, x = B(
|
|
50
|
+
() => u === null || h === null ? null : d({ start: u, end: h }),
|
|
51
|
+
[d, u, h]
|
|
52
|
+
), M = m(C);
|
|
53
|
+
M.current = C, J(() => {
|
|
54
|
+
M.current?.(x);
|
|
55
|
+
}, [x]);
|
|
56
|
+
const K = B(
|
|
57
|
+
() => n ? (t) => t >= n.start && t <= n.end : () => !1,
|
|
58
|
+
[n]
|
|
59
|
+
), L = ["aegis-code-block", O ?? ""].filter(Boolean).join(" ");
|
|
60
|
+
return /* @__PURE__ */ p("div", { ref: v, className: L, ...P, children: [
|
|
61
|
+
/* @__PURE__ */ p("div", { className: "aegis-code-block__header", children: [
|
|
62
|
+
/* @__PURE__ */ c("span", { className: "aegis-code-block__lang", children: b === "text" ? r.plainTextLanguage : b }),
|
|
63
|
+
/* @__PURE__ */ p(
|
|
56
64
|
"button",
|
|
57
65
|
{
|
|
58
66
|
type: "button",
|
|
59
67
|
className: "aegis-code-block__copy",
|
|
60
|
-
onClick:
|
|
68
|
+
onClick: q,
|
|
61
69
|
"aria-label": r.copyToClipboard,
|
|
62
70
|
children: [
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
|
|
71
|
+
/* @__PURE__ */ c(V, { copied: R }),
|
|
72
|
+
R ? r.copied : r.copy
|
|
65
73
|
]
|
|
66
74
|
}
|
|
67
75
|
)
|
|
68
76
|
] }),
|
|
69
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ c(
|
|
70
78
|
"pre",
|
|
71
79
|
{
|
|
72
|
-
ref:
|
|
80
|
+
ref: g,
|
|
73
81
|
className: "aegis-code-block__pre",
|
|
74
|
-
style:
|
|
75
|
-
children: /* @__PURE__ */
|
|
76
|
-
const e = o + 1,
|
|
77
|
-
return /* @__PURE__ */
|
|
82
|
+
style: k === void 0 ? void 0 : { maxHeight: k },
|
|
83
|
+
children: /* @__PURE__ */ c("code", { children: i.map((t, o) => {
|
|
84
|
+
const e = o + 1, s = K(e), l = String(e).padStart(F, " ");
|
|
85
|
+
return /* @__PURE__ */ p(
|
|
78
86
|
"div",
|
|
79
87
|
{
|
|
80
|
-
className:
|
|
88
|
+
className: s ? "aegis-code-block__line aegis-code-block__line--selected" : "aegis-code-block__line",
|
|
81
89
|
children: [
|
|
82
|
-
|
|
90
|
+
E && (N ? /* @__PURE__ */ c(
|
|
83
91
|
"button",
|
|
84
92
|
{
|
|
85
93
|
type: "button",
|
|
86
94
|
className: "aegis-code-block__ln aegis-code-block__ln--button",
|
|
87
95
|
"aria-label": r.codeLine(e),
|
|
88
|
-
"aria-pressed":
|
|
89
|
-
onClick: (
|
|
90
|
-
|
|
96
|
+
"aria-pressed": s,
|
|
97
|
+
onClick: (z) => {
|
|
98
|
+
G(e, z);
|
|
91
99
|
},
|
|
92
|
-
children:
|
|
100
|
+
children: l
|
|
93
101
|
}
|
|
94
|
-
) : /* @__PURE__ */
|
|
95
|
-
/* @__PURE__ */
|
|
102
|
+
) : /* @__PURE__ */ c("span", { className: "aegis-code-block__ln", children: l })),
|
|
103
|
+
/* @__PURE__ */ c("span", { className: "aegis-code-block__body", children: t || " " })
|
|
96
104
|
]
|
|
97
105
|
},
|
|
98
106
|
o
|
|
@@ -103,6 +111,6 @@ function Y({
|
|
|
103
111
|
] });
|
|
104
112
|
}
|
|
105
113
|
export {
|
|
106
|
-
|
|
114
|
+
ne as CodeBlock
|
|
107
115
|
};
|
|
108
116
|
//# sourceMappingURL=CodeBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlock.js","sources":["../../../src/components/ui/CodeBlock.tsx"],"sourcesContent":["import { type MouseEvent, useCallback, useMemo, useRef, useState } from 'react';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport { useCopyToClipboard } from '../../hooks/useCopyToClipboard';\nimport { useStrings } from '../../locale';\nimport type { PopoverAnchor } from './AnchoredPopover';\nimport './CodeBlock.css';\nimport { CopyGlyph } from './CopyGlyph';\n\n/** Lines `start` to `end`, 1-based and inclusive. */\nexport interface CodeLineRange {\n start: number;\n end: number;\n}\n\nexport type CodeBlockSurface = PrimitiveSurface<{\n code: string;\n language: string;\n}>;\n\ninterface CodeBlockProps {\n code: string;\n /** Shown as the header label, e.g. `json`, `typescript`, `python`. */\n language?: string;\n showLineNumbers?: boolean;\n /** Caps the code area's height (number → px); longer code scrolls inside. */\n maxHeight?: number | string;\n className?: string;\n surface?: CodeBlockSurface;\n /**\n * The selected lines, drawn in the brand's soft surface with a brand rule\n * at their left. Leave it out to let the block keep its own selection.\n */\n selectedLines?: CodeLineRange | null;\n /**\n * Makes the line numbers buttons that select lines: a press selects its\n * line, Shift extends the range from the last line pressed, and pressing\n * the only selected line clears it. Receives the range and an anchor over\n * its lines, for an `AnchoredPopover`; turns line numbers on.\n */\n onSelectLines?: (\n range: CodeLineRange | null,\n anchor: PopoverAnchor | null,\n ) => void;\n}\n\nexport function CodeBlock({\n code,\n language = 'text',\n showLineNumbers = false,\n maxHeight,\n className,\n surface,\n selectedLines,\n onSelectLines,\n}: CodeBlockProps) {\n const wrapRef = useRef<HTMLDivElement>(null);\n const preRef = useRef<HTMLPreElement>(null);\n const pivot = useRef<number | null>(null);\n const [ownSelection, setOwnSelection] = useState<CodeLineRange | null>(null);\n const selection = selectedLines === undefined ? ownSelection : selectedLines;\n const selectable = onSelectLines !== undefined;\n const numbered = showLineNumbers || selectable;\n const agentAttrs = usePrimitiveSurface(\n surface,\n { code, language },\n 'code',\n wrapRef,\n );\n const { copied, copy } = useCopyToClipboard(1500);\n const strings = useStrings();\n\n const handleCopy = useCallback(() => {\n void copy(code);\n }, [copy, code]);\n\n const lines = code.split('\\n');\n const padLen = String(lines.length).length;\n\n const anchorFor = useCallback(\n (range: CodeLineRange): PopoverAnchor => ({\n getBoundingClientRect: () => {\n const rows = preRef.current?.querySelectorAll<HTMLElement>(\n '.aegis-code-block__line',\n );\n const first = rows?.[range.start - 1]?.getBoundingClientRect();\n const last = rows?.[range.end - 1]?.getBoundingClientRect();\n if (!first || !last) {\n return new DOMRect();\n }\n return new DOMRect(\n first.left,\n first.top,\n first.width,\n last.bottom - first.top,\n );\n },\n contains: (node) => preRef.current?.contains(node) ?? false,\n }),\n [],\n );\n\n const handleLinePress = useCallback(\n (line: number, event: MouseEvent<HTMLButtonElement>) => {\n const from = event.shiftKey ? pivot.current : null;\n const only =\n selection?.start === line && selection.end === line && from === null;\n const next: CodeLineRange | null = only\n ? null\n : from === null\n ? { start: line, end: line }\n : { start: Math.min(from, line), end: Math.max(from, line) };\n if (from === null) {\n pivot.current = next ? line : null;\n }\n setOwnSelection(next);\n onSelectLines?.(next, next ? anchorFor(next) : null);\n },\n [selection, onSelectLines, anchorFor],\n );\n\n const selectedSet = useMemo(\n () =>\n selection\n ? (line: number) => line >= selection.start && line <= selection.end\n : () => false,\n [selection],\n );\n\n const cls = ['aegis-code-block', className ?? ''].filter(Boolean).join(' ');\n\n return (\n <div ref={wrapRef} className={cls} {...agentAttrs}>\n <div className=\"aegis-code-block__header\">\n <span className=\"aegis-code-block__lang\">\n {language === 'text' ? strings.plainTextLanguage : language}\n </span>\n <button\n type=\"button\"\n className=\"aegis-code-block__copy\"\n onClick={handleCopy}\n aria-label={strings.copyToClipboard}\n >\n <CopyGlyph copied={copied} />\n {copied ? strings.copied : strings.copy}\n </button>\n </div>\n <pre\n ref={preRef}\n className=\"aegis-code-block__pre\"\n style={maxHeight === undefined ? undefined : { maxHeight }}\n >\n <code>\n {lines.map((line, i) => {\n const number = i + 1;\n const selected = selectedSet(number);\n const label = String(number).padStart(padLen, ' ');\n return (\n <div\n key={i}\n className={\n selected\n ? 'aegis-code-block__line aegis-code-block__line--selected'\n : 'aegis-code-block__line'\n }\n >\n {numbered &&\n (selectable ? (\n <button\n type=\"button\"\n className=\"aegis-code-block__ln aegis-code-block__ln--button\"\n aria-label={strings.codeLine(number)}\n aria-pressed={selected}\n onClick={(event) => {\n handleLinePress(number, event);\n }}\n >\n {label}\n </button>\n ) : (\n <span className=\"aegis-code-block__ln\">{label}</span>\n ))}\n <span className=\"aegis-code-block__body\">{line || ' '}</span>\n </div>\n );\n })}\n </code>\n </pre>\n </div>\n );\n}\n"],"names":["CodeBlock","code","language","showLineNumbers","maxHeight","className","surface","selectedLines","onSelectLines","wrapRef","useRef","preRef","pivot","ownSelection","setOwnSelection","useState","selection","selectable","numbered","agentAttrs","usePrimitiveSurface","copied","copy","useCopyToClipboard","strings","useStrings","handleCopy","useCallback","lines","padLen","anchorFor","range","rows","first","last","node","handleLinePress","line","event","from","next","selectedSet","useMemo","cls","jsxs","jsx","CopyGlyph","i","number","selected","label"],"mappings":";;;;;;;AAiDO,SAASA,EAAU;AAAA,EACxB,MAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,iBAAAC,IAAkB;AAAA,EAClB,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,E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AAY,SAAY,EAAE,WAAAA,EAAA;AAAA,QAE/C,4BAAC,QAAA,EACE,UAAAwB,EAAM,IAAI,CAACS,GAAMU,MAAM;AACtB,gBAAMC,IAASD,IAAI,GACbE,IAAWR,EAAYO,CAAM,GAC7BE,IAAQ,OAAOF,CAAM,EAAE,SAASnB,GAAQ,GAAG;AACjD,iBACE,gBAAAe;AAAA,YAAC;AAAA,YAAA;AAAA,cAEC,WACEK,IACI,4DACA;AAAA,cAGL,UAAA;AAAA,gBAAA/B,MACED,IACC,gBAAA4B;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,MAAK;AAAA,oBACL,WAAU;AAAA,oBACV,cAAYrB,EAAQ,SAASwB,CAAM;AAAA,oBACnC,gBAAcC;AAAA,oBACd,SAAS,CAACX,MAAU;AAClB,sBAAAF,EAAgBY,GAAQV,CAAK;AAAA,oBAC/B;AAAA,oBAEC,UAAAY;AAAA,kBAAA;AAAA,gBAAA,IAGH,gBAAAL,EAAC,QAAA,EAAK,WAAU,wBAAwB,UAAAK,EAAA,CAAM;AAAA,gBAElD,gBAAAL,EAAC,QAAA,EAAK,WAAU,0BAA0B,eAAQ,IAAA,CAAI;AAAA,cAAA;AAAA,YAAA;AAAA,YAvBjDE;AAAA,UAAA;AAAA,QA0BX,CAAC,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"CodeBlock.js","sources":["../../../src/components/ui/CodeBlock.tsx"],"sourcesContent":["import {\n type MouseEvent,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport { useCopyToClipboard } from '../../hooks/useCopyToClipboard';\nimport { useStrings } from '../../locale';\nimport type { PopoverAnchor } from './AnchoredPopover';\nimport './CodeBlock.css';\nimport { CopyGlyph } from './CopyGlyph';\n\n/** Lines `start` to `end`, 1-based and inclusive. */\nexport interface CodeLineRange {\n start: number;\n end: number;\n}\n\nexport type CodeBlockSurface = PrimitiveSurface<{\n code: string;\n language: string;\n}>;\n\ninterface CodeBlockProps {\n code: string;\n /** Shown as the header label, e.g. `json`, `typescript`, `python`. */\n language?: string;\n showLineNumbers?: boolean;\n /** Caps the code area's height (number → px); longer code scrolls inside. */\n maxHeight?: number | string;\n className?: string;\n surface?: CodeBlockSurface;\n /**\n * The selected lines, drawn in the brand's soft surface with a brand rule\n * at their left. Leave it out to let the block keep its own selection.\n */\n selectedLines?: CodeLineRange | null;\n /**\n * Makes the line numbers buttons that select lines: a press selects its\n * line, Shift extends the range from the last line pressed, and pressing\n * the only selected line clears it. Receives the range and an anchor over\n * its lines, for an `AnchoredPopover`; turns line numbers on.\n */\n onSelectLines?: (\n range: CodeLineRange | null,\n anchor: PopoverAnchor | null,\n ) => void;\n /**\n * Receives an anchor over the selected lines as drawn, for an\n * `AnchoredPopover`, whenever the drawn selection changes: on mount, on a\n * press, and when a controlled `selectedLines` changes, such as one read\n * from the page's address. Receives null while no line in the code is\n * selected. The anchor measures the lines each time it is asked, so it\n * follows them as the page scrolls or reflows.\n */\n onSelectedLinesAnchor?: (anchor: PopoverAnchor | null) => void;\n}\n\nexport function CodeBlock({\n code,\n language = 'text',\n showLineNumbers = false,\n maxHeight,\n className,\n surface,\n selectedLines,\n onSelectLines,\n onSelectedLinesAnchor,\n}: CodeBlockProps) {\n const wrapRef = useRef<HTMLDivElement>(null);\n const preRef = useRef<HTMLPreElement>(null);\n const pivot = useRef<number | null>(null);\n const [ownSelection, setOwnSelection] = useState<CodeLineRange | null>(null);\n const selection = selectedLines === undefined ? ownSelection : selectedLines;\n const selectable = onSelectLines !== undefined;\n const numbered = showLineNumbers || selectable;\n const agentAttrs = usePrimitiveSurface(\n surface,\n { code, language },\n 'code',\n wrapRef,\n );\n const { copied, copy } = useCopyToClipboard(1500);\n const strings = useStrings();\n\n const handleCopy = useCallback(() => {\n void copy(code);\n }, [copy, code]);\n\n const lines = code.split('\\n');\n const padLen = String(lines.length).length;\n\n const anchorFor = useCallback(\n (range: CodeLineRange): PopoverAnchor => ({\n getBoundingClientRect: () => {\n const rows = preRef.current?.querySelectorAll<HTMLElement>(\n '.aegis-code-block__line',\n );\n const first = rows?.[range.start - 1]?.getBoundingClientRect();\n const last = rows?.[range.end - 1]?.getBoundingClientRect();\n if (!first || !last) {\n return new DOMRect();\n }\n return new DOMRect(\n first.left,\n first.top,\n first.width,\n last.bottom - first.top,\n );\n },\n contains: (node) => preRef.current?.contains(node) ?? false,\n }),\n [],\n );\n\n const handleLinePress = useCallback(\n (line: number, event: MouseEvent<HTMLButtonElement>) => {\n const from = event.shiftKey ? pivot.current : null;\n const only =\n selection?.start === line && selection.end === line && from === null;\n const next: CodeLineRange | null = only\n ? null\n : from === null\n ? { start: line, end: line }\n : { start: Math.min(from, line), end: Math.max(from, line) };\n if (from === null) {\n pivot.current = next ? line : null;\n }\n setOwnSelection(next);\n onSelectLines?.(next, next ? anchorFor(next) : null);\n },\n [selection, onSelectLines, anchorFor],\n );\n\n const drawnStart =\n selection && selection.start <= lines.length ? selection.start : null;\n const drawnEnd =\n selection && drawnStart !== null\n ? Math.min(selection.end, lines.length)\n : null;\n const drawnAnchor = useMemo(\n () =>\n drawnStart === null || drawnEnd === null\n ? null\n : anchorFor({ start: drawnStart, end: drawnEnd }),\n [anchorFor, drawnStart, drawnEnd],\n );\n // Read by the effect below, which runs only when the drawn selection does.\n const anchorListener = useRef(onSelectedLinesAnchor);\n anchorListener.current = onSelectedLinesAnchor;\n useEffect(() => {\n anchorListener.current?.(drawnAnchor);\n }, [drawnAnchor]);\n\n const selectedSet = useMemo(\n () =>\n selection\n ? (line: number) => line >= selection.start && line <= selection.end\n : () => false,\n [selection],\n );\n\n const cls = ['aegis-code-block', className ?? ''].filter(Boolean).join(' ');\n\n return (\n <div ref={wrapRef} className={cls} {...agentAttrs}>\n <div className=\"aegis-code-block__header\">\n <span className=\"aegis-code-block__lang\">\n {language === 'text' ? strings.plainTextLanguage : language}\n </span>\n <button\n type=\"button\"\n className=\"aegis-code-block__copy\"\n onClick={handleCopy}\n aria-label={strings.copyToClipboard}\n >\n <CopyGlyph copied={copied} />\n {copied ? strings.copied : strings.copy}\n </button>\n </div>\n <pre\n ref={preRef}\n className=\"aegis-code-block__pre\"\n style={maxHeight === undefined ? undefined : { maxHeight }}\n >\n <code>\n {lines.map((line, i) => {\n const number = i + 1;\n const selected = selectedSet(number);\n const label = String(number).padStart(padLen, ' ');\n return (\n <div\n key={i}\n className={\n selected\n ? 'aegis-code-block__line aegis-code-block__line--selected'\n : 'aegis-code-block__line'\n }\n >\n {numbered &&\n (selectable ? (\n <button\n type=\"button\"\n className=\"aegis-code-block__ln aegis-code-block__ln--button\"\n aria-label={strings.codeLine(number)}\n aria-pressed={selected}\n onClick={(event) => {\n handleLinePress(number, event);\n }}\n >\n {label}\n </button>\n ) : (\n <span className=\"aegis-code-block__ln\">{label}</span>\n ))}\n <span className=\"aegis-code-block__body\">{line || ' '}</span>\n </div>\n );\n })}\n </code>\n </pre>\n </div>\n );\n}\n"],"names":["CodeBlock","code","language","showLineNumbers","maxHeight","className","surface","selectedLines","onSelectLines","onSelectedLinesAnchor","wrapRef","useRef","preRef","pivot","ownSelection","setOwnSelection","useState","selection","selectable","numbered","agentAttrs","usePrimitiveSurface","copied","copy","useCopyToClipboard","strings","useStrings","handleCopy","useCallback","lines","padLen","anchorFor","range","rows","first","last","node","handleLinePress","line","event","from","next","drawnStart","drawnEnd","drawnAnchor","useMemo","anchorListener","useEffect","selectedSet","cls","jsxs","jsx","CopyGlyph","i","number","selected","label"],"mappings":";;;;;;;AAiEO,SAASA,GAAU;AAAA,EACxB,MAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,iBAAAC,IAAkB;AAAA,EAClB,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,uBAAAC;A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,CAAC,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),e=require("react"),Q=require("../../hooks/useIsomorphicLayoutEffect.cjs"),H=require("../../hooks/useMediaQuery.cjs"),w=require("../../lib/scrollView.cjs");;/* empty css */const $=require("./PaneLayout.cjs"),k=require("./selectedRowDetail.cjs"),U="(max-width: 768px)",E=e.createContext(null);function V(l,i,d,b,c){const f=c.top+b,a=l.top<f?l.top-f:Math.max(l.bottom-c.bottom,0);return Math.max(a,i+d-c.bottom)}function W({boxRef:l}){const i=e.useContext(E);return r.jsx("div",{ref:l,className:"aegis-detail-beside__inline",role:"group",children:i})}function Y(l){const{detail:i,children:d,revealKey:b}=l,c=l.layout==="panes",f=c?null:l.scrollContainer??null,a=H.useMediaQuery(U),[q,m]=e.useState(!1),h=e.useRef(null),C=e.useRef(null),x=e.useRef(null),P=e.useRef(null),D=e.useRef(null),g=e.useRef(null),R=e.useRef(!1),N=e.useRef(0),B=e.useRef(b),M=e.useRef(void 0),S=e.useRef({children:d,detail:i}),u=e.useCallback(()=>{const t=g.current,n=x.current,s=C.current;if(t===null){s?.style.removeProperty("height");return}if(n===null)return;const o=t.getBoundingClientRect();if(s===null){n.style.setProperty("--aegis-detail-beside-row-height",`${String(o.height)}px`);const v=c&&h.current!==null?w.scrollingAncestorOf(h.current):null;v===null?(n.style.removeProperty("--detail-beside-view-height"),n.style.removeProperty("--detail-beside-sticky-top")):(n.style.setProperty("--detail-beside-view-height",`${String(v.clientHeight)}px`),n.style.setProperty("--detail-beside-sticky-top","0px"))}else{const v=s.getBoundingClientRect().top;s.style.height=`${String(Math.max(o.top-v,0))}px`}},[c]),p=e.useCallback(()=>{u();const t=g.current,n=h.current,s=x.current,o=P.current!==null;if(t===null||n===null||s===null&&!o)return;const v=c?w.scrollingAncestorOf(n):f,I=t.getBoundingClientRect(),z=C.current,K=V(I,z===null?I.bottom:z.getBoundingClientRect().top,s===null?0:s.getBoundingClientRect().height,s===null?0:parseFloat(getComputedStyle(s).scrollMarginTop),w.viewBoundsOf(v)),_=w.scrollerOf(v);Math.abs(K)>=1&&_.scrollBy({top:K,behavior:"instant"}),D.current=_,N.current=_.scrollTop},[c,u,f]),y=e.useCallback(()=>{M.current=B.current,P.current?.parentElement?.scrollTo({top:0,behavior:"instant"}),R.current=!0,m(!0),queueMicrotask(()=>{p(),m(!1)})},[p]),L=e.useCallback(t=>{const n=t!==g.current;g.current=t,t===null?(R.current=!1,m(!1),u()):M.current!==B.current?y():(n&&(R.current=!1),u())},[u,y]),O=e.useCallback(()=>{m(!0)},[]);Q.useIsomorphicLayoutEffect(()=>{const t=S.current.children!==d||S.current.detail!==i;S.current={children:d,detail:i},B.current=b,M.current!==b&&g.current!==null?y():(t&&(R.current=!1),u())}),Q.useIsomorphicLayoutEffect(()=>{const t=h.current;if(t===null)return;const n=new ResizeObserver(()=>{R.current?p():u()});for(const o of a?[t]:[t,x.current])o!==null&&n.observe(o);const s=o=>{o.target instanceof Node&&g.current?.contains(o.target)&&y()};return t.addEventListener("click",s),()=>{n.disconnect(),t.removeEventListener("click",s)}},[a,u,p,y]),e.useEffect(()=>{const t=()=>{const o=D.current;o!==null&&Math.abs(o.scrollTop-N.current)>=1&&(R.current=!1)},n=c?document:f??window,s={capture:c,passive:!0};return n.addEventListener("scroll",t,s),()=>{n.removeEventListener("scroll",t,s)}},[c,f]);const T=e.useMemo(()=>a?r.jsx(W,{boxRef:x}):null,[a]),A=e.useMemo(()=>({placeRow:L,awaitRow:O,inline:T}),[L,O,T]),j=r.jsx(k.SelectedRowDetailContext.Provider,{value:null,children:i});if(l.layout==="panes")return r.jsx(k.SelectedRowDetailContext.Provider,{value:A,children:r.jsxs(E.Provider,{value:j,children:[r.jsx($.Pane,{size:"fill",...l.listPane,children:r.jsx("div",{ref:h,className:"aegis-detail-beside__list","aria-busy":q||void 0,children:d})}),!a&&r.jsx($.Pane,{size:"lg",...l.detailPane,children:r.jsx("div",{ref:P,children:j})})]})});const F=["aegis-detail-beside",l.className??""].filter(Boolean).join(" ");return r.jsx(k.SelectedRowDetailContext.Provider,{value:A,children:r.jsx(E.Provider,{value:j,children:r.jsxs("div",{className:F,style:{"--aegis-detail-beside-columns":l.columns},"aria-busy":q||void 0,children:[r.jsx("div",{ref:h,className:"aegis-detail-beside__list",children:d}),!a&&r.jsxs("div",{className:"aegis-detail-beside__side",children:[r.jsx("div",{ref:C}),r.jsx("div",{ref:x,className:"aegis-detail-beside__detail",children:j})]})]})})})}exports.DetailBeside=Y;
|
|
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,EAAeN,EAAAA,OAAOT,CAAS,EAC/BgB,EAAiBP,EAAAA,OAAkC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AC5B,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 /** The element that scrolls the page; omitted or null means the viewport. */\n scrollContainer?: HTMLElement | null;\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 const scrollContainer = panes ? null : (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\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 const scroller =\n panes && listRef.current !== null\n ? scrollingAncestorOf(listRef.current)\n : null;\n if (scroller === null) {\n box.style.removeProperty('--detail-beside-view-height');\n box.style.removeProperty('--detail-beside-sticky-top');\n } else {\n box.style.setProperty(\n '--detail-beside-view-height',\n `${String(scroller.clientHeight)}px`,\n );\n box.style.setProperty('--detail-beside-sticky-top', '0px');\n }\n } else {\n const top = spacer.getBoundingClientRect().top;\n spacer.style.height = `${String(Math.max(rowBox.top - top, 0))}px`;\n }\n }, [panes]);\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 = panes ? scrollingAncestorOf(list) : scrollContainer;\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 }, [panes, 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 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 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 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 // The pane form's scroller is whichever holds the list, found at each\n // reveal; scroll events do not bubble, but they pass the document.\n const target = panes ? document : (scrollContainer ?? window);\n const options = { capture: panes, passive: true };\n target.addEventListener('scroll', scrolled, options);\n return () => {\n target.removeEventListener('scroll', scrolled, options);\n };\n }, [panes, 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","scrollContainer","narrow","useMediaQuery","busy","setBusy","useState","listRef","useRef","spacerRef","detailRef","detailPaneRef","scrollerRef","rowRef","followRef","revealedAtRef","revealKeyRef","revealedKeyRef","shownRef","place","useCallback","box","spacer","rowBox","scroller","scrollingAncestorOf","reveal","list","besidePane","container","distance","viewBoundsOf","scrollerOf","revealSoon","placeRow","fresh","awaitRow","useIsomorphicLayoutEffect","rendered","observer","activate","event","useEffect","scrolled","target","options","inline","useMemo","slot","isolated","SelectedRowDetailContext","jsxs","Pane","cls"],"mappings":"2XA4FMA,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,CA+BO,SAASG,EAAaC,EAA0B,CACrD,KAAM,CAAE,OAAAJ,EAAQ,SAAAK,EAAU,UAAAC,CAAA,EAAcF,EAClCG,EAAQH,EAAM,SAAW,QACzBI,EAAkBD,EAAQ,KAAQH,EAAM,iBAAmB,KAC3DK,EAASC,EAAAA,cAAcvB,CAAY,EACnC,CAACwB,EAAMC,CAAO,EAAIC,EAAAA,SAAS,EAAK,EAChCC,EAAUC,EAAAA,OAAuB,IAAI,EACrCC,EAAYD,EAAAA,OAAuB,IAAI,EACvC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AKY,EAAS,UAAU,4BAC1B,SAAAT,EACH,EACC,CAACI,GACAiD,EAAAA,KAAC,MAAA,CAAI,UAAU,4BACb,SAAA,CAAAxD,EAAAA,IAAC,MAAA,CAAI,IAAKc,CAAA,CAAW,QACpB,MAAA,CAAI,IAAKC,EAAW,UAAU,8BAC5B,SAAAuC,CAAA,CACH,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,EAGN,CAAA,CACF,CAEJ"}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
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.
|
|
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,34 @@ export interface DetailBesideProps {
|
|
|
34
29
|
* as a default the data moved, is only levelled with.
|
|
35
30
|
*/
|
|
36
31
|
revealKey: string | 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;
|
|
37
42
|
/** The element that scrolls the page; omitted or null means the viewport. */
|
|
38
43
|
scrollContainer?: HTMLElement | null;
|
|
39
44
|
className?: string;
|
|
40
45
|
}
|
|
46
|
+
/** A `Pane` of the pane form, as `Pane` takes it but for its content. */
|
|
47
|
+
export type DetailBesidePane = Omit<PaneProps, 'children'>;
|
|
48
|
+
/**
|
|
49
|
+
* The pane form: the list and the detail as two `Pane`s, set directly in a
|
|
50
|
+
* `PaneLayout` after any panes that come before the list.
|
|
51
|
+
*/
|
|
52
|
+
export interface DetailBesidePanesProps extends DetailBesideBaseProps {
|
|
53
|
+
layout: 'panes';
|
|
54
|
+
/** The list's pane; `size` defaults to `fill`. */
|
|
55
|
+
listPane?: DetailBesidePane;
|
|
56
|
+
/** The detail's pane above 768 px; `size` defaults to `lg`. */
|
|
57
|
+
detailPane?: DetailBesidePane;
|
|
58
|
+
}
|
|
59
|
+
export type DetailBesideProps = DetailBesideColumnsProps | DetailBesidePanesProps;
|
|
41
60
|
/**
|
|
42
61
|
* A tree, table or map with the selected item's detail beside it. Above
|
|
43
62
|
* 768 px the detail stands in a column on the right, level with the
|
|
@@ -57,5 +76,15 @@ export interface DetailBesideProps {
|
|
|
57
76
|
* above the view, unless the host sets `overflow-anchor: none` on its
|
|
58
77
|
* scroller. The wrapper is `aria-busy` while a selected row it reveals is
|
|
59
78
|
* still on its way.
|
|
79
|
+
*
|
|
80
|
+
* With `layout="panes"` the list and the detail are two `Pane`s of the
|
|
81
|
+
* `PaneLayout` it is set in, divided by a hairline, and each scrolls on its
|
|
82
|
+
* own. Above 768 px the detail stands at its pane's top, and a reveal
|
|
83
|
+
* scrolls the list's pane to the row and the detail's pane to its top. At
|
|
84
|
+
* 768 px and below there is only the list's pane, which draws the detail
|
|
85
|
+
* right after the selected row as the column form does, and a reveal
|
|
86
|
+
* scrolls the nearest scroller around it, the stacked `PaneLayout` in a
|
|
87
|
+
* bleed page. The list is `aria-busy` while a selected row is on its way.
|
|
60
88
|
*/
|
|
61
|
-
export declare function DetailBeside(
|
|
89
|
+
export declare function DetailBeside(props: DetailBesideProps): import("react/jsx-runtime").JSX.Element;
|
|
90
|
+
export {};
|