@orangecatai/element 0.0.1 → 0.0.2

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 (62) hide show
  1. package/README.md +1 -1
  2. package/dist/dev/index.js +3 -1
  3. package/dist/dev/index.js.map +2 -2
  4. package/dist/types/element/src/arrows/focus.d.ts +1 -1
  5. package/dist/types/element/src/binding.d.ts +3 -3
  6. package/dist/types/element/src/bounds.d.ts +1 -1
  7. package/dist/types/element/src/collision.d.ts +1 -1
  8. package/dist/types/element/src/delta.d.ts +2 -2
  9. package/dist/types/element/src/dragElements.d.ts +1 -1
  10. package/dist/types/element/src/duplicate.d.ts +1 -1
  11. package/dist/types/element/src/embeddable.d.ts +1 -1
  12. package/dist/types/element/src/flowchart.d.ts +1 -1
  13. package/dist/types/element/src/frame.d.ts +1 -1
  14. package/dist/types/element/src/groups.d.ts +1 -1
  15. package/dist/types/element/src/renderElement.d.ts +1 -1
  16. package/dist/types/element/src/selection.d.ts +1 -1
  17. package/dist/types/element/src/shape.d.ts +2 -2
  18. package/dist/types/element/src/store.d.ts +2 -2
  19. package/dist/types/element/src/textElement.d.ts +1 -1
  20. package/dist/types/element/src/transform.d.ts +1 -1
  21. package/dist/types/element/src/utils.d.ts +1 -1
  22. package/dist/types/element/src/zindex.d.ts +1 -1
  23. package/dist/types/excalidraw/actions/actionCanvas.d.ts +7 -7
  24. package/dist/types/excalidraw/actions/actionExport.d.ts +9 -9
  25. package/dist/types/excalidraw/actions/actionProperties.d.ts +1 -1
  26. package/dist/types/excalidraw/appState.d.ts +4 -4
  27. package/dist/types/excalidraw/components/Actions.d.ts +1 -1
  28. package/dist/types/excalidraw/components/App.d.ts +13 -2
  29. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +2 -2
  30. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +1 -1
  31. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +1 -1
  32. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +1 -1
  33. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +2 -2
  34. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
  35. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +1 -1
  36. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +1 -1
  37. package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +1 -1
  38. package/dist/types/excalidraw/components/ImageExportDialog.d.ts +1 -1
  39. package/dist/types/excalidraw/components/ImageGeneratorPanel.d.ts +38 -0
  40. package/dist/types/excalidraw/components/ImageQuickEditPanel.d.ts +7 -0
  41. package/dist/types/excalidraw/components/JSONExportDialog.d.ts +1 -1
  42. package/dist/types/excalidraw/components/LayerUI.d.ts +1 -1
  43. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +1 -1
  44. package/dist/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
  45. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
  46. package/dist/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
  47. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
  48. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +2 -2
  49. package/dist/types/excalidraw/components/image-generation/pendingGenerations.d.ts +30 -0
  50. package/dist/types/excalidraw/components/ui/prompt-input.d.ts +28 -0
  51. package/dist/types/excalidraw/components/ui/textarea.d.ts +3 -0
  52. package/dist/types/excalidraw/components/ui/tooltip.d.ts +7 -0
  53. package/dist/types/excalidraw/data/blob.d.ts +19 -17
  54. package/dist/types/excalidraw/data/json.d.ts +8 -8
  55. package/dist/types/excalidraw/data/library.d.ts +1 -1
  56. package/dist/types/excalidraw/fonts/Fonts.d.ts +2 -2
  57. package/dist/types/excalidraw/i18n.d.ts +1 -1
  58. package/dist/types/excalidraw/index.d.ts +1 -0
  59. package/dist/types/excalidraw/lib/utils.d.ts +2 -0
  60. package/dist/types/excalidraw/types.d.ts +9 -0
  61. package/dist/types/excalidraw/utils/geminiApiKey.d.ts +1 -0
  62. package/package.json +6 -6
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import { Textarea } from "./textarea";
3
+ import { Tooltip } from "./tooltip";
4
+ export type PromptInputProps = {
5
+ isLoading?: boolean;
6
+ value?: string;
7
+ onValueChange?: (value: string) => void;
8
+ maxHeight?: number | string;
9
+ onSubmit?: () => void;
10
+ children: React.ReactNode;
11
+ className?: string;
12
+ disabled?: boolean;
13
+ } & React.ComponentProps<"div">;
14
+ declare function PromptInput({ className, isLoading, maxHeight, value, onValueChange, onSubmit, children, disabled, onClick, ...props }: PromptInputProps): import("react/jsx-runtime").JSX.Element;
15
+ export type PromptInputTextareaProps = {
16
+ disableAutosize?: boolean;
17
+ } & React.ComponentProps<typeof Textarea>;
18
+ declare function PromptInputTextarea({ className, onKeyDown, disableAutosize, ...props }: PromptInputTextareaProps): import("react/jsx-runtime").JSX.Element;
19
+ export type PromptInputActionsProps = React.HTMLAttributes<HTMLDivElement>;
20
+ declare function PromptInputActions({ children, className, ...props }: PromptInputActionsProps): import("react/jsx-runtime").JSX.Element;
21
+ export type PromptInputActionProps = {
22
+ className?: string;
23
+ tooltip: React.ReactNode;
24
+ children: React.ReactNode;
25
+ side?: "top" | "bottom" | "left" | "right";
26
+ } & React.ComponentProps<typeof Tooltip>;
27
+ declare function PromptInputAction({ tooltip, children, className, side, ...props }: PromptInputActionProps): import("react/jsx-runtime").JSX.Element;
28
+ export { PromptInput, PromptInputTextarea, PromptInputActions, PromptInputAction, };
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ declare const Textarea: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
3
+ export { Textarea };
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
3
+ declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
4
+ declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
5
+ declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
6
+ declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
@@ -1,6 +1,6 @@
1
1
  import { IMAGE_MIME_TYPES, MIME_TYPES } from "@orangecatai/common";
