@danxbot/ui 18.4.0 → 19.1.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 (27) hide show
  1. package/dist/index.js +15334 -14677
  2. package/dist/index.js.map +1 -1
  3. package/dist/styles.css +1 -1
  4. package/dist/types/components/AgentWorkingSpinner.d.ts +23 -0
  5. package/dist/types/components/Dialog.d.ts +12 -1
  6. package/dist/types/components/Popover.d.ts +1 -1
  7. package/dist/types/components/chat/Attachment.d.ts +5 -23
  8. package/dist/types/components/file-viewer/FileViewer.d.ts +2 -0
  9. package/dist/types/components/file-viewer/PageNumberJumpField.d.ts +9 -0
  10. package/dist/types/components/file-viewer/ViewerControls.d.ts +20 -0
  11. package/dist/types/components/file-viewer/ViewerRail.d.ts +10 -0
  12. package/dist/types/components/file-viewer/ViewerStage.d.ts +22 -0
  13. package/dist/types/components/file-viewer/frames.d.ts +27 -0
  14. package/dist/types/components/file-viewer/index.d.ts +3 -0
  15. package/dist/types/components/file-viewer/types.d.ts +70 -0
  16. package/dist/types/components/file-viewer/use-frame-cursor.d.ts +13 -0
  17. package/dist/types/components/file-viewer/use-viewer-keys.d.ts +24 -0
  18. package/dist/types/components/file-viewer/use-viewer-zoom.d.ts +29 -0
  19. package/dist/types/components/graph-explorer/camera-math.d.ts +10 -0
  20. package/dist/types/components/graph-explorer/index.d.ts +1 -1
  21. package/dist/types/components/graph-explorer/use-camera.d.ts +3 -5
  22. package/dist/types/components/graph-explorer/viewport-gesture.d.ts +32 -0
  23. package/dist/types/components/overlay-stack.d.ts +18 -0
  24. package/dist/types/icons/data.d.ts +53 -0
  25. package/dist/types/index.d.ts +4 -2
  26. package/dist/types/lib/interactive-target.d.ts +3 -0
  27. package/package.json +1 -1
