@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.
- package/CHANGELOG.md +7100 -0
- package/LICENSE +21 -0
- package/README.md +58 -0
- package/lib/AbortController.js +20 -0
- package/lib/BlurHash/base83.js +10 -0
- package/lib/BlurHash/decode.js +80 -0
- package/lib/BlurHash/error.js +28 -0
- package/lib/BlurHash/utils.js +22 -0
- package/lib/CustomDate.js +157 -0
- package/lib/EventTracker.js +42 -0
- package/lib/FOCUSABLE_ELEMENTS.js +1 -0
- package/lib/LinkHelper.js +153 -0
- package/lib/NetworkError.js +30 -0
- package/lib/ProgressTimeout.js +45 -0
- package/lib/RateLimitedQueue.js +197 -0
- package/lib/RequestError.js +36 -0
- package/lib/Timeframes/getDateRange.js +45 -0
- package/lib/TranslationMissingKeysConsoleHelper.js +113 -0
- package/lib/Translator.js +200 -0
- package/lib/addUrlParams.js +27 -0
- package/lib/adjustUpdatedFolders.js +22 -0
- package/lib/asyncTimeout.js +6 -0
- package/lib/audioMimeTypes.js +3 -0
- package/lib/blobToDataURI.js +13 -0
- package/lib/callIfFunction.js +10 -0
- package/lib/canEditVideo.js +9 -0
- package/lib/canvasToBlob.js +18 -0
- package/lib/capitalizeFirstLetter.js +4 -0
- package/lib/checkConnection.js +4 -0
- package/lib/checkFileOrFolderNameValidation.js +4 -0
- package/lib/checkIfPngSvgGIF.js +3 -0
- package/lib/checkImageIfPngJpegOrWebpOrAvif.js +5 -0
- package/lib/checkItemsSupportExportWithReason.js +41 -0
- package/lib/checkPermissions.js +26 -0
- package/lib/cloudimageSupportedInputMimeTypes.js +2 -0
- package/lib/clsx.js +14 -0
- package/lib/constants.js +570 -0
- package/lib/convertBytesToMb.js +5 -0
- package/lib/convertGbToBytes.js +4 -0
- package/lib/convertVideoFileTypeToSupported.js +17 -0
- package/lib/copyText.js +25 -0
- package/lib/createFolderVirtualPath.js +14 -0
- package/lib/createThunk.js +349 -0
- package/lib/customEncodeURIComponent.js +47 -0
- package/lib/dataURItoBlob.js +33 -0
- package/lib/dataURItoFile.js +4 -0
- package/lib/dateStrToClearDateTime.js +20 -0
- package/lib/debounce.js +14 -0
- package/lib/deepEqual.js +23 -0
- package/lib/deepMerge.js +56 -0
- package/lib/deserializeFunction.js +5 -0
- package/lib/documentMimeTypes.js +2 -0
- package/lib/downloadFromBlob.js +16 -0
- package/lib/emitSocketProgress.js +18 -0
- package/lib/escapeRegExp.js +4 -0
- package/lib/extractFileDataNoBlob.js +12 -0
- package/lib/fetchWithNetworkError.js +14 -0
- package/lib/fieldsQueriesGetters.js +46 -0
- package/lib/findAllDOMElements.js +18 -0
- package/lib/findAllRegexMatchesInString.js +16 -0
- package/lib/findDOMElement.js +17 -0
- package/lib/findIndex.js +9 -0
- package/lib/formatDuration.js +22 -0
- package/lib/formatNumbers.js +32 -0
- package/lib/formatResolution.js +17 -0
- package/lib/formatSeconds.js +14 -0
- package/lib/generateFileId.js +53 -0
- package/lib/generateI18nKeyFromString.js +11 -0
- package/lib/generatePsdThumbnail/adaptHexBoundries.js +9 -0
- package/lib/generatePsdThumbnail/bufferToHex.js +12 -0
- package/lib/generatePsdThumbnail/generatePsdThumbnail.js +36 -0
- package/lib/generatePsdThumbnail/generatePsdThumbnailBytes.js +8 -0
- package/lib/generatePsdThumbnail/generatePsdThumbnailHex.js +4 -0
- package/lib/generateSelectInputPlaceholder.js +24 -0
- package/lib/getActionErrorState.js +17 -0
- package/lib/getArraysMutualObjects.js +12 -0
- package/lib/getBytesRemaining.js +9 -0
- package/lib/getClientTimezone.js +5 -0
- package/lib/getCloudimagePrefixedUrl.js +23 -0
- package/lib/getDateDaysFromNow.js +17 -0
- package/lib/getDateMinusDay.js +5 -0
- package/lib/getDateString.js +20 -0
- package/lib/getDaysLeft.js +9 -0
- package/lib/getDecodedUriComponent.js +10 -0
- package/lib/getDownloadSpeed.js +7 -0
- package/lib/getDroppedFiles/index.js +24 -0
- package/lib/getDroppedFiles/utils/fallbackApi.js +7 -0
- package/lib/getDroppedFiles/utils/webkitGetAsEntryApi/getFilesAndDirectoriesFromDirectory.js +36 -0
- package/lib/getDroppedFiles/utils/webkitGetAsEntryApi/getRelativePath.js +16 -0
- package/lib/getDroppedFiles/utils/webkitGetAsEntryApi/index.js +57 -0
- package/lib/getEncodedWrappedUrl.js +7 -0
- package/lib/getFileAssetsTokenUrl.js +14 -0
- package/lib/getFileCdnLink.js +6 -0
- package/lib/getFileDefaultIcon.js +14 -0
- package/lib/getFileDetails.js +81 -0
- package/lib/getFileExtension.js +32 -0
- package/lib/getFileLink.js +17 -0
- package/lib/getFileNameAndExtension.js +22 -0
- package/lib/getFileType.js +23 -0
- package/lib/getFileTypeExtension.js +22 -0
- package/lib/getFilterFileFormatIcon.js +6 -0
- package/lib/getFolderDetails.js +30 -0
- package/lib/getFormattedPreviewUrl.js +79 -0
- package/lib/getHoursAndMinutes.js +9 -0
- package/lib/getImageEditUrl.js +36 -0
- package/lib/getImgFileDimensions.js +25 -0
- package/lib/getItemIcon.js +112 -0
- package/lib/getItemPath.js +10 -0
- package/lib/getItemPreviewWidthHeight.js +10 -0
- package/lib/getItemsSizeInBytes.js +12 -0
- package/lib/getJsonParsedValue.js +11 -0
- package/lib/getLinkWithNewParams.js +13 -0
- package/lib/getMetadataMultiSelectQuery.js +66 -0
- package/lib/getNormalizedItems.js +55 -0
- package/lib/getObjectsMutualProperties.js +32 -0
- package/lib/getRandomNumber.js +12 -0
- package/lib/getSocketHost.js +7 -0
- package/lib/getSpeed.js +8 -0
- package/lib/getTime.js +18 -0
- package/lib/getTimeStamp.js +18 -0
- package/lib/handleError.js +13 -0
- package/lib/handlePressEnter.js +9 -0
- package/lib/handlePromise.js +39 -0
- package/lib/hasProperty.js +3 -0
- package/lib/hexToRgb.js +15 -0
- package/lib/htmlSanitizer.js +6 -0
- package/lib/humanReadableDate.js +45 -0
- package/lib/humanReadableDateWithTranslations.js +29 -0
- package/lib/i18n.client.js +54 -0
- package/lib/ignoreEvent.js +10 -0
- package/lib/index.js +0 -0
- package/lib/injectVirtualPathToFolders.js +24 -0
- package/lib/isAi.js +7 -0
- package/lib/isArchive.js +12 -0
- package/lib/isAudio.js +9 -0
- package/lib/isAudioAndSupportsPlayback.js +10 -0
- package/lib/isCloudimageFastPreviewSupported.js +16 -0
- package/lib/isDOMElement.js +9 -0
- package/lib/isDocument.js +10 -0
- package/lib/isDragDropSupported.js +20 -0
- package/lib/isEmptyObject.js +4 -0
- package/lib/isEps.js +8 -0
- package/lib/isFile.js +5 -0
- package/lib/isFileSupportedByCloudimage.js +14 -0
- package/lib/isFolder.js +4 -0
- package/lib/isFontFile.js +9 -0
- package/lib/isFunction.js +4 -0
- package/lib/isImage.js +11 -0
- package/lib/isJpg.js +8 -0
- package/lib/isMobileDevice.js +12 -0
- package/lib/isNetworkError.js +7 -0
- package/lib/isNumber.js +4 -0
- package/lib/isObjectType.js +5 -0
- package/lib/isObjectURL.js +10 -0
- package/lib/isOpenedFromAdobe.js +3 -0
- package/lib/isOtf.js +10 -0
- package/lib/isPdf.js +9 -0
- package/lib/isPhotoshopFile.js +8 -0
- package/lib/isPreviewSupported.js +12 -0
- package/lib/isPromise.js +5 -0
- package/lib/isPsd.js +8 -0
- package/lib/isScriptFile.js +12 -0
- package/lib/isSupportedVideo.js +8 -0
- package/lib/isSvg.js +5 -0
- package/lib/isTextFile.js +8 -0
- package/lib/isThumbnailCloudimgSupported.js +13 -0
- package/lib/isThumbnailLocallySupported.js +9 -0
- package/lib/isTiff.js +8 -0
- package/lib/isTransparencySupported.js +12 -0
- package/lib/isTtf.js +11 -0
- package/lib/isUploadableFile.js +7 -0
- package/lib/isUrl.js +5 -0
- package/lib/isValidUri.js +18 -0
- package/lib/isVideo.js +8 -0
- package/lib/isVideoResourceIntensive.js +9 -0
- package/lib/literalDateFromDateObj.js +6 -0
- package/lib/logErrorIfDevEnv.js +7 -0
- package/lib/lowercaseFirstLetter.js +4 -0
- package/lib/mapArrayByStep.js +12 -0
- package/lib/metadata/checkFieldValidation.js +51 -0
- package/lib/metadata/generateItemMetadataState.js +63 -0
- package/lib/metadata/generateMetadataDefaultState.js +30 -0
- package/lib/metadata/getFileCustomMetadataGroups.js +23 -0
- package/lib/metadata/getGeoPointValidationErrors.js +32 -0
- package/lib/metadata/getMetaAttachmentFields.js +9 -0
- package/lib/metadata/getMetadataEmptyAssets.js +28 -0
- package/lib/metadata/getMetadataFieldGeoPointValue.js +42 -0
- package/lib/metadata/getMetadataFieldVariantValue.js +31 -0
- package/lib/metadata/getMetadataGroups.js +16 -0
- package/lib/metadata/getRequiredMetadataFields.js +13 -0
- package/lib/metadata/isM0LegacyMetaVersion.js +5 -0
- package/lib/metadata/isM1EdgyMetaVersion.js +5 -0
- package/lib/metadata/mapMetaAttachmentsObjsToUuids.js +21 -0
- package/lib/metadata/updateValidationErrors.js +59 -0
- package/lib/metadata/validateItemMetadata.js +70 -0
- package/lib/mimeTypes.js +60 -0
- package/lib/nanoid.js +18 -0
- package/lib/openLink.js +3 -0
- package/lib/openLinkInNewTab.js +12 -0
- package/lib/prettyETA.js +15 -0
- package/lib/prettyFileSize.js +7 -0
- package/lib/preventDefault.js +4 -0
- package/lib/provideSvgStrWithCurrColor.js +10 -0
- package/lib/recursiveFnCall.js +26 -0
- package/lib/removeAllUrlParams.js +4 -0
- package/lib/removeDuplicatesFromArray.js +20 -0
- package/lib/removeEmptyFolders.js +8 -0
- package/lib/removeFileExtension.js +4 -0
- package/lib/removeUrlParamsWithRegex.js +14 -0
- package/lib/reorder.js +15 -0
- package/lib/requestFile.js +36 -0
- package/lib/rgbToHex.js +4 -0
- package/lib/secondsToTime.js +10 -0
- package/lib/serializeFunction.js +4 -0
- package/lib/settle.js +19 -0
- package/lib/sortEntitiesByName.js +18 -0
- package/lib/splitCamelCase.js +4 -0
- package/lib/splitPathToPathsAndNames.js +25 -0
- package/lib/stopPropagation.js +4 -0
- package/lib/styledComponentsMixins/truncate.mixin.js +8 -0
- package/lib/timeZones.js +1 -0
- package/lib/toArray.js +6 -0
- package/lib/toLowerCase.js +5 -0
- package/lib/toggleElementFullscreen.js +27 -0
- package/lib/visibility.js +39 -0
- package/package.json +25 -0
- 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,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,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;
|
package/lib/timeZones.js
ADDED
|
@@ -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,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
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -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
|
+
}
|