@snackbit/opendil 0.1.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 (88) hide show
  1. package/README.md +74 -137
  2. package/bin/opendil.mjs +66 -11
  3. package/bin/publish-directory.d.mts +18 -0
  4. package/bin/publish-directory.mjs +173 -17
  5. package/dist/agent-spec.js +9 -0
  6. package/dist/chunk-RPZW4WVX.js +2 -0
  7. package/dist/chunk-ZSTXLIS6.js +2 -0
  8. package/dist/index.js +1 -10
  9. package/dist/runtime/frame.html +117 -44
  10. package/dist/runtime/frame.js +501 -505
  11. package/dist/spec/genui.agent.full.md +1927 -0
  12. package/dist/spec/genui.agent.md +479 -0
  13. package/dist/spec/genui.examples.md +836 -0
  14. package/dist/styled-renderer-PHI4MNPF.js +2441 -0
  15. package/dist/styles.css +115 -42
  16. package/dist/types/agent-spec.d.ts +12 -0
  17. package/dist/types/components/ui/controls/select.d.ts +14 -0
  18. package/dist/types/components/ui/controls/tabs.d.ts +7 -0
  19. package/dist/types/components/ui/controls/toggle-group.d.ts +3 -2
  20. package/dist/types/components/ui/display/chart.d.ts +6 -12
  21. package/dist/types/components/ui/media/carousel.d.ts +1 -1
  22. package/dist/types/components/ui/overlays/collapsible.d.ts +6 -0
  23. package/dist/types/components/ui/overlays/popover.d.ts +2 -1
  24. package/dist/types/components/ui/overlays/ui-scope.d.ts +16 -0
  25. package/dist/types/dil/custom-component.d.ts +1 -1
  26. package/dist/types/dil/dil-renderer.d.ts +58 -23
  27. package/dist/types/dil/isolation/frame-startup.d.ts +18 -0
  28. package/dist/types/dil/isolation/frame-theme.d.ts +14 -0
  29. package/dist/types/dil/isolation/frame-viewport.d.ts +30 -0
  30. package/dist/types/dil/isolation/isolated-renderer.d.ts +13 -7
  31. package/dist/types/dil/isolation/overlay-room.d.ts +29 -0
  32. package/dist/types/dil/isolation/viewport-scroll.d.ts +3 -2
  33. package/dist/types/dil/message-renderer.d.ts +6 -5
  34. package/dist/types/dil/parser/dil-parser.d.ts +44 -3
  35. package/dist/types/dil/parser/lexical.d.ts +13 -2
  36. package/dist/types/dil/parser/literal-tag.d.ts +16 -0
  37. package/dist/types/dil/parser/markdown-lexing.d.ts +41 -0
  38. package/dist/types/dil/parser/types.d.ts +22 -1
  39. package/dist/types/dil/parser/unfinished.d.ts +22 -0
  40. package/dist/types/dil/parser/vocabulary.d.ts +12 -0
  41. package/dist/types/dil/render-error.d.ts +47 -0
  42. package/dist/types/dil/renderer-environment.d.ts +19 -8
  43. package/dist/types/dil/runtime/document.d.ts +18 -6
  44. package/dist/types/dil/runtime/execution-queue.d.ts +2 -1
  45. package/dist/types/dil/runtime/expressions.d.ts +8 -5
  46. package/dist/types/dil/runtime/inline-worker.d.ts +33 -0
  47. package/dist/types/dil/runtime/view-cost.d.ts +2 -2
  48. package/dist/types/dil/styled-renderer.d.ts +39 -0
  49. package/dist/types/dil/view/conditional-view.d.ts +3 -3
  50. package/dist/types/dil/view/markdown-node.d.ts +3 -3
  51. package/dist/types/dil/view/node-children.d.ts +3 -3
  52. package/dist/types/dil/view/node-view.d.ts +2 -2
  53. package/dist/types/dil/view/progressive-reveal.d.ts +5 -4
  54. package/dist/types/dil/view/render-boundary.d.ts +13 -0
  55. package/dist/types/dil/view/render-limit.d.ts +1 -1
  56. package/dist/types/dil/view/repeated-nodes.d.ts +4 -4
  57. package/dist/types/dil/view/reveal/controller.d.ts +9 -2
  58. package/dist/types/dil/view/reveal/presentation.d.ts +1 -1
  59. package/dist/types/dil/view/scroll/controller.d.ts +16 -2
  60. package/dist/types/dil/view/scroll/host-viewport.d.ts +24 -0
  61. package/dist/types/dil/view/scroll/root-tracker.d.ts +17 -0
  62. package/dist/types/dil/view/scroll/scroll-root.d.ts +36 -0
  63. package/dist/types/dil/view/scroll-options.d.ts +15 -0
  64. package/dist/types/dil/view/stream-follow.d.ts +10 -3
  65. package/dist/types/dil/view/table-context.d.ts +1 -1
  66. package/dist/types/dil/view/virtual-flow.d.ts +3 -3
  67. package/dist/types/dil/widgets/action-feedback.d.ts +1 -1
  68. package/dist/types/dil/widgets/charts/chart-hover.d.ts +17 -0
  69. package/dist/types/dil/widgets/charts/chart-legend.d.ts +1 -1
  70. package/dist/types/dil/widgets/charts/chart-pie.d.ts +16 -0
  71. package/dist/types/dil/widgets/charts/chart-series.d.ts +10 -2
  72. package/dist/types/dil/widgets/charts/chart-snapping.d.ts +3 -5
  73. package/dist/types/dil/widgets/charts/snap-cursor.d.ts +3 -7
  74. package/dist/types/dil/widgets/charts/snap-tooltip.d.ts +6 -4
  75. package/dist/types/dil/widgets/code-block.d.ts +1 -1
  76. package/dist/types/dil/widgets/controls.d.ts +2 -2
  77. package/dist/types/dil/widgets/graphs/node-graph.d.ts +1 -1
  78. package/dist/types/dil/widgets/graphs/service-node.d.ts +1 -1
  79. package/dist/types/dil/widgets/primitives/primitive.d.ts +4 -4
  80. package/dist/types/index.d.ts +9 -8
  81. package/dist/types/ui.d.ts +11 -8
  82. package/dist/ui.js +1 -1
  83. package/package.json +13 -2
  84. package/styles/tailwind.css +53 -1
  85. package/styles/tokens.css +3 -0
  86. package/dist/chunk-ZWAN2JCV.js +0 -2
  87. package/dist/runtime/vm.js +0 -6
  88. package/dist/shadow-renderer-F25KL3C4.js +0 -2363
