@bbn/bbn 1.0.24 → 1.0.26

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 (276) hide show
  1. package/dist/bundle.d.ts +224 -238
  2. package/dist/bundle.js +940 -906
  3. package/dist/fn/_addLoader.js +1 -1
  4. package/dist/fn/_deleteLoader.d.ts +1 -1
  5. package/dist/fn/_deleteLoader.js +2 -2
  6. package/dist/fn/abort.js +4 -4
  7. package/dist/fn/abortURL.js +2 -2
  8. package/dist/fn/addColors.d.ts +1 -1
  9. package/dist/fn/addColors.js +23 -6
  10. package/dist/fn/addInputs.d.ts +1 -2
  11. package/dist/fn/addInputs.js +4 -5
  12. package/dist/fn/adjustHeight.js +1 -1
  13. package/dist/fn/adjustSize.js +1 -1
  14. package/dist/fn/adjustWidth.js +1 -1
  15. package/dist/fn/ajax.d.ts +1 -1
  16. package/dist/fn/ajax.js +8 -7
  17. package/dist/fn/analyzeFunction.js +5 -5
  18. package/dist/fn/animateCss.js +8 -7
  19. package/dist/fn/baseName.d.ts +1 -1
  20. package/dist/fn/baseName.js +1 -1
  21. package/dist/fn/br2nl.d.ts +1 -1
  22. package/dist/fn/br2nl.js +1 -1
  23. package/dist/fn/calendar.js +1 -1
  24. package/dist/fn/callback.d.ts +1 -1
  25. package/dist/fn/callback.js +5 -5
  26. package/dist/fn/camelToCss.js +4 -2
  27. package/dist/fn/canvasToImage.js +1 -1
  28. package/dist/fn/center.js +3 -5
  29. package/dist/fn/checkProps.d.ts +1 -1
  30. package/dist/fn/checkProps.js +1 -1
  31. package/dist/fn/checkPropsDetails.d.ts +1 -4
  32. package/dist/fn/checkPropsDetails.js +10 -11
  33. package/dist/fn/checkPropsOrDie.d.ts +1 -1
  34. package/dist/fn/checkPropsOrDie.js +1 -1
  35. package/dist/fn/checkType.d.ts +1 -1
  36. package/dist/fn/checkType.js +3 -3
  37. package/dist/fn/chrono.d.ts +3 -0
  38. package/dist/fn/chrono.js +23 -0
  39. package/dist/fn/circularReplacer.js +2 -2
  40. package/dist/fn/clone.d.ts +0 -1
  41. package/dist/fn/clone.js +1 -1
  42. package/dist/fn/colorToHex.js +1 -1
  43. package/dist/fn/compare.js +44 -44
  44. package/dist/fn/compareConditions.d.ts +0 -1
  45. package/dist/fn/compareConditions.js +3 -3
  46. package/dist/fn/copy.js +9 -9
  47. package/dist/fn/correctCase.js +1 -1
  48. package/dist/fn/count.d.ts +1 -1
  49. package/dist/fn/count.js +2 -2
  50. package/dist/fn/crc32.js +12 -3
  51. package/dist/fn/createObject.d.ts +1 -1
  52. package/dist/fn/createObject.js +3 -3
  53. package/dist/fn/cssExists.js +7 -4
  54. package/dist/fn/date.js +5 -5
  55. package/dist/fn/dateSQL.js +4 -3
  56. package/dist/fn/deepPath.d.ts +1 -2
  57. package/dist/fn/defaultAjaxAbortFunction.d.ts +1 -1
  58. package/dist/fn/defaultAjaxAbortFunction.js +1 -1
  59. package/dist/fn/defaultAjaxErrorFunction.d.ts +1 -1
  60. package/dist/fn/defaultAjaxErrorFunction.js +0 -12
  61. package/dist/fn/defaultAlertFunction.d.ts +1 -1
  62. package/dist/fn/defaultAlertFunction.js +2 -3
  63. package/dist/fn/defaultConfirmFunction.d.ts +1 -1
  64. package/dist/fn/defaultEndLoadingFunction.d.ts +1 -1
  65. package/dist/fn/defaultEndLoadingFunction.js +1 -17
  66. package/dist/fn/defaultPostLinkFunction.d.ts +1 -1
  67. package/dist/fn/defaultPostLinkFunction.js +1 -1
  68. package/dist/fn/defaultPreLinkFunction.d.ts +1 -1
  69. package/dist/fn/defaultPreLinkFunction.js +2 -10
  70. package/dist/fn/defaultStartLoadingFunction.d.ts +1 -1
  71. package/dist/fn/defaultStartLoadingFunction.js +2 -13
  72. package/dist/fn/deleteProp.d.ts +1 -1
  73. package/dist/fn/deleteProp.js +3 -2
  74. package/dist/fn/diffObj.d.ts +1 -2
  75. package/dist/fn/diffObj.js +13 -14
  76. package/dist/fn/dirName.d.ts +1 -1
  77. package/dist/fn/download.d.ts +1 -1
  78. package/dist/fn/download.js +3 -5
  79. package/dist/fn/downloadContent.d.ts +1 -1
  80. package/dist/fn/each.js +1 -1
  81. package/dist/fn/error.js +2 -2
  82. package/dist/fn/escapeRegExp.js +1 -1
  83. package/dist/fn/escapeTicks.js +1 -1
  84. package/dist/fn/escapeUrl.js +1 -1
  85. package/dist/fn/extend.d.ts +1 -2
  86. package/dist/fn/extend.js +11 -11
  87. package/dist/fn/extendOut.d.ts +1 -2
  88. package/dist/fn/extendOut.js +3 -3
  89. package/dist/fn/fdate.d.ts +1 -1
  90. package/dist/fn/fdatetime.d.ts +1 -1
  91. package/dist/fn/fdatetime.js +1 -1
  92. package/dist/fn/fieldValue.js +2 -2
  93. package/dist/fn/fileExt.js +1 -1
  94. package/dist/fn/filter.d.ts +1 -2
  95. package/dist/fn/filter.js +13 -12
  96. package/dist/fn/filterToConditions.d.ts +11 -3
  97. package/dist/fn/filterToConditions.js +6 -6
  98. package/dist/fn/findAll.d.ts +0 -1
  99. package/dist/fn/findAll.js +1 -1
  100. package/dist/fn/fori.d.ts +1 -1
  101. package/dist/fn/fori.js +2 -2
  102. package/dist/fn/forir.d.ts +1 -1
  103. package/dist/fn/forir.js +2 -2
  104. package/dist/fn/formdata.d.ts +1 -1
  105. package/dist/fn/formdata.js +12 -13
  106. package/dist/fn/fromXml.js +6 -6
  107. package/dist/fn/ftime.js +1 -1
  108. package/dist/fn/getAllTags.d.ts +1 -1
  109. package/dist/fn/getAllTags.js +1 -1
  110. package/dist/fn/getAncestors.d.ts +1 -1
  111. package/dist/fn/getAncestors.js +7 -8
  112. package/dist/fn/getAttributes.js +2 -2
  113. package/dist/fn/getBrowserName.js +9 -9
  114. package/dist/fn/getBrowserVersion.js +2 -2
  115. package/dist/fn/getCookie.js +1 -1
  116. package/dist/fn/getDeviceType.js +3 -3
  117. package/dist/fn/getEventData.js +11 -8
  118. package/dist/fn/getField.d.ts +1 -1
  119. package/dist/fn/getField.js +4 -3
  120. package/dist/fn/getFieldValues.d.ts +1 -1
  121. package/dist/fn/getFieldValues.js +2 -2
  122. package/dist/fn/getHTMLOfSelection.d.ts +1 -1
  123. package/dist/fn/getHTMLOfSelection.js +9 -19
  124. package/dist/fn/getLoader.d.ts +1 -1
  125. package/dist/fn/getPath.d.ts +1 -1
  126. package/dist/fn/getPath.js +4 -4
  127. package/dist/fn/getProp.js +3 -2
  128. package/dist/fn/getProperty.js +1 -1
  129. package/dist/fn/getRow.d.ts +1 -1
  130. package/dist/fn/getRow.js +1 -1
  131. package/dist/fn/getScrollBarSize.js +9 -7
  132. package/dist/fn/getText.d.ts +1 -1
  133. package/dist/fn/getTimeoff.js +1 -1
  134. package/dist/fn/happy.js +1 -1
  135. package/dist/fn/hash.d.ts +1 -1
  136. package/dist/fn/hash.js +1 -1
  137. package/dist/fn/hex2rgb.js +7 -5
  138. package/dist/fn/html2text.d.ts +1 -1
  139. package/dist/fn/imageToCanvas.js +2 -2
  140. package/dist/fn/imgToBase64.d.ts +1 -1
  141. package/dist/fn/imgToBase64.js +3 -3
  142. package/dist/fn/info.js +1 -1
  143. package/dist/fn/init.js +29 -29
  144. package/dist/fn/isActiveInterface.js +2 -2
  145. package/dist/fn/isColor.d.ts +1 -1
  146. package/dist/fn/isColor.js +11 -4
  147. package/dist/fn/isCp.js +7 -7
  148. package/dist/fn/isDimension.d.ts +1 -1
  149. package/dist/fn/isDimension.js +11 -4
  150. package/dist/fn/isEmail.d.ts +1 -1
  151. package/dist/fn/isEmail.js +11 -4
  152. package/dist/fn/isEmpty.js +1 -1
  153. package/dist/fn/isFocused.d.ts +1 -1
  154. package/dist/fn/isFocused.js +1 -1
  155. package/dist/fn/isHostname.js +1 -1
  156. package/dist/fn/isIP.js +1 -1
  157. package/dist/fn/isInside.js +1 -1
  158. package/dist/fn/isIterable.js +1 -1
  159. package/dist/fn/isNumber.js +1 -1
  160. package/dist/fn/isPercent.js +1 -1
  161. package/dist/fn/isPrimitive.js +1 -1
  162. package/dist/fn/isPropSize.js +1 -1
  163. package/dist/fn/isSQLDate.js +1 -1
  164. package/dist/fn/isSame.d.ts +1 -2
  165. package/dist/fn/isSame.js +3 -3
  166. package/dist/fn/isURL.js +1 -1
  167. package/dist/fn/isValidDimension.js +2 -3
  168. package/dist/fn/isValue.js +1 -1
  169. package/dist/fn/isVue.d.ts +1 -1
  170. package/dist/fn/isVue.js +5 -5
  171. package/dist/fn/iterate.d.ts +1 -1
  172. package/dist/fn/iterate.js +3 -3
  173. package/dist/fn/lightenDarkenHex.js +2 -2
  174. package/dist/fn/link.d.ts +1 -2
  175. package/dist/fn/link.js +17 -19
  176. package/dist/fn/log.js +4 -4
  177. package/dist/fn/makeReactive.d.ts +0 -1
  178. package/dist/fn/makeReactive.js +35 -23
  179. package/dist/fn/map.d.ts +0 -1
  180. package/dist/fn/md5.js +30 -10
  181. package/dist/fn/money.d.ts +1 -1
  182. package/dist/fn/money.js +47 -34
  183. package/dist/fn/move.d.ts +1 -1
  184. package/dist/fn/move.js +1 -1
  185. package/dist/fn/multiorder.d.ts +1 -1
  186. package/dist/fn/multiorder.js +5 -5
  187. package/dist/fn/nl2br.d.ts +1 -1
  188. package/dist/fn/nl2br.js +1 -1
  189. package/dist/fn/numProperties.d.ts +1 -1
  190. package/dist/fn/numProperties.js +1 -1
  191. package/dist/fn/objectToFormData.d.ts +1 -1
  192. package/dist/fn/objectToFormData.js +3 -3
  193. package/dist/fn/outerHeight.d.ts +1 -1
  194. package/dist/fn/outerHeight.js +5 -4
  195. package/dist/fn/outerWidth.d.ts +1 -1
  196. package/dist/fn/outerWidth.js +1 -2
  197. package/dist/fn/pickValue.d.ts +1 -1
  198. package/dist/fn/post.d.ts +1 -1
  199. package/dist/fn/post.js +3 -3
  200. package/dist/fn/postOut.d.ts +1 -1
  201. package/dist/fn/postOut.js +2 -2
  202. package/dist/fn/printf.js +1 -3
  203. package/dist/fn/quotes2html.d.ts +1 -1
  204. package/dist/fn/quotes2html.js +3 -3
  205. package/dist/fn/randomInt.d.ts +1 -1
  206. package/dist/fn/randomString.d.ts +1 -1
  207. package/dist/fn/randomString.js +9 -8
  208. package/dist/fn/removeAccents.d.ts +1 -1
  209. package/dist/fn/removeAccents.js +1 -1
  210. package/dist/fn/removeEmpty.d.ts +1 -1
  211. package/dist/fn/removeExtraSpaces.d.ts +1 -1
  212. package/dist/fn/removeHtmlComments.d.ts +1 -1
  213. package/dist/fn/removePrivateProp.d.ts +1 -2
  214. package/dist/fn/removePrivateProp.js +6 -6
  215. package/dist/fn/removeTrailingChars.d.ts +1 -1
  216. package/dist/fn/repeat.d.ts +1 -1
  217. package/dist/fn/repeat.js +1 -6
  218. package/dist/fn/replaceAll.d.ts +1 -1
  219. package/dist/fn/replaceAll.js +1 -4
  220. package/dist/fn/replaceSelection.js +1 -1
  221. package/dist/fn/resize.js +9 -7
  222. package/dist/fn/rgb2hex.js +6 -4
  223. package/dist/fn/riterate.d.ts +1 -1
  224. package/dist/fn/roundDecimal.d.ts +1 -1
  225. package/dist/fn/roundDecimal.js +1 -1
  226. package/dist/fn/sanitize.js +3 -1
  227. package/dist/fn/search.d.ts +2 -1
  228. package/dist/fn/search.js +24 -21
  229. package/dist/fn/selectElementText.d.ts +1 -1
  230. package/dist/fn/selectElementText.js +1 -1
  231. package/dist/fn/selector.d.ts +1 -1
  232. package/dist/fn/selector.js +1 -1
  233. package/dist/fn/setCookie.js +4 -4
  234. package/dist/fn/setCssVar.js +2 -1
  235. package/dist/fn/setNavigationVars.d.ts +1 -1
  236. package/dist/fn/setNavigationVars.js +6 -5
  237. package/dist/fn/setProp.d.ts +1 -1
  238. package/dist/fn/setProp.js +1 -3
  239. package/dist/fn/setProperty.d.ts +1 -1
  240. package/dist/fn/setProperty.js +2 -2
  241. package/dist/fn/shorten.d.ts +1 -1
  242. package/dist/fn/shorten.js +3 -3
  243. package/dist/fn/shortenObj.d.ts +1 -2
  244. package/dist/fn/shortenObj.js +2 -2
  245. package/dist/fn/shuffle.d.ts +1 -1
  246. package/dist/fn/shuffle.js +1 -3
  247. package/dist/fn/simpleHash.d.ts +1 -1
  248. package/dist/fn/simpleHash1.d.ts +1 -1
  249. package/dist/fn/simpleHash1.js +1 -1
  250. package/dist/fn/simpleHash2.d.ts +1 -1
  251. package/dist/fn/stat.d.ts +1 -1
  252. package/dist/fn/stat.js +8 -8
  253. package/dist/fn/string2ArrayBuffer.d.ts +1 -1
  254. package/dist/fn/submit.d.ts +1 -1
  255. package/dist/fn/submit.js +6 -21
  256. package/dist/fn/substr.d.ts +1 -1
  257. package/dist/fn/substr.js +1 -1
  258. package/dist/fn/sum.d.ts +1 -1
  259. package/dist/fn/sum.js +2 -3
  260. package/dist/fn/timestamp.d.ts +1 -1
  261. package/dist/fn/timestamp.js +1 -1
  262. package/dist/fn/toCSV.d.ts +1 -1
  263. package/dist/fn/toCSV.js +1 -1
  264. package/dist/fn/toggleFullScreen.js +13 -13
  265. package/dist/fn/translate.d.ts +1 -1
  266. package/dist/fn/treatAjaxArguments.d.ts +1 -1
  267. package/dist/fn/treatAjaxArguments.js +16 -14
  268. package/dist/fn/uniqString.js +3 -3
  269. package/dist/fn/unique.d.ts +1 -1
  270. package/dist/fn/upload.d.ts +1 -1
  271. package/dist/fn/upload.js +6 -6
  272. package/dist/fn/warning.d.ts +1 -1
  273. package/dist/fn/warning.js +6 -6
  274. package/dist/index.d.ts +106 -108
  275. package/dist/index.js +5 -6
  276. package/package.json +3 -1
