@orangecatai/adgen-canvas 0.0.6 → 0.0.7

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-CEENA34D.js → chunk-2Q3FNCU4.js} +32 -3
  2. package/dist/dev/chunk-2Q3FNCU4.js.map +7 -0
  3. package/dist/dev/{chunk-7QYIG5FZ.js → chunk-MW637LK5.js} +2 -2
  4. package/dist/dev/data/{image-YK44DYB7.js → image-L2UC5LX5.js} +3 -3
  5. package/dist/dev/index.css +390 -0
  6. package/dist/dev/index.css.map +3 -3
  7. package/dist/dev/index.js +5064 -2278
  8. package/dist/dev/index.js.map +4 -4
  9. package/dist/dev/subset-shared.chunk.js +1 -1
  10. package/dist/dev/subset-worker.chunk.js +1 -1
  11. package/dist/prod/{chunk-R5LMMFAL.js → chunk-7AVPHWG7.js} +1 -1
  12. package/dist/prod/{chunk-GCPOY3UH.js → chunk-XPV36KCI.js} +3 -3
  13. package/dist/prod/data/image-6DWEFZH4.js +1 -0
  14. package/dist/prod/index.css +1 -1
  15. package/dist/prod/index.js +341 -84
  16. package/dist/prod/subset-shared.chunk.js +1 -1
  17. package/dist/prod/subset-worker.chunk.js +1 -1
  18. package/dist/types/excalidraw/components/AIChatPanel.d.ts +10 -1
  19. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
  20. package/dist/types/excalidraw/components/ElementCanvasButtons.d.ts +1 -1
  21. package/dist/types/excalidraw/components/FrameToolbar.d.ts +1 -1
  22. package/dist/types/excalidraw/components/HintViewer.d.ts +1 -1
  23. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +1 -1
  24. package/dist/types/excalidraw/components/Stats/index.d.ts +1 -1
  25. package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +1 -0
  26. package/dist/types/excalidraw/components/ToolButton.d.ts +1 -1
  27. package/dist/types/excalidraw/components/ai-chat/agentLoop.d.ts +14 -1
  28. package/dist/types/excalidraw/components/ai-chat/canvasTools.d.ts +234 -1
  29. package/dist/types/excalidraw/components/ai-chat/htmlToExcalidraw.d.ts +53 -0
  30. package/dist/types/excalidraw/components/ai-chat/openRouterStream.d.ts +50 -0
  31. package/dist/types/excalidraw/components/auto-resize/AutoResizePanel.d.ts +16 -0
  32. package/dist/types/excalidraw/components/auto-resize/AutoResizeShimmerLayer.d.ts +7 -0
  33. package/dist/types/excalidraw/components/auto-resize/autoResizeEngine.d.ts +89 -0
  34. package/dist/types/excalidraw/components/auto-resize/autoResizeStore.d.ts +16 -0
  35. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +1 -1
  36. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +1 -1
  37. package/dist/types/excalidraw/components/ui/button.d.ts +1 -1
  38. package/dist/types/excalidraw/fonts/Fonts.d.ts +11 -0
  39. package/dist/types/excalidraw/index.d.ts +1 -0
  40. package/dist/types/excalidraw/types.d.ts +96 -0
  41. package/package.json +1 -1
  42. package/dist/dev/chunk-CEENA34D.js.map +0 -7
  43. package/dist/prod/data/image-XZPNP25M.js +0 -1
  44. /package/dist/dev/{chunk-7QYIG5FZ.js.map → chunk-MW637LK5.js.map} +0 -0
  45. /package/dist/dev/data/{image-YK44DYB7.js.map → image-L2UC5LX5.js.map} +0 -0
@@ -14,6 +14,17 @@ export declare class Fonts {
14
14
  metadata: FontMetadata;
15
15
  fontFaces: ExcalidrawFontFace[];
16
16
  }>;
17
+ /**
18
+ * Register a custom font from a URL into the canvas font system.
19
+ *
20
+ * Use family IDs >= 1000 to avoid collisions with built-in fonts.
21
+ *
22
+ * Note: custom fonts are registered without a weight/style descriptor
23
+ * because getFontString generates "${size}px ${familyName}" (no weight),
24
+ * so the browser always requests the normal-weight variant. Pass the font
25
+ * file that should render by default for this family ID.
26
+ */
27
+ static registerCustomFont(spec: import("../types").CustomFontSpec): void;
17
28
  private readonly scene;
18
29
  constructor(scene: Scene);