@@ -0,0 +1,13 @@
1
+ import type { ViewerFile, ViewerFrame } from "./types";
2
+ export interface UseFrameCursorOptions {
3
+ open: boolean;
4
+ files: ViewerFile[];
5
+ initialFileId?: string | null;
6
+ initialPageId?: string | null;
7
+ onFrameChange?: (frame: ViewerFrame) => void;
8
+ }
9
+ export declare function useFrameCursor({ open, files, initialFileId, initialPageId, onFrameChange }: UseFrameCursorOptions): {
10
+ frames: ViewerFrame[];
11
+ frame: ViewerFrame | null;
12
+ go: (next: number) => void;
13
+ };
@@ -0,0 +1,24 @@
1
+ export interface ViewerKeyActions {
2
+ go: (index: number) => void;
3
+ index: number;
4
+ total: number;
5
+ /** Null when the frame is not zoomable: the zoom keys are then not handled. */
6
+ zoom: {
7
+ zoomIn: () => void;
8
+ zoomOut: () => void;
9
+ reset: () => void;
10
+ } | null;
11
+ }
12
+ /**
13
+ * The viewer's keyboard (DX-4398): Arrow, PageUp/PageDown, Home and End step
14
+ * frames; `+`, `-` and `0` zoom. Returns the callback ref for the Dialog popup.
15
+ *
16
+ * A NATIVE listener on the popup element, not a document one and not a React
17
+ * `onKeyDown`: Base UI's popup stops propagation of the arrow, Home, End and Page
18
+ * keys (they belong to composite widgets), so by the time a key reached
19
+ * `document` it was gone. On the popup itself it runs first. It only ever sees
20
+ * keys aimed at the viewer's own DOM: a key inside a portalled Popover (the
21
+ * overflow menu) has a target outside the popup, so it never gets here. Escape is
22
+ * not handled: it is the Dialog's.
23
+ */
24
+ export declare function useViewerKeys(actions: ViewerKeyActions): import("react").Dispatch<import("react").SetStateAction<HTMLDivElement | null>>;
@@ -0,0 +1,29 @@
1
+ import { type CameraState, type ScaleBounds, type Size } from "../graph-explorer/camera-math";
2
+ /** The zoom range of the viewer: far enough out to see a wide page whole, far
3
+ enough in to read a signature. */
4
+ export declare const VIEWER_ZOOM_BOUNDS: ScaleBounds;
5
+ export type ViewerFit = "width" | "contain";
6
+ export interface UseViewerZoomOptions {
7
+ /** Changing this is a different frame: refit. */
8
+ frameKey: string;
9
+ /** How the frame opens. Null: the frame is not zoomable (video, a plain file). */
10
+ fit: ViewerFit | null;
11
+ }
12
+ export declare function useViewerZoom({ frameKey, fit }: UseViewerZoomOptions): {
13
+ camera: CameraState;
14
+ /** Whole-number percent, null until the frame has been measured. */
15
+ percent: number | null;
16
+ measured: boolean;
17
+ atFit: boolean;
18
+ canToggle: boolean;
19
+ panning: boolean;
20
+ bindViewport: (node: HTMLElement | null) => (() => void) | undefined;
21
+ setContentSize: (next: Size) => void;
22
+ zoomIn: () => void;
23
+ zoomOut: () => void;
24
+ reset: () => void;
25
+ toggleActual: (point?: {
26
+ x: number;
27
+ y: number;
28
+ }) => void;
29
+ };
@@ -55,6 +55,16 @@ export interface FitOptions extends ScaleBounds {
55
55
  export declare function unionBox(boxes: readonly Box[]): Box | null;
56
56
  /** A camera that fits the whole of `box` inside `viewport`, centred, padded. */
57
57
  export declare function fitBox(box: Box, viewport: Size, options?: FitOptions): CameraState;
58
+ /**
59
+ * A camera that makes `content` exactly as wide as `viewport` and starts at its
60
+ * top (DX-4398) — how a document page is read: the width fits, the length
61
+ * scrolls, and the top is where a page starts. Horizontally centred, which only
62
+ * shows once `bounds` clamp the page narrower than the viewport. Never an
63
+ * unbounded scale: a 10px-wide page stops at `maxScale`, a 100000px-wide one at
64
+ * `minScale`. Zero-size content (an image not measured yet) is a finite 100%
65
+ * camera at the origin, never NaN.
66
+ */
67
+ export declare function fitWidth(content: Size, viewport: Size, bounds?: ScaleBounds): CameraState;
58
68
  /**
59
69
  * Which viewport edges have `box`'s content extending past them at `camera`'s
60
70
  * current position/scale — the input `fitBoxWithFloor` (below) needs to
@@ -1,5 +1,5 @@
1
1
  export { GraphExplorer, type GraphExplorerProps } from "./GraphExplorer";
2
2
  export { frameBoxFor, layoutExplorerTree, neighbourhoodTree, edgePath } from "./tree-layout";
3
- export { CAMERA_DEFAULTS, centerOn, clampScale, fitBox, fitBoxWithFloor, toContentPoint, toScreenPoint, unionBox, zoomAtPoint, } from "./camera-math";
3
+ export { CAMERA_DEFAULTS, centerOn, clampScale, fitBox, fitBoxWithFloor, fitWidth, toContentPoint, toScreenPoint, unionBox, zoomAtPoint, } from "./camera-math";
4
4
  export type { Box, CameraState, FitOptions, FitWithFloorOptions, FitWithFloorResult, FrameOverflow, Point, ScaleBounds, Size, } from "./camera-math";
5
5
  export type { CrossLink, ExplorerLayout, ExplorerNodeRenderContext, ExplorerNodeRenderer, ExplorerTree, GraphExplorerVariant, TreeNode, } from "./types";
@@ -1,8 +1,6 @@
1
1
  import { type Box, type CameraState, type FrameOverflow } from "./camera-math";
2
- export interface CameraClickEvent {
3
- /** Client coordinates, for the caller to hit-test against its own elements. */
4
- target: HTMLElement;
5
- }
2
+ import { type ViewportClickEvent } from "./viewport-gesture";
3
+ export type CameraClickEvent = ViewportClickEvent;
6
4
  export interface UseCameraOptions {
7
5
  /** Content-space bounding box of the whole drawing. Drives `fitAll`. */
8
6
  contentBox: Box;
@@ -73,7 +71,7 @@ export interface UseCameraResult {
73
71
  * re-derives this from raw `camera` state itself.
74
72
  */
75
73
  frameOverflow: FrameOverflow;
76
- bindViewport: (node: HTMLDivElement | null) => void;
74
+ bindViewport: (node: HTMLElement | null) => (() => void) | undefined;
77
75
  zoomIn: () => void;
78
76
  zoomOut: () => void;
79
77
  fitAll: () => void;
@@ -0,0 +1,32 @@
1
+ import { type CameraState, type ScaleBounds, type Size } from "./camera-math";
2
+ /** How far a pointer may travel and still resolve to a click on release — below
3
+ the jitter of a resting hand, above the travel of a deliberate press. */
4
+ export declare const CLICK_DISTANCE = 5;
5
+ export interface ViewportClickEvent {
6
+ /** The element under the pointer at release, for the caller to hit-test. */
7
+ target: HTMLElement;
8
+ }
9
+ export interface UseViewportGestureOptions {
10
+ /** The camera right now. Read at the start of a pan and on every resume. */
11
+ camera: CameraState;
12
+ /** Wheel, pan and pinch write the camera through this. Wheel and pinch use
13
+ the updater form: they compound on whatever is current. */
14
+ setCamera: (next: CameraState | ((current: CameraState) => CameraState)) => void;
15
+ /** Wheel and pinch never leave these. */
16
+ zoomBounds: ScaleBounds;
17
+ /** A new gesture is starting: stop any programmatic move in flight. */
18
+ onGestureStart?: () => void;
19
+ /** A press that released without travelling past `CLICK_DISTANCE`. */
20
+ onClick?: (event: ViewportClickEvent) => void;
21
+ /** The viewport's content-box size, on observe and on every change. */
22
+ onResize?: (size: Size) => void;
23
+ /** Nothing pans, zooms or clicks. */
24
+ disabled?: boolean;
25
+ }
26
+ export interface UseViewportGestureResult {
27
+ /** A pointer is actively panning or pinching right now. */
28
+ panning: boolean;
29
+ /** Callback ref for the clipping viewport element. */
30
+ bindViewport: (node: HTMLElement | null) => (() => void) | undefined;
31
+ }
32
+ export declare function useViewportGesture(options: UseViewportGestureOptions): UseViewportGestureResult;
@@ -0,0 +1,18 @@
1
+ /** The scopes of every Popover whose content the reader is inside, outermost first. */
2
+ export declare const PopoverScopeContext: import("react").Context<readonly symbol[]>;
3
+ interface OpenPopover {
4
+ scope: symbol;
5
+ close: () => void;
6
+ /** Hide or show the popover without unmounting it. */
7
+ setCovered: (covered: boolean) => void;
8
+ /** How many open dialogs inside it are covering it right now. */
9
+ covers: number;
10
+ }
11
+ /** A Popover is open. Returns the call that says it no longer is. */
12
+ export declare function registerOpenPopover(entry: OpenPopover): () => void;
13
+ /** A Dialog is opening inside `ancestry`: close every open Popover outside it. */
14
+ export declare function dismissPopoversOutside(ancestry: readonly symbol[]): void;
15
+ /** A Dialog is open inside `ancestry`: hide those popovers until it closes.
16
+ Returns the call that says it has. */
17
+ export declare function coverPopovers(ancestry: readonly symbol[]): () => void;
18
+ export {};
@@ -856,6 +856,15 @@ export declare const coreIcons: {
856
856
  }], readonly ["path", {
857
857
  readonly d: "M14 20h7";
858
858
  }]];
