@orangecatai/element 0.0.3 → 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.
Files changed (41) hide show
  1. package/dist/dev/index.js +28 -2
  2. package/dist/dev/index.js.map +2 -2
  3. package/dist/prod/index.js +9 -9
  4. package/dist/types/common/src/constants.d.ts +4 -0
  5. package/dist/types/element/src/Scene.d.ts +1 -1
  6. package/dist/types/element/src/frame.d.ts +2 -2
  7. package/dist/types/element/src/newElement.d.ts +10 -1
  8. package/dist/types/element/src/typeChecks.d.ts +2 -1
  9. package/dist/types/element/src/types.d.ts +17 -2
  10. package/dist/types/excalidraw/actions/actionFrame.d.ts +41 -0
  11. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +41 -0
  12. package/dist/types/excalidraw/components/AIChatPanel.d.ts +70 -8
  13. package/dist/types/excalidraw/components/App.d.ts +10 -0
  14. package/dist/types/excalidraw/components/ImageEditToolbar.d.ts +0 -1
  15. package/dist/types/excalidraw/components/ImageGeneratorPanel.d.ts +53 -12
  16. package/dist/types/excalidraw/components/StockImagePanel.d.ts +49 -0
  17. package/dist/types/excalidraw/components/VideoElement.d.ts +9 -0
  18. package/dist/types/excalidraw/components/VideoGeneratorPanel.d.ts +149 -0
  19. package/dist/types/excalidraw/components/ai-chat/AdGenShimmerLayer.d.ts +10 -0
  20. package/dist/types/excalidraw/components/ai-chat/adGenShimmerStore.d.ts +12 -0
  21. package/dist/types/excalidraw/components/ai-chat/agentLoop.d.ts +8 -6
  22. package/dist/types/excalidraw/components/ai-chat/audioUtils.d.ts +0 -5
  23. package/dist/types/excalidraw/components/ai-chat/canvasTools.d.ts +96 -29
  24. package/dist/types/excalidraw/components/ai-chat/reviewerAgent.d.ts +21 -11
  25. package/dist/types/excalidraw/components/auto-resize/AutoResizePanel.d.ts +2 -2
  26. package/dist/types/excalidraw/components/auto-resize/autoResizeEngine.d.ts +43 -2
  27. package/dist/types/excalidraw/components/icons.d.ts +2 -0
  28. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +4 -0
  29. package/dist/types/excalidraw/data/blob.d.ts +4 -1
  30. package/dist/types/excalidraw/index.d.ts +6 -2
  31. package/dist/types/excalidraw/scene/types.d.ts +1 -0
  32. package/dist/types/excalidraw/types.d.ts +83 -21
  33. package/dist/types/excalidraw/utils/brandContextUtils.d.ts +23 -0
  34. package/dist/types/excalidraw/utils/imageApi.d.ts +19 -0
  35. package/dist/types/excalidraw/utils/videoApi.d.ts +30 -0
  36. package/dist/types/utils/src/shape.d.ts +2 -2
  37. package/package.json +2 -2
  38. package/dist/types/excalidraw/utils/geminiApiKey.d.ts +0 -1
  39. package/dist/types/excalidraw/utils/leonardoApiKey.d.ts +0 -1
  40. package/dist/types/excalidraw/utils/openRouterApiKey.d.ts +0 -1
  41. package/dist/types/excalidraw/utils/removeBgApiKey.d.ts +0 -1
@@ -175,6 +175,10 @@ export declare const IMAGE_MIME_TYPES: {
175
175
  readonly avif: "image/avif";
176
176
  readonly jfif: "image/jfif";
177
177
  };
