@uploadcare/file-uploader 1.23.0 → 1.24.0-alpha.1
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/abstract/loadFileUploaderFrom.d.ts +14 -0
- package/dist/abstract/loadFileUploaderFrom.js +78 -0
- package/dist/env.d.ts +4 -0
- package/dist/env.js +36 -0
- package/dist/index.css +2714 -0
- package/dist/index.d.ts +2043 -0
- package/dist/index.js +11914 -0
- package/{index.ssr.js → dist/index.ssr.js} +1113 -1086
- package/{locales → dist/locales}/file-uploader/ar.d.ts +2 -2
- package/dist/locales/file-uploader/ar.js +168 -0
- package/{locales → dist/locales}/file-uploader/az.d.ts +2 -2
- package/dist/locales/file-uploader/az.js +160 -0
- package/{locales → dist/locales}/file-uploader/ca.d.ts +2 -2
- package/dist/locales/file-uploader/ca.js +162 -0
- package/{locales → dist/locales}/file-uploader/cs.d.ts +2 -2
- package/dist/locales/file-uploader/cs.js +164 -0
- package/{locales → dist/locales}/file-uploader/da.d.ts +2 -2
- package/dist/locales/file-uploader/da.js +160 -0
- package/{locales → dist/locales}/file-uploader/de.d.ts +2 -2
- package/dist/locales/file-uploader/de.js +160 -0
- package/{locales → dist/locales}/file-uploader/el.d.ts +2 -2
- package/dist/locales/file-uploader/el.js +160 -0
- package/{locales → dist/locales}/file-uploader/en.d.ts +2 -2
- package/dist/locales/file-uploader/en.js +160 -0
- package/{locales → dist/locales}/file-uploader/es.d.ts +2 -2
- package/dist/locales/file-uploader/es.js +162 -0
- package/{locales → dist/locales}/file-uploader/et.d.ts +2 -2
- package/dist/locales/file-uploader/et.js +160 -0
- package/{locales → dist/locales}/file-uploader/fi.d.ts +2 -2
- package/dist/locales/file-uploader/fi.js +160 -0
- package/{locales → dist/locales}/file-uploader/fr.d.ts +2 -2
- package/dist/locales/file-uploader/fr.js +162 -0
- package/{locales → dist/locales}/file-uploader/he.d.ts +2 -2
- package/dist/locales/file-uploader/he.js +162 -0
- package/{locales → dist/locales}/file-uploader/hy.d.ts +2 -2
- package/dist/locales/file-uploader/hy.js +160 -0
- package/{locales → dist/locales}/file-uploader/is.d.ts +2 -2
- package/dist/locales/file-uploader/is.js +160 -0
- package/{locales → dist/locales}/file-uploader/it.d.ts +2 -2
- package/dist/locales/file-uploader/it.js +162 -0
- package/{locales → dist/locales}/file-uploader/ja.d.ts +2 -2
- package/dist/locales/file-uploader/ja.js +160 -0
- package/{locales → dist/locales}/file-uploader/ka.d.ts +2 -2
- package/dist/locales/file-uploader/ka.js +160 -0
- package/{locales → dist/locales}/file-uploader/kk.d.ts +2 -2
- package/dist/locales/file-uploader/kk.js +160 -0
- package/{locales → dist/locales}/file-uploader/ko.d.ts +2 -2
- package/dist/locales/file-uploader/ko.js +160 -0
- package/{locales → dist/locales}/file-uploader/lv.d.ts +2 -2
- package/dist/locales/file-uploader/lv.js +162 -0
- package/{locales → dist/locales}/file-uploader/nb.d.ts +2 -2
- package/dist/locales/file-uploader/nb.js +160 -0
- package/{locales → dist/locales}/file-uploader/nl.d.ts +2 -2
- package/dist/locales/file-uploader/nl.js +160 -0
- package/{locales → dist/locales}/file-uploader/pl.d.ts +2 -2
- package/dist/locales/file-uploader/pl.js +164 -0
- package/{locales → dist/locales}/file-uploader/pt.d.ts +2 -2
- package/dist/locales/file-uploader/pt.js +162 -0
- package/{locales → dist/locales}/file-uploader/ro.d.ts +2 -2
- package/dist/locales/file-uploader/ro.js +162 -0
- package/{locales → dist/locales}/file-uploader/ru.d.ts +2 -2
- package/dist/locales/file-uploader/ru.js +164 -0
- package/{locales → dist/locales}/file-uploader/sk.d.ts +2 -2
- package/dist/locales/file-uploader/sk.js +164 -0
- package/{locales → dist/locales}/file-uploader/sr.d.ts +2 -2
- package/dist/locales/file-uploader/sr.js +162 -0
- package/{locales → dist/locales}/file-uploader/sv.d.ts +2 -2
- package/dist/locales/file-uploader/sv.js +160 -0
- package/{locales → dist/locales}/file-uploader/tr.d.ts +2 -2
- package/dist/locales/file-uploader/tr.js +160 -0
- package/{locales → dist/locales}/file-uploader/uk.d.ts +2 -2
- package/dist/locales/file-uploader/uk.js +164 -0
- package/{locales → dist/locales}/file-uploader/vi.d.ts +2 -2
- package/dist/locales/file-uploader/vi.js +160 -0
- package/dist/locales/file-uploader/zh-TW.d.ts +132 -0
- package/dist/locales/file-uploader/zh-TW.js +160 -0
- package/{locales → dist/locales}/file-uploader/zh.d.ts +2 -2
- package/dist/locales/file-uploader/zh.js +160 -0
- package/package.json +104 -56
- package/types/jsx.d.ts +10 -10
- package/web/file-uploader.iife.min.d.ts +2057 -0
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.min.d.ts +2057 -0
- package/web/file-uploader.min.js +4 -4
- package/web/uc-basic.min.css +26 -1
- package/web/uc-cloud-image-editor.min.css +26 -1
- package/web/uc-cloud-image-editor.min.d.ts +1544 -0
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.min.css +26 -1
- package/web/uc-file-uploader-inline.min.d.ts +2057 -0
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.css +26 -1
- package/web/uc-file-uploader-minimal.min.d.ts +2057 -0
- package/web/uc-file-uploader-minimal.min.js +4 -4
- package/web/uc-file-uploader-regular.min.css +26 -1
- package/web/uc-file-uploader-regular.min.d.ts +2057 -0
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/{blocks/Img/ImgBase.d.ts → web/uc-img.min.d.ts} +38 -3
- package/web/uc-img.min.js +3 -3
- package/abstract/ActivityBlock.d.ts +0 -79
- package/abstract/ActivityBlock.d.ts.map +0 -1
- package/abstract/ActivityBlock.js +0 -216
- package/abstract/Block.d.ts +0 -113
- package/abstract/Block.d.ts.map +0 -1
- package/abstract/Block.js +0 -410
- package/abstract/CTX.d.ts +0 -30
- package/abstract/CTX.d.ts.map +0 -1
- package/abstract/CTX.js +0 -39
- package/abstract/SolutionBlock.d.ts +0 -22
- package/abstract/SolutionBlock.d.ts.map +0 -1
- package/abstract/SolutionBlock.js +0 -23
- package/abstract/TypedCollection.d.ts +0 -127
- package/abstract/TypedCollection.d.ts.map +0 -1
- package/abstract/TypedCollection.js +0 -265
- package/abstract/TypedData.d.ts +0 -93
- package/abstract/TypedData.d.ts.map +0 -1
- package/abstract/TypedData.js +0 -134
- package/abstract/UploaderBlock.d.ts +0 -121
- package/abstract/UploaderBlock.d.ts.map +0 -1
- package/abstract/UploaderBlock.js +0 -533
- package/abstract/UploaderPublicApi.d.ts +0 -100
- package/abstract/UploaderPublicApi.d.ts.map +0 -1
- package/abstract/UploaderPublicApi.js +0 -407
- package/abstract/buildOutputCollectionState.d.ts +0 -8
- package/abstract/buildOutputCollectionState.d.ts.map +0 -1
- package/abstract/buildOutputCollectionState.js +0 -136
- package/abstract/defineComponents.d.ts +0 -5
- package/abstract/defineComponents.d.ts.map +0 -1
- package/abstract/defineComponents.js +0 -21
- package/abstract/l10nProcessor.d.ts +0 -7
- package/abstract/l10nProcessor.d.ts.map +0 -1
- package/abstract/l10nProcessor.js +0 -93
- package/abstract/loadFileUploaderFrom.d.ts +0 -8
- package/abstract/loadFileUploaderFrom.d.ts.map +0 -1
- package/abstract/loadFileUploaderFrom.js +0 -34
- package/abstract/localeRegistry.d.ts +0 -5
- package/abstract/localeRegistry.d.ts.map +0 -1
- package/abstract/localeRegistry.js +0 -63
- package/abstract/managers/LocaleManager.d.ts +0 -38
- package/abstract/managers/LocaleManager.d.ts.map +0 -1
- package/abstract/managers/LocaleManager.js +0 -130
- package/abstract/managers/ModalManager.d.ts +0 -122
- package/abstract/managers/ModalManager.d.ts.map +0 -1
- package/abstract/managers/ModalManager.js +0 -235
- package/abstract/managers/SecureUploadsManager.d.ts +0 -22
- package/abstract/managers/SecureUploadsManager.d.ts.map +0 -1
- package/abstract/managers/SecureUploadsManager.js +0 -91
- package/abstract/managers/TelemetryManager.d.ts +0 -71
- package/abstract/managers/TelemetryManager.d.ts.map +0 -1
- package/abstract/managers/TelemetryManager.js +0 -218
- package/abstract/managers/ValidationManager.d.ts +0 -209
- package/abstract/managers/ValidationManager.d.ts.map +0 -1
- package/abstract/managers/ValidationManager.js +0 -340
- package/abstract/managers/a11y.d.ts +0 -20
- package/abstract/managers/a11y.d.ts.map +0 -1
- package/abstract/managers/a11y.js +0 -118
- package/abstract/sharedConfigKey.d.ts +0 -2
- package/abstract/sharedConfigKey.d.ts.map +0 -1
- package/abstract/sharedConfigKey.js +0 -8
- package/abstract/testModeProcessor.d.ts +0 -7
- package/abstract/testModeProcessor.d.ts.map +0 -1
- package/abstract/testModeProcessor.js +0 -39
- package/abstract/uploadEntrySchema.d.ts +0 -134
- package/abstract/uploadEntrySchema.d.ts.map +0 -1
- package/abstract/uploadEntrySchema.js +0 -132
- package/blocks/ActivityHeader/ActivityHeader.d.ts +0 -4
- package/blocks/ActivityHeader/ActivityHeader.d.ts.map +0 -1
- package/blocks/ActivityHeader/ActivityHeader.js +0 -3
- package/blocks/ActivityHeader/activity-header.css +0 -14
- package/blocks/CameraSource/CameraSource.d.ts +0 -176
- package/blocks/CameraSource/CameraSource.d.ts.map +0 -1
- package/blocks/CameraSource/CameraSource.js +0 -929
- package/blocks/CameraSource/calcCameraModes.d.ts +0 -5
- package/blocks/CameraSource/calcCameraModes.d.ts.map +0 -1
- package/blocks/CameraSource/calcCameraModes.js +0 -11
- package/blocks/CameraSource/camera-source.css +0 -183
- package/blocks/CameraSource/constants.d.ts +0 -16
- package/blocks/CameraSource/constants.d.ts.map +0 -1
- package/blocks/CameraSource/constants.js +0 -19
- package/blocks/CloudImageEditor/index.css +0 -1
- package/blocks/CloudImageEditor/index.d.ts +0 -2
- package/blocks/CloudImageEditor/index.d.ts.map +0 -1
- package/blocks/CloudImageEditor/index.js +0 -1
- package/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts +0 -59
- package/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/CloudImageEditorBlock.js +0 -243
- package/blocks/CloudImageEditor/src/CropFrame.d.ts +0 -158
- package/blocks/CloudImageEditor/src/CropFrame.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/CropFrame.js +0 -569
- package/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts +0 -14
- package/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.js +0 -140
- package/blocks/CloudImageEditor/src/EditorButtonControl.d.ts +0 -10
- package/blocks/CloudImageEditor/src/EditorButtonControl.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorButtonControl.js +0 -45
- package/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts +0 -6
- package/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorCropButtonControl.js +0 -52
- package/blocks/CloudImageEditor/src/EditorFilterControl.d.ts +0 -18
- package/blocks/CloudImageEditor/src/EditorFilterControl.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorFilterControl.js +0 -177
- package/blocks/CloudImageEditor/src/EditorImageCropper.d.ts +0 -106
- package/blocks/CloudImageEditor/src/EditorImageCropper.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorImageCropper.js +0 -551
- package/blocks/CloudImageEditor/src/EditorImageFader.d.ts +0 -132
- package/blocks/CloudImageEditor/src/EditorImageFader.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorImageFader.js +0 -456
- package/blocks/CloudImageEditor/src/EditorOperationControl.d.ts +0 -9
- package/blocks/CloudImageEditor/src/EditorOperationControl.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorOperationControl.js +0 -50
- package/blocks/CloudImageEditor/src/EditorScroller.d.ts +0 -7
- package/blocks/CloudImageEditor/src/EditorScroller.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorScroller.js +0 -33
- package/blocks/CloudImageEditor/src/EditorSlider.d.ts +0 -24
- package/blocks/CloudImageEditor/src/EditorSlider.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorSlider.js +0 -118
- package/blocks/CloudImageEditor/src/EditorToolbar.d.ts +0 -124
- package/blocks/CloudImageEditor/src/EditorToolbar.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/EditorToolbar.js +0 -534
- package/blocks/CloudImageEditor/src/crop-utils.d.ts +0 -123
- package/blocks/CloudImageEditor/src/crop-utils.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/crop-utils.js +0 -729
- package/blocks/CloudImageEditor/src/cropper-constants.d.ts +0 -11
- package/blocks/CloudImageEditor/src/cropper-constants.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/cropper-constants.js +0 -11
- package/blocks/CloudImageEditor/src/css/common.css +0 -1259
- package/blocks/CloudImageEditor/src/css/icons.css +0 -12
- package/blocks/CloudImageEditor/src/css/index.css +0 -2
- package/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts +0 -21
- package/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/elements/button/BtnUi.js +0 -99
- package/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts +0 -11
- package/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.js +0 -52
- package/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts +0 -17
- package/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.js +0 -71
- package/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts +0 -16
- package/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/elements/slider/SliderUi.js +0 -179
- package/blocks/CloudImageEditor/src/index.d.ts +0 -16
- package/blocks/CloudImageEditor/src/index.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/index.js +0 -15
- package/blocks/CloudImageEditor/src/lib/FocusVisible.d.ts +0 -15
- package/blocks/CloudImageEditor/src/lib/FocusVisible.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/FocusVisible.js +0 -33
- package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.d.ts +0 -10
- package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.js +0 -256
- package/blocks/CloudImageEditor/src/lib/classNames.d.ts +0 -3
- package/blocks/CloudImageEditor/src/lib/classNames.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/classNames.js +0 -34
- package/blocks/CloudImageEditor/src/lib/linspace.d.ts +0 -8
- package/blocks/CloudImageEditor/src/lib/linspace.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/linspace.js +0 -14
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts +0 -3
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.js +0 -80
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.test.d.ts +0 -2
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.test.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.test.js +0 -35
- package/blocks/CloudImageEditor/src/lib/parseTabs.d.ts +0 -2
- package/blocks/CloudImageEditor/src/lib/parseTabs.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/parseTabs.js +0 -14
- package/blocks/CloudImageEditor/src/lib/pick.d.ts +0 -7
- package/blocks/CloudImageEditor/src/lib/pick.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/pick.js +0 -15
- package/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts +0 -14
- package/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/lib/transformationUtils.js +0 -167
- package/blocks/CloudImageEditor/src/state.d.ts +0 -38
- package/blocks/CloudImageEditor/src/state.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/state.js +0 -92
- package/blocks/CloudImageEditor/src/svg-sprite.d.ts +0 -3
- package/blocks/CloudImageEditor/src/svg-sprite.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/svg-sprite.js +0 -1
- package/blocks/CloudImageEditor/src/template.d.ts +0 -2
- package/blocks/CloudImageEditor/src/template.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/template.js +0 -36
- package/blocks/CloudImageEditor/src/toolbar-constants.d.ts +0 -59
- package/blocks/CloudImageEditor/src/toolbar-constants.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/toolbar-constants.js +0 -116
- package/blocks/CloudImageEditor/src/types.d.ts +0 -66
- package/blocks/CloudImageEditor/src/types.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/types.js +0 -80
- package/blocks/CloudImageEditor/src/util.d.ts +0 -2
- package/blocks/CloudImageEditor/src/util.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/util.js +0 -21
- package/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts +0 -11
- package/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/utils/parseFilterValue.js +0 -11
- package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts +0 -29
- package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts.map +0 -1
- package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.js +0 -128
- package/blocks/CloudImageEditorActivity/index.css +0 -13
- package/blocks/CloudImageEditorActivity/test.d.ts +0 -2
- package/blocks/CloudImageEditorActivity/test.d.ts.map +0 -1
- package/blocks/CloudImageEditorActivity/test.js +0 -9
- package/blocks/Config/Config.d.ts +0 -60
- package/blocks/Config/Config.d.ts.map +0 -1
- package/blocks/Config/Config.js +0 -263
- package/blocks/Config/assertions.d.ts +0 -5
- package/blocks/Config/assertions.d.ts.map +0 -1
- package/blocks/Config/assertions.js +0 -37
- package/blocks/Config/config.css +0 -3
- package/blocks/Config/initialConfig.d.ts +0 -7
- package/blocks/Config/initialConfig.d.ts.map +0 -1
- package/blocks/Config/initialConfig.js +0 -93
- package/blocks/Config/normalizeConfigValue.d.ts +0 -2
- package/blocks/Config/normalizeConfigValue.d.ts.map +0 -1
- package/blocks/Config/normalizeConfigValue.js +0 -129
- package/blocks/Config/side-effects.d.ts +0 -11
- package/blocks/Config/side-effects.d.ts.map +0 -1
- package/blocks/Config/side-effects.js +0 -126
- package/blocks/Config/validatorsType.d.ts +0 -37
- package/blocks/Config/validatorsType.d.ts.map +0 -1
- package/blocks/Config/validatorsType.js +0 -134
- package/blocks/Copyright/Copyright.d.ts +0 -4
- package/blocks/Copyright/Copyright.d.ts.map +0 -1
- package/blocks/Copyright/Copyright.js +0 -24
- package/blocks/Copyright/copyright.css +0 -32
- package/blocks/DropArea/DropArea.d.ts +0 -49
- package/blocks/DropArea/DropArea.d.ts.map +0 -1
- package/blocks/DropArea/DropArea.js +0 -292
- package/blocks/DropArea/addDropzone.d.ts +0 -21
- package/blocks/DropArea/addDropzone.d.ts.map +0 -1
- package/blocks/DropArea/addDropzone.js +0 -137
- package/blocks/DropArea/drop-area.css +0 -201
- package/blocks/DropArea/getDropItems.d.ts +0 -16
- package/blocks/DropArea/getDropItems.d.ts.map +0 -1
- package/blocks/DropArea/getDropItems.js +0 -167
- package/blocks/ExternalSource/ExternalSource.d.ts +0 -82
- package/blocks/ExternalSource/ExternalSource.d.ts.map +0 -1
- package/blocks/ExternalSource/ExternalSource.js +0 -320
- package/blocks/ExternalSource/MessageBridge.d.ts +0 -20
- package/blocks/ExternalSource/MessageBridge.d.ts.map +0 -1
- package/blocks/ExternalSource/MessageBridge.js +0 -73
- package/blocks/ExternalSource/buildThemeDefinition.d.ts +0 -3
- package/blocks/ExternalSource/buildThemeDefinition.d.ts.map +0 -1
- package/blocks/ExternalSource/buildThemeDefinition.js +0 -47
- package/blocks/ExternalSource/external-source.css +0 -94
- package/blocks/ExternalSource/query-string.d.ts +0 -8
- package/blocks/ExternalSource/query-string.d.ts.map +0 -1
- package/blocks/ExternalSource/query-string.js +0 -14
- package/blocks/ExternalSource/types.d.ts +0 -106
- package/blocks/ExternalSource/types.d.ts.map +0 -1
- package/blocks/ExternalSource/types.js +0 -133
- package/blocks/FileItem/FileItem.d.ts +0 -76
- package/blocks/FileItem/FileItem.d.ts.map +0 -1
- package/blocks/FileItem/FileItem.js +0 -480
- package/blocks/FileItem/FileItemConfig.d.ts +0 -28
- package/blocks/FileItem/FileItemConfig.d.ts.map +0 -1
- package/blocks/FileItem/FileItemConfig.js +0 -74
- package/blocks/FileItem/file-item.css +0 -243
- package/blocks/FormInput/FormInput.d.ts +0 -7
- package/blocks/FormInput/FormInput.d.ts.map +0 -1
- package/blocks/FormInput/FormInput.js +0 -92
- package/blocks/Icon/Icon.d.ts +0 -11
- package/blocks/Icon/Icon.d.ts.map +0 -1
- package/blocks/Icon/Icon.js +0 -43
- package/blocks/Icon/icon.css +0 -12
- package/blocks/Img/Img.d.ts +0 -4
- package/blocks/Img/Img.d.ts.map +0 -1
- package/blocks/Img/Img.js +0 -21
- package/blocks/Img/ImgBase.d.ts.map +0 -1
- package/blocks/Img/ImgBase.js +0 -408
- package/blocks/Img/ImgConfig.d.ts +0 -31
- package/blocks/Img/ImgConfig.d.ts.map +0 -1
- package/blocks/Img/ImgConfig.js +0 -102
- package/blocks/Img/configurations.d.ts +0 -12
- package/blocks/Img/configurations.d.ts.map +0 -1
- package/blocks/Img/configurations.js +0 -14
- package/blocks/Img/props-map.d.ts +0 -29
- package/blocks/Img/props-map.d.ts.map +0 -1
- package/blocks/Img/props-map.js +0 -34
- package/blocks/Img/test.css +0 -16
- package/blocks/Img/utils/parseObjectToString.d.ts +0 -2
- package/blocks/Img/utils/parseObjectToString.d.ts.map +0 -1
- package/blocks/Img/utils/parseObjectToString.js +0 -13
- package/blocks/Modal/Modal.d.ts +0 -43
- package/blocks/Modal/Modal.d.ts.map +0 -1
- package/blocks/Modal/Modal.js +0 -158
- package/blocks/Modal/modal.css +0 -45
- package/blocks/ProgressBar/ProgressBar.d.ts +0 -17
- package/blocks/ProgressBar/ProgressBar.d.ts.map +0 -1
- package/blocks/ProgressBar/ProgressBar.js +0 -62
- package/blocks/ProgressBar/progress-bar.css +0 -62
- package/blocks/ProgressBarCommon/ProgressBarCommon.d.ts +0 -8
- package/blocks/ProgressBarCommon/ProgressBarCommon.d.ts.map +0 -1
- package/blocks/ProgressBarCommon/ProgressBarCommon.js +0 -44
- package/blocks/ProgressBarCommon/progress-bar-common.css +0 -16
- package/blocks/Range/Range.d.ts +0 -16
- package/blocks/Range/Range.d.ts.map +0 -1
- package/blocks/Range/Range.js +0 -44
- package/blocks/Range/range.css +0 -65
- package/blocks/Select/Select.d.ts +0 -9
- package/blocks/Select/Select.d.ts.map +0 -1
- package/blocks/Select/Select.js +0 -35
- package/blocks/Select/select.css +0 -22
- package/blocks/SimpleBtn/SimpleBtn.d.ts +0 -25
- package/blocks/SimpleBtn/SimpleBtn.d.ts.map +0 -1
- package/blocks/SimpleBtn/SimpleBtn.js +0 -54
- package/blocks/SimpleBtn/simple-btn.css +0 -64
- package/blocks/SourceBtn/SourceBtn.d.ts +0 -57
- package/blocks/SourceBtn/SourceBtn.d.ts.map +0 -1
- package/blocks/SourceBtn/SourceBtn.js +0 -172
- package/blocks/SourceBtn/source-btn.css +0 -53
- package/blocks/SourceList/SourceList.d.ts +0 -4
- package/blocks/SourceList/SourceList.d.ts.map +0 -1
- package/blocks/SourceList/SourceList.js +0 -51
- package/blocks/Spinner/Spinner.d.ts +0 -8
- package/blocks/Spinner/Spinner.d.ts.map +0 -1
- package/blocks/Spinner/Spinner.js +0 -5
- package/blocks/Spinner/spinner.css +0 -18
- package/blocks/StartFrom/StartFrom.d.ts +0 -7
- package/blocks/StartFrom/StartFrom.d.ts.map +0 -1
- package/blocks/StartFrom/StartFrom.js +0 -14
- package/blocks/StartFrom/start-from.css +0 -28
- package/blocks/Thumb/Thumb.d.ts +0 -51
- package/blocks/Thumb/Thumb.d.ts.map +0 -1
- package/blocks/Thumb/Thumb.js +0 -235
- package/blocks/Thumb/thumb.css +0 -4
- package/blocks/UploadCtxProvider/EventEmitter.d.ts +0 -125
- package/blocks/UploadCtxProvider/EventEmitter.d.ts.map +0 -1
- package/blocks/UploadCtxProvider/EventEmitter.js +0 -144
- package/blocks/UploadCtxProvider/UploadCtxProvider.d.ts +0 -35
- package/blocks/UploadCtxProvider/UploadCtxProvider.d.ts.map +0 -1
- package/blocks/UploadCtxProvider/UploadCtxProvider.js +0 -46
- package/blocks/UploadList/UploadList.d.ts +0 -62
- package/blocks/UploadList/UploadList.d.ts.map +0 -1
- package/blocks/UploadList/UploadList.js +0 -261
- package/blocks/UploadList/upload-list.css +0 -88
- package/blocks/UrlSource/UrlSource.d.ts +0 -9
- package/blocks/UrlSource/UrlSource.d.ts.map +0 -1
- package/blocks/UrlSource/UrlSource.js +0 -69
- package/blocks/UrlSource/url-source.css +0 -16
- package/blocks/svg-backgrounds/svg-backgrounds.d.ts +0 -17
- package/blocks/svg-backgrounds/svg-backgrounds.d.ts.map +0 -1
- package/blocks/svg-backgrounds/svg-backgrounds.js +0 -45
- package/blocks/themes/uc-basic/common.css +0 -129
- package/blocks/themes/uc-basic/config.css +0 -4
- package/blocks/themes/uc-basic/index.css +0 -37
- package/blocks/themes/uc-basic/post-reset.css +0 -3
- package/blocks/themes/uc-basic/svg-sprite.d.ts +0 -3
- package/blocks/themes/uc-basic/svg-sprite.d.ts.map +0 -1
- package/blocks/themes/uc-basic/svg-sprite.js +0 -1
- package/blocks/themes/uc-basic/theme.css +0 -291
- package/blocks/utils/UploadSource.d.ts +0 -39
- package/blocks/utils/UploadSource.d.ts.map +0 -1
- package/blocks/utils/UploadSource.js +0 -33
- package/blocks/utils/abilities.d.ts +0 -2
- package/blocks/utils/abilities.d.ts.map +0 -1
- package/blocks/utils/abilities.js +0 -3
- package/blocks/utils/comma-separated.d.ts +0 -3
- package/blocks/utils/comma-separated.d.ts.map +0 -1
- package/blocks/utils/comma-separated.js +0 -22
- package/blocks/utils/debounce.d.ts +0 -12
- package/blocks/utils/debounce.d.ts.map +0 -1
- package/blocks/utils/debounce.js +0 -22
- package/blocks/utils/preloadImage.d.ts +0 -11
- package/blocks/utils/preloadImage.d.ts.map +0 -1
- package/blocks/utils/preloadImage.js +0 -38
- package/blocks/utils/resizeImage.d.ts +0 -6
- package/blocks/utils/resizeImage.d.ts.map +0 -1
- package/blocks/utils/resizeImage.js +0 -40
- package/blocks/utils/throttle.d.ts +0 -6
- package/blocks/utils/throttle.d.ts.map +0 -1
- package/blocks/utils/throttle.js +0 -45
- package/blocks/utils/userAgent.d.ts +0 -6
- package/blocks/utils/userAgent.d.ts.map +0 -1
- package/blocks/utils/userAgent.js +0 -14
- package/env.d.ts +0 -4
- package/env.d.ts.map +0 -1
- package/env.js +0 -3
- package/index.d.ts +0 -43
- package/index.d.ts.map +0 -1
- package/index.js +0 -55
- package/index.ssr.d.ts +0 -1111
- package/index.ssr.d.ts.map +0 -1
- package/locales/file-uploader/ar.d.ts.map +0 -1
- package/locales/file-uploader/ar.js +0 -139
- package/locales/file-uploader/az.d.ts.map +0 -1
- package/locales/file-uploader/az.js +0 -133
- package/locales/file-uploader/ca.d.ts.map +0 -1
- package/locales/file-uploader/ca.js +0 -137
- package/locales/file-uploader/cs.d.ts.map +0 -1
- package/locales/file-uploader/cs.js +0 -139
- package/locales/file-uploader/da.d.ts.map +0 -1
- package/locales/file-uploader/da.js +0 -135
- package/locales/file-uploader/de.d.ts.map +0 -1
- package/locales/file-uploader/de.js +0 -136
- package/locales/file-uploader/el.d.ts.map +0 -1
- package/locales/file-uploader/el.js +0 -136
- package/locales/file-uploader/en.d.ts.map +0 -1
- package/locales/file-uploader/en.js +0 -131
- package/locales/file-uploader/es.d.ts.map +0 -1
- package/locales/file-uploader/es.js +0 -137
- package/locales/file-uploader/et.d.ts.map +0 -1
- package/locales/file-uploader/et.js +0 -134
- package/locales/file-uploader/fi.d.ts.map +0 -1
- package/locales/file-uploader/fi.js +0 -135
- package/locales/file-uploader/fr.d.ts.map +0 -1
- package/locales/file-uploader/fr.js +0 -137
- package/locales/file-uploader/he.d.ts.map +0 -1
- package/locales/file-uploader/he.js +0 -136
- package/locales/file-uploader/hy.d.ts.map +0 -1
- package/locales/file-uploader/hy.js +0 -132
- package/locales/file-uploader/is.d.ts.map +0 -1
- package/locales/file-uploader/is.js +0 -134
- package/locales/file-uploader/it.d.ts.map +0 -1
- package/locales/file-uploader/it.js +0 -137
- package/locales/file-uploader/ja.d.ts.map +0 -1
- package/locales/file-uploader/ja.js +0 -134
- package/locales/file-uploader/ka.d.ts.map +0 -1
- package/locales/file-uploader/ka.js +0 -134
- package/locales/file-uploader/kk.d.ts.map +0 -1
- package/locales/file-uploader/kk.js +0 -134
- package/locales/file-uploader/ko.d.ts.map +0 -1
- package/locales/file-uploader/ko.js +0 -133
- package/locales/file-uploader/lv.d.ts.map +0 -1
- package/locales/file-uploader/lv.js +0 -136
- package/locales/file-uploader/nb.d.ts.map +0 -1
- package/locales/file-uploader/nb.js +0 -134
- package/locales/file-uploader/nl.d.ts.map +0 -1
- package/locales/file-uploader/nl.js +0 -135
- package/locales/file-uploader/pl.d.ts.map +0 -1
- package/locales/file-uploader/pl.js +0 -138
- package/locales/file-uploader/pt.d.ts.map +0 -1
- package/locales/file-uploader/pt.js +0 -137
- package/locales/file-uploader/ro.d.ts.map +0 -1
- package/locales/file-uploader/ro.js +0 -137
- package/locales/file-uploader/ru.d.ts.map +0 -1
- package/locales/file-uploader/ru.js +0 -136
- package/locales/file-uploader/sk.d.ts.map +0 -1
- package/locales/file-uploader/sk.js +0 -138
- package/locales/file-uploader/sr.d.ts.map +0 -1
- package/locales/file-uploader/sr.js +0 -136
- package/locales/file-uploader/sv.d.ts.map +0 -1
- package/locales/file-uploader/sv.js +0 -134
- package/locales/file-uploader/tr.d.ts.map +0 -1
- package/locales/file-uploader/tr.js +0 -134
- package/locales/file-uploader/uk.d.ts.map +0 -1
- package/locales/file-uploader/uk.js +0 -138
- package/locales/file-uploader/vi.d.ts.map +0 -1
- package/locales/file-uploader/vi.js +0 -134
- package/locales/file-uploader/zh-TW.d.ts +0 -132
- package/locales/file-uploader/zh-TW.d.ts.map +0 -1
- package/locales/file-uploader/zh-TW.js +0 -134
- package/locales/file-uploader/zh.d.ts.map +0 -1
- package/locales/file-uploader/zh.js +0 -132
- package/solutions/adaptive-image/index.d.ts +0 -3
- package/solutions/adaptive-image/index.d.ts.map +0 -1
- package/solutions/adaptive-image/index.js +0 -5
- package/solutions/cloud-image-editor/CloudImageEditor.d.ts +0 -39
- package/solutions/cloud-image-editor/CloudImageEditor.d.ts.map +0 -1
- package/solutions/cloud-image-editor/CloudImageEditor.js +0 -24
- package/solutions/cloud-image-editor/index.css +0 -2
- package/solutions/cloud-image-editor/index.d.ts +0 -6
- package/solutions/cloud-image-editor/index.d.ts.map +0 -1
- package/solutions/cloud-image-editor/index.js +0 -11
- package/solutions/file-uploader/inline/FileUploaderInline.d.ts +0 -27
- package/solutions/file-uploader/inline/FileUploaderInline.d.ts.map +0 -1
- package/solutions/file-uploader/inline/FileUploaderInline.js +0 -80
- package/solutions/file-uploader/inline/index.css +0 -54
- package/solutions/file-uploader/inline/index.d.ts +0 -2
- package/solutions/file-uploader/inline/index.d.ts.map +0 -1
- package/solutions/file-uploader/inline/index.js +0 -1
- package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +0 -43
- package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +0 -1
- package/solutions/file-uploader/minimal/FileUploaderMinimal.js +0 -163
- package/solutions/file-uploader/minimal/index.css +0 -147
- package/solutions/file-uploader/minimal/index.d.ts +0 -2
- package/solutions/file-uploader/minimal/index.d.ts.map +0 -1
- package/solutions/file-uploader/minimal/index.js +0 -1
- package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +0 -24
- package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +0 -1
- package/solutions/file-uploader/regular/FileUploaderRegular.js +0 -69
- package/solutions/file-uploader/regular/index.css +0 -1
- package/solutions/file-uploader/regular/index.d.ts +0 -2
- package/solutions/file-uploader/regular/index.d.ts.map +0 -1
- package/solutions/file-uploader/regular/index.js +0 -1
- package/types/events.d.ts +0 -5
- package/types/events.js +0 -1
- package/types/exported.d.ts +0 -556
- package/types/exported.js +0 -1
- package/types/global.d.ts +0 -8
- package/types/https.d.ts +0 -1
- package/types/index.d.ts +0 -2
- package/types/index.js +0 -3
- package/utils/WindowHeightTracker.d.ts +0 -24
- package/utils/WindowHeightTracker.d.ts.map +0 -1
- package/utils/WindowHeightTracker.js +0 -51
- package/utils/browser-info.d.ts +0 -13
- package/utils/browser-info.d.ts.map +0 -1
- package/utils/browser-info.js +0 -22
- package/utils/browser-info.test.d.ts +0 -2
- package/utils/browser-info.test.d.ts.map +0 -1
- package/utils/browser-info.test.js +0 -109
- package/utils/cdn-utils.d.ts +0 -59
- package/utils/cdn-utils.d.ts.map +0 -1
- package/utils/cdn-utils.js +0 -199
- package/utils/cdn-utils.test.d.ts +0 -2
- package/utils/cdn-utils.test.d.ts.map +0 -1
- package/utils/cdn-utils.test.js +0 -227
- package/utils/delay.d.ts +0 -2
- package/utils/delay.d.ts.map +0 -1
- package/utils/delay.js +0 -4
- package/utils/fileTypes.d.ts +0 -12
- package/utils/fileTypes.d.ts.map +0 -1
- package/utils/fileTypes.js +0 -111
- package/utils/fileTypes.test.d.ts +0 -2
- package/utils/fileTypes.test.d.ts.map +0 -1
- package/utils/fileTypes.test.js +0 -89
- package/utils/get-top-level-origin.d.ts +0 -2
- package/utils/get-top-level-origin.d.ts.map +0 -1
- package/utils/get-top-level-origin.js +0 -11
- package/utils/getLocaleDirection.d.ts +0 -2
- package/utils/getLocaleDirection.d.ts.map +0 -1
- package/utils/getLocaleDirection.js +0 -18
- package/utils/getPluralForm.d.ts +0 -3
- package/utils/getPluralForm.d.ts.map +0 -1
- package/utils/getPluralForm.js +0 -13
- package/utils/getPluralForm.test.d.ts +0 -2
- package/utils/getPluralForm.test.d.ts.map +0 -1
- package/utils/getPluralForm.test.js +0 -16
- package/utils/ifRef.d.ts +0 -7
- package/utils/ifRef.d.ts.map +0 -1
- package/utils/ifRef.js +0 -9
- package/utils/isPromiseLike.d.ts +0 -2
- package/utils/isPromiseLike.d.ts.map +0 -1
- package/utils/isPromiseLike.js +0 -12
- package/utils/isPromiseLike.test.d.ts +0 -2
- package/utils/isPromiseLike.test.d.ts.map +0 -1
- package/utils/isPromiseLike.test.js +0 -20
- package/utils/isSecureTokenExpired.d.ts +0 -4
- package/utils/isSecureTokenExpired.d.ts.map +0 -1
- package/utils/isSecureTokenExpired.js +0 -17
- package/utils/isSecureTokenExpired.test.d.ts +0 -2
- package/utils/isSecureTokenExpired.test.d.ts.map +0 -1
- package/utils/isSecureTokenExpired.test.js +0 -33
- package/utils/memoize.d.ts +0 -2
- package/utils/memoize.d.ts.map +0 -1
- package/utils/memoize.js +0 -23
- package/utils/memoize.test.d.ts +0 -2
- package/utils/memoize.test.d.ts.map +0 -1
- package/utils/memoize.test.js +0 -38
- package/utils/mixinClass.d.ts +0 -10
- package/utils/mixinClass.d.ts.map +0 -1
- package/utils/mixinClass.js +0 -18
- package/utils/parseCdnUrl.d.ts +0 -9
- package/utils/parseCdnUrl.d.ts.map +0 -1
- package/utils/parseCdnUrl.js +0 -23
- package/utils/parseCdnUrl.test.d.ts +0 -2
- package/utils/parseCdnUrl.test.d.ts.map +0 -1
- package/utils/parseCdnUrl.test.js +0 -91
- package/utils/parseShrink.d.ts +0 -5
- package/utils/parseShrink.d.ts.map +0 -1
- package/utils/parseShrink.js +0 -34
- package/utils/parseShrink.test.d.ts +0 -2
- package/utils/parseShrink.test.d.ts.map +0 -1
- package/utils/parseShrink.test.js +0 -26
- package/utils/prettyBytes.d.ts +0 -11
- package/utils/prettyBytes.d.ts.map +0 -1
- package/utils/prettyBytes.js +0 -64
- package/utils/prettyBytes.test.d.ts +0 -2
- package/utils/prettyBytes.test.d.ts.map +0 -1
- package/utils/prettyBytes.test.js +0 -99
- package/utils/stringToArray.d.ts +0 -2
- package/utils/stringToArray.d.ts.map +0 -1
- package/utils/stringToArray.js +0 -11
- package/utils/stringToArray.test.d.ts +0 -2
- package/utils/stringToArray.test.d.ts.map +0 -1
- package/utils/stringToArray.test.js +0 -20
- package/utils/template-utils.d.ts +0 -40
- package/utils/template-utils.d.ts.map +0 -1
- package/utils/template-utils.js +0 -50
- package/utils/template-utils.test.d.ts +0 -2
- package/utils/template-utils.test.d.ts.map +0 -1
- package/utils/template-utils.test.js +0 -56
- package/utils/toKebabCase.d.ts +0 -3
- package/utils/toKebabCase.d.ts.map +0 -1
- package/utils/toKebabCase.js +0 -15
- package/utils/toKebabCase.test.d.ts +0 -2
- package/utils/toKebabCase.test.d.ts.map +0 -1
- package/utils/toKebabCase.test.js +0 -11
- package/utils/transparentPixelSrc.d.ts +0 -2
- package/utils/transparentPixelSrc.d.ts.map +0 -1
- package/utils/transparentPixelSrc.js +0 -2
- package/utils/uniqueArray.d.ts +0 -2
- package/utils/uniqueArray.d.ts.map +0 -1
- package/utils/uniqueArray.js +0 -8
- package/utils/uniqueArray.test.d.ts +0 -2
- package/utils/uniqueArray.test.d.ts.map +0 -1
- package/utils/uniqueArray.test.js +0 -8
- package/utils/validators/collection/index.d.ts +0 -3
- package/utils/validators/collection/index.d.ts.map +0 -1
- package/utils/validators/collection/index.js +0 -2
- package/utils/validators/collection/validateCollectionUploadError.d.ts +0 -3
- package/utils/validators/collection/validateCollectionUploadError.d.ts.map +0 -1
- package/utils/validators/collection/validateCollectionUploadError.js +0 -11
- package/utils/validators/collection/validateMultiple.d.ts +0 -3
- package/utils/validators/collection/validateMultiple.d.ts.map +0 -1
- package/utils/validators/collection/validateMultiple.js +0 -43
- package/utils/validators/file/index.d.ts +0 -5
- package/utils/validators/file/index.d.ts.map +0 -1
- package/utils/validators/file/index.js +0 -4
- package/utils/validators/file/validateFileType.d.ts +0 -3
- package/utils/validators/file/validateFileType.d.ts.map +0 -1
- package/utils/validators/file/validateFileType.js +0 -30
- package/utils/validators/file/validateIsImage.d.ts +0 -3
- package/utils/validators/file/validateIsImage.d.ts.map +0 -1
- package/utils/validators/file/validateIsImage.js +0 -25
- package/utils/validators/file/validateMaxSizeLimit.d.ts +0 -3
- package/utils/validators/file/validateMaxSizeLimit.d.ts.map +0 -1
- package/utils/validators/file/validateMaxSizeLimit.js +0 -15
- package/utils/validators/file/validateUploadError.d.ts +0 -3
- package/utils/validators/file/validateUploadError.d.ts.map +0 -1
- package/utils/validators/file/validateUploadError.js +0 -48
- package/utils/waitForAttribute.d.ts +0 -8
- package/utils/waitForAttribute.d.ts.map +0 -1
- package/utils/waitForAttribute.js +0 -43
- package/utils/waitForAttribute.test.d.ts +0 -2
- package/utils/waitForAttribute.test.d.ts.map +0 -1
- package/utils/waitForAttribute.test.js +0 -78
- package/utils/warnOnce.d.ts +0 -3
- package/utils/warnOnce.d.ts.map +0 -1
- package/utils/warnOnce.js +0 -11
- package/utils/wildcardRegexp.d.ts +0 -2
- package/utils/wildcardRegexp.d.ts.map +0 -1
- package/utils/wildcardRegexp.js +0 -17
- package/utils/wildcardRegexp.test.d.ts +0 -2
- package/utils/wildcardRegexp.test.d.ts.map +0 -1
- package/utils/wildcardRegexp.test.js +0 -19
- package/utils/withResolvers.d.ts +0 -6
- package/utils/withResolvers.d.ts.map +0 -1
- package/utils/withResolvers.js +0 -18
- package/utils/withResolvers.test.d.ts +0 -2
- package/utils/withResolvers.test.d.ts.map +0 -1
- package/utils/withResolvers.test.js +0 -36
|
@@ -1,729 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { MIN_CROP_SIZE, THUMB_CORNER_SIZE, THUMB_OFFSET, THUMB_SIDE_SIZE } from './cropper-constants.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @param {SVGElement} node
|
|
6
|
-
* @param {{ [key: String]: String | Number }} attrs
|
|
7
|
-
*/
|
|
8
|
-
export function setSvgNodeAttrs(node, attrs) {
|
|
9
|
-
for (let p in attrs) node.setAttributeNS(null, p, attrs[p].toString());
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @param {String} name
|
|
14
|
-
* @param {{ [key: String]: String | Number }} attrs
|
|
15
|
-
* @returns {SVGElement}
|
|
16
|
-
*/
|
|
17
|
-
export function createSvgNode(name, attrs = {}) {
|
|
18
|
-
let node = document.createElementNS('http://www.w3.org/2000/svg', name);
|
|
19
|
-
setSvgNodeAttrs(node, attrs);
|
|
20
|
-
return node;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @param {import('./types.js').Rectangle} rect
|
|
25
|
-
* @param {import('./types.js').Direction} direction
|
|
26
|
-
* @param {number} sizeMultiplier
|
|
27
|
-
*/
|
|
28
|
-
export function cornerPath(rect, direction, sizeMultiplier) {
|
|
29
|
-
let { x, y, width, height } = rect;
|
|
30
|
-
|
|
31
|
-
let wMul = direction.includes('w') ? 0 : 1;
|
|
32
|
-
let hMul = direction.includes('n') ? 0 : 1;
|
|
33
|
-
let xSide = [-1, 1][wMul];
|
|
34
|
-
let ySide = [-1, 1][hMul];
|
|
35
|
-
|
|
36
|
-
let p1 = [
|
|
37
|
-
x + wMul * width + THUMB_OFFSET * xSide,
|
|
38
|
-
y + hMul * height + THUMB_OFFSET * ySide - THUMB_CORNER_SIZE * sizeMultiplier * ySide,
|
|
39
|
-
];
|
|
40
|
-
let p2 = [x + wMul * width + THUMB_OFFSET * xSide, y + hMul * height + THUMB_OFFSET * ySide];
|
|
41
|
-
let p3 = [
|
|
42
|
-
x + wMul * width - THUMB_CORNER_SIZE * sizeMultiplier * xSide + THUMB_OFFSET * xSide,
|
|
43
|
-
y + hMul * height + THUMB_OFFSET * ySide,
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
let path = `M ${p1[0]} ${p1[1]} L ${p2[0]} ${p2[1]} L ${p3[0]} ${p3[1]}`;
|
|
47
|
-
let center = p2;
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
d: path,
|
|
51
|
-
center,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @param {import('./types.js').Rectangle} rect
|
|
57
|
-
* @param {Extract<import('./types.js').Direction, 'n' | 's' | 'w' | 'e'>} direction
|
|
58
|
-
* @param {number} sizeMultiplier
|
|
59
|
-
*/
|
|
60
|
-
export function sidePath(rect, direction, sizeMultiplier) {
|
|
61
|
-
let { x, y, width, height } = rect;
|
|
62
|
-
|
|
63
|
-
let wMul = ['n', 's'].includes(direction)
|
|
64
|
-
? 0.5
|
|
65
|
-
: { w: 0, e: 1 }[/** @type {Extract<import('./types.js').Direction, 'w' | 'e'>} */ (direction)];
|
|
66
|
-
let hMul = ['w', 'e'].includes(direction)
|
|
67
|
-
? 0.5
|
|
68
|
-
: { n: 0, s: 1 }[/** @type {Extract<import('./types.js').Direction, 'n' | 's'>} */ (direction)];
|
|
69
|
-
let xSide = [-1, 1][wMul];
|
|
70
|
-
let ySide = [-1, 1][hMul];
|
|
71
|
-
|
|
72
|
-
let p1, p2;
|
|
73
|
-
if (['n', 's'].includes(direction)) {
|
|
74
|
-
p1 = [x + wMul * width - (THUMB_SIDE_SIZE * sizeMultiplier) / 2, y + hMul * height + THUMB_OFFSET * ySide];
|
|
75
|
-
p2 = [x + wMul * width + (THUMB_SIDE_SIZE * sizeMultiplier) / 2, y + hMul * height + THUMB_OFFSET * ySide];
|
|
76
|
-
} else {
|
|
77
|
-
p1 = [x + wMul * width + THUMB_OFFSET * xSide, y + hMul * height - (THUMB_SIDE_SIZE * sizeMultiplier) / 2];
|
|
78
|
-
p2 = [x + wMul * width + THUMB_OFFSET * xSide, y + hMul * height + (THUMB_SIDE_SIZE * sizeMultiplier) / 2];
|
|
79
|
-
}
|
|
80
|
-
let path = `M ${p1[0]} ${p1[1]} L ${p2[0]} ${p2[1]}`;
|
|
81
|
-
let center = [p2[0] - (p2[0] - p1[0]) / 2, p2[1] - (p2[1] - p1[1]) / 2];
|
|
82
|
-
|
|
83
|
-
return { d: path, center };
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/** @param {import('./types.js').Direction} direction */
|
|
87
|
-
export function thumbCursor(direction) {
|
|
88
|
-
if (direction === '') {
|
|
89
|
-
return 'move';
|
|
90
|
-
}
|
|
91
|
-
if (['e', 'w'].includes(direction)) {
|
|
92
|
-
return 'ew-resize';
|
|
93
|
-
}
|
|
94
|
-
if (['n', 's'].includes(direction)) {
|
|
95
|
-
return 'ns-resize';
|
|
96
|
-
}
|
|
97
|
-
if (['nw', 'se'].includes(direction)) {
|
|
98
|
-
return 'nwse-resize';
|
|
99
|
-
}
|
|
100
|
-
return 'nesw-resize';
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* @param {{
|
|
105
|
-
* rect: import('./types.js').Rectangle;
|
|
106
|
-
* delta: [Number, Number];
|
|
107
|
-
* imageBox: import('./types.js').Rectangle;
|
|
108
|
-
* }} options
|
|
109
|
-
*/
|
|
110
|
-
export function moveRect({ rect, delta: [dx, dy], imageBox }) {
|
|
111
|
-
return constraintRect(
|
|
112
|
-
{
|
|
113
|
-
...rect,
|
|
114
|
-
x: rect.x + dx,
|
|
115
|
-
y: rect.y + dy,
|
|
116
|
-
},
|
|
117
|
-
imageBox,
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* @param {import('./types.js').Rectangle} rect1
|
|
123
|
-
* @param {import('./types.js').Rectangle} rect2
|
|
124
|
-
*/
|
|
125
|
-
export function constraintRect(rect1, rect2) {
|
|
126
|
-
let { x } = rect1;
|
|
127
|
-
let { y } = rect1;
|
|
128
|
-
if (rect1.x < rect2.x) {
|
|
129
|
-
x = rect2.x;
|
|
130
|
-
} else if (rect1.x + rect1.width > rect2.x + rect2.width) {
|
|
131
|
-
x = rect2.x + rect2.width - rect1.width;
|
|
132
|
-
}
|
|
133
|
-
if (rect1.y < rect2.y) {
|
|
134
|
-
y = rect2.y;
|
|
135
|
-
} else if (rect1.y + rect1.height > rect2.y + rect2.height) {
|
|
136
|
-
y = rect2.y + rect2.height - rect1.height;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return {
|
|
140
|
-
...rect1,
|
|
141
|
-
x,
|
|
142
|
-
y,
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* @param {{
|
|
148
|
-
* rect: import('./types.js').Rectangle;
|
|
149
|
-
* delta: [Number, Number];
|
|
150
|
-
* aspectRatio?: number;
|
|
151
|
-
* imageBox: import('./types.js').Rectangle;
|
|
152
|
-
* }} options
|
|
153
|
-
*/
|
|
154
|
-
function resizeNorth({ rect, delta, aspectRatio, imageBox }) {
|
|
155
|
-
const [, dy] = delta;
|
|
156
|
-
let { y, width, height } = rect;
|
|
157
|
-
|
|
158
|
-
y += dy;
|
|
159
|
-
height -= dy;
|
|
160
|
-
if (aspectRatio) {
|
|
161
|
-
width = height * aspectRatio;
|
|
162
|
-
}
|
|
163
|
-
let x = rect.x + rect.width / 2 - width / 2;
|
|
164
|
-
if (y <= imageBox.y) {
|
|
165
|
-
y = imageBox.y;
|
|
166
|
-
height = rect.y + rect.height - y;
|
|
167
|
-
if (aspectRatio) {
|
|
168
|
-
width = height * aspectRatio;
|
|
169
|
-
x = rect.x + rect.width / 2 - width / 2;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
if (x <= imageBox.x) {
|
|
173
|
-
x = imageBox.x;
|
|
174
|
-
y = rect.y + rect.height - height;
|
|
175
|
-
}
|
|
176
|
-
if (x + width >= imageBox.x + imageBox.width) {
|
|
177
|
-
x = Math.max(imageBox.x, imageBox.x + imageBox.width - width);
|
|
178
|
-
width = imageBox.x + imageBox.width - x;
|
|
179
|
-
if (aspectRatio) {
|
|
180
|
-
height = width / aspectRatio;
|
|
181
|
-
}
|
|
182
|
-
y = rect.y + rect.height - height;
|
|
183
|
-
}
|
|
184
|
-
if (height < MIN_CROP_SIZE) {
|
|
185
|
-
height = MIN_CROP_SIZE;
|
|
186
|
-
if (aspectRatio) {
|
|
187
|
-
width = height * aspectRatio;
|
|
188
|
-
x = rect.x + rect.width / 2 - width / 2;
|
|
189
|
-
}
|
|
190
|
-
y = rect.y + rect.height - height;
|
|
191
|
-
}
|
|
192
|
-
if (width < MIN_CROP_SIZE) {
|
|
193
|
-
width = MIN_CROP_SIZE;
|
|
194
|
-
if (aspectRatio) {
|
|
195
|
-
height = width / aspectRatio;
|
|
196
|
-
x = rect.x + rect.width / 2 - width / 2;
|
|
197
|
-
}
|
|
198
|
-
y = rect.y + rect.height - height;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return { x, y, width, height };
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* @param {{
|
|
206
|
-
* rect: import('./types.js').Rectangle;
|
|
207
|
-
* delta: [Number, Number];
|
|
208
|
-
* aspectRatio?: number;
|
|
209
|
-
* imageBox: import('./types.js').Rectangle;
|
|
210
|
-
* }} options
|
|
211
|
-
*/
|
|
212
|
-
function resizeWest({ rect, delta, aspectRatio, imageBox }) {
|
|
213
|
-
const [dx] = delta;
|
|
214
|
-
let { x, width, height } = rect;
|
|
215
|
-
|
|
216
|
-
x += dx;
|
|
217
|
-
width -= dx;
|
|
218
|
-
if (aspectRatio) {
|
|
219
|
-
height = width / aspectRatio;
|
|
220
|
-
}
|
|
221
|
-
let y = rect.y + rect.height / 2 - height / 2;
|
|
222
|
-
if (x <= imageBox.x) {
|
|
223
|
-
x = imageBox.x;
|
|
224
|
-
width = rect.x + rect.width - x;
|
|
225
|
-
if (aspectRatio) {
|
|
226
|
-
height = width / aspectRatio;
|
|
227
|
-
y = rect.y + rect.height / 2 - height / 2;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
if (y <= imageBox.y) {
|
|
231
|
-
y = imageBox.y;
|
|
232
|
-
x = rect.x + rect.width - width;
|
|
233
|
-
}
|
|
234
|
-
if (y + height >= imageBox.y + imageBox.height) {
|
|
235
|
-
y = Math.max(imageBox.y, imageBox.y + imageBox.height - height);
|
|
236
|
-
height = imageBox.y + imageBox.height - y;
|
|
237
|
-
if (aspectRatio) {
|
|
238
|
-
width = height * aspectRatio;
|
|
239
|
-
}
|
|
240
|
-
x = rect.x + rect.width - width;
|
|
241
|
-
}
|
|
242
|
-
if (height < MIN_CROP_SIZE) {
|
|
243
|
-
height = MIN_CROP_SIZE;
|
|
244
|
-
if (aspectRatio) {
|
|
245
|
-
width = height * aspectRatio;
|
|
246
|
-
}
|
|
247
|
-
y = rect.y + rect.height / 2 - height / 2;
|
|
248
|
-
x = rect.x + rect.width - width;
|
|
249
|
-
}
|
|
250
|
-
if (width < MIN_CROP_SIZE) {
|
|
251
|
-
width = MIN_CROP_SIZE;
|
|
252
|
-
if (aspectRatio) {
|
|
253
|
-
height = width / aspectRatio;
|
|
254
|
-
}
|
|
255
|
-
y = rect.y + rect.height / 2 - height / 2;
|
|
256
|
-
x = rect.x + rect.width - width;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return { x, y, width, height };
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* @param {{
|
|
264
|
-
* rect: import('./types.js').Rectangle;
|
|
265
|
-
* delta: [Number, Number];
|
|
266
|
-
* aspectRatio?: number;
|
|
267
|
-
* imageBox: import('./types.js').Rectangle;
|
|
268
|
-
* }} options
|
|
269
|
-
*/
|
|
270
|
-
function resizeSouth({ rect, delta, aspectRatio, imageBox }) {
|
|
271
|
-
const [, dy] = delta;
|
|
272
|
-
let { y, width, height } = rect;
|
|
273
|
-
|
|
274
|
-
height += dy;
|
|
275
|
-
if (aspectRatio) {
|
|
276
|
-
width = height * aspectRatio;
|
|
277
|
-
}
|
|
278
|
-
let x = rect.x + rect.width / 2 - width / 2;
|
|
279
|
-
if (y + height >= imageBox.y + imageBox.height) {
|
|
280
|
-
height = imageBox.y + imageBox.height - y;
|
|
281
|
-
if (aspectRatio) {
|
|
282
|
-
width = height * aspectRatio;
|
|
283
|
-
}
|
|
284
|
-
x = rect.x + rect.width / 2 - width / 2;
|
|
285
|
-
}
|
|
286
|
-
if (x <= imageBox.x) {
|
|
287
|
-
x = imageBox.x;
|
|
288
|
-
y = rect.y;
|
|
289
|
-
}
|
|
290
|
-
if (x + width >= imageBox.x + imageBox.width) {
|
|
291
|
-
x = Math.max(imageBox.x, imageBox.x + imageBox.width - width);
|
|
292
|
-
width = imageBox.x + imageBox.width - x;
|
|
293
|
-
if (aspectRatio) {
|
|
294
|
-
height = width / aspectRatio;
|
|
295
|
-
}
|
|
296
|
-
y = rect.y;
|
|
297
|
-
}
|
|
298
|
-
if (height < MIN_CROP_SIZE) {
|
|
299
|
-
height = MIN_CROP_SIZE;
|
|
300
|
-
if (aspectRatio) {
|
|
301
|
-
width = height * aspectRatio;
|
|
302
|
-
}
|
|
303
|
-
x = rect.x + rect.width / 2 - width / 2;
|
|
304
|
-
}
|
|
305
|
-
if (width < MIN_CROP_SIZE) {
|
|
306
|
-
width = MIN_CROP_SIZE;
|
|
307
|
-
if (aspectRatio) {
|
|
308
|
-
height = width / aspectRatio;
|
|
309
|
-
}
|
|
310
|
-
x = rect.x + rect.width / 2 - width / 2;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
return { x, y, width, height };
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* @param {{
|
|
318
|
-
* rect: import('./types.js').Rectangle;
|
|
319
|
-
* delta: [Number, Number];
|
|
320
|
-
* aspectRatio?: number;
|
|
321
|
-
* imageBox: import('./types.js').Rectangle;
|
|
322
|
-
* }} options
|
|
323
|
-
*/
|
|
324
|
-
function resizeEast({ rect, delta, aspectRatio, imageBox }) {
|
|
325
|
-
const [dx] = delta;
|
|
326
|
-
let { x, width, height } = rect;
|
|
327
|
-
|
|
328
|
-
width += dx;
|
|
329
|
-
if (aspectRatio) {
|
|
330
|
-
height = width / aspectRatio;
|
|
331
|
-
}
|
|
332
|
-
let y = rect.y + rect.height / 2 - height / 2;
|
|
333
|
-
if (x + width >= imageBox.x + imageBox.width) {
|
|
334
|
-
width = imageBox.x + imageBox.width - x;
|
|
335
|
-
if (aspectRatio) {
|
|
336
|
-
height = width / aspectRatio;
|
|
337
|
-
}
|
|
338
|
-
y = rect.y + rect.height / 2 - height / 2;
|
|
339
|
-
}
|
|
340
|
-
if (y <= imageBox.y) {
|
|
341
|
-
y = imageBox.y;
|
|
342
|
-
x = rect.x;
|
|
343
|
-
}
|
|
344
|
-
if (y + height >= imageBox.y + imageBox.height) {
|
|
345
|
-
y = Math.max(imageBox.y, imageBox.y + imageBox.height - height);
|
|
346
|
-
height = imageBox.y + imageBox.height - y;
|
|
347
|
-
if (aspectRatio) {
|
|
348
|
-
width = height * aspectRatio;
|
|
349
|
-
}
|
|
350
|
-
x = rect.x;
|
|
351
|
-
}
|
|
352
|
-
if (height < MIN_CROP_SIZE) {
|
|
353
|
-
height = MIN_CROP_SIZE;
|
|
354
|
-
if (aspectRatio) {
|
|
355
|
-
width = height * aspectRatio;
|
|
356
|
-
}
|
|
357
|
-
y = rect.y + rect.height / 2 - height / 2;
|
|
358
|
-
}
|
|
359
|
-
if (width < MIN_CROP_SIZE) {
|
|
360
|
-
width = MIN_CROP_SIZE;
|
|
361
|
-
if (aspectRatio) {
|
|
362
|
-
height = width / aspectRatio;
|
|
363
|
-
}
|
|
364
|
-
y = rect.y + rect.height / 2 - height / 2;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
return { x, y, width, height };
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* @param {{
|
|
372
|
-
* rect: import('./types.js').Rectangle;
|
|
373
|
-
* delta: [Number, Number];
|
|
374
|
-
* aspectRatio?: number;
|
|
375
|
-
* imageBox: import('./types.js').Rectangle;
|
|
376
|
-
* }} options
|
|
377
|
-
*/
|
|
378
|
-
function resizeNorthWest({ rect, delta, aspectRatio, imageBox }) {
|
|
379
|
-
let [dx, dy] = delta;
|
|
380
|
-
let { x, y, width, height } = rect;
|
|
381
|
-
|
|
382
|
-
if (x + dx < imageBox.x) {
|
|
383
|
-
dx = imageBox.x - x;
|
|
384
|
-
}
|
|
385
|
-
if (y + dy < imageBox.y) {
|
|
386
|
-
dy = imageBox.y - y;
|
|
387
|
-
}
|
|
388
|
-
x += dx;
|
|
389
|
-
width -= dx;
|
|
390
|
-
y += dy;
|
|
391
|
-
height -= dy;
|
|
392
|
-
if (aspectRatio && Math.abs(width / height) > aspectRatio) {
|
|
393
|
-
dy = width / aspectRatio - height;
|
|
394
|
-
height += dy;
|
|
395
|
-
y -= dy;
|
|
396
|
-
if (y <= imageBox.y) {
|
|
397
|
-
height = height - (imageBox.y - y);
|
|
398
|
-
width = height * aspectRatio;
|
|
399
|
-
x = rect.x + rect.width - width;
|
|
400
|
-
y = imageBox.y;
|
|
401
|
-
}
|
|
402
|
-
} else if (aspectRatio) {
|
|
403
|
-
dx = height * aspectRatio - width;
|
|
404
|
-
width = width + dx;
|
|
405
|
-
x -= dx;
|
|
406
|
-
if (x <= imageBox.x) {
|
|
407
|
-
width = width - (imageBox.x - x);
|
|
408
|
-
height = width / aspectRatio;
|
|
409
|
-
x = imageBox.x;
|
|
410
|
-
y = rect.y + rect.height - height;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
if (height < MIN_CROP_SIZE) {
|
|
414
|
-
height = MIN_CROP_SIZE;
|
|
415
|
-
if (aspectRatio) {
|
|
416
|
-
width = height * aspectRatio;
|
|
417
|
-
}
|
|
418
|
-
x = rect.x + rect.width - width;
|
|
419
|
-
y = rect.y + rect.height - height;
|
|
420
|
-
}
|
|
421
|
-
if (width < MIN_CROP_SIZE) {
|
|
422
|
-
width = MIN_CROP_SIZE;
|
|
423
|
-
if (aspectRatio) {
|
|
424
|
-
height = width / aspectRatio;
|
|
425
|
-
}
|
|
426
|
-
x = rect.x + rect.width - width;
|
|
427
|
-
y = rect.y + rect.height - height;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
return { x, y, width, height };
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* @param {{
|
|
435
|
-
* rect: import('./types.js').Rectangle;
|
|
436
|
-
* delta: [Number, Number];
|
|
437
|
-
* aspectRatio?: number;
|
|
438
|
-
* imageBox: import('./types.js').Rectangle;
|
|
439
|
-
* }} options
|
|
440
|
-
*/
|
|
441
|
-
function resizeNorthEast({ rect, delta, aspectRatio, imageBox }) {
|
|
442
|
-
let [dx, dy] = delta;
|
|
443
|
-
let { x, y, width, height } = rect;
|
|
444
|
-
|
|
445
|
-
if (x + width + dx > imageBox.x + imageBox.width) {
|
|
446
|
-
dx = imageBox.x + imageBox.width - x - width;
|
|
447
|
-
}
|
|
448
|
-
if (y + dy < imageBox.y) {
|
|
449
|
-
dy = imageBox.y - y;
|
|
450
|
-
}
|
|
451
|
-
width += dx;
|
|
452
|
-
y += dy;
|
|
453
|
-
height -= dy;
|
|
454
|
-
if (aspectRatio && Math.abs(width / height) > aspectRatio) {
|
|
455
|
-
dy = width / aspectRatio - height;
|
|
456
|
-
height += dy;
|
|
457
|
-
y -= dy;
|
|
458
|
-
if (y <= imageBox.y) {
|
|
459
|
-
height = height - (imageBox.y - y);
|
|
460
|
-
width = height * aspectRatio;
|
|
461
|
-
x = rect.x;
|
|
462
|
-
y = imageBox.y;
|
|
463
|
-
}
|
|
464
|
-
} else if (aspectRatio) {
|
|
465
|
-
dx = height * aspectRatio - width;
|
|
466
|
-
width += dx;
|
|
467
|
-
if (x + width >= imageBox.x + imageBox.width) {
|
|
468
|
-
width = imageBox.x + imageBox.width - x;
|
|
469
|
-
height = width / aspectRatio;
|
|
470
|
-
x = imageBox.x + imageBox.width - width;
|
|
471
|
-
y = rect.y + rect.height - height;
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
if (height < MIN_CROP_SIZE) {
|
|
475
|
-
height = MIN_CROP_SIZE;
|
|
476
|
-
if (aspectRatio) {
|
|
477
|
-
width = height * aspectRatio;
|
|
478
|
-
}
|
|
479
|
-
y = rect.y + rect.height - height;
|
|
480
|
-
}
|
|
481
|
-
if (width < MIN_CROP_SIZE) {
|
|
482
|
-
width = MIN_CROP_SIZE;
|
|
483
|
-
if (aspectRatio) {
|
|
484
|
-
height = width / aspectRatio;
|
|
485
|
-
}
|
|
486
|
-
y = rect.y + rect.height - height;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
return { x, y, width, height };
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
/**
|
|
493
|
-
* @param {{
|
|
494
|
-
* rect: import('./types.js').Rectangle;
|
|
495
|
-
* delta: [Number, Number];
|
|
496
|
-
* aspectRatio?: number;
|
|
497
|
-
* imageBox: import('./types.js').Rectangle;
|
|
498
|
-
* }} options
|
|
499
|
-
*/
|
|
500
|
-
function resizeSouthWest({ rect, delta, aspectRatio, imageBox }) {
|
|
501
|
-
let [dx, dy] = delta;
|
|
502
|
-
let { x, y, width, height } = rect;
|
|
503
|
-
|
|
504
|
-
if (x + dx < imageBox.x) {
|
|
505
|
-
dx = imageBox.x - x;
|
|
506
|
-
}
|
|
507
|
-
if (y + height + dy > imageBox.y + imageBox.height) {
|
|
508
|
-
dy = imageBox.y + imageBox.height - y - height;
|
|
509
|
-
}
|
|
510
|
-
x += dx;
|
|
511
|
-
width -= dx;
|
|
512
|
-
height += dy;
|
|
513
|
-
if (aspectRatio && Math.abs(width / height) > aspectRatio) {
|
|
514
|
-
dy = width / aspectRatio - height;
|
|
515
|
-
height += dy;
|
|
516
|
-
if (y + height >= imageBox.y + imageBox.height) {
|
|
517
|
-
height = imageBox.y + imageBox.height - y;
|
|
518
|
-
width = height * aspectRatio;
|
|
519
|
-
x = rect.x + rect.width - width;
|
|
520
|
-
y = imageBox.y + imageBox.height - height;
|
|
521
|
-
}
|
|
522
|
-
} else if (aspectRatio) {
|
|
523
|
-
dx = height * aspectRatio - width;
|
|
524
|
-
width += dx;
|
|
525
|
-
x -= dx;
|
|
526
|
-
if (x <= imageBox.x) {
|
|
527
|
-
width = width - (imageBox.x - x);
|
|
528
|
-
height = width / aspectRatio;
|
|
529
|
-
x = imageBox.x;
|
|
530
|
-
y = rect.y;
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
if (height < MIN_CROP_SIZE) {
|
|
534
|
-
height = MIN_CROP_SIZE;
|
|
535
|
-
if (aspectRatio) {
|
|
536
|
-
width = height * aspectRatio;
|
|
537
|
-
}
|
|
538
|
-
x = rect.x + rect.width - width;
|
|
539
|
-
}
|
|
540
|
-
if (width < MIN_CROP_SIZE) {
|
|
541
|
-
width = MIN_CROP_SIZE;
|
|
542
|
-
if (aspectRatio) {
|
|
543
|
-
height = width / aspectRatio;
|
|
544
|
-
}
|
|
545
|
-
x = rect.x + rect.width - width;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
return { x, y, width, height };
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
* @param {{
|
|
553
|
-
* rect: import('./types.js').Rectangle;
|
|
554
|
-
* delta: [Number, Number];
|
|
555
|
-
* aspectRatio?: number;
|
|
556
|
-
* imageBox: import('./types.js').Rectangle;
|
|
557
|
-
* }} options
|
|
558
|
-
*/
|
|
559
|
-
function resizeSouthEast({ rect, delta, aspectRatio, imageBox }) {
|
|
560
|
-
let [dx, dy] = delta;
|
|
561
|
-
let { x, y, width, height } = rect;
|
|
562
|
-
|
|
563
|
-
if (x + width + dx > imageBox.x + imageBox.width) {
|
|
564
|
-
dx = imageBox.x + imageBox.width - x - width;
|
|
565
|
-
}
|
|
566
|
-
if (y + height + dy > imageBox.y + imageBox.height) {
|
|
567
|
-
dy = imageBox.y + imageBox.height - y - height;
|
|
568
|
-
}
|
|
569
|
-
width += dx;
|
|
570
|
-
height += dy;
|
|
571
|
-
if (aspectRatio && Math.abs(width / height) > aspectRatio) {
|
|
572
|
-
dy = width / aspectRatio - height;
|
|
573
|
-
height += dy;
|
|
574
|
-
if (y + height >= imageBox.y + imageBox.height) {
|
|
575
|
-
height = imageBox.y + imageBox.height - y;
|
|
576
|
-
width = height * aspectRatio;
|
|
577
|
-
x = rect.x;
|
|
578
|
-
y = imageBox.y + imageBox.height - height;
|
|
579
|
-
}
|
|
580
|
-
} else if (aspectRatio) {
|
|
581
|
-
dx = height * aspectRatio - width;
|
|
582
|
-
width += dx;
|
|
583
|
-
if (x + width >= imageBox.x + imageBox.width) {
|
|
584
|
-
width = imageBox.x + imageBox.width - x;
|
|
585
|
-
height = width / aspectRatio;
|
|
586
|
-
x = imageBox.x + imageBox.width - width;
|
|
587
|
-
y = rect.y;
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
if (height < MIN_CROP_SIZE) {
|
|
591
|
-
height = MIN_CROP_SIZE;
|
|
592
|
-
if (aspectRatio) {
|
|
593
|
-
width = height * aspectRatio;
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
if (width < MIN_CROP_SIZE) {
|
|
597
|
-
width = MIN_CROP_SIZE;
|
|
598
|
-
if (aspectRatio) {
|
|
599
|
-
height = width / aspectRatio;
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
return { x, y, width, height };
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
/**
|
|
607
|
-
* @param {{
|
|
608
|
-
* rect: import('./types.js').Rectangle;
|
|
609
|
-
* delta: [Number, Number];
|
|
610
|
-
* direction: import('./types.js').Direction;
|
|
611
|
-
* aspectRatio?: number;
|
|
612
|
-
* imageBox: import('./types.js').Rectangle;
|
|
613
|
-
* }} options
|
|
614
|
-
*/
|
|
615
|
-
export function resizeRect({ direction, ...rest }) {
|
|
616
|
-
switch (direction) {
|
|
617
|
-
case 'n':
|
|
618
|
-
return resizeNorth(rest);
|
|
619
|
-
case 'w':
|
|
620
|
-
return resizeWest(rest);
|
|
621
|
-
case 's':
|
|
622
|
-
return resizeSouth(rest);
|
|
623
|
-
case 'e':
|
|
624
|
-
return resizeEast(rest);
|
|
625
|
-
case 'nw':
|
|
626
|
-
return resizeNorthWest(rest);
|
|
627
|
-
case 'ne':
|
|
628
|
-
return resizeNorthEast(rest);
|
|
629
|
-
case 'sw':
|
|
630
|
-
return resizeSouthWest(rest);
|
|
631
|
-
case 'se':
|
|
632
|
-
return resizeSouthEast(rest);
|
|
633
|
-
default:
|
|
634
|
-
return rest.rect;
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
/**
|
|
639
|
-
* @param {import('./types.js').Rectangle} rect
|
|
640
|
-
* @param {[Number, Number]} point
|
|
641
|
-
*/
|
|
642
|
-
export function rectContainsPoint(rect, [x, y]) {
|
|
643
|
-
return rect.x <= x && x <= rect.x + rect.width && rect.y <= y && y <= rect.y + rect.height;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* @param {import('./types.js').Rectangle} rect1
|
|
648
|
-
* @param {import('./types.js').Rectangle} rect2
|
|
649
|
-
*/
|
|
650
|
-
export function isRectInsideRect(rect1, rect2) {
|
|
651
|
-
return (
|
|
652
|
-
rect1.x >= rect2.x &&
|
|
653
|
-
rect1.y >= rect2.y &&
|
|
654
|
-
rect1.x + rect1.width <= rect2.x + rect2.width &&
|
|
655
|
-
rect1.y + rect1.height <= rect2.y + rect2.height
|
|
656
|
-
);
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
/**
|
|
660
|
-
* @param {import('./types.js').Rectangle} rect
|
|
661
|
-
* @param {number} aspectRatio
|
|
662
|
-
*/
|
|
663
|
-
export function isRectMatchesAspectRatio(rect, aspectRatio) {
|
|
664
|
-
const THRESHOLD = 0.1;
|
|
665
|
-
return Math.abs(rect.width / rect.height - aspectRatio) < THRESHOLD;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
/**
|
|
669
|
-
* @param {import('./types.js').ImageSize} imageSize
|
|
670
|
-
* @param {Number} angle
|
|
671
|
-
* @returns {import('./types.js').ImageSize}
|
|
672
|
-
*/
|
|
673
|
-
export function rotateSize({ width, height }, angle) {
|
|
674
|
-
let swap = (angle / 90) % 2 !== 0;
|
|
675
|
-
return { width: swap ? height : width, height: swap ? width : height };
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
/**
|
|
679
|
-
* @param {number} width
|
|
680
|
-
* @param {number} height
|
|
681
|
-
* @param {number} aspectRatio
|
|
682
|
-
*/
|
|
683
|
-
export function calculateMaxCenteredCropFrame(width, height, aspectRatio) {
|
|
684
|
-
const imageAspectRatio = width / height;
|
|
685
|
-
let cropWidth, cropHeight;
|
|
686
|
-
|
|
687
|
-
if (imageAspectRatio > aspectRatio) {
|
|
688
|
-
cropWidth = Math.round(height * aspectRatio);
|
|
689
|
-
cropHeight = height;
|
|
690
|
-
} else {
|
|
691
|
-
cropWidth = width;
|
|
692
|
-
cropHeight = Math.round(width / aspectRatio);
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
const cropX = Math.round((width - cropWidth) / 2);
|
|
696
|
-
const cropY = Math.round((height - cropHeight) / 2);
|
|
697
|
-
|
|
698
|
-
if (cropX + cropWidth > width) {
|
|
699
|
-
cropWidth = width - cropX;
|
|
700
|
-
}
|
|
701
|
-
if (cropY + cropHeight > height) {
|
|
702
|
-
cropHeight = height - cropY;
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
return { x: cropX, y: cropY, width: cropWidth, height: cropHeight };
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
/**
|
|
709
|
-
* @param {import('./types.js').Rectangle} rect
|
|
710
|
-
* @returns {import('./types.js').Rectangle}
|
|
711
|
-
*/
|
|
712
|
-
export function roundRect(rect) {
|
|
713
|
-
return {
|
|
714
|
-
x: Math.round(rect.x),
|
|
715
|
-
y: Math.round(rect.y),
|
|
716
|
-
width: Math.round(rect.width),
|
|
717
|
-
height: Math.round(rect.height),
|
|
718
|
-
};
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
/**
|
|
722
|
-
* @param {Number} value
|
|
723
|
-
* @param {Number} min
|
|
724
|
-
* @param {Number} max
|
|
725
|
-
* @returns {Number}
|
|
726
|
-
*/
|
|
727
|
-
export function clamp(value, min, max) {
|
|
728
|
-
return Math.min(Math.max(value, min), max);
|
|
729
|
-
}
|