@excalidraw/common 0.18.0-143b5b6 → 0.18.0-1440f2d
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 +28 -18
- package/dist/dev/index.js.map +3 -3
- package/dist/prod/index.js +3 -3
- package/dist/types/common/src/constants.d.ts +1 -0
- package/dist/types/common/src/utils.d.ts +7 -1
- package/dist/types/element/src/align.d.ts +4 -1
- package/dist/types/element/src/binding.d.ts +62 -0
- package/dist/types/element/src/bounds.d.ts +10 -2
- package/dist/types/element/src/collision.d.ts +7 -0
- package/dist/types/element/src/cropElement.d.ts +36 -4
- package/dist/types/element/src/delta.d.ts +7 -1
- package/dist/types/element/src/distribute.d.ts +4 -1
- package/dist/types/element/src/dragElements.d.ts +8 -3
- package/dist/types/element/src/elbowArrow.d.ts +5 -0
- package/dist/types/element/src/embeddable.d.ts +2 -1
- package/dist/types/element/src/flowchart.d.ts +1 -7
- package/dist/types/element/src/frame.d.ts +19 -1
- package/dist/types/element/src/groups.d.ts +1 -6
- package/dist/types/element/src/image.d.ts +5 -2
- package/dist/types/element/src/index.d.ts +1 -0
- package/dist/types/element/src/linearElementEditor.d.ts +4 -1
- package/dist/types/element/src/listMarker.d.ts +7 -2
- package/dist/types/element/src/newElement.d.ts +3 -1
- package/dist/types/element/src/renderElement.d.ts +10 -0
- package/dist/types/element/src/renderEnvironment.d.ts +66 -0
- package/dist/types/element/src/resizeElements.d.ts +15 -5
- package/dist/types/element/src/selection.d.ts +1 -7
- package/dist/types/element/src/shape.d.ts +2 -0
- package/dist/types/element/src/stickyNote.d.ts +8 -0
- package/dist/types/element/src/textElement.d.ts +3 -2
- package/dist/types/element/src/textMeasurements.d.ts +15 -11
- package/dist/types/element/src/textWrapping.d.ts +3 -2
- package/dist/types/element/src/transform.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +3 -0
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +47 -221
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +9 -5
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +2 -0
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -588
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +2 -0
- package/dist/types/excalidraw/actions/actionExport.d.ts +4 -2
- package/dist/types/excalidraw/actions/actionFrame.d.ts +44 -525
- package/dist/types/excalidraw/actions/actionGroup.d.ts +2 -0
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionLink.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionMenu.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionProperties.d.ts +2 -0
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionStyles.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleMinimap.d.ts +201 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +1 -0
- package/dist/types/excalidraw/actions/index.d.ts +2 -0
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/appState.d.ts +3 -2
- package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -1
- package/dist/types/excalidraw/charts/charts.helpers.d.ts +6 -5
- package/dist/types/excalidraw/charts/charts.line.d.ts +2 -1
- package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -1
- package/dist/types/excalidraw/charts/index.d.ts +2 -1
- package/dist/types/excalidraw/components/Actions.d.ts +9 -2
- package/dist/types/excalidraw/components/App.d.ts +23 -8
- package/dist/types/excalidraw/components/App.host.d.ts +102 -0
- package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
- package/dist/types/excalidraw/components/App.selectionTool.d.ts +42 -6
- package/dist/types/excalidraw/components/App.viewport.d.ts +23 -3
- package/dist/types/excalidraw/components/App.wheel.d.ts +6 -2
- package/dist/types/excalidraw/components/App.wrap.d.ts +31 -0
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -1
- package/dist/types/excalidraw/components/Minimap/Minimap.d.ts +15 -0
- package/dist/types/excalidraw/components/Minimap/MinimapAnnouncementDot.d.ts +10 -0
- package/dist/types/excalidraw/components/Minimap/minimap-controller.chunk.d.ts +90 -0
- package/dist/types/excalidraw/components/Minimap/minimap-shared.chunk.d.ts +122 -0
- package/dist/types/excalidraw/components/Minimap/minimap-worker.chunk.d.ts +12 -0
- package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -2
- package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +5 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +5 -2
- package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/common.d.ts +4 -1
- package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +3 -2
- package/dist/types/excalidraw/components/TTDDialog/types.d.ts +14 -1
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +16 -0
- package/dist/types/excalidraw/components/Tooltip.d.ts +11 -1
- package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +1 -1
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +0 -1
- package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +13 -2
- package/dist/types/excalidraw/components/icons.d.ts +1 -0
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +1 -0
- package/dist/types/excalidraw/data/blob.d.ts +6 -4
- package/dist/types/excalidraw/data/index.d.ts +3 -3
- package/dist/types/excalidraw/data/json.d.ts +3 -2
- package/dist/types/excalidraw/fonts/Fonts.d.ts +9 -6
- package/dist/types/excalidraw/history.d.ts +10 -4
- package/dist/types/excalidraw/mermaid.d.ts +7 -0
- package/dist/types/excalidraw/reactUtils.d.ts +1 -1
- package/dist/types/excalidraw/renderer/animation.d.ts +11 -4
- package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -6
- package/dist/types/excalidraw/scene/Renderer.d.ts +1 -1
- package/dist/types/excalidraw/scene/export.d.ts +343 -20
- package/dist/types/excalidraw/scene/types.d.ts +23 -1
- package/dist/types/excalidraw/types.d.ts +48 -1
- package/dist/types/excalidraw/viewport.d.ts +1 -0
- package/dist/types/utils/src/index.d.ts +3 -1
- package/package.json +1 -1
- package/dist/types/utils/src/export.d.ts +0 -36
package/dist/dev/index.js
CHANGED
|
@@ -2049,7 +2049,9 @@ var EDITOR_LS_KEYS = {
|
|
|
2049
2049
|
OAI_API_KEY: "excalidraw-oai-api-key",
|
|
2050
2050
|
// legacy naming (non)scheme
|
|
2051
2051
|
MERMAID_TO_EXCALIDRAW: "mermaid-to-excalidraw",
|
|
2052
|
-
PUBLISH_LIBRARY: "publish-library-data"
|
|
2052
|
+
PUBLISH_LIBRARY: "publish-library-data",
|
|
2053
|
+
// TEMPORARY (see MinimapAnnouncementDot)
|
|
2054
|
+
MINIMAP_ANNOUNCEMENT_DISMISSED: "excalidraw-minimap-announcement-dismissed"
|
|
2053
2055
|
};
|
|
2054
2056
|
var DEFAULT_FILENAME = "Untitled";
|
|
2055
2057
|
var STATS_PANELS = { generalStats: 1, elementProperties: 2 };
|
|
@@ -2242,15 +2244,18 @@ var MQ_MIN_TABLET = MQ_MAX_MOBILE + 1;
|
|
|
2242
2244
|
var MQ_MAX_TABLET = 1180;
|
|
2243
2245
|
var MQ_MIN_WIDTH_DESKTOP = 1440;
|
|
2244
2246
|
var MQ_RIGHT_SIDEBAR_MIN_WIDTH = 1229;
|
|
2245
|
-
var
|
|
2246
|
-
var
|
|
2247
|
-
var
|
|
2248
|
-
var
|
|
2249
|
-
var
|
|
2250
|
-
var
|
|
2251
|
-
var
|
|
2252
|
-
|
|
2253
|
-
var
|
|
2247
|
+
var ua = typeof navigator === "undefined" ? void 0 : navigator;
|
|
2248
|
+
var uaPlatform = ua?.platform ?? "";
|
|
2249
|
+
var uaString = ua?.userAgent ?? "";
|
|
2250
|
+
var isDarwin = /Mac|iPod|iPhone|iPad/.test(uaPlatform);
|
|
2251
|
+
var isWindows = /^Win/.test(uaPlatform);
|
|
2252
|
+
var isAndroid = /\b(android)\b/i.test(uaString);
|
|
2253
|
+
var isFirefox = typeof window !== "undefined" && "netscape" in window && uaString.indexOf("rv:") > 1 && uaString.indexOf("Gecko") > 1;
|
|
2254
|
+
var isChrome = uaString.indexOf("Chrome") !== -1;
|
|
2255
|
+
var isSafari = !isChrome && uaString.indexOf("Safari") !== -1;
|
|
2256
|
+
var isIOS = /iPad|iPhone/i.test(uaPlatform) || // iPadOS 13+
|
|
2257
|
+
uaString.includes("Mac") && typeof document !== "undefined" && "ontouchend" in document;
|
|
2258
|
+
var isBrave = () => ua?.brave?.isBrave?.name === "isBrave";
|
|
2254
2259
|
var isMobileBreakpoint = (width, height) => {
|
|
2255
2260
|
return width <= MQ_MAX_MOBILE || height < MQ_MAX_HEIGHT_LANDSCAPE && width < MQ_MAX_WIDTH_LANDSCAPE;
|
|
2256
2261
|
};
|
|
@@ -2260,7 +2265,7 @@ var isTabletBreakpoint = (editorWidth, editorHeight) => {
|
|
|
2260
2265
|
return minSide >= MQ_MIN_TABLET && maxSide <= MQ_MAX_TABLET;
|
|
2261
2266
|
};
|
|
2262
2267
|
var isMobileOrTablet = () => {
|
|
2263
|
-
const
|
|
2268
|
+
const ua2 = navigator.userAgent || "";
|
|
2264
2269
|
const platform = navigator.platform || "";
|
|
2265
2270
|
const uaData = navigator.userAgentData;
|
|
2266
2271
|
if (uaData) {
|
|
@@ -2281,14 +2286,14 @@ var isMobileOrTablet = () => {
|
|
|
2281
2286
|
return true;
|
|
2282
2287
|
}
|
|
2283
2288
|
if (isAndroid) {
|
|
2284
|
-
const isAndroidPhone = /Mobile/i.test(
|
|
2289
|
+
const isAndroidPhone = /Mobile/i.test(ua2);
|
|
2285
2290
|
const isAndroidTablet = !isAndroidPhone;
|
|
2286
2291
|
if (isAndroidPhone || isAndroidTablet) {
|
|
2287
2292
|
const looksTouchTablet = matchMedia?.("(hover: none)").matches && matchMedia?.("(pointer: coarse)").matches;
|
|
2288
2293
|
return looksTouchTablet;
|
|
2289
2294
|
}
|
|
2290
2295
|
}
|
|
2291
|
-
const looksDesktopPlatform = /Win|Linux|CrOS|Mac/.test(platform) || /Windows NT|X11|CrOS|Macintosh/.test(
|
|
2296
|
+
const looksDesktopPlatform = /Win|Linux|CrOS|Mac/.test(platform) || /Windows NT|X11|CrOS|Macintosh/.test(ua2);
|
|
2292
2297
|
if (looksDesktopPlatform) {
|
|
2293
2298
|
return false;
|
|
2294
2299
|
}
|
|
@@ -2599,7 +2604,10 @@ var getDateTime = () => {
|
|
|
2599
2604
|
return `${year}-${month}-${day}-${hr}${min}`;
|
|
2600
2605
|
};
|
|
2601
2606
|
var capitalizeString = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
2602
|
-
var getTargetWindow = (target) =>
|
|
2607
|
+
var getTargetWindow = (target) => {
|
|
2608
|
+
const owner = target;
|
|
2609
|
+
return owner?.ownerDocument?.defaultView ?? owner?.defaultView ?? (typeof window === "undefined" ? null : window);
|
|
2610
|
+
};
|
|
2603
2611
|
var isToolIcon = (target) => {
|
|
2604
2612
|
const targetWindow = getTargetWindow(target);
|
|
2605
2613
|
return !!targetWindow && target instanceof targetWindow.HTMLElement && target.className.includes("ToolIcon");
|
|
@@ -2662,11 +2670,12 @@ var debounce = (fn, timeout) => {
|
|
|
2662
2670
|
};
|
|
2663
2671
|
return ret;
|
|
2664
2672
|
};
|
|
2665
|
-
var throttleRAF = (fn) => {
|
|
2673
|
+
var throttleRAF = (fn, ownerWindow) => {
|
|
2666
2674
|
let timerId = null;
|
|
2667
2675
|
let lastArgs = null;
|
|
2676
|
+
const getOwnerWindow = () => ownerWindow ?? window;
|
|
2668
2677
|
const scheduleFunc = () => {
|
|
2669
|
-
timerId =
|
|
2678
|
+
timerId = getOwnerWindow().requestAnimationFrame(() => {
|
|
2670
2679
|
timerId = null;
|
|
2671
2680
|
const args = lastArgs;
|
|
2672
2681
|
lastArgs = null;
|
|
@@ -2683,7 +2692,7 @@ var throttleRAF = (fn) => {
|
|
|
2683
2692
|
};
|
|
2684
2693
|
ret.flush = () => {
|
|
2685
2694
|
if (timerId !== null) {
|
|
2686
|
-
cancelAnimationFrame(timerId);
|
|
2695
|
+
getOwnerWindow().cancelAnimationFrame(timerId);
|
|
2687
2696
|
timerId = null;
|
|
2688
2697
|
}
|
|
2689
2698
|
if (lastArgs) {
|
|
@@ -2694,7 +2703,7 @@ var throttleRAF = (fn) => {
|
|
|
2694
2703
|
ret.cancel = () => {
|
|
2695
2704
|
lastArgs = null;
|
|
2696
2705
|
if (timerId !== null) {
|
|
2697
|
-
cancelAnimationFrame(timerId);
|
|
2706
|
+
getOwnerWindow().cancelAnimationFrame(timerId);
|
|
2698
2707
|
timerId = null;
|
|
2699
2708
|
}
|
|
2700
2709
|
};
|
|
@@ -3811,6 +3820,7 @@ export {
|
|
|
3811
3820
|
getSizeFromPoints,
|
|
3812
3821
|
getStrokeWidthByKey,
|
|
3813
3822
|
getSvgPathFromStroke,
|
|
3823
|
+
getTargetWindow,
|
|
3814
3824
|
getUpdatedTimestamp,
|
|
3815
3825
|
getVersion,
|
|
3816
3826
|
getVerticalOffset,
|