@excalidraw/excalidraw 0.18.0-4e471c107 → 0.18.0-51ad895
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/{chunk-QF5FRM6O.js → chunk-OCFTI2BU.js} +49 -26
- package/dist/dev/chunk-OCFTI2BU.js.map +7 -0
- package/dist/dev/{chunk-CBGOW5JB.js → chunk-SJTAY27F.js} +185 -389
- package/dist/dev/chunk-SJTAY27F.js.map +7 -0
- package/dist/dev/chunk-WCM2OLWY.js +69 -0
- package/dist/dev/chunk-WCM2OLWY.js.map +7 -0
- package/dist/dev/data/{image-SURZSZNX.js → image-S2GFZH7W.js} +2 -2
- package/dist/dev/index.css +944 -498
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +10405 -7221
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/locales/{ar-SA-XORAP2EK.js → ar-SA-JK5MQ7TT.js} +300 -142
- package/dist/dev/locales/ar-SA-JK5MQ7TT.js.map +7 -0
- package/dist/dev/locales/{az-AZ-NAUU3Z4Y.js → az-AZ-2PAD62G4.js} +241 -83
- package/dist/dev/locales/az-AZ-2PAD62G4.js.map +7 -0
- package/dist/dev/locales/{bg-BG-AAABLFCY.js → bg-BG-HUKVYCRK.js} +229 -71
- package/dist/dev/locales/bg-BG-HUKVYCRK.js.map +7 -0
- package/dist/dev/locales/{bn-BD-PM4AC5WG.js → bn-BD-V2CQI46P.js} +209 -51
- package/dist/dev/locales/bn-BD-V2CQI46P.js.map +7 -0
- package/dist/dev/locales/bn-IN-MBEO4C3J.js +744 -0
- package/dist/dev/locales/bn-IN-MBEO4C3J.js.map +7 -0
- package/dist/dev/locales/{ca-ES-YNNMFRQX.js → ca-ES-KWEKW4C3.js} +275 -117
- package/dist/dev/locales/ca-ES-KWEKW4C3.js.map +7 -0
- package/dist/dev/locales/{cs-CZ-DGZA5IKG.js → cs-CZ-W5AHZB5H.js} +229 -71
- package/dist/dev/locales/cs-CZ-W5AHZB5H.js.map +7 -0
- package/dist/dev/locales/{da-DK-N76F4QAJ.js → da-DK-ITTM6YM4.js} +298 -140
- package/dist/dev/locales/da-DK-ITTM6YM4.js.map +7 -0
- package/dist/dev/locales/de-CH-OAWPDQFJ.js +744 -0
- package/dist/dev/locales/de-CH-OAWPDQFJ.js.map +7 -0
- package/dist/dev/locales/{de-DE-DMRXZ2SZ.js → de-DE-HE4SJIAA.js} +199 -41
- package/dist/dev/locales/de-DE-HE4SJIAA.js.map +7 -0
- package/dist/dev/locales/{el-GR-HIKPLEXI.js → el-GR-QXASZLPE.js} +274 -116
- package/dist/dev/locales/el-GR-QXASZLPE.js.map +7 -0
- package/dist/dev/locales/{en-SMAPCEOQ.js → en-MLZIHOCR.js} +4 -2
- package/dist/dev/locales/{es-ES-AQYVXC32.js → es-ES-EDA76ZAF.js} +212 -54
- package/dist/dev/locales/es-ES-EDA76ZAF.js.map +7 -0
- package/dist/dev/locales/{eu-ES-3TOEU5DE.js → eu-ES-TF2DGTZU.js} +210 -52
- package/dist/dev/locales/eu-ES-TF2DGTZU.js.map +7 -0
- package/dist/dev/locales/{fa-IR-527GAKUP.js → fa-IR-ITKFQ7QV.js} +286 -128
- package/dist/dev/locales/fa-IR-ITKFQ7QV.js.map +7 -0
- package/dist/dev/locales/{fi-FI-M3WLVDFP.js → fi-FI-UWZRVXFI.js} +240 -82
- package/dist/dev/locales/fi-FI-UWZRVXFI.js.map +7 -0
- package/dist/dev/locales/{fr-FR-YE4VDJFI.js → fr-FR-Z3SBW42Y.js} +203 -45
- package/dist/dev/locales/fr-FR-Z3SBW42Y.js.map +7 -0
- package/dist/dev/locales/{gl-ES-KMXUYGUN.js → gl-ES-2QCVIBFP.js} +212 -54
- package/dist/dev/locales/gl-ES-2QCVIBFP.js.map +7 -0
- package/dist/dev/locales/he-IL-WJNUHU26.js +744 -0
- package/dist/dev/locales/he-IL-WJNUHU26.js.map +7 -0
- package/dist/dev/locales/hi-IN-XGMO235V.js +744 -0
- package/dist/dev/locales/hi-IN-XGMO235V.js.map +7 -0
- package/dist/dev/locales/{hu-HU-VIYZI3X4.js → hu-HU-37FDQFIS.js} +238 -80
- package/dist/dev/locales/hu-HU-37FDQFIS.js.map +7 -0
- package/dist/dev/locales/{id-ID-22TWZNLA.js → id-ID-EJIDCO4E.js} +245 -87
- package/dist/dev/locales/id-ID-EJIDCO4E.js.map +7 -0
- package/dist/dev/locales/{it-IT-MDEQ2SG3.js → it-IT-HD26UZNF.js} +202 -44
- package/dist/dev/locales/it-IT-HD26UZNF.js.map +7 -0
- package/dist/dev/locales/{ja-JP-K2DI4W6B.js → ja-JP-37FC23PR.js} +247 -89
- package/dist/dev/locales/ja-JP-37FC23PR.js.map +7 -0
- package/dist/dev/locales/{kaa-6BPSNM3R.js → kaa-7ZYDFVKA.js} +202 -44
- package/dist/dev/locales/kaa-7ZYDFVKA.js.map +7 -0
- package/dist/dev/locales/{kab-KAB-2S7ZURK7.js → kab-KAB-MILWXBA6.js} +210 -52
- package/dist/dev/locales/kab-KAB-MILWXBA6.js.map +7 -0
- package/dist/dev/locales/{kk-KZ-UJPYGRQQ.js → kk-KZ-7BWTPIAV.js} +175 -17
- package/dist/dev/locales/kk-KZ-7BWTPIAV.js.map +7 -0
- package/dist/dev/locales/{km-KH-M5T5JKUE.js → km-KH-BV4P2KSZ.js} +198 -40
- package/dist/dev/locales/km-KH-BV4P2KSZ.js.map +7 -0
- package/dist/dev/locales/{ko-KR-RQX37SNF.js → ko-KR-TSXE5P7B.js} +218 -60
- package/dist/dev/locales/ko-KR-TSXE5P7B.js.map +7 -0
- package/dist/dev/locales/{ku-TR-5XJDIERL.js → ku-TR-ASSXNN3U.js} +198 -40
- package/dist/dev/locales/ku-TR-ASSXNN3U.js.map +7 -0
- package/dist/dev/locales/{lt-LT-MGUBX6CA.js → lt-LT-G7RZYQQU.js} +179 -21
- package/dist/dev/locales/lt-LT-G7RZYQQU.js.map +7 -0
- package/dist/dev/locales/{lv-LV-MD7N5VHD.js → lv-LV-DXNPBJZU.js} +196 -38
- package/dist/dev/locales/lv-LV-DXNPBJZU.js.map +7 -0
- package/dist/dev/locales/{mr-IN-4XWMNGQC.js → mr-IN-7F2ZCTCF.js} +204 -46
- package/dist/dev/locales/mr-IN-7F2ZCTCF.js.map +7 -0
- package/dist/dev/locales/{my-MM-O4Z74GN5.js → my-MM-NBI3KQGW.js} +181 -23
- package/dist/dev/locales/my-MM-NBI3KQGW.js.map +7 -0
- package/dist/dev/locales/{nb-NO-BMB73KRH.js → nb-NO-4DCTQT6L.js} +220 -62
- package/dist/dev/locales/nb-NO-4DCTQT6L.js.map +7 -0
- package/dist/dev/locales/{nl-NL-F2257BLQ.js → nl-NL-RCSOXLW3.js} +218 -60
- package/dist/dev/locales/nl-NL-RCSOXLW3.js.map +7 -0
- package/dist/dev/locales/{nn-NO-NCORG7TS.js → nn-NO-FR534JV5.js} +201 -43
- package/dist/dev/locales/nn-NO-FR534JV5.js.map +7 -0
- package/dist/dev/locales/{oc-FR-ATFBDMF6.js → oc-FR-YQCIKZIK.js} +220 -62
- package/dist/dev/locales/oc-FR-YQCIKZIK.js.map +7 -0
- package/dist/dev/locales/{pa-IN-D2I375G4.js → pa-IN-UM43JGD2.js} +190 -32
- package/dist/dev/locales/pa-IN-UM43JGD2.js.map +7 -0
- package/dist/dev/locales/{percentages-YKFLWNK2.js → percentages-TR7IWPFY.js} +2 -2
- package/dist/dev/locales/{pl-PL-YJHOWAAW.js → pl-PL-2UGKA6HK.js} +214 -56
- package/dist/dev/locales/pl-PL-2UGKA6HK.js.map +7 -0
- package/dist/dev/locales/{pt-BR-APOPYZJ7.js → pt-BR-H23QFYE3.js} +237 -79
- package/dist/dev/locales/pt-BR-H23QFYE3.js.map +7 -0
- package/dist/dev/locales/pt-PT-RHKJH5I5.js +744 -0
- package/dist/dev/locales/pt-PT-RHKJH5I5.js.map +7 -0
- package/dist/dev/locales/{ro-RO-L575VRQA.js → ro-RO-IIFONL3T.js} +203 -45
- package/dist/dev/locales/ro-RO-IIFONL3T.js.map +7 -0
- package/dist/dev/locales/{ru-RU-BLG6HZG5.js → ru-RU-QEP6D7GK.js} +253 -95
- package/dist/dev/locales/ru-RU-QEP6D7GK.js.map +7 -0
- package/dist/dev/locales/si-LK-LZYJQLHF.js +744 -0
- package/dist/dev/locales/si-LK-LZYJQLHF.js.map +7 -0
- package/dist/dev/locales/{sk-SK-DY6IPO5U.js → sk-SK-G2J6PSCB.js} +200 -42
- package/dist/dev/locales/sk-SK-G2J6PSCB.js.map +7 -0
- package/dist/dev/locales/{sl-SI-5DZSRA47.js → sl-SI-QJT2CAUO.js} +197 -39
- package/dist/dev/locales/sl-SI-QJT2CAUO.js.map +7 -0
- package/dist/dev/locales/{sv-SE-V32YHALQ.js → sv-SE-3MAT3NDX.js} +202 -44
- package/dist/dev/locales/sv-SE-3MAT3NDX.js.map +7 -0
- package/dist/dev/locales/{ta-IN-5JRAGQAO.js → ta-IN-J7XOYF2T.js} +257 -99
- package/dist/dev/locales/ta-IN-J7XOYF2T.js.map +7 -0
- package/dist/dev/locales/{th-TH-55ACRHDJ.js → th-TH-2OI52EOQ.js} +289 -131
- package/dist/dev/locales/th-TH-2OI52EOQ.js.map +7 -0
- package/dist/dev/locales/{tr-TR-7QYBXDBO.js → tr-TR-G7TAUHUI.js} +257 -99
- package/dist/dev/locales/tr-TR-G7TAUHUI.js.map +7 -0
- package/dist/dev/locales/{uk-UA-TJS2TMRH.js → uk-UA-IVSVBJIG.js} +229 -71
- package/dist/dev/locales/uk-UA-IVSVBJIG.js.map +7 -0
- package/dist/dev/locales/{si-LK-KT7GGO6D.js → uz-UZ-KCVDUVDE.js} +212 -54
- package/dist/dev/locales/uz-UZ-KCVDUVDE.js.map +7 -0
- package/dist/dev/locales/vi-VN-XF3AYKJ7.js +744 -0
- package/dist/dev/locales/vi-VN-XF3AYKJ7.js.map +7 -0
- package/dist/dev/locales/{zh-CN-4MXUOFTH.js → zh-CN-IS26RG2D.js} +199 -41
- package/dist/dev/locales/zh-CN-IS26RG2D.js.map +7 -0
- package/dist/dev/locales/{zh-HK-RBTGIU3U.js → zh-HK-KBWQ6SJC.js} +175 -17
- package/dist/dev/locales/zh-HK-KBWQ6SJC.js.map +7 -0
- package/dist/dev/locales/{zh-TW-U5VF4CCU.js → zh-TW-JKJWJQ4J.js} +204 -46
- package/dist/dev/locales/zh-TW-JKJWJQ4J.js.map +7 -0
- package/dist/prod/chunk-Q7BNPSJU.js +1 -0
- package/dist/prod/chunk-QNG5NH6R.js +12 -0
- package/dist/prod/chunk-XJNFOLHK.js +4 -0
- package/dist/prod/data/{image-HXEZYJPQ.js → image-SMWA6JLH.js} +1 -1
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +23 -23
- package/dist/prod/locales/ar-SA-IYHKZRSE.js +8 -0
- package/dist/prod/locales/az-AZ-WL5GYRHK.js +1 -0
- package/dist/prod/locales/bg-BG-FXZYTRPD.js +5 -0
- package/dist/prod/locales/bn-BD-KO6YL5G2.js +3 -0
- package/dist/prod/locales/bn-IN-PC6JHKYB.js +3 -0
- package/dist/prod/locales/ca-ES-AREX5NEO.js +8 -0
- package/dist/prod/locales/cs-CZ-HXAZMFYH.js +7 -0
- package/dist/prod/locales/da-DK-5X7ZLFU3.js +2 -0
- package/dist/prod/locales/de-CH-76ZNVSOF.js +7 -0
- package/dist/prod/locales/de-DE-KU2ABQRN.js +7 -0
- package/dist/prod/locales/el-GR-4AZTZGY6.js +7 -0
- package/dist/prod/locales/en-BARVNJLJ.js +1 -0
- package/dist/prod/locales/es-ES-MXQVAWTQ.js +7 -0
- package/dist/prod/locales/eu-ES-BIF4XBMT.js +7 -0
- package/dist/prod/locales/fa-IR-D4HHKAAI.js +9 -0
- package/dist/prod/locales/fi-FI-O35ZY7UI.js +6 -0
- package/dist/prod/locales/fr-FR-PJOMXPCV.js +12 -0
- package/dist/prod/locales/gl-ES-U4NYM3X5.js +6 -0
- package/dist/prod/locales/he-IL-656ABAVQ.js +8 -0
- package/dist/prod/locales/hi-IN-Z55GAFFR.js +3 -0
- package/dist/prod/locales/hu-HU-UJ62DVIW.js +3 -0
- package/dist/prod/locales/id-ID-FLZFU3OO.js +8 -0
- package/dist/prod/locales/it-IT-DQZT3VFE.js +12 -0
- package/dist/prod/locales/ja-JP-43VXGDWI.js +7 -0
- package/dist/prod/locales/kaa-L3IMSDYL.js +1 -0
- package/dist/prod/locales/kab-KAB-XKPWJLNL.js +4 -0
- package/dist/prod/locales/kk-KZ-SXPDDY2H.js +1 -0
- package/dist/prod/locales/km-KH-DOS4CPGC.js +7 -0
- package/dist/prod/locales/ko-KR-BGC6VCY4.js +5 -0
- package/dist/prod/locales/ku-TR-J7IUITIA.js +6 -0
- package/dist/prod/locales/lt-LT-AC3LV5KG.js +3 -0
- package/dist/prod/locales/lv-LV-I6AY7QG2.js +4 -0
- package/dist/prod/locales/mr-IN-5SP4HV5B.js +9 -0
- package/dist/prod/locales/my-MM-S7ECRBYZ.js +1 -0
- package/dist/prod/locales/nb-NO-6PNHTF4R.js +8 -0
- package/dist/prod/locales/nl-NL-AVTAYVB7.js +7 -0
- package/dist/prod/locales/nn-NO-3TFXTM7Y.js +4 -0
- package/dist/prod/locales/oc-FR-IK6GIE7H.js +4 -0
- package/dist/prod/locales/pa-IN-YAKHYJET.js +4 -0
- package/dist/prod/locales/percentages-FZSTHYWV.js +1 -0
- package/dist/prod/locales/pl-PL-BIY22ZWU.js +12 -0
- package/dist/prod/locales/pt-BR-Q23NUPD6.js +6 -0
- package/dist/prod/locales/pt-PT-LOPEJLPJ.js +8 -0
- package/dist/prod/locales/ro-RO-W3D2ZATV.js +12 -0
- package/dist/prod/locales/ru-RU-DCTW7QSH.js +10 -0
- package/dist/prod/locales/si-LK-FYRRHO3C.js +1 -0
- package/dist/prod/locales/sk-SK-2KAMKFW5.js +7 -0
- package/dist/prod/locales/sl-SI-L6B6HFY5.js +6 -0
- package/dist/prod/locales/sv-SE-KMY6L2BA.js +8 -0
- package/dist/prod/locales/ta-IN-ZQCYE2JK.js +6 -0
- package/dist/prod/locales/th-TH-WS7ECBAV.js +1 -0
- package/dist/prod/locales/tr-TR-S5FI7JRW.js +4 -0
- package/dist/prod/locales/uk-UA-4EZUWUSQ.js +6 -0
- package/dist/prod/locales/uz-UZ-OKHL6AFA.js +1 -0
- package/dist/prod/locales/vi-VN-I6Q2YS4S.js +7 -0
- package/dist/prod/locales/zh-CN-JE4UZWNO.js +11 -0
- package/dist/prod/locales/zh-HK-RM35YDXX.js +1 -0
- package/dist/prod/locales/zh-TW-ONGLV6Y5.js +9 -0
- package/dist/types/common/src/constants.d.ts +21 -15
- package/dist/types/common/src/editorInterface.d.ts +34 -0
- package/dist/types/common/src/index.d.ts +2 -0
- package/dist/types/common/src/utils.d.ts +9 -3
- package/dist/types/common/src/visualdebug.d.ts +41 -0
- package/dist/types/element/src/Scene.d.ts +6 -2
- package/dist/types/element/src/align.d.ts +2 -1
- package/dist/types/element/src/binding.d.ts +55 -43
- package/dist/types/element/src/bounds.d.ts +1 -1
- package/dist/types/element/src/collision.d.ts +6 -2
- package/dist/types/element/src/delta.d.ts +16 -4
- package/dist/types/element/src/distribute.d.ts +2 -1
- package/dist/types/element/src/groups.d.ts +1 -0
- package/dist/types/element/src/index.d.ts +1 -3
- package/dist/types/element/src/linearElementEditor.d.ts +17 -19
- package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
- package/dist/types/element/src/renderElement.d.ts +5 -2
- package/dist/types/element/src/resizeTest.d.ts +5 -4
- package/dist/types/element/src/store.d.ts +6 -1
- package/dist/types/element/src/textElement.d.ts +1 -1
- package/dist/types/element/src/transformHandles.d.ts +5 -4
- package/dist/types/element/src/typeChecks.d.ts +2 -3
- package/dist/types/element/src/types.d.ts +7 -11
- package/dist/types/element/src/utils.d.ts +2 -1
- package/dist/types/element/src/zindex.d.ts +7 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +34 -16
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +25 -13
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +153 -275
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +45 -777
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +12 -6
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +45 -29
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +11 -7
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +23 -11
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +12 -6
- package/dist/types/excalidraw/actions/actionExport.d.ts +68 -952
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +10 -394
- package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionFrame.d.ts +50 -28
- package/dist/types/excalidraw/actions/actionGroup.d.ts +24 -12
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +47 -14
- package/dist/types/excalidraw/actions/actionLink.d.ts +9 -3
- package/dist/types/excalidraw/actions/actionMenu.d.ts +10 -374
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +21 -361
- package/dist/types/excalidraw/actions/actionProperties.d.ts +87 -2418
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +12 -6
- package/dist/types/excalidraw/actions/actionStyles.d.ts +13 -7
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +10 -6
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +12 -6
- package/dist/types/excalidraw/actions/actionZindex.d.ts +2 -2
- package/dist/types/excalidraw/actions/index.d.ts +2 -2
- package/dist/types/excalidraw/actions/manager.d.ts +1 -1
- package/dist/types/excalidraw/actions/register.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +4 -4
- package/dist/types/excalidraw/appState.d.ts +9 -4
- package/dist/types/excalidraw/clipboard.d.ts +64 -1
- package/dist/types/excalidraw/components/Actions.d.ts +20 -7
- package/dist/types/excalidraw/components/App.d.ts +35 -25
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -0
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -1
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -1
- package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
- package/dist/types/excalidraw/components/CommandPalette/types.d.ts +1 -2
- package/dist/types/excalidraw/components/Ellipsify.d.ts +4 -0
- package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +1 -1
- package/dist/types/excalidraw/components/FilledButton.d.ts +1 -1
- package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
- package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
- package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
- package/dist/types/excalidraw/components/LayerUI.d.ts +2 -1
- package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
- package/dist/types/excalidraw/components/LinkButton.d.ts +4 -0
- package/dist/types/excalidraw/components/MobileMenu.d.ts +3 -5
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +11 -0
- package/dist/types/excalidraw/components/Popover.d.ts +2 -1
- package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -0
- package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -2
- package/dist/types/excalidraw/components/TextField.d.ts +1 -0
- package/dist/types/excalidraw/components/ToolPopover.d.ts +25 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +6 -3
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +4 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +2 -1
- package/dist/types/excalidraw/components/icons.d.ts +10 -0
- package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +13 -1
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +0 -3
- package/dist/types/excalidraw/components/shapes.d.ts +129 -1
- package/dist/types/excalidraw/data/blob.d.ts +3 -7
- package/dist/types/excalidraw/data/reconcile.d.ts +1 -0
- package/dist/types/excalidraw/data/restore.d.ts +7 -2
- package/dist/types/excalidraw/data/types.d.ts +4 -1
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +3 -1
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
- package/dist/types/excalidraw/index.d.ts +4 -4
- package/dist/types/excalidraw/renderer/animation.d.ts +12 -0
- package/dist/types/excalidraw/renderer/helpers.d.ts +1 -5
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +5 -13
- package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
- package/dist/types/excalidraw/scene/types.d.ts +15 -3
- package/dist/types/excalidraw/shortcut.d.ts +1 -0
- package/dist/types/excalidraw/types.d.ts +37 -24
- package/dist/types/math/src/segment.d.ts +1 -0
- package/history.ts +1 -1
- package/package.json +6 -6
- package/dist/dev/chunk-CBGOW5JB.js.map +0 -7
- package/dist/dev/chunk-MFAYKRVR.js +0 -66
- package/dist/dev/chunk-MFAYKRVR.js.map +0 -7
- package/dist/dev/chunk-QF5FRM6O.js.map +0 -7
- package/dist/dev/locales/ar-SA-XORAP2EK.js.map +0 -7
- package/dist/dev/locales/az-AZ-NAUU3Z4Y.js.map +0 -7
- package/dist/dev/locales/bg-BG-AAABLFCY.js.map +0 -7
- package/dist/dev/locales/bn-BD-PM4AC5WG.js.map +0 -7
- package/dist/dev/locales/ca-ES-YNNMFRQX.js.map +0 -7
- package/dist/dev/locales/cs-CZ-DGZA5IKG.js.map +0 -7
- package/dist/dev/locales/da-DK-N76F4QAJ.js.map +0 -7
- package/dist/dev/locales/de-DE-DMRXZ2SZ.js.map +0 -7
- package/dist/dev/locales/el-GR-HIKPLEXI.js.map +0 -7
- package/dist/dev/locales/es-ES-AQYVXC32.js.map +0 -7
- package/dist/dev/locales/eu-ES-3TOEU5DE.js.map +0 -7
- package/dist/dev/locales/fa-IR-527GAKUP.js.map +0 -7
- package/dist/dev/locales/fi-FI-M3WLVDFP.js.map +0 -7
- package/dist/dev/locales/fr-FR-YE4VDJFI.js.map +0 -7
- package/dist/dev/locales/gl-ES-KMXUYGUN.js.map +0 -7
- package/dist/dev/locales/he-IL-4MU5N22B.js +0 -586
- package/dist/dev/locales/he-IL-4MU5N22B.js.map +0 -7
- package/dist/dev/locales/hi-IN-ZHZNZWFC.js +0 -586
- package/dist/dev/locales/hi-IN-ZHZNZWFC.js.map +0 -7
- package/dist/dev/locales/hu-HU-VIYZI3X4.js.map +0 -7
- package/dist/dev/locales/id-ID-22TWZNLA.js.map +0 -7
- package/dist/dev/locales/it-IT-MDEQ2SG3.js.map +0 -7
- package/dist/dev/locales/ja-JP-K2DI4W6B.js.map +0 -7
- package/dist/dev/locales/kaa-6BPSNM3R.js.map +0 -7
- package/dist/dev/locales/kab-KAB-2S7ZURK7.js.map +0 -7
- package/dist/dev/locales/kk-KZ-UJPYGRQQ.js.map +0 -7
- package/dist/dev/locales/km-KH-M5T5JKUE.js.map +0 -7
- package/dist/dev/locales/ko-KR-RQX37SNF.js.map +0 -7
- package/dist/dev/locales/ku-TR-5XJDIERL.js.map +0 -7
- package/dist/dev/locales/lt-LT-MGUBX6CA.js.map +0 -7
- package/dist/dev/locales/lv-LV-MD7N5VHD.js.map +0 -7
- package/dist/dev/locales/mr-IN-4XWMNGQC.js.map +0 -7
- package/dist/dev/locales/my-MM-O4Z74GN5.js.map +0 -7
- package/dist/dev/locales/nb-NO-BMB73KRH.js.map +0 -7
- package/dist/dev/locales/nl-NL-F2257BLQ.js.map +0 -7
- package/dist/dev/locales/nn-NO-NCORG7TS.js.map +0 -7
- package/dist/dev/locales/oc-FR-ATFBDMF6.js.map +0 -7
- package/dist/dev/locales/pa-IN-D2I375G4.js.map +0 -7
- package/dist/dev/locales/pl-PL-YJHOWAAW.js.map +0 -7
- package/dist/dev/locales/pt-BR-APOPYZJ7.js.map +0 -7
- package/dist/dev/locales/pt-PT-W56WCN7P.js +0 -586
- package/dist/dev/locales/pt-PT-W56WCN7P.js.map +0 -7
- package/dist/dev/locales/ro-RO-L575VRQA.js.map +0 -7
- package/dist/dev/locales/ru-RU-BLG6HZG5.js.map +0 -7
- package/dist/dev/locales/si-LK-KT7GGO6D.js.map +0 -7
- package/dist/dev/locales/sk-SK-DY6IPO5U.js.map +0 -7
- package/dist/dev/locales/sl-SI-5DZSRA47.js.map +0 -7
- package/dist/dev/locales/sv-SE-V32YHALQ.js.map +0 -7
- package/dist/dev/locales/ta-IN-5JRAGQAO.js.map +0 -7
- package/dist/dev/locales/th-TH-55ACRHDJ.js.map +0 -7
- package/dist/dev/locales/tr-TR-7QYBXDBO.js.map +0 -7
- package/dist/dev/locales/uk-UA-TJS2TMRH.js.map +0 -7
- package/dist/dev/locales/vi-VN-Y5CQ2EKQ.js +0 -586
- package/dist/dev/locales/vi-VN-Y5CQ2EKQ.js.map +0 -7
- package/dist/dev/locales/zh-CN-4MXUOFTH.js.map +0 -7
- package/dist/dev/locales/zh-HK-RBTGIU3U.js.map +0 -7
- package/dist/dev/locales/zh-TW-U5VF4CCU.js.map +0 -7
- package/dist/prod/chunk-I4UNSFV6.js +0 -12
- package/dist/prod/chunk-IRHK23LL.js +0 -4
- package/dist/prod/chunk-Z3N5DIM6.js +0 -1
- package/dist/prod/locales/ar-SA-G6X2FPQ2.js +0 -10
- package/dist/prod/locales/az-AZ-76LH7QW2.js +0 -1
- package/dist/prod/locales/bg-BG-XCXSNQG7.js +0 -5
- package/dist/prod/locales/bn-BD-2XOGV67Q.js +0 -5
- package/dist/prod/locales/ca-ES-6MX7JW3Y.js +0 -8
- package/dist/prod/locales/cs-CZ-2BRQDIVT.js +0 -11
- package/dist/prod/locales/da-DK-5WZEPLOC.js +0 -5
- package/dist/prod/locales/de-DE-XR44H4JA.js +0 -8
- package/dist/prod/locales/el-GR-BZB4AONW.js +0 -10
- package/dist/prod/locales/en-TYY6KWIJ.js +0 -1
- package/dist/prod/locales/es-ES-U4NZUMDT.js +0 -9
- package/dist/prod/locales/eu-ES-A7QVB2H4.js +0 -11
- package/dist/prod/locales/fa-IR-HGAKTJCU.js +0 -8
- package/dist/prod/locales/fi-FI-Z5N7JZ37.js +0 -6
- package/dist/prod/locales/fr-FR-RHASNOE6.js +0 -9
- package/dist/prod/locales/gl-ES-HMX3MZ6V.js +0 -10
- package/dist/prod/locales/he-IL-6SHJWFNN.js +0 -10
- package/dist/prod/locales/hi-IN-IWLTKZ5I.js +0 -4
- package/dist/prod/locales/hu-HU-A5ZG7DT2.js +0 -7
- package/dist/prod/locales/id-ID-SAP4L64H.js +0 -10
- package/dist/prod/locales/it-IT-JPQ66NNP.js +0 -11
- package/dist/prod/locales/ja-JP-DBVTYXUO.js +0 -8
- package/dist/prod/locales/kaa-6HZHGXH3.js +0 -1
- package/dist/prod/locales/kab-KAB-ZGHBKWFO.js +0 -8
- package/dist/prod/locales/kk-KZ-P5N5QNE5.js +0 -1
- package/dist/prod/locales/km-KH-HSX4SM5Z.js +0 -11
- package/dist/prod/locales/ko-KR-MTYHY66A.js +0 -9
- package/dist/prod/locales/ku-TR-6OUDTVRD.js +0 -9
- package/dist/prod/locales/lt-LT-XHIRWOB4.js +0 -3
- package/dist/prod/locales/lv-LV-5QDEKY6T.js +0 -7
- package/dist/prod/locales/mr-IN-CRQNXWMA.js +0 -13
- package/dist/prod/locales/my-MM-5M5IBNSE.js +0 -1
- package/dist/prod/locales/nb-NO-T6EIAALU.js +0 -10
- package/dist/prod/locales/nl-NL-IS3SIHDZ.js +0 -8
- package/dist/prod/locales/nn-NO-6E72VCQL.js +0 -8
- package/dist/prod/locales/oc-FR-POXYY2M6.js +0 -8
- package/dist/prod/locales/pa-IN-N4M65BXN.js +0 -4
- package/dist/prod/locales/percentages-BXMCSKIN.js +0 -1
- package/dist/prod/locales/pl-PL-T2D74RX3.js +0 -9
- package/dist/prod/locales/pt-BR-5N22H2LF.js +0 -9
- package/dist/prod/locales/pt-PT-UZXXM6DQ.js +0 -9
- package/dist/prod/locales/ro-RO-JPDTUUEW.js +0 -11
- package/dist/prod/locales/ru-RU-B4JR7IUQ.js +0 -9
- package/dist/prod/locales/si-LK-N5RQ5JYF.js +0 -1
- package/dist/prod/locales/sk-SK-C5VTKIMK.js +0 -6
- package/dist/prod/locales/sl-SI-NN7IZMDC.js +0 -6
- package/dist/prod/locales/sv-SE-XGPEYMSR.js +0 -10
- package/dist/prod/locales/ta-IN-2NMHFXQM.js +0 -9
- package/dist/prod/locales/th-TH-HPSO5L25.js +0 -2
- package/dist/prod/locales/tr-TR-DEFEU3FU.js +0 -7
- package/dist/prod/locales/uk-UA-QMV73CPH.js +0 -6
- package/dist/prod/locales/vi-VN-M7AON7JQ.js +0 -5
- package/dist/prod/locales/zh-CN-LNUGB5OW.js +0 -10
- package/dist/prod/locales/zh-HK-E62DVLB3.js +0 -1
- package/dist/prod/locales/zh-TW-RAJ6MFWO.js +0 -9
- /package/dist/dev/data/{image-SURZSZNX.js.map → image-S2GFZH7W.js.map} +0 -0
- /package/dist/dev/locales/{en-SMAPCEOQ.js.map → en-MLZIHOCR.js.map} +0 -0
- /package/dist/dev/locales/{percentages-YKFLWNK2.js.map → percentages-TR7IWPFY.js.map} +0 -0
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
bytesToHexString,
|
|
20
20
|
isPromiseLike
|
|
21
21
|
} from "@excalidraw/common";
|
|
22
|
-
import { clearElementsForExport as clearElementsForExport2 } from "@excalidraw/element";
|
|
23
22
|
|
|
24
23
|
// appState.ts
|
|
25
24
|
import {
|
|
@@ -63,7 +62,6 @@ var getDefaultAppState = () => {
|
|
|
63
62
|
newElement: null,
|
|
64
63
|
editingTextElement: null,
|
|
65
64
|
editingGroupId: null,
|
|
66
|
-
editingLinearElement: null,
|
|
67
65
|
activeTool: {
|
|
68
66
|
type: "selection",
|
|
69
67
|
customType: null,
|
|
@@ -71,6 +69,10 @@ var getDefaultAppState = () => {
|
|
|
71
69
|
fromSelection: false,
|
|
72
70
|
lastActiveTool: null
|
|
73
71
|
},
|
|
72
|
+
preferredSelectionTool: {
|
|
73
|
+
type: "selection",
|
|
74
|
+
initialized: false
|
|
75
|
+
},
|
|
74
76
|
penMode: false,
|
|
75
77
|
penDetected: false,
|
|
76
78
|
errorMessage: null,
|
|
@@ -112,7 +114,7 @@ var getDefaultAppState = () => {
|
|
|
112
114
|
panels: STATS_PANELS.generalStats | STATS_PANELS.elementProperties
|
|
113
115
|
},
|
|
114
116
|
startBoundElement: null,
|
|
115
|
-
|
|
117
|
+
suggestedBinding: null,
|
|
116
118
|
frameRendering: { enabled: true, clip: true, name: true, outline: true },
|
|
117
119
|
frameToHighlight: null,
|
|
118
120
|
editingFrame: null,
|
|
@@ -138,7 +140,8 @@ var getDefaultAppState = () => {
|
|
|
138
140
|
croppingElementId: null,
|
|
139
141
|
searchMatches: null,
|
|
140
142
|
lockedMultiSelections: {},
|
|
141
|
-
activeLockedId: null
|
|
143
|
+
activeLockedId: null,
|
|
144
|
+
bindMode: "orbit"
|
|
142
145
|
};
|
|
143
146
|
};
|
|
144
147
|
var APP_STATE_STORAGE_CONF = /* @__PURE__ */ ((config) => config)({
|
|
@@ -174,8 +177,8 @@ var APP_STATE_STORAGE_CONF = /* @__PURE__ */ ((config) => config)({
|
|
|
174
177
|
newElement: { browser: false, export: false, server: false },
|
|
175
178
|
editingTextElement: { browser: false, export: false, server: false },
|
|
176
179
|
editingGroupId: { browser: true, export: false, server: false },
|
|
177
|
-
editingLinearElement: { browser: false, export: false, server: false },
|
|
178
180
|
activeTool: { browser: true, export: false, server: false },
|
|
181
|
+
preferredSelectionTool: { browser: true, export: false, server: false },
|
|
179
182
|
penMode: { browser: true, export: false, server: false },
|
|
180
183
|
penDetected: { browser: true, export: false, server: false },
|
|
181
184
|
errorMessage: { browser: false, export: false, server: false },
|
|
@@ -225,7 +228,7 @@ var APP_STATE_STORAGE_CONF = /* @__PURE__ */ ((config) => config)({
|
|
|
225
228
|
shouldCacheIgnoreZoom: { browser: true, export: false, server: false },
|
|
226
229
|
stats: { browser: true, export: false, server: false },
|
|
227
230
|
startBoundElement: { browser: false, export: false, server: false },
|
|
228
|
-
|
|
231
|
+
suggestedBinding: { browser: false, export: false, server: false },
|
|
229
232
|
frameRendering: { browser: false, export: false, server: false },
|
|
230
233
|
frameToHighlight: { browser: false, export: false, server: false },
|
|
231
234
|
editingFrame: { browser: false, export: false, server: false },
|
|
@@ -247,7 +250,8 @@ var APP_STATE_STORAGE_CONF = /* @__PURE__ */ ((config) => config)({
|
|
|
247
250
|
croppingElementId: { browser: false, export: false, server: false },
|
|
248
251
|
searchMatches: { browser: false, export: false, server: false },
|
|
249
252
|
lockedMultiSelections: { browser: true, export: true, server: true },
|
|
250
|
-
activeLockedId: { browser: false, export: false, server: false }
|
|
253
|
+
activeLockedId: { browser: false, export: false, server: false },
|
|
254
|
+
bindMode: { browser: true, export: false, server: false }
|
|
251
255
|
});
|
|
252
256
|
var _clearAppStateForStorage = (appState, exportType) => {
|
|
253
257
|
const stateForExport = {};
|
|
@@ -519,10 +523,6 @@ import {
|
|
|
519
523
|
MIME_TYPES as MIME_TYPES2,
|
|
520
524
|
VERSIONS
|
|
521
525
|
} from "@excalidraw/common";
|
|
522
|
-
import {
|
|
523
|
-
clearElementsForDatabase,
|
|
524
|
-
clearElementsForExport
|
|
525
|
-
} from "@excalidraw/element";
|
|
526
526
|
|
|
527
527
|
// data/filesystem.ts
|
|
528
528
|
import {
|
|
@@ -531,8 +531,8 @@ import {
|
|
|
531
531
|
supported as nativeFileSystemSupported
|
|
532
532
|
} from "browser-fs-access";
|
|
533
533
|
import { EVENT, MIME_TYPES, debounce } from "@excalidraw/common";
|
|
534
|
-
var INPUT_CHANGE_INTERVAL_MS =
|
|
535
|
-
var fileOpen = (opts) => {
|
|
534
|
+
var INPUT_CHANGE_INTERVAL_MS = 5e3;
|
|
535
|
+
var fileOpen = async (opts) => {
|
|
536
536
|
const mimeTypes = opts.extensions?.reduce((mimeTypes2, type) => {
|
|
537
537
|
mimeTypes2.push(MIME_TYPES[type]);
|
|
538
538
|
return mimeTypes2;
|
|
@@ -543,7 +543,7 @@ var fileOpen = (opts) => {
|
|
|
543
543
|
}
|
|
544
544
|
return acc.concat(`.${ext}`);
|
|
545
545
|
}, []);
|
|
546
|
-
|
|
546
|
+
const files = await _fileOpen({
|
|
547
547
|
description: opts.description,
|
|
548
548
|
extensions,
|
|
549
549
|
mimeTypes,
|
|
@@ -581,6 +581,12 @@ var fileOpen = (opts) => {
|
|
|
581
581
|
};
|
|
582
582
|
}
|
|
583
583
|
});
|
|
584
|
+
if (Array.isArray(files)) {
|
|
585
|
+
return await Promise.all(
|
|
586
|
+
files.map((file) => normalizeFile(file))
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
return await normalizeFile(files);
|
|
584
590
|
};
|
|
585
591
|
var fileSave = (blob, opts) => {
|
|
586
592
|
return _fileSave(
|
|
@@ -610,7 +616,7 @@ var serializeAsJSON = (elements, appState, files, type) => {
|
|
|
610
616
|
type: EXPORT_DATA_TYPES.excalidraw,
|
|
611
617
|
version: VERSIONS.excalidraw,
|
|
612
618
|
source: getExportSource(),
|
|
613
|
-
elements
|
|
619
|
+
elements,
|
|
614
620
|
appState: type === "local" ? cleanAppStateForExport(appState) : clearAppStateForDatabase(appState),
|
|
615
621
|
files: type === "local" ? filterOutDeletedFiles(elements, files) : (
|
|
616
622
|
// will be stripped from JSON
|
|
@@ -639,12 +645,7 @@ var loadFromJSON = async (localAppState, localElements) => {
|
|
|
639
645
|
// gets resolved. Else, iOS users cannot open `.excalidraw` files.
|
|
640
646
|
// extensions: ["json", "excalidraw", "png", "svg"],
|
|
641
647
|
});
|
|
642
|
-
return loadFromBlob(
|
|
643
|
-
await normalizeFile(file),
|
|
644
|
-
localAppState,
|
|
645
|
-
localElements,
|
|
646
|
-
file.handle
|
|
647
|
-
);
|
|
648
|
+
return loadFromBlob(file, localAppState, localElements, file.handle);
|
|
648
649
|
};
|
|
649
650
|
var isValidExcalidrawData = (data) => {
|
|
650
651
|
return data?.type === EXPORT_DATA_TYPES.excalidraw && (!data.elements || Array.isArray(data.elements) && (!data.appState || typeof data.appState === "object"));
|
|
@@ -3150,18 +3151,6 @@ var isPointHittingLink = (element, elementsMap, appState, [x, y], isMobile) => {
|
|
|
3150
3151
|
|
|
3151
3152
|
// renderer/helpers.ts
|
|
3152
3153
|
import { THEME as THEME2, THEME_FILTER } from "@excalidraw/common";
|
|
3153
|
-
import { FIXED_BINDING_DISTANCE } from "@excalidraw/element";
|
|
3154
|
-
import { getDiamondPoints } from "@excalidraw/element";
|
|
3155
|
-
import { elementCenterPoint, getCornerRadius } from "@excalidraw/element";
|
|
3156
|
-
import {
|
|
3157
|
-
curve,
|
|
3158
|
-
curveCatmullRomCubicApproxPoints,
|
|
3159
|
-
curveCatmullRomQuadraticApproxPoints,
|
|
3160
|
-
curveOffsetPoints,
|
|
3161
|
-
offsetPointsForQuadraticBezier,
|
|
3162
|
-
pointFrom as pointFrom2,
|
|
3163
|
-
pointRotateRads as pointRotateRads2
|
|
3164
|
-
} from "@excalidraw/math";
|
|
3165
3154
|
var fillCircle = (context, cx, cy, radius, stroke, fill = true) => {
|
|
3166
3155
|
context.beginPath();
|
|
3167
3156
|
context.arc(cx, cy, radius, 0, Math.PI * 2);
|
|
@@ -3206,127 +3195,7 @@ var bootstrapCanvas = ({
|
|
|
3206
3195
|
}
|
|
3207
3196
|
return context;
|
|
3208
3197
|
};
|
|
3209
|
-
|
|
3210
|
-
const pointSets = curveCatmullRomQuadraticApproxPoints(points, tension);
|
|
3211
|
-
if (pointSets) {
|
|
3212
|
-
for (let i = 0; i < pointSets.length - 1; i++) {
|
|
3213
|
-
const [[cpX, cpY], [p2X, p2Y]] = pointSets[i];
|
|
3214
|
-
ctx.quadraticCurveTo(cpX, cpY, p2X, p2Y);
|
|
3215
|
-
}
|
|
3216
|
-
}
|
|
3217
|
-
}
|
|
3218
|
-
function drawCatmullRomCubicApprox(ctx, points, tension = 0.5) {
|
|
3219
|
-
const pointSets = curveCatmullRomCubicApproxPoints(points, tension);
|
|
3220
|
-
if (pointSets) {
|
|
3221
|
-
for (let i = 0; i < pointSets.length; i++) {
|
|
3222
|
-
const [[cp1x, cp1y], [cp2x, cp2y], [x, y]] = pointSets[i];
|
|
3223
|
-
ctx.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
|
|
3224
|
-
}
|
|
3225
|
-
}
|
|
3226
|
-
}
|
|
3227
|
-
var drawHighlightForRectWithRotation = (context, element, elementsMap, padding) => {
|
|
3228
|
-
const [x, y] = pointRotateRads2(
|
|
3229
|
-
pointFrom2(element.x, element.y),
|
|
3230
|
-
elementCenterPoint(element, elementsMap),
|
|
3231
|
-
element.angle
|
|
3232
|
-
);
|
|
3233
|
-
context.save();
|
|
3234
|
-
context.translate(x, y);
|
|
3235
|
-
context.rotate(element.angle);
|
|
3236
|
-
let radius = getCornerRadius(
|
|
3237
|
-
Math.min(element.width, element.height),
|
|
3238
|
-
element
|
|
3239
|
-
);
|
|
3240
|
-
if (radius === 0) {
|
|
3241
|
-
radius = 0.01;
|
|
3242
|
-
}
|
|
3243
|
-
context.beginPath();
|
|
3244
|
-
{
|
|
3245
|
-
const topLeftApprox = offsetPointsForQuadraticBezier(
|
|
3246
|
-
pointFrom2(0, 0 + radius),
|
|
3247
|
-
pointFrom2(0, 0),
|
|
3248
|
-
pointFrom2(0 + radius, 0),
|
|
3249
|
-
padding
|
|
3250
|
-
);
|
|
3251
|
-
const topRightApprox = offsetPointsForQuadraticBezier(
|
|
3252
|
-
pointFrom2(element.width - radius, 0),
|
|
3253
|
-
pointFrom2(element.width, 0),
|
|
3254
|
-
pointFrom2(element.width, radius),
|
|
3255
|
-
padding
|
|
3256
|
-
);
|
|
3257
|
-
const bottomRightApprox = offsetPointsForQuadraticBezier(
|
|
3258
|
-
pointFrom2(element.width, element.height - radius),
|
|
3259
|
-
pointFrom2(element.width, element.height),
|
|
3260
|
-
pointFrom2(element.width - radius, element.height),
|
|
3261
|
-
padding
|
|
3262
|
-
);
|
|
3263
|
-
const bottomLeftApprox = offsetPointsForQuadraticBezier(
|
|
3264
|
-
pointFrom2(radius, element.height),
|
|
3265
|
-
pointFrom2(0, element.height),
|
|
3266
|
-
pointFrom2(0, element.height - radius),
|
|
3267
|
-
padding
|
|
3268
|
-
);
|
|
3269
|
-
context.moveTo(
|
|
3270
|
-
topLeftApprox[topLeftApprox.length - 1][0],
|
|
3271
|
-
topLeftApprox[topLeftApprox.length - 1][1]
|
|
3272
|
-
);
|
|
3273
|
-
context.lineTo(topRightApprox[0][0], topRightApprox[0][1]);
|
|
3274
|
-
drawCatmullRomQuadraticApprox(context, topRightApprox);
|
|
3275
|
-
context.lineTo(bottomRightApprox[0][0], bottomRightApprox[0][1]);
|
|
3276
|
-
drawCatmullRomQuadraticApprox(context, bottomRightApprox);
|
|
3277
|
-
context.lineTo(bottomLeftApprox[0][0], bottomLeftApprox[0][1]);
|
|
3278
|
-
drawCatmullRomQuadraticApprox(context, bottomLeftApprox);
|
|
3279
|
-
context.lineTo(topLeftApprox[0][0], topLeftApprox[0][1]);
|
|
3280
|
-
drawCatmullRomQuadraticApprox(context, topLeftApprox);
|
|
3281
|
-
}
|
|
3282
|
-
{
|
|
3283
|
-
const topLeftApprox = offsetPointsForQuadraticBezier(
|
|
3284
|
-
pointFrom2(0 + radius, 0),
|
|
3285
|
-
pointFrom2(0, 0),
|
|
3286
|
-
pointFrom2(0, 0 + radius),
|
|
3287
|
-
-FIXED_BINDING_DISTANCE
|
|
3288
|
-
);
|
|
3289
|
-
const topRightApprox = offsetPointsForQuadraticBezier(
|
|
3290
|
-
pointFrom2(element.width, radius),
|
|
3291
|
-
pointFrom2(element.width, 0),
|
|
3292
|
-
pointFrom2(element.width - radius, 0),
|
|
3293
|
-
-FIXED_BINDING_DISTANCE
|
|
3294
|
-
);
|
|
3295
|
-
const bottomRightApprox = offsetPointsForQuadraticBezier(
|
|
3296
|
-
pointFrom2(element.width - radius, element.height),
|
|
3297
|
-
pointFrom2(element.width, element.height),
|
|
3298
|
-
pointFrom2(element.width, element.height - radius),
|
|
3299
|
-
-FIXED_BINDING_DISTANCE
|
|
3300
|
-
);
|
|
3301
|
-
const bottomLeftApprox = offsetPointsForQuadraticBezier(
|
|
3302
|
-
pointFrom2(0, element.height - radius),
|
|
3303
|
-
pointFrom2(0, element.height),
|
|
3304
|
-
pointFrom2(radius, element.height),
|
|
3305
|
-
-FIXED_BINDING_DISTANCE
|
|
3306
|
-
);
|
|
3307
|
-
context.moveTo(
|
|
3308
|
-
topLeftApprox[topLeftApprox.length - 1][0],
|
|
3309
|
-
topLeftApprox[topLeftApprox.length - 1][1]
|
|
3310
|
-
);
|
|
3311
|
-
context.lineTo(bottomLeftApprox[0][0], bottomLeftApprox[0][1]);
|
|
3312
|
-
drawCatmullRomQuadraticApprox(context, bottomLeftApprox);
|
|
3313
|
-
context.lineTo(bottomRightApprox[0][0], bottomRightApprox[0][1]);
|
|
3314
|
-
drawCatmullRomQuadraticApprox(context, bottomRightApprox);
|
|
3315
|
-
context.lineTo(topRightApprox[0][0], topRightApprox[0][1]);
|
|
3316
|
-
drawCatmullRomQuadraticApprox(context, topRightApprox);
|
|
3317
|
-
context.lineTo(topLeftApprox[0][0], topLeftApprox[0][1]);
|
|
3318
|
-
drawCatmullRomQuadraticApprox(context, topLeftApprox);
|
|
3319
|
-
}
|
|
3320
|
-
context.closePath();
|
|
3321
|
-
context.fill();
|
|
3322
|
-
context.restore();
|
|
3323
|
-
};
|
|
3324
|
-
var strokeEllipseWithRotation = (context, width, height, cx, cy, angle) => {
|
|
3325
|
-
context.beginPath();
|
|
3326
|
-
context.ellipse(cx, cy, width / 2, height / 2, angle, 0, Math.PI * 2);
|
|
3327
|
-
context.stroke();
|
|
3328
|
-
};
|
|
3329
|
-
var strokeRectWithRotation = (context, x, y, width, height, cx, cy, angle, fill = false, radius = 0) => {
|
|
3198
|
+
var strokeRectWithRotation_simple = (context, x, y, width, height, cx, cy, angle, fill = false, radius = 0) => {
|
|
3330
3199
|
context.save();
|
|
3331
3200
|
context.translate(cx, cy);
|
|
3332
3201
|
context.rotate(angle);
|
|
@@ -3343,126 +3212,6 @@ var strokeRectWithRotation = (context, x, y, width, height, cx, cy, angle, fill
|
|
|
3343
3212
|
}
|
|
3344
3213
|
context.restore();
|
|
3345
3214
|
};
|
|
3346
|
-
var drawHighlightForDiamondWithRotation = (context, padding, element, elementsMap) => {
|
|
3347
|
-
const [x, y] = pointRotateRads2(
|
|
3348
|
-
pointFrom2(element.x, element.y),
|
|
3349
|
-
elementCenterPoint(element, elementsMap),
|
|
3350
|
-
element.angle
|
|
3351
|
-
);
|
|
3352
|
-
context.save();
|
|
3353
|
-
context.translate(x, y);
|
|
3354
|
-
context.rotate(element.angle);
|
|
3355
|
-
{
|
|
3356
|
-
context.beginPath();
|
|
3357
|
-
const [topX, topY, rightX, rightY, bottomX, bottomY, leftX, leftY] = getDiamondPoints(element);
|
|
3358
|
-
const verticalRadius = element.roundness ? getCornerRadius(Math.abs(topX - leftX), element) : (topX - leftX) * 0.01;
|
|
3359
|
-
const horizontalRadius = element.roundness ? getCornerRadius(Math.abs(rightY - topY), element) : (rightY - topY) * 0.01;
|
|
3360
|
-
const topApprox = curveOffsetPoints(
|
|
3361
|
-
curve(
|
|
3362
|
-
pointFrom2(topX - verticalRadius, topY + horizontalRadius),
|
|
3363
|
-
pointFrom2(topX, topY),
|
|
3364
|
-
pointFrom2(topX, topY),
|
|
3365
|
-
pointFrom2(topX + verticalRadius, topY + horizontalRadius)
|
|
3366
|
-
),
|
|
3367
|
-
padding
|
|
3368
|
-
);
|
|
3369
|
-
const rightApprox = curveOffsetPoints(
|
|
3370
|
-
curve(
|
|
3371
|
-
pointFrom2(rightX - verticalRadius, rightY - horizontalRadius),
|
|
3372
|
-
pointFrom2(rightX, rightY),
|
|
3373
|
-
pointFrom2(rightX, rightY),
|
|
3374
|
-
pointFrom2(rightX - verticalRadius, rightY + horizontalRadius)
|
|
3375
|
-
),
|
|
3376
|
-
padding
|
|
3377
|
-
);
|
|
3378
|
-
const bottomApprox = curveOffsetPoints(
|
|
3379
|
-
curve(
|
|
3380
|
-
pointFrom2(bottomX + verticalRadius, bottomY - horizontalRadius),
|
|
3381
|
-
pointFrom2(bottomX, bottomY),
|
|
3382
|
-
pointFrom2(bottomX, bottomY),
|
|
3383
|
-
pointFrom2(bottomX - verticalRadius, bottomY - horizontalRadius)
|
|
3384
|
-
),
|
|
3385
|
-
padding
|
|
3386
|
-
);
|
|
3387
|
-
const leftApprox = curveOffsetPoints(
|
|
3388
|
-
curve(
|
|
3389
|
-
pointFrom2(leftX + verticalRadius, leftY + horizontalRadius),
|
|
3390
|
-
pointFrom2(leftX, leftY),
|
|
3391
|
-
pointFrom2(leftX, leftY),
|
|
3392
|
-
pointFrom2(leftX + verticalRadius, leftY - horizontalRadius)
|
|
3393
|
-
),
|
|
3394
|
-
padding
|
|
3395
|
-
);
|
|
3396
|
-
context.moveTo(
|
|
3397
|
-
topApprox[topApprox.length - 1][0],
|
|
3398
|
-
topApprox[topApprox.length - 1][1]
|
|
3399
|
-
);
|
|
3400
|
-
context.lineTo(rightApprox[1][0], rightApprox[1][1]);
|
|
3401
|
-
drawCatmullRomCubicApprox(context, rightApprox);
|
|
3402
|
-
context.lineTo(bottomApprox[1][0], bottomApprox[1][1]);
|
|
3403
|
-
drawCatmullRomCubicApprox(context, bottomApprox);
|
|
3404
|
-
context.lineTo(leftApprox[1][0], leftApprox[1][1]);
|
|
3405
|
-
drawCatmullRomCubicApprox(context, leftApprox);
|
|
3406
|
-
context.lineTo(topApprox[1][0], topApprox[1][1]);
|
|
3407
|
-
drawCatmullRomCubicApprox(context, topApprox);
|
|
3408
|
-
}
|
|
3409
|
-
{
|
|
3410
|
-
const [topX, topY, rightX, rightY, bottomX, bottomY, leftX, leftY] = getDiamondPoints(element);
|
|
3411
|
-
const verticalRadius = element.roundness ? getCornerRadius(Math.abs(topX - leftX), element) : (topX - leftX) * 0.01;
|
|
3412
|
-
const horizontalRadius = element.roundness ? getCornerRadius(Math.abs(rightY - topY), element) : (rightY - topY) * 0.01;
|
|
3413
|
-
const topApprox = curveOffsetPoints(
|
|
3414
|
-
curve(
|
|
3415
|
-
pointFrom2(topX + verticalRadius, topY + horizontalRadius),
|
|
3416
|
-
pointFrom2(topX, topY),
|
|
3417
|
-
pointFrom2(topX, topY),
|
|
3418
|
-
pointFrom2(topX - verticalRadius, topY + horizontalRadius)
|
|
3419
|
-
),
|
|
3420
|
-
-FIXED_BINDING_DISTANCE
|
|
3421
|
-
);
|
|
3422
|
-
const rightApprox = curveOffsetPoints(
|
|
3423
|
-
curve(
|
|
3424
|
-
pointFrom2(rightX - verticalRadius, rightY + horizontalRadius),
|
|
3425
|
-
pointFrom2(rightX, rightY),
|
|
3426
|
-
pointFrom2(rightX, rightY),
|
|
3427
|
-
pointFrom2(rightX - verticalRadius, rightY - horizontalRadius)
|
|
3428
|
-
),
|
|
3429
|
-
-FIXED_BINDING_DISTANCE
|
|
3430
|
-
);
|
|
3431
|
-
const bottomApprox = curveOffsetPoints(
|
|
3432
|
-
curve(
|
|
3433
|
-
pointFrom2(bottomX - verticalRadius, bottomY - horizontalRadius),
|
|
3434
|
-
pointFrom2(bottomX, bottomY),
|
|
3435
|
-
pointFrom2(bottomX, bottomY),
|
|
3436
|
-
pointFrom2(bottomX + verticalRadius, bottomY - horizontalRadius)
|
|
3437
|
-
),
|
|
3438
|
-
-FIXED_BINDING_DISTANCE
|
|
3439
|
-
);
|
|
3440
|
-
const leftApprox = curveOffsetPoints(
|
|
3441
|
-
curve(
|
|
3442
|
-
pointFrom2(leftX + verticalRadius, leftY - horizontalRadius),
|
|
3443
|
-
pointFrom2(leftX, leftY),
|
|
3444
|
-
pointFrom2(leftX, leftY),
|
|
3445
|
-
pointFrom2(leftX + verticalRadius, leftY + horizontalRadius)
|
|
3446
|
-
),
|
|
3447
|
-
-FIXED_BINDING_DISTANCE
|
|
3448
|
-
);
|
|
3449
|
-
context.moveTo(
|
|
3450
|
-
topApprox[topApprox.length - 1][0],
|
|
3451
|
-
topApprox[topApprox.length - 1][1]
|
|
3452
|
-
);
|
|
3453
|
-
context.lineTo(leftApprox[1][0], leftApprox[1][1]);
|
|
3454
|
-
drawCatmullRomCubicApprox(context, leftApprox);
|
|
3455
|
-
context.lineTo(bottomApprox[1][0], bottomApprox[1][1]);
|
|
3456
|
-
drawCatmullRomCubicApprox(context, bottomApprox);
|
|
3457
|
-
context.lineTo(rightApprox[1][0], rightApprox[1][1]);
|
|
3458
|
-
drawCatmullRomCubicApprox(context, rightApprox);
|
|
3459
|
-
context.lineTo(topApprox[1][0], topApprox[1][1]);
|
|
3460
|
-
drawCatmullRomCubicApprox(context, topApprox);
|
|
3461
|
-
}
|
|
3462
|
-
context.closePath();
|
|
3463
|
-
context.fill();
|
|
3464
|
-
context.restore();
|
|
3465
|
-
};
|
|
3466
3215
|
|
|
3467
3216
|
// renderer/staticScene.ts
|
|
3468
3217
|
var GridLineColor = {
|
|
@@ -3806,7 +3555,7 @@ import {
|
|
|
3806
3555
|
isTextElement as isTextElement3
|
|
3807
3556
|
} from "@excalidraw/element";
|
|
3808
3557
|
import { getContainingFrame } from "@excalidraw/element";
|
|
3809
|
-
import { getCornerRadius
|
|
3558
|
+
import { getCornerRadius, isPathALoop } from "@excalidraw/element";
|
|
3810
3559
|
import { ShapeCache as ShapeCache2 } from "@excalidraw/element";
|
|
3811
3560
|
import { getFreeDrawSvgPath, IMAGE_INVERT_FILTER } from "@excalidraw/element";
|
|
3812
3561
|
import { getElementAbsoluteCoords as getElementAbsoluteCoords3 } from "@excalidraw/element";
|
|
@@ -3944,7 +3693,7 @@ var renderElementToSvg = (element, elementsMap, rsvg, svgRoot, files, offsetX, o
|
|
|
3944
3693
|
while (embeddableNode.firstChild) {
|
|
3945
3694
|
embeddableNode.removeChild(embeddableNode.firstChild);
|
|
3946
3695
|
}
|
|
3947
|
-
const radius =
|
|
3696
|
+
const radius = getCornerRadius(
|
|
3948
3697
|
Math.min(element.width, element.height),
|
|
3949
3698
|
element
|
|
3950
3699
|
);
|
|
@@ -4187,14 +3936,19 @@ var renderElementToSvg = (element, elementsMap, rsvg, svgRoot, files, offsetX, o
|
|
|
4187
3936
|
"clipPath"
|
|
4188
3937
|
);
|
|
4189
3938
|
clipPath.id = `image-clipPath-${element.id}`;
|
|
3939
|
+
clipPath.setAttribute("clipPathUnits", "userSpaceOnUse");
|
|
4190
3940
|
const clipRect = svgRoot.ownerDocument.createElementNS(
|
|
4191
3941
|
SVG_NS,
|
|
4192
3942
|
"rect"
|
|
4193
3943
|
);
|
|
4194
|
-
const radius =
|
|
3944
|
+
const radius = getCornerRadius(
|
|
4195
3945
|
Math.min(element.width, element.height),
|
|
4196
3946
|
element
|
|
4197
3947
|
);
|
|
3948
|
+
const clipOffsetX = element.crop ? normalizedCropX : 0;
|
|
3949
|
+
const clipOffsetY = element.crop ? normalizedCropY : 0;
|
|
3950
|
+
clipRect.setAttribute("x", `${clipOffsetX}`);
|
|
3951
|
+
clipRect.setAttribute("y", `${clipOffsetY}`);
|
|
4198
3952
|
clipRect.setAttribute("width", `${element.width}`);
|
|
4199
3953
|
clipRect.setAttribute("height", `${element.height}`);
|
|
4200
3954
|
clipRect.setAttribute("rx", `${radius}`);
|
|
@@ -4680,7 +4434,7 @@ var getExportSize = (elements, exportPadding, scale) => {
|
|
|
4680
4434
|
};
|
|
4681
4435
|
|
|
4682
4436
|
// data/restore.ts
|
|
4683
|
-
import { isFiniteNumber, pointFrom as
|
|
4437
|
+
import { isFiniteNumber, pointFrom as pointFrom2 } from "@excalidraw/math";
|
|
4684
4438
|
import {
|
|
4685
4439
|
DEFAULT_FONT_FAMILY as DEFAULT_FONT_FAMILY2,
|
|
4686
4440
|
DEFAULT_TEXT_ALIGN as DEFAULT_TEXT_ALIGN2,
|
|
@@ -4699,7 +4453,13 @@ import {
|
|
|
4699
4453
|
normalizeLink as normalizeLink2,
|
|
4700
4454
|
getLineHeight
|
|
4701
4455
|
} from "@excalidraw/common";
|
|
4702
|
-
import {
|
|
4456
|
+
import {
|
|
4457
|
+
calculateFixedPointForNonElbowArrowBinding,
|
|
4458
|
+
getNonDeletedElements,
|
|
4459
|
+
isPointInElement,
|
|
4460
|
+
isValidPolygon,
|
|
4461
|
+
projectFixedPointOntoDiagonal
|
|
4462
|
+
} from "@excalidraw/element";
|
|
4703
4463
|
import { normalizeFixedPoint } from "@excalidraw/element";
|
|
4704
4464
|
import {
|
|
4705
4465
|
updateElbowArrowPoints,
|
|
@@ -4713,7 +4473,6 @@ import {
|
|
|
4713
4473
|
isArrowBoundToElement,
|
|
4714
4474
|
isArrowElement as isArrowElement2,
|
|
4715
4475
|
isElbowArrow,
|
|
4716
|
-
isFixedPointBinding,
|
|
4717
4476
|
isLinearElement,
|
|
4718
4477
|
isLineElement,
|
|
4719
4478
|
isTextElement as isTextElement4,
|
|
@@ -4748,23 +4507,54 @@ var getFontFamilyByName = (fontFamilyName) => {
|
|
|
4748
4507
|
}
|
|
4749
4508
|
return DEFAULT_FONT_FAMILY2;
|
|
4750
4509
|
};
|
|
4751
|
-
var repairBinding = (element, binding) => {
|
|
4510
|
+
var repairBinding = (element, binding, elementsMap, startOrEnd) => {
|
|
4752
4511
|
if (!binding) {
|
|
4753
4512
|
return null;
|
|
4754
4513
|
}
|
|
4755
|
-
const focus = binding.focus || 0;
|
|
4756
4514
|
if (isElbowArrow(element)) {
|
|
4757
|
-
const fixedPointBinding =
|
|
4515
|
+
const fixedPointBinding = {
|
|
4758
4516
|
...binding,
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
}
|
|
4517
|
+
fixedPoint: normalizeFixedPoint(binding.fixedPoint ?? [0, 0]),
|
|
4518
|
+
mode: binding.mode || "orbit"
|
|
4519
|
+
};
|
|
4762
4520
|
return fixedPointBinding;
|
|
4763
4521
|
}
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4522
|
+
const boundElement = elementsMap.get(binding.elementId) || void 0;
|
|
4523
|
+
if (boundElement) {
|
|
4524
|
+
if (binding.mode) {
|
|
4525
|
+
return {
|
|
4526
|
+
elementId: binding.elementId,
|
|
4527
|
+
mode: binding.mode || "orbit",
|
|
4528
|
+
fixedPoint: normalizeFixedPoint(binding.fixedPoint || [0.5, 0.5])
|
|
4529
|
+
};
|
|
4530
|
+
}
|
|
4531
|
+
const p = LinearElementEditor2.getPointAtIndexGlobalCoordinates(
|
|
4532
|
+
element,
|
|
4533
|
+
startOrEnd === "start" ? 0 : element.points.length - 1,
|
|
4534
|
+
elementsMap
|
|
4535
|
+
);
|
|
4536
|
+
const mode = isPointInElement(p, boundElement, elementsMap) ? "inside" : "orbit";
|
|
4537
|
+
const focusPoint = mode === "inside" ? p : projectFixedPointOntoDiagonal(
|
|
4538
|
+
element,
|
|
4539
|
+
p,
|
|
4540
|
+
boundElement,
|
|
4541
|
+
startOrEnd,
|
|
4542
|
+
elementsMap
|
|
4543
|
+
) || p;
|
|
4544
|
+
const { fixedPoint } = calculateFixedPointForNonElbowArrowBinding(
|
|
4545
|
+
element,
|
|
4546
|
+
boundElement,
|
|
4547
|
+
startOrEnd,
|
|
4548
|
+
elementsMap,
|
|
4549
|
+
focusPoint
|
|
4550
|
+
);
|
|
4551
|
+
return {
|
|
4552
|
+
mode,
|
|
4553
|
+
elementId: binding.elementId,
|
|
4554
|
+
fixedPoint
|
|
4555
|
+
};
|
|
4556
|
+
}
|
|
4557
|
+
return null;
|
|
4768
4558
|
};
|
|
4769
4559
|
var restoreElementWithProperties = (element, extra) => {
|
|
4770
4560
|
const base = {
|
|
@@ -4817,7 +4607,7 @@ var restoreElementWithProperties = (element, extra) => {
|
|
|
4817
4607
|
delete ret.boundElementIds;
|
|
4818
4608
|
return ret;
|
|
4819
4609
|
};
|
|
4820
|
-
var restoreElement = (element) => {
|
|
4610
|
+
var restoreElement = (element, elementsMap, opts) => {
|
|
4821
4611
|
element = { ...element };
|
|
4822
4612
|
switch (element.type) {
|
|
4823
4613
|
case "text":
|
|
@@ -4849,7 +4639,7 @@ var restoreElement = (element) => {
|
|
|
4849
4639
|
autoResize: element.autoResize ?? true,
|
|
4850
4640
|
lineHeight
|
|
4851
4641
|
});
|
|
4852
|
-
if (!text && !element.isDeleted) {
|
|
4642
|
+
if (opts?.deleteInvisibleElements && !text && !element.isDeleted) {
|
|
4853
4643
|
element = { ...element, originalText: text, isDeleted: true };
|
|
4854
4644
|
element = bumpVersion(element);
|
|
4855
4645
|
}
|
|
@@ -4857,7 +4647,6 @@ var restoreElement = (element) => {
|
|
|
4857
4647
|
case "freedraw": {
|
|
4858
4648
|
return restoreElementWithProperties(element, {
|
|
4859
4649
|
points: element.points,
|
|
4860
|
-
lastCommittedPoint: null,
|
|
4861
4650
|
simulatePressure: element.simulatePressure,
|
|
4862
4651
|
pressures: element.pressures
|
|
4863
4652
|
});
|
|
@@ -4876,16 +4665,15 @@ var restoreElement = (element) => {
|
|
|
4876
4665
|
let y = element.y;
|
|
4877
4666
|
let points = (
|
|
4878
4667
|
// migrate old arrow model to new one
|
|
4879
|
-
!Array.isArray(element.points) || element.points.length < 2 ? [
|
|
4668
|
+
!Array.isArray(element.points) || element.points.length < 2 ? [pointFrom2(0, 0), pointFrom2(element.width, element.height)] : element.points
|
|
4880
4669
|
);
|
|
4881
4670
|
if (points[0][0] !== 0 || points[0][1] !== 0) {
|
|
4882
4671
|
({ points, x, y } = LinearElementEditor2.getNormalizeElementPointsAndCoords(element));
|
|
4883
4672
|
}
|
|
4884
4673
|
return restoreElementWithProperties(element, {
|
|
4885
|
-
type:
|
|
4886
|
-
startBinding:
|
|
4887
|
-
endBinding:
|
|
4888
|
-
lastCommittedPoint: null,
|
|
4674
|
+
type: "line",
|
|
4675
|
+
startBinding: null,
|
|
4676
|
+
endBinding: null,
|
|
4889
4677
|
startArrowhead,
|
|
4890
4678
|
endArrowhead,
|
|
4891
4679
|
points,
|
|
@@ -4898,20 +4686,26 @@ var restoreElement = (element) => {
|
|
|
4898
4686
|
});
|
|
4899
4687
|
case "arrow": {
|
|
4900
4688
|
const { startArrowhead: startArrowhead2 = null, endArrowhead: endArrowhead2 = "arrow" } = element;
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4689
|
+
const x2 = element.x;
|
|
4690
|
+
const y2 = element.y;
|
|
4691
|
+
const points2 = (
|
|
4904
4692
|
// migrate old arrow model to new one
|
|
4905
|
-
!Array.isArray(element.points) || element.points.length < 2 ? [
|
|
4693
|
+
!Array.isArray(element.points) || element.points.length < 2 ? [pointFrom2(0, 0), pointFrom2(element.width, element.height)] : element.points
|
|
4906
4694
|
);
|
|
4907
|
-
if (points2[0][0] !== 0 || points2[0][1] !== 0) {
|
|
4908
|
-
({ points: points2, x: x2, y: y2 } = LinearElementEditor2.getNormalizeElementPointsAndCoords(element));
|
|
4909
|
-
}
|
|
4910
4695
|
const base = {
|
|
4911
4696
|
type: element.type,
|
|
4912
|
-
startBinding: repairBinding(
|
|
4913
|
-
|
|
4914
|
-
|
|
4697
|
+
startBinding: repairBinding(
|
|
4698
|
+
element,
|
|
4699
|
+
element.startBinding,
|
|
4700
|
+
elementsMap,
|
|
4701
|
+
"start"
|
|
4702
|
+
),
|
|
4703
|
+
endBinding: repairBinding(
|
|
4704
|
+
element,
|
|
4705
|
+
element.endBinding,
|
|
4706
|
+
elementsMap,
|
|
4707
|
+
"end"
|
|
4708
|
+
),
|
|
4915
4709
|
startArrowhead: startArrowhead2,
|
|
4916
4710
|
endArrowhead: endArrowhead2,
|
|
4917
4711
|
points: points2,
|
|
@@ -4920,15 +4714,19 @@ var restoreElement = (element) => {
|
|
|
4920
4714
|
elbowed: element.elbowed,
|
|
4921
4715
|
...getSizeFromPoints(points2)
|
|
4922
4716
|
};
|
|
4923
|
-
|
|
4717
|
+
const restoredElement = isElbowArrow(element) ? restoreElementWithProperties(element, {
|
|
4924
4718
|
...base,
|
|
4925
4719
|
elbowed: true,
|
|
4926
|
-
|
|
4927
|
-
endBinding: repairBinding(element, element.endBinding),
|
|
4928
|
-
fixedSegments: element.fixedSegments,
|
|
4720
|
+
fixedSegments: element.fixedSegments?.length && base.points.length >= 4 ? element.fixedSegments : null,
|
|
4929
4721
|
startIsSpecial: element.startIsSpecial,
|
|
4930
4722
|
endIsSpecial: element.endIsSpecial
|
|
4931
4723
|
}) : restoreElementWithProperties(element, base);
|
|
4724
|
+
return {
|
|
4725
|
+
...restoredElement,
|
|
4726
|
+
...LinearElementEditor2.getNormalizeElementPointsAndCoords(
|
|
4727
|
+
restoredElement
|
|
4728
|
+
)
|
|
4729
|
+
};
|
|
4932
4730
|
}
|
|
4933
4731
|
case "ellipse":
|
|
4934
4732
|
case "rectangle":
|
|
@@ -4993,29 +4791,38 @@ var repairFrameMembership = (element, elementsMap) => {
|
|
|
4993
4791
|
}
|
|
4994
4792
|
}
|
|
4995
4793
|
};
|
|
4996
|
-
var restoreElements = (
|
|
4794
|
+
var restoreElements = (targetElements, localElements, opts) => {
|
|
4997
4795
|
const existingIds = /* @__PURE__ */ new Set();
|
|
4796
|
+
const elementsMap = arrayToMap2(targetElements || []);
|
|
4998
4797
|
const localElementsMap = localElements ? arrayToMap2(localElements) : null;
|
|
4999
4798
|
const restoredElements = syncInvalidIndices2(
|
|
5000
|
-
(
|
|
5001
|
-
if (element.type
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
4799
|
+
(targetElements || []).reduce((elements, element) => {
|
|
4800
|
+
if (element.type === "selection") {
|
|
4801
|
+
return elements;
|
|
4802
|
+
}
|
|
4803
|
+
let migratedElement = restoreElement(
|
|
4804
|
+
element,
|
|
4805
|
+
elementsMap,
|
|
4806
|
+
{
|
|
4807
|
+
deleteInvisibleElements: opts?.deleteInvisibleElements
|
|
4808
|
+
}
|
|
4809
|
+
);
|
|
4810
|
+
if (migratedElement) {
|
|
4811
|
+
const localElement = localElementsMap?.get(element.id);
|
|
4812
|
+
const shouldMarkAsDeleted = opts?.deleteInvisibleElements && isInvisiblySmallElement(element);
|
|
4813
|
+
if (shouldMarkAsDeleted || localElement && localElement.version > migratedElement.version) {
|
|
4814
|
+
migratedElement = bumpVersion(migratedElement, localElement?.version);
|
|
4815
|
+
}
|
|
4816
|
+
if (shouldMarkAsDeleted) {
|
|
4817
|
+
migratedElement = { ...migratedElement, isDeleted: true };
|
|
4818
|
+
}
|
|
4819
|
+
if (existingIds.has(migratedElement.id)) {
|
|
4820
|
+
migratedElement = { ...migratedElement, id: randomId() };
|
|
5016
4821
|
}
|
|
4822
|
+
existingIds.add(migratedElement.id);
|
|
4823
|
+
elements.push(migratedElement);
|
|
5017
4824
|
}
|
|
5018
|
-
return
|
|
4825
|
+
return elements;
|
|
5019
4826
|
}, [])
|
|
5020
4827
|
);
|
|
5021
4828
|
if (!opts?.repairBindings) {
|
|
@@ -5059,7 +4866,7 @@ var restoreElements = (elements, localElements, opts) => {
|
|
|
5059
4866
|
restoredElementsMap,
|
|
5060
4867
|
{
|
|
5061
4868
|
points: [
|
|
5062
|
-
|
|
4869
|
+
pointFrom2(0, 0),
|
|
5063
4870
|
element.points[element.points.length - 1]
|
|
5064
4871
|
]
|
|
5065
4872
|
}
|
|
@@ -5088,10 +4895,10 @@ var restoreElements = (elements, localElements, opts) => {
|
|
|
5088
4895
|
width: boundElement.width,
|
|
5089
4896
|
height: boundElement.height,
|
|
5090
4897
|
points: [
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
4898
|
+
pointFrom2(0, 0),
|
|
4899
|
+
pointFrom2(0, -10),
|
|
4900
|
+
pointFrom2(boundElement.width / 2 + 5, -10),
|
|
4901
|
+
pointFrom2(
|
|
5095
4902
|
boundElement.width / 2 + 5,
|
|
5096
4903
|
boundElement.height / 2 + 5
|
|
5097
4904
|
)
|
|
@@ -5217,7 +5024,7 @@ var parseFileContents = async (blob) => {
|
|
|
5217
5024
|
let contents;
|
|
5218
5025
|
if (blob.type === MIME_TYPES6.png) {
|
|
5219
5026
|
try {
|
|
5220
|
-
return await (await import("./data/image-
|
|
5027
|
+
return await (await import("./data/image-S2GFZH7W.js")).decodePngMetadata(blob);
|
|
5221
5028
|
} catch (error) {
|
|
5222
5029
|
if (error.message === "INVALID") {
|
|
5223
5030
|
throw new ImageSceneDataError(
|
|
@@ -5301,7 +5108,7 @@ var loadSceneOrLibraryFromBlob = async (blob, localAppState, localElements, file
|
|
|
5301
5108
|
type: MIME_TYPES6.excalidraw,
|
|
5302
5109
|
data: restore(
|
|
5303
5110
|
{
|
|
5304
|
-
elements:
|
|
5111
|
+
elements: data.elements || [],
|
|
5305
5112
|
appState: {
|
|
5306
5113
|
theme: localAppState?.theme,
|
|
5307
5114
|
fileHandle: fileHandle || blob.handle || null,
|
|
@@ -5312,7 +5119,11 @@ var loadSceneOrLibraryFromBlob = async (blob, localAppState, localElements, file
|
|
|
5312
5119
|
},
|
|
5313
5120
|
localAppState,
|
|
5314
5121
|
localElements,
|
|
5315
|
-
{
|
|
5122
|
+
{
|
|
5123
|
+
repairBindings: true,
|
|
5124
|
+
refreshDimensions: false,
|
|
5125
|
+
deleteInvisibleElements: true
|
|
5126
|
+
}
|
|
5316
5127
|
)
|
|
5317
5128
|
};
|
|
5318
5129
|
} else if (isValidLibrary(data)) {
|
|
@@ -5457,16 +5268,11 @@ var ImageURLToFile = async (imageUrl, filename = "") => {
|
|
|
5457
5268
|
}
|
|
5458
5269
|
throw new Error("Error: unsupported file type", { cause: "UNSUPPORTED" });
|
|
5459
5270
|
};
|
|
5460
|
-
var getFileFromEvent = async (event) => {
|
|
5461
|
-
const file = event.dataTransfer.files.item(0);
|
|
5462
|
-
const fileHandle = await getFileHandle(event);
|
|
5463
|
-
return { file: file ? await normalizeFile(file) : null, fileHandle };
|
|
5464
|
-
};
|
|
5465
5271
|
var getFileHandle = async (event) => {
|
|
5466
5272
|
if (nativeFileSystemSupported) {
|
|
5467
5273
|
try {
|
|
5468
|
-
const
|
|
5469
|
-
const handle = await
|
|
5274
|
+
const dataTransferItem = event instanceof DataTransferItem ? event : event.dataTransfer?.items?.[0];
|
|
5275
|
+
const handle = await dataTransferItem.getAsFileSystemHandle() || null;
|
|
5470
5276
|
return handle;
|
|
5471
5277
|
} catch (error) {
|
|
5472
5278
|
console.warn(error.name, error.message);
|
|
@@ -5475,61 +5281,52 @@ var getFileHandle = async (event) => {
|
|
|
5475
5281
|
}
|
|
5476
5282
|
return null;
|
|
5477
5283
|
};
|
|
5478
|
-
var getActualMimeTypeFromImage = (
|
|
5284
|
+
var getActualMimeTypeFromImage = async (file) => {
|
|
5479
5285
|
let mimeType = null;
|
|
5480
|
-
const
|
|
5481
|
-
|
|
5286
|
+
const leadingBytes = [
|
|
5287
|
+
...new Uint8Array(await blobToArrayBuffer(file.slice(0, 15)))
|
|
5288
|
+
].join(" ");
|
|
5289
|
+
const bytes = {
|
|
5482
5290
|
// https://en.wikipedia.org/wiki/Portable_Network_Graphics#File_header
|
|
5483
|
-
png:
|
|
5291
|
+
png: /^137 80 78 71 13 10 26 10\b/,
|
|
5484
5292
|
// https://en.wikipedia.org/wiki/JPEG#Syntax_and_structure
|
|
5485
5293
|
// jpg is a bit wonky. Checking the first three bytes should be enough,
|
|
5486
5294
|
// but may yield false positives. (https://stackoverflow.com/a/23360709/927631)
|
|
5487
|
-
jpg:
|
|
5295
|
+
jpg: /^255 216 255\b/,
|
|
5488
5296
|
// https://en.wikipedia.org/wiki/GIF#Example_GIF_file
|
|
5489
|
-
gif:
|
|
5297
|
+
gif: /^71 73 70 56 57 97\b/,
|
|
5298
|
+
// 4 bytes for RIFF + 4 bytes for chunk size + WEBP identifier
|
|
5299
|
+
webp: /^82 73 70 70 \d+ \d+ \d+ \d+ 87 69 66 80 86 80 56\b/
|
|
5490
5300
|
};
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
return mimeType;
|
|
5301
|
+
for (const type of Object.keys(bytes)) {
|
|
5302
|
+
if (leadingBytes.match(bytes[type])) {
|
|
5303
|
+
mimeType = MIME_TYPES6[type];
|
|
5304
|
+
break;
|
|
5305
|
+
}
|
|
5306
|
+
}
|
|
5307
|
+
return mimeType || file.type || null;
|
|
5499
5308
|
};
|
|
5500
5309
|
var createFile = (blob, mimeType, name) => {
|
|
5501
5310
|
return new File([blob], name || "", {
|
|
5502
5311
|
type: mimeType
|
|
5503
5312
|
});
|
|
5504
5313
|
};
|
|
5314
|
+
var normalizedFileSymbol = Symbol("fileNormalized");
|
|
5505
5315
|
var normalizeFile = async (file) => {
|
|
5506
|
-
if (
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
await blobToArrayBuffer(file),
|
|
5516
|
-
MIME_TYPES6.excalidraw,
|
|
5517
|
-
file.name
|
|
5518
|
-
);
|
|
5519
|
-
} else {
|
|
5520
|
-
const buffer = await blobToArrayBuffer(file);
|
|
5521
|
-
const mimeType = getActualMimeTypeFromImage(buffer);
|
|
5522
|
-
if (mimeType) {
|
|
5523
|
-
file = createFile(buffer, mimeType, file.name);
|
|
5524
|
-
}
|
|
5525
|
-
}
|
|
5526
|
-
} else if (isSupportedImageFile(file)) {
|
|
5527
|
-
const buffer = await blobToArrayBuffer(file);
|
|
5528
|
-
const mimeType = getActualMimeTypeFromImage(buffer);
|
|
5316
|
+
if (file[normalizedFileSymbol]) {
|
|
5317
|
+
return file;
|
|
5318
|
+
}
|
|
5319
|
+
if (file?.name?.endsWith(".excalidrawlib")) {
|
|
5320
|
+
file = createFile(file, MIME_TYPES6.excalidrawlib, file.name);
|
|
5321
|
+
} else if (file?.name?.endsWith(".excalidraw")) {
|
|
5322
|
+
file = createFile(file, MIME_TYPES6.excalidraw, file.name);
|
|
5323
|
+
} else if (!file.type || file.type?.startsWith("image/")) {
|
|
5324
|
+
const mimeType = await getActualMimeTypeFromImage(file);
|
|
5529
5325
|
if (mimeType && mimeType !== file.type) {
|
|
5530
|
-
file = createFile(
|
|
5326
|
+
file = createFile(file, mimeType, file.name);
|
|
5531
5327
|
}
|
|
5532
5328
|
}
|
|
5329
|
+
file[normalizedFileSymbol] = true;
|
|
5533
5330
|
return file;
|
|
5534
5331
|
};
|
|
5535
5332
|
var blobToArrayBuffer = (blob) => {
|
|
@@ -5629,15 +5426,14 @@ export {
|
|
|
5629
5426
|
fillCircle,
|
|
5630
5427
|
getNormalizedCanvasDimensions,
|
|
5631
5428
|
bootstrapCanvas,
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
strokeRectWithRotation,
|
|
5635
|
-
drawHighlightForDiamondWithRotation,
|
|
5429
|
+
strokeRectWithRotation_simple,
|
|
5430
|
+
frameClip,
|
|
5636
5431
|
renderStaticSceneThrottled,
|
|
5637
5432
|
renderStaticScene,
|
|
5638
5433
|
exportToCanvas,
|
|
5639
5434
|
exportToSvg,
|
|
5640
5435
|
getExportSize,
|
|
5436
|
+
restoreElement,
|
|
5641
5437
|
restoreElements,
|
|
5642
5438
|
restoreAppState,
|
|
5643
5439
|
restore,
|
|
@@ -5662,8 +5458,8 @@ export {
|
|
|
5662
5458
|
resizeImageFile,
|
|
5663
5459
|
SVGStringToFile,
|
|
5664
5460
|
ImageURLToFile,
|
|
5665
|
-
|
|
5461
|
+
getFileHandle,
|
|
5666
5462
|
createFile,
|
|
5667
5463
|
normalizeFile
|
|
5668
5464
|
};
|
|
5669
|
-
//# sourceMappingURL=chunk-
|
|
5465
|
+
//# sourceMappingURL=chunk-SJTAY27F.js.map
|