@dwelle/excalidraw 0.3.4
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 +680 -0
- package/README.md +927 -0
- package/dist/excalidraw-assets/Cascadia.woff2 +0 -0
- package/dist/excalidraw-assets/Virgil.woff2 +0 -0
- package/dist/excalidraw-assets/image-02a1f3ecd6baf42daaa6.js +1 -0
- package/dist/excalidraw-assets/image-eafab0c39ce13f7fea67.js +1 -0
- package/dist/excalidraw-assets/vendor-448ccb79e58765b61834.js +2 -0
- package/dist/excalidraw-assets/vendor-448ccb79e58765b61834.js.LICENSE.txt +1 -0
- package/dist/excalidraw-assets/vendor-cb708a4580b007d81177.js +2 -0
- package/dist/excalidraw-assets/vendor-cb708a4580b007d81177.js.LICENSE.txt +1 -0
- package/dist/excalidraw-assets-dev/Cascadia.woff2 +0 -0
- package/dist/excalidraw-assets-dev/Virgil.woff2 +0 -0
- package/dist/excalidraw-assets-dev/image-cacb3d0c02eb2e346ecc.js +33 -0
- package/dist/excalidraw-assets-dev/vendor-0454f90696ac835aeb45.js +356 -0
- package/dist/excalidraw-assets-dev/vendor-7664c12c379862ed98a5.js +356 -0
- package/dist/excalidraw.development.js +2924 -0
- package/dist/excalidraw.production.min.js +2 -0
- package/dist/excalidraw.production.min.js.LICENSE.txt +1 -0
- package/main.js +8 -0
- package/package.json +72 -0
- package/types/actions/actionAddToLibrary.d.ts +1 -0
- package/types/actions/actionAlign.d.ts +6 -0
- package/types/actions/actionCanvas.d.ts +8 -0
- package/types/actions/actionClipboard.d.ts +4 -0
- package/types/actions/actionDeleteSelected.d.ts +1 -0
- package/types/actions/actionDistribute.d.ts +2 -0
- package/types/actions/actionDuplicateSelection.d.ts +1 -0
- package/types/actions/actionExport.d.ts +9 -0
- package/types/actions/actionFinalize.d.ts +1 -0
- package/types/actions/actionFlip.d.ts +2 -0
- package/types/actions/actionGroup.d.ts +2 -0
- package/types/actions/actionHistory.d.ts +6 -0
- package/types/actions/actionMenu.d.ts +4 -0
- package/types/actions/actionNavigate.d.ts +1 -0
- package/types/actions/actionProperties.d.ts +12 -0
- package/types/actions/actionSelectAll.d.ts +1 -0
- package/types/actions/actionStyles.d.ts +3 -0
- package/types/actions/actionToggleGridMode.d.ts +1 -0
- package/types/actions/actionToggleStats.d.ts +1 -0
- package/types/actions/actionToggleViewMode.d.ts +1 -0
- package/types/actions/actionToggleZenMode.d.ts +1 -0
- package/types/actions/actionZindex.d.ts +4 -0
- package/types/actions/index.d.ts +20 -0
- package/types/actions/manager.d.ts +28 -0
- package/types/actions/register.d.ts +3 -0
- package/types/actions/shortcuts.d.ts +2 -0
- package/types/actions/types.d.ts +49 -0
- package/types/align.d.ts +7 -0
- package/types/analytics.d.ts +1 -0
- package/types/appState.d.ts +59 -0
- package/types/charts.d.ts +19 -0
- package/types/clients.d.ts +6 -0
- package/types/clipboard.d.ts +19 -0
- package/types/colors.d.ts +6 -0
- package/types/components/Actions.d.ts +19 -0
- package/types/components/ActiveFile.d.ts +8 -0
- package/types/components/App.d.ts +154 -0
- package/types/components/Avatar.d.ts +10 -0
- package/types/components/BackgroundPickerAndDarkModeToggle.d.ts +9 -0
- package/types/components/ButtonIconSelect.d.ts +11 -0
- package/types/components/Card.d.ts +6 -0
- package/types/components/CheckboxItem.d.ts +6 -0
- package/types/components/CollabButton.d.ts +8 -0
- package/types/components/ColorPicker.d.ts +10 -0
- package/types/components/ContextMenu.d.ts +25 -0
- package/types/components/DarkModeToggle.d.ts +8 -0
- package/types/components/Dialog.d.ts +12 -0
- package/types/components/ErrorDialog.d.ts +5 -0
- package/types/components/FixedSideContainer.d.ts +9 -0
- package/types/components/HelpDialog.d.ts +5 -0
- package/types/components/HelpIcon.d.ts +9 -0
- package/types/components/HintViewer.d.ts +10 -0
- package/types/components/IconPicker.d.ts +14 -0
- package/types/components/ImageExportDialog.d.ts +16 -0
- package/types/components/InitializeApp.d.ts +16 -0
- package/types/components/Island.d.ts +10 -0
- package/types/components/JSONExportDialog.d.ts +13 -0
- package/types/components/LayerUI.d.ts +34 -0
- package/types/components/LibraryButton.d.ts +6 -0
- package/types/components/LibraryUnit.d.ts +9 -0
- package/types/components/LoadingMessage.d.ts +2 -0
- package/types/components/LockButton.d.ts +11 -0
- package/types/components/MobileMenu.d.ts +24 -0
- package/types/components/Modal.d.ts +11 -0
- package/types/components/PasteChartDialog.d.ts +9 -0
- package/types/components/Popover.d.ts +11 -0
- package/types/components/ProjectName.d.ts +11 -0
- package/types/components/Section.d.ts +7 -0
- package/types/components/Stack.d.ts +15 -0
- package/types/components/Stats.d.ts +11 -0
- package/types/components/Toast.d.ts +6 -0
- package/types/components/ToolButton.d.ts +35 -0
- package/types/components/Tooltip.d.ts +9 -0
- package/types/components/UserList.d.ts +13 -0
- package/types/components/icons.d.ts +163 -0
- package/types/constants.d.ts +115 -0
- package/types/data/blob.d.ts +11 -0
- package/types/data/encode.d.ts +25 -0
- package/types/data/image.d.ts +15 -0
- package/types/data/index.d.ts +13 -0
- package/types/data/json.d.ts +17 -0
- package/types/data/library.d.ts +14 -0
- package/types/data/resave.d.ts +5 -0
- package/types/data/restore.d.ts +13 -0
- package/types/data/types.d.ts +27 -0
- package/types/disitrubte.d.ts +7 -0
- package/types/element/binding.d.ts +33 -0
- package/types/element/bounds.d.ts +16 -0
- package/types/element/collision.d.ts +19 -0
- package/types/element/dragElements.d.ts +7 -0
- package/types/element/index.d.ts +22 -0
- package/types/element/linearElementEditor.d.ts +62 -0
- package/types/element/mutateElement.d.ts +11 -0
- package/types/element/newElement.d.ts +45 -0
- package/types/element/resizeElements.d.ts +9 -0
- package/types/element/resizeTest.d.ts +13 -0
- package/types/element/showSelectedShapeActions.d.ts +3 -0
- package/types/element/sizeHelpers.d.ts +16 -0
- package/types/element/textElement.d.ts +2 -0
- package/types/element/textWysiwyg.d.ts +15 -0
- package/types/element/transformHandles.d.ts +28 -0
- package/types/element/typeChecks.d.ts +11 -0
- package/types/element/types.d.ts +106 -0
- package/types/errors.d.ts +5 -0
- package/types/ga.d.ts +63 -0
- package/types/gadirections.d.ts +8 -0
- package/types/galines.d.ts +22 -0
- package/types/gapoints.d.ts +7 -0
- package/types/gatransforms.d.ts +10 -0
- package/types/gesture.d.ts +6 -0
- package/types/groups.d.ts +26 -0
- package/types/history.d.ts +52 -0
- package/types/hooks/useCallbackRefState.d.ts +1 -0
- package/types/i18n.d.ts +15 -0
- package/types/keys.d.ts +61 -0
- package/types/math.d.ts +20 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ar-SA-json-9a3fdf94110439c2826a.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ar-SA-json-efd63375f9605b72c4af.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-bg-BG-json-047db6df7a74c0298938.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-bg-BG-json-35c0e8b92b0dba8a4e6d.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ca-ES-json-6acefe26cfe1d2f12349.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ca-ES-json-9924fbd53652d5f15134.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-cs-CZ-json-85a469d813bb069829e7.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-de-DE-json-a52c17c4bd1b1db22464.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-de-DE-json-f85a8a52534c04c3f3b8.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-el-GR-json-060595a09e0004e33936.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-el-GR-json-3b209ec86ca2ce69bdfa.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-es-ES-json-32dc3bf0f789ef18e65d.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-es-ES-json-af5c541f9ac1526a9eb7.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-fa-IR-json-7ee232d4ef08da0903f6.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-fa-IR-json-c732ff7772327332c259.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-fi-FI-json-46abeda8d809d4091924.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-fi-FI-json-c1d5c5510660a11a428e.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-fr-FR-json-6a418571305eecefe9bc.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-fr-FR-json-79fa555bfea0a356f393.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-he-IL-json-157ae036fcf470528687.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-he-IL-json-d006423b531ab062bb85.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-hi-IN-json-3035c3b3ab3ce981dbc7.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-hi-IN-json-d959b869453c591a8861.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-hu-HU-json-50a13e322a60bb701615.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-hu-HU-json-a366989217753fe3d02b.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-id-ID-json-87212daac6113b5bf808.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-id-ID-json-8d13d29ee41be15a1f99.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-it-IT-json-59f2e9d3dac07f3264cb.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-it-IT-json-90283cd2809f4165506b.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ja-JP-json-9e0a78ddb43d5709fb29.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ja-JP-json-ccb5ffd0f8a0980c2ec0.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-kab-KAB-json-d9acc7b8ee952e356d06.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-kab-KAB-json-dac787e0446cdb747fe1.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ko-KR-json-d61af373bea59d1ff4c6.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ko-KR-json-e42ededaa35032a201b9.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-lv-LV-json-07f6bffcb44fdd9aad4f.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-lv-LV-json-7eea5c4054f8418fdd10.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-my-MM-json-26d1e27bab3b8ac4a3e6.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-my-MM-json-a8f9bb37a7b947e9dfba.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-nb-NO-json-8ce0749d46f0b4a8defb.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-nb-NO-json-c01fab8602e1b658d5d1.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-nl-NL-json-23fdfd9f11bc8efbaf56.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-nl-NL-json-cf922daa828029c1aff5.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-nn-NO-json-b5931de6e1ed336bf087.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-nn-NO-json-d363be6b3dcdbf3a868a.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-oc-FR-json-29d6193adb907d4f5890.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-oc-FR-json-c6414107ad634b113aba.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-pa-IN-json-27063e4865142ac11b1a.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-pa-IN-json-f0c779291da384fb5173.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-pl-PL-json-16af1b83ac16af57ad07.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-pl-PL-json-a4a5c6e0a9877c43476a.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-pt-BR-json-03a046855063512eb9ff.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-pt-BR-json-db86828d6e3ced9f9854.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-pt-PT-json-7ed352e9de6dc74ef503.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-pt-PT-json-bc0cd589bd87a3079407.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ro-RO-json-75692b7a0166d6ad27a4.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ro-RO-json-f13a2e7b7a63fbfb6ae7.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ru-RU-json-69b1a919b7f42adfd6ec.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ru-RU-json-7c2a2061d0ca99cf7007.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-sk-SK-json-0ef09f90308059d22ae8.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-sk-SK-json-4757551ceb15fa0a29a9.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-sv-SE-json-dc7718d79b9bf93a4ba4.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-sv-SE-json-fa5bd09f128972b13ac2.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-tr-TR-json-b574833ee1c2f58fd24e.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-tr-TR-json-cba7e62d9610795a5ac3.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-uk-UA-json-a9a8ea7adb95c0a03680.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-uk-UA-json-f0cab296bdc4089ffa77.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-zh-CN-json-45da9983459601b845e8.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-zh-CN-json-94f562845a945a45e385.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-zh-TW-json-0e77c896018bcd221bf6.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-zh-TW-json-7dd3d9ba72493687c286.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/image-02a1f3ecd6baf42daaa6.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/image-eafab0c39ce13f7fea67.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/vendor-448ccb79e58765b61834.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/vendor-cb708a4580b007d81177.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-cacb3d0c02eb2e346ecc.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/vendor-0454f90696ac835aeb45.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/vendor-7664c12c379862ed98a5.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw.development.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw.production.min.d.ts +3 -0
- package/types/packages/excalidraw/entry.d.ts +3 -0
- package/types/packages/excalidraw/index.d.ts +16 -0
- package/types/packages/excalidraw/main.d.ts +2 -0
- package/types/packages/excalidraw/publicPath.d.ts +1 -0
- package/types/packages/excalidraw/webpack.dev.config.d.ts +81 -0
- package/types/packages/excalidraw/webpack.prod.config.d.ts +91 -0
- package/types/packages/utils.d.ts +26 -0
- package/types/points.d.ts +6 -0
- package/types/random.d.ts +3 -0
- package/types/renderer/index.d.ts +1 -0
- package/types/renderer/renderElement.d.ts +23 -0
- package/types/renderer/renderScene.d.ts +21 -0
- package/types/renderer/roundRect.d.ts +11 -0
- package/types/scene/Scene.d.ts +26 -0
- package/types/scene/comparisons.d.ts +10 -0
- package/types/scene/export.d.ts +20 -0
- package/types/scene/index.d.ts +5 -0
- package/types/scene/scroll.d.ts +17 -0
- package/types/scene/scrollbars.d.ts +16 -0
- package/types/scene/selection.d.ts +11 -0
- package/types/scene/types.d.ts +50 -0
- package/types/scene/zoom.d.ts +6 -0
- package/types/shapes.d.ts +35 -0
- package/types/types.d.ts +287 -0
- package/types/utils.d.ts +94 -0
- package/types/zindex.d.ts +6 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const SHAPES: readonly [{
|
|
3
|
+
readonly icon: JSX.Element;
|
|
4
|
+
readonly value: "selection";
|
|
5
|
+
readonly key: "v";
|
|
6
|
+
}, {
|
|
7
|
+
readonly icon: JSX.Element;
|
|
8
|
+
readonly value: "rectangle";
|
|
9
|
+
readonly key: "r";
|
|
10
|
+
}, {
|
|
11
|
+
readonly icon: JSX.Element;
|
|
12
|
+
readonly value: "diamond";
|
|
13
|
+
readonly key: "d";
|
|
14
|
+
}, {
|
|
15
|
+
readonly icon: JSX.Element;
|
|
16
|
+
readonly value: "ellipse";
|
|
17
|
+
readonly key: "e";
|
|
18
|
+
}, {
|
|
19
|
+
readonly icon: JSX.Element;
|
|
20
|
+
readonly value: "arrow";
|
|
21
|
+
readonly key: "a";
|
|
22
|
+
}, {
|
|
23
|
+
readonly icon: JSX.Element;
|
|
24
|
+
readonly value: "line";
|
|
25
|
+
readonly key: readonly ["p", "l"];
|
|
26
|
+
}, {
|
|
27
|
+
readonly icon: JSX.Element;
|
|
28
|
+
readonly value: "freedraw";
|
|
29
|
+
readonly key: "x";
|
|
30
|
+
}, {
|
|
31
|
+
readonly icon: JSX.Element;
|
|
32
|
+
readonly value: "text";
|
|
33
|
+
readonly key: "t";
|
|
34
|
+
}];
|
|
35
|
+
export declare const findShapeByKey: (key: string) => "line" | "selection" | "rectangle" | "diamond" | "ellipse" | "text" | "arrow" | "freedraw" | null;
|
package/types/types.d.ts
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues } from "./element/types";
|
|
3
|
+
import { SHAPES } from "./shapes";
|
|
4
|
+
import { Point as RoughPoint } from "roughjs/bin/geometry";
|
|
5
|
+
import { LinearElementEditor } from "./element/linearElementEditor";
|
|
6
|
+
import { SuggestedBinding } from "./element/binding";
|
|
7
|
+
import { ImportedDataState } from "./data/types";
|
|
8
|
+
import type App from "./components/App";
|
|
9
|
+
import type { ResolvablePromise } from "./utils";
|
|
10
|
+
import { Spreadsheet } from "./charts";
|
|
11
|
+
import { Language } from "./i18n";
|
|
12
|
+
import { ClipboardData } from "./clipboard";
|
|
13
|
+
import { isOverScrollBars } from "./scene";
|
|
14
|
+
import { MaybeTransformHandleType } from "./element/transformHandles";
|
|
15
|
+
export declare type Point = Readonly<RoughPoint>;
|
|
16
|
+
export declare type Collaborator = {
|
|
17
|
+
pointer?: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
};
|
|
21
|
+
button?: "up" | "down";
|
|
22
|
+
selectedElementIds?: AppState["selectedElementIds"];
|
|
23
|
+
username?: string | null;
|
|
24
|
+
userState?: UserIdleState;
|
|
25
|
+
color?: {
|
|
26
|
+
background: string;
|
|
27
|
+
stroke: string;
|
|
28
|
+
};
|
|
29
|
+
picture?: string;
|
|
30
|
+
};
|
|
31
|
+
export declare type AppState = {
|
|
32
|
+
isLoading: boolean;
|
|
33
|
+
errorMessage: string | null;
|
|
34
|
+
draggingElement: NonDeletedExcalidrawElement | null;
|
|
35
|
+
resizingElement: NonDeletedExcalidrawElement | null;
|
|
36
|
+
multiElement: NonDeleted<ExcalidrawLinearElement> | null;
|
|
37
|
+
selectionElement: NonDeletedExcalidrawElement | null;
|
|
38
|
+
isBindingEnabled: boolean;
|
|
39
|
+
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
40
|
+
suggestedBindings: SuggestedBinding[];
|
|
41
|
+
editingElement: NonDeletedExcalidrawElement | null;
|
|
42
|
+
editingLinearElement: LinearElementEditor | null;
|
|
43
|
+
elementType: typeof SHAPES[number]["value"];
|
|
44
|
+
elementLocked: boolean;
|
|
45
|
+
exportBackground: boolean;
|
|
46
|
+
exportEmbedScene: boolean;
|
|
47
|
+
exportWithDarkMode: boolean;
|
|
48
|
+
exportScale: number;
|
|
49
|
+
currentItemStrokeColor: string;
|
|
50
|
+
currentItemBackgroundColor: string;
|
|
51
|
+
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
52
|
+
currentItemStrokeWidth: number;
|
|
53
|
+
currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
|
|
54
|
+
currentItemRoughness: number;
|
|
55
|
+
currentItemOpacity: number;
|
|
56
|
+
currentItemFontFamily: FontFamilyValues;
|
|
57
|
+
currentItemFontSize: number;
|
|
58
|
+
currentItemTextAlign: TextAlign;
|
|
59
|
+
currentItemStrokeSharpness: ExcalidrawElement["strokeSharpness"];
|
|
60
|
+
currentItemStartArrowhead: Arrowhead | null;
|
|
61
|
+
currentItemEndArrowhead: Arrowhead | null;
|
|
62
|
+
currentItemLinearStrokeSharpness: ExcalidrawElement["strokeSharpness"];
|
|
63
|
+
viewBackgroundColor: string;
|
|
64
|
+
scrollX: number;
|
|
65
|
+
scrollY: number;
|
|
66
|
+
cursorButton: "up" | "down";
|
|
67
|
+
scrolledOutside: boolean;
|
|
68
|
+
name: string;
|
|
69
|
+
isResizing: boolean;
|
|
70
|
+
isRotating: boolean;
|
|
71
|
+
zoom: Zoom;
|
|
72
|
+
openMenu: "canvas" | "shape" | null;
|
|
73
|
+
openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
|
|
74
|
+
lastPointerDownWith: PointerType;
|
|
75
|
+
selectedElementIds: {
|
|
76
|
+
[id: string]: boolean;
|
|
77
|
+
};
|
|
78
|
+
previousSelectedElementIds: {
|
|
79
|
+
[id: string]: boolean;
|
|
80
|
+
};
|
|
81
|
+
shouldCacheIgnoreZoom: boolean;
|
|
82
|
+
showHelpDialog: boolean;
|
|
83
|
+
toastMessage: string | null;
|
|
84
|
+
zenModeEnabled: boolean;
|
|
85
|
+
theme: "light" | "dark";
|
|
86
|
+
gridSize: number | null;
|
|
87
|
+
viewModeEnabled: boolean;
|
|
88
|
+
/** top-most selected groups (i.e. does not include nested groups) */
|
|
89
|
+
selectedGroupIds: {
|
|
90
|
+
[groupId: string]: boolean;
|
|
91
|
+
};
|
|
92
|
+
/** group being edited when you drill down to its constituent element
|
|
93
|
+
(e.g. when you double-click on a group's element) */
|
|
94
|
+
editingGroupId: GroupId | null;
|
|
95
|
+
width: number;
|
|
96
|
+
height: number;
|
|
97
|
+
offsetTop: number;
|
|
98
|
+
offsetLeft: number;
|
|
99
|
+
isLibraryOpen: boolean;
|
|
100
|
+
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
101
|
+
collaborators: Map<string, Collaborator>;
|
|
102
|
+
showStats: boolean;
|
|
103
|
+
currentChartType: ChartType;
|
|
104
|
+
pasteDialog: {
|
|
105
|
+
shown: false;
|
|
106
|
+
data: null;
|
|
107
|
+
} | {
|
|
108
|
+
shown: true;
|
|
109
|
+
data: Spreadsheet;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
export declare type NormalizedZoomValue = number & {
|
|
113
|
+
_brand: "normalizedZoom";
|
|
114
|
+
};
|
|
115
|
+
export declare type Zoom = Readonly<{
|
|
116
|
+
value: NormalizedZoomValue;
|
|
117
|
+
translation: Readonly<{
|
|
118
|
+
x: number;
|
|
119
|
+
y: number;
|
|
120
|
+
}>;
|
|
121
|
+
}>;
|
|
122
|
+
export declare type PointerCoords = Readonly<{
|
|
123
|
+
x: number;
|
|
124
|
+
y: number;
|
|
125
|
+
}>;
|
|
126
|
+
export declare type Gesture = {
|
|
127
|
+
pointers: Map<number, PointerCoords>;
|
|
128
|
+
lastCenter: {
|
|
129
|
+
x: number;
|
|
130
|
+
y: number;
|
|
131
|
+
} | null;
|
|
132
|
+
initialDistance: number | null;
|
|
133
|
+
initialScale: number | null;
|
|
134
|
+
};
|
|
135
|
+
export declare class GestureEvent extends UIEvent {
|
|
136
|
+
readonly rotation: number;
|
|
137
|
+
readonly scale: number;
|
|
138
|
+
}
|
|
139
|
+
export declare type LibraryItem = readonly NonDeleted<ExcalidrawElement>[];
|
|
140
|
+
export declare type LibraryItems = readonly LibraryItem[];
|
|
141
|
+
export declare type ExcalidrawAPIRefValue = ExcalidrawImperativeAPI | {
|
|
142
|
+
readyPromise?: ResolvablePromise<ExcalidrawImperativeAPI>;
|
|
143
|
+
ready?: false;
|
|
144
|
+
};
|
|
145
|
+
declare type InitialData = ImportedDataState & {
|
|
146
|
+
scrollX?: number;
|
|
147
|
+
scrollY?: number;
|
|
148
|
+
};
|
|
149
|
+
export interface ExcalidrawProps {
|
|
150
|
+
id?: string | null;
|
|
151
|
+
onChange?: (elements: readonly ExcalidrawElement[], appState: AppState, id?: string | null) => void;
|
|
152
|
+
onHomeButtonClick?: () => void;
|
|
153
|
+
initialData?: InitialData | null | Promise<InitialData | null>;
|
|
154
|
+
user?: {
|
|
155
|
+
name?: string | null;
|
|
156
|
+
};
|
|
157
|
+
excalidrawRef?: ForwardRef<ExcalidrawAPIRefValue>;
|
|
158
|
+
onCollabButtonClick?: () => void;
|
|
159
|
+
isCollaborating?: boolean;
|
|
160
|
+
onPointerUpdate?: (payload: {
|
|
161
|
+
pointer: {
|
|
162
|
+
x: number;
|
|
163
|
+
y: number;
|
|
164
|
+
};
|
|
165
|
+
button: "down" | "up";
|
|
166
|
+
pointersMap: Gesture["pointers"];
|
|
167
|
+
}) => void;
|
|
168
|
+
onPaste?: (data: ClipboardData, event: ClipboardEvent | null) => Promise<boolean> | boolean;
|
|
169
|
+
renderTopRightUI?: (isMobile: boolean, appState: AppState) => JSX.Element;
|
|
170
|
+
renderFooter?: (isMobile: boolean, appState: AppState) => JSX.Element;
|
|
171
|
+
langCode?: Language["code"];
|
|
172
|
+
viewModeEnabled?: boolean;
|
|
173
|
+
zenModeEnabled?: boolean;
|
|
174
|
+
gridModeEnabled?: boolean;
|
|
175
|
+
libraryReturnUrl?: string;
|
|
176
|
+
theme?: "dark" | "light";
|
|
177
|
+
name?: string;
|
|
178
|
+
renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => JSX.Element;
|
|
179
|
+
UIOptions?: UIOptions;
|
|
180
|
+
detectScroll?: boolean;
|
|
181
|
+
handleKeyboardGlobally?: boolean;
|
|
182
|
+
onLibraryChange?: (libraryItems: LibraryItems) => void | Promise<any>;
|
|
183
|
+
autoFocus?: boolean;
|
|
184
|
+
}
|
|
185
|
+
export declare type SceneData = {
|
|
186
|
+
elements?: ImportedDataState["elements"];
|
|
187
|
+
appState?: ImportedDataState["appState"];
|
|
188
|
+
collaborators?: Map<string, Collaborator>;
|
|
189
|
+
commitToHistory?: boolean;
|
|
190
|
+
};
|
|
191
|
+
export declare enum UserIdleState {
|
|
192
|
+
ACTIVE = "active",
|
|
193
|
+
AWAY = "away",
|
|
194
|
+
IDLE = "idle"
|
|
195
|
+
}
|
|
196
|
+
export declare type ExportOpts = {
|
|
197
|
+
saveFileToDisk?: boolean;
|
|
198
|
+
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: AppState, canvas: HTMLCanvasElement | null) => void;
|
|
199
|
+
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: AppState, canvas: HTMLCanvasElement | null) => JSX.Element;
|
|
200
|
+
};
|
|
201
|
+
export declare type CanvasActions = {
|
|
202
|
+
changeViewBackgroundColor?: boolean;
|
|
203
|
+
clearCanvas?: boolean;
|
|
204
|
+
export?: false | ExportOpts | (() => void);
|
|
205
|
+
loadScene?: boolean;
|
|
206
|
+
saveToActiveFile?: boolean;
|
|
207
|
+
theme?: boolean;
|
|
208
|
+
saveAsImage?: boolean;
|
|
209
|
+
};
|
|
210
|
+
export declare type UIOptions = {
|
|
211
|
+
canvasActions?: CanvasActions | false;
|
|
212
|
+
};
|
|
213
|
+
export declare type AppProps = ExcalidrawProps & {
|
|
214
|
+
UIOptions: {
|
|
215
|
+
canvasActions: Required<CanvasActions> | false;
|
|
216
|
+
};
|
|
217
|
+
detectScroll: boolean;
|
|
218
|
+
handleKeyboardGlobally: boolean;
|
|
219
|
+
};
|
|
220
|
+
export declare type PointerDownState = Readonly<{
|
|
221
|
+
origin: Readonly<{
|
|
222
|
+
x: number;
|
|
223
|
+
y: number;
|
|
224
|
+
}>;
|
|
225
|
+
originInGrid: Readonly<{
|
|
226
|
+
x: number;
|
|
227
|
+
y: number;
|
|
228
|
+
}>;
|
|
229
|
+
scrollbars: ReturnType<typeof isOverScrollBars>;
|
|
230
|
+
lastCoords: {
|
|
231
|
+
x: number;
|
|
232
|
+
y: number;
|
|
233
|
+
};
|
|
234
|
+
originalElements: Map<string, NonDeleted<ExcalidrawElement>>;
|
|
235
|
+
resize: {
|
|
236
|
+
handleType: MaybeTransformHandleType;
|
|
237
|
+
isResizing: boolean;
|
|
238
|
+
offset: {
|
|
239
|
+
x: number;
|
|
240
|
+
y: number;
|
|
241
|
+
};
|
|
242
|
+
arrowDirection: "origin" | "end";
|
|
243
|
+
center: {
|
|
244
|
+
x: number;
|
|
245
|
+
y: number;
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
hit: {
|
|
249
|
+
element: NonDeleted<ExcalidrawElement> | null;
|
|
250
|
+
allHitElements: NonDeleted<ExcalidrawElement>[];
|
|
251
|
+
wasAddedToSelection: boolean;
|
|
252
|
+
hasBeenDuplicated: boolean;
|
|
253
|
+
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
254
|
+
};
|
|
255
|
+
withCmdOrCtrl: boolean;
|
|
256
|
+
drag: {
|
|
257
|
+
hasOccurred: boolean;
|
|
258
|
+
offset: {
|
|
259
|
+
x: number;
|
|
260
|
+
y: number;
|
|
261
|
+
} | null;
|
|
262
|
+
};
|
|
263
|
+
eventListeners: {
|
|
264
|
+
onMove: null | ((event: PointerEvent) => void);
|
|
265
|
+
onUp: null | ((event: PointerEvent) => void);
|
|
266
|
+
onKeyDown: null | ((event: KeyboardEvent) => void);
|
|
267
|
+
onKeyUp: null | ((event: KeyboardEvent) => void);
|
|
268
|
+
};
|
|
269
|
+
}>;
|
|
270
|
+
export declare type ExcalidrawImperativeAPI = {
|
|
271
|
+
updateScene: InstanceType<typeof App>["updateScene"];
|
|
272
|
+
resetScene: InstanceType<typeof App>["resetScene"];
|
|
273
|
+
getSceneElementsIncludingDeleted: InstanceType<typeof App>["getSceneElementsIncludingDeleted"];
|
|
274
|
+
history: {
|
|
275
|
+
clear: InstanceType<typeof App>["resetHistory"];
|
|
276
|
+
};
|
|
277
|
+
scrollToContent: InstanceType<typeof App>["scrollToContent"];
|
|
278
|
+
getSceneElements: InstanceType<typeof App>["getSceneElements"];
|
|
279
|
+
getAppState: () => InstanceType<typeof App>["state"];
|
|
280
|
+
refresh: InstanceType<typeof App>["refresh"];
|
|
281
|
+
importLibrary: InstanceType<typeof App>["importLibraryFromUrl"];
|
|
282
|
+
setToastMessage: InstanceType<typeof App>["setToastMessage"];
|
|
283
|
+
readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
|
|
284
|
+
ready: true;
|
|
285
|
+
id: string;
|
|
286
|
+
};
|
|
287
|
+
export {};
|
package/types/utils.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { FontFamilyValues, FontString } from "./element/types";
|
|
2
|
+
import { Zoom } from "./types";
|
|
3
|
+
export declare const SVG_NS = "http://www.w3.org/2000/svg";
|
|
4
|
+
export declare const setDateTimeForTests: (dateTime: string) => void;
|
|
5
|
+
export declare const getDateTime: () => string;
|
|
6
|
+
export declare const capitalizeString: (str: string) => string;
|
|
7
|
+
export declare const isToolIcon: (target: Element | EventTarget | null) => target is HTMLElement;
|
|
8
|
+
export declare const isInputLike: (target: Element | EventTarget | null) => target is HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLBRElement | HTMLDivElement;
|
|
9
|
+
export declare const isWritableElement: (target: Element | EventTarget | null) => target is HTMLInputElement | HTMLTextAreaElement | HTMLBRElement | HTMLDivElement;
|
|
10
|
+
export declare const getFontFamilyString: ({ fontFamily, }: {
|
|
11
|
+
fontFamily: FontFamilyValues;
|
|
12
|
+
}) => string;
|
|
13
|
+
/** returns fontSize+fontFamily string for assignment to DOM elements */
|
|
14
|
+
export declare const getFontString: ({ fontSize, fontFamily, }: {
|
|
15
|
+
fontSize: number;
|
|
16
|
+
fontFamily: FontFamilyValues;
|
|
17
|
+
}) => FontString;
|
|
18
|
+
export declare const measureText: (text: string, font: FontString) => {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
baseline: number;
|
|
22
|
+
};
|
|
23
|
+
export declare const debounce: <T extends any[]>(fn: (...args: T) => void, timeout: number) => {
|
|
24
|
+
(...args: T): void;
|
|
25
|
+
flush(): void;
|
|
26
|
+
cancel(): void;
|
|
27
|
+
};
|
|
28
|
+
export declare const selectNode: (node: Element) => void;
|
|
29
|
+
export declare const removeSelection: () => void;
|
|
30
|
+
export declare const distance: (x: number, y: number) => number;
|
|
31
|
+
export declare const resetCursor: (canvas: HTMLCanvasElement | null) => void;
|
|
32
|
+
export declare const setCursor: (canvas: HTMLCanvasElement | null, cursor: string) => void;
|
|
33
|
+
export declare const setCursorForShape: (canvas: HTMLCanvasElement | null, shape: string) => void;
|
|
34
|
+
export declare const isFullScreen: () => boolean;
|
|
35
|
+
export declare const allowFullScreen: () => Promise<void>;
|
|
36
|
+
export declare const exitFullScreen: () => Promise<void>;
|
|
37
|
+
export declare const getShortcutKey: (shortcut: string) => string;
|
|
38
|
+
export declare const viewportCoordsToSceneCoords: ({ clientX, clientY }: {
|
|
39
|
+
clientX: number;
|
|
40
|
+
clientY: number;
|
|
41
|
+
}, { zoom, offsetLeft, offsetTop, scrollX, scrollY, }: {
|
|
42
|
+
zoom: Zoom;
|
|
43
|
+
offsetLeft: number;
|
|
44
|
+
offsetTop: number;
|
|
45
|
+
scrollX: number;
|
|
46
|
+
scrollY: number;
|
|
47
|
+
}) => {
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
};
|
|
51
|
+
export declare const sceneCoordsToViewportCoords: ({ sceneX, sceneY }: {
|
|
52
|
+
sceneX: number;
|
|
53
|
+
sceneY: number;
|
|
54
|
+
}, { zoom, offsetLeft, offsetTop, scrollX, scrollY, }: {
|
|
55
|
+
zoom: Zoom;
|
|
56
|
+
offsetLeft: number;
|
|
57
|
+
offsetTop: number;
|
|
58
|
+
scrollX: number;
|
|
59
|
+
scrollY: number;
|
|
60
|
+
}) => {
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
};
|
|
64
|
+
export declare const getGlobalCSSVariable: (name: string) => string;
|
|
65
|
+
/**
|
|
66
|
+
* Checks whether first directional character is RTL. Meaning whether it starts
|
|
67
|
+
* with RTL characters, or indeterminate (numbers etc.) characters followed by
|
|
68
|
+
* RTL.
|
|
69
|
+
* See https://github.com/excalidraw/excalidraw/pull/1722#discussion_r436340171
|
|
70
|
+
*/
|
|
71
|
+
export declare const isRTL: (text: string) => boolean;
|
|
72
|
+
export declare const tupleToCoors: (xyTuple: readonly [number, number]) => {
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
};
|
|
76
|
+
/** use as a rejectionHandler to mute filesystem Abort errors */
|
|
77
|
+
export declare const muteFSAbortError: (error?: Error | undefined) => void;
|
|
78
|
+
export declare const findIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
|
|
79
|
+
export declare const findLastIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
|
|
80
|
+
export declare const isTransparent: (color: string) => boolean;
|
|
81
|
+
export declare type ResolvablePromise<T> = Promise<T> & {
|
|
82
|
+
resolve: [T] extends [undefined] ? (value?: T) => void : (value: T) => void;
|
|
83
|
+
reject: (error: Error) => void;
|
|
84
|
+
};
|
|
85
|
+
export declare const resolvablePromise: <T>() => ResolvablePromise<T>;
|
|
86
|
+
/**
|
|
87
|
+
* @param func handler taking at most single parameter (event).
|
|
88
|
+
*/
|
|
89
|
+
export declare const withBatchedUpdates: <TFunction extends ((event: any) => void) | (() => void)>(func: Parameters<TFunction>["length"] extends 0 | 1 ? TFunction : never) => TFunction;
|
|
90
|
+
export declare const nFormatter: (num: number, digits: number) => string;
|
|
91
|
+
export declare const getVersion: () => string;
|
|
92
|
+
export declare const supportsEmoji: () => boolean;
|
|
93
|
+
export declare const getNearestScrollableContainer: (element: HTMLElement) => HTMLElement | Document;
|
|
94
|
+
export declare const focusNearestParent: (element: HTMLInputElement) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExcalidrawElement } from "./element/types";
|
|
2
|
+
import { AppState } from "./types";
|
|
3
|
+
export declare const moveOneLeft: (elements: readonly ExcalidrawElement[], appState: AppState) => (import("./element/types").ExcalidrawLinearElement | import("./element/types").ExcalidrawSelectionElement | import("./element/types").ExcalidrawRectangleElement | import("./element/types").ExcalidrawDiamondElement | import("./element/types").ExcalidrawEllipseElement | import("./element/types").ExcalidrawTextElement | import("./element/types").ExcalidrawFreeDrawElement)[];
|
|
4
|
+
export declare const moveOneRight: (elements: readonly ExcalidrawElement[], appState: AppState) => (import("./element/types").ExcalidrawLinearElement | import("./element/types").ExcalidrawSelectionElement | import("./element/types").ExcalidrawRectangleElement | import("./element/types").ExcalidrawDiamondElement | import("./element/types").ExcalidrawEllipseElement | import("./element/types").ExcalidrawTextElement | import("./element/types").ExcalidrawFreeDrawElement)[];
|
|
5
|
+
export declare const moveAllLeft: (elements: readonly ExcalidrawElement[], appState: AppState) => readonly ExcalidrawElement[];
|
|
6
|
+
export declare const moveAllRight: (elements: readonly ExcalidrawElement[], appState: AppState) => readonly ExcalidrawElement[];
|