@orangecatai/adgen-canvas 0.0.18 → 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.
Files changed (45) hide show
  1. package/dist/dev/{chunk-IFMURN5W.js → chunk-4K5LIQQU.js} +2 -1
  2. package/dist/dev/chunk-4K5LIQQU.js.map +7 -0
  3. package/dist/dev/{chunk-V5POPSPR.js → chunk-ILOOQ6LL.js} +3 -3
  4. package/dist/dev/{chunk-MCENPNB7.js → chunk-Y6SGUVKW.js} +2 -2
  5. package/dist/dev/data/{image-5TNF6BOW.js → image-MFQPU4SU.js} +3 -3
  6. package/dist/dev/index.css +396 -12
  7. package/dist/dev/index.css.map +3 -3
  8. package/dist/dev/index.js +4776 -3552
  9. package/dist/dev/index.js.map +4 -4
  10. package/dist/dev/locales/{en-ZZQASRYX.js → en-IMRJ2ODG.js} +2 -2
  11. package/dist/dev/subset-shared.chunk.js +1 -1
  12. package/dist/dev/subset-worker.chunk.js +1 -1
  13. package/dist/prod/{chunk-TDDASSRC.js → chunk-3BUGCS63.js} +2 -2
  14. package/dist/prod/{chunk-OH4MQBSI.js → chunk-SDWSFP7L.js} +1 -1
  15. package/dist/prod/{chunk-MSBJ7C4T.js → chunk-TX6PVFUX.js} +3 -3
  16. package/dist/prod/data/image-NBDZMG3P.js +1 -0
  17. package/dist/prod/index.css +1 -1
  18. package/dist/prod/index.js +124 -79
  19. package/dist/prod/locales/{en-RQF5X6GM.js → en-5WIO63S4.js} +1 -1
  20. package/dist/prod/subset-shared.chunk.js +1 -1
  21. package/dist/prod/subset-worker.chunk.js +1 -1
  22. package/dist/types/common/src/keys.d.ts +2 -0
  23. package/dist/types/element/src/frame.d.ts +3 -3
  24. package/dist/types/excalidraw/actions/actionFrame.d.ts +178 -0
  25. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  26. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  27. package/dist/types/excalidraw/components/AIChatPanel.d.ts +25 -8
  28. package/dist/types/excalidraw/components/ImageGeneratorPanel.d.ts +23 -10
  29. package/dist/types/excalidraw/components/StockImagePanel.d.ts +49 -0
  30. package/dist/types/excalidraw/components/ai-chat/agentLoop.d.ts +7 -1
  31. package/dist/types/excalidraw/components/ai-chat/canvasTools.d.ts +14 -2
  32. package/dist/types/excalidraw/components/ai-chat/reviewerAgent.d.ts +1 -1
  33. package/dist/types/excalidraw/components/auto-resize/AutoResizeShimmerLayer.d.ts +4 -0
  34. package/dist/types/excalidraw/components/auto-resize/autoResizeEngine.d.ts +47 -1
  35. package/dist/types/excalidraw/index.d.ts +2 -0
  36. package/dist/types/excalidraw/types.d.ts +3 -9
  37. package/dist/types/excalidraw/utils/imageApi.d.ts +1 -0
  38. package/package.json +3 -3
  39. package/dist/dev/chunk-IFMURN5W.js.map +0 -7
  40. package/dist/prod/data/image-3TR7TIWR.js +0 -1
  41. package/dist/types/excalidraw/utils/geminiApiKey.d.ts +0 -1
  42. /package/dist/dev/{chunk-V5POPSPR.js.map → chunk-ILOOQ6LL.js.map} +0 -0
  43. /package/dist/dev/{chunk-MCENPNB7.js.map → chunk-Y6SGUVKW.js.map} +0 -0
  44. /package/dist/dev/data/{image-5TNF6BOW.js.map → image-MFQPU4SU.js.map} +0 -0
  45. /package/dist/dev/locales/{en-ZZQASRYX.js.map → en-IMRJ2ODG.js.map} +0 -0
