@nous-excalidraw/excalidraw 0.18.9-beta.6 → 0.18.9-beta.8

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 (66) hide show
  1. package/dist/dev/{chunk-WP6KBWU6.js → chunk-IPSNC7TC.js} +2 -2
  2. package/dist/dev/{chunk-PCEWNDUK.js → chunk-QZCUPUYI.js} +30 -19
  3. package/dist/dev/chunk-QZCUPUYI.js.map +7 -0
  4. package/dist/dev/components/TTDDialog/{CodeMirrorEditor-NHUTC424.js → CodeMirrorEditor-ND32HXUO.js} +2 -2
  5. package/dist/dev/data/{image-IKVBS4ON.js → image-ZYGBTNX7.js} +3 -3
  6. package/dist/dev/index.js +969 -761
  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-5TJ5YDX4.js → chunk-VL5QGQZ3.js} +1 -1
  11. package/dist/prod/chunk-WOEQL7L3.js +4 -0
  12. package/dist/prod/components/TTDDialog/{CodeMirrorEditor-MRRAT5E3.js → CodeMirrorEditor-E6GSWXPI.js} +1 -1
  13. package/dist/prod/data/image-T6FZOTD3.js +1 -0
  14. package/dist/prod/index.js +41 -41
  15. package/dist/prod/subset-shared.chunk.js +1 -1
  16. package/dist/prod/subset-worker.chunk.js +1 -1
  17. package/dist/types/common/src/constants.d.ts +8 -7
  18. package/dist/types/common/src/fontSize.d.ts +9 -4
  19. package/dist/types/common/src/strokeWidth.d.ts +57 -11
  20. package/dist/types/common/src/zoomDisplay.d.ts +3 -0
  21. package/dist/types/element/src/bounds.d.ts +2 -2
  22. package/dist/types/element/src/index.d.ts +1 -0
  23. package/dist/types/element/src/renderElement.d.ts +1 -0
  24. package/dist/types/element/src/selection.d.ts +2 -2
  25. package/dist/types/element/src/shape.d.ts +5 -3
  26. package/dist/types/element/src/strokeWidth.d.ts +11 -0
  27. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +3 -0
  28. package/dist/types/excalidraw/actions/actionBoundText.d.ts +2 -0
  29. package/dist/types/excalidraw/actions/actionCanvas.d.ts +47 -25
  30. package/dist/types/excalidraw/actions/actionClipboard.d.ts +2 -0
  31. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +1 -0
  32. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -1
  33. package/dist/types/excalidraw/actions/actionDeselect.d.ts +2 -1
  34. package/dist/types/excalidraw/actions/actionElementLink.d.ts +1 -0
  35. package/dist/types/excalidraw/actions/actionElementLock.d.ts +2 -0
  36. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +1 -0
  37. package/dist/types/excalidraw/actions/actionExport.d.ts +8 -6
  38. package/dist/types/excalidraw/actions/actionFrame.d.ts +4 -0
  39. package/dist/types/excalidraw/actions/actionGroup.d.ts +4 -2
  40. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +1 -0
  41. package/dist/types/excalidraw/actions/actionLink.d.ts +1 -0
  42. package/dist/types/excalidraw/actions/actionMenu.d.ts +1 -0
  43. package/dist/types/excalidraw/actions/actionProperties.d.ts +2 -0
  44. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +2 -1
  45. package/dist/types/excalidraw/actions/actionStyles.d.ts +1 -0
  46. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +1 -0
  47. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +1 -0
  48. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +1 -0
  49. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +1 -0
  50. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +1 -0
  51. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +1 -0
  52. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +1 -0
  53. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +1 -0
  54. package/dist/types/excalidraw/appState.d.ts +6 -6
  55. package/dist/types/excalidraw/components/App.d.ts +2 -0
  56. package/dist/types/excalidraw/data/blob.d.ts +14 -12
  57. package/dist/types/excalidraw/data/json.d.ts +7 -6
  58. package/dist/types/excalidraw/scene/types.d.ts +3 -0
  59. package/dist/types/excalidraw/types.d.ts +2 -0
  60. package/package.json +4 -4
  61. package/dist/dev/chunk-PCEWNDUK.js.map +0 -7
  62. package/dist/prod/chunk-NJSF2Y4K.js +0 -4
  63. package/dist/prod/data/image-HS3IWLD2.js +0 -1
  64. /package/dist/dev/{chunk-WP6KBWU6.js.map → chunk-IPSNC7TC.js.map} +0 -0
  65. /package/dist/dev/components/TTDDialog/{CodeMirrorEditor-NHUTC424.js.map → CodeMirrorEditor-ND32HXUO.js.map} +0 -0
  66. /package/dist/dev/data/{image-IKVBS4ON.js.map → image-ZYGBTNX7.js.map} +0 -0
