@orangecatai/adgen-canvas 0.0.19 → 0.0.20
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/{chunk-JFIHKE5E.js → chunk-ILOOQ6LL.js} +3 -3
- package/dist/dev/{chunk-SFB47GDQ.js → chunk-Y6SGUVKW.js} +2 -2
- package/dist/dev/data/{image-OXVYDFFE.js → image-MFQPU4SU.js} +3 -3
- package/dist/dev/index.css +391 -12
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +3088 -2343
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/{chunk-5GYFLSBF.js → chunk-3BUGCS63.js} +2 -2
- package/dist/prod/{chunk-7XQHY7WT.js → chunk-SDWSFP7L.js} +1 -1
- package/dist/prod/data/image-NBDZMG3P.js +1 -0
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +87 -61
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/excalidraw/components/AIChatPanel.d.ts +24 -7
- package/dist/types/excalidraw/components/ImageGeneratorPanel.d.ts +23 -10
- package/dist/types/excalidraw/components/StockImagePanel.d.ts +49 -0
- package/dist/types/excalidraw/components/ai-chat/agentLoop.d.ts +7 -1
- package/dist/types/excalidraw/components/ai-chat/canvasTools.d.ts +14 -2
- package/dist/types/excalidraw/components/ai-chat/reviewerAgent.d.ts +1 -1
- package/dist/types/excalidraw/components/auto-resize/autoResizeEngine.d.ts +0 -1
- package/dist/types/excalidraw/index.d.ts +2 -0
- package/dist/types/excalidraw/types.d.ts +3 -9
- package/dist/types/excalidraw/utils/imageApi.d.ts +1 -0
- package/package.json +1 -1
- package/dist/prod/data/image-FRJAQJ62.js +0 -1
- package/dist/types/excalidraw/utils/geminiApiKey.d.ts +0 -1
- /package/dist/dev/{chunk-JFIHKE5E.js.map → chunk-ILOOQ6LL.js.map} +0 -0
- /package/dist/dev/{chunk-SFB47GDQ.js.map → chunk-Y6SGUVKW.js.map} +0 -0
- /package/dist/dev/data/{image-OXVYDFFE.js.map → image-MFQPU4SU.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-
|
|
1
|
+
import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-SDWSFP7L.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r,c as t}from"./chunk-Z5NKEFVG.js";import"./chunk-
|
|
1
|
+
import{a as r,c as t}from"./chunk-Z5NKEFVG.js";import"./chunk-SDWSFP7L.js";import"./chunk-SRAX5OIU.js";var s=import.meta.url?new URL(import.meta.url):void 0;typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{switch(e.data.command){case r.Subset:let a=await t(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]});break}});export{s as WorkerUrl};
|
|
@@ -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;
|
|
@@ -31,7 +33,6 @@ export type AIChatPanelProps = {
|
|
|
31
33
|
onClose: () => void;
|
|
32
34
|
apiKey?: string;
|
|
33
35
|
excalidrawAPI?: ExcalidrawImperativeAPI;
|
|
34
|
-
geminiApiKey?: string;
|
|
35
36
|
initialMessages?: ChatMessage[];
|
|
36
37
|
initialSessionId?: string;
|
|
37
38
|
initialSessions?: ChatSession[];
|
|
@@ -41,6 +42,15 @@ export type AIChatPanelProps = {
|
|
|
41
42
|
title: string;
|
|
42
43
|
}) => void;
|
|
43
44
|
onSessionSwitch?: (sessionId: string) => void;
|
|
45
|
+
onBeforeFileUpload?: (files: Array<{
|
|
46
|
+
name: string;
|
|
47
|
+
type: "image" | "pdf" | "text" | "docx";
|
|
48
|
+
mimeType: string;
|
|
49
|
+
dataUrl?: string;
|
|
50
|
+
textContent?: string;
|
|
51
|
+
}>, sessionId: string) => Promise<Array<{
|
|
52
|
+
s3Key: string;
|
|
53
|
+
} | null>>;
|
|
44
54
|
onBeforeSend?: (ctx: {
|
|
45
55
|
hasVoice: boolean;
|
|
46
56
|
}) => Promise<{
|
|
@@ -57,19 +67,26 @@ export type AIChatPanelProps = {
|
|
|
57
67
|
onAfterImageGen?: () => void;
|
|
58
68
|
/**
|
|
59
69
|
* OpenRouter model tag for the chat system (both plain chat and agent loop).
|
|
60
|
-
* @default "
|
|
70
|
+
* @default "minimax/minimax-m3"
|
|
61
71
|
* @example "openai/gpt-4o" or "anthropic/claude-sonnet-4"
|
|
62
72
|
*/
|
|
63
73
|
chatModel?: string;
|
|
64
74
|
/**
|
|
65
75
|
* OpenRouter model tag for voice/speech-to-text transcription.
|
|
66
|
-
* @default "mistralai/voxtral-
|
|
76
|
+
* @default "mistralai/voxtral-mini-transcribe"
|
|
67
77
|
*/
|
|
68
78
|
voiceModel?: string;
|
|
69
79
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
80
|
+
* URL to POST `{ audio: string; format: string }` for server-side transcription.
|
|
81
|
+
* When provided, the SDK routes mic audio through this endpoint instead of
|
|
82
|
+
* calling OpenRouter directly, so the API key never needs to be in the browser.
|
|
83
|
+
* The endpoint must return `{ text: string }`.
|
|
84
|
+
*/
|
|
85
|
+
transcribeUrl?: string;
|
|
86
|
+
/**
|
|
87
|
+
* OpenRouter model ID used by the agent's generate_image tool.
|
|
88
|
+
* @default "google/gemini-3.1-flash-image-preview"
|
|
89
|
+
* @example "google/gemini-2.5-flash-image"
|
|
73
90
|
*/
|
|
74
91
|
agentImageModel?: string;
|
|
75
92
|
/**
|
|
@@ -2,27 +2,41 @@ 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
|
|
12
|
+
readonly "nano banana 2": {
|
|
13
|
+
readonly modelId: "google/gemini-3.1-flash-image-preview";
|
|
14
|
+
readonly textOutput: true;
|
|
14
15
|
readonly supportsImageSize: true;
|
|
15
|
-
readonly supportsThinking: true;
|
|
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
|
|
19
|
+
readonly "nano banana pro": {
|
|
20
|
+
readonly modelId: "google/gemini-3-pro-image-preview";
|
|
21
|
+
readonly textOutput: true;
|
|
21
22
|
readonly supportsImageSize: true;
|
|
22
|
-
readonly supportsThinking: false;
|
|
23
23
|
readonly supportedResolutions: readonly ["1K", "2K", "4K"];
|
|
24
24
|
readonly supportedRatios: readonly ["21:9", "16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5"];
|
|
25
25
|
};
|
|
26
|
+
readonly "seedream 4.5": {
|
|
27
|
+
readonly modelId: "bytedance-seed/seedream-4.5";
|
|
28
|
+
readonly textOutput: false;
|
|
29
|
+
readonly supportsImageSize: false;
|
|
30
|
+
readonly supportedResolutions: readonly ["1K"];
|
|
31
|
+
readonly supportedRatios: readonly ["16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5"];
|
|
32
|
+
};
|
|
33
|
+
readonly "grok image": {
|
|
34
|
+
readonly modelId: "x-ai/grok-imagine-image-quality";
|
|
35
|
+
readonly textOutput: false;
|
|
36
|
+
readonly supportsImageSize: true;
|
|
37
|
+
readonly supportedResolutions: readonly ["1K", "2K"];
|
|
38
|
+
readonly supportedRatios: readonly ["16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5"];
|
|
39
|
+
};
|
|
26
40
|
};
|
|
27
41
|
export type ModelName = keyof typeof MODEL_CONFIG;
|
|
28
42
|
export declare const MODEL_NAMES: ModelName[];
|
|
@@ -31,7 +45,6 @@ export declare function getDimensions(model: ModelName, ratio: string, resolutio
|
|
|
31
45
|
width: number;
|
|
32
46
|
height: number;
|
|
33
47
|
};
|
|
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
48
|
export declare const ImageGeneratorPanel: ({ element, app, onBeforeImageGen, onAfterImageGen, }: {
|
|
36
49
|
element: NonDeletedExcalidrawElement & ExcalidrawFrameLikeElement;
|
|
37
50
|
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>;
|
|
@@ -8,6 +8,12 @@ type ContentPart = {
|
|
|
8
8
|
image_url: {
|
|
9
9
|
url: string;
|
|
10
10
|
};
|
|
11
|
+
} | {
|
|
12
|
+
type: "file";
|
|
13
|
+
file: {
|
|
14
|
+
filename: string;
|
|
15
|
+
file_data: string;
|
|
16
|
+
};
|
|
11
17
|
};
|
|
12
18
|
export type AgentMessage = {
|
|
13
19
|
role: "system";
|
|
@@ -60,7 +66,7 @@ export type AgentResult = {
|
|
|
60
66
|
export declare function buildBrandContextMessage(ctx: BrandContext): string;
|
|
61
67
|
export type FileAttachment = {
|
|
62
68
|
name: string;
|
|
63
|
-
type: "image" | "text";
|
|
69
|
+
type: "image" | "text" | "pdf" | "docx";
|
|
64
70
|
dataUrl?: string;
|
|
65
71
|
textContent?: string;
|
|
66
72
|
};
|
|
@@ -436,6 +436,18 @@ export declare const BANNER_TOOLS: readonly [{
|
|
|
436
436
|
readonly additionalProperties: false;
|
|
437
437
|
};
|
|
438
438
|
};
|
|
439
|
+
}, {
|
|
440
|
+
readonly type: "function";
|
|
441
|
+
readonly function: {
|
|
442
|
+
readonly name: "list_frames";
|
|
443
|
+
readonly description: "List all frames currently on the canvas. Returns each frame's id, name, width, height, and child element count. Call this when you need to find a frameId and none was provided by the user.";
|
|
444
|
+
readonly parameters: {
|
|
445
|
+
readonly type: "object";
|
|
446
|
+
readonly properties: {};
|
|
447
|
+
readonly required: readonly [];
|
|
448
|
+
readonly additionalProperties: false;
|
|
449
|
+
};
|
|
450
|
+
};
|
|
439
451
|
}, {
|
|
440
452
|
readonly type: "function";
|
|
441
453
|
readonly function: {
|
|
@@ -611,9 +623,9 @@ export declare function getFrameContext(api: ExcalidrawImperativeAPI, frameId: s
|
|
|
611
623
|
} | null;
|
|
612
624
|
export type ToolExecutionContext = {
|
|
613
625
|
excalidrawAPI: ExcalidrawImperativeAPI;
|
|
614
|
-
|
|
626
|
+
openRouterApiKey: string;
|
|
615
627
|
signal?: AbortSignal;
|
|
616
|
-
/** Override
|
|
628
|
+
/** Override OpenRouter model ID for the agent's generate_image tool. */
|
|
617
629
|
agentImageModel?: string;
|
|
618
630
|
/**
|
|
619
631
|
* Maps lowercase brand font-family names to their registered Excalidraw
|
|
@@ -57,7 +57,7 @@ export declare function runReviewerAgent(opts: {
|
|
|
57
57
|
userBrief: string;
|
|
58
58
|
brandContext?: BrandContext;
|
|
59
59
|
apiKey: string;
|
|
60
|
-
/** OpenRouter model tag. Must be vision-capable. Defaults to
|
|
60
|
+
/** OpenRouter model tag. Must be vision-capable. Defaults to minimax/minimax-m3 */
|
|
61
61
|
reviewerModel?: string;
|
|
62
62
|
signal?: AbortSignal;
|
|
63
63
|
iteration: number;
|
|
@@ -8,6 +8,8 @@ import "./css/styles.scss";
|
|
|
8
8
|
import "./fonts/fonts.css";
|
|
9
9
|
import "./css/tailwind.generated.css";
|
|
10
10
|
import type { ExcalidrawProps } from "./types";
|
|
11
|
+
export { StockImagePanel } from "./components/StockImagePanel";
|
|
12
|
+
export type { StockImagePanelProps, StockImagePhoto, StockImageSearchResult, LibraryImage, LibraryImageResult, LibraryImageFilter, } from "./components/StockImagePanel";
|
|
11
13
|
export declare const Excalidraw: React.MemoExoticComponent<(props: ExcalidrawProps) => import("react/jsx-runtime").JSX.Element>;
|
|
12
14
|
export { getSceneVersion, hashElementsVersion, hashString, getNonDeletedElements, } from "@orangecatai/element";
|
|
13
15
|
export { getTextFromElements } from "@orangecatai/element";
|
|
@@ -565,12 +565,6 @@ export interface ExcalidrawProps {
|
|
|
565
565
|
aiEnabled?: boolean;
|
|
566
566
|
showDeprecatedFonts?: boolean;
|
|
567
567
|
renderScrollbars?: boolean;
|
|
568
|
-
/**
|
|
569
|
-
* Gemini API key for image generation.
|
|
570
|
-
* When provided, takes precedence over the VITE_APP_GEMINI_API_KEY env variable.
|
|
571
|
-
* Required for image generation when using this package as an npm dependency.
|
|
572
|
-
*/
|
|
573
|
-
geminiApiKey?: string;
|
|
574
568
|
/**
|
|
575
569
|
* Leonardo API key for image toolbar upscale action.
|
|
576
570
|
* When provided, takes precedence over the VITE_APP_LEONARDO_API_KEY env variable.
|
|
@@ -630,12 +624,12 @@ export interface ExcalidrawProps {
|
|
|
630
624
|
/** Called after each successfully generated auto-resize dimension. */
|
|
631
625
|
onAfterAutoResize?: () => void;
|
|
632
626
|
/**
|
|
633
|
-
*
|
|
627
|
+
* OpenRouter model ID used for AI image generation — covers both the auto-resize
|
|
634
628
|
* background regeneration and the agent chat `generate_image` tool.
|
|
635
629
|
* Pass the same value here and to `AIChatPanel.agentImageModel` to keep
|
|
636
630
|
* both surfaces on the same model with a single configuration.
|
|
637
|
-
* @default "gemini-3.1-flash-image-preview"
|
|
638
|
-
* @example "gemini-
|
|
631
|
+
* @default "google/gemini-3.1-flash-image-preview"
|
|
632
|
+
* @example "google/gemini-2.5-flash-image"
|
|
639
633
|
*/
|
|
640
634
|
agentImageModel?: string;
|
|
641
635
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function callOpenRouterImageAPI(prompt: string, modelId: string, aspectRatio: string, imageSize: string | null, textOutput: boolean, apiKey: string, referenceImageDataUrl?: string, signal?: AbortSignal): Promise<string>;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{T as a,U as b,V as c}from"../chunk-5GYFLSBF.js";import"../chunk-7XQHY7WT.js";import"../chunk-SRAX5OIU.js";export{c as decodePngMetadata,b as encodePngMetadata,a as getTEXtChunk};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function resolveGeminiApiKey(propKey?: string): string;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|