@haoxin-web/excalidraw 1.0.0 → 1.0.1
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/README.md +20 -20
- package/dist/dev/{chunk-PTYT4VPM.js → chunk-G6EN3STO.js} +3 -3
- package/dist/dev/{chunk-VC7V2GEZ.js → chunk-R3GBEHWA.js} +2 -2
- package/dist/dev/{chunk-VC7V2GEZ.js.map → chunk-R3GBEHWA.js.map} +1 -1
- package/dist/dev/data/{image-CVHJEERS.js → image-QP66FJQD.js} +3 -3
- package/dist/dev/index.css.map +2 -2
- package/dist/dev/index.js +250 -108
- 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-5BVJZ5IS.js → chunk-57UWYCGH.js} +2 -2
- package/dist/prod/{chunk-ZHX5UPTB.js → chunk-T5E2FHQC.js} +1 -1
- package/dist/prod/data/image-AJHKS3PW.js +1 -0
- package/dist/prod/index.js +26 -26
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +21 -14
- package/dist/types/excalidraw/components/Actions.d.ts +3 -2
- package/dist/types/excalidraw/components/App.d.ts +1 -0
- package/dist/types/excalidraw/components/HandButton.d.ts +2 -1
- package/dist/types/excalidraw/components/LayerUI.d.ts +4 -1
- package/dist/types/excalidraw/components/LeftMainToolbar.d.ts +1 -0
- package/dist/types/excalidraw/components/LeftToolFlyouts.d.ts +1 -0
- package/dist/types/excalidraw/components/MobileMenu.d.ts +2 -1
- package/dist/types/excalidraw/components/footer/Footer.d.ts +2 -1
- package/dist/types/excalidraw/types.d.ts +4 -0
- package/package.json +4 -4
- package/dist/prod/data/image-7GV76HIR.js +0 -1
- /package/dist/dev/{chunk-PTYT4VPM.js.map → chunk-G6EN3STO.js.map} +0 -0
- /package/dist/dev/data/{image-CVHJEERS.js.map → image-QP66FJQD.js.map} +0 -0
package/dist/dev/index.js
CHANGED
|
@@ -69,10 +69,10 @@ import {
|
|
|
69
69
|
serializeLibraryAsJSON,
|
|
70
70
|
strokeEllipseWithRotation,
|
|
71
71
|
strokeRectWithRotation
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-G6EN3STO.js";
|
|
73
73
|
import {
|
|
74
74
|
define_import_meta_env_default
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-R3GBEHWA.js";
|
|
76
76
|
import {
|
|
77
77
|
en_default
|
|
78
78
|
} from "./chunk-ZSSURRA2.js";
|
|
@@ -7507,6 +7507,9 @@ var actionZoomIn = register({
|
|
|
7507
7507
|
viewMode: true,
|
|
7508
7508
|
icon: ZoomInIcon,
|
|
7509
7509
|
trackEvent: { category: "canvas" },
|
|
7510
|
+
predicate: (elements, appState, appProps) => {
|
|
7511
|
+
return appProps.showZoomActions !== false;
|
|
7512
|
+
},
|
|
7510
7513
|
perform: (_elements, appState, _, app) => {
|
|
7511
7514
|
return {
|
|
7512
7515
|
appState: {
|
|
@@ -7538,7 +7541,9 @@ var actionZoomIn = register({
|
|
|
7538
7541
|
}
|
|
7539
7542
|
}
|
|
7540
7543
|
),
|
|
7541
|
-
keyTest: (event
|
|
7544
|
+
keyTest: (event, appState, elements, app) => {
|
|
7545
|
+
return app.props.showZoomActions !== false && (event.code === CODES2.EQUAL || event.code === CODES2.NUM_ADD) && (event[KEYS12.CTRL_OR_CMD] || event.shiftKey);
|
|
7546
|
+
}
|
|
7542
7547
|
});
|
|
7543
7548
|
var actionZoomOut = register({
|
|
7544
7549
|
name: "zoomOut",
|
|
@@ -7546,6 +7551,9 @@ var actionZoomOut = register({
|
|
|
7546
7551
|
icon: ZoomOutIcon,
|
|
7547
7552
|
viewMode: true,
|
|
7548
7553
|
trackEvent: { category: "canvas" },
|
|
7554
|
+
predicate: (elements, appState, appProps) => {
|
|
7555
|
+
return appProps.showZoomActions !== false;
|
|
7556
|
+
},
|
|
7549
7557
|
perform: (_elements, appState, _, app) => {
|
|
7550
7558
|
return {
|
|
7551
7559
|
appState: {
|
|
@@ -7577,7 +7585,9 @@ var actionZoomOut = register({
|
|
|
7577
7585
|
}
|
|
7578
7586
|
}
|
|
7579
7587
|
),
|
|
7580
|
-
keyTest: (event
|
|
7588
|
+
keyTest: (event, appState, elements, app) => {
|
|
7589
|
+
return app.props.showZoomActions !== false && (event.code === CODES2.MINUS || event.code === CODES2.NUM_SUBTRACT) && (event[KEYS12.CTRL_OR_CMD] || event.shiftKey);
|
|
7590
|
+
}
|
|
7581
7591
|
});
|
|
7582
7592
|
var actionResetZoom = register({
|
|
7583
7593
|
name: "resetZoom",
|
|
@@ -7585,6 +7595,9 @@ var actionResetZoom = register({
|
|
|
7585
7595
|
icon: ZoomResetIcon,
|
|
7586
7596
|
viewMode: true,
|
|
7587
7597
|
trackEvent: { category: "canvas" },
|
|
7598
|
+
predicate: (elements, appState, appProps) => {
|
|
7599
|
+
return appProps.showZoomActions !== false;
|
|
7600
|
+
},
|
|
7588
7601
|
perform: (_elements, appState, _, app) => {
|
|
7589
7602
|
return {
|
|
7590
7603
|
appState: {
|
|
@@ -7618,7 +7631,9 @@ var actionResetZoom = register({
|
|
|
7618
7631
|
]
|
|
7619
7632
|
}
|
|
7620
7633
|
) }),
|
|
7621
|
-
keyTest: (event
|
|
7634
|
+
keyTest: (event, appState, elements, app) => {
|
|
7635
|
+
return app.props.showZoomActions !== false && (event.code === CODES2.ZERO || event.code === CODES2.NUM_ZERO) && (event[KEYS12.CTRL_OR_CMD] || event.shiftKey);
|
|
7636
|
+
}
|
|
7622
7637
|
});
|
|
7623
7638
|
var zoomValueToFitBoundsOnViewport = (bounds, viewportDimensions, viewportZoomFactor = 1) => {
|
|
7624
7639
|
const [x1, y1, x2, y2] = bounds;
|
|
@@ -7714,6 +7729,9 @@ var actionZoomToFitSelectionInViewport = register({
|
|
|
7714
7729
|
label: "labels.zoomToFitViewport",
|
|
7715
7730
|
icon: zoomAreaIcon,
|
|
7716
7731
|
trackEvent: { category: "canvas" },
|
|
7732
|
+
predicate: (elements, appState, appProps) => {
|
|
7733
|
+
return appProps.showZoomActions !== false;
|
|
7734
|
+
},
|
|
7717
7735
|
perform: (elements, appState, _, app) => {
|
|
7718
7736
|
const selectedElements = app.scene.getSelectedElements(appState);
|
|
7719
7737
|
return zoomToFit({
|
|
@@ -7728,13 +7746,18 @@ var actionZoomToFitSelectionInViewport = register({
|
|
|
7728
7746
|
},
|
|
7729
7747
|
// NOTE shift-2 should have been assigned actionZoomToFitSelection.
|
|
7730
7748
|
// TBD on how proceed
|
|
7731
|
-
keyTest: (event
|
|
7749
|
+
keyTest: (event, appState, elements, app) => {
|
|
7750
|
+
return app.props.showZoomActions !== false && event.code === CODES2.TWO && event.shiftKey && !event.altKey && !event[KEYS12.CTRL_OR_CMD];
|
|
7751
|
+
}
|
|
7732
7752
|
});
|
|
7733
7753
|
var actionZoomToFitSelection = register({
|
|
7734
7754
|
name: "zoomToFitSelection",
|
|
7735
7755
|
label: "helpDialog.zoomToSelection",
|
|
7736
7756
|
icon: zoomAreaIcon,
|
|
7737
7757
|
trackEvent: { category: "canvas" },
|
|
7758
|
+
predicate: (elements, appState, appProps) => {
|
|
7759
|
+
return appProps.showZoomActions !== false;
|
|
7760
|
+
},
|
|
7738
7761
|
perform: (elements, appState, _, app) => {
|
|
7739
7762
|
const selectedElements = app.scene.getSelectedElements(appState);
|
|
7740
7763
|
return zoomToFit({
|
|
@@ -7748,7 +7771,9 @@ var actionZoomToFitSelection = register({
|
|
|
7748
7771
|
});
|
|
7749
7772
|
},
|
|
7750
7773
|
// NOTE this action should use shift-2 per figma, alas
|
|
7751
|
-
keyTest: (event
|
|
7774
|
+
keyTest: (event, appState, elements, app) => {
|
|
7775
|
+
return app.props.showZoomActions !== false && event.code === CODES2.THREE && event.shiftKey && !event.altKey && !event[KEYS12.CTRL_OR_CMD];
|
|
7776
|
+
}
|
|
7752
7777
|
});
|
|
7753
7778
|
var actionZoomToFit = register({
|
|
7754
7779
|
name: "zoomToFit",
|
|
@@ -7756,6 +7781,9 @@ var actionZoomToFit = register({
|
|
|
7756
7781
|
icon: zoomAreaIcon,
|
|
7757
7782
|
viewMode: true,
|
|
7758
7783
|
trackEvent: { category: "canvas" },
|
|
7784
|
+
predicate: (elements, appState, appProps) => {
|
|
7785
|
+
return appProps.showZoomActions !== false;
|
|
7786
|
+
},
|
|
7759
7787
|
perform: (elements, appState, _, app) => zoomToFit({
|
|
7760
7788
|
targetElements: elements,
|
|
7761
7789
|
appState: {
|
|
@@ -7765,7 +7793,9 @@ var actionZoomToFit = register({
|
|
|
7765
7793
|
fitToViewport: false,
|
|
7766
7794
|
canvasOffsets: app.getEditorUIOffsets()
|
|
7767
7795
|
}),
|
|
7768
|
-
keyTest: (event
|
|
7796
|
+
keyTest: (event, appState, elements, app) => {
|
|
7797
|
+
return app.props.showZoomActions !== false && event.code === CODES2.ONE && event.shiftKey && !event.altKey && !event[KEYS12.CTRL_OR_CMD];
|
|
7798
|
+
}
|
|
7769
7799
|
});
|
|
7770
7800
|
var actionToggleTheme = register({
|
|
7771
7801
|
name: "toggleTheme",
|
|
@@ -7861,6 +7891,9 @@ var actionToggleHandTool = register({
|
|
|
7861
7891
|
trackEvent: { category: "toolbar" },
|
|
7862
7892
|
icon: handIcon,
|
|
7863
7893
|
viewMode: false,
|
|
7894
|
+
predicate: (elements, appState, appProps) => {
|
|
7895
|
+
return appProps.showPanActions !== false;
|
|
7896
|
+
},
|
|
7864
7897
|
perform: (elements, appState, _, app) => {
|
|
7865
7898
|
let activeTool;
|
|
7866
7899
|
if (isHandToolActive(appState)) {
|
|
@@ -7888,7 +7921,9 @@ var actionToggleHandTool = register({
|
|
|
7888
7921
|
captureUpdate: CaptureUpdateAction6.IMMEDIATELY
|
|
7889
7922
|
};
|
|
7890
7923
|
},
|
|
7891
|
-
keyTest: (event
|
|
7924
|
+
keyTest: (event, appState, elements, app) => {
|
|
7925
|
+
return app.props.showPanActions !== false && !event.altKey && !event[KEYS12.CTRL_OR_CMD] && event.key === KEYS12.H;
|
|
7926
|
+
}
|
|
7892
7927
|
});
|
|
7893
7928
|
|
|
7894
7929
|
// actions/actionEmbeddable.ts
|
|
@@ -9145,7 +9180,7 @@ var exportCanvas = async (type, elements, appState, files, {
|
|
|
9145
9180
|
let blob = canvasToBlob(tempCanvas);
|
|
9146
9181
|
if (appState.exportEmbedScene) {
|
|
9147
9182
|
blob = blob.then(
|
|
9148
|
-
(blob2) => import("./data/image-
|
|
9183
|
+
(blob2) => import("./data/image-QP66FJQD.js").then(
|
|
9149
9184
|
({ encodePngMetadata: encodePngMetadata2 }) => encodePngMetadata2({
|
|
9150
9185
|
blob: blob2,
|
|
9151
9186
|
metadata: serializeAsJSON(elements, appState, files, "local")
|
|
@@ -16265,19 +16300,27 @@ var ShapesSwitcher = ({
|
|
|
16265
16300
|
}
|
|
16266
16301
|
if (value === "freedraw") {
|
|
16267
16302
|
window.dispatchEvent(
|
|
16268
|
-
new CustomEvent("leftflyout:toggle", {
|
|
16303
|
+
new CustomEvent("leftflyout:toggle", {
|
|
16304
|
+
detail: { group: "freedraw" }
|
|
16305
|
+
})
|
|
16269
16306
|
);
|
|
16270
16307
|
} else if (value === "line") {
|
|
16271
16308
|
window.dispatchEvent(
|
|
16272
|
-
new CustomEvent("leftflyout:toggle", {
|
|
16309
|
+
new CustomEvent("leftflyout:toggle", {
|
|
16310
|
+
detail: { group: "line" }
|
|
16311
|
+
})
|
|
16273
16312
|
);
|
|
16274
16313
|
} else if (value === "rectangle") {
|
|
16275
16314
|
window.dispatchEvent(
|
|
16276
|
-
new CustomEvent("leftflyout:toggle", {
|
|
16315
|
+
new CustomEvent("leftflyout:toggle", {
|
|
16316
|
+
detail: { group: "shapes" }
|
|
16317
|
+
})
|
|
16277
16318
|
);
|
|
16278
16319
|
} else if (value === "text") {
|
|
16279
16320
|
window.dispatchEvent(
|
|
16280
|
-
new CustomEvent("leftflyout:toggle", {
|
|
16321
|
+
new CustomEvent("leftflyout:toggle", {
|
|
16322
|
+
detail: { group: "text" }
|
|
16323
|
+
})
|
|
16281
16324
|
);
|
|
16282
16325
|
}
|
|
16283
16326
|
if (value === "selection") {
|
|
@@ -16345,23 +16388,18 @@ var ShapesSwitcher = ({
|
|
|
16345
16388
|
};
|
|
16346
16389
|
var ZoomActions = ({
|
|
16347
16390
|
renderAction,
|
|
16348
|
-
zoom
|
|
16349
|
-
|
|
16350
|
-
|
|
16351
|
-
|
|
16352
|
-
|
|
16353
|
-
|
|
16354
|
-
|
|
16355
|
-
|
|
16356
|
-
|
|
16357
|
-
|
|
16358
|
-
|
|
16359
|
-
|
|
16360
|
-
" ",
|
|
16361
|
-
renderAction("redo")
|
|
16362
|
-
] }) }),
|
|
16363
|
-
/* @__PURE__ */ jsx71("div", { className: "clear-button-container", children: /* @__PURE__ */ jsx71(Tooltip, { label: t("labels.clearCanvas"), children: renderAction("clearCanvas") }) })
|
|
16364
|
-
] });
|
|
16391
|
+
zoom,
|
|
16392
|
+
visible = true
|
|
16393
|
+
}) => {
|
|
16394
|
+
if (!visible) {
|
|
16395
|
+
return null;
|
|
16396
|
+
}
|
|
16397
|
+
return /* @__PURE__ */ jsx71(Stack_default.Col, { gap: 1, className: CLASSES2.ZOOM_ACTIONS, children: /* @__PURE__ */ jsxs39(Stack_default.Row, { align: "center", children: [
|
|
16398
|
+
renderAction("zoomOut"),
|
|
16399
|
+
renderAction("resetZoom"),
|
|
16400
|
+
renderAction("zoomIn")
|
|
16401
|
+
] }) });
|
|
16402
|
+
};
|
|
16365
16403
|
var ExitZenModeAction = ({
|
|
16366
16404
|
actionManager,
|
|
16367
16405
|
showExitZenModeBtn
|
|
@@ -19462,12 +19500,12 @@ var ActionManager = class {
|
|
|
19462
19500
|
*/
|
|
19463
19501
|
__publicField(this, "renderAction", (name, data) => {
|
|
19464
19502
|
const canvasActions = this.app.props.UIOptions.canvasActions;
|
|
19465
|
-
|
|
19466
|
-
|
|
19503
|
+
const elements = this.getElementsIncludingDeleted();
|
|
19504
|
+
const appState = this.getAppState();
|
|
19505
|
+
const action = this.actions[name];
|
|
19506
|
+
if (action && "PanelComponent" in action && (name in canvasActions ? canvasActions[name] : true) && (!action.predicate || action.predicate(elements, appState, this.app.props, this.app))) {
|
|
19467
19507
|
const PanelComponent = action.PanelComponent;
|
|
19468
19508
|
PanelComponent.displayName = "PanelComponent";
|
|
19469
|
-
const elements = this.getElementsIncludingDeleted();
|
|
19470
|
-
const appState = this.getAppState();
|
|
19471
19509
|
const updateData = (formState) => {
|
|
19472
19510
|
trackAction(action, "ui", appState, elements, this.app, formState);
|
|
19473
19511
|
this.updater(
|
|
@@ -19520,13 +19558,11 @@ var ActionManager = class {
|
|
|
19520
19558
|
}
|
|
19521
19559
|
handleKeyDown(event) {
|
|
19522
19560
|
const canvasActions = this.app.props.UIOptions.canvasActions;
|
|
19561
|
+
const elements = this.getElementsIncludingDeleted();
|
|
19562
|
+
const appState = this.getAppState();
|
|
19563
|
+
const appProps = this.app.props;
|
|
19523
19564
|
const data = Object.values(this.actions).sort((a, b) => (b.keyPriority || 0) - (a.keyPriority || 0)).filter(
|
|
19524
|
-
(action2) => (action2.name in canvasActions ? canvasActions[action2.name] : true) && action2.keyTest && action2.keyTest(
|
|
19525
|
-
event,
|
|
19526
|
-
this.getAppState(),
|
|
19527
|
-
this.getElementsIncludingDeleted(),
|
|
19528
|
-
this.app
|
|
19529
|
-
)
|
|
19565
|
+
(action2) => (action2.name in canvasActions ? canvasActions[action2.name] : true) && action2.keyTest && (!action2.predicate || action2.predicate(elements, appState, appProps, this.app)) && action2.keyTest(event, appState, elements, this.app)
|
|
19530
19566
|
);
|
|
19531
19567
|
if (data.length !== 1) {
|
|
19532
19568
|
if (data.length > 1) {
|
|
@@ -19535,11 +19571,9 @@ var ActionManager = class {
|
|
|
19535
19571
|
return false;
|
|
19536
19572
|
}
|
|
19537
19573
|
const action = data[0];
|
|
19538
|
-
if (
|
|
19574
|
+
if (appState.viewModeEnabled && action.viewMode !== true) {
|
|
19539
19575
|
return false;
|
|
19540
19576
|
}
|
|
19541
|
-
const elements = this.getElementsIncludingDeleted();
|
|
19542
|
-
const appState = this.getAppState();
|
|
19543
19577
|
const value = null;
|
|
19544
19578
|
trackAction(action, "keyboard", appState, elements, this.app, null);
|
|
19545
19579
|
event.preventDefault();
|
|
@@ -22797,10 +22831,7 @@ var textWysiwyg = ({
|
|
|
22797
22831
|
const strike = styleFromElement.strikethrough ?? app.state.currentTextStrikethrough ? true : false;
|
|
22798
22832
|
editable.style.fontWeight = bold ? "700" : "400";
|
|
22799
22833
|
editable.style.fontStyle = italic ? "italic" : "normal";
|
|
22800
|
-
editable.style.textDecoration = [
|
|
22801
|
-
underline ? "underline" : "",
|
|
22802
|
-
strike ? "line-through" : ""
|
|
22803
|
-
].filter(Boolean).join(" ") || "none";
|
|
22834
|
+
editable.style.textDecoration = [underline ? "underline" : "", strike ? "line-through" : ""].filter(Boolean).join(" ") || "none";
|
|
22804
22835
|
editable.scrollTop = 0;
|
|
22805
22836
|
if (isTestEnv5()) {
|
|
22806
22837
|
editable.style.fontFamily = getFontFamilyString3(updatedTextElement);
|
|
@@ -22888,15 +22919,30 @@ var textWysiwyg = ({
|
|
|
22888
22919
|
};
|
|
22889
22920
|
}
|
|
22890
22921
|
editable.onkeydown = (event) => {
|
|
22891
|
-
if (!event.shiftKey && actionZoomIn.keyTest(
|
|
22922
|
+
if (!event.shiftKey && actionZoomIn.keyTest(
|
|
22923
|
+
event,
|
|
22924
|
+
app.state,
|
|
22925
|
+
Object.values(app.scene.getNonDeletedElementsMap()),
|
|
22926
|
+
app
|
|
22927
|
+
)) {
|
|
22892
22928
|
event.preventDefault();
|
|
22893
22929
|
app.actionManager.executeAction(actionZoomIn);
|
|
22894
22930
|
updateWysiwygStyle();
|
|
22895
|
-
} else if (!event.shiftKey && actionZoomOut.keyTest(
|
|
22931
|
+
} else if (!event.shiftKey && actionZoomOut.keyTest(
|
|
22932
|
+
event,
|
|
22933
|
+
app.state,
|
|
22934
|
+
Object.values(app.scene.getNonDeletedElementsMap()),
|
|
22935
|
+
app
|
|
22936
|
+
)) {
|
|
22896
22937
|
event.preventDefault();
|
|
22897
22938
|
app.actionManager.executeAction(actionZoomOut);
|
|
22898
22939
|
updateWysiwygStyle();
|
|
22899
|
-
} else if (!event.shiftKey && actionResetZoom.keyTest(
|
|
22940
|
+
} else if (!event.shiftKey && actionResetZoom.keyTest(
|
|
22941
|
+
event,
|
|
22942
|
+
app.state,
|
|
22943
|
+
Object.values(app.scene.getNonDeletedElementsMap()),
|
|
22944
|
+
app
|
|
22945
|
+
)) {
|
|
22900
22946
|
event.preventDefault();
|
|
22901
22947
|
app.actionManager.executeAction(actionResetZoom);
|
|
22902
22948
|
updateWysiwygStyle();
|
|
@@ -23873,7 +23919,14 @@ import { ShapeCache as ShapeCache3 } from "haoxin-excalidraw-sdk-element";
|
|
|
23873
23919
|
// components/LeftMainToolbar.tsx
|
|
23874
23920
|
import { TOOL_TYPE as TOOL_TYPE2 } from "haoxin-excalidraw-sdk-common";
|
|
23875
23921
|
import { jsx as jsx83, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
23876
|
-
var LeftMainToolbar = ({
|
|
23922
|
+
var LeftMainToolbar = ({
|
|
23923
|
+
appState,
|
|
23924
|
+
app,
|
|
23925
|
+
visible = true
|
|
23926
|
+
}) => {
|
|
23927
|
+
if (!visible) {
|
|
23928
|
+
return null;
|
|
23929
|
+
}
|
|
23877
23930
|
const active = appState.activeTool.type;
|
|
23878
23931
|
let lineGroupIcon = LineIcon;
|
|
23879
23932
|
let shapesGroupIcon = RectangleIcon;
|
|
@@ -24082,6 +24135,9 @@ import clsx36 from "clsx";
|
|
|
24082
24135
|
import { KEYS as KEYS45 } from "haoxin-excalidraw-sdk-common";
|
|
24083
24136
|
import { jsx as jsx86 } from "react/jsx-runtime";
|
|
24084
24137
|
var HandButton = (props) => {
|
|
24138
|
+
if (props.visible === false) {
|
|
24139
|
+
return null;
|
|
24140
|
+
}
|
|
24085
24141
|
return /* @__PURE__ */ jsx86(
|
|
24086
24142
|
ToolButton,
|
|
24087
24143
|
{
|
|
@@ -24328,7 +24384,8 @@ var MobileMenu = ({
|
|
|
24328
24384
|
device,
|
|
24329
24385
|
renderWelcomeScreen,
|
|
24330
24386
|
UIOptions,
|
|
24331
|
-
app
|
|
24387
|
+
app,
|
|
24388
|
+
showPanActions
|
|
24332
24389
|
}) => {
|
|
24333
24390
|
const {
|
|
24334
24391
|
WelcomeScreenCenterTunnel,
|
|
@@ -24353,7 +24410,8 @@ var MobileMenu = ({
|
|
|
24353
24410
|
checked: isHandToolActive(appState),
|
|
24354
24411
|
onChange: () => onHandToolToggle(),
|
|
24355
24412
|
title: t("toolBar.hand"),
|
|
24356
|
-
isMobile: true
|
|
24413
|
+
isMobile: true,
|
|
24414
|
+
visible: showPanActions !== false
|
|
24357
24415
|
}
|
|
24358
24416
|
),
|
|
24359
24417
|
/* @__PURE__ */ jsx91(
|
|
@@ -24431,15 +24489,22 @@ var MobileMenu = ({
|
|
|
24431
24489
|
marginRight: SCROLLBAR_WIDTH + SCROLLBAR_MARGIN * 2
|
|
24432
24490
|
},
|
|
24433
24491
|
children: /* @__PURE__ */ jsxs50(Island, { padding: 0, children: [
|
|
24434
|
-
appState.openMenu === "shape" && showSelectedShapeActions2(appState, elements) ? /* @__PURE__ */ jsx91(
|
|
24435
|
-
|
|
24492
|
+
appState.openMenu === "shape" && showSelectedShapeActions2(appState, elements) ? /* @__PURE__ */ jsx91(
|
|
24493
|
+
Section,
|
|
24436
24494
|
{
|
|
24437
|
-
|
|
24438
|
-
|
|
24439
|
-
|
|
24440
|
-
|
|
24495
|
+
className: "App-mobile-menu",
|
|
24496
|
+
heading: "selectedShapeActions",
|
|
24497
|
+
children: /* @__PURE__ */ jsx91(
|
|
24498
|
+
SelectedShapeActions,
|
|
24499
|
+
{
|
|
24500
|
+
appState,
|
|
24501
|
+
elementsMap: app.scene.getNonDeletedElementsMap(),
|
|
24502
|
+
renderAction: actionManager.renderAction,
|
|
24503
|
+
app
|
|
24504
|
+
}
|
|
24505
|
+
)
|
|
24441
24506
|
}
|
|
24442
|
-
)
|
|
24507
|
+
) : null,
|
|
24443
24508
|
/* @__PURE__ */ jsxs50("footer", { className: "App-toolbar", children: [
|
|
24444
24509
|
renderAppToolbar(),
|
|
24445
24510
|
appState.scrolledOutside && !appState.openMenu && !appState.openSidebar && /* @__PURE__ */ jsx91(
|
|
@@ -24799,8 +24864,10 @@ var Footer = ({
|
|
|
24799
24864
|
appState,
|
|
24800
24865
|
actionManager,
|
|
24801
24866
|
showExitZenModeBtn,
|
|
24802
|
-
renderWelcomeScreen
|
|
24867
|
+
renderWelcomeScreen,
|
|
24868
|
+
showZoomActions
|
|
24803
24869
|
}) => {
|
|
24870
|
+
const effectiveShowZoomActions = showZoomActions !== false;
|
|
24804
24871
|
const { FooterCenterTunnel, WelcomeScreenHelpHintTunnel } = useTunnels();
|
|
24805
24872
|
return /* @__PURE__ */ jsxs53(
|
|
24806
24873
|
"footer",
|
|
@@ -24808,30 +24875,23 @@ var Footer = ({
|
|
|
24808
24875
|
role: "contentinfo",
|
|
24809
24876
|
className: "layer-ui__wrapper__footer App-menu App-menu_bottom",
|
|
24810
24877
|
children: [
|
|
24811
|
-
/* @__PURE__ */ jsx95(
|
|
24878
|
+
effectiveShowZoomActions && /* @__PURE__ */ jsx95(
|
|
24812
24879
|
"div",
|
|
24813
24880
|
{
|
|
24814
|
-
className: clsx40(
|
|
24815
|
-
"layer-ui__wrapper__footer-left
|
|
24816
|
-
|
|
24817
|
-
|
|
24818
|
-
|
|
24819
|
-
|
|
24820
|
-
|
|
24821
|
-
|
|
24822
|
-
|
|
24823
|
-
|
|
24824
|
-
|
|
24825
|
-
|
|
24826
|
-
|
|
24827
|
-
|
|
24828
|
-
renderAction: actionManager.renderAction,
|
|
24829
|
-
className: clsx40("zen-mode-transition", {
|
|
24830
|
-
"layer-ui__wrapper__footer-left--transition-bottom": appState.zenModeEnabled
|
|
24831
|
-
})
|
|
24832
|
-
}
|
|
24833
|
-
)
|
|
24834
|
-
] }) })
|
|
24881
|
+
className: clsx40(
|
|
24882
|
+
"layer-ui__wrapper__footer-left zen-mode-transition",
|
|
24883
|
+
{
|
|
24884
|
+
"layer-ui__wrapper__footer-left--transition-left": appState.zenModeEnabled
|
|
24885
|
+
}
|
|
24886
|
+
),
|
|
24887
|
+
children: /* @__PURE__ */ jsx95(Stack_default.Col, { gap: 2, children: /* @__PURE__ */ jsx95(Section, { heading: "canvasActions", children: /* @__PURE__ */ jsx95(
|
|
24888
|
+
ZoomActions,
|
|
24889
|
+
{
|
|
24890
|
+
renderAction: actionManager.renderAction,
|
|
24891
|
+
zoom: appState.zoom,
|
|
24892
|
+
visible: effectiveShowZoomActions
|
|
24893
|
+
}
|
|
24894
|
+
) }) })
|
|
24835
24895
|
}
|
|
24836
24896
|
),
|
|
24837
24897
|
/* @__PURE__ */ jsx95(FooterCenterTunnel.Out, {}),
|
|
@@ -25710,8 +25770,12 @@ var LeftToolFlyouts = ({
|
|
|
25710
25770
|
appState,
|
|
25711
25771
|
app,
|
|
25712
25772
|
actionManager,
|
|
25713
|
-
elements
|
|
25773
|
+
elements,
|
|
25774
|
+
showToolBar = true
|
|
25714
25775
|
}) => {
|
|
25776
|
+
if (!showToolBar) {
|
|
25777
|
+
return null;
|
|
25778
|
+
}
|
|
25715
25779
|
const activeTool = appState.activeTool.type;
|
|
25716
25780
|
const selectedStrokeWidth = getFormValue(
|
|
25717
25781
|
elements,
|
|
@@ -31857,7 +31921,10 @@ var LayerUI = ({
|
|
|
31857
31921
|
children,
|
|
31858
31922
|
app,
|
|
31859
31923
|
isCollaborating,
|
|
31860
|
-
generateLinkForSelection
|
|
31924
|
+
generateLinkForSelection,
|
|
31925
|
+
showZoomActions,
|
|
31926
|
+
showPanActions,
|
|
31927
|
+
showToolBar = true
|
|
31861
31928
|
}) => {
|
|
31862
31929
|
const device = useDevice();
|
|
31863
31930
|
const tunnels = useInitializeTunnels();
|
|
@@ -31902,13 +31969,20 @@ var LayerUI = ({
|
|
|
31902
31969
|
renderWelcomeScreen && /* @__PURE__ */ jsx145(tunnels.WelcomeScreenMenuHintTunnel.Out, {})
|
|
31903
31970
|
] });
|
|
31904
31971
|
const renderLeftToolbar = () => {
|
|
31905
|
-
if (appState.viewModeEnabled || appState.openDialog?.name === "elementLinkSelector") {
|
|
31972
|
+
if (appState.viewModeEnabled || appState.openDialog?.name === "elementLinkSelector" || !showToolBar) {
|
|
31906
31973
|
return null;
|
|
31907
31974
|
}
|
|
31908
31975
|
return /* @__PURE__ */ jsx145(FixedSideContainer, { side: "left", children: /* @__PURE__ */ jsx145("div", { className: "App-menu App-menu_left", children: /* @__PURE__ */ jsx145(Section, { heading: "shapes", className: "shapes-section-left", children: (heading) => /* @__PURE__ */ jsxs79("div", { style: { position: "relative" }, children: [
|
|
31909
31976
|
renderWelcomeScreen && /* @__PURE__ */ jsx145(tunnels.WelcomeScreenToolbarHintTunnel.Out, {}),
|
|
31910
31977
|
/* @__PURE__ */ jsxs79(Stack_default.Col, { gap: 4, align: "center", children: [
|
|
31911
|
-
/* @__PURE__ */ jsx145(
|
|
31978
|
+
/* @__PURE__ */ jsx145(
|
|
31979
|
+
LeftMainToolbar_default,
|
|
31980
|
+
{
|
|
31981
|
+
appState,
|
|
31982
|
+
app,
|
|
31983
|
+
visible: showToolBar
|
|
31984
|
+
}
|
|
31985
|
+
),
|
|
31912
31986
|
isCollaborating && /* @__PURE__ */ jsx145(
|
|
31913
31987
|
Island,
|
|
31914
31988
|
{
|
|
@@ -31934,7 +32008,15 @@ var LayerUI = ({
|
|
|
31934
32008
|
const renderFixedSideContainer = () => {
|
|
31935
32009
|
const shouldShowStats = appState.stats.open && !appState.zenModeEnabled && !appState.viewModeEnabled && appState.openDialog?.name !== "elementLinkSelector";
|
|
31936
32010
|
return /* @__PURE__ */ jsx145(FixedSideContainer, { side: "top", children: /* @__PURE__ */ jsxs79("div", { className: "App-menu App-menu_top", children: [
|
|
31937
|
-
/* @__PURE__ */ jsx145(
|
|
32011
|
+
/* @__PURE__ */ jsx145(
|
|
32012
|
+
Stack_default.Col,
|
|
32013
|
+
{
|
|
32014
|
+
gap: 6,
|
|
32015
|
+
className: clsx55("App-menu_top__left"),
|
|
32016
|
+
style: { display: "none" },
|
|
32017
|
+
children: renderCanvasActions()
|
|
32018
|
+
}
|
|
32019
|
+
),
|
|
31938
32020
|
/* @__PURE__ */ jsxs79(
|
|
31939
32021
|
"div",
|
|
31940
32022
|
{
|
|
@@ -32102,7 +32184,8 @@ var LayerUI = ({
|
|
|
32102
32184
|
renderSidebars,
|
|
32103
32185
|
device,
|
|
32104
32186
|
renderWelcomeScreen,
|
|
32105
|
-
UIOptions
|
|
32187
|
+
UIOptions,
|
|
32188
|
+
showPanActions
|
|
32106
32189
|
}
|
|
32107
32190
|
),
|
|
32108
32191
|
!device.editor.isMobile && /* @__PURE__ */ jsxs79(Fragment24, { children: [
|
|
@@ -32121,7 +32204,8 @@ var LayerUI = ({
|
|
|
32121
32204
|
appState,
|
|
32122
32205
|
actionManager,
|
|
32123
32206
|
showExitZenModeBtn,
|
|
32124
|
-
renderWelcomeScreen
|
|
32207
|
+
renderWelcomeScreen,
|
|
32208
|
+
showZoomActions
|
|
32125
32209
|
}
|
|
32126
32210
|
),
|
|
32127
32211
|
appState.scrolledOutside && /* @__PURE__ */ jsx145(
|
|
@@ -32145,16 +32229,17 @@ var LayerUI = ({
|
|
|
32145
32229
|
] });
|
|
32146
32230
|
return /* @__PURE__ */ jsx145(UIAppStateContext.Provider, { value: appState, children: /* @__PURE__ */ jsx145(TunnelsJotaiProvider, { children: /* @__PURE__ */ jsxs79(TunnelsContext.Provider, { value: tunnels, children: [
|
|
32147
32231
|
layerUIJSX,
|
|
32148
|
-
!appState.viewModeEnabled && /* @__PURE__ */ jsx145(
|
|
32232
|
+
!appState.viewModeEnabled && showToolBar && /* @__PURE__ */ jsx145(
|
|
32149
32233
|
LeftToolFlyouts_default,
|
|
32150
32234
|
{
|
|
32151
32235
|
appState,
|
|
32152
32236
|
app,
|
|
32153
32237
|
actionManager,
|
|
32154
|
-
elements
|
|
32238
|
+
elements,
|
|
32239
|
+
showToolBar
|
|
32155
32240
|
}
|
|
32156
32241
|
),
|
|
32157
|
-
!device.editor.isMobile && !appState.viewModeEnabled && /* @__PURE__ */ jsx145(
|
|
32242
|
+
!device.editor.isMobile && !appState.viewModeEnabled && showToolBar && /* @__PURE__ */ jsx145(
|
|
32158
32243
|
TopLeftToolbar,
|
|
32159
32244
|
{
|
|
32160
32245
|
appState,
|
|
@@ -33857,10 +33942,27 @@ var App = class _App extends React46.Component {
|
|
|
33857
33942
|
}
|
|
33858
33943
|
});
|
|
33859
33944
|
/** use when changing scrollX/scrollY/zoom based on user interaction */
|
|
33860
|
-
__publicField(this, "translateCanvas", (state) => {
|
|
33945
|
+
__publicField(this, "translateCanvas", (state, callback) => {
|
|
33946
|
+
if (this.props.showPanActions === false) {
|
|
33947
|
+
if (typeof state === "function") {
|
|
33948
|
+
const wrappedStateFn = (prevState) => {
|
|
33949
|
+
const nextState = state(prevState);
|
|
33950
|
+
if (nextState.scrollX !== prevState.scrollX || nextState.scrollY !== prevState.scrollY) {
|
|
33951
|
+
return prevState;
|
|
33952
|
+
}
|
|
33953
|
+
return nextState;
|
|
33954
|
+
};
|
|
33955
|
+
this.cancelInProgressAnimation?.();
|
|
33956
|
+
this.maybeUnfollowRemoteUser();
|
|
33957
|
+
this.setState(wrappedStateFn, callback);
|
|
33958
|
+
return;
|
|
33959
|
+
} else if (state.scrollX !== void 0 || state.scrollY !== void 0) {
|
|
33960
|
+
return;
|
|
33961
|
+
}
|
|
33962
|
+
}
|
|
33861
33963
|
this.cancelInProgressAnimation?.();
|
|
33862
33964
|
this.maybeUnfollowRemoteUser();
|
|
33863
|
-
this.setState(state);
|
|
33965
|
+
this.setState(state, callback);
|
|
33864
33966
|
});
|
|
33865
33967
|
__publicField(this, "setToast", (toast) => {
|
|
33866
33968
|
this.setState({ toast });
|
|
@@ -33953,7 +34055,7 @@ var App = class _App extends React46.Component {
|
|
|
33953
34055
|
* This method has the same signature as updateScene but marks the
|
|
33954
34056
|
* onChange callback with source: "updateSceneSilently" so consumers
|
|
33955
34057
|
* can choose how to handle it.
|
|
33956
|
-
*
|
|
34058
|
+
*
|
|
33957
34059
|
* Use this method when you need to update the canvas programmatically
|
|
33958
34060
|
* and want to inform consumers that this was a programmatic update.
|
|
33959
34061
|
*/
|
|
@@ -34043,6 +34145,24 @@ var App = class _App extends React46.Component {
|
|
|
34043
34145
|
left: Math.max(propertiesPanelRect?.right ?? 0, 0) + PADDING
|
|
34044
34146
|
};
|
|
34045
34147
|
});
|
|
34148
|
+
__publicField(this, "zoomToFit", () => {
|
|
34149
|
+
console.log("\u{1F50D} \u8C03\u7528 zoomToFit \u65B9\u6CD5");
|
|
34150
|
+
const result = zoomToFit({
|
|
34151
|
+
targetElements: this.scene.getNonDeletedElements(),
|
|
34152
|
+
appState: {
|
|
34153
|
+
...this.state,
|
|
34154
|
+
userToFollow: null
|
|
34155
|
+
},
|
|
34156
|
+
fitToViewport: false,
|
|
34157
|
+
canvasOffsets: {}
|
|
34158
|
+
});
|
|
34159
|
+
if (result) {
|
|
34160
|
+
console.log("\u2705 zoomToFit \u6210\u529F\u6267\u884C\uFF0C\u66F4\u65B0\u573A\u666F");
|
|
34161
|
+
this.updateScene(result);
|
|
34162
|
+
} else {
|
|
34163
|
+
console.log("\u26A0\uFE0F zoomToFit \u6CA1\u6709\u8FD4\u56DE\u7ED3\u679C\uFF0C\u53EF\u80FD\u6CA1\u6709\u5143\u7D20\u9700\u8981\u7F29\u653E");
|
|
34164
|
+
}
|
|
34165
|
+
});
|
|
34046
34166
|
// Input handling
|
|
34047
34167
|
__publicField(this, "onKeyDown", withBatchedUpdates(
|
|
34048
34168
|
(event) => {
|
|
@@ -34368,7 +34488,7 @@ var App = class _App extends React46.Component {
|
|
|
34368
34488
|
event.stopPropagation();
|
|
34369
34489
|
}
|
|
34370
34490
|
}
|
|
34371
|
-
if (event.key === KEYS52.SPACE && gesture.pointers.size === 0) {
|
|
34491
|
+
if (event.key === KEYS52.SPACE && gesture.pointers.size === 0 && this.props.showPanActions !== false) {
|
|
34372
34492
|
isHoldingSpace = true;
|
|
34373
34493
|
setCursor(this.interactiveCanvas, CURSOR_TYPE4.GRAB);
|
|
34374
34494
|
event.preventDefault();
|
|
@@ -35755,7 +35875,7 @@ var App = class _App extends React46.Component {
|
|
|
35755
35875
|
});
|
|
35756
35876
|
// Returns whether the event is a panning
|
|
35757
35877
|
__publicField(this, "handleCanvasPanUsingWheelOrSpaceDrag", (event) => {
|
|
35758
|
-
if (!(gesture.pointers.size <= 1 && (event.button === POINTER_BUTTON2.WHEEL || event.button === POINTER_BUTTON2.MAIN && isHoldingSpace || isHandToolActive(this.state) || this.state.viewModeEnabled))) {
|
|
35878
|
+
if (!(this.props.showPanActions !== false && gesture.pointers.size <= 1 && (event.button === POINTER_BUTTON2.WHEEL || event.button === POINTER_BUTTON2.MAIN && isHoldingSpace || isHandToolActive(this.state) || this.state.viewModeEnabled))) {
|
|
35759
35879
|
return false;
|
|
35760
35880
|
}
|
|
35761
35881
|
isPanning = true;
|
|
@@ -37336,17 +37456,19 @@ var App = class _App extends React46.Component {
|
|
|
37336
37456
|
this.resetShouldCacheIgnoreZoomDebounced();
|
|
37337
37457
|
return;
|
|
37338
37458
|
}
|
|
37339
|
-
if (event.shiftKey) {
|
|
37459
|
+
if (event.shiftKey && this.props.showPanActions !== false) {
|
|
37340
37460
|
this.translateCanvas(({ zoom, scrollX }) => ({
|
|
37341
37461
|
// on Mac, shift+wheel tends to result in deltaX
|
|
37342
37462
|
scrollX: scrollX - (deltaY || deltaX) / zoom.value
|
|
37343
37463
|
}));
|
|
37344
37464
|
return;
|
|
37345
37465
|
}
|
|
37346
|
-
this.
|
|
37347
|
-
|
|
37348
|
-
|
|
37349
|
-
|
|
37466
|
+
if (this.props.showPanActions !== false) {
|
|
37467
|
+
this.translateCanvas(({ zoom, scrollX, scrollY }) => ({
|
|
37468
|
+
scrollX: scrollX - deltaX / zoom.value,
|
|
37469
|
+
scrollY: scrollY - deltaY / zoom.value
|
|
37470
|
+
}));
|
|
37471
|
+
}
|
|
37350
37472
|
}
|
|
37351
37473
|
));
|
|
37352
37474
|
__publicField(this, "savePointer", (x, y, button) => {
|
|
@@ -37466,6 +37588,7 @@ var App = class _App extends React46.Component {
|
|
|
37466
37588
|
clear: this.resetHistory
|
|
37467
37589
|
},
|
|
37468
37590
|
scrollToContent: this.scrollToContent,
|
|
37591
|
+
zoomToFit: this.zoomToFit,
|
|
37469
37592
|
getSceneElements: this.getSceneElements,
|
|
37470
37593
|
getAppState: () => this.state,
|
|
37471
37594
|
getFiles: () => this.files,
|
|
@@ -37939,6 +38062,9 @@ var App = class _App extends React46.Component {
|
|
|
37939
38062
|
app: this,
|
|
37940
38063
|
isCollaborating: this.props.isCollaborating,
|
|
37941
38064
|
generateLinkForSelection: this.props.generateLinkForSelection,
|
|
38065
|
+
showZoomActions: this.props.showZoomActions,
|
|
38066
|
+
showPanActions: this.props.showPanActions,
|
|
38067
|
+
showToolBar: this.props.showToolBar,
|
|
37942
38068
|
children: this.props.children
|
|
37943
38069
|
}
|
|
37944
38070
|
),
|
|
@@ -38839,8 +38965,14 @@ var App = class _App extends React46.Component {
|
|
|
38839
38965
|
const currentStyle = _element.customData?.textStyle || {};
|
|
38840
38966
|
const pick = (cur, st) => cur === void 0 ? !!st : !!cur;
|
|
38841
38967
|
const nextStyle = {
|
|
38842
|
-
bold: pick(
|
|
38843
|
-
|
|
38968
|
+
bold: pick(
|
|
38969
|
+
currentStyle.bold,
|
|
38970
|
+
this.state.currentTextBold
|
|
38971
|
+
),
|
|
38972
|
+
italic: pick(
|
|
38973
|
+
currentStyle.italic,
|
|
38974
|
+
this.state.currentTextItalic
|
|
38975
|
+
),
|
|
38844
38976
|
underline: pick(
|
|
38845
38977
|
currentStyle.underline,
|
|
38846
38978
|
this.state.currentTextUnderline
|
|
@@ -38860,7 +38992,10 @@ var App = class _App extends React46.Component {
|
|
|
38860
38992
|
elementsMap,
|
|
38861
38993
|
nextOriginalText
|
|
38862
38994
|
),
|
|
38863
|
-
customData: {
|
|
38995
|
+
customData: {
|
|
38996
|
+
..._element.customData || {},
|
|
38997
|
+
textStyle: nextStyle
|
|
38998
|
+
}
|
|
38864
38999
|
});
|
|
38865
39000
|
}
|
|
38866
39001
|
return _element;
|
|
@@ -41202,6 +41337,7 @@ import { setCustomTextMetricsProvider } from "haoxin-excalidraw-sdk-element";
|
|
|
41202
41337
|
import { jsx as jsx162 } from "react/jsx-runtime";
|
|
41203
41338
|
polyfill_default();
|
|
41204
41339
|
var ExcalidrawBase = (props) => {
|
|
41340
|
+
console.log("\u4F7F\u7528\u4E86\u7EC4\u4EF6=====Excalidraw component initialized");
|
|
41205
41341
|
const {
|
|
41206
41342
|
onChange,
|
|
41207
41343
|
onIncrement,
|
|
@@ -41235,7 +41371,10 @@ var ExcalidrawBase = (props) => {
|
|
|
41235
41371
|
renderEmbeddable,
|
|
41236
41372
|
aiEnabled,
|
|
41237
41373
|
showDeprecatedFonts,
|
|
41238
|
-
renderScrollbars
|
|
41374
|
+
renderScrollbars,
|
|
41375
|
+
showZoomActions,
|
|
41376
|
+
showPanActions,
|
|
41377
|
+
showToolBar
|
|
41239
41378
|
} = props;
|
|
41240
41379
|
const canvasActions = props.UIOptions?.canvasActions;
|
|
41241
41380
|
const UIOptions = {
|
|
@@ -41307,6 +41446,9 @@ var ExcalidrawBase = (props) => {
|
|
|
41307
41446
|
aiEnabled: aiEnabled !== false,
|
|
41308
41447
|
showDeprecatedFonts,
|
|
41309
41448
|
renderScrollbars,
|
|
41449
|
+
showZoomActions,
|
|
41450
|
+
showPanActions,
|
|
41451
|
+
showToolBar,
|
|
41310
41452
|
children
|
|
41311
41453
|
}
|
|
41312
41454
|
) }) });
|