@bbn/bbn 1.0.14 → 1.0.16

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 (205) hide show
  1. package/dist/bundle.d.ts +33 -33
  2. package/dist/bundle.js +1341 -555
  3. package/dist/fn/_addLoader.js +12 -4
  4. package/dist/fn/_compareValues.js +2 -2
  5. package/dist/fn/_deleteLoader.js +0 -1
  6. package/dist/fn/abort.js +12 -3
  7. package/dist/fn/abortURL.js +0 -1
  8. package/dist/fn/addColors.js +9 -2
  9. package/dist/fn/addInputs.js +9 -2
  10. package/dist/fn/addStyle.js +7 -3
  11. package/dist/fn/adjustSize.js +19 -6
  12. package/dist/fn/ajax.js +16 -6
  13. package/dist/fn/analyzeFunction.js +10 -1
  14. package/dist/fn/animateCss.js +8 -2
  15. package/dist/fn/arrayBuffer2String.js +3 -1
  16. package/dist/fn/arrayFromProp.js +7 -1
  17. package/dist/fn/autoExtend.js +2 -1
  18. package/dist/fn/br2nl.js +3 -1
  19. package/dist/fn/calendar.js +8 -2
  20. package/dist/fn/callback.js +4 -3
  21. package/dist/fn/camelToCss.js +7 -1
  22. package/dist/fn/canvasToImage.js +5 -1
  23. package/dist/fn/center.js +12 -1
  24. package/dist/fn/checkProps.js +3 -1
  25. package/dist/fn/checkPropsDetails.js +4 -2
  26. package/dist/fn/checkType.js +0 -1
  27. package/dist/fn/clone.js +3 -1
  28. package/dist/fn/colorToHex.js +5 -1
  29. package/dist/fn/compare.js +28 -15
  30. package/dist/fn/compareConditions.js +1 -0
  31. package/dist/fn/copy.js +8 -2
  32. package/dist/fn/correctCase.js +3 -1
  33. package/dist/fn/count.js +3 -1
  34. package/dist/fn/crc32.js +1 -1
  35. package/dist/fn/cssExists.js +2 -0
  36. package/dist/fn/dateSQL.js +6 -3
  37. package/dist/fn/deepPath.js +9 -7
  38. package/dist/fn/defaultAjaxAbortFunction.js +3 -1
  39. package/dist/fn/defaultAjaxErrorFunction.d.ts +1 -1
  40. package/dist/fn/defaultAjaxErrorFunction.js +15 -2
  41. package/dist/fn/defaultAlertFunction.d.ts +1 -1
  42. package/dist/fn/defaultAlertFunction.js +5 -1
  43. package/dist/fn/defaultEndLoadingFunction.d.ts +1 -1
  44. package/dist/fn/defaultEndLoadingFunction.js +19 -1
  45. package/dist/fn/defaultErrorFunction.js +3 -1
  46. package/dist/fn/defaultHistoryFunction.js +3 -1
  47. package/dist/fn/defaultLinkFunction.js +3 -1
  48. package/dist/fn/defaultPostLinkFunction.js +3 -1
  49. package/dist/fn/defaultPreLinkFunction.d.ts +1 -1
  50. package/dist/fn/defaultPreLinkFunction.js +11 -1
  51. package/dist/fn/defaultResizeFunction.js +3 -1
  52. package/dist/fn/defaultStartLoadingFunction.d.ts +1 -1
  53. package/dist/fn/defaultStartLoadingFunction.js +14 -1
  54. package/dist/fn/deleteProp.js +5 -2
  55. package/dist/fn/diffObj.js +20 -5
  56. package/dist/fn/download.js +4 -1
  57. package/dist/fn/downloadContent.js +12 -1
  58. package/dist/fn/eraseCookie.js +3 -1
  59. package/dist/fn/error.js +5 -1
  60. package/dist/fn/escapeRegExp.js +3 -1
  61. package/dist/fn/escapeUrl.js +3 -1
  62. package/dist/fn/extend.js +6 -2
  63. package/dist/fn/fdate.js +1 -0
  64. package/dist/fn/fdatetime.js +10 -2
  65. package/dist/fn/filter.js +10 -6
  66. package/dist/fn/filterToConditions.js +8 -2
  67. package/dist/fn/findAll.js +5 -3
  68. package/dist/fn/format.js +5 -2
  69. package/dist/fn/formatDate.js +3 -1
  70. package/dist/fn/formdata.js +7 -2
  71. package/dist/fn/ftime.js +3 -1
  72. package/dist/fn/getAllTags.js +3 -1
  73. package/dist/fn/getAttributes.js +3 -1
  74. package/dist/fn/getBrowserName.js +20 -10
  75. package/dist/fn/getBrowserVersion.js +21 -10
  76. package/dist/fn/getEventData.js +26 -7
  77. package/dist/fn/getField.js +1 -2
  78. package/dist/fn/getLoader.d.ts +1 -1
  79. package/dist/fn/getLoader.js +0 -1
  80. package/dist/fn/getPath.js +14 -3
  81. package/dist/fn/getProp.js +5 -2
  82. package/dist/fn/getRequestId.js +5 -3
  83. package/dist/fn/getScrollBarSize.d.ts +1 -1
  84. package/dist/fn/getScrollBarSize.js +4 -2
  85. package/dist/fn/getText.js +3 -1
  86. package/dist/fn/getTimeoff.js +0 -1
  87. package/dist/fn/happy.js +8 -1
  88. package/dist/fn/hash.js +2 -1
  89. package/dist/fn/hex2rgb.js +8 -1
  90. package/dist/fn/history.js +3 -1
  91. package/dist/fn/html2text.js +6 -1
  92. package/dist/fn/imageToCanvas.js +7 -1
  93. package/dist/fn/imgToBase64.js +4 -1
  94. package/dist/fn/info.js +9 -1
  95. package/dist/fn/init.js +70 -13
  96. package/dist/fn/isActiveInterface.js +0 -1
  97. package/dist/fn/isArray.d.ts +1 -1
  98. package/dist/fn/isArray.js +3 -3
  99. package/dist/fn/isBlob.d.ts +1 -1
  100. package/dist/fn/isBlob.js +3 -3
  101. package/dist/fn/isBoolean.d.ts +1 -1
  102. package/dist/fn/isBoolean.js +3 -3
  103. package/dist/fn/isCanvas.d.ts +1 -1
  104. package/dist/fn/isCanvas.js +3 -3
  105. package/dist/fn/isComment.d.ts +1 -1
  106. package/dist/fn/isComment.js +3 -3
  107. package/dist/fn/isCp.d.ts +1 -1
  108. package/dist/fn/isCp.js +3 -4
  109. package/dist/fn/isDate.d.ts +1 -1
  110. package/dist/fn/isDate.js +3 -3
  111. package/dist/fn/isDesktopDevice.js +3 -1
  112. package/dist/fn/isDom.d.ts +1 -1
  113. package/dist/fn/isDom.js +3 -3
  114. package/dist/fn/isEvent.d.ts +1 -1
  115. package/dist/fn/isEvent.js +3 -3
  116. package/dist/fn/isFocused.js +3 -1
  117. package/dist/fn/isFunction.d.ts +1 -1
  118. package/dist/fn/isFunction.js +3 -3
  119. package/dist/fn/isHostname.d.ts +1 -1
  120. package/dist/fn/isHostname.js +10 -6
  121. package/dist/fn/isIP.d.ts +1 -1
  122. package/dist/fn/isIP.js +10 -4
  123. package/dist/fn/isInside.js +6 -4
  124. package/dist/fn/isInt.d.ts +1 -1
  125. package/dist/fn/isInt.js +3 -3
  126. package/dist/fn/isIterable.js +3 -1
  127. package/dist/fn/isMobile.js +3 -1
  128. package/dist/fn/isMobileDevice.js +3 -1
  129. package/dist/fn/isNull.d.ts +1 -1
  130. package/dist/fn/isNull.js +3 -3
  131. package/dist/fn/isNumber.d.ts +1 -1
  132. package/dist/fn/isNumber.js +3 -3
  133. package/dist/fn/isObject.d.ts +1 -1
  134. package/dist/fn/isObject.js +3 -3
  135. package/dist/fn/isPercent.d.ts +1 -1
  136. package/dist/fn/isPercent.js +3 -3
  137. package/dist/fn/isPrimitive.d.ts +1 -1
  138. package/dist/fn/isPrimitive.js +3 -3
  139. package/dist/fn/isPromise.d.ts +1 -1
  140. package/dist/fn/isPromise.js +3 -3
  141. package/dist/fn/isPropSize.js +10 -4
  142. package/dist/fn/isSQLDate.d.ts +1 -1
  143. package/dist/fn/isSQLDate.js +5 -4
  144. package/dist/fn/isSame.js +7 -4
  145. package/dist/fn/isSymbol.d.ts +1 -1
  146. package/dist/fn/isSymbol.js +3 -3
  147. package/dist/fn/isTabletDevice.js +3 -1
  148. package/dist/fn/isURL.d.ts +1 -1
  149. package/dist/fn/isURL.js +10 -2
  150. package/dist/fn/isValidDimension.js +3 -1
  151. package/dist/fn/isValidName.d.ts +1 -1
  152. package/dist/fn/isValidName.js +3 -3
  153. package/dist/fn/isValue.d.ts +1 -1
  154. package/dist/fn/isValue.js +3 -3
  155. package/dist/fn/isVue.d.ts +1 -1
  156. package/dist/fn/isVue.js +5 -6
  157. package/dist/fn/iterate.js +5 -3
  158. package/dist/fn/link.js +24 -4
  159. package/dist/fn/log.js +0 -1
  160. package/dist/fn/makeReactive.js +47 -11
  161. package/dist/fn/md5.js +12 -3
  162. package/dist/fn/money.js +26 -1
  163. package/dist/fn/nl2br.js +3 -1
  164. package/dist/fn/objectToFormData.js +8 -4
  165. package/dist/fn/order.js +3 -1
  166. package/dist/fn/percent.js +3 -1
  167. package/dist/fn/pickValue.js +5 -3
  168. package/dist/fn/post.js +8 -3
  169. package/dist/fn/printf.js +8 -1
  170. package/dist/fn/randomInt.js +3 -1
  171. package/dist/fn/randomString.js +9 -2
  172. package/dist/fn/removeAccents.js +0 -1
  173. package/dist/fn/removeExtraSpaces.js +3 -1
  174. package/dist/fn/repeat.js +7 -1
  175. package/dist/fn/replaceSelection.js +6 -0
  176. package/dist/fn/resize.js +0 -1
  177. package/dist/fn/riterate.js +3 -1
  178. package/dist/fn/roundDecimal.js +3 -1
  179. package/dist/fn/search.js +17 -3
  180. package/dist/fn/selector.js +3 -1
  181. package/dist/fn/setNavigationVars.js +20 -3
  182. package/dist/fn/setProp.js +9 -2
  183. package/dist/fn/setProperty.js +0 -1
  184. package/dist/fn/shorten.js +0 -1
  185. package/dist/fn/shuffle.js +6 -1
  186. package/dist/fn/simpleHash.js +5 -1
  187. package/dist/fn/simpleHash1.js +1 -1
  188. package/dist/fn/simpleHash2.js +1 -1
  189. package/dist/fn/startChrono.js +5 -3
  190. package/dist/fn/stat.js +3 -2
  191. package/dist/fn/stopChrono.js +7 -5
  192. package/dist/fn/string2ArrayBuffer.js +1 -1
  193. package/dist/fn/submit.js +12 -2
  194. package/dist/fn/substr.js +0 -1
  195. package/dist/fn/sum.js +11 -3
  196. package/dist/fn/timestamp.js +4 -1
  197. package/dist/fn/toggleFullScreen.js +3 -1
  198. package/dist/fn/translate.js +6 -2
  199. package/dist/fn/treatAjaxArguments.js +8 -1
  200. package/dist/fn/uniqString.d.ts +1 -1
  201. package/dist/fn/uniqString.js +14 -11
  202. package/dist/fn/unique.js +5 -1
  203. package/dist/fn/upload.js +20 -10
  204. package/dist/fn/warning.js +10 -1
  205. package/package.json +1 -1
