@excalidraw/excalidraw 0.18.0-9036812b6 → 0.18.0-9ba0f5d
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-FB2NA5UG.js → chunk-6JJSWC4C.js} +1 -1
- package/dist/dev/{chunk-FB2NA5UG.js.map → chunk-6JJSWC4C.js.map} +2 -2
- package/dist/dev/chunk-DJHLEOOZ.js +69 -0
- package/dist/dev/chunk-DJHLEOOZ.js.map +7 -0
- package/dist/dev/{chunk-QF5FRM6O.js → chunk-MNO2YU5M.js} +101 -27
- package/dist/dev/chunk-MNO2YU5M.js.map +7 -0
- package/dist/dev/{chunk-FRLWKCNE.js → chunk-PW6TXCLQ.js} +330 -476
- package/dist/dev/chunk-PW6TXCLQ.js.map +7 -0
- package/dist/dev/{chunk-CP5DND7P.js → chunk-Y3BTNZQY.js} +2 -2
- package/dist/dev/data/{image-T2LJEHDP.js → image-2BHUUSLM.js} +3 -3
- package/dist/dev/index.css +1900 -774
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +11938 -7867
- 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-ZRDYEPMS.js} +199 -41
- package/dist/dev/locales/de-DE-ZRDYEPMS.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-JRVQ7H6V.js} +8 -2
- package/dist/dev/locales/{es-ES-AQYVXC32.js → es-ES-VLQBB7FJ.js} +212 -54
- package/dist/dev/locales/es-ES-VLQBB7FJ.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-A72LKGCO.js} +203 -45
- package/dist/dev/locales/fr-FR-A72LKGCO.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-X34PIOJ2.js} +202 -44
- package/dist/dev/locales/it-IT-X34PIOJ2.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-XGZJ7V2V.js} +297 -139
- package/dist/dev/locales/nl-NL-XGZJ7V2V.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-OGWD7R2K.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-RWC6UWGY.js} +200 -42
- package/dist/dev/locales/sk-SK-RWC6UWGY.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-KBZAVWP5.js +744 -0
- package/dist/dev/locales/vi-VN-KBZAVWP5.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/dev/subset-shared.chunk.js +2 -2
- package/dist/dev/subset-worker.chunk.js +2 -2
- package/dist/prod/chunk-AJI3LATG.js +1 -0
- package/dist/prod/chunk-COMIBRVY.js +12 -0
- package/dist/prod/chunk-R7EP47KM.js +4 -0
- package/dist/prod/{chunk-LS7FJGPW.js → chunk-Z5NKEFVG.js} +8 -8
- package/dist/prod/data/{image-53OPA26C.js → image-WVUQOLPF.js} +1 -1
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +35 -25
- 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-G3JVZ4MQ.js +7 -0
- package/dist/prod/locales/el-GR-4AZTZGY6.js +7 -0
- package/dist/prod/locales/en-TSRAEZ4E.js +1 -0
- package/dist/prod/locales/es-ES-ART7BI3G.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-XEFNCM4I.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-GIGIGIBJ.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-R4C4SUIG.js +13 -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-OL6W367U.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-MC7UOHQO.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-K34TWHF7.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/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/common/src/bounds.d.ts +10 -0
- package/dist/types/common/src/colors.d.ts +59 -39
- package/dist/types/common/src/constants.d.ts +33 -26
- package/dist/types/common/src/editorInterface.d.ts +34 -0
- package/dist/types/common/src/font-metadata.d.ts +1 -3
- package/dist/types/common/src/index.d.ts +2 -0
- package/dist/types/common/src/keys.d.ts +1 -1
- package/dist/types/common/src/utility-types.d.ts +0 -1
- package/dist/types/common/src/utils.d.ts +49 -34
- package/dist/types/element/src/Scene.d.ts +9 -5
- package/dist/types/element/src/binding.d.ts +58 -44
- package/dist/types/element/src/bounds.d.ts +3 -11
- package/dist/types/element/src/collision.d.ts +6 -2
- package/dist/types/element/src/comparisons.d.ts +7 -7
- package/dist/types/element/src/delta.d.ts +6 -3
- package/dist/types/element/src/dragElements.d.ts +3 -3
- package/dist/types/element/src/duplicate.d.ts +3 -3
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +5 -1
- package/dist/types/element/src/heading.d.ts +2 -1
- package/dist/types/element/src/image.d.ts +1 -11
- package/dist/types/element/src/index.d.ts +2 -3
- package/dist/types/element/src/linearElementEditor.d.ts +16 -20
- package/dist/types/element/src/mutateElement.d.ts +3 -1
- package/dist/types/element/src/newElement.d.ts +6 -6
- package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
- package/dist/types/element/src/renderElement.d.ts +4 -7
- package/dist/types/element/src/resizeElements.d.ts +10 -10
- package/dist/types/element/src/resizeTest.d.ts +6 -5
- package/dist/types/element/src/selection.d.ts +3 -7
- package/dist/types/element/src/shape.d.ts +8 -7
- 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/textMeasurements.d.ts +1 -3
- package/dist/types/{excalidraw/data → element/src}/transform.d.ts +3 -3
- package/dist/types/element/src/transformHandles.d.ts +8 -27
- package/dist/types/element/src/typeChecks.d.ts +4 -7
- package/dist/types/element/src/types.d.ts +7 -11
- package/dist/types/element/src/utils.d.ts +5 -2
- package/dist/types/element/src/zindex.d.ts +7 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +93 -136
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -7
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +67 -96
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +402 -758
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +86 -856
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +32 -47
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +107 -156
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +28 -45
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +66 -95
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +33 -48
- package/dist/types/excalidraw/actions/actionExport.d.ts +144 -1104
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +10 -394
- package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionFrame.d.ts +213 -308
- package/dist/types/excalidraw/actions/actionGroup.d.ts +70 -107
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +123 -178
- package/dist/types/excalidraw/actions/actionLink.d.ts +30 -45
- package/dist/types/excalidraw/actions/actionMenu.d.ts +27 -410
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -359
- package/dist/types/excalidraw/actions/actionProperties.d.ts +129 -2488
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +35 -54
- package/dist/types/excalidraw/actions/actionStyles.d.ts +32 -47
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +32 -47
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +32 -47
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +25 -42
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +32 -47
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +32 -47
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +33 -48
- package/dist/types/excalidraw/actions/actionZindex.d.ts +2 -3
- package/dist/types/excalidraw/actions/index.d.ts +2 -2
- package/dist/types/excalidraw/actions/register.d.ts +2 -2
- package/dist/types/excalidraw/actions/types.d.ts +4 -4
- package/dist/types/excalidraw/appState.d.ts +12 -7
- package/dist/types/excalidraw/clipboard.d.ts +55 -16
- package/dist/types/excalidraw/components/Actions.d.ts +22 -5
- package/dist/types/excalidraw/components/App.d.ts +67 -65
- package/dist/types/excalidraw/components/ButtonIconCycle.d.ts +1 -1
- package/dist/types/excalidraw/components/Card.d.ts +1 -3
- package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -4
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +0 -1
- 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/ColorPicker/colorPickerUtils.d.ts +0 -1
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +0 -1
- package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
- package/dist/types/excalidraw/components/CommandPalette/types.d.ts +1 -3
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -2
- package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
- package/dist/types/excalidraw/components/DefaultSidebar.d.ts +9 -13
- package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/Ellipsify.d.ts +1 -2
- package/dist/types/excalidraw/components/ErrorDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +1 -2
- package/dist/types/excalidraw/components/EyeDropper.d.ts +0 -1
- package/dist/types/excalidraw/components/FilledButton.d.ts +2 -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/FontPicker/keyboardNavHandlers.d.ts +0 -1
- package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -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/LibraryMenuControlButtons.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -2
- package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryUnit.d.ts +2 -3
- package/dist/types/excalidraw/components/LinkButton.d.ts +4 -0
- package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -1
- package/dist/types/excalidraw/components/MobileMenu.d.ts +3 -5
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +10 -0
- package/dist/types/excalidraw/components/Modal.d.ts +0 -1
- package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +1 -1
- 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/RadioGroup.d.ts +0 -1
- package/dist/types/excalidraw/components/RadioSelection.d.ts +4 -4
- package/dist/types/excalidraw/components/ScrollableList.d.ts +0 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +15 -21
- package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +1 -2
- package/dist/types/excalidraw/components/Spinner.d.ts +4 -4
- package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/index.d.ts +7 -8
- package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatHistoryMenu.d.ts +15 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +27 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatMessage.d.ts +14 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +26 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/index.d.ts +3 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/useChatAgent.d.ts +8 -0
- package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +3 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +13 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +4 -25
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +2 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +13 -9
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +2 -3
- package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +9 -0
- package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +8 -0
- package/dist/types/excalidraw/components/TTDDialog/common.d.ts +16 -16
- package/dist/types/excalidraw/components/TTDDialog/hooks/useChatManagement.d.ts +13 -0
- package/dist/types/excalidraw/components/TTDDialog/hooks/useMermaidRenderer.d.ts +14 -0
- package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +7 -0
- package/dist/types/excalidraw/components/TTDDialog/types.d.ts +91 -0
- package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +22 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +24 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/chat.d.ts +10 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidValidation.d.ts +1 -0
- package/dist/types/excalidraw/components/TextField.d.ts +1 -0
- package/dist/types/excalidraw/components/Toast.d.ts +3 -3
- package/dist/types/excalidraw/components/ToolPopover.d.ts +25 -0
- package/dist/types/excalidraw/components/Trans.d.ts +2 -2
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +6 -3
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +30 -32
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +6 -5
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +3 -3
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +10 -18
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +3 -3
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +0 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +6 -6
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +3 -4
- package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +1 -1
- package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +1 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +1 -1
- package/dist/types/excalidraw/components/icons.d.ts +26 -12
- package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +4 -3
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +2 -2
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +25 -30
- package/dist/types/excalidraw/components/shapes.d.ts +129 -1
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +6 -6
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +15 -16
- package/dist/types/excalidraw/data/blob.d.ts +324 -10
- package/dist/types/excalidraw/data/encode.d.ts +4 -4
- package/dist/types/excalidraw/data/encryption.d.ts +5 -5
- package/dist/types/excalidraw/data/filesystem.d.ts +2 -2
- package/dist/types/excalidraw/data/index.d.ts +3 -3
- package/dist/types/excalidraw/data/json.d.ts +159 -2
- package/dist/types/excalidraw/data/library.d.ts +24 -9
- package/dist/types/excalidraw/data/restore.d.ts +27 -7
- package/dist/types/excalidraw/data/types.d.ts +4 -1
- package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
- package/dist/types/excalidraw/errors.d.ts +14 -0
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +4 -3
- package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -2
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
- package/dist/types/excalidraw/i18n.d.ts +2 -2
- package/dist/types/excalidraw/index.d.ts +6 -7
- package/dist/types/excalidraw/renderer/animation.d.ts +12 -0
- package/dist/types/excalidraw/renderer/helpers.d.ts +6 -8
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +8 -14
- package/dist/types/excalidraw/scene/Renderer.d.ts +5 -2
- package/dist/types/excalidraw/scene/export.d.ts +2 -2
- package/dist/types/excalidraw/scene/scroll.d.ts +1 -6
- package/dist/types/excalidraw/scene/types.d.ts +22 -5
- package/dist/types/excalidraw/shortcut.d.ts +1 -0
- package/dist/types/excalidraw/snapping.d.ts +5 -5
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +1 -1
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +1 -1
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +1 -1
- package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +2 -2
- package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +1 -1
- package/dist/types/excalidraw/types.d.ts +32 -20
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +2 -2
- package/dist/types/math/src/polygon.d.ts +2 -2
- package/dist/types/math/src/range.d.ts +1 -3
- package/dist/types/math/src/segment.d.ts +4 -3
- package/dist/types/utils/src/bbox.d.ts +1 -1
- package/dist/types/utils/src/export.d.ts +5 -5
- package/dist/types/utils/src/shape.d.ts +6 -6
- package/dist/types/utils/src/withinBounds.d.ts +2 -2
- package/history.ts +1 -1
- package/package.json +7 -8
- package/dist/dev/chunk-FRLWKCNE.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-YZO7PSYQ.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/{chunk-CP5DND7P.js.map → chunk-Y3BTNZQY.js.map} +0 -0
- /package/dist/dev/data/{image-T2LJEHDP.js.map → image-2BHUUSLM.js.map} +0 -0
- /package/dist/dev/locales/{en-SMAPCEOQ.js.map → en-JRVQ7H6V.js.map} +0 -0
- /package/dist/dev/locales/{percentages-YKFLWNK2.js.map → percentages-OGWD7R2K.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
define_import_meta_env_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Y3BTNZQY.js";
|
|
4
4
|
import {
|
|
5
5
|
__publicField
|
|
6
6
|
} from "./chunk-XDFCUUT6.js";
|
|
@@ -9,17 +9,16 @@ import {
|
|
|
9
9
|
import tEXt from "png-chunk-text";
|
|
10
10
|
import encodePng from "png-chunks-encode";
|
|
11
11
|
import decodePng from "png-chunks-extract";
|
|
12
|
-
import { EXPORT_DATA_TYPES as EXPORT_DATA_TYPES3, MIME_TYPES as
|
|
12
|
+
import { EXPORT_DATA_TYPES as EXPORT_DATA_TYPES3, MIME_TYPES as MIME_TYPES6 } from "@excalidraw/common";
|
|
13
13
|
|
|
14
14
|
// data/blob.ts
|
|
15
15
|
import { nanoid } from "nanoid";
|
|
16
16
|
import {
|
|
17
17
|
IMAGE_MIME_TYPES,
|
|
18
|
-
MIME_TYPES as
|
|
18
|
+
MIME_TYPES as MIME_TYPES5,
|
|
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 {
|
|
@@ -70,6 +69,10 @@ var getDefaultAppState = () => {
|
|
|
70
69
|
fromSelection: false,
|
|
71
70
|
lastActiveTool: null
|
|
72
71
|
},
|
|
72
|
+
preferredSelectionTool: {
|
|
73
|
+
type: "selection",
|
|
74
|
+
initialized: false
|
|
75
|
+
},
|
|
73
76
|
penMode: false,
|
|
74
77
|
penDetected: false,
|
|
75
78
|
errorMessage: null,
|
|
@@ -111,7 +114,7 @@ var getDefaultAppState = () => {
|
|
|
111
114
|
panels: STATS_PANELS.generalStats | STATS_PANELS.elementProperties
|
|
112
115
|
},
|
|
113
116
|
startBoundElement: null,
|
|
114
|
-
|
|
117
|
+
suggestedBinding: null,
|
|
115
118
|
frameRendering: { enabled: true, clip: true, name: true, outline: true },
|
|
116
119
|
frameToHighlight: null,
|
|
117
120
|
editingFrame: null,
|
|
@@ -137,7 +140,8 @@ var getDefaultAppState = () => {
|
|
|
137
140
|
croppingElementId: null,
|
|
138
141
|
searchMatches: null,
|
|
139
142
|
lockedMultiSelections: {},
|
|
140
|
-
activeLockedId: null
|
|
143
|
+
activeLockedId: null,
|
|
144
|
+
bindMode: "orbit"
|
|
141
145
|
};
|
|
142
146
|
};
|
|
143
147
|
var APP_STATE_STORAGE_CONF = /* @__PURE__ */ ((config) => config)({
|
|
@@ -174,6 +178,7 @@ var APP_STATE_STORAGE_CONF = /* @__PURE__ */ ((config) => config)({
|
|
|
174
178
|
editingTextElement: { browser: false, export: false, server: false },
|
|
175
179
|
editingGroupId: { browser: true, export: false, server: false },
|
|
176
180
|
activeTool: { browser: true, export: false, server: false },
|
|
181
|
+
preferredSelectionTool: { browser: true, export: false, server: false },
|
|
177
182
|
penMode: { browser: true, export: false, server: false },
|
|
178
183
|
penDetected: { browser: true, export: false, server: false },
|
|
179
184
|
errorMessage: { browser: false, export: false, server: false },
|
|
@@ -223,7 +228,7 @@ var APP_STATE_STORAGE_CONF = /* @__PURE__ */ ((config) => config)({
|
|
|
223
228
|
shouldCacheIgnoreZoom: { browser: true, export: false, server: false },
|
|
224
229
|
stats: { browser: true, export: false, server: false },
|
|
225
230
|
startBoundElement: { browser: false, export: false, server: false },
|
|
226
|
-
|
|
231
|
+
suggestedBinding: { browser: false, export: false, server: false },
|
|
227
232
|
frameRendering: { browser: false, export: false, server: false },
|
|
228
233
|
frameToHighlight: { browser: false, export: false, server: false },
|
|
229
234
|
editingFrame: { browser: false, export: false, server: false },
|
|
@@ -245,7 +250,8 @@ var APP_STATE_STORAGE_CONF = /* @__PURE__ */ ((config) => config)({
|
|
|
245
250
|
croppingElementId: { browser: false, export: false, server: false },
|
|
246
251
|
searchMatches: { browser: false, export: false, server: false },
|
|
247
252
|
lockedMultiSelections: { browser: true, export: true, server: true },
|
|
248
|
-
activeLockedId: { browser: false, export: false, server: false }
|
|
253
|
+
activeLockedId: { browser: false, export: false, server: false },
|
|
254
|
+
bindMode: { browser: true, export: false, server: false }
|
|
249
255
|
});
|
|
250
256
|
var _clearAppStateForStorage = (appState, exportType) => {
|
|
251
257
|
const stateForExport = {};
|
|
@@ -316,6 +322,24 @@ var ExcalidrawError = class extends Error {
|
|
|
316
322
|
this.name = "ExcalidrawError";
|
|
317
323
|
}
|
|
318
324
|
};
|
|
325
|
+
var RequestError = class extends Error {
|
|
326
|
+
constructor({
|
|
327
|
+
message = "Something went wrong",
|
|
328
|
+
status = 500,
|
|
329
|
+
data
|
|
330
|
+
} = {}) {
|
|
331
|
+
super();
|
|
332
|
+
__publicField(this, "status");
|
|
333
|
+
__publicField(this, "data");
|
|
334
|
+
this.name = "RequestError";
|
|
335
|
+
this.message = message;
|
|
336
|
+
this.status = status;
|
|
337
|
+
this.data = data;
|
|
338
|
+
}
|
|
339
|
+
toObject() {
|
|
340
|
+
return { name: this.name, status: this.status, message: this.message };
|
|
341
|
+
}
|
|
342
|
+
};
|
|
319
343
|
|
|
320
344
|
// scene/index.ts
|
|
321
345
|
import {
|
|
@@ -416,14 +440,14 @@ import {
|
|
|
416
440
|
FRAME_STYLE as FRAME_STYLE3,
|
|
417
441
|
FONT_FAMILY as FONT_FAMILY2,
|
|
418
442
|
SVG_NS as SVG_NS2,
|
|
419
|
-
THEME as
|
|
420
|
-
|
|
421
|
-
MIME_TYPES as MIME_TYPES5,
|
|
443
|
+
THEME as THEME5,
|
|
444
|
+
MIME_TYPES as MIME_TYPES4,
|
|
422
445
|
EXPORT_DATA_TYPES as EXPORT_DATA_TYPES2,
|
|
423
446
|
arrayToMap,
|
|
424
447
|
distance,
|
|
425
448
|
getFontString as getFontString2,
|
|
426
|
-
toBrandedType
|
|
449
|
+
toBrandedType,
|
|
450
|
+
applyDarkModeFilter as applyDarkModeFilter4
|
|
427
451
|
} from "@excalidraw/common";
|
|
428
452
|
import { getCommonBounds as getCommonBounds2, getElementAbsoluteCoords as getElementAbsoluteCoords4 } from "@excalidraw/element";
|
|
429
453
|
import {
|
|
@@ -517,10 +541,6 @@ import {
|
|
|
517
541
|
MIME_TYPES as MIME_TYPES2,
|
|
518
542
|
VERSIONS
|
|
519
543
|
} from "@excalidraw/common";
|
|
520
|
-
import {
|
|
521
|
-
clearElementsForDatabase,
|
|
522
|
-
clearElementsForExport
|
|
523
|
-
} from "@excalidraw/element";
|
|
524
544
|
|
|
525
545
|
// data/filesystem.ts
|
|
526
546
|
import {
|
|
@@ -529,8 +549,8 @@ import {
|
|
|
529
549
|
supported as nativeFileSystemSupported
|
|
530
550
|
} from "browser-fs-access";
|
|
531
551
|
import { EVENT, MIME_TYPES, debounce } from "@excalidraw/common";
|
|
532
|
-
var INPUT_CHANGE_INTERVAL_MS =
|
|
533
|
-
var fileOpen = (opts) => {
|
|
552
|
+
var INPUT_CHANGE_INTERVAL_MS = 5e3;
|
|
553
|
+
var fileOpen = async (opts) => {
|
|
534
554
|
const mimeTypes = opts.extensions?.reduce((mimeTypes2, type) => {
|
|
535
555
|
mimeTypes2.push(MIME_TYPES[type]);
|
|
536
556
|
return mimeTypes2;
|
|
@@ -541,7 +561,7 @@ var fileOpen = (opts) => {
|
|
|
541
561
|
}
|
|
542
562
|
return acc.concat(`.${ext}`);
|
|
543
563
|
}, []);
|
|
544
|
-
|
|
564
|
+
const files = await _fileOpen({
|
|
545
565
|
description: opts.description,
|
|
546
566
|
extensions,
|
|
547
567
|
mimeTypes,
|
|
@@ -579,6 +599,12 @@ var fileOpen = (opts) => {
|
|
|
579
599
|
};
|
|
580
600
|
}
|
|
581
601
|
});
|
|
602
|
+
if (Array.isArray(files)) {
|
|
603
|
+
return await Promise.all(
|
|
604
|
+
files.map((file) => normalizeFile(file))
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
return await normalizeFile(files);
|
|
582
608
|
};
|
|
583
609
|
var fileSave = (blob, opts) => {
|
|
584
610
|
return _fileSave(
|
|
@@ -608,7 +634,7 @@ var serializeAsJSON = (elements, appState, files, type) => {
|
|
|
608
634
|
type: EXPORT_DATA_TYPES.excalidraw,
|
|
609
635
|
version: VERSIONS.excalidraw,
|
|
610
636
|
source: getExportSource(),
|
|
611
|
-
elements
|
|
637
|
+
elements,
|
|
612
638
|
appState: type === "local" ? cleanAppStateForExport(appState) : clearAppStateForDatabase(appState),
|
|
613
639
|
files: type === "local" ? filterOutDeletedFiles(elements, files) : (
|
|
614
640
|
// will be stripped from JSON
|
|
@@ -637,12 +663,7 @@ var loadFromJSON = async (localAppState, localElements) => {
|
|
|
637
663
|
// gets resolved. Else, iOS users cannot open `.excalidraw` files.
|
|
638
664
|
// extensions: ["json", "excalidraw", "png", "svg"],
|
|
639
665
|
});
|
|
640
|
-
return loadFromBlob(
|
|
641
|
-
await normalizeFile(file),
|
|
642
|
-
localAppState,
|
|
643
|
-
localElements,
|
|
644
|
-
file.handle
|
|
645
|
-
);
|
|
666
|
+
return loadFromBlob(file, localAppState, localElements, file.handle);
|
|
646
667
|
};
|
|
647
668
|
var isValidExcalidrawData = (data) => {
|
|
648
669
|
return data?.type === EXPORT_DATA_TYPES.excalidraw && (!data.elements || Array.isArray(data.elements) && (!data.appState || typeof data.appState === "object"));
|
|
@@ -679,7 +700,8 @@ import {
|
|
|
679
700
|
FONT_FAMILY_FALLBACKS,
|
|
680
701
|
CJK_HAND_DRAWN_FALLBACK_FONT,
|
|
681
702
|
WINDOWS_EMOJI_FALLBACK_FONT,
|
|
682
|
-
getFontFamilyFallbacks
|
|
703
|
+
getFontFamilyFallbacks,
|
|
704
|
+
FONT_SIZES
|
|
683
705
|
} from "@excalidraw/common";
|
|
684
706
|
import { getContainerElement } from "@excalidraw/element";
|
|
685
707
|
import { charWidth } from "@excalidraw/element";
|
|
@@ -2908,7 +2930,7 @@ var _Fonts = class _Fonts {
|
|
|
2908
2930
|
for (const [index, fontFamily] of fontFamilies.entries()) {
|
|
2909
2931
|
const font = getFontString({
|
|
2910
2932
|
fontFamily,
|
|
2911
|
-
fontSize:
|
|
2933
|
+
fontSize: FONT_SIZES.sm
|
|
2912
2934
|
});
|
|
2913
2935
|
const text = _Fonts.getCharacters(charsPerFamily, fontFamily);
|
|
2914
2936
|
if (!window.document.fonts.check(font, text)) {
|
|
@@ -3065,7 +3087,12 @@ __publicField(_Fonts, "loadElementsFonts", async (elements) => {
|
|
|
3065
3087
|
var Fonts = _Fonts;
|
|
3066
3088
|
|
|
3067
3089
|
// renderer/staticScene.ts
|
|
3068
|
-
import {
|
|
3090
|
+
import {
|
|
3091
|
+
applyDarkModeFilter as applyDarkModeFilter2,
|
|
3092
|
+
FRAME_STYLE,
|
|
3093
|
+
THEME as THEME3,
|
|
3094
|
+
throttleRAF
|
|
3095
|
+
} from "@excalidraw/common";
|
|
3069
3096
|
import { isElementLink } from "@excalidraw/element";
|
|
3070
3097
|
import { createPlaceholderEmbeddableLabel } from "@excalidraw/element";
|
|
3071
3098
|
import { getBoundTextElement } from "@excalidraw/element";
|
|
@@ -3147,19 +3174,7 @@ var isPointHittingLink = (element, elementsMap, appState, [x, y], isMobile) => {
|
|
|
3147
3174
|
};
|
|
3148
3175
|
|
|
3149
3176
|
// renderer/helpers.ts
|
|
3150
|
-
import { THEME as THEME2,
|
|
3151
|
-
import { FIXED_BINDING_DISTANCE } from "@excalidraw/element";
|
|
3152
|
-
import { getDiamondPoints } from "@excalidraw/element";
|
|
3153
|
-
import { elementCenterPoint, getCornerRadius } from "@excalidraw/element";
|
|
3154
|
-
import {
|
|
3155
|
-
curve,
|
|
3156
|
-
curveCatmullRomCubicApproxPoints,
|
|
3157
|
-
curveCatmullRomQuadraticApproxPoints,
|
|
3158
|
-
curveOffsetPoints,
|
|
3159
|
-
offsetPointsForQuadraticBezier,
|
|
3160
|
-
pointFrom as pointFrom2,
|
|
3161
|
-
pointRotateRads as pointRotateRads2
|
|
3162
|
-
} from "@excalidraw/math";
|
|
3177
|
+
import { THEME as THEME2, applyDarkModeFilter } from "@excalidraw/common";
|
|
3163
3178
|
var fillCircle = (context, cx, cy, radius, stroke, fill = true) => {
|
|
3164
3179
|
context.beginPath();
|
|
3165
3180
|
context.arc(cx, cy, radius, 0, Math.PI * 2);
|
|
@@ -3185,9 +3200,6 @@ var bootstrapCanvas = ({
|
|
|
3185
3200
|
const context = canvas.getContext("2d");
|
|
3186
3201
|
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
3187
3202
|
context.scale(scale, scale);
|
|
3188
|
-
if (isExporting && theme === THEME2.DARK) {
|
|
3189
|
-
context.filter = THEME_FILTER;
|
|
3190
|
-
}
|
|
3191
3203
|
if (typeof viewBackgroundColor === "string") {
|
|
3192
3204
|
const hasTransparence = viewBackgroundColor === "transparent" || viewBackgroundColor.length === 5 || // #RGBA
|
|
3193
3205
|
viewBackgroundColor.length === 9 || // #RRGGBBA
|
|
@@ -3196,7 +3208,7 @@ var bootstrapCanvas = ({
|
|
|
3196
3208
|
context.clearRect(0, 0, normalizedWidth, normalizedHeight);
|
|
3197
3209
|
}
|
|
3198
3210
|
context.save();
|
|
3199
|
-
context.fillStyle = viewBackgroundColor;
|
|
3211
|
+
context.fillStyle = theme === THEME2.DARK ? applyDarkModeFilter(viewBackgroundColor) : viewBackgroundColor;
|
|
3200
3212
|
context.fillRect(0, 0, normalizedWidth, normalizedHeight);
|
|
3201
3213
|
context.restore();
|
|
3202
3214
|
} else {
|
|
@@ -3204,127 +3216,7 @@ var bootstrapCanvas = ({
|
|
|
3204
3216
|
}
|
|
3205
3217
|
return context;
|
|
3206
3218
|
};
|
|
3207
|
-
|
|
3208
|
-
const pointSets = curveCatmullRomQuadraticApproxPoints(points, tension);
|
|
3209
|
-
if (pointSets) {
|
|
3210
|
-
for (let i = 0; i < pointSets.length - 1; i++) {
|
|
3211
|
-
const [[cpX, cpY], [p2X, p2Y]] = pointSets[i];
|
|
3212
|
-
ctx.quadraticCurveTo(cpX, cpY, p2X, p2Y);
|
|
3213
|
-
}
|
|
3214
|
-
}
|
|
3215
|
-
}
|
|
3216
|
-
function drawCatmullRomCubicApprox(ctx, points, tension = 0.5) {
|
|
3217
|
-
const pointSets = curveCatmullRomCubicApproxPoints(points, tension);
|
|
3218
|
-
if (pointSets) {
|
|
3219
|
-
for (let i = 0; i < pointSets.length; i++) {
|
|
3220
|
-
const [[cp1x, cp1y], [cp2x, cp2y], [x, y]] = pointSets[i];
|
|
3221
|
-
ctx.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
|
|
3222
|
-
}
|
|
3223
|
-
}
|
|
3224
|
-
}
|
|
3225
|
-
var drawHighlightForRectWithRotation = (context, element, elementsMap, padding) => {
|
|
3226
|
-
const [x, y] = pointRotateRads2(
|
|
3227
|
-
pointFrom2(element.x, element.y),
|
|
3228
|
-
elementCenterPoint(element, elementsMap),
|
|
3229
|
-
element.angle
|
|
3230
|
-
);
|
|
3231
|
-
context.save();
|
|
3232
|
-
context.translate(x, y);
|
|
3233
|
-
context.rotate(element.angle);
|
|
3234
|
-
let radius = getCornerRadius(
|
|
3235
|
-
Math.min(element.width, element.height),
|
|
3236
|
-
element
|
|
3237
|
-
);
|
|
3238
|
-
if (radius === 0) {
|
|
3239
|
-
radius = 0.01;
|
|
3240
|
-
}
|
|
3241
|
-
context.beginPath();
|
|
3242
|
-
{
|
|
3243
|
-
const topLeftApprox = offsetPointsForQuadraticBezier(
|
|
3244
|
-
pointFrom2(0, 0 + radius),
|
|
3245
|
-
pointFrom2(0, 0),
|
|
3246
|
-
pointFrom2(0 + radius, 0),
|
|
3247
|
-
padding
|
|
3248
|
-
);
|
|
3249
|
-
const topRightApprox = offsetPointsForQuadraticBezier(
|
|
3250
|
-
pointFrom2(element.width - radius, 0),
|
|
3251
|
-
pointFrom2(element.width, 0),
|
|
3252
|
-
pointFrom2(element.width, radius),
|
|
3253
|
-
padding
|
|
3254
|
-
);
|
|
3255
|
-
const bottomRightApprox = offsetPointsForQuadraticBezier(
|
|
3256
|
-
pointFrom2(element.width, element.height - radius),
|
|
3257
|
-
pointFrom2(element.width, element.height),
|
|
3258
|
-
pointFrom2(element.width - radius, element.height),
|
|
3259
|
-
padding
|
|
3260
|
-
);
|
|
3261
|
-
const bottomLeftApprox = offsetPointsForQuadraticBezier(
|
|
3262
|
-
pointFrom2(radius, element.height),
|
|
3263
|
-
pointFrom2(0, element.height),
|
|
3264
|
-
pointFrom2(0, element.height - radius),
|
|
3265
|
-
padding
|
|
3266
|
-
);
|
|
3267
|
-
context.moveTo(
|
|
3268
|
-
topLeftApprox[topLeftApprox.length - 1][0],
|
|
3269
|
-
topLeftApprox[topLeftApprox.length - 1][1]
|
|
3270
|
-
);
|
|
3271
|
-
context.lineTo(topRightApprox[0][0], topRightApprox[0][1]);
|
|
3272
|
-
drawCatmullRomQuadraticApprox(context, topRightApprox);
|
|
3273
|
-
context.lineTo(bottomRightApprox[0][0], bottomRightApprox[0][1]);
|
|
3274
|
-
drawCatmullRomQuadraticApprox(context, bottomRightApprox);
|
|
3275
|
-
context.lineTo(bottomLeftApprox[0][0], bottomLeftApprox[0][1]);
|
|
3276
|
-
drawCatmullRomQuadraticApprox(context, bottomLeftApprox);
|
|
3277
|
-
context.lineTo(topLeftApprox[0][0], topLeftApprox[0][1]);
|
|
3278
|
-
drawCatmullRomQuadraticApprox(context, topLeftApprox);
|
|
3279
|
-
}
|
|
3280
|
-
{
|
|
3281
|
-
const topLeftApprox = offsetPointsForQuadraticBezier(
|
|
3282
|
-
pointFrom2(0 + radius, 0),
|
|
3283
|
-
pointFrom2(0, 0),
|
|
3284
|
-
pointFrom2(0, 0 + radius),
|
|
3285
|
-
-FIXED_BINDING_DISTANCE
|
|
3286
|
-
);
|
|
3287
|
-
const topRightApprox = offsetPointsForQuadraticBezier(
|
|
3288
|
-
pointFrom2(element.width, radius),
|
|
3289
|
-
pointFrom2(element.width, 0),
|
|
3290
|
-
pointFrom2(element.width - radius, 0),
|
|
3291
|
-
-FIXED_BINDING_DISTANCE
|
|
3292
|
-
);
|
|
3293
|
-
const bottomRightApprox = offsetPointsForQuadraticBezier(
|
|
3294
|
-
pointFrom2(element.width - radius, element.height),
|
|
3295
|
-
pointFrom2(element.width, element.height),
|
|
3296
|
-
pointFrom2(element.width, element.height - radius),
|
|
3297
|
-
-FIXED_BINDING_DISTANCE
|
|
3298
|
-
);
|
|
3299
|
-
const bottomLeftApprox = offsetPointsForQuadraticBezier(
|
|
3300
|
-
pointFrom2(0, element.height - radius),
|
|
3301
|
-
pointFrom2(0, element.height),
|
|
3302
|
-
pointFrom2(radius, element.height),
|
|
3303
|
-
-FIXED_BINDING_DISTANCE
|
|
3304
|
-
);
|
|
3305
|
-
context.moveTo(
|
|
3306
|
-
topLeftApprox[topLeftApprox.length - 1][0],
|
|
3307
|
-
topLeftApprox[topLeftApprox.length - 1][1]
|
|
3308
|
-
);
|
|
3309
|
-
context.lineTo(bottomLeftApprox[0][0], bottomLeftApprox[0][1]);
|
|
3310
|
-
drawCatmullRomQuadraticApprox(context, bottomLeftApprox);
|
|
3311
|
-
context.lineTo(bottomRightApprox[0][0], bottomRightApprox[0][1]);
|
|
3312
|
-
drawCatmullRomQuadraticApprox(context, bottomRightApprox);
|
|
3313
|
-
context.lineTo(topRightApprox[0][0], topRightApprox[0][1]);
|
|
3314
|
-
drawCatmullRomQuadraticApprox(context, topRightApprox);
|
|
3315
|
-
context.lineTo(topLeftApprox[0][0], topLeftApprox[0][1]);
|
|
3316
|
-
drawCatmullRomQuadraticApprox(context, topLeftApprox);
|
|
3317
|
-
}
|
|
3318
|
-
context.closePath();
|
|
3319
|
-
context.fill();
|
|
3320
|
-
context.restore();
|
|
3321
|
-
};
|
|
3322
|
-
var strokeEllipseWithRotation = (context, width, height, cx, cy, angle) => {
|
|
3323
|
-
context.beginPath();
|
|
3324
|
-
context.ellipse(cx, cy, width / 2, height / 2, angle, 0, Math.PI * 2);
|
|
3325
|
-
context.stroke();
|
|
3326
|
-
};
|
|
3327
|
-
var strokeRectWithRotation = (context, x, y, width, height, cx, cy, angle, fill = false, radius = 0) => {
|
|
3219
|
+
var strokeRectWithRotation_simple = (context, x, y, width, height, cx, cy, angle, fill = false, radius = 0) => {
|
|
3328
3220
|
context.save();
|
|
3329
3221
|
context.translate(cx, cy);
|
|
3330
3222
|
context.rotate(angle);
|
|
@@ -3341,133 +3233,19 @@ var strokeRectWithRotation = (context, x, y, width, height, cx, cy, angle, fill
|
|
|
3341
3233
|
}
|
|
3342
3234
|
context.restore();
|
|
3343
3235
|
};
|
|
3344
|
-
var drawHighlightForDiamondWithRotation = (context, padding, element, elementsMap) => {
|
|
3345
|
-
const [x, y] = pointRotateRads2(
|
|
3346
|
-
pointFrom2(element.x, element.y),
|
|
3347
|
-
elementCenterPoint(element, elementsMap),
|
|
3348
|
-
element.angle
|
|
3349
|
-
);
|
|
3350
|
-
context.save();
|
|
3351
|
-
context.translate(x, y);
|
|
3352
|
-
context.rotate(element.angle);
|
|
3353
|
-
{
|
|
3354
|
-
context.beginPath();
|
|
3355
|
-
const [topX, topY, rightX, rightY, bottomX, bottomY, leftX, leftY] = getDiamondPoints(element);
|
|
3356
|
-
const verticalRadius = element.roundness ? getCornerRadius(Math.abs(topX - leftX), element) : (topX - leftX) * 0.01;
|
|
3357
|
-
const horizontalRadius = element.roundness ? getCornerRadius(Math.abs(rightY - topY), element) : (rightY - topY) * 0.01;
|
|
3358
|
-
const topApprox = curveOffsetPoints(
|
|
3359
|
-
curve(
|
|
3360
|
-
pointFrom2(topX - verticalRadius, topY + horizontalRadius),
|
|
3361
|
-
pointFrom2(topX, topY),
|
|
3362
|
-
pointFrom2(topX, topY),
|
|
3363
|
-
pointFrom2(topX + verticalRadius, topY + horizontalRadius)
|
|
3364
|
-
),
|
|
3365
|
-
padding
|
|
3366
|
-
);
|
|
3367
|
-
const rightApprox = curveOffsetPoints(
|
|
3368
|
-
curve(
|
|
3369
|
-
pointFrom2(rightX - verticalRadius, rightY - horizontalRadius),
|
|
3370
|
-
pointFrom2(rightX, rightY),
|
|
3371
|
-
pointFrom2(rightX, rightY),
|
|
3372
|
-
pointFrom2(rightX - verticalRadius, rightY + horizontalRadius)
|
|
3373
|
-
),
|
|
3374
|
-
padding
|
|
3375
|
-
);
|
|
3376
|
-
const bottomApprox = curveOffsetPoints(
|
|
3377
|
-
curve(
|
|
3378
|
-
pointFrom2(bottomX + verticalRadius, bottomY - horizontalRadius),
|
|
3379
|
-
pointFrom2(bottomX, bottomY),
|
|
3380
|
-
pointFrom2(bottomX, bottomY),
|
|
3381
|
-
pointFrom2(bottomX - verticalRadius, bottomY - horizontalRadius)
|
|
3382
|
-
),
|
|
3383
|
-
padding
|
|
3384
|
-
);
|
|
3385
|
-
const leftApprox = curveOffsetPoints(
|
|
3386
|
-
curve(
|
|
3387
|
-
pointFrom2(leftX + verticalRadius, leftY + horizontalRadius),
|
|
3388
|
-
pointFrom2(leftX, leftY),
|
|
3389
|
-
pointFrom2(leftX, leftY),
|
|
3390
|
-
pointFrom2(leftX + verticalRadius, leftY - horizontalRadius)
|
|
3391
|
-
),
|
|
3392
|
-
padding
|
|
3393
|
-
);
|
|
3394
|
-
context.moveTo(
|
|
3395
|
-
topApprox[topApprox.length - 1][0],
|
|
3396
|
-
topApprox[topApprox.length - 1][1]
|
|
3397
|
-
);
|
|
3398
|
-
context.lineTo(rightApprox[1][0], rightApprox[1][1]);
|
|
3399
|
-
drawCatmullRomCubicApprox(context, rightApprox);
|
|
3400
|
-
context.lineTo(bottomApprox[1][0], bottomApprox[1][1]);
|
|
3401
|
-
drawCatmullRomCubicApprox(context, bottomApprox);
|
|
3402
|
-
context.lineTo(leftApprox[1][0], leftApprox[1][1]);
|
|
3403
|
-
drawCatmullRomCubicApprox(context, leftApprox);
|
|
3404
|
-
context.lineTo(topApprox[1][0], topApprox[1][1]);
|
|
3405
|
-
drawCatmullRomCubicApprox(context, topApprox);
|
|
3406
|
-
}
|
|
3407
|
-
{
|
|
3408
|
-
const [topX, topY, rightX, rightY, bottomX, bottomY, leftX, leftY] = getDiamondPoints(element);
|
|
3409
|
-
const verticalRadius = element.roundness ? getCornerRadius(Math.abs(topX - leftX), element) : (topX - leftX) * 0.01;
|
|
3410
|
-
const horizontalRadius = element.roundness ? getCornerRadius(Math.abs(rightY - topY), element) : (rightY - topY) * 0.01;
|
|
3411
|
-
const topApprox = curveOffsetPoints(
|
|
3412
|
-
curve(
|
|
3413
|
-
pointFrom2(topX + verticalRadius, topY + horizontalRadius),
|
|
3414
|
-
pointFrom2(topX, topY),
|
|
3415
|
-
pointFrom2(topX, topY),
|
|
3416
|
-
pointFrom2(topX - verticalRadius, topY + horizontalRadius)
|
|
3417
|
-
),
|
|
3418
|
-
-FIXED_BINDING_DISTANCE
|
|
3419
|
-
);
|
|
3420
|
-
const rightApprox = curveOffsetPoints(
|
|
3421
|
-
curve(
|
|
3422
|
-
pointFrom2(rightX - verticalRadius, rightY + horizontalRadius),
|
|
3423
|
-
pointFrom2(rightX, rightY),
|
|
3424
|
-
pointFrom2(rightX, rightY),
|
|
3425
|
-
pointFrom2(rightX - verticalRadius, rightY - horizontalRadius)
|
|
3426
|
-
),
|
|
3427
|
-
-FIXED_BINDING_DISTANCE
|
|
3428
|
-
);
|
|
3429
|
-
const bottomApprox = curveOffsetPoints(
|
|
3430
|
-
curve(
|
|
3431
|
-
pointFrom2(bottomX - verticalRadius, bottomY - horizontalRadius),
|
|
3432
|
-
pointFrom2(bottomX, bottomY),
|
|
3433
|
-
pointFrom2(bottomX, bottomY),
|
|
3434
|
-
pointFrom2(bottomX + verticalRadius, bottomY - horizontalRadius)
|
|
3435
|
-
),
|
|
3436
|
-
-FIXED_BINDING_DISTANCE
|
|
3437
|
-
);
|
|
3438
|
-
const leftApprox = curveOffsetPoints(
|
|
3439
|
-
curve(
|
|
3440
|
-
pointFrom2(leftX + verticalRadius, leftY - horizontalRadius),
|
|
3441
|
-
pointFrom2(leftX, leftY),
|
|
3442
|
-
pointFrom2(leftX, leftY),
|
|
3443
|
-
pointFrom2(leftX + verticalRadius, leftY + horizontalRadius)
|
|
3444
|
-
),
|
|
3445
|
-
-FIXED_BINDING_DISTANCE
|
|
3446
|
-
);
|
|
3447
|
-
context.moveTo(
|
|
3448
|
-
topApprox[topApprox.length - 1][0],
|
|
3449
|
-
topApprox[topApprox.length - 1][1]
|
|
3450
|
-
);
|
|
3451
|
-
context.lineTo(leftApprox[1][0], leftApprox[1][1]);
|
|
3452
|
-
drawCatmullRomCubicApprox(context, leftApprox);
|
|
3453
|
-
context.lineTo(bottomApprox[1][0], bottomApprox[1][1]);
|
|
3454
|
-
drawCatmullRomCubicApprox(context, bottomApprox);
|
|
3455
|
-
context.lineTo(rightApprox[1][0], rightApprox[1][1]);
|
|
3456
|
-
drawCatmullRomCubicApprox(context, rightApprox);
|
|
3457
|
-
context.lineTo(topApprox[1][0], topApprox[1][1]);
|
|
3458
|
-
drawCatmullRomCubicApprox(context, topApprox);
|
|
3459
|
-
}
|
|
3460
|
-
context.closePath();
|
|
3461
|
-
context.fill();
|
|
3462
|
-
context.restore();
|
|
3463
|
-
};
|
|
3464
3236
|
|
|
3465
3237
|
// renderer/staticScene.ts
|
|
3466
3238
|
var GridLineColor = {
|
|
3467
|
-
|
|
3468
|
-
|
|
3239
|
+
[THEME3.LIGHT]: {
|
|
3240
|
+
bold: "#dddddd",
|
|
3241
|
+
regular: "#e5e5e5"
|
|
3242
|
+
},
|
|
3243
|
+
[THEME3.DARK]: {
|
|
3244
|
+
bold: applyDarkModeFilter2("#dddddd"),
|
|
3245
|
+
regular: applyDarkModeFilter2("#e5e5e5")
|
|
3246
|
+
}
|
|
3469
3247
|
};
|
|
3470
|
-
var strokeGrid = (context, gridSize, gridStep, scrollX, scrollY, zoom, width, height) => {
|
|
3248
|
+
var strokeGrid = (context, gridSize, gridStep, scrollX, scrollY, zoom, theme, width, height) => {
|
|
3471
3249
|
const offsetX = scrollX % gridSize - gridSize;
|
|
3472
3250
|
const offsetY = scrollY % gridSize - gridSize;
|
|
3473
3251
|
const actualGridSize = gridSize * zoom.value;
|
|
@@ -3486,7 +3264,7 @@ var strokeGrid = (context, gridSize, gridStep, scrollX, scrollY, zoom, width, he
|
|
|
3486
3264
|
const lineDash = [lineWidth * 3, spaceWidth + (lineWidth + spaceWidth)];
|
|
3487
3265
|
context.beginPath();
|
|
3488
3266
|
context.setLineDash(isBold ? [] : lineDash);
|
|
3489
|
-
context.strokeStyle = isBold ? GridLineColor.
|
|
3267
|
+
context.strokeStyle = isBold ? GridLineColor[theme].bold : GridLineColor[theme].regular;
|
|
3490
3268
|
context.moveTo(x, offsetY - gridSize);
|
|
3491
3269
|
context.lineTo(x, Math.ceil(offsetY + height + gridSize * 2));
|
|
3492
3270
|
context.stroke();
|
|
@@ -3501,7 +3279,7 @@ var strokeGrid = (context, gridSize, gridStep, scrollX, scrollY, zoom, width, he
|
|
|
3501
3279
|
const lineDash = [lineWidth * 3, spaceWidth + (lineWidth + spaceWidth)];
|
|
3502
3280
|
context.beginPath();
|
|
3503
3281
|
context.setLineDash(isBold ? [] : lineDash);
|
|
3504
|
-
context.strokeStyle = isBold ? GridLineColor.
|
|
3282
|
+
context.strokeStyle = isBold ? GridLineColor[theme].bold : GridLineColor[theme].regular;
|
|
3505
3283
|
context.moveTo(offsetX - gridSize, y);
|
|
3506
3284
|
context.lineTo(Math.ceil(offsetX + width + gridSize * 2), y);
|
|
3507
3285
|
context.stroke();
|
|
@@ -3614,6 +3392,7 @@ var _renderStaticScene = ({
|
|
|
3614
3392
|
appState.scrollX,
|
|
3615
3393
|
appState.scrollY,
|
|
3616
3394
|
appState.zoom,
|
|
3395
|
+
renderConfig.theme,
|
|
3617
3396
|
normalizedWidth / appState.zoom.value,
|
|
3618
3397
|
normalizedHeight / appState.zoom.value
|
|
3619
3398
|
);
|
|
@@ -3780,12 +3559,13 @@ var renderStaticScene = (renderConfig, throttle) => {
|
|
|
3780
3559
|
import {
|
|
3781
3560
|
FRAME_STYLE as FRAME_STYLE2,
|
|
3782
3561
|
MAX_DECIMALS_FOR_SVG_EXPORT,
|
|
3783
|
-
MIME_TYPES as MIME_TYPES4,
|
|
3784
3562
|
SVG_NS,
|
|
3563
|
+
THEME as THEME4,
|
|
3785
3564
|
getFontFamilyString,
|
|
3786
3565
|
isRTL,
|
|
3787
3566
|
isTestEnv as isTestEnv2,
|
|
3788
|
-
getVerticalOffset
|
|
3567
|
+
getVerticalOffset,
|
|
3568
|
+
applyDarkModeFilter as applyDarkModeFilter3
|
|
3789
3569
|
} from "@excalidraw/common";
|
|
3790
3570
|
import { normalizeLink, toValidURL } from "@excalidraw/common";
|
|
3791
3571
|
import { hashString } from "@excalidraw/element";
|
|
@@ -3804,9 +3584,8 @@ import {
|
|
|
3804
3584
|
isTextElement as isTextElement3
|
|
3805
3585
|
} from "@excalidraw/element";
|
|
3806
3586
|
import { getContainingFrame } from "@excalidraw/element";
|
|
3807
|
-
import { getCornerRadius
|
|
3587
|
+
import { getCornerRadius, isPathALoop } from "@excalidraw/element";
|
|
3808
3588
|
import { ShapeCache as ShapeCache2 } from "@excalidraw/element";
|
|
3809
|
-
import { getFreeDrawSvgPath, IMAGE_INVERT_FILTER } from "@excalidraw/element";
|
|
3810
3589
|
import { getElementAbsoluteCoords as getElementAbsoluteCoords3 } from "@excalidraw/element";
|
|
3811
3590
|
var roughSVGDrawWithPrecision = (rsvg, drawable, precision) => {
|
|
3812
3591
|
if (typeof precision === "undefined") {
|
|
@@ -3874,7 +3653,7 @@ var renderElementToSvg = (element, elementsMap, rsvg, svgRoot, files, offsetX, o
|
|
|
3874
3653
|
case "rectangle":
|
|
3875
3654
|
case "diamond":
|
|
3876
3655
|
case "ellipse": {
|
|
3877
|
-
const shape = ShapeCache2.generateElementShape(element,
|
|
3656
|
+
const shape = ShapeCache2.generateElementShape(element, renderConfig);
|
|
3878
3657
|
const node = roughSVGDrawWithPrecision(
|
|
3879
3658
|
rsvg,
|
|
3880
3659
|
shape,
|
|
@@ -3942,7 +3721,7 @@ var renderElementToSvg = (element, elementsMap, rsvg, svgRoot, files, offsetX, o
|
|
|
3942
3721
|
while (embeddableNode.firstChild) {
|
|
3943
3722
|
embeddableNode.removeChild(embeddableNode.firstChild);
|
|
3944
3723
|
}
|
|
3945
|
-
const radius =
|
|
3724
|
+
const radius = getCornerRadius(
|
|
3946
3725
|
Math.min(element.width, element.height),
|
|
3947
3726
|
element
|
|
3948
3727
|
);
|
|
@@ -4067,36 +3846,49 @@ var renderElementToSvg = (element, elementsMap, rsvg, svgRoot, files, offsetX, o
|
|
|
4067
3846
|
break;
|
|
4068
3847
|
}
|
|
4069
3848
|
case "freedraw": {
|
|
4070
|
-
const
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
3849
|
+
const wrapper = svgRoot.ownerDocument.createElementNS(SVG_NS, "g");
|
|
3850
|
+
const shapes = ShapeCache2.generateElementShape(element, renderConfig);
|
|
3851
|
+
for (const shape of shapes) {
|
|
3852
|
+
if (typeof shape === "string") {
|
|
3853
|
+
const path = svgRoot.ownerDocument.createElementNS(SVG_NS, "path");
|
|
3854
|
+
path.setAttribute(
|
|
3855
|
+
"fill",
|
|
3856
|
+
renderConfig.theme === THEME4.DARK ? applyDarkModeFilter3(element.strokeColor) : element.strokeColor
|
|
3857
|
+
);
|
|
3858
|
+
path.setAttribute("d", shape);
|
|
3859
|
+
wrapper.appendChild(path);
|
|
3860
|
+
} else {
|
|
3861
|
+
const bgNode = roughSVGDrawWithPrecision(
|
|
3862
|
+
rsvg,
|
|
3863
|
+
shape,
|
|
3864
|
+
MAX_DECIMALS_FOR_SVG_EXPORT
|
|
3865
|
+
);
|
|
3866
|
+
if (bgNode.nodeName === "g") {
|
|
3867
|
+
while (bgNode.firstChild) {
|
|
3868
|
+
wrapper.appendChild(bgNode.firstChild);
|
|
3869
|
+
}
|
|
3870
|
+
} else {
|
|
3871
|
+
wrapper.appendChild(bgNode);
|
|
3872
|
+
}
|
|
3873
|
+
}
|
|
3874
|
+
}
|
|
4079
3875
|
if (opacity !== 1) {
|
|
4080
|
-
|
|
4081
|
-
|
|
3876
|
+
wrapper.setAttribute("stroke-opacity", `${opacity}`);
|
|
3877
|
+
wrapper.setAttribute("fill-opacity", `${opacity}`);
|
|
4082
3878
|
}
|
|
4083
|
-
|
|
3879
|
+
wrapper.setAttribute(
|
|
4084
3880
|
"transform",
|
|
4085
3881
|
`translate(${offsetX || 0} ${offsetY || 0}) rotate(${degree} ${cx} ${cy})`
|
|
4086
3882
|
);
|
|
4087
|
-
|
|
4088
|
-
const path = svgRoot.ownerDocument.createElementNS(SVG_NS, "path");
|
|
4089
|
-
path.setAttribute("fill", element.strokeColor);
|
|
4090
|
-
path.setAttribute("d", getFreeDrawSvgPath(element));
|
|
4091
|
-
node.appendChild(path);
|
|
3883
|
+
wrapper.setAttribute("stroke", "none");
|
|
4092
3884
|
const g = maybeWrapNodesInFrameClipPath(
|
|
4093
3885
|
element,
|
|
4094
3886
|
root,
|
|
4095
|
-
[
|
|
3887
|
+
[wrapper],
|
|
4096
3888
|
renderConfig.frameRendering,
|
|
4097
3889
|
elementsMap
|
|
4098
3890
|
);
|
|
4099
|
-
addToRoot(g ||
|
|
3891
|
+
addToRoot(g || wrapper, element);
|
|
4100
3892
|
break;
|
|
4101
3893
|
}
|
|
4102
3894
|
case "image": {
|
|
@@ -4136,9 +3928,6 @@ var renderElementToSvg = (element, elementsMap, rsvg, svgRoot, files, offsetX, o
|
|
|
4136
3928
|
}
|
|
4137
3929
|
const use = svgRoot.ownerDocument.createElementNS(SVG_NS, "use");
|
|
4138
3930
|
use.setAttribute("href", `#${symbolId}`);
|
|
4139
|
-
if (renderConfig.exportWithDarkMode && fileData.mimeType !== MIME_TYPES4.svg) {
|
|
4140
|
-
use.setAttribute("filter", IMAGE_INVERT_FILTER);
|
|
4141
|
-
}
|
|
4142
3931
|
let normalizedCropX = 0;
|
|
4143
3932
|
let normalizedCropY = 0;
|
|
4144
3933
|
if (element.crop) {
|
|
@@ -4185,14 +3974,19 @@ var renderElementToSvg = (element, elementsMap, rsvg, svgRoot, files, offsetX, o
|
|
|
4185
3974
|
"clipPath"
|
|
4186
3975
|
);
|
|
4187
3976
|
clipPath.id = `image-clipPath-${element.id}`;
|
|
3977
|
+
clipPath.setAttribute("clipPathUnits", "userSpaceOnUse");
|
|
4188
3978
|
const clipRect = svgRoot.ownerDocument.createElementNS(
|
|
4189
3979
|
SVG_NS,
|
|
4190
3980
|
"rect"
|
|
4191
3981
|
);
|
|
4192
|
-
const radius =
|
|
3982
|
+
const radius = getCornerRadius(
|
|
4193
3983
|
Math.min(element.width, element.height),
|
|
4194
3984
|
element
|
|
4195
3985
|
);
|
|
3986
|
+
const clipOffsetX = element.crop ? normalizedCropX : 0;
|
|
3987
|
+
const clipOffsetY = element.crop ? normalizedCropY : 0;
|
|
3988
|
+
clipRect.setAttribute("x", `${clipOffsetX}`);
|
|
3989
|
+
clipRect.setAttribute("y", `${clipOffsetY}`);
|
|
4196
3990
|
clipRect.setAttribute("width", `${element.width}`);
|
|
4197
3991
|
clipRect.setAttribute("height", `${element.height}`);
|
|
4198
3992
|
clipRect.setAttribute("rx", `${radius}`);
|
|
@@ -4225,7 +4019,10 @@ var renderElementToSvg = (element, elementsMap, rsvg, svgRoot, files, offsetX, o
|
|
|
4225
4019
|
rect.setAttribute("rx", FRAME_STYLE2.radius.toString());
|
|
4226
4020
|
rect.setAttribute("ry", FRAME_STYLE2.radius.toString());
|
|
4227
4021
|
rect.setAttribute("fill", "none");
|
|
4228
|
-
rect.setAttribute(
|
|
4022
|
+
rect.setAttribute(
|
|
4023
|
+
"stroke",
|
|
4024
|
+
renderConfig.theme === THEME4.DARK ? applyDarkModeFilter3(FRAME_STYLE2.strokeColor) : FRAME_STYLE2.strokeColor
|
|
4025
|
+
);
|
|
4229
4026
|
rect.setAttribute("stroke-width", FRAME_STYLE2.strokeWidth.toString());
|
|
4230
4027
|
addToRoot(rect, element);
|
|
4231
4028
|
}
|
|
@@ -4262,7 +4059,10 @@ var renderElementToSvg = (element, elementsMap, rsvg, svgRoot, files, offsetX, o
|
|
|
4262
4059
|
text.setAttribute("y", `${i * lineHeightPx + verticalOffset}`);
|
|
4263
4060
|
text.setAttribute("font-family", getFontFamilyString(element));
|
|
4264
4061
|
text.setAttribute("font-size", `${element.fontSize}px`);
|
|
4265
|
-
text.setAttribute(
|
|
4062
|
+
text.setAttribute(
|
|
4063
|
+
"fill",
|
|
4064
|
+
renderConfig.theme === THEME4.DARK ? applyDarkModeFilter3(element.strokeColor) : element.strokeColor
|
|
4065
|
+
);
|
|
4266
4066
|
text.setAttribute("text-anchor", textAnchor);
|
|
4267
4067
|
text.setAttribute("style", "white-space: pre;");
|
|
4268
4068
|
text.setAttribute("direction", direction);
|
|
@@ -4475,7 +4275,7 @@ var exportToCanvas = async (elements, appState, files, {
|
|
|
4475
4275
|
scrollY: -minY + exportPadding,
|
|
4476
4276
|
zoom: defaultAppState.zoom,
|
|
4477
4277
|
shouldCacheIgnoreZoom: false,
|
|
4478
|
-
theme: appState.exportWithDarkMode ?
|
|
4278
|
+
theme: appState.exportWithDarkMode ? THEME5.DARK : THEME5.LIGHT
|
|
4479
4279
|
},
|
|
4480
4280
|
renderConfig: {
|
|
4481
4281
|
canvasBackgroundColor: viewBackgroundColor,
|
|
@@ -4485,7 +4285,8 @@ var exportToCanvas = async (elements, appState, files, {
|
|
|
4485
4285
|
// empty disables embeddable rendering
|
|
4486
4286
|
embedsValidationStatus: /* @__PURE__ */ new Map(),
|
|
4487
4287
|
elementsPendingErasure: /* @__PURE__ */ new Set(),
|
|
4488
|
-
pendingFlowchartNodes: null
|
|
4288
|
+
pendingFlowchartNodes: null,
|
|
4289
|
+
theme: appState.exportWithDarkMode ? THEME5.DARK : THEME5.LIGHT
|
|
4489
4290
|
}
|
|
4490
4291
|
});
|
|
4491
4292
|
return canvas;
|
|
@@ -4527,9 +4328,6 @@ var exportToSvg = async (elements, appState, files, opts) => {
|
|
|
4527
4328
|
svgRoot.setAttribute("viewBox", `0 0 ${width} ${height}`);
|
|
4528
4329
|
svgRoot.setAttribute("width", `${width * exportScale}`);
|
|
4529
4330
|
svgRoot.setAttribute("height", `${height * exportScale}`);
|
|
4530
|
-
if (exportWithDarkMode) {
|
|
4531
|
-
svgRoot.setAttribute("filter", THEME_FILTER2);
|
|
4532
|
-
}
|
|
4533
4331
|
const defsElement = svgRoot.ownerDocument.createElementNS(SVG_NS2, "defs");
|
|
4534
4332
|
const metadataElement = svgRoot.ownerDocument.createElementNS(
|
|
4535
4333
|
SVG_NS2,
|
|
@@ -4593,7 +4391,10 @@ var exportToSvg = async (elements, appState, files, opts) => {
|
|
|
4593
4391
|
rect.setAttribute("y", "0");
|
|
4594
4392
|
rect.setAttribute("width", `${width}`);
|
|
4595
4393
|
rect.setAttribute("height", `${height}`);
|
|
4596
|
-
rect.setAttribute(
|
|
4394
|
+
rect.setAttribute(
|
|
4395
|
+
"fill",
|
|
4396
|
+
exportWithDarkMode ? applyDarkModeFilter4(viewBackgroundColor) : viewBackgroundColor
|
|
4397
|
+
);
|
|
4597
4398
|
svgRoot.appendChild(rect);
|
|
4598
4399
|
}
|
|
4599
4400
|
const rsvg = rough.svg(svgRoot);
|
|
@@ -4615,7 +4416,8 @@ var exportToSvg = async (elements, appState, files, opts) => {
|
|
|
4615
4416
|
embedsValidationStatus: renderEmbeddables ? new Map(
|
|
4616
4417
|
elementsForRender.filter((element) => isFrameLikeElement(element)).map((element) => [element.id, true])
|
|
4617
4418
|
) : /* @__PURE__ */ new Map(),
|
|
4618
|
-
reuseImages: opts?.reuseImages ?? true
|
|
4419
|
+
reuseImages: opts?.reuseImages ?? true,
|
|
4420
|
+
theme: exportWithDarkMode ? THEME5.DARK : THEME5.LIGHT
|
|
4619
4421
|
}
|
|
4620
4422
|
);
|
|
4621
4423
|
return svgRoot;
|
|
@@ -4629,7 +4431,7 @@ var encodeSvgBase64Payload = ({
|
|
|
4629
4431
|
true
|
|
4630
4432
|
);
|
|
4631
4433
|
metadataElement.appendChild(
|
|
4632
|
-
createHTMLComment(`payload-type:${
|
|
4434
|
+
createHTMLComment(`payload-type:${MIME_TYPES4.excalidraw}`)
|
|
4633
4435
|
);
|
|
4634
4436
|
metadataElement.appendChild(createHTMLComment("payload-version:2"));
|
|
4635
4437
|
metadataElement.appendChild(createHTMLComment("payload-start"));
|
|
@@ -4637,7 +4439,7 @@ var encodeSvgBase64Payload = ({
|
|
|
4637
4439
|
metadataElement.appendChild(createHTMLComment("payload-end"));
|
|
4638
4440
|
};
|
|
4639
4441
|
var decodeSvgBase64Payload = ({ svg }) => {
|
|
4640
|
-
if (svg.includes(`payload-type:${
|
|
4442
|
+
if (svg.includes(`payload-type:${MIME_TYPES4.excalidraw}`)) {
|
|
4641
4443
|
const match = svg.match(
|
|
4642
4444
|
/<!-- payload-start -->\s*(.+?)\s*<!-- payload-end -->/
|
|
4643
4445
|
);
|
|
@@ -4678,7 +4480,7 @@ var getExportSize = (elements, exportPadding, scale) => {
|
|
|
4678
4480
|
};
|
|
4679
4481
|
|
|
4680
4482
|
// data/restore.ts
|
|
4681
|
-
import { isFiniteNumber, pointFrom as
|
|
4483
|
+
import { isFiniteNumber, pointFrom as pointFrom2 } from "@excalidraw/math";
|
|
4682
4484
|
import {
|
|
4683
4485
|
DEFAULT_FONT_FAMILY as DEFAULT_FONT_FAMILY2,
|
|
4684
4486
|
DEFAULT_TEXT_ALIGN as DEFAULT_TEXT_ALIGN2,
|
|
@@ -4697,7 +4499,13 @@ import {
|
|
|
4697
4499
|
normalizeLink as normalizeLink2,
|
|
4698
4500
|
getLineHeight
|
|
4699
4501
|
} from "@excalidraw/common";
|
|
4700
|
-
import {
|
|
4502
|
+
import {
|
|
4503
|
+
calculateFixedPointForNonElbowArrowBinding,
|
|
4504
|
+
getNonDeletedElements,
|
|
4505
|
+
isPointInElement,
|
|
4506
|
+
isValidPolygon,
|
|
4507
|
+
projectFixedPointOntoDiagonal
|
|
4508
|
+
} from "@excalidraw/element";
|
|
4701
4509
|
import { normalizeFixedPoint } from "@excalidraw/element";
|
|
4702
4510
|
import {
|
|
4703
4511
|
updateElbowArrowPoints,
|
|
@@ -4711,7 +4519,6 @@ import {
|
|
|
4711
4519
|
isArrowBoundToElement,
|
|
4712
4520
|
isArrowElement as isArrowElement2,
|
|
4713
4521
|
isElbowArrow,
|
|
4714
|
-
isFixedPointBinding,
|
|
4715
4522
|
isLinearElement,
|
|
4716
4523
|
isLineElement,
|
|
4717
4524
|
isTextElement as isTextElement4,
|
|
@@ -4746,23 +4553,66 @@ var getFontFamilyByName = (fontFamilyName) => {
|
|
|
4746
4553
|
}
|
|
4747
4554
|
return DEFAULT_FONT_FAMILY2;
|
|
4748
4555
|
};
|
|
4749
|
-
var repairBinding = (element, binding) => {
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4556
|
+
var repairBinding = (element, binding, targetElementsMap, existingElementsMap, startOrEnd) => {
|
|
4557
|
+
try {
|
|
4558
|
+
if (!binding) {
|
|
4559
|
+
return null;
|
|
4560
|
+
}
|
|
4561
|
+
if (isElbowArrow(element)) {
|
|
4562
|
+
const fixedPointBinding = {
|
|
4563
|
+
...binding,
|
|
4564
|
+
fixedPoint: normalizeFixedPoint(binding.fixedPoint ?? [0, 0]),
|
|
4565
|
+
mode: binding.mode || "orbit"
|
|
4566
|
+
};
|
|
4567
|
+
return fixedPointBinding;
|
|
4568
|
+
}
|
|
4569
|
+
if (binding.mode) {
|
|
4570
|
+
if (binding.elementId) {
|
|
4571
|
+
return {
|
|
4572
|
+
elementId: binding.elementId,
|
|
4573
|
+
mode: binding.mode,
|
|
4574
|
+
fixedPoint: normalizeFixedPoint(binding.fixedPoint || [0.5, 0.5])
|
|
4575
|
+
};
|
|
4576
|
+
}
|
|
4577
|
+
return null;
|
|
4578
|
+
}
|
|
4579
|
+
const targetBoundElement = targetElementsMap.get(binding.elementId) || void 0;
|
|
4580
|
+
const boundElement = targetBoundElement || existingElementsMap?.get(
|
|
4581
|
+
binding.elementId
|
|
4582
|
+
) || void 0;
|
|
4583
|
+
const elementsMap = targetBoundElement ? targetElementsMap : existingElementsMap;
|
|
4584
|
+
if (boundElement && elementsMap) {
|
|
4585
|
+
const p = LinearElementEditor2.getPointAtIndexGlobalCoordinates(
|
|
4586
|
+
element,
|
|
4587
|
+
startOrEnd === "start" ? 0 : element.points.length - 1,
|
|
4588
|
+
elementsMap
|
|
4589
|
+
);
|
|
4590
|
+
const mode = isPointInElement(p, boundElement, elementsMap) ? "inside" : "orbit";
|
|
4591
|
+
const focusPoint = mode === "inside" ? p : projectFixedPointOntoDiagonal(
|
|
4592
|
+
element,
|
|
4593
|
+
p,
|
|
4594
|
+
boundElement,
|
|
4595
|
+
startOrEnd,
|
|
4596
|
+
elementsMap
|
|
4597
|
+
) || p;
|
|
4598
|
+
const { fixedPoint } = calculateFixedPointForNonElbowArrowBinding(
|
|
4599
|
+
element,
|
|
4600
|
+
boundElement,
|
|
4601
|
+
startOrEnd,
|
|
4602
|
+
elementsMap,
|
|
4603
|
+
focusPoint
|
|
4604
|
+
);
|
|
4605
|
+
return {
|
|
4606
|
+
mode,
|
|
4607
|
+
elementId: binding.elementId,
|
|
4608
|
+
fixedPoint
|
|
4609
|
+
};
|
|
4610
|
+
}
|
|
4611
|
+
console.error(`could not repair binding for element`);
|
|
4612
|
+
} catch (error) {
|
|
4613
|
+
console.error("Error repairing binding:", error);
|
|
4761
4614
|
}
|
|
4762
|
-
return
|
|
4763
|
-
...binding,
|
|
4764
|
-
focus
|
|
4765
|
-
};
|
|
4615
|
+
return null;
|
|
4766
4616
|
};
|
|
4767
4617
|
var restoreElementWithProperties = (element, extra) => {
|
|
4768
4618
|
const base = {
|
|
@@ -4815,7 +4665,7 @@ var restoreElementWithProperties = (element, extra) => {
|
|
|
4815
4665
|
delete ret.boundElementIds;
|
|
4816
4666
|
return ret;
|
|
4817
4667
|
};
|
|
4818
|
-
var restoreElement = (element) => {
|
|
4668
|
+
var restoreElement = (element, targetElementsMap, existingElementsMap, opts) => {
|
|
4819
4669
|
element = { ...element };
|
|
4820
4670
|
switch (element.type) {
|
|
4821
4671
|
case "text":
|
|
@@ -4847,7 +4697,7 @@ var restoreElement = (element) => {
|
|
|
4847
4697
|
autoResize: element.autoResize ?? true,
|
|
4848
4698
|
lineHeight
|
|
4849
4699
|
});
|
|
4850
|
-
if (!text && !element.isDeleted) {
|
|
4700
|
+
if (opts?.deleteInvisibleElements && !text && !element.isDeleted) {
|
|
4851
4701
|
element = { ...element, originalText: text, isDeleted: true };
|
|
4852
4702
|
element = bumpVersion(element);
|
|
4853
4703
|
}
|
|
@@ -4855,7 +4705,6 @@ var restoreElement = (element) => {
|
|
|
4855
4705
|
case "freedraw": {
|
|
4856
4706
|
return restoreElementWithProperties(element, {
|
|
4857
4707
|
points: element.points,
|
|
4858
|
-
lastCommittedPoint: null,
|
|
4859
4708
|
simulatePressure: element.simulatePressure,
|
|
4860
4709
|
pressures: element.pressures
|
|
4861
4710
|
});
|
|
@@ -4874,16 +4723,15 @@ var restoreElement = (element) => {
|
|
|
4874
4723
|
let y = element.y;
|
|
4875
4724
|
let points = (
|
|
4876
4725
|
// migrate old arrow model to new one
|
|
4877
|
-
!Array.isArray(element.points) || element.points.length < 2 ? [
|
|
4726
|
+
!Array.isArray(element.points) || element.points.length < 2 ? [pointFrom2(0, 0), pointFrom2(element.width, element.height)] : element.points
|
|
4878
4727
|
);
|
|
4879
4728
|
if (points[0][0] !== 0 || points[0][1] !== 0) {
|
|
4880
4729
|
({ points, x, y } = LinearElementEditor2.getNormalizeElementPointsAndCoords(element));
|
|
4881
4730
|
}
|
|
4882
4731
|
return restoreElementWithProperties(element, {
|
|
4883
|
-
type:
|
|
4884
|
-
startBinding:
|
|
4885
|
-
endBinding:
|
|
4886
|
-
lastCommittedPoint: null,
|
|
4732
|
+
type: "line",
|
|
4733
|
+
startBinding: null,
|
|
4734
|
+
endBinding: null,
|
|
4887
4735
|
startArrowhead,
|
|
4888
4736
|
endArrowhead,
|
|
4889
4737
|
points,
|
|
@@ -4896,20 +4744,28 @@ var restoreElement = (element) => {
|
|
|
4896
4744
|
});
|
|
4897
4745
|
case "arrow": {
|
|
4898
4746
|
const { startArrowhead: startArrowhead2 = null, endArrowhead: endArrowhead2 = "arrow" } = element;
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4747
|
+
const x2 = element.x;
|
|
4748
|
+
const y2 = element.y;
|
|
4749
|
+
const points2 = (
|
|
4902
4750
|
// migrate old arrow model to new one
|
|
4903
|
-
!Array.isArray(element.points) || element.points.length < 2 ? [
|
|
4751
|
+
!Array.isArray(element.points) || element.points.length < 2 ? [pointFrom2(0, 0), pointFrom2(element.width, element.height)] : element.points
|
|
4904
4752
|
);
|
|
4905
|
-
if (points2[0][0] !== 0 || points2[0][1] !== 0) {
|
|
4906
|
-
({ points: points2, x: x2, y: y2 } = LinearElementEditor2.getNormalizeElementPointsAndCoords(element));
|
|
4907
|
-
}
|
|
4908
4753
|
const base = {
|
|
4909
4754
|
type: element.type,
|
|
4910
|
-
startBinding: repairBinding(
|
|
4911
|
-
|
|
4912
|
-
|
|
4755
|
+
startBinding: repairBinding(
|
|
4756
|
+
element,
|
|
4757
|
+
element.startBinding,
|
|
4758
|
+
targetElementsMap,
|
|
4759
|
+
existingElementsMap,
|
|
4760
|
+
"start"
|
|
4761
|
+
),
|
|
4762
|
+
endBinding: repairBinding(
|
|
4763
|
+
element,
|
|
4764
|
+
element.endBinding,
|
|
4765
|
+
targetElementsMap,
|
|
4766
|
+
existingElementsMap,
|
|
4767
|
+
"end"
|
|
4768
|
+
),
|
|
4913
4769
|
startArrowhead: startArrowhead2,
|
|
4914
4770
|
endArrowhead: endArrowhead2,
|
|
4915
4771
|
points: points2,
|
|
@@ -4918,15 +4774,19 @@ var restoreElement = (element) => {
|
|
|
4918
4774
|
elbowed: element.elbowed,
|
|
4919
4775
|
...getSizeFromPoints(points2)
|
|
4920
4776
|
};
|
|
4921
|
-
|
|
4777
|
+
const restoredElement = isElbowArrow(element) ? restoreElementWithProperties(element, {
|
|
4922
4778
|
...base,
|
|
4923
4779
|
elbowed: true,
|
|
4924
|
-
|
|
4925
|
-
endBinding: repairBinding(element, element.endBinding),
|
|
4926
|
-
fixedSegments: element.fixedSegments,
|
|
4780
|
+
fixedSegments: element.fixedSegments?.length && base.points.length >= 4 ? element.fixedSegments : null,
|
|
4927
4781
|
startIsSpecial: element.startIsSpecial,
|
|
4928
4782
|
endIsSpecial: element.endIsSpecial
|
|
4929
4783
|
}) : restoreElementWithProperties(element, base);
|
|
4784
|
+
return {
|
|
4785
|
+
...restoredElement,
|
|
4786
|
+
...LinearElementEditor2.getNormalizeElementPointsAndCoords(
|
|
4787
|
+
restoredElement
|
|
4788
|
+
)
|
|
4789
|
+
};
|
|
4930
4790
|
}
|
|
4931
4791
|
case "ellipse":
|
|
4932
4792
|
case "rectangle":
|
|
@@ -4991,29 +4851,45 @@ var repairFrameMembership = (element, elementsMap) => {
|
|
|
4991
4851
|
}
|
|
4992
4852
|
}
|
|
4993
4853
|
};
|
|
4994
|
-
var restoreElements = (
|
|
4854
|
+
var restoreElements = (targetElements, existingElements, opts) => {
|
|
4995
4855
|
const existingIds = /* @__PURE__ */ new Set();
|
|
4996
|
-
const
|
|
4856
|
+
const targetElementsMap = arrayToMap2(targetElements || []);
|
|
4857
|
+
const existingElementsMap = existingElements ? arrayToMap2(existingElements) : null;
|
|
4997
4858
|
const restoredElements = syncInvalidIndices2(
|
|
4998
|
-
(
|
|
4999
|
-
if (element.type
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
migratedElement = { ...migratedElement, id: randomId() };
|
|
4859
|
+
(targetElements || []).reduce((elements, element) => {
|
|
4860
|
+
if (element.type === "selection") {
|
|
4861
|
+
return elements;
|
|
4862
|
+
}
|
|
4863
|
+
let migratedElement;
|
|
4864
|
+
try {
|
|
4865
|
+
migratedElement = restoreElement(
|
|
4866
|
+
element,
|
|
4867
|
+
targetElementsMap,
|
|
4868
|
+
existingElementsMap,
|
|
4869
|
+
{
|
|
4870
|
+
deleteInvisibleElements: opts?.deleteInvisibleElements
|
|
5011
4871
|
}
|
|
5012
|
-
|
|
5013
|
-
|
|
4872
|
+
);
|
|
4873
|
+
} catch (error) {
|
|
4874
|
+
console.error("Error restoring element:", error);
|
|
4875
|
+
migratedElement = null;
|
|
4876
|
+
}
|
|
4877
|
+
if (migratedElement) {
|
|
4878
|
+
const localElement = existingElementsMap?.get(element.id);
|
|
4879
|
+
const shouldMarkAsDeleted = opts?.deleteInvisibleElements && isInvisiblySmallElement(element);
|
|
4880
|
+
if (shouldMarkAsDeleted) {
|
|
4881
|
+
migratedElement = bumpVersion(migratedElement, localElement?.version);
|
|
4882
|
+
}
|
|
4883
|
+
if (shouldMarkAsDeleted) {
|
|
4884
|
+
migratedElement = { ...migratedElement, isDeleted: true };
|
|
4885
|
+
}
|
|
4886
|
+
if (existingIds.has(migratedElement.id)) {
|
|
4887
|
+
migratedElement = { ...migratedElement, id: randomId() };
|
|
5014
4888
|
}
|
|
4889
|
+
existingIds.add(migratedElement.id);
|
|
4890
|
+
elements.push(migratedElement);
|
|
5015
4891
|
}
|
|
5016
|
-
return
|
|
4892
|
+
return elements;
|
|
5017
4893
|
}, [])
|
|
5018
4894
|
);
|
|
5019
4895
|
if (!opts?.repairBindings) {
|
|
@@ -5057,7 +4933,7 @@ var restoreElements = (elements, localElements, opts) => {
|
|
|
5057
4933
|
restoredElementsMap,
|
|
5058
4934
|
{
|
|
5059
4935
|
points: [
|
|
5060
|
-
|
|
4936
|
+
pointFrom2(0, 0),
|
|
5061
4937
|
element.points[element.points.length - 1]
|
|
5062
4938
|
]
|
|
5063
4939
|
}
|
|
@@ -5086,10 +4962,10 @@ var restoreElements = (elements, localElements, opts) => {
|
|
|
5086
4962
|
width: boundElement.width,
|
|
5087
4963
|
height: boundElement.height,
|
|
5088
4964
|
points: [
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
4965
|
+
pointFrom2(0, 0),
|
|
4966
|
+
pointFrom2(0, -10),
|
|
4967
|
+
pointFrom2(boundElement.width / 2 + 5, -10),
|
|
4968
|
+
pointFrom2(
|
|
5093
4969
|
boundElement.width / 2 + 5,
|
|
5094
4970
|
boundElement.height / 2 + 5
|
|
5095
4971
|
)
|
|
@@ -5167,13 +5043,6 @@ var restoreAppState = (appState, localAppState) => {
|
|
|
5167
5043
|
editingFrame: null
|
|
5168
5044
|
};
|
|
5169
5045
|
};
|
|
5170
|
-
var restore = (data, localAppState, localElements, elementsConfig) => {
|
|
5171
|
-
return {
|
|
5172
|
-
elements: restoreElements(data?.elements, localElements, elementsConfig),
|
|
5173
|
-
appState: restoreAppState(data?.appState, localAppState || null),
|
|
5174
|
-
files: data?.files || {}
|
|
5175
|
-
};
|
|
5176
|
-
};
|
|
5177
5046
|
var restoreLibraryItem = (libraryItem) => {
|
|
5178
5047
|
const elements = restoreElements(
|
|
5179
5048
|
getNonDeletedElements(libraryItem.elements),
|
|
@@ -5213,9 +5082,9 @@ var restoreLibraryItems = (libraryItems = [], defaultStatus) => {
|
|
|
5213
5082
|
// data/blob.ts
|
|
5214
5083
|
var parseFileContents = async (blob) => {
|
|
5215
5084
|
let contents;
|
|
5216
|
-
if (blob.type ===
|
|
5085
|
+
if (blob.type === MIME_TYPES5.png) {
|
|
5217
5086
|
try {
|
|
5218
|
-
return await (await import("./data/image-
|
|
5087
|
+
return await (await import("./data/image-2BHUUSLM.js")).decodePngMetadata(blob);
|
|
5219
5088
|
} catch (error) {
|
|
5220
5089
|
if (error.message === "INVALID") {
|
|
5221
5090
|
throw new ImageSceneDataError(
|
|
@@ -5240,7 +5109,7 @@ var parseFileContents = async (blob) => {
|
|
|
5240
5109
|
};
|
|
5241
5110
|
});
|
|
5242
5111
|
}
|
|
5243
|
-
if (blob.type ===
|
|
5112
|
+
if (blob.type === MIME_TYPES5.svg) {
|
|
5244
5113
|
try {
|
|
5245
5114
|
return decodeSvgBase64Payload({
|
|
5246
5115
|
svg: contents
|
|
@@ -5296,26 +5165,27 @@ var loadSceneOrLibraryFromBlob = async (blob, localAppState, localElements, file
|
|
|
5296
5165
|
}
|
|
5297
5166
|
if (isValidExcalidrawData(data)) {
|
|
5298
5167
|
return {
|
|
5299
|
-
type:
|
|
5300
|
-
data:
|
|
5301
|
-
{
|
|
5302
|
-
|
|
5303
|
-
|
|
5168
|
+
type: MIME_TYPES5.excalidraw,
|
|
5169
|
+
data: {
|
|
5170
|
+
elements: restoreElements(data.elements, localElements, {
|
|
5171
|
+
repairBindings: true,
|
|
5172
|
+
deleteInvisibleElements: true
|
|
5173
|
+
}),
|
|
5174
|
+
appState: restoreAppState(
|
|
5175
|
+
{
|
|
5304
5176
|
theme: localAppState?.theme,
|
|
5305
5177
|
fileHandle: fileHandle || blob.handle || null,
|
|
5306
5178
|
...cleanAppStateForExport(data.appState || {}),
|
|
5307
5179
|
...localAppState ? calculateScrollCenter(data.elements || [], localAppState) : {}
|
|
5308
5180
|
},
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
{ repairBindings: true, refreshDimensions: false }
|
|
5314
|
-
)
|
|
5181
|
+
localAppState
|
|
5182
|
+
),
|
|
5183
|
+
files: data.files || {}
|
|
5184
|
+
}
|
|
5315
5185
|
};
|
|
5316
5186
|
} else if (isValidLibrary(data)) {
|
|
5317
5187
|
return {
|
|
5318
|
-
type:
|
|
5188
|
+
type: MIME_TYPES5.excalidrawlib,
|
|
5319
5189
|
data
|
|
5320
5190
|
};
|
|
5321
5191
|
}
|
|
@@ -5334,7 +5204,7 @@ var loadFromBlob = async (blob, localAppState, localElements, fileHandle) => {
|
|
|
5334
5204
|
localElements,
|
|
5335
5205
|
fileHandle
|
|
5336
5206
|
);
|
|
5337
|
-
if (ret.type !==
|
|
5207
|
+
if (ret.type !== MIME_TYPES5.excalidraw) {
|
|
5338
5208
|
throw new Error("Error: invalid file");
|
|
5339
5209
|
}
|
|
5340
5210
|
return ret.data;
|
|
@@ -5402,7 +5272,7 @@ var dataURLToString = (dataURL) => {
|
|
|
5402
5272
|
return base64ToString(dataURL.slice(dataURL.indexOf(",") + 1));
|
|
5403
5273
|
};
|
|
5404
5274
|
var resizeImageFile = async (file, opts) => {
|
|
5405
|
-
if (file.type ===
|
|
5275
|
+
if (file.type === MIME_TYPES5.svg) {
|
|
5406
5276
|
return file;
|
|
5407
5277
|
}
|
|
5408
5278
|
const [pica, imageBlobReduce] = await Promise.all([
|
|
@@ -5435,7 +5305,7 @@ var resizeImageFile = async (file, opts) => {
|
|
|
5435
5305
|
};
|
|
5436
5306
|
var SVGStringToFile = (SVGString, filename = "") => {
|
|
5437
5307
|
return new File([new TextEncoder().encode(SVGString)], filename, {
|
|
5438
|
-
type:
|
|
5308
|
+
type: MIME_TYPES5.svg
|
|
5439
5309
|
});
|
|
5440
5310
|
};
|
|
5441
5311
|
var ImageURLToFile = async (imageUrl, filename = "") => {
|
|
@@ -5455,16 +5325,11 @@ var ImageURLToFile = async (imageUrl, filename = "") => {
|
|
|
5455
5325
|
}
|
|
5456
5326
|
throw new Error("Error: unsupported file type", { cause: "UNSUPPORTED" });
|
|
5457
5327
|
};
|
|
5458
|
-
var getFileFromEvent = async (event) => {
|
|
5459
|
-
const file = event.dataTransfer.files.item(0);
|
|
5460
|
-
const fileHandle = await getFileHandle(event);
|
|
5461
|
-
return { file: file ? await normalizeFile(file) : null, fileHandle };
|
|
5462
|
-
};
|
|
5463
5328
|
var getFileHandle = async (event) => {
|
|
5464
5329
|
if (nativeFileSystemSupported) {
|
|
5465
5330
|
try {
|
|
5466
|
-
const
|
|
5467
|
-
const handle = await
|
|
5331
|
+
const dataTransferItem = event instanceof DataTransferItem ? event : event.dataTransfer?.items?.[0];
|
|
5332
|
+
const handle = await dataTransferItem.getAsFileSystemHandle() || null;
|
|
5468
5333
|
return handle;
|
|
5469
5334
|
} catch (error) {
|
|
5470
5335
|
console.warn(error.name, error.message);
|
|
@@ -5473,61 +5338,52 @@ var getFileHandle = async (event) => {
|
|
|
5473
5338
|
}
|
|
5474
5339
|
return null;
|
|
5475
5340
|
};
|
|
5476
|
-
var getActualMimeTypeFromImage = (
|
|
5341
|
+
var getActualMimeTypeFromImage = async (file) => {
|
|
5477
5342
|
let mimeType = null;
|
|
5478
|
-
const
|
|
5479
|
-
|
|
5343
|
+
const leadingBytes = [
|
|
5344
|
+
...new Uint8Array(await blobToArrayBuffer(file.slice(0, 15)))
|
|
5345
|
+
].join(" ");
|
|
5346
|
+
const bytes = {
|
|
5480
5347
|
// https://en.wikipedia.org/wiki/Portable_Network_Graphics#File_header
|
|
5481
|
-
png:
|
|
5348
|
+
png: /^137 80 78 71 13 10 26 10\b/,
|
|
5482
5349
|
// https://en.wikipedia.org/wiki/JPEG#Syntax_and_structure
|
|
5483
5350
|
// jpg is a bit wonky. Checking the first three bytes should be enough,
|
|
5484
5351
|
// but may yield false positives. (https://stackoverflow.com/a/23360709/927631)
|
|
5485
|
-
jpg:
|
|
5352
|
+
jpg: /^255 216 255\b/,
|
|
5486
5353
|
// https://en.wikipedia.org/wiki/GIF#Example_GIF_file
|
|
5487
|
-
gif:
|
|
5354
|
+
gif: /^71 73 70 56 57 97\b/,
|
|
5355
|
+
// 4 bytes for RIFF + 4 bytes for chunk size + WEBP identifier
|
|
5356
|
+
webp: /^82 73 70 70 \d+ \d+ \d+ \d+ 87 69 66 80 86 80 56\b/
|
|
5488
5357
|
};
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
return mimeType;
|
|
5358
|
+
for (const type of Object.keys(bytes)) {
|
|
5359
|
+
if (leadingBytes.match(bytes[type])) {
|
|
5360
|
+
mimeType = MIME_TYPES5[type];
|
|
5361
|
+
break;
|
|
5362
|
+
}
|
|
5363
|
+
}
|
|
5364
|
+
return mimeType || file.type || null;
|
|
5497
5365
|
};
|
|
5498
5366
|
var createFile = (blob, mimeType, name) => {
|
|
5499
5367
|
return new File([blob], name || "", {
|
|
5500
5368
|
type: mimeType
|
|
5501
5369
|
});
|
|
5502
5370
|
};
|
|
5371
|
+
var normalizedFileSymbol = Symbol("fileNormalized");
|
|
5503
5372
|
var normalizeFile = async (file) => {
|
|
5504
|
-
if (
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
await blobToArrayBuffer(file),
|
|
5514
|
-
MIME_TYPES6.excalidraw,
|
|
5515
|
-
file.name
|
|
5516
|
-
);
|
|
5517
|
-
} else {
|
|
5518
|
-
const buffer = await blobToArrayBuffer(file);
|
|
5519
|
-
const mimeType = getActualMimeTypeFromImage(buffer);
|
|
5520
|
-
if (mimeType) {
|
|
5521
|
-
file = createFile(buffer, mimeType, file.name);
|
|
5522
|
-
}
|
|
5523
|
-
}
|
|
5524
|
-
} else if (isSupportedImageFile(file)) {
|
|
5525
|
-
const buffer = await blobToArrayBuffer(file);
|
|
5526
|
-
const mimeType = getActualMimeTypeFromImage(buffer);
|
|
5373
|
+
if (file[normalizedFileSymbol]) {
|
|
5374
|
+
return file;
|
|
5375
|
+
}
|
|
5376
|
+
if (file?.name?.endsWith(".excalidrawlib")) {
|
|
5377
|
+
file = createFile(file, MIME_TYPES5.excalidrawlib, file.name);
|
|
5378
|
+
} else if (file?.name?.endsWith(".excalidraw")) {
|
|
5379
|
+
file = createFile(file, MIME_TYPES5.excalidraw, file.name);
|
|
5380
|
+
} else if (!file.type || file.type?.startsWith("image/")) {
|
|
5381
|
+
const mimeType = await getActualMimeTypeFromImage(file);
|
|
5527
5382
|
if (mimeType && mimeType !== file.type) {
|
|
5528
|
-
file = createFile(
|
|
5383
|
+
file = createFile(file, mimeType, file.name);
|
|
5529
5384
|
}
|
|
5530
5385
|
}
|
|
5386
|
+
file[normalizedFileSymbol] = true;
|
|
5531
5387
|
return file;
|
|
5532
5388
|
};
|
|
5533
5389
|
var blobToArrayBuffer = (blob) => {
|
|
@@ -5561,7 +5417,7 @@ var encodePngMetadata = async ({
|
|
|
5561
5417
|
}) => {
|
|
5562
5418
|
const chunks = decodePng(new Uint8Array(await blobToArrayBuffer(blob)));
|
|
5563
5419
|
const metadataChunk = tEXt.encode(
|
|
5564
|
-
|
|
5420
|
+
MIME_TYPES6.excalidraw,
|
|
5565
5421
|
JSON.stringify(
|
|
5566
5422
|
encode({
|
|
5567
5423
|
text: metadata,
|
|
@@ -5570,11 +5426,11 @@ var encodePngMetadata = async ({
|
|
|
5570
5426
|
)
|
|
5571
5427
|
);
|
|
5572
5428
|
chunks.splice(-1, 0, metadataChunk);
|
|
5573
|
-
return new Blob([encodePng(chunks)], { type:
|
|
5429
|
+
return new Blob([encodePng(chunks)], { type: MIME_TYPES6.png });
|
|
5574
5430
|
};
|
|
5575
5431
|
var decodePngMetadata = async (blob) => {
|
|
5576
5432
|
const metadata = await getTEXtChunk(blob);
|
|
5577
|
-
if (metadata?.keyword ===
|
|
5433
|
+
if (metadata?.keyword === MIME_TYPES6.excalidraw) {
|
|
5578
5434
|
try {
|
|
5579
5435
|
const encodedData = JSON.parse(metadata.text);
|
|
5580
5436
|
if (!("encoded" in encodedData)) {
|
|
@@ -5609,6 +5465,7 @@ export {
|
|
|
5609
5465
|
AbortError,
|
|
5610
5466
|
ImageSceneDataError,
|
|
5611
5467
|
ExcalidrawError,
|
|
5468
|
+
RequestError,
|
|
5612
5469
|
Fonts,
|
|
5613
5470
|
getDefaultAppState,
|
|
5614
5471
|
isEraserActive,
|
|
@@ -5627,19 +5484,16 @@ export {
|
|
|
5627
5484
|
fillCircle,
|
|
5628
5485
|
getNormalizedCanvasDimensions,
|
|
5629
5486
|
bootstrapCanvas,
|
|
5630
|
-
|
|
5631
|
-
strokeEllipseWithRotation,
|
|
5632
|
-
strokeRectWithRotation,
|
|
5633
|
-
drawHighlightForDiamondWithRotation,
|
|
5487
|
+
strokeRectWithRotation_simple,
|
|
5634
5488
|
frameClip,
|
|
5635
5489
|
renderStaticSceneThrottled,
|
|
5636
5490
|
renderStaticScene,
|
|
5637
5491
|
exportToCanvas,
|
|
5638
5492
|
exportToSvg,
|
|
5639
5493
|
getExportSize,
|
|
5494
|
+
restoreElement,
|
|
5640
5495
|
restoreElements,
|
|
5641
5496
|
restoreAppState,
|
|
5642
|
-
restore,
|
|
5643
5497
|
restoreLibraryItems,
|
|
5644
5498
|
getTEXtChunk,
|
|
5645
5499
|
encodePngMetadata,
|
|
@@ -5661,8 +5515,8 @@ export {
|
|
|
5661
5515
|
resizeImageFile,
|
|
5662
5516
|
SVGStringToFile,
|
|
5663
5517
|
ImageURLToFile,
|
|
5664
|
-
|
|
5518
|
+
getFileHandle,
|
|
5665
5519
|
createFile,
|
|
5666
5520
|
normalizeFile
|
|
5667
5521
|
};
|
|
5668
|
-
//# sourceMappingURL=chunk-
|
|
5522
|
+
//# sourceMappingURL=chunk-PW6TXCLQ.js.map
|