@bbn/bbn 1.0.59 → 1.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_.js +1 -1
- package/dist/bundle.d.ts +3804 -242
- package/dist/bundle.js +4061 -502
- package/dist/db.js +3 -3
- package/dist/fn/ajax/_addLoader.d.ts +16 -0
- package/dist/fn/ajax/_addLoader.js +51 -0
- package/dist/fn/ajax/_deleteLoader.d.ts +16 -0
- package/dist/fn/ajax/_deleteLoader.js +39 -0
- package/dist/fn/ajax/abort.d.ts +24 -0
- package/dist/fn/ajax/abort.js +36 -0
- package/dist/fn/ajax/abortURL.d.ts +22 -0
- package/dist/fn/ajax/abortURL.js +33 -0
- package/dist/fn/ajax/ajax.d.ts +58 -0
- package/dist/fn/ajax/ajax.js +170 -0
- package/dist/fn/ajax/callback.d.ts +37 -0
- package/dist/fn/ajax/callback.js +117 -0
- package/dist/fn/ajax/download.d.ts +30 -0
- package/dist/fn/ajax/download.js +64 -0
- package/dist/fn/ajax/downloadContent.d.ts +28 -0
- package/dist/fn/ajax/downloadContent.js +74 -0
- package/dist/fn/ajax/getLoader.d.ts +37 -0
- package/dist/fn/ajax/getLoader.js +44 -0
- package/dist/fn/ajax/getRequestId.d.ts +50 -0
- package/dist/fn/ajax/getRequestId.js +62 -0
- package/dist/fn/ajax/link.d.ts +26 -0
- package/dist/fn/ajax/link.js +129 -0
- package/dist/fn/ajax/post.d.ts +35 -0
- package/dist/fn/ajax/post.js +45 -0
- package/dist/fn/ajax/postOut.d.ts +21 -0
- package/dist/fn/ajax/postOut.js +49 -0
- package/dist/fn/ajax/setNavigationVars.d.ts +25 -0
- package/dist/fn/ajax/setNavigationVars.js +80 -0
- package/dist/fn/ajax/treatAjaxArguments.d.ts +53 -0
- package/dist/fn/ajax/treatAjaxArguments.js +127 -0
- package/dist/fn/ajax/upload.d.ts +18 -0
- package/dist/fn/ajax/upload.js +52 -0
- package/dist/fn/browser/copy.d.ts +15 -0
- package/dist/fn/browser/copy.js +50 -0
- package/dist/fn/browser/eraseCookie.d.ts +15 -0
- package/dist/fn/browser/eraseCookie.js +17 -0
- package/dist/fn/browser/error.d.ts +14 -0
- package/dist/fn/browser/error.js +29 -0
- package/dist/fn/browser/getBrowserName.d.ts +9 -0
- package/dist/fn/browser/getBrowserName.js +28 -0
- package/dist/fn/browser/getBrowserVersion.d.ts +9 -0
- package/dist/fn/browser/getBrowserVersion.js +29 -0
- package/dist/fn/browser/getCookie.d.ts +16 -0
- package/dist/fn/browser/getCookie.js +32 -0
- package/dist/fn/browser/getDeviceType.d.ts +14 -0
- package/dist/fn/browser/getDeviceType.js +23 -0
- package/dist/fn/browser/getEventData.d.ts +16 -0
- package/dist/fn/browser/getEventData.js +116 -0
- package/dist/fn/browser/happy.d.ts +14 -0
- package/dist/fn/browser/happy.js +22 -0
- package/dist/fn/browser/history.d.ts +2 -0
- package/dist/fn/browser/history.js +4 -0
- package/dist/fn/browser/info.d.ts +10 -0
- package/dist/fn/browser/info.js +19 -0
- package/dist/fn/browser/isActiveInterface.d.ts +14 -0
- package/dist/fn/browser/isActiveInterface.js +20 -0
- package/dist/fn/browser/isDesktopDevice.d.ts +14 -0
- package/dist/fn/browser/isDesktopDevice.js +17 -0
- package/dist/fn/browser/isFocused.d.ts +21 -0
- package/dist/fn/browser/isFocused.js +23 -0
- package/dist/fn/browser/isMobile.d.ts +14 -0
- package/dist/fn/browser/isMobile.js +18 -0
- package/dist/fn/browser/isMobileDevice.d.ts +2 -0
- package/dist/fn/browser/isMobileDevice.js +5 -0
- package/dist/fn/browser/isTabletDevice.d.ts +14 -0
- package/dist/fn/browser/isTabletDevice.js +17 -0
- package/dist/fn/browser/log.d.ts +15 -0
- package/dist/fn/browser/log.js +46 -0
- package/dist/fn/browser/replaceSelection.d.ts +2 -0
- package/dist/fn/browser/replaceSelection.js +42 -0
- package/dist/fn/browser/selectElementText.d.ts +21 -0
- package/dist/fn/browser/selectElementText.js +42 -0
- package/dist/fn/browser/setCookie.d.ts +16 -0
- package/dist/fn/browser/setCookie.js +25 -0
- package/dist/fn/browser/toggleFullScreen.d.ts +2 -0
- package/dist/fn/browser/toggleFullScreen.js +39 -0
- package/dist/fn/browser/warning.d.ts +14 -0
- package/dist/fn/browser/warning.js +24 -0
- package/dist/fn/convert/arrayBuffer2String.d.ts +2 -0
- package/dist/fn/convert/arrayBuffer2String.js +4 -0
- package/dist/fn/convert/canvasToImage.d.ts +16 -0
- package/dist/fn/convert/canvasToImage.js +20 -0
- package/dist/fn/convert/colorToHex.d.ts +20 -0
- package/dist/fn/convert/colorToHex.js +24 -0
- package/dist/fn/convert/fromXml.d.ts +12 -0
- package/dist/fn/convert/fromXml.js +54 -0
- package/dist/fn/convert/hex2rgb.d.ts +24 -0
- package/dist/fn/convert/hex2rgb.js +29 -0
- package/dist/fn/convert/imageToCanvas.d.ts +15 -0
- package/dist/fn/convert/imageToCanvas.js +21 -0
- package/dist/fn/convert/imgToBase64.d.ts +2 -0
- package/dist/fn/convert/imgToBase64.js +7 -0
- package/dist/fn/convert/rgb2hex.d.ts +20 -0
- package/dist/fn/convert/rgb2hex.js +28 -0
- package/dist/fn/convert/string2ArrayBuffer.d.ts +2 -0
- package/dist/fn/convert/string2ArrayBuffer.js +9 -0
- package/dist/fn/convert/toCSV.d.ts +26 -0
- package/dist/fn/convert/toCSV.js +64 -0
- package/dist/fn/datetime/calendar.d.ts +2 -0
- package/dist/fn/datetime/calendar.js +23 -0
- package/dist/fn/datetime/chrono.d.ts +25 -0
- package/dist/fn/datetime/chrono.js +45 -0
- package/dist/fn/datetime/date.d.ts +18 -0
- package/dist/fn/datetime/date.js +44 -0
- package/dist/fn/datetime/dateSQL.d.ts +20 -0
- package/dist/fn/datetime/dateSQL.js +26 -0
- package/dist/fn/datetime/daysInMonth.d.ts +17 -0
- package/dist/fn/datetime/daysInMonth.js +24 -0
- package/dist/fn/datetime/fdate.d.ts +11 -0
- package/dist/fn/datetime/fdate.js +28 -0
- package/dist/fn/datetime/fdatetime.d.ts +9 -0
- package/dist/fn/datetime/fdatetime.js +30 -0
- package/dist/fn/datetime/formatDate.d.ts +2 -0
- package/dist/fn/datetime/formatDate.js +4 -0
- package/dist/fn/datetime/ftime.d.ts +9 -0
- package/dist/fn/datetime/ftime.js +21 -0
- package/dist/fn/datetime/getDay.d.ts +11 -0
- package/dist/fn/datetime/getDay.js +26 -0
- package/dist/fn/datetime/timestamp.d.ts +15 -0
- package/dist/fn/datetime/timestamp.js +18 -0
- package/dist/fn/default/defaultAjaxAbortFunction.d.ts +2 -0
- package/dist/fn/default/defaultAjaxAbortFunction.js +5 -0
- package/dist/fn/default/defaultAjaxErrorFunction.d.ts +2 -0
- package/dist/fn/default/defaultAjaxErrorFunction.js +4 -0
- package/dist/fn/default/defaultAlertFunction.d.ts +2 -0
- package/dist/fn/default/defaultAlertFunction.js +5 -0
- package/dist/fn/default/defaultConfirmFunction.d.ts +2 -0
- package/dist/fn/default/defaultConfirmFunction.js +14 -0
- package/dist/fn/default/defaultEndLoadingFunction.d.ts +2 -0
- package/dist/fn/default/defaultEndLoadingFunction.js +4 -0
- package/dist/fn/default/defaultErrorFunction.d.ts +2 -0
- package/dist/fn/default/defaultErrorFunction.js +5 -0
- package/dist/fn/default/defaultHistoryFunction.d.ts +2 -0
- package/dist/fn/default/defaultHistoryFunction.js +4 -0
- package/dist/fn/default/defaultLinkFunction.d.ts +2 -0
- package/dist/fn/default/defaultLinkFunction.js +4 -0
- package/dist/fn/default/defaultPostLinkFunction.d.ts +2 -0
- package/dist/fn/default/defaultPostLinkFunction.js +4 -0
- package/dist/fn/default/defaultPreLinkFunction.d.ts +2 -0
- package/dist/fn/default/defaultPreLinkFunction.js +4 -0
- package/dist/fn/default/defaultResizeFunction.d.ts +2 -0
- package/dist/fn/default/defaultResizeFunction.js +4 -0
- package/dist/fn/default/defaultStartLoadingFunction.d.ts +2 -0
- package/dist/fn/default/defaultStartLoadingFunction.js +4 -0
- package/dist/fn/form/addInputs.d.ts +43 -0
- package/dist/fn/form/addInputs.js +81 -0
- package/dist/fn/form/fieldValue.d.ts +12 -0
- package/dist/fn/form/fieldValue.js +34 -0
- package/dist/fn/form/formdata.d.ts +45 -0
- package/dist/fn/form/formdata.js +95 -0
- package/dist/fn/form/objectToFormData.d.ts +12 -0
- package/dist/fn/form/objectToFormData.js +45 -0
- package/dist/fn/form/submit.d.ts +20 -0
- package/dist/fn/form/submit.js +51 -0
- package/dist/fn/html/adjustHeight.d.ts +2 -0
- package/dist/fn/html/adjustHeight.js +10 -0
- package/dist/fn/html/adjustSize.d.ts +2 -0
- package/dist/fn/html/adjustSize.js +21 -0
- package/dist/fn/html/adjustWidth.d.ts +2 -0
- package/dist/fn/html/adjustWidth.js +10 -0
- package/dist/fn/html/getAllTags.d.ts +6 -0
- package/dist/fn/html/getAllTags.js +9 -0
- package/dist/fn/html/getAncestors.d.ts +2 -0
- package/dist/fn/html/getAncestors.js +25 -0
- package/dist/fn/html/getAttributes.d.ts +6 -0
- package/dist/fn/html/getAttributes.js +16 -0
- package/dist/fn/html/getHTMLOfSelection.d.ts +2 -0
- package/dist/fn/html/getHTMLOfSelection.js +18 -0
- package/dist/fn/html/getHtml.d.ts +2 -0
- package/dist/fn/html/getHtml.js +9 -0
- package/dist/fn/html/getPath.d.ts +10 -0
- package/dist/fn/html/getPath.js +50 -0
- package/dist/fn/html/getText.d.ts +2 -0
- package/dist/fn/html/getText.js +4 -0
- package/dist/fn/html/html2text.d.ts +17 -0
- package/dist/fn/html/html2text.js +22 -0
- package/dist/fn/html/isInside.d.ts +2 -0
- package/dist/fn/html/isInside.js +23 -0
- package/dist/fn/html/makeReactive.d.ts +2 -0
- package/dist/fn/html/makeReactive.js +185 -0
- package/dist/fn/html/selector.d.ts +10 -0
- package/dist/fn/html/selector.js +12 -0
- package/dist/fn/init.d.ts +13 -0
- package/dist/fn/init.js +25 -12
- package/dist/fn/loop/each.d.ts +33 -0
- package/dist/fn/loop/each.js +54 -0
- package/dist/fn/loop/fori.d.ts +36 -0
- package/dist/fn/loop/fori.js +53 -0
- package/dist/fn/loop/forir.d.ts +36 -0
- package/dist/fn/loop/forir.js +53 -0
- package/dist/fn/loop/iterate.d.ts +22 -0
- package/dist/fn/loop/iterate.js +36 -0
- package/dist/fn/loop/riterate.d.ts +21 -0
- package/dist/fn/loop/riterate.js +24 -0
- package/dist/fn/misc/analyzeFunction.d.ts +11 -0
- package/dist/fn/misc/analyzeFunction.js +141 -0
- package/dist/fn/misc/getTimeoff.d.ts +14 -0
- package/dist/fn/misc/getTimeoff.js +19 -0
- package/dist/fn/misc/money.d.ts +23 -0
- package/dist/fn/misc/money.js +122 -0
- package/dist/fn/misc/percent.d.ts +23 -0
- package/dist/fn/misc/percent.js +25 -0
- package/dist/fn/misc/randomInt.d.ts +22 -0
- package/dist/fn/misc/randomInt.js +24 -0
- package/dist/fn/misc/roundDecimal.d.ts +11 -0
- package/dist/fn/misc/roundDecimal.js +13 -0
- package/dist/fn/misc/translate.d.ts +2 -0
- package/dist/fn/misc/translate.js +8 -0
- package/dist/fn/object/_compareValues.d.ts +40 -0
- package/dist/fn/object/_compareValues.js +78 -0
- package/dist/fn/object/arrayFromProp.d.ts +33 -0
- package/dist/fn/object/arrayFromProp.js +41 -0
- package/dist/fn/object/autoExtend.d.ts +33 -0
- package/dist/fn/object/autoExtend.js +44 -0
- package/dist/fn/object/checkProps.d.ts +2 -0
- package/dist/fn/object/checkProps.js +5 -0
- package/dist/fn/object/checkPropsDetails.d.ts +2 -0
- package/dist/fn/object/checkPropsDetails.js +53 -0
- package/dist/fn/object/checkPropsOrDie.d.ts +2 -0
- package/dist/fn/object/checkPropsOrDie.js +9 -0
- package/dist/fn/object/circularReplacer.d.ts +7 -0
- package/dist/fn/object/circularReplacer.js +39 -0
- package/dist/fn/object/clone.d.ts +19 -0
- package/dist/fn/object/clone.js +33 -0
- package/dist/fn/object/compare.d.ts +53 -0
- package/dist/fn/object/compare.js +150 -0
- package/dist/fn/object/compareConditions.d.ts +46 -0
- package/dist/fn/object/compareConditions.js +86 -0
- package/dist/fn/object/count.d.ts +56 -0
- package/dist/fn/object/count.js +59 -0
- package/dist/fn/object/createObject.d.ts +2 -0
- package/dist/fn/object/createObject.js +9 -0
- package/dist/fn/object/deepPath.d.ts +57 -0
- package/dist/fn/object/deepPath.js +78 -0
- package/dist/fn/object/deleteProp.d.ts +8 -0
- package/dist/fn/object/deleteProp.js +13 -0
- package/dist/fn/object/diffObj.d.ts +79 -0
- package/dist/fn/object/diffObj.js +168 -0
- package/dist/fn/object/extend.d.ts +87 -0
- package/dist/fn/object/extend.js +158 -0
- package/dist/fn/object/extendOut.d.ts +18 -0
- package/dist/fn/object/extendOut.js +40 -0
- package/dist/fn/object/filter.d.ts +50 -0
- package/dist/fn/object/filter.js +94 -0
- package/dist/fn/object/filterToConditions.d.ts +48 -0
- package/dist/fn/object/filterToConditions.js +68 -0
- package/dist/fn/object/findAll.d.ts +57 -0
- package/dist/fn/object/findAll.js +73 -0
- package/dist/fn/object/getField.d.ts +30 -0
- package/dist/fn/object/getField.js +37 -0
- package/dist/fn/object/getFieldValues.d.ts +30 -0
- package/dist/fn/object/getFieldValues.js +41 -0
- package/dist/fn/object/getProp.d.ts +8 -0
- package/dist/fn/object/getProp.js +13 -0
- package/dist/fn/object/getProperty.d.ts +30 -0
- package/dist/fn/object/getProperty.js +39 -0
- package/dist/fn/object/getRow.d.ts +42 -0
- package/dist/fn/object/getRow.js +49 -0
- package/dist/fn/object/map.d.ts +74 -0
- package/dist/fn/object/map.js +83 -0
- package/dist/fn/object/move.d.ts +34 -0
- package/dist/fn/object/move.js +43 -0
- package/dist/fn/object/multiorder.d.ts +40 -0
- package/dist/fn/object/multiorder.js +60 -0
- package/dist/fn/object/numProperties.d.ts +31 -0
- package/dist/fn/object/numProperties.js +36 -0
- package/dist/fn/object/order.d.ts +28 -0
- package/dist/fn/object/order.js +36 -0
- package/dist/fn/object/pickValue.d.ts +2 -0
- package/dist/fn/object/pickValue.js +6 -0
- package/dist/fn/object/removeEmpty.d.ts +18 -0
- package/dist/fn/object/removeEmpty.js +47 -0
- package/dist/fn/object/removePrivateProp.d.ts +24 -0
- package/dist/fn/object/removePrivateProp.js +41 -0
- package/dist/fn/object/search.d.ts +101 -0
- package/dist/fn/object/search.js +177 -0
- package/dist/fn/object/setProp.d.ts +11 -0
- package/dist/fn/object/setProp.js +17 -0
- package/dist/fn/object/setProperty.d.ts +30 -0
- package/dist/fn/object/setProperty.js +50 -0
- package/dist/fn/object/shortenObj.d.ts +25 -0
- package/dist/fn/object/shortenObj.js +40 -0
- package/dist/fn/object/shuffle.d.ts +2 -0
- package/dist/fn/object/shuffle.js +13 -0
- package/dist/fn/object/stat.d.ts +2 -0
- package/dist/fn/object/stat.js +49 -0
- package/dist/fn/object/sum.d.ts +46 -0
- package/dist/fn/object/sum.js +57 -0
- package/dist/fn/object/unique.d.ts +18 -0
- package/dist/fn/object/unique.js +22 -0
- package/dist/fn/string/baseName.d.ts +24 -0
- package/dist/fn/string/baseName.js +39 -0
- package/dist/fn/string/br2nl.d.ts +19 -0
- package/dist/fn/string/br2nl.js +22 -0
- package/dist/fn/string/camelToCss.d.ts +18 -0
- package/dist/fn/string/camelToCss.js +26 -0
- package/dist/fn/string/camelize.d.ts +20 -0
- package/dist/fn/string/camelize.js +27 -0
- package/dist/fn/string/correctCase.d.ts +18 -0
- package/dist/fn/string/correctCase.js +20 -0
- package/dist/fn/string/crc32.d.ts +2 -0
- package/dist/fn/string/crc32.js +20 -0
- package/dist/fn/string/dirName.d.ts +17 -0
- package/dist/fn/string/dirName.js +33 -0
- package/dist/fn/string/escapeDquotes.d.ts +2 -0
- package/dist/fn/string/escapeDquotes.js +8 -0
- package/dist/fn/string/escapeRegExp.d.ts +19 -0
- package/dist/fn/string/escapeRegExp.js +21 -0
- package/dist/fn/string/escapeSquotes.d.ts +2 -0
- package/dist/fn/string/escapeSquotes.js +8 -0
- package/dist/fn/string/escapeTicks.d.ts +2 -0
- package/dist/fn/string/escapeTicks.js +8 -0
- package/dist/fn/string/escapeUrl.d.ts +9 -0
- package/dist/fn/string/escapeUrl.js +47 -0
- package/dist/fn/string/fileExt.d.ts +38 -0
- package/dist/fn/string/fileExt.js +47 -0
- package/dist/fn/string/format.d.ts +2 -0
- package/dist/fn/string/format.js +14 -0
- package/dist/fn/string/formatBytes.d.ts +14 -0
- package/dist/fn/string/formatBytes.js +20 -0
- package/dist/fn/string/formatSize.d.ts +2 -0
- package/dist/fn/string/formatSize.js +12 -0
- package/dist/fn/string/hash.d.ts +7 -0
- package/dist/fn/string/hash.js +42 -0
- package/dist/fn/string/md5.d.ts +22 -0
- package/dist/fn/string/md5.js +142 -0
- package/dist/fn/string/nl2br.d.ts +17 -0
- package/dist/fn/string/nl2br.js +20 -0
- package/dist/fn/string/printf.d.ts +10 -0
- package/dist/fn/string/printf.js +15 -0
- package/dist/fn/string/quotes2html.d.ts +30 -0
- package/dist/fn/string/quotes2html.js +39 -0
- package/dist/fn/string/randomString.d.ts +28 -0
- package/dist/fn/string/randomString.js +72 -0
- package/dist/fn/string/removeAccents.d.ts +17 -0
- package/dist/fn/string/removeAccents.js +30 -0
- package/dist/fn/string/removeExtraSpaces.d.ts +7 -0
- package/dist/fn/string/removeExtraSpaces.js +9 -0
- package/dist/fn/string/removeHtmlComments.d.ts +2 -0
- package/dist/fn/string/removeHtmlComments.js +8 -0
- package/dist/fn/string/removeTrailingChars.d.ts +11 -0
- package/dist/fn/string/removeTrailingChars.js +25 -0
- package/dist/fn/string/repeat.d.ts +16 -0
- package/dist/fn/string/repeat.js +18 -0
- package/dist/fn/string/replaceAll.d.ts +23 -0
- package/dist/fn/string/replaceAll.js +29 -0
- package/dist/fn/string/sanitize.d.ts +17 -0
- package/dist/fn/string/sanitize.js +34 -0
- package/dist/fn/string/shorten.d.ts +27 -0
- package/dist/fn/string/shorten.js +42 -0
- package/dist/fn/string/simpleHash.d.ts +2 -0
- package/dist/fn/string/simpleHash.js +8 -0
- package/dist/fn/string/simpleHash1.d.ts +2 -0
- package/dist/fn/string/simpleHash1.js +10 -0
- package/dist/fn/string/simpleHash2.d.ts +2 -0
- package/dist/fn/string/simpleHash2.js +10 -0
- package/dist/fn/string/substr.d.ts +23 -0
- package/dist/fn/string/substr.js +38 -0
- package/dist/fn/string/trim.d.ts +2 -0
- package/dist/fn/string/trim.js +20 -0
- package/dist/fn/string/uniqString.d.ts +18 -0
- package/dist/fn/string/uniqString.js +49 -0
- package/dist/fn/style/addColors.d.ts +17 -0
- package/dist/fn/style/addColors.js +76 -0
- package/dist/fn/style/addStyle.d.ts +12 -0
- package/dist/fn/style/addStyle.js +20 -0
- package/dist/fn/style/animateCss.d.ts +13 -0
- package/dist/fn/style/animateCss.js +31 -0
- package/dist/fn/style/center.d.ts +16 -0
- package/dist/fn/style/center.js +40 -0
- package/dist/fn/style/cssExists.d.ts +12 -0
- package/dist/fn/style/cssExists.js +40 -0
- package/dist/fn/style/getCssVar.d.ts +7 -0
- package/dist/fn/style/getCssVar.js +12 -0
- package/dist/fn/style/getScrollBarSize.d.ts +2 -0
- package/dist/fn/style/getScrollBarSize.js +25 -0
- package/dist/fn/style/lightenDarkenHex.d.ts +20 -0
- package/dist/fn/style/lightenDarkenHex.js +45 -0
- package/dist/fn/style/outerHeight.d.ts +11 -0
- package/dist/fn/style/outerHeight.js +19 -0
- package/dist/fn/style/outerWidth.d.ts +10 -0
- package/dist/fn/style/outerWidth.js +16 -0
- package/dist/fn/style/resize.d.ts +2 -0
- package/dist/fn/style/resize.js +39 -0
- package/dist/fn/style/setCssVar.d.ts +8 -0
- package/dist/fn/style/setCssVar.js +14 -0
- package/dist/fn/type/checkType.d.ts +2 -0
- package/dist/fn/type/checkType.js +59 -0
- package/dist/fn/type/isArray.d.ts +14 -0
- package/dist/fn/type/isArray.js +23 -0
- package/dist/fn/type/isBlob.d.ts +9 -0
- package/dist/fn/type/isBlob.js +18 -0
- package/dist/fn/type/isBoolean.d.ts +16 -0
- package/dist/fn/type/isBoolean.js +25 -0
- package/dist/fn/type/isCanvas.d.ts +16 -0
- package/dist/fn/type/isCanvas.js +25 -0
- package/dist/fn/type/isColor.d.ts +31 -0
- package/dist/fn/type/isColor.js +45 -0
- package/dist/fn/type/isComment.d.ts +14 -0
- package/dist/fn/type/isComment.js +23 -0
- package/dist/fn/type/isCp.d.ts +2 -0
- package/dist/fn/type/isCp.js +17 -0
- package/dist/fn/type/isDate.d.ts +20 -0
- package/dist/fn/type/isDate.js +29 -0
- package/dist/fn/type/isDimension.d.ts +11 -0
- package/dist/fn/type/isDimension.js +24 -0
- package/dist/fn/type/isDom.d.ts +14 -0
- package/dist/fn/type/isDom.js +23 -0
- package/dist/fn/type/isEmail.d.ts +23 -0
- package/dist/fn/type/isEmail.js +37 -0
- package/dist/fn/type/isEmpty.d.ts +41 -0
- package/dist/fn/type/isEmpty.js +57 -0
- package/dist/fn/type/isEvent.d.ts +9 -0
- package/dist/fn/type/isEvent.js +18 -0
- package/dist/fn/type/isFunction.d.ts +16 -0
- package/dist/fn/type/isFunction.js +25 -0
- package/dist/fn/type/isHostname.d.ts +2 -0
- package/dist/fn/type/isHostname.js +16 -0
- package/dist/fn/type/isIP.d.ts +2 -0
- package/dist/fn/type/isIP.js +12 -0
- package/dist/fn/type/isInt.d.ts +18 -0
- package/dist/fn/type/isInt.js +27 -0
- package/dist/fn/type/isIterable.d.ts +27 -0
- package/dist/fn/type/isIterable.js +37 -0
- package/dist/fn/type/isNull.d.ts +14 -0
- package/dist/fn/type/isNull.js +23 -0
- package/dist/fn/type/isNumber.d.ts +19 -0
- package/dist/fn/type/isNumber.js +30 -0
- package/dist/fn/type/isObject.d.ts +19 -0
- package/dist/fn/type/isObject.js +28 -0
- package/dist/fn/type/isPercent.d.ts +14 -0
- package/dist/fn/type/isPercent.js +23 -0
- package/dist/fn/type/isPrimitive.d.ts +18 -0
- package/dist/fn/type/isPrimitive.js +27 -0
- package/dist/fn/type/isPromise.d.ts +18 -0
- package/dist/fn/type/isPromise.js +27 -0
- package/dist/fn/type/isPropSize.d.ts +2 -0
- package/dist/fn/type/isPropSize.js +12 -0
- package/dist/fn/type/isSQLDate.d.ts +10 -0
- package/dist/fn/type/isSQLDate.js +20 -0
- package/dist/fn/type/isSame.d.ts +41 -0
- package/dist/fn/type/isSame.js +72 -0
- package/dist/fn/type/isString.d.ts +14 -0
- package/dist/fn/type/isString.js +23 -0
- package/dist/fn/type/isSymbol.d.ts +15 -0
- package/dist/fn/type/isSymbol.js +24 -0
- package/dist/fn/type/isURL.d.ts +2 -0
- package/dist/fn/type/isURL.js +11 -0
- package/dist/fn/type/isValidDimension.d.ts +11 -0
- package/dist/fn/type/isValidDimension.js +24 -0
- package/dist/fn/type/isValidName.d.ts +27 -0
- package/dist/fn/type/isValidName.js +38 -0
- package/dist/fn/type/isValue.d.ts +26 -0
- package/dist/fn/type/isValue.js +36 -0
- package/dist/fn/type/isVue.d.ts +16 -0
- package/dist/fn/type/isVue.js +42 -0
- package/dist/fn.d.ts +4 -5
- package/dist/fn.js +226 -228
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Changes the URL and the associated variables and updates the history.
|
|
3
|
+
*
|
|
4
|
+
* @method setNavigationVars
|
|
5
|
+
* @todo Add method description for setNavigationVars
|
|
6
|
+
* @global
|
|
7
|
+
* @memberof bbn.fn
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* // Changing URL
|
|
12
|
+
* bbn.fn.setNavigationVars('my/page', 'My page');
|
|
13
|
+
* // Replacing the previous state
|
|
14
|
+
* bbn.fn.setNavigationVars('my/page/deeper', 'My deeper page', null, true);
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param {String} url The URL which will become the location.href
|
|
18
|
+
* @param {String} title The title corresponding to the given URL
|
|
19
|
+
* @param {Object} data The data if any
|
|
20
|
+
* @param {Boolean} repl If true the history state object will replace the current one, will be added otherwise
|
|
21
|
+
*
|
|
22
|
+
* @returns {undefined}
|
|
23
|
+
*/
|
|
24
|
+
declare const setNavigationVars: (url: any, title: any, data?: object, repl?: boolean) => void;
|
|
25
|
+
export { setNavigationVars };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { substr } from '../string/substr';
|
|
2
|
+
import { filter } from '../object/filter';
|
|
3
|
+
import { extend } from '../object/extend';
|
|
4
|
+
import { html2text } from '../html/html2text';
|
|
5
|
+
/**
|
|
6
|
+
* Changes the URL and the associated variables and updates the history.
|
|
7
|
+
*
|
|
8
|
+
* @method setNavigationVars
|
|
9
|
+
* @todo Add method description for setNavigationVars
|
|
10
|
+
* @global
|
|
11
|
+
* @memberof bbn.fn
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```javascript
|
|
15
|
+
* // Changing URL
|
|
16
|
+
* bbn.fn.setNavigationVars('my/page', 'My page');
|
|
17
|
+
* // Replacing the previous state
|
|
18
|
+
* bbn.fn.setNavigationVars('my/page/deeper', 'My deeper page', null, true);
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param {String} url The URL which will become the location.href
|
|
22
|
+
* @param {String} title The title corresponding to the given URL
|
|
23
|
+
* @param {Object} data The data if any
|
|
24
|
+
* @param {Boolean} repl If true the history state object will replace the current one, will be added otherwise
|
|
25
|
+
*
|
|
26
|
+
* @returns {undefined}
|
|
27
|
+
*/
|
|
28
|
+
const setNavigationVars = function (url, title, data, repl) {
|
|
29
|
+
// Current path becomes old path
|
|
30
|
+
bbn.env.old_path = bbn.env.path;
|
|
31
|
+
// URL includes the domain
|
|
32
|
+
bbn.env.url = ['https:/', 'http://'].includes(substr(url, 0, 7)) ? url : bbn.env.root + url;
|
|
33
|
+
// Path does not
|
|
34
|
+
bbn.env.path = substr(bbn.env.url, bbn.env.root.length);
|
|
35
|
+
// Params will include each part of the URL
|
|
36
|
+
bbn.env.params = filter(bbn.env.path.split('/'), (v) => {
|
|
37
|
+
return v !== '';
|
|
38
|
+
});
|
|
39
|
+
// Managing history
|
|
40
|
+
let h = window.history;
|
|
41
|
+
if (h) {
|
|
42
|
+
// Current state
|
|
43
|
+
let state = h.state;
|
|
44
|
+
// Future state
|
|
45
|
+
let obj = {
|
|
46
|
+
url: bbn.env.path,
|
|
47
|
+
old_path: bbn.env.old_path || null,
|
|
48
|
+
data: data || {},
|
|
49
|
+
reload: false
|
|
50
|
+
};
|
|
51
|
+
// If same URL we replace
|
|
52
|
+
if (state && state.url === bbn.env.path) {
|
|
53
|
+
if (state.data) {
|
|
54
|
+
extend(obj.data, state.data);
|
|
55
|
+
}
|
|
56
|
+
if (state.title && !title) {
|
|
57
|
+
title = state.title;
|
|
58
|
+
}
|
|
59
|
+
repl = true;
|
|
60
|
+
}
|
|
61
|
+
// If no title the global title
|
|
62
|
+
if (!title) {
|
|
63
|
+
title = bbn.env.siteTitle;
|
|
64
|
+
}
|
|
65
|
+
// Otherwise we add the global title at the end
|
|
66
|
+
else {
|
|
67
|
+
title = html2text(title);
|
|
68
|
+
}
|
|
69
|
+
// Replacing state
|
|
70
|
+
if (repl) {
|
|
71
|
+
obj.reload = true;
|
|
72
|
+
h.replaceState(obj, title, bbn.env.url);
|
|
73
|
+
}
|
|
74
|
+
// Adding state
|
|
75
|
+
else {
|
|
76
|
+
h.pushState(obj, title, bbn.env.url);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
export { setNavigationVars };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transforms unordered arguments into a configuratiuon object for Ajax shortcut functions.
|
|
3
|
+
*
|
|
4
|
+
* The final object will have the following arguments: url, obj, datatype, force, successFn,
|
|
5
|
+
* errorFn, abortFn, e, and ele; The rules are:
|
|
6
|
+
* * The first string found is the URL
|
|
7
|
+
* * The second string found is the datatype
|
|
8
|
+
* * The first function is successFn
|
|
9
|
+
* * The second function is errorFn
|
|
10
|
+
* * The third function is abortFn
|
|
11
|
+
* * A boolean true is force
|
|
12
|
+
* * An Event is e
|
|
13
|
+
* * An HTML element is ele
|
|
14
|
+
*
|
|
15
|
+
* If no object is given the _bbn property will be added in order to always post something
|
|
16
|
+
* and let the bbn server scripts know if a whole DOM is requested or a JSON answer
|
|
17
|
+
*
|
|
18
|
+
* @method treatAjaxArguments
|
|
19
|
+
* @global
|
|
20
|
+
* @memberof bbn.fn
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```javascript
|
|
24
|
+
* bbn.fn.treatAjaxArguments(['my/script', 'json', {a:1, b:2}, () => bbn.fn.log('Hi'), () => bbn.fn.log('Bye'), () => bbn.fn.log('Argh'), true])
|
|
25
|
+
* // {
|
|
26
|
+
* // "url": "my/script",
|
|
27
|
+
* // "datatype": "json",
|
|
28
|
+
* // "obj": {
|
|
29
|
+
* // "a": 1,
|
|
30
|
+
* // "b": 2
|
|
31
|
+
* // },
|
|
32
|
+
* // "successFn": () => bbn.fn.log('Hi'),
|
|
33
|
+
* // "errorFn": () => bbn.fn.log('Bye'),
|
|
34
|
+
* // "abortFn": () => bbn.fn.log('Argh'),
|
|
35
|
+
* // "force": true
|
|
36
|
+
* // }
|
|
37
|
+
*
|
|
38
|
+
* bbn.fn.treatAjaxArguments(['my/script?id=1'])
|
|
39
|
+
* // {
|
|
40
|
+
* // "url": "my/script?id=1",
|
|
41
|
+
* // "obj": {
|
|
42
|
+
* // "_bbn": "public"
|
|
43
|
+
* // },
|
|
44
|
+
* // "datatype": "json"
|
|
45
|
+
* // }
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @param {*} args
|
|
49
|
+
*
|
|
50
|
+
* @returns {Object} The configuration object
|
|
51
|
+
*/
|
|
52
|
+
declare const treatAjaxArguments: (args: any) => BbnAjaxCfg;
|
|
53
|
+
export { treatAjaxArguments };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { isObject } from '../type/isObject';
|
|
2
|
+
import { isFunction } from '../type/isFunction';
|
|
3
|
+
import { substr } from '../string/substr';
|
|
4
|
+
import { numProperties } from '../object/numProperties';
|
|
5
|
+
/**
|
|
6
|
+
* Transforms unordered arguments into a configuratiuon object for Ajax shortcut functions.
|
|
7
|
+
*
|
|
8
|
+
* The final object will have the following arguments: url, obj, datatype, force, successFn,
|
|
9
|
+
* errorFn, abortFn, e, and ele; The rules are:
|
|
10
|
+
* * The first string found is the URL
|
|
11
|
+
* * The second string found is the datatype
|
|
12
|
+
* * The first function is successFn
|
|
13
|
+
* * The second function is errorFn
|
|
14
|
+
* * The third function is abortFn
|
|
15
|
+
* * A boolean true is force
|
|
16
|
+
* * An Event is e
|
|
17
|
+
* * An HTML element is ele
|
|
18
|
+
*
|
|
19
|
+
* If no object is given the _bbn property will be added in order to always post something
|
|
20
|
+
* and let the bbn server scripts know if a whole DOM is requested or a JSON answer
|
|
21
|
+
*
|
|
22
|
+
* @method treatAjaxArguments
|
|
23
|
+
* @global
|
|
24
|
+
* @memberof bbn.fn
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```javascript
|
|
28
|
+
* bbn.fn.treatAjaxArguments(['my/script', 'json', {a:1, b:2}, () => bbn.fn.log('Hi'), () => bbn.fn.log('Bye'), () => bbn.fn.log('Argh'), true])
|
|
29
|
+
* // {
|
|
30
|
+
* // "url": "my/script",
|
|
31
|
+
* // "datatype": "json",
|
|
32
|
+
* // "obj": {
|
|
33
|
+
* // "a": 1,
|
|
34
|
+
* // "b": 2
|
|
35
|
+
* // },
|
|
36
|
+
* // "successFn": () => bbn.fn.log('Hi'),
|
|
37
|
+
* // "errorFn": () => bbn.fn.log('Bye'),
|
|
38
|
+
* // "abortFn": () => bbn.fn.log('Argh'),
|
|
39
|
+
* // "force": true
|
|
40
|
+
* // }
|
|
41
|
+
*
|
|
42
|
+
* bbn.fn.treatAjaxArguments(['my/script?id=1'])
|
|
43
|
+
* // {
|
|
44
|
+
* // "url": "my/script?id=1",
|
|
45
|
+
* // "obj": {
|
|
46
|
+
* // "_bbn": "public"
|
|
47
|
+
* // },
|
|
48
|
+
* // "datatype": "json"
|
|
49
|
+
* // }
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @param {*} args
|
|
53
|
+
*
|
|
54
|
+
* @returns {Object} The configuration object
|
|
55
|
+
*/
|
|
56
|
+
const treatAjaxArguments = function (args) {
|
|
57
|
+
let cfg = {};
|
|
58
|
+
let t;
|
|
59
|
+
let i;
|
|
60
|
+
if (isObject(args[0]) && args.length === 1) {
|
|
61
|
+
return args[0];
|
|
62
|
+
}
|
|
63
|
+
for (i = 0; i < args.length; i++) {
|
|
64
|
+
t = typeof args[i];
|
|
65
|
+
t = t.toLowerCase();
|
|
66
|
+
/* Callbacks */
|
|
67
|
+
if (isFunction(args[i])) {
|
|
68
|
+
if (cfg.errorFn && !cfg.abortFn) {
|
|
69
|
+
cfg.abortFn = args[i];
|
|
70
|
+
}
|
|
71
|
+
if (cfg.successFn && !cfg.errorFn) {
|
|
72
|
+
cfg.errorFn = args[i];
|
|
73
|
+
}
|
|
74
|
+
else if (!cfg.successFn) {
|
|
75
|
+
cfg.successFn = args[i];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else if (args[i] === 1 || args[i] === true) {
|
|
79
|
+
/* Force */
|
|
80
|
+
cfg.force = true;
|
|
81
|
+
}
|
|
82
|
+
else if (t === 'string') {
|
|
83
|
+
if (!cfg.url) {
|
|
84
|
+
/* Hash */
|
|
85
|
+
if (args[i].indexOf('#') === 0 || args[i].indexOf(bbn.env.root + '#') === 0) {
|
|
86
|
+
cfg.url = substr(args[i], bbn.env.root.length);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
/* Link */
|
|
90
|
+
cfg.url = args[i];
|
|
91
|
+
if (cfg.url.indexOf(bbn.env.root) === 0) {
|
|
92
|
+
cfg.url = substr(cfg.url, bbn.env.root.length);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
/* Ajax datatype */
|
|
98
|
+
cfg.datatype = args[i];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else if (args[i] && t === 'object') {
|
|
102
|
+
/* Event */
|
|
103
|
+
if (args[i] instanceof Event) {
|
|
104
|
+
cfg.e = args[i];
|
|
105
|
+
}
|
|
106
|
+
else if (!cfg.ele && args[i].nodeType === 1) {
|
|
107
|
+
/* HTML Element */
|
|
108
|
+
cfg.ele = args[i];
|
|
109
|
+
}
|
|
110
|
+
else if (t.toLowerCase() === 'object') {
|
|
111
|
+
/* An object to post */
|
|
112
|
+
cfg.obj = args[i];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (!cfg.url && numProperties(cfg)) {
|
|
117
|
+
cfg.url = bbn.env.path;
|
|
118
|
+
}
|
|
119
|
+
if (cfg.obj === undefined) {
|
|
120
|
+
cfg.obj = { _bbn: 'public' };
|
|
121
|
+
}
|
|
122
|
+
if (!cfg.datatype) {
|
|
123
|
+
cfg.datatype = 'json';
|
|
124
|
+
}
|
|
125
|
+
return cfg;
|
|
126
|
+
};
|
|
127
|
+
export { treatAjaxArguments };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Uploads a file synchronously through an XHR indicating progress.
|
|
3
|
+
*
|
|
4
|
+
* @method upload
|
|
5
|
+
* @todo examples
|
|
6
|
+
* @global
|
|
7
|
+
* @memberof bbn.fn
|
|
8
|
+
*
|
|
9
|
+
* @param {String} url The URL to which the file should be uploaded
|
|
10
|
+
* @param {File} file A File object or an array of data
|
|
11
|
+
* @param {Function} success A function to execute after success
|
|
12
|
+
* @param {Function} failure A function to execute after failure
|
|
13
|
+
* @param {Function} progress A function to execute during progress
|
|
14
|
+
*
|
|
15
|
+
* @returns {Promise}
|
|
16
|
+
*/
|
|
17
|
+
declare const upload: (url: string, file: any, success?: (d: any) => any, failure?: (d: any) => any, progress?: (d: any, l: any, t: any) => any) => any;
|
|
18
|
+
export { upload };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { objectToFormData } from '../form/objectToFormData';
|
|
2
|
+
import { log } from '../browser/log';
|
|
3
|
+
/**
|
|
4
|
+
* Uploads a file synchronously through an XHR indicating progress.
|
|
5
|
+
*
|
|
6
|
+
* @method upload
|
|
7
|
+
* @todo examples
|
|
8
|
+
* @global
|
|
9
|
+
* @memberof bbn.fn
|
|
10
|
+
*
|
|
11
|
+
* @param {String} url The URL to which the file should be uploaded
|
|
12
|
+
* @param {File} file A File object or an array of data
|
|
13
|
+
* @param {Function} success A function to execute after success
|
|
14
|
+
* @param {Function} failure A function to execute after failure
|
|
15
|
+
* @param {Function} progress A function to execute during progress
|
|
16
|
+
*
|
|
17
|
+
* @returns {Promise}
|
|
18
|
+
*/
|
|
19
|
+
const upload = function (url, file, success, failure, progress) {
|
|
20
|
+
let fn = () => {
|
|
21
|
+
return axios.post(url || bbn.env.path, objectToFormData(file), {
|
|
22
|
+
headers: {
|
|
23
|
+
'Content-Type': 'multipart/form-data',
|
|
24
|
+
},
|
|
25
|
+
onUploadProgress(progressEvent) {
|
|
26
|
+
if (progress) {
|
|
27
|
+
let percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total);
|
|
28
|
+
progress(percentCompleted, progressEvent.loaded, progressEvent.total);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
if (!success && !failure) {
|
|
34
|
+
return fn();
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return fn()
|
|
38
|
+
.then((res) => {
|
|
39
|
+
if (success) {
|
|
40
|
+
log('SUCCESS', res);
|
|
41
|
+
success(res);
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
.catch((err) => {
|
|
45
|
+
if (failure) {
|
|
46
|
+
log('ERROR', err);
|
|
47
|
+
failure(err);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
export { upload };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copies to the clipboard the value of the given string.
|
|
3
|
+
* @method copy
|
|
4
|
+
* @global
|
|
5
|
+
* ``` javascript
|
|
6
|
+
* let myVal = 'the value you want to copy to clipbord';
|
|
7
|
+
* bbn.fn.copy(myVal);
|
|
8
|
+
*
|
|
9
|
+
* ```
|
|
10
|
+
* @memberof bbn.fn
|
|
11
|
+
* @param {String} st The string to copy.
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
declare const copy: (st: any) => Promise<unknown>;
|
|
15
|
+
export { copy };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { isObject } from '../type/isObject';
|
|
2
|
+
import { isFunction } from '../type/isFunction';
|
|
3
|
+
/**
|
|
4
|
+
* Copies to the clipboard the value of the given string.
|
|
5
|
+
* @method copy
|
|
6
|
+
* @global
|
|
7
|
+
* ``` javascript
|
|
8
|
+
* let myVal = 'the value you want to copy to clipbord';
|
|
9
|
+
* bbn.fn.copy(myVal);
|
|
10
|
+
*
|
|
11
|
+
* ```
|
|
12
|
+
* @memberof bbn.fn
|
|
13
|
+
* @param {String} st The string to copy.
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
const copy = function (st) {
|
|
17
|
+
return new Promise((resolve) => {
|
|
18
|
+
if (st) {
|
|
19
|
+
if (navigator && navigator.clipboard) {
|
|
20
|
+
if (st instanceof Blob) {
|
|
21
|
+
navigator.clipboard.write([new ClipboardItem({ [st.type.toString()]: st })]).then(() => {
|
|
22
|
+
resolve(true);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else if (isObject(st) && isFunction(st.toBlob)) {
|
|
26
|
+
st.toBlob((blob) => {
|
|
27
|
+
navigator.clipboard.write([new ClipboardItem({ [blob.type.toString()]: blob })]).then(() => {
|
|
28
|
+
resolve(true);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
navigator.clipboard.writeText(st);
|
|
34
|
+
resolve(true);
|
|
35
|
+
}
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
let input = document.createElement('textarea');
|
|
39
|
+
input.style.opacity = '0';
|
|
40
|
+
input.value = st;
|
|
41
|
+
document.body.appendChild(input);
|
|
42
|
+
input.select();
|
|
43
|
+
document.execCommand('copy');
|
|
44
|
+
document.body.removeChild(input);
|
|
45
|
+
resolve(true);
|
|
46
|
+
}
|
|
47
|
+
resolve(false);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
export { copy };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Erase the cookie corresponding to the given name;
|
|
3
|
+
*
|
|
4
|
+
* @method eraseCookie
|
|
5
|
+
* @global
|
|
6
|
+
* @example
|
|
7
|
+
* ``` javascript
|
|
8
|
+
* // 'en'
|
|
9
|
+
* bbn.fn.erase('lang');
|
|
10
|
+
* ```
|
|
11
|
+
* @memberof bbn.fn
|
|
12
|
+
* @returns {*}
|
|
13
|
+
*/
|
|
14
|
+
declare const eraseCookie: (name: any) => void;
|
|
15
|
+
export { eraseCookie };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Erase the cookie corresponding to the given name;
|
|
3
|
+
*
|
|
4
|
+
* @method eraseCookie
|
|
5
|
+
* @global
|
|
6
|
+
* @example
|
|
7
|
+
* ``` javascript
|
|
8
|
+
* // 'en'
|
|
9
|
+
* bbn.fn.erase('lang');
|
|
10
|
+
* ```
|
|
11
|
+
* @memberof bbn.fn
|
|
12
|
+
* @returns {*}
|
|
13
|
+
*/
|
|
14
|
+
const eraseCookie = function (name) {
|
|
15
|
+
document.cookie = name + '=; Max-Age=-99999999;';
|
|
16
|
+
};
|
|
17
|
+
export { eraseCookie };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throws an error.
|
|
3
|
+
* @method error
|
|
4
|
+
* @global
|
|
5
|
+
* @ignore
|
|
6
|
+
* ``` javascript
|
|
7
|
+
* bbn.fn.error('I log this error in console with a red background')
|
|
8
|
+
* ```
|
|
9
|
+
* @memberof bbn.fn
|
|
10
|
+
* @param {String} errorMsg
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
declare const error: (errorMsg: any) => never;
|
|
14
|
+
export { error };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { log } from './log';
|
|
2
|
+
/**
|
|
3
|
+
* Throws an error.
|
|
4
|
+
* @method error
|
|
5
|
+
* @global
|
|
6
|
+
* @ignore
|
|
7
|
+
* ``` javascript
|
|
8
|
+
* bbn.fn.error('I log this error in console with a red background')
|
|
9
|
+
* ```
|
|
10
|
+
* @memberof bbn.fn
|
|
11
|
+
* @param {String} errorMsg
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
const error = function (errorMsg) {
|
|
15
|
+
if (arguments.length > 1) {
|
|
16
|
+
const args = [];
|
|
17
|
+
for (let i = 1; i < arguments.length; i++) {
|
|
18
|
+
args.push(arguments[i]);
|
|
19
|
+
}
|
|
20
|
+
args.unshift({
|
|
21
|
+
_bbn_console_mode: 'error',
|
|
22
|
+
_bbn_console_level: 1,
|
|
23
|
+
_bbn_console_style: 'color: #E64141; background: #F7E195; font-size: 14px',
|
|
24
|
+
});
|
|
25
|
+
log.apply(this, args);
|
|
26
|
+
}
|
|
27
|
+
throw new Error(errorMsg);
|
|
28
|
+
};
|
|
29
|
+
export { error };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the browser's name
|
|
3
|
+
* @method getBrowserName
|
|
4
|
+
* @global
|
|
5
|
+
* @memberof bbn.fn
|
|
6
|
+
* @returns {String}
|
|
7
|
+
*/
|
|
8
|
+
declare const getBrowserName: () => "Edge" | "Opera" | "Chrome" | "Internet Explorer" | "Firefox" | "Safari" | "Other";
|
|
9
|
+
export { getBrowserName };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the browser's name
|
|
3
|
+
* @method getBrowserName
|
|
4
|
+
* @global
|
|
5
|
+
* @memberof bbn.fn
|
|
6
|
+
* @returns {String}
|
|
7
|
+
*/
|
|
8
|
+
const getBrowserName = function () {
|
|
9
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
10
|
+
switch (true) {
|
|
11
|
+
case userAgent.includes('edge'):
|
|
12
|
+
case userAgent.includes('edg/'):
|
|
13
|
+
return 'Edge';
|
|
14
|
+
case userAgent.includes('opr') && !!window['opr']:
|
|
15
|
+
return 'Opera';
|
|
16
|
+
case userAgent.includes('chrome') && !!window['chrome']:
|
|
17
|
+
return 'Chrome';
|
|
18
|
+
case userAgent.includes('trident'):
|
|
19
|
+
return 'Internet Explorer';
|
|
20
|
+
case userAgent.includes('firefox'):
|
|
21
|
+
return 'Firefox';
|
|
22
|
+
case userAgent.includes('safari'):
|
|
23
|
+
return 'Safari';
|
|
24
|
+
default:
|
|
25
|
+
return 'Other';
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export { getBrowserName };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the browser's version
|
|
3
|
+
* @method getBrowserVersion
|
|
4
|
+
* @global
|
|
5
|
+
* @memberof bbn.fn
|
|
6
|
+
* @returns {String}
|
|
7
|
+
*/
|
|
8
|
+
const getBrowserVersion = function () {
|
|
9
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
10
|
+
switch (true) {
|
|
11
|
+
case userAgent.includes('edge/'):
|
|
12
|
+
return userAgent.split('edge/')[1].split(' ')[0];
|
|
13
|
+
case userAgent.includes('edg/'):
|
|
14
|
+
return userAgent.split('edg/')[1].split(' ')[0];
|
|
15
|
+
case userAgent.includes('opr/') && !!window['opr']:
|
|
16
|
+
return userAgent.split('opr/')[1].split(' ')[0];
|
|
17
|
+
case userAgent.includes('chrome/') && !!window['chrome']:
|
|
18
|
+
return userAgent.split('chrome/')[1].split(' ')[0];
|
|
19
|
+
case userAgent.includes('trident/'):
|
|
20
|
+
return userAgent.split('trident/')[1].split(' ')[0];
|
|
21
|
+
case userAgent.includes('firefox/'):
|
|
22
|
+
return userAgent.split('firefox/')[1].split(' ')[0];
|
|
23
|
+
case userAgent.includes('safari/'):
|
|
24
|
+
return userAgent.split('version/')[1].split(' ')[0];
|
|
25
|
+
default:
|
|
26
|
+
return '';
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export { getBrowserVersion };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* If it exsists returns the cookie corresponding to the given name.
|
|
3
|
+
*
|
|
4
|
+
* @method getCookie
|
|
5
|
+
* @example
|
|
6
|
+
* ``` javascript
|
|
7
|
+
* // 'en'
|
|
8
|
+
* bbn.fn.getCookie('lang');
|
|
9
|
+
* ```
|
|
10
|
+
* @global
|
|
11
|
+
* @memberof bbn.fn
|
|
12
|
+
* @param {String} name
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
declare const getCookie: (name: any) => any;
|
|
16
|
+
export { getCookie };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* If it exsists returns the cookie corresponding to the given name.
|
|
3
|
+
*
|
|
4
|
+
* @method getCookie
|
|
5
|
+
* @example
|
|
6
|
+
* ``` javascript
|
|
7
|
+
* // 'en'
|
|
8
|
+
* bbn.fn.getCookie('lang');
|
|
9
|
+
* ```
|
|
10
|
+
* @global
|
|
11
|
+
* @memberof bbn.fn
|
|
12
|
+
* @param {String} name
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
const getCookie = function (name) {
|
|
16
|
+
let nameEqual = name + '=';
|
|
17
|
+
let ca = document.cookie.split(';');
|
|
18
|
+
for (let i = 0; i < ca.length; i++) {
|
|
19
|
+
let c = ca[i];
|
|
20
|
+
while (c.charAt(0) == ' ') {
|
|
21
|
+
c = c.substring(1, c.length);
|
|
22
|
+
}
|
|
23
|
+
if (c.indexOf(nameEqual) == 0) {
|
|
24
|
+
let st = c.substring(nameEqual.length, c.length);
|
|
25
|
+
if (st) {
|
|
26
|
+
return JSON.parse(unescape(st)).value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
};
|
|
32
|
+
export { getCookie };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the current device type.
|
|
3
|
+
* @method getDeviceType
|
|
4
|
+
* @global
|
|
5
|
+
* @example
|
|
6
|
+
* ``` javascript
|
|
7
|
+
* bbn.fn.getDeviceType();
|
|
8
|
+
* // mobile
|
|
9
|
+
* ```
|
|
10
|
+
* @memberof bbn.fn
|
|
11
|
+
* @returns {String}
|
|
12
|
+
*/
|
|
13
|
+
declare const getDeviceType: () => "mobile" | "tablet" | "desktop";
|
|
14
|
+
export { getDeviceType };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the current device type.
|
|
3
|
+
* @method getDeviceType
|
|
4
|
+
* @global
|
|
5
|
+
* @example
|
|
6
|
+
* ``` javascript
|
|
7
|
+
* bbn.fn.getDeviceType();
|
|
8
|
+
* // mobile
|
|
9
|
+
* ```
|
|
10
|
+
* @memberof bbn.fn
|
|
11
|
+
* @returns {String}
|
|
12
|
+
*/
|
|
13
|
+
const getDeviceType = function () {
|
|
14
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
15
|
+
if (/iPhone|Android/i.test(navigator.userAgent)) {
|
|
16
|
+
return 'mobile';
|
|
17
|
+
}
|
|
18
|
+
if (/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(userAgent)) {
|
|
19
|
+
return 'tablet';
|
|
20
|
+
}
|
|
21
|
+
return 'desktop';
|
|
22
|
+
};
|
|
23
|
+
export { getDeviceType };
|