@@ -1,7 +1,6 @@
1
- import { getRow } from './getRow';
2
1
  const getField = function (arr, field, prop, val, operator) {
3
2
  var r;
4
- if (field && (r = getRow(arr, prop, val, operator))) {
3
+ if (field && (r = bbn.fn.getRow(arr, prop, val, operator))) {
5
4
  return r[field];
6
5
  }
7
6
  return undefined;
@@ -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,7 +1,10 @@
1
1
  import { replaceAll } from './replaceAll';
2
2
  const getPath = function (element) {
3
- let path, node = element, done = false;
3
+ let path,
4
+ //node = $(element),
5
+ node = element, done = false;
4
6
  while (node.length) {
7
+ //let realNode = node[0],
5
8
  let realNode = node, name = realNode.localName;
6
9
  if (!name)
7
10
  break;
@@ -16,9 +19,17 @@ const getPath = function (element) {
16
19
  }
17
20
  done = 1;
18
21
  }
19
- let parent = node.parentNode, sameTagSiblings = parent.children.filter(val => { return val.tagName === name; });
22
+ //var parent = node.parent(),
23
+ let parent = node.parentNode,
24
+ //sameTagSiblings = parent.children(name);
25
+ sameTagSiblings = parent.children.filter(val => {
26
+ return val.tagName === name;
27
+ });
20
28
  if (sameTagSiblings.length > 1) {
21
- let allSiblings = parent.children, index = allSiblings.indexOf(realNode) + 1;
29
+ //var allSiblings = parent.children(),
30
+ let allSiblings = parent.children,
31
+ //index = allSiblings.index(realNode) + 1;
32
+ index = allSiblings.indexOf(realNode) + 1;
22
33
  if (index > 1) {
23
34
  name += ':nth-child(' + index + ')';
24
35
  }
@@ -1,3 +1,6 @@
1
- import { bbn } from '../definitions';
2
- 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]; };
1
+ const getProp = function (obj, prop) {
2
+ checkType(obj, "object", bbn._("The obj must be an object in setProp"));
3
+ checkType(prop, "string", bbn._("The prop must be a string in setProp"));
4
+ return obj[prop];
5
+ };
3
6
  export { getProp };
@@ -3,9 +3,11 @@ import { md5 } from './md5';
3
3
  const getRequestId = function (url, data, datatype) {
4
4
  let d = {};
5
5
  if (data) {
6
- iterate(data, (a, n) => { if (n.indexOf('_bbn') === -1) {
7
- d[n] = a;
8
- } });
6
+ iterate(data, (a, n) => {
7
+ if (n.indexOf('_bbn') === -1) {
8
+ d[n] = a;
9
+ }
10
+ });
9
11
  }
10
12
  return url + ':' + md5((datatype || 'json') + JSON.stringify(d));
11
13
  };
@@ -1,2 +1,2 @@
1
- declare const getScrollBarSize: () => any;
1
+ declare const getScrollBarSize: () => number;
2
2
  export { getScrollBarSize };
@@ -1,17 +1,19 @@
1
- import { bbn } from '../definitions';
2
1
  const getScrollBarSize = function () {
3
2
  if (bbn.env.scrollBarSize === undefined) {
4
3
  let outer = document.createElement("div");
5
4
  outer.style.visibility = "hidden";
6
5
  outer.style.width = "100px";
7
- outer.style.msOverflowStyle = "scrollbar";
6
+ outer.style.msOverflowStyle = "scrollbar"; // needed for WinJS apps
8
7
  document.body.appendChild(outer);
9
8
  let widthNoScroll = outer.offsetWidth;
9
+ // force scrollbars
10
10
  outer.style.overflow = "scroll";
11
+ // add innerdiv
11
12
  let inner = document.createElement("div");
12
13
  inner.style.width = "100%";
13
14
  outer.appendChild(inner);
14
15
  let widthWithScroll = inner.offsetWidth;
16
+ // remove divs
15
17
  outer.parentNode.removeChild(outer);
16
18
  let sz = widthNoScroll - widthWithScroll;
17
19
  bbn.env.scrollBarSize = sz ? sz + 1 : 0;
@@ -1,2 +1,4 @@
1
- const getText = function (ele) { return ele.innerText().trim(); };
1
+ const getText = function (ele) {
2
+ return ele.innerText().trim();
3
+ };
2
4
  export { getText };
@@ -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/happy.js CHANGED
@@ -1,3 +1,10 @@
1
1
  import { log } from './log';
2
- const happy = function (...args) { args.unshift({ _bbn_console_level: 3, _bbn_console_style: "color: white; background: green; font-size: 18px;" }); log.apply(this, args); return this; };
2
+ const happy = function (...args) {
3
+ args.unshift({
4
+ _bbn_console_level: 3,
5
+ _bbn_console_style: "color: white; background: green; font-size: 18px;"
6
+ });
7
+ log.apply(this, args);
8
+ return this;
9
+ };
3
10
  export { happy };
package/dist/fn/hash.js CHANGED
@@ -1,9 +1,10 @@
1
+ import { log } from './log';
1
2
  import { isDom } from './isDom';
2
3
  import { isCp } from './isCp';
3
- import { log } from './log';
4
4
  import { circularReplacer } from './circularReplacer';
5
5
  import { simpleHash } from './simpleHash';
6
6
  const hash = function (obj) {
7
+ //log(obj);
7
8
  let st = '__bbn__';
8
9
  for (let i in arguments) {
9
10
  if (arguments[i]) {
@@ -1,2 +1,9 @@
1
- const hex2rgb = function (hex) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null; };
1
+ const hex2rgb = function (hex) {
2
+ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
3
+ return result ? {
4
+ r: parseInt(result[1], 16),
5
+ g: parseInt(result[2], 16),
6
+ b: parseInt(result[3], 16)
7
+ } : null;
8
+ };
2
9
  export { hex2rgb };
@@ -1,2 +1,4 @@
1
- const history = function () { return window.history || false; };
1
+ const history = function () {
2
+ return window.history || false;
3
+ };
2
4
  export { history };
@@ -1,2 +1,7 @@
1
- const html2text = function (st) { let $test = document.createElement('div'); $test.innerHTML = st; st = $test.innerText; return st; };
1
+ const html2text = function (st) {
2
+ let $test = document.createElement('div');
3
+ $test.innerHTML = st;
4
+ st = $test.innerText;
5
+ return st;
6
+ };
2
7
  export { html2text };
@@ -1,2 +1,8 @@
1
- const imageToCanvas = function (img) { let canvas = document.createElement("canvas"); canvas.width = img.width; canvas.height = img.height; canvas.getContext("2d").drawImage(img, 0, 0); return canvas; };
1
+ const imageToCanvas = function (img) {
2
+ let canvas = document.createElement("canvas");
3
+ canvas.width = img.width;
4
+ canvas.height = img.height;
5
+ canvas.getContext("2d").drawImage(img, 0, 0);
6
+ return canvas;
7
+ };
2
8
  export { imageToCanvas };
@@ -1,4 +1,7 @@
1
1
  import { imageToCanvas } from './imageToCanvas';
2
2
  import { canvasToImage } from './canvasToImage';
3
- const imgToBase64 = function (img) { let canvas = imageToCanvas(img); return canvasToImage(canvas); };
3
+ const imgToBase64 = function (img) {
4
+ let canvas = imageToCanvas(img);
5
+ return canvasToImage(canvas);
6
+ };
4
7
  export { imgToBase64 };
package/dist/fn/info.js CHANGED
@@ -1,3 +1,11 @@
1
1
  import { log } from './log';
2
- const info = function (...args) { args.unshift({ _bbn_console_level: 4, _bbn_console_style: "color: #EEE; background: blue; font-size: 12px;" }); log.apply(this, args); return this; };
2
+ const info = function (...args) {
3
+ args.unshift({
4
+ //_bbn_console_mode: "info",
5
+ _bbn_console_level: 4,
6
+ _bbn_console_style: "color: #EEE; background: blue; font-size: 12px;"
7
+ });
8
+ log.apply(this, args);
9
+ return this;
10
+ };
3
11
  export { info };
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';
@@ -19,26 +18,72 @@ const init = function (cfg, force) {
19
18
  bbn.env.root += '/';
20
19
  }
21
20
  if (!bbn.env.isInit && (typeof dayjs !== 'undefined')) {
22
- each(['advancedFormat', 'arraySupport', 'badMutable', 'buddhistEra', 'calendar', 'customParseFormat', 'dayOfYear', 'devHelper', 'duration', 'isBetween', 'isLeapYear', 'isSameOrAfter', 'isSameOrBefore', 'isToday', 'isTomorrow', 'isYesterday', 'isoWeek', 'isoWeeksInYear', 'localeData', 'localizedFormat', 'minMax', 'objectSupport', 'pluralGetSet', 'quarterOfYear', 'relativeTime', 'timezone', 'toArray', 'toObject', 'updateLocale', 'utc', 'weekOfYear', 'weekYear', 'weekday'], plugin => { if (window['dayjs_plugin_' + plugin]) {
23
- dayjs.extend(window['dayjs_plugin_' + plugin]);
24
- } });
21
+ each([
22
+ 'advancedFormat',
23
+ 'arraySupport',
24
+ 'badMutable',
25
+ 'buddhistEra',
26
+ 'calendar',
27
+ 'customParseFormat',
28
+ 'dayOfYear',
29
+ 'devHelper',
30
+ 'duration',
31
+ 'isBetween',
32
+ 'isLeapYear',
33
+ 'isSameOrAfter',
34
+ 'isSameOrBefore',
35
+ 'isToday',
36
+ 'isTomorrow',
37
+ 'isYesterday',
38
+ 'isoWeek',
39
+ 'isoWeeksInYear',
40
+ 'localeData',
41
+ 'localizedFormat',
42
+ 'minMax',
43
+ 'objectSupport',
44
+ 'pluralGetSet',
45
+ 'quarterOfYear',
46
+ 'relativeTime',
47
+ 'timezone',
48
+ 'toArray',
49
+ 'toObject',
50
+ 'updateLocale',
51
+ 'utc',
52
+ 'weekOfYear',
53
+ 'weekYear',
54
+ 'weekday'
55
+ ], plugin => {
56
+ if (window['dayjs_plugin_' + plugin]) {
57
+ dayjs.extend(window['dayjs_plugin_' + plugin]);
58
+ }
59
+ });
25
60
  }
61
+ /* The server's path (difference between the host and the current dir */
26
62
  if (typeof (cfg) === 'object') {
27
63
  extend(true, window.bbn, cfg);
28
64
  }
29
65
  bbn.env.path = substr(bbn.env.url, bbn.env.root.length);
30
66
  parts = bbn.env.path.split("/");
31
- each(parts, (v, i) => { v = decodeURI(v.trim()); if (v !== "") {
32
- bbn.env.params.push(v);
33
- } });
67
+ //$.each(parts, function(i, v){
68
+ each(parts, (v, i) => {
69
+ v = decodeURI(v.trim());
70
+ if (v !== "") {
71
+ bbn.env.params.push(v);
72
+ }
73
+ });
34
74
  if (bbn.var.colors) {
35
75
  addColors(bbn.var.colors);
36
76
  }
37
77
  if (bbn.env.lang && (undefined !== dayjs)) {
38
78
  dayjs.locale(bbn.env.lang);
39
79
  }
40
- window.onfocus = () => { bbn.env.isFocused = true; };
41
- window.onblur = () => { bbn.env.isFocused = false; bbn.env.timeoff = Math.round((new Date()).getTime() / 1000); };
80
+ window.onfocus = () => {
81
+ bbn.env.isFocused = true;
82
+ };
83
+ window.onblur = () => {
84
+ bbn.env.isFocused = false;
85
+ bbn.env.timeoff = Math.round((new Date()).getTime() / 1000);
86
+ };
42
87
  document.addEventListener("focusin", e => {
43
88
  if (!e.target.classList.contains('bbn-no')) {
44
89
  bbn.env.focused = e.target;
@@ -73,10 +118,20 @@ const init = function (cfg, force) {
73
118
  return false;
74
119
  }
75
120
  });
76
- each(document.querySelectorAll("form:not(.bbn-no), form:not(.bbn-form)"), (ele, i) => { ele.addEventListener("submit", e => { submit(ele, e); }); });
77
- window.addEventListener('hashchange', () => { bbn.env.hashChanged = (new Date()).getTime(); }, false);
78
- window.addEventListener("resize", () => { resize(); });
79
- window.addEventListener("orientationchange", () => { resize(); });
121
+ each(document.querySelectorAll("form:not(.bbn-no), form:not(.bbn-form)"), (ele, i) => {
122
+ ele.addEventListener("submit", e => {
123
+ submit(ele, e);
124
+ });
125
+ });
126
+ window.addEventListener('hashchange', () => {
127
+ bbn.env.hashChanged = (new Date()).getTime();
128
+ }, false);
129
+ window.addEventListener("resize", () => {
130
+ resize();
131
+ });
132
+ window.addEventListener("orientationchange", () => {
133
+ resize();
134
+ });
80
135
  resize();
81
136
  if (isMobile()) {
82
137
  document.body.classList.add('bbn-mobile');
@@ -88,9 +143,11 @@ const init = function (cfg, force) {
88
143
  window.onpopstate = function (e) {
89
144
  let h = window.history;
90
145
  if (!bbn.env.historyDisabled && h) {
146
+ //e.preventDefault();
91
147
  let state = h.state;
92
148
  if (state) {
93
149
  if (defaultHistoryFunction(state)) {
150
+ //link(substr(state.url, bbn.env.root.length), $.extend({title: state.title}, state.data));
94
151
  link(state.url, extend({ title: state.title || bbn.env.siteTitle }, state.data || {}));
95
152
  }
96
153
  else if (state && state.data && isFunction(state.data.script)) {
@@ -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;
@@ -1,2 +1,2 @@
1
- declare const isArray: () => boolean;
1
+ declare const isArray: (...args: any[]) => boolean;
2
2
  export { isArray };
@@ -1,7 +1,7 @@
1
- const isArray = function () {
2
- if (!arguments.length)
1
+ const isArray = function (...args) {
2
+ if (!args.length)
3
3
  return false;
4
- for (let a of arguments) {
4
+ for (let a of args) {
5
5
  if (!Array.isArray(a)) {
6
6
  return false;
7
7
  }
@@ -1,2 +1,2 @@
1
- declare const isBlob: () => boolean;
1
+ declare const isBlob: (...args: any[]) => boolean;
2
2
  export { isBlob };
package/dist/fn/isBlob.js CHANGED
@@ -1,7 +1,7 @@
1
- const isBlob = function () {
2
- if (!arguments.length)
1
+ const isBlob = function (...args) {
2
+ if (!args.length)
3
3
  return false;
4
- for (let a of arguments) {
4
+ for (let a of args) {
5
5
  if ({}.toString.apply(a) !== '[object Blob]') {
6
6
  return false;
7
7
  }
@@ -1,2 +1,2 @@
1
- declare const isBoolean: () => boolean;
1
+ declare const isBoolean: (...args: any[]) => boolean;
2
2
  export { isBoolean };
@@ -1,7 +1,7 @@
1
- const isBoolean = function () {
2
- if (!arguments.length)
1
+ const isBoolean = function (...args) {
2
+ if (!args.length)
3
3
  return false;
4
- for (let a of arguments) {
4
+ for (let a of args) {
5
5
  if (![true, false].includes(a)) {
6
6
  return false;
7
7
  }
@@ -1,2 +1,2 @@
1
- declare const isCanvas: () => boolean;
1
+ declare const isCanvas: (...args: any[]) => boolean;
2
2
  export { isCanvas };
@@ -1,7 +1,7 @@
1
- const isCanvas = function () {
2
- if (!arguments.length)
1
+ const isCanvas = function (...args) {
2
+ if (!args.length)
3
3
  return false;
4
- for (let a of arguments) {
4
+ for (let a of args) {
5
5
  if (!(a instanceof HTMLCanvasElement)) {
6
6
  return false;
7
7
  }
@@ -1,2 +1,2 @@
1
- declare const isComment: () => boolean;
1
+ declare const isComment: (...args: any[]) => boolean;
2
2
  export { isComment };
@@ -1,7 +1,7 @@
1
- const isComment = function () {
2
- if (!arguments.length)
1
+ const isComment = function (...args) {
2
+ if (!args.length)
3
3
  return false;
4
- for (let a of arguments) {
4
+ for (let a of args) {
5
5
  if (!(a instanceof Comment)) {
6
6
  return false;
7
7
  }
package/dist/fn/isCp.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const isCp: () => boolean;
1
+ declare const isCp: (...args: any[]) => boolean;
2
2
  export { isCp };
package/dist/fn/isCp.js CHANGED
@@ -1,13 +1,12 @@
1
- import { bbn } from '../definitions';
2
1
  import { isDom } from './isDom';
3
- const isCp = function () {
4
- if (!arguments.length) {
2
+ const isCp = function (...args) {
3
+ if (!args.length) {
5
4
  return false;
6
5
  }
7
6
  if (!Object.hasOwn(bbn, 'cp')) {
8
7
  return false;
9
8
  }
10
- for (let a of arguments) {
9
+ for (let a of args) {
11
10
  let res = bbn.cp.isComponent(a);
12
11
  if (!res || isDom(res) || !res.$el) {
13
12
  return false;
@@ -1,2 +1,2 @@
1
- declare const isDate: () => boolean;
1
+ declare const isDate: (...args: any[]) => boolean;
2
2
  export { isDate };
package/dist/fn/isDate.js CHANGED
@@ -1,7 +1,7 @@
1
- const isDate = function () {
2
- if (!arguments.length)
1
+ const isDate = function (...args) {
2
+ if (!args.length)
3
3
  return false;
4
- for (let a of arguments) {
4
+ for (let a of args) {
5
5
  if ({}.toString.apply(a) !== '[object Date]') {
6
6
  return false;
7
7
  }
@@ -1,2 +1,4 @@
1
- const isDesktopDevice = function () { return this.getDeviceType() === 'desktop'; };
1
+ const isDesktopDevice = function () {
2
+ return this.getDeviceType() === 'desktop';
3
+ };
2
4
  export { isDesktopDevice };
@@ -1,2 +1,2 @@
1
- declare const isDom: () => boolean;
1
+ declare const isDom: (...args: any[]) => boolean;
2
2
  export { isDom };
package/dist/fn/isDom.js CHANGED
@@ -1,7 +1,7 @@
1
- const isDom = function () {
2
- if (!arguments.length)
1
+ const isDom = function (...args) {
2
+ if (!args.length)
3
3
  return false;
4
- for (let a of arguments) {
4
+ for (let a of args) {
5
5
  if (!(a instanceof HTMLElement)) {
6
6
  return false;
7
7
  }
@@ -1,2 +1,2 @@
1
- declare const isEvent: () => boolean;
1
+ declare const isEvent: (...args: any[]) => boolean;
2
2
  export { isEvent };
@@ -1,7 +1,7 @@
1
- const isEvent = function () {
2
- if (!arguments.length)
1
+ const isEvent = function (...args) {
2
+ if (!args.length)
3
3
  return false;
4
- for (let a of arguments) {
4
+ for (let a of args) {
5
5
  if (!(a instanceof Event)) {
6
6
  return false;
7
7
  }
@@ -1,2 +1,4 @@
1
- const isFocused = function (ele, contain) { return (ele === document.activeElement) || (contain && ele.contains && (ele.contains(document.activeElement))); };
1
+ const isFocused = function (ele, contain) {
2
+ return (ele === document.activeElement) || (contain && ele.contains && (ele.contains(document.activeElement)));
3
+ };
2
4
  export { isFocused };
@@ -1,2 +1,2 @@
1
- declare const isFunction: () => boolean;
1
+ declare const isFunction: (...args: any[]) => boolean;
2
2
  export { isFunction };
@@ -1,7 +1,7 @@
1
- const isFunction = function () {
2
- if (!arguments.length)
1
+ const isFunction = function (...args) {
2
+ if (!args.length)
3
3
  return false;
4
- for (let obj of arguments) {
4
+ for (let obj of args) {
5
5
  if (!(obj && obj.constructor && obj.call && obj.apply)) {
6
6
  return false;
7
7
  }
@@ -1,2 +1,2 @@
1
- declare const isHostname: (st: any) => any;
1
+ declare const isHostname: (...args: any[]) => boolean;
2
2
  export { isHostname };
@@ -1,12 +1,16 @@
1
- import { bbn } from '../definitions';
2
1
  import { isString } from './isString';
3
2
  import { isIP } from './isIP';
4
- const isHostname = function (st) {
5
- if (isString(st)) {
6
- if (isIP(st)) {
7
- return true;
3
+ const isHostname = function (...args) {
4
+ if (!args.length)
5
+ return false;
6
+ for (let st of args) {
7
+ if (!isString(st)) {
8
+ return false;
9
+ }
10
+ if (!isIP(st) && !bbn.var.regexp.hostname.test(st)) {
11
+ return false;
8
12
  }
9
- return bbn.var.regexp.hostname.test(st);
10
13
  }
14
+ return true;
11
15
  };
12
16
  export { isHostname };
package/dist/fn/isIP.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const isIP: (st: any) => any;
1
+ declare const isIP: (...args: any[]) => boolean;
2
2
  export { isIP };
package/dist/fn/isIP.js CHANGED
@@ -1,6 +1,12 @@
1
- import { bbn } from '../definitions';
2
1
  import { isString } from './isString';
3
- const isIP = function (st) { if (isString(st)) {
4
- return bbn.var.regexp.ip.test(st);
5
- } };
2
+ const isIP = function (...args) {
3
+ if (!args.length)
4
+ return false;
5
+ for (let st of args) {
6
+ if (!isString(st) || !bbn.var.regexp.ip.test(st)) {
7
+ return false;
8
+ }
9
+ }
10
+ return true;
11
+ };
6
12
  export { isIP };
@@ -6,10 +6,12 @@ const isInside = function (ele, ancestor) {
6
6
  if (ancestors.length) {
7
7
  if (isString(ancestor)) {
8
8
  let ok = false;
9
- each(ancestors, a => { if (a.matches && a.matches(ancestor)) {
10
- ok = true;
11
- return false;
12
- } });
9
+ each(ancestors, a => {
10
+ if (a.matches && a.matches(ancestor)) {
11
+ ok = true;
12
+ return false;
13
+ }
14
+ });
13
15
  return ok;
14
16
  }
15
17
  if (ancestor instanceof HTMLElement) {
@@ -1,2 +1,2 @@
1
- declare const isInt: () => boolean;
1
+ declare const isInt: (...args: any[]) => boolean;
2
2
  export { isInt };
package/dist/fn/isInt.js CHANGED
@@ -1,7 +1,7 @@
1
- const isInt = function () {
2
- if (!arguments.length)
1
+ const isInt = function (...args) {
2
+ if (!args.length)
3
3
  return false;
4
- for (let a of arguments) {
4
+ for (let a of args) {
5
5
  if (!Number.isInteger(a)) {
6
6
  return false;
7
7
  }
@@ -1,2 +1,4 @@
1
- const isIterable = function (v) { return v && (typeof v === 'object') && (Symbol.iterator in Object(v)); };
1
+ const isIterable = function (v) {
2
+ return v && (typeof v === 'object') && (Symbol.iterator in Object(v));
3
+ };
2
4
  export { isIterable };
@@ -1,4 +1,6 @@
1
1
  import { isMobileDevice } from './isMobileDevice';
2
2
  import { isTabletDevice } from './isTabletDevice';
3
- const isMobile = function () { return isMobileDevice() || isTabletDevice(); };
3
+ const isMobile = function () {
4
+ return isMobileDevice() || isTabletDevice();
5
+ };
4
6
  export { isMobile };