@myoc/excalidraw 0.19.511 → 0.19.513

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/dist/dev/{chunk-WGF6T3RR.js → chunk-BI6BDZVY.js} +72 -16
  3. package/dist/dev/chunk-BI6BDZVY.js.map +7 -0
  4. package/dist/dev/{chunk-G3MPOS33.js → chunk-FW62QUKV.js} +2 -2
  5. package/dist/dev/data/{image-UBAFGYUH.js → image-WGZL7YPK.js} +3 -3
  6. package/dist/dev/index.js +999 -983
  7. package/dist/dev/index.js.map +4 -4
  8. package/dist/dev/subset-shared.chunk.js +1 -1
  9. package/dist/dev/subset-worker.chunk.js +1 -1
  10. package/dist/prod/chunk-56AUOKVR.js +4 -0
  11. package/dist/prod/{chunk-L47KOK35.js → chunk-NVT4BTJO.js} +1 -1
  12. package/dist/prod/data/image-ZQZIDAZL.js +1 -0
  13. package/dist/prod/index.js +22 -22
  14. package/dist/prod/subset-shared.chunk.js +1 -1
  15. package/dist/prod/subset-worker.chunk.js +1 -1
  16. package/dist/types/common/src/constants.d.ts +1 -0
  17. package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
  18. package/dist/types/excalidraw/components/App.d.ts +6 -8
  19. package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
  20. package/dist/types/excalidraw/eraser/index.d.ts +2 -3
  21. package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
  22. package/dist/types/excalidraw/lasso/index.d.ts +2 -3
  23. package/dist/types/excalidraw/renderer/animation.d.ts +4 -1
  24. package/dist/types/excalidraw/types.d.ts +13 -1
  25. package/dist/types/math/src/point.d.ts +1 -0
  26. package/package.json +4 -4
  27. package/dist/dev/chunk-WGF6T3RR.js.map +0 -7
  28. package/dist/prod/chunk-FDFMDTNR.js +0 -4
  29. package/dist/prod/data/image-TSPDSW4O.js +0 -1
  30. package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
  31. /package/dist/dev/{chunk-G3MPOS33.js.map → chunk-FW62QUKV.js.map} +0 -0
  32. /package/dist/dev/data/{image-UBAFGYUH.js.map → image-WGZL7YPK.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -4389,4 +4389,110 @@ First release of `@excalidraw/excalidraw`## Excalidraw Library
4389
4389
  - Incorrect import for color (was moved to common)
4390
4390
 
4391
4391
  ---
4392
+ ## Excalidraw Library
4393
+
4394
+ **_This section lists the updates made to the excalidraw library and will not affect the integration._**
4395
+
4396
+ ### Features
4397
+
4398
+ - Add ability to turn off compression for files that are smaller than a given size
4399
+
4400
+ - Add lock tool to the dropdown and also add the status of the extra tools to be the same icon as the selected tool
4401
+
4402
+ - Add view mode button
4403
+
4404
+ - Add multiple image copy paste or drag and drop
4405
+
4406
+ - Multiple image additions from clipboard
4407
+
4408
+ - Add arrange elements action
4409
+
4410
+ - Add top picks to appProps for both stoke color and background color
4411
+
4412
+ ### Fixes
4413
+
4414
+ - Issues
4415
+
4416
+ - Make mobile mode more myoc looking
4417
+
4418
+ - Add normalise functionality
4419
+
4420
+ - Update with excalidraw
4421
+
4422
+ - Fix imports
4423
+
4424
+ - Fix mutateGroup to use scene.mutateGroup
4425
+
4426
+ - Imports
4427
+
4428
+ - Ensure that fileId is different for compressed vs uncompressed file
4429
+
4430
+ - Remove not working prop for dontResizeLimitMBs
4431
+
4432
+ - Add smartview for mobile
4433
+
4434
+ - Hide the alignment buttons if there is only one group selected (they do nothing if only one group is selected)
4435
+
4436
+ - Use css vars already provided instead of hard coding directly from oc-gray
4437
+
4438
+ - Remove unused variables
4439
+
4440
+ - Pass the new top pick color props properly
4441
+
4442
+ - Incorrect import for color (was moved to common)
4443
+
4444
+ ---
4445
+ ## Excalidraw Library
4446
+
4447
+ **_This section lists the updates made to the excalidraw library and will not affect the integration._**
4448
+
4449
+ ### Features
4450
+
4451
+ - Add ability to turn off compression for files that are smaller than a given size
4452
+
4453
+ - Add lock tool to the dropdown and also add the status of the extra tools to be the same icon as the selected tool
4454
+
4455
+ - Add view mode button
4456
+
4457
+ - Add multiple image copy paste or drag and drop
4458
+
4459
+ - Multiple image additions from clipboard
4460
+
4461
+ - Add arrange elements action
4462
+
4463
+ - Add top picks to appProps for both stoke color and background color
4464
+
4465
+ ### Fixes
4466
+
4467
+ - Issues
4468
+
4469
+ - Make mobile mode more myoc looking
4470
+
4471
+ - Add normalise functionality
4472
+
4473
+ - Update with excalidraw
4474
+
4475
+ - Fix imports
4476
+
4477
+ - Fix mutateGroup to use scene.mutateGroup
4478
+
4479
+ - Imports
4480
+
4481
+ - Ensure that fileId is different for compressed vs uncompressed file
4482
+
4483
+ - Remove not working prop for dontResizeLimitMBs
4484
+
4485
+ - Add smartview for mobile
4486
+
4487
+ - Hide the alignment buttons if there is only one group selected (they do nothing if only one group is selected)
4488
+
4489
+ - Use css vars already provided instead of hard coding directly from oc-gray
4490
+
4491
+ - Remove unused variables
4492
+
4493
+ - Pass the new top pick color props properly
4494
+
4495
+ - Incorrect import for color (was moved to common)
4496
+
4497
+ ---
4392
4498
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  define_import_meta_env_default
3
- } from "./chunk-G3MPOS33.js";
3
+ } from "./chunk-FW62QUKV.js";
4
4
  import {
5
5
  __publicField
6
6
  } from "./chunk-XDFCUUT6.js";
