@myoc/excalidraw 0.18.13 → 0.18.15

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 (46) hide show
  1. package/dist/dev/{chunk-FCBL7N77.js → chunk-DJKQZ4KD.js} +2 -2
  2. package/dist/dev/{chunk-TNF6UDDD.js → chunk-O7OUZ7ZJ.js} +4 -4
  3. package/dist/dev/{chunk-TNF6UDDD.js.map → chunk-O7OUZ7ZJ.js.map} +2 -2
  4. package/dist/dev/data/{image-QRAMC25Z.js → image-NJWLICAS.js} +3 -3
  5. package/dist/dev/index.js +34 -29
  6. package/dist/dev/index.js.map +2 -2
  7. package/dist/dev/subset-shared.chunk.js +1 -1
  8. package/dist/dev/subset-worker.chunk.js +1 -1
  9. package/dist/prod/{chunk-WPCPB5W2.js → chunk-NJOW7IOK.js} +1 -1
  10. package/dist/prod/{chunk-FZRODZWT.js → chunk-WGXUBJ4X.js} +3 -3
  11. package/dist/prod/data/image-EKW6RBW7.js +1 -0
  12. package/dist/prod/index.js +11 -11
  13. package/dist/prod/subset-shared.chunk.js +1 -1
  14. package/dist/prod/subset-worker.chunk.js +1 -1
  15. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +3 -3
  16. package/dist/types/excalidraw/actions/actionBoundText.d.ts +2 -2
  17. package/dist/types/excalidraw/actions/actionCanvas.d.ts +12 -12
  18. package/dist/types/excalidraw/actions/actionClipboard.d.ts +6 -6
  19. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +1 -1
  20. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +3 -3
  21. package/dist/types/excalidraw/actions/actionElementLink.d.ts +1 -1
  22. package/dist/types/excalidraw/actions/actionElementLock.d.ts +2 -2
  23. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +1 -1
  24. package/dist/types/excalidraw/actions/actionExport.d.ts +9 -9
  25. package/dist/types/excalidraw/actions/actionFinalize.d.ts +2 -2
  26. package/dist/types/excalidraw/actions/actionFrame.d.ts +4 -4
  27. package/dist/types/excalidraw/actions/actionGroup.d.ts +2 -2
  28. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +1 -1
  29. package/dist/types/excalidraw/actions/actionLink.d.ts +1 -1
  30. package/dist/types/excalidraw/actions/actionMenu.d.ts +3 -3
  31. package/dist/types/excalidraw/actions/actionNavigate.d.ts +2 -2
  32. package/dist/types/excalidraw/actions/actionProperties.d.ts +15 -15
  33. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +1 -1
  34. package/dist/types/excalidraw/actions/actionStyles.d.ts +1 -1
  35. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +1 -1
  36. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +1 -1
  37. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +2 -2
  38. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +1 -1
  39. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +1 -1
  40. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +1 -1
  41. package/dist/types/excalidraw/appState.d.ts +1 -1
  42. package/dist/types/excalidraw/types.d.ts +3 -1
  43. package/package.json +1 -1
  44. package/dist/prod/data/image-XWIJFTJ5.js +0 -1
  45. /package/dist/dev/{chunk-FCBL7N77.js.map → chunk-DJKQZ4KD.js.map} +0 -0
  46. /package/dist/dev/data/{image-QRAMC25Z.js.map → image-NJWLICAS.js.map} +0 -0
@@ -2,12 +2,12 @@ import {
2
2
  decodePngMetadata,
3
3
  encodePngMetadata,
4
4
  getTEXtChunk
5
- } from "../chunk-TNF6UDDD.js";
6
- import "../chunk-FCBL7N77.js";
5
+ } from "../chunk-O7OUZ7ZJ.js";
6
+ import "../chunk-DJKQZ4KD.js";
7
7
  import "../chunk-XDFCUUT6.js";
8
8
  export {
9
9
  decodePngMetadata,
10
10
  encodePngMetadata,
11
11
  getTEXtChunk
12
12
  };
13
- //# sourceMappingURL=image-QRAMC25Z.js.map
13
+ //# sourceMappingURL=image-NJWLICAS.js.map
package/dist/dev/index.js CHANGED
@@ -618,10 +618,10 @@ import {
618
618
  wrapEvent,
619
619
  wrapText,
620
620
  zoomAreaIcon
621
- } from "./chunk-TNF6UDDD.js";
621
+ } from "./chunk-O7OUZ7ZJ.js";
622
622
  import {
623
623
  define_import_meta_env_default
624
- } from "./chunk-FCBL7N77.js";
624
+ } from "./chunk-DJKQZ4KD.js";
625
625
  import {
626
626
  en_default
627
627
  } from "./chunk-PEI7EPYO.js";