@@ -1,5 +1,5 @@
1
- import type { DilDocument } from "../runtime/document";
2
- import type { Scope } from "../runtime/expressions";
1
+ import type { DilDocument } from "../runtime/document.js";
2
+ import type { Scope } from "../runtime/expressions.js";
3
3
  export interface NodeViewProps {
4
4
  id: number;
5
5
  document: DilDocument;
@@ -1,6 +1,7 @@
1
1
  import { type RefObject } from "react";
2
- import type { DilDocument } from "../runtime/document";
3
- import { type ProgressiveReveal } from "./reveal-options";
4
- import { RevealController } from "./reveal/controller";
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";
5
6
  export declare function revealDelay(index: number, staggerMs?: number): number;
6
- export declare function useProgressiveReveal(root: RefObject<HTMLElement | null>, options: ProgressiveReveal, document: DilDocument | null): RevealController;
7
+ export declare function useProgressiveReveal(root: RefObject<HTMLElement | null>, options: ProgressiveReveal, document: DilDocument | null, viewport?: RendererViewport): RevealController;
@@ -1,8 +1,12 @@
1
1
  import { Component, type ReactNode } from "react";
2
+ import type { DilDocument } from "../runtime/document.js";
3
+ import type { DilRenderError } from "../render-error.js";
2
4
  interface RenderBoundaryProps {
3
5
  revision: string;
4
6
  streaming: boolean;
5
7
  children: ReactNode;
8
+ /** Receives the error readers see once the message is final. */
9
+ onError?: ((message: string) => void) | undefined;
6
10
  }
7
11
  interface BoundaryState {
8
12
  error: string;
@@ -17,6 +21,15 @@ export declare class RenderBoundary extends Component<RenderBoundaryProps, Bound
17
21
  static getDerivedStateFromError(error: unknown): {
18
22
  error: string;
19
23
  };
24
+ componentDidMount(): void;
25
+ componentDidUpdate(): void;
26
+ private reportShownError;
20
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;
21
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;
22
35
  export {};
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
- import type { DilDocument } from "../runtime/document";
2
+ import type { DilDocument } from "../runtime/document.js";
3
3
  type BudgetDocument = Pick<DilDocument, "renderBudget" | "reportRenderLimit">;
4
4
  export declare const RenderAllowance: import("react").Context<number>;
5
5
  export interface RenderLimitProps {
@@ -1,7 +1,7 @@
1
- import type { DilNode } from "../parser/types";
2
- import type { ChildList } from "../runtime/child-list";
3
- import type { DilDocument } from "../runtime/document";
4
- import type { Scope } from "../runtime/expressions";
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
5
  interface RepeatedNodesProps {
6
6
  node: DilNode;
7
7
  childrenIds: ChildList;
@@ -1,5 +1,5 @@
1
- import type { PresentationHistory } from "../../runtime/presentation-history";
2
- import type { RevealTiming } from "../reveal-options";
1
+ import type { PresentationHistory } from "../../runtime/presentation-history.js";
2
+ import type { RevealTiming } from "../reveal-options.js";
3
3
  export declare class RevealController {
4
4
  readonly history: PresentationHistory;
5
5
  private readonly viewport;
@@ -17,6 +17,13 @@ export declare class RevealController {
17
17
  configure(timing: RevealTiming | null): void;
18
18
  start(): () => void;
19
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;
20
27
  private prepare;
21
28
  private finish;
22
29
  showAll(): void;
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
- import type { RevealController } from "./controller";
2
+ import type { RevealController } from "./controller.js";
3
3
  export declare const RevealContext: import("react").Context<RevealController | null>;
4
4
  export declare function usePresentationKey(identity: string): string;
5
5
  export declare function usePresentationTarget(identity: string, eligible?: boolean): (element: HTMLElement | null) => void;
@@ -1,21 +1,35 @@
1
- import type { scrollSettings } from "../scroll-options";
1
+ import type { scrollSettings } from "../scroll-options.js";
2
+ import type { ScrollRootTracker } from "./root-tracker.js";
3
+ import { ScrollRoot } from "./scroll-root.js";
2
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;
3
7
  /** One moving-target animation per message. Native smooth scrolling would restart on each chunk. */
4
8
  export declare class ScrollFollower {
5
9
  private readonly element;
6
10
  private readonly settings;
7
11
  private readonly changed;
12
+ private readonly roots?;
8
13
  private readonly view;
14
+ private readonly page;
9
15
  private readonly reduced;
10
16
  private readonly observer;
11
17
  private readonly unlisten;
18
+ private readonly unsubscribe;
12
19
  private releaseAnchor;
20
+ private observed;
13
21
  private frame;
14
22
  private previous;
15
23
  private position;
16
24
  private following;
17
25
  private notified;
18
- constructor(element: HTMLElement, settings: () => Settings, changed: (following: boolean) => void, listen: (view: Window, pause: () => void) => () => void);
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;
19
33
  private report;
20
34
  start(): void;
21
35
  end(): void;
@@ -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;
@@ -1,10 +1,25 @@
1
+ import type { RefObject } from "react";
1
2
  export interface AutoScrollOptions {
2
3
  behavior?: "instant" | "smooth";
3
4
  /** Extra distance beyond the message tail, clamped to available document space. */
4
5
  padding?: number;
5
6
  }
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;
7
16
  export declare function scrollSettings(value: AutoScroll): {
8
17
  behavior: "instant" | "smooth";
9
18
  padding: number;
10
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;
@@ -1,8 +1,15 @@
1
1
  import { type RefObject } from "react";
2
- import { type AutoScroll } from "./scroll-options";
3
- export declare function listenForScrollAway(view: Window, pause: () => void): () => void;
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;
4
11
  /** Only deliberate reading gestures suspend following, never layout or anchor adjustments. */
5
- export declare function useStreamFollow(root: RefObject<HTMLElement | null>, options: AutoScroll, streaming: boolean, onChange?: ((following: boolean) => void) | undefined): {
12
+ export declare function useStreamFollow(root: RefObject<HTMLElement | null>, options: AutoScroll, streaming: boolean, onChange?: ((following: boolean) => void) | undefined, scroller?: ScrollRootTracker): {
6
13
  pause: () => void | undefined;
7
14
  resume: () => void | undefined;
8
15
  };
@@ -1,5 +1,5 @@
1
1
  import { type FocusEvent, type ReactNode } from "react";
2
- export declare const TableScope: import("react").Context<false | "row" | "body">;
2
+ export declare const TableScope: import("react").Context<false | "body" | "row">;
3
3
  interface RowMeasurement {
4
4
  index: number;
5
5
  group: string;
@@ -1,7 +1,7 @@
1
1
  import { type ReactNode } from "react";
2
- import type { ChildList } from "../runtime/child-list";
3
- import type { DilDocument } from "../runtime/document";
4
- import type { Scope } from "../runtime/expressions";
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
5
  export interface VirtualFlowProps {
6
6
  identity?: string;
7
7
  count: number;
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { StoreApi } from "zustand/vanilla";
3
- import type { DocumentStatus } from "../runtime/document";
3
+ import type { DocumentStatus } from "../runtime/document.js";
4
4
  export type ActionFeedback = "idle" | "copied" | "failed";
5
5
  /** Shows the clipboard outcome of the action this control started, briefly. */
6
6
  export declare function useActionFeedback(status: StoreApi<DocumentStatus>): readonly [ActionFeedback, (result: unknown) => void];
@@ -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;
@@ -1,4 +1,4 @@
1
- import type { ChartItem } from "./chart-selection";
1
+ import type { ChartItem } from "./chart-selection.js";
2
2
  export interface ChartLegendProps {
3
3
  items: readonly ChartItem[];
4
4
  hidden: ReadonlySet<string>;
@@ -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>;
@@ -1,4 +1,5 @@
1
- import type { ChartItem } from "./chart-selection";
1
+ import type { ChartHit } from "./chart-hover.js";
2
+ import type { ChartItem } from "./chart-selection.js";
2
3
  export interface ChartSeriesProps {
3
4
  item: ChartItem;
4
5
  index: number;
@@ -7,5 +8,12 @@ export interface ChartSeriesProps {
7
8
  muted: boolean;
8
9
  rows: Record<string, unknown>[];
9
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;
10
18
  }
11
- export declare function ChartSeries({ item, index, type, hidden, muted, rows, highlight, }: ChartSeriesProps): import("react").JSX.Element;
19
+ export declare function ChartSeries({ item, index, type, hidden, muted, rows, highlight, hover, markers, }: ChartSeriesProps): import("react").JSX.Element;
@@ -1,8 +1,6 @@
1
- import type { ChartItem } from "./chart-selection";
2
- export interface ChartPoint {
3
- index: number;
4
- item: ChartItem;
5
- row: Record<string, unknown>;
1
+ import type { ChartItem } from "./chart-selection.js";
2
+ import type { ChartTarget } from "./chart-hover.js";
3
+ export interface ChartPoint extends ChartTarget {
6
4
  x: number;
7
5
  y: number;
8
6
  value: number;
@@ -1,10 +1,5 @@
1
- import { type ChartPoint } from "./chart-snapping";
2
- import type { ChartItem } from "./chart-selection";
3
- export interface ChartHit {
4
- point: ChartPoint;
5
- clientX: number;
6
- clientY: number;
7
- }
1
+ import { type ChartHit } from "./chart-hover.js";
2
+ import type { ChartItem } from "./chart-selection.js";
8
3
  export interface SnapCursorProps {
9
4
  rows: Record<string, unknown>[];
10
5
  items: readonly ChartItem[];
@@ -13,4 +8,5 @@ export interface SnapCursorProps {
13
8
  hit: ChartHit | null;
14
9
  onHover: (hit: ChartHit | null) => void;
15
10
  }
11
+ /** Line and scatter hover: snap from anywhere in the plot to the nearest datum. */
16
12
  export declare function SnapCursor({ rows, items, xKey, scatter, hit, onHover, }: SnapCursorProps): import("react").JSX.Element | null;
@@ -1,10 +1,12 @@
1
- import type { ChartItem } from "./chart-selection";
2
- import type { ChartHit } from "./snap-cursor";
1
+ import type { ChartItem } from "./chart-selection.js";
2
+ import type { ChartHit } from "./chart-hover.js";
3
3
  export interface SnapTooltipProps {
4
4
  hit: ChartHit | null;
5
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";
6
8
  xKey: string;
7
- scatter: boolean;
9
+ valueKey: string;
8
10
  onHover: (hit: ChartHit | null) => void;
9
11
  }
10
- export declare function SnapTooltip({ hit, items, xKey, scatter, onHover, }: SnapTooltipProps): import("react").JSX.Element | null;
12
+ export declare function SnapTooltip({ hit, items, kind, xKey, valueKey, onHover, }: SnapTooltipProps): import("react").JSX.Element | null;
@@ -1,4 +1,4 @@
1
- import type { DilDocument } from "../runtime/document";
1
+ import type { DilDocument } from "../runtime/document.js";
2
2
  export interface CodeBlockProps {
3
3
  source: string;
4
4
  language: string;
@@ -1,7 +1,7 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { StoreApi } from "zustand/vanilla";
3
- import type { DocumentStatus } from "../runtime/document";
4
- import { type Attributes } from "./primitives/attribute-values";
3
+ import type { DocumentStatus } from "../runtime/document.js";
4
+ import { type Attributes } from "./primitives/attribute-values.js";
5
5
  export declare const PopoverTriggerScope: import("react").Context<boolean>;
6
6
  export interface ControlProps {
7
7
  attributes: Attributes;
@@ -1,4 +1,4 @@
1
- import { type Attributes } from "../primitives/attribute-values";
1
+ import { type Attributes } from "../primitives/attribute-values.js";
2
2
  export interface NodeGraphProps {
3
3
  attributes: Attributes;
4
4
  presentationRef?: ((element: HTMLElement | null) => void) | undefined;
@@ -1,3 +1,3 @@
1
1
  import { type NodeProps } from "@xyflow/react";
2
- import type { ServiceGraphNode } from "./graph-model";
2
+ import type { ServiceGraphNode } from "./graph-model.js";
3
3
  export declare function ServiceNode({ data, selected }: NodeProps<ServiceGraphNode>): import("react").JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import { type ReactNode } from "react";
2
- import type { DilNode } from "../../parser/types";
3
- import type { DilDocument } from "../../runtime/document";
4
- import type { Scope } from "../../runtime/expressions";
5
- import { type Attributes } from "./attribute-values";
2
+ import type { DilNode } from "../../parser/types.js";
3
+ import type { DilDocument } from "../../runtime/document.js";
4
+ import type { Scope } from "../../runtime/expressions.js";
5
+ import { type Attributes } from "./attribute-values.js";
6
6
  export interface PrimitiveProps {
7
7
  node: DilNode;
8
8
  attributes: Attributes;
@@ -1,8 +1,9 @@
1
- export { DilRenderer } from "./dil/dil-renderer";
2
- export type { DilRendererHandle } from "./dil/renderer-handle";
3
- export type { AutoScroll, AutoScrollOptions } from "./dil/view/scroll-options";
4
- export type { UpdateInterval } from "./dil/runtime/presentation-scheduler";
5
- export type { DilRendererProps, DilHostRendererProps, DilShadowRendererProps, DilIsolatedRendererProps, } from "./dil/dil-renderer";
6
- export type { DilComponentProps, DilCustomization } from "./dil/customization";
7
- export type { RendererMetrics } from "./dil/renderer-environment";
8
- export type { ProgressiveRevealOptions, ProgressiveReveal, } from "./dil/view/reveal-options";
1
+ export { DilRenderer, preloadHostRenderer } from "./dil/dil-renderer.js";
2
+ export type { DilRendererHandle } from "./dil/renderer-handle.js";
3
+ export type { AutoScroll, AutoScrollOptions, ScrollContainer, } from "./dil/view/scroll-options.js";
4
+ export type { UpdateInterval } from "./dil/runtime/presentation-scheduler.js";
5
+ export type { DilRendererProps, DilHostRendererProps, DilShadowRendererProps, DilIsolatedRendererProps, } from "./dil/dil-renderer.js";
6
+ export type { DilComponentProps, DilCustomization } from "./dil/customization.js";
7
+ export type { RendererMetrics } from "./dil/renderer-environment.js";
8
+ export type { DilRenderError, DilRenderErrorKind } from "./dil/render-error.js";
9
+ export type { ProgressiveRevealOptions, ProgressiveReveal, } from "./dil/view/reveal-options.js";
@@ -1,8 +1,11 @@
1
- export { Button, buttonVariants } from "./components/ui/controls/button";
2
- export { ToggleGroup, ToggleGroupItem, } from "./components/ui/controls/toggle-group";
3
- export { UiScope } from "./components/ui/overlays/ui-scope";
4
- export { Popover, PopoverTrigger, PopoverContent, } from "./components/ui/overlays/popover";
5
- export { Tooltip } from "./components/ui/overlays/tooltip";
6
- export { Input } from "./components/ui/controls/input";
7
- export { Checkbox } from "./components/ui/controls/checkbox";
8
- export { Slider } from "./components/ui/controls/slider";
1
+ export { Button, buttonVariants } from "./components/ui/controls/button.js";
2
+ export { ToggleGroup, ToggleGroupItem, } from "./components/ui/controls/toggle-group.js";
3
+ export { UiScope } from "./components/ui/overlays/ui-scope.js";
4
+ export { Popover, PopoverTrigger, PopoverContent, } from "./components/ui/overlays/popover.js";
5
+ export { Tooltip } from "./components/ui/overlays/tooltip.js";
6
+ export { Input } from "./components/ui/controls/input.js";
7
+ export { Checkbox } from "./components/ui/controls/checkbox.js";
8
+ export { Collapsible, CollapsibleTrigger, CollapsibleContent, } from "./components/ui/overlays/collapsible.js";
9
+ export { Tabs, TabsList, TabsTrigger, TabsContent, } from "./components/ui/controls/tabs.js";
10
+ export { Slider } from "./components/ui/controls/slider.js";
11
+ export { Select, SelectValue, SelectGroup, SelectPortal, SelectViewport, SelectItemIndicator, SelectItemText, SelectTrigger, SelectContent, SelectItem, SelectLabel, } from "./components/ui/controls/select.js";
package/dist/ui.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{b as o,c as r,d as e,e as t,g as p,h as m,i as x,j as f,k as g,l as n,m as i,n as u}from"./chunk-ZWAN2JCV.js";export{m as Button,f as Checkbox,g as Input,r as Popover,t as PopoverContent,e as PopoverTrigger,n as Slider,i as ToggleGroup,u as ToggleGroupItem,x as Tooltip,o as UiScope,p as buttonVariants};
2
+ import{a as r,b as p,c,d as m,e as f,f as d,h as u,i as b,j as g,k as C,l as P,m as T,n as x,o as S}from"./chunk-RPZW4WVX.js";import{Collapsible as s}from"radix-ui";import{jsx as a}from"react/jsx-runtime";function v(e){return a(s.Root,{"data-slot":"collapsible",...e})}function y(e){return a(s.Trigger,{"data-slot":"collapsible-trigger",...e})}function I(e){return a(s.Content,{"data-slot":"collapsible-content",...e})}import{Tabs as i}from"radix-ui";import{jsx as l}from"react/jsx-runtime";function w(e){return l(i.Root,{"data-slot":"tabs",...e})}function h({className:e,...t}){return l(i.List,{"data-slot":"tabs-list",className:r("inline-flex w-fit items-center rounded-lg bg-secondary p-1",e),...t})}function L({className:e,...t}){return l(i.Trigger,{"data-slot":"tabs-trigger",className:r("inline-flex h-8 items-center justify-center gap-2 rounded-md px-2 text-sm font-medium text-foreground whitespace-nowrap outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:shadow-sm",e),...t})}function V(e){return l(i.Content,{"data-slot":"tabs-content",...e})}import{Select as o}from"radix-ui";import{jsx as n}from"react/jsx-runtime";var N=o.Root,G=o.Value,R=o.Group,k=o.Viewport,z=o.ItemIndicator,B=o.ItemText;function U(e){let{container:t}=p();return n(o.Portal,{container:t,...e})}function q({className:e,...t}){return n(o.Trigger,{"data-slot":"select-trigger",className:r("inline-flex items-center justify-between gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50",e),...t})}function A({className:e,...t}){return n(o.Content,{"data-slot":"select-content",className:r("z-50 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",e),...t})}function D({className:e,...t}){return n(o.Item,{"data-slot":"select-item",className:r("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[highlighted]:bg-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t})}function E({className:e,...t}){return n(o.Label,{"data-slot":"select-label",className:r("px-2 py-1.5 text-xs font-medium",e),...t})}export{b as Button,C as Checkbox,v as Collapsible,I as CollapsibleContent,y as CollapsibleTrigger,P as Input,m as Popover,d as PopoverContent,f as PopoverTrigger,N as Select,A as SelectContent,R as SelectGroup,D as SelectItem,z as SelectItemIndicator,B as SelectItemText,E as SelectLabel,U as SelectPortal,q as SelectTrigger,G as SelectValue,k as SelectViewport,T as Slider,w as Tabs,V as TabsContent,h as TabsList,L as TabsTrigger,x as ToggleGroup,S as ToggleGroupItem,g as Tooltip,c as UiScope,u as buttonVariants};
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@snackbit/opendil",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Streaming interactive documents for React using Dynamic Interface Language",
5
5
  "type": "module",
6
+ "types": "./dist/types/index.d.ts",
6
7
  "license": "Apache-2.0",
7
8
  "repository": {
8
9
  "type": "git",
@@ -22,6 +23,8 @@
22
23
  },
23
24
  "files": [
24
25
  "dist",
26
+ "!dist/test",
27
+ "!dist/.opendil-manifest.json",
25
28
  "styles",
26
29
  "bin",
27
30
  "THIRD_PARTY_NOTICES.md"
@@ -40,7 +43,14 @@
40
43
  "./ui": {
41
44
  "types": "./dist/types/ui.d.ts",
42
45
  "import": "./dist/ui.js"
43
- }
46
+ },
47
+ "./agent-spec": {
48
+ "types": "./dist/types/agent-spec.d.ts",
49
+ "default": "./dist/agent-spec.js"
50
+ },
51
+ "./spec/genui.agent.md": "./dist/spec/genui.agent.md",
52
+ "./spec/genui.agent.full.md": "./dist/spec/genui.agent.full.md",
53
+ "./spec/genui.examples.md": "./dist/spec/genui.examples.md"
44
54
  },
45
55
  "bin": {
46
56
  "opendil": "./bin/opendil.mjs"
@@ -50,6 +60,7 @@
50
60
  },
51
61
  "scripts": {
52
62
  "build": "node scripts/build.mjs",
63
+ "prepack": "node scripts/prune-dist.mjs",
53
64
  "typecheck": "tsc --noEmit -p tsconfig.json"
54
65
  },
55
66
  "peerDependencies": {