@uploadcare/file-uploader 1.15.0-alpha.9 → 1.16.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.
Files changed (285) hide show
  1. package/abstract/ActivityBlock.d.ts +5 -5
  2. package/abstract/ActivityBlock.d.ts.map +1 -1
  3. package/abstract/Block.d.ts +3 -9
  4. package/abstract/Block.d.ts.map +1 -1
  5. package/abstract/CTX.d.ts +6 -6
  6. package/abstract/CTX.d.ts.map +1 -1
  7. package/abstract/LocaleManager.d.ts +3 -3
  8. package/abstract/LocaleManager.d.ts.map +1 -1
  9. package/abstract/ModalManager.d.ts +13 -18
  10. package/abstract/ModalManager.d.ts.map +1 -1
  11. package/abstract/ModalManager.js +19 -10
  12. package/abstract/SecureUploadsManager.d.ts +2 -2
  13. package/abstract/SecureUploadsManager.d.ts.map +1 -1
  14. package/abstract/SolutionBlock.d.ts +2 -2
  15. package/abstract/SolutionBlock.d.ts.map +1 -1
  16. package/abstract/TypedCollection.d.ts +44 -44
  17. package/abstract/TypedCollection.d.ts.map +1 -1
  18. package/abstract/TypedCollection.js +53 -33
  19. package/abstract/TypedData.d.ts +71 -25
  20. package/abstract/TypedData.d.ts.map +1 -1
  21. package/abstract/TypedData.js +74 -17
  22. package/abstract/UploaderBlock.d.ts +10 -10
  23. package/abstract/UploaderBlock.d.ts.map +1 -1
  24. package/abstract/UploaderBlock.js +22 -10
  25. package/abstract/UploaderPublicApi.d.ts +24 -23
  26. package/abstract/UploaderPublicApi.d.ts.map +1 -1
  27. package/abstract/UploaderPublicApi.js +21 -10
  28. package/abstract/ValidationManager.d.ts +125 -6
  29. package/abstract/ValidationManager.d.ts.map +1 -1
  30. package/abstract/ValidationManager.js +1 -1
  31. package/abstract/a11y.d.ts +2 -2
  32. package/abstract/a11y.d.ts.map +1 -1
  33. package/abstract/buildOutputCollectionState.d.ts +1 -1
  34. package/abstract/buildOutputCollectionState.d.ts.map +1 -1
  35. package/abstract/defineComponents.d.ts.map +1 -1
  36. package/abstract/l10nProcessor.d.ts.map +1 -1
  37. package/abstract/loadFileUploaderFrom.d.ts +1 -1
  38. package/abstract/loadFileUploaderFrom.d.ts.map +1 -1
  39. package/abstract/localeRegistry.d.ts.map +1 -1
  40. package/abstract/sharedConfigKey.d.ts.map +1 -1
  41. package/abstract/uploadEntrySchema.d.ts +123 -63
  42. package/abstract/uploadEntrySchema.d.ts.map +1 -1
  43. package/abstract/uploadEntrySchema.js +66 -81
  44. package/blocks/CameraSource/CameraSource.d.ts +9 -9
  45. package/blocks/CameraSource/CameraSource.d.ts.map +1 -1
  46. package/blocks/CameraSource/calcCameraModes.d.ts +1 -1
  47. package/blocks/CameraSource/constants.d.ts.map +1 -1
  48. package/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts.map +1 -1
  49. package/blocks/CloudImageEditor/src/CropFrame.d.ts +8 -1
  50. package/blocks/CloudImageEditor/src/CropFrame.d.ts.map +1 -1
  51. package/blocks/CloudImageEditor/src/CropFrame.js +50 -0
  52. package/blocks/CloudImageEditor/src/EditorFilterControl.js +1 -1
  53. package/blocks/CloudImageEditor/src/EditorImageCropper.d.ts +3 -3
  54. package/blocks/CloudImageEditor/src/EditorImageCropper.js +1 -1
  55. package/blocks/CloudImageEditor/src/EditorImageFader.d.ts +1 -1
  56. package/blocks/CloudImageEditor/src/EditorImageFader.d.ts.map +1 -1
  57. package/blocks/CloudImageEditor/src/EditorImageFader.js +1 -1
  58. package/blocks/CloudImageEditor/src/EditorSlider.d.ts +1 -1
  59. package/blocks/CloudImageEditor/src/EditorSlider.d.ts.map +1 -1
  60. package/blocks/CloudImageEditor/src/EditorToolbar.d.ts +1 -1
  61. package/blocks/CloudImageEditor/src/EditorToolbar.js +1 -1
  62. package/blocks/CloudImageEditor/src/crop-utils.d.ts +14 -14
  63. package/blocks/CloudImageEditor/src/crop-utils.d.ts.map +1 -1
  64. package/blocks/CloudImageEditor/src/cropper-constants.d.ts.map +1 -1
  65. package/blocks/CloudImageEditor/src/css/common.css +4 -0
  66. package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.d.ts +1 -1
  67. package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.d.ts.map +1 -1
  68. package/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts +1 -1
  69. package/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts +3 -3
  70. package/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts.map +1 -1
  71. package/blocks/CloudImageEditor/src/state.d.ts +4 -4
  72. package/blocks/CloudImageEditor/src/svg-sprite.d.ts.map +1 -1
  73. package/blocks/CloudImageEditor/src/types.d.ts +8 -58
  74. package/blocks/CloudImageEditor/src/types.d.ts.map +1 -1
  75. package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts +5 -2
  76. package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts.map +1 -1
  77. package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.js +7 -3
  78. package/blocks/Config/Config.d.ts +3 -12
  79. package/blocks/Config/Config.d.ts.map +1 -1
  80. package/blocks/Config/assertions.d.ts +1 -1
  81. package/blocks/Config/initialConfig.d.ts +1 -1
  82. package/blocks/Config/initialConfig.d.ts.map +1 -1
  83. package/blocks/Config/initialConfig.js +3 -1
  84. package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
  85. package/blocks/Config/normalizeConfigValue.js +1 -0
  86. package/blocks/Config/side-effects.d.ts.map +1 -1
  87. package/blocks/Config/validatorsType.d.ts +1 -1
  88. package/blocks/Config/validatorsType.d.ts.map +1 -1
  89. package/blocks/DropArea/DropArea.d.ts +2 -2
  90. package/blocks/DropArea/DropArea.d.ts.map +1 -1
  91. package/blocks/DropArea/addDropzone.d.ts.map +1 -1
  92. package/blocks/DropArea/drop-area.css +4 -2
  93. package/blocks/DropArea/getDropItems.d.ts +2 -2
  94. package/blocks/DropArea/getDropItems.d.ts.map +1 -1
  95. package/blocks/ExternalSource/ExternalSource.d.ts +3 -3
  96. package/blocks/ExternalSource/ExternalSource.d.ts.map +1 -1
  97. package/blocks/ExternalSource/MessageBridge.d.ts +3 -3
  98. package/blocks/ExternalSource/MessageBridge.d.ts.map +1 -1
  99. package/blocks/ExternalSource/query-string.d.ts.map +1 -1
  100. package/blocks/ExternalSource/types.d.ts +64 -64
  101. package/blocks/ExternalSource/types.d.ts.map +1 -1
  102. package/blocks/FileItem/FileItem.d.ts +12 -39
  103. package/blocks/FileItem/FileItem.d.ts.map +1 -1
  104. package/blocks/FileItem/FileItem.js +114 -178
  105. package/blocks/FileItem/FileItemConfig.d.ts +28 -0
  106. package/blocks/FileItem/FileItemConfig.d.ts.map +1 -0
  107. package/blocks/FileItem/FileItemConfig.js +74 -0
  108. package/blocks/FileItem/file-item.css +21 -6
  109. package/blocks/Img/ImgBase.d.ts +3 -3
  110. package/blocks/Img/ImgBase.d.ts.map +1 -1
  111. package/blocks/Img/ImgBase.js +9 -9
  112. package/blocks/Img/ImgConfig.d.ts.map +1 -1
  113. package/blocks/Img/configurations.d.ts.map +1 -1
  114. package/blocks/Modal/Modal.d.ts +4 -4
  115. package/blocks/Modal/Modal.d.ts.map +1 -1
  116. package/blocks/ProgressBar/ProgressBar.d.ts +6 -1
  117. package/blocks/ProgressBar/ProgressBar.d.ts.map +1 -1
  118. package/blocks/ProgressBar/ProgressBar.js +41 -44
  119. package/blocks/ProgressBar/progress-bar.css +8 -6
  120. package/blocks/Range/Range.d.ts.map +1 -1
  121. package/blocks/SimpleBtn/SimpleBtn.d.ts +2 -2
  122. package/blocks/SimpleBtn/SimpleBtn.d.ts.map +1 -1
  123. package/blocks/SourceBtn/SourceBtn.d.ts +2 -5
  124. package/blocks/SourceBtn/SourceBtn.d.ts.map +1 -1
  125. package/blocks/SourceBtn/SourceBtn.js +5 -5
  126. package/blocks/SourceList/SourceList.js +2 -2
  127. package/blocks/Spinner/Spinner.d.ts.map +1 -1
  128. package/blocks/Thumb/Thumb.d.ts +30 -5
  129. package/blocks/Thumb/Thumb.d.ts.map +1 -1
  130. package/blocks/Thumb/Thumb.js +188 -22
  131. package/blocks/UploadCtxProvider/EventEmitter.d.ts +20 -20
  132. package/blocks/UploadCtxProvider/EventEmitter.d.ts.map +1 -1
  133. package/blocks/UploadCtxProvider/UploadCtxProvider.d.ts +4 -4
  134. package/blocks/UploadCtxProvider/UploadCtxProvider.d.ts.map +1 -1
  135. package/blocks/UploadList/UploadList.d.ts +3 -3
  136. package/blocks/UploadList/UploadList.d.ts.map +1 -1
  137. package/blocks/svg-backgrounds/svg-backgrounds.d.ts +3 -3
  138. package/blocks/svg-backgrounds/svg-backgrounds.d.ts.map +1 -1
  139. package/blocks/themes/uc-basic/svg-sprite.d.ts.map +1 -1
  140. package/blocks/utils/UploadSource.d.ts.map +1 -1
  141. package/blocks/utils/debounce.d.ts +3 -1
  142. package/blocks/utils/debounce.d.ts.map +1 -1
  143. package/blocks/{CloudImageEditor/src/lib → utils}/preloadImage.js +1 -1
  144. package/blocks/utils/resizeImage.d.ts +1 -1
  145. package/blocks/utils/resizeImage.d.ts.map +1 -1
  146. package/blocks/utils/throttle.d.ts +3 -1
  147. package/blocks/utils/throttle.d.ts.map +1 -1
  148. package/blocks/utils/userAgent.d.ts +1 -1
  149. package/blocks/utils/userAgent.d.ts.map +1 -1
  150. package/env.d.ts +1 -1
  151. package/env.d.ts.map +1 -1
  152. package/env.js +1 -1
  153. package/index.d.ts +1 -0
  154. package/index.js +1 -0
  155. package/index.ssr.d.ts +9 -1
  156. package/index.ssr.d.ts.map +1 -1
  157. package/index.ssr.js +18 -10
  158. package/locales/file-uploader/ar.d.ts +1 -0
  159. package/locales/file-uploader/ar.js +1 -0
  160. package/locales/file-uploader/az.d.ts +1 -0
  161. package/locales/file-uploader/az.js +1 -0
  162. package/locales/file-uploader/ca.d.ts +1 -0
  163. package/locales/file-uploader/ca.js +1 -0
  164. package/locales/file-uploader/cs.d.ts +1 -0
  165. package/locales/file-uploader/cs.js +1 -0
  166. package/locales/file-uploader/da.d.ts +1 -0
  167. package/locales/file-uploader/da.js +1 -0
  168. package/locales/file-uploader/de.d.ts +1 -0
  169. package/locales/file-uploader/de.js +1 -0
  170. package/locales/file-uploader/el.d.ts +1 -0
  171. package/locales/file-uploader/el.js +1 -0
  172. package/locales/file-uploader/en.d.ts +1 -0
  173. package/locales/file-uploader/en.js +1 -0
  174. package/locales/file-uploader/es.d.ts +1 -0
  175. package/locales/file-uploader/es.js +1 -0
  176. package/locales/file-uploader/et.d.ts +1 -0
  177. package/locales/file-uploader/et.js +1 -0
  178. package/locales/file-uploader/fi.d.ts +1 -0
  179. package/locales/file-uploader/fi.js +1 -0
  180. package/locales/file-uploader/fr.d.ts +1 -0
  181. package/locales/file-uploader/fr.js +1 -0
  182. package/locales/file-uploader/he.d.ts +1 -0
  183. package/locales/file-uploader/he.js +1 -0
  184. package/locales/file-uploader/hy.d.ts +1 -0
  185. package/locales/file-uploader/hy.js +1 -0
  186. package/locales/file-uploader/is.d.ts +1 -0
  187. package/locales/file-uploader/is.js +1 -0
  188. package/locales/file-uploader/it.d.ts +1 -0
  189. package/locales/file-uploader/it.js +1 -0
  190. package/locales/file-uploader/ja.d.ts +1 -0
  191. package/locales/file-uploader/ja.js +1 -0
  192. package/locales/file-uploader/ka.d.ts +1 -0
  193. package/locales/file-uploader/ka.js +1 -0
  194. package/locales/file-uploader/kk.d.ts +1 -0
  195. package/locales/file-uploader/kk.js +1 -0
  196. package/locales/file-uploader/ko.d.ts +1 -0
  197. package/locales/file-uploader/ko.js +1 -0
  198. package/locales/file-uploader/lv.d.ts +1 -0
  199. package/locales/file-uploader/lv.js +1 -0
  200. package/locales/file-uploader/nb.d.ts +1 -0
  201. package/locales/file-uploader/nb.js +1 -0
  202. package/locales/file-uploader/nl.d.ts +1 -0
  203. package/locales/file-uploader/nl.js +1 -0
  204. package/locales/file-uploader/pl.d.ts +1 -0
  205. package/locales/file-uploader/pl.js +1 -0
  206. package/locales/file-uploader/pt.d.ts +1 -0
  207. package/locales/file-uploader/pt.js +1 -0
  208. package/locales/file-uploader/ro.d.ts +1 -0
  209. package/locales/file-uploader/ro.js +1 -0
  210. package/locales/file-uploader/ru.d.ts +1 -0
  211. package/locales/file-uploader/ru.js +1 -0
  212. package/locales/file-uploader/sk.d.ts +1 -0
  213. package/locales/file-uploader/sk.js +1 -0
  214. package/locales/file-uploader/sr.d.ts +1 -0
  215. package/locales/file-uploader/sr.js +1 -0
  216. package/locales/file-uploader/sv.d.ts +1 -0
  217. package/locales/file-uploader/sv.js +1 -0
  218. package/locales/file-uploader/tr.d.ts +1 -0
  219. package/locales/file-uploader/tr.js +1 -0
  220. package/locales/file-uploader/uk.d.ts +1 -0
  221. package/locales/file-uploader/uk.js +1 -0
  222. package/locales/file-uploader/vi.d.ts +1 -0
  223. package/locales/file-uploader/vi.js +1 -0
  224. package/locales/file-uploader/zh-TW.d.ts +1 -0
  225. package/locales/file-uploader/zh-TW.js +1 -0
  226. package/locales/file-uploader/zh.d.ts +1 -0
  227. package/locales/file-uploader/zh.js +1 -0
  228. package/package.json +7 -8
  229. package/solutions/file-uploader/inline/FileUploaderInline.d.ts +2 -2
  230. package/solutions/file-uploader/inline/FileUploaderInline.d.ts.map +1 -1
  231. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +10 -10
  232. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -1
  233. package/solutions/file-uploader/minimal/FileUploaderMinimal.js +8 -1
  234. package/solutions/file-uploader/minimal/index.css +5 -23
  235. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +2 -2
  236. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +1 -1
  237. package/types/exported.d.ts +51 -49
  238. package/types/jsx.d.ts +1 -1
  239. package/utils/browser-info.d.ts +13 -0
  240. package/utils/browser-info.d.ts.map +1 -0
  241. package/utils/browser-info.js +22 -0
  242. package/utils/browser-info.test.d.ts +2 -0
  243. package/utils/browser-info.test.d.ts.map +1 -0
  244. package/utils/browser-info.test.js +109 -0
  245. package/utils/cdn-utils.d.ts +3 -3
  246. package/utils/cdn-utils.d.ts.map +1 -1
  247. package/utils/fileTypes.d.ts +5 -1
  248. package/utils/fileTypes.d.ts.map +1 -1
  249. package/utils/fileTypes.js +18 -2
  250. package/utils/getPluralForm.d.ts.map +1 -1
  251. package/utils/isSecureTokenExpired.d.ts +1 -1
  252. package/utils/memoize.d.ts.map +1 -1
  253. package/utils/mixinClass.d.ts +3 -1
  254. package/utils/mixinClass.d.ts.map +1 -1
  255. package/utils/prettyBytes.d.ts.map +1 -1
  256. package/utils/template-utils.d.ts +1 -1
  257. package/utils/template-utils.d.ts.map +1 -1
  258. package/utils/toKebabCase.d.ts.map +1 -1
  259. package/utils/transparentPixelSrc.d.ts.map +1 -1
  260. package/utils/uniqueArray.d.ts.map +1 -1
  261. package/utils/validators/collection/validateCollectionUploadError.d.ts +1 -1
  262. package/utils/validators/collection/validateMultiple.d.ts +1 -1
  263. package/utils/validators/file/validateFileType.d.ts +1 -1
  264. package/utils/validators/file/validateIsImage.d.ts +1 -1
  265. package/utils/validators/file/validateMaxSizeLimit.d.ts +1 -1
  266. package/utils/validators/file/validateUploadError.d.ts +1 -1
  267. package/utils/waitForAttribute.d.ts +1 -1
  268. package/utils/waitForAttribute.d.ts.map +1 -1
  269. package/web/file-uploader.iife.min.js +4 -4
  270. package/web/file-uploader.min.js +4 -4
  271. package/web/uc-basic.min.css +1 -1
  272. package/web/uc-cloud-image-editor.min.css +1 -1
  273. package/web/uc-cloud-image-editor.min.js +2 -2
  274. package/web/uc-file-uploader-inline.min.css +1 -1
  275. package/web/uc-file-uploader-inline.min.js +4 -4
  276. package/web/uc-file-uploader-minimal.min.css +1 -1
  277. package/web/uc-file-uploader-minimal.min.js +4 -4
  278. package/web/uc-file-uploader-regular.min.css +1 -1
  279. package/web/uc-file-uploader-regular.min.js +4 -4
  280. package/web/uc-img.min.js +2 -2
  281. package/blocks/utils/supportCapture.d.ts +0 -2
  282. package/blocks/utils/supportCapture.d.ts.map +0 -1
  283. package/blocks/utils/supportCapture.js +0 -3
  284. /package/blocks/{CloudImageEditor/src/lib → utils}/preloadImage.d.ts +0 -0
  285. /package/blocks/{CloudImageEditor/src/lib → utils}/preloadImage.d.ts.map +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uploadcare/file-uploader",