178
+ export declare const VIDEO_MIME_TYPES: {
179
+ readonly mp4: "video/mp4";
180
+ readonly mov: "video/quicktime";
181
+ };
178
182
  export declare const STRING_MIME_TYPES: {
179
183
  readonly text: "text/plain";
180
184
  readonly html: "text/html";
@@ -70,7 +70,7 @@ export declare class Scene {
70
70
  getElementIndex(elementId: string): number;
71
71
  getContainerElement: (element: (ExcalidrawElement & {
72
72
  containerId: ExcalidrawElement["id"] | null;
73
- }) | null) => import("@orangecatai/element/types").ExcalidrawLinearElement | import("@orangecatai/element/types").ExcalidrawSelectionElement | import("@orangecatai/element/types").ExcalidrawRectangleElement | import("@orangecatai/element/types").ExcalidrawDiamondElement | import("@orangecatai/element/types").ExcalidrawEllipseElement | import("@orangecatai/element/types").ExcalidrawEmbeddableElement | import("@orangecatai/element/types").ExcalidrawIframeElement | import("@orangecatai/element/types").ExcalidrawImageElement | import("@orangecatai/element/types").ExcalidrawFrameElement | import("@orangecatai/element/types").ExcalidrawMagicFrameElement | import("@orangecatai/element/types").ExcalidrawTextElement | import("@orangecatai/element/types").ExcalidrawFreeDrawElement | null;
73
+ }) | null) => import("@orangecatai/element/types").ExcalidrawLinearElement | import("@orangecatai/element/types").ExcalidrawSelectionElement | import("@orangecatai/element/types").ExcalidrawRectangleElement | import("@orangecatai/element/types").ExcalidrawDiamondElement | import("@orangecatai/element/types").ExcalidrawEllipseElement | import("@orangecatai/element/types").ExcalidrawEmbeddableElement | import("@orangecatai/element/types").ExcalidrawIframeElement | import("@orangecatai/element/types").ExcalidrawImageElement | import("@orangecatai/element/types").ExcalidrawVideoElement | import("@orangecatai/element/types").ExcalidrawFrameElement | import("@orangecatai/element/types").ExcalidrawMagicFrameElement | import("@orangecatai/element/types").ExcalidrawTextElement | import("@orangecatai/element/types").ExcalidrawFreeDrawElement | null;
74
74
  getElementsFromId: (id: string) => ExcalidrawElement[];
