@myoc/excalidraw 0.19.520 → 0.19.521

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 CHANGED
@@ -4926,4 +4926,57 @@ First release of `@excalidraw/excalidraw`## Excalidraw Library
4926
4926
  - Incorrect import for color (was moved to common)
4927
4927
 
4928
4928
  ---
4929
+ ## Excalidraw Library
4930
+
4931
+ **_This section lists the updates made to the excalidraw library and will not affect the integration._**
4932
+
4933
+ ### Features
4934
+
4935
+ - Add ability to turn off compression for files that are smaller than a given size
4936
+
4937
+ - Add lock tool to the dropdown and also add the status of the extra tools to be the same icon as the selected tool
4938
+
4939
+ - Add view mode button
4940
+
4941
+ - Add multiple image copy paste or drag and drop
4942
+
4943
+ - Multiple image additions from clipboard
4944
+
4945
+ - Add arrange elements action
4946
+
4947
+ - Add top picks to appProps for both stoke color and background color
4948
+
4949
+ ### Fixes
4950
+
4951
+ - Issues
4952
+
4953
+ - Make mobile mode more myoc looking
4954
+
4955
+ - Add normalise functionality
4956
+
4957
+ - Update with excalidraw
4958
+
4959
+ - Fix imports
4960
+
4961
+ - Fix mutateGroup to use scene.mutateGroup
4962
+
4963
+ - Imports
4964
+
4965
+ - Ensure that fileId is different for compressed vs uncompressed file
4966
+
4967
+ - Remove not working prop for dontResizeLimitMBs
4968
+
4969
+ - Add smartview for mobile
4970
+
4971
+ - Hide the alignment buttons if there is only one group selected (they do nothing if only one group is selected)
4972
+
4973
+ - Use css vars already provided instead of hard coding directly from oc-gray
4974
+
4975
+ - Remove unused variables
4976
+
4977
+ - Pass the new top pick color props properly
4978
+
4979
+ - Incorrect import for color (was moved to common)
4980
+
4981
+ ---
4929
4982
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  define_import_meta_env_default
3
- } from "./chunk-SJJUXTTF.js";
3
+ } from "./chunk-P7I4FGOG.js";
4
4
  import {
5
5
  __publicField
6
6
  } from "./chunk-XDFCUUT6.js";
