@orangecatai/element 0.0.2 → 0.0.4
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/dist/dev/index.js +67 -4
- package/dist/dev/index.js.map +2 -2
- package/dist/prod/index.js +9 -9
- package/dist/types/common/src/constants.d.ts +4 -0
- package/dist/types/common/src/keys.d.ts +2 -0
- package/dist/types/element/src/Scene.d.ts +1 -1
- package/dist/types/element/src/frame.d.ts +5 -5
- package/dist/types/element/src/newElement.d.ts +10 -1
- package/dist/types/element/src/typeChecks.d.ts +2 -1
- package/dist/types/element/src/types.d.ts +17 -2
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +177 -0
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +7 -7
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionFrame.d.ts +219 -0
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +48 -7
- package/dist/types/excalidraw/actions/actionLink.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionMenu.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionStyles.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
- package/dist/types/excalidraw/actions/index.d.ts +1 -1
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/components/AIChatPanel.d.ts +176 -0
- package/dist/types/excalidraw/components/Actions.d.ts +3 -0
- package/dist/types/excalidraw/components/App.d.ts +10 -0
- package/dist/types/excalidraw/components/CanvasBackgroundSwatch.d.ts +7 -0
- package/dist/types/excalidraw/components/ColorPicker/AdvancedColorPicker.d.ts +8 -0
- package/dist/types/excalidraw/components/ColorPicker/colorConversions.d.ts +27 -0
- package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
- package/dist/types/excalidraw/components/DefaultSidebar.d.ts +1 -1
- package/dist/types/excalidraw/components/ElementCanvasButtons.d.ts +1 -1
- package/dist/types/excalidraw/components/FrameToolbar.d.ts +1 -1
- package/dist/types/excalidraw/components/HintViewer.d.ts +1 -1
- package/dist/types/excalidraw/components/ImageEditToolbar.d.ts +15 -0
- package/dist/types/excalidraw/components/ImageGeneratorPanel.d.ts +59 -13
- package/dist/types/excalidraw/components/ImageQuickEditPanel.d.ts +10 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/index.d.ts +1 -1
- package/dist/types/excalidraw/components/StockImagePanel.d.ts +49 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +1 -0
- package/dist/types/excalidraw/components/ToolButton.d.ts +1 -1
- package/dist/types/excalidraw/components/VideoElement.d.ts +9 -0
- package/dist/types/excalidraw/components/VideoGeneratorPanel.d.ts +149 -0
- package/dist/types/excalidraw/components/ai-chat/AdGenShimmerLayer.d.ts +10 -0
- package/dist/types/excalidraw/components/ai-chat/adGenShimmerStore.d.ts +12 -0
- package/dist/types/excalidraw/components/ai-chat/agentLoop.d.ts +114 -0
- package/dist/types/excalidraw/components/ai-chat/audioUtils.d.ts +5 -0
- package/dist/types/excalidraw/components/ai-chat/canvasTools.d.ts +752 -0
- package/dist/types/excalidraw/components/ai-chat/htmlToExcalidraw.d.ts +53 -0
- package/dist/types/excalidraw/components/ai-chat/openRouterStream.d.ts +50 -0
- package/dist/types/excalidraw/components/ai-chat/reviewerAgent.d.ts +74 -0
- package/dist/types/excalidraw/components/auto-resize/AutoResizePanel.d.ts +17 -0
- package/dist/types/excalidraw/components/auto-resize/AutoResizePanelHost.d.ts +4 -0
- package/dist/types/excalidraw/components/auto-resize/AutoResizeShimmerLayer.d.ts +11 -0
- package/dist/types/excalidraw/components/auto-resize/autoResizeEngine.d.ts +185 -0
- package/dist/types/excalidraw/components/auto-resize/autoResizePanelStore.d.ts +15 -0
- package/dist/types/excalidraw/components/auto-resize/autoResizeStore.d.ts +16 -0
- package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +1 -1
- package/dist/types/excalidraw/components/icons.d.ts +3 -0
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +5 -1
- package/dist/types/excalidraw/components/template-builder/TemplateBuilderPanelHost.d.ts +4 -0
- package/dist/types/excalidraw/components/template-builder/TemplateBuilderTray.d.ts +4 -0
- package/dist/types/excalidraw/components/template-builder/slotTypes.d.ts +43 -0
- package/dist/types/excalidraw/components/template-builder/templateBuilderStore.d.ts +19 -0
- package/dist/types/excalidraw/components/ui/avatar.d.ts +6 -0
- package/dist/types/excalidraw/components/ui/button.d.ts +11 -0
- package/dist/types/excalidraw/components/ui/chat-container.d.ts +17 -0
- package/dist/types/excalidraw/components/ui/code-block.d.ts +16 -0
- package/dist/types/excalidraw/components/ui/markdown.d.ts +10 -0
- package/dist/types/excalidraw/components/ui/message.d.ts +35 -0
- package/dist/types/excalidraw/components/ui/scroll-button.d.ts +10 -0
- package/dist/types/excalidraw/data/blob.d.ts +4 -1
- package/dist/types/excalidraw/fonts/Fonts.d.ts +17 -0
- package/dist/types/excalidraw/index.d.ts +13 -1
- package/dist/types/excalidraw/scene/types.d.ts +1 -0
- package/dist/types/excalidraw/types.d.ts +286 -4
- package/dist/types/excalidraw/utils/brandContextUtils.d.ts +23 -0
- package/dist/types/excalidraw/utils/imageApi.d.ts +19 -0
- package/dist/types/excalidraw/utils/videoApi.d.ts +30 -0
- package/dist/types/utils/src/shape.d.ts +2 -2
- package/package.json +2 -2
- package/dist/types/excalidraw/utils/geminiApiKey.d.ts +0 -1
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type ToolAction } from "./ai-chat/agentLoop";
|
|
3
|
+
import "./AIChatPanel.scss";
|
|
4
|
+
import type { ReviewerFeedback } from "./ai-chat/reviewerAgent";
|
|
5
|
+
import type { ExcalidrawImperativeAPI } from "../types";
|
|
6
|
+
export type ChatMessage = {
|
|
7
|
+
id: string;
|
|
8
|
+
role: "user" | "assistant";
|
|
9
|
+
content: string;
|
|
10
|
+
timestamp: Date;
|
|
11
|
+
toolActions?: ToolAction[];
|
|
12
|
+
attachments?: Array<{
|
|
13
|
+
name: string;
|
|
14
|
+
type: "image" | "text" | "pdf" | "docx";
|
|
15
|
+
dataUrl?: string;
|
|
16
|
+
textContent?: string;
|
|
17
|
+
s3Key?: string;
|
|
18
|
+
}>;
|
|
19
|
+
/** Reviewer feedback attached to an assistant message after HTML ad generation */
|
|
20
|
+
reviewFeedback?: ReviewerFeedback;
|
|
21
|
+
};
|
|
22
|
+
export type ChatSession = {
|
|
23
|
+
id: string;
|
|
24
|
+
title: string;
|
|
25
|
+
messages: ChatMessage[];
|
|
26
|
+
};
|
|
27
|
+
export type AIChatPanelRef = {
|
|
28
|
+
setMessages: (messages: ChatMessage[], sessionId?: string) => void;
|
|
29
|
+
send: (text: string) => void;
|
|
30
|
+
};
|
|
31
|
+
export type AIChatPanelProps = {
|
|
32
|
+
isOpen: boolean;
|
|
33
|
+
onClose: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Host proxy URL for the chat / agent loop / reviewer OpenRouter calls. The
|
|
36
|
+
* SDK POSTs the OpenRouter request body here; the host injects the API key,
|
|
37
|
+
* gates credits, and streams the response back. Keeps the provider key out of
|
|
38
|
+
* the browser.
|
|
39
|
+
*/
|
|
40
|
+
chatUrl?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Host proxy URL for the agent's generate_image tool. Same contract as
|
|
43
|
+
* `chatUrl`. Keeps the provider key out of the browser.
|
|
44
|
+
*/
|
|
45
|
+
imageGenUrl?: string;
|
|
46
|
+
excalidrawAPI?: ExcalidrawImperativeAPI;
|
|
47
|
+
initialMessages?: ChatMessage[];
|
|
48
|
+
initialSessionId?: string;
|
|
49
|
+
initialSessions?: ChatSession[];
|
|
50
|
+
onMessagesChange?: (messages: ChatMessage[], sessionId: string) => void;
|
|
51
|
+
onSessionCreate?: (session: {
|
|
52
|
+
id: string;
|
|
53
|
+
title: string;
|
|
54
|
+
}) => void;
|
|
55
|
+
onSessionSwitch?: (sessionId: string) => void;
|
|
56
|
+
onBeforeFileUpload?: (files: Array<{
|
|
57
|
+
name: string;
|
|
58
|
+
type: "image" | "pdf" | "text" | "docx";
|
|
59
|
+
mimeType: string;
|
|
60
|
+
dataUrl?: string;
|
|
61
|
+
textContent?: string;
|
|
62
|
+
}>, sessionId: string) => Promise<Array<{
|
|
63
|
+
s3Key: string;
|
|
64
|
+
} | null>>;
|
|
65
|
+
onBeforeSend?: (ctx: {
|
|
66
|
+
hasVoice: boolean;
|
|
67
|
+
}) => Promise<{
|
|
68
|
+
allowed: boolean;
|
|
69
|
+
error?: string;
|
|
70
|
+
}>;
|
|
71
|
+
onAfterSend?: (ctx: {
|
|
72
|
+
hasVoice: boolean;
|
|
73
|
+
}) => void;
|
|
74
|
+
onBeforeImageGen?: () => Promise<{
|
|
75
|
+
allowed: boolean;
|
|
76
|
+
error?: string;
|
|
77
|
+
}>;
|
|
78
|
+
onAfterImageGen?: () => void;
|
|
79
|
+
/**
|
|
80
|
+
* OpenRouter model tag for the chat system (both plain chat and agent loop).
|
|
81
|
+
* @default "minimax/minimax-m3"
|
|
82
|
+
* @example "openai/gpt-4o" or "anthropic/claude-sonnet-4"
|
|
83
|
+
*/
|
|
84
|
+
chatModel?: string;
|
|
85
|
+
/**
|
|
86
|
+
* OpenRouter model tag for voice/speech-to-text transcription.
|
|
87
|
+
* @default "mistralai/voxtral-mini-transcribe"
|
|
88
|
+
*/
|
|
89
|
+
voiceModel?: string;
|
|
90
|
+
/**
|
|
91
|
+
* URL to POST `{ audio: string; format: string }` for server-side transcription.
|
|
92
|
+
* When provided, the SDK routes mic audio through this endpoint instead of
|
|
93
|
+
* calling OpenRouter directly, so the API key never needs to be in the browser.
|
|
94
|
+
* The endpoint must return `{ text: string }`.
|
|
95
|
+
*/
|
|
96
|
+
transcribeUrl?: string;
|
|
97
|
+
/**
|
|
98
|
+
* OpenRouter model ID used by the agent's generate_image tool.
|
|
99
|
+
* @default "google/gemini-3.1-flash-image-preview"
|
|
100
|
+
* @example "google/gemini-2.5-flash-image"
|
|
101
|
+
*/
|
|
102
|
+
agentImageModel?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Optional brand identity context. When provided, the AI agent receives
|
|
105
|
+
* the brand's colors, typography, tone of voice, and imagery direction as
|
|
106
|
+
* a system-level context message so it can create on-brand ads.
|
|
107
|
+
*
|
|
108
|
+
* Pair this with `customFonts` on `<Excalidraw>` so that any uploaded
|
|
109
|
+
* brand font files are also registered in the canvas.
|
|
110
|
+
*/
|
|
111
|
+
brandContext?: import("../types").BrandContext;
|
|
112
|
+
onSearchBrandAssets?: (query: string, type?: string) => Promise<Array<{
|
|
113
|
+
id: string;
|
|
114
|
+
name: string;
|
|
115
|
+
tags: string[];
|
|
116
|
+
assetType: string;
|
|
117
|
+
blobUrl: string;
|
|
118
|
+
previewDataUrl?: string;
|
|
119
|
+
}>>;
|
|
120
|
+
onSearchAdCreatives?: (query: string) => Promise<Array<{
|
|
121
|
+
id: string;
|
|
122
|
+
name: string;
|
|
123
|
+
tags: string[];
|
|
124
|
+
mimeType: string;
|
|
125
|
+
blobUrl: string;
|
|
126
|
+
previewDataUrl?: string;
|
|
127
|
+
}>>;
|
|
128
|
+
onListBrandTemplates?: (keywords?: string[]) => Promise<Array<{
|
|
129
|
+
id: string;
|
|
130
|
+
name: string;
|
|
131
|
+
campaignTag?: string;
|
|
132
|
+
label?: string;
|
|
133
|
+
width?: number;
|
|
134
|
+
height?: number;
|
|
135
|
+
thumbnailBlobUrl?: string;
|
|
136
|
+
thumbnailDataUrl?: string;
|
|
137
|
+
}>>;
|
|
138
|
+
onGetTemplateVariant?: (variantId: string) => Promise<{
|
|
139
|
+
canvasJson: string;
|
|
140
|
+
}>;
|
|
141
|
+
/**
|
|
142
|
+
* Searches brand assets, ad creatives, and templates by keywords, returning
|
|
143
|
+
* top 3 matches with base64 preview images. Used by the visual agent's
|
|
144
|
+
* `find_brand_asset` tool and the @mention autocomplete.
|
|
145
|
+
*/
|
|
146
|
+
onFindBrandAssets?: (type: "image-asset" | "ad-creative" | "template", keywords: string[]) => Promise<{
|
|
147
|
+
results: Array<{
|
|
148
|
+
id: string;
|
|
149
|
+
name: string;
|
|
150
|
+
tags?: string[];
|
|
151
|
+
width?: number | null;
|
|
152
|
+
height?: number | null;
|
|
153
|
+
previewDataUrl: string;
|
|
154
|
+
}>;
|
|
155
|
+
}>;
|
|
156
|
+
/**
|
|
157
|
+
* Called when user types after `@` in the chat input. Should return a
|
|
158
|
+
* lightweight list of matching items (no base64 — previews fetched on pick).
|
|
159
|
+
*/
|
|
160
|
+
onMentionSearch?: (query: string) => Promise<Array<{
|
|
161
|
+
id: string;
|
|
162
|
+
type: "image-asset" | "ad-creative" | "template";
|
|
163
|
+
name: string;
|
|
164
|
+
}>>;
|
|
165
|
+
/**
|
|
166
|
+
* OpenRouter model tag for the reviewer agent. Must be vision-capable.
|
|
167
|
+
* Defaults to the same model as chatModel.
|
|
168
|
+
*/
|
|
169
|
+
reviewerModel?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Maximum number of reviewer rounds per banner before the reviewer is skipped.
|
|
172
|
+
* @default 2
|
|
173
|
+
*/
|
|
174
|
+
maxReviewRounds?: number;
|
|
175
|
+
};
|
|
176
|
+
export declare const AIChatPanel: React.ForwardRefExoticComponent<AIChatPanelProps & React.RefAttributes<AIChatPanelRef>>;
|
|
@@ -30,6 +30,9 @@ export declare const ShapesSwitcher: ({ activeTool, setAppState, app, UIOptions,
|
|
|
30
30
|
app: AppClassProperties;
|
|
31
31
|
UIOptions: AppProps["UIOptions"];
|
|
32
32
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare const ScrollBackToContentAction: ({ renderAction, }: {
|
|
34
|
+
renderAction: ActionManager["renderAction"];
|
|
35
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
33
36
|
export declare const ZoomActions: ({ renderAction, zoom, }: {
|
|
34
37
|
renderAction: ActionManager["renderAction"];
|
|
35
38
|
zoom: Zoom;
|
|
@@ -258,6 +258,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
258
258
|
private updateEmbedValidationStatus;
|
|
259
259
|
private updateEmbeddables;
|
|
260
260
|
private renderEmbeddables;
|
|
261
|
+
private renderVideos;
|
|
261
262
|
private getFrameNameDOMId;
|
|
262
263
|
frameNameBoundsCache: FrameNameBoundsCache;
|
|
263
264
|
private resetEditingFrame;
|
|
@@ -284,11 +285,17 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
284
285
|
private onIframeSrcCopy;
|
|
285
286
|
onMagicframeToolSelect: () => void;
|
|
286
287
|
onImageGeneratorSelect: () => void;
|
|
288
|
+
onVideoGeneratorSelect: () => void;
|
|
287
289
|
/**
|
|
288
290
|
* Inserts a generated image (base64 data URL) into a frame element,
|
|
289
291
|
* sized to fill the frame exactly. Used by the image generator panel.
|
|
290
292
|
*/
|
|
291
293
|
insertGeneratedImageIntoFrame: (dataURL: string, frameElement: import("@orangecatai/element/types").ExcalidrawFrameLikeElement & import("@orangecatai/element/types").NonDeletedExcalidrawElement) => Promise<void>;
|
|
294
|
+
/**
|
|
295
|
+
* Inserts a generated video (presigned/CDN URL) into a video-generator frame,
|
|
296
|
+
* replacing any previous video. The video element fills the frame exactly.
|
|
297
|
+
*/
|
|
298
|
+
insertGeneratedVideoIntoFrame: (videoUrl: string, frameElement: import("@orangecatai/element/types").ExcalidrawFrameLikeElement & import("@orangecatai/element/types").NonDeletedExcalidrawElement) => void;
|
|
292
299
|
/**
|
|
293
300
|
* Inserts a generated image near a source element (≥ 25 px clearance).
|
|
294
301
|
* Tries right → below → left → above; falls back to right if all collide.
|
|
@@ -532,6 +539,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
532
539
|
*/
|
|
533
540
|
private getLatestInitializedImageElement;
|
|
534
541
|
private onImageToolbarButtonClick;
|
|
542
|
+
onVideoToolbarButtonClick: () => void;
|
|
535
543
|
private getImageNaturalDimensions;
|
|
536
544
|
/** updates image cache, refreshing updated elements and/or setting status
|
|
537
545
|
to error for images that fail during <img> element creation */
|
|
@@ -545,6 +553,8 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
545
553
|
private clearSelection;
|
|
546
554
|
private handleInteractiveCanvasRef;
|
|
547
555
|
private insertImages;
|
|
556
|
+
private newVideoPlaceholder;
|
|
557
|
+
insertVideos: (videoFiles: File[], sceneX: number, sceneY: number) => Promise<void>;
|
|
548
558
|
private handleAppOnDrop;
|
|
549
559
|
loadFileToCanvas: (file: File, fileHandle: FileSystemHandle | null) => Promise<void>;
|
|
550
560
|
private handleCanvasContextMenu;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "./CanvasBackgroundSwatch.scss";
|
|
2
|
+
import type { ActionManager } from "../actions/manager";
|
|
3
|
+
import type { UIAppState } from "../types";
|
|
4
|
+
export declare const CanvasBackgroundSwatch: ({ actionManager, appState, }: {
|
|
5
|
+
actionManager: ActionManager;
|
|
6
|
+
appState: UIAppState;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "./AdvancedColorPicker.scss";
|
|
2
|
+
interface AdvancedColorPickerProps {
|
|
3
|
+
color: string;
|
|
4
|
+
onChange: (color: string) => void;
|
|
5
|
+
showAlpha?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const AdvancedColorPicker: ({ color, onChange, showAlpha, }: AdvancedColorPickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure color conversion utilities for HSV ↔ RGB ↔ Hex with alpha support.
|
|
3
|
+
*/
|
|
4
|
+
export interface HSVA {
|
|
5
|
+
h: number;
|
|
6
|
+
s: number;
|
|
7
|
+
v: number;
|
|
8
|
+
a: number;
|
|
9
|
+
}
|
|
10
|
+
export interface RGBA {
|
|
11
|
+
r: number;
|
|
12
|
+
g: number;
|
|
13
|
+
b: number;
|
|
14
|
+
a: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const hsvaToRgba: ({ h, s, v, a }: HSVA) => RGBA;
|
|
17
|
+
export declare const rgbaToHsva: ({ r, g, b, a }: RGBA) => HSVA;
|
|
18
|
+
export declare const rgbaToHex: ({ r, g, b, a }: RGBA) => string;
|
|
19
|
+
export declare const hexToRgba: (hex: string) => RGBA;
|
|
20
|
+
export declare const hsvaToHex: (hsva: HSVA) => string;
|
|
21
|
+
export declare const hexToHsva: (hex: string) => HSVA;
|
|
22
|
+
/** Produces a CSS-safe rgba() string */
|
|
23
|
+
export declare const hsvaToRgbaString: (hsva: HSVA) => string;
|
|
24
|
+
/**
|
|
25
|
+
* Clamp a number between min and max.
|
|
26
|
+
*/
|
|
27
|
+
export declare const clampValue: (value: number, min: number, max: number) => number;
|
|
@@ -4,7 +4,7 @@ import type { SidebarProps, SidebarTriggerProps } from "./Sidebar/common";
|
|
|
4
4
|
export declare const DefaultSidebar: import("react").FC<Omit<MarkOptional<Omit<{
|
|
5
5
|
name: import("../types").SidebarName;
|
|
6
6
|
children: React.ReactNode;
|
|
7
|
-
onStateChange?: (state: import("
|
|
7
|
+
onStateChange?: (state: import("..").AppState["openSidebar"]) => void;
|
|
8
8
|
onDock?: (docked: boolean) => void;
|
|
9
9
|
docked?: boolean;
|
|
10
10
|
className?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ElementsMap, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
|
|
2
1
|
import "./ElementCanvasButtons.scss";
|
|
2
|
+
import type { ElementsMap, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
|
|
3
3
|
export declare const ElementCanvasButtons: ({ children, element, elementsMap, }: {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
element: NonDeletedExcalidrawElement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
|
|
2
1
|
import "./FrameToolbar.scss";
|
|
2
|
+
import type { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
|
|
3
3
|
import type { AppClassProperties } from "../types";
|
|
4
4
|
export declare const FrameToolbar: ({ element, app, }: {
|
|
5
5
|
element: NonDeletedExcalidrawElement & ExcalidrawFrameLikeElement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { EditorInterface } from "@orangecatai/common";
|
|
2
1
|
import "./HintViewer.scss";
|
|
2
|
+
import type { EditorInterface } from "@orangecatai/common";
|
|
3
3
|
import type { AppClassProperties, UIAppState } from "../types";
|
|
4
4
|
interface HintViewerProps {
|
|
5
5
|
appState: UIAppState;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./ImageEditToolbar.scss";
|
|
2
|
+
import type { ExcalidrawImageElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
|
|
3
|
+
import type { AppClassProperties } from "../types";
|
|
4
|
+
export interface ImageEditToolbarCallbacks {
|
|
5
|
+
onQuickEdit?: () => void;
|
|
6
|
+
onRemoveBG?: () => void;
|
|
7
|
+
onCrop?: () => void;
|
|
8
|
+
onDownload?: () => void;
|
|
9
|
+
onSwapAsset?: (elementId: string) => Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare const ImageEditToolbar: ({ element, app, callbacks, }: {
|
|
12
|
+
element: ExcalidrawImageElement & NonDeletedExcalidrawElement;
|
|
13
|
+
app: AppClassProperties;
|
|
14
|
+
callbacks?: ImageEditToolbarCallbacks;
|
|
15
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -2,27 +2,69 @@ import "./ImageGeneratorPanel.scss";
|
|
|
2
2
|
import type { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
|
|
3
3
|
import type { AppClassProperties } from "../types";
|
|
4
4
|
export declare const MODEL_CONFIG: {
|
|
5
|
-
readonly "
|
|
6
|
-
readonly
|
|
5
|
+
readonly "nano banana": {
|
|
6
|
+
readonly modelId: "google/gemini-2.5-flash-image";
|
|
7
|
+
readonly textOutput: true;
|
|
7
8
|
readonly supportsImageSize: false;
|
|
8
|
-
readonly supportsThinking: false;
|
|
9
9
|
readonly supportedResolutions: readonly ["1K"];
|
|
10
10
|
readonly supportedRatios: readonly ["21:9", "16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5"];
|
|
11
11
|
};
|
|
12
|
-
readonly "
|
|
13
|
-
readonly
|
|
14
|
-
readonly
|
|
15
|
-
readonly
|
|
12
|
+
readonly "nano banana 2": {
|
|
13
|
+
readonly modelId: "google/gemini-3.1-flash-image-preview";
|
|
14
|
+
readonly textOutput: true;
|
|
15
|
+
readonly supportsImageSize: false;
|
|
16
16
|
readonly supportedResolutions: readonly ["0.5K", "1K", "2K", "4K"];
|
|
17
17
|
readonly supportedRatios: readonly ["21:9", "16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5", "4:1", "1:4", "8:1", "1:8"];
|
|
18
18
|
};
|
|
19
|
-
readonly "
|
|
20
|
-
readonly
|
|
21
|
-
readonly
|
|
22
|
-
readonly
|
|
19
|
+
readonly "nano banana lite": {
|
|
20
|
+
readonly modelId: "google/gemini-3.1-flash-lite-image";
|
|
21
|
+
readonly textOutput: true;
|
|
22
|
+
readonly supportsImageSize: false;
|
|
23
|
+
readonly supportedResolutions: readonly ["0.5K", "1K", "2K", "4K"];
|
|
24
|
+
readonly supportedRatios: readonly ["21:9", "16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5", "4:1", "1:4", "8:1", "1:8"];
|
|
25
|
+
};
|
|
26
|
+
readonly "nano banana 2 lite": {
|
|
27
|
+
readonly modelId: "google/gemini-3.1-flash-lite-image";
|
|
28
|
+
readonly textOutput: true;
|
|
29
|
+
readonly supportsImageSize: false;
|
|
30
|
+
readonly supportedResolutions: readonly ["0.5K", "1K", "2K", "4K"];
|
|
31
|
+
readonly supportedRatios: readonly ["21:9", "16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5", "4:1", "1:4", "8:1", "1:8"];
|
|
32
|
+
};
|
|
33
|
+
readonly "nano banana pro": {
|
|
34
|
+
readonly modelId: "google/gemini-3-pro-image-preview";
|
|
35
|
+
readonly textOutput: true;
|
|
36
|
+
readonly supportsImageSize: false;
|
|
23
37
|
readonly supportedResolutions: readonly ["1K", "2K", "4K"];
|
|
24
38
|
readonly supportedRatios: readonly ["21:9", "16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5"];
|
|
25
39
|
};
|
|
40
|
+
readonly "seedream 4.5": {
|
|
41
|
+
readonly modelId: "bytedance-seed/seedream-4.5";
|
|
42
|
+
readonly textOutput: false;
|
|
43
|
+
readonly supportsImageSize: false;
|
|
44
|
+
readonly supportedResolutions: readonly ["1K"];
|
|
45
|
+
readonly supportedRatios: readonly ["16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5"];
|
|
46
|
+
};
|
|
47
|
+
readonly "grok image": {
|
|
48
|
+
readonly modelId: "x-ai/grok-imagine-image-quality";
|
|
49
|
+
readonly textOutput: false;
|
|
50
|
+
readonly supportsImageSize: true;
|
|
51
|
+
readonly supportedResolutions: readonly ["1K", "2K"];
|
|
52
|
+
readonly supportedRatios: readonly ["16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5"];
|
|
53
|
+
};
|
|
54
|
+
readonly "riverflow 2.5 fast": {
|
|
55
|
+
readonly modelId: "sourceful/riverflow-v2.5-fast";
|
|
56
|
+
readonly textOutput: false;
|
|
57
|
+
readonly supportsImageSize: true;
|
|
58
|
+
readonly supportedResolutions: readonly ["1K", "2K"];
|
|
59
|
+
readonly supportedRatios: readonly ["1:1", "21:9", "16:9", "3:2", "4:3", "5:4", "4:5", "3:4", "2:3", "9:16"];
|
|
60
|
+
};
|
|
61
|
+
readonly "riverflow 2.5 pro": {
|
|
62
|
+
readonly modelId: "sourceful/riverflow-v2.5-pro";
|
|
63
|
+
readonly textOutput: false;
|
|
64
|
+
readonly supportsImageSize: true;
|
|
65
|
+
readonly supportedResolutions: readonly ["1K", "2K", "4K"];
|
|
66
|
+
readonly supportedRatios: readonly ["1:1", "21:9", "16:9", "3:2", "4:3", "5:4", "4:5", "3:4", "2:3", "9:16"];
|
|
67
|
+
};
|
|
26
68
|
};
|
|
27
69
|
export type ModelName = keyof typeof MODEL_CONFIG;
|
|
28
70
|
export declare const MODEL_NAMES: ModelName[];
|
|
@@ -31,8 +73,12 @@ export declare function getDimensions(model: ModelName, ratio: string, resolutio
|
|
|
31
73
|
width: number;
|
|
32
74
|
height: number;
|
|
33
75
|
};
|
|
34
|
-
export declare
|
|
35
|
-
export declare const ImageGeneratorPanel: ({ element, app, }: {
|
|
76
|
+
export declare const ImageGeneratorPanel: ({ element, app, onBeforeImageGen, onAfterImageGen, }: {
|
|
36
77
|
element: NonDeletedExcalidrawElement & ExcalidrawFrameLikeElement;
|
|
37
78
|
app: AppClassProperties;
|
|
79
|
+
onBeforeImageGen?: () => Promise<{
|
|
80
|
+
allowed: boolean;
|
|
81
|
+
error?: string;
|
|
82
|
+
}>;
|
|
83
|
+
onAfterImageGen?: () => void;
|
|
38
84
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import "./ImageQuickEditPanel.scss";
|
|
2
2
|
import type { ExcalidrawImageElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
|
|
3
3
|
import type { AppClassProperties } from "../types";
|
|
4
|
-
export declare const ImageQuickEditPanel: ({ element, app, }: {
|
|
4
|
+
export declare const ImageQuickEditPanel: ({ element, app, onBeforeImageGen, onAfterImageGen, forceOpen, onClose, }: {
|
|
5
5
|
element: ExcalidrawImageElement & NonDeletedExcalidrawElement;
|
|
6
6
|
app: AppClassProperties;
|
|
7
|
+
onBeforeImageGen?: () => Promise<{
|
|
8
|
+
allowed: boolean;
|
|
9
|
+
error?: string;
|
|
10
|
+
}>;
|
|
11
|
+
onAfterImageGen?: () => void;
|
|
12
|
+
/** When true, skip the trigger bar and render the panel directly. */
|
|
13
|
+
forceOpen?: boolean;
|
|
14
|
+
/** Called when the panel closes itself (only used when forceOpen=true). */
|
|
15
|
+
onClose?: () => void;
|
|
7
16
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -14,7 +14,7 @@ export declare const isSidebarDockedAtom: import("jotai/vanilla/atom").Primitive
|
|
|
14
14
|
export declare const SidebarInner: React.ForwardRefExoticComponent<Omit<{
|
|
15
15
|
name: import("../../types").SidebarName;
|
|
16
16
|
children: React.ReactNode;
|
|
17
|
-
onStateChange?: (state: import("
|
|
17
|
+
onStateChange?: (state: import("../..").AppState["openSidebar"]) => void;
|
|
18
18
|
onDock?: (docked: boolean) => void;
|
|
19
19
|
docked?: boolean;
|
|
20
20
|
className?: string;
|
|
@@ -23,7 +23,7 @@ export declare const SidebarInner: React.ForwardRefExoticComponent<Omit<{
|
|
|
23
23
|
export declare const Sidebar: React.ForwardRefExoticComponent<{
|
|
24
24
|
name: import("../../types").SidebarName;
|
|
25
25
|
children: React.ReactNode;
|
|
26
|
-
onStateChange?: (state: import("
|
|
26
|
+
onStateChange?: (state: import("../..").AppState["openSidebar"]) => void;
|
|
27
27
|
onDock?: (docked: boolean) => void;
|
|
28
28
|
docked?: boolean;
|
|
29
29
|
className?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Scene } from "@orangecatai/element";
|
|
2
1
|
import { useApp, useExcalidrawSetAppState } from "../App";
|
|
3
2
|
import "./DragInput.scss";
|
|
3
|
+
import type { Scene } from "@orangecatai/element";
|
|
4
4
|
import type { ElementsMap, ExcalidrawElement } from "@orangecatai/element/types";
|
|
5
5
|
import type { StatsInputProperty } from "./utils";
|
|
6
6
|
import type { AppState } from "../../types";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { NonDeletedExcalidrawElement } from "@orangecatai/element/types";
|
|
2
1
|
import "./Stats.scss";
|
|
2
|
+
import type { NonDeletedExcalidrawElement } from "@orangecatai/element/types";
|
|
3
3
|
import type { AppClassProperties, AppState, ExcalidrawProps } from "../../types";
|
|
4
4
|
interface StatsProps {
|
|
5
5
|
app: AppClassProperties;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./StockImagePanel.scss";
|
|
3
|
+
import type { ExcalidrawImperativeAPI } from "../types";
|
|
4
|
+
export type StockImagePhoto = {
|
|
5
|
+
id: string;
|
|
6
|
+
thumbUrl: string;
|
|
7
|
+
regularUrl: string;
|
|
8
|
+
description: string | null;
|
|
9
|
+
authorName: string;
|
|
10
|
+
authorUsername: string;
|
|
11
|
+
};
|
|
12
|
+
export type StockImageSearchResult = {
|
|
13
|
+
photos: StockImagePhoto[];
|
|
14
|
+
totalPages: number;
|
|
15
|
+
};
|
|
16
|
+
export type LibraryImageFilter = "all" | "product" | "logo" | "lifestyle" | "auxiliary";
|
|
17
|
+
export type LibraryImage = {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
url: string;
|
|
21
|
+
assetType: string;
|
|
22
|
+
};
|
|
23
|
+
export type LibraryImageResult = {
|
|
24
|
+
images: LibraryImage[];
|
|
25
|
+
totalPages: number;
|
|
26
|
+
};
|
|
27
|
+
export interface StockImagePanelProps {
|
|
28
|
+
isOpen: boolean;
|
|
29
|
+
onClose: () => void;
|
|
30
|
+
excalidrawAPI: ExcalidrawImperativeAPI | null;
|
|
31
|
+
onSearchStockImages?: (query: string, page: number) => Promise<StockImageSearchResult>;
|
|
32
|
+
onTriggerStockImageDownload?: (photoId: string) => Promise<void>;
|
|
33
|
+
onBeforeStockImageDownload?: () => Promise<{
|
|
34
|
+
allowed: boolean;
|
|
35
|
+
error?: string;
|
|
36
|
+
}>;
|
|
37
|
+
onAfterStockImageDownload?: () => void;
|
|
38
|
+
/**
|
|
39
|
+
* Fetch the signed-in user's own image library. Supplied by the host
|
|
40
|
+
* (the SDK never fetches on its own). Supports type filtering, name/tag
|
|
41
|
+
* search, and pagination ("Load more").
|
|
42
|
+
*/
|
|
43
|
+
onFetchLibraryImages?: (params: {
|
|
44
|
+
filter: LibraryImageFilter;
|
|
45
|
+
query: string;
|
|
46
|
+
page: number;
|
|
47
|
+
}) => Promise<LibraryImageResult>;
|
|
48
|
+
}
|
|
49
|
+
export declare const StockImagePanel: React.FC<StockImagePanelProps>;
|
|
@@ -20,5 +20,6 @@ export type StreamChunk = {
|
|
|
20
20
|
status?: number;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
+
export declare function parseSSEStream(reader: ReadableStreamDefaultReader<Uint8Array>): AsyncGenerator<string, void, unknown>;
|
|
23
24
|
export declare function TTDStreamFetch(options: StreamingOptions): Promise<TTTDDialog.OnTextSubmitRetValue>;
|
|
24
25
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { PointerType } from "@orangecatai/element/types";
|
|
3
2
|
import "./ToolIcon.scss";
|
|
3
|
+
import type { PointerType } from "@orangecatai/element/types";
|
|
4
4
|
import type { CSSProperties } from "react";
|
|
5
5
|
export type ToolButtonSize = "small" | "medium";
|
|
6
6
|
type ToolButtonBaseProps = {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ExcalidrawVideoElement } from "@orangecatai/element/types";
|
|
2
|
+
import "./VideoElement.scss";
|
|
3
|
+
interface VideoElementProps {
|
|
4
|
+
element: ExcalidrawVideoElement;
|
|
5
|
+
isActive: boolean;
|
|
6
|
+
videoDownloadProxyUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const VideoElement: ({ element, videoDownloadProxyUrl }: VideoElementProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|