@bbn/bbn 1.0.14 → 1.0.15

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 (51) hide show
  1. package/dist/bundle.d.ts +3 -3
  2. package/dist/bundle.js +180 -191
  3. package/dist/fn/_addLoader.js +3 -15
  4. package/dist/fn/_compareValues.js +2 -2
  5. package/dist/fn/_deleteLoader.js +0 -1
  6. package/dist/fn/abortURL.js +0 -1
  7. package/dist/fn/addColors.js +3 -4
  8. package/dist/fn/ajax.js +0 -1
  9. package/dist/fn/autoExtend.js +0 -1
  10. package/dist/fn/calendar.js +0 -1
  11. package/dist/fn/callback.js +0 -1
  12. package/dist/fn/checkPropsDetails.js +0 -1
  13. package/dist/fn/checkType.js +0 -1
  14. package/dist/fn/deleteProp.js +0 -1
  15. package/dist/fn/extend.js +0 -1
  16. package/dist/fn/fdatetime.js +0 -1
  17. package/dist/fn/format.js +0 -1
  18. package/dist/fn/getEventData.js +0 -1
  19. package/dist/fn/getLoader.d.ts +1 -1
  20. package/dist/fn/getLoader.js +0 -1
  21. package/dist/fn/getProp.js +0 -1
  22. package/dist/fn/getScrollBarSize.d.ts +1 -1
  23. package/dist/fn/getScrollBarSize.js +0 -1
  24. package/dist/fn/getTimeoff.js +0 -1
  25. package/dist/fn/init.js +2 -3
  26. package/dist/fn/isActiveInterface.js +0 -1
  27. package/dist/fn/isCp.js +0 -1
  28. package/dist/fn/isHostname.js +1 -2
  29. package/dist/fn/isIP.js +1 -2
  30. package/dist/fn/isString.d.ts +1 -1
  31. package/dist/fn/isString.js +3 -3
  32. package/dist/fn/isURL.js +1 -2
  33. package/dist/fn/isVue.js +0 -1
  34. package/dist/fn/link.js +0 -1
  35. package/dist/fn/log.js +0 -1
  36. package/dist/fn/money.js +0 -1
  37. package/dist/fn/removeAccents.js +0 -1
  38. package/dist/fn/resize.js +0 -1
  39. package/dist/fn/search.js +0 -1
  40. package/dist/fn/setNavigationVars.js +0 -1
  41. package/dist/fn/setProp.js +0 -1
  42. package/dist/fn/setProperty.js +0 -1
  43. package/dist/fn/shorten.js +1 -2
  44. package/dist/fn/stat.js +1 -2
  45. package/dist/fn/submit.js +0 -1
  46. package/dist/fn/substr.js +0 -1
  47. package/dist/fn/translate.js +0 -1
  48. package/dist/fn/treatAjaxArguments.js +0 -1
  49. package/dist/fn/upload.js +0 -1
  50. package/dist/index.js +1 -1
  51. package/package.json +1 -1
@@ -1,24 +1,12 @@
1
- import { bbn } from '../definitions';
2
1
  import { substr } from './substr';
