@myoc/element 0.19.532 → 0.19.533

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 (44) hide show
  1. package/dist/dev/index.js +783 -16
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +15 -15
  4. package/dist/types/common/src/constants.d.ts +1 -0
  5. package/dist/types/element/src/gif.d.ts +29 -0
  6. package/dist/types/element/src/image.d.ts +6 -1
  7. package/dist/types/element/src/index.d.ts +2 -0
  8. package/dist/types/element/src/newElement.d.ts +1 -0
  9. package/dist/types/element/src/renderGif.d.ts +5 -0
  10. package/dist/types/element/src/types.d.ts +12 -0
  11. package/dist/types/excalidraw/actions/actionBoundText.d.ts +2 -2
  12. package/dist/types/excalidraw/actions/actionCanvas.d.ts +6 -6
  13. package/dist/types/excalidraw/actions/actionClipboard.d.ts +2 -2
  14. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +1 -1
  15. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +3 -3
  16. package/dist/types/excalidraw/actions/actionDeselect.d.ts +1 -1
  17. package/dist/types/excalidraw/actions/actionElementLock.d.ts +2 -2
  18. package/dist/types/excalidraw/actions/actionExport.d.ts +2 -2
  19. package/dist/types/excalidraw/actions/actionFrame.d.ts +4 -3
  20. package/dist/types/excalidraw/actions/actionGroup.d.ts +2 -2
  21. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +2 -1
  22. package/dist/types/excalidraw/actions/actionLink.d.ts +1 -1
  23. package/dist/types/excalidraw/actions/actionProperties.d.ts +2 -2
  24. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +1 -1
  25. package/dist/types/excalidraw/actions/actionStyles.d.ts +1 -1
  26. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +1 -1
  27. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +1 -1
  28. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +1 -1
  29. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +1 -1
  30. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +1 -1
  31. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +1 -1
  32. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +1 -1
  33. package/dist/types/excalidraw/components/App.d.ts +8 -1
  34. package/dist/types/excalidraw/components/App.gif.d.ts +18 -0
  35. package/dist/types/excalidraw/components/GifPlaybackControls.d.ts +10 -0
  36. package/dist/types/excalidraw/components/icons.d.ts +4 -0
  37. package/dist/types/excalidraw/data/blob.d.ts +2 -2
  38. package/dist/types/excalidraw/data/json.d.ts +1 -1
  39. package/dist/types/excalidraw/data/restoreGif.d.ts +4 -0
  40. package/dist/types/excalidraw/scene/Renderer.d.ts +1 -0
  41. package/dist/types/excalidraw/scene/types.d.ts +2 -1
  42. package/dist/types/excalidraw/types.d.ts +12 -2
  43. package/dist/types/excalidraw/viewport.d.ts +1 -1
  44. package/package.json +5 -4
@@ -4,7 +4,7 @@ import type { ExcalidrawElement, FileId } from "@excalidraw/element/types";
4
4
  import type { AppState, CompressImageFile, DataURL } from "../types";
5
5
  export declare const getMimeType: (blob: Blob | string) => string;
6
6
  export declare const getFileHandleType: (handle: FileSystemFileHandle | null) => string | null;
7
- export declare const isImageFileHandleType: (type: string | null) => type is "png" | "svg";
7
+ export declare const isImageFileHandleType: (type: string | null) => type is "png" | "svg" | "gif";
8
8
  export declare const isImageFileHandle: (handle: FileSystemFileHandle | null) => handle is FileSystemFileHandle;
9
9
  export declare const isSupportedImageFileType: (type: string | null | undefined) => boolean;
