@orangecatai/adgen-canvas 0.0.13 → 0.0.15

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.
@@ -1 +1 @@
1
- import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-IILTKGTJ.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-WLACMVHN.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-IILTKGTJ.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-WLACMVHN.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,4 +1,4 @@
1
- import { type ToolExecutionContext, type ToolResult } from "./canvasTools";
1
+ import { type ToolExecutionContext } from "./canvasTools";
2
2
  import type { BrandContext } from "../../types";
3
3
  type ContentPart = {
4
4
  type: "text";
@@ -33,9 +33,10 @@ export type ToolCall = {
33
33
  };
34
34
  };
35
35
  export type ToolAction = {
36
- toolName: string;
37
- args: Record<string, unknown>;
38
- result: ToolResult;
36
+ result: {
37
+ success: boolean;
38
+ statusMessage: string;
39
+ };
39
40
  };
40
41
  export type AgentUpdate = {
41
42
  type: "status" | "tool_start" | "tool_done" | "final" | "content_delta";
@@ -618,6 +618,25 @@ export type ToolExecutionContext = {
618
618
  * used by the HTML parser to preserve brand fonts in text elements.
619
619
  */
620
620
  customFontMap?: Record<string, number>;
621
+ /**
622
+ * Brand headline font file name (e.g. "Avenir-Heavy.otf"). Sourced from brand DNA.
623
+ * Passed to generate_image as style context so the AI knows the brand typography.
624
+ */
625
+ brandHeadlineFontName?: string;
626
+ /** Brand body font file name. Sourced from brand DNA. */
627
+ brandBodyFontName?: string;
628
+ /**
629
+ * Excalidraw fontFamilyId for the brand headline font.
630
+ * When set, ALL text elements (add_text, fill_template_slots headline slots)
631
+ * use this font. Falls back to brandBodyFontId, then Excalidraw default.
632
+ */
633
+ brandHeadlineFontId?: number;
634
+ /**
635
+ * Excalidraw fontFamilyId for the brand body font.
636
+ * When set, ALL text elements use this font — never a built-in fallback
637
+ * unless the font failed to load.
638
+ */
639
+ brandBodyFontId?: number;
621
640
  /**
622
641
  * Image file attachments the user uploaded in the current chat turn.
623
642
  * Indexed 0-based in the order they were attached.
@@ -6,6 +6,10 @@ export declare class Fonts {
6
6
  static readonly loadedFontsCache: Set<string>;
7
7
  private static _registered;
8
8
  private static _initialized;
9
+ private static _customFontVersion;
10
+ private static _subscribers;
11
+ static readonly subscribeToCustomFonts: (callback: () => void) => (() => void);
12
+ static readonly getCustomFontVersion: () => number;
9
13
  static get registered(): Map<number, {
10
14
  metadata: FontMetadata;
11
15
  fontFaces: ExcalidrawFontFace[];
@@ -17,7 +21,9 @@ export declare class Fonts {
17
21
  /**
18
22
  * Register a custom font from a URL into the canvas font system.
19
23
  *
20
- * Use family IDs >= 1000 to avoid collisions with built-in fonts.
24
+ * Use family IDs >= 2000 to avoid collisions with built-in fonts.
25
+ * IDs 1–10 are named fonts, 100 = Xiaolai, 998/999 = generic fallbacks,
26
+ * 1000 = Segoe UI Emoji — all are reserved.
21
27
  *
22
28
  * Note: custom fonts are registered without a weight/style descriptor
23
29
  * because getFontString generates "${size}px ${familyName}" (no weight),
@@ -432,10 +432,11 @@ export type OnUserFollowedPayload = {
432
432
  };
433
433
  /**
434
434
  * Describes a custom font to register in the canvas font system.
435
- * Use family IDs >= 1000 to avoid collision with built-in fonts.
435
+ * Use family IDs >= 2000 to avoid collision with built-in fonts.
436
+ * IDs up to 1000 are reserved (1–10 named fonts, 100 CJK, 998/999 generic, 1000 emoji).
436
437
  */
437
438
  export type CustomFontSpec = {
438
- /** Unique numeric family ID. Use 1000+ to avoid collisions with built-ins. */
439
+ /** Unique numeric family ID. Use 2000+ to avoid collisions with built-ins. */
439
440
  familyId: number;
440
441
  /** CSS font-family name used in @font-face and canvas rendering. */
441
442
  name: string;
@@ -471,12 +472,16 @@ export type BrandContext = {
471
472
  * this number to add_text fontFamily calls.
472
473
  */
473
474
  fontFamilyId?: number;
475
+ /** Original font file name from brand DNA (e.g. "Avenir-Heavy.otf"). Passed to AI for image generation context. */
476
+ fontName?: string;
474
477
  };
475
478
  body?: {
476
479
  family: string;
477
480
  weight?: string;
478
481
  sizeScale?: string;
479
482
  fontFamilyId?: number;
483
+ /** Original font file name from brand DNA. */
484
+ fontName?: string;
480
485
  };
481
486
  };
482
487
  visualStyle?: string;
@@ -654,7 +659,7 @@ export interface ExcalidrawProps {
654
659
  imageEditToolbarCallbacks?: import("./components/ImageEditToolbar").ImageEditToolbarCallbacks;
655
660
  /**
656
661
  * Custom fonts to register in the canvas font system.
657
- * Each entry maps a numeric family ID (use 1000+) to a font file URL.
662
+ * Each entry maps a numeric family ID (use 2000+) to a font file URL.
658
663
  * Registered fonts become available for text elements whose fontFamily
659
664
  * matches the given familyId.
660
665
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orangecatai/adgen-canvas",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "type": "module",
5
5
  "types": "./dist/types/excalidraw/index.d.ts",
6
6
  "main": "./dist/prod/index.js",