859
+ readonly maximize: readonly [readonly ["path", {
860
+ readonly d: "M8 3H5a2 2 0 0 0-2 2v3";
861
+ }], readonly ["path", {
862
+ readonly d: "M21 8V5a2 2 0 0 0-2-2h-3";
863
+ }], readonly ["path", {
864
+ readonly d: "M3 16v3a2 2 0 0 0 2 2h3";
865
+ }], readonly ["path", {
866
+ readonly d: "M16 21h3a2 2 0 0 0 2-2v-3";
867
+ }]];
859
868
  readonly "maximize-2": readonly [readonly ["path", {
860
869
  readonly d: "M15 3h6v6";
861
870
  }], readonly ["path", {
@@ -916,6 +925,15 @@ export declare const coreIcons: {
916
925
  }], readonly ["path", {
917
926
  readonly d: "M21 15H3";
918
927
  }]];
928
+ readonly scan: readonly [readonly ["path", {
929
+ readonly d: "M3 7V5a2 2 0 0 1 2-2h2";
930
+ }], readonly ["path", {
931
+ readonly d: "M17 3h2a2 2 0 0 1 2 2v2";
932
+ }], readonly ["path", {
933
+ readonly d: "M21 17v2a2 2 0 0 1-2 2h-2";
934
+ }], readonly ["path", {
935
+ readonly d: "M7 21H5a2 2 0 0 1-2-2v-2";
936
+ }]];
919
937
  readonly table: readonly [readonly ["path", {
920
938
  readonly d: "M12 3v18";
921
939
  }], readonly ["rect", {
@@ -929,6 +947,41 @@ export declare const coreIcons: {
929
947
  }], readonly ["path", {
930
948
  readonly d: "M3 15h18";
931
949
  }]];
950
+ readonly "zoom-in": readonly [readonly ["circle", {
951
+ readonly cx: "11";
952
+ readonly cy: "11";
953
+ readonly r: "8";
954
+ }], readonly ["line", {
955
+ readonly x1: "21";
956
+ readonly x2: "16.65";
957
+ readonly y1: "21";
958
+ readonly y2: "16.65";
959
+ }], readonly ["line", {
960
+ readonly x1: "11";
961
+ readonly x2: "11";
962
+ readonly y1: "8";
963
+ readonly y2: "14";
964
+ }], readonly ["line", {
965
+ readonly x1: "8";
966
+ readonly x2: "14";
967
+ readonly y1: "11";
968
+ readonly y2: "11";
969
+ }]];
970
+ readonly "zoom-out": readonly [readonly ["circle", {
971
+ readonly cx: "11";
972
+ readonly cy: "11";
973
+ readonly r: "8";
974
+ }], readonly ["line", {
975
+ readonly x1: "21";
976
+ readonly x2: "16.65";
977
+ readonly y1: "21";
978
+ readonly y2: "16.65";
979
+ }], readonly ["line", {
980
+ readonly x1: "8";
981
+ readonly x2: "14";
982
+ readonly y1: "11";
983
+ readonly y2: "11";
984
+ }]];
932
985
  readonly activity: readonly [readonly ["path", {
933
986
  readonly d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2";
934
987
  }]];
@@ -18,6 +18,7 @@ export { IconButton, type IconButtonProps, type IconButtonVariant, type IconButt
18
18
  export { Badge, type BadgeProps, type BadgeDismiss, } from "./components/Badge";
19
19
  export { Callout, type CalloutProps } from "./components/Callout";
20
20
  export { Spinner, type SpinnerProps } from "./components/Spinner";
21
+ export { AgentWorkingSpinner, type AgentWorkingSpinnerProps, } from "./components/AgentWorkingSpinner";
21
22
  export { Skeleton, SkeletonText, LoadingOverlay, type SkeletonProps, type SkeletonTextProps, type LoadingOverlayProps, } from "./components/Loading";
22
23
  export { ErrorBoundary, type ErrorBoundaryProps } from "./components/ErrorBoundary";
23
24
  export { Field, FieldSet, type FieldProps, type FieldSetProps } from "./components/Field";
@@ -119,8 +120,9 @@ export { Message, MessagePartView, ToolCall, type MessageProps, type MessageActi
119
120
  export { MessageScroller, type MessageScrollerProps, } from "./components/chat/MessageScroller";
120
121
  export { Composer, type ComposerProps } from "./components/chat/Composer";
121
122
  export { StreamingMarkdown, type StreamingMarkdownProps, } from "./components/chat/StreamingMarkdown";
122
- export { Attachment, AttachmentAction, AttachmentList, AttachmentPreview, type AttachmentProps, type AttachmentActionProps, type AttachmentListProps, type AttachmentPreviewProps, type AttachmentLayout, } from "./components/chat/Attachment";
123
+ export { Attachment, AttachmentAction, AttachmentList, type AttachmentProps, type AttachmentActionProps, type AttachmentListProps, type AttachmentLayout, } from "./components/chat/Attachment";
123
124
  export { FileCover, type FileCoverProps } from "./components/chat/FileCover";
125
+ export { FileViewer, PageNumberJumpField, type FileViewerProps, type PageNumberJumpFieldProps, type ViewerFile, type ViewerFrame, type ViewerPage, } from "./components/file-viewer";
124
126
  export { fileIconFor, type FileIdentity } from "./components/chat/file-icon";
125
127
  export { VideoPlayer, type VideoPlayerProps, type VideoTrack } from "./components/VideoPlayer";
126
128
  export { ModelSelector, type ModelSelectorProps, type ChatModel, } from "./components/chat/ModelSelector";
@@ -155,7 +157,7 @@ export { ProvenanceDisclosure, ProvenanceDetail, ProvenanceBadge, ConfidenceRead
155
157
  export { confidenceLevel, CONFIDENCE_LEVEL_LABELS, type ConfidenceLevel } from "./lib/confidence";
156
158
  export { createSimStore, resetSimStores, useSimSettings, setSimSettings, getNetworkSpeed, getDataSource, simulateLatency, SimNetworkError, type SimStore, type SimStoreOptions, type SimSettings, type NetworkSpeed, type DataSource, type SimNamespace, } from "./lib/sim";
157
159
  export { NodeCanvas, LAYOUT_DEFAULTS, edgePath, layoutGraph, neighbourhood, type NodeCanvasProps, type CanvasCycleScope, type CanvasEdge, type CanvasGraph, type CanvasGroup, type CanvasLayout, type CanvasNode, type CanvasOrientation, type CanvasPlacedEdge, type CanvasScope, type LayoutOptions, type NodeRenderContext, type NodeRenderer, type PlacedNode, } from "./components/node-canvas";
158
- export { GraphExplorer, frameBoxFor, layoutExplorerTree, neighbourhoodTree, CAMERA_DEFAULTS, centerOn, clampScale, fitBox, fitBoxWithFloor, toContentPoint, toScreenPoint, unionBox, zoomAtPoint, type GraphExplorerProps, type Box, type CameraState, type FitOptions, type FitWithFloorOptions, type FitWithFloorResult, type FrameOverflow, type Point, type ScaleBounds, type Size, type CrossLink, type ExplorerLayout, type ExplorerNodeRenderContext, type ExplorerNodeRenderer, type ExplorerTree, type GraphExplorerVariant, type TreeNode as ExplorerTreeNode, } from "./components/graph-explorer";
160
+ export { GraphExplorer, frameBoxFor, layoutExplorerTree, neighbourhoodTree, CAMERA_DEFAULTS, centerOn, clampScale, fitBox, fitBoxWithFloor, fitWidth, toContentPoint, toScreenPoint, unionBox, zoomAtPoint, type GraphExplorerProps, type Box, type CameraState, type FitOptions, type FitWithFloorOptions, type FitWithFloorResult, type FrameOverflow, type Point, type ScaleBounds, type Size, type CrossLink, type ExplorerLayout, type ExplorerNodeRenderContext, type ExplorerNodeRenderer, type ExplorerTree, type GraphExplorerVariant, type TreeNode as ExplorerTreeNode, } from "./components/graph-explorer";
159
161
  export { FocusWeb, CENTER_POSITION, PARENT_POSITION, WIDE_RING_THRESHOLD, layoutRing, type FocusNodeRenderContext, type FocusNodeRenderer, type FocusNodeRole, type FocusWebNode, type FocusWebNodeLook, type FocusWebProps, type PlacedRingNode, } from "./components/focus-web";
160
162
  export { SequenceDiagram, type SequenceDiagramProps, type SequenceStep, } from "./components/SequenceDiagram";
161
163
  export { OpenApiViewer, type OpenApiViewerProps, OperationCard, type OperationCardProps, OperationHeader, type OperationHeaderProps, OperationDetail, type OperationDetailProps, SchemaView, type SchemaViewProps, groupOperations, isHttpMethod, mergedParameters, operationAnchorId, resolveSchema, resolveWebhooks, schemaToExample, type SchemaResolution, HTTP_METHODS, type HttpMethod, type OpenApiDocument, type OpenApiMediaType, type OpenApiOperation, type OpenApiParameter, type OpenApiParameterLocation, type OpenApiPathItem, type OpenApiRequestBody, type OpenApiResponse, type OpenApiSchema, type OpenApiSecurityRequirement, type OpenApiSecurityScheme, type OpenApiTag, type OperationGroup, type ResolvedOperation, } from "./components/openapi";
@@ -0,0 +1,3 @@
1
+ export declare const INTERACTIVE_SELECTOR = "button, a, input, textarea, select, [role='button']";
2
+ /** True when `target` is, or is inside, a control. */
3
+ export declare function isInteractiveTarget(target: EventTarget | null): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "18.4.0",
3
+ "version": "19.1.0",
4
4
  "type": "module",
5
5
  "description": "Danxbot — a domain-agnostic React design system with motion as a first-class primitive.",
6
6
  "license": "MIT",