@nous-excalidraw/excalidraw 0.18.9-beta.2 → 0.18.9-beta.21

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 (94) hide show
  1. package/dist/dev/{chunk-DSYRTCAK.js → chunk-6PNL5SR6.js} +34 -14
  2. package/dist/dev/chunk-6PNL5SR6.js.map +7 -0
  3. package/dist/dev/{chunk-CYLA22NC.js → chunk-FGNDYJ2B.js} +2 -2
  4. package/dist/dev/{chunk-CYLA22NC.js.map → chunk-FGNDYJ2B.js.map} +1 -1
  5. package/dist/dev/{chunk-4JOINNOK.js → chunk-IXBA2ET3.js} +3 -1
  6. package/dist/dev/chunk-IXBA2ET3.js.map +7 -0
  7. package/dist/dev/components/TTDDialog/{CodeMirrorEditor-T4CL43BJ.js → CodeMirrorEditor-LUWBT76B.js} +2 -2
  8. package/dist/dev/data/{image-OB55CB4R.js → image-5IO6LC6F.js} +3 -3
  9. package/dist/dev/index.css +2 -2
  10. package/dist/dev/index.css.map +1 -1
  11. package/dist/dev/index.js +1598 -1039
  12. package/dist/dev/index.js.map +4 -4
  13. package/dist/dev/locales/{en-WD25OMHJ.js → en-FKZ7NP7W.js} +2 -2
  14. package/dist/dev/locales/{zh-CN-SZ37453H.js → zh-CN-MQID2QWX.js} +3 -1
  15. package/dist/dev/locales/zh-CN-MQID2QWX.js.map +7 -0
  16. package/dist/dev/subset-shared.chunk.js +1 -1
  17. package/dist/dev/subset-worker.chunk.js +1 -1
  18. package/dist/prod/{chunk-LOOWOR4L.js → chunk-KGPK36EJ.js} +1 -1
  19. package/dist/prod/{chunk-CR4SD7AI.js → chunk-TFET7NMD.js} +1 -1
  20. package/dist/prod/chunk-YAGSAM37.js +4 -0
  21. package/dist/prod/components/TTDDialog/{CodeMirrorEditor-KIQDCIKP.js → CodeMirrorEditor-QL4RYZUZ.js} +1 -1
  22. package/dist/prod/data/image-LRQMDLTI.js +1 -0
  23. package/dist/prod/index.css +1 -1
  24. package/dist/prod/index.js +41 -36
  25. package/dist/prod/locales/{en-CMP6EMR6.js → en-QIAUJ35X.js} +1 -1
  26. package/dist/prod/locales/{zh-CN-MVX3E32U.js → zh-CN-3F3C6RA5.js} +1 -1
  27. package/dist/prod/subset-shared.chunk.js +1 -1
  28. package/dist/prod/subset-worker.chunk.js +1 -1
  29. package/dist/types/common/src/constants.d.ts +12 -20
  30. package/dist/types/common/src/fontSize.d.ts +27 -0
  31. package/dist/types/common/src/index.d.ts +2 -0
  32. package/dist/types/common/src/strokeWidth.d.ts +68 -0
  33. package/dist/types/common/src/zoomDisplay.d.ts +3 -0
  34. package/dist/types/common/src/zoomStep.d.ts +15 -0
  35. package/dist/types/element/src/Scene.d.ts +1 -1
  36. package/dist/types/element/src/bounds.d.ts +6 -1
  37. package/dist/types/element/src/comparisons.d.ts +5 -5
  38. package/dist/types/element/src/frame.d.ts +2 -5
  39. package/dist/types/element/src/index.d.ts +1 -0
  40. package/dist/types/element/src/renderElement.d.ts +1 -0
  41. package/dist/types/element/src/resizeElements.d.ts +1 -2
  42. package/dist/types/element/src/selection.d.ts +1 -1
  43. package/dist/types/element/src/shape.d.ts +5 -3
  44. package/dist/types/element/src/strokeWidth.d.ts +11 -0
  45. package/dist/types/element/src/typeChecks.d.ts +3 -1
  46. package/dist/types/element/src/types.d.ts +8 -5
  47. package/dist/types/element/src/utils.d.ts +3 -1
  48. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +3 -0
  49. package/dist/types/excalidraw/actions/actionBoundText.d.ts +2 -0
  50. package/dist/types/excalidraw/actions/actionCanvas.d.ts +59 -31
  51. package/dist/types/excalidraw/actions/actionClipboard.d.ts +2 -0
  52. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +1 -0
  53. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +3 -0
  54. package/dist/types/excalidraw/actions/actionDeselect.d.ts +1 -0
  55. package/dist/types/excalidraw/actions/actionElementLink.d.ts +1 -0
  56. package/dist/types/excalidraw/actions/actionElementLock.d.ts +2 -0
  57. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +1 -0
  58. package/dist/types/excalidraw/actions/actionExport.d.ts +8 -6
  59. package/dist/types/excalidraw/actions/actionFrame.d.ts +38 -0
  60. package/dist/types/excalidraw/actions/actionGroup.d.ts +2 -0
  61. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +35 -0
  62. package/dist/types/excalidraw/actions/actionLink.d.ts +1 -0
  63. package/dist/types/excalidraw/actions/actionMenu.d.ts +1 -0
  64. package/dist/types/excalidraw/actions/actionProperties.d.ts +2 -0
  65. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +1 -0
  66. package/dist/types/excalidraw/actions/actionStyles.d.ts +1 -0
  67. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +1 -0
  68. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +1 -0
  69. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +1 -0
  70. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +1 -0
  71. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +1 -0
  72. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +1 -0
  73. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +1 -0
  74. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +1 -0
  75. package/dist/types/excalidraw/appState.d.ts +5 -5
  76. package/dist/types/excalidraw/components/App.d.ts +28 -3
  77. package/dist/types/excalidraw/components/icons.d.ts +1 -0
  78. package/dist/types/excalidraw/components/shapes.d.ts +22 -1
  79. package/dist/types/excalidraw/data/blob.d.ts +14 -12
  80. package/dist/types/excalidraw/data/json.d.ts +7 -6
  81. package/dist/types/excalidraw/scene/types.d.ts +7 -0
  82. package/dist/types/excalidraw/scene/zoom.d.ts +2 -0
  83. package/dist/types/excalidraw/snapping.d.ts +1 -1
  84. package/dist/types/excalidraw/types.d.ts +7 -2
  85. package/dist/types/utils/src/shape.d.ts +2 -2
  86. package/package.json +4 -4
  87. package/dist/dev/chunk-4JOINNOK.js.map +0 -7
  88. package/dist/dev/chunk-DSYRTCAK.js.map +0 -7
  89. package/dist/dev/locales/zh-CN-SZ37453H.js.map +0 -7
  90. package/dist/prod/chunk-HFHOWOFT.js +0 -4
  91. package/dist/prod/data/image-5LSIY7YB.js +0 -1
  92. /package/dist/dev/components/TTDDialog/{CodeMirrorEditor-T4CL43BJ.js.map → CodeMirrorEditor-LUWBT76B.js.map} +0 -0
  93. /package/dist/dev/data/{image-OB55CB4R.js.map → image-5IO6LC6F.js.map} +0 -0
  94. /package/dist/dev/locales/{en-WD25OMHJ.js.map → en-FKZ7NP7W.js.map} +0 -0