@@ -10907,7 +10907,7 @@ var exportCanvas = async (type, elements, appState, files, {
10907
10907
  let blob = canvasToBlob(tempCanvas);
10908
10908
  if (appState.exportEmbedScene) {
10909
10909
  blob = blob.then(
10910
- (blob2) => import("./data/image-QRAMC25Z.js").then(
10910
+ (blob2) => import("./data/image-NJWLICAS.js").then(
10911
10911
  ({ encodePngMetadata: encodePngMetadata2 }) => encodePngMetadata2({
10912
10912
  blob: blob2,
10913
10913
  metadata: serializeAsJSON(elements, appState, files, "local")
@@ -34090,8 +34090,14 @@ var App = class _App extends React42.Component {
34090
34090
  if (!isSupportedImageFile(imageFile)) {
34091
34091
  throw new Error(t("errors.unsupportedFileType"));
34092
34092
  }
34093
- const mimeType = imageFile.type;
34094
34093
  setCursor(this.interactiveCanvas, "wait");
34094
+ const mimeType = imageFile.type;
34095
+ const fileNeedsResizing = imageFile.size >= this.state.dontResizeLimitMBs * 1024 * 1024;
34096
+ console.info(
34097
+ "fileNeedsResizing",
34098
+ fileNeedsResizing,
34099
+ this.state.dontResizeLimitMBs * 1024 * 1024
34100
+ );
34095
34101
  if (mimeType === MIME_TYPES.svg) {
34096
34102
  try {
34097
34103
  imageFile = SVGStringToFile(
@@ -34102,6 +34108,24 @@ var App = class _App extends React42.Component {
34102
34108
  console.warn(error);
34103
34109
  throw new Error(t("errors.svgImageInsertError"));
34104
34110
  }
34111
+ } else if (fileNeedsResizing) {
34112
+ try {
34113
+ imageFile = await resizeImageFile(imageFile, {
34114
+ maxWidthOrHeight: DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT
34115
+ });
34116
+ } catch (error) {
34117
+ console.error(
34118
+ "Error trying to resizing image file on insertion",
34119
+ error
34120
+ );
34121
+ }
34122
+ }
34123
+ if (imageFile.size > MAX_ALLOWED_FILE_BYTES) {
34124
+ throw new Error(
34125
+ t("errors.fileTooBig", {
34126
+ maxSize: `${Math.trunc(MAX_ALLOWED_FILE_BYTES / 1024 / 1024)}MB`
34127
+ })
34128
+ );
34105
34129
  }
34106
34130
  const fileId = await (this.props.generateIdForFile?.(
34107
34131
  imageFile
@@ -34112,29 +34136,6 @@ var App = class _App extends React42.Component {
34112
34136
  );
34113
34137
  throw new Error(t("errors.imageInsertError"));
34114
34138
  }
34115
- const existingFileData = this.files[fileId];
34116
- if (!existingFileData?.dataURL) {
34117
- const sizeLimitInKBs = this.state.dontResizeLimitMBs * 1024 * 1024;
34118
- if (imageFile.size >= sizeLimitInKBs) {
34119
- try {
34120
- imageFile = await resizeImageFile(imageFile, {
34121
- maxWidthOrHeight: DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT
34122
- });
34123
- } catch (error) {
34124
- console.error(
34125
- "Error trying to resizing image file on insertion",
34126
- error
34127
- );
34128
- }
34129
- }
34130
- if (imageFile.size > MAX_ALLOWED_FILE_BYTES) {
34131
- throw new Error(
34132
- t("errors.fileTooBig", {
34133
- maxSize: `${Math.trunc(MAX_ALLOWED_FILE_BYTES / 1024 / 1024)}MB`
34134
- })
34135
- );
34136
- }
34137
- }
34138
34139
  if (showCursorImagePreview) {
34139
34140
  const dataURL2 = this.files[fileId]?.dataURL;
34140
34141
  const resizedFile = dataURL2 && dataURLToFile(dataURL2);
@@ -35128,7 +35129,8 @@ var App = class _App extends React42.Component {
35128
35129
  objectsSnapModeEnabled = false,
35129
35130
  theme = defaultAppState.theme,
35130
35131
  name = `${t("labels.untitled")}-${getDateTime()}`,
35131
- wheelZoomsOnDefault = false
35132
+ wheelZoomsOnDefault = false,
35133
+ dontResizeLimitMBs
35132
35134
  } = props;
35133
35135
  this.state = {
35134
35136
  ...defaultAppState,
@@ -35142,7 +35144,8 @@ var App = class _App extends React42.Component {
35142
35144
  name,
35143
35145
  width: window.innerWidth,
35144
35146
  height: window.innerHeight,
35145
- wheelZoomsOnDefault
35147
+ wheelZoomsOnDefault,
35148
+ dontResizeLimitMBs
35146
35149
  };
35147
35150
  this.id = nanoid();
35148
35151
  this.library = new library_default(this);
@@ -38753,6 +38756,7 @@ var ExcalidrawBase = (props) => {
38753
38756
  renderEmbeddable,
38754
38757
  showDeprecatedFonts,
38755
38758
  wheelZoomsOnDefault,
38759
+ dontResizeLimitMBs,
38756
38760
  strokeColorTopPicks,
38757
38761
  backgroundColorTopPicks,
38758
38762
  renderScrollbars
@@ -38826,6 +38830,7 @@ var ExcalidrawBase = (props) => {
38826
38830
  aiEnabled: false,
38827
38831
  showDeprecatedFonts,
38828
38832
  wheelZoomsOnDefault,
38833
+ dontResizeLimitMBs,
38829
38834
  strokeColorTopPicks,
38830
38835
  backgroundColorTopPicks,
38831
38836
  renderScrollbars,