@snackbit/opendil 0.0.0 → 0.2.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 (130) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +137 -2
  3. package/THIRD_PARTY_NOTICES.md +9 -0
  4. package/bin/opendil.mjs +75 -0
  5. package/bin/publish-directory.d.mts +18 -0
  6. package/bin/publish-directory.mjs +188 -0
  7. package/dist/agent-spec.js +9 -0
  8. package/dist/chunk-RPZW4WVX.js +2 -0
  9. package/dist/chunk-ZSTXLIS6.js +2 -0
  10. package/dist/index.js +2 -0
  11. package/dist/mermaid-diagram-GFWD4Y2X.js +2 -0
  12. package/dist/runtime/frame.html +2435 -0
  13. package/dist/runtime/frame.js +4621 -0
  14. package/dist/spec/genui.agent.full.md +1927 -0
  15. package/dist/spec/genui.agent.md +479 -0
  16. package/dist/spec/genui.examples.md +836 -0
  17. package/dist/styled-renderer-PHI4MNPF.js +2441 -0
  18. package/dist/styles.css +2434 -0
  19. package/dist/types/agent-spec.d.ts +12 -0
  20. package/dist/types/components/ui/controls/button.d.ts +10 -0
  21. package/dist/types/components/ui/controls/checkbox.d.ts +4 -0
  22. package/dist/types/components/ui/controls/input.d.ts +3 -0
  23. package/dist/types/components/ui/controls/radio-group.d.ts +5 -0
  24. package/dist/types/components/ui/controls/select.d.ts +14 -0
  25. package/dist/types/components/ui/controls/slider.d.ts +4 -0
  26. package/dist/types/components/ui/controls/tabs.d.ts +7 -0
  27. package/dist/types/components/ui/controls/textarea.d.ts +3 -0
  28. package/dist/types/components/ui/controls/toggle-group.d.ts +10 -0
  29. package/dist/types/components/ui/controls/toggle.d.ts +9 -0
  30. package/dist/types/components/ui/display/badge.d.ts +9 -0
  31. package/dist/types/components/ui/display/card.d.ts +9 -0
  32. package/dist/types/components/ui/display/chart.d.ts +39 -0
  33. package/dist/types/components/ui/display/separator.d.ts +4 -0
  34. package/dist/types/components/ui/display/skeleton.d.ts +2 -0
  35. package/dist/types/components/ui/display/table.d.ts +10 -0
  36. package/dist/types/components/ui/media/carousel.d.ts +19 -0
  37. package/dist/types/components/ui/overlays/collapsible.d.ts +6 -0
  38. package/dist/types/components/ui/overlays/popover.d.ts +11 -0
  39. package/dist/types/components/ui/overlays/tooltip.d.ts +8 -0
  40. package/dist/types/components/ui/overlays/ui-scope.d.ts +27 -0
  41. package/dist/types/dil/custom-component.d.ts +14 -0
  42. package/dist/types/dil/customization.d.ts +21 -0
  43. package/dist/types/dil/dil-renderer.d.ts +90 -0
  44. package/dist/types/dil/isolation/frame-startup.d.ts +18 -0
  45. package/dist/types/dil/isolation/frame-theme.d.ts +14 -0
  46. package/dist/types/dil/isolation/frame-viewport.d.ts +30 -0
  47. package/dist/types/dil/isolation/frame.d.ts +1 -0
  48. package/dist/types/dil/isolation/isolated-renderer.d.ts +28 -0
  49. package/dist/types/dil/isolation/overlay-room.d.ts +29 -0
  50. package/dist/types/dil/isolation/shadow-renderer.d.ts +7 -0
  51. package/dist/types/dil/isolation/shadow-styles.d.ts +2 -0
  52. package/dist/types/dil/isolation/viewport-scroll.d.ts +7 -0
  53. package/dist/types/dil/isolation/vm-worker.d.ts +1 -0
  54. package/dist/types/dil/message-renderer.d.ts +17 -0
  55. package/dist/types/dil/parser/dil-parser.d.ts +74 -0
  56. package/dist/types/dil/parser/lexical.d.ts +27 -0
  57. package/dist/types/dil/parser/literal-tag.d.ts +16 -0
  58. package/dist/types/dil/parser/markdown-lexing.d.ts +41 -0
  59. package/dist/types/dil/parser/stream-worker.d.ts +1 -0
  60. package/dist/types/dil/parser/types.d.ts +53 -0
  61. package/dist/types/dil/parser/unfinished.d.ts +22 -0
  62. package/dist/types/dil/parser/vocabulary.d.ts +12 -0
  63. package/dist/types/dil/render-error.d.ts +47 -0
  64. package/dist/types/dil/renderer-environment.d.ts +33 -0
  65. package/dist/types/dil/renderer-handle.d.ts +4 -0
  66. package/dist/types/dil/runtime/action-receipt.d.ts +5 -0
  67. package/dist/types/dil/runtime/child-list.d.ts +8 -0
  68. package/dist/types/dil/runtime/document.d.ts +54 -0
  69. package/dist/types/dil/runtime/evaluation-cache.d.ts +24 -0
  70. package/dist/types/dil/runtime/execution-queue.d.ts +56 -0
  71. package/dist/types/dil/runtime/expressions.d.ts +62 -0
  72. package/dist/types/dil/runtime/inline-worker.d.ts +33 -0
  73. package/dist/types/dil/runtime/markdown-stream.d.ts +17 -0
  74. package/dist/types/dil/runtime/presentation-history.d.ts +14 -0
  75. package/dist/types/dil/runtime/presentation-scheduler.d.ts +16 -0
  76. package/dist/types/dil/runtime/render-budget.d.ts +10 -0
  77. package/dist/types/dil/runtime/view-cost.d.ts +10 -0
  78. package/dist/types/dil/styled-renderer.d.ts +39 -0
  79. package/dist/types/dil/view/conditional-view.d.ts +12 -0
  80. package/dist/types/dil/view/loading-block.d.ts +7 -0
  81. package/dist/types/dil/view/markdown-node.d.ts +12 -0
  82. package/dist/types/dil/view/node-children.d.ts +13 -0
  83. package/dist/types/dil/view/node-view.d.ts +11 -0
  84. package/dist/types/dil/view/progressive-reveal.d.ts +7 -0
  85. package/dist/types/dil/view/render-boundary.d.ts +35 -0
  86. package/dist/types/dil/view/render-limit.d.ts +14 -0
  87. package/dist/types/dil/view/repeated-nodes.d.ts +15 -0
  88. package/dist/types/dil/view/reveal/controller.d.ts +32 -0
  89. package/dist/types/dil/view/reveal/presentation.d.ts +13 -0
  90. package/dist/types/dil/view/reveal-options.d.ts +11 -0
  91. package/dist/types/dil/view/scroll/controller.d.ts +42 -0
  92. package/dist/types/dil/view/scroll/host-viewport.d.ts +24 -0
  93. package/dist/types/dil/view/scroll/root-tracker.d.ts +17 -0
  94. package/dist/types/dil/view/scroll/scroll-root.d.ts +36 -0
  95. package/dist/types/dil/view/scroll-options.d.ts +25 -0
  96. package/dist/types/dil/view/stream-follow.d.ts +15 -0
  97. package/dist/types/dil/view/table-context.d.ts +15 -0
  98. package/dist/types/dil/view/virtual-flow.d.ts +15 -0
  99. package/dist/types/dil/widgets/action-feedback.d.ts +11 -0
  100. package/dist/types/dil/widgets/async-image.d.ts +6 -0
  101. package/dist/types/dil/widgets/charts/chart-hover.d.ts +17 -0
  102. package/dist/types/dil/widgets/charts/chart-legend.d.ts +10 -0
  103. package/dist/types/dil/widgets/charts/chart-pie.d.ts +16 -0
  104. package/dist/types/dil/widgets/charts/chart-selection.d.ts +8 -0
  105. package/dist/types/dil/widgets/charts/chart-series.d.ts +19 -0
  106. package/dist/types/dil/widgets/charts/chart-snapping.d.ts +13 -0
  107. package/dist/types/dil/widgets/charts/dil-chart.d.ts +5 -0
  108. package/dist/types/dil/widgets/charts/snap-cursor.d.ts +12 -0
  109. package/dist/types/dil/widgets/charts/snap-tooltip.d.ts +12 -0
  110. package/dist/types/dil/widgets/code/code-editor.d.ts +9 -0
  111. package/dist/types/dil/widgets/code/highlighted-code.d.ts +25 -0
  112. package/dist/types/dil/widgets/code-block.d.ts +11 -0
  113. package/dist/types/dil/widgets/control-revision.d.ts +1 -0
  114. package/dist/types/dil/widgets/control-state.d.ts +8 -0
  115. package/dist/types/dil/widgets/controls.d.ts +25 -0
  116. package/dist/types/dil/widgets/graphs/graph-model.d.ts +13 -0
  117. package/dist/types/dil/widgets/graphs/node-graph.d.ts +6 -0
  118. package/dist/types/dil/widgets/graphs/service-node.d.ts +3 -0
  119. package/dist/types/dil/widgets/mermaid-diagram.d.ts +5 -0
  120. package/dist/types/dil/widgets/primitives/attribute-values.d.ts +12 -0
  121. package/dist/types/dil/widgets/primitives/primitive.d.ts +17 -0
  122. package/dist/types/dil/widgets/primitives/vocabulary.d.ts +5 -0
  123. package/dist/types/dil/widgets/use-control-value.d.ts +2 -0
  124. package/dist/types/index.d.ts +9 -0
  125. package/dist/types/lib/cn.d.ts +2 -0
  126. package/dist/types/ui.d.ts +11 -0
  127. package/dist/ui.js +2 -0
  128. package/package.json +85 -4
  129. package/styles/tailwind.css +443 -0
  130. package/styles/tokens.css +32 -0
