@danxbot/ui 1.0.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 (183) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +126 -0
  3. package/dist/fonts/bricolage-grotesque-0.woff2 +0 -0
  4. package/dist/fonts/bricolage-grotesque-1.woff2 +0 -0
  5. package/dist/fonts/bricolage-grotesque-2.woff2 +0 -0
  6. package/dist/fonts/figtree-0.woff2 +0 -0
  7. package/dist/fonts/figtree-1.woff2 +0 -0
  8. package/dist/fonts/figtree-2.woff2 +0 -0
  9. package/dist/fonts/figtree-3.woff2 +0 -0
  10. package/dist/fonts/jetbrains-mono-0.woff2 +0 -0
  11. package/dist/fonts/jetbrains-mono-1.woff2 +0 -0
  12. package/dist/fonts/jetbrains-mono-10.woff2 +0 -0
  13. package/dist/fonts/jetbrains-mono-11.woff2 +0 -0
  14. package/dist/fonts/jetbrains-mono-2.woff2 +0 -0
  15. package/dist/fonts/jetbrains-mono-3.woff2 +0 -0
  16. package/dist/fonts/jetbrains-mono-4.woff2 +0 -0
  17. package/dist/fonts/jetbrains-mono-5.woff2 +0 -0
  18. package/dist/fonts/jetbrains-mono-6.woff2 +0 -0
  19. package/dist/fonts/jetbrains-mono-7.woff2 +0 -0
  20. package/dist/fonts/jetbrains-mono-8.woff2 +0 -0
  21. package/dist/fonts/jetbrains-mono-9.woff2 +0 -0
  22. package/dist/fonts.css +187 -0
  23. package/dist/index.js +42425 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/styles.css +190 -0
  26. package/dist/types/components/Accordion.d.ts +15 -0
  27. package/dist/types/components/AppShell.d.ts +58 -0
  28. package/dist/types/components/Avatar.d.ts +154 -0
  29. package/dist/types/components/Badge.d.ts +73 -0
  30. package/dist/types/components/Button.d.ts +103 -0
  31. package/dist/types/components/Card.d.ts +193 -0
  32. package/dist/types/components/Choice.d.ts +112 -0
  33. package/dist/types/components/CodeEditor.d.ts +86 -0
  34. package/dist/types/components/Combobox.d.ts +37 -0
  35. package/dist/types/components/CommandPalette.d.ts +33 -0
  36. package/dist/types/components/DatePicker.d.ts +20 -0
  37. package/dist/types/components/Dialog.d.ts +117 -0
  38. package/dist/types/components/DragDrop.d.ts +60 -0
  39. package/dist/types/components/ErrorBoundary.d.ts +16 -0
  40. package/dist/types/components/Field.d.ts +37 -0
  41. package/dist/types/components/FileUpload.d.ts +22 -0
  42. package/dist/types/components/Icon.d.ts +40 -0
  43. package/dist/types/components/Input.d.ts +120 -0
  44. package/dist/types/components/Loading.d.ts +83 -0
  45. package/dist/types/components/MarkdownEditor.d.ts +24 -0
  46. package/dist/types/components/Menu.d.ts +57 -0
  47. package/dist/types/components/Navigation.d.ts +46 -0
  48. package/dist/types/components/NumberInput.d.ts +88 -0
  49. package/dist/types/components/OTPInput.d.ts +11 -0
  50. package/dist/types/components/Panel.d.ts +94 -0
  51. package/dist/types/components/Popover.d.ts +64 -0
  52. package/dist/types/components/Progress.d.ts +178 -0
  53. package/dist/types/components/Select.d.ts +53 -0
  54. package/dist/types/components/Slider.d.ts +203 -0
  55. package/dist/types/components/Spinner.d.ts +29 -0
  56. package/dist/types/components/Stat.d.ts +98 -0
  57. package/dist/types/components/StatusSelect.d.ts +23 -0
  58. package/dist/types/components/Surface.d.ts +110 -0
  59. package/dist/types/components/Table.d.ts +46 -0
  60. package/dist/types/components/Tabs.d.ts +84 -0
  61. package/dist/types/components/ThemeMenu.d.ts +4 -0
  62. package/dist/types/components/Toast.d.ts +46 -0
  63. package/dist/types/components/Toggle.d.ts +65 -0
  64. package/dist/types/components/Tree.d.ts +20 -0
  65. package/dist/types/components/calendar/CalendarMonth.d.ts +33 -0
  66. package/dist/types/components/calendar/CalendarTimeGrid.d.ts +75 -0
  67. package/dist/types/components/calendar/EventActions.d.ts +17 -0
  68. package/dist/types/components/calendar/format.d.ts +43 -0
  69. package/dist/types/components/calendar/index.d.ts +9 -0
  70. package/dist/types/components/calendar/palette.d.ts +17 -0
  71. package/dist/types/components/calendar/use-calendar-drag.d.ts +54 -0
  72. package/dist/types/components/calendar/use-event-keyboard.d.ts +24 -0
  73. package/dist/types/components/calendar/use-grid-navigation.d.ts +47 -0
  74. package/dist/types/components/calendar/use-now.d.ts +20 -0
  75. package/dist/types/components/chat/Attachment.d.ts +49 -0
  76. package/dist/types/components/chat/Chat.d.ts +60 -0
  77. package/dist/types/components/chat/Composer.d.ts +29 -0
  78. package/dist/types/components/chat/ContextMeter.d.ts +55 -0
  79. package/dist/types/components/chat/EffortControl.d.ts +23 -0
  80. package/dist/types/components/chat/Markdown.d.ts +22 -0
  81. package/dist/types/components/chat/Message.d.ts +59 -0
  82. package/dist/types/components/chat/MessageScroller.d.ts +13 -0
  83. package/dist/types/components/chat/ModelSelector.d.ts +44 -0
  84. package/dist/types/components/chat/types.d.ts +155 -0
  85. package/dist/types/components/code-editor/context.d.ts +32 -0
  86. package/dist/types/components/code-editor/editing.d.ts +39 -0
  87. package/dist/types/components/code-editor/highlight.d.ts +20 -0
  88. package/dist/types/components/code-editor/recipe.d.ts +109 -0
  89. package/dist/types/components/code-editor/state.d.ts +14 -0
  90. package/dist/types/components/drag-drop/context.d.ts +45 -0
  91. package/dist/types/components/drag-drop/recipe.d.ts +121 -0
  92. package/dist/types/components/drag-drop/shift.d.ts +66 -0
  93. package/dist/types/components/markdown/Affordances.d.ts +76 -0
  94. package/dist/types/components/rbac/AccountMenu.d.ts +8 -0
  95. package/dist/types/components/rbac/DevToolsPopover.d.ts +5 -0
  96. package/dist/types/components/rbac/ProfilePage.d.ts +1 -0
  97. package/dist/types/components/rbac/RBACProvider.d.ts +64 -0
  98. package/dist/types/components/rbac/RolePermissionMatrix.d.ts +6 -0
  99. package/dist/types/components/rbac/RolesPermissionsPage.d.ts +1 -0
  100. package/dist/types/components/rbac/index.d.ts +7 -0
  101. package/dist/types/components/rbac/types.d.ts +26 -0
  102. package/dist/types/components/roadmap/PhaseManager.d.ts +19 -0
  103. package/dist/types/components/roadmap/RoadmapItemCard.d.ts +45 -0
  104. package/dist/types/components/roadmap/RoadmapPage.d.ts +9 -0
  105. package/dist/types/components/roadmap/RoadmapSwimlaneBoard.d.ts +9 -0
  106. package/dist/types/components/roadmap/UseCaseCard.d.ts +14 -0
  107. package/dist/types/components/roadmap/UseCaseLedgerPage.d.ts +21 -0
  108. package/dist/types/components/roadmap/chip-tones.d.ts +2 -0
  109. package/dist/types/components/roadmap/derive.d.ts +12 -0
  110. package/dist/types/components/roadmap/index.d.ts +9 -0
  111. package/dist/types/components/roadmap/types.d.ts +54 -0
  112. package/dist/types/icons/data.d.ts +1318 -0
  113. package/dist/types/index.d.ts +97 -0
  114. package/dist/types/lib/calendar/band-packer.d.ts +53 -0
  115. package/dist/types/lib/calendar/drag.d.ts +125 -0
  116. package/dist/types/lib/calendar/index.d.ts +4 -0
  117. package/dist/types/lib/calendar/lane-packer.d.ts +88 -0
  118. package/dist/types/lib/calendar/segments.d.ts +91 -0
  119. package/dist/types/lib/calendar/types.d.ts +166 -0
  120. package/dist/types/lib/cn.d.ts +7 -0
  121. package/dist/types/lib/dnd/announce.d.ts +132 -0
  122. package/dist/types/lib/dnd/autoscroll.d.ts +88 -0
  123. package/dist/types/lib/dnd/geometry.d.ts +78 -0
  124. package/dist/types/lib/dnd/index.d.ts +16 -0
  125. package/dist/types/lib/dnd/sensors/gesture.d.ts +37 -0
  126. package/dist/types/lib/dnd/sensors/keyboard.d.ts +50 -0
  127. package/dist/types/lib/dnd/sensors/pointer.d.ts +59 -0
  128. package/dist/types/lib/dnd/session.d.ts +99 -0
  129. package/dist/types/lib/dnd/types.d.ts +162 -0
  130. package/dist/types/lib/dnd/use-drag.d.ts +56 -0
  131. package/dist/types/lib/icons.d.ts +40 -0
  132. package/dist/types/lib/markdown/caret-map.d.ts +48 -0
  133. package/dist/types/lib/markdown/caret.d.ts +6 -0
  134. package/dist/types/lib/markdown/commands.d.ts +170 -0
  135. package/dist/types/lib/markdown/convert.d.ts +82 -0
  136. package/dist/types/lib/markdown/dom.d.ts +67 -0
  137. package/dist/types/lib/markdown/edit.d.ts +16 -0
  138. package/dist/types/lib/markdown/history.d.ts +47 -0
  139. package/dist/types/lib/markdown/hotkeys.d.ts +39 -0
  140. package/dist/types/lib/markdown/input.d.ts +15 -0
  141. package/dist/types/lib/markdown/keys.d.ts +34 -0
  142. package/dist/types/lib/markdown/paste.d.ts +9 -0
  143. package/dist/types/lib/markdown/position.d.ts +43 -0
  144. package/dist/types/lib/markdown/project.d.ts +88 -0
  145. package/dist/types/lib/markdown/reconcile.d.ts +63 -0
  146. package/dist/types/lib/markdown/surface.d.ts +177 -0
  147. package/dist/types/lib/persist.d.ts +40 -0
  148. package/dist/types/lib/preferences.d.ts +80 -0
  149. package/dist/types/lib/sim/createSimStore.d.ts +18 -0
  150. package/dist/types/lib/sim/index.d.ts +5 -0
  151. package/dist/types/lib/sim/latency.d.ts +10 -0
  152. package/dist/types/lib/sim/registry.d.ts +14 -0
  153. package/dist/types/lib/sim/settings.d.ts +11 -0
  154. package/dist/types/lib/sim/types.d.ts +3 -0
  155. package/dist/types/lib/syntax/index.d.ts +16 -0
  156. package/dist/types/lib/syntax/languages/bash.d.ts +1 -0
  157. package/dist/types/lib/syntax/languages/css.d.ts +1 -0
  158. package/dist/types/lib/syntax/languages/html.d.ts +17 -0
  159. package/dist/types/lib/syntax/languages/index.d.ts +33 -0
  160. package/dist/types/lib/syntax/languages/javascript.d.ts +22 -0
  161. package/dist/types/lib/syntax/languages/json.d.ts +1 -0
  162. package/dist/types/lib/syntax/languages/mongodb.d.ts +1 -0
  163. package/dist/types/lib/syntax/languages/plain.d.ts +9 -0
  164. package/dist/types/lib/syntax/languages/sql.d.ts +4 -0
  165. package/dist/types/lib/syntax/languages/vue.d.ts +1 -0
  166. package/dist/types/lib/syntax/languages/yaml.d.ts +1 -0
  167. package/dist/types/lib/syntax/markdown/frames.d.ts +145 -0
  168. package/dist/types/lib/syntax/markdown/grammar.d.ts +1 -0
  169. package/dist/types/lib/syntax/markdown/index.d.ts +4 -0
  170. package/dist/types/lib/syntax/markdown/inline.d.ts +21 -0
  171. package/dist/types/lib/syntax/markdown/parse.d.ts +11 -0
  172. package/dist/types/lib/syntax/markdown/render.d.ts +19 -0
  173. package/dist/types/lib/syntax/markdown/spans.d.ts +84 -0
  174. package/dist/types/lib/syntax/markdown/types.d.ts +108 -0
  175. package/dist/types/lib/syntax/registry.d.ts +37 -0
  176. package/dist/types/lib/syntax/tokenize.d.ts +17 -0
  177. package/dist/types/lib/syntax/types.d.ts +119 -0
  178. package/dist/types/lib/time/index.d.ts +3 -0
  179. package/dist/types/lib/time/plain.d.ts +61 -0
  180. package/dist/types/lib/time/types.d.ts +87 -0
  181. package/dist/types/lib/time/zone.d.ts +97 -0
  182. package/dist/types/lib/use-media-query.d.ts +29 -0
  183. package/package.json +130 -0
