@nous-excalidraw/excalidraw 0.18.2 → 0.18.4
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.
- package/dist/dev/{chunk-UFTMCXXK.js → chunk-BEK2EAAK.js} +2 -2
- package/dist/dev/{chunk-VTFWC67S.js → chunk-OACEU3ED.js} +3 -3
- package/dist/dev/components/TTDDialog/{CodeMirrorEditor-TCVBULR7.js → CodeMirrorEditor-CKDKMBXK.js} +2 -2
- package/dist/dev/data/{image-R33I73P5.js → image-2ZS4Q5UV.js} +3 -3
- package/dist/dev/index.css +2 -1
- package/dist/dev/index.css.map +2 -2
- package/dist/dev/index.js +58 -39
- package/dist/dev/index.js.map +3 -3
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/{chunk-EB5FYFLH.js → chunk-CGCZ4QZ7.js} +1 -1
- package/dist/prod/{chunk-73RUUKWR.js → chunk-SVDA3JML.js} +2 -2
- package/dist/prod/components/TTDDialog/{CodeMirrorEditor-IKE5EWSB.js → CodeMirrorEditor-KOIUTN6W.js} +1 -1
- package/dist/prod/data/image-H2IWT6DM.js +1 -0
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +29 -29
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/common/src/constants.d.ts +11 -2
- package/dist/types/excalidraw/components/App.d.ts +1 -1
- package/package.json +4 -4
- package/dist/prod/data/image-5THRS7YK.js +0 -1
- /package/dist/dev/{chunk-UFTMCXXK.js.map → chunk-BEK2EAAK.js.map} +0 -0
- /package/dist/dev/{chunk-VTFWC67S.js.map → chunk-OACEU3ED.js.map} +0 -0
- /package/dist/dev/components/TTDDialog/{CodeMirrorEditor-TCVBULR7.js.map → CodeMirrorEditor-CKDKMBXK.js.map} +0 -0
- /package/dist/dev/data/{image-R33I73P5.js.map → image-2ZS4Q5UV.js.map} +0 -0
package/dist/dev/index.js
CHANGED
|
@@ -65,10 +65,10 @@ import {
|
|
|
65
65
|
serializeAsJSON,
|
|
66
66
|
serializeLibraryAsJSON,
|
|
67
67
|
strokeRectWithRotation_simple
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-OACEU3ED.js";
|
|
69
69
|
import {
|
|
70
70
|
define_import_meta_env_default
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-BEK2EAAK.js";
|
|
72
72
|
import {
|
|
73
73
|
en_default
|
|
74
74
|
} from "./chunk-4JOINNOK.js";
|
|
@@ -142,7 +142,8 @@ import {
|
|
|
142
142
|
TOUCH_CTX_MENU_TIMEOUT,
|
|
143
143
|
VERTICAL_ALIGN as VERTICAL_ALIGN5,
|
|
144
144
|
YOUTUBE_STATES,
|
|
145
|
-
|
|
145
|
+
getInteractiveZoomStep as getInteractiveZoomStep2,
|
|
146
|
+
INITIAL_CANVAS_ZOOM,
|
|
146
147
|
POINTER_EVENTS,
|
|
147
148
|
TOOL_TYPE as TOOL_TYPE3,
|
|
148
149
|
supportsResizeObserver as supportsResizeObserver2,
|
|
@@ -7878,6 +7879,7 @@ import {
|
|
|
7878
7879
|
MIN_ZOOM,
|
|
7879
7880
|
THEME as THEME5,
|
|
7880
7881
|
ZOOM_STEP,
|
|
7882
|
+
getInteractiveZoomStep,
|
|
7881
7883
|
updateActiveTool as updateActiveTool2,
|
|
7882
7884
|
CODES as CODES2,
|
|
7883
7885
|
KEYS as KEYS12
|
|
@@ -8147,7 +8149,9 @@ var actionZoomIn = register({
|
|
|
8147
8149
|
{
|
|
8148
8150
|
viewportX: appState.width / 2 + appState.offsetLeft,
|
|
8149
8151
|
viewportY: appState.height / 2 + appState.offsetTop,
|
|
8150
|
-
nextZoom: getNormalizedZoom(
|
|
8152
|
+
nextZoom: getNormalizedZoom(
|
|
8153
|
+
appState.zoom.value + getInteractiveZoomStep(appState.zoom.value)
|
|
8154
|
+
)
|
|
8151
8155
|
},
|
|
8152
8156
|
appState
|
|
8153
8157
|
),
|
|
@@ -8186,7 +8190,9 @@ var actionZoomOut = register({
|
|
|
8186
8190
|
{
|
|
8187
8191
|
viewportX: appState.width / 2 + appState.offsetLeft,
|
|
8188
8192
|
viewportY: appState.height / 2 + appState.offsetTop,
|
|
8189
|
-
nextZoom: getNormalizedZoom(
|
|
8193
|
+
nextZoom: getNormalizedZoom(
|
|
8194
|
+
appState.zoom.value - getInteractiveZoomStep(appState.zoom.value)
|
|
8195
|
+
)
|
|
8190
8196
|
},
|
|
8191
8197
|
appState
|
|
8192
8198
|
),
|
|
@@ -9630,7 +9636,7 @@ var exportCanvas = async (type, elements, appState, files, {
|
|
|
9630
9636
|
let blob = canvasToBlob(tempCanvas);
|
|
9631
9637
|
if (appState.exportEmbedScene) {
|
|
9632
9638
|
blob = blob.then(
|
|
9633
|
-
(blob2) => import("./data/image-
|
|
9639
|
+
(blob2) => import("./data/image-2ZS4Q5UV.js").then(
|
|
9634
9640
|
({ encodePngMetadata: encodePngMetadata2 }) => encodePngMetadata2({
|
|
9635
9641
|
blob: blob2,
|
|
9636
9642
|
metadata: serializeAsJSON(elements, appState, files, "local")
|
|
@@ -28481,7 +28487,7 @@ var TTDDialogInput = ({
|
|
|
28481
28487
|
setShowSpinner(true);
|
|
28482
28488
|
}
|
|
28483
28489
|
}, SPINNER_DELAY_MS);
|
|
28484
|
-
import("./components/TTDDialog/CodeMirrorEditor-
|
|
28490
|
+
import("./components/TTDDialog/CodeMirrorEditor-CKDKMBXK.js").then((mod) => {
|
|
28485
28491
|
if (!cancelled) {
|
|
28486
28492
|
setEditorState({ type: "ready", component: mod.default });
|
|
28487
28493
|
}
|
|
@@ -38128,6 +38134,37 @@ var App = class _App extends React46.Component {
|
|
|
38128
38134
|
})
|
|
38129
38135
|
};
|
|
38130
38136
|
}
|
|
38137
|
+
const initialZoomValue = getNormalizedZoom(INITIAL_CANVAS_ZOOM);
|
|
38138
|
+
const nonDeletedRestoredElements = restoredElements.filter(
|
|
38139
|
+
(element) => !element.isDeleted
|
|
38140
|
+
);
|
|
38141
|
+
if (nonDeletedRestoredElements.length) {
|
|
38142
|
+
const { appState: fittedAppState } = zoomToFit({
|
|
38143
|
+
targetElements: nonDeletedRestoredElements,
|
|
38144
|
+
appState: {
|
|
38145
|
+
...restoredAppState,
|
|
38146
|
+
width: this.state.width,
|
|
38147
|
+
height: this.state.height,
|
|
38148
|
+
offsetTop: this.state.offsetTop,
|
|
38149
|
+
offsetLeft: this.state.offsetLeft,
|
|
38150
|
+
zoom: { value: initialZoomValue }
|
|
38151
|
+
},
|
|
38152
|
+
fitToViewport: false,
|
|
38153
|
+
maxZoom: initialZoomValue,
|
|
38154
|
+
canvasOffsets: this.getEditorUIOffsets()
|
|
38155
|
+
});
|
|
38156
|
+
restoredAppState = {
|
|
38157
|
+
...restoredAppState,
|
|
38158
|
+
scrollX: fittedAppState.scrollX,
|
|
38159
|
+
scrollY: fittedAppState.scrollY,
|
|
38160
|
+
zoom: fittedAppState.zoom
|
|
38161
|
+
};
|
|
38162
|
+
} else {
|
|
38163
|
+
restoredAppState = {
|
|
38164
|
+
...restoredAppState,
|
|
38165
|
+
zoom: { value: initialZoomValue }
|
|
38166
|
+
};
|
|
38167
|
+
}
|
|
38131
38168
|
this.resetStore();
|
|
38132
38169
|
this.resetHistory();
|
|
38133
38170
|
this.syncActionResult({
|
|
@@ -39743,6 +39780,16 @@ var App = class _App extends React46.Component {
|
|
|
39743
39780
|
this.startImageCropping(selectedElements[0]);
|
|
39744
39781
|
return;
|
|
39745
39782
|
}
|
|
39783
|
+
if (selectedElements.length === 1 && isFrameLikeElement15(selectedElements[0])) {
|
|
39784
|
+
this.scrollToContent(selectedElements[0], {
|
|
39785
|
+
animate: true,
|
|
39786
|
+
duration: 500,
|
|
39787
|
+
viewportZoomFactor: 0.6,
|
|
39788
|
+
fitToViewport: true,
|
|
39789
|
+
canvasOffsets: this.getEditorUIOffsets()
|
|
39790
|
+
});
|
|
39791
|
+
return;
|
|
39792
|
+
}
|
|
39746
39793
|
resetCursor(this.interactiveCanvas);
|
|
39747
39794
|
const selectedGroupIds = getSelectedGroupIds4(this.state);
|
|
39748
39795
|
if (selectedGroupIds.length > 0) {
|
|
@@ -41981,41 +42028,13 @@ var App = class _App extends React46.Component {
|
|
|
41981
42028
|
const hasSupportedImage = files.some(
|
|
41982
42029
|
(file2) => isSupportedImageFile(file2)
|
|
41983
42030
|
);
|
|
41984
|
-
if (
|
|
42031
|
+
if (hasSupportedImage) {
|
|
41985
42032
|
return;
|
|
41986
42033
|
}
|
|
41987
|
-
|
|
41988
|
-
|
|
41989
|
-
const { file: file2, fileHandle } = fileItems[0];
|
|
41990
|
-
if (file2 && (file2.type === MIME_TYPES9.png || file2.type === MIME_TYPES9.svg)) {
|
|
41991
|
-
try {
|
|
41992
|
-
const scene = await loadFromBlob(
|
|
41993
|
-
file2,
|
|
41994
|
-
this.state,
|
|
41995
|
-
this.scene.getElementsIncludingDeleted(),
|
|
41996
|
-
fileHandle
|
|
41997
|
-
);
|
|
41998
|
-
this.syncActionResult({
|
|
41999
|
-
...scene,
|
|
42000
|
-
appState: {
|
|
42001
|
-
...scene.appState || this.state,
|
|
42002
|
-
isLoading: false
|
|
42003
|
-
},
|
|
42004
|
-
replaceFiles: true,
|
|
42005
|
-
captureUpdate: CaptureUpdateAction40.IMMEDIATELY
|
|
42006
|
-
});
|
|
42007
|
-
return;
|
|
42008
|
-
} catch (error) {
|
|
42009
|
-
if (error.name !== "EncodingError") {
|
|
42010
|
-
throw new Error(t("alerts.couldNotLoadInvalidFile"));
|
|
42011
|
-
}
|
|
42012
|
-
}
|
|
42034
|
+
if (!isSinglePngOrSvgSceneCandidate && !hasSupportedImage) {
|
|
42035
|
+
return;
|
|
42013
42036
|
}
|
|
42014
42037
|
}
|
|
42015
|
-
const imageFiles = fileItems.map((data) => data.file).filter((file2) => isSupportedImageFile(file2));
|
|
42016
|
-
if (imageFiles.length > 0 && this.isToolSupported("image")) {
|
|
42017
|
-
return this.insertImages(imageFiles, sceneX, sceneY);
|
|
42018
|
-
}
|
|
42019
42038
|
const excalidrawLibrary_ids = dataTransferList.getData(
|
|
42020
42039
|
MIME_TYPES9.excalidrawlibIds
|
|
42021
42040
|
);
|
|
@@ -42528,7 +42547,7 @@ var App = class _App extends React46.Component {
|
|
|
42528
42547
|
const { deltaX, deltaY } = event;
|
|
42529
42548
|
if (event.metaKey || event.ctrlKey) {
|
|
42530
42549
|
const sign = Math.sign(deltaY);
|
|
42531
|
-
const MAX_STEP =
|
|
42550
|
+
const MAX_STEP = getInteractiveZoomStep2(this.state.zoom.value) * 100;
|
|
42532
42551
|
const absDelta = Math.abs(deltaY);
|
|
42533
42552
|
let delta = deltaY;
|
|
42534
42553
|
if (absDelta > MAX_STEP) {
|