@@ -0,0 +1,39 @@
1
+ import { type Ref } from "react";
2
+ import type { DilRendererHandle } from "./renderer-handle.js";
3
+ import { type DilCustomization } from "./customization.js";
4
+ import { type RendererMetrics } from "./renderer-environment.js";
5
+ import type { DilRenderError } from "./render-error.js";
6
+ import type { ProgressiveReveal } from "./view/reveal-options.js";
7
+ import type { AutoScroll, ScrollContainer } from "./view/scroll-options.js";
8
+ import type { UpdateInterval } from "./runtime/presentation-scheduler.js";
9
+ import type { Appearance, ThemeTokens } from "./isolation/frame-theme.js";
10
+ type Optional<T> = {
11
+ [Key in keyof T]?: T[Key] | undefined;
12
+ };
13
+ export interface StyledRendererProps extends Optional<DilCustomization> {
14
+ mode: "host" | "shadow";
15
+ rendererRef?: Ref<DilRendererHandle> | undefined;
16
+ text: string;
17
+ isStreaming: boolean;
18
+ showStatus: boolean;
19
+ progressiveReveal: ProgressiveReveal;
20
+ autoScroll: AutoScroll;
21
+ scrollContainer?: ScrollContainer | undefined;
22
+ updateInterval: UpdateInterval;
23
+ onFollowChange?: ((following: boolean) => void) | undefined;
24
+ onInput?: ((detail: {
25
+ length: number;
26
+ }) => void) | undefined;
27
+ onCommit?: ((detail: RendererMetrics) => void) | undefined;
28
+ onError?: ((error: DilRenderError) => void) | undefined;
29
+ className?: string | undefined;
30
+ appearance: Appearance;
31
+ tokens?: ThemeTokens | undefined;
32
+ shadowStyles?: string | undefined;
33
+ }
34
+ /**
35
+ * Host and Shadow DOM rendering run the parser and QuickJS workers in the page,
36
+ * so this module and its embedded workers load only when a page uses those modes.
37
+ */
38
+ export declare function StyledRenderer(props: StyledRendererProps): import("react").JSX.Element;
39
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { ChildList } from "../runtime/child-list.js";
2
+ import type { DilDocument } from "../runtime/document.js";
3
+ import type { Scope } from "../runtime/expressions.js";
4
+ export interface ConditionalViewProps {
5
+ childrenIds: ChildList;
6
+ document: DilDocument;
7
+ scope: Scope;
8
+ svg: boolean;
9
+ inline: boolean;
10
+ instance: string;
11
+ }
12
+ export declare function ConditionalView({ childrenIds, document, scope, svg, inline, instance, }: ConditionalViewProps): import("react").JSX.Element | null;
@@ -0,0 +1,7 @@
1
+ export interface LoadingBlockProps {
2
+ name?: string;
3
+ table?: false | "body" | "row";
4
+ svg?: boolean;
5
+ error?: string | undefined;
6
+ }
7
+ export declare function LoadingBlock({ name: _name, table, svg, error, }: LoadingBlockProps): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { type Scope } from "../runtime/expressions.js";
2
+ import type { DilNode } from "../parser/types.js";
3
+ import type { DilDocument } from "../runtime/document.js";
4
+ export interface MarkdownNodeProps {
5
+ node: DilNode;
6
+ document: DilDocument;
7
+ scope: Scope;
8
+ inline: boolean;
9
+ svg: boolean;
10
+ instance: string;
11
+ }
12
+ export declare function MarkdownNode({ node, document, scope, inline, svg, instance, }: MarkdownNodeProps): import("react").JSX.Element | null;
@@ -0,0 +1,13 @@
1
+ import type { DilDocument } from "../runtime/document.js";
2
+ import type { Scope } from "../runtime/expressions.js";
3
+ import type { ChildList } from "../runtime/child-list.js";
4
+ export interface NodeChildrenProps {
5
+ childrenIds: ChildList;
6
+ document: DilDocument;
7
+ scope: Scope;
8
+ inline: boolean;
9
+ svg: boolean;
10
+ instance: string;
11
+ flowParent?: number | undefined;
12
+ }
13
+ export declare function NodeChildren({ childrenIds, document, scope, inline, svg, instance, flowParent, }: NodeChildrenProps): import("react").JSX.Element | import("react").JSX.Element[];
@@ -0,0 +1,11 @@
1
+ import type { DilDocument } from "../runtime/document.js";
2
+ import type { Scope } from "../runtime/expressions.js";
3
+ export interface NodeViewProps {
4
+ id: number;
5
+ document: DilDocument;
6
+ scope?: Scope;
7
+ inline?: boolean;
8
+ svg?: boolean;
9
+ instance?: string;
10
+ }
11
+ export declare const NodeView: import("react").NamedExoticComponent<NodeViewProps>;
@@ -0,0 +1,7 @@
1
+ import { type RefObject } from "react";
2
+ import type { DilDocument } from "../runtime/document.js";
3
+ import type { RendererViewport } from "../renderer-environment.js";
4
+ import { type ProgressiveReveal } from "./reveal-options.js";
5
+ import { RevealController } from "./reveal/controller.js";
6
+ export declare function revealDelay(index: number, staggerMs?: number): number;
7
+ export declare function useProgressiveReveal(root: RefObject<HTMLElement | null>, options: ProgressiveReveal, document: DilDocument | null, viewport?: RendererViewport): RevealController;
@@ -0,0 +1,35 @@
1
+ import { Component, type ReactNode } from "react";
2
+ import type { DilDocument } from "../runtime/document.js";
3
+ import type { DilRenderError } from "../render-error.js";
4
+ interface RenderBoundaryProps {
5
+ revision: string;
6
+ streaming: boolean;
7
+ children: ReactNode;
8
+ /** Receives the error readers see once the message is final. */
9
+ onError?: ((message: string) => void) | undefined;
10
+ }
11
+ interface BoundaryState {
12
+ error: string;
13
+ revision: string;
14
+ }
15
+ export declare class RenderBoundary extends Component<RenderBoundaryProps, BoundaryState> {
16
+ state: BoundaryState;
17
+ static getDerivedStateFromProps(props: RenderBoundaryProps, state: BoundaryState): {
18
+ revision: string;
19
+ error: string;
20
+ } | null;
21
+ static getDerivedStateFromError(error: unknown): {
22
+ error: string;
23
+ };
24
+ componentDidMount(): void;
25
+ componentDidUpdate(): void;
26
+ private reportShownError;
27
+ render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
28
+ }
29
+ /**
30
+ * Reports a problem that readers see once the message is final; until then,
31
+ * later source can still resolve it. Reporting from an effect keeps the host's
32
+ * onError out of React's render phase. The document drops repeated reports.
33
+ */
34
+ export declare function useReportProblem(document: DilDocument, problem: DilRenderError | undefined): void;
35
+ export {};
@@ -0,0 +1,14 @@
1
+ import { type ReactNode } from "react";
2
+ import type { DilDocument } from "../runtime/document.js";
3
+ type BudgetDocument = Pick<DilDocument, "renderBudget" | "reportRenderLimit">;
4
+ export declare const RenderAllowance: import("react").Context<number>;
5
+ export interface RenderLimitProps {
6
+ document: BudgetDocument;
7
+ cost?: number;
8
+ children: ReactNode;
9
+ }
10
+ export declare function RenderExceeded({ document }: {
11
+ document: BudgetDocument;
12
+ }): null;
13
+ export declare function RenderLimit({ document, cost, children, }: RenderLimitProps): import("react").JSX.Element | null;
14
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { DilNode } from "../parser/types.js";
2
+ import type { ChildList } from "../runtime/child-list.js";
3
+ import type { DilDocument } from "../runtime/document.js";
4
+ import type { Scope } from "../runtime/expressions.js";
5
+ interface RepeatedNodesProps {
6
+ node: DilNode;
7
+ childrenIds: ChildList;
8
+ document: DilDocument;
9
+ scope: Scope;
10
+ svg: boolean;
11
+ instance: string;
12
+ attributes: Record<string, unknown>;
13
+ }
14
+ export declare function RepeatedNodes(props: RepeatedNodesProps): import("react").JSX.Element | import("react").JSX.Element[] | null;
15
+ export {};
@@ -0,0 +1,32 @@
1
+ import type { PresentationHistory } from "../../runtime/presentation-history.js";
2
+ import type { RevealTiming } from "../reveal-options.js";
3
+ export declare class RevealController {
4
+ readonly history: PresentationHistory;
5
+ private readonly viewport;
6
+ private timing;
7
+ private targets;
8
+ private queued;
9
+ private frame;
10
+ private started;
11
+ private reduced;
12
+ private nextStart;
13
+ constructor(history: PresentationHistory, viewport: () => {
14
+ top: number;
15
+ bottom: number;
16
+ });
17
+ configure(timing: RevealTiming | null): void;
18
+ start(): () => void;
19
+ register(key: string, element: HTMLElement, eligible: boolean, skip: boolean): () => void;
20
+ /**
21
+ * Stops tracking a target. A reveal in progress completes at once. A target
22
+ * that never started revealing stays "ready" in history, so registering it
23
+ * again, as React does when it replays refs, reveals it.
24
+ */
25
+ private release;
26
+ private restore;
27
+ private prepare;
28
+ private finish;
29
+ showAll(): void;
30
+ private schedule;
31
+ private flush;
32
+ }
@@ -0,0 +1,13 @@
1
+ import { type ReactNode } from "react";
2
+ import type { RevealController } from "./controller.js";
3
+ export declare const RevealContext: import("react").Context<RevealController | null>;
4
+ export declare function usePresentationKey(identity: string): string;
5
+ export declare function usePresentationTarget(identity: string, eligible?: boolean): (element: HTMLElement | null) => void;
6
+ export declare function VirtualPresentation({ identity, returning, children, }: {
7
+ identity: string;
8
+ returning: boolean;
9
+ children: ReactNode;
10
+ }): import("react").JSX.Element;
11
+ export declare function BranchPresentation({ children }: {
12
+ children: ReactNode;
13
+ }): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ export interface ProgressiveRevealOptions {
2
+ staggerMs?: number;
3
+ durationMs?: number;
4
+ }
5
+ export type ProgressiveReveal = boolean | ProgressiveRevealOptions;
6
+ export interface RevealTiming {
7
+ staggerMs: number;
8
+ durationMs: number;
9
+ }
10
+ export declare function revealTiming(value: ProgressiveReveal): RevealTiming | null;
11
+ export declare function readReveal(value: unknown): ProgressiveReveal;
@@ -0,0 +1,42 @@
1
+ import type { scrollSettings } from "../scroll-options.js";
2
+ import type { ScrollRootTracker } from "./root-tracker.js";
3
+ import { ScrollRoot } from "./scroll-root.js";
4
+ type Settings = ReturnType<typeof scrollSettings>;
5
+ /** Listens for reading gestures inside the scroller that `scope` returns (null: the page). */
6
+ export type GestureListener = (view: Window, pause: () => void, scope: () => ScrollRoot) => () => void;
7
+ /** One moving-target animation per message. Native smooth scrolling would restart on each chunk. */
8
+ export declare class ScrollFollower {
9
+ private readonly element;
10
+ private readonly settings;
11
+ private readonly changed;
12
+ private readonly roots?;
13
+ private readonly view;
14
+ private readonly page;
15
+ private readonly reduced;
16
+ private readonly observer;
17
+ private readonly unlisten;
18
+ private readonly unsubscribe;
19
+ private releaseAnchor;
20
+ private observed;
21
+ private frame;
22
+ private previous;
23
+ private position;
24
+ private following;
25
+ private notified;
26
+ private ended;
27
+ /** How far the last tick left the view from the message's end. */
28
+ private gap;
29
+ constructor(element: HTMLElement, settings: () => Settings, changed: (following: boolean) => void, listen: GestureListener, roots?: ScrollRootTracker | undefined);
30
+ private get root();
31
+ /** Moves anchoring and size observation to the current scroller. */
32
+ private rebind;
33
+ private report;
34
+ start(): void;
35
+ end(): void;
36
+ resume: () => void;
37
+ pause: () => void;
38
+ refresh: () => void;
39
+ private tick;
40
+ dispose(): void;
41
+ }
42
+ export {};
@@ -0,0 +1,24 @@
1
+ import type { RendererViewport } from "../../renderer-environment.js";
2
+ import type { ScrollRootTracker } from "./root-tracker.js";
3
+ /**
4
+ * The visible area of a host or Shadow DOM renderer, measured from the
5
+ * renderer's top like the iframe runtime's frame viewport, so that layout
6
+ * outside the renderer never shifts virtualized positions.
7
+ */
8
+ export declare class HostViewport implements RendererViewport {
9
+ private readonly target;
10
+ private readonly roots;
11
+ private readonly listeners;
12
+ private stop;
13
+ private last;
14
+ constructor(target: () => HTMLElement | null, roots: ScrollRootTracker);
15
+ private measure;
16
+ get offset(): number;
17
+ get height(): number;
18
+ get width(): number;
19
+ origin(): number;
20
+ scrollTo(offset: number): void;
21
+ subscribe(listener: () => void): () => void;
22
+ private notify;
23
+ private observe;
24
+ }
@@ -0,0 +1,17 @@
1
+ import { type RefObject } from "react";
2
+ import { type ScrollContainer } from "../scroll-options.js";
3
+ import { ScrollRoot } from "./scroll-root.js";
4
+ /** Keeps track of the scroller around one renderer and announces when it changes. */
5
+ export declare class ScrollRootTracker {
6
+ private root;
7
+ private readonly listeners;
8
+ /** The tracked scroller, or null before the renderer is attached. */
9
+ get current(): ScrollRoot | null;
10
+ /** The tracked scroller, or the window of `element` before tracking starts. */
11
+ rootFor(element: Element): ScrollRoot | null;
12
+ subscribe(listener: () => void): () => void;
13
+ /** Follows `target`'s scroller until the returned cleanup runs. */
14
+ attach(target: HTMLElement, container: ScrollContainer): () => void;
15
+ }
16
+ /** The scroller around `target`; `enabled` is false where an outer frame owns scrolling. */
17
+ export declare function useScrollRoot(target: RefObject<HTMLElement | null>, option: unknown, enabled?: boolean): ScrollRootTracker;
@@ -0,0 +1,36 @@
1
+ /** Visible part of a scrolling viewport, in client coordinates. */
2
+ export interface ScrollBounds {
3
+ top: number;
4
+ bottom: number;
5
+ width: number;
6
+ }
7
+ /** The window or element whose scrolling moves a renderer. */
8
+ export declare class ScrollRoot {
9
+ readonly view: Window;
10
+ /** The scrolling element, or null when the window scrolls. */
11
+ readonly element: HTMLElement | null;
12
+ constructor(view: Window,
13
+ /** The scrolling element, or null when the window scrolls. */
14
+ element: HTMLElement | null);
15
+ get top(): number;
16
+ get maximum(): number;
17
+ /** The scroller's visible area, clipped to the window when it extends beyond it. */
18
+ bounds(): ScrollBounds;
19
+ scrollTo(top: number): void;
20
+ /** The element whose `overflow-anchor` governs this scroller. */
21
+ get anchor(): HTMLElement;
22
+ /** Whether an event happened inside this scroller. The window contains every event. */
23
+ contains(event: Event): boolean;
24
+ /** Whether a pointer event pressed this scroller's own vertical scrollbar. */
25
+ scrollbar(event: PointerEvent): boolean;
26
+ }
27
+ /** The nearest ancestor that scrolls, across Shadow DOM boundaries, or null for the window. */
28
+ export declare function findScrollContainer(start: Element): HTMLElement | null;
29
+ /**
30
+ * Calls `listener` in the capture phase for scroll events that can move
31
+ * `target`. Scroll events do not cross Shadow DOM boundaries, so besides the
32
+ * document this listens on every shadow root around `target`.
33
+ */
34
+ export declare function listenForScroll(target: Element, listener: (event: Event) => void): () => void;
35
+ /** Whether `node` is `element` or one of its flat-tree ancestors. */
36
+ export declare function encloses(node: Node, element: Element): boolean;
@@ -0,0 +1,25 @@
1
+ import type { RefObject } from "react";
2
+ export interface AutoScrollOptions {
3
+ behavior?: "instant" | "smooth";
4
+ /** Extra distance beyond the message tail, clamped to available document space. */
5
+ padding?: number;
6
+ }
7
+ export type AutoScroll = boolean | AutoScrollOptions;
8
+ /**
9
+ * What scrolls the conversation around a renderer. `"auto"` uses the nearest
10
+ * ancestor that scrolls vertically, crossing Shadow DOM boundaries, and the
11
+ * window when none does; it re-checks when layout changes. `"window"` always
12
+ * uses the page. An element, or a ref to one, names the scroller directly; a
13
+ * ref that is still empty, or `null`, behaves like `"auto"`.
14
+ */
15
+ export type ScrollContainer = "auto" | "window" | HTMLElement | RefObject<HTMLElement | null> | null;
16
+ export declare function scrollSettings(value: AutoScroll): {
17
+ behavior: "instant" | "smooth";
18
+ padding: number;
19
+ } | null;
20
+ /** Checks the option at the API boundary; untyped callers can pass anything. */
21
+ export declare function readScrollContainer(value: unknown): ScrollContainer;
22
+ /** Whether the option fixes the scroller for good: the window or an element, not a ref. */
23
+ export declare function namesScroller(value: ScrollContainer): value is HTMLElement | "window";
24
+ /** The element the option names right now, `null` for the window, or undefined to detect it. */
25
+ export declare function chosenScroller(value: ScrollContainer): HTMLElement | null | undefined;
@@ -0,0 +1,15 @@
1
+ import { type RefObject } from "react";
2
+ import { type AutoScroll } from "./scroll-options.js";
3
+ import type { ScrollRootTracker } from "./scroll/root-tracker.js";
4
+ import { ScrollRoot } from "./scroll/scroll-root.js";
5
+ /**
6
+ * Pauses on reading gestures inside the scroller that `scope` returns. With a
7
+ * scroll container, gestures elsewhere on the page, such as wheeling a
8
+ * sidebar, leave following alone.
9
+ */
10
+ export declare function listenForScrollAway(view: Window, pause: () => void, scope?: () => ScrollRoot): () => void;
11
+ /** Only deliberate reading gestures suspend following, never layout or anchor adjustments. */
12
+ export declare function useStreamFollow(root: RefObject<HTMLElement | null>, options: AutoScroll, streaming: boolean, onChange?: ((following: boolean) => void) | undefined, scroller?: ScrollRootTracker): {
13
+ pause: () => void | undefined;
14
+ resume: () => void | undefined;
15
+ };
@@ -0,0 +1,15 @@
1
+ import { type FocusEvent, type ReactNode } from "react";
2
+ export declare const TableScope: import("react").Context<false | "body" | "row">;
3
+ interface RowMeasurement {
4
+ index: number;
5
+ group: string;
6
+ measure: (element: HTMLElement | null) => void;
7
+ focus: (event: FocusEvent<HTMLElement>) => void;
8
+ blur: (event: FocusEvent<HTMLElement>) => void;
9
+ }
10
+ export declare const VirtualRowScope: import("react").Context<RowMeasurement | null>;
11
+ export declare function DilTableRow({ children, presentationRef, }: {
12
+ children: ReactNode;
13
+ presentationRef?: ((element: HTMLElement | null) => void) | undefined;
14
+ }): import("react").JSX.Element;
15
+ export {};
@@ -0,0 +1,15 @@
1
+ import { type ReactNode } from "react";
2
+ import type { ChildList } from "../runtime/child-list.js";
3
+ import type { DilDocument } from "../runtime/document.js";
4
+ import type { Scope } from "../runtime/expressions.js";
5
+ export interface VirtualFlowProps {
6
+ identity?: string;
7
+ count: number;
8
+ childIds?: ChildList;
9
+ document: DilDocument;
10
+ scope: Scope;
11
+ instance: string;
12
+ renderItem?: (index: number) => ReactNode;
13
+ itemKey?: (index: number) => string | number;
14
+ }
15
+ export declare function VirtualFlow({ identity, count, childIds, document, scope, instance, renderItem, itemKey, }: VirtualFlowProps): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { type ReactNode } from "react";
2
+ import type { StoreApi } from "zustand/vanilla";
3
+ import type { DocumentStatus } from "../runtime/document.js";
4
+ export type ActionFeedback = "idle" | "copied" | "failed";
5
+ /** Shows the clipboard outcome of the action this control started, briefly. */
6
+ export declare function useActionFeedback(status: StoreApi<DocumentStatus>): readonly [ActionFeedback, (result: unknown) => void];
7
+ /** Always mounted around the control so showing feedback never remounts or blurs it. */
8
+ export declare function ActionFeedbackTooltip({ feedback, children, }: {
9
+ feedback: ActionFeedback;
10
+ children: ReactNode;
11
+ }): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ export interface AsyncImageProps {
2
+ query: string;
3
+ presentationRef?: ((element: HTMLElement | null) => void) | undefined;
4
+ }
5
+ /** Offline illustration. A host-mode component override can supply an image service. */
6
+ export declare function AsyncImage({ query, presentationRef }: AsyncImageProps): import("react").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import type { ChartItem } from "./chart-selection.js";
2
+ /** The datum under the pointer: one row of one series, or one pie slice. */
3
+ export interface ChartTarget {
4
+ index: number;
5
+ item: ChartItem;
6
+ row: Record<string, unknown>;
7
+ }
8
+ export interface ChartHit {
9
+ target: ChartTarget;
10
+ clientX: number;
11
+ clientY: number;
12
+ }
13
+ /**
14
+ * Coalesces pointer updates to one per animation frame. The latest update wins,
15
+ * so leaving one mark and entering the next does not close and reopen the tooltip.
16
+ */
17
+ export declare function useFrameHover(onHover: (hit: ChartHit | null) => void): (hit: ChartHit | null) => void;
@@ -0,0 +1,10 @@
1
+ import type { ChartItem } from "./chart-selection.js";
2
+ export interface ChartLegendProps {
3
+ items: readonly ChartItem[];
4
+ hidden: ReadonlySet<string>;
5
+ hovered: string | null;
6
+ select: (id: string, toggle: boolean) => void;
7
+ highlight: (id: string | null) => void;
8
+ interactive: boolean;
9
+ }
10
+ export declare function ChartLegend({ items, hidden, hovered, select, highlight, interactive, }: ChartLegendProps): import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import type { ChartHit, ChartTarget } from "./chart-hover.js";
2
+ export interface ChartPieProps {
3
+ slices: readonly ChartTarget[];
4
+ valueKey: string;
5
+ nameKey: string;
6
+ /** Slice emphasized from the legend. Slice hover and focus emphasis is CSS-only. */
7
+ emphasized: string | null;
8
+ hover: (hit: ChartHit | null) => void;
9
+ highlight: (id: string | null) => void;
10
+ }
11
+ /**
12
+ * Recharts remounts every sector whenever a Pie re-renders, which loses the
13
+ * pointer and keyboard focus. Memoize the Pie so hover and focus state do not
14
+ * re-render it.
15
+ */
16
+ export declare const ChartPie: import("react").NamedExoticComponent<ChartPieProps>;
@@ -0,0 +1,8 @@
1
+ export interface ChartItem {
2
+ id: string;
3
+ label: string;
4
+ color: string;
5
+ }
6
+ /** Grafana: isolate on plain click, toggle individually with Ctrl/Cmd. */
7
+ export declare function selectChartItem(ids: readonly string[], hidden: ReadonlySet<string>, id: string, toggle: boolean): Set<string>;
8
+ export declare function reconcileChartSelection(ids: readonly string[], hidden: ReadonlySet<string>): Set<string>;
@@ -0,0 +1,19 @@
1
+ import type { ChartHit } from "./chart-hover.js";
2
+ import type { ChartItem } from "./chart-selection.js";
3
+ export interface ChartSeriesProps {
4
+ item: ChartItem;
5
+ index: number;
6
+ type: string;
7
+ hidden: boolean;
8
+ muted: boolean;
9
+ rows: Record<string, unknown>[];
10
+ highlight: (id: string | null) => void;
11
+ /** Bar hover: report the bar under the pointer, or null after leaving it. */
12
+ hover: (hit: ChartHit | null) => void;
13
+ /**
14
+ * Show Recharts' own active dots. Only keyboard navigation wants them; on pointer
15
+ * hover Recharts keeps a stale active index next to the snapped point.
16
+ */
17
+ markers: boolean;
18
+ }
19
+ export declare function ChartSeries({ item, index, type, hidden, muted, rows, highlight, hover, markers, }: ChartSeriesProps): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import type { ChartItem } from "./chart-selection.js";
2
+ import type { ChartTarget } from "./chart-hover.js";
3
+ export interface ChartPoint extends ChartTarget {
4
+ x: number;
5
+ y: number;
6
+ value: number;
7
+ }
8
+ type AxisScale = (value: unknown, options?: {
9
+ position: "middle";
10
+ }) => number | undefined;
11
+ export declare function projectChartPoints(rows: Record<string, unknown>[], items: readonly ChartItem[], xKey: string, xScale: AxisScale, yScale: AxisScale): ChartPoint[];
12
+ export declare function nearestChartPoint(points: readonly ChartPoint[], x: number, y: number, scatter: boolean): ChartPoint | undefined;
13
+ export {};
@@ -0,0 +1,5 @@
1
+ export interface DilChartProps {
2
+ content: unknown;
3
+ presentationRef?: ((element: HTMLElement | null) => void) | undefined;
4
+ }
5
+ export declare function DilChart({ content, presentationRef }: DilChartProps): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { type ChartHit } from "./chart-hover.js";
2
+ import type { ChartItem } from "./chart-selection.js";
3
+ export interface SnapCursorProps {
4
+ rows: Record<string, unknown>[];
5
+ items: readonly ChartItem[];
6
+ xKey: string;
7
+ scatter: boolean;
8
+ hit: ChartHit | null;
9
+ onHover: (hit: ChartHit | null) => void;
10
+ }
11
+ /** Line and scatter hover: snap from anywhere in the plot to the nearest datum. */
12
+ export declare function SnapCursor({ rows, items, xKey, scatter, hit, onHover, }: SnapCursorProps): import("react").JSX.Element | null;
@@ -0,0 +1,12 @@
1
+ import type { ChartItem } from "./chart-selection.js";
2
+ import type { ChartHit } from "./chart-hover.js";
3
+ export interface SnapTooltipProps {
4
+ hit: ChartHit | null;
5
+ items: readonly ChartItem[];
6
+ /** category: x label with every visible series; scatter: x and y; slice: one pie slice. */
7
+ kind: "category" | "scatter" | "slice";
8
+ xKey: string;
9
+ valueKey: string;
10
+ onHover: (hit: ChartHit | null) => void;
11
+ }
12
+ export declare function SnapTooltip({ hit, items, kind, xKey, valueKey, onHover, }: SnapTooltipProps): import("react").JSX.Element | null;
@@ -0,0 +1,9 @@
1
+ import { type ChangeEvent } from "react";
2
+ export interface CodeEditorProps {
3
+ source: string;
4
+ language: string;
5
+ ready: boolean;
6
+ wrapped: boolean;
7
+ onChange: (event: ChangeEvent<HTMLTextAreaElement>) => void;
8
+ }
9
+ export declare function CodeEditor({ source, language, ready, wrapped, onChange, }: CodeEditorProps): import("react").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { type ReactNode } from "react";
2
+ declare const highlighter: {
3
+ highlight: (language: string, value: string, options?: Readonly<import("lowlight").Options> | null | undefined) => import("hast").Root;
4
+ highlightAuto: (value: string, options?: Readonly<import("lowlight").AutoOptions> | null | undefined) => import("hast").Root;
5
+ listLanguages: () => Array<string>;
6
+ register: {
7
+ (grammars: Readonly<Record<string, import("highlight.js").LanguageFn>>): undefined;
8
+ (name: string, grammar: import("highlight.js").LanguageFn): undefined;
9
+ };
10
+ registerAlias: {
11
+ (aliases: Readonly<Record<string, ReadonlyArray<string> | string>>): undefined;
12
+ (language: string, alias: ReadonlyArray<string> | string): undefined;
13
+ };
14
+ registered: (aliasOrName: string) => boolean;
15
+ };
16
+ type Tree = ReturnType<typeof highlighter.highlight>;
17
+ export declare function renderTokens(node: Tree | Tree["children"][number], count: {
18
+ value: number;
19
+ }): ReactNode;
20
+ /** Highlight AST nodes become React text/spans; authored code never becomes raw HTML. */
21
+ export declare const HighlightedCode: import("react").NamedExoticComponent<{
22
+ source: string;
23
+ language: string;
24
+ }>;
25
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { DilDocument } from "../runtime/document.js";
2
+ export interface CodeBlockProps {
3
+ source: string;
4
+ language: string;
5
+ editable: boolean;
6
+ ready: boolean;
7
+ document: DilDocument;
8
+ identity: string;
9
+ presentationRef?: ((element: HTMLElement | null) => void) | undefined;
10
+ }
11
+ export declare function CodeBlock({ source, language, editable, ready, document, identity, presentationRef, }: CodeBlockProps): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const ControlRevisionContext: import("react").Context<number>;