@@ -0,0 +1,22 @@
1
+ export interface CodeBlockProps {
2
+ code: string;
3
+ language?: string;
4
+ filename?: string;
5
+ /** Still filling — suppresses the copy button, which would copy a fragment. */
6
+ streaming?: boolean;
7
+ className?: string;
8
+ }
9
+ export declare function CodeBlock({ code, language, filename, streaming, className }: CodeBlockProps): import("react").JSX.Element;
10
+ export interface MarkdownProps {
11
+ children: string;
12
+ className?: string;
13
+ }
14
+ /**
15
+ * Blocks are memoised individually.
16
+ *
17
+ * A response is re-parsed on every token, so without this the reconciler
18
+ * rebuilds every finished paragraph each time a word lands at the bottom —
19
+ * which is both wasteful and visible, because re-created DOM loses selection.
20
+ * Someone highlighting a sentence while the answer continues keeps it.
21
+ */
22
+ export declare const Markdown: import("react").NamedExoticComponent<MarkdownProps>;
@@ -0,0 +1,59 @@
1
+ import { type ReactNode, type Ref } from "react";
2
+ import { Icon } from "../Icon";
3
+ import type { ChatComponents, ChatFile, ChatMessage, MessagePart, PartRenderers, RenderContext, ToolPart } from "./types";
4
+ export interface ToolCallProps {
5
+ part: ToolPart;
6
+ defaultOpen?: boolean;
7
+ className?: string;
8
+ }
9
+ /**
10
+ * A tool invocation, collapsed to one line.
11
+ *
12
+ * COLLAPSED BY DEFAULT because the transcript is a conversation and not a log:
13
+ * twenty lines of output between two sentences buries both of them. The summary
14
+ * carries enough to decide whether opening it is worth doing, which is the only
15
+ * decision anyone makes about a tool call they did not have to authorise.
16
+ */
17
+ export declare function ToolCall({ part, defaultOpen, className }: ToolCallProps): import("react").JSX.Element;
18
+ export interface MessagePartViewProps<TApp = unknown> {
19
+ part: MessagePart;
20
+ context: RenderContext<TApp>;
21
+ renderers?: PartRenderers<TApp>;
22
+ components?: ChatComponents<TApp>;
23
+ onPreviewFile?: (file: ChatFile) => void;
24
+ onDownloadFile?: (file: ChatFile) => void;
25
+ }
26
+ export declare function MessagePartView<TApp>({ part, context, renderers, components, onPreviewFile, onDownloadFile, }: MessagePartViewProps<TApp>): import("react").JSX.Element;
27
+ export interface MessageAction {
28
+ id: string;
29
+ icon: Parameters<typeof Icon>[0]["name"];
30
+ label: string;
31
+ onClick: (message: ChatMessage) => void;
32
+ /** Latches on — a cast feedback vote, a saved message. */
33
+ active?: boolean;
34
+ }
35
+ export interface MessageProps<TApp = unknown> {
36
+ message: ChatMessage;
37
+ renderers?: PartRenderers<TApp>;
38
+ components?: ChatComponents<TApp>;
39
+ appContext?: TApp;
40
+ /** Row buttons under the body. Assistant turns only, unless `on` says otherwise. */
41
+ actions?: MessageAction[];
42
+ /** Hides the avatar and name — for consecutive turns from the same author. */
43
+ grouped?: boolean;
44
+ showAvatar?: boolean;
45
+ showTimestamp?: boolean;
46
+ onPreviewFile?: (file: ChatFile) => void;
47
+ onDownloadFile?: (file: ChatFile) => void;
48
+ className?: string;
49
+ ref?: Ref<HTMLElement>;
50
+ }
51
+ export declare function Message<TApp = unknown>({ message, renderers, components, appContext, actions, grouped, showAvatar, showTimestamp, onPreviewFile, onDownloadFile, className, ref, }: MessageProps<TApp>): import("react").JSX.Element;
52
+ export interface ChatMarkerProps {
53
+ children: ReactNode;
54
+ /** A date break or a labelled rule rather than a status note. */
55
+ variant?: "rule" | "note";
56
+ className?: string;
57
+ }
58
+ /** A date break, a "context compacted" note, a model change mid-thread. */
59
+ export declare function ChatMarker({ children, variant, className }: ChatMarkerProps): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { type ReactNode, type Ref } from "react";
2
+ export interface MessageScrollerProps {
3
+ children: ReactNode;
4
+ /** Distance from the bottom, in px, still counted as "at the bottom". */
5
+ threshold?: number;
6
+ /** Label for the return-to-newest button. */
7
+ jumpLabel?: string;
8
+ /** Fades content at the top edge so it reads as continuing past the frame. */
9
+ fade?: boolean;
10
+ className?: string;
11
+ ref?: Ref<HTMLDivElement>;
12
+ }
13
+ export declare function MessageScroller({ children, threshold, jumpLabel, fade, className, ref, }: MessageScrollerProps): import("react").JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { type ReactNode } from "react";
2
+ export interface ChatModel {
3
+ id: string;
4
+ name: string;
5
+ /** One line under the name — what this model is FOR. */
6
+ description?: string;
7
+ /** "New", "Fastest", a context size — anything that fits in a chip. */
8
+ badge?: ReactNode;
9
+ disabled?: boolean;
10
+ /**
11
+ * Keeps the model out of the main list until "More models" is opened.
12
+ *
13
+ * The primary list should be short enough to read at a glance; everything
14
+ * an experienced user occasionally reaches for lives one click deeper. A
15
+ * flat list of fifteen models makes the three that matter harder to find.
16
+ */
17
+ secondary?: boolean;
18
+ }
19
+ export interface ModelSelectorProps {
20
+ models: ChatModel[];
21
+ value: string;
22
+ onValueChange: (id: string) => void;
23
+ /** Extra switches under a separator — fast mode, thinking, whatever applies. */
24
+ options?: Array<{
25
+ id: string;
26
+ label: ReactNode;
27
+ description?: ReactNode;
28
+ checked: boolean;
29
+ onCheckedChange: (checked: boolean) => void;
30
+ disabled?: boolean;
31
+ }>;
32
+ /**
33
+ * Number keys pick from the primary list while the menu is open.
34
+ *
35
+ * Only while OPEN — a bare digit is a legitimate character everywhere else,
36
+ * and a chat's composer is the last place to steal one.
37
+ */
38
+ numericShortcuts?: boolean;
39
+ side?: "top" | "bottom";
40
+ align?: "start" | "center" | "end";
41
+ disabled?: boolean;
42
+ className?: string;
43
+ }
44
+ export declare function ModelSelector({ models, value, onValueChange, options, numericShortcuts, side, align, disabled, className, }: ModelSelectorProps): import("react").JSX.Element;
@@ -0,0 +1,155 @@
1
+ import type { ReactNode } from "react";
2
+ export type MessageRole = "user" | "assistant" | "system";
3
+ /** Prose. Rendered through the streaming-aware markdown renderer. */
4
+ export interface TextPart {
5
+ type: "text";
6
+ text: string;
7
+ }
8
+ export interface CodePart {
9
+ type: "code";
10
+ code: string;
11
+ language?: string;
12
+ filename?: string;
13
+ }
14
+ /**
15
+ * Model reasoning, shown collapsed.
16
+ *
17
+ * A separate type rather than styled text because it is a different KIND of
18
+ * content: usually hidden, summarised when collapsed, and never the answer.
19
+ */
20
+ export interface ReasoningPart {
21
+ type: "reasoning";
22
+ text: string;
23
+ /** Shown on the collapsed row — "Thought for 8s". */
24
+ label?: string;
25
+ streaming?: boolean;
26
+ }
27
+ export type ToolStatus = "running" | "success" | "error";
28
+ /**
29
+ * A tool invocation, collapsed to one line by default.
30
+ *
31
+ * Collapsed is the DEFAULT because the transcript is a conversation, not a
32
+ * log: fifteen lines of tool output between two sentences buries both. The
33
+ * summary carries enough to decide whether to open it.
34
+ */
35
+ export interface ToolPart {
36
+ type: "tool";
37
+ name: string;
38
+ /** One line: "Ran 3 commands, used a tool". */
39
+ summary: string;
40
+ status: ToolStatus;
41
+ detail?: ReactNode;
42
+ /** Diff counts, rendered as +N −N beside the summary. */
43
+ stats?: {
44
+ added?: number;
45
+ removed?: number;
46
+ };
47
+ }
48
+ export interface FilePart {
49
+ type: "file";
50
+ file: ChatFile;
51
+ }
52
+ /**
53
+ * An application component, addressed BY NAME.
54
+ *
55
+ * This is the whole reason the registry exists: a message can carry a live
56
+ * approval form, a chart, a card with working buttons — real UI wired to the
57
+ * host application, not a picture of it.
58
+ *
59
+ * The name is a string and the props are plain data, so a message stays
60
+ * serialisable. Putting a component reference in the part would make a
61
+ * transcript impossible to persist, replay, or send over a wire — and a chat
62
+ * you cannot reload is not a chat.
63
+ */
64
+ export interface ComponentPart {
65
+ type: "component";
66
+ /** Key into `ChatComponents`. */
67
+ component: string;
68
+ props?: Record<string, unknown>;
69
+ }
70
+ export type MessagePart = TextPart | CodePart | ReasoningPart | ToolPart | FilePart | ComponentPart;
71
+ export type MessagePartType = MessagePart["type"];
72
+ export interface ChatFile {
73
+ id: string;
74
+ name: string;
75
+ /** Bytes. Omitted while an upload is still in flight and the size is unknown. */
76
+ size?: number;
77
+ mimeType?: string;
78
+ /** Object URL or remote href. Absent means "not fetchable yet". */
79
+ url?: string;
80
+ /** Image thumbnail, when one exists. */
81
+ thumbnailUrl?: string;
82
+ status?: "uploading" | "ready" | "error";
83
+ /** 0–100, while uploading. */
84
+ progress?: number;
85
+ error?: string;
86
+ }
87
+ export interface ChatMessage {
88
+ id: string;
89
+ role: MessageRole;
90
+ parts: MessagePart[];
91
+ createdAt?: Date | string;
92
+ /** Files attached by the author, shown above the body. */
93
+ attachments?: ChatFile[];
94
+ /** True while this message is still arriving. */
95
+ streaming?: boolean;
96
+ /** Shown in place of the body — a failed turn is still part of the record. */
97
+ error?: string;
98
+ author?: {
99
+ name?: string;
100
+ avatarUrl?: string;
101
+ };
102
+ }
103
+ /**
104
+ * What a renderer is handed alongside its part.
105
+ *
106
+ * `app` is the answer to "how does a custom component reach application
107
+ * state". The registry is built ONCE, at module scope, with no closures over
108
+ * hooks or props — and every renderer receives the live application handle
109
+ * here, at call time. Closing over app state when building the registry would
110
+ * work exactly until someone defines it outside the component that owns the
111
+ * state, which is precisely where a registry is supposed to live.
112
+ */
113
+ export interface RenderContext<TApp = unknown> {
114
+ message: ChatMessage;
115
+ /** True while THIS message is still streaming — renderers use it to hold
116
+ back anything that would thrash, and to show live affordances. */
117
+ streaming: boolean;
118
+ /** Whatever the application passed to `<Chat appContext>`. */
119
+ app: TApp;
120
+ }
121
+ export type PartRenderer<P extends MessagePart = MessagePart, TApp = unknown> = (part: P, context: RenderContext<TApp>) => ReactNode;
122
+ /**
123
+ * Overrides for the built-in part renderers.
124
+ *
125
+ * Partial on purpose: an application replacing the code renderer should not
126
+ * have to re-implement the other five.
127
+ */
128
+ export type PartRenderers<TApp = unknown> = {
129
+ text?: PartRenderer<TextPart, TApp>;
130
+ code?: PartRenderer<CodePart, TApp>;
131
+ reasoning?: PartRenderer<ReasoningPart, TApp>;
132
+ tool?: PartRenderer<ToolPart, TApp>;
133
+ file?: PartRenderer<FilePart, TApp>;
134
+ };
135
+ export type ChatComponentRenderer<TApp = unknown> = (props: Record<string, unknown>, context: RenderContext<TApp>) => ReactNode;
136
+ /** Named application components a message may address. */
137
+ export type ChatComponents<TApp = unknown> = Record<string, ChatComponentRenderer<TApp>>;
138
+ /**
139
+ * An unrenderable part is shown, never swallowed.
140
+ *
141
+ * Two failure modes are possible and both are silent by default: a part whose
142
+ * `type` no renderer handles, and a `component` part naming something the
143
+ * registry does not contain. Dropping either produces a message that is
144
+ * missing content with nothing anywhere to say so — the same class of failure
145
+ * as the icon registry that optimised itself away and rendered nothing.
146
+ *
147
+ * Throwing is not the alternative. An uncaught throw in render unmounts the
148
+ * React tree, so one malformed message would blank the entire application.
149
+ * The part renders as a visible, labelled placeholder and logs once.
150
+ */
151
+ export interface UnknownPartInfo {
152
+ reason: "unknown-type" | "missing-component";
153
+ /** The `type`, or the component name that was not found. */
154
+ name: string;
155
+ }
@@ -0,0 +1,32 @@
1
+ /** How the content is presented. `split` is source and preview side by side. */
2
+ export type CodeEditorView = "source" | "rendered" | "split";
3
+ export interface CodeEditorContextValue {
4
+ /** The current text — the source of truth for copying and for the preview. */
5
+ value: string;
6
+ /** Language name as given, before registry resolution. Null when unset. */
7
+ language: string | null;
8
+ /** Caption for the toolbar, usually a filename. */
9
+ filename?: string;
10
+ /** True when there is no textarea and the surface is a viewer. */
11
+ readOnly: boolean;
12
+ /** Soft wrap on. */
13
+ wrap: boolean;
14
+ setWrap: (next: boolean) => void;
15
+ /** Current presentation. */
16
+ view: CodeEditorView;
17
+ setView: (next: CodeEditorView) => void;
18
+ /**
19
+ * The views THIS instance can offer. One entry means there is nothing to
20
+ * switch between, so the switch does not render — the configuration is the
21
+ * switch, not a `showViewSwitch` prop.
22
+ */
23
+ views: readonly CodeEditorView[];
24
+ /** Copies `value` to the clipboard. */
25
+ copy: () => void;
26
+ /** True for a moment after a successful copy. */
27
+ copied: boolean;
28
+ /** Lines in `value`, for the gutter and for the expand affordance's label. */
29
+ lineCount: number;
30
+ }
31
+ export declare const CodeEditorProvider: import("react").Provider<CodeEditorContextValue | null>;
32
+ export declare function useCodeEditor(component: string): CodeEditorContextValue;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Writes `text` over `[start, end)` and leaves the caret at `caret`.
3
+ *
4
+ * Returns true when the browser's history recorded it — false when this fell
5
+ * through to the direct-write path and undo will not reach past this edit.
6
+ */
7
+ export declare function applyEdit(el: HTMLTextAreaElement, start: number, end: number, text: string, caret?: readonly [number, number]): boolean;
8
+ /** Offset of the first character of the line containing `at`. */
9
+ export declare function lineStart(value: string, at: number): number;
10
+ /** Offset of the newline ending the line containing `at`, or the length. */
11
+ export declare function lineEnd(value: string, at: number): number;
12
+ /**
13
+ * Tab / Shift+Tab.
14
+ *
15
+ * A selection that spans a line break indents or dedents the whole BLOCK —
16
+ * including when the selection is only partial on its first and last lines,
17
+ * because a person who dragged across four lines meant those four lines.
18
+ */
19
+ export declare function indentSelection(el: HTMLTextAreaElement, indent: string, dedent: boolean): void;
20
+ /**
21
+ * Enter. Copies the current line's indentation, adds one unit after an opener,
22
+ * and pushes a closer that was sitting right after the caret onto its own line.
23
+ *
24
+ * That last case is the only "clever" one and it earns its place: typing `{`
25
+ * then Enter is how a block is opened, and without it the caret lands on the
26
+ * same line as the `}` every single time.
27
+ */
28
+ export declare function autoIndentNewline(el: HTMLTextAreaElement, indent: string): void;
29
+ /**
30
+ * Bracket and quote handling for one printable character. Returns true when it
31
+ * consumed the key, false to let the browser type it normally.
32
+ *
33
+ * DELIBERATELY SMALL. Auto-pairing that tries to be smart is the feature people
34
+ * turn off: the rules below never delete anything, never act inside a word, and
35
+ * never insert a partner the caret is not immediately in front of.
36
+ */
37
+ export declare function handleAutoPair(el: HTMLTextAreaElement, key: string): boolean;
38
+ /** Backspace between an auto-inserted pair removes both halves. */
39
+ export declare function handlePairBackspace(el: HTMLTextAreaElement): boolean;
@@ -0,0 +1,20 @@
1
+ import type { Token } from "../../lib/syntax";
2
+ /** Tokens for `source`, recomputed only when the text or the language moves. */
3
+ export declare function useTokens(source: string, language: string | null | undefined): Token[];
4
+ export declare const CodeEditorTokens: import("react").NamedExoticComponent<{
5
+ source: string;
6
+ tokens: Token[];
7
+ }>;
8
+ /**
9
+ * The line-number column.
10
+ *
11
+ * NOT RENDERED WHILE SOFT WRAP IS ON, and that is deliberate rather than
12
+ * unfinished. A wrapped line occupies several visual rows, so a fixed column of
13
+ * numbers drifts one row further out of true for every line that wraps — and a
14
+ * number printed beside the wrong line is worse than no number, because it is
15
+ * believed. `CodeEditor` decides; this component just draws.
16
+ */
17
+ export declare const CodeEditorGutterNumbers: import("react").NamedExoticComponent<{
18
+ count: number;
19
+ from: number;
20
+ }>;
@@ -0,0 +1,109 @@
1
+ export declare const code: import("tailwind-variants").TVReturnType<{
2
+ [key: string]: {
3
+ [key: string]: import("tailwind-variants").ClassValue | {
4
+ textarea?: import("tailwind-variants").ClassValue;
5
+ pre?: import("tailwind-variants").ClassValue;
6
+ caption?: import("tailwind-variants").ClassValue;
7
+ toolbar?: import("tailwind-variants").ClassValue;
8
+ body?: import("tailwind-variants").ClassValue;
9
+ footer?: import("tailwind-variants").ClassValue;
10
+ hint?: import("tailwind-variants").ClassValue;
11
+ root?: import("tailwind-variants").ClassValue;
12
+ control?: import("tailwind-variants").ClassValue;
13
+ rendered?: import("tailwind-variants").ClassValue;
14
+ layers?: import("tailwind-variants").ClassValue;
15
+ gutter?: import("tailwind-variants").ClassValue;
16
+ fade?: import("tailwind-variants").ClassValue;
17
+ scroller?: import("tailwind-variants").ClassValue;
18
+ expand?: import("tailwind-variants").ClassValue;
19
+ };
20
+ };
21
+ } | {
22
+ [x: string]: {
23
+ [x: string]: import("tailwind-variants").ClassValue | {
24
+ textarea?: import("tailwind-variants").ClassValue;
25
+ pre?: import("tailwind-variants").ClassValue;
26
+ caption?: import("tailwind-variants").ClassValue;
27
+ toolbar?: import("tailwind-variants").ClassValue;
28
+ body?: import("tailwind-variants").ClassValue;
29
+ footer?: import("tailwind-variants").ClassValue;
30
+ hint?: import("tailwind-variants").ClassValue;
31
+ root?: import("tailwind-variants").ClassValue;
32
+ control?: import("tailwind-variants").ClassValue;
33
+ rendered?: import("tailwind-variants").ClassValue;
34
+ layers?: import("tailwind-variants").ClassValue;
35
+ gutter?: import("tailwind-variants").ClassValue;
36
+ fade?: import("tailwind-variants").ClassValue;
37
+ scroller?: import("tailwind-variants").ClassValue;
38
+ expand?: import("tailwind-variants").ClassValue;
39
+ };
40
+ };
41
+ } | {}, {
42
+ root: string[];
43
+ toolbar: string;
44
+ caption: string;
45
+ control: string[];
46
+ body: string;
47
+ scroller: string[];
48
+ layers: string;
49
+ gutter: string;
50
+ pre: string;
51
+ textarea: string[];
52
+ rendered: string;
53
+ footer: string;
54
+ hint: string;
55
+ expand: string[];
56
+ fade: string;
57
+ }, undefined, {
58
+ [key: string]: {
59
+ [key: string]: import("tailwind-variants").ClassValue | {
60
+ textarea?: import("tailwind-variants").ClassValue;
61
+ pre?: import("tailwind-variants").ClassValue;
62
+ caption?: import("tailwind-variants").ClassValue;
63
+ toolbar?: import("tailwind-variants").ClassValue;
64
+ body?: import("tailwind-variants").ClassValue;
65
+ footer?: import("tailwind-variants").ClassValue;
66
+ hint?: import("tailwind-variants").ClassValue;
67
+ root?: import("tailwind-variants").ClassValue;
68
+ control?: import("tailwind-variants").ClassValue;
69
+ rendered?: import("tailwind-variants").ClassValue;
70
+ layers?: import("tailwind-variants").ClassValue;
71
+ gutter?: import("tailwind-variants").ClassValue;
72
+ fade?: import("tailwind-variants").ClassValue;
73
+ scroller?: import("tailwind-variants").ClassValue;
74
+ expand?: import("tailwind-variants").ClassValue;
75
+ };
76
+ };
77
+ } | {}, {
78
+ root: string[];
79
+ toolbar: string;
80
+ caption: string;
81
+ control: string[];
82
+ body: string;
83
+ scroller: string[];
84
+ layers: string;
85
+ gutter: string;
86
+ pre: string;
87
+ textarea: string[];
88
+ rendered: string;
89
+ footer: string;
90
+ hint: string;
91
+ expand: string[];
92
+ fade: string;
93
+ }, import("tailwind-variants").TVReturnTypeLike<unknown, {
94
+ root: string[];
95
+ toolbar: string;
96
+ caption: string;
97
+ control: string[];
98
+ body: string;
99
+ scroller: string[];
100
+ layers: string;
101
+ gutter: string;
102
+ pre: string;
103
+ textarea: string[];
104
+ rendered: string;
105
+ footer: string;
106
+ hint: string;
107
+ expand: string[];
108
+ fade: string;
109
+ }>>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * One value that may be driven from outside or kept here.
3
+ *
4
+ * WHY IT IS SHARED RATHER THAN WRITTEN FOUR TIMES: `CodeEditor` has four of
5
+ * these (text, wrap, view, expanded) and the subtle half is identical in all
6
+ * four — a controlled instance must NEVER write its own state, or it renders
7
+ * the consumer's value for one frame and its own for the next, which shows up
8
+ * as a control that flickers back after every change.
9
+ *
10
+ * `controlled === undefined` decides, once per render, exactly as React's own
11
+ * inputs do. Switching a prop from undefined to a value mid-life is a consumer
12
+ * bug everywhere in React and is not defended against here.
13
+ */
14
+ export declare function useControllable<T>(controlled: T | undefined, initial: T, onChange?: (next: T) => void): [T, (next: T) => void];
@@ -0,0 +1,45 @@
1
+ import type { DragAxis, DragId, ContainerId, DragSession } from "../../lib/dnd";
2
+ import type { ContainerShift } from "./shift";
3
+ export interface DragDropContextValue {
4
+ session: DragSession;
5
+ /**
6
+ * The id of THIS board's instructions paragraph, generated per board.
7
+ *
8
+ * Per board, not per page: the engine's `DRAG_INSTRUCTIONS_ID` is a module
9
+ * constant, so two boards on one page emit the same id twice and every
10
+ * handle's `aria-describedby` then resolves to whichever the browser saw
11
+ * first. A duplicate id is valid HTML that no check reads, and the symptom —
12
+ * one board's handles describing the other's — is invisible to everything
13
+ * except a screen reader.
14
+ */
15
+ instructionsId: string;
16
+ /**
17
+ * True while a `<DragDropOverlay>` is mounted, i.e. while something else is
18
+ * able to carry the card. It decides whether an item vacates its own slot.
19
+ */
20
+ lifted: boolean;
21
+ registerOverlay: () => () => void;
22
+ /** Items and containers publish their spoken names here at mount. */
23
+ registerLabel: (kind: "item" | "container", id: string, label: string | undefined) => () => void;
24
+ }
25
+ export interface DragDropContainerContextValue {
26
+ id: ContainerId;
27
+ axis: DragAxis;
28
+ /** Null when no drag is in flight — nothing moves and no gap is open. */
29
+ shift: ContainerShift | null;
30
+ }
31
+ export interface DragDropItemContextValue {
32
+ id: DragId;
33
+ /** The element the pointer and keyboard sensors attach to. */
34
+ setHandleRef: (el: HTMLElement | null) => void;
35
+ /** Spoken name, used to build the handle's accessible name. */
36
+ label: string | undefined;
37
+ }
38
+ export declare const DragDropProvider: import("react").Provider<DragDropContextValue | null>;
39
+ export declare const DragDropContainerProvider: import("react").Provider<DragDropContainerContextValue | null>;
40
+ export declare const DragDropItemProvider: import("react").Provider<DragDropItemContextValue | null>;
41
+ export declare const DragDropCloneProvider: import("react").Provider<boolean>;
42
+ export declare function useDragDropClone(): boolean;
43
+ export declare function useDragDrop(component: string): DragDropContextValue;
44
+ export declare function useDragDropContainer(component: string): DragDropContainerContextValue;
45
+ export declare function useDragDropItem(component: string): DragDropItemContextValue;
@@ -0,0 +1,121 @@
1
+ export declare const dnd: import("tailwind-variants").TVReturnType<{
2
+ axis: {
3
+ y: {
4
+ container: string;
5
+ item: string;
6
+ marker: string;
7
+ landing: string;
8
+ handle: string;
9
+ };
10
+ x: {
11
+ container: string;
12
+ item: string;
13
+ marker: string;
14
+ landing: string;
15
+ handle: string;
16
+ };
17
+ };
18
+ moving: {
19
+ true: {
20
+ shift: string[];
21
+ };
22
+ false: {};
23
+ };
24
+ mode: {
25
+ pointer: {
26
+ overlay: string;
27
+ };
28
+ keyboard: {
29
+ overlay: string[];
30
+ };
31
+ };
32
+ }, {
33
+ root: string;
34
+ container: string;
35
+ item: string;
36
+ shift: string;
37
+ marker: string[];
38
+ landing: string;
39
+ handle: string[];
40
+ overlay: string[];
41
+ }, undefined, {
42
+ axis: {
43
+ y: {
44
+ container: string;
45
+ item: string;
46
+ marker: string;
47
+ landing: string;
48
+ handle: string;
49
+ };
50
+ x: {
51
+ container: string;
52
+ item: string;
53
+ marker: string;
54
+ landing: string;
55
+ handle: string;
56
+ };
57
+ };
58
+ moving: {
59
+ true: {
60
+ shift: string[];
61
+ };
62
+ false: {};
63
+ };
64
+ mode: {
65
+ pointer: {
66
+ overlay: string;
67
+ };
68
+ keyboard: {
69
+ overlay: string[];
70
+ };
71
+ };
72
+ }, {
73
+ root: string;
74
+ container: string;
75
+ item: string;
76
+ shift: string;
77
+ marker: string[];
78
+ landing: string;
79
+ handle: string[];
80
+ overlay: string[];
81
+ }, import("tailwind-variants").TVReturnTypeLike<{
82
+ axis: {
83
+ y: {
84
+ container: string;
85
+ item: string;
86
+ marker: string;
87
+ landing: string;
88
+ handle: string;
89
+ };
90
+ x: {
91
+ container: string;
92
+ item: string;
93
+ marker: string;
94
+ landing: string;
95
+ handle: string;
96
+ };
97
+ };
98
+ moving: {
99
+ true: {
100
+ shift: string[];
101
+ };
102
+ false: {};
103
+ };
104
+ mode: {
105
+ pointer: {
106
+ overlay: string;
107
+ };
108
+ keyboard: {
109
+ overlay: string[];
110
+ };
111
+ };
112
+ }, {
113
+ root: string;
114
+ container: string;
115
+ item: string;
116
+ shift: string;
117
+ marker: string[];
118
+ landing: string;
119
+ handle: string[];
120
+ overlay: string[];
121
+ }>>;