@@ -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: "@nous-excalidraw/excalidraw", PKG_VERSION: "0.18.9-beta.5", 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: "@nous-excalidraw/excalidraw", PKG_VERSION: "0.18.9-beta.7", DEV: true };
3
3
 
4
4
  export {
5
5
  define_import_meta_env_default
6
6
  };
7
- //# sourceMappingURL=chunk-WP6KBWU6.js.map
7
+ //# sourceMappingURL=chunk-IPSNC7TC.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  define_import_meta_env_default
3
- } from "./chunk-WP6KBWU6.js";
3
+ } from "./chunk-IPSNC7TC.js";
4
4
  import {
5
5
  __publicField
6
6
  } from "./chunk-XDFCUUT6.js";
@@ -33,10 +33,9 @@ import {
33
33
  THEME,
34
34
  DEFAULT_GRID_STEP,
35
35
  isTestEnv,
36
- FONT_SIZE_SCREEN,
37
- getSceneFontSizeForZoom,
38
- STROKE_WIDTH_SCREEN,
39
- getSceneStrokeWidthForZoom
36
+ getDefaultSceneFontSizeForZoom,
37
+ getDefaultSceneStrokeWidth,
38
+ INITIAL_CANVAS_ZOOM
40
39
  } from "@nous-excalidraw/common";
41
40
  var defaultExportScale = EXPORT_SCALES.includes(devicePixelRatio) ? devicePixelRatio : 1;
