@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,149 @@
|
|
|
1
|
+
import "./VideoGeneratorPanel.scss";
|
|
2
|
+
import type { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
|
|
3
|
+
import type { AppClassProperties } from "../types";
|
|
4
|
+
declare const VIDEO_MODEL_CONFIG: {
|
|
5
|
+
readonly "veo 3.1 fast": {
|
|
6
|
+
readonly modelId: "google/veo-3.1-fast";
|
|
7
|
+
readonly supportsFirstFrame: true;
|
|
8
|
+
readonly supportsLastFrame: true;
|
|
9
|
+
readonly audioMode: "always-on";
|
|
10
|
+
readonly supportsDuration: true;
|
|
11
|
+
readonly durationMode: "choices";
|
|
12
|
+
readonly durationValues: readonly [4, 6, 8];
|
|
13
|
+
readonly supportsResolution: true;
|
|
14
|
+
readonly supportedResolutions: readonly ["720p", "1080p", "4K"];
|
|
15
|
+
readonly supportsNegativePrompt: false;
|
|
16
|
+
readonly supportedRatios: readonly ["16:9", "9:16"];
|
|
17
|
+
readonly frameInputMode: "dual-frame";
|
|
18
|
+
readonly supportsInputReferences: false;
|
|
19
|
+
readonly supportsSeed: true;
|
|
20
|
+
};
|
|
21
|
+
readonly "veo 3.1 lite": {
|
|
22
|
+
readonly modelId: "google/veo-3.1-lite";
|
|
23
|
+
readonly supportsFirstFrame: true;
|
|
24
|
+
readonly supportsLastFrame: true;
|
|
25
|
+
readonly audioMode: "always-on";
|
|
26
|
+
readonly supportsDuration: true;
|
|
27
|
+
readonly durationMode: "choices";
|
|
28
|
+
readonly durationValues: readonly [4, 6, 8];
|
|
29
|
+
readonly supportsResolution: true;
|
|
30
|
+
readonly supportedResolutions: readonly ["720p", "1080p"];
|
|
31
|
+
readonly supportsNegativePrompt: false;
|
|
32
|
+
readonly supportedRatios: readonly ["16:9", "9:16"];
|
|
33
|
+
readonly frameInputMode: "dual-frame";
|
|
34
|
+
readonly supportsInputReferences: false;
|
|
35
|
+
readonly supportsSeed: true;
|
|
36
|
+
};
|
|
37
|
+
readonly "kling v3 pro": {
|
|
38
|
+
readonly modelId: "kwaivgi/kling-v3.0-pro";
|
|
39
|
+
readonly supportsFirstFrame: true;
|
|
40
|
+
readonly supportsLastFrame: true;
|
|
41
|
+
readonly audioMode: "toggle";
|
|
42
|
+
readonly supportsDuration: true;
|
|
43
|
+
readonly durationMode: "slider";
|
|
44
|
+
readonly minDuration: 3;
|
|
45
|
+
readonly maxDuration: 15;
|
|
46
|
+
readonly supportsResolution: false;
|
|
47
|
+
readonly supportsNegativePrompt: true;
|
|
48
|
+
readonly supportedRatios: readonly ["16:9", "9:16", "1:1"];
|
|
49
|
+
readonly frameInputMode: "dual-frame";
|
|
50
|
+
readonly supportsInputReferences: false;
|
|
51
|
+
readonly supportsSeed: true;
|
|
52
|
+
};
|
|
53
|
+
readonly "kling v3 std": {
|
|
54
|
+
readonly modelId: "kwaivgi/kling-v3.0-std";
|
|
55
|
+
readonly supportsFirstFrame: true;
|
|
56
|
+
readonly supportsLastFrame: true;
|
|
57
|
+
readonly audioMode: "toggle";
|
|
58
|
+
readonly supportsDuration: true;
|
|
59
|
+
readonly durationMode: "slider";
|
|
60
|
+
readonly minDuration: 3;
|
|
61
|
+
readonly maxDuration: 15;
|
|
62
|
+
readonly supportsResolution: false;
|
|
63
|
+
readonly supportsNegativePrompt: true;
|
|
64
|
+
readonly supportedRatios: readonly ["16:9", "9:16", "1:1"];
|
|
65
|
+
readonly frameInputMode: "dual-frame";
|
|
66
|
+
readonly supportsInputReferences: false;
|
|
67
|
+
readonly supportsSeed: true;
|
|
68
|
+
};
|
|
69
|
+
readonly "seedance 2.0": {
|
|
70
|
+
readonly modelId: "bytedance/seedance-2.0";
|
|
71
|
+
readonly supportsFirstFrame: true;
|
|
72
|
+
readonly supportsLastFrame: true;
|
|
73
|
+
readonly audioMode: "always-on";
|
|
74
|
+
readonly supportsDuration: true;
|
|
75
|
+
readonly durationMode: "slider";
|
|
76
|
+
readonly minDuration: 4;
|
|
77
|
+
readonly maxDuration: 15;
|
|
78
|
+
readonly supportsResolution: true;
|
|
79
|
+
readonly supportedResolutions: readonly ["480p", "720p", "1080p", "4K"];
|
|
80
|
+
readonly supportsNegativePrompt: false;
|
|
81
|
+
readonly supportedRatios: readonly ["16:9", "9:16", "1:1", "4:3", "3:4", "21:9", "9:21"];
|
|
82
|
+
readonly frameInputMode: "dual-frame";
|
|
83
|
+
readonly supportsInputReferences: true;
|
|
84
|
+
readonly supportsSeed: true;
|
|
85
|
+
};
|
|
86
|
+
readonly "seedance 2.0 fast": {
|
|
87
|
+
readonly modelId: "bytedance/seedance-2.0-fast";
|
|
88
|
+
readonly supportsFirstFrame: true;
|
|
89
|
+
readonly supportsLastFrame: true;
|
|
90
|
+
readonly audioMode: "always-on";
|
|
91
|
+
readonly supportsDuration: true;
|
|
92
|
+
readonly durationMode: "slider";
|
|
93
|
+
readonly minDuration: 4;
|
|
94
|
+
readonly maxDuration: 15;
|
|
95
|
+
readonly supportsResolution: true;
|
|
96
|
+
readonly supportedResolutions: readonly ["480p", "720p"];
|
|
97
|
+
readonly supportsNegativePrompt: false;
|
|
98
|
+
readonly supportedRatios: readonly ["16:9", "9:16", "1:1", "4:3", "3:4", "21:9", "9:21"];
|
|
99
|
+
readonly frameInputMode: "dual-frame";
|
|
100
|
+
readonly supportsInputReferences: true;
|
|
101
|
+
readonly supportsSeed: true;
|
|
102
|
+
};
|
|
103
|
+
readonly "happyhorse 1.1": {
|
|
104
|
+
readonly modelId: "alibaba/happyhorse-1.1";
|
|
105
|
+
readonly supportsFirstFrame: true;
|
|
106
|
+
readonly supportsLastFrame: false;
|
|
107
|
+
readonly audioMode: "none";
|
|
108
|
+
readonly supportsDuration: true;
|
|
109
|
+
readonly durationMode: "slider";
|
|
110
|
+
readonly minDuration: 3;
|
|
111
|
+
readonly maxDuration: 15;
|
|
112
|
+
readonly supportsResolution: true;
|
|
113
|
+
readonly supportedResolutions: readonly ["720p", "1080p"];
|
|
114
|
+
readonly supportsNegativePrompt: false;
|
|
115
|
+
readonly supportedRatios: readonly ["16:9", "9:16", "1:1", "4:3", "3:4", "21:9", "9:21"];
|
|
116
|
+
readonly frameInputMode: "start-only";
|
|
117
|
+
readonly supportsInputReferences: false;
|
|
118
|
+
readonly supportsSeed: true;
|
|
119
|
+
};
|
|
120
|
+
readonly "grok video": {
|
|
121
|
+
readonly modelId: "x-ai/grok-imagine-video";
|
|
122
|
+
readonly supportsFirstFrame: true;
|
|
123
|
+
readonly supportsLastFrame: false;
|
|
124
|
+
readonly audioMode: "none";
|
|
125
|
+
readonly supportsDuration: true;
|
|
126
|
+
readonly durationMode: "slider";
|
|
127
|
+
readonly minDuration: 1;
|
|
128
|
+
readonly maxDuration: 15;
|
|
129
|
+
readonly supportsResolution: true;
|
|
130
|
+
readonly supportedResolutions: readonly ["480p", "720p"];
|
|
131
|
+
readonly supportsNegativePrompt: false;
|
|
132
|
+
readonly supportedRatios: readonly ["16:9", "9:16", "1:1", "4:3", "3:4", "3:2", "2:3"];
|
|
133
|
+
readonly frameInputMode: "start-only";
|
|
134
|
+
readonly supportsInputReferences: false;
|
|
135
|
+
readonly supportsSeed: true;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
export type VideoModelName = keyof typeof VIDEO_MODEL_CONFIG;
|
|
139
|
+
export declare const VIDEO_MODEL_NAMES: VideoModelName[];
|
|
140
|
+
export declare const VideoGeneratorPanel: ({ element, app, onBeforeVideoGen, onAfterVideoGen, }: {
|
|
141
|
+
element: NonDeletedExcalidrawElement & ExcalidrawFrameLikeElement;
|
|
142
|
+
app: AppClassProperties;
|
|
143
|
+
onBeforeVideoGen?: () => Promise<{
|
|
144
|
+
allowed: boolean;
|
|
145
|
+
error?: string;
|
|
146
|
+
}>;
|
|
147
|
+
onAfterVideoGen?: () => void;
|
|
148
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
149
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders a shimmer overlay on top of frames that are currently being
|
|
3
|
+
* generated by the AI chat agent (create_frame → generate_image → review).
|
|
4
|
+
*
|
|
5
|
+
* Rendered unconditionally from App.tsx alongside AutoResizeShimmerLayer.
|
|
6
|
+
* Uses useExcalidrawAppState() so it repositions correctly on scroll/zoom.
|
|
7
|
+
* Reads current frame position from scene elements so it follows the frame
|
|
8
|
+
* if the user drags it during generation.
|
|
9
|
+
*/
|
|
10
|
+
export declare const AdGenShimmerLayer: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type AdGenFrameInfo = {
|
|
2
|
+
frameId: string;
|
|
3
|
+
};
|
|
4
|
+
type Listener = () => void;
|
|
5
|
+
export declare const adGenShimmerStore: {
|
|
6
|
+
startGenerating(frameId: string): void;
|
|
7
|
+
stopGenerating(frameId: string): void;
|
|
8
|
+
clear(): void;
|
|
9
|
+
getLoadingFrames(): AdGenFrameInfo[];
|
|
10
|
+
subscribe(fn: Listener): () => void;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { type ToolExecutionContext } from "./canvasTools";
|
|
2
|
+
import type { BrandContext } from "../../types";
|
|
3
|
+
type ContentPart = {
|
|
4
|
+
type: "text";
|
|
5
|
+
text: string;
|
|
6
|
+
} | {
|
|
7
|
+
type: "image_url";
|
|
8
|
+
image_url: {
|
|
9
|
+
url: string;
|
|
10
|
+
};
|
|
11
|
+
} | {
|
|
12
|
+
type: "file";
|
|
13
|
+
file: {
|
|
14
|
+
filename: string;
|
|
15
|
+
file_data: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export type AgentMessage = {
|
|
19
|
+
role: "system";
|
|
20
|
+
content: string;
|
|
21
|
+
} | {
|
|
22
|
+
role: "user";
|
|
23
|
+
content: string | ContentPart[];
|
|
24
|
+
} | {
|
|
25
|
+
role: "assistant";
|
|
26
|
+
content: string | null;
|
|
27
|
+
tool_calls?: ToolCall[];
|
|
28
|
+
} | {
|
|
29
|
+
role: "tool";
|
|
30
|
+
tool_call_id: string;
|
|
31
|
+
content: string;
|
|
32
|
+
};
|
|
33
|
+
export type ToolCall = {
|
|
34
|
+
id: string;
|
|
35
|
+
type: "function";
|
|
36
|
+
function: {
|
|
37
|
+
name: string;
|
|
38
|
+
arguments: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export type ToolAction = {
|
|
42
|
+
result: {
|
|
43
|
+
success: boolean;
|
|
44
|
+
statusMessage: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export type AgentUpdate = {
|
|
48
|
+
type: "status" | "tool_start" | "tool_done" | "final" | "content_delta";
|
|
49
|
+
message: string;
|
|
50
|
+
toolAction?: ToolAction;
|
|
51
|
+
} | {
|
|
52
|
+
type: "review_start";
|
|
53
|
+
message: string;
|
|
54
|
+
} | {
|
|
55
|
+
type: "review_done";
|
|
56
|
+
message: string;
|
|
57
|
+
feedback: import("./reviewerAgent").ReviewerFeedback;
|
|
58
|
+
};
|
|
59
|
+
export type AgentResult = {
|
|
60
|
+
reply: string;
|
|
61
|
+
toolActions: ToolAction[];
|
|
62
|
+
};
|
|
63
|
+
export type FileAttachment = {
|
|
64
|
+
name: string;
|
|
65
|
+
type: "image" | "text" | "pdf" | "docx";
|
|
66
|
+
dataUrl?: string;
|
|
67
|
+
textContent?: string;
|
|
68
|
+
};
|
|
69
|
+
export declare function runAgentLoop(opts: {
|
|
70
|
+
userMessages: Array<{
|
|
71
|
+
role: "user" | "assistant";
|
|
72
|
+
content: string;
|
|
73
|
+
/** Images attached to THIS specific message (from the user's upload history) */
|
|
74
|
+
imageAttachments?: Array<{
|
|
75
|
+
name: string;
|
|
76
|
+
dataUrl: string;
|
|
77
|
+
}>;
|
|
78
|
+
}>;
|
|
79
|
+
elementContext?: string;
|
|
80
|
+
frameScreenshot?: string;
|
|
81
|
+
fileAttachments?: FileAttachment[];
|
|
82
|
+
webSearchEnabled?: boolean;
|
|
83
|
+
chatUrl: string;
|
|
84
|
+
chatModel?: string;
|
|
85
|
+
agentImageModel?: string;
|
|
86
|
+
toolCtx: ToolExecutionContext;
|
|
87
|
+
onUpdate: (update: AgentUpdate) => void;
|
|
88
|
+
signal?: AbortSignal;
|
|
89
|
+
onBeforeImageGen?: () => Promise<{
|
|
90
|
+
allowed: boolean;
|
|
91
|
+
error?: string;
|
|
92
|
+
}>;
|
|
93
|
+
onAfterImageGen?: () => void;
|
|
94
|
+
/** Optional brand identity context — injected as a system message before user messages. */
|
|
95
|
+
brandContext?: BrandContext;
|
|
96
|
+
/**
|
|
97
|
+
* @deprecated Font IDs are now derived from brandContext.typography.fontFamilyId.
|
|
98
|
+
* Kept for API compatibility but no longer used internally.
|
|
99
|
+
*/
|
|
100
|
+
customFontIds?: number[];
|
|
101
|
+
/**
|
|
102
|
+
* OpenRouter model tag for the reviewer agent. Must be vision-capable.
|
|
103
|
+
* Defaults to the same model as chatModel.
|
|
104
|
+
*/
|
|
105
|
+
reviewerModel?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Maximum number of reviewer rounds per banner.
|
|
108
|
+
* After this many rounds the reviewer is skipped and the outer MAX_ITERATIONS
|
|
109
|
+
* cap handles loop termination.
|
|
110
|
+
* @default 2
|
|
111
|
+
*/
|
|
112
|
+
maxReviewRounds?: number;
|
|
113
|
+
}): Promise<AgentResult>;
|
|
114
|
+
export {};
|