@orangecatai/element 0.0.2 → 0.0.3
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.
- package/dist/dev/index.js +39 -2
- package/dist/dev/index.js.map +2 -2
- package/dist/prod/index.js +1 -1
- package/dist/types/common/src/keys.d.ts +2 -0
- package/dist/types/element/src/frame.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +177 -0
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +7 -7
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionFrame.d.ts +178 -0
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +7 -7
- package/dist/types/excalidraw/actions/actionLink.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionMenu.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionStyles.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
- package/dist/types/excalidraw/actions/index.d.ts +1 -1
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/components/AIChatPanel.d.ts +114 -0
- package/dist/types/excalidraw/components/Actions.d.ts +3 -0
- package/dist/types/excalidraw/components/CanvasBackgroundSwatch.d.ts +7 -0
- package/dist/types/excalidraw/components/ColorPicker/AdvancedColorPicker.d.ts +8 -0
- package/dist/types/excalidraw/components/ColorPicker/colorConversions.d.ts +27 -0
- package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
- package/dist/types/excalidraw/components/DefaultSidebar.d.ts +1 -1
- package/dist/types/excalidraw/components/ElementCanvasButtons.d.ts +1 -1
- package/dist/types/excalidraw/components/FrameToolbar.d.ts +1 -1
- package/dist/types/excalidraw/components/HintViewer.d.ts +1 -1
- package/dist/types/excalidraw/components/ImageEditToolbar.d.ts +16 -0
- package/dist/types/excalidraw/components/ImageGeneratorPanel.d.ts +9 -4
- package/dist/types/excalidraw/components/ImageQuickEditPanel.d.ts +10 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/index.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +1 -0
- package/dist/types/excalidraw/components/ToolButton.d.ts +1 -1
- package/dist/types/excalidraw/components/ai-chat/agentLoop.d.ts +112 -0
- package/dist/types/excalidraw/components/ai-chat/audioUtils.d.ts +10 -0
- package/dist/types/excalidraw/components/ai-chat/canvasTools.d.ts +685 -0
- package/dist/types/excalidraw/components/ai-chat/htmlToExcalidraw.d.ts +53 -0
- package/dist/types/excalidraw/components/ai-chat/openRouterStream.d.ts +50 -0
- package/dist/types/excalidraw/components/ai-chat/reviewerAgent.d.ts +64 -0
- package/dist/types/excalidraw/components/auto-resize/AutoResizePanel.d.ts +17 -0
- package/dist/types/excalidraw/components/auto-resize/AutoResizePanelHost.d.ts +4 -0
- package/dist/types/excalidraw/components/auto-resize/AutoResizeShimmerLayer.d.ts +11 -0
- package/dist/types/excalidraw/components/auto-resize/autoResizeEngine.d.ts +144 -0
- package/dist/types/excalidraw/components/auto-resize/autoResizePanelStore.d.ts +15 -0
- package/dist/types/excalidraw/components/auto-resize/autoResizeStore.d.ts +16 -0
- package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +1 -1
- package/dist/types/excalidraw/components/icons.d.ts +1 -0
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +1 -1
- package/dist/types/excalidraw/components/template-builder/TemplateBuilderPanelHost.d.ts +4 -0
- package/dist/types/excalidraw/components/template-builder/TemplateBuilderTray.d.ts +4 -0
- package/dist/types/excalidraw/components/template-builder/slotTypes.d.ts +43 -0
- package/dist/types/excalidraw/components/template-builder/templateBuilderStore.d.ts +19 -0
- package/dist/types/excalidraw/components/ui/avatar.d.ts +6 -0
- package/dist/types/excalidraw/components/ui/button.d.ts +11 -0
- package/dist/types/excalidraw/components/ui/chat-container.d.ts +17 -0
- package/dist/types/excalidraw/components/ui/code-block.d.ts +16 -0
- package/dist/types/excalidraw/components/ui/markdown.d.ts +10 -0
- package/dist/types/excalidraw/components/ui/message.d.ts +35 -0
- package/dist/types/excalidraw/components/ui/scroll-button.d.ts +10 -0
- package/dist/types/excalidraw/fonts/Fonts.d.ts +17 -0
- package/dist/types/excalidraw/index.d.ts +8 -0
- package/dist/types/excalidraw/types.d.ts +220 -0
- package/dist/types/excalidraw/utils/leonardoApiKey.d.ts +1 -0
- package/dist/types/excalidraw/utils/openRouterApiKey.d.ts +1 -0
- package/dist/types/excalidraw/utils/removeBgApiKey.d.ts +1 -0
- package/package.json +2 -2
|
@@ -430,6 +430,80 @@ 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 >= 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).
|
|
437
|
+
*/
|
|
438
|
+
export type CustomFontSpec = {
|
|
439
|
+
/** Unique numeric family ID. Use 2000+ to avoid collisions with built-ins. */
|
|
440
|
+
familyId: number;
|
|
441
|
+
/** CSS font-family name used in @font-face and canvas rendering. */
|
|
442
|
+
name: string;
|
|
443
|
+
/** Absolute URL or data: URL pointing to the font file. */
|
|
444
|
+
url: string;
|
|
445
|
+
/**
|
|
446
|
+
* Informational font-weight (e.g. "400", "700"). Not applied as a CSS
|
|
447
|
+
* descriptor — getFontString never includes weight, so all custom fonts
|
|
448
|
+
* load as the normal-weight variant for their family ID.
|
|
449
|
+
*/
|
|
450
|
+
weight?: string;
|
|
451
|
+
};
|
|
452
|
+
/**
|
|
453
|
+
* Optional brand identity context passed to AIChatPanel.
|
|
454
|
+
* When provided, the AI agent uses these guidelines when creating ads.
|
|
455
|
+
*/
|
|
456
|
+
export type BrandContext = {
|
|
457
|
+
colors?: {
|
|
458
|
+
primary?: string;
|
|
459
|
+
secondary?: string;
|
|
460
|
+
accent?: string;
|
|
461
|
+
background?: string;
|
|
462
|
+
};
|
|
463
|
+
typography?: {
|
|
464
|
+
headline?: {
|
|
465
|
+
family: string;
|
|
466
|
+
weight?: string;
|
|
467
|
+
/** size_scale from brand kit (e.g. "display", "large", "medium", "small") */
|
|
468
|
+
sizeScale?: string;
|
|
469
|
+
/**
|
|
470
|
+
* Font family ID if a matching custom font was registered via
|
|
471
|
+
* the `customFonts` prop on <Excalidraw>. The agent will pass
|
|
472
|
+
* this number to add_text fontFamily calls.
|
|
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;
|
|
477
|
+
};
|
|
478
|
+
body?: {
|
|
479
|
+
family: string;
|
|
480
|
+
weight?: string;
|
|
481
|
+
sizeScale?: string;
|
|
482
|
+
fontFamilyId?: number;
|
|
483
|
+
/** Original font file name from brand DNA. */
|
|
484
|
+
fontName?: string;
|
|
485
|
+
};
|
|
486
|
+
};
|
|
487
|
+
visualStyle?: string;
|
|
488
|
+
layoutPattern?: string;
|
|
489
|
+
toneOfVoice?: {
|
|
490
|
+
register?: string;
|
|
491
|
+
vocabulary?: string;
|
|
492
|
+
ctaStyle?: string;
|
|
493
|
+
sentenceLength?: string;
|
|
494
|
+
person?: string;
|
|
495
|
+
};
|
|
496
|
+
imagery?: {
|
|
497
|
+
type?: string;
|
|
498
|
+
lighting?: string;
|
|
499
|
+
composition?: string;
|
|
500
|
+
subjects?: string;
|
|
501
|
+
grading?: string;
|
|
502
|
+
depthOfField?: string;
|
|
503
|
+
environment?: string;
|
|
504
|
+
negativeSpace?: string;
|
|
505
|
+
};
|
|
506
|
+
};
|
|
433
507
|
export interface ExcalidrawProps {
|
|
434
508
|
onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
435
509
|
onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
|
|
@@ -497,6 +571,149 @@ export interface ExcalidrawProps {
|
|
|
497
571
|
* Required for image generation when using this package as an npm dependency.
|
|
498
572
|
*/
|
|
499
573
|
geminiApiKey?: string;
|
|
574
|
+
/**
|
|
575
|
+
* Leonardo API key for image toolbar upscale action.
|
|
576
|
+
* When provided, takes precedence over the VITE_APP_LEONARDO_API_KEY env variable.
|
|
577
|
+
*/
|
|
578
|
+
leonardoApiKey?: string;
|
|
579
|
+
/**
|
|
580
|
+
* OpenRouter API key for auto-resize layout planning.
|
|
581
|
+
* When provided, takes precedence over the VITE_APP_OPEN_ROUTER_API_KEY env variable.
|
|
582
|
+
*/
|
|
583
|
+
openRouterApiKey?: string;
|
|
584
|
+
/**
|
|
585
|
+
* remove.bg API key for the remove background toolbar action.
|
|
586
|
+
* When provided, takes precedence over the VITE_APP_REMOVE_BG_API_KEY env variable.
|
|
587
|
+
*/
|
|
588
|
+
removeBgApiKey?: string;
|
|
589
|
+
/**
|
|
590
|
+
* Called before any image generation (ImageGeneratorPanel, ImageQuickEditPanel,
|
|
591
|
+
* or agent loop generate_image tool). Return `{ allowed: false }` to block.
|
|
592
|
+
* Host apps use this for credit gating.
|
|
593
|
+
*/
|
|
594
|
+
onBeforeImageGen?: () => Promise<{
|
|
595
|
+
allowed: boolean;
|
|
596
|
+
error?: string;
|
|
597
|
+
}>;
|
|
598
|
+
/**
|
|
599
|
+
* Called after a successful image generation from any panel or agent tool.
|
|
600
|
+
*/
|
|
601
|
+
onAfterImageGen?: () => void;
|
|
602
|
+
/**
|
|
603
|
+
* Called before an upscale is run (deduct credits, check quota).
|
|
604
|
+
* Return `{ allowed: false, error: "..." }` to block the operation.
|
|
605
|
+
*/
|
|
606
|
+
onBeforeUpscale?: () => Promise<{
|
|
607
|
+
allowed: boolean;
|
|
608
|
+
error?: string;
|
|
609
|
+
}>;
|
|
610
|
+
/** Called after a successful upscale. */
|
|
611
|
+
onAfterUpscale?: () => void;
|
|
612
|
+
/**
|
|
613
|
+
* Called before a background removal is run (deduct credits, check quota).
|
|
614
|
+
* Return `{ allowed: false, error: "..." }` to block the operation.
|
|
615
|
+
*/
|
|
616
|
+
onBeforeRemoveBg?: () => Promise<{
|
|
617
|
+
allowed: boolean;
|
|
618
|
+
error?: string;
|
|
619
|
+
}>;
|
|
620
|
+
/** Called after a successful background removal. */
|
|
621
|
+
onAfterRemoveBg?: () => void;
|
|
622
|
+
/**
|
|
623
|
+
* Called before each auto-resize dimension is generated (deduct credits, check quota).
|
|
624
|
+
* Return `{ allowed: false, error: "..." }` to skip that dimension.
|
|
625
|
+
*/
|
|
626
|
+
onBeforeAutoResize?: () => Promise<{
|
|
627
|
+
allowed: boolean;
|
|
628
|
+
error?: string;
|
|
629
|
+
}>;
|
|
630
|
+
/** Called after each successfully generated auto-resize dimension. */
|
|
631
|
+
onAfterAutoResize?: () => void;
|
|
632
|
+
/**
|
|
633
|
+
* Gemini model ID used for AI image generation — covers both the auto-resize
|
|
634
|
+
* background regeneration and the agent chat `generate_image` tool.
|
|
635
|
+
* Pass the same value here and to `AIChatPanel.agentImageModel` to keep
|
|
636
|
+
* 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"
|
|
639
|
+
*/
|
|
640
|
+
agentImageModel?: string;
|
|
641
|
+
/**
|
|
642
|
+
* OpenRouter model tag used by the auto-resize engine for HTML layout
|
|
643
|
+
* generation. This is the LLM call that figures out how to reflow the ad
|
|
644
|
+
* content into the target dimensions before Gemini regenerates the background.
|
|
645
|
+
* @default "google/gemini-3.1-flash-lite-preview"
|
|
646
|
+
* @example "openai/gpt-4o"
|
|
647
|
+
*/
|
|
648
|
+
chatModel?: string;
|
|
649
|
+
/**
|
|
650
|
+
* Show the Library sidebar trigger button. Defaults to `false`.
|
|
651
|
+
* Set to `true` to show the library icon in the top-right area.
|
|
652
|
+
*/
|
|
653
|
+
showLibraryButton?: boolean;
|
|
654
|
+
/**
|
|
655
|
+
* Callbacks for each action in the image edit toolbar
|
|
656
|
+
* (shown when an image element is selected on canvas).
|
|
657
|
+
* When callbacks are omitted, built-in toolbar actions are used.
|
|
658
|
+
*/
|
|
659
|
+
imageEditToolbarCallbacks?: import("./components/ImageEditToolbar").ImageEditToolbarCallbacks;
|
|
660
|
+
/**
|
|
661
|
+
* Custom fonts to register in the canvas font system.
|
|
662
|
+
* Each entry maps a numeric family ID (use 2000+) to a font file URL.
|
|
663
|
+
* Registered fonts become available for text elements whose fontFamily
|
|
664
|
+
* matches the given familyId.
|
|
665
|
+
*/
|
|
666
|
+
customFonts?: CustomFontSpec[];
|
|
667
|
+
/**
|
|
668
|
+
* Called when the user saves a template from the Template Builder.
|
|
669
|
+
*/
|
|
670
|
+
onSaveTemplate?: (template: {
|
|
671
|
+
name: string;
|
|
672
|
+
campaignTag?: string;
|
|
673
|
+
label?: string;
|
|
674
|
+
width?: number;
|
|
675
|
+
height?: number;
|
|
676
|
+
canvasJson?: string;
|
|
677
|
+
thumbnailDataUrl?: string;
|
|
678
|
+
}) => void;
|
|
679
|
+
/**
|
|
680
|
+
* Fetch all available brand assets for the asset picker (in-canvas swap).
|
|
681
|
+
*/
|
|
682
|
+
onFetchAllAssets?: () => Promise<Array<{
|
|
683
|
+
id: string;
|
|
684
|
+
name: string;
|
|
685
|
+
tags: string[];
|
|
686
|
+
assetType: string;
|
|
687
|
+
blobUrl: string;
|
|
688
|
+
}>>;
|
|
689
|
+
/**
|
|
690
|
+
* Search brand assets by query and optional type filter.
|
|
691
|
+
*/
|
|
692
|
+
onSearchBrandAssets?: (query: string, type?: string) => Promise<Array<{
|
|
693
|
+
id: string;
|
|
694
|
+
name: string;
|
|
695
|
+
tags: string[];
|
|
696
|
+
assetType: string;
|
|
697
|
+
blobUrl: string;
|
|
698
|
+
}>>;
|
|
699
|
+
/**
|
|
700
|
+
* List brand templates, optionally filtered by campaignTag.
|
|
701
|
+
*/
|
|
702
|
+
onListBrandTemplates?: (keywords?: string[]) => Promise<Array<{
|
|
703
|
+
id: string;
|
|
704
|
+
name: string;
|
|
705
|
+
campaignTag?: string;
|
|
706
|
+
label?: string;
|
|
707
|
+
width?: number;
|
|
708
|
+
height?: number;
|
|
709
|
+
thumbnailBlobUrl?: string;
|
|
710
|
+
}>>;
|
|
711
|
+
/**
|
|
712
|
+
* Fetch the full canvas JSON for a specific template by ID.
|
|
713
|
+
*/
|
|
714
|
+
onGetTemplateVariant?: (templateId: string) => Promise<{
|
|
715
|
+
canvasJson: string;
|
|
716
|
+
}>;
|
|
500
717
|
}
|
|
501
718
|
export type SceneData = {
|
|
502
719
|
elements?: ImportedDataState["elements"];
|
|
@@ -517,6 +734,7 @@ export type CanvasActions = Partial<{
|
|
|
517
734
|
saveToActiveFile: boolean;
|
|
518
735
|
toggleTheme: boolean | null;
|
|
519
736
|
saveAsImage: boolean;
|
|
737
|
+
scrollBackToContent: boolean;
|
|
520
738
|
}>;
|
|
521
739
|
export type UIOptions = Partial<{
|
|
522
740
|
dockedSidebarBreakpoint: number;
|
|
@@ -549,6 +767,7 @@ export type AppProps = Merge<ExcalidrawProps, {
|
|
|
549
767
|
export type AppClassProperties = {
|
|
550
768
|
props: AppProps;
|
|
551
769
|
state: AppState;
|
|
770
|
+
actionManager: App["actionManager"];
|
|
552
771
|
interactiveCanvas: HTMLCanvasElement | null;
|
|
553
772
|
/** static canvas */
|
|
554
773
|
canvas: HTMLCanvasElement;
|
|
@@ -590,6 +809,7 @@ export type AppClassProperties = {
|
|
|
590
809
|
visibleElements: App["visibleElements"];
|
|
591
810
|
excalidrawContainerValue: App["excalidrawContainerValue"];
|
|
592
811
|
getSceneElements: App["getSceneElements"];
|
|
812
|
+
updateScene: App["updateScene"];
|
|
593
813
|
onPointerUpEmitter: App["onPointerUpEmitter"];
|
|
594
814
|
updateEditorAtom: App["updateEditorAtom"];
|
|
595
815
|
onPointerDownEmitter: App["onPointerDownEmitter"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveLeonardoApiKey(propKey?: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveOpenRouterApiKey(propKey?: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveRemoveBgApiKey(propKey?: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orangecatai/element",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/types/element/src/index.d.ts",
|
|
6
6
|
"main": "./dist/prod/index.js",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@orangecatai/common": "0.0.
|
|
66
|
+
"@orangecatai/common": "0.0.3",
|
|
67
67
|
"@orangecatai/math": "0.0.2"
|
|
68
68
|
}
|
|
69
69
|
}
|