@@ -1 +1 @@
1
- import{A,B,C,D,E,F,G,H,I,J,K,L,M,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-MSBJ7C4T.js";import"../chunk-SRAX5OIU.js";export{f as alerts,e as buttons,l as canvasError,G as chat,s as clearCanvasDialog,C as colorPicker,A as colors,K as commandPalette,v as confirmDialog,M as default,i as element,b as elementLink,x as encrypted,p as errorDialog,m as errorSplash,g as errors,q as exportDialog,I as fontList,j as headings,r as helpDialog,k as hints,w as imageExportDialog,L as keys,a as labels,c as library,E as mermaid,D as overwriteConfirm,t as publishDialog,u as publishSuccessDialog,H as quickSearch,o as roomDialog,d as search,n as shareDialog,y as stats,z as toast,h as toolBar,F as ttd,J as userList,B as welcomeScreen};
1
+ import{A,B,C,D,E,F,G,H,I,J,K,L,M,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-TX6PVFUX.js";import"../chunk-SRAX5OIU.js";export{f as alerts,e as buttons,l as canvasError,G as chat,s as clearCanvasDialog,C as colorPicker,A as colors,K as commandPalette,v as confirmDialog,M as default,i as element,b as elementLink,x as encrypted,p as errorDialog,m as errorSplash,g as errors,q as exportDialog,I as fontList,j as headings,r as helpDialog,k as hints,w as imageExportDialog,L as keys,a as labels,c as library,E as mermaid,D as overwriteConfirm,t as publishDialog,u as publishSuccessDialog,H as quickSearch,o as roomDialog,d as search,n as shareDialog,y as stats,z as toast,h as toolBar,F as ttd,J as userList,B as welcomeScreen};
@@ -1 +1 @@
1
- import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-OH4MQBSI.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-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-OH4MQBSI.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-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};
@@ -53,6 +53,7 @@ export declare const KEYS: {
53
53
  readonly G: "g";
54
54
  readonly H: "h";
55
55
  readonly I: "i";
56
+ readonly J: "j";
56
57
  readonly L: "l";
57
58
  readonly O: "o";
58
59
  readonly P: "p";
@@ -108,6 +109,7 @@ export declare const KeyCodeMap: Map<ValueOf<{
108
109
  readonly G: "g";
109
110
  readonly H: "h";
110
111
  readonly I: "i";
112
+ readonly J: "j";
111
113
  readonly L: "l";
112
114
  readonly O: "o";
113
115
  readonly P: "p";
@@ -37,9 +37,9 @@ export declare const getContainingFrame: (element: ExcalidrawElement, elementsMa
37
37
  /** */
38
38
  export declare const filterElementsEligibleAsFrameChildren: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => ExcalidrawElement[];
39
39
  /**
40
- * Retains (or repairs for target frame) the ordering invriant where children
41
- * elements come right before the parent frame:
42
- * [el, el, child, child, frame, el]
40
+ * Retains (or repairs for target frame) the ordering invariant where the frame
41
+ * comes before its children elements:
42
+ * [el, el, frame, child, child, el]
43
43
  *
44
44
  * @returns mutated allElements (same data structure)
45
45
  */
@@ -701,6 +701,184 @@ export declare const actionSetFrameAsActiveTool: {
701
701
  } & {
702
702
  keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
703
703
  };
704
+ export declare const actionCycleThroughFrameChildren: {
705
+ name: "cycleThroughFrameChildren";
706
+ label: string;
707
+ trackEvent: {
708
+ category: "element";
709
+ };
710
+ predicate: (elements: readonly ExcalidrawElement[], appState: AppState, _: import("../types").ExcalidrawProps, app: AppClassProperties) => boolean;
711
+ perform: (elements: readonly import("@orangecatai/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, _: unknown, app: AppClassProperties) => {
712
+ elements: readonly import("@orangecatai/element/types").OrderedExcalidrawElement[];
713
+ appState: Readonly<AppState>;
714
+ captureUpdate: "EVENTUALLY";
715
+ } | {
716
+ elements: readonly import("@orangecatai/element/types").OrderedExcalidrawElement[];
717
+ appState: {
718
+ selectedElementIds: {
719
+ [x: string]: true;
720
+ };
721
+ contextMenu: {
722
+ items: import("../components/ContextMenu").ContextMenuItems;
723
+ top: number;
724
+ left: number;
725
+ } | null;
726
+ showWelcomeScreen: boolean;
727
+ isLoading: boolean;
728
+ errorMessage: React.ReactNode;
729
+ activeEmbeddable: {
730
+ element: import("@orangecatai/element/types").NonDeletedExcalidrawElement;
731
+ state: "hover" | "active";
732
+ } | null;
733
+ newElement: import("@orangecatai/element/types").NonDeleted<import("@orangecatai/element/types").ExcalidrawNonSelectionElement> | null;
734
+ resizingElement: import("@orangecatai/element/types").NonDeletedExcalidrawElement | null;
735
+ multiElement: import("@orangecatai/element/types").NonDeleted<import("@orangecatai/element/types").ExcalidrawLinearElement> | null;
736
+ selectionElement: import("@orangecatai/element/types").NonDeletedExcalidrawElement | null;
737
+ isBindingEnabled: boolean;
738
+ startBoundElement: import("@orangecatai/element/types").NonDeleted<import("@orangecatai/element/types").ExcalidrawBindableElement> | null;
739
+ suggestedBinding: {
740
+ element: import("@orangecatai/element/types").NonDeleted<import("@orangecatai/element/types").ExcalidrawBindableElement>;
741
+ midPoint?: import("@orangecatai/math").GlobalPoint;
742
+ } | null;
743
+ frameToHighlight: import("@orangecatai/element/types").NonDeleted<import("@orangecatai/element/types").ExcalidrawFrameLikeElement> | null;
744
+ frameRendering: {
745
+ enabled: boolean;
746
+ name: boolean;
747
+ outline: boolean;
748
+ clip: boolean;
749
+ };
750
+ editingFrame: string | null;
751
+ elementsToHighlight: import("@orangecatai/element/types").NonDeleted<ExcalidrawElement>[] | null;
752
+ editingTextElement: import("@orangecatai/element/types").NonDeletedExcalidrawElement | null;
753
+ activeTool: {
754
+ lastActiveTool: import("../types").ActiveTool | null;
755
+ locked: boolean;
756
+ fromSelection: boolean;
757
+ } & import("../types").ActiveTool;
758
+ preferredSelectionTool: {
759
+ type: "selection" | "lasso";
760
+ initialized: boolean;
761
+ };
762
+ penMode: boolean;
763
+ penDetected: boolean;
764
+ exportBackground: boolean;
765
+ exportEmbedScene: boolean;
766
+ exportWithDarkMode: boolean;
767
+ exportScale: number;
768
+ currentItemStrokeColor: string;
769
+ currentItemBackgroundColor: string;
770
+ currentItemFillStyle: ExcalidrawElement["fillStyle"];
771
+ currentItemStrokeWidth: number;
772
+ currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
773
+ currentItemRoughness: number;
774
+ currentItemOpacity: number;
775
+ currentItemFontFamily: import("@orangecatai/element/types").FontFamilyValues;
776
+ currentItemFontSize: number;
777
+ currentItemTextAlign: import("@orangecatai/element/types").TextAlign;
778
+ currentItemStartArrowhead: import("@orangecatai/element/types").Arrowhead | null;
779
+ currentItemEndArrowhead: import("@orangecatai/element/types").Arrowhead | null;
780
+ currentHoveredFontFamily: import("@orangecatai/element/types").FontFamilyValues | null;
781
+ currentItemRoundness: import("@orangecatai/element/types").StrokeRoundness;
782
+ currentItemArrowType: "sharp" | "round" | "elbow";
783
+ viewBackgroundColor: string;
784
+ scrollX: number;
785
+ scrollY: number;
786
+ cursorButton: "up" | "down";
787
+ scrolledOutside: boolean;
788
+ name: string | null;
789
+ isResizing: boolean;
790
+ isRotating: boolean;
791
+ zoom: import("../types").Zoom;
792
+ openMenu: "canvas" | null;
793
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
794
+ openSidebar: {
795
+ name: import("../types").SidebarName;
796
+ tab?: import("../types").SidebarTabName;
797
+ } | null;
798
+ openDialog: null | {
799
+ name: "imageExport" | "help" | "jsonExport";
800
+ } | {
801
+ name: "ttd";
802
+ tab: "text-to-diagram" | "mermaid";
803
+ } | {
804
+ name: "commandPalette";
805
+ } | {
806
+ name: "settings";
807
+ } | {
808
+ name: "elementLinkSelector";
809
+ sourceElementId: ExcalidrawElement["id"];
810
+ };
811
+ defaultSidebarDockedPreference: boolean;
812
+ lastPointerDownWith: import("@orangecatai/element/types").PointerType;
813
+ hoveredElementIds: Readonly<{
814
+ [id: string]: true;
815
+ }>;
816
+ previousSelectedElementIds: {
817
+ [id: string]: true;
818
+ };
819
+ selectedElementsAreBeingDragged: boolean;
820
+ shouldCacheIgnoreZoom: boolean;
821
+ toast: {
822
+ message: string;
823
+ closable?: boolean;
824
+ duration?: number;
825
+ } | null;
826
+ zenModeEnabled: boolean;
827
+ theme: import("@orangecatai/element/types").Theme;
828
+ gridSize: number;
829
+ gridStep: number;
830
+ gridModeEnabled: boolean;
831
+ viewModeEnabled: boolean;
832
+ selectedGroupIds: {
833
+ [groupId: string]: boolean;
834
+ };
835
+ editingGroupId: import("@orangecatai/element/types").GroupId | null;
836
+ width: number;
837
+ height: number;
838
+ offsetTop: number;
839
+ offsetLeft: number;
840
+ fileHandle: import("browser-fs-access").FileSystemHandle | null;
841
+ collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
842
+ stats: {
843
+ open: boolean;
844
+ panels: number;
845
+ };
846
+ currentChartType: import("@orangecatai/element/types").ChartType;
847
+ pasteDialog: {
848
+ shown: false;
849
+ data: null;
850
+ } | {
851
+ shown: true;
852
+ data: import("../charts").Spreadsheet;
853
+ };
854
+ showHyperlinkPopup: false | "info" | "editor";
855
+ selectedLinearElement: import("@orangecatai/element").LinearElementEditor | null;
856
+ snapLines: readonly import("../snapping").SnapLine[];
857
+ originSnapOffset: {
858
+ x: number;
859
+ y: number;
860
+ } | null;
861
+ objectsSnapModeEnabled: boolean;
862
+ userToFollow: import("../types").UserToFollow | null;
863
+ followedBy: Set<import("../types").SocketId>;
864
+ isCropping: boolean;
865
+ croppingElementId: ExcalidrawElement["id"] | null;
866
+ searchMatches: Readonly<{
867
+ focusedId: ExcalidrawElement["id"] | null;
868
+ matches: readonly import("../types").SearchMatch[];
869
+ }> | null;
870
+ activeLockedId: string | null;
871
+ lockedMultiSelections: {
872
+ [groupId: string]: true;
873
+ };
874
+ bindMode: import("@orangecatai/element/types").BindMode;
875
+ };
876
+ captureUpdate: "IMMEDIATELY";
877
+ };
878
+ keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
879
+ } & {
880
+ keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
881
+ };
704
882
  export declare const actionWrapSelectionInFrame: {
705
883
  name: "wrapSelectionInFrame";
706
884
  label: string;
@@ -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" | "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" | "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" | "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" | "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,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { type ToolAction } from "./ai-chat/agentLoop";
3
- import type { ReviewerFeedback } from "./ai-chat/reviewerAgent";
4
3
  import "./AIChatPanel.scss";
4
+ import type { ReviewerFeedback } from "./ai-chat/reviewerAgent";
5
5
  import type { ExcalidrawImperativeAPI } from "../types";
6
6
  export type ChatMessage = {
7
7
  id: string;
@@ -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 "google/gemini-3.1-flash-lite-preview"
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-small-24b-2507"
76
+ * @default "mistralai/voxtral-mini-transcribe"
67
77
  */
68
78
  voiceModel?: string;
69
79
  /**
70
- * Gemini model ID used by the agent's generate_image tool.
71
- * @default "gemini-3.1-flash-image-preview"
72
- * @example "gemini-2.0-flash-preview-image-generation"
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 "Gemini 2.5 Flash": {
6
- readonly geminiModelId: "gemini-3.1-flash-image-preview";
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 "Gemini 3.1 Flash": {
13
- readonly geminiModelId: "gemini-3.1-flash-image-preview";
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 "Gemini 3 Pro": {
20
- readonly geminiModelId: "gemini-3-pro-image-preview";
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
- geminiApiKey: string;
626
+ openRouterApiKey: string;
615
627
  signal?: AbortSignal;
616
- /** Override Gemini model ID for the agent's generate_image tool. */
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 gemini-3.1-flash-lite-preview */
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;
@@ -3,5 +3,9 @@
3
3
  * Rendered unconditionally from App.tsx — same React tree as FrameToolbar
4
4
  * and ElementCanvasButtons. Uses useExcalidrawAppState() for reactive
5
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.
6
10
  */
7
11
  export declare const AutoResizeShimmerLayer: () => import("react/jsx-runtime").JSX.Element | null;
@@ -66,7 +66,54 @@ type SourceFrameInfo = {
66
66
  foreground: ForegroundEl[];
67
67
  };
68
68
  export declare function extractFrameInfo(elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, files: BinaryFiles): SourceFrameInfo;
69
+ export declare function computeCropLoss(sourceAR: number, targetAR: number): number;
69
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
+ * Selects the optimal resolution for a given target dimension and aspect ratio.
74
+ * Chooses the resolution level that is closest to (but preferably >= ) the target size.
75
+ */
76
+ export declare function selectOptimalResolution(targetW: number, targetH: number, aspectRatio: string): "0.5K" | "1K" | "2K" | "4K";
77
+ /**
78
+ * Returns the x, y, width, height (relative to frame top-left) to place an
79
+ * image such that:
80
+ * - it covers the entire frame (scale up if needed)
81
+ * - the centres of the image and frame coincide
82
+ */
83
+ export declare function fitImageToFrame(imgW: number, imgH: number, frameW: number, frameH: number): {
84
+ relX: number;
85
+ relY: number;
86
+ width: number;
87
+ height: number;
88
+ };
89
+ /**
90
+ * Fit-contain: scale image to fit entirely within the bbox, preserving aspect
91
+ * ratio, centred. Use for foreground elements (logos, product images) where
92
+ * cropping or stretching is not acceptable.
93
+ */
94
+ export declare function containImageInBbox(imgW: number, imgH: number, bboxW: number, bboxH: number): {
95
+ relX: number;
96
+ relY: number;
97
+ width: number;
98
+ height: number;
99
+ };
100
+ export declare function getProductMinBox(targetW: number, targetH: number): {
101
+ minWidth: number;
102
+ minHeight: number;
103
+ };
104
+ export declare function enforceMinProductBox({ x, y, width, height, targetW, targetH, }: {
105
+ x: number;
106
+ y: number;
107
+ width: number;
108
+ height: number;
109
+ targetW: number;
110
+ targetH: number;
111
+ }): {
112
+ x: number;
113
+ y: number;
114
+ width: number;
115
+ height: number;
116
+ };
70
117
  export type PreCreatedFrameInfo = {
71
118
  frameId: string;
72
119
  x: number;
@@ -79,7 +126,6 @@ export declare function runAutoResize(opts: {
79
126
  sourceFrameId: string;
80
127
  targetDimensions: TargetDimension[];
81
128
  app: AppClassProperties;
82
- geminiApiKey: string;
83
129
  openRouterApiKey: string;
84
130
  chatModel?: string;
85
131
  agentImageModel?: string;
@@ -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
- * Gemini model ID used for AI image generation — covers both the auto-resize
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-3.1-flash-image-preview"
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>;