2
- import type { ValueOf } from "@orangecatai/common/utility-types";
3
2
  import type { ExcalidrawElement, FileId } from "@orangecatai/element/types";
3
+ import type { ValueOf } from "@orangecatai/common/utility-types";
4
4
  import type { AppState, DataURL, LibraryItem } from "../types";
5
5
  import type { FileSystemHandle } from "browser-fs-access";
6
6
  import type { ImportedLibraryData } from "./types";
@@ -21,14 +21,6 @@ fileHandle?: FileSystemHandle | null) => Promise<{
21
21
  data: {
22
22
  elements: import("@orangecatai/element/types").OrderedExcalidrawElement[];
23
23
  appState: {
24
- viewBackgroundColor: string;
25
- theme: import("@orangecatai/element/types").Theme;
26
- frameRendering: {
27
- enabled: boolean;
28
- name: boolean;
29
- outline: boolean;
30
- clip: boolean;
31
- };
32
24
  name: string | null;
33
25
  zoom: import("../types").Zoom;
34
26
  scrollX: number;
@@ -52,6 +44,7 @@ fileHandle?: FileSystemHandle | null) => Promise<{
52
44
  [id: string]: true;
53
45
  }>;
54
46
  frameToHighlight: import("@orangecatai/element/types").NonDeleted<import("@orangecatai/element/types").ExcalidrawFrameLikeElement> | null;
47
+ theme: import("@orangecatai/element/types").Theme;
55
48
  activeTool: {
56
49
  lastActiveTool: import("../types").ActiveTool | null;
57
50
  locked: boolean;
@@ -89,6 +82,12 @@ fileHandle?: FileSystemHandle | null) => Promise<{
89
82
  hoveredElementIds: Readonly<{
90
83
  [id: string]: true;
91
84
  }>;
85
+ frameRendering: {
86
+ enabled: boolean;
87
+ name: boolean;
88
+ outline: boolean;
89
+ clip: boolean;
90
+ };
92
91
  shouldCacheIgnoreZoom: boolean;
93
92
  exportScale: number;
94
93
  currentItemArrowType: "sharp" | "round" | "elbow";
@@ -128,6 +127,7 @@ fileHandle?: FileSystemHandle | null) => Promise<{
128
127
  currentItemEndArrowhead: import("@orangecatai/element/types").Arrowhead | null;
129
128
  currentHoveredFontFamily: import("@orangecatai/element/types").FontFamilyValues | null;
130
129
  currentItemRoundness: import("@orangecatai/element/types").StrokeRoundness;
130
+ viewBackgroundColor: string;
131
131
  cursorButton: "up" | "down";
132
132
  scrolledOutside: boolean;
133
133
  isResizing: boolean;
@@ -188,14 +188,6 @@ localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | nu
188
188
  fileHandle?: FileSystemHandle | null) => Promise<{
189
189
  elements: import("@orangecatai/element/types").OrderedExcalidrawElement[];
190
190
  appState: {
191
- viewBackgroundColor: string;
192
- theme: import("@orangecatai/element/types").Theme;
193
- frameRendering: {
194
- enabled: boolean;
195
- name: boolean;
196
- outline: boolean;
197
- clip: boolean;
198
- };
199
191
  name: string | null;
200
192
  zoom: import("../types").Zoom;
201
193
  scrollX: number;
@@ -219,6 +211,7 @@ fileHandle?: FileSystemHandle | null) => Promise<{
219
211
  [id: string]: true;
220
212
  }>;
221
213
  frameToHighlight: import("@orangecatai/element/types").NonDeleted<import("@orangecatai/element/types").ExcalidrawFrameLikeElement> | null;
214
+ theme: import("@orangecatai/element/types").Theme;
222
215
  activeTool: {
223
216
  lastActiveTool: import("../types").ActiveTool | null;
224
217
  locked: boolean;
@@ -256,6 +249,12 @@ fileHandle?: FileSystemHandle | null) => Promise<{
256
249
  hoveredElementIds: Readonly<{
257
250
  [id: string]: true;
258
251
  }>;
252
+ frameRendering: {
253
+ enabled: boolean;
254
+ name: boolean;
255
+ outline: boolean;
256
+ clip: boolean;
257
+ };
259
258
  shouldCacheIgnoreZoom: boolean;
260
259
  exportScale: number;
261
260
  currentItemArrowType: "sharp" | "round" | "elbow";
@@ -295,6 +294,7 @@ fileHandle?: FileSystemHandle | null) => Promise<{
295
294
  currentItemEndArrowhead: import("@orangecatai/element/types").Arrowhead | null;
296
295
  currentHoveredFontFamily: import("@orangecatai/element/types").FontFamilyValues | null;
297
296
  currentItemRoundness: import("@orangecatai/element/types").StrokeRoundness;
297
+ viewBackgroundColor: string;
298
298
  cursorButton: "up" | "down";
299
299
  scrolledOutside: boolean;
300
300
  isResizing: boolean;
@@ -353,6 +353,8 @@ export declare const generateIdFromFile: (file: File) => Promise<FileId>;
353
353
  /** async. For sync variant, use getDataURL_sync */
354
354
  export declare const getDataURL: (file: Blob | File) => Promise<DataURL>;
355
355
  export declare const getDataURL_sync: (data: string | Uint8Array | ArrayBuffer, mimeType: ValueOf<typeof MIME_TYPES>) => DataURL;
356
+ /** Parses MIME type from a data URL (e.g. data:image/webp;base64,...). */
357
+ export declare const getMimeTypeFromDataURL: (dataURL: string) => string;
356
358
  export declare const dataURLToFile: (dataURL: DataURL, filename?: string) => File;
357
359
  export declare const dataURLToString: (dataURL: DataURL) => string;
358
360
  export declare const resizeImageFile: (file: File, opts: {
@@ -10,14 +10,6 @@ name?: string) => Promise<{
10
10
  export declare const loadFromJSON: (localAppState: AppState, localElements: readonly ExcalidrawElement[] | null) => Promise<{
11
11
  elements: import("@orangecatai/element/types").OrderedExcalidrawElement[];
12
12
  appState: {
13
- viewBackgroundColor: string;
14
- theme: import("@orangecatai/element/types").Theme;
15
- frameRendering: {
16
- enabled: boolean;
17
- name: boolean;
18
- outline: boolean;
19
- clip: boolean;
20
- };
21
13
  name: string | null;
22
14
  zoom: import("../types").Zoom;
23
15
  scrollX: number;
@@ -41,6 +33,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
41
33
  [id: string]: true;
42
34
  }>;
43
35
  frameToHighlight: import("@orangecatai/element/types").NonDeleted<import("@orangecatai/element/types").ExcalidrawFrameLikeElement> | null;
36
+ theme: import("@orangecatai/element/types").Theme;
44
37
  activeTool: {
45
38
  lastActiveTool: import("../types").ActiveTool | null;
46
39
  locked: boolean;
@@ -78,6 +71,12 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
78
71
  hoveredElementIds: Readonly<{
79
72
  [id: string]: true;
80
73
  }>;
74
+ frameRendering: {
75
+ enabled: boolean;
76
+ name: boolean;
77
+ outline: boolean;
78
+ clip: boolean;
79
+ };
81
80
  shouldCacheIgnoreZoom: boolean;
82
81
  exportScale: number;
83
82
  currentItemArrowType: "sharp" | "round" | "elbow";
@@ -117,6 +116,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
117
116
  currentItemEndArrowhead: import("@orangecatai/element/types").Arrowhead | null;
118
117
  currentHoveredFontFamily: import("@orangecatai/element/types").FontFamilyValues | null;
119
118
  currentItemRoundness: import("@orangecatai/element/types").StrokeRoundness;
119
+ viewBackgroundColor: string;
120
120
  cursorButton: "up" | "down";
121
121
  scrolledOutside: boolean;
122
122
  isResizing: boolean;
@@ -1,5 +1,5 @@
1
- import type { ExcalidrawElement } from "@orangecatai/element/types";
2
1
  import type { MaybePromise } from "@orangecatai/common/utility-types";
2
+ import type { ExcalidrawElement } from "@orangecatai/element/types";
3
3
  import type App from "../components/App";
4
4
  import type { LibraryItems, ExcalidrawImperativeAPI, LibraryItemsSource, LibraryItems_anyVersion } from "../types";
5
5
  export type LibraryPersistedData = {
@@ -1,7 +1,7 @@
1
1
  import { type FontMetadata } from "@orangecatai/common";
2
- import type { ExcalidrawElement } from "@orangecatai/element/types";
3
- import type { Scene } from "@orangecatai/element";
4
2
  import { ExcalidrawFontFace } from "./ExcalidrawFontFace";
3
+ import type { Scene } from "@orangecatai/element";
4
+ import type { ExcalidrawElement } from "@orangecatai/element/types";
5
5
  export declare class Fonts {
6
6
  static readonly loadedFontsCache: Set<string>;
7
7
  private static _registered;
@@ -1,5 +1,5 @@
1
- import type { NestedKeyOf } from "@orangecatai/common/utility-types";
2
1
  import fallbackLangData from "./locales/en.json";
2
+ import type { NestedKeyOf } from "@orangecatai/common/utility-types";
3
3
  export interface Language {
4
4
  code: string;
5
5
  label: string;
@@ -6,6 +6,7 @@ import WelcomeScreen from "./components/welcome-screen/WelcomeScreen";
6
6
  import "./css/app.scss";
7
7
  import "./css/styles.scss";
8
8
  import "./fonts/fonts.css";
9
+ import "./css/tailwind.generated.css";
9
10
  import type { ExcalidrawProps } from "./types";
10
11
  export declare const Excalidraw: React.MemoExoticComponent<(props: ExcalidrawProps) => import("react/jsx-runtime").JSX.Element>;
11
12
  export { getSceneVersion, hashElementsVersion, hashString, getNonDeletedElements, } from "@orangecatai/element";
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from "clsx";
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -491,6 +491,12 @@ export interface ExcalidrawProps {
491
491
  aiEnabled?: boolean;
492
492
  showDeprecatedFonts?: boolean;
493
493
  renderScrollbars?: boolean;
494
+ /**
495
+ * Gemini API key for image generation.
496
+ * When provided, takes precedence over the VITE_APP_GEMINI_API_KEY env variable.
497
+ * Required for image generation when using this package as an npm dependency.
498
+ */
499
+ geminiApiKey?: string;
494
500
  }
495
501
  export type SceneData = {
496
502
  elements?: ImportedDataState["elements"];
@@ -571,6 +577,9 @@ export type AppClassProperties = {
571
577
  setOpenDialog: App["setOpenDialog"];
572
578
  insertEmbeddableElement: App["insertEmbeddableElement"];
573
579
  onMagicframeToolSelect: App["onMagicframeToolSelect"];
580
+ onImageGeneratorSelect: App["onImageGeneratorSelect"];
581
+ insertGeneratedImageIntoFrame: App["insertGeneratedImageIntoFrame"];
582
+ insertGeneratedImageNearElement: App["insertGeneratedImageNearElement"];
574
583
  getName: App["getName"];
575
584
  dismissLinearEditor: App["dismissLinearEditor"];
576
585
  flowChartCreator: App["flowChartCreator"];
@@ -0,0 +1 @@
1
+ export declare function resolveGeminiApiKey(propKey?: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orangecatai/element",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "types": "./dist/types/element/src/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -28,7 +28,7 @@
28
28
  "files": [
29
29
  "dist/*"
30
30
  ],
31
- "description": "Excalidraw elements-related logic",
31
+ "description": "OrangeCat adgen-canvas elements-related logic",
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
@@ -56,14 +56,14 @@
56
56
  "last 1 safari version"
57
57
  ]
58
58
  },
59
- "bugs": "https://github.com/yourorg/excalidraw/issues",
60
- "repository": "https://github.com/yourorg/excalidraw",
59
+ "bugs": "https://github.com/Kraken2003/adgen-canvas/issues",
60
+ "repository": "https://github.com/Kraken2003/adgen-canvas",
61
61
  "scripts": {
62
62
  "gen:types": "rimraf types && tsc",
63
63
  "build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
64
64
  },
65
65
  "dependencies": {
66
- "@orangecatai/common": "0.0.1",
67
- "@orangecatai/math": "0.0.1"
66
+ "@orangecatai/common": "0.0.2",
67
+ "@orangecatai/math": "0.0.2"
68
68
  }
69
69
  }