3
2
  const _addLoader = function (requestId, prom, source) {
4
- let tst = new Date().getTime();
3
+ let tst = (new Date()).getTime();
5
4
  let url = substr(requestId, 0, requestId.length - 33);
6
- let loader = {
7
- key: requestId,
8
- url: url,
9
- loader: prom,
10
- source: source,
11
- loading: true,
12
- error: false,
13
- abort: false,
14
- errorMessage: false,
15
- success: false,
16
- start: tst,
17
- };
5
+ let loader = { key: requestId, url: url, loader: prom, source: source, loading: true, error: false, abort: false, errorMessage: false, success: false, start: tst };
18
6
  bbn.env.loaders.push(loader);
19
7
  bbn.env.loadersHistory.unshift(loader);
20
8
  let idx = bbn.env.loadersHistory.length;
21
- while (idx && bbn.env.loadersHistory.length > bbn.env.maxLoadersHistory) {
9
+ while (idx && (bbn.env.loadersHistory.length > bbn.env.maxLoadersHistory)) {
22
10
  idx--;
23
11
  if (!bbn.env.loadersHistory.loading) {
24
12
  bbn.env.loadersHistory.splice(idx, 1);
@@ -3,8 +3,8 @@ import { isString } from './isString';
3
3
  import { removeAccents } from './removeAccents';
4
4
  import { isDate } from './isDate';
5
5
  const _compareValues = function (a, b, prop, dir = 'asc') {
6
- let va = getProperty(a, prop), vb = getProperty(b, prop), ta = (typeof va).toLowerCase(), tb = (typeof vb).toLowerCase();
7
- if (dir !== 'asc' && isString(dir) && dir.toLowerCase() === 'desc') {
6
+ let va = getProperty(a, prop), vb = getProperty(b, prop), ta = (typeof (va)).toLowerCase(), tb = (typeof (vb)).toLowerCase();
7
+ if ((dir !== 'asc') && isString(dir) && (dir.toLowerCase() === 'desc')) {
8
8
  dir = 'desc';
9
9
  }
10
10
  if (ta !== tb) {
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { search } from './search';
3
2
  import { getRow } from './getRow';
4
3
  import { isObject } from './isObject';
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { each } from './each';
3
2
  import { filter } from './filter';
4
3
  const abortURL = function (url) {
@@ -1,17 +1,16 @@
1
- import { bbn } from '../definitions';
2
1
  import { numProperties } from './numProperties';
3
2
  import { iterate } from './iterate';
4
3
  const addColors = function (colors) {
5
4
  let st = '';
6
5
  if (numProperties(colors)) {
7
- if (!bbn.var.colors) {
8
- bbn.var.colors = {};
6
+ if (!bbn.vars.colors) {
7
+ bbn.vars.colors = {};
9
8
  }
10
9
  let element = document.createElement('style');
11
10
  document.head.appendChild(element);
12
11
  let sheet = element.sheet;
13
12
  let i = 0;
14
- iterate(colors, (v, n) => { bbn.var.colors[n] = v; sheet.insertRule('.bbn-' + n + ', .bbn-color-text-' + n + ' {color: ' + v + ' !important;}', i); sheet.insertRule('svg.bbn-' + n + ', .bbn-' + n + ' svg, svg.bbn-color-text-' + n + ', .bbn-color-text-' + n + ' svg {fill: ' + v + ';}', i); sheet.insertRule('.bbn-bg-' + n + ', .bbn-color-bg-' + n + ', .bbn-color-background-' + n + ' {background-color: ' + v + ' !important;}', i); sheet.insertRule('.bbn-border-' + n + ', .bbn-color-border-' + n + ' {border-color: ' + v + ' !important;}', i); sheet.insertRule('.bbn-color-' + n + ' {border-color: ' + v + '; background-color: ' + v + '; color: ' + v + ';}', i); });
13
+ iterate(colors, (v, n) => { bbn.vars.colors[n] = v; sheet.insertRule('.bbn-' + n + ', .bbn-color-text-' + n + ' {color: ' + v + ' !important;}', i); sheet.insertRule('svg.bbn-' + n + ', .bbn-' + n + ' svg, svg.bbn-color-text-' + n + ', .bbn-color-text-' + n + ' svg {fill: ' + v + ';}', i); sheet.insertRule('.bbn-bg-' + n + ', .bbn-color-bg-' + n + ', .bbn-color-background-' + n + ' {background-color: ' + v + ' !important;}', i); sheet.insertRule('.bbn-border-' + n + ', .bbn-color-border-' + n + ' {border-color: ' + v + ' !important;}', i); sheet.insertRule('.bbn-color-' + n + ' {border-color: ' + v + '; background-color: ' + v + '; color: ' + v + ';}', i); });
15
14
  }
16
15
  };
17
16
  export { addColors };
package/dist/fn/ajax.js CHANGED
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { isObject } from './isObject';
3
2
  import { replaceAll } from './replaceAll';
4
3
  import { getRequestId } from './getRequestId';
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { extend } from './extend';
3
2
  const autoExtend = function (namespace, obj) {
4
3
  if (!bbn[namespace]) {
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { fdate } from './fdate';
3
2
  import { date } from './date';
4
3
  import { isDate } from './isDate';
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { error } from './error';
3
2
  import { defaultLinkFunction } from './defaultLinkFunction';
4
3
  import { insertContent } from './insertContent';
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { isString } from './isString';
3
2
  import { isArray } from './isArray';
4
3
  import { isObject } from './isObject';
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { isArray } from './isArray';
3
2
  import { each } from './each';
4
3
  import { isFunction } from './isFunction';
@@ -1,3 +1,2 @@
1
- import { bbn } from '../definitions';
2
1
  const deleteProp = function (obj, prop) { checkType(obj, "object", bbn._("The obj must be an object in setProp")); checkType(prop, "string", bbn._("The prop must be a string in setProp")); delete obj[prop]; };
3
2
  export { deleteProp };
package/dist/fn/extend.js CHANGED
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { iterate } from './iterate';
3
2
  import { isArray } from './isArray';
4
3
  import { each } from './each';
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { date } from './date';
3
2
  import { isDate } from './isDate';
4
3
  import { isString } from './isString';
package/dist/fn/format.js CHANGED
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { checkType } from './checkType';
3
2
  const format = function (str) {
4
3
  let args = Array.prototype.slice.call(arguments, 1);
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { getHTMLOfSelection } from './getHTMLOfSelection';
3
2
  import { each } from './each';
4
3
  const getEventData = function (e) {
@@ -1,2 +1,2 @@
1
- declare const getLoader: (requestId: any) => any;
1
+ declare const getLoader: (requestId: any) => false | object;
2
2
  export { getLoader };
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { search } from './search';
3
2
  const getLoader = function (requestId) {
4
3
  let idx = search(bbn.env.loaders, { key: requestId });
@@ -1,3 +1,2 @@
1
- import { bbn } from '../definitions';
2
1
  const getProp = function (obj, prop) { checkType(obj, "object", bbn._("The obj must be an object in setProp")); checkType(prop, "string", bbn._("The prop must be a string in setProp")); return obj[prop]; };
3
2
  export { getProp };
@@ -1,2 +1,2 @@
1
- declare const getScrollBarSize: () => any;
1
+ declare const getScrollBarSize: () => number;
2
2
  export { getScrollBarSize };
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  const getScrollBarSize = function () {
3
2
  if (bbn.env.scrollBarSize === undefined) {
4
3
  let outer = document.createElement("div");
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  const getTimeoff = function () {
3
2
  if (!bbn.env.isFocused) {
4
3
  return Math.round((new Date()).getTime() / 1000 - bbn.env.timeoff);
package/dist/fn/init.js CHANGED
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { substr } from './substr';
3
2
  import { each } from './each';
4
3
  import { extend } from './extend';
@@ -31,8 +30,8 @@ const init = function (cfg, force) {
31
30
  each(parts, (v, i) => { v = decodeURI(v.trim()); if (v !== "") {
32
31
  bbn.env.params.push(v);
33
32
  } });
34
- if (bbn.var.colors) {
35
- addColors(bbn.var.colors);
33
+ if (bbn.vars.colors) {
34
+ addColors(bbn.vars.colors);
36
35
  }
37
36
  if (bbn.env.lang && (undefined !== dayjs)) {
38
37
  dayjs.locale(bbn.env.lang);
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  const isActiveInterface = function (secs = 600) {
3
2
  if (!bbn.env.last_focus) {
4
3
  return false;
package/dist/fn/isCp.js CHANGED
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { isDom } from './isDom';
3
2
  const isCp = function () {
4
3
  if (!arguments.length) {
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { isString } from './isString';
3
2
  import { isIP } from './isIP';
4
3
  const isHostname = function (st) {
@@ -6,7 +5,7 @@ const isHostname = function (st) {
6
5
  if (isIP(st)) {
7
6
  return true;
8
7
  }
9
- return bbn.var.regexp.hostname.test(st);
8
+ return bbn.vars.regexp.hostname.test(st);
10
9
  }
11
10
  };
12
11
  export { isHostname };
package/dist/fn/isIP.js CHANGED
@@ -1,6 +1,5 @@
1
- import { bbn } from '../definitions';
2
1
  import { isString } from './isString';
3
2
  const isIP = function (st) { if (isString(st)) {
4
- return bbn.var.regexp.ip.test(st);
3
+ return bbn.vars.regexp.ip.test(st);
5
4
  } };
6
5
  export { isIP };
@@ -1,2 +1,2 @@
1
- declare const isString: (...args: any[]) => boolean;
1
+ declare const isString: () => boolean;
2
2
  export { isString };
@@ -1,7 +1,7 @@
1
- const isString = function (...args) {
2
- if (!args.length)
1
+ const isString = function () {
2
+ if (!arguments.length)
3
3
  return false;
4
- for (let a of args) {
4
+ for (let a of arguments) {
5
5
  if ({}.toString.apply(a) !== '[object String]') {
6
6
  return false;
7
7
  }
package/dist/fn/isURL.js CHANGED
@@ -1,3 +1,2 @@
1
- import { bbn } from '../definitions';
2
- const isURL = function (str) { return bbn.var.regexp.url.test(str); };
1
+ const isURL = function (str) { return bbn.vars.regexp.url.test(str); };
3
2
  export { isURL };
package/dist/fn/isVue.js CHANGED
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  const isVue = function () {
3
2
  if (!arguments.length) {
4
3
  return false;
package/dist/fn/link.js CHANGED
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { treatAjaxArguments } from './treatAjaxArguments';
3
2
  import { getLoader } from './getLoader';
4
3
  import { defaultPreLinkFunction } from './defaultPreLinkFunction';
package/dist/fn/log.js CHANGED
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { isFunction } from './isFunction';
3
2
  const log = function (...args) {
4
3
  if (window.console !== undefined) {
package/dist/fn/money.js CHANGED
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { isNumber } from './isNumber';
3
2
  const money = function (val, kilo, currency, novalue, decimal, thousands, precision) {
4
3
  if (!decimal) {
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { isString } from './isString';
3
2
  import { log } from './log';
4
3
  const removeAccents = function (st) {
package/dist/fn/resize.js CHANGED
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { getCssVar } from './getCssVar';
3
2
  import { each } from './each';
4
3
  import { defaultResizeFunction } from './defaultResizeFunction';
package/dist/fn/search.js CHANGED
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { isIterable } from './isIterable';
3
2
  import { isString } from './isString';
4
3
  import { compareConditions } from './compareConditions';
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { substr } from './substr';
3
2
  import { filter } from './filter';
4
3
  import { extend } from './extend';
@@ -1,3 +1,2 @@
1
- import { bbn } from '../definitions';
2
1
  const setProp = function (obj, prop, value, writable = true, configurable = true) { checkType(prop, "string", bbn._("The prop must be a string in setProp")); checkType(obj, "object", bbn._("The obj must be an object in setProp")); Object.defineProperty(obj, prop, { value: value, writable: writable, configurable: configurable }); };
3
2
  export { setProp };
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { each } from './each';
3
2
  const setProperty = function (obj, prop, value, force) {
4
3
  if ((typeof obj === 'object') && (typeof prop === 'string')) {
@@ -1,10 +1,9 @@
1
- import { bbn } from '../definitions';
2
1
  import { isString } from './isString';
3
2
  import { substr } from './substr';
4
3
  const shorten = function (st, len, adj) {
5
4
  if (typeof (st).toLowerCase() === 'string') {
6
5
  if (!len) {
7
- len = bbn.var.shortenLen;
6
+ len = bbn.vars.shortenLen;
8
7
  }
9
8
  if ((adj === undefined) || !isString(adj)) {
10
9
  adj = '...';
package/dist/fn/stat.js CHANGED
@@ -1,9 +1,8 @@
1
- import { bbn } from '../definitions';
2
1
  import { getPath } from './getPath';
3
2
  const stat = function (returnStat) {
4
3
  return;
5
4
  if (bbn.env.logging) {
6
- var logs = bbn.var.loggers;
5
+ var logs = bbn.vars.loggers;
7
6
  for (var i = 0; i < arguments.length; i++) {
8
7
  var a = arguments[i], type = typeof (a);
9
8
  if ((type === 'boolean') || (type === 'undefined')) {
package/dist/fn/submit.js CHANGED
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { formdata } from './formdata';
3
2
  import { isFunction } from './isFunction';
4
3
  import { isString } from './isString';
package/dist/fn/substr.js CHANGED
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { isString } from './isString';
3
2
  import { isInt } from './isInt';
4
3
  import { log } from './log';
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { iterate } from './iterate';
3
2
  const translate = function (o, namespace) { let lng = namespace ? bbn.lng[namespace.indexOf('_') === 0 ? namespace : '_' + namespace] : bbn.lng; iterate(o, (v, k) => { lng[k] = v; }); };
4
3
  export { translate };
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { isObject } from './isObject';
3
2
  import { isFunction } from './isFunction';
4
3
  import { substr } from './substr';
package/dist/fn/upload.js CHANGED
@@ -1,4 +1,3 @@
1
- import { bbn } from '../definitions';
2
1
  import { objectToFormData } from './objectToFormData';
3
2
  import { log } from './log';
4
3
  const upload = function (url, file, success, failure, progress) {
package/dist/index.js CHANGED
@@ -227,7 +227,7 @@ import { uniqString } from './fn/uniqString';
227
227
  import { unique } from './fn/unique';
228
228
  import { upload } from './fn/upload';
229
229
  import { warning } from './fn/warning';
230
- const fn = {
230
+ bbn.fn = {
231
231
  _addLoader,
232
232
  _compareValues,
233
233
  _deleteLoader,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",