@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.
Files changed (93) hide show
  1. package/dist/dev/index.js +67 -4
  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/common/src/keys.d.ts +2 -0
  6. package/dist/types/element/src/Scene.d.ts +1 -1
  7. package/dist/types/element/src/frame.d.ts +5 -5
  8. package/dist/types/element/src/newElement.d.ts +10 -1
  9. package/dist/types/element/src/typeChecks.d.ts +2 -1
  10. package/dist/types/element/src/types.d.ts +17 -2
  11. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +1 -1
  12. package/dist/types/excalidraw/actions/actionCanvas.d.ts +177 -0
  13. package/dist/types/excalidraw/actions/actionClipboard.d.ts +7 -7
  14. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +2 -2
  15. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
  16. package/dist/types/excalidraw/actions/actionElementLink.d.ts +6 -6
  17. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +1 -1
  18. package/dist/types/excalidraw/actions/actionFrame.d.ts +219 -0
  19. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +48 -7
  20. package/dist/types/excalidraw/actions/actionLink.d.ts +3 -3
  21. package/dist/types/excalidraw/actions/actionMenu.d.ts +1 -1
  22. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +4 -4
  23. package/dist/types/excalidraw/actions/actionStyles.d.ts +2 -2
  24. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +4 -4
  25. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +3 -3
  26. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +2 -2
  27. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +4 -4
  28. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +4 -4
  29. package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
  30. package/dist/types/excalidraw/actions/index.d.ts +1 -1
  31. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  32. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  33. package/dist/types/excalidraw/components/AIChatPanel.d.ts +176 -0
  34. package/dist/types/excalidraw/components/Actions.d.ts +3 -0
  35. package/dist/types/excalidraw/components/App.d.ts +10 -0
  36. package/dist/types/excalidraw/components/CanvasBackgroundSwatch.d.ts +7 -0
  37. package/dist/types/excalidraw/components/ColorPicker/AdvancedColorPicker.d.ts +8 -0
  38. package/dist/types/excalidraw/components/ColorPicker/colorConversions.d.ts +27 -0
  39. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
  40. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +1 -1
  41. package/dist/types/excalidraw/components/ElementCanvasButtons.d.ts +1 -1
  42. package/dist/types/excalidraw/components/FrameToolbar.d.ts +1 -1
  43. package/dist/types/excalidraw/components/HintViewer.d.ts +1 -1
  44. package/dist/types/excalidraw/components/ImageEditToolbar.d.ts +15 -0
  45. package/dist/types/excalidraw/components/ImageGeneratorPanel.d.ts +59 -13
  46. package/dist/types/excalidraw/components/ImageQuickEditPanel.d.ts +10 -1
  47. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +2 -2
  48. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +1 -1
  49. package/dist/types/excalidraw/components/Stats/index.d.ts +1 -1
  50. package/dist/types/excalidraw/components/StockImagePanel.d.ts +49 -0
  51. package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +1 -0
  52. package/dist/types/excalidraw/components/ToolButton.d.ts +1 -1
  53. package/dist/types/excalidraw/components/VideoElement.d.ts +9 -0
  54. package/dist/types/excalidraw/components/VideoGeneratorPanel.d.ts +149 -0
  55. package/dist/types/excalidraw/components/ai-chat/AdGenShimmerLayer.d.ts +10 -0
  56. package/dist/types/excalidraw/components/ai-chat/adGenShimmerStore.d.ts +12 -0
  57. package/dist/types/excalidraw/components/ai-chat/agentLoop.d.ts +114 -0
  58. package/dist/types/excalidraw/components/ai-chat/audioUtils.d.ts +5 -0
  59. package/dist/types/excalidraw/components/ai-chat/canvasTools.d.ts +752 -0
  60. package/dist/types/excalidraw/components/ai-chat/htmlToExcalidraw.d.ts +53 -0
  61. package/dist/types/excalidraw/components/ai-chat/openRouterStream.d.ts +50 -0
  62. package/dist/types/excalidraw/components/ai-chat/reviewerAgent.d.ts +74 -0
  63. package/dist/types/excalidraw/components/auto-resize/AutoResizePanel.d.ts +17 -0
  64. package/dist/types/excalidraw/components/auto-resize/AutoResizePanelHost.d.ts +4 -0
  65. package/dist/types/excalidraw/components/auto-resize/AutoResizeShimmerLayer.d.ts +11 -0
  66. package/dist/types/excalidraw/components/auto-resize/autoResizeEngine.d.ts +185 -0
  67. package/dist/types/excalidraw/components/auto-resize/autoResizePanelStore.d.ts +15 -0
  68. package/dist/types/excalidraw/components/auto-resize/autoResizeStore.d.ts +16 -0
  69. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +1 -1
  70. package/dist/types/excalidraw/components/icons.d.ts +3 -0
  71. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +5 -1
  72. package/dist/types/excalidraw/components/template-builder/TemplateBuilderPanelHost.d.ts +4 -0
  73. package/dist/types/excalidraw/components/template-builder/TemplateBuilderTray.d.ts +4 -0
  74. package/dist/types/excalidraw/components/template-builder/slotTypes.d.ts +43 -0
  75. package/dist/types/excalidraw/components/template-builder/templateBuilderStore.d.ts +19 -0
  76. package/dist/types/excalidraw/components/ui/avatar.d.ts +6 -0
  77. package/dist/types/excalidraw/components/ui/button.d.ts +11 -0
  78. package/dist/types/excalidraw/components/ui/chat-container.d.ts +17 -0
  79. package/dist/types/excalidraw/components/ui/code-block.d.ts +16 -0
  80. package/dist/types/excalidraw/components/ui/markdown.d.ts +10 -0
  81. package/dist/types/excalidraw/components/ui/message.d.ts +35 -0
  82. package/dist/types/excalidraw/components/ui/scroll-button.d.ts +10 -0
  83. package/dist/types/excalidraw/data/blob.d.ts +4 -1
  84. package/dist/types/excalidraw/fonts/Fonts.d.ts +17 -0
  85. package/dist/types/excalidraw/index.d.ts +13 -1
  86. package/dist/types/excalidraw/scene/types.d.ts +1 -0
  87. package/dist/types/excalidraw/types.d.ts +286 -4
  88. package/dist/types/excalidraw/utils/brandContextUtils.d.ts +23 -0
  89. package/dist/types/excalidraw/utils/imageApi.d.ts +19 -0
  90. package/dist/types/excalidraw/utils/videoApi.d.ts +30 -0
  91. package/dist/types/utils/src/shape.d.ts +2 -2
  92. package/package.json +2 -2
  93. package/dist/types/excalidraw/utils/geminiApiKey.d.ts +0 -1