@@ -5156,7 +5156,7 @@ var parseFileContents = async (blob) => {
5156
5156
  let contents;
5157
5157
  if (blob.type === MIME_TYPES6.png) {
5158
5158
  try {
5159
- return await (await import("./data/image-X3JCQEUX.js")).decodePngMetadata(blob);
5159
+ return await (await import("./data/image-ZYGVHYLC.js")).decodePngMetadata(blob);
5160
5160
  } catch (error) {
5161
5161
  if (error.message === "INVALID") {
5162
5162
  throw new ImageSceneDataError(
@@ -5518,4 +5518,4 @@ export {
5518
5518
  createFile,
5519
5519
  normalizeFile
5520
5520
  };
5521
- //# sourceMappingURL=chunk-FQHULQ5P.js.map
5521
+ //# sourceMappingURL=chunk-MN6E45MP.js.map
@@ -1,7 +1,7 @@
1
1
  // <define:import.meta.env>
2
- var define_import_meta_env_default = { MODE: "development", VITE_APP_BACKEND_V2_GET_URL: "https://json-dev.excalidraw.com/api/v2/", VITE_APP_BACKEND_V2_POST_URL: "https://json-dev.excalidraw.com/api/v2/post/", VITE_APP_LIBRARY_URL: "https://libraries.excalidraw.com", VITE_APP_LIBRARY_BACKEND: "https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries", VITE_APP_WS_SERVER_URL: "http://localhost:3002", VITE_APP_PLUS_LP: "https://plus.excalidraw.com", VITE_APP_PLUS_APP: "http://localhost:3000", VITE_APP_AI_BACKEND: "http://localhost:3016", VITE_APP_FIREBASE_CONFIG: '{"apiKey":"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8","authDomain":"excalidraw-oss-dev.firebaseapp.com","projectId":"excalidraw-oss-dev","storageBucket":"excalidraw-oss-dev.appspot.com","messagingSenderId":"664559512677","appId":"1:664559512677:web:a385181f2928d328a7aa8c"}', VITE_APP_DEV_DISABLE_LIVE_RELOAD: "", VITE_APP_ENABLE_TRACKING: "true", FAST_REFRESH: "false", VITE_APP_PORT: "3001", VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX: "", VITE_APP_COLLAPSE_OVERLAY: "true", VITE_APP_ENABLE_ESLINT: "true", VITE_APP_ENABLE_PWA: "false", VITE_APP_PLUS_EXPORT_PUBLIC_KEY: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\nHQIDAQAB", VITE_APP_DISABLE_PREVENT_UNLOAD: "", PKG_NAME: "@myoc/excalidraw", PKG_VERSION: "0.19.519", DEV: true };
2
+ var define_import_meta_env_default = { MODE: "development", VITE_APP_BACKEND_V2_GET_URL: "https://json-dev.excalidraw.com/api/v2/", VITE_APP_BACKEND_V2_POST_URL: "https://json-dev.excalidraw.com/api/v2/post/", VITE_APP_LIBRARY_URL: "https://libraries.excalidraw.com", VITE_APP_LIBRARY_BACKEND: "https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries", VITE_APP_WS_SERVER_URL: "http://localhost:3002", VITE_APP_PLUS_LP: "https://plus.excalidraw.com", VITE_APP_PLUS_APP: "http://localhost:3000", VITE_APP_AI_BACKEND: "http://localhost:3016", VITE_APP_FIREBASE_CONFIG: '{"apiKey":"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8","authDomain":"excalidraw-oss-dev.firebaseapp.com","projectId":"excalidraw-oss-dev","storageBucket":"excalidraw-oss-dev.appspot.com","messagingSenderId":"664559512677","appId":"1:664559512677:web:a385181f2928d328a7aa8c"}', VITE_APP_DEV_DISABLE_LIVE_RELOAD: "", VITE_APP_ENABLE_TRACKING: "true", FAST_REFRESH: "false", VITE_APP_PORT: "3001", VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX: "", VITE_APP_COLLAPSE_OVERLAY: "true", VITE_APP_ENABLE_ESLINT: "true", VITE_APP_ENABLE_PWA: "false", VITE_APP_PLUS_EXPORT_PUBLIC_KEY: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\nHQIDAQAB", VITE_APP_DISABLE_PREVENT_UNLOAD: "", PKG_NAME: "@myoc/excalidraw", PKG_VERSION: "0.19.520", DEV: true };
3
3
 
4
4
  export {
5
5
  define_import_meta_env_default
6
6
  };
7
- //# sourceMappingURL=chunk-SJJUXTTF.js.map
7
+ //# sourceMappingURL=chunk-P7I4FGOG.js.map
@@ -2,12 +2,12 @@ import {
2
2
  decodePngMetadata,
3
3
  encodePngMetadata,
4
4
  getTEXtChunk
5
- } from "../chunk-FQHULQ5P.js";
6
- import "../chunk-SJJUXTTF.js";
5
+ } from "../chunk-MN6E45MP.js";
6
+ import "../chunk-P7I4FGOG.js";
7
7
  import "../chunk-XDFCUUT6.js";
8
8
  export {
9
9
  decodePngMetadata,
10
10
  encodePngMetadata,
11
11
  getTEXtChunk
12
12
  };
13
- //# sourceMappingURL=image-X3JCQEUX.js.map
13
+ //# sourceMappingURL=image-ZYGVHYLC.js.map
package/dist/dev/index.js CHANGED
@@ -58,10 +58,10 @@ import {
58
58
  saveAsJSON,
59
59
  serializeAsJSON,
60
60
  strokeRectWithRotation_simple
61
- } from "./chunk-FQHULQ5P.js";
61
+ } from "./chunk-MN6E45MP.js";
62
62
  import {
63
63
  define_import_meta_env_default
64
- } from "./chunk-SJJUXTTF.js";
64
+ } from "./chunk-P7I4FGOG.js";
65
65
  import {
66
66
  en_default
67
67
  } from "./chunk-IU2VFRFU.js";
@@ -9558,6 +9558,133 @@ var getDataTransferFiles = function() {
9558
9558
  (item) => item.kind === "file"
9559
9559
  );
9560
9560
  };
9561
+ var captureDragEventData = (event) => {
9562
+ const dataTransfer = isClipboardEvent(event) ? event.clipboardData : event.dataTransfer;
9563
+ const types = Array.from(dataTransfer?.types ?? []);
9564
+ const dataTypes = Array.from(
9565
+ /* @__PURE__ */ new Set([
9566
+ ...types.filter((type) => type !== "Files"),
9567
+ MIME_TYPES2.text,
9568
+ MIME_TYPES2.html,
9569
+ "text/uri-list",
9570
+ "public.url",
9571
+ "public.plain-text",
9572
+ "text/x-moz-url"
9573
+ ])
9574
+ );
9575
+ const data = {};
9576
+ for (const type of dataTypes) {
9577
+ try {
9578
+ const value = dataTransfer?.getData(type);
9579
+ if (value) {
9580
+ data[type] = value;
9581
+ }
9582
+ } catch {
9583
+ }
9584
+ }
9585
+ return {
9586
+ items: Array.from(dataTransfer?.items ?? []).map((item) => ({
9587
+ kind: item.kind,
9588
+ type: item.type
9589
+ })),
9590
+ files: Array.from(dataTransfer?.files ?? []).map((file2) => ({
9591
+ name: file2.name,
9592
+ type: file2.type,
9593
+ size: file2.size,
9594
+ lastModified: file2.lastModified
9595
+ })),
9596
+ types,
9597
+ data
9598
+ };
9599
+ };
9600
+ var getParsedRawDragItems = (dataTransferList) => dataTransferList.map((item) => {
9601
+ if (item.kind === "string") {
9602
+ return {
9603
+ kind: item.kind,
9604
+ type: item.type,
9605
+ value: item.value
9606
+ };
9607
+ }
9608
+ return {
9609
+ kind: item.kind,
9610
+ type: item.type,
9611
+ file: {
9612
+ name: item.file.name,
9613
+ type: item.file.type,
9614
+ size: item.file.size,
9615
+ lastModified: item.file.lastModified
9616
+ }
9617
+ };
9618
+ });
9619
+ var parseDragImageMetadata = (dataTransferList, imageCount, dragDataSnapshot) => {
9620
+ const htmlImageSources = [];
9621
+ const textImageSources = [];
9622
+ const imageAlts = [];
9623
+ const pushUnique = (values, value) => {
9624
+ const trimmedValue = value?.trim();
9625
+ if (trimmedValue && !values.includes(trimmedValue)) {
9626
+ values.push(trimmedValue);
9627
+ }
9628
+ };
9629
+ const pushUriList = (values, value) => {
9630
+ value.split(/\r?\n/).map((line) => line.trim()).filter((line) => line && !line.startsWith("#")).forEach((line) => pushUnique(values, line));
9631
+ };
9632
+ dataTransferList.forEach((item) => {
9633
+ if (item.kind !== "string") {
9634
+ return;
9635
+ }
9636
+ if (item.type === MIME_TYPES2.html) {
9637
+ try {
9638
+ const doc = new DOMParser().parseFromString(item.value, MIME_TYPES2.html);
9639
+ for (const img of Array.from(doc.body.querySelectorAll("img"))) {
9640
+ pushUnique(htmlImageSources, img.getAttribute("src"));
9641
+ pushUnique(imageAlts, img.getAttribute("alt"));
9642
+ }
9643
+ } catch {
9644
+ }
9645
+ } else if (item.type === MIME_TYPES2.text) {
9646
+ pushUnique(textImageSources, item.value);
9647
+ } else if (item.type === "text/uri-list") {
9648
+ pushUriList(textImageSources, item.value);
9649
+ }
9650
+ });
9651
+ const imageSources = [
9652
+ ...htmlImageSources,
9653
+ ...textImageSources.filter((src) => !htmlImageSources.includes(src))
9654
+ ];
9655
+ const imageDetails = Array.from(
9656
+ { length: imageCount },
9657
+ () => ({})
9658
+ );
9659
+ const rawDragData = {
9660
+ ...dragDataSnapshot ?? {
9661
+ items: [],
9662
+ files: [],
9663
+ types: [],
9664
+ data: {}
9665
+ },
9666
+ parsedItems: getParsedRawDragItems(dataTransferList)
9667
+ };
9668
+ imageDetails.forEach((detail, index) => {
9669
+ const source = imageSources[index];
9670
+ const alt = imageAlts[index];
9671
+ if (source) {
9672
+ detail.src = source;
9673
+ }
9674
+ if (alt) {
9675
+ detail.alt = alt;
9676
+ }
9677
+ detail.rawDragData = rawDragData;
9678
+ });
9679
+ const additionalUrls = imageSources.slice(imageDetails.length);
9680
+ const firstImageDetails = imageDetails[0];
9681
+ if (firstImageDetails && additionalUrls.length > 0) {
9682
+ additionalUrls.forEach((url, index) => {
9683
+ firstImageDetails[`additionalUrl${index + 1}`] = url;
9684
+ });
9685
+ }
9686
+ return imageDetails;
9687
+ };
9561
9688
  var parseDataTransferEventMimeTypes = (event) => {
9562
9689
  let items = void 0;
9563
9690
  if (isClipboardEvent(event)) {
@@ -9823,7 +9950,7 @@ var exportCanvas = async (type, elements, appState, files, {
9823
9950
  let blob = canvasToBlob(tempCanvas);
9824
9951
  if (appState.exportEmbedScene) {
9825
9952
  blob = blob.then(
9826
- (blob2) => import("./data/image-X3JCQEUX.js").then(
9953
+ (blob2) => import("./data/image-ZYGVHYLC.js").then(
9827
9954
  ({ encodePngMetadata: encodePngMetadata2 }) => encodePngMetadata2({
9828
9955
  blob: blob2,
9829
9956
  metadata: serializeAsJSON(elements, appState, files, "local")
@@ -37170,6 +37297,7 @@ var App = class _App extends React40.Component {
37170
37297
  });
37171
37298
  });
37172
37299
  __publicField(this, "handleAppOnDrop", async (event) => {
37300
+ const dragDataSnapshot = captureDragEventData(event);
37173
37301
  const { x: sceneX, y: sceneY } = viewportCoordsToSceneCoords3(
37174
37302
  event,
37175
37303
  this.state
@@ -37206,65 +37334,14 @@ var App = class _App extends React40.Component {
37206
37334
  const imageFiles = fileItems.map((data) => data.file).filter((file2) => isSupportedImageFile(file2));
37207
37335
  if (imageFiles.length > 0) {
37208
37336
  if (this.isToolSupported("image")) {
37209
- const parseDroppedImageDetails = () => {
37210
- const htmlImageSources = [];
37211
- const textImageSources = [];
37212
- const imageAlts = [];
37213
- const pushUnique = (values, value) => {
37214
- const trimmedValue = value?.trim();
37215
- if (trimmedValue && !values.includes(trimmedValue)) {
37216
- values.push(trimmedValue);
37217
- }
37218
- };
37219
- dataTransferList.forEach((item) => {
37220
- if (item.kind !== "string") {
37221
- return;
37222
- }
37223
- if (item.type === MIME_TYPES8.html) {
37224
- try {
37225
- const doc = new DOMParser().parseFromString(
37226
- item.value,
37227
- MIME_TYPES8.html
37228
- );
37229
- for (const img of Array.from(
37230
- doc.body.querySelectorAll("img")
37231
- )) {
37232
- pushUnique(htmlImageSources, img.getAttribute("src"));
37233
- pushUnique(imageAlts, img.getAttribute("alt"));
37234
- }
37235
- } catch {
37236
- }
37237
- } else if (item.type === MIME_TYPES8.text) {
37238
- pushUnique(textImageSources, item.value);
37239
- }
37240
- });
37241
- const imageSources = [
37242
- ...htmlImageSources,
37243
- ...textImageSources.filter(
37244
- (src) => !htmlImageSources.includes(src)
37245
- )
37246
- ];
37247
- const imageDetails = imageFiles.map(() => ({}));
37248
- imageDetails.forEach((detail, index) => {
37249
- const source = imageSources[index];
37250
- const alt = imageAlts[index];
37251
- if (source) {
37252
- detail.src = source;
37253
- }
37254
- if (alt) {
37255
- detail.alt = alt;
37256
- }
37257
- });
37258
- const additionalUrls = imageSources.slice(imageDetails.length);
37259
- const firstImageDetails = imageDetails[0];
37260
- if (firstImageDetails && additionalUrls.length > 0) {
37261
- additionalUrls.forEach((url, index) => {
37262
- firstImageDetails[`additionalUrl${index + 1}`] = url;
37263
- });
37264
- }
37265
- return imageDetails;
37266
- };
37267
- const droppedImageDetails = parseDroppedImageDetails();
37337
+ const droppedImageDetails = parseDragImageMetadata(
37338
+ dataTransferList,
37339
+ imageFiles.length,
37340
+ dragDataSnapshot
37341
+ );
37342
+ if (this.props.showDropEventDebugAlert) {
37343
+ alert(`${JSON.stringify(droppedImageDetails)}`);
37344
+ }
37268
37345
  return this.insertImages(
37269
37346
  imageFiles.map((file2, index) => ({
37270
37347
  file: file2,
@@ -42230,7 +42307,8 @@ var ExcalidrawBase = (props) => {
42230
42307
  strokeColorTopPicks,
42231
42308
  backgroundColorTopPicks,
42232
42309
  renderScrollbars,
42233
- imageOptions
42310
+ imageOptions,
42311
+ showDropEventDebugAlert
42234
42312
  } = props;
42235
42313
  const canvasActions = props.UIOptions?.canvasActions;
42236
42314
  const UIOptions = {
@@ -42329,6 +42407,7 @@ var ExcalidrawBase = (props) => {
42329
42407
  backgroundColorTopPicks,
42330
42408
  renderScrollbars,
42331
42409
  imageOptions: normalizedImageOptions,
42410
+ showDropEventDebugAlert,
42332
42411
  children
42333
42412
  }
42334
42413
  ) }) });
@@ -42403,6 +42482,7 @@ export {
42403
42482
  WelcomeScreen_default as WelcomeScreen,
42404
42483
  applyDarkModeFilter5 as applyDarkModeFilter,
42405
42484
  bumpVersion3 as bumpVersion,
42485
+ captureDragEventData,
42406
42486
  convertToExcalidrawElements2 as convertToExcalidrawElements,
42407
42487
  defaultLang,
42408
42488
  elementsOverlappingBBox3 as elementsOverlappingBBox,
@@ -42429,6 +42509,8 @@ export {
42429
42509
  mutateElement7 as mutateElement,
42430
42510
  newElementWith11 as newElementWith,
42431
42511
  normalizeLink4 as normalizeLink,
42512
+ parseDataTransferEvent,
42513
+ parseDragImageMetadata,
42432
42514
  reconcileElements,
42433
42515
  renderSpreadsheet,
42434
42516
  restoreAppState,