@myoc/excalidraw 0.19.519 → 0.19.521

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 (89) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/dist/dev/{chunk-ZGRXNVW4.js → chunk-IU2VFRFU.js} +4 -1
  3. package/dist/dev/chunk-IU2VFRFU.js.map +7 -0
  4. package/dist/dev/{chunk-RIK6B6HD.js → chunk-MN6E45MP.js} +62 -26
  5. package/dist/dev/chunk-MN6E45MP.js.map +7 -0
  6. package/dist/dev/{chunk-MCPNWEHU.js → chunk-P7I4FGOG.js} +2 -2
  7. package/dist/dev/data/{image-IRC25PM5.js → image-ZYGVHYLC.js} +3 -3
  8. package/dist/dev/index.css +12 -0
  9. package/dist/dev/index.css.map +2 -2
  10. package/dist/dev/index.js +1454 -452
  11. package/dist/dev/index.js.map +4 -4
  12. package/dist/dev/locales/{en-RQFAMS2U.js → en-25BPHB4T.js} +2 -2
  13. package/dist/dev/subset-shared.chunk.js +1 -1
  14. package/dist/dev/subset-worker.chunk.js +1 -1
  15. package/dist/prod/{chunk-VHQT4IVX.js → chunk-3UXKIWVY.js} +2 -2
  16. package/dist/prod/chunk-BNYGVLQX.js +4 -0
  17. package/dist/prod/{chunk-QW7MIEK6.js → chunk-ZYOK2JIN.js} +1 -1
  18. package/dist/prod/data/image-OFIWDJ6Z.js +1 -0
  19. package/dist/prod/index.css +1 -1
  20. package/dist/prod/index.js +20 -20
  21. package/dist/prod/locales/{en-6UCVDQQ7.js → en-AH5BYWXT.js} +1 -1
  22. package/dist/prod/subset-shared.chunk.js +1 -1
  23. package/dist/prod/subset-worker.chunk.js +1 -1
  24. package/dist/types/common/src/constants.d.ts +8 -5
  25. package/dist/types/common/src/utils.d.ts +0 -42
  26. package/dist/types/element/src/comparisons.d.ts +1 -0
  27. package/dist/types/element/src/image.d.ts +5 -0
  28. package/dist/types/element/src/newElement.d.ts +2 -0
  29. package/dist/types/element/src/types.d.ts +8 -0
  30. package/dist/types/excalidraw/actions/actionBoundText.d.ts +4 -2
  31. package/dist/types/excalidraw/actions/actionCanvas.d.ts +22 -11
  32. package/dist/types/excalidraw/actions/actionClipboard.d.ts +4 -2
  33. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +2 -1
  34. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +6 -3
  35. package/dist/types/excalidraw/actions/actionDeselect.d.ts +2 -1
  36. package/dist/types/excalidraw/actions/actionElementLink.d.ts +2 -1
  37. package/dist/types/excalidraw/actions/actionElementLock.d.ts +4 -2
  38. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +2 -1
  39. package/dist/types/excalidraw/actions/actionExport.d.ts +4 -2
  40. package/dist/types/excalidraw/actions/actionFrame.d.ts +10 -4
  41. package/dist/types/excalidraw/actions/actionGroup.d.ts +4 -2
  42. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +4 -1
  43. package/dist/types/excalidraw/actions/actionLink.d.ts +2 -1
  44. package/dist/types/excalidraw/actions/actionMenu.d.ts +2 -1
  45. package/dist/types/excalidraw/actions/actionProperties.d.ts +16 -5
  46. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +2 -1
  47. package/dist/types/excalidraw/actions/actionStyles.d.ts +2 -1
  48. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +2 -1
  49. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +2 -1
  50. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +2 -1
  51. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +2 -1
  52. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +2 -1
  53. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +2 -1
  54. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +2 -1
  55. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +2 -1
  56. package/dist/types/excalidraw/actions/index.d.ts +1 -1
  57. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  58. package/dist/types/excalidraw/appState.d.ts +2 -1
  59. package/dist/types/excalidraw/clipboard.d.ts +34 -0
  60. package/dist/types/excalidraw/components/App.d.ts +12 -28
  61. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
  62. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +1 -1
  63. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
  64. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
  65. package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
  66. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
  67. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +2 -1
  68. package/dist/types/excalidraw/components/icons.d.ts +2 -0
  69. package/dist/types/excalidraw/data/blob.d.ts +2 -1
  70. package/dist/types/excalidraw/data/json.d.ts +2 -1
  71. package/dist/types/excalidraw/index.d.ts +4 -2
  72. package/dist/types/excalidraw/renderer/animation.d.ts +1 -0
  73. package/dist/types/excalidraw/scene/Renderer.d.ts +2 -0
  74. package/dist/types/excalidraw/scene/index.d.ts +1 -1
  75. package/dist/types/excalidraw/scene/types.d.ts +1 -0
  76. package/dist/types/excalidraw/scroll.d.ts +46 -0
  77. package/dist/types/excalidraw/types.d.ts +18 -3
  78. package/dist/types/laser-pointer/src/index.d.ts +2 -0
  79. package/dist/types/laser-pointer/src/math.d.ts +16 -0
  80. package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
  81. package/dist/types/laser-pointer/src/state.d.ts +35 -0
  82. package/package.json +4 -4
  83. package/dist/dev/chunk-RIK6B6HD.js.map +0 -7
  84. package/dist/dev/chunk-ZGRXNVW4.js.map +0 -7
  85. package/dist/prod/chunk-FL5QOM6C.js +0 -4
  86. package/dist/prod/data/image-7LG744DI.js +0 -1
  87. /package/dist/dev/{chunk-MCPNWEHU.js.map → chunk-P7I4FGOG.js.map} +0 -0
  88. /package/dist/dev/data/{image-IRC25PM5.js.map → image-ZYGVHYLC.js.map} +0 -0
  89. /package/dist/dev/locales/{en-RQFAMS2U.js.map → en-25BPHB4T.js.map} +0 -0
