MCPcopy Create free account
hub / github.com/anomalyco/opencode / target

Function target

packages/session-ui/src/pierre/virtualizer.ts:35–64  ·  view source on GitHub ↗
(container: HTMLElement)

Source from the content-addressed store, hash-verified

33}
34
35function target(container: HTMLElement): Target | undefined {
36 if (typeof document === "undefined") return
37
38 const review = container.closest("[data-component='session-review']")
39 if (review instanceof HTMLElement) {
40 const root = scrollRoot(container) ?? review
41 const content = review.querySelector("[data-slot='session-review-container']")
42 return {
43 key: review,
44 root,
45 content: content instanceof HTMLElement ? content : undefined,
46 }
47 }
48
49 const root = scrollRoot(container)
50 if (root) {
51 const content = root.querySelector("[role='log']")
52 return {
53 key: root,
54 root,
55 content: content instanceof HTMLElement ? content : undefined,
56 }
57 }
58
59 return {
60 key: document,
61 root: document,
62 content: undefined,
63 }
64}
65
66export function acquireVirtualizer(container: HTMLElement) {
67 const resolved = target(container)

Callers 1

acquireVirtualizerFunction · 0.70

Calls 1

scrollRootFunction · 0.85

Tested by

no test coverage detected