@@ -72,6 +72,7 @@ export declare const actionGroup: {
72
72
  currentItemBackgroundColor: string;
73
73
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
74
74
  currentItemStrokeWidth: number;
75
+ currentItemStrokeWidthCustom: boolean;
75
76
  currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
76
77
  currentItemRoughness: number;
77
78
  currentItemOpacity: number;
@@ -249,6 +250,7 @@ export declare const actionUngroup: {
249
250
  currentItemBackgroundColor: string;
250
251
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
251
252
  currentItemStrokeWidth: number;
253
+ currentItemStrokeWidthCustom: boolean;
252
254
  currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
253
255
  currentItemRoughness: number;
254
256
  currentItemOpacity: number;
@@ -99,6 +99,7 @@ export declare const actionToggleLinearEditor: {
99
99
  currentItemBackgroundColor: string;
100
100
  currentItemFillStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["fillStyle"];
101
101
  currentItemStrokeWidth: number;
102
+ currentItemStrokeWidthCustom: boolean;
102
103
  currentItemStrokeStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["strokeStyle"];
103
104
  currentItemRoughness: number;
104
105
  currentItemOpacity: number;
@@ -389,6 +390,40 @@ export declare const actionTogglePolygon: {
389
390
  link: string | null;
390
391
  locked: boolean;
391
392
  customData?: Record<string, any>;
393
+ }> & {
394
+ type: "triangle";
395
+ } & {
396
+ index: import("@nous-excalidraw/element/types").FractionalIndex;
397
+ }) | (Readonly<{
398
+ id: string;
399
+ x: number;
400
+ y: number;
401
+ strokeColor: string;
402
+ backgroundColor: string;
403
+ fillStyle: import("@nous-excalidraw/element/types").FillStyle;
404
+ strokeWidth: number;
405
+ strokeStyle: import("@nous-excalidraw/element/types").StrokeStyle;
406
+ roundness: null | {
407
+ type: import("@nous-excalidraw/element/types").RoundnessType;
408
+ value?: number;
409
+ };
410
+ roughness: number;
411
+ opacity: number;
412
+ width: number;
413
+ height: number;
414
+ angle: import("@nous-excalidraw/math").Radians;
415
+ seed: number;
416
+ version: number;
417
+ versionNonce: number;
418
+ index: import("@nous-excalidraw/element/types").FractionalIndex | null;
419
+ isDeleted: boolean;
420
+ groupIds: readonly import("@nous-excalidraw/element/types").GroupId[];
421
+ frameId: string | null;
422
+ boundElements: readonly import("@nous-excalidraw/element/types").BoundElement[] | null;
423
+ updated: number;
424
+ link: string | null;
425
+ locked: boolean;
426
+ customData?: Record<string, any>;
392
427
  }> & {
393
428
  type: "ellipse";
394
429
  } & {
@@ -63,6 +63,7 @@ export declare const actionLink: {
63
63
  currentItemBackgroundColor: string;
64
64
  currentItemFillStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["fillStyle"];
65
65
  currentItemStrokeWidth: number;
66
+ currentItemStrokeWidthCustom: boolean;
66
67
  currentItemStrokeStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["strokeStyle"];
67
68
  currentItemRoughness: number;
68
69
  currentItemOpacity: number;
@@ -70,6 +70,7 @@ export declare const actionShortcuts: {
70
70
  currentItemBackgroundColor: string;
71
71
  currentItemFillStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["fillStyle"];
72
72
  currentItemStrokeWidth: number;
73
+ currentItemStrokeWidthCustom: boolean;
73
74
  currentItemStrokeStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["strokeStyle"];
74
75
  currentItemRoughness: number;
75
76
  currentItemOpacity: number;
@@ -92,6 +92,7 @@ export declare const actionDecreaseFontSize: {
92
92
  currentItemBackgroundColor: string;
93
93
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
94
94
  currentItemStrokeWidth: number;
95
+ currentItemStrokeWidthCustom: boolean;
95
96
  currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
96
97
  currentItemRoughness: number;
97
98
  currentItemOpacity: number;
@@ -265,6 +266,7 @@ export declare const actionIncreaseFontSize: {
265
266
  currentItemBackgroundColor: string;
266
267
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
267
268
  currentItemStrokeWidth: number;
269
+ currentItemStrokeWidthCustom: boolean;
268
270
  currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
269
271
  currentItemRoughness: number;
270
272
  currentItemOpacity: number;
@@ -70,6 +70,7 @@ export declare const actionSelectAll: {
70
70
  currentItemBackgroundColor: string;
71
71
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
72
72
  currentItemStrokeWidth: number;
73
+ currentItemStrokeWidthCustom: boolean;
73
74
  currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
74
75
  currentItemRoughness: number;
75
76
  currentItemOpacity: number;
@@ -68,6 +68,7 @@ export declare const actionCopyStyles: {
68
68
  currentItemBackgroundColor: string;
69
69
  currentItemFillStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["fillStyle"];
70
70
  currentItemStrokeWidth: number;
71
+ currentItemStrokeWidthCustom: boolean;
71
72
  currentItemStrokeStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["strokeStyle"];
72
73
  currentItemRoughness: number;
73
74
  currentItemOpacity: number;
@@ -64,6 +64,7 @@ export declare const actionToggleArrowBinding: {
64
64
  currentItemBackgroundColor: string;
65
65
  currentItemFillStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["fillStyle"];
66
66
  currentItemStrokeWidth: number;
67
+ currentItemStrokeWidthCustom: boolean;
67
68
  currentItemStrokeStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["strokeStyle"];
68
69
  currentItemRoughness: number;
69
70
  currentItemOpacity: number;
@@ -69,6 +69,7 @@ export declare const actionToggleGridMode: {
69
69
  currentItemBackgroundColor: string;
70
70
  currentItemFillStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["fillStyle"];
71
71
  currentItemStrokeWidth: number;
72
+ currentItemStrokeWidthCustom: boolean;
72
73
  currentItemStrokeStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["strokeStyle"];
73
74
  currentItemRoughness: number;
74
75
  currentItemOpacity: number;
@@ -64,6 +64,7 @@ export declare const actionToggleMidpointSnapping: {
64
64
  currentItemBackgroundColor: string;
65
65
  currentItemFillStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["fillStyle"];
66
66
  currentItemStrokeWidth: number;
67
+ currentItemStrokeWidthCustom: boolean;
67
68
  currentItemStrokeStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["strokeStyle"];
68
69
  currentItemRoughness: number;
69
70
  currentItemOpacity: number;
@@ -67,6 +67,7 @@ export declare const actionToggleObjectsSnapMode: {
67
67
  currentItemBackgroundColor: string;
68
68
  currentItemFillStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["fillStyle"];
69
69
  currentItemStrokeWidth: number;
70
+ currentItemStrokeWidthCustom: boolean;
70
71
  currentItemStrokeStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["strokeStyle"];
71
72
  currentItemRoughness: number;
72
73
  currentItemOpacity: number;
@@ -73,6 +73,7 @@ export declare const actionToggleSearchMenu: {
73
73
  currentItemBackgroundColor: string;
74
74
  currentItemFillStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["fillStyle"];
75
75
  currentItemStrokeWidth: number;
76
+ currentItemStrokeWidthCustom: boolean;
76
77
  currentItemStrokeStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["strokeStyle"];
77
78
  currentItemRoughness: number;
78
79
  currentItemOpacity: number;
@@ -69,6 +69,7 @@ export declare const actionToggleStats: {
69
69
  currentItemBackgroundColor: string;
70
70
  currentItemFillStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["fillStyle"];
71
71
  currentItemStrokeWidth: number;
72
+ currentItemStrokeWidthCustom: boolean;
72
73
  currentItemStrokeStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["strokeStyle"];
73
74
  currentItemRoughness: number;
74
75
  currentItemOpacity: number;
@@ -66,6 +66,7 @@ export declare const actionToggleViewMode: {
66
66
  currentItemBackgroundColor: string;
67
67
  currentItemFillStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["fillStyle"];
68
68
  currentItemStrokeWidth: number;
69
+ currentItemStrokeWidthCustom: boolean;
69
70
  currentItemStrokeStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["strokeStyle"];
70
71
  currentItemRoughness: number;
71
72
  currentItemOpacity: number;
@@ -66,6 +66,7 @@ export declare const actionToggleZenMode: {
66
66
  currentItemBackgroundColor: string;
67
67
  currentItemFillStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["fillStyle"];
68
68
  currentItemStrokeWidth: number;
69
+ currentItemStrokeWidthCustom: boolean;
69
70
  currentItemStrokeStyle: import("@nous-excalidraw/element/types").ExcalidrawElement["strokeStyle"];
70
71
  currentItemRoughness: number;
71
72
  currentItemOpacity: number;
@@ -3,12 +3,10 @@ export declare const getDefaultAppState: () => Omit<AppState, "offsetTop" | "off
3
3
  export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>) => {
4
4
  viewBackgroundColor?: string | undefined;
5
5
  theme?: import("@nous-excalidraw/element/types").Theme | undefined;
6
- name?: string | null | undefined;
7
6
  zoom?: Readonly<{
8
7
  value: NormalizedZoomValue;
9
8
  }> | undefined;
10
- isBindingEnabled?: boolean | undefined;
11
- isMidpointSnappingEnabled?: boolean | undefined;
9
+ name?: string | null | undefined;
12
10
  selectedElementIds?: Readonly<{
13
11
  [id: string]: true;
14
12
  }> | undefined;
@@ -24,12 +22,12 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
24
22
  [groupId: string]: boolean;
25
23
  } | undefined;
26
24
  selectedLinearElement?: import("@nous-excalidraw/element").LinearElementEditor | null | undefined;
25
+ isBindingEnabled?: boolean | undefined;
26
+ isMidpointSnappingEnabled?: boolean | undefined;
27
27
  zenModeEnabled?: boolean | undefined;
28
28
  shouldCacheIgnoreZoom?: boolean | undefined;
29
29
  exportScale?: number | undefined;
30
30
  currentItemArrowType?: "round" | "sharp" | "elbow" | undefined;
31
- bindMode?: import("@nous-excalidraw/element/types").BindMode | undefined;
32
- gridSize?: number | undefined;
33
31
  showWelcomeScreen?: boolean | undefined;
34
32
  boxSelectionMode?: import("./types").BoxSelectionMode | undefined;
35
33
  bindingPreference?: "enabled" | "disabled" | undefined;
@@ -67,6 +65,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
67
65
  previousSelectedElementIds?: {
68
66
  [id: string]: true;
69
67
  } | undefined;
68
+ gridSize?: number | undefined;
70
69
  gridStep?: number | undefined;
71
70
  gridModeEnabled?: boolean | undefined;
72
71
  stats?: {
@@ -77,6 +76,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
77
76
  lockedMultiSelections?: {
78
77
  [groupId: string]: true;
79
78
  } | undefined;
79
+ bindMode?: import("@nous-excalidraw/element/types").BindMode | undefined;
80
80
  };
81
81
  export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
82
82
  viewBackgroundColor?: string | undefined;
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { AppEventBus, type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@nous-excalidraw/common";
3
3
  import { LinearElementEditor, FlowChartCreator, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@nous-excalidraw/element";
4
+ import type { MaybeTransformHandleType, TransformHandleType } from "@nous-excalidraw/element";
4
5
  import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@nous-excalidraw/element/types";
5
6
  import type { Mutable } from "@nous-excalidraw/common/utility-types";
6
7
  import { ActionManager } from "../actions/manager";
@@ -121,6 +122,7 @@ declare class App extends React.Component<AppProps, AppState> {
121
122
  x: number;
122
123
  y: number;
123
124
  } | null;
125
+ hoveredCornerTransformHandleType: TransformHandleType | null;
124
126
  private lastCompletedCanvasClicks;
125
127
  /** previous frame pointer coords */
126
128
  previousPointerMoveCoords: {
@@ -156,7 +158,7 @@ declare class App extends React.Component<AppProps, AppState> {
156
158
  };
157
159
  originalElements: Map<string, NonDeleted<ExcalidrawElement>>;
158
160
  resize: {
159
- handleType: import("@nous-excalidraw/element").MaybeTransformHandleType;
161
+ handleType: MaybeTransformHandleType;
160
162
  isResizing: boolean;
161
163
  offset: {
162
164
  x: number;
@@ -218,7 +220,7 @@ declare class App extends React.Component<AppProps, AppState> {
218
220
  };
219
221
  originalElements: Map<string, NonDeleted<ExcalidrawElement>>;
220
222
  resize: {
221
- handleType: import("@nous-excalidraw/element").MaybeTransformHandleType;
223
+ handleType: MaybeTransformHandleType;
222
224
  isResizing: boolean;
223
225
  offset: {
224
226
  x: number;
@@ -380,6 +382,7 @@ declare class App extends React.Component<AppProps, AppState> {
380
382
  * 1 = 100% zoom, 2 = 200% zoom, 0.5 = 50% zoom
381
383
  */
382
384
  value: number) => void;
385
+ private syncSceneStrokeWidthsForZoom;
383
386
  private cancelInProgressAnimation;
384
387
  scrollToContent: (
385
388
  /**
@@ -398,7 +401,7 @@ declare class App extends React.Component<AppProps, AppState> {
398
401
  fitToContent?: never;
399
402
  fitToViewport?: boolean;
400
403
  /** when fitToViewport=true, how much screen should the content cover,
401
- * between 0.02 (2%) and 1 (100%)
404
+ * between 0.01 (1%) and 1 (100%)
402
405
  */
403
406
  viewportZoomFactor?: number;
404
407
  animate?: boolean;
@@ -407,6 +410,15 @@ declare class App extends React.Component<AppProps, AppState> {
407
410
  minZoom?: number;
408
411
  maxZoom?: number;
409
412
  canvasOffsets?: Offsets;
413
+ /** offsets for zoom / effective viewport only */
414
+ fitCanvasOffsets?: Offsets;
415
+ /** offsets for scroll centering only (defaults to fitCanvasOffsets) */
416
+ scrollCanvasOffsets?: Offsets;
417
+ /**
418
+ * 宿主 StyleBar 定位在元素上方 HOST_STYLEBAR_GAP_ABOVE_ELEMENT px;
419
+ * 仅钳制 scrollY 下限,避免把 StyleBar 高度误当作顶栏叠入 centerScrollOn。
420
+ */
421
+ clampHostStylebarAboveElement?: boolean;
410
422
  }) => void;
411
423
  private maybeUnfollowRemoteUser;
412
424
  /** use when changing scrollX/scrollY/zoom based on user interaction */
@@ -448,6 +460,15 @@ declare class App extends React.Component<AppProps, AppState> {
448
460
  force?: boolean;
449
461
  }) => boolean;
450
462
  private updateCurrentCursorPosition;
463
+ /**
464
+ * 宿主业务顶部 UI 占位(与 web-art-flow 布局对齐):
465
+ * - tool-bar-wrapper: 顶部工具栏
466
+ * - stylebar-wrapper: 选中元素上方的样式栏(moveStyleMenuBar 定位在元素上方)
467
+ */
468
+ private static HOST_TOOLBAR_SELECTOR;
469
+ /** utils/index.ts: MEUE_LEFT_BAR_HEIGHT(47) + STYLE_BAR_TO_ELEMENT_TOP_GAP_PX(26) */
470
+ private static HOST_STYLEBAR_GAP_ABOVE_ELEMENT;
471
+ private getHostUiBottomRelativeToContainer;
451
472
  getEditorUIOffsets: () => Offsets;
452
473
  private onKeyDown;
453
474
  private onKeyUp;
@@ -502,6 +523,9 @@ declare class App extends React.Component<AppProps, AppState> {
502
523
  private getElementLinkAtPosition;
503
524
  private handleElementLinkClick;
504
525
  private getTopLayerFrameAtSceneCoords;
526
+ private getHoveredCornerTransformHandleType;
527
+ private syncHoveredCornerTransformHandleType;
528
+ private clearHoveredCornerTransformHandleType;
505
529
  private clearHoverOutlineIfNeeded;
506
530
  /** Unified frame hover: title band, frame interior, or any element inside the frame. */
507
531
  private computeHoveredFrameId;
@@ -547,6 +571,7 @@ declare class App extends React.Component<AppProps, AppState> {
547
571
  }) => NonDeleted<ExcalidrawEmbeddableElement> | undefined;
548
572
  private newImagePlaceholder;
549
573
  private handleLinearElementOnPointerDown;
574
+ private getNewElementStrokeProps;
550
575
  private getCurrentItemRoundness;
551
576
  private createGenericElementOnPointerDown;
552
577
  private createFrameElementOnPointerDown;
@@ -25,6 +25,7 @@ export declare const SelectionIcon: import("react/jsx-runtime").JSX.Element;
25
25
  export declare const LassoIcon: import("react/jsx-runtime").JSX.Element;
26
26
  export declare const RectangleIcon: import("react/jsx-runtime").JSX.Element;
27
27
  export declare const DiamondIcon: import("react/jsx-runtime").JSX.Element;
28
+ export declare const TriangleIcon: import("react/jsx-runtime").JSX.Element;
28
29
  export declare const EllipseIcon: import("react/jsx-runtime").JSX.Element;
29
30
  export declare const ArrowIcon: import("react/jsx-runtime").JSX.Element;
30
31
  export declare const LineIcon: import("react/jsx-runtime").JSX.Element;
@@ -27,6 +27,13 @@ export declare const SHAPES: readonly [{
27
27
  readonly numericKey: "3";
28
28
  readonly fillable: true;
29
29
  readonly toolbar: true;
30
+ }, {
31
+ readonly icon: import("react/jsx-runtime").JSX.Element;
32
+ readonly value: "triangle";
33
+ readonly key: "g";
34
+ readonly numericKey: null;
35
+ readonly fillable: true;
36
+ readonly toolbar: true;
30
37
  }, {
31
38
  readonly icon: import("react/jsx-runtime").JSX.Element;
32
39
  readonly value: "ellipse";
@@ -112,6 +119,13 @@ export declare const getToolbarTools: (app: AppClassProperties) => readonly [{
112
119
  readonly numericKey: "3";
113
120
  readonly fillable: true;
114
121
  readonly toolbar: true;
122
+ }, {
123
+ readonly icon: import("react/jsx-runtime").JSX.Element;
124
+ readonly value: "triangle";
125
+ readonly key: "g";
126
+ readonly numericKey: null;
127
+ readonly fillable: true;
128
+ readonly toolbar: true;
115
129
  }, {
116
130
  readonly icon: import("react/jsx-runtime").JSX.Element;
117
131
  readonly value: "ellipse";
@@ -203,6 +217,13 @@ export declare const getToolbarTools: (app: AppClassProperties) => readonly [{
203
217
  readonly numericKey: "3";
204
218
  readonly fillable: true;
205
219
  readonly toolbar: true;
220
+ } | {
221
+ readonly icon: import("react/jsx-runtime").JSX.Element;
222
+ readonly value: "triangle";
223
+ readonly key: "g";
224
+ readonly numericKey: null;
225
+ readonly fillable: true;
226
+ readonly toolbar: true;
206
227
  } | {
207
228
  readonly icon: import("react/jsx-runtime").JSX.Element;
208
229
  readonly value: "ellipse";
@@ -260,4 +281,4 @@ export declare const getToolbarTools: (app: AppClassProperties) => readonly [{
260
281
  readonly fillable: false;
261
282
  readonly toolbar: false;
262
283
  })[]];
263
- export declare const findShapeByKey: (key: string, app: AppClassProperties) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "lasso" | "eraser" | "hand" | "laser" | null;
284
+ export declare const findShapeByKey: (key: string, app: AppClassProperties) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "triangle" | "ellipse" | "image" | "freedraw" | "lasso" | "eraser" | "hand" | "laser" | null;
@@ -22,6 +22,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
22
22
  appState: {
23
23
  viewBackgroundColor: string;
24
24
  theme: import("@nous-excalidraw/element/types").Theme;
25
+ zoom: import("../types").Zoom;
25
26
  frameRendering: {
26
27
  enabled: boolean;
27
28
  name: boolean;
@@ -29,9 +30,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
29
30
  clip: boolean;
30
31
  };
31
32
  name: string | null;
32
- zoom: import("../types").Zoom;
33
- isBindingEnabled: boolean;
34
- isMidpointSnappingEnabled: boolean;
35
33
  selectedElementIds: Readonly<{
36
34
  [id: string]: true;
37
35
  }>;
@@ -74,11 +72,14 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
74
72
  selectedLinearElement: import("@nous-excalidraw/element").LinearElementEditor | null;
75
73
  multiElement: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawLinearElement> | null;
76
74
  newElement: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
75
+ isBindingEnabled: boolean;
76
+ isMidpointSnappingEnabled: boolean;
77
77
  suggestedBinding: {
78
78
  element: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawBindableElement>;
79
79
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
80
80
  } | null;
81
81
  isRotating: boolean;
82
+ isResizing: boolean;
82
83
  elementsToHighlight: import("@nous-excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
83
84
  collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
84
85
  snapLines: readonly import("../snapping").SnapLine[];
@@ -98,8 +99,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
98
99
  exportScale: number;
99
100
  currentItemArrowType: "sharp" | "round" | "elbow";
100
101
  selectedElementsAreBeingDragged: boolean;
101
- bindMode: import("@nous-excalidraw/element/types").BindMode;
102
- gridSize: number;
103
102
  contextMenu: {
104
103
  items: import("../components/ContextMenu").ContextMenuItems;
105
104
  top: number;
@@ -127,6 +126,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
127
126
  currentItemBackgroundColor: string;
128
127
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
129
128
  currentItemStrokeWidth: number;
129
+ currentItemStrokeWidthCustom: boolean;
130
130
  currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
131
131
  currentItemRoughness: number;
132
132
  currentItemOpacity: number;
@@ -139,7 +139,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
139
139
  currentItemRoundness: import("@nous-excalidraw/element/types").StrokeRoundness;
140
140
  cursorButton: "up" | "down";
141
141
  scrolledOutside: boolean;
142
- isResizing: boolean;
143
142
  openMenu: "canvas" | null;
144
143
  openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
145
144
  openSidebar: {
@@ -156,6 +155,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
156
155
  closable?: boolean;
157
156
  duration?: number;
158
157
  } | null;
158
+ gridSize: number;
159
159
  gridStep: number;
160
160
  gridModeEnabled: boolean;
161
161
  fileHandle: FileSystemFileHandle | null;
@@ -174,6 +174,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
174
174
  lockedMultiSelections: {
175
175
  [groupId: string]: true;
176
176
  };
177
+ bindMode: import("@nous-excalidraw/element/types").BindMode;
177
178
  };
178
179
  files: import("../types").BinaryFiles;
179
180
  };
@@ -190,6 +191,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
190
191
  appState: {
191
192
  viewBackgroundColor: string;
192
193
  theme: import("@nous-excalidraw/element/types").Theme;
194
+ zoom: import("../types").Zoom;
193
195
  frameRendering: {
194
196
  enabled: boolean;
195
197
  name: boolean;
@@ -197,9 +199,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
197
199
  clip: boolean;
198
200
  };
199
201
  name: string | null;
200
- zoom: import("../types").Zoom;
201
- isBindingEnabled: boolean;
202
- isMidpointSnappingEnabled: boolean;
203
202
  selectedElementIds: Readonly<{
204
203
  [id: string]: true;
205
204
  }>;
@@ -242,11 +241,14 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
242
241
  selectedLinearElement: import("@nous-excalidraw/element").LinearElementEditor | null;
243
242
  multiElement: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawLinearElement> | null;
244
243
  newElement: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
244
+ isBindingEnabled: boolean;
245
+ isMidpointSnappingEnabled: boolean;
245
246
  suggestedBinding: {
246
247
  element: import("@nous-excalidraw/element/types").NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawBindableElement>;
247
248
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
248
249
  } | null;
249
250
  isRotating: boolean;
251
+ isResizing: boolean;
250
252
  elementsToHighlight: import("@nous-excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
251
253
  collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
252
254
  snapLines: readonly import("../snapping").SnapLine[];
@@ -266,8 +268,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
266
268
  exportScale: number;
267
269
  currentItemArrowType: "sharp" | "round" | "elbow";
268
270
  selectedElementsAreBeingDragged: boolean;
269
- bindMode: import("@nous-excalidraw/element/types").BindMode;
270
- gridSize: number;
271
271
  contextMenu: {
272
272
  items: import("../components/ContextMenu").ContextMenuItems;
273
273
  top: number;
@@ -295,6 +295,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
295
295
  currentItemBackgroundColor: string;
296
296
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
297
297
  currentItemStrokeWidth: number;
298
+ currentItemStrokeWidthCustom: boolean;
298
299
  currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
299
300
  currentItemRoughness: number;
300
301
  currentItemOpacity: number;
@@ -307,7 +308,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
307
308
  currentItemRoundness: import("@nous-excalidraw/element/types").StrokeRoundness;
308
309
  cursorButton: "up" | "down";
309
310
  scrolledOutside: boolean;
310
- isResizing: boolean;
311
311
  openMenu: "canvas" | null;
312
312
  openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
313
313
  openSidebar: {
@@ -324,6 +324,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
324
324
  closable?: boolean;
325
325
  duration?: number;
326
326
  } | null;
327
+ gridSize: number;
327
328
  gridStep: number;
328
329
  gridModeEnabled: boolean;
329
330
  fileHandle: FileSystemFileHandle | null;
@@ -342,6 +343,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
342
343
  lockedMultiSelections: {
343
344
  [groupId: string]: true;
344
345
  };
346
+ bindMode: import("@nous-excalidraw/element/types").BindMode;
345
347
  };
346
348
  files: import("../types").BinaryFiles;
347
349
  }>;
@@ -20,6 +20,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
20
20
  appState: {
21
21
  viewBackgroundColor: string;
22
22
  theme: import("@nous-excalidraw/element/types").Theme;
23
+ zoom: import("../types").Zoom;
23
24
  frameRendering: {
24
25
  enabled: boolean;
25
26
  name: boolean;
@@ -27,9 +28,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
27
28
  clip: boolean;
28
29
  };
29
30
  name: string | null;
30
- zoom: import("../types").Zoom;
31
- isBindingEnabled: boolean;
32
- isMidpointSnappingEnabled: boolean;
33
31
  selectedElementIds: Readonly<{
34
32
  [id: string]: true;
35
33
  }>;
@@ -72,11 +70,14 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
72
70
  selectedLinearElement: import("@nous-excalidraw/element").LinearElementEditor | null;
73
71
  multiElement: NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawLinearElement> | null;
74
72
  newElement: NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
73
+ isBindingEnabled: boolean;
74
+ isMidpointSnappingEnabled: boolean;
75
75
  suggestedBinding: {
76
76
  element: NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawBindableElement>;
77
77
  midPoint?: import("@nous-excalidraw/math").GlobalPoint;
78
78
  } | null;
79
79
  isRotating: boolean;
80
+ isResizing: boolean;
80
81
  elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
81
82
  collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
82
83
  snapLines: readonly import("../snapping").SnapLine[];
@@ -96,8 +97,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
96
97
  exportScale: number;
97
98
  currentItemArrowType: "sharp" | "round" | "elbow";
98
99
  selectedElementsAreBeingDragged: boolean;
99
- bindMode: import("@nous-excalidraw/element/types").BindMode;
100
- gridSize: number;
101
100
  contextMenu: {
102
101
  items: import("../components/ContextMenu").ContextMenuItems;
103
102
  top: number;
@@ -125,6 +124,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
125
124
  currentItemBackgroundColor: string;
126
125
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
127
126
  currentItemStrokeWidth: number;
127
+ currentItemStrokeWidthCustom: boolean;
128
128
  currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
129
129
  currentItemRoughness: number;
130
130
  currentItemOpacity: number;
@@ -137,7 +137,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
137
137
  currentItemRoundness: import("@nous-excalidraw/element/types").StrokeRoundness;
138
138
  cursorButton: "up" | "down";
139
139
  scrolledOutside: boolean;
140
- isResizing: boolean;
141
140
  openMenu: "canvas" | null;
142
141
  openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
143
142
  openSidebar: {
@@ -154,6 +153,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
154
153
  closable?: boolean;
155
154
  duration?: number;
156
155
  } | null;
156
+ gridSize: number;
157
157
  gridStep: number;
158
158
  gridModeEnabled: boolean;
159
159
  fileHandle: FileSystemFileHandle | null;
@@ -172,6 +172,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
172
172
  lockedMultiSelections: {
173
173
  [groupId: string]: true;
174
174
  };
175
+ bindMode: import("@nous-excalidraw/element/types").BindMode;
175
176
  };
176
177
  files: BinaryFiles;
177
178
  }>;
@@ -1,4 +1,5 @@
1
1
  import type { UserIdleState, EditorInterface } from "@nous-excalidraw/common";
2
+ import type { TransformHandleType } from "@nous-excalidraw/element";
2
3
  import type { ExcalidrawElement, NonDeletedElementsMap, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "@nous-excalidraw/element/types";
3
4
  import type { MakeBrand } from "@nous-excalidraw/common/utility-types";
4
5
  import type { AppClassProperties, AppState, EmbedsValidationStatus, ElementsPendingErasure, InteractiveCanvasAppState, StaticCanvasAppState, SocketId, PendingExcalidrawElements } from "../types";
@@ -16,6 +17,9 @@ export type StaticCanvasRenderConfig = {
16
17
  elementsPendingErasure: ElementsPendingErasure;
17
18
  pendingFlowchartNodes: PendingExcalidrawElements | null;
18
19
  theme: AppState["theme"];
20
+ zoom: AppState["zoom"]["value"];
21
+ /** Canvas rasterization scale; defaults to `zoom` when omitted. */
22
+ renderScale?: number;
19
23
  };
20
24
  export type SVGRenderConfig = {
21
25
  offsetX: number;
@@ -45,6 +49,8 @@ export type InteractiveCanvasRenderConfig = {
45
49
  remotePointerUsernames: Map<SocketId, string>;
46
50
  remotePointerButton: Map<SocketId, string | undefined>;
47
51
  selectionColor: string;
52
+ /** nw/ne/sw/se when cursor is over a corner resize handle */
53
+ hoveredCornerTransformHandleType: TransformHandleType | null;
48
54
  lastViewportPosition: {
49
55
  x: number;
50
56
  y: number;
@@ -127,6 +133,7 @@ export type ElementShapes = {
127
133
  rectangle: Drawable;
128
134
  ellipse: Drawable;
129
135
  diamond: Drawable;
136
+ triangle: Drawable;
130
137
  iframe: Drawable;
131
138
  embeddable: Drawable;
132
139
  freedraw: (Drawable | SVGPathString)[];
@@ -9,4 +9,6 @@ export declare const getStateForZoom: ({ viewportX, viewportY, nextZoom, }: {
9
9
  zoom: {
10
10
  value: NormalizedZoomValue;
11
11
  };
12
+ currentItemStrokeWidth: number;
13
+ currentItemFontSize: number;
12
14
  };