@myoc/excalidraw 0.19.518 → 0.19.520

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/CHANGELOG.md +166 -0
  2. package/dist/dev/{chunk-36IX6I7U.js → chunk-FQHULQ5P.js} +86 -31
  3. package/dist/dev/chunk-FQHULQ5P.js.map +7 -0
  4. package/dist/dev/{chunk-ZGRXNVW4.js → chunk-IU2VFRFU.js} +4 -1
  5. package/dist/dev/chunk-IU2VFRFU.js.map +7 -0
  6. package/dist/dev/{chunk-2ZDXTNY7.js → chunk-SJJUXTTF.js} +2 -2
  7. package/dist/dev/data/{image-VHQDH63K.js → image-X3JCQEUX.js} +3 -3
  8. package/dist/dev/index.css +14 -3
  9. package/dist/dev/index.css.map +2 -2
  10. package/dist/dev/index.js +1853 -981
  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-VW4XDTQW.js → chunk-3QXZ5NQO.js} +1 -1
  16. package/dist/prod/{chunk-VHQT4IVX.js → chunk-3UXKIWVY.js} +2 -2
  17. package/dist/prod/chunk-YJSNILE6.js +4 -0
  18. package/dist/prod/data/image-OBEPGJLJ.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/colors.d.ts +1 -1
  25. package/dist/types/common/src/constants.d.ts +8 -5
  26. package/dist/types/common/src/utils.d.ts +0 -42
  27. package/dist/types/element/src/bounds.d.ts +18 -1
  28. package/dist/types/element/src/comparisons.d.ts +1 -0
  29. package/dist/types/element/src/image.d.ts +5 -0
  30. package/dist/types/element/src/newElement.d.ts +2 -0
  31. package/dist/types/element/src/types.d.ts +8 -0
  32. package/dist/types/excalidraw/actions/actionBoundText.d.ts +6 -2
  33. package/dist/types/excalidraw/actions/actionCanvas.d.ts +33 -11
  34. package/dist/types/excalidraw/actions/actionClipboard.d.ts +6 -2
  35. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +3 -1
  36. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +9 -3
  37. package/dist/types/excalidraw/actions/actionDeselect.d.ts +3 -1
  38. package/dist/types/excalidraw/actions/actionElementLink.d.ts +3 -1
  39. package/dist/types/excalidraw/actions/actionElementLock.d.ts +6 -2
  40. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +3 -1
  41. package/dist/types/excalidraw/actions/actionExport.d.ts +6 -2
  42. package/dist/types/excalidraw/actions/actionFrame.d.ts +14 -4
  43. package/dist/types/excalidraw/actions/actionGroup.d.ts +6 -2
  44. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +5 -1
  45. package/dist/types/excalidraw/actions/actionLink.d.ts +3 -1
  46. package/dist/types/excalidraw/actions/actionMenu.d.ts +3 -1
  47. package/dist/types/excalidraw/actions/actionProperties.d.ts +18 -5
  48. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +3 -1
  49. package/dist/types/excalidraw/actions/actionStyles.d.ts +3 -1
  50. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +3 -1
  51. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +3 -1
  52. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +3 -1
  53. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +3 -1
  54. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +3 -1
  55. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +3 -1
  56. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +5 -3
  57. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +3 -1
  58. package/dist/types/excalidraw/actions/index.d.ts +1 -1
  59. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  60. package/dist/types/excalidraw/appState.d.ts +2 -1
  61. package/dist/types/excalidraw/components/App.d.ts +13 -28
  62. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
  63. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +1 -1
  64. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
  65. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
  66. package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
  67. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
  68. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +2 -1
  69. package/dist/types/excalidraw/components/icons.d.ts +2 -0
  70. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +7 -4
  71. package/dist/types/excalidraw/data/blob.d.ts +3 -1
  72. package/dist/types/excalidraw/data/json.d.ts +3 -1
  73. package/dist/types/excalidraw/index.d.ts +3 -1
  74. package/dist/types/excalidraw/renderer/animation.d.ts +1 -0
  75. package/dist/types/excalidraw/scene/Renderer.d.ts +2 -0
  76. package/dist/types/excalidraw/scene/index.d.ts +1 -1
  77. package/dist/types/excalidraw/scene/types.d.ts +1 -0
  78. package/dist/types/excalidraw/scroll.d.ts +46 -0
  79. package/dist/types/excalidraw/types.d.ts +24 -3
  80. package/dist/types/laser-pointer/src/index.d.ts +2 -0
  81. package/dist/types/laser-pointer/src/math.d.ts +16 -0
  82. package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
  83. package/dist/types/laser-pointer/src/state.d.ts +35 -0
  84. package/dist/types/utils/src/index.d.ts +1 -2
  85. package/package.json +4 -4
  86. package/dist/dev/chunk-36IX6I7U.js.map +0 -7
  87. package/dist/dev/chunk-ZGRXNVW4.js.map +0 -7
  88. package/dist/prod/chunk-B67RJXF2.js +0 -4
  89. package/dist/prod/data/image-YRR6RGIN.js +0 -1
  90. package/dist/types/utils/src/bbox.d.ts +0 -9
  91. package/dist/types/utils/src/withinBounds.d.ts +0 -19
  92. /package/dist/dev/{chunk-2ZDXTNY7.js.map → chunk-SJJUXTTF.js.map} +0 -0
  93. /package/dist/dev/data/{image-VHQDH63K.js.map → image-X3JCQEUX.js.map} +0 -0
  94. /package/dist/dev/locales/{en-RQFAMS2U.js.map → en-25BPHB4T.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -72,6 +72,13 @@ Please add the latest change on the top under the correct section.
72
72
 
73
73
  ### Breaking changes
74
74
 
75
+ - Theme changes initiated by the default UI are now delegated to `<Excalidraw onThemeChange={(theme) => ...} />` when supplied. If `onThemeChange` is not supplied, light/dark theme toggling still falls back to updating the internal editor state.
76
+
77
+ - `MainMenu.DefaultItems.ToggleTheme` no longer accepts the item-level `onSelect` callback. Host apps that need to control light/dark/system theme should pass `onThemeChange` to `<Excalidraw />` instead.
78
+ - `MainMenu.DefaultItems.ToggleTheme` with system theme support now uses `allowSystemTheme` together with `theme={Theme | "system"}` only to render the selected value. For the regular light/dark item, pass `allowSystemTheme={false}`.
79
+ - `CommandPalette.defaultItems.toggleTheme` was removed. The default theme command is now rendered by the command palette itself when `UIOptions.canvasActions.toggleTheme` enables the action (see below).
80
+ - `UIOptions.canvasActions.toggleTheme` still controls default theme UI availability. When it is `null`, it defaults to `true` if `props.theme` is omitted or `props.onThemeChange` is supplied, and otherwise defaults to disabled.
81
+
75
82
  - Renamed the `excalidrawAPI` prop to `onExcalidrawAPI`.
76
83
  - `onExcalidrawAPI` is now called on mount (instead of during constructor), and later on unmount (with `null` value). The API may be removed altogether in the future (you can use `onMount` & `onUmount` to manage the `ExcalidrawAPI` object (e.g. to cache it to a global state), already).
77
84
 
@@ -4760,4 +4767,163 @@ First release of `@excalidraw/excalidraw`## Excalidraw Library
4760
4767
  - Incorrect import for color (was moved to common)
4761
4768
 
4762
4769
  ---
4770
+ ## Excalidraw Library
4771
+
4772
+ **_This section lists the updates made to the excalidraw library and will not affect the integration._**
4773
+
4774
+ ### Features
4775
+
4776
+ - Add ability to turn off compression for files that are smaller than a given size
4777
+
4778
+ - Add lock tool to the dropdown and also add the status of the extra tools to be the same icon as the selected tool
4779
+
4780
+ - Add view mode button
4781
+
4782
+ - Add multiple image copy paste or drag and drop
4783
+
4784
+ - Multiple image additions from clipboard
4785
+
4786
+ - Add arrange elements action
4787
+
4788
+ - Add top picks to appProps for both stoke color and background color
4789
+
4790
+ ### Fixes
4791
+
4792
+ - Issues
4793
+
4794
+ - Make mobile mode more myoc looking
4795
+
4796
+ - Add normalise functionality
4797
+
4798
+ - Update with excalidraw
4799
+
4800
+ - Fix imports
4801
+
4802
+ - Fix mutateGroup to use scene.mutateGroup
4803
+
4804
+ - Imports
4805
+
4806
+ - Ensure that fileId is different for compressed vs uncompressed file
4807
+
4808
+ - Remove not working prop for dontResizeLimitMBs
4809
+
4810
+ - Add smartview for mobile
4811
+
4812
+ - Hide the alignment buttons if there is only one group selected (they do nothing if only one group is selected)
4813
+
4814
+ - Use css vars already provided instead of hard coding directly from oc-gray
4815
+
4816
+ - Remove unused variables
4817
+
4818
+ - Pass the new top pick color props properly
4819
+
4820
+ - Incorrect import for color (was moved to common)
4821
+
4822
+ ---
4823
+ ## Excalidraw Library
4824
+
4825
+ **_This section lists the updates made to the excalidraw library and will not affect the integration._**
4826
+
4827
+ ### Features
4828
+
4829
+ - Add ability to turn off compression for files that are smaller than a given size
4830
+
4831
+ - Add lock tool to the dropdown and also add the status of the extra tools to be the same icon as the selected tool
4832
+
4833
+ - Add view mode button
4834
+
4835
+ - Add multiple image copy paste or drag and drop
4836
+
4837
+ - Multiple image additions from clipboard
4838
+
4839
+ - Add arrange elements action
4840
+
4841
+ - Add top picks to appProps for both stoke color and background color
4842
+
4843
+ ### Fixes
4844
+
4845
+ - Issues
4846
+
4847
+ - Make mobile mode more myoc looking
4848
+
4849
+ - Add normalise functionality
4850
+
4851
+ - Update with excalidraw
4852
+
4853
+ - Fix imports
4854
+
4855
+ - Fix mutateGroup to use scene.mutateGroup
4856
+
4857
+ - Imports
4858
+
4859
+ - Ensure that fileId is different for compressed vs uncompressed file
4860
+
4861
+ - Remove not working prop for dontResizeLimitMBs
4862
+
4863
+ - Add smartview for mobile
4864
+
4865
+ - Hide the alignment buttons if there is only one group selected (they do nothing if only one group is selected)
4866
+
4867
+ - Use css vars already provided instead of hard coding directly from oc-gray
4868
+
4869
+ - Remove unused variables
4870
+
4871
+ - Pass the new top pick color props properly
4872
+
4873
+ - Incorrect import for color (was moved to common)
4874
+
4875
+ ---
4876
+ ## Excalidraw Library
4877
+
4878
+ **_This section lists the updates made to the excalidraw library and will not affect the integration._**
4879
+
4880
+ ### Features
4881
+
4882
+ - Add ability to turn off compression for files that are smaller than a given size
4883
+
4884
+ - Add lock tool to the dropdown and also add the status of the extra tools to be the same icon as the selected tool
4885
+
4886
+ - Add view mode button
4887
+
4888
+ - Add multiple image copy paste or drag and drop
4889
+
4890
+ - Multiple image additions from clipboard
4891
+
4892
+ - Add arrange elements action
4893
+
4894
+ - Add top picks to appProps for both stoke color and background color
4895
+
4896
+ ### Fixes
4897
+
4898
+ - Issues
4899
+
4900
+ - Make mobile mode more myoc looking
4901
+
4902
+ - Add normalise functionality
4903
+
4904
+ - Update with excalidraw
4905
+
4906
+ - Fix imports
4907
+
4908
+ - Fix mutateGroup to use scene.mutateGroup
4909
+
4910
+ - Imports
4911
+
4912
+ - Ensure that fileId is different for compressed vs uncompressed file
4913
+
4914
+ - Remove not working prop for dontResizeLimitMBs
4915
+
4916
+ - Add smartview for mobile
4917
+
4918
+ - Hide the alignment buttons if there is only one group selected (they do nothing if only one group is selected)
4919
+
4920
+ - Use css vars already provided instead of hard coding directly from oc-gray
4921
+
4922
+ - Remove unused variables
4923
+
4924
+ - Pass the new top pick color props properly
4925
+
4926
+ - Incorrect import for color (was moved to common)
4927
+
4928
+ ---
4763
4929
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  define_import_meta_env_default
3
- } from "./chunk-2ZDXTNY7.js";
3
+ } from "./chunk-SJJUXTTF.js";
4
4
  import {
5
5
  __publicField
6
6
  } from "./chunk-XDFCUUT6.js";