42
41
  var getDefaultAppState = () => {
@@ -48,7 +47,7 @@ var getDefaultAppState = () => {
48
47
  currentItemEndArrowhead: "arrow",
49
48
  currentItemFillStyle: DEFAULT_ELEMENT_PROPS.fillStyle,
50
49
  currentItemFontFamily: DEFAULT_FONT_FAMILY,
51
- currentItemFontSize: getSceneFontSizeForZoom(FONT_SIZE_SCREEN.md, 1),
50
+ currentItemFontSize: getDefaultSceneFontSizeForZoom(INITIAL_CANVAS_ZOOM),
52
51
  currentItemOpacity: DEFAULT_ELEMENT_PROPS.opacity,
53
52
  currentItemRoughness: DEFAULT_ELEMENT_PROPS.roughness,
54
53
  currentItemStartArrowhead: null,
@@ -56,10 +55,8 @@ var getDefaultAppState = () => {
56
55
  currentItemRoundness: isTestEnv() ? "sharp" : "round",
57
56
  currentItemArrowType: ARROW_TYPE.round,
58
57
  currentItemStrokeStyle: DEFAULT_ELEMENT_PROPS.strokeStyle,
59
- currentItemStrokeWidth: getSceneStrokeWidthForZoom(
60
- STROKE_WIDTH_SCREEN.thin,
61
- 1
62
- ),
58
+ currentItemStrokeWidth: getDefaultSceneStrokeWidth(INITIAL_CANVAS_ZOOM),
59
+ currentItemStrokeWidthCustom: false,
63
60
  currentItemTextAlign: DEFAULT_TEXT_ALIGN,
64
61
  currentHoveredFontFamily: null,
65
62
  cursorButton: "up",
@@ -131,7 +128,7 @@ var getDefaultAppState = () => {
131
128
  viewBackgroundColor: COLOR_PALETTE.white,
132
129
  zenModeEnabled: false,
133
130
  zoom: {
134
- value: 1
131
+ value: INITIAL_CANVAS_ZOOM
135
132
  },
136
133
  viewModeEnabled: false,
137
134
  showHyperlinkPopup: false,
@@ -178,6 +175,7 @@ var APP_STATE_STORAGE_CONF = /* @__PURE__ */ ((config) => config)({
178
175
  currentItemStrokeColor: { browser: true, export: false, server: false },
179
176
  currentItemStrokeStyle: { browser: true, export: false, server: false },
180
177
  currentItemStrokeWidth: { browser: true, export: false, server: false },
178
+ currentItemStrokeWidthCustom: { browser: false, export: false, server: false },
181
179
  currentItemTextAlign: { browser: true, export: false, server: false },
182
180
  currentHoveredFontFamily: { browser: false, export: false, server: false },
183
181
  cursorButton: { browser: true, export: false, server: false },
@@ -4280,7 +4278,8 @@ var exportToCanvas = async (elements, appState, files, {
4280
4278
  embedsValidationStatus: /* @__PURE__ */ new Map(),
4281
4279
  elementsPendingErasure: /* @__PURE__ */ new Set(),
4282
4280
  pendingFlowchartNodes: null,
4283
- theme: appState.exportWithDarkMode ? THEME5.DARK : THEME5.LIGHT
4281
+ theme: appState.exportWithDarkMode ? THEME5.DARK : THEME5.LIGHT,
4282
+ zoom: defaultAppState.zoom.value
4284
4283
  }
4285
4284
  });
4286
4285
  return canvas;
@@ -4491,7 +4490,9 @@ import {
4491
4490
  arrayToMap as arrayToMap2,
4492
4491
  getSizeFromPoints,
4493
4492
  normalizeLink as normalizeLink2,
4494
- getLineHeight
4493
+ getLineHeight,
4494
+ getDisplaySceneStrokeWidth,
4495
+ isCustomStrokeWidthOverride
4495
4496
  } from "@nous-excalidraw/common";
4496
4497
  import {
4497
4498
  calculateFixedPointForNonElbowArrowBinding,
@@ -4499,7 +4500,8 @@ import {
4499
4500
  normalizeArrowhead,
4500
4501
  isPointInElement,
4501
4502
  isValidPolygon,
4502
- projectFixedPointOntoDiagonal
4503
+ projectFixedPointOntoDiagonal,
4504
+ migrateElementStrokeWidthCustom
4503
4505
  } from "@nous-excalidraw/element";
4504
4506
  import { normalizeFixedPoint } from "@nous-excalidraw/element";
4505
4507
  import {
@@ -4888,6 +4890,7 @@ var restoreElements = (targetElements, existingElements, opts) => {
4888
4890
  migratedElement = null;
4889
4891
  }
4890
4892
  if (migratedElement) {
4893
+ migratedElement = migrateElementStrokeWidthCustom(migratedElement);
4891
4894
  const localElement = existingElementsMap?.get(element.id);
4892
4895
  const shouldMarkAsDeleted = opts?.deleteInvisibleElements && isInvisiblySmallElement(element);
4893
4896
  if (shouldMarkAsDeleted) {
@@ -5028,6 +5031,16 @@ var restoreAppState = (appState, localAppState) => {
5028
5031
  if (boxSelectionMode !== void 0) {
5029
5032
  nextAppState.boxSelectionMode = boxSelectionMode;
5030
5033
  }
5034
+ const zoomValue = getNormalizedZoom(
5035
+ isFiniteNumber(appState.zoom) ? appState.zoom : appState.zoom?.value ?? defaultAppState.zoom.value
5036
+ );
5037
+ if (!nextAppState.currentItemStrokeWidthCustom || !isCustomStrokeWidthOverride(
5038
+ true,
5039
+ nextAppState.currentItemStrokeWidth
5040
+ )) {
5041
+ nextAppState.currentItemStrokeWidthCustom = false;
5042
+ nextAppState.currentItemStrokeWidth = getDisplaySceneStrokeWidth(zoomValue);
5043
+ }
5031
5044
  return {
5032
5045
  ...nextAppState,
5033
5046
  cursorButton: localAppState?.cursorButton || "up",
@@ -5043,9 +5056,7 @@ var restoreAppState = (appState, localAppState) => {
5043
5056
  },
5044
5057
  // Migrates from previous version where appState.zoom was a number
5045
5058
  zoom: {
5046
- value: getNormalizedZoom(
5047
- isFiniteNumber(appState.zoom) ? appState.zoom : appState.zoom?.value ?? defaultAppState.zoom.value
5048
- )
5059
+ value: zoomValue
5049
5060
  },
5050
5061
  openSidebar: (
5051
5062
  // string (legacy)
@@ -5101,7 +5112,7 @@ var parseFileContents = async (blob) => {
5101
5112
  let contents;
5102
5113
  if (blob.type === MIME_TYPES6.png) {
5103
5114
  try {
5104
- return await (await import("./data/image-IKVBS4ON.js")).decodePngMetadata(blob);
5115
+ return await (await import("./data/image-ZYGBTNX7.js")).decodePngMetadata(blob);
5105
5116
  } catch (error) {
5106
5117
  if (error.message === "INVALID") {
5107
5118
  throw new ImageSceneDataError(
@@ -5535,4 +5546,4 @@ export {
5535
5546
  createFile,
5536
5547
  normalizeFile
5537
5548
  };
5538
- //# sourceMappingURL=chunk-PCEWNDUK.js.map
5549
+ //# sourceMappingURL=chunk-QZCUPUYI.js.map