@@ -0,0 +1,53 @@
1
+ export type ParsedRectangle = {
2
+ kind: "rectangle";
3
+ x: number;
4
+ y: number;
5
+ width: number;
6
+ height: number;
7
+ backgroundColor: string;
8
+ backgroundGradient?: string;
9
+ strokeColor: string;
10
+ strokeWidth: number;
11
+ opacity: number;
12
+ borderRadius: number;
13
+ };
14
+ export type ParsedEllipse = {
15
+ kind: "ellipse";
16
+ x: number;
17
+ y: number;
18
+ width: number;
19
+ height: number;
20
+ backgroundColor: string;
21
+ backgroundGradient?: string;
22
+ strokeColor: string;
23
+ strokeWidth: number;
24
+ opacity: number;
25
+ };
26
+ export type ParsedText = {
27
+ kind: "text";
28
+ x: number;
29
+ y: number;
30
+ width: number;
31
+ height: number;
32
+ text: string;
33
+ fontSize: number;
34
+ fontFamily: number;
35
+ color: string;
36
+ textAlign: "left" | "center" | "right";
37
+ opacity: number;
38
+ };
39
+ export type ParsedImage = {
40
+ kind: "image";
41
+ x: number;
42
+ y: number;
43
+ width: number;
44
+ height: number;
45
+ dataUrl: string;
46
+ };
47
+ export type ParsedElement = ParsedRectangle | ParsedEllipse | ParsedText | ParsedImage;
48
+ /**
49
+ * Render `html` in an off-screen iframe and walk the DOM to produce an
50
+ * array of ParsedElement objects, translated so the root .canvas div sits
51
+ * at (frameX, frameY) in Excalidraw canvas coordinates.
52
+ */
53
+ export declare function htmlToExcalidrawElements(html: string, frameX: number, frameY: number, frameWidth: number, frameHeight: number, customFontMap?: Record<string, number>): Promise<ParsedElement[]>;
@@ -0,0 +1,50 @@
1
+ import type { ToolCall } from "./agentLoop";
2
+ export type OpenRouterDelta = {
3
+ content: string | null;
4
+ toolCalls: Array<{
5
+ index: number;
6
+ id?: string;
7
+ type?: string;
8
+ function?: {
9
+ name?: string;
10
+ arguments?: string;
11
+ };
12
+ }> | null;
13
+ finishReason: string | null;
14
+ };
15
+ export type ToolCallAccumulator = {
16
+ id: string;
17
+ type: "function";
18
+ function: {
19
+ name: string;
20
+ arguments: string;
21
+ };
22
+ };
23
+ /**
24
+ * Parse a single OpenAI-compatible SSE chunk JSON string into a typed delta.
25
+ * Returns null if the JSON is invalid or missing expected structure.
26
+ */
27
+ export declare function parseOpenRouterChunk(jsonStr: string): OpenRouterDelta | null;
28
+ /**
29
+ * Async generator that yields parsed deltas from an OpenRouter streaming
30
+ * response. Reuses `parseSSEStream` for SSE line parsing.
31
+ */
32
+ export declare function streamOpenRouter(response: Response): AsyncGenerator<OpenRouterDelta>;
33
+ /**
34
+ * Accumulate streaming tool call deltas into complete ToolCall objects.
35
+ * OpenRouter sends tool calls in chunks:
36
+ * - First chunk for a tool: has `id`, `type`, `function.name`, empty `function.arguments`
37
+ * - Subsequent chunks: has `function.arguments` fragment to append
38
+ */
39
+ export declare function accumulateToolCalls(accumulated: ToolCallAccumulator[], delta: OpenRouterDelta): ToolCallAccumulator[];
40
+ /**
41
+ * Convert accumulators to the ToolCall type used by the agent loop.
42
+ */
43
+ export declare function finalizeToolCalls(accumulated: ToolCallAccumulator[]): ToolCall[];
44
+ /**
45
+ * Check if a response is a streaming SSE response.
46
+ * Returns true only when the response has a body AND the content-type
47
+ * indicates an SSE stream (`text/event-stream`). Any other content-type
48
+ * (including `application/json` or `text/plain`) falls back to non-streaming.
49
+ */
50
+ export declare function isStreamingResponse(response: Response): boolean;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * reviewerAgent.ts
3
+ *
4
+ * Brand Governance Agent — stateless reviewer that runs after the main agent
5
+ * generates a complete ad image (visuals + all copy baked in) and calls
6
+ * finalize_ad. It receives a focused context (the rendered screenshot, frame
7
+ * dimensions, brand guidelines, original user brief) and returns a precise
8
+ * critique covering creative quality AND brand-governance compliance:
9
+ * copy correctness, brand tone, logo usage, claim accuracy, legal mandatories,
10
+ * offer disclaimers, regulatory sensitivity, prohibited language, competitive
11
+ * claims, and data/privacy concerns.
12
+ *
13
+ * The reviewer is a separate LLM call from the main agent loop so it brings an
14
+ * independent eye to the generated ad. Because the ad is a single image, every
15
+ * fix is applied by regenerating the image with a revised prompt — there is no
16
+ * HTML/CSS layer to patch.
17
+ *
18
+ * @deprecated note (2026-06-17): this reviewer previously audited an HTML text
19
+ * layer composited over a text-free image and emitted CSS-only fixes. That
20
+ * flow is gone — see the image-first agent loop in agentLoop.ts.
21
+ */
22
+ import type { BrandContext } from "../../types";
23
+ export type ReviewIssue = {
24
+ /** Which design element or governance dimension is affected */
25
+ element: "headline" | "subheadline" | "cta" | "image" | "layout" | "brand" | "brand_tone" | "logo" | "claim" | "legal" | "disclaimer" | "regulatory" | "prohibited_language" | "competitive_claim" | "privacy";
26
+ /** How bad it is */
27
+ severity: "critical" | "major" | "minor";
28
+ /** What is wrong — one sentence */
29
+ problem: string;
30
+ /** One-line direction for the fix */
31
+ fix: string;
32
+ /**
33
+ * Precise instruction with numeric coordinates or px values.
34
+ * Examples:
35
+ * "Reduce headline font-size from 72px to 48px"
36
+ * "Move CTA button to x=380,y=440 (bottom-right quadrant)"
37
+ * "Shift text container left boundary from x=0 to x=20 so it clears the image at x=260"
38
+ */
39
+ preciseInstruction: string;
40
+ };
41
+ export type ReviewerFeedback = {
42
+ /** true = no actionable issues; main agent should finalize */
43
+ approved: boolean;
44
+ /** empty when approved */
45
+ issues: ReviewIssue[];
46
+ /** 1-2 sentence overall verdict */
47
+ summary: string;
48
+ /** which reviewer round produced this (1-based) */
49
+ iteration: number;
50
+ };
51
+ export declare function runReviewerAgent(opts: {
52
+ screenshotDataUrl: string;
53
+ htmlSource: string;
54
+ frame: {
55
+ width: number;
56
+ height: number;
57
+ id: string;
58
+ };
59
+ imagePlacement?: {
60
+ x: number;
61
+ y: number;
62
+ width: number;
63
+ height: number;
64
+ };
65
+ /** Original user request — first message only, not full conversation history */
66
+ userBrief: string;
67
+ brandContext?: BrandContext;
68
+ /** Host proxy URL for the reviewer's OpenRouter call. Key stays server-side. */
69
+ chatUrl: string;
70
+ /** OpenRouter model tag. Must be vision-capable. Defaults to minimax/minimax-m3 */
71
+ reviewerModel?: string;
72
+ signal?: AbortSignal;
73
+ iteration: number;
74
+ }): Promise<ReviewerFeedback>;
@@ -0,0 +1,17 @@
1
+ import "./AutoResizePanel.scss";
2
+ import type { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
3
+ import type { AppClassProperties } from "../../types";
4
+ export declare const AutoResizePanel: ({ element, app, onClose, onBeforeAutoResize, onAfterAutoResize, onRunningChange, autoResizeUrl, chatModel, agentImageModel, }: {
5
+ element: NonDeletedExcalidrawElement & ExcalidrawFrameLikeElement;
6
+ app: AppClassProperties;
7
+ onClose: () => void;
8
+ onBeforeAutoResize?: () => Promise<{
9
+ allowed: boolean;
10
+ error?: string;
11
+ }>;
12
+ onAfterAutoResize?: () => void;
13
+ onRunningChange?: (running: boolean) => void;
14
+ autoResizeUrl: string;
15
+ chatModel: string;
16
+ agentImageModel?: string;
17
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import type { AppClassProperties } from "../../types";
2
+ export declare const AutoResizePanelHost: ({ app }: {
3
+ app: AppClassProperties;
4
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Renders shimmer overlays on top of in-progress auto-resize frames.
3
+ * Rendered unconditionally from App.tsx — same React tree as FrameToolbar
4
+ * and ElementCanvasButtons. Uses useExcalidrawAppState() for reactive
5
+ * viewport state (scroll, zoom, offset) so it repositions on every change.
6
+ *
7
+ * IMPORTANT: Reads the CURRENT frame position from the scene elements,
8
+ * not from the stored LoadingFrameInfo. This ensures the shimmer moves
9
+ * with the frame if the user drags it during generation.
10
+ */
11
+ export declare const AutoResizeShimmerLayer: () => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,185 @@
1
+ import type { ExcalidrawElement, ExcalidrawFrameLikeElement } from "@orangecatai/element/types";
2
+ import type { AppClassProperties } from "../../types";
3
+ import type { BinaryFiles } from "../../types";
4
+ export type TargetDimension = {
5
+ width: number;
6
+ height: number;
7
+ label?: string;
8
+ };
9
+ export type DimensionResult = {
10
+ status: "ok";
11
+ frameId: string;
12
+ } | {
13
+ status: "error";
14
+ error: string;
15
+ };
16
+ export type ProgressCallback = (dimensionIndex: number, total: number, phase: "bg-regen" | "layout" | "inserting" | "done" | "error", label: string) => void;
17
+ type ForegroundEl = {
18
+ kind: "text";
19
+ elementId: string;
20
+ slotType?: string;
21
+ relX: number;
22
+ relY: number;
23
+ width: number;
24
+ height: number;
25
+ text: string;
26
+ fontSize: number;
27
+ color: string;
28
+ textAlign: string;
29
+ fontWeight: string;
30
+ opacity: number;
31
+ } | {
32
+ kind: "image";
33
+ elementId: string;
34
+ slotType?: string;
35
+ relX: number;
36
+ relY: number;
37
+ width: number;
38
+ height: number;
39
+ dataUrl: string;
40
+ opacity: number;
41
+ } | {
42
+ kind: "rect";
43
+ elementId: string;
44
+ slotType?: string;
45
+ relX: number;
46
+ relY: number;
47
+ width: number;
48
+ height: number;
49
+ backgroundColor: string;
50
+ borderRadius: number;
51
+ opacity: number;
52
+ };
53
+ type SourceFrameInfo = {
54
+ frame: ExcalidrawFrameLikeElement;
55
+ background: {
56
+ type: "solid";
57
+ color: string;
58
+ elementId?: string;
59
+ } | {
60
+ type: "image";
61
+ dataUrl: string;
62
+ elementId?: string;
63
+ } | {
64
+ type: "none";
65
+ };
66
+ foreground: ForegroundEl[];
67
+ };
68
+ export declare function extractFrameInfo(elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, files: BinaryFiles): SourceFrameInfo;
69
+ export declare function computeCropLoss(sourceAR: number, targetAR: number): number;
70
+ export declare function needsBackgroundRegeneration(srcW: number, srcH: number, tgtW: number, tgtH: number): boolean;
71
+ export declare function nearestGeminiAspectRatio(w: number, h: number): string;
72
+ /**
73
+ * Resolution dimensions available for each aspect ratio in Gemini 3.1 Flash
74
+ * Image (Nano Banana 2). Maps aspect ratio → resolution level → [width, height].
75
+ * Exported so the Auto Resize panel can build its dimension presets from the
76
+ * exact model-supported sizes instead of duplicating the numbers.
77
+ */
78
+ export declare const GEMINI_RESOLUTION_TABLE: Record<string, Record<string, [number, number]>>;
79
+ /**
80
+ * Resolution levels offered by the Auto Resize panel.
81
+ * Nano Banana (gemini-2.5-flash-image) and Nano Banana 2 (gemini-3.1-flash-image-preview)
82
+ * both support 0.5K–4K. 0.5K is the fastest/cheapest tier.
83
+ */
84
+ export declare const AUTO_RESIZE_RESOLUTIONS: readonly ["0.5K", "1K", "2K", "4K"];
85
+ export type AutoResizeResolution = typeof AUTO_RESIZE_RESOLUTIONS[number];
86
+ /**
87
+ * Aspect ratios the Nano Banana 2 / Gemini 3.1 Flash Image model supports,
88
+ * ordered for display (common first, then the ultrawide / extreme-narrow ones).
89
+ * Each carries a human label for the panel.
90
+ */
91
+ export declare const AUTO_RESIZE_ASPECT_RATIOS: {
92
+ ratio: string;
93
+ desc: string;
94
+ }[];
95
+ /**
96
+ * Concrete pixel dimensions for a given aspect ratio + resolution, straight from
97
+ * the Nano Banana 2 resolution table. Falls back to 1:1 / 1K if unknown.
98
+ */
99
+ export declare function geminiDimsFor(ratio: string, resolution: string): {
100
+ width: number;
101
+ height: number;
102
+ };
103
+ /**
104
+ * Selects the optimal resolution for a given target dimension and aspect ratio.
105
+ * Chooses the resolution level that is closest to (but preferably >= ) the target size.
106
+ */
107
+ export declare function selectOptimalResolution(targetW: number, targetH: number, aspectRatio: string): "0.5K" | "1K" | "2K" | "4K";
108
+ /**
109
+ * Returns the x, y, width, height (relative to frame top-left) to place an
110
+ * image such that:
111
+ * - it covers the entire frame (scale up if needed)
112
+ * - the centres of the image and frame coincide
113
+ */
114
+ export declare function fitImageToFrame(imgW: number, imgH: number, frameW: number, frameH: number): {
115
+ relX: number;
116
+ relY: number;
117
+ width: number;
118
+ height: number;
119
+ };
120
+ /**
121
+ * Fit-contain: scale image to fit entirely within the bbox, preserving aspect
122
+ * ratio, centred. Use for foreground elements (logos, product images) where
123
+ * cropping or stretching is not acceptable.
124
+ */
125
+ export declare function containImageInBbox(imgW: number, imgH: number, bboxW: number, bboxH: number): {
126
+ relX: number;
127
+ relY: number;
128
+ width: number;
129
+ height: number;
130
+ };
131
+ export declare function getProductMinBox(targetW: number, targetH: number): {
132
+ minWidth: number;
133
+ minHeight: number;
134
+ };
135
+ export declare function enforceMinProductBox({ x, y, width, height, targetW, targetH, }: {
136
+ x: number;
137
+ y: number;
138
+ width: number;
139
+ height: number;
140
+ targetW: number;
141
+ targetH: number;
142
+ }): {
143
+ x: number;
144
+ y: number;
145
+ width: number;
146
+ height: number;
147
+ };
148
+ export type PreCreatedFrameInfo = {
149
+ frameId: string;
150
+ x: number;
151
+ y: number;
152
+ width: number;
153
+ height: number;
154
+ };
155
+ export declare function preCreateAllFrames(targetDimensions: TargetDimension[], sourceFrame: ExcalidrawFrameLikeElement, app: AppClassProperties): PreCreatedFrameInfo[];
156
+ export declare function runAutoResize(opts: {
157
+ sourceFrameId: string;
158
+ targetDimensions: TargetDimension[];
159
+ app: AppClassProperties;
160
+ autoResizeUrl: string;
161
+ chatModel?: string;
162
+ agentImageModel?: string;
163
+ customFontMap?: Record<string, number>;
164
+ onBeforeAutoResize?: () => Promise<{
165
+ allowed: boolean;
166
+ error?: string;
167
+ }>;
168
+ onAfterAutoResize?: () => void;
169
+ onProgress?: ProgressCallback;
170
+ signal?: AbortSignal;
171
+ /** Pass the result of preCreateAllFrames() to skip redundant frame creation */
172
+ preCreatedFrameInfos?: PreCreatedFrameInfo[];
173
+ /**
174
+ * Brand assets handed to the image model so the recomposed ad keeps the brand
175
+ * logo, typeface, and (for font-aware models) the real font file. Sourced from
176
+ * `app.state.brandContext` by the panel.
177
+ */
178
+ brandImages?: {
179
+ logo?: string;
180
+ fontPreview?: string;
181
+ fontUrl?: string;
182
+ name?: string;
183
+ };
184
+ }): Promise<DimensionResult[]>;
185
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
2
+ export type AutoResizePanelState = {
3
+ element: (NonDeletedExcalidrawElement & ExcalidrawFrameLikeElement) | null;
4
+ isOpen: boolean;
5
+ isRunning: boolean;
6
+ };
7
+ type Listener = (state: AutoResizePanelState) => void;
8
+ export declare const autoResizePanelStore: {
9
+ open(element: NonDeletedExcalidrawElement & ExcalidrawFrameLikeElement): void;
10
+ close(): void;
11
+ setRunning(running: boolean): void;
12
+ getState(): AutoResizePanelState;
13
+ subscribe(fn: Listener): () => void;
14
+ };
15
+ export {};
@@ -0,0 +1,16 @@
1
+ export type LoadingFrameInfo = {
2
+ frameId: string;
3
+ x: number;
4
+ y: number;
5
+ width: number;
6
+ height: number;
7
+ };
8
+ type Listener = () => void;
9
+ export declare const autoResizeStore: {
10
+ setLoadingFrames(frames: LoadingFrameInfo[]): void;
11
+ markComplete(frameId: string): void;
12
+ clear(): void;
13
+ getLoadingFrames(): LoadingFrameInfo[];
14
+ subscribe(fn: Listener): () => void;
15
+ };
16
+ export {};
@@ -1,6 +1,6 @@
1
+ import "./Hyperlink.scss";
1
2
  import type { Scene } from "@orangecatai/element";
2
3
  import type { ElementsMap, ExcalidrawEmbeddableElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
3
- import "./Hyperlink.scss";
4
4
  import type { AppState, ExcalidrawProps, UIAppState } from "../../types";
5
5
  export declare const Hyperlink: ({ element, scene, setAppState, onLinkOpen, setToast, updateEmbedValidationStatus, }: {
6
6
  element: NonDeletedExcalidrawElement;
@@ -33,6 +33,7 @@ export declare const FreedrawIcon: import("react/jsx-runtime").JSX.Element;
33
33
  export declare const TextIcon: import("react/jsx-runtime").JSX.Element;
34
34
  export declare const TextSizeIcon: import("react/jsx-runtime").JSX.Element;
35
35
  export declare const ImageIcon: import("react/jsx-runtime").JSX.Element;
36
+ export declare const VideoIcon: import("react/jsx-runtime").JSX.Element;
36
37
  export declare const EraserIcon: import("react/jsx-runtime").JSX.Element;
37
38
  export declare const ZoomInIcon: import("react/jsx-runtime").JSX.Element;
38
39
  export declare const ZoomOutIcon: import("react/jsx-runtime").JSX.Element;
@@ -188,6 +189,8 @@ export declare const alertTriangleIcon: import("react/jsx-runtime").JSX.Element;
188
189
  export declare const eyeDropperIcon: import("react/jsx-runtime").JSX.Element;
189
190
  export declare const extraToolsIcon: import("react/jsx-runtime").JSX.Element;
190
191
  export declare const frameToolIcon: import("react/jsx-runtime").JSX.Element;
192
+ export declare const imageGeneratorToolIcon: import("react/jsx-runtime").JSX.Element;
193
+ export declare const videoGeneratorToolIcon: import("react/jsx-runtime").JSX.Element;
191
194
  export declare const mermaidLogoIcon: import("react/jsx-runtime").JSX.Element;
192
195
  export declare const RetryIcon: import("react/jsx-runtime").JSX.Element;
193
196
  export declare const stackPushIcon: import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
- import type { Theme } from "@orangecatai/element/types";
2
1
  import "./DefaultItems.scss";
2
+ import type { Theme } from "@orangecatai/element/types";
3
3
  export declare const LoadScene: {
4
4
  (): import("react/jsx-runtime").JSX.Element | null;
5
5
  displayName: string;
@@ -12,6 +12,10 @@ export declare const SaveAsImage: {
12
12
  (): import("react/jsx-runtime").JSX.Element;
13
13
  displayName: string;
14
14
  };
15
+ export declare const UploadVideo: {
16
+ (): import("react/jsx-runtime").JSX.Element;
17
+ displayName: string;
18
+ };
15
19
  export declare const CommandPalette: {
16
20
  (opts?: {
17
21
  className?: string;
@@ -0,0 +1,4 @@
1
+ import type { AppClassProperties } from "../../types";
2
+ export declare const TemplateBuilderPanelHost: ({ app, }: {
3
+ app: AppClassProperties;
4
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ import type { AppClassProperties } from "../../types";
2
+ export declare const TemplateBuilderTray: ({ app }: {
3
+ app: AppClassProperties;
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,43 @@
1
+ export declare const SLOT_TYPES: readonly [{
2
+ readonly id: "background";
3
+ readonly label: "Background";
4
+ readonly color: "#94a3b8";
5
+ readonly kind: "rect";
6
+ }, {
7
+ readonly id: "logo";
8
+ readonly label: "Logo";
9
+ readonly color: "#f97316";
10
+ readonly kind: "image";
11
+ }, {
12
+ readonly id: "product_image";
13
+ readonly label: "Product Image";
14
+ readonly color: "#22c55e";
15
+ readonly kind: "image";
16
+ }, {
17
+ readonly id: "headline";
18
+ readonly label: "Headline";
19
+ readonly color: "#3b82f6";
20
+ readonly kind: "text";
21
+ }, {
22
+ readonly id: "subhead";
23
+ readonly label: "Subhead";
24
+ readonly color: "#8b5cf6";
25
+ readonly kind: "text";
26
+ }, {
27
+ readonly id: "cta";
28
+ readonly label: "CTA";
29
+ readonly color: "#ef4444";
30
+ readonly kind: "text";
31
+ }, {
32
+ readonly id: "signoff";
33
+ readonly label: "Signoff";
34
+ readonly color: "#64748b";
35
+ readonly kind: "text";
36
+ }, {
37
+ readonly id: "auxiliary_image";
38
+ readonly label: "Aux Image";
39
+ readonly color: "#14b8a6";
40
+ readonly kind: "image";
41
+ }];
42
+ export type SlotType = typeof SLOT_TYPES[number];
43
+ export type SlotTypeId = SlotType["id"];
@@ -0,0 +1,19 @@
1
+ export type TemplateBuilderState = {
2
+ isOpen: boolean;
3
+ isBuilding: boolean;
4
+ templateName: string;
5
+ campaignTag: string;
6
+ /** The frame element ID that triggered the template builder (set by FrameToolbar). */
7
+ sourceFrameId: string | null;
8
+ };
9
+ type Listener = (state: TemplateBuilderState) => void;
10
+ export declare const templateBuilderStore: {
11
+ open(sourceFrameId?: string): void;
12
+ close(): void;
13
+ setBuilding(b: boolean): void;
14
+ setName(name: string): void;
15
+ setCampaignTag(tag: string): void;
16
+ getState(): TemplateBuilderState;
17
+ subscribe(fn: Listener): () => void;
18
+ };
19
+ export {};
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import * as AvatarPrimitive from "@radix-ui/react-avatar";
3
+ declare const Avatar: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
4
+ declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
5
+ declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
6
+ export { Avatar, AvatarImage, AvatarFallback };
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "link" | "default" | "outline" | "secondary" | "destructive" | "ghost" | null | undefined;
5
+ size?: "icon" | "default" | "sm" | "lg" | null | undefined;
6
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
7
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
8
+ asChild?: boolean;
9
+ }
10
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
11
+ export { Button, buttonVariants };
@@ -0,0 +1,17 @@
1
+ import * as React from "react";
2
+ export type ChatContainerRootProps = {
3
+ children: React.ReactNode;
4
+ className?: string;
5
+ } & React.HTMLAttributes<HTMLDivElement>;
6
+ export type ChatContainerContentProps = {
7
+ children: React.ReactNode;
8
+ className?: string;
9
+ } & React.HTMLAttributes<HTMLDivElement>;
10
+ export type ChatContainerScrollAnchorProps = {
11
+ className?: string;
12
+ ref?: React.RefObject<HTMLDivElement>;
13
+ } & React.HTMLAttributes<HTMLDivElement>;
14
+ declare function ChatContainerRoot({ children, className, ...props }: ChatContainerRootProps): import("react/jsx-runtime").JSX.Element;
15
+ declare function ChatContainerContent({ children, className, ...props }: ChatContainerContentProps): import("react/jsx-runtime").JSX.Element;
16
+ declare function ChatContainerScrollAnchor({ className, ...props }: ChatContainerScrollAnchorProps): import("react/jsx-runtime").JSX.Element;
17
+ export { ChatContainerRoot, ChatContainerContent, ChatContainerScrollAnchor };
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ export type CodeBlockProps = {
3
+ children?: React.ReactNode;
4
+ className?: string;
5
+ } & React.HTMLProps<HTMLDivElement>;
6
+ declare function CodeBlock({ children, className, ...props }: CodeBlockProps): import("react/jsx-runtime").JSX.Element;
7
+ export type CodeBlockCodeProps = {
8
+ code: string;
9
+ language?: string;
10
+ theme?: string;
11
+ className?: string;
12
+ } & React.HTMLProps<HTMLDivElement>;
13
+ declare function CodeBlockCode({ code, language, theme, className, ...props }: CodeBlockCodeProps): import("react/jsx-runtime").JSX.Element;
14
+ export type CodeBlockGroupProps = React.HTMLAttributes<HTMLDivElement>;
15
+ declare function CodeBlockGroup({ children, className, ...props }: CodeBlockGroupProps): import("react/jsx-runtime").JSX.Element;
16
+ export { CodeBlockGroup, CodeBlockCode, CodeBlock };
@@ -0,0 +1,10 @@
1
+ import type { Components } from "react-markdown";
2
+ export type MarkdownProps = {
3
+ children: string;
4
+ id?: string;
5
+ className?: string;
6
+ components?: Partial<Components>;
7
+ };
8
+ declare function MarkdownComponent({ children, id, className, components, }: MarkdownProps): import("react/jsx-runtime").JSX.Element;
9
+ declare const Markdown: import("react").MemoExoticComponent<typeof MarkdownComponent>;
10
+ export { Markdown };
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { Markdown } from "./markdown";
3
+ import { Tooltip } from "@/components/ui/tooltip";
4
+ export type MessageProps = {
5
+ children: React.ReactNode;
6
+ className?: string;
7
+ } & React.HTMLProps<HTMLDivElement>;
8
+ declare const Message: ({ children, className, ...props }: MessageProps) => import("react/jsx-runtime").JSX.Element;
9
+ export type MessageAvatarProps = {
10
+ src: string;
11
+ alt: string;
12
+ fallback?: string;
13
+ delayMs?: number;
14
+ className?: string;
15
+ };
16
+ declare const MessageAvatar: ({ src, alt, fallback, delayMs, className, }: MessageAvatarProps) => import("react/jsx-runtime").JSX.Element;
17
+ export type MessageContentProps = {
18
+ children: React.ReactNode;
19
+ markdown?: boolean;
20
+ className?: string;
21
+ } & React.ComponentProps<typeof Markdown> & React.HTMLProps<HTMLDivElement>;
22
+ declare const MessageContent: ({ children, markdown, className, ...props }: MessageContentProps) => import("react/jsx-runtime").JSX.Element;
23
+ export type MessageActionsProps = {
24
+ children: React.ReactNode;
25
+ className?: string;
26
+ } & React.HTMLProps<HTMLDivElement>;
27
+ declare const MessageActions: ({ children, className, ...props }: MessageActionsProps) => import("react/jsx-runtime").JSX.Element;
28
+ export type MessageActionProps = {
29
+ className?: string;
30
+ tooltip: React.ReactNode;
31
+ children: React.ReactNode;
32
+ side?: "top" | "bottom" | "left" | "right";
33
+ } & React.ComponentProps<typeof Tooltip>;
34
+ declare const MessageAction: ({ tooltip, children, className, side, ...props }: MessageActionProps) => import("react/jsx-runtime").JSX.Element;
35
+ export { Message, MessageAvatar, MessageContent, MessageActions, MessageAction, };