@myoc/excalidraw 0.19.529 → 0.19.531

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/index.js CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  ImageSceneDataError,
7
7
  ImageURLToFile,
8
8
  SVGStringToFile,
9
+ UnsupportedImageFileTypeError,
9
10
  bootstrapCanvas,
10
11
  canChangeRoundness,
11
12
  canHaveArrowheads,
@@ -62,10 +63,10 @@ import {
62
63
  serializeAsJSON,
63
64
  strokeRectWithRotation_simple,
64
65
  zoomToFitBounds
65
- } from "./chunk-7GX2B2N5.js";
66
+ } from "./chunk-6NFVXSAY.js";
66
67
  import {
67
68
  define_import_meta_env_default
68
- } from "./chunk-H5L4PT3U.js";
69
+ } from "./chunk-ASAPRLCW.js";
69
70
  import {
70
71
  en_default
71
72
  } from "./chunk-SKCAT7JG.js";
@@ -10936,7 +10937,7 @@ var exportCanvas = async (type, elements, appState, files, {
10936
10937
  let blob = canvasToBlob(tempCanvas);
10937
10938
  if (appState.exportEmbedScene) {
10938
10939
  blob = blob.then(
10939
- (blob2) => import("./data/image-GYAOLTNI.js").then(
10940
+ (blob2) => import("./data/image-PZBZVE3P.js").then(
10940
10941
  ({ encodePngMetadata: encodePngMetadata2 }) => encodePngMetadata2({
10941
10942
  blob: blob2,
10942
10943
  metadata: serializeAsJSON(elements, appState, files, "local")
@@ -13009,6 +13010,7 @@ var actionSmartZoom = register({
13009
13010
  type: "button",
13010
13011
  icon: arrowsToEyeIcon,
13011
13012
  "aria-label": t("labels.smartZoom"),
13013
+ title: `${t("labels.smartZoom")} - ${KEYS26.F.toLocaleUpperCase()}`,
13012
13014
  onClick: () => updateData(null),
13013
13015
  size: data?.size || "medium",
13014
13016
  "data-testid": "button-smart-zoom",
@@ -25568,6 +25570,7 @@ var getShapeActionPredicates = (appState, targetElements, elementsMap, app) => {
25568
25570
  ),
25569
25571
  align: !isSingleElementBoundContainer && alignActionsPredicate(appState, app),
25570
25572
  distribute: targetElements.length > 2,
25573
+ imageLayout: targetElements.length > 1 && targetElements.every(isImageElement4) && alignActionsPredicate(appState, app),
25571
25574
  // per-element actions
25572
25575
  // NOTE: the full panel treats a bound container as linkable; the compact /
25573
25576
  // mobile layouts only link a truly single selection. Both are preserved via
@@ -25598,7 +25601,8 @@ var LayersFieldset = ({
25598
25601
  ] });
25599
25602
  var AlignFieldset = ({
25600
25603
  renderAction,
25601
- showDistribute
25604
+ showDistribute,
25605
+ showImageLayout
25602
25606
  }) => {
25603
25607
  const isRTL3 = document.documentElement.getAttribute("dir") === "rtl";
25604
25608
  return /* @__PURE__ */ jsxs33("fieldset", { children: [
@@ -25631,7 +25635,12 @@ var AlignFieldset = ({
25631
25635
  showDistribute && renderAction("distributeVertically")
25632
25636
  ]
25633
25637
  }
25634
- )
25638
+ ),
25639
+ showImageLayout && /* @__PURE__ */ jsxs33(Fragment9, { children: [
25640
+ /* @__PURE__ */ jsx66("div", { style: { flexBasis: "100%", height: 0 } }),
25641
+ renderAction("arrangeElements"),
25642
+ renderAction("normaliseElements")
25643
+ ] })
25635
25644
  ] })
25636
25645
  ] });
25637
25646
  };
@@ -25678,7 +25687,8 @@ var SelectedShapeActions = ({
25678
25687
  AlignFieldset,
25679
25688
  {
25680
25689
  renderAction,
25681
- showDistribute: predicates.distribute
25690
+ showDistribute: predicates.distribute,
25691
+ showImageLayout: predicates.imageLayout
25682
25692
  }
25683
25693
  ),
25684
25694
  predicates.showExtraActions && /* @__PURE__ */ jsxs33("fieldset", { children: [
@@ -25690,7 +25700,8 @@ var SelectedShapeActions = ({
25690
25700
  renderAction("ungroup"),
25691
25701
  predicates.link && renderAction("hyperlink"),
25692
25702
  predicates.cropEditor && renderAction("cropEditor"),
25693
- predicates.lineEditor && renderAction("toggleLinearEditor")
25703
+ predicates.lineEditor && renderAction("toggleLinearEditor"),
25704
+ renderAction("smartZoom")
25694
25705
  ] })
25695
25706
  ] })
25696
25707
  ] });
@@ -25976,7 +25987,8 @@ var CombinedExtraActions = ({
25976
25987
  AlignFieldset,
25977
25988
  {
25978
25989
  renderAction,
25979
- showDistribute: predicates.distribute
25990
+ showDistribute: predicates.distribute,
25991
+ showImageLayout: predicates.imageLayout
25980
25992
  }
25981
25993
  ),
25982
25994
  /* @__PURE__ */ jsxs33("fieldset", { children: [
@@ -25986,6 +25998,7 @@ var CombinedExtraActions = ({
25986
25998
  renderAction("ungroup"),
25987
25999
  predicates.linkSingleOnly && renderAction("hyperlink"),
25988
26000
  predicates.cropEditor && renderAction("cropEditor"),
26001
+ renderAction("smartZoom"),
25989
26002
  showDuplicate && renderAction("duplicateSelection"),
25990
26003
  showDelete && renderAction("deleteSelectedElements")
25991
26004
  ] })
@@ -27103,7 +27116,9 @@ var MobileMenu = ({
27103
27116
  {
27104
27117
  className: "App-bottom-bar",
27105
27118
  style: {
27106
- marginBottom: SCROLLBAR_WIDTH + SCROLLBAR_MARGIN
27119
+ marginBottom: SCROLLBAR_WIDTH + SCROLLBAR_MARGIN,
27120
+ left: 14,
27121
+ transform: "none"
27107
27122
  },
27108
27123
  "data-viewport-ui": "bottom",
27109
27124
  children: [
@@ -27124,7 +27139,14 @@ var MobileMenu = ({
27124
27139
  }
27125
27140
  )
27126
27141
  ] }),
27127
- !appState.viewModeEnabled && /* @__PURE__ */ jsx80(Island, { className: "App-toolbar", children: appState.openDialog?.name !== "elementLinkSelector" && renderToolbar() })
27142
+ !appState.viewModeEnabled && /* @__PURE__ */ jsx80(
27143
+ Island,
27144
+ {
27145
+ className: "App-toolbar",
27146
+ style: { justifyContent: "flex-start" },
27147
+ children: appState.openDialog?.name !== "elementLinkSelector" && renderToolbar()
27148
+ }
27149
+ )
27128
27150
  ]
27129
27151
  }
27130
27152
  ),
@@ -36985,10 +37007,20 @@ var App = class _App extends React40.Component {
36985
37007
  }
36986
37008
  ));
