@orangecatai/adgen-canvas 0.0.25 → 0.0.27

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 (33) hide show
  1. package/dist/dev/{chunk-RPBS5GNJ.js → chunk-H7FMBIGC.js} +2 -2
  2. package/dist/dev/{chunk-QEU5XBGX.js → chunk-S3VKJDL2.js} +3 -3
  3. package/dist/dev/data/{image-3SGMKXEK.js → image-3CYK2GU4.js} +3 -3
  4. package/dist/dev/index.css +159 -0
  5. package/dist/dev/index.css.map +3 -3
  6. package/dist/dev/index.js +3380 -2345
  7. package/dist/dev/index.js.map +4 -4
  8. package/dist/dev/subset-shared.chunk.js +1 -1
  9. package/dist/dev/subset-worker.chunk.js +1 -1
  10. package/dist/prod/{chunk-JVKQD63G.js → chunk-AO5DXVZ2.js} +1 -1
  11. package/dist/prod/{chunk-Q6JGYK3N.js → chunk-SGW23N4D.js} +2 -2
  12. package/dist/prod/data/image-GV5PHJOS.js +1 -0
  13. package/dist/prod/index.css +1 -1
  14. package/dist/prod/index.js +49 -48
  15. package/dist/prod/subset-shared.chunk.js +1 -1
  16. package/dist/prod/subset-worker.chunk.js +1 -1
  17. package/dist/types/common/src/keys.d.ts +2 -0
  18. package/dist/types/excalidraw/actions/actionGenerators.d.ts +34 -0
  19. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  20. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  21. package/dist/types/excalidraw/components/App.d.ts +1 -0
  22. package/dist/types/excalidraw/components/CampaignDropdown.d.ts +14 -0
  23. package/dist/types/excalidraw/components/ImageGeneratorPanel.d.ts +14 -0
  24. package/dist/types/excalidraw/components/VideoElement.d.ts +17 -1
  25. package/dist/types/excalidraw/components/auto-resize/AutoResizePanel.d.ts +3 -1
  26. package/dist/types/excalidraw/components/auto-resize/autoResizeEngine.d.ts +9 -0
  27. package/dist/types/excalidraw/index.d.ts +1 -0
  28. package/dist/types/excalidraw/types.d.ts +74 -0
  29. package/package.json +1 -1
  30. package/dist/prod/data/image-ZZTLAGXX.js +0 -1
  31. /package/dist/dev/{chunk-RPBS5GNJ.js.map → chunk-H7FMBIGC.js.map} +0 -0
  32. /package/dist/dev/{chunk-QEU5XBGX.js.map → chunk-S3VKJDL2.js.map} +0 -0
  33. /package/dist/dev/data/{image-3SGMKXEK.js.map → image-3CYK2GU4.js.map} +0 -0
