@orangecatai/adgen-canvas 0.0.4 → 0.0.6
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-IRIUFXMO.js → chunk-7QYIG5FZ.js} +2 -2
- package/dist/dev/{chunk-3FGOYDLK.js → chunk-CEENA34D.js} +15 -3
- package/dist/dev/{chunk-3FGOYDLK.js.map → chunk-CEENA34D.js.map} +2 -2
- package/dist/dev/data/{image-HH4XNQRO.js → image-YK44DYB7.js} +3 -3
- package/dist/dev/index.css +509 -17
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +2743 -1418
- 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-LUZI7MFZ.js → chunk-GCPOY3UH.js} +3 -3
- package/dist/prod/{chunk-SG4RCQVC.js → chunk-R5LMMFAL.js} +1 -1
- package/dist/prod/data/image-XZPNP25M.js +1 -0
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +37 -37
- 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 +18 -1
- 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/ImageEditToolbar.d.ts +15 -0
- package/dist/types/excalidraw/components/ImageQuickEditPanel.d.ts +5 -1
- package/dist/types/excalidraw/components/ai-chat/agentLoop.d.ts +2 -0
- package/dist/types/excalidraw/components/ai-chat/audioUtils.d.ts +1 -1
- package/dist/types/excalidraw/components/ai-chat/canvasTools.d.ts +2 -0
- package/dist/types/excalidraw/components/icons.d.ts +1 -0
- package/dist/types/excalidraw/index.d.ts +1 -0
- package/dist/types/excalidraw/types.d.ts +42 -0
- package/dist/types/excalidraw/utils/leonardoApiKey.d.ts +1 -0
- package/dist/types/excalidraw/utils/removeBgApiKey.d.ts +1 -0
- package/package.json +1 -1
- package/dist/prod/data/image-J2ZJZU4A.js +0 -1
- /package/dist/dev/{chunk-IRIUFXMO.js.map → chunk-7QYIG5FZ.js.map} +0 -0
- /package/dist/dev/data/{image-HH4XNQRO.js.map → image-YK44DYB7.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-R5LMMFAL.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-R5LMMFAL.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};
|
|
@@ -20,7 +20,7 @@ export type ChatSession = {
|
|
|
20
20
|
messages: ChatMessage[];
|
|
21
21
|
};
|
|
22
22
|
export type AIChatPanelRef = {
|
|
23
|
-
setMessages: (messages: ChatMessage[]) => void;
|
|
23
|
+
setMessages: (messages: ChatMessage[], sessionId?: string) => void;
|
|
24
24
|
send: (text: string) => void;
|
|
25
25
|
};
|
|
26
26
|
export type AIChatPanelProps = {
|
|
@@ -52,5 +52,22 @@ export type AIChatPanelProps = {
|
|
|
52
52
|
error?: string;
|
|
53
53
|
}>;
|
|
54
54
|
onAfterImageGen?: () => void;
|
|
55
|
+
/**
|
|
56
|
+
* OpenRouter model tag for the chat system (both plain chat and agent loop).
|
|
57
|
+
* @default "openai/gpt-4.1-mini"
|
|
58
|
+
* @example "openai/gpt-4o" or "anthropic/claude-sonnet-4"
|
|
59
|
+
*/
|
|
60
|
+
chatModel?: string;
|
|
61
|
+
/**
|
|
62
|
+
* OpenRouter model tag for voice/speech-to-text transcription.
|
|
63
|
+
* @default "mistralai/voxtral-small-24b-2507"
|
|
64
|
+
*/
|
|
65
|
+
voiceModel?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Gemini model ID used by the agent's generate_image tool.
|
|
68
|
+
* @default "gemini-2.5-flash-image"
|
|
69
|
+
* @example "gemini-2.0-flash-preview-image-generation"
|
|
70
|
+
*/
|
|
71
|
+
agentImageModel?: string;
|
|
55
72
|
};
|
|
56
73
|
export declare const AIChatPanel: React.ForwardRefExoticComponent<AIChatPanelProps & React.RefAttributes<AIChatPanelRef>>;
|
|
@@ -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;
|
|
@@ -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
|
+
onUpscale?: () => void;
|
|
7
|
+
onRemoveBG?: () => void;
|
|
8
|
+
onCrop?: () => void;
|
|
9
|
+
onDownload?: () => 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;
|
|
@@ -1,7 +1,7 @@
|
|
|
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, onBeforeImageGen, onAfterImageGen, }: {
|
|
4
|
+
export declare const ImageQuickEditPanel: ({ element, app, onBeforeImageGen, onAfterImageGen, forceOpen, onClose, }: {
|
|
5
5
|
element: ExcalidrawImageElement & NonDeletedExcalidrawElement;
|
|
6
6
|
app: AppClassProperties;
|
|
7
7
|
onBeforeImageGen?: () => Promise<{
|
|
@@ -9,4 +9,8 @@ export declare const ImageQuickEditPanel: ({ element, app, onBeforeImageGen, onA
|
|
|
9
9
|
error?: string;
|
|
10
10
|
}>;
|
|
11
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;
|
|
12
16
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -61,6 +61,8 @@ export declare function runAgentLoop(opts: {
|
|
|
61
61
|
fileAttachments?: FileAttachment[];
|
|
62
62
|
webSearchEnabled?: boolean;
|
|
63
63
|
apiKey: string;
|
|
64
|
+
chatModel?: string;
|
|
65
|
+
agentImageModel?: string;
|
|
64
66
|
toolCtx: ToolExecutionContext;
|
|
65
67
|
onUpdate: (update: AgentUpdate) => void;
|
|
66
68
|
signal?: AbortSignal;
|
|
@@ -7,4 +7,4 @@ export declare function blobToWavBase64(blob: Blob): Promise<string>;
|
|
|
7
7
|
* Sends a base64-encoded audio string to the OpenRouter Voxtral model for
|
|
8
8
|
* transcription. `format` must be "wav" or "mp3".
|
|
9
9
|
*/
|
|
10
|
-
export declare function transcribeAudio(base64Audio: string, format: string, apiKey: string): Promise<string>;
|
|
10
|
+
export declare function transcribeAudio(base64Audio: string, format: string, apiKey: string, voiceModel?: string): Promise<string>;
|
|
@@ -278,6 +278,8 @@ export type ToolExecutionContext = {
|
|
|
278
278
|
excalidrawAPI: ExcalidrawImperativeAPI;
|
|
279
279
|
geminiApiKey: string;
|
|
280
280
|
signal?: AbortSignal;
|
|
281
|
+
/** Override Gemini model ID for the agent's generate_image tool. */
|
|
282
|
+
agentImageModel?: string;
|
|
281
283
|
};
|
|
282
284
|
export type ToolResult = {
|
|
283
285
|
success: boolean;
|
|
@@ -188,6 +188,7 @@ export declare const alertTriangleIcon: import("react/jsx-runtime").JSX.Element;
|
|
|
188
188
|
export declare const eyeDropperIcon: import("react/jsx-runtime").JSX.Element;
|
|
189
189
|
export declare const extraToolsIcon: import("react/jsx-runtime").JSX.Element;
|
|
190
190
|
export declare const frameToolIcon: import("react/jsx-runtime").JSX.Element;
|
|
191
|
+
export declare const imageGeneratorToolIcon: import("react/jsx-runtime").JSX.Element;
|
|
191
192
|
export declare const mermaidLogoIcon: import("react/jsx-runtime").JSX.Element;
|
|
192
193
|
export declare const RetryIcon: import("react/jsx-runtime").JSX.Element;
|
|
193
194
|
export declare const stackPushIcon: import("react/jsx-runtime").JSX.Element;
|
|
@@ -51,3 +51,4 @@ export type { AIChatPanelProps, AIChatPanelRef, ChatMessage, ChatSession, } from
|
|
|
51
51
|
export type { ExcalidrawImperativeAPI } from "./types";
|
|
52
52
|
export type { AppState, BinaryFiles, BinaryFileData, ExcalidrawProps, ExcalidrawInitialDataState, LibraryItem, LibraryItems, SceneData, UnsubscribeCallback, } from "./types";
|
|
53
53
|
export type { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, OrderedExcalidrawElement, ExcalidrawElementType, } from "@orangecatai/element/types";
|
|
54
|
+
export type { ImageEditToolbarCallbacks } from "./components/ImageEditToolbar";
|
|
@@ -497,6 +497,16 @@ export interface ExcalidrawProps {
|
|
|
497
497
|
* Required for image generation when using this package as an npm dependency.
|
|
498
498
|
*/
|
|
499
499
|
geminiApiKey?: string;
|
|
500
|
+
/**
|
|
501
|
+
* Leonardo API key for image toolbar upscale action.
|
|
502
|
+
* When provided, takes precedence over the VITE_APP_LEONARDO_API_KEY env variable.
|
|
503
|
+
*/
|
|
504
|
+
leonardoApiKey?: string;
|
|
505
|
+
/**
|
|
506
|
+
* remove.bg API key for the remove background toolbar action.
|
|
507
|
+
* When provided, takes precedence over the VITE_APP_REMOVE_BG_API_KEY env variable.
|
|
508
|
+
*/
|
|
509
|
+
removeBgApiKey?: string;
|
|
500
510
|
/**
|
|
501
511
|
* Called before any image generation (ImageGeneratorPanel, ImageQuickEditPanel,
|
|
502
512
|
* or agent loop generate_image tool). Return `{ allowed: false }` to block.
|
|
@@ -510,6 +520,37 @@ export interface ExcalidrawProps {
|
|
|
510
520
|
* Called after a successful image generation from any panel or agent tool.
|
|
511
521
|
*/
|
|
512
522
|
onAfterImageGen?: () => void;
|
|
523
|
+
/**
|
|
524
|
+
* Called before an upscale is run (deduct credits, check quota).
|
|
525
|
+
* Return `{ allowed: false, error: "..." }` to block the operation.
|
|
526
|
+
*/
|
|
527
|
+
onBeforeUpscale?: () => Promise<{
|
|
528
|
+
allowed: boolean;
|
|
529
|
+
error?: string;
|
|
530
|
+
}>;
|
|
531
|
+
/** Called after a successful upscale. */
|
|
532
|
+
onAfterUpscale?: () => void;
|
|
533
|
+
/**
|
|
534
|
+
* Called before a background removal is run (deduct credits, check quota).
|
|
535
|
+
* Return `{ allowed: false, error: "..." }` to block the operation.
|
|
536
|
+
*/
|
|
537
|
+
onBeforeRemoveBg?: () => Promise<{
|
|
538
|
+
allowed: boolean;
|
|
539
|
+
error?: string;
|
|
540
|
+
}>;
|
|
541
|
+
/** Called after a successful background removal. */
|
|
542
|
+
onAfterRemoveBg?: () => void;
|
|
543
|
+
/**
|
|
544
|
+
* Show the Library sidebar trigger button. Defaults to `false`.
|
|
545
|
+
* Set to `true` to show the library icon in the top-right area.
|
|
546
|
+
*/
|
|
547
|
+
showLibraryButton?: boolean;
|
|
548
|
+
/**
|
|
549
|
+
* Callbacks for each action in the image edit toolbar
|
|
550
|
+
* (shown when an image element is selected on canvas).
|
|
551
|
+
* When callbacks are omitted, built-in toolbar actions are used.
|
|
552
|
+
*/
|
|
553
|
+
imageEditToolbarCallbacks?: import("./components/ImageEditToolbar").ImageEditToolbarCallbacks;
|
|
513
554
|
}
|
|
514
555
|
export type SceneData = {
|
|
515
556
|
elements?: ImportedDataState["elements"];
|
|
@@ -563,6 +604,7 @@ export type AppProps = Merge<ExcalidrawProps, {
|
|
|
563
604
|
export type AppClassProperties = {
|
|
564
605
|
props: AppProps;
|
|
565
606
|
state: AppState;
|
|
607
|
+
actionManager: App["actionManager"];
|
|
566
608
|
interactiveCanvas: HTMLCanvasElement | null;
|
|
567
609
|
/** static canvas */
|
|
568
610
|
canvas: HTMLCanvasElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveLeonardoApiKey(propKey?: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveRemoveBgApiKey(propKey?: string): string;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{T as a,U as b,V as c}from"../chunk-LUZI7MFZ.js";import"../chunk-SG4RCQVC.js";import"../chunk-SRAX5OIU.js";export{c as decodePngMetadata,b as encodePngMetadata,a as getTEXtChunk};
|
|
File without changes
|
|
File without changes
|