@scaleflex/widget-utils 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/CHANGELOG.md +7100 -0
  2. package/LICENSE +21 -0
  3. package/README.md +58 -0
  4. package/lib/AbortController.js +20 -0
  5. package/lib/BlurHash/base83.js +10 -0
  6. package/lib/BlurHash/decode.js +80 -0
  7. package/lib/BlurHash/error.js +28 -0
  8. package/lib/BlurHash/utils.js +22 -0
  9. package/lib/CustomDate.js +157 -0
  10. package/lib/EventTracker.js +42 -0
  11. package/lib/FOCUSABLE_ELEMENTS.js +1 -0
  12. package/lib/LinkHelper.js +153 -0
  13. package/lib/NetworkError.js +30 -0
  14. package/lib/ProgressTimeout.js +45 -0
  15. package/lib/RateLimitedQueue.js +197 -0
  16. package/lib/RequestError.js +36 -0
  17. package/lib/Timeframes/getDateRange.js +45 -0
  18. package/lib/TranslationMissingKeysConsoleHelper.js +113 -0
  19. package/lib/Translator.js +200 -0
  20. package/lib/addUrlParams.js +27 -0
  21. package/lib/adjustUpdatedFolders.js +22 -0
  22. package/lib/asyncTimeout.js +6 -0
  23. package/lib/audioMimeTypes.js +3 -0
  24. package/lib/blobToDataURI.js +13 -0
  25. package/lib/callIfFunction.js +10 -0
  26. package/lib/canEditVideo.js +9 -0
  27. package/lib/canvasToBlob.js +18 -0
  28. package/lib/capitalizeFirstLetter.js +4 -0
  29. package/lib/checkConnection.js +4 -0
  30. package/lib/checkFileOrFolderNameValidation.js +4 -0
  31. package/lib/checkIfPngSvgGIF.js +3 -0
  32. package/lib/checkImageIfPngJpegOrWebpOrAvif.js +5 -0
  33. package/lib/checkItemsSupportExportWithReason.js +41 -0
  34. package/lib/checkPermissions.js +26 -0
  35. package/lib/cloudimageSupportedInputMimeTypes.js +2 -0
  36. package/lib/clsx.js +14 -0
  37. package/lib/constants.js +570 -0
  38. package/lib/convertBytesToMb.js +5 -0
  39. package/lib/convertGbToBytes.js +4 -0
  40. package/lib/convertVideoFileTypeToSupported.js +17 -0
  41. package/lib/copyText.js +25 -0
  42. package/lib/createFolderVirtualPath.js +14 -0
  43. package/lib/createThunk.js +349 -0
  44. package/lib/customEncodeURIComponent.js +47 -0
  45. package/lib/dataURItoBlob.js +33 -0
  46. package/lib/dataURItoFile.js +4 -0
  47. package/lib/dateStrToClearDateTime.js +20 -0
  48. package/lib/debounce.js +14 -0
  49. package/lib/deepEqual.js +23 -0
  50. package/lib/deepMerge.js +56 -0
  51. package/lib/deserializeFunction.js +5 -0
  52. package/lib/documentMimeTypes.js +2 -0
  53. package/lib/downloadFromBlob.js +16 -0
  54. package/lib/emitSocketProgress.js +18 -0
  55. package/lib/escapeRegExp.js +4 -0
  56. package/lib/extractFileDataNoBlob.js +12 -0
  57. package/lib/fetchWithNetworkError.js +14 -0
  58. package/lib/fieldsQueriesGetters.js +46 -0
  59. package/lib/findAllDOMElements.js +18 -0
  60. package/lib/findAllRegexMatchesInString.js +16 -0
  61. package/lib/findDOMElement.js +17 -0
  62. package/lib/findIndex.js +9 -0
  63. package/lib/formatDuration.js +22 -0
  64. package/lib/formatNumbers.js +32 -0
  65. package/lib/formatResolution.js +17 -0
  66. package/lib/formatSeconds.js +14 -0
  67. package/lib/generateFileId.js +53 -0
  68. package/lib/generateI18nKeyFromString.js +11 -0
  69. package/lib/generatePsdThumbnail/adaptHexBoundries.js +9 -0
  70. package/lib/generatePsdThumbnail/bufferToHex.js +12 -0
  71. package/lib/generatePsdThumbnail/generatePsdThumbnail.js +36 -0
  72. package/lib/generatePsdThumbnail/generatePsdThumbnailBytes.js +8 -0
  73. package/lib/generatePsdThumbnail/generatePsdThumbnailHex.js +4 -0
  74. package/lib/generateSelectInputPlaceholder.js +24 -0
  75. package/lib/getActionErrorState.js +17 -0
  76. package/lib/getArraysMutualObjects.js +12 -0
  77. package/lib/getBytesRemaining.js +9 -0
  78. package/lib/getClientTimezone.js +5 -0
  79. package/lib/getCloudimagePrefixedUrl.js +23 -0
  80. package/lib/getDateDaysFromNow.js +17 -0
  81. package/lib/getDateMinusDay.js +5 -0
  82. package/lib/getDateString.js +20 -0
  83. package/lib/getDaysLeft.js +9 -0
  84. package/lib/getDecodedUriComponent.js +10 -0
  85. package/lib/getDownloadSpeed.js +7 -0
  86. package/lib/getDroppedFiles/index.js +24 -0
  87. package/lib/getDroppedFiles/utils/fallbackApi.js +7 -0
  88. package/lib/getDroppedFiles/utils/webkitGetAsEntryApi/getFilesAndDirectoriesFromDirectory.js +36 -0
  89. package/lib/getDroppedFiles/utils/webkitGetAsEntryApi/getRelativePath.js +16 -0
  90. package/lib/getDroppedFiles/utils/webkitGetAsEntryApi/index.js +57 -0
  91. package/lib/getEncodedWrappedUrl.js +7 -0
  92. package/lib/getFileAssetsTokenUrl.js +14 -0
  93. package/lib/getFileCdnLink.js +6 -0
  94. package/lib/getFileDefaultIcon.js +14 -0
  95. package/lib/getFileDetails.js +81 -0
  96. package/lib/getFileExtension.js +32 -0
  97. package/lib/getFileLink.js +17 -0
  98. package/lib/getFileNameAndExtension.js +22 -0
  99. package/lib/getFileType.js +23 -0
  100. package/lib/getFileTypeExtension.js +22 -0
  101. package/lib/getFilterFileFormatIcon.js +6 -0
  102. package/lib/getFolderDetails.js +30 -0
  103. package/lib/getFormattedPreviewUrl.js +79 -0
  104. package/lib/getHoursAndMinutes.js +9 -0
  105. package/lib/getImageEditUrl.js +36 -0
  106. package/lib/getImgFileDimensions.js +25 -0
  107. package/lib/getItemIcon.js +112 -0
  108. package/lib/getItemPath.js +10 -0
  109. package/lib/getItemPreviewWidthHeight.js +10 -0
  110. package/lib/getItemsSizeInBytes.js +12 -0
  111. package/lib/getJsonParsedValue.js +11 -0
  112. package/lib/getLinkWithNewParams.js +13 -0
  113. package/lib/getMetadataMultiSelectQuery.js +66 -0
  114. package/lib/getNormalizedItems.js +55 -0
  115. package/lib/getObjectsMutualProperties.js +32 -0
  116. package/lib/getRandomNumber.js +12 -0
  117. package/lib/getSocketHost.js +7 -0
  118. package/lib/getSpeed.js +8 -0
  119. package/lib/getTime.js +18 -0
  120. package/lib/getTimeStamp.js +18 -0
  121. package/lib/handleError.js +13 -0
  122. package/lib/handlePressEnter.js +9 -0
  123. package/lib/handlePromise.js +39 -0
  124. package/lib/hasProperty.js +3 -0
  125. package/lib/hexToRgb.js +15 -0
  126. package/lib/htmlSanitizer.js +6 -0
  127. package/lib/humanReadableDate.js +45 -0
  128. package/lib/humanReadableDateWithTranslations.js +29 -0
  129. package/lib/i18n.client.js +54 -0
  130. package/lib/ignoreEvent.js +10 -0
  131. package/lib/index.js +0 -0
  132. package/lib/injectVirtualPathToFolders.js +24 -0
  133. package/lib/isAi.js +7 -0
  134. package/lib/isArchive.js +12 -0
  135. package/lib/isAudio.js +9 -0
  136. package/lib/isAudioAndSupportsPlayback.js +10 -0
  137. package/lib/isCloudimageFastPreviewSupported.js +16 -0
  138. package/lib/isDOMElement.js +9 -0
  139. package/lib/isDocument.js +10 -0
  140. package/lib/isDragDropSupported.js +20 -0
  141. package/lib/isEmptyObject.js +4 -0
  142. package/lib/isEps.js +8 -0
  143. package/lib/isFile.js +5 -0
  144. package/lib/isFileSupportedByCloudimage.js +14 -0
  145. package/lib/isFolder.js +4 -0
  146. package/lib/isFontFile.js +9 -0
  147. package/lib/isFunction.js +4 -0
  148. package/lib/isImage.js +11 -0
  149. package/lib/isJpg.js +8 -0
  150. package/lib/isMobileDevice.js +12 -0
  151. package/lib/isNetworkError.js +7 -0
  152. package/lib/isNumber.js +4 -0
  153. package/lib/isObjectType.js +5 -0
  154. package/lib/isObjectURL.js +10 -0
  155. package/lib/isOpenedFromAdobe.js +3 -0
  156. package/lib/isOtf.js +10 -0
  157. package/lib/isPdf.js +9 -0
  158. package/lib/isPhotoshopFile.js +8 -0
  159. package/lib/isPreviewSupported.js +12 -0
  160. package/lib/isPromise.js +5 -0
  161. package/lib/isPsd.js +8 -0
  162. package/lib/isScriptFile.js +12 -0
  163. package/lib/isSupportedVideo.js +8 -0
  164. package/lib/isSvg.js +5 -0
  165. package/lib/isTextFile.js +8 -0
  166. package/lib/isThumbnailCloudimgSupported.js +13 -0
  167. package/lib/isThumbnailLocallySupported.js +9 -0
  168. package/lib/isTiff.js +8 -0
  169. package/lib/isTransparencySupported.js +12 -0
  170. package/lib/isTtf.js +11 -0
  171. package/lib/isUploadableFile.js +7 -0
  172. package/lib/isUrl.js +5 -0
  173. package/lib/isValidUri.js +18 -0
  174. package/lib/isVideo.js +8 -0
  175. package/lib/isVideoResourceIntensive.js +9 -0
  176. package/lib/literalDateFromDateObj.js +6 -0
  177. package/lib/logErrorIfDevEnv.js +7 -0
  178. package/lib/lowercaseFirstLetter.js +4 -0
  179. package/lib/mapArrayByStep.js +12 -0
  180. package/lib/metadata/checkFieldValidation.js +51 -0
  181. package/lib/metadata/generateItemMetadataState.js +63 -0
  182. package/lib/metadata/generateMetadataDefaultState.js +30 -0
  183. package/lib/metadata/getFileCustomMetadataGroups.js +23 -0
  184. package/lib/metadata/getGeoPointValidationErrors.js +32 -0
  185. package/lib/metadata/getMetaAttachmentFields.js +9 -0
  186. package/lib/metadata/getMetadataEmptyAssets.js +28 -0
  187. package/lib/metadata/getMetadataFieldGeoPointValue.js +42 -0
  188. package/lib/metadata/getMetadataFieldVariantValue.js +31 -0
  189. package/lib/metadata/getMetadataGroups.js +16 -0
  190. package/lib/metadata/getRequiredMetadataFields.js +13 -0
  191. package/lib/metadata/isM0LegacyMetaVersion.js +5 -0
  192. package/lib/metadata/isM1EdgyMetaVersion.js +5 -0
  193. package/lib/metadata/mapMetaAttachmentsObjsToUuids.js +21 -0
  194. package/lib/metadata/updateValidationErrors.js +59 -0
  195. package/lib/metadata/validateItemMetadata.js +70 -0
  196. package/lib/mimeTypes.js +60 -0
  197. package/lib/nanoid.js +18 -0
  198. package/lib/openLink.js +3 -0
  199. package/lib/openLinkInNewTab.js +12 -0
  200. package/lib/prettyETA.js +15 -0
  201. package/lib/prettyFileSize.js +7 -0
  202. package/lib/preventDefault.js +4 -0
  203. package/lib/provideSvgStrWithCurrColor.js +10 -0
  204. package/lib/recursiveFnCall.js +26 -0
  205. package/lib/removeAllUrlParams.js +4 -0
  206. package/lib/removeDuplicatesFromArray.js +20 -0
  207. package/lib/removeEmptyFolders.js +8 -0
  208. package/lib/removeFileExtension.js +4 -0
  209. package/lib/removeUrlParamsWithRegex.js +14 -0
  210. package/lib/reorder.js +15 -0
  211. package/lib/requestFile.js +36 -0
  212. package/lib/rgbToHex.js +4 -0
  213. package/lib/secondsToTime.js +10 -0
  214. package/lib/serializeFunction.js +4 -0
  215. package/lib/settle.js +19 -0
  216. package/lib/sortEntitiesByName.js +18 -0
  217. package/lib/splitCamelCase.js +4 -0
  218. package/lib/splitPathToPathsAndNames.js +25 -0
  219. package/lib/stopPropagation.js +4 -0
  220. package/lib/styledComponentsMixins/truncate.mixin.js +8 -0
  221. package/lib/timeZones.js +1 -0
  222. package/lib/toArray.js +6 -0
  223. package/lib/toLowerCase.js +5 -0
  224. package/lib/toggleElementFullscreen.js +27 -0
  225. package/lib/visibility.js +39 -0
  226. package/package.json +25 -0
  227. package/types/index.d.ts +279 -0