@@ -28,7 +28,7 @@ const _addLoader = function (requestId, prom, source) {
28
28
  while (idx && (bbn.env.loadersHistory.length > bbn.env.maxLoadersHistory)) {
29
29
  idx--;
30
30
  // Not removing the ones still loading
31
- if (!bbn.env.loadersHistory.loading) {
31
+ if (!bbn.env.loading) {
32
32
  bbn.env.loadersHistory.splice(idx, 1);
33
33
  }
34
34
  }
@@ -1,2 +1,2 @@
1
- declare const _deleteLoader: (requestId: any, res: any, isAbort: any) => boolean;
1
+ declare const _deleteLoader: (requestId: string, res?: any, isAbort?: boolean) => boolean;
2
2
  export { _deleteLoader };
@@ -1,14 +1,14 @@
1
1
  import { search } from './search';
2
2
  import { getRow } from './getRow';
3
3
  import { isObject } from './isObject';
4
- const _deleteLoader = function (requestId, res, isAbort) {
4
+ const _deleteLoader = function (requestId, res = null, isAbort = false) {
5
5
  let idx = search(bbn.env.loaders, { key: requestId });
6
6
  if (idx > -1) {
7
7
  let loader = bbn.env.loaders.splice(idx, 1)[0];
8
8
  let history = getRow(bbn.env.loadersHistory, { key: requestId, start: loader.start });
9
9
  if (history) {
10
10
  history.loading = false;
11
- history.duration = (new Date()).getTime() - loader.start;
11
+ history.duration = new Date().getTime() - loader.start;
12
12
  if (typeof res === 'string') {
13
13
  history.errorMessage = res;
14
14
  history.error = !isAbort;
package/dist/fn/abort.js CHANGED
@@ -6,9 +6,9 @@ const abort = function (requestId) {
6
6
  loader.source.cancel('Operation canceled by the user.');
7
7
  }
8
8
  /*
9
- else {
10
- throw new Error("Impossible to find the loader " + requestId);
11
- }
12
- */
9
+ else {
10
+ throw new Error("Impossible to find the loader " + requestId);
11
+ }
12
+ */
13
13
  };
14
14
  export { abort };
@@ -1,12 +1,12 @@
1
1
  import { each } from './each';
2
2
  import { filter } from './filter';
3
3
  const abortURL = function (url) {
4
- each(filter(bbn.env.loaders, { url: url }), a => {
4
+ each(filter(bbn.env.loaders, { url: url }), (a) => {
5
5
  if (a && a.source) {
6
6
  a.source.cancel('Operation canceled by the user.');
7
7
  }
8
8
  else {
9
- throw new Error("Impossible to find the loader with URL " + url);
9
+ throw new Error('Impossible to find the loader with URL ' + url);
10
10
  }
11
11
  });
12
12
  };
@@ -1,2 +1,2 @@
1
- declare const addColors: (colors: any) => void;
1
+ declare const addColors: (colors: object) => void;
2
2
  export { addColors };
@@ -1,10 +1,9 @@
1
1
  import { numProperties } from './numProperties';
2
2
  import { iterate } from './iterate';
3
3
  const addColors = function (colors) {
4
- let st = '';
5
4
  if (numProperties(colors)) {
6
- if (!bbn.var.colors) {
7
- bbn.var.colors = {};
5
+ if (!bbn.vars.colors) {
6
+ bbn.vars.colors = {};
8
7
  }
9
8
  let element = document.createElement('style');
10
9
  document.head.appendChild(element);
@@ -12,10 +11,28 @@ const addColors = function (colors) {
12
11
  // Append style element to head
13
12
  let i = 0;
14
13
  iterate(colors, (v, n) => {
15
- bbn.var.colors[n] = v;
14
+ bbn.vars.colors[n] = v;
16
15
  sheet.insertRule('.bbn-' + n + ', .bbn-color-text-' + n + ' {color: ' + v + ' !important;}', i);
17
- sheet.insertRule('svg.bbn-' + n + ', .bbn-' + n + ' svg, svg.bbn-color-text-' + n + ', .bbn-color-text-' + n + ' svg {fill: ' + v + ';}', i);
18
- sheet.insertRule('.bbn-bg-' + n + ', .bbn-color-bg-' + n + ', .bbn-color-background-' + n + ' {background-color: ' + v + ' !important;}', i);
16
+ sheet.insertRule('svg.bbn-' +
17
+ n +
18
+ ', .bbn-' +
19
+ n +
20
+ ' svg, svg.bbn-color-text-' +
21
+ n +
22
+ ', .bbn-color-text-' +
23
+ n +
24
+ ' svg {fill: ' +
25
+ v +
26
+ ';}', i);
27
+ sheet.insertRule('.bbn-bg-' +
28
+ n +
29
+ ', .bbn-color-bg-' +
30
+ n +
31
+ ', .bbn-color-background-' +
32
+ n +
33
+ ' {background-color: ' +
34
+ v +
35
+ ' !important;}', i);
19
36
  sheet.insertRule('.bbn-border-' + n + ', .bbn-color-border-' + n + ' {border-color: ' + v + ' !important;}', i);
20
37
  sheet.insertRule('.bbn-color-' + n + ' {border-color: ' + v + '; background-color: ' + v + '; color: ' + v + ';}', i);
21
38
  });
@@ -1,3 +1,2 @@
1
- import { addInputs } from './addInputs';
2
- declare const addInputs: (form: any, params: any, prefix: any) => void;
1
+ declare const addInputs: (form: HTMLFormElement, params?: object, prefix?: string) => void;
3
2
  export { addInputs };
@@ -1,6 +1,6 @@
1
1
  import { iterate } from './iterate';
2
- const addInputs = function (form, params, prefix) {
3
- if (form && (form.tagName === 'FORM')) {
2
+ const addInputs = function (form, params = null, prefix = '') {
3
+ if (form && form.tagName === 'FORM') {
4
4
  let appendToForm = (name, val) => {
5
5
  let input = document.createElement('input');
6
6
  input.setAttribute('type', 'hidden');
@@ -14,7 +14,7 @@ const addInputs = function (form, params, prefix) {
14
14
  iterate(params, (param, key) => {
15
15
  let name = prefix ? `${prefix}[${key}]` : key;
16
16
  if (param instanceof Date) {
17
- appendToForm(form, name, param.toISOString());
17
+ appendToForm(name, param.toISOString());
18
18
  }
19
19
  else if (param instanceof Array) {
20
20
  param.forEach((e, i) => {
@@ -27,8 +27,7 @@ const addInputs = function (form, params, prefix) {
27
27
  }
28
28
  });
29
29
  }
30
- else if ((typeof param === 'object') &&
31
- !(param instanceof File)) {
30
+ else if (typeof param === 'object' && !(param instanceof File)) {
32
31
  addInputs(form, param, name);
33
32
  }
34
33
  else {
@@ -2,7 +2,7 @@ import { isIterable } from './isIterable';
2
2
  import { adjustSize } from './adjustSize';
3
3
  const adjustHeight = function () {
4
4
  let args = arguments;
5
- if ((args.length === 1) && isIterable(args[0])) {
5
+ if (args.length === 1 && isIterable(args[0])) {
6
6
  args = args[0];
7
7
  }
8
8
  return adjustSize('height', args);
@@ -5,7 +5,7 @@ const adjustSize = function (type, eles) {
5
5
  el.style[type] = 'auto';
6
6
  });
7
7
  each(eles, (el, i) => {
8
- let rect = el.getBoundingClientRect(), s = rect[type] % 1 ? (rect[type] - (rect[type] % 1) + 1) : rect[type];
8
+ let rect = el.getBoundingClientRect(), s = rect[type] % 1 ? rect[type] - (rect[type] % 1) + 1 : rect[type];
9
9
  //s = rect[type];
10
10
  if (s > max) {
11
11
  max = s;
@@ -2,7 +2,7 @@ import { isIterable } from './isIterable';
2
2
  import { adjustSize } from './adjustSize';
3
3
  const adjustWidth = function () {
4
4
  let args = arguments;
5
- if ((args.length === 1) && isIterable(args[0])) {
5
+ if (args.length === 1 && isIterable(args[0])) {
6
6
  args = args[0];
7
7
  }
8
8
  return adjustSize('width', args);
package/dist/fn/ajax.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const ajax: (url: any, datatype: any, data: any, success: any, failure: any, abort: any) => any;
1
+ declare const ajax: (url: any, datatype: string, data: any, success?: (data: object, headers?: object) => any, failure?: (url: string, o?: object) => any, abort?: (message: string, url: string) => any) => any;
2
2
  export { ajax };
package/dist/fn/ajax.js CHANGED
@@ -12,7 +12,7 @@ import { defaultAjaxAbortFunction } from './defaultAjaxAbortFunction';
12
12
  import { _addLoader } from './_addLoader';
13
13
  import { defaultStartLoadingFunction } from './defaultStartLoadingFunction';
14
14
  const ajax = function (url, datatype, data, success, failure, abort) {
15
- if ((arguments.length === 1) && isObject(url) && url.url) {
15
+ if (arguments.length === 1 && url && typeof url === 'object' && url.url) {
16
16
  if (url.abort) {
17
17
  abort = url.abort;
18
18
  }
@@ -33,10 +33,10 @@ const ajax = function (url, datatype, data, success, failure, abort) {
33
33
  if (!url) {
34
34
  return;
35
35
  }
36
- if (url) {
36
+ if (url && typeof url === 'string') {
37
37
  if (url.indexOf('://') === -1) {
38
38
  // Prevent protocol mismatch by Axios
39
- url = replaceAll("//", "/", url);
39
+ url = replaceAll('//', '/', url);
40
40
  }
41
41
  if (!datatype) {
42
42
  datatype = 'json';
@@ -54,20 +54,21 @@ const ajax = function (url, datatype, data, success, failure, abort) {
54
54
  let source = cancelToken.source();
55
55
  let options = {
56
56
  responseType: datatype,
57
- cancelToken: source.token
57
+ cancelToken: source.token,
58
58
  };
59
59
  if (datatype === 'text') {
60
60
  options.headers = {
61
61
  accept: 'text/javascript',
62
- 'Content-Type': 'text/javascript'
62
+ 'Content-Type': 'text/javascript',
63
63
  };
64
64
  }
65
65
  let args = [url];
66
- if (isObject(data) && (numProperties(data) > 0)) {
66
+ if (isObject(data) && numProperties(data) > 0) {
67
67
  args.push(data);
68
68
  }
69
69
  args.push(options);
70
- let loader = axios[args.length === 2 ? 'get' : 'post'].apply(axios, args)
70
+ let loader = axios[args.length === 2 ? 'get' : 'post']
71
+ .apply(axios, args)
71
72
  .then((res) => {
72
73
  _deleteLoader(requestId, res);
73
74
  defaultEndLoadingFunction(url, tst, data, res);
@@ -17,7 +17,7 @@ const analyzeFunction = function (fn) {
17
17
  let isEscaped = false;
18
18
  let settingDefault = false;
19
19
  for (let i = 0; i < all.length; i++) {
20
- if ((all[i] === currentQuote) && !isEscaped && currentQuote) {
20
+ if (all[i] === currentQuote && !isEscaped && currentQuote) {
21
21
  currentQuote = '';
22
22
  exp += all[i];
23
23
  }
@@ -59,7 +59,7 @@ const analyzeFunction = function (fn) {
59
59
  }
60
60
  else if (all[i] === '=') {
61
61
  if (functionString.substr(i, 2) === '=>') {
62
- if (exp.trim() !== "" && parOpened === parClosed) {
62
+ if (exp.trim() !== '' && parOpened === parClosed) {
63
63
  currentArg.name = exp.trim();
64
64
  args.push(currentArg);
65
65
  currentArg = {};
@@ -122,10 +122,10 @@ const analyzeFunction = function (fn) {
122
122
  body = exp;
123
123
  }
124
124
  else {
125
- throw Error("Unexpected end of function while parsing function");
125
+ throw Error('Unexpected end of function while parsing function');
126
126
  }
127
127
  }
128
- const argString = args.map(arg => arg.name + (arg.default ? ' = ' + arg.default : '')).join(', ');
128
+ const argString = args.map((arg) => arg.name + (arg.default ? ' = ' + arg.default : '')).join(', ');
129
129
  const hash = md5(body + (name ? '-' + name : '') + (argString ? '-' + argString : ''));
130
130
  return {
131
131
  body,
@@ -135,7 +135,7 @@ const analyzeFunction = function (fn) {
135
135
  hasFunction,
136
136
  name,
137
137
  isAsync,
138
- hash
138
+ hash,
139
139
  };
140
140
  };
141
141
  export { analyzeFunction };
@@ -1,19 +1,20 @@
1
1
  const animateCss = function (ele, animationName, callback) {
2
2
  let animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
3
3
  /*$(ele).addClass('animated ' + animationName).one(animationEnd, function(){
4
- if ( typeof callback == 'function' ){ // make sure the callback is a function
5
- callback.call(this); // brings the scope to the callback
6
- }
7
- $(this).removeClass('animated ' + animationName);
8
- })*/
4
+ if ( typeof callback == 'function' ){ // make sure the callback is a function
5
+ callback.call(this); // brings the scope to the callback
6
+ }
7
+ $(this).removeClass('animated ' + animationName);
8
+ })*/
9
9
  ele.classList.add('animated');
10
10
  ele.classList.add(animationName);
11
11
  ele.addEventListener(animationEnd, (e) => {
12
12
  e.target.removeEventListener(e.type, arguments.callee);
13
- if (typeof callback == 'function') { // make sure the callback is a function
13
+ if (typeof callback == 'function') {
14
+ // make sure the callback is a function
14
15
  callback.call(this); // brings the scope to the callback
15
16
  }
16
- this.classList.remove(animation);
17
+ this.classList.remove(animationName);
17
18
  });
18
19
  };
19
20
  export { animateCss };
@@ -1,2 +1,2 @@
1
- declare const baseName: (path: any, suffix: any) => any;
1
+ declare const baseName: (path: string, suffix?: string) => string;
2
2
  export { baseName };
@@ -2,7 +2,7 @@ import { isString } from './isString';
2
2
  import { substr } from './substr';
3
3
  const baseName = function (path, suffix) {
4
4
  if (path && isString(path)) {
5
- let bits = path.split("/");
5
+ let bits = path.split('/');
6
6
  let res = bits.pop();
7
7
  if (!suffix) {
8
8
  return res;
@@ -1,2 +1,2 @@
1
- declare const br2nl: (st: any) => any;
1
+ declare const br2nl: (st: any) => string;
2
2
  export { br2nl };
package/dist/fn/br2nl.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { replaceAll } from './replaceAll';
2
2
  const br2nl = function (st) {
3
- return replaceAll("<br />", "\n", replaceAll("<br/>", "\n", replaceAll("<br>", "\n", st)));
3
+ return replaceAll('<br />', '\n', replaceAll('<br/>', '\n', replaceAll('<br>', '\n', st)));
4
4
  };
5
5
  export { br2nl };
@@ -16,7 +16,7 @@ const calendar = function (d, wrong_result) {
16
16
  nextWeek: 'ddd D',
17
17
  lastDay: '[' + bbn._('Yesterday') + ']',
18
18
  lastWeek: 'ddd D',
19
- sameElse: 'L'
19
+ sameElse: 'L',
20
20
  });
21
21
  };
22
22
  export { calendar };
@@ -1,2 +1,2 @@
1
- declare const callback: (url: any, res: any, fn: any, fn2: any, ele: any) => boolean;
1
+ declare const callback: (url: string, res?: BbnAjaxResult, fn?: (a: BbnAjaxResult, b?: HTMLElement) => any, fn2?: (a: BbnAjaxResult) => any, ele?: HTMLElement | HTMLInputElement | HTMLTextAreaElement) => boolean;
2
2
  export { callback };
@@ -4,7 +4,7 @@ import { isFunction } from './isFunction';
4
4
  import { log } from './log';
5
5
  import { defaultPostLinkFunction } from './defaultPostLinkFunction';
6
6
  import { defaultAlertFunction } from './defaultAlertFunction';
7
- const callback = function (url, res, fn, fn2, ele) {
7
+ const callback = function (url, res = null, fn = null, fn2 = null, ele = null) {
8
8
  let tmp = false;
9
9
  if (res) {
10
10
  tmp = true;
@@ -31,16 +31,16 @@ const callback = function (url, res, fn, fn2, ele) {
31
31
  tmp = defaultLinkFunction(res, ele);
32
32
  }
33
33
  if (ele && isObj && (res.content !== undefined)) {
34
- if (ele.is("input,textarea")) {
35
- ele.val(res.content);
34
+ if ('value' in ele) {
35
+ ele.value = res.content;
36
36
  }
37
37
  else {
38
38
  ele.innerHTML = res.content;
39
39
  }
40
40
  }
41
41
  if (tmp && isObj && res.script) {
42
- if (isFunction(res.script)) {
43
- tmp = res.script(res.data ? res.data : {}, ele ? ele : false);
42
+ if (typeof (res.script) === 'function') {
43
+ tmp = res.script(res.data ? res.data : {}, ele || null);
44
44
  }
45
45
  else {
46
46
  tmp = ((data, ele) => {
@@ -1,7 +1,9 @@
1
1
  const camelToCss = function (str) {
2
- return str.replace(/([A-Z])/g, function (st) {
2
+ return str
3
+ .replace(/([A-Z])/g, function (st) {
3
4
  return '-' + st.toLowerCase();
4
- }).replace('/^./', function (st) {
5
+ })
6
+ .replace('/^./', function (st) {
5
7
  return st.toLowerCase();
6
8
  });
7
9
  };
@@ -1,6 +1,6 @@
1
1
  const canvasToImage = function (canvas) {
2
2
  let img = new Image();
3
- img.src = canvas.toDataURL("image/png");
3
+ img.src = canvas.toDataURL('image/png');
4
4
  return img;
5
5
  };
6
6
  export { canvasToImage };
package/dist/fn/center.js CHANGED
@@ -1,4 +1,3 @@
1
- import { log } from './log';
2
1
  const center = function (ele) {
3
2
  //ele = $(ele);
4
3
  let parent = ele.parentNode,
@@ -14,13 +13,12 @@ const center = function (ele) {
14
13
  w = parent.clientWidth;
15
14
  h = parent.clientHeight;
16
15
  }
17
- log("BBN_CENTER", w, h);
18
16
  //ele.css("position","absolute");
19
- ele.style.position = "absolute";
17
+ ele.style.position = 'absolute';
20
18
  //ele.css("top", Math.max(0, ((h - ele.outerHeight()) / 2) + parent.scrollTop()) + "px");
21
- ele.style.top = Math.max(0, ((h - ele.offsetHeight) / 2) + parent.scrollTop) + "px";
19
+ ele.style.top = Math.max(0, (h - ele.offsetHeight) / 2 + parent.scrollTop) + 'px';
22
20
  //ele.css("left", Math.max(0, ((w - ele.outerWidth()) / 2) + parent.scrollLeft()) + "px");
23
- ele.style.left = Math.max(0, ((h - ele.offsetWidth) / 2) + parent.scrollLeft) + "px";
21
+ ele.style.left = Math.max(0, (h - ele.offsetWidth) / 2 + parent.scrollLeft) + 'px';
24
22
  return ele;
25
23
  };
26
24
  export { center };
@@ -1,2 +1,2 @@
1
- declare const checkProps: (obj: any, props: any, checkEmpty: any) => boolean;
1
+ declare const checkProps: (obj: object, props: string | string[], checkEmpty?: boolean) => boolean;
2
2
  export { checkProps };
@@ -1,5 +1,5 @@
1
1
  import { checkPropsDetails } from './checkPropsDetails';
2
- const checkProps = function (obj, props, checkEmpty) {
2
+ const checkProps = function (obj, props, checkEmpty = false) {
3
3
  return checkPropsDetails(obj, props, checkEmpty).result;
4
4
  };
5
5
  export { checkProps };
@@ -1,5 +1,2 @@
1
- declare const checkPropsDetails: (obj: any, props: any, checkEmpty: any) => {
2
- error: boolean;
3
- result: boolean;
4
- };
1
+ declare const checkPropsDetails: (obj: object, props: string | string[], checkEmpty?: boolean) => BbnResError;
5
2
  export { checkPropsDetails };
@@ -1,42 +1,41 @@
1
- import { isString } from './isString';
2
1
  import { isArray } from './isArray';
3
2
  import { isObject } from './isObject';
4
3
  import { each } from './each';
5
4
  import { substr } from './substr';
6
- const checkPropsDetails = function (obj, props, checkEmpty) {
5
+ const checkPropsDetails = function (obj, props, checkEmpty = false) {
7
6
  let res = {
8
7
  error: false,
9
- result: true
8
+ result: true,
10
9
  };
11
- if (isString(props)) {
10
+ if (typeof (props) === 'string') {
12
11
  props = [props];
13
12
  }
14
13
  if (!isArray(props)) {
15
- res.error = bbn._("checkProps must receive a string or an array as props argument");
14
+ res.error = bbn._('checkProps must receive a string or an array as props argument');
16
15
  }
17
16
  if (!isObject(obj)) {
18
- res.error = bbn._("checkProps must receive an object as obj argument");
17
+ res.error = bbn._('checkProps must receive an object as obj argument');
19
18
  }
20
19
  if (!res.error) {
21
20
  let check;
22
- each(props, varName => {
21
+ each(props, (varName) => {
23
22
  varName = varName.trim().split(':');
24
23
  let type = varName[1] || false;
25
24
  varName = varName[0];
26
25
  if (obj[varName] === undefined) {
27
- res.error = varName + ' ' + bbn._("is not defined");
26
+ res.error = varName + ' ' + bbn._('is not defined');
28
27
  }
29
28
  else if (type) {
30
29
  check = 'is' + substr(type, 0, 1).toUpperCase() + substr(type, 1).toLowerCase();
31
30
  if (bbn.fn[check] === undefined) {
32
- res.error = type + ' ' + bbn._("is not a valid type");
31
+ res.error = type + ' ' + bbn._('is not a valid type');
33
32
  }
34
33
  else if (!bbn.fn[check](obj[varName])) {
35
- res.error = varName + ' ' + bbn._("is not a") + ' ' + type;
34
+ res.error = varName + ' ' + bbn._('is not a') + ' ' + type;
36
35
  }
37
36
  }
38
37
  else if (checkEmpty && !obj[varName]) {
39
- res.error = varName + ' ' + bbn._("is empty");
38
+ res.error = varName + ' ' + bbn._('is empty');
40
39
  }
41
40
  if (res.error) {
42
41
  return false;
@@ -1,2 +1,2 @@
1
- declare const checkPropsOrDie: (obj: any, props: any, checkEmpty: any) => boolean;
1
+ declare const checkPropsOrDie: (obj: object, props: string | string[], checkEmpty?: boolean) => boolean;
2
2
  export { checkPropsOrDie };
@@ -1,5 +1,5 @@
1
1
  import { checkPropsDetails } from './checkPropsDetails';
2
- const checkPropsOrDie = function (obj, props, checkEmpty) {
2
+ const checkPropsOrDie = function (obj, props, checkEmpty = false) {
3
3
  let res = checkPropsDetails(obj, props, checkEmpty);
4
4
  if (res.error) {
5
5
  throw new Error(res.error);
@@ -1,2 +1,2 @@
1
- declare const checkType: (value: any, type: any, msg: any, ...logs: any[]) => void;
1
+ declare const checkType: (value: any, type: object | string, msg?: string, ...logs: any[]) => void;
2
2
  export { checkType };
@@ -11,7 +11,7 @@ const checkType = function (value, type, msg, ...logs) {
11
11
  type = [type];
12
12
  }
13
13
  const typesList = [];
14
- each(type, t => {
14
+ each(type, (t) => {
15
15
  var _a;
16
16
  if (t === String) {
17
17
  t = 'string';
@@ -50,11 +50,11 @@ const checkType = function (value, type, msg, ...logs) {
50
50
  }
51
51
  });
52
52
  if (!ok) {
53
- log(["Value given", value, "type", typeof value, "expected", typesList.join(' or ')]);
53
+ log(['Value given', value, 'type', typeof value, 'expected', typesList.join(' or ')]);
54
54
  if (logs.length) {
55
55
  log(logs);
56
56
  }
57
- throw new Error((msg ? msg + ' - ' : '') + bbn._("The value should be a %s", typesList.join(' ' + bbn._("or a") + ' ')));
57
+ throw new Error((msg ? msg + ' - ' : '') + bbn._('The value should be a %s', typesList.join(' ' + bbn._('or a') + ' ')));
58
58
  }
59
59
  };
60
60
  export { checkType };
@@ -0,0 +1,3 @@
1
+ declare const startChrono: (name: any) => void;
2
+ declare const stopChrono: (name: any) => number;
3
+ export { startChrono, stopChrono };
@@ -0,0 +1,23 @@
1
+ import { each } from './each';
2
+ const _private = [];
3
+ const startChrono = function (name) {
4
+ let now = new Date().getTime();
5
+ let h1 = 3600 * 1000;
6
+ if (_private.length) {
7
+ each(_private, (t, n) => {
8
+ if (now - t > h1) {
9
+ delete _private[n];
10
+ }
11
+ });
12
+ now = new Date().getTime();
13
+ }
14
+ _private[name] = now;
15
+ };
16
+ const stopChrono = function (name) {
17
+ if (_private[name]) {
18
+ let now = new Date().getTime();
19
+ let diff = now - _private[name];
20
+ return diff;
21
+ }
22
+ };
23
+ export { startChrono, stopChrono };
@@ -4,7 +4,7 @@ import { log } from './log';
4
4
  const circularReplacer = function () {
5
5
  const visited = new WeakSet();
6
6
  return (key, value) => {
7
- if ((typeof value === "object") && (value !== null)) {
7
+ if (typeof value === 'object' && value !== null) {
8
8
  if (visited.has(value)) {
9
9
  return;
10
10
  }
@@ -19,7 +19,7 @@ const circularReplacer = function () {
19
19
  }
20
20
  }
21
21
  else if (isCp(value)) {
22
- log("IS CP");
22
+ log('IS CP');
23
23
  value = '__BBN_CP__' + value.$options.name + '/' + value.$cid;
24
24
  }
25
25
  else {
@@ -1,3 +1,2 @@
1
- import { clone } from './clone';
2
1
  declare const clone: (obj: any) => any;
3
2
  export { clone };
package/dist/fn/clone.js CHANGED
@@ -4,7 +4,7 @@ import { extend } from './extend';
4
4
  const clone = function (obj) {
5
5
  if (isArray(obj)) {
6
6
  return obj.slice().map((a) => {
7
- return typeof (a) === 'object' ? clone(a) : a;
7
+ return typeof a === 'object' ? clone(a) : a;
8
8
  });
9
9
  }
10
10
  if (isObject(obj)) {
@@ -1,5 +1,5 @@
1
1
  const colorToHex = function (color) {
2
- let canvas = document.createElement("canvas").getContext("2d");
2
+ let canvas = document.createElement('canvas').getContext('2d');
3
3
  canvas.fillStyle = color;
4
4
  return canvas.fillStyle;
5
5
  };