3
- "version": "1.15.0-alpha.9",
3
+ "version": "1.16.0",
4
4
  "description": "Building blocks for Uploadcare products integration",
5
5
  "keywords": [
6
6
  "web components",
@@ -35,9 +35,7 @@
35
35
  "MIT"
36
36
  ],
37
37
  "type": "module",
38
- "sideEffects": [
39
- "*.css"
40
- ],
38
+ "sideEffects": ["*.css"],
41
39
  "module": "./index.js",
42
40
  "exports": {
43
41
  ".": {
@@ -100,13 +98,14 @@
100
98
  "@babel/preset-env": "^7.21.4",
101
99
  "@esm-bundle/chai": "^4.3.4-fix.0",
102
100
  "@happy-dom/global-registrator": "^16.8.1",
103
- "@total-typescript/ts-reset": "^0.5.1",
101
+ "@total-typescript/ts-reset": "^0.6.1",
104
102
  "@types/chai": "^4.3.4",
105
103
  "@types/mocha": "^10.0.1",
106
104
  "@types/node": "^18.15.11",
107
105
  "@types/react": "^18.2.34",
106
+ "@types/sinon": "^17.0.4",
108
107
  "@web/test-runner": "^0.19.0",
109
- "esbuild": "^0.19.9",
108
+ "esbuild": "^0.25.1",
110
109
  "eslint": "^8.56.0",
111
110
  "eslint-config-prettier": "^9.1.0",
112
111
  "eslint-plugin-import": "^2.29.1",
@@ -126,8 +125,8 @@
126
125
  "stylelint-declaration-block-no-ignored-properties": "^2.7.0",
127
126
  "stylelint-order": "^6.0.3",
128
127
  "svg-sprite": "^2.0.4",
129
- "tsd": "^0.29.0",
130
- "typescript": "^5.2.2"
128
+ "tsd": "^0.31.2",
129
+ "typescript": "^5.8.2"
131
130
  },
132
131
  "author": "Uploadcare Inc.",
133
132
  "license": "MIT",
@@ -5,8 +5,8 @@ export class FileUploaderInline extends SolutionBlock {
5
5
  '*commonProgress': number;
6
6
  '*uploadList': never[];
7
7
  '*uploadQueue': import("@uploadcare/upload-client").Queue;
8
- '*collectionErrors': any[];
9
- '*collectionState': import("./index.js").OutputCollectionState<import("./index.js").OutputCollectionStatus, "maybe-has-group"> | null;
8
+ '*collectionErrors': ReturnType<import("./index.js").OutputErrorCollection>[];
9
+ '*collectionState': import("./index.js").OutputCollectionState | null;
10
10
  '*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
11
11
  '*uploadTrigger': Set<string>;
12
12
  '*secureUploadsManager': import("../../../abstract/SecureUploadsManager.js").SecureUploadsManager | null;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploaderInline.d.ts","sourceRoot":"","sources":["FileUploaderInline.js"],"names":[],"mappings":"AAIA;IAMI;;;;;;;;;;;;;;;;MAUC;IAGH,gCAGC;IAED,6BAEC;CA0BF;;;;8BAtD6B,oCAAoC"}
1
+ {"version":3,"file":"FileUploaderInline.d.ts","sourceRoot":"","sources":["FileUploaderInline.js"],"names":[],"mappings":"AAIA;IAMI;;;;;;+CAcoB,YAAU;mCACsC,YAAU;6BAIhD,2BAA2B;;wCAMS,2CACnD;;;;;;MAhBd;IAGH,gCAGC;IAED,6BAEC;CA0BF;;;;8BAtD6B,oCAAoC"}
@@ -7,8 +7,8 @@ export class FileUploaderMinimal extends SolutionBlock {
7
7
  '*commonProgress': number;
8
8
  '*uploadList': never[];
9
9
  '*uploadQueue': import("@uploadcare/upload-client").Queue;
10
- '*collectionErrors': any[];
11
- '*collectionState': import("./index.js").OutputCollectionState<import("./index.js").OutputCollectionStatus, "maybe-has-group"> | null;
10
+ '*collectionErrors': ReturnType<import("./index.js").OutputErrorCollection>[];
11
+ '*collectionState': import("./index.js").OutputCollectionState | null;
12
12
  '*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
13
13
  '*uploadTrigger': Set<string>;
14
14
  '*secureUploadsManager': import("../../../abstract/SecureUploadsManager.js").SecureUploadsManager | null;
@@ -19,20 +19,20 @@ export class FileUploaderMinimal extends SolutionBlock {
19
19
  '*closeModal': () => void;
20
20
  };
21
21
  _handleModalOpen(data: {
22
- id: string;
23
- modal?: import("./index.js").Modal | undefined;
22
+ id: import("../../../abstract/ModalManager.js").ModalId;
23
+ modal: import("../../../abstract/ModalManager.js").ModalNode;
24
24
  }): void;
25
25
  _handleModalClose(data: {
26
- id: string;
27
- modal?: import("./index.js").Modal | undefined;
26
+ id: import("../../../abstract/ModalManager.js").ModalId;
27
+ modal: import("../../../abstract/ModalManager.js").ModalNode;
28
28
  }): void;
29
29
  handleModalOpen: ((data: {
30
- id: string;
31
- modal?: import("./index.js").Modal | undefined;
30
+ id: import("../../../abstract/ModalManager.js").ModalId;
31
+ modal: import("../../../abstract/ModalManager.js").ModalNode;
32
32
  }) => void) | undefined;
33
33
  handleModalClose: ((data: {
34
- id: string;
35
- modal?: import("./index.js").Modal | undefined;
34
+ id: import("../../../abstract/ModalManager.js").ModalId;
35
+ modal: import("../../../abstract/ModalManager.js").ModalNode;
36
36
  }) => void) | undefined;
37
37
  }
38
38
  export namespace FileUploaderMinimal {
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploaderMinimal.d.ts","sourceRoot":"","sources":["FileUploaderMinimal.js"],"names":[],"mappings":"AAQA;IAMI;;;;;;;;;;;;;;;;;;MAMC;IAXF;;;aAAkD;IAAlD;;;aAAkD;IAkGjD;;;4BAAuD;IACvD;;;4BAAyD;CAW5D;;;;8BArH6B,oCAAoC"}
1
+ {"version":3,"file":"FileUploaderMinimal.d.ts","sourceRoot":"","sources":["FileUploaderMinimal.js"],"names":[],"mappings":"AAQA;IAMI;;;;;;;;+CASqD,YAAU;mCAEf,YAClD;6BAKS,2BAA2B;;wCAIhC,2CAGI;;;;;;MAlBL;;;;;;;;;IA8FD;;;4BAAuD;IACvD;;;4BAAyD;CAW5D;;;;8BA5H6B,oCAAoC"}
@@ -22,7 +22,13 @@ export class FileUploaderMinimal extends SolutionBlock {
22
22
  }
23
23
 
24
24
  /** @type {import('../../../abstract/ModalManager.js').ModalCb} */
25
- _handleModalOpen() {
25
+ _handleModalOpen(e) {
26
+ if (e.id === ActivityBlock.activities.CLOUD_IMG_EDIT) {
27
+ this.set$({
28
+ classUploadList: ACTIVE_CLASS,
29
+ });
30
+ }
31
+
26
32
  if (this.$['*currentActivity'] === ActivityBlock.activities.UPLOAD_LIST) {
27
33
  this.set$({
28
34
  classUploadList: ACTIVE_CLASS,
@@ -75,6 +81,7 @@ export class FileUploaderMinimal extends SolutionBlock {
75
81
  } else {
76
82
  this.set$({
77
83
  classUploadList: EMPTY_CLASS,
84
+ isHiddenStartFrom: false,
78
85
  });
79
86
  this.$['*currentActivity'] = uBlock.initActivity || ActivityBlock.activities.START_FROM;
80
87
  }
@@ -1,28 +1,5 @@
1
1
  @import url('../../../blocks/themes/uc-basic/index.css');
2
2
 
3
- /* @import url('../../../blocks/themes/uc-basic/config.css'); */
4
-
5
- /* COMMON STYLES */
6
-
7
- /* @import url('../../../blocks/themes/uc-basic/common.css'); */
8
-
9
- /* THEME */
10
-
11
- /* @import url('../../../blocks/themes/uc-basic/theme.css'); */
12
-
13
- /* BLOCKS: */
14
-
15
- /* @import url('../../../blocks/StartFrom/start-from.css');
16
- @import url('../../../blocks/DropArea/drop-area.css');
17
- @import url('../../../blocks/UploadList/upload-list.css');
18
- @import url('../../../blocks/FileItem/file-item.css');
19
- @import url('../../../blocks/Icon/icon.css');
20
- @import url('../../../blocks/ProgressBar/progress-bar.css');
21
- @import url('../../../blocks/Copyright/copyright.css');
22
- @import url('../../../blocks/Modal/modal.css');
23
- @import url('../../../blocks/CloudImageEditor/index.css');
24
- @import url('../../../blocks/CloudImageEditorActivity/index.css'); */
25
-
26
3
  /* ICONS: */
27
4
  :where([uc-file-uploader-minimal]) {
28
5
  --cfg-init-activity: 'start-from';
@@ -133,6 +110,11 @@
133
110
  border-radius: var(--uc-radius);
134
111
  }
135
112
 
113
+ [uc-file-uploader-minimal] uc-file-item uc-progress-bar .uc-fake-progress {
114
+ background-color: var(--uc-primary-transparent);
115
+ border-radius: var(--uc-radius);
116
+ }
117
+
136
118
  [uc-file-uploader-minimal] uc-upload-list uc-drop-area {
137
119
  width: 100%;
138
120
  height: 100%;
@@ -4,8 +4,8 @@ export class FileUploaderRegular extends SolutionBlock {
4
4
  '*commonProgress': number;
5
5
  '*uploadList': never[];
6
6
  '*uploadQueue': import("@uploadcare/upload-client").Queue;
7
- '*collectionErrors': any[];
8
- '*collectionState': import("./index.js").OutputCollectionState<import("./index.js").OutputCollectionStatus, "maybe-has-group"> | null;
7
+ '*collectionErrors': ReturnType<import("./index.js").OutputErrorCollection>[];
8
+ '*collectionState': import("./index.js").OutputCollectionState | null;
9
9
  '*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
10
10
  '*uploadTrigger': Set<string>;
11
11
  '*secureUploadsManager': import("../../../abstract/SecureUploadsManager.js").SecureUploadsManager | null;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploaderRegular.d.ts","sourceRoot":"","sources":["FileUploaderRegular.js"],"names":[],"mappings":"AAIA;IAMI;;;;;;;;;;;;;;;MAGC;CAaJ;;;;8BAzB6B,oCAAoC"}
1
+ {"version":3,"file":"FileUploaderRegular.d.ts","sourceRoot":"","sources":["FileUploaderRegular.js"],"names":[],"mappings":"AAIA;IAMI;;;;;+CAmBsB,YAAU;mCAEmB,YAChD;6BAEO,2BAA2B;;wCAEnC,2CAAoB;;;;;;MAvBrB;CAaJ;;;;8BAzB6B,oCAAoC"}
@@ -285,6 +285,8 @@ export type ConfigType = {
285
285
  gridShowFileNames: boolean;
286
286
 
287
287
  cloudImageEditorAutoOpen: boolean;
288
+
289
+ cloudImageEditorMaskHref: string | null;
288
290
  };
289
291
  export type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
290
292
  export type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
@@ -292,8 +294,8 @@ export type ConfigAttributesType = KebabCaseKeys<ConfigPlainType> & LowerCaseKey
292
294
 
293
295
  export type KebabCase<S extends string> = S extends `${infer C}${infer T}`
294
296
  ? T extends Uncapitalize<T>
295
- ? `${Uncapitalize<C>}${KebabCase<T>}`
296
- : `${Uncapitalize<C>}-${KebabCase<T>}`
297
+ ? `${Uncapitalize<C>}${KebabCase<T>}`
298
+ : `${Uncapitalize<C>}-${KebabCase<T>}`
297
299
  : S;
298
300
  export type KebabCaseKeys<T extends Record<string, unknown>> = { [Key in keyof T as KebabCase<Key & string>]: T[Key] };
299
301
  export type LowerCase<S extends string> = Lowercase<S>;
@@ -352,17 +354,17 @@ export type OutputErrorTypePayload = {
352
354
 
353
355
  export type OutputError<T extends OutputFileErrorType | OutputCollectionErrorType> = T extends OutputCustomErrorType
354
356
  ? {
355
- type?: T;
356
- message: string;
357
- payload?: OutputErrorTypePayload[T];
358
- }
357
+ type?: T;
358
+ message: string;
359
+ payload?: OutputErrorTypePayload[T];
360
+ }
359
361
  : T extends keyof OutputErrorTypePayload
360
- ? {
361
- type: T;
362
- message: string;
363
- payload?: OutputErrorTypePayload[T];
364
- }
365
- : never;
362
+ ? {
363
+ type: T;
364
+ message: string;
365
+ payload?: OutputErrorTypePayload[T];
366
+ }
367
+ : never;
366
368
 
367
369
  export type OutputErrorFile = OutputError<OutputFileErrorType>;
368
370
 
@@ -384,7 +386,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
384
386
  fullPath: string | null;
385
387
  source: SourceTypes | null;
386
388
  } & (
387
- | {
389
+ | {
388
390
  status: 'success';
389
391
  fileInfo: UploadcareFile;
390
392
  uuid: string;
@@ -396,7 +398,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
396
398
  isRemoved: false;
397
399
  errors: [];
398
400
  }
399
- | {
401
+ | {
400
402
  status: 'failed';
401
403
  fileInfo: UploadcareFile | null;
402
404
  uuid: string | null;
@@ -408,7 +410,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
408
410
  isRemoved: false;
409
411
  errors: OutputError<OutputFileErrorType>[];
410
412
  }
411
- | {
413
+ | {
412
414
  status: 'uploading';
413
415
  fileInfo: null;
414
416
  uuid: null;
@@ -420,7 +422,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
420
422
  isRemoved: false;
421
423
  errors: [];
422
424
  }
423
- | {
425
+ | {
424
426
  status: 'removed';
425
427
  fileInfo: UploadcareFile | null;
426
428
  uuid: string | null;
@@ -432,7 +434,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
432
434
  isRemoved: true;
433
435
  errors: OutputError<OutputFileErrorType>[];
434
436
  }
435
- | {
437
+ | {
436
438
  status: 'idle';
437
439
  fileInfo: null;
438
440
  uuid: null;
@@ -444,7 +446,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
444
446
  isRemoved: false;
445
447
  errors: [];
446
448
  }
447
- );
449
+ );
448
450
 
449
451
  export type OutputCollectionStatus = 'idle' | 'uploading' | 'success' | 'failed';
450
452
 
@@ -468,43 +470,43 @@ export type OutputCollectionState<
468
470
  } & (TGroupFlag extends 'has-group'
469
471
  ? { group: UploadcareGroup }
470
472
  : TGroupFlag extends 'maybe-has-group'
471
- ? { group: UploadcareGroup | null }
472
- : never) &
473
+ ? { group: UploadcareGroup | null }
474
+ : never) &
473
475
  (
474
476
  | {
475
- status: 'idle';
476
- isFailed: false;
477
- isUploading: false;
478
- isSuccess: false;
479
- errors: [];
480
- allEntries: OutputFileEntry<'idle' | 'success'>[];
481
- }
477
+ status: 'idle';
478
+ isFailed: false;
479
+ isUploading: false;
480
+ isSuccess: false;
481
+ errors: [];
482
+ allEntries: OutputFileEntry<'idle' | 'success'>[];
483
+ }
482
484
  | {
483
- status: 'uploading';
484
- isFailed: false;
485
- isUploading: true;
486
- isSuccess: false;
487
- errors: [];
488
- allEntries: OutputFileEntry[];
489
- }
485
+ status: 'uploading';
486
+ isFailed: false;
487
+ isUploading: true;
488
+ isSuccess: false;
489
+ errors: [];
490
+ allEntries: OutputFileEntry[];
491
+ }
490
492
  | {
491
- status: 'success';
492
- isFailed: false;
493
- isUploading: false;
494
- isSuccess: true;
495
- errors: [];
496
- allEntries: OutputFileEntry<'success'>[];
497
- }
493
+ status: 'success';
494
+ isFailed: false;
495
+ isUploading: false;
496
+ isSuccess: true;
497
+ errors: [];
498
+ allEntries: OutputFileEntry<'success'>[];
499
+ }
498
500
  | {
499
- status: 'failed';
500
- isFailed: true;
501
- isUploading: false;
502
- isSuccess: false;
503
- errors: OutputError<OutputCollectionErrorType>[];
504
- allEntries: OutputFileEntry[];
505
- }
501
+ status: 'failed';
502
+ isFailed: true;
503
+ isUploading: false;
504
+ isSuccess: false;
505
+ errors: OutputError<OutputCollectionErrorType>[];
506
+ allEntries: OutputFileEntry[];
507
+ }
506
508
  );
507
509
 
508
510
  export { EventType, EventPayload } from '../blocks/UploadCtxProvider/EventEmitter';
509
511
 
510
- export {};
512
+ export { };
package/types/jsx.d.ts CHANGED
@@ -54,7 +54,7 @@ declare namespace JSX {
54
54
  >;
55
55
  'uc-cloud-image-editor': CustomElement<CloudImageEditorBlock, JSX.IntrinsicElements['uc-cloud-image-editor-block']>;
56
56
  'uc-form-input': CustomElement<FormInput, CtxAttributes>;
57
- 'uc-file-uploader-regular': CustomElement<FileUploaderRegular, CtxAttributes>;
57
+ 'uc-file-uploader-regular': CustomElement<FileUploaderRegular, CtxAttributes & Partial<{ headless: boolean }>>;
58
58
  'uc-file-uploader-minimal': CustomElement<FileUploaderMinimal, CtxAttributes>;
59
59
  'uc-file-uploader-inline': CustomElement<FileUploaderInline, CtxAttributes>;
60
60
  'uc-upload-ctx-provider': CustomElement<InstanceType<UploadCtxProvider>, CtxAttributes>;
@@ -0,0 +1,13 @@
1
+ export function calcBrowserInfo(): {
2
+ safariDesktop: boolean;
3
+ };
4
+ export function calcBrowserFeatures(): {
5
+ htmlMediaCapture: boolean;
6
+ };
7
+ export namespace browserInfo {
8
+ let safariDesktop: boolean;
9
+ }
10
+ export namespace browserFeatures {
11
+ let htmlMediaCapture: boolean;
12
+ }
13
+ //# sourceMappingURL=browser-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-info.d.ts","sourceRoot":"","sources":["browser-info.js"],"names":[],"mappings":"AAWO;;EAEL;AAEK;;EAEL"}
@@ -0,0 +1,22 @@
1
+ // @ts-check
2
+
3
+ const calcIsDesktopSafari = () => {
4
+ const ua = navigator.userAgent;
5
+ return /Macintosh|Windows/.test(ua) && /Version\/[\d\.]+.*Safari/.test(ua) && !/Chrome|Chromium|Edg|OPR/.test(ua);
6
+ };
7
+
8
+ const calcHtmlMediaCaptureSupport = () => {
9
+ return 'capture' in document.createElement('input');
10
+ };
11
+
12
+ export const calcBrowserInfo = () => ({
13
+ safariDesktop: calcIsDesktopSafari(),
14
+ });
15
+
16
+ export const calcBrowserFeatures = () => ({
17
+ htmlMediaCapture: calcHtmlMediaCaptureSupport(),
18
+ });
19
+
20
+ export const browserInfo = calcBrowserInfo();
21
+
22
+ export const browserFeatures = calcBrowserFeatures();
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=browser-info.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-info.test.d.ts","sourceRoot":"","sources":["browser-info.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,109 @@
1
+ // @ts-check
2
+ import { expect } from '@esm-bundle/chai';
3
+ import { calcBrowserFeatures, calcBrowserInfo } from './browser-info';
4
+ import * as sinon from 'sinon';
5
+
6
+ const DESKTOP_SAFARI_USER_AGENTS = [
7
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15',
8
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15',
9
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15',
10
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 12_0) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15',
11
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_0) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15',
12
+ 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6; en-US) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.4 Safari/533.18.5',
13
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.8 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.8',
14
+ 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_7_5; en-US) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.10 Safari/534.57.2',
15
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/602.3.12 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8',
16
+ ];
17
+
18
+ const MOBILE_SAFARI_USER_AGENTS = [
19
+ 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15A5365e Safari/604.1',
20
+ 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1',
21
+ 'Mozilla/5.0 (iPad; CPU OS 15_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1',
22
+ 'Mozilla/5.0 (iPod touch; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Mobile/15E148 Safari/604.1',
23
+ 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1',
24
+ 'Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1',
25
+ 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/16A366 Safari/602.1',
26
+ 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15G77 Safari/604.1',
27
+ 'Mozilla/5.0 (iPad; CPU OS 13_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Mobile/15E148 Safari/604.1',
28
+ 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/14E5239e Safari/602.1',
29
+ ];
30
+
31
+ const OTHER_DESKTOP_USER_AGENTS = [
32
+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36',
33
+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.64',
34
+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:112.0) Gecko/20100101 Firefox/112.0',
35
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36',
36
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:112.0) Gecko/20100101 Firefox/112.0',
37
+ 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36',
38
+ 'Mozilla/5.0 (X11; Linux x86_64; rv:112.0) Gecko/20100101 Firefox/112.0',
39
+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.49 Safari/537.36 OPR/98.0.4759.82',
40
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 OPR/98.0.4759.82',
41
+ 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko',
42
+ ];
43
+
44
+ const OTHER_MOBILE_USER_AGENTS = [
45
+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36',
46
+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:115.0) Gecko/20100101 Firefox/115.0',
47
+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Edg/115.0.0.0',
48
+ 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko',
49
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36',
50
+ 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36',
51
+ 'Mozilla/5.0 (X11; Linux x86_64; rv:115.0) Gecko/20100101 Firefox/115.0',
52
+ 'Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Mobile Safari/537.36',
53
+ 'Mozilla/5.0 (Android 11; Mobile; rv:115.0) Gecko/115.0 Firefox/115.0',
54
+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 OPR/100.0.0.0',
55
+ ];
56
+
57
+ describe('browser-info', () => {
58
+ describe('safariDesktop flag', () => {
59
+ it('should be true for desktop safari', () => {
60
+ const sandbox = sinon.createSandbox();
61
+ for (const ua of DESKTOP_SAFARI_USER_AGENTS) {
62
+ sandbox.replaceGetter(window.navigator, 'userAgent', () => ua);
63
+ const browserInfo = calcBrowserInfo();
64
+ expect(browserInfo.safariDesktop).to.be.true;
65
+ sandbox.restore();
66
+ }
67
+ });
68
+
69
+ it('should be false for other browsers', () => {
70
+ const sandbox = sinon.createSandbox();
71
+ for (const ua of [...OTHER_DESKTOP_USER_AGENTS, ...OTHER_MOBILE_USER_AGENTS, ...MOBILE_SAFARI_USER_AGENTS]) {
72
+ sandbox.replaceGetter(window.navigator, 'userAgent', () => ua);
73
+ const browserInfo = calcBrowserInfo();
74
+ expect(browserInfo.safariDesktop).to.be.false;
75
+ sandbox.restore();
76
+ }
77
+ });
78
+ });
79
+ });
80
+
81
+ describe('browser-features', () => {
82
+ describe('htmlMediaCapture', () => {
83
+ it('should be true if capture is supported', () => {
84
+ const sandbox = sinon.createSandbox();
85
+ const originalDocumentCreateElement = document.createElement.bind(document);
86
+ sandbox.replace(document, 'createElement', () => {
87
+ const input = originalDocumentCreateElement('input');
88
+ input.capture = '';
89
+ return input;
90
+ });
91
+ const browserFeatures = calcBrowserFeatures();
92
+ expect(browserFeatures.htmlMediaCapture).to.be.true;
93
+ sandbox.restore();
94
+ });
95
+ it('should be false if capture is not supported', () => {
96
+ const sandbox = sinon.createSandbox();
97
+ const originalDocumentCreateElement = document.createElement.bind(document);
98
+ sandbox.replace(document, 'createElement', () => {
99
+ const input = originalDocumentCreateElement('input');
100
+ // @ts-ignore
101
+ delete input.capture;
102
+ return input;
103
+ });
104
+ const browserFeatures = calcBrowserFeatures();
105
+ expect(browserFeatures.htmlMediaCapture).to.be.false;
106
+ sandbox.restore();
107
+ });
108
+ });
109
+ });
@@ -52,8 +52,8 @@ export function splitFileUrl(fileUrl: string): {
52
52
  hash: string;
53
53
  };
54
54
  export function normalizeCdnOperation(operation?: string | unknown): string;
55
- export function joinCdnOperations(...operations?: unknown[] | undefined): string;
56
- export function createCdnUrlModifiers(...cdnOperations?: unknown[] | undefined): string;
57
- export function createCdnUrl(baseCdnUrl: string, cdnModifiers?: string | undefined, filename?: string | undefined): string;
55
+ export function joinCdnOperations(...operations?: (string | unknown)[]): string;
56
+ export function createCdnUrlModifiers(...cdnOperations?: (string | unknown)[]): string;
57
+ export function createCdnUrl(baseCdnUrl: string, cdnModifiers?: string, filename?: string): string;
58
58
  export function createOriginalUrl(cdnUrl: string, uuid: string): string;
59
59
  //# sourceMappingURL=cdn-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cdn-utils.d.ts","sourceRoot":"","sources":["cdn-utils.js"],"names":[],"mappings":"AAgDA;;;;;GAKG;AACH,wDAcC;AAED;;;;;GAKG;AACH,oCAHW,MAAM,GACJ,MAAM,CAQlB;AAED;;;;;GAKG;AACH,+CAHW,MAAM,GACJ,MAAM,CAYlB;AAED;;;;;GAKG;AACH,0CAHW,MAAM,GACJ,MAAM,EAAE,CASpB;AAED;;;;;GAKG;AACH,qDASC;AAED;;;;;GAKG;AACH,qDAEC;AAED;;;;;GAKG;AACH,+CAFa;IAAE,QAAQ,SAAS;IAAC,MAAM,SAAS;IAAC,IAAI,SAAQ;CAAE,CAS9D;AAvJM,kDAHI,SAAS,OAAO,UAkB1B;AAQM,iFAKN;AASM,wFAGN;AA2HM,2HAgBN;AASM,wEAIN"}
1
+ {"version":3,"file":"cdn-utils.d.ts","sourceRoot":"","sources":["cdn-utils.js"],"names":[],"mappings":"AAgDA;;;;;GAKG;AACH,wDAcC;AAED;;;;;GAKG;AACH,oCAHW,MAAM,GACJ,MAAM,CAQlB;AAED;;;;;GAKG;AACH,+CAHW,MAAM,GACJ,MAAM,CAYlB;AAED;;;;;GAKG;AACH,0CAHW,MAAM,GACJ,MAAM,EAAE,CASpB;AAED;;;;;GAKG;AACH,qDASC;AAED;;;;;GAKG;AACH,qDAEC;AAED;;;;;GAKG;AACH,+CAFa;IAAE,QAAQ,SAAS;IAAC,MAAM,SAAS;IAAC,IAAI,SAAQ;CAAE,CAS9D;AAvJM,kDAHI,SAAS,OAAO,UAkB1B;AAQM,kDAHO,CAAC,SAAS,OAAO,CAAC,EAAA,UAQ/B;AASM,yDAHO,CAAC,SAAS,OAAO,CAAC,EAAA,UAM/B;AA2HM,mGAgBN;AASM,wEAIN"}
@@ -1,5 +1,9 @@
1
+ export const BASIC_IMAGE_WILDCARD: "image/*";
2
+ export const BASIC_VIDEO_WILDCARD: "video/*";
3
+ export const HEIC_IMAGE_MIME_LIST: string[];
4
+ export function calcImageAcceptList(): string[];
1
5
  export const IMAGE_ACCEPT_LIST: string[];
2
- export function mergeFileTypes(fileTypes?: string[] | undefined): string[];
6
+ export function mergeFileTypes(fileTypes?: string[]): string[];
3
7
  export function matchMimeType(mimeType: string, allowedFileTypes: string[]): boolean;
4
8
  export function matchExtension(fileName: string, allowedFileTypes: string[]): boolean;
5
9
  export function fileIsImage(file: File | Blob): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"fileTypes.d.ts","sourceRoot":"","sources":["fileTypes.js"],"names":[],"mappings":"AAGA,yCAcE;AAMK,kEAFM,MAAM,EAAE,CAUpB;AAOM,kEAHI,QAAQ,WAYlB;AAOM,mEAHI,QAAQ,WAWlB;AAMM,kCAHI,IAAI,GAAG,IAAI,WASrB;AAQM,6BAHI,OAAO,GACL,OAAO,CAInB;AAQM,6BAHI,OAAO,GACL,OAAO,CAInB"}