@@ -27,6 +27,7 @@ import {
27
27
  DEFAULT_ELEMENT_PROPS,
28
28
  DEFAULT_FONT_FAMILY,
29
29
  DEFAULT_FONT_SIZE,
30
+ DEFAULT_ELEMENT_STROKE_WIDTH_KEY,
30
31
  DEFAULT_TEXT_ALIGN,
31
32
  DEFAULT_GRID_SIZE,
32
33
  EXPORT_SCALES,
@@ -59,12 +60,13 @@ var getDefaultAppState = () => {
59
60
  currentItemFontSize: DEFAULT_FONT_SIZE,
60
61
  currentItemOpacity: DEFAULT_ELEMENT_PROPS.opacity,
61
62
  currentItemRoughness: DEFAULT_ELEMENT_PROPS.roughness,
63
+ currentItemStrokeVariability: "constant",
62
64
  currentItemStartArrowhead: null,
63
65
  currentItemStrokeColor: DEFAULT_ELEMENT_PROPS.strokeColor,
64
66
  currentItemRoundness: isTestEnv() ? "sharp" : "round",
65
67
  currentItemArrowType: ARROW_TYPE.round,
66
68
  currentItemStrokeStyle: DEFAULT_ELEMENT_PROPS.strokeStyle,
67
- currentItemStrokeWidth: DEFAULT_ELEMENT_PROPS.strokeWidth,
69
+ currentItemStrokeWidthKey: DEFAULT_ELEMENT_STROKE_WIDTH_KEY,
68
70
  currentItemTextAlign: DEFAULT_TEXT_ALIGN,
69
71
  currentHoveredFontFamily: null,
70
72
  cursorButton: "up",
@@ -136,6 +138,7 @@ var getDefaultAppState = () => {
136
138
  value: 1
137
139
  },
138
140
  viewModeEnabled: false,
141
+ viewModeOnly: false,
139
142
  showHyperlinkPopup: false,
140
143
  selectedLinearElement: null,
141
144
  snapLines: [],
@@ -182,10 +185,15 @@ var APP_STATE_STORAGE_CONF = /* @__PURE__ */ ((config) => config)({
182
185
  },
183
186
  currentItemOpacity: { browser: true, export: false, server: false },
184
187
  currentItemRoughness: { browser: true, export: false, server: false },
188
+ currentItemStrokeVariability: {
189
+ browser: true,
190
+ export: false,
191
+ server: false
192
+ },
185
193
  currentItemStartArrowhead: { browser: true, export: false, server: false },
186
194
  currentItemStrokeColor: { browser: true, export: false, server: false },
187
195
  currentItemStrokeStyle: { browser: true, export: false, server: false },
188
- currentItemStrokeWidth: { browser: true, export: false, server: false },
196
+ currentItemStrokeWidthKey: { browser: true, export: false, server: false },
189
197
  currentItemTextAlign: { browser: true, export: false, server: false },
190
198
  currentHoveredFontFamily: { browser: false, export: false, server: false },
191
199
  cursorButton: { browser: true, export: false, server: false },
@@ -256,6 +264,7 @@ var APP_STATE_STORAGE_CONF = /* @__PURE__ */ ((config) => config)({
256
264
  zenModeEnabled: { browser: true, export: false, server: false },
257
265
  zoom: { browser: true, export: false, server: false },
258
266
  viewModeEnabled: { browser: false, export: false, server: false },
267
+ viewModeOnly: { browser: false, export: false, server: false },
259
268
  showHyperlinkPopup: { browser: false, export: false, server: false },
260
269
  selectedLinearElement: { browser: true, export: false, server: false },
261
270
  snapLines: { browser: false, export: false, server: false },
@@ -415,6 +424,7 @@ import {
415
424
  hasBackground,
416
425
  hasStrokeWidth,
417
426
  hasStrokeStyle,
427
+ hasFreedrawMode,
418
428
  canHaveArrowheads,
419
429
  canChangeRoundness
420
430
  } from "@excalidraw/element";
@@ -3155,7 +3165,10 @@ var bootstrapCanvas = ({
3155
3165
  context.clearRect(0, 0, normalizedWidth, normalizedHeight);
3156
3166
  }
3157
3167
  context.save();
3158
- context.fillStyle = theme === THEME2.DARK ? applyDarkModeFilter(viewBackgroundColor) : viewBackgroundColor;
3168
+ context.fillStyle = applyDarkModeFilter(
3169
+ viewBackgroundColor,
3170
+ theme === THEME2.DARK
3171
+ );
3159
3172
  context.fillRect(0, 0, normalizedWidth, normalizedHeight);
3160
3173
  context.restore();
3161
3174
  } else {
@@ -3723,6 +3736,11 @@ var renderElementToSvg = (element, elementsMap, rsvg, svgRoot, files, offsetX, o
3723
3736
  );
3724
3737
  offsetX = offsetX || 0;
3725
3738
  offsetY = offsetY || 0;
3739
+ maskPath.setAttribute("maskUnits", "userSpaceOnUse");
3740
+ maskPath.setAttribute("x", "0");
3741
+ maskPath.setAttribute("y", "0");
3742
+ maskPath.setAttribute("width", `${element.width + 100 + offsetX}`);
3743
+ maskPath.setAttribute("height", `${element.height + 100 + offsetY}`);
3726
3744
  maskRectVisible.setAttribute("x", "0");
3727
3745
  maskRectVisible.setAttribute("y", "0");
3728
3746
  maskRectVisible.setAttribute("fill", "#fff");
@@ -3803,7 +3821,10 @@ var renderElementToSvg = (element, elementsMap, rsvg, svgRoot, files, offsetX, o
3803
3821
  const path = svgRoot.ownerDocument.createElementNS(SVG_NS, "path");
3804
3822
  path.setAttribute(
3805
3823
  "fill",
3806
- renderConfig.theme === THEME4.DARK ? applyDarkModeFilter3(element.strokeColor) : element.strokeColor
3824
+ applyDarkModeFilter3(
3825
+ element.strokeColor,
3826
+ renderConfig.theme === THEME4.DARK
3827
+ )
3807
3828
  );
3808
3829
  path.setAttribute("d", shape);
3809
3830
  wrapper.appendChild(path);
@@ -3974,7 +3995,10 @@ var renderElementToSvg = (element, elementsMap, rsvg, svgRoot, files, offsetX, o
3974
3995
  rect.setAttribute("fill", "none");
3975
3996
  rect.setAttribute(
3976
3997
  "stroke",
3977
- renderConfig.theme === THEME4.DARK ? applyDarkModeFilter3(FRAME_STYLE2.strokeColor) : FRAME_STYLE2.strokeColor
3998
+ applyDarkModeFilter3(
3999
+ FRAME_STYLE2.strokeColor,
4000
+ renderConfig.theme === THEME4.DARK
4001
+ )
3978
4002
  );
3979
4003
  rect.setAttribute("stroke-width", FRAME_STYLE2.strokeWidth.toString());
3980
4004
  addToRoot(rect, element);
@@ -4014,7 +4038,10 @@ var renderElementToSvg = (element, elementsMap, rsvg, svgRoot, files, offsetX, o
4014
4038
  text.setAttribute("font-size", `${element.fontSize}px`);
4015
4039
  text.setAttribute(
4016
4040
  "fill",
4017
- renderConfig.theme === THEME4.DARK ? applyDarkModeFilter3(element.strokeColor) : element.strokeColor
4041
+ applyDarkModeFilter3(
4042
+ element.strokeColor,
4043
+ renderConfig.theme === THEME4.DARK
4044
+ )
4018
4045
  );
4019
4046
  text.setAttribute("text-anchor", textAnchor);
4020
4047
  text.setAttribute("style", "white-space: pre;");
@@ -4350,7 +4377,7 @@ var exportToSvg = async (elements, appState, files, opts) => {
4350
4377
  rect.setAttribute("height", `${height}`);
4351
4378
  rect.setAttribute(
4352
4379
  "fill",
4353
- exportWithDarkMode ? applyDarkModeFilter4(viewBackgroundColor) : viewBackgroundColor
4380
+ applyDarkModeFilter4(viewBackgroundColor, exportWithDarkMode)
4354
4381
  );
4355
4382
  svgRoot.appendChild(rect);
4356
4383
  }
@@ -4440,6 +4467,7 @@ var getExportSize = (elements, exportPadding, scale) => {
4440
4467
  import { isFiniteNumber, isValidPoint, pointFrom as pointFrom2 } from "@excalidraw/math";
4441
4468
  import {
4442
4469
  DEFAULT_FONT_FAMILY as DEFAULT_FONT_FAMILY2,
4470
+ DEFAULT_STROKE_STREAMLINE,
4443
4471
  DEFAULT_TEXT_ALIGN as DEFAULT_TEXT_ALIGN2,
4444
4472
  DEFAULT_VERTICAL_ALIGN,
4445
4473
  FONT_FAMILY as FONT_FAMILY3,
@@ -4454,7 +4482,9 @@ import {
4454
4482
  arrayToMap as arrayToMap2,
4455
4483
  getSizeFromPoints,
4456
4484
  normalizeLink as normalizeLink2,
4457
- getLineHeight
4485
+ getLineHeight,
4486
+ STROKE_WIDTH,
4487
+ STROKE_WIDTH_KEYS
4458
4488
  } from "@excalidraw/common";
4459
4489
  import {
4460
4490
  calculateFixedPointForNonElbowArrowBinding,
@@ -4485,7 +4515,25 @@ import { syncInvalidIndices as syncInvalidIndices2 } from "@excalidraw/element";
4485
4515
  import { refreshTextDimensions } from "@excalidraw/element";
4486
4516
  import { getNormalizedDimensions } from "@excalidraw/element";
4487
4517
  import { isInvisiblySmallElement } from "@excalidraw/element";
4488
- var MAX_ARROW_PX = 75e3;
4518
+ var MAX_LINEAR_PX = 75e3;
4519
+ var handleOversizedLinearElements = (element) => {
4520
+ if (element.width <= MAX_LINEAR_PX && element.height <= MAX_LINEAR_PX) {
4521
+ return element;
4522
+ }
4523
+ const label = element.type === "arrow" ? `${isElbowArrow(element) ? "elbow" : "simple"} arrow` : element.type;
4524
+ console.error(
4525
+ `Removing extremely large ${label} ${element.id} (width: ${element.width}, height: ${element.height}, x: ${element.x}, y: ${element.y})`
4526
+ );
4527
+ return {
4528
+ ...element,
4529
+ x: 0,
4530
+ y: 0,
4531
+ width: 100,
4532
+ height: 100,
4533
+ points: [pointFrom2(0, 0), pointFrom2(100, 100)],
4534
+ isDeleted: true
4535
+ };
4536
+ };
4489
4537
  var restoreLinearElementPoints = (points, width, height) => {
4490
4538
  const restoredPoints = Array.isArray(points) ? points.reduce((acc, point) => {
4491
4539
  if (isValidPoint(point)) {
@@ -4544,6 +4592,23 @@ var AllowedExcalidrawActiveTools = {
4544
4592
  laser: false,
4545
4593
  magicframe: false
4546
4594
  };
4595
+ var ALLOWED_STROKE_VARIABILITIES = /* @__PURE__ */ new Set([
4596
+ "constant",
4597
+ "variable"
4598
+ ]);
4599
+ var restoreStrokeVariability = (variability, defaultValue) => {
4600
+ return typeof variability === "string" && ALLOWED_STROKE_VARIABILITIES.has(variability) ? variability : defaultValue;
4601
+ };
4602
+ var getStrokeWidthKey = (strokeWidth) => {
4603
+ return isFiniteNumber(strokeWidth) ? STROKE_WIDTH_KEYS.find((key) => STROKE_WIDTH[key] === strokeWidth) ?? null : null;
4604
+ };
4605
+ var restoreFreedrawStrokeOptions = (strokeOptions) => {
4606
+ const options = strokeOptions && typeof strokeOptions === "object" ? strokeOptions : null;
4607
+ return {
4608
+ variability: restoreStrokeVariability(options?.variability, "variable"),
4609
+ streamline: isFiniteNumber(options?.streamline) ? options?.streamline : DEFAULT_STROKE_STREAMLINE
4610
+ };
4611
+ };
4547
4612
  var getFontFamilyByName = (fontFamilyName) => {
4548
4613
  if (Object.keys(FONT_FAMILY3).includes(fontFamilyName)) {
4549
4614
  return FONT_FAMILY3[fontFamilyName];
@@ -4721,6 +4786,7 @@ var restoreElement = (element, targetElementsMap, existingElementsMap, opts) =>
4721
4786
  return restoreElementWithProperties(element, {
4722
4787
  points: points2,
4723
4788
  simulatePressure: element.simulatePressure,
4789
+ strokeOptions: restoreFreedrawStrokeOptions(element.strokeOptions),
4724
4790
  pressures
4725
4791
  });
4726
4792
  }
@@ -4729,6 +4795,7 @@ var restoreElement = (element, targetElementsMap, existingElementsMap, opts) =>
4729
4795
  status: element.status || "pending",
4730
4796
  fileId: element.fileId,
4731
4797
  fileName: element.fileName ?? null,
4798
+ thumbHash: typeof element.thumbHash === "string" ? element.thumbHash : null,
4732
4799
  scale: element.scale || [1, 1],
4733
4800
  crop: element.crop ?? null
4734
4801
  });
@@ -4751,7 +4818,7 @@ var restoreElement = (element, targetElementsMap, existingElementsMap, opts) =>
4751
4818
  y: y ?? 0
4752
4819
  }));
4753
4820
  }
4754
- return restoreElementWithProperties(element, {
4821
+ const restoredLine = restoreElementWithProperties(element, {
4755
4822
  type: "line",
4756
4823
  startBinding: null,
4757
4824
  endBinding: null,
@@ -4765,6 +4832,7 @@ var restoreElement = (element, targetElementsMap, existingElementsMap, opts) =>
4765
4832
  } : {},
4766
4833
  ...getSizeFromPoints(points)
4767
4834
  });
4835
+ return handleOversizedLinearElements(restoredLine);
4768
4836
  case "arrow": {
4769
4837
  const startArrowhead2 = normalizeArrowhead(element.startArrowhead);
4770
4838
  const endArrowhead2 = element.endArrowhead === void 0 ? "arrow" : normalizeArrowhead(element.endArrowhead);
@@ -4818,24 +4886,7 @@ var restoreElement = (element, targetElementsMap, existingElementsMap, opts) =>
4818
4886
  restoredElement
4819
4887
  )
4820
4888
  };
4821
- if (normalizedRestoredElement.width > MAX_ARROW_PX || normalizedRestoredElement.height > MAX_ARROW_PX) {
4822
- console.error(
4823
- `Removing extremely large arrow ${normalizedRestoredElement.id} (type: ${isElbowArrow(normalizedRestoredElement) ? "elbow" : "simple"}, width: ${normalizedRestoredElement.width}, height: ${normalizedRestoredElement.height}, x: ${normalizedRestoredElement.x}, y: ${normalizedRestoredElement.y})`
4824
- );
4825
- return {
4826
- ...normalizedRestoredElement,
4827
- x: 0,
4828
- y: 0,
4829
- width: 100,
4830
- height: 100,
4831
- points: [
4832
- pointFrom2(0, 0),
4833
- pointFrom2(100, 100)
4834
- ],
4835
- isDeleted: true
4836
- };
4837
- }
4838
- return normalizedRestoredElement;
4889
+ return handleOversizedLinearElements(normalizedRestoredElement);
4839
4890
  }
4840
4891
  case "ellipse":
4841
4892
  case "rectangle":
@@ -5064,6 +5115,9 @@ var restoreAppState = (appState, localAppState) => {
5064
5115
  if (boxSelectionMode !== void 0) {
5065
5116
  nextAppState.boxSelectionMode = boxSelectionMode;
5066
5117
  }
5118
+ if (appState.currentItemStrokeWidth !== void 0) {
5119
+ nextAppState.currentItemStrokeWidthKey = getStrokeWidthKey(appState.currentItemStrokeWidth) ?? defaultAppState.currentItemStrokeWidthKey;
5120
+ }
5067
5121
  return {
5068
5122
  ...nextAppState,
5069
5123
  cursorButton: localAppState?.cursorButton || "up",
@@ -5102,7 +5156,7 @@ var parseFileContents = async (blob) => {
5102
5156
  let contents;
5103
5157
  if (blob.type === MIME_TYPES6.png) {
5104
5158
  try {
5105
- return await (await import("./data/image-VHQDH63K.js")).decodePngMetadata(blob);
5159
+ return await (await import("./data/image-X3JCQEUX.js")).decodePngMetadata(blob);
5106
5160
  } catch (error) {
5107
5161
  if (error.message === "INVALID") {
5108
5162
  throw new ImageSceneDataError(
@@ -5413,6 +5467,7 @@ export {
5413
5467
  hasBackground,
5414
5468
  hasStrokeWidth,
5415
5469
  hasStrokeStyle,
5470
+ hasFreedrawMode,
5416
5471
  canHaveArrowheads,
5417
5472
  canChangeRoundness,
5418
5473
  AbortError,
@@ -5463,4 +5518,4 @@ export {
5463
5518
  createFile,
5464
5519
  normalizeFile
5465
5520
  };
5466
- //# sourceMappingURL=chunk-36IX6I7U.js.map
5521
+ //# sourceMappingURL=chunk-FQHULQ5P.js.map