@@ -0,0 +1,18 @@
1
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
5
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
6
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7
+ var defaultSortFn = function defaultSortFn(entity1, entity2) {
8
+ return entity1 === null || entity1 === void 0 ? void 0 : entity1.name.localeCompare(entity2 === null || entity2 === void 0 ? void 0 : entity2.name);
9
+ };
10
+ var sortEntitiesByName = function sortEntitiesByName() {
11
+ var ids = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
12
+ var entities = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
13
+ var sortFn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultSortFn;
14
+ return _toConsumableArray(ids).sort(function (id1, id2) {
15
+ return sortFn(entities[id1], entities[id2]);
16
+ });
17
+ };
18
+ export default sortEntitiesByName;
@@ -0,0 +1,4 @@
1
+ var splitCamelCase = function splitCamelCase(text) {
2
+ return text.replace(/([a-z])([A-Z])/g, '$1 $2').toLowerCase().split(' ');
3
+ };
4
+ export default splitCamelCase;
@@ -0,0 +1,25 @@
1
+ export default function splitPathToPathsAndNames() {
2
+ var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
3
+ var depth = (path.match(/\//ig) || []).length;
4
+ var startSearchIndex = path.indexOf('/');
5
+ var index;
6
+ var tempPath;
7
+ var tempName;
8
+ var paths = [];
9
+ var names = [];
10
+ for (var i = 0; i < depth; i++) {
11
+ index = path.indexOf('/', startSearchIndex + 1);
12
+ if (index === -1) {
13
+ index = path.length;
14
+ }
15
+ tempPath = path.slice(0, index);
16
+ tempName = path.slice(startSearchIndex + 1, index);
17
+ paths.push(tempPath);
18
+ names.push(tempName);
19
+ startSearchIndex = index;
20
+ }
21
+ return {
22
+ paths: paths,
23
+ names: names
24
+ };
25
+ }
@@ -0,0 +1,4 @@
1
+ var stopPropagation = function stopPropagation(event) {
2
+ event.stopPropagation();
3
+ };
4
+ export default stopPropagation;
@@ -0,0 +1,8 @@
1
+ var _templateObject;
2
+ function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
3
+ import { css } from 'styled-components';
4
+ var truncateMixin = function truncateMixin() {
5
+ var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '100%';
6
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n ", "\n"])), typeof width === 'string' && width ? "width: ".concat(width, ";") : '');
7
+ };
8
+ export default truncateMixin;
@@ -0,0 +1 @@
1
+ export default ['Africa/Abidjan', 'Africa/Accra', 'Africa/Addis_Ababa', 'Africa/Algiers', 'Africa/Asmara', 'Africa/Asmera', 'Africa/Bamako', 'Africa/Bangui', 'Africa/Banjul', 'Africa/Bissau', 'Africa/Blantyre', 'Africa/Brazzaville', 'Africa/Bujumbura', 'Africa/Cairo', 'Africa/Casablanca', 'Africa/Ceuta', 'Africa/Conakry', 'Africa/Dakar', 'Africa/Dar_es_Salaam', 'Africa/Djibouti', 'Africa/Douala', 'Africa/El_Aaiun', 'Africa/Freetown', 'Africa/Gaborone', 'Africa/Harare', 'Africa/Johannesbur', 'Africa/Juba', 'Africa/Kampala', 'Africa/Khartoum', 'Africa/Kigali', 'Africa/Kinshasa', 'Africa/Lagos', 'Africa/Libreville', 'Africa/Lome', 'Africa/Luanda', 'Africa/Lubumbashi', 'Africa/Lusaka', 'Africa/Malabo', 'Africa/Maputo', 'Africa/Maseru', 'Africa/Mbabane', 'Africa/Mogadishu', 'Africa/Monrovia', 'Africa/Nairobi', 'Africa/Ndjamena', 'Africa/Niamey', 'Africa/Nouakchott', 'Africa/Ouagadougou', 'Africa/Porto-Novo', 'Africa/Sao_Tome', 'Africa/Timbuktu', 'Africa/Tripoli', 'Africa/Tunis', 'Africa/Windhoek', 'America/Adak', 'America/Anchorage', 'America/Anguilla', 'America/Antigua', 'America/Araguaina', 'America/Argentina/Buenos_Aires', 'America/Argentina/Catamarca', 'America/Argentina/ComodRivadavia', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/La_Rioja', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Salta', 'America/Argentina/San_Juan', 'America/Argentina/San_Luis', 'America/Argentina/Tucuman', 'America/Argentina/Ushuaia', 'America/Aruba', 'America/Asuncion', 'America/Atikokan', 'America/Atka', 'America/Bahia', 'America/Bahia_Banderas', 'America/Barbados', 'America/Belem', 'America/Belize', 'America/Blanc-Sablon', 'America/Boa_Vista', 'America/Bogota', 'America/Boise', 'America/Buenos_Aires', 'America/Cambridge_Bay', 'America/Campo_Grande', 'America/Cancun', 'America/Caracas', 'America/Catamarca', 'America/Cayenne', 'America/Cayman', 'America/Chicago', 'America/Chihuahua', 'America/Coral_Harbour', 'America/Cordoba', 'America/Costa_Rica', 'America/Creston', 'America/Cuiaba', 'America/Curacao', 'America/Danmarkshavn', 'America/Dawson', 'America/Dawson_Creek', 'America/Denver', 'America/Detroit', 'America/Dominica', 'America/Edmonton', 'America/Eirunepe', 'America/El_Salvador', 'America/Fort_Nelson', 'America/Fort_Wayne', 'America/Fortaleza', 'America/Glace_Bay', 'America/Godthab', 'America/Goose_Bay', 'America/Grand_Turk', 'America/Grenada', 'America/Guadeloupe', 'America/Guatemala', 'America/Guayaquil', 'America/Guyana', 'America/Halifax', 'America/Havana', 'America/Hermosillo', 'America/Indiana/Indianapolis', 'America/Indiana/Knox', 'America/Indiana/Marengo', 'America/Indiana/Petersburg', 'America/Indiana/Tell_City', 'America/Indiana/Vevay', 'America/Indiana/Vincennes', 'America/Indiana/Winamac', 'America/Indianapolis', 'America/Inuvik', 'America/Iqaluit', 'America/Jamaica', 'America/Jujuy', 'America/Juneau', 'America/Kentucky/Louisville', 'America/Kentucky/Monticello', 'America/Knox_IN', 'America/Kralendijk', 'America/La_Paz', 'America/Lima', 'America/Los_Angeles', 'America/Louisville', 'America/Lower_Princes', 'America/Maceio', 'America/Managua', 'America/Manaus', 'America/Marigot', 'America/Martinique', 'America/Matamoros', 'America/Mazatlan', 'America/Mendoza', 'America/Menominee', 'America/Merida', 'America/Metlakatla', 'America/Mexico_City', 'America/Miquelon', 'America/Moncton', 'America/Monterrey', 'America/Montevideo', 'America/Montreal', 'America/Montserrat', 'America/Nassau', 'America/New_York', 'America/Nipigon', 'America/Nome', 'America/Noronha', 'America/North_Dakota/Beulah', 'America/North_Dakota/Center', 'America/North_Dakota/New_Salem', 'America/Ojinaga', 'America/Panama', 'America/Pangnirtung', 'America/Paramaribo', 'America/Phoenix', 'America/Port-au-Prince', 'America/Port_of_Spain', 'America/Porto_Acre', 'America/Porto_Velho', 'America/Puerto_Rico', 'America/Punta_Arenas', 'America/Rainy_River', 'America/Rankin_Inlet', 'America/Recife', 'America/Regina', 'America/Resolute', 'America/Rio_Branco', 'America/Rosario', 'America/Santa_Isabel', 'America/Santarem', 'America/Santiago', 'America/Santo_Domingo', 'America/Sao_Paulo', 'America/Scoresbysund', 'America/Shiprock', 'America/Sitka', 'America/St_Barthelemy', 'America/St_Johns', 'America/St_Kitts', 'America/St_Lucia', 'America/St_Thomas', 'America/St_Vincent', 'America/Swift_Current', 'America/Tegucigalpa', 'America/Thule', 'America/Thunder_Bay', 'America/Tijuana', 'America/Toronto', 'America/Tortola', 'America/Vancouver', 'America/Virgin', 'America/Whitehorse', 'America/Winnipeg', 'America/Yakutat', 'America/Yellowknife', 'Antarctica/Casey', 'Antarctica/Davis', 'Antarctica/DumontDUrville', 'Antarctica/Macquarie', 'Antarctica/Mawson', 'Antarctica/McMurdo', 'Antarctica/Palmer', 'Antarctica/Rothera', 'Antarctica/South_Pole', 'Antarctica/Syowa', 'Antarctica/Troll', 'Antarctica/Vostok', 'Arctic/Longyearbyen', 'Asia/Aden', 'Asia/Almaty', 'Asia/Amman', 'Asia/Anadyr', 'Asia/Aqtau', 'Asia/Aqtobe', 'Asia/Ashgabat', 'Asia/Ashkhabad', 'Asia/Atyrau', 'Asia/Baghdad', 'Asia/Bahrain', 'Asia/Baku', 'Asia/Bangkok', 'Asia/Barnaul', 'Asia/Beirut', 'Asia/Bishkek', 'Asia/Brunei', 'Asia/Calcutta', 'Asia/Chita', 'Asia/Choibalsan', 'Asia/Chongqing', 'Asia/Chungking', 'Asia/Colombo', 'Asia/Dacca', 'Asia/Damascus', 'Asia/Dhaka', 'Asia/Dili', 'Asia/Dubai', 'Asia/Dushanbe', 'Asia/Famagusta', 'Asia/Gaza', 'Asia/Harbin', 'Asia/Hebron', 'Asia/Ho_Chi_Minh', 'Asia/Hong_Kong', 'Asia/Hovd', 'Asia/Irkutsk', 'Asia/Istanbul', 'Asia/Jakarta', 'Asia/Jayapura', 'Asia/Jerusalem', 'Asia/Kabul', 'Asia/Kamchatka', 'Asia/Karachi', 'Asia/Kashgar', 'Asia/Kathmandu', 'Asia/Katmandu', 'Asia/Khandyga', 'Asia/Kolkata', 'Asia/Krasnoyarsk', 'Asia/Kuala_Lumpur', 'Asia/Kuching', 'Asia/Kuwait', 'Asia/Macao', 'Asia/Macau', 'Asia/Magadan', 'Asia/Makassar', 'Asia/Manila', 'Asia/Muscat', 'Asia/Nicosia', 'Asia/Novokuznetsk', 'Asia/Novosibirsk', 'Asia/Omsk', 'Asia/Oral', 'Asia/Phnom_Penh', 'Asia/Pontianak', 'Asia/Pyongyang', 'Asia/Qatar', 'Asia/Qyzylorda', 'Asia/Rangoon', 'Asia/Riyadh', 'Asia/Saigon', 'Asia/Sakhalin', 'Asia/Samarkand', 'Asia/Seoul', 'Asia/Shanghai', 'Asia/Singapore', 'Asia/Srednekolymsk', 'Asia/Taipei', 'Asia/Tashkent', 'Asia/Tbilisi', 'Asia/Tehran', 'Asia/Tel_Aviv', 'Asia/Thimbu', 'Asia/Thimphu', 'Asia/Tokyo', 'Asia/Tomsk', 'Asia/Ujung_Pandang', 'Asia/Ulaanbaatar', 'Asia/Ulan_Bator', 'Asia/Urumqi', 'Asia/Ust-Nera', 'Asia/Vientiane', 'Asia/Vladivostok', 'Asia/Yakutsk', 'Asia/Yangon', 'Asia/Yekaterinburg', 'Asia/Yerevan', 'Atlantic/Azores', 'Atlantic/Bermuda', 'Atlantic/Canary', 'Atlantic/Cape_Verde', 'Atlantic/Faeroe', 'Atlantic/Faroe', 'Atlantic/Jan_Mayen', 'Atlantic/Madeira', 'Atlantic/Reykjavik', 'Atlantic/South_Georgia', 'Atlantic/St_Helena', 'Atlantic/Stanley', 'Australia/ACT', 'Australia/Adelaide', 'Australia/Brisbane', 'Australia/Broken_Hill', 'Australia/Canberra', 'Australia/Currie', 'Australia/Darwin', 'Australia/Eucla', 'Australia/Hobart', 'Australia/LHI', 'Australia/Lindeman', 'Australia/Lord_Howe', 'Australia/Melbourne', 'Australia/NSW', 'Australia/North', 'Australia/Perth', 'Australia/Queensland', 'Australia/South', 'Australia/Sydney', 'Australia/Tasmania', 'Australia/Victoria', 'Australia/West', 'Australia/Yancowinna', 'Brazil/Acre', 'Brazil/DeNoronha', 'Brazil/East', 'Brazil/West', 'CET', 'CST6CDT', 'Canada/Atlantic', 'Canada/Central', 'Canada/Eastern', 'Canada/Mountain', 'Canada/Newfoundland', 'Canada/Pacific', 'Canada/Saskatchewan', 'Canada/Yukon', 'Chile/Continental', 'Chile/EasterIsland', 'Cuba', 'EET', 'EST', 'EST5EDT', 'Egypt', 'Eire', 'Etc/GMT', 'Etc/GMT+0', 'Etc/GMT+1', 'Etc/GMT+10', 'Etc/GMT+11', 'Etc/GMT+12', 'Etc/GMT+2', 'Etc/GMT+3', 'Etc/GMT+4', 'Etc/GMT+5', 'Etc/GMT+6', 'Etc/GMT+7', 'Etc/GMT+8', 'Etc/GMT+9', 'Etc/GMT-0', 'Etc/GMT-1', 'Etc/GMT-10', 'Etc/GMT-11', 'Etc/GMT-12', 'Etc/GMT-13', 'Etc/GMT-14', 'Etc/GMT-2', 'Etc/GMT-3', 'Etc/GMT-4', 'Etc/GMT-5', 'Etc/GMT-6', 'Etc/GMT-7', 'Etc/GMT-8', 'Etc/GMT-9', 'Etc/GMT0', 'Etc/Greenwich', 'Etc/UCT', 'Etc/UTC', 'Etc/Universal', 'Etc/Zulu', 'Europe/Amsterdam', 'Europe/Andorra', 'Europe/Astrakhan', 'Europe/Athens', 'Europe/Belfast', 'Europe/Belgrade', 'Europe/Berlin', 'Europe/Bratislava', 'Europe/Brussels', 'Europe/Bucharest', 'Europe/Budapest', 'Europe/Busingen', 'Europe/Chisinau', 'Europe/Copenhagen', 'Europe/Dublin', 'Europe/Gibraltar', 'Europe/Guernsey', 'Europe/Helsinki', 'Europe/Isle_of_Man', 'Europe/Istanbul', 'Europe/Jersey', 'Europe/Kaliningrad', 'Europe/Kiev', 'Europe/Kirov', 'Europe/Lisbon', 'Europe/Ljubljana', 'Europe/London', 'Europe/Luxembourg', 'Europe/Madrid', 'Europe/Malta', 'Europe/Mariehamn', 'Europe/Minsk', 'Europe/Monaco', 'Europe/Moscow', 'Europe/Nicosia', 'Europe/Oslo', 'Europe/Paris', 'Europe/Podgorica', 'Europe/Prague', 'Europe/Riga', 'Europe/Rome', 'Europe/Samara', 'Europe/San_Marino', 'Europe/Sarajevo', 'Europe/Saratov', 'Europe/Simferopol', 'Europe/Skopje', 'Europe/Sofia', 'Europe/Stockholm', 'Europe/Tallinn', 'Europe/Tirane', 'Europe/Tiraspol', 'Europe/Ulyanovsk', 'Europe/Uzhgorod', 'Europe/Vaduz', 'Europe/Vatican', 'Europe/Vienna', 'Europe/Vilnius', 'Europe/Volgograd', 'Europe/Warsaw', 'Europe/Zagreb', 'Europe/Zaporozhye', 'Europe/Zurich', 'GB', 'GB-Eire', 'GMT', 'GMT+0', 'GMT-0', 'GMT0', 'Greenwich', 'HST', 'Hongkong', 'Iceland', 'Indian/Antananarivo', 'Indian/Chagos', 'Indian/Christmas', 'Indian/Cocos', 'Indian/Comoro', 'Indian/Kerguelen', 'Indian/Mahe', 'Indian/Maldives', 'Indian/Mauritius', 'Indian/Mayotte', 'Indian/Reunion', 'Iran', 'Israel', 'Jamaica', 'Japan', 'Kwajalein', 'Libya', 'MET', 'MST', 'MST7MDT', 'Mexico/BajaNorte', 'Mexico/BajaSur', 'Mexico/General', 'NZ', 'NZ-CHAT', 'Navajo', 'PRC', 'PST8PDT', 'Pacific/Apia', 'Pacific/Auckland', 'Pacific/Bougainville', 'Pacific/Chatham', 'Pacific/Chuuk', 'Pacific/Easter', 'Pacific/Efate', 'Pacific/Enderbury', 'Pacific/Fakaofo', 'Pacific/Fiji', 'Pacific/Funafuti', 'Pacific/Galapagos', 'Pacific/Gambier', 'Pacific/Guadalcanal', 'Pacific/Guam', 'Pacific/Honolulu', 'Pacific/Johnston', 'Pacific/Kiritimati', 'Pacific/Kosrae', 'Pacific/Kwajalein', 'Pacific/Majuro', 'Pacific/Marquesas', 'Pacific/Midway', 'Pacific/Nauru', 'Pacific/Niue', 'Pacific/Norfolk', 'Pacific/Noumea', 'Pacific/Pago_Pago', 'Pacific/Palau', 'Pacific/Pitcairn', 'Pacific/Pohnpei', 'Pacific/Ponape', 'Pacific/Port_Moresby', 'Pacific/Rarotonga', 'Pacific/Saipan', 'Pacific/Samoa', 'Pacific/Tahiti', 'Pacific/Tarawa', 'Pacific/Tongatapu', 'Pacific/Truk', 'Pacific/Wake', 'Pacific/Wallis', 'Pacific/Yap', 'Poland', 'Portugal', 'ROC', 'ROK', 'Singapore', 'Turkey', 'UCT', 'US/Alaska', 'US/Aleutian', 'US/Arizona', 'US/Central', 'US/East-Indiana', 'US/Eastern', 'US/Hawaii', 'US/Indiana-Starke', 'US/Michigan', 'US/Mountain', 'US/Pacific', 'US/Pacific-New', 'US/Samoa', 'UTC', 'Universal', 'W-SU', 'WET', 'Zulu'];
package/lib/toArray.js ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Converts list into array
3
+ */
4
+ export default function toArray(list) {
5
+ return Array.prototype.slice.call(list || [], 0);
6
+ }
@@ -0,0 +1,5 @@
1
+ var toLowerCase = function toLowerCase() {
2
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
3
+ return value.toLowerCase();
4
+ };
5
+ export default toLowerCase;
@@ -0,0 +1,27 @@
1
+ var openFullscreen = function openFullscreen(element) {
2
+ if (element.requestFullscreen) {
3
+ element.requestFullscreen();
4
+ } else if (element.webkitRequestFullscreen) {
5
+ element.webkitRequestFullscreen();
6
+ } else if (element.msRequestFullscreen) {
7
+ element.msRequestFullscreen();
8
+ }
9
+ };
10
+ var closeFullscreen = function closeFullscreen() {
11
+ if (document.exitFullscreen) {
12
+ document.exitFullscreen();
13
+ } else if (document.webkitExitFullscreen) {
14
+ document.webkitExitFullscreen();
15
+ } else if (document.msExitFullscreen) {
16
+ document.msExitFullscreen();
17
+ }
18
+ };
19
+ var toggleElementFullscreen = function toggleElementFullscreen(element) {
20
+ var isFullscreened = Boolean(document.fullscreenElement);
21
+ if (isFullscreened) {
22
+ closeFullscreen();
23
+ return;
24
+ }
25
+ openFullscreen(element);
26
+ };
27
+ export default toggleElementFullscreen;
@@ -0,0 +1,39 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ // TODO (Dima) update the function description according to latest changes
8
+
9
+ import { VISIBILITY_OPTIONS } from './constants';
10
+ export var isVisibilityPublic = function isVisibilityPublic() {
11
+ var _visibility$in_cdn, _visibility$in_cdn$ac, _visibility$in_cdn$ac2;
12
+ var visibility = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
13
+ return (visibility === null || visibility === void 0 ? void 0 : (_visibility$in_cdn = visibility.in_cdn) === null || _visibility$in_cdn === void 0 ? void 0 : (_visibility$in_cdn$ac = _visibility$in_cdn.actual) === null || _visibility$in_cdn$ac === void 0 ? void 0 : (_visibility$in_cdn$ac2 = _visibility$in_cdn$ac.indexOf) === null || _visibility$in_cdn$ac2 === void 0 ? void 0 : _visibility$in_cdn$ac2.call(_visibility$in_cdn$ac, 'public')) === 0;
14
+ };
15
+ export var getActualVisibility = function getActualVisibility() {
16
+ var visibility = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17
+ return isVisibilityPublic(visibility) ? VISIBILITY_OPTIONS.PUBLIC.value : VISIBILITY_OPTIONS.NOT_PUBLIC.value;
18
+ };
19
+ export var getVisibilityObject = function getVisibilityObject() {
20
+ var visibility = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
21
+ return isVisibilityPublic(visibility) ? VISIBILITY_OPTIONS.PUBLIC : VISIBILITY_OPTIONS.NOT_PUBLIC;
22
+ };
23
+ export var getVisibilityI18nLabel = function getVisibilityI18nLabel() {
24
+ var _VISIBILITY_OPTIONS$v;
25
+ var visibility = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
26
+ return (_VISIBILITY_OPTIONS$v = VISIBILITY_OPTIONS[visibility.toUpperCase()]) === null || _VISIBILITY_OPTIONS$v === void 0 ? void 0 : _VISIBILITY_OPTIONS$v.i18nLabel;
27
+ };
28
+ export var getFileInheritedVisibility = function getFileInheritedVisibility() {
29
+ var _folderVisibility$vis, _folderVisibility$vis2;
30
+ var folderVisibility = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
31
+ return {
32
+ in_cdn: _objectSpread(_objectSpread({}, folderVisibility === null || folderVisibility === void 0 ? void 0 : (_folderVisibility$vis = folderVisibility.visibility) === null || _folderVisibility$vis === void 0 ? void 0 : _folderVisibility$vis.in_cdn), {}, {
33
+ set: 'inherited'
34
+ }),
35
+ in_dam: _objectSpread(_objectSpread({}, folderVisibility === null || folderVisibility === void 0 ? void 0 : (_folderVisibility$vis2 = folderVisibility.visibility) === null || _folderVisibility$vis2 === void 0 ? void 0 : _folderVisibility$vis2.in_dam), {}, {
36
+ set: 'inherited'
37
+ })
38
+ };
39
+ };
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@scaleflex/widget-utils",
3
+ "description": "Shared utility functions for filerobot modules",
4
+ "main": "lib/index.js",
5
+ "types": "types/index.d.ts",
6
+ "version": "0.0.1",
7
+ "files": [
8
+ "/dist",
9
+ "/lib",
10
+ "/types"
11
+ ],
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "license": "MIT",
16
+ "dependencies": {
17
+ "@scaleflex/icons": "^3.0.0-beta.11",
18
+ "@scaleflex/ui": "^3.0.0-beta.11",
19
+ "@scaleflex/widget-icons": "^0.0.1",
20
+ "abortcontroller-polyfill": "^1.4.0",
21
+ "dompurify": "^3.1.6",
22
+ "lodash.throttle": "^4.1.1"
23
+ },
24
+ "gitHead": "64ea82e745b7deda36d6794863350e6671e9010d"
25
+ }
@@ -0,0 +1,279 @@
1
+ declare module "@scaleflex/widget-utils/lib/Translator" {
2
+ namespace Translator {
3
+ export interface Locale {
4
+ strings?: {
5
+ [key: string]: string | { [plural: number]: string };
6
+ };
7
+ pluralize?: (n: number) => number;
8
+ }
9
+ }
10
+
11
+ class Translator {
12
+ constructor(opts: Translator.Locale | Translator.Locale[]);
13
+ }
14
+
15
+ export = Translator;
16
+ }
17
+
18
+ declare module "@scaleflex/widget-utils/lib/EventTracker" {
19
+ namespace EventTracker {
20
+ export type EventHandler = (...args: any[]) => void;
21
+ export interface Emitter {
22
+ on: (event: string, handler: EventHandler) => void;
23
+ off: (event: string, handler: EventHandler) => void;
24
+ }
25
+ }
26
+
27
+ class EventTracker {
28
+ constructor(emitter: EventTracker.Emitter);
29
+ on(event: string, handler: EventTracker.EventHandler): void;
30
+ remove(): void;
31
+ }
32
+
33
+ export = EventTracker;
34
+ }
35
+
36
+ declare module "@scaleflex/widget-utils/lib/ProgressTimeout" {
37
+ class ProgressTimeout {
38
+ constructor(timeout: number, timeoutHandler: () => void);
39
+ progress(): void;
40
+ done(): void;
41
+ }
42
+ export = ProgressTimeout;
43
+ }
44
+
45
+ declare module "@scaleflex/widget-utils/lib/RateLimitedQueue" {
46
+ namespace RateLimitedQueue {
47
+ export type AbortFunction = () => void;
48
+ export type PromiseFunction = (...args: any[]) => Promise<any>;
49
+ export type QueueEntry = {
50
+ abort: () => void;
51
+ done: () => void;
52
+ };
53
+ export type QueueOptions = {
54
+ priority?: number;
55
+ };
56
+ }
57
+
58
+ class RateLimitedQueue {
59
+ constructor(limit: number);
60
+ run(
61
+ fn: () => RateLimitedQueue.AbortFunction,
62
+ queueOptions?: RateLimitedQueue.QueueOptions
63
+ ): RateLimitedQueue.QueueEntry;
64
+ wrapPromiseFunction(
65
+ fn: () => RateLimitedQueue.PromiseFunction,
66
+ queueOptions?: RateLimitedQueue.QueueOptions
67
+ ): RateLimitedQueue.PromiseFunction;
68
+ }
69
+
70
+ export = RateLimitedQueue;
71
+ }
72
+
73
+ declare module "@scaleflex/widget-utils/lib/canvasToBlob" {
74
+ function canvasToBlob(
75
+ canvas: HTMLCanvasElement,
76
+ type: string,
77
+ quality?: number
78
+ ): Promise<Blob>;
79
+ export = canvasToBlob;
80
+ }
81
+
82
+ declare module "@scaleflex/widget-utils/lib/dataURItoBlob" {
83
+ function dataURItoBlob(
84
+ dataURI: string,
85
+ opts: { mimeType?: string; name?: string }
86
+ ): Blob;
87
+ export = dataURItoBlob;
88
+ }
89
+
90
+ declare module "@scaleflex/widget-utils/lib/dataURItoFile" {
91
+ function dataURItoFile(
92
+ dataURI: string,
93
+ opts: { mimeType?: string; name?: string }
94
+ ): File;
95
+ export = dataURItoFile;
96
+ }
97
+
98
+ declare module "@scaleflex/widget-utils/lib/emitSocketProgress" {
99
+ import FilerobotUtils = require("@scaleflex/widget-utils");
100
+
101
+ interface ProgressData {
102
+ progress: number;
103
+ bytesFinished: number;
104
+ bytesTotal: number;
105
+ }
106
+
107
+ function emitSocketProgress(
108
+ filerobot: object,
109
+ progressData: ProgressData,
110
+ file: FilerobotUtils.FilerobotFile
111
+ ): void;
112
+ export = emitSocketProgress;
113
+ }
114
+
115
+ declare module "@scaleflex/widget-utils/lib/findAllDOMElements" {
116
+ function findAllDOMElements(element: string | HTMLElement): HTMLElement[];
117
+ export = findAllDOMElements;
118
+ }
119
+
120
+ declare module "@scaleflex/widget-utils/lib/findDOMElement" {
121
+ function findDOMElement(element: string | HTMLElement): HTMLElement | null;
122
+ export = findDOMElement;
123
+ }
124
+
125
+ declare module "@scaleflex/widget-utils/lib/generateFileId" {
126
+ import FilerobotUtils = require("@scaleflex/widget-utils");
127
+
128
+ function generateFileId(file: FilerobotUtils.FilerobotFile): string;
129
+ export = generateFileId;
130
+ }
131
+
132
+ declare module "@scaleflex/widget-utils/lib/getBytesRemaining" {
133
+ function getBytesRemaining(files): number;
134
+ export = getBytesRemaining;
135
+ }
136
+
137
+ declare module "@scaleflex/widget-utils/lib/getETA" {
138
+ function getETA(progress: object): number;
139
+ export = getETA;
140
+ }
141
+
142
+ declare module "@scaleflex/widget-utils/lib/getFileNameAndExtension" {
143
+ function getFileNameAndExtension(filename: string): {
144
+ name: string;
145
+ extension: string | undefined;
146
+ };
147
+ export = getFileNameAndExtension;
148
+ }
149
+
150
+ declare module "@scaleflex/widget-utils/lib/getFileType" {
151
+ import FilerobotUtils = require("@scaleflex/widget-utils");
152
+
153
+ function getFileType(file: FilerobotUtils.FilerobotFile): string | null;
154
+ export = getFileType;
155
+ }
156
+
157
+ declare module "@scaleflex/widget-utils/lib/getFileTypeExtension" {
158
+ function getFileTypeExtension(mime: string): string;
159
+ export = getFileTypeExtension;
160
+ }
161
+
162
+ declare module "@scaleflex/widget-utils/lib/getSocketHost" {
163
+ function getSocketHost(url: string): string;
164
+ export = getSocketHost;
165
+ }
166
+
167
+ declare module "@scaleflex/widget-utils/lib/getSpeed" {
168
+ function getSpeed(progress: {
169
+ bytesTotal: number;
170
+ bytesFinished: number;
171
+ }): number;
172
+ export = getSpeed;
173
+ }
174
+
175
+ declare module "@scaleflex/widget-utils/lib/getTimeStamp" {
176
+ function getTimeStamp(): string;
177
+ export = getTimeStamp;
178
+ }
179
+
180
+ declare module "@scaleflex/widget-utils/lib/isDOMElement" {
181
+ function isDOMElement(element: any): boolean;
182
+ export = isDOMElement;
183
+ }
184
+
185
+ declare module "@scaleflex/widget-utils/lib/isObjectURL" {
186
+ function isObjectURL(url: string): boolean;
187
+ export = isObjectURL;
188
+ }
189
+
190
+ declare module "@scaleflex/widget-utils/lib/isDragDropSupported" {
191
+ function isDragDropSupported(): boolean;
192
+ export = isDragDropSupported;
193
+ }
194
+
195
+ declare module "@scaleflex/widget-utils/lib/isPreviewSupported" {
196
+ function isPreviewSupported(mime: string): boolean;
197
+ export = isPreviewSupported;
198
+ }
199
+
200
+ declare module "@scaleflex/widget-utils/lib/isTouchDevice" {
201
+ function isTouchDevice(): boolean;
202
+ export = isTouchDevice;
203
+ }
204
+
205
+ declare module "@scaleflex/widget-utils/lib/prettyETA" {
206
+ function prettyETA(seconds: number): string;
207
+ export = prettyETA;
208
+ }
209
+
210
+ declare module "@scaleflex/widget-utils/lib/secondsToTime" {
211
+ function secondsToTime(seconds: number): string;
212
+ export = secondsToTime;
213
+ }
214
+
215
+ declare module "@scaleflex/widget-utils/lib/settle" {
216
+ function settle<T>(
217
+ promises: Promise<T>[]
218
+ ): Promise<{ successful: T[]; failed: any[] }>;
219
+ export = settle;
220
+ }
221
+
222
+ declare module "@scaleflex/widget-utils/lib/toArray" {
223
+ function toArray(list: any): any[];
224
+ export = toArray;
225
+ }
226
+
227
+ declare module "@scaleflex/widget-utils/lib/getDroppedFiles" {
228
+ function getDroppedFiles(
229
+ dataTransfer: DataTransfer,
230
+ options?: object
231
+ ): Promise<File[]>;
232
+ export = getDroppedFiles;
233
+ }
234
+
235
+ declare module "@scaleflex/widget-utils" {
236
+ interface IndexedObject<T> {
237
+ [key: string]: T;
238
+ [key: number]: T;
239
+ }
240
+ export type InternalMetadata = { name: string; type?: string };
241
+ export interface FilerobotFile<
242
+ TMeta = IndexedObject<any>,
243
+ TBody = IndexedObject<any>
244
+ > {
245
+ data: Blob | File;
246
+ extension: string;
247
+ id: string;
248
+ isRemote: boolean;
249
+ meta: InternalMetadata & TMeta;
250
+ name: string;
251
+ preview?: string;
252
+ progress?: {
253
+ activity: string;
254
+ startedAt: number | null;
255
+ percentage: number;
256
+ bytesFinished: number;
257
+ bytesTotal: number;
258
+ status: string;
259
+ };
260
+ remote?: {
261
+ host: string;
262
+ url: string;
263
+ body?: object;
264
+ };
265
+ size: number;
266
+ source?: string;
267
+ type?: string;
268
+ response?: {
269
+ body: TBody;
270
+ status: number;
271
+ uploadURL: string | undefined;
272
+ };
273
+ }
274
+ export interface Store {
275
+ getState(): object;
276
+ setState(patch: object): void;
277
+ subscribe(listener: any): () => void;
278
+ }
279
+ }