19
30
  /**
@@ -52,3 +52,4 @@ export type { ExcalidrawImperativeAPI } from "./types";
52
52
  export type { AppState, BinaryFiles, BinaryFileData, ExcalidrawProps, ExcalidrawInitialDataState, LibraryItem, LibraryItems, SceneData, UnsubscribeCallback, } from "./types";
53
53
  export type { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, OrderedExcalidrawElement, ExcalidrawElementType, } from "@orangecatai/element/types";
54
54
  export type { ImageEditToolbarCallbacks } from "./components/ImageEditToolbar";
55
+ export type { CustomFontSpec, BrandContext } from "./types";
@@ -430,6 +430,75 @@ export type OnUserFollowedPayload = {
430
430
  userToFollow: UserToFollow;
431
431
  action: "FOLLOW" | "UNFOLLOW";
432
432
  };
433
+ /**
434
+ * Describes a custom font to register in the canvas font system.
435
+ * Use family IDs >= 1000 to avoid collision with built-in fonts.
436
+ */
437
+ export type CustomFontSpec = {
438
+ /** Unique numeric family ID. Use 1000+ to avoid collisions with built-ins. */
439
+ familyId: number;
440
+ /** CSS font-family name used in @font-face and canvas rendering. */
441
+ name: string;
442
+ /** Absolute URL or data: URL pointing to the font file. */
443
+ url: string;
444
+ /**
445
+ * Informational font-weight (e.g. "400", "700"). Not applied as a CSS
446
+ * descriptor — getFontString never includes weight, so all custom fonts
447
+ * load as the normal-weight variant for their family ID.
448
+ */
449
+ weight?: string;
450
+ };
451
+ /**
452
+ * Optional brand identity context passed to AIChatPanel.
453
+ * When provided, the AI agent uses these guidelines when creating ads.
454
+ */
455
+ export type BrandContext = {
456
+ colors?: {
457
+ primary?: string;
458
+ secondary?: string;
459
+ accent?: string;
460
+ background?: string;
461
+ };
462
+ typography?: {
463
+ headline?: {
464
+ family: string;
465
+ weight?: string;
466
+ /** size_scale from brand kit (e.g. "display", "large", "medium", "small") */
467
+ sizeScale?: string;
468
+ /**
469
+ * Font family ID if a matching custom font was registered via
470
+ * the `customFonts` prop on <Excalidraw>. The agent will pass
471
+ * this number to add_text fontFamily calls.
472
+ */
473
+ fontFamilyId?: number;
474
+ };
475
+ body?: {
476
+ family: string;
477
+ weight?: string;
478
+ sizeScale?: string;
479
+ fontFamilyId?: number;
480
+ };
481
+ };
482
+ visualStyle?: string;
483
+ layoutPattern?: string;
484
+ toneOfVoice?: {
485
+ register?: string;
486
+ vocabulary?: string;
487
+ ctaStyle?: string;
488
+ sentenceLength?: string;
489
+ person?: string;
490
+ };
491
+ imagery?: {
492
+ type?: string;
493
+ lighting?: string;
494
+ composition?: string;
495
+ subjects?: string;
496
+ grading?: string;
497
+ depthOfField?: string;
498
+ environment?: string;
499
+ negativeSpace?: string;
500
+ };
501
+ };
433
502
  export interface ExcalidrawProps {
434
503
  onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
435
504
  onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
@@ -540,6 +609,25 @@ export interface ExcalidrawProps {
540
609
  }>;
541
610
  /** Called after a successful background removal. */
542
611
  onAfterRemoveBg?: () => void;
612
+ /**
613
+ * Called before each auto-resize dimension is generated (deduct credits, check quota).
614
+ * Return `{ allowed: false, error: "..." }` to skip that dimension.
615
+ */
616
+ onBeforeAutoResize?: () => Promise<{
617
+ allowed: boolean;
618
+ error?: string;
619
+ }>;
620
+ /** Called after each successfully generated auto-resize dimension. */
621
+ onAfterAutoResize?: () => void;
622
+ /**
623
+ * Gemini model ID used for AI image generation — covers both the auto-resize
624
+ * background regeneration and the agent chat `generate_image` tool.
625
+ * Pass the same value here and to `AIChatPanel.agentImageModel` to keep
626
+ * both surfaces on the same model with a single configuration.
627
+ * @default "gemini-3.1-flash-image-preview"
628
+ * @example "gemini-3.1-flash-image-preview"
629
+ */
630
+ agentImageModel?: string;
543
631
  /**
544
632
  * Show the Library sidebar trigger button. Defaults to `false`.
545
633
  * Set to `true` to show the library icon in the top-right area.
@@ -551,6 +639,13 @@ export interface ExcalidrawProps {
551
639
  * When callbacks are omitted, built-in toolbar actions are used.
552
640
  */
553
641
  imageEditToolbarCallbacks?: import("./components/ImageEditToolbar").ImageEditToolbarCallbacks;
642
+ /**
643
+ * Custom fonts to register in the canvas font system.
644
+ * Each entry maps a numeric family ID (use 1000+) to a font file URL.
645
+ * Registered fonts become available for text elements whose fontFamily
646
+ * matches the given familyId.
647
+ */
648
+ customFonts?: CustomFontSpec[];
554
649
  }
555
650
  export type SceneData = {
556
651
  elements?: ImportedDataState["elements"];
@@ -646,6 +741,7 @@ export type AppClassProperties = {
646
741
  visibleElements: App["visibleElements"];
647
742
  excalidrawContainerValue: App["excalidrawContainerValue"];
648
743
  getSceneElements: App["getSceneElements"];
744
+ updateScene: App["updateScene"];
649
745
  onPointerUpEmitter: App["onPointerUpEmitter"];
650
746
  updateEditorAtom: App["updateEditorAtom"];
651
747
  onPointerDownEmitter: App["onPointerDownEmitter"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orangecatai/adgen-canvas",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "types": "./dist/types/excalidraw/index.d.ts",
6
6
  "main": "./dist/prod/index.js",