@myoc/excalidraw 0.19.546 → 0.19.547
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/CHANGELOG.md +53 -0
- package/dist/dev/{chunk-GEFQQ6MF.js → chunk-6X722ZMM.js} +2 -2
- package/dist/dev/{chunk-XE3CQOUC.js → chunk-OWS32STE.js} +3 -3
- package/dist/dev/{chunk-35XUJXYN.js → chunk-VBVJJWUO.js} +5 -1
- package/dist/dev/chunk-VBVJJWUO.js.map +7 -0
- package/dist/dev/data/{image-K27274LO.js → image-SHO5VNS6.js} +3 -3
- package/dist/dev/index.css +0 -3
- package/dist/dev/index.css.map +2 -2
- package/dist/dev/index.js +225 -65
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/locales/{en-CBVTFJ6O.js → en-V2WTRX5T.js} +2 -2
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/{chunk-QYIN2RK3.js → chunk-FZE33ODQ.js} +2 -2
- package/dist/prod/{chunk-VXOLR3OR.js → chunk-MZBVWY5X.js} +4 -4
- package/dist/prod/{chunk-X54XK3GS.js → chunk-U23VT5B7.js} +1 -1
- package/dist/prod/data/image-ELTE3WZG.js +1 -0
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +13 -13
- package/dist/prod/locales/{en-7BECMN3G.js → en-ALU5NMSJ.js} +1 -1
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/excalidraw/actions/manager.d.ts +3 -1
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -0
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/components/App.d.ts +7 -3
- package/dist/types/excalidraw/index.d.ts +1 -1
- package/dist/types/excalidraw/types.d.ts +11 -0
- package/package.json +4 -4
- package/dist/dev/chunk-35XUJXYN.js.map +0 -7
- package/dist/prod/data/image-355PB44S.js +0 -1
- /package/dist/dev/{chunk-GEFQQ6MF.js.map → chunk-6X722ZMM.js.map} +0 -0
- /package/dist/dev/{chunk-XE3CQOUC.js.map → chunk-OWS32STE.js.map} +0 -0
- /package/dist/dev/data/{image-K27274LO.js.map → image-SHO5VNS6.js.map} +0 -0
- /package/dist/dev/locales/{en-CBVTFJ6O.js.map → en-V2WTRX5T.js.map} +0 -0
package/dist/dev/index.js
CHANGED
|
@@ -65,13 +65,13 @@ import {
|
|
|
65
65
|
serializeAsJSON,
|
|
66
66
|
strokeRectWithRotation_simple,
|
|
67
67
|
zoomToFitBounds
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-OWS32STE.js";
|
|
69
69
|
import {
|
|
70
70
|
define_import_meta_env_default
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-6X722ZMM.js";
|
|
72
72
|
import {
|
|
73
73
|
en_default
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-VBVJJWUO.js";
|
|
75
75
|
import {
|
|
76
76
|
percentages_default
|
|
77
77
|
} from "./chunk-72CYJXY3.js";
|
|
@@ -183,6 +183,7 @@ import {
|
|
|
183
183
|
normalizeEOL as normalizeEOL2,
|
|
184
184
|
getDateTime,
|
|
185
185
|
isShallowEqual as isShallowEqual9,
|
|
186
|
+
capitalizeString as capitalizeString4,
|
|
186
187
|
arrayToMap as arrayToMap34,
|
|
187
188
|
applyDarkModeFilter as applyDarkModeFilter10,
|
|
188
189
|
AppEventBus,
|
|
@@ -399,7 +400,7 @@ var globImport_locales_json = __glob({
|
|
|
399
400
|
"./locales/de-CH.json": () => import("./locales/de-CH-KLWBYLGC.js"),
|
|
400
401
|
"./locales/de-DE.json": () => import("./locales/de-DE-UB755M7G.js"),
|
|
401
402
|
"./locales/el-GR.json": () => import("./locales/el-GR-J2BFDAEA.js"),
|
|
402
|
-
"./locales/en.json": () => import("./locales/en-
|
|
403
|
+
"./locales/en.json": () => import("./locales/en-V2WTRX5T.js"),
|
|
403
404
|
"./locales/es-ES.json": () => import("./locales/es-ES-GL35U3D6.js"),
|
|
404
405
|
"./locales/eu-ES.json": () => import("./locales/eu-ES-5LL7P4G7.js"),
|
|
405
406
|
"./locales/fa-IR.json": () => import("./locales/fa-IR-2D6AXPSB.js"),
|
|
@@ -9539,6 +9540,13 @@ var TOOLS = defineTools({
|
|
|
9539
9540
|
fillable: false
|
|
9540
9541
|
}
|
|
9541
9542
|
});
|
|
9543
|
+
var MYOC_SIMPLIFIED_MAIN_TOOL_TYPES = [
|
|
9544
|
+
"selection",
|
|
9545
|
+
"freedraw",
|
|
9546
|
+
"text",
|
|
9547
|
+
"image",
|
|
9548
|
+
"eraser"
|
|
9549
|
+
];
|
|
9542
9550
|
var MYOC_SIMPLIFIED_EXTRA_TOOL_TYPES = [
|
|
9543
9551
|
"autoshape",
|
|
9544
9552
|
"rectangle",
|
|
@@ -11044,7 +11052,7 @@ var exportCanvas = async (type, elements, appState, files, {
|
|
|
11044
11052
|
let blob = canvasToBlob(tempCanvas);
|
|
11045
11053
|
if (appState.exportEmbedScene) {
|
|
11046
11054
|
blob = blob.then(
|
|
11047
|
-
(blob2) => import("./data/image-
|
|
11055
|
+
(blob2) => import("./data/image-SHO5VNS6.js").then(
|
|
11048
11056
|
({ encodePngMetadata: encodePngMetadata2 }) => encodePngMetadata2({
|
|
11049
11057
|
blob: blob2,
|
|
11050
11058
|
metadata: serializeAsJSON(elements, appState, files, "local")
|
|
@@ -17140,6 +17148,15 @@ var ActionManager = class {
|
|
|
17140
17148
|
__publicField(this, "getElementsIncludingDeleted");
|
|
17141
17149
|
__publicField(this, "app");
|
|
17142
17150
|
__publicField(this, "isActionBlockedByViewportTransition", (action) => action.navigation === true && this.app.viewport.isLockedTransitionPending);
|
|
17151
|
+
__publicField(this, "isActionEnabledByCanvasOptions", (action) => {
|
|
17152
|
+
const canvasActions = this.app.props.UIOptions.canvasActions;
|
|
17153
|
+
if (action.name === "saveFileToDisk") {
|
|
17154
|
+
return Boolean(
|
|
17155
|
+
canvasActions.export && typeof canvasActions.export === "object" && canvasActions.export.saveFileToDisk
|
|
17156
|
+
);
|
|
17157
|
+
}
|
|
17158
|
+
return action.name in canvasActions ? Boolean(canvasActions[action.name]) : true;
|
|
17159
|
+
});
|
|
17143
17160
|
/**
|
|
17144
17161
|
* @param data additional data sent to the PanelComponent
|
|
17145
17162
|
*/
|
|
@@ -17190,6 +17207,10 @@ var ActionManager = class {
|
|
|
17190
17207
|
const appState = this.getAppState();
|
|
17191
17208
|
return !action.predicate || action.predicate(elements, appState, this.app.props, this.app);
|
|
17192
17209
|
});
|
|
17210
|
+
__publicField(this, "isActionAvailableForUI", (action) => {
|
|
17211
|
+
const appState = this.getAppState();
|
|
17212
|
+
return this.isActionEnabledByCanvasOptions(action) && this.isActionEnabled(action) && (!appState.viewModeEnabled || action.viewMode === true) && (this.app.isInteractionEnabled() || this.app.isNavigationEnabled() && action.navigation === true) && !this.isActionBlockedByViewportTransition(action);
|
|
17213
|
+
});
|
|
17193
17214
|
this.updater = (actionResult) => {
|
|
17194
17215
|
if (isPromiseLike3(actionResult)) {
|
|
17195
17216
|
actionResult.then((actionResult2) => {
|
|
@@ -21301,6 +21322,71 @@ var renderSpreadsheet = (chartType, spreadsheet, x, y, colorSeed) => {
|
|
|
21301
21322
|
return renderBarChart(spreadsheet, x, y, colorSeed);
|
|
21302
21323
|
};
|
|
21303
21324
|
|
|
21325
|
+
// actions/shortcuts.ts
|
|
21326
|
+
import { isDarwin as isDarwin3 } from "@excalidraw/common";
|
|
21327
|
+
var shortcutMap = {
|
|
21328
|
+
toggleTheme: [getShortcutKey("Shift+Alt+D")],
|
|
21329
|
+
saveScene: [getShortcutKey("CtrlOrCmd+S")],
|
|
21330
|
+
loadScene: [getShortcutKey("CtrlOrCmd+O")],
|
|
21331
|
+
imageExport: [getShortcutKey("CtrlOrCmd+Shift+E")],
|
|
21332
|
+
cut: [getShortcutKey("CtrlOrCmd+X")],
|
|
21333
|
+
copy: [getShortcutKey("CtrlOrCmd+C")],
|
|
21334
|
+
paste: [getShortcutKey("CtrlOrCmd+V")],
|
|
21335
|
+
copyStyles: [getShortcutKey("CtrlOrCmd+Alt+C")],
|
|
21336
|
+
pasteStyles: [getShortcutKey("CtrlOrCmd+Alt+V")],
|
|
21337
|
+
selectAll: [getShortcutKey("CtrlOrCmd+A")],
|
|
21338
|
+
deleteSelectedElements: [getShortcutKey("Delete")],
|
|
21339
|
+
duplicateSelection: [
|
|
21340
|
+
getShortcutKey("CtrlOrCmd+D"),
|
|
21341
|
+
getShortcutKey(`Alt+${t("helpDialog.drag")}`)
|
|
21342
|
+
],
|
|
21343
|
+
sendBackward: [getShortcutKey("CtrlOrCmd+[")],
|
|
21344
|
+
bringForward: [getShortcutKey("CtrlOrCmd+]")],
|
|
21345
|
+
sendToBack: [
|
|
21346
|
+
isDarwin3 ? getShortcutKey("CtrlOrCmd+Alt+[") : getShortcutKey("CtrlOrCmd+Shift+[")
|
|
21347
|
+
],
|
|
21348
|
+
bringToFront: [
|
|
21349
|
+
isDarwin3 ? getShortcutKey("CtrlOrCmd+Alt+]") : getShortcutKey("CtrlOrCmd+Shift+]")
|
|
21350
|
+
],
|
|
21351
|
+
copyAsPng: [getShortcutKey("Shift+Alt+C")],
|
|
21352
|
+
group: [getShortcutKey("CtrlOrCmd+G")],
|
|
21353
|
+
ungroup: [getShortcutKey("CtrlOrCmd+Shift+G")],
|
|
21354
|
+
gridMode: [getShortcutKey("CtrlOrCmd+'")],
|
|
21355
|
+
objectsSnapMode: [getShortcutKey("Alt+S")],
|
|
21356
|
+
stats: [getShortcutKey("Alt+/")],
|
|
21357
|
+
flipHorizontal: [getShortcutKey("Shift+H")],
|
|
21358
|
+
flipVertical: [getShortcutKey("Shift+V")],
|
|
21359
|
+
flipViewpointHorizontal: [getShortcutKey("Shift+R")],
|
|
21360
|
+
flipViewpointVertical: [getShortcutKey("Alt+Shift+R")],
|
|
21361
|
+
viewMode: [getShortcutKey("Alt+R")],
|
|
21362
|
+
hyperlink: [getShortcutKey("CtrlOrCmd+K")],
|
|
21363
|
+
toggleElementLock: [getShortcutKey("CtrlOrCmd+Shift+L")],
|
|
21364
|
+
resetZoom: [getShortcutKey("CtrlOrCmd+0")],
|
|
21365
|
+
zoomOut: [getShortcutKey("CtrlOrCmd+-")],
|
|
21366
|
+
zoomIn: [getShortcutKey("CtrlOrCmd++")],
|
|
21367
|
+
zoomToFitSelection: [],
|
|
21368
|
+
zoomToFit: [],
|
|
21369
|
+
zoomToFitSelectionInViewport: [],
|
|
21370
|
+
smartZoom: [getShortcutKey("F")],
|
|
21371
|
+
saveFileToDisk: [getShortcutKey("CtrlOrCmd+S")],
|
|
21372
|
+
saveToActiveFile: [getShortcutKey("CtrlOrCmd+S")],
|
|
21373
|
+
toggleShortcuts: [getShortcutKey("?")],
|
|
21374
|
+
searchMenu: [getShortcutKey("CtrlOrCmd+F")],
|
|
21375
|
+
wrapSelectionInFrame: [],
|
|
21376
|
+
arrangeElements: [getShortcutKey("Shift+A")],
|
|
21377
|
+
toolLock: [getShortcutKey("Q")]
|
|
21378
|
+
};
|
|
21379
|
+
var getShortcutFromShortcutName = (name, idx = 0) => {
|
|
21380
|
+
const shortcuts = shortcutMap[name];
|
|
21381
|
+
return shortcuts && shortcuts.length > 0 ? shortcuts[idx] || shortcuts[0] : "";
|
|
21382
|
+
};
|
|
21383
|
+
var getActionShortcut = (name) => {
|
|
21384
|
+
if (!Object.prototype.hasOwnProperty.call(shortcutMap, name)) {
|
|
21385
|
+
return void 0;
|
|
21386
|
+
}
|
|
21387
|
+
return getShortcutFromShortcutName(name) || void 0;
|
|
21388
|
+
};
|
|
21389
|
+
|
|
21304
21390
|
// renderer/interactiveScene.ts
|
|
21305
21391
|
import {
|
|
21306
21392
|
clamp as clamp7,
|
|
@@ -25441,65 +25527,6 @@ var BraveMeasureTextError_default = BraveMeasureTextError;
|
|
|
25441
25527
|
import clsx27 from "clsx";
|
|
25442
25528
|
import React20 from "react";
|
|
25443
25529
|
|
|
25444
|
-
// actions/shortcuts.ts
|
|
25445
|
-
import { isDarwin as isDarwin3 } from "@excalidraw/common";
|
|
25446
|
-
var shortcutMap = {
|
|
25447
|
-
toggleTheme: [getShortcutKey("Shift+Alt+D")],
|
|
25448
|
-
saveScene: [getShortcutKey("CtrlOrCmd+S")],
|
|
25449
|
-
loadScene: [getShortcutKey("CtrlOrCmd+O")],
|
|
25450
|
-
imageExport: [getShortcutKey("CtrlOrCmd+Shift+E")],
|
|
25451
|
-
cut: [getShortcutKey("CtrlOrCmd+X")],
|
|
25452
|
-
copy: [getShortcutKey("CtrlOrCmd+C")],
|
|
25453
|
-
paste: [getShortcutKey("CtrlOrCmd+V")],
|
|
25454
|
-
copyStyles: [getShortcutKey("CtrlOrCmd+Alt+C")],
|
|
25455
|
-
pasteStyles: [getShortcutKey("CtrlOrCmd+Alt+V")],
|
|
25456
|
-
selectAll: [getShortcutKey("CtrlOrCmd+A")],
|
|
25457
|
-
deleteSelectedElements: [getShortcutKey("Delete")],
|
|
25458
|
-
duplicateSelection: [
|
|
25459
|
-
getShortcutKey("CtrlOrCmd+D"),
|
|
25460
|
-
getShortcutKey(`Alt+${t("helpDialog.drag")}`)
|
|
25461
|
-
],
|
|
25462
|
-
sendBackward: [getShortcutKey("CtrlOrCmd+[")],
|
|
25463
|
-
bringForward: [getShortcutKey("CtrlOrCmd+]")],
|
|
25464
|
-
sendToBack: [
|
|
25465
|
-
isDarwin3 ? getShortcutKey("CtrlOrCmd+Alt+[") : getShortcutKey("CtrlOrCmd+Shift+[")
|
|
25466
|
-
],
|
|
25467
|
-
bringToFront: [
|
|
25468
|
-
isDarwin3 ? getShortcutKey("CtrlOrCmd+Alt+]") : getShortcutKey("CtrlOrCmd+Shift+]")
|
|
25469
|
-
],
|
|
25470
|
-
copyAsPng: [getShortcutKey("Shift+Alt+C")],
|
|
25471
|
-
group: [getShortcutKey("CtrlOrCmd+G")],
|
|
25472
|
-
ungroup: [getShortcutKey("CtrlOrCmd+Shift+G")],
|
|
25473
|
-
gridMode: [getShortcutKey("CtrlOrCmd+'")],
|
|
25474
|
-
objectsSnapMode: [getShortcutKey("Alt+S")],
|
|
25475
|
-
stats: [getShortcutKey("Alt+/")],
|
|
25476
|
-
flipHorizontal: [getShortcutKey("Shift+H")],
|
|
25477
|
-
flipVertical: [getShortcutKey("Shift+V")],
|
|
25478
|
-
flipViewpointHorizontal: [getShortcutKey("Shift+R")],
|
|
25479
|
-
flipViewpointVertical: [getShortcutKey("Alt+Shift+R")],
|
|
25480
|
-
viewMode: [getShortcutKey("Alt+R")],
|
|
25481
|
-
hyperlink: [getShortcutKey("CtrlOrCmd+K")],
|
|
25482
|
-
toggleElementLock: [getShortcutKey("CtrlOrCmd+Shift+L")],
|
|
25483
|
-
resetZoom: [getShortcutKey("CtrlOrCmd+0")],
|
|
25484
|
-
zoomOut: [getShortcutKey("CtrlOrCmd+-")],
|
|
25485
|
-
zoomIn: [getShortcutKey("CtrlOrCmd++")],
|
|
25486
|
-
zoomToFitSelection: [],
|
|
25487
|
-
zoomToFit: [],
|
|
25488
|
-
zoomToFitSelectionInViewport: [],
|
|
25489
|
-
smartZoom: [getShortcutKey("F")],
|
|
25490
|
-
saveFileToDisk: [getShortcutKey("CtrlOrCmd+S")],
|
|
25491
|
-
saveToActiveFile: [getShortcutKey("CtrlOrCmd+S")],
|
|
25492
|
-
toggleShortcuts: [getShortcutKey("?")],
|
|
25493
|
-
searchMenu: [getShortcutKey("CtrlOrCmd+F")],
|
|
25494
|
-
wrapSelectionInFrame: [],
|
|
25495
|
-
arrangeElements: [getShortcutKey("Shift+A")],
|
|
25496
|
-
toolLock: [getShortcutKey("Q")]
|
|
25497
|
-
};
|
|
25498
|
-
var getShortcutFromShortcutName = (name, idx = 0) => {
|
|
25499
|
-
const shortcuts = shortcutMap[name];
|
|
25500
|
-
return shortcuts && shortcuts.length > 0 ? shortcuts[idx] || shortcuts[0] : "";
|
|
25501
|
-
};
|
|
25502
|
-
|
|
25503
25530
|
// components/Popover.tsx
|
|
25504
25531
|
import { useLayoutEffect as useLayoutEffect4, useRef as useRef16, useEffect as useEffect23 } from "react";
|
|
25505
25532
|
import { unstable_batchedUpdates as unstable_batchedUpdates2 } from "react-dom";
|
|
@@ -28825,6 +28852,40 @@ var PreferencesToggleViewModeItem = () => {
|
|
|
28825
28852
|
}
|
|
28826
28853
|
);
|
|
28827
28854
|
};
|
|
28855
|
+
var PreferencesMyOCDesktopUIModeItem = () => {
|
|
28856
|
+
const { t: t2 } = useI18n();
|
|
28857
|
+
const app = useApp();
|
|
28858
|
+
const editorInterface = useEditorInterface();
|
|
28859
|
+
if (editorInterface.formFactor !== "desktop") {
|
|
28860
|
+
return null;
|
|
28861
|
+
}
|
|
28862
|
+
const description = t2("labels.preferences_myocDesktopUIDescription");
|
|
28863
|
+
return /* @__PURE__ */ jsx92(
|
|
28864
|
+
DropdownMenuItemContentRadio_default,
|
|
28865
|
+
{
|
|
28866
|
+
name: "myocDesktopUIMode",
|
|
28867
|
+
value: editorInterface.desktopUIMode,
|
|
28868
|
+
onChange: (mode) => app.setDesktopUIMode(mode),
|
|
28869
|
+
choices: [
|
|
28870
|
+
{
|
|
28871
|
+
value: "full",
|
|
28872
|
+
label: t2("labels.preferences_myocDesktopUIFull"),
|
|
28873
|
+
ariaLabel: `${t2(
|
|
28874
|
+
"labels.preferences_myocDesktopUIFull"
|
|
28875
|
+
)}. ${description}`
|
|
28876
|
+
},
|
|
28877
|
+
{
|
|
28878
|
+
value: "compact",
|
|
28879
|
+
label: t2("labels.preferences_myocDesktopUICompact"),
|
|
28880
|
+
ariaLabel: `${t2(
|
|
28881
|
+
"labels.preferences_myocDesktopUICompact"
|
|
28882
|
+
)}. ${description}`
|
|
28883
|
+
}
|
|
28884
|
+
],
|
|
28885
|
+
children: /* @__PURE__ */ jsx92("span", { title: description, children: t2("labels.preferences_myocDesktopUISize") })
|
|
28886
|
+
}
|
|
28887
|
+
);
|
|
28888
|
+
};
|
|
28828
28889
|
var PreferencesToggleElementPropertiesItem = () => {
|
|
28829
28890
|
const { t: t2 } = useI18n();
|
|
28830
28891
|
const actionManager = useExcalidrawActionManager();
|
|
@@ -28851,6 +28912,7 @@ var Preferences = ({
|
|
|
28851
28912
|
/* @__PURE__ */ jsx92(DropdownMenuSub_default.Trigger, { icon: settingsIcon, children: t2("labels.preferences") }),
|
|
28852
28913
|
/* @__PURE__ */ jsxs49(DropdownMenuSub_default.Content, { className: "excalidraw-main-menu-preferences-submenu", children: [
|
|
28853
28914
|
children || /* @__PURE__ */ jsxs49(Fragment15, { children: [
|
|
28915
|
+
/* @__PURE__ */ jsx92(PreferencesMyOCDesktopUIModeItem, {}),
|
|
28854
28916
|
/* @__PURE__ */ jsx92(PreferencesBoxSelectionModeItem, {}),
|
|
28855
28917
|
/* @__PURE__ */ jsx92(PreferencesToggleToolLockItem, {}),
|
|
28856
28918
|
/* @__PURE__ */ jsx92(PreferencesToggleSnapModeItem, {}),
|
|
@@ -36635,6 +36697,99 @@ var App = class _App extends React41.Component {
|
|
|
36635
36697
|
__publicField(this, "missingPointerEventCleanupEmitter", new Emitter3());
|
|
36636
36698
|
__publicField(this, "onRemoveEventListenersEmitter", new Emitter3());
|
|
36637
36699
|
__publicField(this, "api");
|
|
36700
|
+
__publicField(this, "getCommandToolTypes", () => this.state.myocSimplifiedMode ? [
|
|
36701
|
+
...MYOC_SIMPLIFIED_MAIN_TOOL_TYPES,
|
|
36702
|
+
...MYOC_SIMPLIFIED_EXTRA_TOOL_TYPES
|
|
36703
|
+
] : Object.keys(TOOLS));
|
|
36704
|
+
__publicField(this, "resolveCommandToolType", (type) => {
|
|
36705
|
+
if (!Object.prototype.hasOwnProperty.call(TOOLS, type)) {
|
|
36706
|
+
return null;
|
|
36707
|
+
}
|
|
36708
|
+
const catalogType = type;
|
|
36709
|
+
if (!this.getCommandToolTypes().includes(catalogType)) {
|
|
36710
|
+
return null;
|
|
36711
|
+
}
|
|
36712
|
+
const toolType = catalogType === "selection" ? this.state.preferredSelectionTool.type : catalogType;
|
|
36713
|
+
if (!this.isToolSupported(toolType) || this.props.activeTool != null && this.props.activeTool.type !== toolType) {
|
|
36714
|
+
return null;
|
|
36715
|
+
}
|
|
36716
|
+
return toolType;
|
|
36717
|
+
});
|
|
36718
|
+
__publicField(this, "getCommandActionEntry", (action, elements) => {
|
|
36719
|
+
if (!action.keyTest || !this.actionManager.isActionAvailableForUI(action)) {
|
|
36720
|
+
return null;
|
|
36721
|
+
}
|
|
36722
|
+
const resolvedLabel = typeof action.label === "function" ? action.label(elements, this.state, this) : action.label;
|
|
36723
|
+
if (!resolvedLabel.trim()) {
|
|
36724
|
+
return null;
|
|
36725
|
+
}
|
|
36726
|
+
const resolvedIcon = typeof action.icon === "function" ? action.icon(this.state, elements) : action.icon;
|
|
36727
|
+
const shortcut = getActionShortcut(action.name);
|
|
36728
|
+
return {
|
|
36729
|
+
id: `action:${action.name}`,
|
|
36730
|
+
kind: "action",
|
|
36731
|
+
label: t(resolvedLabel, null, resolvedLabel),
|
|
36732
|
+
...resolvedIcon ? { icon: resolvedIcon } : {},
|
|
36733
|
+
...action.keywords ? { keywords: action.keywords } : {},
|
|
36734
|
+
...shortcut ? { shortcut } : {}
|
|
36735
|
+
};
|
|
36736
|
+
});
|
|
36737
|
+
__publicField(this, "getCommandCatalog", () => {
|
|
36738
|
+
const elements = this.actionManager.getElementsIncludingDeleted();
|
|
36739
|
+
const actions2 = Object.values(this.actionManager.actions).flatMap(
|
|
36740
|
+
(action) => {
|
|
36741
|
+
const entry = this.getCommandActionEntry(action, elements);
|
|
36742
|
+
return entry ? [entry] : [];
|
|
36743
|
+
}
|
|
36744
|
+
);
|
|
36745
|
+
const tools = this.getCommandToolTypes().flatMap((type) => {
|
|
36746
|
+
const resolvedType = this.resolveCommandToolType(type);
|
|
36747
|
+
if (!resolvedType) {
|
|
36748
|
+
return [];
|
|
36749
|
+
}
|
|
36750
|
+
const shortcut = getToolShortcut(type);
|
|
36751
|
+
return [
|
|
36752
|
+
{
|
|
36753
|
+
id: `tool:${type}`,
|
|
36754
|
+
kind: "tool",
|
|
36755
|
+
label: capitalizeString4(t(`toolBar.${resolvedType}`)),
|
|
36756
|
+
icon: TOOLS[resolvedType].icon,
|
|
36757
|
+
...shortcut ? { shortcut } : {}
|
|
36758
|
+
}
|
|
36759
|
+
];
|
|
36760
|
+
});
|
|
36761
|
+
return [...actions2, ...tools];
|
|
36762
|
+
});
|
|
36763
|
+
__publicField(this, "executeCommand", (id) => {
|
|
36764
|
+
if (id.startsWith("action:")) {
|
|
36765
|
+
const actionName = id.slice("action:".length);
|
|
36766
|
+
if (!Object.prototype.hasOwnProperty.call(
|
|
36767
|
+
this.actionManager.actions,
|
|
36768
|
+
actionName
|
|
36769
|
+
)) {
|
|
36770
|
+
return false;
|
|
36771
|
+
}
|
|
36772
|
+
const action = this.actionManager.actions[actionName];
|
|
36773
|
+
if (!action || `action:${action.name}` !== id || !this.getCommandActionEntry(
|
|
36774
|
+
action,
|
|
36775
|
+
this.actionManager.getElementsIncludingDeleted()
|
|
36776
|
+
)) {
|
|
36777
|
+
return false;
|
|
36778
|
+
}
|
|
36779
|
+
this.actionManager.executeAction(action, "ui");
|
|
36780
|
+
return true;
|
|
36781
|
+
}
|
|
36782
|
+
if (!id.startsWith("tool:")) {
|
|
36783
|
+
return false;
|
|
36784
|
+
}
|
|
36785
|
+
const type = id.slice("tool:".length);
|
|
36786
|
+
const resolvedType = this.resolveCommandToolType(type);
|
|
36787
|
+
if (!resolvedType) {
|
|
36788
|
+
return false;
|
|
36789
|
+
}
|
|
36790
|
+
this.setActiveTool({ type: resolvedType });
|
|
36791
|
+
return true;
|
|
36792
|
+
});
|
|
36638
36793
|
/**
|
|
36639
36794
|
* Whether the tool can be activated & driven by user input. False when
|
|
36640
36795
|
* disabled via `UIOptions.tools`, or when the editor is non-interactive
|
|
@@ -37472,13 +37627,16 @@ var App = class _App extends React41.Component {
|
|
|
37472
37627
|
}));
|
|
37473
37628
|
}
|
|
37474
37629
|
});
|
|
37475
|
-
/** TO BE USED LATER */
|
|
37476
37630
|
__publicField(this, "setDesktopUIMode", (mode) => {
|
|
37477
37631
|
const nextMode = setDesktopUIMode(mode);
|
|
37632
|
+
if (!nextMode || nextMode === this.editorInterface.desktopUIMode) {
|
|
37633
|
+
return;
|
|
37634
|
+
}
|
|
37478
37635
|
this.editorInterface = updateObject2(this.editorInterface, {
|
|
37479
37636
|
desktopUIMode: nextMode
|
|
37480
37637
|
});
|
|
37481
37638
|
this.reconcileStylesPanelMode(this.editorInterface);
|
|
37639
|
+
this.forceUpdate();
|
|
37482
37640
|
});
|
|
37483
37641
|
__publicField(this, "onResize", withBatchedUpdates(() => {
|
|
37484
37642
|
this.scene.getElementsIncludingDeleted().forEach((element) => ShapeCache7.delete(element));
|
|
@@ -42795,6 +42953,8 @@ var App = class _App extends React41.Component {
|
|
|
42795
42953
|
registerAction: (action) => {
|
|
42796
42954
|
this.actionManager.registerAction(action);
|
|
42797
42955
|
},
|
|
42956
|
+
getCommandCatalog: this.getCommandCatalog,
|
|
42957
|
+
executeCommand: this.executeCommand,
|
|
42798
42958
|
refresh: this.refresh,
|
|
42799
42959
|
setToast: this.setToast,
|
|
42800
42960
|
id: this.id,
|