@uploadcare/file-uploader 1.27.1 → 1.28.0-alpha.0
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/CameraSource-DbyO6GoK.js +481 -0
- package/dist/CameraSource-px4BzEMI.js +9 -0
- package/dist/CloudImageEditor-BIxf1V4M.js +2162 -0
- package/dist/CloudImageEditorActivity-CJxP5N0S.js +9 -0
- package/dist/CloudImageEditorActivity-d4DpK6fQ.js +87 -0
- package/dist/Config-DuWre5p3.js +433 -0
- package/dist/ExternalSource-BKTFp95O.js +248 -0
- package/dist/ExternalSource-CR5DG0Jv.js +9 -0
- package/dist/Icon-CqTVC82Q.js +1811 -0
- package/dist/LitUploaderBlock-BA34rzeU.js +998 -0
- package/dist/UrlSource-BxVL9Pve.js +9 -0
- package/dist/UrlSource-DZK5EBwT.js +73 -0
- package/dist/abstract/CTX.d.ts +40 -0
- package/dist/abstract/TypedCollection.d.ts +47 -0
- package/dist/abstract/TypedCollection.test.d.ts +1 -0
- package/dist/abstract/TypedData.d.ts +12 -0
- package/dist/abstract/TypedData.test.d.ts +1 -0
- package/dist/abstract/UploaderPublicApi.d.ts +41 -0
- package/dist/abstract/buildOutputCollectionState.d.ts +3 -0
- package/dist/abstract/customConfigOptions.d.ts +65 -0
- package/dist/abstract/defineComponents.d.ts +1 -0
- package/dist/abstract/features/ClipboardLayer.d.ts +12 -0
- package/dist/abstract/loadFileUploaderFrom.d.ts +3 -4
- package/dist/abstract/loadFileUploaderFrom.js +7 -6
- package/dist/abstract/localeRegistry.d.ts +5 -0
- package/dist/abstract/managers/LocaleManager.d.ts +10 -0
- package/dist/abstract/managers/ModalManager.d.ts +53 -0
- package/dist/abstract/managers/SecureUploadsManager.d.ts +7 -0
- package/dist/abstract/managers/TelemetryManager.d.ts +41 -0
- package/dist/abstract/managers/ValidationManager.d.ts +34 -0
- package/dist/abstract/managers/__tests__/ModalManager.test.d.ts +13 -0
- package/dist/abstract/managers/__tests__/SecureUploadsManager.test.d.ts +1 -0
- package/dist/abstract/managers/a11y.d.ts +9 -0
- package/dist/abstract/managers/plugin/PluginManager.d.ts +25 -0
- package/dist/abstract/managers/plugin/PluginTypes.d.ts +146 -0
- package/dist/abstract/managers/plugin/index.d.ts +2 -0
- package/dist/abstract/sharedConfigKey.d.ts +2 -0
- package/dist/abstract/uploadEntrySchema.d.ts +34 -0
- package/dist/blocks/ActivityHeader/ActivityHeader.d.ts +8 -0
- package/dist/blocks/CameraSource/CameraSource.d.ts +121 -0
- package/dist/blocks/CameraSource/__tests__/calcCameraModes.test.d.ts +1 -0
- package/dist/blocks/CameraSource/calcCameraModes.d.ts +5 -0
- package/dist/blocks/CameraSource/constants.d.ts +15 -0
- package/dist/blocks/CloudImageEditor/index.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts +60 -0
- package/dist/blocks/CloudImageEditor/src/CropFrame.d.ts +56 -0
- package/dist/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts +24 -0
- package/dist/blocks/CloudImageEditor/src/EditorButtonControl.d.ts +14 -0
- package/dist/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts +13 -0
- package/dist/blocks/CloudImageEditor/src/EditorFilterControl.d.ts +35 -0
- package/dist/blocks/CloudImageEditor/src/EditorImageCropper.d.ts +56 -0
- package/dist/blocks/CloudImageEditor/src/EditorImageFader.d.ts +63 -0
- package/dist/blocks/CloudImageEditor/src/EditorOperationControl.d.ts +15 -0
- package/dist/blocks/CloudImageEditor/src/EditorScroller.d.ts +15 -0
- package/dist/blocks/CloudImageEditor/src/EditorSlider.d.ts +33 -0
- package/dist/blocks/CloudImageEditor/src/EditorToolbar.d.ts +68 -0
- package/dist/blocks/CloudImageEditor/src/crop-utils.d.ts +36 -0
- package/dist/blocks/CloudImageEditor/src/crop-utils.test.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/cropper-constants.d.ts +10 -0
- package/dist/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts +31 -0
- package/dist/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts +19 -0
- package/dist/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts +27 -0
- package/dist/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts +38 -0
- package/dist/blocks/CloudImageEditor/src/index.d.ts +15 -0
- package/dist/blocks/CloudImageEditor/src/lib/classNames.d.ts +5 -0
- package/dist/blocks/CloudImageEditor/src/lib/classNames.test.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/lib/linspace.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/lib/linspace.test.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts +4 -0
- package/dist/blocks/CloudImageEditor/src/lib/parseCropPreset.test.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/lib/parseTabs.d.ts +2 -0
- package/dist/blocks/CloudImageEditor/src/lib/pick.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/lib/pick.test.d.ts +1 -0
- package/dist/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts +7 -0
- package/dist/blocks/CloudImageEditor/src/state.d.ts +20 -0
- package/dist/blocks/CloudImageEditor/src/svg-sprite.d.ts +2 -0
- package/dist/blocks/CloudImageEditor/src/toolbar-constants.d.ts +61 -0
- package/dist/blocks/CloudImageEditor/src/types.d.ts +60 -0
- package/dist/blocks/CloudImageEditor/src/util.d.ts +2 -0
- package/dist/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts +7 -0
- package/dist/blocks/CloudImageEditor/src/utils/parseFilterValue.test.d.ts +1 -0
- package/dist/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts +25 -0
- package/dist/blocks/Config/Config.d.ts +60 -0
- package/dist/blocks/Config/assertions.d.ts +5 -0
- package/dist/blocks/Config/computed-properties.d.ts +24 -0
- package/dist/blocks/Config/computed-properties.test.d.ts +1 -0
- package/dist/blocks/Config/initialConfig.d.ts +6 -0
- package/dist/blocks/Config/normalizeConfigValue.d.ts +2 -0
- package/dist/blocks/Config/validatorsType.d.ts +18 -0
- package/dist/blocks/Copyright/Copyright.d.ts +10 -0
- package/dist/blocks/DropArea/DropArea.d.ts +47 -0
- package/dist/blocks/DropArea/addDropzone.d.ts +17 -0
- package/dist/blocks/DropArea/getDropItems.d.ts +12 -0
- package/dist/blocks/ExternalSource/ExternalSource.d.ts +45 -0
- package/dist/blocks/ExternalSource/MessageBridge.d.ts +11 -0
- package/dist/blocks/ExternalSource/buildThemeDefinition.d.ts +4 -0
- package/dist/blocks/ExternalSource/query-string.d.ts +1 -0
- package/dist/blocks/ExternalSource/types.d.ts +105 -0
- package/dist/blocks/FileItem/FileItem.d.ts +50 -0
- package/dist/blocks/FileItem/FileItemConfig.d.ts +10 -0
- package/dist/blocks/FormInput/FormInput.d.ts +18 -0
- package/dist/blocks/Icon/Icon.d.ts +19 -0
- package/dist/blocks/Img/Img.d.ts +14 -0
- package/dist/blocks/Img/ImgBase.d.ts +29 -0
- package/dist/blocks/Img/ImgConfig.d.ts +28 -0
- package/dist/blocks/Img/configurations.d.ts +11 -0
- package/dist/blocks/Img/props-map.d.ts +28 -0
- package/dist/blocks/Img/utils/parseObjectToString.d.ts +2 -0
- package/dist/blocks/Modal/Modal.d.ts +34 -0
- package/dist/blocks/PluginActivityRenderer/PluginActivityRenderer.d.ts +32 -0
- package/dist/blocks/PluginActivityRenderer/index.d.ts +1 -0
- package/dist/blocks/ProgressBar/ProgressBar.d.ts +21 -0
- package/dist/blocks/ProgressBarCommon/ProgressBarCommon.d.ts +17 -0
- package/dist/blocks/Select/Select.d.ts +18 -0
- package/dist/blocks/SimpleBtn/SimpleBtn.d.ts +15 -0
- package/dist/blocks/SourceBtn/SourceBtn.d.ts +23 -0
- package/dist/blocks/SourceList/SourceList.d.ts +24 -0
- package/dist/blocks/Spinner/Spinner.d.ts +9 -0
- package/dist/blocks/StartFrom/StartFrom.d.ts +12 -0
- package/dist/blocks/Thumb/Thumb.d.ts +35 -0
- package/dist/blocks/UploadCtxProvider/EventEmitter.d.ts +70 -0
- package/dist/blocks/UploadCtxProvider/UploadCtxProvider.d.ts +44 -0
- package/dist/blocks/UploadList/UploadList.d.ts +39 -0
- package/dist/blocks/UrlSource/UrlSource.d.ts +14 -0
- package/dist/blocks/svg-backgrounds/svg-backgrounds.d.ts +3 -0
- package/dist/blocks/themes/uc-basic/svg-sprite.d.ts +2 -0
- package/dist/cameraPlugin-dGash48Q.js +8 -0
- package/dist/cloud-image-editor-fNswWrI4.js +11 -0
- package/dist/cloudImageEditorPlugin-2EU0Pm_j.js +8 -0
- package/dist/core.d.ts +42 -0
- package/dist/en-DNCwRJsB.js +135 -0
- package/dist/env-B1nfXy9i.js +8 -0
- package/dist/env.d.ts +2 -4
- package/dist/env.js +7 -6
- package/dist/externalSourcesPlugin-DKQqk3AC.js +8 -0
- package/dist/imageShrinkPlugin-DAx8eRen.js +8 -0
- package/dist/index.css +3964 -6
- package/dist/index.d.ts +29 -2715
- package/dist/index.js +1011 -8
- package/dist/index.layered.css +4478 -7
- package/dist/instagramPlugin-k67tMAo3.js +8 -0
- package/dist/lit/BaseComponent.d.ts +12 -0
- package/dist/lit/Constructor.d.ts +1 -0
- package/dist/lit/CssDataMixin.d.ts +7 -0
- package/dist/lit/LightDomMixin.d.ts +8 -0
- package/dist/lit/LitActivityBlock.d.ts +53 -0
- package/dist/lit/LitBlock.d.ts +83 -0
- package/dist/lit/LitSolutionBlock.d.ts +21 -0
- package/dist/lit/LitUploaderBlock.d.ts +53 -0
- package/dist/lit/PubSubCompat.d.ts +18 -0
- package/dist/lit/RegisterableElementMixin.d.ts +7 -0
- package/dist/lit/SharedState.d.ts +119 -0
- package/dist/lit/SymbioteCompatMixin.d.ts +40 -0
- package/dist/lit/TestModeController.d.ts +16 -0
- package/dist/lit/Uid.d.ts +3 -0
- package/dist/lit/activity-constants.d.ts +11 -0
- package/dist/lit/createDebugPrinter.d.ts +3 -0
- package/dist/lit/findBlockInCtx.d.ts +3 -0
- package/dist/lit/getOutputData.d.ts +2 -0
- package/dist/lit/hasBlockInCtx.d.ts +3 -0
- package/dist/lit/l10n.d.ts +5 -0
- package/dist/lit/parseCssPropertyValue.d.ts +1 -0
- package/dist/lit/shared-instances.d.ts +65 -0
- package/dist/loadFileUploaderFrom-BWJM43Yq.js +28 -0
- package/dist/locales/file-uploader/ar.d.ts +1 -4
- package/dist/locales/file-uploader/ar.js +142 -6
- package/dist/locales/file-uploader/az.d.ts +1 -4
- package/dist/locales/file-uploader/az.js +134 -6
- package/dist/locales/file-uploader/ca.d.ts +1 -4
- package/dist/locales/file-uploader/ca.js +136 -6
- package/dist/locales/file-uploader/cs.d.ts +1 -4
- package/dist/locales/file-uploader/cs.js +138 -6
- package/dist/locales/file-uploader/da.d.ts +1 -4
- package/dist/locales/file-uploader/da.js +134 -6
- package/dist/locales/file-uploader/de.d.ts +1 -4
- package/dist/locales/file-uploader/de.js +134 -6
- package/dist/locales/file-uploader/el.d.ts +1 -4
- package/dist/locales/file-uploader/el.js +134 -6
- package/dist/locales/file-uploader/en.d.ts +1 -4
- package/dist/locales/file-uploader/en.js +7 -6
- package/dist/locales/file-uploader/es.d.ts +1 -4
- package/dist/locales/file-uploader/es.js +136 -6
- package/dist/locales/file-uploader/et.d.ts +1 -4
- package/dist/locales/file-uploader/et.js +134 -6
- package/dist/locales/file-uploader/fi.d.ts +1 -4
- package/dist/locales/file-uploader/fi.js +134 -6
- package/dist/locales/file-uploader/fr.d.ts +1 -4
- package/dist/locales/file-uploader/fr.js +136 -6
- package/dist/locales/file-uploader/he.d.ts +1 -4
- package/dist/locales/file-uploader/he.js +136 -6
- package/dist/locales/file-uploader/hy.d.ts +1 -4
- package/dist/locales/file-uploader/hy.js +134 -6
- package/dist/locales/file-uploader/is.d.ts +1 -4
- package/dist/locales/file-uploader/is.js +134 -6
- package/dist/locales/file-uploader/it.d.ts +1 -4
- package/dist/locales/file-uploader/it.js +136 -6
- package/dist/locales/file-uploader/ja.d.ts +1 -4
- package/dist/locales/file-uploader/ja.js +134 -6
- package/dist/locales/file-uploader/ka.d.ts +1 -4
- package/dist/locales/file-uploader/ka.js +134 -6
- package/dist/locales/file-uploader/kk.d.ts +1 -4
- package/dist/locales/file-uploader/kk.js +134 -6
- package/dist/locales/file-uploader/ko.d.ts +1 -4
- package/dist/locales/file-uploader/ko.js +134 -6
- package/dist/locales/file-uploader/lv.d.ts +1 -4
- package/dist/locales/file-uploader/lv.js +136 -6
- package/dist/locales/file-uploader/nb.d.ts +1 -4
- package/dist/locales/file-uploader/nb.js +134 -6
- package/dist/locales/file-uploader/nl.d.ts +1 -4
- package/dist/locales/file-uploader/nl.js +134 -6
- package/dist/locales/file-uploader/pl.d.ts +1 -4
- package/dist/locales/file-uploader/pl.js +138 -6
- package/dist/locales/file-uploader/pt.d.ts +1 -4
- package/dist/locales/file-uploader/pt.js +136 -6
- package/dist/locales/file-uploader/ro.d.ts +1 -4
- package/dist/locales/file-uploader/ro.js +136 -6
- package/dist/locales/file-uploader/ru.d.ts +1 -4
- package/dist/locales/file-uploader/ru.js +138 -6
- package/dist/locales/file-uploader/sk.d.ts +1 -4
- package/dist/locales/file-uploader/sk.js +138 -6
- package/dist/locales/file-uploader/sr.d.ts +1 -4
- package/dist/locales/file-uploader/sr.js +136 -6
- package/dist/locales/file-uploader/sv.d.ts +1 -4
- package/dist/locales/file-uploader/sv.js +134 -6
- package/dist/locales/file-uploader/tr.d.ts +1 -4
- package/dist/locales/file-uploader/tr.js +134 -6
- package/dist/locales/file-uploader/uk.d.ts +1 -4
- package/dist/locales/file-uploader/uk.js +138 -6
- package/dist/locales/file-uploader/vi.d.ts +1 -4
- package/dist/locales/file-uploader/vi.js +134 -6
- package/dist/locales/file-uploader/zh-TW.d.ts +1 -4
- package/dist/locales/file-uploader/zh-TW.js +134 -6
- package/dist/locales/file-uploader/zh.d.ts +1 -4
- package/dist/locales/file-uploader/zh.js +134 -6
- package/dist/plugins/cameraPlugin.d.ts +2 -0
- package/dist/plugins/cloudImageEditorPlugin.d.ts +2 -0
- package/dist/plugins/externalSourcesPlugin.d.ts +2 -0
- package/dist/plugins/imageShrinkPlugin.d.ts +2 -0
- package/dist/plugins/instagramPlugin.d.ts +2 -0
- package/dist/plugins/unsplashPlugin.d.ts +16 -0
- package/dist/plugins/urlSourcePlugin.d.ts +2 -0
- package/dist/plugins-DxjsQUa8.js +278 -0
- package/dist/solutions/adaptive-image/index.d.ts +2 -0
- package/dist/solutions/cloud-image-editor/CloudImageEditor.d.ts +11 -0
- package/dist/solutions/cloud-image-editor/index.d.ts +5 -0
- package/dist/solutions/file-uploader/inline/FileUploaderInline.d.ts +20 -0
- package/dist/solutions/file-uploader/inline/index.d.ts +1 -0
- package/dist/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +23 -0
- package/dist/solutions/file-uploader/minimal/index.d.ts +1 -0
- package/dist/solutions/file-uploader/regular/FileUploaderRegular.d.ts +17 -0
- package/dist/solutions/file-uploader/regular/index.d.ts +1 -0
- package/dist/types/dom.d.ts +1 -0
- package/dist/types/events.d.ts +4 -0
- package/dist/types/exported.d.ts +492 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/urlSourcePlugin-9xdB7Pvw.js +8 -0
- package/dist/utils/UID.d.ts +5 -0
- package/dist/utils/UID.test.d.ts +1 -0
- package/dist/utils/UploadSource.d.ts +37 -0
- package/dist/utils/WindowHeightTracker.d.ts +9 -0
- package/dist/utils/abilities.d.ts +1 -0
- package/dist/utils/applyStyles.d.ts +1 -0
- package/dist/utils/browser-info.d.ts +12 -0
- package/dist/utils/browser-info.test.d.ts +1 -0
- package/dist/utils/cdn-utils.d.ts +53 -0
- package/dist/utils/cdn-utils.test.d.ts +1 -0
- package/dist/utils/comma-separated.d.ts +2 -0
- package/dist/utils/debounce.d.ts +3 -0
- package/dist/utils/delay.d.ts +1 -0
- package/dist/utils/fileTypes.d.ts +11 -0
- package/dist/utils/fileTypes.test.d.ts +1 -0
- package/dist/utils/get-top-level-origin.d.ts +1 -0
- package/dist/utils/get-top-level-origin.test.d.ts +1 -0
- package/dist/utils/getLocaleDirection.d.ts +1 -0
- package/dist/utils/getPluralForm.d.ts +1 -0
- package/dist/utils/getPluralForm.test.d.ts +1 -0
- package/dist/utils/isPromiseLike.d.ts +1 -0
- package/dist/utils/isPromiseLike.test.d.ts +1 -0
- package/dist/utils/isSecureTokenExpired.d.ts +8 -0
- package/dist/utils/isSecureTokenExpired.test.d.ts +1 -0
- package/dist/utils/memoize.d.ts +1 -0
- package/dist/utils/memoize.test.d.ts +1 -0
- package/dist/utils/mixinClass.d.ts +8 -0
- package/dist/utils/parseCdnUrl.d.ts +11 -0
- package/dist/utils/parseCdnUrl.test.d.ts +1 -0
- package/dist/utils/parseShrink.d.ts +7 -0
- package/dist/utils/parseShrink.test.d.ts +1 -0
- package/dist/utils/preloadImage.d.ts +10 -0
- package/dist/utils/prettyBytes.d.ts +11 -0
- package/dist/utils/prettyBytes.test.d.ts +1 -0
- package/dist/utils/resizeImage.d.ts +1 -0
- package/dist/utils/stringToArray.d.ts +1 -0
- package/dist/utils/stringToArray.test.d.ts +1 -0
- package/dist/utils/template-utils.d.ts +16 -0
- package/dist/utils/template-utils.test.d.ts +1 -0
- package/dist/utils/throttle.d.ts +3 -0
- package/dist/utils/toKebabCase.d.ts +2 -0
- package/dist/utils/toKebabCase.test.d.ts +1 -0
- package/dist/utils/transparentPixelSrc.d.ts +1 -0
- package/dist/utils/uniqueArray.d.ts +1 -0
- package/dist/utils/uniqueArray.test.d.ts +1 -0
- package/dist/utils/userAgent.d.ts +2 -0
- package/dist/utils/validators/collection/index.d.ts +2 -0
- package/dist/utils/validators/collection/validateCollectionUploadError.d.ts +2 -0
- package/dist/utils/validators/collection/validateMultiple.d.ts +2 -0
- package/dist/utils/validators/file/index.d.ts +4 -0
- package/dist/utils/validators/file/validateFileType.d.ts +2 -0
- package/dist/utils/validators/file/validateIsImage.d.ts +2 -0
- package/dist/utils/validators/file/validateMaxSizeLimit.d.ts +2 -0
- package/dist/utils/validators/file/validateUploadError.d.ts +2 -0
- package/dist/utils/warnOnce.d.ts +1 -0
- package/dist/utils/wildcardRegexp.d.ts +1 -0
- package/dist/utils/wildcardRegexp.test.d.ts +1 -0
- package/dist/utils/withResolvers.d.ts +5 -0
- package/dist/utils/withResolvers.test.d.ts +1 -0
- package/package.json +8 -2
- package/dist/index.ssr.js +0 -1538
- package/web/file-uploader.iife.min.d.ts +0 -2859
- package/web/file-uploader.iife.min.js +0 -8
- package/web/file-uploader.iife.min.js.LEGAL.txt +0 -71
- package/web/file-uploader.min.d.ts +0 -2859
- package/web/file-uploader.min.js +0 -8
- package/web/file-uploader.min.js.LEGAL.txt +0 -71
- package/web/uc-basic.layered.min.css +0 -7
- package/web/uc-basic.min.css +0 -6
- package/web/uc-cloud-image-editor.layered.min.css +0 -7
- package/web/uc-cloud-image-editor.min.css +0 -6
- package/web/uc-cloud-image-editor.min.d.ts +0 -2816
- package/web/uc-cloud-image-editor.min.js +0 -8
- package/web/uc-cloud-image-editor.min.js.LEGAL.txt +0 -70
- package/web/uc-file-uploader-inline.layered.min.css +0 -7
- package/web/uc-file-uploader-inline.min.css +0 -6
- package/web/uc-file-uploader-inline.min.d.ts +0 -2859
- package/web/uc-file-uploader-inline.min.js +0 -8
- package/web/uc-file-uploader-inline.min.js.LEGAL.txt +0 -71
- package/web/uc-file-uploader-minimal.layered.min.css +0 -7
- package/web/uc-file-uploader-minimal.min.css +0 -6
- package/web/uc-file-uploader-minimal.min.d.ts +0 -2859
- package/web/uc-file-uploader-minimal.min.js +0 -8
- package/web/uc-file-uploader-minimal.min.js.LEGAL.txt +0 -71
- package/web/uc-file-uploader-regular.layered.min.css +0 -7
- package/web/uc-file-uploader-regular.min.css +0 -6
- package/web/uc-file-uploader-regular.min.d.ts +0 -2859
- package/web/uc-file-uploader-regular.min.js +0 -8
- package/web/uc-file-uploader-regular.min.js.LEGAL.txt +0 -71
- package/web/uc-img.min.d.ts +0 -75
- package/web/uc-img.min.js +0 -8
- package/web/uc-img.min.js.LEGAL.txt +0 -24
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Package: @uploadcare/file-uploader@1.28.0-alpha.0 (MIT)
|
|
4
|
+
* License: https://github.com/uploadcare/blob/main/LICENSE
|
|
5
|
+
* Built: 2026-03-02T14:46:15.080Z
|
|
6
|
+
*/
|
|
7
|
+
import "./Icon-CqTVC82Q.js";
|
|
8
|
+
import { t as CloudImageEditorActivity } from "./CloudImageEditorActivity-d4DpK6fQ.js";
|
|
9
|
+
export { CloudImageEditorActivity };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Package: @uploadcare/file-uploader@1.28.0-alpha.0 (MIT)
|
|
4
|
+
* License: https://github.com/uploadcare/blob/main/LICENSE
|
|
5
|
+
* Built: 2026-03-02T14:46:15.080Z
|
|
6
|
+
*/
|
|
7
|
+
import { ct as __decorate } from "./Icon-CqTVC82Q.js";
|
|
8
|
+
import { n as LitActivityBlock, t as LitUploaderBlock } from "./LitUploaderBlock-BA34rzeU.js";
|
|
9
|
+
import { html, nothing } from "lit";
|
|
10
|
+
import { state } from "lit/decorators.js";
|
|
11
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
12
|
+
var CloudImageEditorActivity = class extends LitUploaderBlock {
|
|
13
|
+
constructor(...e) {
|
|
14
|
+
super(...e), this._editorConfig = null;
|
|
15
|
+
}
|
|
16
|
+
get activityParams() {
|
|
17
|
+
let e = super.activityParams;
|
|
18
|
+
if ("internalId" in e) return e;
|
|
19
|
+
throw Error("Cloud Image Editor activity params not found");
|
|
20
|
+
}
|
|
21
|
+
initCallback() {
|
|
22
|
+
super.initCallback(), this.subConfigValue("cropPreset", (e) => {
|
|
23
|
+
this._editorConfig && this._editorConfig.cropPreset !== e && (this._editorConfig = {
|
|
24
|
+
...this._editorConfig,
|
|
25
|
+
cropPreset: e
|
|
26
|
+
});
|
|
27
|
+
}), this.subConfigValue("cloudImageEditorTabs", (e) => {
|
|
28
|
+
this._editorConfig && this._editorConfig.tabs !== e && (this._editorConfig = {
|
|
29
|
+
...this._editorConfig,
|
|
30
|
+
tabs: e
|
|
31
|
+
});
|
|
32
|
+
}), this._mountEditor();
|
|
33
|
+
}
|
|
34
|
+
disconnectedCallback() {
|
|
35
|
+
super.disconnectedCallback(), this._unmountEditor();
|
|
36
|
+
}
|
|
37
|
+
_handleApply(e) {
|
|
38
|
+
if (!this._entry) return;
|
|
39
|
+
this.debugPrint("editor event \"apply\"", e.detail);
|
|
40
|
+
let s = e.detail;
|
|
41
|
+
this._entry.setMultipleValues({
|
|
42
|
+
cdnUrl: s.cdnUrl,
|
|
43
|
+
cdnUrlModifiers: s.cdnUrlModifiers
|
|
44
|
+
}), this.modalManager?.close(LitActivityBlock.activities.CLOUD_IMG_EDIT), this.historyBack();
|
|
45
|
+
}
|
|
46
|
+
_handleCancel(e) {
|
|
47
|
+
let s = e instanceof CustomEvent ? e.detail : void 0;
|
|
48
|
+
this.debugPrint("editor event \"cancel\"", s), this.modalManager?.close(LitActivityBlock.activities.CLOUD_IMG_EDIT), this.historyBack();
|
|
49
|
+
}
|
|
50
|
+
handleChange(e) {
|
|
51
|
+
this.debugPrint("editor event \"change\"", e.detail);
|
|
52
|
+
}
|
|
53
|
+
_mountEditor() {
|
|
54
|
+
let { internalId: e } = this.activityParams, o = this.uploadCollection.read(e);
|
|
55
|
+
if (!o) throw Error(`Entry with internalId "${e}" not found`);
|
|
56
|
+
this._entry = o;
|
|
57
|
+
let s = this._entry.getValue("cdnUrl");
|
|
58
|
+
if (!s) throw Error(`Entry with internalId "${e}" hasn't uploaded yet`);
|
|
59
|
+
this._editorConfig = this._createEditorConfig(s);
|
|
60
|
+
}
|
|
61
|
+
_unmountEditor() {
|
|
62
|
+
this._entry = void 0, this._editorConfig = null;
|
|
63
|
+
}
|
|
64
|
+
render() {
|
|
65
|
+
if (!this._editorConfig) return nothing;
|
|
66
|
+
let { cdnUrl: e, cropPreset: o, tabs: s } = this._editorConfig;
|
|
67
|
+
return html`
|
|
68
|
+
<uc-cloud-image-editor
|
|
69
|
+
cdn-url=${e}
|
|
70
|
+
crop-preset=${ifDefined(o)}
|
|
71
|
+
tabs=${ifDefined(s)}
|
|
72
|
+
@apply=${this._handleApply}
|
|
73
|
+
@cancel=${this._handleCancel}
|
|
74
|
+
@change=${this.handleChange}
|
|
75
|
+
></uc-cloud-image-editor>
|
|
76
|
+
`;
|
|
77
|
+
}
|
|
78
|
+
_createEditorConfig(e) {
|
|
79
|
+
return {
|
|
80
|
+
cdnUrl: e,
|
|
81
|
+
cropPreset: this.cfg.cropPreset,
|
|
82
|
+
tabs: this.cfg.cloudImageEditorTabs
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
__decorate([state()], CloudImageEditorActivity.prototype, "_editorConfig", void 0);
|
|
87
|
+
export { CloudImageEditorActivity as t };
|
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Package: @uploadcare/file-uploader@1.28.0-alpha.0 (MIT)
|
|
4
|
+
* License: https://github.com/uploadcare/blob/main/LICENSE
|
|
5
|
+
* Built: 2026-03-02T14:46:15.080Z
|
|
6
|
+
*/
|
|
7
|
+
import { A as CameraSourceTypes, H as initialConfig, O as warnOnce, V as DEFAULT_CDN_CNAME, it as sharedConfigKey, j as LitBlock, lt as debounce } from "./Icon-CqTVC82Q.js";
|
|
8
|
+
import { f as deserializeCsv, p as serializeCsv, s as ExternalUploadSource } from "./plugins-DxjsQUa8.js";
|
|
9
|
+
import { getPrefixedCdnBaseAsync, isPrefixedCdnBase } from "@uploadcare/cname-prefix/async";
|
|
10
|
+
const toKebabCase = (p) => p.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map((p) => p.toLowerCase()).join("-");
|
|
11
|
+
var ASSERTIONS = [
|
|
12
|
+
{
|
|
13
|
+
test: (p) => !!p.accept && !!p.imgOnly,
|
|
14
|
+
message: "There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
test: (p) => p.enableVideoRecording !== null,
|
|
18
|
+
message: "The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
test: (p) => p.defaultCameraMode !== null,
|
|
22
|
+
message: "The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
const runAssertions = debounce((p) => {
|
|
26
|
+
for (let { test: N, message: F } of ASSERTIONS) N(p) && warnOnce(F);
|
|
27
|
+
}, 0), isPromiseLike = (p) => p instanceof Promise || !!(p && typeof p == "object" && "then" in p && typeof p.then == "function");
|
|
28
|
+
var defineComputedProperty = (p) => p, withLazyPlugins = async ({ plugins: p, entries: N, signal: P }) => {
|
|
29
|
+
let F = p(), I = new Set(N.map((p) => p.pluginId)), L = F.filter((p) => !I.has(p?.id)), R = await Promise.all(N.map(async (p) => {
|
|
30
|
+
if (!p.isEnabled()) return null;
|
|
31
|
+
let N = F.find((N) => N?.id === p.pluginId);
|
|
32
|
+
if (N) return N;
|
|
33
|
+
try {
|
|
34
|
+
let N = await p.load();
|
|
35
|
+
return P.aborted || !p.isEnabled() ? null : N ?? null;
|
|
36
|
+
} catch (N) {
|
|
37
|
+
return P.aborted || console.warn(`[${p.pluginId}] Failed to load plugin`, N), null;
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
if (P.aborted) return F;
|
|
41
|
+
let z = R.filter((p) => p !== null), B = [...L, ...z];
|
|
42
|
+
return B.length === F.length && B.every((p, N) => p === F[N]) ? F : B;
|
|
43
|
+
}, COMPUTED_PROPERTIES = [
|
|
44
|
+
defineComputedProperty({
|
|
45
|
+
key: "cameraModes",
|
|
46
|
+
deps: ["enableVideoRecording"],
|
|
47
|
+
fn: ({ cameraModes: p, enableVideoRecording: N }) => {
|
|
48
|
+
let P = N();
|
|
49
|
+
if (P === null) return p();
|
|
50
|
+
let F = deserializeCsv(p());
|
|
51
|
+
return P && !F.includes("video") ? F = F.concat("video") : P || (F = F.filter((p) => p !== "video")), serializeCsv(F);
|
|
52
|
+
}
|
|
53
|
+
}),
|
|
54
|
+
defineComputedProperty({
|
|
55
|
+
key: "cameraModes",
|
|
56
|
+
deps: ["defaultCameraMode"],
|
|
57
|
+
fn: ({ cameraModes: p, defaultCameraMode: N }) => {
|
|
58
|
+
let P = N();
|
|
59
|
+
if (P === null) return p();
|
|
60
|
+
let F = deserializeCsv(p());
|
|
61
|
+
return F = F.sort((p, N) => p === P ? -1 : N === P ? 1 : 0), serializeCsv(F);
|
|
62
|
+
}
|
|
63
|
+
}),
|
|
64
|
+
defineComputedProperty({
|
|
65
|
+
key: "cdnCname",
|
|
66
|
+
deps: ["pubkey", "cdnCnamePrefixed"],
|
|
67
|
+
fn: ({ pubkey: p, cdnCname: N, cdnCnamePrefixed: P }) => {
|
|
68
|
+
let F = p(), I = N(), L = P();
|
|
69
|
+
return F && (I === "https://ucarecdn.com" || isPrefixedCdnBase(I, L)) ? getPrefixedCdnBaseAsync(F, L) : I;
|
|
70
|
+
}
|
|
71
|
+
}),
|
|
72
|
+
defineComputedProperty({
|
|
73
|
+
key: "plugins",
|
|
74
|
+
deps: [
|
|
75
|
+
"useCloudImageEditor",
|
|
76
|
+
"imageShrink",
|
|
77
|
+
"sourceList"
|
|
78
|
+
],
|
|
79
|
+
fn: ({ plugins: p, useCloudImageEditor: N, imageShrink: P, sourceList: F }, { signal: I }) => withLazyPlugins({
|
|
80
|
+
plugins: p,
|
|
81
|
+
entries: [
|
|
82
|
+
{
|
|
83
|
+
pluginId: "cloud-image-editor",
|
|
84
|
+
isEnabled: () => !!N(),
|
|
85
|
+
load: async () => {
|
|
86
|
+
let { cloudImageEditorPlugin: p } = await import("./cloudImageEditorPlugin-2EU0Pm_j.js");
|
|
87
|
+
return p;
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
pluginId: "image-shrink",
|
|
92
|
+
isEnabled: () => !!P(),
|
|
93
|
+
load: async () => {
|
|
94
|
+
let { imageShrinkPlugin: p } = await import("./imageShrinkPlugin-DAx8eRen.js");
|
|
95
|
+
return p;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
pluginId: "camera",
|
|
100
|
+
isEnabled: () => deserializeCsv(F()).includes("camera"),
|
|
101
|
+
load: async () => {
|
|
102
|
+
let { cameraPlugin: p } = await import("./cameraPlugin-dGash48Q.js");
|
|
103
|
+
return p;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
pluginId: "instagram",
|
|
108
|
+
isEnabled: () => deserializeCsv(F()).includes("instagram"),
|
|
109
|
+
load: async () => {
|
|
110
|
+
let { instagramPlugin: p } = await import("./instagramPlugin-k67tMAo3.js");
|
|
111
|
+
return p;
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
pluginId: "external-sources",
|
|
116
|
+
isEnabled: () => Object.values(ExternalUploadSource).some((p) => deserializeCsv(F()).includes(p)),
|
|
117
|
+
load: async () => {
|
|
118
|
+
let { externalSourcesPlugin: p } = await import("./externalSourcesPlugin-DKQqk3AC.js");
|
|
119
|
+
return p;
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
pluginId: "url-source",
|
|
124
|
+
isEnabled: () => deserializeCsv(F()).includes("url"),
|
|
125
|
+
load: async () => {
|
|
126
|
+
let { urlSourcePlugin: p } = await import("./urlSourcePlugin-9xdB7Pvw.js");
|
|
127
|
+
return p;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
signal: I
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
];
|
|
135
|
+
const computeProperty = ({ key: p, setValue: N, getValue: P, computationControllers: F }) => {
|
|
136
|
+
for (let I of COMPUTED_PROPERTIES) if (I.deps.includes(p)) {
|
|
137
|
+
let p = { [I.key]: () => P(I.key) };
|
|
138
|
+
for (let N of I.deps) p[N] = () => P(N);
|
|
139
|
+
let L = new AbortController();
|
|
140
|
+
F.get(I.fn)?.abort(), F.set(I.fn, L);
|
|
141
|
+
let R;
|
|
142
|
+
try {
|
|
143
|
+
R = I.fn(p, { signal: L.signal });
|
|
144
|
+
} catch (p) {
|
|
145
|
+
F.get(I.fn) === L && F.delete(I.fn), console.error(`Failed to compute value for "${I.key}"`, p);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
isPromiseLike(R) ? R.then((p) => {
|
|
149
|
+
L.signal.aborted || N(I.key, p);
|
|
150
|
+
}).catch((p) => {
|
|
151
|
+
L.signal.aborted || console.error(`Failed to compute value for "${I.key}"`, p);
|
|
152
|
+
}).finally(() => {
|
|
153
|
+
F.get(I.fn) === L && F.delete(I.fn);
|
|
154
|
+
}) : N(I.key, R);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
var asString = (p) => String(p), asNumber = (p) => {
|
|
158
|
+
let N = Number(p);
|
|
159
|
+
if (Number.isNaN(N)) throw Error(`Invalid number: "${p}"`);
|
|
160
|
+
return N;
|
|
161
|
+
}, asBoolean = (p) => {
|
|
162
|
+
if (p == null) return !1;
|
|
163
|
+
if (typeof p == "boolean") return p;
|
|
164
|
+
if (p === "true" || p === "") return !0;
|
|
165
|
+
if (p === "false") return !1;
|
|
166
|
+
throw Error(`Invalid boolean: "${p}"`);
|
|
167
|
+
}, asStore = (p) => p === "auto" ? p : asBoolean(p), asCameraCapture = (p) => {
|
|
168
|
+
let N = asString(p);
|
|
169
|
+
if (N !== "user" && N !== "environment" && N !== "") throw Error(`Invalid value: "${N}"`);
|
|
170
|
+
return N;
|
|
171
|
+
}, asCameraMode = (N) => {
|
|
172
|
+
let P = asString(N);
|
|
173
|
+
if (!Object.values(CameraSourceTypes).includes(P)) throw Error(`Invalid value: "${P}"`);
|
|
174
|
+
return P;
|
|
175
|
+
}, asCameraModes = (N) => {
|
|
176
|
+
let P = asString(N), F = deserializeCsv(P);
|
|
177
|
+
if (F.some((N) => !Object.values(CameraSourceTypes).includes(N))) throw Error(`Invalid value: "${JSON.stringify(F)}"`);
|
|
178
|
+
return P;
|
|
179
|
+
}, asPasteScope = (p) => {
|
|
180
|
+
let N = asString(p);
|
|
181
|
+
if (N === "local" || N === "global") return N;
|
|
182
|
+
if (asBoolean(p) === !1) return !1;
|
|
183
|
+
throw Error(`Invalid value: "${N}"`);
|
|
184
|
+
}, asMetadata = (p) => {
|
|
185
|
+
if (typeof p == "object" && !Array.isArray(p) || typeof p == "function") return p;
|
|
186
|
+
throw Error("Invalid metadata value. Must be an object or function.");
|
|
187
|
+
}, asObject = (p) => {
|
|
188
|
+
if (typeof p == "object") return p;
|
|
189
|
+
throw Error("Invalid value. Must be an object.");
|
|
190
|
+
}, asFunction = (p) => {
|
|
191
|
+
if (typeof p == "function") return p;
|
|
192
|
+
throw Error("Invalid value. Must be a function.");
|
|
193
|
+
}, asArray = (p) => {
|
|
194
|
+
if (Array.isArray(p)) return p;
|
|
195
|
+
throw Error("Must be an array.");
|
|
196
|
+
}, mapping = {
|
|
197
|
+
pubkey: asString,
|
|
198
|
+
multiple: asBoolean,
|
|
199
|
+
multipleMin: asNumber,
|
|
200
|
+
multipleMax: asNumber,
|
|
201
|
+
confirmUpload: asBoolean,
|
|
202
|
+
imgOnly: asBoolean,
|
|
203
|
+
accept: asString,
|
|
204
|
+
externalSourcesPreferredTypes: asString,
|
|
205
|
+
externalSourcesEmbedCss: asString,
|
|
206
|
+
store: asStore,
|
|
207
|
+
cameraMirror: asBoolean,
|
|
208
|
+
cameraCapture: asCameraCapture,
|
|
209
|
+
sourceList: asString,
|
|
210
|
+
topLevelOrigin: asString,
|
|
211
|
+
maxLocalFileSizeBytes: asNumber,
|
|
212
|
+
thumbSize: asNumber,
|
|
213
|
+
showEmptyList: asBoolean,
|
|
214
|
+
useLocalImageEditor: asBoolean,
|
|
215
|
+
useCloudImageEditor: asBoolean,
|
|
216
|
+
cloudImageEditorTabs: asString,
|
|
217
|
+
removeCopyright: asBoolean,
|
|
218
|
+
cropPreset: asString,
|
|
219
|
+
imageShrink: asString,
|
|
220
|
+
modalScrollLock: asBoolean,
|
|
221
|
+
modalBackdropStrokes: asBoolean,
|
|
222
|
+
sourceListWrap: asBoolean,
|
|
223
|
+
remoteTabSessionKey: asString,
|
|
224
|
+
cdnCname: asString,
|
|
225
|
+
cdnCnamePrefixed: asString,
|
|
226
|
+
baseUrl: asString,
|
|
227
|
+
socialBaseUrl: asString,
|
|
228
|
+
secureSignature: asString,
|
|
229
|
+
secureExpire: asString,
|
|
230
|
+
secureDeliveryProxy: asString,
|
|
231
|
+
retryThrottledRequestMaxTimes: asNumber,
|
|
232
|
+
retryNetworkErrorMaxTimes: asNumber,
|
|
233
|
+
multipartMinFileSize: asNumber,
|
|
234
|
+
multipartChunkSize: asNumber,
|
|
235
|
+
maxConcurrentRequests: asNumber,
|
|
236
|
+
multipartMaxConcurrentRequests: asNumber,
|
|
237
|
+
multipartMaxAttempts: asNumber,
|
|
238
|
+
checkForUrlDuplicates: asBoolean,
|
|
239
|
+
saveUrlForRecurrentUploads: asBoolean,
|
|
240
|
+
groupOutput: asBoolean,
|
|
241
|
+
userAgentIntegration: asString,
|
|
242
|
+
debug: asBoolean,
|
|
243
|
+
localeName: asString,
|
|
244
|
+
metadata: asMetadata,
|
|
245
|
+
secureUploadsExpireThreshold: asNumber,
|
|
246
|
+
localeDefinitionOverride: (p) => asObject(p),
|
|
247
|
+
secureUploadsSignatureResolver: (p) => asFunction(p),
|
|
248
|
+
secureDeliveryProxyUrlResolver: (p) => asFunction(p),
|
|
249
|
+
iconHrefResolver: (p) => asFunction(p),
|
|
250
|
+
plugins: (p) => asArray(p),
|
|
251
|
+
fileValidators: asArray,
|
|
252
|
+
collectionValidators: asArray,
|
|
253
|
+
validationTimeout: asNumber,
|
|
254
|
+
validationConcurrency: asNumber,
|
|
255
|
+
cameraModes: asCameraModes,
|
|
256
|
+
defaultCameraMode: asCameraMode,
|
|
257
|
+
enableAudioRecording: asBoolean,
|
|
258
|
+
enableVideoRecording: asBoolean,
|
|
259
|
+
mediaRecorderOptions: asObject,
|
|
260
|
+
maxVideoRecordingDuration: asNumber,
|
|
261
|
+
filesViewMode: (p) => {
|
|
262
|
+
let N = asString(p);
|
|
263
|
+
if (["grid", "list"].includes(N)) return N;
|
|
264
|
+
throw Error(`Invalid value: "${N}"`);
|
|
265
|
+
},
|
|
266
|
+
gridShowFileNames: asBoolean,
|
|
267
|
+
cloudImageEditorAutoOpen: asBoolean,
|
|
268
|
+
cloudImageEditorMaskHref: asString,
|
|
269
|
+
testMode: asBoolean,
|
|
270
|
+
qualityInsights: asBoolean,
|
|
271
|
+
pasteScope: asPasteScope
|
|
272
|
+
};
|
|
273
|
+
const normalizeConfigValue = (p, P) => {
|
|
274
|
+
if (P != null) try {
|
|
275
|
+
return mapping[p](P);
|
|
276
|
+
} catch (P) {
|
|
277
|
+
return console.error(`Invalid value for config key "${p}".`, P), initialConfig[p];
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
var allConfigKeys = [...new Set(["debug", ...Object.keys(initialConfig)])];
|
|
281
|
+
const complexConfigKeys = [
|
|
282
|
+
"metadata",
|
|
283
|
+
"plugins",
|
|
284
|
+
"localeDefinitionOverride",
|
|
285
|
+
"secureUploadsSignatureResolver",
|
|
286
|
+
"secureDeliveryProxyUrlResolver",
|
|
287
|
+
"iconHrefResolver",
|
|
288
|
+
"fileValidators",
|
|
289
|
+
"collectionValidators",
|
|
290
|
+
"mediaRecorderOptions"
|
|
291
|
+
];
|
|
292
|
+
var isComplexKey = (p) => complexConfigKeys.includes(p), plainConfigKeys = allConfigKeys.filter((p) => !isComplexKey(p)), builtinAttrKeyMapping = {
|
|
293
|
+
...Object.fromEntries(plainConfigKeys.map((p) => [toKebabCase(p), p])),
|
|
294
|
+
...Object.fromEntries(plainConfigKeys.map((p) => [p.toLowerCase(), p]))
|
|
295
|
+
}, getLocalPropName = (p) => `__${p}`, Config = class extends LitBlock {
|
|
296
|
+
constructor(...p) {
|
|
297
|
+
super(...p), this.init$ = {
|
|
298
|
+
...this.init$,
|
|
299
|
+
...Object.fromEntries(Object.entries(initialConfig).map(([p, N]) => [sharedConfigKey(p), N]))
|
|
300
|
+
}, this._computationControllers = /* @__PURE__ */ new Map(), this._customAttrKeyMapping = {}, this._customConfigKeys = /* @__PURE__ */ new Set(), this._customConfigSubscriptions = /* @__PURE__ */ new Map();
|
|
301
|
+
}
|
|
302
|
+
_isCustomConfig(p) {
|
|
303
|
+
return this._customConfigKeys.has(p);
|
|
304
|
+
}
|
|
305
|
+
_getCustomConfigDefinition(p) {
|
|
306
|
+
let N = this._sharedInstancesBag.pluginManager;
|
|
307
|
+
if (N) return N.configRegistry.get(p);
|
|
308
|
+
}
|
|
309
|
+
_getAttributeNames(p) {
|
|
310
|
+
return [...new Set([toKebabCase(p), p.toLowerCase()])];
|
|
311
|
+
}
|
|
312
|
+
_flushValueToAttribute(p, N) {
|
|
313
|
+
if (isComplexKey(p) || this._isCustomConfig(p) && this._getCustomConfigDefinition(p)?.attribute === !1) return;
|
|
314
|
+
let P = this._getAttributeNames(p);
|
|
315
|
+
for (let p of P) N == null ? this.removeAttribute(p) : this.getAttribute(p) !== N.toString() && this.setAttribute(p, N.toString());
|
|
316
|
+
}
|
|
317
|
+
_flushValueToState(p, P) {
|
|
318
|
+
let F = sharedConfigKey(p);
|
|
319
|
+
if (this.$[F] !== P) if (P == null) {
|
|
320
|
+
let I = initialConfig[p];
|
|
321
|
+
this.$[F] = I === void 0 ? P : I;
|
|
322
|
+
} else this.$[F] = P;
|
|
323
|
+
}
|
|
324
|
+
_setValue(p, N) {
|
|
325
|
+
let P;
|
|
326
|
+
P = this._isCustomConfig(p) ? this._getCustomConfigDefinition(p)?.normalize?.(N) ?? N : normalizeConfigValue(p, N);
|
|
327
|
+
let F = this, I = getLocalPropName(p);
|
|
328
|
+
F[I] !== P && (this._assertSameValueDifferentReference(p, F[I], P), F[I] = P, this._flushValueToAttribute(p, P), this._flushValueToState(p, P), this.debugPrint(`"${p}"`, P), this._isCustomConfig(p) || runAssertions(this.cfg));
|
|
329
|
+
}
|
|
330
|
+
_getValue(p) {
|
|
331
|
+
return this[getLocalPropName(p)] ?? this.$[sharedConfigKey(p)];
|
|
332
|
+
}
|
|
333
|
+
_assertSameValueDifferentReference(p, N, P) {
|
|
334
|
+
this.cfg.debug && P !== N && typeof P == "object" && typeof N == "object" && JSON.stringify(P) === JSON.stringify(N) && (console.warn(`[uc-config] Option "${p}" value is the same as the previous one but the reference is different`), console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"), console.warn(`[uc-config] "${p}" previous value:`, N), console.warn(`[uc-config] "${p}" new value:`, P));
|
|
335
|
+
}
|
|
336
|
+
_processCustomConfigs(p) {
|
|
337
|
+
let N = p.configRegistry.getAll();
|
|
338
|
+
this._customAttrKeyMapping = {}, this._customConfigKeys = new Set(N.keys());
|
|
339
|
+
for (let [p, P] of this._customConfigSubscriptions) N.has(p) || (P(), this._customConfigSubscriptions.delete(p));
|
|
340
|
+
for (let [p, P] of N) {
|
|
341
|
+
let N = sharedConfigKey(p);
|
|
342
|
+
if (P.attribute) {
|
|
343
|
+
let N = this._getAttributeNames(p);
|
|
344
|
+
for (let P of N) this._customAttrKeyMapping[P] = p;
|
|
345
|
+
}
|
|
346
|
+
this.sharedCtx.has(N) || this.sharedCtx.add(N, P.defaultValue);
|
|
347
|
+
let F = Object.getOwnPropertyDescriptor(this, p);
|
|
348
|
+
if ((!F || !F.set || !F.get) && Object.defineProperty(this, p, {
|
|
349
|
+
set: (N) => {
|
|
350
|
+
this._setValue(p, N);
|
|
351
|
+
},
|
|
352
|
+
get: () => this._getValue(p),
|
|
353
|
+
enumerable: !0,
|
|
354
|
+
configurable: !0
|
|
355
|
+
}), !this._customConfigSubscriptions.has(p)) {
|
|
356
|
+
let P = this.sub(N, (N) => {
|
|
357
|
+
this._setValue(p, N);
|
|
358
|
+
}, !1);
|
|
359
|
+
this._customConfigSubscriptions.set(p, P);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
_setupCustomConfigs() {
|
|
364
|
+
this._sharedInstancesBag.when("pluginManager", (p) => {
|
|
365
|
+
this._processCustomConfigs(p), this._pluginChangeUnsubscribe = p.onPluginsChange(() => {
|
|
366
|
+
this._processCustomConfigs(p);
|
|
367
|
+
});
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
_setupMutationObserver() {
|
|
371
|
+
this._mutationObserver = new MutationObserver((p) => {
|
|
372
|
+
for (let N of p) if (N.type === "attributes" && N.attributeName) {
|
|
373
|
+
let p = N.attributeName, P = N.oldValue, F = this.getAttribute(p);
|
|
374
|
+
if (P === F || p in builtinAttrKeyMapping) continue;
|
|
375
|
+
p in this._customAttrKeyMapping && this.attributeChangedCallback(p, P ?? "", F ?? "");
|
|
376
|
+
}
|
|
377
|
+
}), this._mutationObserver.observe(this, {
|
|
378
|
+
attributes: !0,
|
|
379
|
+
attributeOldValue: !0
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
initCallback() {
|
|
383
|
+
super.initCallback();
|
|
384
|
+
let p = this;
|
|
385
|
+
this._setupCustomConfigs(), this._setupMutationObserver();
|
|
386
|
+
for (let p of plainConfigKeys) this.sub(sharedConfigKey(p), (N) => {
|
|
387
|
+
this._setValue(p, N);
|
|
388
|
+
}, !1);
|
|
389
|
+
for (let P of allConfigKeys) {
|
|
390
|
+
let F = p[P] ?? this.$[sharedConfigKey(P)];
|
|
391
|
+
F !== initialConfig[P] && this._setValue(P, F);
|
|
392
|
+
let L = Object.getOwnPropertyDescriptor(this, P);
|
|
393
|
+
(!L || !L.set || !L.get) && Object.defineProperty(this, P, {
|
|
394
|
+
set: (p) => {
|
|
395
|
+
this._setValue(P, p);
|
|
396
|
+
},
|
|
397
|
+
get: () => this._getValue(P)
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
for (let p of allConfigKeys) this.sub(sharedConfigKey(p), () => {
|
|
401
|
+
computeProperty({
|
|
402
|
+
key: p,
|
|
403
|
+
setValue: this._setValue.bind(this),
|
|
404
|
+
getValue: this._getValue.bind(this),
|
|
405
|
+
computationControllers: this._computationControllers
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
attributeChangedCallback(p, N, P) {
|
|
410
|
+
if (super.attributeChangedCallback(p, N, P), N === P) return;
|
|
411
|
+
let F = this, I = builtinAttrKeyMapping[p];
|
|
412
|
+
I ? F[I] = P : this._sharedInstancesBag.when("pluginManager", (N) => {
|
|
413
|
+
if (this.getAttribute(p) !== P) return;
|
|
414
|
+
let F = this._customAttrKeyMapping[p], I = F ? N.configRegistry.get(F) : void 0;
|
|
415
|
+
if (F && I) {
|
|
416
|
+
let p = I.fromAttribute ? I.fromAttribute(P) : P;
|
|
417
|
+
if (this._getValue(F) === p) return;
|
|
418
|
+
this._setValue(F, p);
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
disconnectedCallback() {
|
|
423
|
+
super.disconnectedCallback(), this._pluginChangeUnsubscribe &&= (this._pluginChangeUnsubscribe(), void 0), this._mutationObserver &&= (this._mutationObserver.disconnect(), void 0);
|
|
424
|
+
for (let p of this._customConfigSubscriptions.values()) p();
|
|
425
|
+
this._customConfigSubscriptions.clear();
|
|
426
|
+
}
|
|
427
|
+
static get observedAttributes() {
|
|
428
|
+
let p = super.observedAttributes, N = Object.keys(builtinAttrKeyMapping);
|
|
429
|
+
return [...p, ...N];
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
for (let p of allConfigKeys) Config.prototype[p] = void 0;
|
|
433
|
+
export { toKebabCase as n, Config as t };
|