10
10
  export declare const isSupportedImageFile: (blob: Blob | null | undefined) => blob is Blob & {
@@ -152,7 +152,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
152
152
  scrolledOutside: boolean;
153
153
  isResizing: boolean;
154
154
  openMenu: "canvas" | null;
155
- openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
155
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | "gifFrameGallery" | "gifSpeedPicker" | null;
156
156
  openSidebar: {
157
157
  name: import("../types").SidebarName;
158
158
  tab?: import("../types").SidebarTabName;
@@ -153,7 +153,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
153
153
  scrolledOutside: boolean;
154
154
  isResizing: boolean;
155
155
  openMenu: "canvas" | null;
156
- openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
156
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | "gifFrameGallery" | "gifSpeedPicker" | null;
157
157
  openSidebar: {
158
158
  name: import("../types").SidebarName;
159
159
  tab?: import("../types").SidebarTabName;
@@ -0,0 +1,4 @@
1
+ import type { ExcalidrawGifPlayback } from "@excalidraw/element/types";
2
+ type RestorableGifPlayback = Partial<ExcalidrawGifPlayback> | null | undefined;
3
+ export declare const restoreGifPlayback: (gifPlayback: RestorableGifPlayback) => ExcalidrawGifPlayback | null;
4
+ export {};
@@ -276,6 +276,7 @@ export declare class Renderer {
276
276
  status: "pending" | "saved" | "error";
277
277
  scale: [number, number];
278
278
  crop: import("@excalidraw/element/types").ImageCrop | null;
279
+ gifPlayback: import("@excalidraw/element/types").ExcalidrawGifPlayback | null;
279
280
  }> & {
280
281
  isDeleted: false;
281
282
  }) | (Readonly<{
@@ -1,5 +1,5 @@
1
1
  import type { UserIdleState, EditorInterface } from "@excalidraw/common";
2
- import type { ExcalidrawElement, NonDeletedElementsMap, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
2
+ import type { ExcalidrawElement, ExcalidrawImageElement, NonDeletedElementsMap, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
3
3
  import type { MakeBrand } from "@excalidraw/common/utility-types";
4
4
  import type { AppClassProperties, AppState, EmbedsValidationStatus, ElementsPendingErasure, InteractiveCanvasAppState, StaticCanvasAppState, SocketId, PendingExcalidrawElements } from "../types";
5
5
  import type { RoughCanvas } from "roughjs/bin/canvas";
@@ -8,6 +8,7 @@ export type RenderableElementsMap = NonDeletedElementsMap & MakeBrand<"Renderabl
8
8
  export type StaticCanvasRenderConfig = {
9
9
  canvasBackgroundColor: AppState["viewBackgroundColor"];
10
10
  imageCache: AppClassProperties["imageCache"];
11
+ getGifFrameIndex?: (element: ExcalidrawImageElement) => number | undefined;
11
12
  imageTransitionDuration?: number;
12
13
  renderGrid: boolean;
13
14
  /** whether to render link icons on elements with links (never rendered
@@ -1,7 +1,7 @@
1
1
  import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, ColorTuple, EditorInterface, StrokeWidthKey } from "@excalidraw/common";
2
2
  import type { LinearElementEditor } from "@excalidraw/element";
3
3
  import type { MaybeTransformHandleType } from "@excalidraw/element";
4
- import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, ExcalidrawArrowElement, Arrowhead, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, ArrangeAlgorithms, BindMode, ExcalidrawTextElement, StrokeVariability } from "@excalidraw/element/types";
4
+ import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, ExcalidrawArrowElement, Arrowhead, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, ArrangeAlgorithms, BindMode, ExcalidrawTextElement, StrokeVariability, ExcalidrawGifCache } from "@excalidraw/element/types";
5
5
  import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
6
6
  import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
7
7
  import type { GlobalPoint } from "@excalidraw/math";
@@ -406,7 +406,7 @@ export interface AppState {
406
406
  isRotating: boolean;
407
407
  zoom: Zoom;
408
408
  openMenu: "canvas" | null;
409
- openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
409
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | "gifFrameGallery" | "gifSpeedPicker" | null;
410
410
  openSidebar: {
411
411
  name: SidebarName;
412
412
  tab?: SidebarTabName;
@@ -913,6 +913,8 @@ export type ExportOpts = {
913
913
  export type ImageOptions = Partial<{
914
914
  maxWidthOrHeight: number;
915
915
  maxFileSizeBytes: number;
916
+ /** GIF files larger than this are inserted as static images until manually loaded */
917
+ gifAutoDecodeMaxFileSizeBytes: number;
916
918
  /** duration of the placeholder-to-full-image crossfade in milliseconds */
917
919
  placeholderTransitionDuration: number;
918
920
  }>;
@@ -973,6 +975,8 @@ export type AppClassProperties = {
973
975
  isPlaceholder?: boolean;
974
976
  placeholderImage?: HTMLImageElement;
975
977
  transitionStart?: number;
978
+ gifDecodeStatus?: "pending" | "success" | "error" | "deferred";
979
+ gif?: ExcalidrawGifCache;
976
980
  }>;
977
981
  imageLoadingProgress: App["imageLoadingProgress"];
978
982
  imageLoadingProgressEmitter: App["imageLoadingProgressEmitter"];
@@ -993,6 +997,12 @@ export type AppClassProperties = {
993
997
  scrollToViewport: App["scrollToViewport"];
994
998
  scrollToContent: App["scrollToContent"];
995
999
  addFiles: App["addFiles"];
1000
+ scheduleCapture: App["scheduleCapture"];
1001
+ scheduleUpdate: App["scheduleUpdate"];
1002
+ ensureGifPlaybackLoop: App["ensureGifPlaybackLoop"];
1003
+ loadDeferredGif: App["loadDeferredGif"];
1004
+ getGifPlaybackFrameIndex: App["getGifPlaybackFrameIndex"];
1005
+ setGifPlaybackFrameIndex: App["setGifPlaybackFrameIndex"];
996
1006
  addElementsFromPaste: App["addElementsFromPaste"];
997
1007
  togglePenMode: App["togglePenMode"];
998
1008
  toggleLock: App["toggleLock"];
@@ -183,7 +183,7 @@ export declare const zoomToFitBounds: ({ bounds, appState, canvasOffsets, fit, m
183
183
  isResizing: boolean;
184
184
  isRotating: boolean;
185
185
  openMenu: "canvas" | null;
186
- openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
186
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | "gifFrameGallery" | "gifSpeedPicker" | null;
187
187
  openSidebar: {
188
188
  name: import("./types").SidebarName;
189
189
  tab?: import("./types").SidebarTabName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myoc/element",
3
- "version": "0.19.532",
3
+ "version": "0.19.533",
4
4
  "type": "module",
5
5
  "types": "./dist/types/element/src/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -64,9 +64,10 @@
64
64
  "build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
65
65
  },
66
66
  "dependencies": {
67
- "@excalidraw/common": "npm:@myoc/common@0.19.532",
68
- "@excalidraw/fractional-indexing": "npm:@myoc/fractional-indexing@0.19.532",
69
- "@excalidraw/math": "npm:@myoc/math@0.19.532",
67
+ "@excalidraw/common": "npm:@myoc/common@0.19.533",
68
+ "@excalidraw/fractional-indexing": "npm:@myoc/fractional-indexing@0.19.533",
69
+ "@excalidraw/math": "npm:@myoc/math@0.19.533",
70
+ "modern-gif": "2.1.0",
70
71
  "thumbhash": "0.1.1"
71
72
  }
72
73
  }