@@ -1 +1 @@
1
- import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-JVKQD63G.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
1
+ import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-AO5DXVZ2.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-JVKQD63G.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};
1
+ import{a as r,c as t}from"./chunk-Z5NKEFVG.js";import"./chunk-AO5DXVZ2.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};
@@ -55,6 +55,7 @@ export declare const KEYS: {
55
55
  readonly I: "i";
56
56
  readonly J: "j";
57
57
  readonly L: "l";
58
+ readonly M: "m";
58
59
  readonly O: "o";
59
60
  readonly P: "p";
60
61
  readonly Q: "q";
@@ -111,6 +112,7 @@ export declare const KeyCodeMap: Map<ValueOf<{
111
112
  readonly I: "i";
112
113
  readonly J: "j";
113
114
  readonly L: "l";
115
+ readonly M: "m";
114
116
  readonly O: "o";
115
117
  readonly P: "p";
116
118
  readonly Q: "q";
@@ -0,0 +1,34 @@
1
+ export declare const actionOpenImageGenerator: {
2
+ name: "openImageGenerator";
3
+ label: string;
4
+ icon: import("react/jsx-runtime").JSX.Element;
5
+ viewMode: false;
6
+ trackEvent: {
7
+ category: "toolbar";
8
+ };
9
+ perform: (elements: readonly import("@orangecatai/element/types").OrderedExcalidrawElement[], appState: Readonly<import("..").AppState>, _: unknown, app: import("../types").AppClassProperties) => {
10
+ elements: null;
11
+ appState: null;
12
+ captureUpdate: "EVENTUALLY";
13
+ };
14
+ keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
15
+ } & {
16
+ keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
17
+ };
18
+ export declare const actionOpenVideoGenerator: {
19
+ name: "openVideoGenerator";
20
+ label: string;
21
+ icon: import("react/jsx-runtime").JSX.Element;
22
+ viewMode: false;
23
+ trackEvent: {
24
+ category: "toolbar";
25
+ };
26
+ perform: (elements: readonly import("@orangecatai/element/types").OrderedExcalidrawElement[], appState: Readonly<import("..").AppState>, _: unknown, app: import("../types").AppClassProperties) => {
27
+ elements: null;
28
+ appState: null;
29
+ captureUpdate: "EVENTUALLY";
30
+ };
31
+ keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
32
+ } & {
33
+ keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
34
+ };
@@ -1,4 +1,4 @@
1
1
  import type { SubtypeOf } from "@orangecatai/common/utility-types";
2
2
  import type { ActionName } from "./types";
3
- export type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "clearCanvas" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "group" | "ungroup" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleElementLock" | "resetZoom" | "zoomOut" | "zoomIn" | "zoomToFit" | "zoomToFitSelectionInViewport" | "zoomToFitSelection" | "toggleEraserTool" | "toggleHandTool" | "setFrameAsActiveTool" | "cycleThroughFrameChildren" | "saveFileToDisk" | "saveToActiveFile" | "toggleShortcuts" | "wrapSelectionInFrame"> | "saveScene" | "imageExport" | "commandPalette" | "searchMenu" | "toolLock";
3
+ export type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "clearCanvas" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "group" | "ungroup" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleElementLock" | "resetZoom" | "zoomOut" | "zoomIn" | "zoomToFit" | "zoomToFitSelectionInViewport" | "zoomToFitSelection" | "toggleEraserTool" | "toggleHandTool" | "setFrameAsActiveTool" | "cycleThroughFrameChildren" | "openImageGenerator" | "openVideoGenerator" | "saveFileToDisk" | "saveToActiveFile" | "toggleShortcuts" | "wrapSelectionInFrame"> | "saveScene" | "imageExport" | "commandPalette" | "searchMenu" | "toolLock";
4
4
  export declare const getShortcutFromShortcutName: (name: ShortcutName, idx?: number) => string;
@@ -14,7 +14,7 @@ export type ActionResult = {
14
14
  type ActionFn<TData = any> = (elements: readonly OrderedExcalidrawElement[], appState: Readonly<AppState>, formData: TData | undefined, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
15
15
  export type UpdaterFn = (res: ActionResult) => void;
16
16
  export type ActionFilterFn = (action: Action) => void;
17
- export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeArrowProperties" | "changeOpacity" | "changeFontSize" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "scrollBackToContent" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu" | "copyElementLink" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "cycleThroughFrameChildren" | "toggleLassoTool" | "toggleShapeSwitch" | "togglePolygon";
17
+ export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeArrowProperties" | "changeOpacity" | "changeFontSize" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "scrollBackToContent" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "openImageGenerator" | "openVideoGenerator" | "createContainerFromText" | "wrapTextInContainer" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu" | "copyElementLink" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "cycleThroughFrameChildren" | "toggleLassoTool" | "toggleShapeSwitch" | "togglePolygon";
18
18
  export type PanelComponentProps = {
19
19
  elements: readonly ExcalidrawElement[];
20
20
  appState: AppState;
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@orangecatai/common";
3
3
  import { LinearElementEditor, FlowChartCreator, Scene, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@orangecatai/element";
4
+ import "../actions/actionGenerators";
4
5
  import { ActionManager } from "../actions/manager";
5
6
  import { AnimationFrameHandler } from "../animation-frame-handler";
6
7
  import { Fonts } from "../fonts";
@@ -0,0 +1,14 @@
1
+ import "./CampaignDropdown.scss";
2
+ import type { CampaignSummary } from "../types";
3
+ export declare const CampaignDropdown: ({ onFetchCampaigns, onCreateCampaign, onAdd, disabled, disabledReason, }: {
4
+ onFetchCampaigns?: () => Promise<{
5
+ campaigns: CampaignSummary[];
6
+ }>;
7
+ onCreateCampaign?: (name: string) => Promise<CampaignSummary>;
8
+ onAdd?: (campaignId: string) => Promise<{
9
+ ok: boolean;
10
+ error?: string;
11
+ }>;
12
+ disabled?: boolean;
13
+ disabledReason?: string;
14
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -65,6 +65,20 @@ export declare const MODEL_CONFIG: {
65
65
  readonly supportedResolutions: readonly ["1K", "2K", "4K"];
66
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
67
  };
68
+ readonly "gpt image 1 mini": {
69
+ readonly modelId: "openai/gpt-image-1-mini";
70
+ readonly textOutput: false;
71
+ readonly supportsImageSize: false;
72
+ readonly supportedResolutions: readonly ["1K"];
73
+ readonly supportedRatios: readonly ["1:1", "2:3", "3:2"];
74
+ };
75
+ readonly "gpt image 2": {
76
+ readonly modelId: "openai/gpt-image-2";
77
+ readonly textOutput: false;
78
+ readonly supportsImageSize: false;
79
+ readonly supportedResolutions: readonly ["1K", "2K"];
80
+ readonly supportedRatios: readonly ["21:9", "16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5"];
81
+ };
68
82
  };
69
83
  export type ModelName = keyof typeof MODEL_CONFIG;
70
84
  export declare const MODEL_NAMES: ModelName[];
@@ -1,9 +1,25 @@
1
1
  import type { ExcalidrawVideoElement } from "@orangecatai/element/types";
2
+ import type { CampaignSummary } from "../types";
2
3
  import "./VideoElement.scss";
3
4
  interface VideoElementProps {
4
5
  element: ExcalidrawVideoElement;
5
6
  isActive: boolean;
6
7
  videoDownloadProxyUrl?: string;
8
+ onFetchCampaigns?: () => Promise<{
9
+ campaigns: CampaignSummary[];
10
+ }>;
11
+ onCreateCampaign?: (name: string) => Promise<CampaignSummary>;
12
+ onAddToCampaign?: (payload: {
13
+ kind: "video";
14
+ campaignId: string;
15
+ videoUrl: string;
16
+ mimeType: string;
17
+ width: number;
18
+ height: number;
19
+ }) => Promise<{
20
+ ok: boolean;
21
+ error?: string;
22
+ }>;
7
23
  }
8
- export declare const VideoElement: ({ element, videoDownloadProxyUrl }: VideoElementProps) => import("react/jsx-runtime").JSX.Element;
24
+ export declare const VideoElement: ({ element, videoDownloadProxyUrl, onFetchCampaigns, onCreateCampaign, onAddToCampaign, }: VideoElementProps) => import("react/jsx-runtime").JSX.Element;
9
25
  export {};
@@ -1,7 +1,7 @@
1
1
  import "./AutoResizePanel.scss";
2
2
  import type { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
3
3
  import type { AppClassProperties } from "../../types";
4
- export declare const AutoResizePanel: ({ element, app, onClose, onBeforeAutoResize, onAfterAutoResize, onRunningChange, autoResizeUrl, chatModel, agentImageModel, }: {
4
+ export declare const AutoResizePanel: ({ element, app, onClose, onBeforeAutoResize, onAfterAutoResize, onRunningChange, autoResizeUrl, customResizeUrl, tier1CropUrl, chatModel, agentImageModel, }: {
5
5
  element: NonDeletedExcalidrawElement & ExcalidrawFrameLikeElement;
6
6
  app: AppClassProperties;
7
7
  onClose: () => void;
@@ -12,6 +12,8 @@ export declare const AutoResizePanel: ({ element, app, onClose, onBeforeAutoResi
12
12
  onAfterAutoResize?: () => void;
13
13
  onRunningChange?: (running: boolean) => void;
14
14
  autoResizeUrl: string;
15
+ customResizeUrl?: string;
16
+ tier1CropUrl?: string;
15
17
  chatModel: string;
16
18
  agentImageModel?: string;
17
19
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,13 @@
1
1
  import type { ExcalidrawElement, ExcalidrawFrameLikeElement } from "@orangecatai/element/types";
2
2
  import type { AppClassProperties } from "../../types";
3
3
  import type { BinaryFiles } from "../../types";
4
+ /**
5
+ * True when (targetW, targetH)'s aspect ratio is far from every ratio the
6
+ * generation model natively supports, OR is an extreme ultra-wide/tall ratio
7
+ * prone to element duplication regardless of native support — routes this
8
+ * dimension to `customResizeUrl` when the host has provided one.
9
+ */
10
+ export declare function isBigAspectRatioDelta(targetW: number, targetH: number): boolean;
4
11
  export type TargetDimension = {
5
12
  width: number;
6
13
  height: number;
@@ -158,6 +165,8 @@ export declare function runAutoResize(opts: {
158
165
  targetDimensions: TargetDimension[];
159
166
  app: AppClassProperties;
160
167
  autoResizeUrl: string;
168
+ customResizeUrl?: string;
169
+ tier1CropUrl?: string;
161
170
  chatModel?: string;
162
171
  agentImageModel?: string;
163
172
  customFontMap?: Record<string, number>;
@@ -57,4 +57,5 @@ export type { AppState, BinaryFiles, BinaryFileData, ExcalidrawProps, Excalidraw
57
57
  export type { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, OrderedExcalidrawElement, ExcalidrawElementType, ExcalidrawVideoElement, } from "@orangecatai/element/types";
58
58
  export type { ImageEditToolbarCallbacks } from "./components/ImageEditToolbar";
59
59
  export type { CustomFontSpec, BrandContext } from "./types";
60
+ export type { CampaignSummary, AddToCampaignPayload } from "./types";
60
61
  export type { ReviewerFeedback, ReviewIssue, } from "./components/ai-chat/reviewerAgent";
@@ -521,6 +521,31 @@ export type BrandContext = {
521
521
  */
522
522
  headlineFontUrl?: string;
523
523
  };
524
+ /** A campaign the user can save a frame/video snapshot into. */
525
+ export type CampaignSummary = {
526
+ id: string;
527
+ name: string;
528
+ };
529
+ /**
530
+ * Payload passed to `onAddToCampaign`. `image` carries a rendered PNG blob
531
+ * of the exported frame; `video` carries the video element's existing URL
532
+ * (the host copies the file server-side — it never round-trips the browser).
533
+ */
534
+ export type AddToCampaignPayload = {
535
+ kind: "image";
536
+ campaignId: string;
537
+ blob: Blob;
538
+ mimeType: string;
539
+ width: number;
540
+ height: number;
541
+ } | {
542
+ kind: "video";
543
+ campaignId: string;
544
+ videoUrl: string;
545
+ mimeType: string;
546
+ width: number;
547
+ height: number;
548
+ };
524
549
  export interface ExcalidrawProps {
525
550
  onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
526
551
  onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
@@ -601,6 +626,33 @@ export interface ExcalidrawProps {
601
626
  * planning, vision tagging, HTML generation, reviewer). Key stays server-side.
602
627
  */
603
628
  autoResizeUrl?: string;
629
+ /**
630
+ * Host proxy URL for the Tier-2 (extreme aspect-ratio) custom-resize
631
+ * pipeline. When a target dimension in Auto Resize is far from every
632
+ * aspect ratio the generation model natively supports, the standard
633
+ * generate+cover-crop flow risks cutting foreground elements — the SDK
634
+ * routes that dimension here instead. The SDK POSTs
635
+ * `{ imageDataUrl, targetWidth, targetHeight }` and expects
636
+ * `{ dataUrl: string }` back, already resized to the exact target pixels.
637
+ * Key/credit-gating and the multi-step pipeline (detect/generate/verify/
638
+ * retry/fallback) all live host-side. Falls back to the standard flow when
639
+ * omitted. See the host's `docs/custom-resize-big-delta-spec.md`.
640
+ */
641
+ customResizeUrl?: string;
642
+ /**
643
+ * Host proxy URL for the Tier-1 element-aware crop step. After the
644
+ * standard generate+cover-crop flow generates an image at the nearest
645
+ * native ratio, the SDK POSTs
646
+ * `{ generatedImageDataUrl, sourceImageDataUrl, targetWidth, targetHeight }`
647
+ * here instead of doing a blind dead-center crop locally — the host
648
+ * detects element positions in the generated image and picks a crop
649
+ * window that keeps every critical/important element fully inside it,
650
+ * escalating to the Tier-2 pipeline (via `customResizeUrl`) if no safe
651
+ * crop exists. Expects `{ dataUrl: string }` back, already resized to the
652
+ * exact target pixels. Falls back to the local blind-crop behavior when
653
+ * omitted. See the host's `docs/custom-resize-big-delta-spec.md` §4.3.
654
+ */
655
+ tier1CropUrl?: string;
604
656
  /**
605
657
  * Host proxy URL for the remove.bg toolbar action. The SDK POSTs
606
658
  * `{ imageDataUrl }` and receives `{ imageDataUrl }`. Key stays server-side.
@@ -648,6 +700,28 @@ export interface ExcalidrawProps {
648
700
  onAfterVideoGen?: () => void;
649
701
  /** Host proxy URL for video downloads — works around S3 CORS / presigned-URL expiry. */
650
702
  videoDownloadProxyUrl?: string;
703
+ /**
704
+ * Fetches the user's campaigns for the "Add to campaign" dropdown on the
705
+ * frame toolbar and the video element toolbar. Without this prop, the
706
+ * campaign button is not rendered.
707
+ */
708
+ onFetchCampaigns?: () => Promise<{
709
+ campaigns: CampaignSummary[];
710
+ }>;
711
+ /**
712
+ * Creates a new campaign from the inline "New campaign" row in the
713
+ * dropdown. Returns the created campaign so the SDK can auto-select it.
714
+ */
715
+ onCreateCampaign?: (name: string) => Promise<CampaignSummary>;
716
+ /**
717
+ * Saves a snapshot of the selected frame (exported to PNG) or video
718
+ * element (by its existing URL) into the chosen campaign. This is a
719
+ * free action (no credit gate) since no AI call is involved.
720
+ */
721
+ onAddToCampaign?: (payload: AddToCampaignPayload) => Promise<{
722
+ ok: boolean;
723
+ error?: string;
724
+ }>;
651
725
  /**
652
726
  * Called before a background removal is run (deduct credits, check quota).
653
727
  * Return `{ allowed: false, error: "..." }` to block the operation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orangecatai/adgen-canvas",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "type": "module",
5
5
  "types": "./dist/types/excalidraw/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -1 +0,0 @@
1
- import{S as a,T as b,U as c}from"../chunk-Q6JGYK3N.js";import"../chunk-JVKQD63G.js";import"../chunk-SRAX5OIU.js";export{c as decodePngMetadata,b as encodePngMetadata,a as getTEXtChunk};