@uploadcare/file-uploader 0.50.1-alpha.2

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 (631) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +165 -0
  3. package/abstract/ActivityBlock.d.ts +68 -0
  4. package/abstract/ActivityBlock.d.ts.map +1 -0
  5. package/abstract/ActivityBlock.js +207 -0
  6. package/abstract/Block.d.ts +99 -0
  7. package/abstract/Block.d.ts.map +1 -0
  8. package/abstract/Block.js +349 -0
  9. package/abstract/CTX.d.ts +31 -0
  10. package/abstract/CTX.d.ts.map +1 -0
  11. package/abstract/CTX.js +38 -0
  12. package/abstract/LocaleManager.d.ts +38 -0
  13. package/abstract/LocaleManager.d.ts.map +1 -0
  14. package/abstract/LocaleManager.js +127 -0
  15. package/abstract/SecureUploadsManager.d.ts +22 -0
  16. package/abstract/SecureUploadsManager.d.ts.map +1 -0
  17. package/abstract/SecureUploadsManager.js +87 -0
  18. package/abstract/SolutionBlock.d.ts +23 -0
  19. package/abstract/SolutionBlock.d.ts.map +1 -0
  20. package/abstract/SolutionBlock.js +23 -0
  21. package/abstract/TypedCollection.d.ts +127 -0
  22. package/abstract/TypedCollection.d.ts.map +1 -0
  23. package/abstract/TypedCollection.js +245 -0
  24. package/abstract/TypedData.d.ts +47 -0
  25. package/abstract/TypedData.d.ts.map +1 -0
  26. package/abstract/TypedData.js +77 -0
  27. package/abstract/UploaderBlock.d.ts +114 -0
  28. package/abstract/UploaderBlock.d.ts.map +1 -0
  29. package/abstract/UploaderBlock.js +444 -0
  30. package/abstract/UploaderPublicApi.d.ts +90 -0
  31. package/abstract/UploaderPublicApi.d.ts.map +1 -0
  32. package/abstract/UploaderPublicApi.js +316 -0
  33. package/abstract/ValidationManager.d.ts +31 -0
  34. package/abstract/ValidationManager.d.ts.map +1 -0
  35. package/abstract/ValidationManager.js +162 -0
  36. package/abstract/a11y.d.ts +20 -0
  37. package/abstract/a11y.d.ts.map +1 -0
  38. package/abstract/a11y.js +118 -0
  39. package/abstract/buildOutputCollectionState.d.ts +8 -0
  40. package/abstract/buildOutputCollectionState.d.ts.map +1 -0
  41. package/abstract/buildOutputCollectionState.js +136 -0
  42. package/abstract/connectBlocksFrom.d.ts +8 -0
  43. package/abstract/connectBlocksFrom.d.ts.map +1 -0
  44. package/abstract/connectBlocksFrom.js +34 -0
  45. package/abstract/l10nProcessor.d.ts +7 -0
  46. package/abstract/l10nProcessor.d.ts.map +1 -0
  47. package/abstract/l10nProcessor.js +80 -0
  48. package/abstract/localeRegistry.d.ts +5 -0
  49. package/abstract/localeRegistry.d.ts.map +1 -0
  50. package/abstract/localeRegistry.js +63 -0
  51. package/abstract/registerBlocks.d.ts +5 -0
  52. package/abstract/registerBlocks.d.ts.map +1 -0
  53. package/abstract/registerBlocks.js +31 -0
  54. package/abstract/sharedConfigKey.d.ts +2 -0
  55. package/abstract/sharedConfigKey.d.ts.map +1 -0
  56. package/abstract/sharedConfigKey.js +8 -0
  57. package/abstract/uploadEntrySchema.d.ts +64 -0
  58. package/abstract/uploadEntrySchema.d.ts.map +1 -0
  59. package/abstract/uploadEntrySchema.js +138 -0
  60. package/blocks/ActivityHeader/ActivityHeader.d.ts +4 -0
  61. package/blocks/ActivityHeader/ActivityHeader.d.ts.map +1 -0
  62. package/blocks/ActivityHeader/ActivityHeader.js +3 -0
  63. package/blocks/ActivityHeader/activity-header.css +14 -0
  64. package/blocks/CameraSource/CameraSource.d.ts +39 -0
  65. package/blocks/CameraSource/CameraSource.d.ts.map +1 -0
  66. package/blocks/CameraSource/CameraSource.js +253 -0
  67. package/blocks/CameraSource/camera-source.css +107 -0
  68. package/blocks/CloudImageEditor/index.css +1 -0
  69. package/blocks/CloudImageEditor/index.d.ts +2 -0
  70. package/blocks/CloudImageEditor/index.d.ts.map +1 -0
  71. package/blocks/CloudImageEditor/index.js +1 -0
  72. package/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts +58 -0
  73. package/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts.map +1 -0
  74. package/blocks/CloudImageEditor/src/CloudImageEditorBlock.js +228 -0
  75. package/blocks/CloudImageEditor/src/CropFrame.d.ts +146 -0
  76. package/blocks/CloudImageEditor/src/CropFrame.d.ts.map +1 -0
  77. package/blocks/CloudImageEditor/src/CropFrame.js +511 -0
  78. package/blocks/CloudImageEditor/src/EditorButtonControl.d.ts +10 -0
  79. package/blocks/CloudImageEditor/src/EditorButtonControl.d.ts.map +1 -0
  80. package/blocks/CloudImageEditor/src/EditorButtonControl.js +44 -0
  81. package/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts +6 -0
  82. package/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts.map +1 -0
  83. package/blocks/CloudImageEditor/src/EditorCropButtonControl.js +39 -0
  84. package/blocks/CloudImageEditor/src/EditorFilterControl.d.ts +18 -0
  85. package/blocks/CloudImageEditor/src/EditorFilterControl.d.ts.map +1 -0
  86. package/blocks/CloudImageEditor/src/EditorFilterControl.js +155 -0
  87. package/blocks/CloudImageEditor/src/EditorImageCropper.d.ts +106 -0
  88. package/blocks/CloudImageEditor/src/EditorImageCropper.d.ts.map +1 -0
  89. package/blocks/CloudImageEditor/src/EditorImageCropper.js +551 -0
  90. package/blocks/CloudImageEditor/src/EditorImageFader.d.ts +132 -0
  91. package/blocks/CloudImageEditor/src/EditorImageFader.d.ts.map +1 -0
  92. package/blocks/CloudImageEditor/src/EditorImageFader.js +454 -0
  93. package/blocks/CloudImageEditor/src/EditorOperationControl.d.ts +9 -0
  94. package/blocks/CloudImageEditor/src/EditorOperationControl.d.ts.map +1 -0
  95. package/blocks/CloudImageEditor/src/EditorOperationControl.js +39 -0
  96. package/blocks/CloudImageEditor/src/EditorScroller.d.ts +7 -0
  97. package/blocks/CloudImageEditor/src/EditorScroller.d.ts.map +1 -0
  98. package/blocks/CloudImageEditor/src/EditorScroller.js +33 -0
  99. package/blocks/CloudImageEditor/src/EditorSlider.d.ts +24 -0
  100. package/blocks/CloudImageEditor/src/EditorSlider.d.ts.map +1 -0
  101. package/blocks/CloudImageEditor/src/EditorSlider.js +118 -0
  102. package/blocks/CloudImageEditor/src/EditorToolbar.d.ts +104 -0
  103. package/blocks/CloudImageEditor/src/EditorToolbar.d.ts.map +1 -0
  104. package/blocks/CloudImageEditor/src/EditorToolbar.js +441 -0
  105. package/blocks/CloudImageEditor/src/crop-utils.d.ts +123 -0
  106. package/blocks/CloudImageEditor/src/crop-utils.d.ts.map +1 -0
  107. package/blocks/CloudImageEditor/src/crop-utils.js +729 -0
  108. package/blocks/CloudImageEditor/src/cropper-constants.d.ts +11 -0
  109. package/blocks/CloudImageEditor/src/cropper-constants.d.ts.map +1 -0
  110. package/blocks/CloudImageEditor/src/cropper-constants.js +11 -0
  111. package/blocks/CloudImageEditor/src/css/common.css +1157 -0
  112. package/blocks/CloudImageEditor/src/css/icons.css +12 -0
  113. package/blocks/CloudImageEditor/src/css/index.css +2 -0
  114. package/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts +20 -0
  115. package/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts.map +1 -0
  116. package/blocks/CloudImageEditor/src/elements/button/BtnUi.js +90 -0
  117. package/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts +11 -0
  118. package/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts.map +1 -0
  119. package/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.js +52 -0
  120. package/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts +17 -0
  121. package/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts.map +1 -0
  122. package/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.js +71 -0
  123. package/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts +16 -0
  124. package/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts.map +1 -0
  125. package/blocks/CloudImageEditor/src/elements/slider/SliderUi.js +178 -0
  126. package/blocks/CloudImageEditor/src/index.d.ts +15 -0
  127. package/blocks/CloudImageEditor/src/index.d.ts.map +1 -0
  128. package/blocks/CloudImageEditor/src/index.js +14 -0
  129. package/blocks/CloudImageEditor/src/lib/FocusVisible.d.ts +15 -0
  130. package/blocks/CloudImageEditor/src/lib/FocusVisible.d.ts.map +1 -0
  131. package/blocks/CloudImageEditor/src/lib/FocusVisible.js +33 -0
  132. package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.d.ts +10 -0
  133. package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.d.ts.map +1 -0
  134. package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.js +256 -0
  135. package/blocks/CloudImageEditor/src/lib/classNames.d.ts +3 -0
  136. package/blocks/CloudImageEditor/src/lib/classNames.d.ts.map +1 -0
  137. package/blocks/CloudImageEditor/src/lib/classNames.js +34 -0
  138. package/blocks/CloudImageEditor/src/lib/linspace.d.ts +8 -0
  139. package/blocks/CloudImageEditor/src/lib/linspace.d.ts.map +1 -0
  140. package/blocks/CloudImageEditor/src/lib/linspace.js +14 -0
  141. package/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts +2 -0
  142. package/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts.map +1 -0
  143. package/blocks/CloudImageEditor/src/lib/parseCropPreset.js +14 -0
  144. package/blocks/CloudImageEditor/src/lib/parseTabs.d.ts +2 -0
  145. package/blocks/CloudImageEditor/src/lib/parseTabs.d.ts.map +1 -0
  146. package/blocks/CloudImageEditor/src/lib/parseTabs.js +14 -0
  147. package/blocks/CloudImageEditor/src/lib/pick.d.ts +7 -0
  148. package/blocks/CloudImageEditor/src/lib/pick.d.ts.map +1 -0
  149. package/blocks/CloudImageEditor/src/lib/pick.js +15 -0
  150. package/blocks/CloudImageEditor/src/lib/preloadImage.d.ts +11 -0
  151. package/blocks/CloudImageEditor/src/lib/preloadImage.d.ts.map +1 -0
  152. package/blocks/CloudImageEditor/src/lib/preloadImage.js +38 -0
  153. package/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts +14 -0
  154. package/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts.map +1 -0
  155. package/blocks/CloudImageEditor/src/lib/transformationUtils.js +167 -0
  156. package/blocks/CloudImageEditor/src/state.d.ts +38 -0
  157. package/blocks/CloudImageEditor/src/state.d.ts.map +1 -0
  158. package/blocks/CloudImageEditor/src/state.js +92 -0
  159. package/blocks/CloudImageEditor/src/svg-sprite.d.ts +3 -0
  160. package/blocks/CloudImageEditor/src/svg-sprite.d.ts.map +1 -0
  161. package/blocks/CloudImageEditor/src/svg-sprite.js +1 -0
  162. package/blocks/CloudImageEditor/src/template.d.ts +2 -0
  163. package/blocks/CloudImageEditor/src/template.d.ts.map +1 -0
  164. package/blocks/CloudImageEditor/src/template.js +36 -0
  165. package/blocks/CloudImageEditor/src/toolbar-constants.d.ts +58 -0
  166. package/blocks/CloudImageEditor/src/toolbar-constants.d.ts.map +1 -0
  167. package/blocks/CloudImageEditor/src/toolbar-constants.js +114 -0
  168. package/blocks/CloudImageEditor/src/types.d.ts +58 -0
  169. package/blocks/CloudImageEditor/src/types.d.ts.map +1 -0
  170. package/blocks/CloudImageEditor/src/types.js +61 -0
  171. package/blocks/CloudImageEditor/src/util.d.ts +2 -0
  172. package/blocks/CloudImageEditor/src/util.d.ts.map +1 -0
  173. package/blocks/CloudImageEditor/src/util.js +19 -0
  174. package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts +31 -0
  175. package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts.map +1 -0
  176. package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.js +113 -0
  177. package/blocks/CloudImageEditorActivity/index.css +13 -0
  178. package/blocks/CloudImageEditorActivity/test.d.ts +2 -0
  179. package/blocks/CloudImageEditorActivity/test.d.ts.map +1 -0
  180. package/blocks/CloudImageEditorActivity/test.js +9 -0
  181. package/blocks/Config/Config.d.ts +67 -0
  182. package/blocks/Config/Config.d.ts.map +1 -0
  183. package/blocks/Config/Config.js +246 -0
  184. package/blocks/Config/config.css +3 -0
  185. package/blocks/Config/initialConfig.d.ts +6 -0
  186. package/blocks/Config/initialConfig.d.ts.map +1 -0
  187. package/blocks/Config/initialConfig.js +69 -0
  188. package/blocks/Config/normalizeConfigValue.d.ts +3 -0
  189. package/blocks/Config/normalizeConfigValue.d.ts.map +1 -0
  190. package/blocks/Config/normalizeConfigValue.js +177 -0
  191. package/blocks/Copyright/Copyright.d.ts +4 -0
  192. package/blocks/Copyright/Copyright.d.ts.map +1 -0
  193. package/blocks/Copyright/Copyright.js +24 -0
  194. package/blocks/Copyright/copyright.css +31 -0
  195. package/blocks/DropArea/DropArea.d.ts +49 -0
  196. package/blocks/DropArea/DropArea.d.ts.map +1 -0
  197. package/blocks/DropArea/DropArea.js +273 -0
  198. package/blocks/DropArea/addDropzone.d.ts +21 -0
  199. package/blocks/DropArea/addDropzone.d.ts.map +1 -0
  200. package/blocks/DropArea/addDropzone.js +137 -0
  201. package/blocks/DropArea/drop-area.css +188 -0
  202. package/blocks/DropArea/getDropItems.d.ts +16 -0
  203. package/blocks/DropArea/getDropItems.d.ts.map +1 -0
  204. package/blocks/DropArea/getDropItems.js +167 -0
  205. package/blocks/ExternalSource/ExternalSource.d.ts +98 -0
  206. package/blocks/ExternalSource/ExternalSource.d.ts.map +1 -0
  207. package/blocks/ExternalSource/ExternalSource.js +268 -0
  208. package/blocks/ExternalSource/buildStyles.d.ts +27 -0
  209. package/blocks/ExternalSource/buildStyles.d.ts.map +1 -0
  210. package/blocks/ExternalSource/buildStyles.js +133 -0
  211. package/blocks/ExternalSource/external-source.css +65 -0
  212. package/blocks/ExternalSource/messages.d.ts +3 -0
  213. package/blocks/ExternalSource/messages.d.ts.map +1 -0
  214. package/blocks/ExternalSource/messages.js +35 -0
  215. package/blocks/ExternalSource/query-string.d.ts +8 -0
  216. package/blocks/ExternalSource/query-string.d.ts.map +1 -0
  217. package/blocks/ExternalSource/query-string.js +14 -0
  218. package/blocks/FileItem/FileItem.d.ts +97 -0
  219. package/blocks/FileItem/FileItem.d.ts.map +1 -0
  220. package/blocks/FileItem/FileItem.js +460 -0
  221. package/blocks/FileItem/file-item.css +140 -0
  222. package/blocks/FormInput/FormInput.d.ts +7 -0
  223. package/blocks/FormInput/FormInput.d.ts.map +1 -0
  224. package/blocks/FormInput/FormInput.js +92 -0
  225. package/blocks/Icon/Icon.d.ts +12 -0
  226. package/blocks/Icon/Icon.d.ts.map +1 -0
  227. package/blocks/Icon/Icon.js +44 -0
  228. package/blocks/Icon/icon.css +12 -0
  229. package/blocks/Img/Img.d.ts +4 -0
  230. package/blocks/Img/Img.d.ts.map +1 -0
  231. package/blocks/Img/Img.js +21 -0
  232. package/blocks/Img/ImgBase.d.ts +80 -0
  233. package/blocks/Img/ImgBase.d.ts.map +1 -0
  234. package/blocks/Img/ImgBase.js +408 -0
  235. package/blocks/Img/ImgConfig.d.ts +31 -0
  236. package/blocks/Img/ImgConfig.d.ts.map +1 -0
  237. package/blocks/Img/ImgConfig.js +102 -0
  238. package/blocks/Img/configurations.d.ts +12 -0
  239. package/blocks/Img/configurations.d.ts.map +1 -0
  240. package/blocks/Img/configurations.js +14 -0
  241. package/blocks/Img/props-map.d.ts +29 -0
  242. package/blocks/Img/props-map.d.ts.map +1 -0
  243. package/blocks/Img/props-map.js +34 -0
  244. package/blocks/Img/test.css +16 -0
  245. package/blocks/Img/utils/parseObjectToString.d.ts +2 -0
  246. package/blocks/Img/utils/parseObjectToString.d.ts.map +1 -0
  247. package/blocks/Img/utils/parseObjectToString.js +13 -0
  248. package/blocks/Modal/Modal.d.ts +24 -0
  249. package/blocks/Modal/Modal.d.ts.map +1 -0
  250. package/blocks/Modal/Modal.js +116 -0
  251. package/blocks/Modal/modal.css +92 -0
  252. package/blocks/ProgressBar/ProgressBar.d.ts +10 -0
  253. package/blocks/ProgressBar/ProgressBar.d.ts.map +1 -0
  254. package/blocks/ProgressBar/ProgressBar.js +38 -0
  255. package/blocks/ProgressBar/progress-bar.css +25 -0
  256. package/blocks/ProgressBarCommon/ProgressBarCommon.d.ts +8 -0
  257. package/blocks/ProgressBarCommon/ProgressBarCommon.d.ts.map +1 -0
  258. package/blocks/ProgressBarCommon/ProgressBarCommon.js +44 -0
  259. package/blocks/ProgressBarCommon/progress-bar-common.css +16 -0
  260. package/blocks/Range/Range.d.ts +16 -0
  261. package/blocks/Range/Range.d.ts.map +1 -0
  262. package/blocks/Range/Range.js +44 -0
  263. package/blocks/Range/range.css +65 -0
  264. package/blocks/Select/Select.d.ts +9 -0
  265. package/blocks/Select/Select.d.ts.map +1 -0
  266. package/blocks/Select/Select.js +35 -0
  267. package/blocks/Select/select.css +22 -0
  268. package/blocks/SimpleBtn/SimpleBtn.d.ts +26 -0
  269. package/blocks/SimpleBtn/SimpleBtn.d.ts.map +1 -0
  270. package/blocks/SimpleBtn/SimpleBtn.js +54 -0
  271. package/blocks/SimpleBtn/simple-btn.css +64 -0
  272. package/blocks/SourceBtn/SourceBtn.d.ts +58 -0
  273. package/blocks/SourceBtn/SourceBtn.d.ts.map +1 -0
  274. package/blocks/SourceBtn/SourceBtn.js +145 -0
  275. package/blocks/SourceBtn/source-btn.css +45 -0
  276. package/blocks/SourceList/SourceList.d.ts +4 -0
  277. package/blocks/SourceList/SourceList.d.ts.map +1 -0
  278. package/blocks/SourceList/SourceList.js +20 -0
  279. package/blocks/StartFrom/StartFrom.d.ts +7 -0
  280. package/blocks/StartFrom/StartFrom.d.ts.map +1 -0
  281. package/blocks/StartFrom/StartFrom.js +14 -0
  282. package/blocks/StartFrom/start-from.css +32 -0
  283. package/blocks/UploadCtxProvider/EventEmitter.d.ts +107 -0
  284. package/blocks/UploadCtxProvider/EventEmitter.d.ts.map +1 -0
  285. package/blocks/UploadCtxProvider/EventEmitter.js +132 -0
  286. package/blocks/UploadCtxProvider/UploadCtxProvider.d.ts +35 -0
  287. package/blocks/UploadCtxProvider/UploadCtxProvider.d.ts.map +1 -0
  288. package/blocks/UploadCtxProvider/UploadCtxProvider.js +45 -0
  289. package/blocks/UploadList/UploadList.d.ts +59 -0
  290. package/blocks/UploadList/UploadList.d.ts.map +1 -0
  291. package/blocks/UploadList/UploadList.js +237 -0
  292. package/blocks/UploadList/upload-list.css +74 -0
  293. package/blocks/UrlSource/UrlSource.d.ts +9 -0
  294. package/blocks/UrlSource/UrlSource.d.ts.map +1 -0
  295. package/blocks/UrlSource/UrlSource.js +61 -0
  296. package/blocks/UrlSource/url-source.css +24 -0
  297. package/blocks/svg-backgrounds/svg-backgrounds.d.ts +17 -0
  298. package/blocks/svg-backgrounds/svg-backgrounds.d.ts.map +1 -0
  299. package/blocks/svg-backgrounds/svg-backgrounds.js +45 -0
  300. package/blocks/themes/uc-basic/common.css +116 -0
  301. package/blocks/themes/uc-basic/config.css +4 -0
  302. package/blocks/themes/uc-basic/index.css +32 -0
  303. package/blocks/themes/uc-basic/svg-sprite.d.ts +3 -0
  304. package/blocks/themes/uc-basic/svg-sprite.d.ts.map +1 -0
  305. package/blocks/themes/uc-basic/svg-sprite.js +1 -0
  306. package/blocks/themes/uc-basic/theme.css +232 -0
  307. package/blocks/utils/UploadSource.d.ts +9 -0
  308. package/blocks/utils/UploadSource.d.ts.map +1 -0
  309. package/blocks/utils/UploadSource.js +8 -0
  310. package/blocks/utils/abilities.d.ts +2 -0
  311. package/blocks/utils/abilities.d.ts.map +1 -0
  312. package/blocks/utils/abilities.js +3 -0
  313. package/blocks/utils/comma-separated.d.ts +3 -0
  314. package/blocks/utils/comma-separated.d.ts.map +1 -0
  315. package/blocks/utils/comma-separated.js +19 -0
  316. package/blocks/utils/debounce.d.ts +10 -0
  317. package/blocks/utils/debounce.d.ts.map +1 -0
  318. package/blocks/utils/debounce.js +22 -0
  319. package/blocks/utils/resizeImage.d.ts +6 -0
  320. package/blocks/utils/resizeImage.d.ts.map +1 -0
  321. package/blocks/utils/resizeImage.js +40 -0
  322. package/blocks/utils/throttle.d.ts +4 -0
  323. package/blocks/utils/throttle.d.ts.map +1 -0
  324. package/blocks/utils/throttle.js +45 -0
  325. package/blocks/utils/userAgent.d.ts +6 -0
  326. package/blocks/utils/userAgent.d.ts.map +1 -0
  327. package/blocks/utils/userAgent.js +14 -0
  328. package/env.d.ts +4 -0
  329. package/env.d.ts.map +1 -0
  330. package/env.js +3 -0
  331. package/index.d.ts +39 -0
  332. package/index.d.ts.map +1 -0
  333. package/index.js +51 -0
  334. package/index.ssr.d.ts +961 -0
  335. package/index.ssr.d.ts.map +1 -0
  336. package/index.ssr.js +1461 -0
  337. package/locales/file-uploader/ar.d.ts +114 -0
  338. package/locales/file-uploader/ar.d.ts.map +1 -0
  339. package/locales/file-uploader/ar.js +113 -0
  340. package/locales/file-uploader/az.d.ts +106 -0
  341. package/locales/file-uploader/az.d.ts.map +1 -0
  342. package/locales/file-uploader/az.js +105 -0
  343. package/locales/file-uploader/ca.d.ts +108 -0
  344. package/locales/file-uploader/ca.d.ts.map +1 -0
  345. package/locales/file-uploader/ca.js +108 -0
  346. package/locales/file-uploader/cs.d.ts +110 -0
  347. package/locales/file-uploader/cs.d.ts.map +1 -0
  348. package/locales/file-uploader/cs.js +110 -0
  349. package/locales/file-uploader/da.d.ts +106 -0
  350. package/locales/file-uploader/da.d.ts.map +1 -0
  351. package/locales/file-uploader/da.js +106 -0
  352. package/locales/file-uploader/de.d.ts +106 -0
  353. package/locales/file-uploader/de.d.ts.map +1 -0
  354. package/locales/file-uploader/de.js +107 -0
  355. package/locales/file-uploader/el.d.ts +106 -0
  356. package/locales/file-uploader/el.d.ts.map +1 -0
  357. package/locales/file-uploader/el.js +107 -0
  358. package/locales/file-uploader/en.d.ts +106 -0
  359. package/locales/file-uploader/en.d.ts.map +1 -0
  360. package/locales/file-uploader/en.js +105 -0
  361. package/locales/file-uploader/es.d.ts +108 -0
  362. package/locales/file-uploader/es.d.ts.map +1 -0
  363. package/locales/file-uploader/es.js +108 -0
  364. package/locales/file-uploader/et.d.ts +106 -0
  365. package/locales/file-uploader/et.d.ts.map +1 -0
  366. package/locales/file-uploader/et.js +105 -0
  367. package/locales/file-uploader/fr.d.ts +108 -0
  368. package/locales/file-uploader/fr.d.ts.map +1 -0
  369. package/locales/file-uploader/fr.js +108 -0
  370. package/locales/file-uploader/he.d.ts +108 -0
  371. package/locales/file-uploader/he.d.ts.map +1 -0
  372. package/locales/file-uploader/he.js +107 -0
  373. package/locales/file-uploader/hy.d.ts +106 -0
  374. package/locales/file-uploader/hy.d.ts.map +1 -0
  375. package/locales/file-uploader/hy.js +105 -0
  376. package/locales/file-uploader/is.d.ts +106 -0
  377. package/locales/file-uploader/is.d.ts.map +1 -0
  378. package/locales/file-uploader/is.js +105 -0
  379. package/locales/file-uploader/it.d.ts +108 -0
  380. package/locales/file-uploader/it.d.ts.map +1 -0
  381. package/locales/file-uploader/it.js +108 -0
  382. package/locales/file-uploader/ja.d.ts +106 -0
  383. package/locales/file-uploader/ja.d.ts.map +1 -0
  384. package/locales/file-uploader/ja.js +105 -0
  385. package/locales/file-uploader/ka.d.ts +106 -0
  386. package/locales/file-uploader/ka.d.ts.map +1 -0
  387. package/locales/file-uploader/ka.js +105 -0
  388. package/locales/file-uploader/kk.d.ts +106 -0
  389. package/locales/file-uploader/kk.d.ts.map +1 -0
  390. package/locales/file-uploader/kk.js +105 -0
  391. package/locales/file-uploader/ko.d.ts +106 -0
  392. package/locales/file-uploader/ko.d.ts.map +1 -0
  393. package/locales/file-uploader/ko.js +104 -0
  394. package/locales/file-uploader/lv.d.ts +108 -0
  395. package/locales/file-uploader/lv.d.ts.map +1 -0
  396. package/locales/file-uploader/lv.js +107 -0
  397. package/locales/file-uploader/nb.d.ts +106 -0
  398. package/locales/file-uploader/nb.d.ts.map +1 -0
  399. package/locales/file-uploader/nb.js +105 -0
  400. package/locales/file-uploader/nl.d.ts +106 -0
  401. package/locales/file-uploader/nl.d.ts.map +1 -0
  402. package/locales/file-uploader/nl.js +106 -0
  403. package/locales/file-uploader/pl.d.ts +110 -0
  404. package/locales/file-uploader/pl.d.ts.map +1 -0
  405. package/locales/file-uploader/pl.js +109 -0
  406. package/locales/file-uploader/pt.d.ts +108 -0
  407. package/locales/file-uploader/pt.d.ts.map +1 -0
  408. package/locales/file-uploader/pt.js +108 -0
  409. package/locales/file-uploader/ro.d.ts +108 -0
  410. package/locales/file-uploader/ro.d.ts.map +1 -0
  411. package/locales/file-uploader/ro.js +108 -0
  412. package/locales/file-uploader/ru.d.ts +110 -0
  413. package/locales/file-uploader/ru.d.ts.map +1 -0
  414. package/locales/file-uploader/ru.js +109 -0
  415. package/locales/file-uploader/sk.d.ts +110 -0
  416. package/locales/file-uploader/sk.d.ts.map +1 -0
  417. package/locales/file-uploader/sk.js +109 -0
  418. package/locales/file-uploader/sr.d.ts +108 -0
  419. package/locales/file-uploader/sr.d.ts.map +1 -0
  420. package/locales/file-uploader/sr.js +107 -0
  421. package/locales/file-uploader/sv.d.ts +106 -0
  422. package/locales/file-uploader/sv.d.ts.map +1 -0
  423. package/locales/file-uploader/sv.js +105 -0
  424. package/locales/file-uploader/tr.d.ts +106 -0
  425. package/locales/file-uploader/tr.d.ts.map +1 -0
  426. package/locales/file-uploader/tr.js +105 -0
  427. package/locales/file-uploader/uk.d.ts +110 -0
  428. package/locales/file-uploader/uk.d.ts.map +1 -0
  429. package/locales/file-uploader/uk.js +109 -0
  430. package/locales/file-uploader/vi.d.ts +106 -0
  431. package/locales/file-uploader/vi.d.ts.map +1 -0
  432. package/locales/file-uploader/vi.js +105 -0
  433. package/locales/file-uploader/zh-TW.d.ts +106 -0
  434. package/locales/file-uploader/zh-TW.d.ts.map +1 -0
  435. package/locales/file-uploader/zh-TW.js +105 -0
  436. package/locales/file-uploader/zh.d.ts +106 -0
  437. package/locales/file-uploader/zh.d.ts.map +1 -0
  438. package/locales/file-uploader/zh.js +105 -0
  439. package/package.json +142 -0
  440. package/solutions/adaptive-image/index.d.ts +3 -0
  441. package/solutions/adaptive-image/index.d.ts.map +1 -0
  442. package/solutions/adaptive-image/index.js +5 -0
  443. package/solutions/cloud-image-editor/CloudImageEditor.d.ts +4 -0
  444. package/solutions/cloud-image-editor/CloudImageEditor.d.ts.map +1 -0
  445. package/solutions/cloud-image-editor/CloudImageEditor.js +12 -0
  446. package/solutions/cloud-image-editor/index.css +2 -0
  447. package/solutions/cloud-image-editor/index.d.ts +6 -0
  448. package/solutions/cloud-image-editor/index.d.ts.map +1 -0
  449. package/solutions/cloud-image-editor/index.js +11 -0
  450. package/solutions/file-uploader/inline/FileUploaderInline.d.ts +27 -0
  451. package/solutions/file-uploader/inline/FileUploaderInline.d.ts.map +1 -0
  452. package/solutions/file-uploader/inline/FileUploaderInline.js +75 -0
  453. package/solutions/file-uploader/inline/index.css +54 -0
  454. package/solutions/file-uploader/inline/index.d.ts +2 -0
  455. package/solutions/file-uploader/inline/index.d.ts.map +1 -0
  456. package/solutions/file-uploader/inline/index.js +1 -0
  457. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +7 -0
  458. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -0
  459. package/solutions/file-uploader/minimal/FileUploaderMinimal.js +46 -0
  460. package/solutions/file-uploader/minimal/index.css +137 -0
  461. package/solutions/file-uploader/minimal/index.d.ts +14 -0
  462. package/solutions/file-uploader/minimal/index.d.ts.map +1 -0
  463. package/solutions/file-uploader/minimal/index.js +13 -0
  464. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +26 -0
  465. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +1 -0
  466. package/solutions/file-uploader/regular/FileUploaderRegular.js +66 -0
  467. package/solutions/file-uploader/regular/index.css +1 -0
  468. package/solutions/file-uploader/regular/index.d.ts +2 -0
  469. package/solutions/file-uploader/regular/index.d.ts.map +1 -0
  470. package/solutions/file-uploader/regular/index.js +1 -0
  471. package/types/events.d.ts +5 -0
  472. package/types/events.js +1 -0
  473. package/types/exported.d.ts +295 -0
  474. package/types/exported.js +1 -0
  475. package/types/global.d.ts +8 -0
  476. package/types/https.d.ts +1 -0
  477. package/types/index.d.ts +2 -0
  478. package/types/index.js +3 -0
  479. package/types/jsx.d.ts +63 -0
  480. package/types/jsx.js +1 -0
  481. package/utils/WindowHeightTracker.d.ts +24 -0
  482. package/utils/WindowHeightTracker.d.ts.map +1 -0
  483. package/utils/WindowHeightTracker.js +51 -0
  484. package/utils/cdn-utils.d.ts +59 -0
  485. package/utils/cdn-utils.d.ts.map +1 -0
  486. package/utils/cdn-utils.js +201 -0
  487. package/utils/cdn-utils.test.d.ts +2 -0
  488. package/utils/cdn-utils.test.d.ts.map +1 -0
  489. package/utils/cdn-utils.test.js +227 -0
  490. package/utils/delay.d.ts +2 -0
  491. package/utils/delay.d.ts.map +1 -0
  492. package/utils/delay.js +4 -0
  493. package/utils/fileTypes.d.ts +8 -0
  494. package/utils/fileTypes.d.ts.map +1 -0
  495. package/utils/fileTypes.js +95 -0
  496. package/utils/fileTypes.test.d.ts +2 -0
  497. package/utils/fileTypes.test.d.ts.map +1 -0
  498. package/utils/fileTypes.test.js +89 -0
  499. package/utils/getLocaleDirection.d.ts +2 -0
  500. package/utils/getLocaleDirection.d.ts.map +1 -0
  501. package/utils/getLocaleDirection.js +18 -0
  502. package/utils/getPluralForm.d.ts +3 -0
  503. package/utils/getPluralForm.d.ts.map +1 -0
  504. package/utils/getPluralForm.js +13 -0
  505. package/utils/getPluralForm.test.d.ts +2 -0
  506. package/utils/getPluralForm.test.d.ts.map +1 -0
  507. package/utils/getPluralForm.test.js +16 -0
  508. package/utils/ifRef.d.ts +7 -0
  509. package/utils/ifRef.d.ts.map +1 -0
  510. package/utils/ifRef.js +9 -0
  511. package/utils/isSecureTokenExpired.d.ts +4 -0
  512. package/utils/isSecureTokenExpired.d.ts.map +1 -0
  513. package/utils/isSecureTokenExpired.js +17 -0
  514. package/utils/isSecureTokenExpired.test.d.ts +2 -0
  515. package/utils/isSecureTokenExpired.test.d.ts.map +1 -0
  516. package/utils/isSecureTokenExpired.test.js +33 -0
  517. package/utils/memoize.d.ts +2 -0
  518. package/utils/memoize.d.ts.map +1 -0
  519. package/utils/memoize.js +23 -0
  520. package/utils/memoize.test.d.ts +2 -0
  521. package/utils/memoize.test.d.ts.map +1 -0
  522. package/utils/memoize.test.js +38 -0
  523. package/utils/mixinClass.d.ts +8 -0
  524. package/utils/mixinClass.d.ts.map +1 -0
  525. package/utils/mixinClass.js +18 -0
  526. package/utils/parseCdnUrl.d.ts +9 -0
  527. package/utils/parseCdnUrl.d.ts.map +1 -0
  528. package/utils/parseCdnUrl.js +20 -0
  529. package/utils/parseCdnUrl.test.d.ts +2 -0
  530. package/utils/parseCdnUrl.test.d.ts.map +1 -0
  531. package/utils/parseCdnUrl.test.js +78 -0
  532. package/utils/parseShrink.d.ts +5 -0
  533. package/utils/parseShrink.d.ts.map +1 -0
  534. package/utils/parseShrink.js +34 -0
  535. package/utils/parseShrink.test.d.ts +2 -0
  536. package/utils/parseShrink.test.d.ts.map +1 -0
  537. package/utils/parseShrink.test.js +26 -0
  538. package/utils/prettyBytes.d.ts +11 -0
  539. package/utils/prettyBytes.d.ts.map +1 -0
  540. package/utils/prettyBytes.js +64 -0
  541. package/utils/prettyBytes.test.d.ts +2 -0
  542. package/utils/prettyBytes.test.d.ts.map +1 -0
  543. package/utils/prettyBytes.test.js +99 -0
  544. package/utils/stringToArray.d.ts +2 -0
  545. package/utils/stringToArray.d.ts.map +1 -0
  546. package/utils/stringToArray.js +11 -0
  547. package/utils/stringToArray.test.d.ts +2 -0
  548. package/utils/stringToArray.test.d.ts.map +1 -0
  549. package/utils/stringToArray.test.js +20 -0
  550. package/utils/template-utils.d.ts +40 -0
  551. package/utils/template-utils.d.ts.map +1 -0
  552. package/utils/template-utils.js +50 -0
  553. package/utils/template-utils.test.d.ts +2 -0
  554. package/utils/template-utils.test.d.ts.map +1 -0
  555. package/utils/template-utils.test.js +56 -0
  556. package/utils/toKebabCase.d.ts +3 -0
  557. package/utils/toKebabCase.d.ts.map +1 -0
  558. package/utils/toKebabCase.js +15 -0
  559. package/utils/toKebabCase.test.d.ts +2 -0
  560. package/utils/toKebabCase.test.d.ts.map +1 -0
  561. package/utils/toKebabCase.test.js +11 -0
  562. package/utils/transparentPixelSrc.d.ts +2 -0
  563. package/utils/transparentPixelSrc.d.ts.map +1 -0
  564. package/utils/transparentPixelSrc.js +2 -0
  565. package/utils/uniqueArray.d.ts +2 -0
  566. package/utils/uniqueArray.d.ts.map +1 -0
  567. package/utils/uniqueArray.js +8 -0
  568. package/utils/uniqueArray.test.d.ts +2 -0
  569. package/utils/uniqueArray.test.d.ts.map +1 -0
  570. package/utils/uniqueArray.test.js +8 -0
  571. package/utils/validators/collection/index.d.ts +3 -0
  572. package/utils/validators/collection/index.d.ts.map +1 -0
  573. package/utils/validators/collection/index.js +2 -0
  574. package/utils/validators/collection/validateCollectionUploadError.d.ts +3 -0
  575. package/utils/validators/collection/validateCollectionUploadError.d.ts.map +1 -0
  576. package/utils/validators/collection/validateCollectionUploadError.js +11 -0
  577. package/utils/validators/collection/validateMultiple.d.ts +3 -0
  578. package/utils/validators/collection/validateMultiple.d.ts.map +1 -0
  579. package/utils/validators/collection/validateMultiple.js +43 -0
  580. package/utils/validators/file/index.d.ts +5 -0
  581. package/utils/validators/file/index.d.ts.map +1 -0
  582. package/utils/validators/file/index.js +4 -0
  583. package/utils/validators/file/validateFileType.d.ts +3 -0
  584. package/utils/validators/file/validateFileType.d.ts.map +1 -0
  585. package/utils/validators/file/validateFileType.js +30 -0
  586. package/utils/validators/file/validateIsImage.d.ts +3 -0
  587. package/utils/validators/file/validateIsImage.d.ts.map +1 -0
  588. package/utils/validators/file/validateIsImage.js +25 -0
  589. package/utils/validators/file/validateMaxSizeLimit.d.ts +3 -0
  590. package/utils/validators/file/validateMaxSizeLimit.d.ts.map +1 -0
  591. package/utils/validators/file/validateMaxSizeLimit.js +15 -0
  592. package/utils/validators/file/validateUploadError.d.ts +3 -0
  593. package/utils/validators/file/validateUploadError.d.ts.map +1 -0
  594. package/utils/validators/file/validateUploadError.js +48 -0
  595. package/utils/waitForAttribute.d.ts +8 -0
  596. package/utils/waitForAttribute.d.ts.map +1 -0
  597. package/utils/waitForAttribute.js +43 -0
  598. package/utils/waitForAttribute.test.d.ts +2 -0
  599. package/utils/waitForAttribute.test.d.ts.map +1 -0
  600. package/utils/waitForAttribute.test.js +78 -0
  601. package/utils/warnOnce.d.ts +3 -0
  602. package/utils/warnOnce.d.ts.map +1 -0
  603. package/utils/warnOnce.js +11 -0
  604. package/utils/wildcardRegexp.d.ts +2 -0
  605. package/utils/wildcardRegexp.d.ts.map +1 -0
  606. package/utils/wildcardRegexp.js +17 -0
  607. package/utils/wildcardRegexp.test.d.ts +2 -0
  608. package/utils/wildcardRegexp.test.d.ts.map +1 -0
  609. package/utils/wildcardRegexp.test.js +19 -0
  610. package/web/blocks.iife.min.js +29 -0
  611. package/web/blocks.min.js +29 -0
  612. package/web/lr-basic.min.css +1 -0
  613. package/web/lr-cloud-image-editor.min.css +1 -0
  614. package/web/lr-cloud-image-editor.min.js +29 -0
  615. package/web/lr-file-uploader-inline.min.css +1 -0
  616. package/web/lr-file-uploader-inline.min.js +29 -0
  617. package/web/lr-file-uploader-minimal.min.css +1 -0
  618. package/web/lr-file-uploader-minimal.min.js +28 -0
  619. package/web/lr-file-uploader-regular.min.css +1 -0
  620. package/web/lr-file-uploader-regular.min.js +29 -0
  621. package/web/lr-img.min.js +28 -0
  622. package/web/uc-basic.min.css +1 -0
  623. package/web/uc-cloud-image-editor.min.css +1 -0
  624. package/web/uc-cloud-image-editor.min.js +29 -0
  625. package/web/uc-file-uploader-inline.min.css +1 -0
  626. package/web/uc-file-uploader-inline.min.js +29 -0
  627. package/web/uc-file-uploader-minimal.min.css +1 -0
  628. package/web/uc-file-uploader-minimal.min.js +28 -0
  629. package/web/uc-file-uploader-regular.min.css +1 -0
  630. package/web/uc-file-uploader-regular.min.js +29 -0
  631. package/web/uc-img.min.js +28 -0
