@farero-ai/ui 0.0.0-stage → 0.4.1
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.
- package/LICENSE +21 -0
- package/README.md +150 -2
- package/dist/activity/orrery.d.ts +6 -0
- package/dist/activity/orrery.js +1 -0
- package/dist/activity.css +2 -0
- package/dist/activity.d.ts +10 -0
- package/dist/activity.js +1 -0
- package/dist/chunks/ActivityGlyph-tlf4hwl8.d.ts +44 -0
- package/dist/chunks/DataTable-GR4HPUOJ.js +1 -0
- package/dist/chunks/IsolatedPreview-HJ6B36KF.js +1 -0
- package/dist/chunks/MathEquation-7ZVYQFEK.js +1 -0
- package/dist/chunks/chunk-3I4YBQX6.js +1 -0
- package/dist/chunks/chunk-5SBKMKFB.js +1 -0
- package/dist/chunks/chunk-756GM57N.js +1 -0
- package/dist/chunks/chunk-CMWS5PI4.js +2 -0
- package/dist/chunks/chunk-CXEEHWHD.js +3 -0
- package/dist/chunks/chunk-E7KN7CHM.js +5 -0
- package/dist/chunks/chunk-FW2QVWXL.js +1 -0
- package/dist/chunks/chunk-HGN4GN2E.js +1 -0
- package/dist/chunks/chunk-ITKN2ASJ.js +1 -0
- package/dist/chunks/chunk-LHMFMBHY.js +2 -0
- package/dist/chunks/chunk-LNOXROHT.js +1 -0
- package/dist/chunks/chunk-ONVWTQLU.js +1 -0
- package/dist/chunks/chunk-RR7BB4EQ.js +2 -0
- package/dist/chunks/chunk-RWFARXSG.js +1 -0
- package/dist/chunks/chunk-S3DX6DGB.js +1 -0
- package/dist/chunks/chunk-T3JXEXIJ.js +1 -0
- package/dist/chunks/chunk-UNO25KYE.js +1 -0
- package/dist/chunks/chunk-WMKRKKIS.js +1 -0
- package/dist/chunks/chunk-WQZ3EUKA.js +1 -0
- package/dist/chunks/chunk-YPRVAH5G.js +1 -0
- package/dist/chunks/chunk-Z3Z6LSG4.js +2 -0
- package/dist/chunks/chunk-ZVJQ5X63.js +2 -0
- package/dist/chunks/d2-S4ICDZEQ.js +1 -0
- package/dist/chunks/download-K6ZKYCHG.js +1 -0
- package/dist/chunks/mermaid-CQ4QMBLA.js +7 -0
- package/dist/chunks/readonly-components-1cDZu8D0.d.ts +26 -0
- package/dist/cn.d.ts +5 -0
- package/dist/cn.js +1 -0
- package/dist/code.d.ts +44 -0
- package/dist/code.js +1 -0
- package/dist/commands.d.ts +159 -0
- package/dist/commands.js +1 -0
- package/dist/controls.d.ts +233 -0
- package/dist/controls.js +1 -0
- package/dist/diagram.d.ts +83 -0
- package/dist/diagram.js +1 -0
- package/dist/fence.d.ts +41 -0
- package/dist/fence.js +1 -0
- package/dist/icons.d.ts +18 -0
- package/dist/icons.js +1 -0
- package/dist/markdown.d.ts +133 -0
- package/dist/markdown.js +1 -0
- package/dist/styles.css +2 -0
- package/dist/table.d.ts +41 -0
- package/dist/table.js +1 -0
- package/dist/theme.d.ts +4 -0
- package/dist/theme.js +1 -0
- package/dist/transcript.d.ts +849 -0
- package/dist/transcript.js +17 -0
- package/package.json +91 -4
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { FC, ReactNode, ComponentProps, ComponentType, MouseEvent } from 'react';
|
|
3
|
+
import { LucideIcon } from 'lucide-react';
|
|
4
|
+
|
|
5
|
+
type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
|
|
6
|
+
type ButtonSize = 'sm' | 'md';
|
|
7
|
+
interface ButtonOwnProps {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
variant?: ButtonVariant;
|
|
11
|
+
size?: ButtonSize;
|
|
12
|
+
}
|
|
13
|
+
type ButtonLinkProps = ButtonOwnProps & Omit<ComponentProps<'a'>, keyof ButtonOwnProps | 'href'> & {
|
|
14
|
+
href: string;
|
|
15
|
+
disabled?: never;
|
|
16
|
+
};
|
|
17
|
+
type ButtonActionProps = ButtonOwnProps & Omit<ComponentProps<'button'>, keyof ButtonOwnProps | 'type'> & {
|
|
18
|
+
type?: ComponentProps<'button'>['type'];
|
|
19
|
+
};
|
|
20
|
+
type ButtonProps = ButtonLinkProps | ButtonActionProps;
|
|
21
|
+
/** A shared button that renders as a link when `href` is supplied. */
|
|
22
|
+
declare const Button: FC<ButtonProps>;
|
|
23
|
+
|
|
24
|
+
interface CopyButtonProps extends Omit<ComponentProps<'button'>, 'children' | 'onClick'> {
|
|
25
|
+
text: string;
|
|
26
|
+
label: string;
|
|
27
|
+
size?: number;
|
|
28
|
+
showLabel?: boolean;
|
|
29
|
+
onCopyError?: (error: unknown) => void;
|
|
30
|
+
}
|
|
31
|
+
declare const CopyButton: FC<CopyButtonProps>;
|
|
32
|
+
interface ZoomControlsProps {
|
|
33
|
+
scale: number;
|
|
34
|
+
onZoom: (factor: number) => void;
|
|
35
|
+
onFit: () => void;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
}
|
|
38
|
+
declare const ZoomControls: FC<ZoomControlsProps>;
|
|
39
|
+
/** Round icon toggle in the sticky header row. Badges position against its `relative` box. */
|
|
40
|
+
interface HeaderIconButtonProps extends ComponentProps<'button'> {
|
|
41
|
+
open?: boolean;
|
|
42
|
+
}
|
|
43
|
+
declare const HeaderIconButton: FC<HeaderIconButtonProps>;
|
|
44
|
+
|
|
45
|
+
declare function copyText(text: string): Promise<void>;
|
|
46
|
+
/** Promise-backed HTML keeps Clipboard.write inside the original tap on Safari/iOS. */
|
|
47
|
+
declare function copyFormatted(text: string, html: string | Promise<string>): Promise<'formatted' | 'text'>;
|
|
48
|
+
/** Strip UI and active surfaces while retaining ordinary rendered document structure. */
|
|
49
|
+
declare function formattedFragment(fragment: DocumentFragment): string;
|
|
50
|
+
|
|
51
|
+
interface ExpandableTextProps {
|
|
52
|
+
children: string;
|
|
53
|
+
/** The text's typography. The toggle keeps its own. */
|
|
54
|
+
className?: string;
|
|
55
|
+
}
|
|
56
|
+
/** Text cut to three lines. Show more appears only when the cut hides some of the text. */
|
|
57
|
+
declare const ExpandableText: FC<ExpandableTextProps>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Selectable error text with an explicit X to dismiss. The whole box is never
|
|
61
|
+
* a button: a click-to-dismiss box swallows the press that starts a text
|
|
62
|
+
* selection, so error details (ports, paths, relay messages) cannot be copied.
|
|
63
|
+
*/
|
|
64
|
+
interface DismissibleErrorProps extends Omit<ComponentProps<'div'>, 'children'> {
|
|
65
|
+
error: ReactNode;
|
|
66
|
+
onDismiss: () => void;
|
|
67
|
+
dismissLabel?: string;
|
|
68
|
+
children?: ReactNode;
|
|
69
|
+
}
|
|
70
|
+
declare const DismissibleError: FC<DismissibleErrorProps>;
|
|
71
|
+
interface DismissButtonProps extends Omit<ComponentProps<'button'>, 'children'> {
|
|
72
|
+
label: string;
|
|
73
|
+
}
|
|
74
|
+
/** Danger-tone X that closes an error, inline or in a pane banner. */
|
|
75
|
+
declare const DismissButton: FC<DismissButtonProps>;
|
|
76
|
+
interface CopyErrorToastProps {
|
|
77
|
+
error: string | null;
|
|
78
|
+
onDismiss: () => void;
|
|
79
|
+
}
|
|
80
|
+
/** Keep a failed clipboard action visible after its context menu closes. */
|
|
81
|
+
declare const CopyErrorToast: FC<CopyErrorToastProps>;
|
|
82
|
+
interface SpinnerProps extends Omit<ComponentProps<'div'>, 'children'> {
|
|
83
|
+
label?: string;
|
|
84
|
+
}
|
|
85
|
+
declare const Spinner: FC<SpinnerProps>;
|
|
86
|
+
|
|
87
|
+
type EyebrowElement = 'span' | 'div' | 'p' | 'h2' | 'h3';
|
|
88
|
+
type EyebrowProps<T extends EyebrowElement = 'span'> = ComponentProps<T> & {
|
|
89
|
+
as?: T;
|
|
90
|
+
tone?: 'muted' | 'danger';
|
|
91
|
+
};
|
|
92
|
+
/** Small structural headings; descriptive chips never borrow this uppercase treatment. */
|
|
93
|
+
declare function Eyebrow<T extends EyebrowElement = 'span'>({ as, tone, className, ...props }: EyebrowProps<T>): react.DetailedReactHTMLElement<Omit<EyebrowProps<T>, "className" | "as" | "tone"> & {
|
|
94
|
+
className: string;
|
|
95
|
+
}, HTMLSpanElement>;
|
|
96
|
+
type SearchHitProps = ComponentProps<'mark'>;
|
|
97
|
+
/** What a search matched: words in a chat excerpt, or a submenu row a palette query named. */
|
|
98
|
+
declare const SearchHit: FC<SearchHitProps>;
|
|
99
|
+
interface KeyboardHintProps extends ComponentProps<'kbd'> {
|
|
100
|
+
/** `quiet` drops the key cap: a muted letter in a menu row's shortcut column. */
|
|
101
|
+
tone?: 'cap' | 'quiet';
|
|
102
|
+
}
|
|
103
|
+
declare const KeyboardHint: FC<KeyboardHintProps>;
|
|
104
|
+
|
|
105
|
+
interface LongPressButtonProps extends Omit<ComponentProps<'button'>, 'onTouchStart' | 'onTouchMove' | 'onTouchEnd' | 'onTouchCancel'> {
|
|
106
|
+
/**
|
|
107
|
+
* Runs when a touch holds still on the button: the stand-in for ⌘/Ctrl-click where
|
|
108
|
+
* there is no keyboard. Without it, or while the button is disabled, a hold does nothing.
|
|
109
|
+
*/
|
|
110
|
+
onLongPress?: () => void;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* A button with an optional touch long press. When the hold fires, the button gives a
|
|
114
|
+
* haptic tick, runs `onLongPress` and swallows the click that comes on lift. Android
|
|
115
|
+
* reports its own long press as a context menu while the finger is still down. That
|
|
116
|
+
* event fires the press early, so one hold never opens a menu as well.
|
|
117
|
+
*/
|
|
118
|
+
declare const LongPressButton: FC<LongPressButtonProps>;
|
|
119
|
+
|
|
120
|
+
interface MenuItem {
|
|
121
|
+
label: string;
|
|
122
|
+
onSelect: () => void;
|
|
123
|
+
}
|
|
124
|
+
/** A menu that opens at a point, for a trigger that takes focus back when it closes. */
|
|
125
|
+
interface MenuProps {
|
|
126
|
+
label: string;
|
|
127
|
+
x: number;
|
|
128
|
+
y: number;
|
|
129
|
+
trigger: HTMLElement;
|
|
130
|
+
items: readonly MenuItem[];
|
|
131
|
+
onClose: () => void;
|
|
132
|
+
}
|
|
133
|
+
/** The package's own menu: a viewport-bound list of actions, closed by a choice, Escape or a press outside. */
|
|
134
|
+
declare const PopoverMenu: FC<MenuProps>;
|
|
135
|
+
/** The menu the package's controls open. An app supplies its own, such as one drawn by a native menu layer. */
|
|
136
|
+
declare const MenuContext: react.Context<ComponentType<MenuProps>>;
|
|
137
|
+
|
|
138
|
+
interface ReferenceChipClassOptions {
|
|
139
|
+
/** A button or link: it brightens on hover and shows focus and press. */
|
|
140
|
+
action?: boolean;
|
|
141
|
+
className?: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A file or chat that a message carries. Attachments and chat references share this one pill,
|
|
145
|
+
* so they read as equals; the caller's element decides what a tap does.
|
|
146
|
+
*/
|
|
147
|
+
declare function referenceChipClass({ action, className }?: ReferenceChipClassOptions): string;
|
|
148
|
+
interface ReferenceChipLabelProps {
|
|
149
|
+
icon: LucideIcon;
|
|
150
|
+
/** The whole name, for a label that truncates. */
|
|
151
|
+
title?: string;
|
|
152
|
+
children: ReactNode;
|
|
153
|
+
}
|
|
154
|
+
/** The glyph and the truncating name inside a reference chip. */
|
|
155
|
+
declare const ReferenceChipLabel: FC<ReferenceChipLabelProps>;
|
|
156
|
+
|
|
157
|
+
/** Shared segmented single-select control, with optional touch long-press. */
|
|
158
|
+
declare function Segments<const T extends string>({ value, options, onChange, onLongPress, disabled, wrap, touchReach }: {
|
|
159
|
+
value: T;
|
|
160
|
+
/**
|
|
161
|
+
* `icon` renders before the label; give it its own accessible name when it carries meaning.
|
|
162
|
+
* `marked` shows a second selection the group also holds, such as another mode's pick, with a fainter fill.
|
|
163
|
+
*/
|
|
164
|
+
options: {
|
|
165
|
+
id: T;
|
|
166
|
+
label: string;
|
|
167
|
+
icon?: ReactNode;
|
|
168
|
+
marked?: boolean;
|
|
169
|
+
disabled?: boolean;
|
|
170
|
+
}[];
|
|
171
|
+
onChange: (value: T, event: MouseEvent<HTMLButtonElement>) => void;
|
|
172
|
+
/** Touch long-press target, the stand-in for a ⌘/Ctrl-click where there is no keyboard. */
|
|
173
|
+
onLongPress?: (value: T) => void;
|
|
174
|
+
/** Disables the whole group; prefer per-option `disabled` for partial states. */
|
|
175
|
+
disabled?: boolean;
|
|
176
|
+
/** Let long option lists flow onto more lines instead of overflowing the card. */
|
|
177
|
+
wrap?: boolean;
|
|
178
|
+
/** Reach 44 px on a phone or touch screen through a ghost layer. The paint keeps its size. */
|
|
179
|
+
touchReach?: boolean;
|
|
180
|
+
}): react.JSX.Element;
|
|
181
|
+
|
|
182
|
+
interface TooltipProps {
|
|
183
|
+
label: string;
|
|
184
|
+
/** A second, muted line, such as why the control is unavailable. */
|
|
185
|
+
detail?: string;
|
|
186
|
+
/** `top` keeps the label off a native page view drawn below the control. */
|
|
187
|
+
side?: 'top' | 'bottom';
|
|
188
|
+
/** Classes for the wrapper around the control. */
|
|
189
|
+
className?: string;
|
|
190
|
+
children: ReactNode;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* A label that the app draws on hover and keyboard focus. The desktop window does not
|
|
194
|
+
* reliably show native `title` tooltips, and a native page view covers anything drawn
|
|
195
|
+
* under it. The label is visual only: the control keeps its own accessible name.
|
|
196
|
+
*/
|
|
197
|
+
declare const Tooltip: FC<TooltipProps>;
|
|
198
|
+
|
|
199
|
+
interface ViewerActionProps {
|
|
200
|
+
label: string;
|
|
201
|
+
/** The tooltip, where it is shorter than the accessible name. */
|
|
202
|
+
title?: string;
|
|
203
|
+
onClick: () => void;
|
|
204
|
+
/** The icon, at 16px. */
|
|
205
|
+
children: ReactNode;
|
|
206
|
+
}
|
|
207
|
+
/** An icon action in a viewer's header row. */
|
|
208
|
+
declare const ViewerAction: FC<ViewerActionProps>;
|
|
209
|
+
/** Shared chrome for source previews and the in-chat diff viewer. */
|
|
210
|
+
interface ViewerHeaderProps {
|
|
211
|
+
/** Null where a pane head already says what the row would. */
|
|
212
|
+
title: ReactNode;
|
|
213
|
+
subtitle?: ReactNode;
|
|
214
|
+
actions?: ReactNode;
|
|
215
|
+
/** Absent where something else closes the viewer, such as a pane head. */
|
|
216
|
+
onClose?: () => void;
|
|
217
|
+
closeLabel: string;
|
|
218
|
+
/** One row under a pane head that already names the file. */
|
|
219
|
+
compact?: boolean;
|
|
220
|
+
}
|
|
221
|
+
declare const ViewerHeader: FC<ViewerHeaderProps>;
|
|
222
|
+
|
|
223
|
+
/** Shared word-wrap switch; each viewer owns its wrapping preference. */
|
|
224
|
+
interface WordWrapToggleProps {
|
|
225
|
+
pressed: boolean;
|
|
226
|
+
onToggle: () => void;
|
|
227
|
+
className?: string;
|
|
228
|
+
size?: number;
|
|
229
|
+
}
|
|
230
|
+
declare const WordWrapToggle: FC<WordWrapToggleProps>;
|
|
231
|
+
|
|
232
|
+
export { Button, CopyButton, CopyErrorToast, DismissButton, DismissibleError, ExpandableText, Eyebrow, HeaderIconButton, KeyboardHint, LongPressButton, MenuContext, PopoverMenu, ReferenceChipLabel, SearchHit, Segments, Spinner, Tooltip, ViewerAction, ViewerHeader, WordWrapToggle, ZoomControls, copyFormatted, copyText, formattedFragment, referenceChipClass };
|
|
233
|
+
export type { ButtonProps, ButtonSize, ButtonVariant, CopyButtonProps, CopyErrorToastProps, DismissButtonProps, DismissibleErrorProps, ExpandableTextProps, EyebrowProps, HeaderIconButtonProps, KeyboardHintProps, LongPressButtonProps, MenuItem, MenuProps, ReferenceChipClassOptions, ReferenceChipLabelProps, SearchHitProps, SpinnerProps, TooltipProps, ViewerActionProps, ViewerHeaderProps, WordWrapToggleProps, ZoomControlsProps };
|
package/dist/controls.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as V,b as D}from"./chunks/chunk-ONVWTQLU.js";import{a as b,b as I}from"./chunks/chunk-ITKN2ASJ.js";import{a as x,b as f,c as P}from"./chunks/chunk-S3DX6DGB.js";import{a as M,b as R}from"./chunks/chunk-T3JXEXIJ.js";import{a as H,b as w,c as S,d as v,f as W,g as N}from"./chunks/chunk-RR7BB4EQ.js";import{a as z}from"./chunks/chunk-WQZ3EUKA.js";import{a as L,b as F}from"./chunks/chunk-FW2QVWXL.js";import{a as C,b as E,c as g,d as T,e as B,f as h}from"./chunks/chunk-HGN4GN2E.js";import{a}from"./chunks/chunk-5SBKMKFB.js";import{a as o}from"./chunks/chunk-3I4YBQX6.js";import{useId as A,useLayoutEffect as K,useRef as O,useState as l}from"react";import{jsx as c,jsxs as k}from"react/jsx-runtime";var Z=o(({children:r,className:m})=>{let p=O(null),s=A(),[e,u]=l(!1),[y,d]=l(!1);return K(()=>{let t=p.current;if(!t||e)return;let n=o(()=>d(t.scrollHeight>t.clientHeight),"measure"),i=new ResizeObserver(n);return i.observe(t),n(),()=>i.disconnect()},[r,e]),k("div",{children:[c("p",{ref:p,id:s,className:a(m,!e&&"line-clamp-3"),children:r}),y||e?c("button",{type:"button","aria-expanded":e,"aria-controls":s,onClick:()=>u(t=>!t),className:"mt-0.5 rounded-sm text-accent text-xs underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-accent",children:e?"Show less":"Show more"}):null]})},"ExpandableText");export{b as Button,T as CopyButton,S as CopyErrorToast,w as DismissButton,H as DismissibleError,Z as ExpandableText,x as Eyebrow,h as HeaderIconButton,P as KeyboardHint,L as LongPressButton,R as MenuContext,M as PopoverMenu,D as ReferenceChipLabel,f as SearchHit,F as Segments,v as Spinner,I as Tooltip,W as ViewerAction,N as ViewerHeader,z as WordWrapToggle,B as ZoomControls,E as copyFormatted,C as copyText,g as formattedFragment,V as referenceChipClass};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
|
|
4
|
+
interface DiagramTheme {
|
|
5
|
+
dark: boolean;
|
|
6
|
+
background: string;
|
|
7
|
+
surface: string;
|
|
8
|
+
surface2: string;
|
|
9
|
+
border: string;
|
|
10
|
+
borderSoft: string;
|
|
11
|
+
text: string;
|
|
12
|
+
muted: string;
|
|
13
|
+
fontFamily: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* SVG renderers need resolved hex colors rather than CSS light-dark() tokens. The sample sits
|
|
17
|
+
* inside `host`, so it reads the tokens and color scheme the diagram itself is drawn with.
|
|
18
|
+
*/
|
|
19
|
+
declare function readDiagramTheme(host: Element): DiagramTheme;
|
|
20
|
+
|
|
21
|
+
type DiagramLanguage = 'mermaid' | 'd2';
|
|
22
|
+
type DiagramLayout = 'auto' | 'tala' | 'elk' | 'dagre';
|
|
23
|
+
declare function diagramLanguage(classes: unknown): DiagramLanguage | undefined;
|
|
24
|
+
declare function diagramLayouts(language: DiagramLanguage): readonly [{
|
|
25
|
+
readonly id: "tala";
|
|
26
|
+
readonly label: "TALA";
|
|
27
|
+
}, {
|
|
28
|
+
readonly id: "elk";
|
|
29
|
+
readonly label: "ELK";
|
|
30
|
+
}, {
|
|
31
|
+
readonly id: "dagre";
|
|
32
|
+
readonly label: "Dagre";
|
|
33
|
+
}] | readonly [{
|
|
34
|
+
readonly id: "auto";
|
|
35
|
+
readonly label: "Auto";
|
|
36
|
+
}, {
|
|
37
|
+
readonly id: "elk";
|
|
38
|
+
readonly label: "ELK";
|
|
39
|
+
}, {
|
|
40
|
+
readonly id: "dagre";
|
|
41
|
+
readonly label: "Dagre";
|
|
42
|
+
}];
|
|
43
|
+
declare function defaultDiagramLayout(language: DiagramLanguage): DiagramLayout;
|
|
44
|
+
/** Load each language's engine only when its diagram is ready to render. */
|
|
45
|
+
declare function renderDiagram(source: string, theme: DiagramTheme, language: DiagramLanguage, layout: DiagramLayout, signal: AbortSignal, onProgress?: (label: string) => void): Promise<{
|
|
46
|
+
svg: string;
|
|
47
|
+
diagramType: string;
|
|
48
|
+
notice?: string;
|
|
49
|
+
}>;
|
|
50
|
+
|
|
51
|
+
interface DiagramProps {
|
|
52
|
+
source: string;
|
|
53
|
+
language: DiagramLanguage;
|
|
54
|
+
}
|
|
55
|
+
declare const Diagram: FC<DiagramProps>;
|
|
56
|
+
|
|
57
|
+
interface DiagramSize {
|
|
58
|
+
width: number;
|
|
59
|
+
height: number;
|
|
60
|
+
}
|
|
61
|
+
interface DiagramPoint {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
}
|
|
65
|
+
interface DiagramTransform extends DiagramPoint {
|
|
66
|
+
scale: number;
|
|
67
|
+
}
|
|
68
|
+
declare function fitDiagram(image: DiagramSize, viewport: DiagramSize): DiagramTransform;
|
|
69
|
+
/** Keep both edges reachable, and center an image smaller than the viewport. */
|
|
70
|
+
declare function containDiagram(view: DiagramTransform, image: DiagramSize, viewport: DiagramSize): DiagramTransform;
|
|
71
|
+
/** Keep the diagram coordinate underneath the pointer stationary during zoom. */
|
|
72
|
+
declare function zoomDiagramAt(view: DiagramTransform, scale: number, point: DiagramPoint): DiagramTransform;
|
|
73
|
+
|
|
74
|
+
/** Local pan/zoom: never resize the app or let a gesture reach the transcript beneath it. */
|
|
75
|
+
declare function useDiagramViewport(image: DiagramSize): {
|
|
76
|
+
canvas: react.RefObject<HTMLElement | null>;
|
|
77
|
+
view: DiagramTransform;
|
|
78
|
+
fit: () => void;
|
|
79
|
+
zoom: (factor: number) => void;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export { Diagram, containDiagram, defaultDiagramLayout, diagramLanguage, diagramLayouts, fitDiagram, readDiagramTheme, renderDiagram, useDiagramViewport, zoomDiagramAt };
|
|
83
|
+
export type { DiagramLanguage, DiagramLayout, DiagramPoint, DiagramSize, DiagramTheme, DiagramTransform };
|
package/dist/diagram.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b as r,c as m,d as e,e as i,f as g,g as t,h as o,i as D,j as p}from"./chunks/chunk-WMKRKKIS.js";import"./chunks/chunk-YPRVAH5G.js";import"./chunks/chunk-T3JXEXIJ.js";import"./chunks/chunk-RR7BB4EQ.js";import"./chunks/chunk-FW2QVWXL.js";import"./chunks/chunk-HGN4GN2E.js";import"./chunks/chunk-5SBKMKFB.js";import"./chunks/chunk-3I4YBQX6.js";export{p as Diagram,g as containDiagram,m as defaultDiagramLayout,a as diagramLanguage,r as diagramLayouts,i as fitDiagram,D as readDiagramTheme,e as renderDiagram,o as useDiagramViewport,t as zoomDiagramAt};
|
package/dist/fence.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { FC, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/** The text color of one line of a unified diff. */
|
|
5
|
+
declare function diffLineClass(line: string): string;
|
|
6
|
+
|
|
7
|
+
interface IsolatedPreviewProps {
|
|
8
|
+
/** A complete HTML document or SVG image. */
|
|
9
|
+
source: string;
|
|
10
|
+
kind: 'html' | 'svg';
|
|
11
|
+
/** Sizes the HTML frame. */
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Draws untrusted HTML in a sandboxed frame with no scripts or network, and SVG as a passive image. */
|
|
15
|
+
declare function IsolatedPreview({ source, kind, className }: IsolatedPreviewProps): react.JSX.Element;
|
|
16
|
+
|
|
17
|
+
/** What a fenced block can draw besides its source. */
|
|
18
|
+
type FenceKind = 'html' | 'svg' | 'diff' | 'source';
|
|
19
|
+
/**
|
|
20
|
+
* Picks the view for a fence from its language tag. HTML and SVG need the whole
|
|
21
|
+
* document, so they count only when the source opens and closes its root element.
|
|
22
|
+
*/
|
|
23
|
+
declare function fenceKind(info: string, source: string): FenceKind;
|
|
24
|
+
|
|
25
|
+
interface RichFenceProps {
|
|
26
|
+
source: string;
|
|
27
|
+
/** The highlighting grammar, or the fence's own tag where no grammar matches. */
|
|
28
|
+
language: string | null;
|
|
29
|
+
kind: FenceKind;
|
|
30
|
+
/** False while a streaming reply still writes this fence. Highlighting and previews wait for it. */
|
|
31
|
+
complete: boolean;
|
|
32
|
+
/** More buttons for the block's toolbar. They go before Download. */
|
|
33
|
+
actions?: ReactNode;
|
|
34
|
+
/** Draws the Diff view of a `diff` fence. Without it, the fence draws a plain colored diff. */
|
|
35
|
+
renderDiff?: (patch: string) => ReactNode;
|
|
36
|
+
}
|
|
37
|
+
/** A fenced code block with its toolbar. Complete HTML, SVG and diff fences also get a Preview or Diff view. */
|
|
38
|
+
declare const RichFence: FC<RichFenceProps>;
|
|
39
|
+
|
|
40
|
+
export { IsolatedPreview, RichFence, diffLineClass, fenceKind };
|
|
41
|
+
export type { FenceKind, IsolatedPreviewProps, RichFenceProps };
|
package/dist/fence.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"./chunks/chunk-LNOXROHT.js";import{a as e,b as r,c as t}from"./chunks/chunk-Z3Z6LSG4.js";import"./chunks/chunk-ZVJQ5X63.js";import"./chunks/chunk-CMWS5PI4.js";import"./chunks/chunk-CXEEHWHD.js";import"./chunks/chunk-WQZ3EUKA.js";import"./chunks/chunk-FW2QVWXL.js";import"./chunks/chunk-HGN4GN2E.js";import"./chunks/chunk-5SBKMKFB.js";import"./chunks/chunk-3I4YBQX6.js";export{o as IsolatedPreview,t as RichFence,e as diffLineClass,r as fenceKind};
|
package/dist/icons.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { LucideProps } from 'lucide-react';
|
|
3
|
+
|
|
4
|
+
interface RadiantBeaconProps extends LucideProps {
|
|
5
|
+
beams?: boolean;
|
|
6
|
+
beamsClassName?: string;
|
|
7
|
+
/** Lights the lantern room and the beams. They paint in their own text color, so give them one through `lightClassName`. */
|
|
8
|
+
lit?: boolean;
|
|
9
|
+
lightClassName?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The beam layer stays mounted so it can fade independently of the tower.
|
|
13
|
+
* The light paints before the roof and balcony, which cover its edges.
|
|
14
|
+
*/
|
|
15
|
+
declare const RadiantBeacon: react.ForwardRefExoticComponent<Omit<RadiantBeaconProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
16
|
+
|
|
17
|
+
export { RadiantBeacon };
|
|
18
|
+
export type { RadiantBeaconProps };
|
package/dist/icons.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunks/chunk-3I4YBQX6.js";import{Icon as c}from"lucide-react";import{forwardRef as m}from"react";import{jsx as a,jsxs as t}from"react/jsx-runtime";var o=m(({beams:r=!0,beamsClassName:n,lit:e=!1,lightClassName:d,children:i,...p},s)=>t(c,{ref:s,iconNode:[],"aria-hidden":"true",...p,children:[t("g",{"data-part":"light",className:e?d:void 0,stroke:e?"currentColor":void 0,children:[e?a("rect",{x:"8",y:"6",width:"8",height:"6",fill:"currentColor"}):a("path",{d:"M8 6v6m4-6v6m4-6v6"}),t("g",{"data-part":"beams",className:n,opacity:r?1:0,children:[a("path",{d:"M2 8h2m16 0h2"}),a("path",{d:"M2 13l2-1m16 0 2 1"})]})]}),a("path",{d:"M7 6l5-4 5 4Z"}),a("path",{d:"M6 12h12"}),a("path",{d:"m8 12-2 9h12l-2-9"}),a("path",{d:"M12 16v2"}),i]}));o.displayName="RadiantBeacon";export{o as RadiantBeacon};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { FC, ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { ExtraProps, Components } from 'react-markdown';
|
|
3
|
+
import { Element } from 'hast';
|
|
4
|
+
export { R as ReadonlyComponentsOptions, a as ReadonlyImageSource, b as ReadonlyMarkdownComponents, c as createReadonlyComponents } from './chunks/readonly-components-1cDZu8D0.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The composer puts each attachment and chat reference on its own line before the text. Those
|
|
8
|
+
* lines gather above it: image thumbnails, then one wrapping row of chips. A reference that
|
|
9
|
+
* shares its line with text stays in the sentence.
|
|
10
|
+
*/
|
|
11
|
+
declare const ChatParagraph: FC<ComponentProps<'p'> & ExtraProps>;
|
|
12
|
+
|
|
13
|
+
interface FootnoteReferenceProps extends ComponentProps<'a'> {
|
|
14
|
+
}
|
|
15
|
+
declare const FootnoteReference: FC<FootnoteReferenceProps>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Whether an absolute reference names an on-disk file rather than a
|
|
19
|
+
* same-origin web URL.
|
|
20
|
+
*
|
|
21
|
+
* The linker used to treat every dotted `/…` path as a filesystem path, so a
|
|
22
|
+
* A public URL such as `/voice/lantern-room-dark.webp` opened the relay
|
|
23
|
+
* file preview, which resolves it against the OS root (`/`) and refuses it as
|
|
24
|
+
* outside the workspaces. The PWA serves that namespace from `public/`
|
|
25
|
+
* instead (`public/voice/*.webp` on disk), so it must stay in the
|
|
26
|
+
* browser. Only home-rooted absolutes (where worktrees and plans live), drive
|
|
27
|
+
* paths and the current worktree itself are file references; the relay still
|
|
28
|
+
* authorizes the result before reading a byte.
|
|
29
|
+
*/
|
|
30
|
+
declare function isAbsoluteFilePath(candidate: string, worktree?: string | null): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* A `file://` destination names the same on-disk file an absolute path does.
|
|
33
|
+
* Agents write `file:///Users/…` links constantly — pasted artwork paths,
|
|
34
|
+
* staged attachments — and the browser refuses `file://` subresources and
|
|
35
|
+
* navigations from the PWA origin, so without this every one of those images
|
|
36
|
+
* renders broken and every link goes nowhere. Only local files qualify: a
|
|
37
|
+
* `file://host/…` URL naming another machine resolves to nothing.
|
|
38
|
+
*/
|
|
39
|
+
declare function fileUrlToLocalPath(href: string): string | null;
|
|
40
|
+
|
|
41
|
+
/** The fence's source text, walked out of the hast node react-markdown parsed. */
|
|
42
|
+
declare function fenceSource(node: Element): string;
|
|
43
|
+
declare function attachmentPath(href: string | undefined): string | null;
|
|
44
|
+
/** A chat reference from `chatHandoffHref`: this app's route to the source chat. */
|
|
45
|
+
declare function isChatHandoffHref(href: string | undefined): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Agent file links are absolute paths, unlike the PWA's own `/w/:id` routes.
|
|
48
|
+
*
|
|
49
|
+
* Anything absolute links — the relay decides at open time whether it may be read,
|
|
50
|
+
* answering binaries with a notice and refusing the rest with an error. Two shapes
|
|
51
|
+
* stay in the browser: raster images, which have their own viewer, and dotless
|
|
52
|
+
* basenames such as `/w/a-workspace` or `/usr/bin/env`, which are PWA routes and
|
|
53
|
+
* tool paths rather than files an agent meant to show.
|
|
54
|
+
*/
|
|
55
|
+
declare function sourceReference(href: string | undefined): string | null;
|
|
56
|
+
/**
|
|
57
|
+
* A tool can name several source files in its one detail field (Codex's Edit
|
|
58
|
+
* item does this). They are separate destinations, not one newline-containing
|
|
59
|
+
* href. Only split a detail when every non-empty line independently names a
|
|
60
|
+
* source, so multiline commands and ordinary tool input remain one value.
|
|
61
|
+
*/
|
|
62
|
+
declare function sourceReferences(detail: string | undefined): readonly string[] | null;
|
|
63
|
+
/**
|
|
64
|
+
* What a tap on a chat link does — the one decision `ChatLink`'s click and
|
|
65
|
+
* aux-click handlers share, kept pure so it pins in a unit test without a DOM.
|
|
66
|
+
*
|
|
67
|
+
* `reference` is the in-app file/image target, if the href resolved to one.
|
|
68
|
+
* `external` is whether the href is an http(s) URL; `externalPreview` is the
|
|
69
|
+
* reader's "open external links in preview" setting.
|
|
70
|
+
*
|
|
71
|
+
* A file reference is an in-app preview, never a navigation — even with
|
|
72
|
+
* ⌘/Ctrl/shift held or a middle-click, following the href hands the PWA
|
|
73
|
+
* router an on-disk path (`/Users/…`) and lands on the home screen. External
|
|
74
|
+
* links keep their browser default, so ⌘-click still opens a new window.
|
|
75
|
+
*/
|
|
76
|
+
type ChatLinkAction = 'preview' | 'external-preview' | 'browser';
|
|
77
|
+
declare function chatLinkAction({ reference, external, externalPreview, button, metaKey, ctrlKey, shiftKey, altKey, defaultPrevented }: {
|
|
78
|
+
reference: string | null;
|
|
79
|
+
external: boolean;
|
|
80
|
+
externalPreview: boolean;
|
|
81
|
+
button: number;
|
|
82
|
+
metaKey: boolean;
|
|
83
|
+
ctrlKey: boolean;
|
|
84
|
+
shiftKey: boolean;
|
|
85
|
+
altKey: boolean;
|
|
86
|
+
defaultPrevented: boolean;
|
|
87
|
+
}): ChatLinkAction;
|
|
88
|
+
/**
|
|
89
|
+
* The icon for a link's site, or null when the link's host has to stay on this
|
|
90
|
+
* machine. Only the hostname leaves: the path, query and any credentials in the
|
|
91
|
+
* URL go nowhere. The result reaches an inline style, so `DNS_NAME` runs first.
|
|
92
|
+
*/
|
|
93
|
+
declare function linkFaviconUrl(href: string): string | null;
|
|
94
|
+
/**
|
|
95
|
+
* Plain text inside a chat link ("Open the experiment"), kept as the preview
|
|
96
|
+
* title when the link is dragged onto the pins. Markup inside the link is
|
|
97
|
+
* skipped; a link without text falls back to its URL.
|
|
98
|
+
*/
|
|
99
|
+
declare function linkText(children: ReactNode): string | null;
|
|
100
|
+
|
|
101
|
+
interface MarkdownBodyProps {
|
|
102
|
+
children: string;
|
|
103
|
+
/** Live chat passes its interactive map; the read-only demo passes its static map. */
|
|
104
|
+
components: Components;
|
|
105
|
+
foldHeadings?: boolean;
|
|
106
|
+
hideTranscriptAttachments?: boolean;
|
|
107
|
+
onContextMenu?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The shared chat-markdown pipeline: GFM for autolinks, footnotes, tables,
|
|
111
|
+
* strikethrough and task lists; math only between `$$` pairs, so two prices
|
|
112
|
+
* in one paragraph stay plain text; breaks so single newlines behave like
|
|
113
|
+
* chat line breaks. Raw HTML is not rendered (react-markdown escapes it by
|
|
114
|
+
* default), so transcript content can't inject markup.
|
|
115
|
+
*
|
|
116
|
+
* Interactivity lives in `components`, not here: the live transcript passes
|
|
117
|
+
* its sheet-opening links and file mentions, while a host-independent reader
|
|
118
|
+
* passes static anchors.
|
|
119
|
+
*/
|
|
120
|
+
declare const MarkdownBody: FC<MarkdownBodyProps>;
|
|
121
|
+
|
|
122
|
+
/** Plain text from labels that may contain inline markup. */
|
|
123
|
+
declare function reactText(node: ReactNode): string;
|
|
124
|
+
|
|
125
|
+
declare const ATTACHMENT_HOST = "farero-attachment.invalid";
|
|
126
|
+
declare function attachmentHref(path: string): string;
|
|
127
|
+
/** Shared by renderer and outline worker: offsets always refer to this exact string. */
|
|
128
|
+
declare function markdownSource(text: string, hideTranscriptAttachments?: boolean): string;
|
|
129
|
+
|
|
130
|
+
declare function isMarkdownFile(filePath: string): boolean;
|
|
131
|
+
|
|
132
|
+
export { ATTACHMENT_HOST, ChatParagraph, FootnoteReference, MarkdownBody, attachmentHref, attachmentPath, chatLinkAction, fenceSource, fileUrlToLocalPath, isAbsoluteFilePath, isChatHandoffHref, isMarkdownFile, linkFaviconUrl, linkText, markdownSource, reactText, sourceReference, sourceReferences };
|
|
133
|
+
export type { ChatLinkAction, MarkdownBodyProps };
|
package/dist/markdown.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o,b as r,c as t,d as n,e as a,f as c,g as p,h as f,i as m,j as i,k as l,l as d,m as s,n as h,o as x,p as y,q as k,r as C,s as R}from"./chunks/chunk-E7KN7CHM.js";import"./chunks/chunk-756GM57N.js";import"./chunks/chunk-LHMFMBHY.js";import"./chunks/chunk-ONVWTQLU.js";import"./chunks/chunk-ITKN2ASJ.js";import"./chunks/chunk-WMKRKKIS.js";import"./chunks/chunk-YPRVAH5G.js";import"./chunks/chunk-T3JXEXIJ.js";import{e}from"./chunks/chunk-RR7BB4EQ.js";import"./chunks/chunk-Z3Z6LSG4.js";import"./chunks/chunk-ZVJQ5X63.js";import"./chunks/chunk-CMWS5PI4.js";import"./chunks/chunk-CXEEHWHD.js";import"./chunks/chunk-WQZ3EUKA.js";import"./chunks/chunk-FW2QVWXL.js";import"./chunks/chunk-HGN4GN2E.js";import"./chunks/chunk-5SBKMKFB.js";import"./chunks/chunk-3I4YBQX6.js";export{t as ATTACHMENT_HOST,x as ChatParagraph,y as FootnoteReference,k as MarkdownBody,R as ReadonlyMarkdownComponents,n as attachmentHref,f as attachmentPath,d as chatLinkAction,C as createReadonlyComponents,p as fenceSource,r as fileUrlToLocalPath,o as isAbsoluteFilePath,m as isChatHandoffHref,c as isMarkdownFile,s as linkFaviconUrl,h as linkText,a as markdownSource,e as reactText,i as sourceReference,l as sourceReferences};
|