@dsrcjs/ai-widget 0.0.0-stage → 1.0.5
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 +64 -0
- package/README.md +296 -2
- package/dist/ai-dana-chat.js +76 -0
- package/dist/avatar/model.d.ts +12 -0
- package/dist/drag.d.ts +44 -0
- package/dist/echarts-B6eiFnZN.js +18 -0
- package/dist/i18n.d.ts +287 -0
- package/dist/index-D2Riqtpn.js +19 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.js +1 -0
- package/dist/markdown-impl-Cu_bBFxI.js +34 -0
- package/dist/stream-entry-CNdFWIwY.js +8 -0
- package/dist/theme.d.ts +82 -0
- package/package.json +36 -4
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI-Dana: one drawn character whose picture follows what the chat is doing.
|
|
3
|
+
*/
|
|
4
|
+
export type Mood = 'calm' | 'listen' | 'think' | 'typing' | 'eureka' | 'sorry';
|
|
5
|
+
/** The design's five states; `listen` has no picture of its own and shows the resting one. */
|
|
6
|
+
export type DanaFrame = 'idle' | 'typing' | 'thinking' | 'success' | 'fail';
|
|
7
|
+
export type DanaOverlay = 'bubble' | 'spark' | 'drop';
|
|
8
|
+
export declare const FRAME_OF: Record<Mood, DanaFrame>;
|
|
9
|
+
/** Drawn on top of the frame, on the same canvas: the thought bubble, the success spark, the drop of sweat. */
|
|
10
|
+
export declare const OVERLAY_OF: Partial<Record<Mood, DanaOverlay>>;
|
|
11
|
+
/** Mood for a chat answer by its state; the pause before the first token is «thinking», the stream is «typing». */
|
|
12
|
+
export declare const moodOfAnswer: (status: string, hasText: boolean) => Mood;
|
package/dist/drag.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Launcher geometry, kept pure for tests. The position is an offset from the anchored corner: `x` from the left or
|
|
3
|
+
* right edge (by `position`), `y` from the bottom, so a saved position survives viewport resizes sensibly.
|
|
4
|
+
*/
|
|
5
|
+
export type Corner = 'bottom-right' | 'bottom-left';
|
|
6
|
+
export interface Offset {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}
|
|
10
|
+
export interface Size {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const LAUNCHER_SIZE = 60;
|
|
15
|
+
export declare const DRAG_THRESHOLD = 6;
|
|
16
|
+
export declare const EDGE_MARGIN = 8;
|
|
17
|
+
export declare const DEFAULT_OFFSET: Offset;
|
|
18
|
+
export declare const WINDOW_SIZE: Size;
|
|
19
|
+
/** Below this width the launcher does not drag and the window is fullscreen. */
|
|
20
|
+
export declare const MOBILE_MAX_WIDTH = 639;
|
|
21
|
+
export declare const STORAGE_KEY = "aid_pos";
|
|
22
|
+
/** A pointer that moved less than the threshold is a click, not a drag. */
|
|
23
|
+
export declare const exceedsThreshold: (dx: number, dy: number, threshold?: number) => boolean;
|
|
24
|
+
/** Keeps the whole box (the launcher by default, or the window) on screen with a margin. */
|
|
25
|
+
export declare const clampOffset: (offset: Offset, viewport: Size, size?: number | Size, margin?: number) => Offset;
|
|
26
|
+
/** Pointer moved by (dx, dy) in screen coordinates → new offset; the x axis flips for the right corner. */
|
|
27
|
+
export declare const moveOffset: (start: Offset, dx: number, dy: number, corner: Corner) => Offset;
|
|
28
|
+
export declare const readOffset: (storage: Pick<Storage, "getItem"> | null) => Offset | null;
|
|
29
|
+
export declare const writeOffset: (storage: Pick<Storage, "setItem"> | null, offset: Offset) => void;
|
|
30
|
+
export interface WindowPlacement {
|
|
31
|
+
/** Same corner semantics as the launcher offset. */
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
}
|
|
37
|
+
/** The window may shrink to this height to stay clear of the launcher. */
|
|
38
|
+
export declare const MIN_WINDOW_HEIGHT = 420;
|
|
39
|
+
/**
|
|
40
|
+
* The window opens above the launcher, on its side, shrinking down to MIN_WINDOW_HEIGHT to fit. A launcher dragged
|
|
41
|
+
* high up gets the window below it instead. Only when neither fits does the window slide over the launcher and
|
|
42
|
+
* shrink to the viewport.
|
|
43
|
+
*/
|
|
44
|
+
export declare const placeWindow: (launcher: Offset, viewport: Size, size?: Size, margin?: number) => WindowPlacement;
|