@@ -0,0 +1,95 @@
1
+ // @ts-check
2
+ import { stringToArray } from './stringToArray.js';
3
+
4
+ export const IMAGE_ACCEPT_LIST = [
5
+ 'image/*',
6
+ 'image/heif',
7
+ 'image/heif-sequence',
8
+ 'image/heic',
9
+ 'image/heic-sequence',
10
+ 'image/avif',
11
+ 'image/avif-sequence',
12
+ '.heif',
13
+ '.heifs',
14
+ '.heic',
15
+ '.heics',
16
+ '.avif',
17
+ '.avifs',
18
+ ];
19
+
20
+ /**
21
+ * @param {string[]} [fileTypes]
22
+ * @returns {string[]}
23
+ */
24
+ export const mergeFileTypes = (fileTypes) => {
25
+ if (!fileTypes) {
26
+ return [];
27
+ }
28
+ return fileTypes
29
+ .filter((item) => typeof item === 'string')
30
+ .map((str) => stringToArray(str))
31
+ .flat();
32
+ };
33
+
34
+ /**
35
+ * @param {String} mimeType
36
+ * @param {String[]} allowedFileTypes
37
+ * @returns {Boolean}
38
+ */
39
+ export const matchMimeType = (mimeType, allowedFileTypes) => {
40
+ return allowedFileTypes.some((type) => {
41
+ if (type.endsWith('*')) {
42
+ type = type.replace('*', '');
43
+ return mimeType.startsWith(type);
44
+ }
45
+
46
+ return mimeType === type;
47
+ });
48
+ };
49
+
50
+ /**
51
+ * @param {String} fileName
52
+ * @param {String[]} allowedFileTypes
53
+ * @returns {Boolean}
54
+ */
55
+ export const matchExtension = (fileName, allowedFileTypes) => {
56
+ return allowedFileTypes.some((type) => {
57
+ if (!type.startsWith('.')) {
58
+ return false;
59
+ }
60
+
61
+ return fileName.toLowerCase().endsWith(type.toLowerCase());
62
+ });
63
+ };
64
+
65
+ /**
66
+ * @param {File | Blob} file
67
+ * @returns {Boolean}
68
+ */
69
+ export const fileIsImage = (file) => {
70
+ let type = file?.type;
71
+ if (!type) {
72
+ return false;
73
+ }
74
+ return matchMimeType(type, IMAGE_ACCEPT_LIST);
75
+ };
76
+
77
+ /**
78
+ * Checks if the given data is a Blob.
79
+ *
80
+ * @param {unknown} data - The data to check.
81
+ * @returns {boolean} - True if the data is a Blob, false otherwise.
82
+ */
83
+ export const isBlob = (data) => {
84
+ return typeof Blob !== 'undefined' && data instanceof Blob;
85
+ };
86
+
87
+ /**
88
+ * Checks if the given data is a File.
89
+ *
90
+ * @param {unknown} data - The data to check.
91
+ * @returns {boolean} - True if the data is a File, false otherwise.
92
+ */
93
+ export const isFile = (data) => {
94
+ return typeof File !== 'undefined' && data instanceof File;
95
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=fileTypes.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileTypes.test.d.ts","sourceRoot":"","sources":["fileTypes.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,89 @@
1
+ import { expect } from '@esm-bundle/chai';
2
+ import { mergeFileTypes, matchMimeType, fileIsImage, matchExtension, isBlob, isFile } from './fileTypes';
3
+
4
+ describe('mergeFileTypes', () => {
5
+ it('should join input strings with comma', () => {
6
+ expect(mergeFileTypes(['text/html,text/plain', 'image/*,image/heic', 'text/markdown'])).to.eql([
7
+ 'text/html',
8
+ 'text/plain',
9
+ 'image/*',
10
+ 'image/heic',
11
+ 'text/markdown',
12
+ ]);
13
+ });
14
+
15
+ it('should skip empty values', () => {
16
+ expect(mergeFileTypes()).to.eql([]);
17
+ expect(mergeFileTypes(['text/html', '', undefined, 'text/plain'])).to.eql(['text/html', 'text/plain']);
18
+ });
19
+
20
+ it('should trim values', () => {
21
+ expect(mergeFileTypes([' text/html , text/plain ', ' image/*, image/heic ', ' text/markdown '])).to.eql([
22
+ 'text/html',
23
+ 'text/plain',
24
+ 'image/*',
25
+ 'image/heic',
26
+ 'text/markdown',
27
+ ]);
28
+ });
29
+ });
30
+
31
+ describe('matchMimeType', () => {
32
+ it('should return true if file type is exactly matched', () => {
33
+ expect(matchMimeType('image/jpeg', ['image/jpeg'])).to.be.true;
34
+ });
35
+ it('should return true if file type is wildcard matched', () => {
36
+ expect(matchMimeType('image/jpeg', ['image/*'])).to.be.true;
37
+ });
38
+ it('should return false if file type is not matched', () => {
39
+ expect(matchMimeType('text/plain', ['image/*'])).to.be.false;
40
+ });
41
+ });
42
+
43
+ describe('matchExtension', () => {
44
+ it('should return true if file extension is exactly matched', () => {
45
+ expect(matchExtension('image.jpeg', ['.jpeg'])).to.be.true;
46
+ expect(matchExtension('image.avif', ['.avif'])).to.be.true;
47
+ });
48
+ it('should return false if file extension is not matched', () => {
49
+ expect(matchExtension('image.jpeg', ['.png'])).to.be.false;
50
+ expect(matchExtension('image.avifs', ['.avif'])).to.be.false;
51
+ });
52
+ it('should be case insensitive', () => {
53
+ expect(matchExtension('image.PNG', ['.png'])).to.be.true;
54
+ });
55
+ });
56
+
57
+ describe('fileIsImage', () => {
58
+ it('should return true if file is image', () => {
59
+ const file = new File([''], 'name', { type: 'image/jpeg' });
60
+ expect(fileIsImage(file)).to.be.true;
61
+ });
62
+ it('should return false if file is not image', () => {
63
+ const file = new File([''], 'name', { type: 'text/plain' });
64
+ expect(fileIsImage(file)).to.be.false;
65
+ });
66
+ });
67
+
68
+ describe('isBlob', () => {
69
+ it('should return true if Blob is passed', () => {
70
+ expect(isBlob(new Blob(['']))).to.be.true;
71
+ });
72
+ it('should return true if File is passed', () => {
73
+ expect(isBlob(new File([''], 'test.txt'))).to.be.true;
74
+ });
75
+ it('should return false if something else passed', () => {
76
+ expect(isBlob('test')).to.be.false;
77
+ expect(isBlob({ uri: 'test' })).to.be.false;
78
+ });
79
+ });
80
+ describe('isFile', () => {
81
+ it('should return true if File is passed', () => {
82
+ expect(isFile(new File([''], 'test.txt'))).to.be.true;
83
+ });
84
+ it('should return false if something else passed', () => {
85
+ expect(isFile(new Blob(['']))).to.be.false;
86
+ expect(isFile('test')).to.be.false;
87
+ expect(isFile({ uri: 'test' })).to.be.false;
88
+ });
89
+ });
@@ -0,0 +1,2 @@
1
+ export function getLocaleDirection(localeId: string): string;
2
+ //# sourceMappingURL=getLocaleDirection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getLocaleDirection.d.ts","sourceRoot":"","sources":["getLocaleDirection.js"],"names":[],"mappings":"AAEO,6CADK,MAAM,UAgBjB"}
@@ -0,0 +1,18 @@
1
+ // @ts-check
2
+ /** @param {string} localeId */
3
+ export const getLocaleDirection = (localeId) => {
4
+ /**
5
+ * @type {typeof Intl.Locale & {
6
+ * textInfo?: { direction: string };
7
+ * getTextInfo?: () => { direction: string };
8
+ * }}
9
+ */
10
+ const locale = /** @type {any} */ (new Intl.Locale(localeId));
11
+ let direction = 'ltr';
12
+ if (typeof locale.getTextInfo === 'function' && locale.getTextInfo().direction) {
13
+ direction = locale.getTextInfo().direction;
14
+ } else if ('textInfo' in locale && locale.textInfo?.direction) {
15
+ direction = locale.textInfo.direction;
16
+ }
17
+ return direction;
18
+ };
@@ -0,0 +1,3 @@
1
+ export function getPluralForm(locale: string, count: number): PluralForm;
2
+ export type PluralForm = Intl.LDMLPluralRule;
3
+ //# sourceMappingURL=getPluralForm.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,13 @@
1
+ // @ts-check
2
+
3
+ /** @typedef {Intl.LDMLPluralRule} PluralForm */
4
+
5
+ /**
6
+ * @param {string} locale
7
+ * @param {number} count
8
+ * @returns {PluralForm}
9
+ */
10
+ export const getPluralForm = (locale, count) => {
11
+ const pluralForm = new Intl.PluralRules(locale).select(count);
12
+ return pluralForm;
13
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=getPluralForm.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPluralForm.test.d.ts","sourceRoot":"","sources":["getPluralForm.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { getPluralForm } from './getPluralForm';
2
+ import { expect } from '@esm-bundle/chai';
3
+
4
+ describe('getPluralForm', () => {
5
+ it('should return selected form for es-US', () => {
6
+ expect(getPluralForm('en-US', 1)).to.equal('one');
7
+ expect(getPluralForm('en-US', 2)).to.equal('other');
8
+ });
9
+
10
+ it('should return selected form for ru-RU', () => {
11
+ expect(getPluralForm('ru-RU', 1)).to.equal('one');
12
+ expect(getPluralForm('ru-RU', 2)).to.equal('few');
13
+ expect(getPluralForm('ru-RU', 5)).to.equal('many');
14
+ expect(getPluralForm('ru-RU', 1.5)).to.equal('other');
15
+ });
16
+ });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This will check if the execution environment is a short code snippet, and not the complete HTML-document
3
+ *
4
+ * @param {Function} cb
5
+ */
6
+ export function ifRef(cb: Function): void;
7
+ //# sourceMappingURL=ifRef.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifRef.d.ts","sourceRoot":"","sources":["ifRef.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,0CAGC"}
package/utils/ifRef.js ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This will check if the execution environment is a short code snippet, and not the complete HTML-document
3
+ *
4
+ * @param {Function} cb
5
+ */
6
+ export function ifRef(cb) {
7
+ // @ts-ignore
8
+ typeof window.__IS_REF__ === 'boolean' && !!window.__IS_REF__ && cb();
9
+ }
@@ -0,0 +1,4 @@
1
+ export function isSecureTokenExpired(secureToken: import('../types').SecureUploadsSignatureAndExpire, { threshold }: {
2
+ threshold?: number;
3
+ }): boolean;
4
+ //# sourceMappingURL=isSecureTokenExpired.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isSecureTokenExpired.d.ts","sourceRoot":"","sources":["isSecureTokenExpired.js"],"names":[],"mappings":"AAUO,kDAHI,OAAO,UAAU,EAAE,+BAA+B,iBAClD;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,WAQhC"}
@@ -0,0 +1,17 @@
1
+ /** @param {number} ms */
2
+ const msToUnixTimestamp = (ms) => Math.floor(ms / 1000);
3
+
4
+ /**
5
+ * Check if secure token is expired. It uses a threshold of 10 seconds by default. i.e. if the token is not expired yet
6
+ * but will expire in the next 10 seconds, it will return false.
7
+ *
8
+ * @param {import('../types').SecureUploadsSignatureAndExpire} secureToken
9
+ * @param {{ threshold?: number }} options
10
+ */
11
+ export const isSecureTokenExpired = (secureToken, { threshold }) => {
12
+ const { secureExpire } = secureToken;
13
+ const nowUnix = msToUnixTimestamp(Date.now());
14
+ const expireUnix = Number(secureExpire);
15
+ const thresholdUnix = msToUnixTimestamp(threshold);
16
+ return nowUnix + thresholdUnix >= expireUnix;
17
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=isSecureTokenExpired.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isSecureTokenExpired.test.d.ts","sourceRoot":"","sources":["isSecureTokenExpired.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,33 @@
1
+ import { isSecureTokenExpired } from './isSecureTokenExpired';
2
+ import { expect } from '@esm-bundle/chai';
3
+ import * as sinon from 'sinon';
4
+
5
+ const DATE_NOW = 60 * 1000;
6
+ const THRESHOLD = 10 * 1000;
7
+
8
+ describe('isSecureTokenExpired', () => {
9
+ let clock;
10
+ beforeEach(() => {
11
+ clock = sinon.useFakeTimers(DATE_NOW);
12
+ });
13
+
14
+ afterEach(() => {
15
+ clock.restore();
16
+ });
17
+
18
+ it('should return true if the token is expired', () => {
19
+ expect(isSecureTokenExpired({ secureExpire: '0', secureSignature: '' }, { threshold: THRESHOLD })).to.equal(true);
20
+ expect(isSecureTokenExpired({ secureExpire: '59', secureSignature: '' }, { threshold: THRESHOLD })).to.equal(true);
21
+ });
22
+
23
+ it('should return true if the token will expire in the next 10 seconds', () => {
24
+ expect(isSecureTokenExpired({ secureExpire: '60', secureSignature: '' }, { threshold: THRESHOLD })).to.equal(true);
25
+ expect(isSecureTokenExpired({ secureExpire: '61', secureSignature: '' }, { threshold: THRESHOLD })).to.equal(true);
26
+ expect(isSecureTokenExpired({ secureExpire: '70', secureSignature: '' }, { threshold: THRESHOLD })).to.equal(true);
27
+ });
28
+
29
+ it("should return false if the token is not expired and won't expire in next 10 seconds", () => {
30
+ expect(isSecureTokenExpired({ secureExpire: '71', secureSignature: '' }, { threshold: THRESHOLD })).to.equal(false);
31
+ expect(isSecureTokenExpired({ secureExpire: '80', secureSignature: '' }, { threshold: THRESHOLD })).to.equal(false);
32
+ });
33
+ });
@@ -0,0 +1,2 @@
1
+ export function memoize<TArgs extends any[], TReturn extends unknown, T extends (...args: TArgs) => TReturn>(fn: T): T;
2
+ //# sourceMappingURL=memoize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memoize.d.ts","sourceRoot":"","sources":["memoize.js"],"names":[],"mappings":"AASO,uHAaN"}
@@ -0,0 +1,23 @@
1
+ // @ts-check
2
+
3
+ /**
4
+ * @template {any[]} TArgs
5
+ * @template {any} TReturn
6
+ * @template {(...args: TArgs) => TReturn} T
7
+ * @param {T} fn
8
+ * @returns {T}
9
+ */
10
+ export const memoize = (fn) => {
11
+ const cache = new Map();
12
+ return /** @type {T} */ (
13
+ (...args) => {
14
+ const key = JSON.stringify(args);
15
+ if (cache.has(key)) {
16
+ return cache.get(key);
17
+ }
18
+ const result = fn(...args);
19
+ cache.set(key, result);
20
+ return result;
21
+ }
22
+ );
23
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=memoize.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memoize.test.d.ts","sourceRoot":"","sources":["memoize.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ import { expect } from '@esm-bundle/chai';
2
+ import { memoize } from './memoize.js';
3
+ import { spy } from 'sinon';
4
+
5
+ describe('memoize', () => {
6
+ it('should cache result', () => {
7
+ let counter = 0;
8
+ const fn = spy(() => counter++);
9
+ const memoized = memoize(fn);
10
+ memoized();
11
+ memoized();
12
+ memoized();
13
+ expect(fn.callCount).to.equal(1);
14
+ });
15
+
16
+ it('should cache result for each set of arguments', () => {
17
+ const fn = spy((a, b) => {
18
+ return a + b;
19
+ });
20
+ const memoized = memoize(fn);
21
+
22
+ memoized(1, 2);
23
+ memoized(1, 2);
24
+ memoized(1, 2);
25
+ memoized(2, 3);
26
+ memoized(2, 3);
27
+ memoized(2, 3);
28
+ expect(fn.callCount).to.equal(2);
29
+ });
30
+
31
+ it('should return the same result as original function', () => {
32
+ const fn = (a, b) => a + b;
33
+ const memoized = memoize(fn);
34
+ expect(memoized(1, 2)).to.equal(fn(1, 2));
35
+ expect(memoized(2, 3)).to.equal(fn(2, 3));
36
+ expect(memoized(3, 4)).to.equal(fn(3, 4));
37
+ });
38
+ });
@@ -0,0 +1,8 @@
1
+ export type GConstructor<T> = new (...args: any[]) => T;
2
+ /**
3
+ * This is a helper to create a class type extended with the provided set of instance properties. It's useful when there
4
+ * are some dynamic generated properties or native overrides in the class. We're use it to define dynamic access
5
+ * properties and events to subscribe to.
6
+ */
7
+ export type MixinClass<Base extends GConstructor<HTMLElement>, InstanceProperties extends Record<string, any> = {}> = (new (...args: ConstructorParameters<Base>) => InstanceProperties & InstanceType<Base>) & Omit<Base, "new">;
8
+ //# sourceMappingURL=mixinClass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixinClass.d.ts","sourceRoot":"","sources":["mixinClass.js"],"names":[],"mappings":"4CAE2B,GAAG,EAAE,KAAK,CAAC;;;;;;qIAWnB,sBAAsB,IAAI,CAAC,KAAG,kBAAkB,GAAG,aAAa,IAAI,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @template T
3
+ * @typedef {new (...args: any[]) => T} GConstructor
4
+ */
5
+
6
+ /**
7
+ * This is a helper to create a class type extended with the provided set of instance properties. It's useful when there
8
+ * are some dynamic generated properties or native overrides in the class. We're use it to define dynamic access
9
+ * properties and events to subscribe to.
10
+ *
11
+ * @template {GConstructor<HTMLElement>} Base
12
+ * @template {Record<string, any>} [InstanceProperties={}] Default is `{}`
13
+ * @typedef {{
14
+ * new (...args: ConstructorParameters<Base>): InstanceProperties & InstanceType<Base>;
15
+ * } & Omit<Base, 'new'>} MixinClass
16
+ */
17
+
18
+ export {};
@@ -0,0 +1,9 @@
1
+ export function parseCdnUrl({ url, cdnBase }: {
2
+ url: string;
3
+ cdnBase: string;
4
+ }): {
5
+ uuid: any;
6
+ cdnUrlModifiers: any;
7
+ filename: any;
8
+ } | null;
9
+ //# sourceMappingURL=parseCdnUrl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseCdnUrl.d.ts","sourceRoot":"","sources":["parseCdnUrl.js"],"names":[],"mappings":"AAIO,8CADK;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;;;;SAgB3C"}
@@ -0,0 +1,20 @@
1
+ const uuidRegex = /[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i;
2
+ const cdnUrlRegex = new RegExp(`^/?(${uuidRegex.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`, 'i');
3
+
4
+ /** @param {{ url: string; cdnBase: string }} options */
5
+ export const parseCdnUrl = ({ url, cdnBase }) => {
6
+ const cdnBaseUrlObj = new URL(cdnBase);
7
+ const urlObj = new URL(url);
8
+
9
+ if (cdnBaseUrlObj.host !== urlObj.host) {
10
+ return null;
11
+ }
12
+
13
+ const [, uuid, cdnUrlModifiers, filename] = cdnUrlRegex.exec(urlObj.pathname);
14
+
15
+ return {
16
+ uuid,
17
+ cdnUrlModifiers: cdnUrlModifiers || '',
18
+ filename: filename || null,
19
+ };
20
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=parseCdnUrl.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseCdnUrl.test.d.ts","sourceRoot":"","sources":["parseCdnUrl.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,78 @@
1
+ import { parseCdnUrl } from './parseCdnUrl';
2
+ import { expect } from '@esm-bundle/chai';
3
+
4
+ describe('parseCdnUrl', () => {
5
+ it('should should work', () => {
6
+ expect(
7
+ parseCdnUrl({
8
+ url: 'https://cdn.example.com/12345678-1234-5678-1234-567812345678/',
9
+ cdnBase: 'https://cdn.example.com',
10
+ }),
11
+ ).to.deep.equal({
12
+ uuid: '12345678-1234-5678-1234-567812345678',
13
+ cdnUrlModifiers: '',
14
+ filename: null,
15
+ });
16
+ });
17
+
18
+ it('should parse filename', () => {
19
+ expect(
20
+ parseCdnUrl({
21
+ url: 'https://cdn.example.com/12345678-1234-5678-1234-567812345678/bar.jpg',
22
+ cdnBase: 'https://cdn.example.com',
23
+ }),
24
+ ).to.deep.equal({
25
+ uuid: '12345678-1234-5678-1234-567812345678',
26
+ cdnUrlModifiers: '',
27
+ filename: 'bar.jpg',
28
+ });
29
+ });
30
+
31
+ it('should parse cdn url modifiers', () => {
32
+ expect(
33
+ parseCdnUrl({
34
+ url: 'https://cdn.example.com/12345678-1234-5678-1234-567812345678/-/foo/bar/baz.jpg',
35
+ cdnBase: 'https://cdn.example.com',
36
+ }),
37
+ ).to.deep.equal({
38
+ uuid: '12345678-1234-5678-1234-567812345678',
39
+ cdnUrlModifiers: '-/foo/bar/',
40
+ filename: 'baz.jpg',
41
+ });
42
+ });
43
+
44
+ it('should return null if cdn base is different', () => {
45
+ expect(
46
+ parseCdnUrl({
47
+ url: 'https://cdn.example.com/12345678-1234-5678-1234-567812345678/',
48
+ cdnBase: 'https://cdn2.example.com',
49
+ }),
50
+ ).to.equal(null);
51
+ });
52
+
53
+ it('should strip slashes from the end cdn base before comparing', () => {
54
+ expect(
55
+ parseCdnUrl({
56
+ url: 'https://cdn.example.com/12345678-1234-5678-1234-567812345678/',
57
+ cdnBase: 'https://cdn.example.com/',
58
+ }),
59
+ ).to.deep.equal({
60
+ uuid: '12345678-1234-5678-1234-567812345678',
61
+ cdnUrlModifiers: '',
62
+ filename: null,
63
+ });
64
+ });
65
+
66
+ it('should not compare the protocol', () => {
67
+ expect(
68
+ parseCdnUrl({
69
+ url: 'https://cdn.example.com/12345678-1234-5678-1234-567812345678/',
70
+ cdnBase: 'http://cdn.example.com',
71
+ }),
72
+ ).to.deep.equal({
73
+ uuid: '12345678-1234-5678-1234-567812345678',
74
+ cdnUrlModifiers: '',
75
+ filename: null,
76
+ });
77
+ });
78
+ });
@@ -0,0 +1,5 @@
1
+ export function parseShrink(value: any): {
2
+ size: number;
3
+ quality: number | undefined;
4
+ };
5
+ //# sourceMappingURL=parseShrink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseShrink.d.ts","sourceRoot":"","sources":["parseShrink.js"],"names":[],"mappings":"AAUO,yCAFM;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAyBzD"}
@@ -0,0 +1,34 @@
1
+ /** TODO parseShrink move to package @uploadcare/image-shrink */
2
+
3
+ const MAX_SQUARE_SIDE = 16384;
4
+
5
+ const regExpShrink = /^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i;
6
+
7
+ /**
8
+ * @param value
9
+ * @returns {{ size: number; quality: number | undefined }}
10
+ */
11
+ export const parseShrink = (value) => {
12
+ const terms = regExpShrink.exec(value?.toLocaleLowerCase()) || [];
13
+
14
+ if (!terms.length) {
15
+ return false;
16
+ }
17
+
18
+ const sizeShrink = terms[1] * terms[2];
19
+ const maxSize = MAX_SQUARE_SIDE * MAX_SQUARE_SIDE;
20
+
21
+ if (sizeShrink > maxSize) {
22
+ console.warn(
23
+ `Shrinked size can not be larger than ${Math.floor(maxSize / 1000 / 1000)}MP. ` +
24
+ `You have set ${terms[1]}x${terms[2]} (` +
25
+ `${Math.ceil(sizeShrink / 1000 / 100) / 10}MP).`,
26
+ );
27
+ return false;
28
+ }
29
+
30
+ return {
31
+ quality: terms[3] ? terms[3] / 100 : undefined,
32
+ size: sizeShrink,
33
+ };
34
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=parseShrink.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseShrink.test.d.ts","sourceRoot":"","sources":["parseShrink.test.js"],"names":[],"mappings":""}