1
+ {"version":3,"file":"fileTypes.d.ts","sourceRoot":"","sources":["fileTypes.js"],"names":[],"mappings":"AAIA,mCAAoC,SAAS,CAAC;AAC9C,mCAAoC,SAAS,CAAC;AAC9C,4CAaE;AAEK,gDAUN;AAED,yCAAuD;AAMhD,2CAHI,MAAM,EAAE,GACN,MAAM,EAAE,CAUpB;AAOM,kEAHI,QAAQ,WAYlB;AAOM,mEAHI,QAAQ,WAWlB;AAMM,kCAHI,IAAI,GAAG,IAAI,WASrB;AAQM,6BAHI,OAAO,GACL,OAAO,CAInB;AAQM,6BAHI,OAAO,GACL,OAAO,CAInB"}
@@ -1,8 +1,10 @@
1
1
  // @ts-check
2
+ import { browserInfo } from './browser-info.js';
2
3
  import { stringToArray } from './stringToArray.js';
3
4
 
4
- export const IMAGE_ACCEPT_LIST = [
5
- 'image/*',
5
+ export const BASIC_IMAGE_WILDCARD = 'image/*';
6
+ export const BASIC_VIDEO_WILDCARD = 'video/*';
7
+ export const HEIC_IMAGE_MIME_LIST = [
6
8
  'image/heif',
7
9
  'image/heif-sequence',
8
10
  'image/heic',
@@ -17,6 +19,20 @@ export const IMAGE_ACCEPT_LIST = [
17
19
  '.avifs',
18
20
  ];
19
21
 
22
+ export const calcImageAcceptList = () => {
23
+ // Desktop Safari allows selecting HEIC images with simple image/* wildcard
24
+ // But if we provide a more specific HEIC types - safari starts to convert any images to HEIC
25
+ if (browserInfo.safariDesktop) {
26
+ return [BASIC_IMAGE_WILDCARD];
27
+ }
28
+ // Other browsers allows to select HEIC images with more specific HEIC types only
29
+ // Mobile Safari will allow to select HEIC images even with simple image/* wildcard and it will convert them to JPEG by default (behaviour could be changed in file picker UI)
30
+ // Hope it will be fixed in the future so we'll add specific types so that Mobile Safari will know that we're supporting HEIC images
31
+ return [BASIC_IMAGE_WILDCARD, ...HEIC_IMAGE_MIME_LIST];
32
+ };
33
+
34
+ export const IMAGE_ACCEPT_LIST = calcImageAcceptList();
35
+
20
36
  /**
21
37
  * @param {string[]} [fileTypes]
22
38
  * @returns {string[]}
@@ -1 +1 @@
1
- {"version":3,"file":"getPluralForm.d.ts","sourceRoot":"","sources":["getPluralForm.js"],"names":[],"mappings":"AASO,sCAJI,MAAM,SACN,MAAM,GACJ,UAAU,CAKtB;yBAVa,KAAK,cAAc"}
1
+ {"version":3,"file":"getPluralForm.d.ts","sourceRoot":"","sources":["getPluralForm.js"],"names":[],"mappings":"AASO,sCAJI,MAAM,SACN,MAAM,GACJ,UAAU,CAKtB;yBAVa,IAAI,CAAC,cAAc"}
@@ -1,4 +1,4 @@
1
- export function isSecureTokenExpired(secureToken: import('../types').SecureUploadsSignatureAndExpire, { threshold }: {
1
+ export function isSecureTokenExpired(secureToken: import("../types").SecureUploadsSignatureAndExpire, { threshold }: {
2
2
  threshold?: number;
3
3
  }): boolean;
4
4
  //# sourceMappingURL=isSecureTokenExpired.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memoize.d.ts","sourceRoot":"","sources":["memoize.js"],"names":[],"mappings":"AASO,uHAaN"}
1
+ {"version":3,"file":"memoize.d.ts","sourceRoot":"","sources":["memoize.js"],"names":[],"mappings":"AASO,wBANc,KAAK,SAAZ,GAAG,EAAG,EACD,OAAO,kBACiB,CAAC,SAA/B,CAAE,GAAG,IAAI,EAAE,KAAK,KAAK,OAAQ,MAC/B,CAAC,GACC,CAAC,CAeb"}
@@ -4,5 +4,7 @@ export type GConstructor<T> = new (...args: any[]) => T;
4
4
  * are some dynamic generated properties or native overrides in the class. We're use it to define dynamic access
5
5
  * properties and events to subscribe to.
6
6
  */
7
- export type MixinClass<Base extends GConstructor<HTMLElement>, InstanceProperties extends Record<string, any> = {}> = (new (...args: ConstructorParameters<Base>) => InstanceProperties & InstanceType<Base>) & Omit<Base, "new">;
7
+ export type MixinClass<Base extends GConstructor<HTMLElement>, InstanceProperties extends Record<string, any> = {}> = {
8
+ new (...args: ConstructorParameters<Base>): InstanceProperties & InstanceType<Base>;
9
+ } & Omit<Base, "new">;
8
10
  //# sourceMappingURL=mixinClass.d.ts.map