@@ -4437,7 +4437,7 @@ var getExportSize = (elements, exportPadding, scale) => {
4437
4437
  };
4438
4438
 
4439
4439
  // data/restore.ts
4440
- import { isFiniteNumber, pointFrom as pointFrom2 } from "@excalidraw/math";
4440
+ import { isFiniteNumber, isValidPoint, pointFrom as pointFrom2 } from "@excalidraw/math";
4441
4441
  import {
4442
4442
  DEFAULT_FONT_FAMILY as DEFAULT_FONT_FAMILY2,
4443
4443
  DEFAULT_TEXT_ALIGN as DEFAULT_TEXT_ALIGN2,
@@ -4486,6 +4486,45 @@ import { refreshTextDimensions } from "@excalidraw/element";
4486
4486
  import { getNormalizedDimensions } from "@excalidraw/element";
4487
4487
  import { isInvisiblySmallElement } from "@excalidraw/element";
4488
4488
  var MAX_ARROW_PX = 75e3;
4489
+ var restoreLinearElementPoints = (points, width, height) => {
4490
+ const restoredPoints = Array.isArray(points) ? points.reduce((acc, point) => {
4491
+ if (isValidPoint(point)) {
4492
+ acc.push(pointFrom2(point[0], point[1]));
4493
+ }
4494
+ return acc;
4495
+ }, []) : [];
4496
+ return restoredPoints.length < 2 ? [
4497
+ pointFrom2(0, 0),
4498
+ pointFrom2(
4499
+ isFiniteNumber(width) ? width : 0,
4500
+ isFiniteNumber(height) ? height : 0
4501
+ )
4502
+ ] : restoredPoints;
4503
+ };
4504
+ var restoreFreedrawPoints = (points, pressures) => {
4505
+ if (!Array.isArray(points)) {
4506
+ return {
4507
+ points: [],
4508
+ pressures: []
4509
+ };
4510
+ }
4511
+ const pressureValues = Array.isArray(pressures) ? pressures : [];
4512
+ const restoredPoints = [];
4513
+ const restoredPressures = [];
4514
+ points.forEach((point, index) => {
4515
+ if (isValidPoint(point)) {
4516
+ restoredPoints.push(pointFrom2(point[0], point[1]));
4517
+ if (index in pressureValues) {
4518
+ const pressure = pressureValues[index];
4519
+ restoredPressures.push(isFiniteNumber(pressure) ? pressure : 0.5);
4520
+ }
4521
+ }
4522
+ });
4523
+ return {
4524
+ points: restoredPoints,
4525
+ pressures: restoredPressures
4526
+ };
4527
+ };
4489
4528
  var AllowedExcalidrawActiveTools = {
4490
4529
  selection: true,
4491
4530
  lasso: true,
@@ -4675,10 +4714,14 @@ var restoreElement = (element, targetElementsMap, existingElementsMap, opts) =>
4675
4714
  }
4676
4715
  return element;
4677
4716
  case "freedraw": {
4717
+ const { points: points2, pressures } = restoreFreedrawPoints(
4718
+ element.points,
4719
+ element.pressures
4720
+ );
4678
4721
  return restoreElementWithProperties(element, {
4679
- points: element.points,
4722
+ points: points2,
4680
4723
  simulatePressure: element.simulatePressure,
4681
- pressures: element.pressures
4724
+ pressures
4682
4725
  });
4683
4726
  }
4684
4727
  case "image":
@@ -4694,12 +4737,18 @@ var restoreElement = (element, targetElementsMap, existingElementsMap, opts) =>
4694
4737
  const endArrowhead = normalizeArrowhead(element.endArrowhead);
4695
4738
  let x = element.x;
4696
4739
  let y = element.y;
4697
- let points = (
4698
- // migrate old arrow model to new one
4699
- !Array.isArray(element.points) || element.points.length < 2 ? [pointFrom2(0, 0), pointFrom2(element.width, element.height)] : element.points
4740
+ let points = restoreLinearElementPoints(
4741
+ element.points,
4742
+ element.width,
4743
+ element.height
4700
4744
  );
4701
4745
  if (points[0][0] !== 0 || points[0][1] !== 0) {
4702
- ({ points, x, y } = LinearElementEditor2.getNormalizeElementPointsAndCoords(element));
4746
+ ({ points, x, y } = LinearElementEditor2.getNormalizeElementPointsAndCoords({
4747
+ ...element,
4748
+ points,
4749
+ x: x ?? 0,
4750
+ y: y ?? 0
4751
+ }));
4703
4752
  }
4704
4753
  return restoreElementWithProperties(element, {
4705
4754
  type: "line",
@@ -4711,7 +4760,7 @@ var restoreElement = (element, targetElementsMap, existingElementsMap, opts) =>
4711
4760
  x,
4712
4761
  y,
4713
4762
  ...isLineElement(element) ? {
4714
- polygon: isValidPolygon(element.points) ? element.polygon ?? false : false
4763
+ polygon: isValidPolygon(points) ? element.polygon ?? false : false
4715
4764
  } : {},
4716
4765
  ...getSizeFromPoints(points)
4717
4766
  });
@@ -4720,21 +4769,28 @@ var restoreElement = (element, targetElementsMap, existingElementsMap, opts) =>
4720
4769
  const endArrowhead2 = element.endArrowhead === void 0 ? "arrow" : normalizeArrowhead(element.endArrowhead);
4721
4770
  const x2 = element.x;
4722
4771
  const y2 = element.y;
4723
- const points2 = (
4724
- // migrate old arrow model to new one
4725
- !Array.isArray(element.points) || element.points.length < 2 ? [pointFrom2(0, 0), pointFrom2(element.width, element.height)] : element.points
4772
+ const points2 = restoreLinearElementPoints(
4773
+ element.points,
4774
+ element.width,
4775
+ element.height
4726
4776
  );
4777
+ const elementWithRestoredPoints = {
4778
+ ...element,
4779
+ points: points2,
4780
+ x: x2 ?? 0,
4781
+ y: y2 ?? 0
4782
+ };
4727
4783
  const base = {
4728
4784
  type: element.type,
4729
4785
  startBinding: repairBinding(
4730
- element,
4786
+ elementWithRestoredPoints,
4731
4787
  element.startBinding,
4732
4788
  targetElementsMap,
4733
4789
  existingElementsMap,
4734
4790
  "start"
4735
4791
  ),
4736
4792
  endBinding: repairBinding(
4737
- element,
4793
+ elementWithRestoredPoints,
4738
4794
  element.endBinding,
4739
4795
  targetElementsMap,
4740
4796
  existingElementsMap,
@@ -5045,7 +5101,7 @@ var parseFileContents = async (blob) => {
5045
5101
  let contents;
5046
5102
  if (blob.type === MIME_TYPES6.png) {
5047
5103
  try {
5048
- return await (await import("./data/image-UBAFGYUH.js")).decodePngMetadata(blob);
5104
+ return await (await import("./data/image-WGZL7YPK.js")).decodePngMetadata(blob);
5049
5105
  } catch (error) {
5050
5106
  if (error.message === "INVALID") {
5051
5107
  throw new ImageSceneDataError(
@@ -5406,4 +5462,4 @@ export {
5406
5462
  createFile,
5407
5463
  normalizeFile
5408
5464
  };
5409
- //# sourceMappingURL=chunk-WGF6T3RR.js.map
5465
+ //# sourceMappingURL=chunk-BI6BDZVY.js.map