36987
37009
  __publicField(this, "addImageElementsToScene", async (imageFiles, sceneX, sceneY) => {
37010
+ const unsupportedImage = imageFiles.find(
37011
+ ({ file: file2 }) => !isSupportedImageFile(file2)
37012
+ );
37013
+ if (unsupportedImage) {
37014
+ throw new UnsupportedImageFileTypeError(
37015
+ unsupportedImage.file,
37016
+ t("errors.unsupportedFileType")
37017
+ );
37018
+ }
36988
37019
  await this.insertImages(
36989
37020
  imageFiles.map(({ file: file2 }) => file2),
36990
37021
  sceneX,
36991
- sceneY
37022
+ sceneY,
37023
+ imageFiles.map(({ customData }) => customData ?? {})
36992
37024
  );
36993
37025
  });
36994
37026
  __publicField(this, "addImagePlaceholder", async (fileId, file2) => {
@@ -41184,6 +41216,13 @@ var App = class _App extends React40.Component {
41184
41216
  }
41185
41217
  return [];
41186
41218
  });
41219
+ __publicField(this, "getImageActionContextMenuItems", (hitElement) => {
41220
+ const selectedElements = this.scene.getSelectedElements(this.state);
41221
+ if (selectedElements.length > 0 && selectedElements.every((element) => isImageElement9(element)) && (!hitElement || this.state.selectedElementIds[hitElement.id])) {
41222
+ return [actionArrangeElements, actionNormaliseElements];
41223
+ }
41224
+ return [];
41225
+ });
41187
41226
  __publicField(this, "getElementLinkContextMenuItems", (hitElement) => {
41188
41227
  if (!hitElement?.link) {
41189
41228
  return [];
@@ -41213,6 +41252,7 @@ var App = class _App extends React40.Component {
41213
41252
  });
41214
41253
  __publicField(this, "getContextMenuItems", (type, hitElement) => {
41215
41254
  const imageContextMenuItems = this.getImageContextMenuItems(hitElement);
41255
+ const imageActionContextMenuItems = this.getImageActionContextMenuItems(hitElement);
41216
41256
  const elementLinkContextMenuItems = this.getElementLinkContextMenuItems(hitElement);
41217
41257
  if (type === "canvas") {
41218
41258
  if (this.state.viewModeEnabled) {
@@ -41263,6 +41303,8 @@ var App = class _App extends React40.Component {
41263
41303
  actionPaste,
41264
41304
  imageContextMenuItems.length > 0 && CONTEXT_MENU_SEPARATOR,
41265
41305
  ...imageContextMenuItems,
41306
+ imageActionContextMenuItems.length > 0 && CONTEXT_MENU_SEPARATOR,
41307
+ ...imageActionContextMenuItems,
41266
41308
  CONTEXT_MENU_SEPARATOR,
41267
41309
  actionSelectAllElementsInFrame,
41268
41310
  actionRemoveAllElementsFromFrame,
@@ -45926,6 +45968,7 @@ export {
45926
45968
  Sidebar,
45927
45969
  Stats,
45928
45970
  THEME26 as THEME,
45971
+ UnsupportedImageFileTypeError,
45929
45972
  UserIdleState2 as UserIdleState,
45930
45973
  WelcomeScreen_default as WelcomeScreen,
45931
45974
  applyDarkModeFilter11 as applyDarkModeFilter,