@@ -1,7 +1,7 @@
1
- import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, ColorTuple, EditorInterface } from "@excalidraw/common";
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, Arrowhead, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, ArrangeAlgorithms, BindMode, ExcalidrawTextElement } from "@excalidraw/element/types";
4
+ import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, ArrangeAlgorithms, BindMode, ExcalidrawTextElement, StrokeVariability } 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";
@@ -64,6 +64,8 @@ export type BinaryFileData = {
64
64
  id: FileId;
65
65
  fileName: string;
66
66
  dataURL: DataURL;
67
+ /** compact image placeholder, also stored on the corresponding image element */
68
+ thumbHash?: string;
67
69
  /**
68
70
  * Epoch timestamp in milliseconds
69
71
  */
@@ -294,9 +296,10 @@ export interface AppState {
294
296
  currentItemStrokeColor: string;
295
297
  currentItemBackgroundColor: string;
296
298
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
297
- currentItemStrokeWidth: number;
299
+ currentItemStrokeWidthKey: StrokeWidthKey;
298
300
  currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
299
301
  currentItemRoughness: number;
302
+ currentItemStrokeVariability: StrokeVariability;
300
303
  currentItemOpacity: number;
301
304
  currentItemFontFamily: FontFamilyValues;
302
305
  currentItemFontSize: number;
@@ -540,6 +543,8 @@ export interface ExcalidrawProps {
540
543
  nativeEvent: MouseEvent | React.PointerEvent<HTMLCanvasElement>;
541
544
  }>) => void;
542
545
  imageContextMenuItems?: (imageIds: readonly ExcalidrawElement["id"][]) => readonly ImageContextMenuItem[];
546
+ /** @internal Myoc app-only diagnostics for mobile drag/drop payloads. */
547
+ showDropEventDebugAlert?: boolean;
543
548
  onPointerDown?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
544
549
  onPointerUp?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
545
550
  onScrollChange?: (scrollX: number, scrollY: number, zoom: Zoom) => void;
@@ -590,6 +595,8 @@ export type ExportOpts = {
590
595
  export type ImageOptions = Partial<{
591
596
  maxWidthOrHeight: number;
592
597
  maxFileSizeBytes: number;
598
+ /** duration of the placeholder-to-full-image crossfade in milliseconds */
599
+ placeholderTransitionDuration: number;
593
600
  }>;
594
601
  export type CanvasActions = Partial<{
595
602
  changeViewBackgroundColor: boolean;
@@ -645,7 +652,13 @@ export type AppClassProperties = {
645
652
  imageCache: Map<FileId, {
646
653
  image: HTMLImageElement | Promise<HTMLImageElement>;
647
654
  mimeType: ValueOf<typeof IMAGE_MIME_TYPES>;
655
+ isPlaceholder?: boolean;
656
+ placeholderImage?: HTMLImageElement;
657
+ transitionStart?: number;
648
658
  }>;
659
+ imageLoadingProgress: App["imageLoadingProgress"];
660
+ imageLoadingProgressEmitter: App["imageLoadingProgressEmitter"];
661
+ imagePlaceholderUpdateEmitter: App["imagePlaceholderUpdateEmitter"];
649
662
  files: BinaryFiles;
650
663
  editorInterface: App["editorInterface"];
651
664
  scene: App["scene"];
@@ -774,6 +787,8 @@ export interface ExcalidrawImperativeAPI {
774
787
  refresh: InstanceType<typeof App>["refresh"];
775
788
  setToast: InstanceType<typeof App>["setToast"];
776
789
  addFiles: (data: BinaryFileData[]) => void;
790
+ addImagePlaceholder: (fileId: FileId, file: File) => Promise<void>;
791
+ setImageLoadingProgress: (fileId: FileId, progress: number | null) => void;
777
792
  addImageElementsToScene: (imageFiles: {
778
793
  file: File;
779
794
  customData: Record<string, any>;
@@ -0,0 +1,2 @@
1
+ export * from "./state";
2
+ export type { Point } from "./math";
@@ -0,0 +1,16 @@
1
+ export type Point = [x: number, y: number, r: number];
2
+ export declare function add([ax, ay, ar]: Point, [bx, by, br]: Point): Point;
3
+ export declare function sub([ax, ay, ar]: Point, [bx, by, br]: Point): Point;
4
+ export declare function smul([x, y, r]: Point, s: number): Point;
5
+ export declare function norm([x, y, r]: Point): Point;
6
+ export declare function rot([x, y, r]: Point, rad: number): Point;
7
+ export declare function plerp(a: Point, b: Point, t: number): Point;
8
+ export declare function lerp(a: number, b: number, t: number): number;
9
+ export declare function angle(p: Point, p1: Point, p2: Point): number;
10
+ export declare function normAngle(a: number): number;
11
+ export declare function mag([x, y]: Point): number;
12
+ export declare function dist([ax, ay]: Point, [bx, by]: Point): number;
13
+ export declare function getCircleAndPerpendicularLineIntersectionsAtPoint(point: Point, direction: Point, radius: number): [Point, Point];
14
+ export declare function runLength(ps: Point[]): number;
15
+ export declare const clamp: (v: number, min: number, max: number) => number;
16
+ export declare function distancePointToSegment(p3: Point, p1: Point, p2: Point): number;
@@ -0,0 +1,2 @@
1
+ import { type Point } from "./math";
2
+ export declare function douglasPeucker(points: Point[], epsilon: number): Point[];
@@ -0,0 +1,35 @@
1
+ import type { Point } from "./math";
2
+ export type SizeMappingDetails = {
3
+ pressure: number;
4
+ runningLength: number;
5
+ currentIndex: number;
6
+ totalLength: number;
7
+ };
8
+ export type LaserPointerOptions = {
9
+ size: number;
10
+ streamline: number;
11
+ simplify: number;
12
+ simplifyPhase: "tail" | "output" | "input";
13
+ keepHead: boolean;
14
+ sizeMapping: (details: SizeMappingDetails) => number;
15
+ };
16
+ export declare class LaserPointer {
17
+ static defaults: LaserPointerOptions;
18
+ static constants: {
19
+ cornerDetectionMaxAngle: number;
20
+ cornerDetectionVariance: (s: number) => 1 | 0.5;
21
+ maxTailLength: number;
22
+ };
23
+ options: LaserPointerOptions;
24
+ constructor(options: Partial<LaserPointerOptions>);
25
+ originalPoints: Point[];
26
+ private stablePoints;
27
+ private tailPoints;
28
+ private isFresh;
29
+ private get lastPoint();
30
+ addPoint(point: Point): void;
31
+ close(): void;
32
+ stabilizeTail(): void;
33
+ private getSize;
34
+ getStrokeOutline(sizeOverride?: number | undefined): Point[];
35
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myoc/excalidraw",
3
- "version": "0.19.519",
3
+ "version": "0.19.521",
4
4
  "type": "module",
5
5
  "types": "./dist/types/excalidraw/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -108,9 +108,9 @@
108
108
  "roughjs": "4.6.4",
109
109
  "sass": "1.51.0",
110
110
  "tunnel-rat": "0.1.2",
111
- "@excalidraw/common": "npm:@myoc/common@0.19.519",
112
- "@excalidraw/math": "npm:@myoc/math@0.19.519",
113
- "@excalidraw/element": "npm:@myoc/element@0.19.519"
111
+ "@excalidraw/common": "npm:@myoc/common@0.19.521",
112
+ "@excalidraw/math": "npm:@myoc/math@0.19.521",
113
+ "@excalidraw/element": "npm:@myoc/element@0.19.521"
114
114
  },
115
115
  "devDependencies": {
116
116
  "@size-limit/preset-big-lib": "9.0.0",