@excalidraw/excalidraw 0.18.0-rc.7 → 0.18.0

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
@@ -618,10 +618,10 @@ import {
618
618
  wrapText,
619
619
  youtubeIcon,
620
620
  zoomAreaIcon
621
- } from "./chunk-GOAAUIXU.js";
621
+ } from "./chunk-3KPV5WBD.js";
622
622
  import {
623
623
  define_import_meta_env_default
624
- } from "./chunk-TLD3FD3P.js";
624
+ } from "./chunk-66VA7UC4.js";
625
625
  import {
626
626
  en_default
627
627
  } from "./chunk-LMHBUWQS.js";
@@ -6478,7 +6478,7 @@ var exportCanvas = async (type, elements, appState, files, {
6478
6478
  let blob = canvasToBlob(tempCanvas);
6479
6479
  if (appState.exportEmbedScene) {
6480
6480
  blob = blob.then(
6481
- (blob2) => import("./data/image-HTHTIQHJ.js").then(
6481
+ (blob2) => import("./data/image-WB3WPX2D.js").then(
6482
6482
  ({ encodePngMetadata }) => encodePngMetadata({
6483
6483
  blob: blob2,
6484
6484
  metadata: serializeAsJSON(elements, appState, files, "local")
@@ -12457,7 +12457,7 @@ var ShapesSwitcher = ({
12457
12457
  }),
12458
12458
  /* @__PURE__ */ jsx70("div", { className: "App-toolbar__divider" }),
12459
12459
  /* @__PURE__ */ jsxs39(DropdownMenu_default, { open: isExtraToolsMenuOpen, children: [
12460
- /* @__PURE__ */ jsxs39(
12460
+ /* @__PURE__ */ jsx70(
12461
12461
  DropdownMenu_default.Trigger,
12462
12462
  {
12463
12463
  className: clsx31("App-toolbar__extra-tools-trigger", {
@@ -12468,28 +12468,7 @@ var ShapesSwitcher = ({
12468
12468
  }),
12469
12469
  onToggle: () => setIsExtraToolsMenuOpen(!isExtraToolsMenuOpen),
12470
12470
  title: t("toolBar.extraTools"),
12471
- children: [
12472
- extraToolsIcon,
12473
- app.props.aiEnabled !== false && /* @__PURE__ */ jsx70(
12474
- "div",
12475
- {
12476
- style: {
12477
- display: "inline-flex",
12478
- marginLeft: "auto",
12479
- padding: "2px 4px",
12480
- borderRadius: 6,
12481
- fontSize: 8,
12482
- fontFamily: "Cascadia, monospace",
12483
- position: "absolute",
12484
- background: "var(--color-promo)",
12485
- color: "var(--color-surface-lowest)",
12486
- bottom: 3,
12487
- right: 4
12488
- },
12489
- children: "AI"
12490
- }
12491
- )
12492
- ]
12471
+ children: extraToolsIcon
12493
12472
  }
12494
12473
  ),
12495
12474
  /* @__PURE__ */ jsxs39(
@@ -17085,9 +17064,6 @@ var SidebarInner = forwardRef5(
17085
17064
  {
17086
17065
  ...rest,
17087
17066
  className: clsx45("sidebar", { "sidebar--docked": docked }, className),
17088
- style: {
17089
- "--right-sidebar-width": "302px"
17090
- },
17091
17067
  ref: islandRef,
17092
17068
  children: /* @__PURE__ */ jsx104(SidebarPropsContext.Provider, { value: headerPropsRef.current, children })
17093
17069
  }
@@ -21474,7 +21450,7 @@ var LayerUI = ({
21474
21450
  "div",
21475
21451
  {
21476
21452
  className: "layer-ui__wrapper",
21477
- style: appState.openSidebar && isSidebarDocked && device.editor.canFitSidebar ? { width: `calc(100% - var(--right-sidebar-width)px)` } : {},
21453
+ style: appState.openSidebar && isSidebarDocked && device.editor.canFitSidebar ? { width: `calc(100% - var(--right-sidebar-width))` } : {},
21478
21454
  children: [
21479
21455
  renderWelcomeScreen && /* @__PURE__ */ jsx137(tunnels.WelcomeScreenCenterTunnel.Out, {}),
21480
21456
  renderFixedSideContainer(),
@@ -29884,7 +29860,8 @@ var App = class _App extends React43.Component {
29884
29860
  "excalidraw--mobile": this.device.editor.isMobile
29885
29861
  }),
29886
29862
  style: {
29887
- ["--ui-pointerEvents"]: shouldBlockPointerEvents ? POINTER_EVENTS.disabled : POINTER_EVENTS.enabled
29863
+ ["--ui-pointerEvents"]: shouldBlockPointerEvents ? POINTER_EVENTS.disabled : POINTER_EVENTS.enabled,
29864
+ ["--right-sidebar-width"]: "302px"
29888
29865
  },
29889
29866
  ref: this.excalidrawContainerRef,
29890
29867
  onDrop: this.handleAppOnDrop,
@@ -31531,17 +31508,49 @@ var App = class _App extends React43.Component {
31531
31508
  );
31532
31509
  const elements = this.scene.getElementsIncludingDeleted();
31533
31510
  for (const element of elements) {
31534
- if (selectedElementIds.has(element.id) || // case: the state.selectedElementIds might not have been
31511
+ const isInSelection = selectedElementIds.has(element.id) || // case: the state.selectedElementIds might not have been
31535
31512
  // updated yet by the time this mousemove event is fired
31536
- element.id === hitElement?.id && pointerDownState.hit.wasAddedToSelection) {
31513
+ element.id === hitElement?.id && pointerDownState.hit.wasAddedToSelection;
31514
+ if (Math.abs(element.x) > 1e7 || Math.abs(element.x) > 1e7 || Math.abs(element.width) > 1e7 || Math.abs(element.height) > 1e7) {
31515
+ console.error(
31516
+ `Alt+dragging element in scene with invalid dimensions`,
31517
+ element.x,
31518
+ element.y,
31519
+ element.width,
31520
+ element.height,
31521
+ isInSelection
31522
+ );
31523
+ return;
31524
+ }
31525
+ if (isInSelection) {
31537
31526
  const duplicatedElement = duplicateElement(
31538
31527
  this.state.editingGroupId,
31539
31528
  groupIdMap,
31540
31529
  element
31541
31530
  );
31531
+ if (Math.abs(duplicatedElement.x) > 1e7 || Math.abs(duplicatedElement.x) > 1e7 || Math.abs(duplicatedElement.width) > 1e7 || Math.abs(duplicatedElement.height) > 1e7) {
31532
+ console.error(
31533
+ `Alt+dragging duplicated element with invalid dimensions`,
31534
+ duplicatedElement.x,
31535
+ duplicatedElement.y,
31536
+ duplicatedElement.width,
31537
+ duplicatedElement.height
31538
+ );
31539
+ return;
31540
+ }
31542
31541
  const origElement = pointerDownState.originalElements.get(
31543
31542
  element.id
31544
31543
  );
31544
+ if (Math.abs(origElement.x) > 1e7 || Math.abs(origElement.x) > 1e7 || Math.abs(origElement.width) > 1e7 || Math.abs(origElement.height) > 1e7) {
31545
+ console.error(
31546
+ `Alt+dragging duplicated element with invalid dimensions`,
31547
+ origElement.x,
31548
+ origElement.y,
31549
+ origElement.width,
31550
+ origElement.height
31551
+ );
31552
+ return;
31553
+ }
31545
31554
  mutateElement(duplicatedElement, {
31546
31555
  x: origElement.x,
31547
31556
  y: origElement.y