75
75
  mutateElement<TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, options?: {
76
76
  informMutation: boolean;
@@ -31,8 +31,8 @@ export declare const getFrameLikeElements: (allElements: ExcalidrawElementsInclu
31
31
  */
32
32
  export declare const getRootElements: (allElements: ExcalidrawElementsIncludingDeleted) => ExcalidrawElement[];
33
33
  export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, appState: AppState, elementsMap: ElementsMap) => ExcalidrawElement[];
34
- export declare const getElementsInNewFrame: (elements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => (import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawSelectionElement | import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawEmbeddableElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawFreeDrawElement)[];
35
- export declare const omitPartialGroups: (elements: ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, allElementsMap: ElementsMap) => (import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawSelectionElement | import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawEmbeddableElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawFreeDrawElement)[];
34
+ export declare const getElementsInNewFrame: (elements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => (import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawSelectionElement | import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawEmbeddableElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawVideoElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawFreeDrawElement)[];
35
+ export declare const omitPartialGroups: (elements: ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, allElementsMap: ElementsMap) => (import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawSelectionElement | import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawEmbeddableElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawVideoElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawFreeDrawElement)[];
36
36
  export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap: ElementsMap) => ExcalidrawFrameLikeElement | null;
37
37
  /** */
38
38
  export declare const filterElementsEligibleAsFrameChildren: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => ExcalidrawElement[];
@@ -1,5 +1,5 @@
1
1
  import type { MarkOptional } from "@orangecatai/common/utility-types";
2
- import type { ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawIframeElement, ElementsMap, ExcalidrawArrowElement, ExcalidrawElbowArrowElement, ExcalidrawLineElement } from "./types";
2
+ import type { ExcalidrawImageElement, ExcalidrawVideoElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawIframeElement, ElementsMap, ExcalidrawArrowElement, ExcalidrawElbowArrowElement, ExcalidrawLineElement } from "./types";
3
3
  export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "index" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity" | "customData">;
4
4
  export declare const newElement: (opts: {
5
5
  type: ExcalidrawGenericElement["type"];
@@ -60,3 +60,12 @@ export declare const newImageElement: (opts: {
60
60
  scale?: ExcalidrawImageElement["scale"];
61
61
  crop?: ExcalidrawImageElement["crop"];
62
62
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawImageElement>;
63
+ export declare const newVideoElement: (opts: {
64
+ status?: ExcalidrawVideoElement["status"];
65
+ videoUrl?: ExcalidrawVideoElement["videoUrl"];
66
+ mimeType?: ExcalidrawVideoElement["mimeType"];
67
+ thumbnailDataUrl?: ExcalidrawVideoElement["thumbnailDataUrl"];
68
+ duration?: ExcalidrawVideoElement["duration"];
69
+ naturalWidth?: ExcalidrawVideoElement["naturalWidth"];
70
+ naturalHeight?: ExcalidrawVideoElement["naturalHeight"];
71
+ } & ElementConstructorOpts) => NonDeleted<ExcalidrawVideoElement>;
@@ -1,8 +1,9 @@
1
1
  import type { ElementOrToolType } from "@orangecatai/adgen-canvas/types";
2
2
  import type { MarkNonNullable } from "@orangecatai/common/utility-types";
3
- import type { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeElement, ExcalidrawIframeLikeElement, ExcalidrawMagicFrameElement, ExcalidrawArrowElement, ExcalidrawElbowArrowElement, ExcalidrawLineElement, ExcalidrawFlowchartNodeElement, ExcalidrawLinearElementSubType } from "./types";
3
+ import type { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeElement, ExcalidrawIframeLikeElement, ExcalidrawMagicFrameElement, ExcalidrawArrowElement, ExcalidrawElbowArrowElement, ExcalidrawLineElement, ExcalidrawFlowchartNodeElement, ExcalidrawLinearElementSubType, ExcalidrawVideoElement } from "./types";
4
4
  export declare const isInitializedImageElement: (element: ExcalidrawElement | null) => element is InitializedExcalidrawImageElement;
5
5
  export declare const isImageElement: (element: ExcalidrawElement | null) => element is ExcalidrawImageElement;
6
+ export declare const isVideoElement: (element: ExcalidrawElement | null | undefined) => element is ExcalidrawVideoElement;
6
7
  export declare const isEmbeddableElement: (element: ExcalidrawElement | null | undefined) => element is ExcalidrawEmbeddableElement;
7
8
  export declare const isIframeElement: (element: ExcalidrawElement | null) => element is ExcalidrawIframeElement;
8
9
  export declare const isIframeLikeElement: (element: ExcalidrawElement | null) => element is ExcalidrawIframeLikeElement;
@@ -137,6 +137,21 @@ export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
137
137
  crop: ImageCrop | null;
138
138
  }>;
139
139
  export type InitializedExcalidrawImageElement = MarkNonNullable<ExcalidrawImageElement, "fileId">;
140
+ export type ExcalidrawVideoElement = _ExcalidrawElementBase & Readonly<{
141
+ type: "video";
142
+ /** URL to host-stored video file (not DataURL — videos are too large for base64) */
143
+ videoUrl: string | null;
144
+ status: "idle" | "uploading" | "saved" | "error";
145
+ mimeType: "video/mp4" | "video/quicktime" | null;
146
+ /** JPEG data URL of the first frame, used as the static thumbnail on canvas */
147
+ thumbnailDataUrl: string | null;
148
+ /** Total duration in seconds */
149
+ duration: number;
150
+ /** Original video pixel width */
151
+ naturalWidth: number;
152
+ /** Original video pixel height */
153
+ naturalHeight: number;
154
+ }>;
140
155
  export type ExcalidrawFrameElement = _ExcalidrawElementBase & {
141
156
  type: "frame";
142
157
  name: string | null;
@@ -151,13 +166,13 @@ export type ExcalidrawFrameLikeElement = ExcalidrawFrameElement | ExcalidrawMagi
151
166
  */
152
167
  export type ExcalidrawGenericElement = ExcalidrawSelectionElement | ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement;
153
168
  export type ExcalidrawFlowchartNodeElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement;
154
- export type ExcalidrawRectanguloidElement = ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawTextElement | ExcalidrawFreeDrawElement | ExcalidrawIframeLikeElement | ExcalidrawFrameLikeElement | ExcalidrawEmbeddableElement | ExcalidrawSelectionElement;
169
+ export type ExcalidrawRectanguloidElement = ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawVideoElement | ExcalidrawTextElement | ExcalidrawFreeDrawElement | ExcalidrawIframeLikeElement | ExcalidrawFrameLikeElement | ExcalidrawEmbeddableElement | ExcalidrawSelectionElement;
155
170
  /**
156
171
  * ExcalidrawElement should be JSON serializable and (eventually) contain
157
172
  * no computed data. The list of all ExcalidrawElements should be shareable
158
173
  * between peers and contain no state local to the peer.
159
174
  */
160
- export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawArrowElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement | ExcalidrawMagicFrameElement | ExcalidrawIframeElement | ExcalidrawEmbeddableElement;
175
+ export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawArrowElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawVideoElement | ExcalidrawFrameElement | ExcalidrawMagicFrameElement | ExcalidrawIframeElement | ExcalidrawEmbeddableElement;
161
176
  export type ExcalidrawNonSelectionElement = Exclude<ExcalidrawElement, ExcalidrawSelectionElement>;
162
177
  export type Ordered<TElement extends ExcalidrawElement> = TElement & {
163
178
  index: FractionalIndex;
@@ -1201,6 +1201,47 @@ export declare const actionWrapSelectionInFrame: {
1201
1201
  link: string | null;
1202
1202
  locked: boolean;
1203
1203
  customData?: Record<string, any>;
1204
+ }> & Readonly<{
1205
+ type: "video";
1206
+ videoUrl: string | null;
1207
+ status: "idle" | "uploading" | "saved" | "error";
1208
+ mimeType: "video/mp4" | "video/quicktime" | null;
1209
+ thumbnailDataUrl: string | null;
1210
+ duration: number;
1211
+ naturalWidth: number;
1212
+ naturalHeight: number;
1213
+ }> & {
1214
+ index: import("@orangecatai/element/types").FractionalIndex;
1215
+ }) | (Readonly<{
1216
+ id: string;
1217
+ x: number;
1218
+ y: number;
1219
+ strokeColor: string;
1220
+ backgroundColor: string;
1221
+ fillStyle: import("@orangecatai/element/types").FillStyle;
1222
+ strokeWidth: number;
1223
+ strokeStyle: import("@orangecatai/element/types").StrokeStyle;
1224
+ roundness: null | {
1225
+ type: import("@orangecatai/element/types").RoundnessType;
1226
+ value?: number;
1227
+ };
1228
+ roughness: number;
1229
+ opacity: number;
1230
+ width: number;
1231
+ height: number;
1232
+ angle: import("@orangecatai/math").Radians;
1233
+ seed: number;
1234
+ version: number;
1235
+ versionNonce: number;
1236
+ index: import("@orangecatai/element/types").FractionalIndex | null;
1237
+ isDeleted: boolean;
1238
+ groupIds: readonly import("@orangecatai/element/types").GroupId[];
1239
+ frameId: string | null;
1240
+ boundElements: readonly import("@orangecatai/element/types").BoundElement[] | null;
1241
+ updated: number;
1242
+ link: string | null;
1243
+ locked: boolean;
1244
+ customData?: Record<string, any>;
1204
1245
  }> & {
1205
1246
  type: "frame";
1206
1247
  name: string | null;
@@ -531,6 +531,47 @@ export declare const actionTogglePolygon: {
531
531
  link: string | null;
532
532
  locked: boolean;
533
533
  customData?: Record<string, any>;
534
+ }> & Readonly<{
535
+ type: "video";
536
+ videoUrl: string | null;
537
+ status: "idle" | "uploading" | "saved" | "error";
538
+ mimeType: "video/mp4" | "video/quicktime" | null;
539
+ thumbnailDataUrl: string | null;
540
+ duration: number;
541
+ naturalWidth: number;
542
+ naturalHeight: number;
543
+ }> & {
544
+ index: import("@orangecatai/element/types").FractionalIndex;
545
+ }) | (Readonly<{
546
+ id: string;
547
+ x: number;
548
+ y: number;
549
+ strokeColor: string;
550
+ backgroundColor: string;
551
+ fillStyle: import("@orangecatai/element/types").FillStyle;
552
+ strokeWidth: number;
553
+ strokeStyle: import("@orangecatai/element/types").StrokeStyle;
554
+ roundness: null | {
555
+ type: import("@orangecatai/element/types").RoundnessType;
556
+ value?: number;
557
+ };
558
+ roughness: number;
559
+ opacity: number;
560
+ width: number;
561
+ height: number;
562
+ angle: import("@orangecatai/math").Radians;
563
+ seed: number;
564
+ version: number;
565
+ versionNonce: number;
566
+ index: import("@orangecatai/element/types").FractionalIndex | null;
567
+ isDeleted: boolean;
568
+ groupIds: readonly import("@orangecatai/element/types").GroupId[];
569
+ frameId: string | null;
570
+ boundElements: readonly import("@orangecatai/element/types").BoundElement[] | null;
571
+ updated: number;
572
+ link: string | null;
573
+ locked: boolean;
574
+ customData?: Record<string, any>;
534
575
  }> & {
535
576
  type: "frame";
536
577
  name: string | null;
@@ -11,8 +11,10 @@ export type ChatMessage = {
11
11
  toolActions?: ToolAction[];
12
12
  attachments?: Array<{
13
13
  name: string;
14
- type: "image" | "text";
14
+ type: "image" | "text" | "pdf" | "docx";
15
15
  dataUrl?: string;
16
+ textContent?: string;
17
+ s3Key?: string;
16
18
  }>;
17
19
  /** Reviewer feedback attached to an assistant message after HTML ad generation */
18
20
  reviewFeedback?: ReviewerFeedback;
@@ -29,9 +31,19 @@ export type AIChatPanelRef = {
29
31
  export type AIChatPanelProps = {
30
32
  isOpen: boolean;
31
33
  onClose: () => void;
32
- apiKey?: string;
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;
33
46
  excalidrawAPI?: ExcalidrawImperativeAPI;
34
- geminiApiKey?: string;
35
47
  initialMessages?: ChatMessage[];
36
48
  initialSessionId?: string;
37
49
  initialSessions?: ChatSession[];
@@ -41,6 +53,15 @@ export type AIChatPanelProps = {
41
53
  title: string;
42
54
  }) => void;
43
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>>;
44
65
  onBeforeSend?: (ctx: {
45
66
  hasVoice: boolean;
46
67
  }) => Promise<{
@@ -57,19 +78,26 @@ export type AIChatPanelProps = {
57
78
  onAfterImageGen?: () => void;
58
79
  /**
59
80
  * OpenRouter model tag for the chat system (both plain chat and agent loop).
60
- * @default "google/gemini-3.1-flash-lite-preview"
81
+ * @default "minimax/minimax-m3"
61
82
  * @example "openai/gpt-4o" or "anthropic/claude-sonnet-4"
62
83
  */
63
84
  chatModel?: string;
64
85
  /**
65
86
  * OpenRouter model tag for voice/speech-to-text transcription.
66
- * @default "mistralai/voxtral-small-24b-2507"
87
+ * @default "mistralai/voxtral-mini-transcribe"
67
88
  */
68
89
  voiceModel?: string;
69
90
  /**
70
- * Gemini model ID used by the agent's generate_image tool.
71
- * @default "gemini-3.1-flash-image-preview"
72
- * @example "gemini-2.0-flash-preview-image-generation"
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"
73
101
  */
74
102
  agentImageModel?: string;
75
103
  /**
@@ -87,6 +115,15 @@ export type AIChatPanelProps = {
87
115
  tags: string[];
88
116
  assetType: string;
89
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;
90
127
  }>>;
91
128
  onListBrandTemplates?: (keywords?: string[]) => Promise<Array<{
92
129
  id: string;
@@ -96,10 +133,35 @@ export type AIChatPanelProps = {
96
133
  width?: number;
97
134
  height?: number;
98
135
  thumbnailBlobUrl?: string;
136
+ thumbnailDataUrl?: string;
99
137
  }>>;
100
138
  onGetTemplateVariant?: (variantId: string) => Promise<{
101
139
  canvasJson: string;
102
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
+ }>>;
103
165
  /**
104
166
  * OpenRouter model tag for the reviewer agent. Must be vision-capable.
105
167
  * Defaults to the same model as chatModel.
@@ -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;
@@ -3,7 +3,6 @@ import type { ExcalidrawImageElement, NonDeletedExcalidrawElement } from "@orang
3
3
  import type { AppClassProperties } from "../types";
4
4
  export interface ImageEditToolbarCallbacks {
5
5
  onQuickEdit?: () => void;
6
- onUpscale?: () => void;
7
6
  onRemoveBG?: () => void;
8
7
  onCrop?: () => void;
9
8
  onDownload?: () => void;
@@ -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 "Gemini 2.5 Flash": {
6
- readonly geminiModelId: "gemini-3.1-flash-image";
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 "Gemini 3.1 Flash": {
13
- readonly geminiModelId: "gemini-3.1-flash-image";
14
- readonly supportsImageSize: true;
15
- readonly supportsThinking: true;
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 "Gemini 3 Pro": {
20
- readonly geminiModelId: "gemini-3-pro-image";
21
- readonly supportsImageSize: true;
22
- readonly supportsThinking: false;
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,7 +73,6 @@ export declare function getDimensions(model: ModelName, ratio: string, resolutio
31
73
  width: number;
32
74
  height: number;
33
75
  };
34
- export declare function callGeminiAPI(prompt: string, modelId: string, aspectRatio: string, resolution: Resolution, supportsImageSize: boolean, supportsThinking: boolean, apiKey: string, referenceImageDataUrl?: string, signal?: AbortSignal): Promise<string>;
35
76
  export declare const ImageGeneratorPanel: ({ element, app, onBeforeImageGen, onAfterImageGen, }: {
36
77
  element: NonDeletedExcalidrawElement & ExcalidrawFrameLikeElement;
37
78
  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>;
@@ -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 {};