@webalternatif/js-core 1.5.4 → 1.6.0

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/esm/array.js CHANGED
@@ -1,4 +1,4 @@
1
- import { each } from "./traversal.js";
1
+ import { each, map } from "./traversal.js";
2
2
  import { isArray, isInteger, isObject, isString, isUndefined } from "./is.js";
3
3
  import { round } from "./math.js";
4
4
  import { equals } from "./utils.js";
@@ -6,7 +6,7 @@ import { equals } from "./utils.js";
6
6
  /**
7
7
  * Checks if a value exists in an array or an object
8
8
  *
9
- * @param {*} value the searched value
9
+ * @param {any} value the searched value
10
10
  * @param {Object|Array} arr the array
11
11
  * @param {number} [index=0] if provided, search from this index
12
12
  * @param {boolean} [strict=false] if true, search is done with strict equality
@@ -21,8 +21,7 @@ import { equals } from "./utils.js";
21
21
  * // → true
22
22
  *
23
23
  * @example
24
- * inArray(5, [1, 2, 3])
25
- * // → false
24
+ * inArray(5, [1, 2, 3]) // → false
26
25
  */
27
26
  export var inArray = function inArray(value, arr) {
28
27
  var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
@@ -51,11 +50,47 @@ export var inArray = function inArray(value, arr) {
51
50
  });
52
51
  return ret;
53
52
  };
53
+
54
+ /**
55
+ * Returns the first index at which a given element can be found in an array or a string.
56
+ * or -1 if it is not present.
57
+ *
58
+ * @param {Array<any>|string} arr - The array to search in
59
+ * @param {any} elt - The element to search for
60
+ * @param {number} [from] - The index to start the search from. Can be negative.
61
+ * @returns {number} - The index of the element, or -1 if not found
62
+ */
54
63
  export var indexOf = function indexOf(arr, elt) {
55
64
  var from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
56
- from = from < 0 ? Math.ceil(from) + arr.length : Math.floor(from);
57
- for (; from < arr.length; from++) {
58
- if (from in arr && arr[from] === elt) {
65
+ var a = isString(arr) ? map(arr, function (_, a) {
66
+ return a;
67
+ }) : arr;
68
+ from = from < 0 ? Math.ceil(from) + a.length : Math.floor(from);
69
+ for (; from < a.length; from++) {
70
+ if (from in a && a[from] === elt) {
71
+ return from;
72
+ }
73
+ }
74
+ return -1;
75
+ };
76
+
77
+ /**
78
+ * Returns the last index at which a given element can be found in an array or a string.
79
+ * or -1 if it is not present.
80
+ *
81
+ * @param {Array<any>|string} arr - The array to search in
82
+ * @param {any} elt - The element to search for
83
+ * @param {number} [from] - The index to start the search from. Can be negative.
84
+ * @returns {number} - The index of the element, or -1 if not found
85
+ */
86
+ export var lastIndexOf = function lastIndexOf(arr, elt) {
87
+ var from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
88
+ var a = isString(arr) ? map(arr, function (_, a) {
89
+ return a;
90
+ }) : arr;
91
+ from = from < 0 ? a.length + Math.ceil(from) : Math.floor(from);
92
+ for (; from >= 0; from--) {
93
+ if (from in a && a[from] === elt) {
59
94
  return from;
60
95
  }
61
96
  }
package/dist/esm/dom.js CHANGED
@@ -1,129 +1,15 @@
1
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
4
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
5
1
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
6
2
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
3
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
8
4
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
9
5
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
10
6
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
- import { isArray, isArrayLike, isFunction, isObject, isPlainObject, isString, isTouchDevice } from "./is.js";
7
+ import { isArray, isArrayLike, isObject, isPlainObject, isString } from "./is.js";
12
8
  import { camelCase } from "./string.js";
13
9
  import { each, foreach, map } from "./traversal.js";
14
10
  import { inArray } from "./array.js";
15
- import Mouse from "./Mouse.js";
11
+ import { on, off, __resetCustomEventsForTests } from './onOff.js';
16
12
  var cssNumber = ['animationIterationCount', 'aspectRatio', 'borderImageSlice', 'columnCount', 'flexGrow', 'flexShrink', 'fontWeight', 'gridArea', 'gridColumn', 'gridColumnEnd', 'gridColumnStart', 'gridRow', 'gridRowEnd', 'gridRowStart', 'lineHeight', 'opacity', 'order', 'orphans', 'scale', 'widows', 'zIndex', 'zoom', 'fillOpacity', 'floodOpacity', 'stopOpacity', 'strokeMiterlimit', 'strokeOpacity'];
17
- var LISTENERS = new Map();
18
- var CUSTOM_EVENTS = ['longtap', 'dbltap'];
19
- var ENABLED_EVENTS = new Set();
20
- var _teardownLongTap = null;
21
- var _teardownDblTap = null;
22
- var supplyEvent = function supplyEvent(event) {
23
- if (ENABLED_EVENTS !== null && ENABLED_EVENTS !== void 0 && ENABLED_EVENTS.has(event)) return;
24
- if (event === 'longtap') enableLongTap();
25
- if (event === 'dbltap') enableDblTap();
26
- ENABLED_EVENTS.add(event);
27
- };
28
- var enableLongTap = function enableLongTap() {
29
- var LONGPRESS_DELAY = 800;
30
- var MOVE_TOLERANCE = 8;
31
- var timer = null;
32
- var startX = 0;
33
- var startY = 0;
34
- var target = null;
35
- var start = function start(ev) {
36
- target = ev.target;
37
- var pos = Mouse.getViewportPosition(ev);
38
- startX = pos.x;
39
- startY = pos.y;
40
- timer = setTimeout(function () {
41
- target.dispatchEvent(new CustomEvent('longtap', {
42
- bubbles: true,
43
- cancelable: true,
44
- detail: {
45
- originalEvent: ev
46
- }
47
- }));
48
- timer = null;
49
- }, LONGPRESS_DELAY);
50
- };
51
- var move = function move(ev) {
52
- if (!timer) return;
53
- var pos = Mouse.getViewportPosition(ev);
54
- if (Math.hypot(pos.x - startX, pos.y - startY) > MOVE_TOLERANCE) {
55
- clearTimeout(timer);
56
- timer = null;
57
- }
58
- };
59
- var end = function end() {
60
- if (timer) clearTimeout(timer);
61
- timer = null;
62
- };
63
- document.addEventListener('touchstart', start, {
64
- passive: true
65
- });
66
- document.addEventListener('touchmove', move, {
67
- passive: true
68
- });
69
- document.addEventListener('touchend', end);
70
- document.addEventListener('touchcancel', end);
71
- _teardownLongTap = function teardownLongTap() {
72
- document.removeEventListener('touchstart', start, {
73
- passive: true
74
- });
75
- document.removeEventListener('touchmove', move, {
76
- passive: true
77
- });
78
- document.removeEventListener('touchend', end);
79
- document.removeEventListener('touchcancel', end);
80
- _teardownLongTap = null;
81
- };
82
- };
83
- var enableDblTap = function enableDblTap() {
84
- var DBLTAP_DELAY = 300;
85
- var MOVE_TOLERANCE = 40;
86
- var lastTapTime = 0;
87
- var lastPos = null;
88
- if (isTouchDevice()) {
89
- document.addEventListener('dblclick', function (ev) {
90
- ev.preventDefault();
91
- ev.stopPropagation();
92
- ev.stopImmediatePropagation();
93
- }, {
94
- capture: true
95
- });
96
- }
97
- var start = function start(ev) {
98
- var target = ev.target;
99
- if (Date.now() - lastTapTime > DBLTAP_DELAY) {
100
- lastTapTime = Date.now();
101
- lastPos = Mouse.getViewportPosition(ev);
102
- } else {
103
- var pos = Mouse.getViewportPosition(ev);
104
- if (Math.hypot(pos.x - lastPos.x, pos.y - lastPos.y) <= MOVE_TOLERANCE) {
105
- target.dispatchEvent(new CustomEvent('dbltap', {
106
- bubbles: true,
107
- cancelable: true,
108
- detail: {
109
- originalEvent: ev
110
- }
111
- }));
112
- }
113
- lastTapTime = Date.now();
114
- lastPos = pos;
115
- }
116
- };
117
- document.addEventListener('touchstart', start, {
118
- passive: true
119
- });
120
- _teardownDblTap = function teardownDblTap() {
121
- document.removeEventListener('touchstart', start, {
122
- passive: true
123
- });
124
- _teardownDblTap = null;
125
- };
126
- };
127
13
 
128
14
  /**
129
15
  * @param {any} o
@@ -372,9 +258,7 @@ var dom = {
372
258
  */
373
259
  closest: function closest(el, selector) {
374
260
  if (selector instanceof Element) {
375
- if (el === selector) {
376
- return el;
377
- }
261
+ if (el === selector) return el;
378
262
  var parentEl = el.parentElement;
379
263
  while (parentEl) {
380
264
  if (parentEl === selector) {
@@ -532,7 +416,7 @@ var dom = {
532
416
  /**
533
417
  * @param {Element} el
534
418
  * @param {string} [html]
535
- * @returns {Element|*}
419
+ * @returns {Element|string}
536
420
  */
537
421
  html: function html(el, _html) {
538
422
  if (undefined === _html) return el.innerHTML;
@@ -542,7 +426,7 @@ var dom = {
542
426
  /**
543
427
  * @param {Element} el
544
428
  * @param {string} [text]
545
- * @returns {Element|*}
429
+ * @returns {Element|string}
546
430
  */
547
431
  text: function text(el, _text) {
548
432
  if (undefined === _text) return el.innerText;
@@ -619,128 +503,6 @@ var dom = {
619
503
  delete el.dataset[key];
620
504
  return el;
621
505
  },
622
- /**
623
- * @param {Element|Document|Window} el
624
- * @param {string} events
625
- * @param {string|Element|function} selector
626
- * @param {function|AddEventListenerOptions|boolean} [handler]
627
- * @param {AddEventListenerOptions|boolean} [options]
628
- * @returns {Element}
629
- */
630
- on: function on(el, events, selector, handler, options) {
631
- var _this5 = this;
632
- if (isFunction(selector)) {
633
- options = handler;
634
- handler = selector;
635
- selector = null;
636
- }
637
- foreach(events.split(' '), function (rawEvent) {
638
- var _rawEvent$split = rawEvent.split('.'),
639
- _rawEvent$split2 = _slicedToArray(_rawEvent$split, 2),
640
- event = _rawEvent$split2[0],
641
- namespace = _rawEvent$split2[1];
642
- var listener = function listener(ev) {
643
- if (!selector) {
644
- handler.call(el, ev);
645
- return;
646
- }
647
- var currentTarget = ev.target;
648
- var _loop = function _loop() {
649
- if (_this5.matches(currentTarget, selector)) {
650
- var wrappedEv = {
651
- _immediateStopped: false,
652
- originalEvent: ev,
653
- type: ev.type,
654
- target: ev.target,
655
- currentTarget: currentTarget,
656
- relatedTarget: ev.relatedTarget,
657
- button: ev.button,
658
- pageX: ev.pageX,
659
- pageY: ev.pageY,
660
- preventDefault: function preventDefault() {
661
- return ev.preventDefault.apply(ev, arguments);
662
- },
663
- stopPropagation: function stopPropagation() {
664
- return ev.stopPropagation.apply(ev, arguments);
665
- },
666
- stopImmediatePropagation: function stopImmediatePropagation() {
667
- wrappedEv._immediateStopped = true;
668
- ev.stopImmediatePropagation.apply(ev, arguments);
669
- }
670
- };
671
- handler.call(currentTarget, wrappedEv);
672
- if (wrappedEv._immediateStopped) {
673
- return {
674
- v: void 0
675
- };
676
- }
677
- return 0; // break
678
- }
679
- currentTarget = currentTarget.parentElement;
680
- },
681
- _ret;
682
- while (currentTarget && currentTarget !== el) {
683
- _ret = _loop();
684
- if (_ret === 0) break;
685
- if (_ret) return _ret.v;
686
- }
687
- };
688
- var store = LISTENERS.get(el);
689
- if (!store) {
690
- store = [];
691
- LISTENERS.set(el, store);
692
- }
693
- store.push({
694
- event: event,
695
- handler: handler,
696
- selector: selector,
697
- listener: listener,
698
- namespace: namespace,
699
- options: options
700
- });
701
- if (inArray(event, CUSTOM_EVENTS)) {
702
- supplyEvent(event);
703
- }
704
- el.addEventListener(event, listener, options);
705
- });
706
- return el;
707
- },
708
- /**
709
- * @param {Element|Document|Window} el
710
- * @param {string} [events]
711
- * @param {string|Element|function} [selector]
712
- * @param {function|AddEventListenerOptions|boolean} [handler]
713
- * @param {AddEventListenerOptions|boolean} [options]
714
- * @returns {Element}
715
- */
716
- off: function off(el, events, selector, handler, options) {
717
- if (isFunction(selector)) {
718
- options = handler;
719
- handler = selector;
720
- selector = null;
721
- }
722
- var store = LISTENERS.get(el);
723
- if (!store) return el;
724
- var evts = events ? events.split(' ') : [undefined];
725
- foreach(evts, function (rawEvent) {
726
- var _ref = undefined === rawEvent ? [undefined, undefined] : rawEvent.split('.'),
727
- _ref2 = _slicedToArray(_ref, 2),
728
- event = _ref2[0],
729
- namespace = _ref2[1];
730
- event = !event ? undefined : event;
731
- var hasEvent = undefined !== event;
732
- var hasNs = undefined !== namespace;
733
- foreach(_toConsumableArray(store).reverse(), function (l) {
734
- var match = !hasEvent && !hasNs || hasEvent && !hasNs && l.event === event || !hasEvent && hasNs && l.namespace === namespace || hasEvent && hasNs && l.event === event && l.namespace === namespace;
735
- if (match && (undefined === event || l.event === event) && (undefined === handler || l.handler === handler) && (undefined === selector || l.selector === selector) && (undefined === namespace || l.namespace === namespace) && (undefined === options || l.options === options)) {
736
- el.removeEventListener(l.event, l.listener, l.options);
737
- var index = store.indexOf(l);
738
- index !== -1 && store.splice(index, 1);
739
- }
740
- });
741
- });
742
- return el;
743
- },
744
506
  /**
745
507
  * @param {HTMLElement} el
746
508
  * @param {Object<string, string>|string} style
@@ -748,7 +510,7 @@ var dom = {
748
510
  * @returns {Element}
749
511
  */
750
512
  css: function css(el, style, value) {
751
- var _this6 = this;
513
+ var _this5 = this;
752
514
  if (isString(style)) {
753
515
  var prop = style.startsWith('--') ? style : camelCase(style);
754
516
  if (undefined === value) {
@@ -762,7 +524,7 @@ var dom = {
762
524
  }
763
525
  } else {
764
526
  each(style, function (name, v) {
765
- _this6.css(el, name, v);
527
+ _this5.css(el, name, v);
766
528
  });
767
529
  }
768
530
  return el;
@@ -817,7 +579,7 @@ var dom = {
817
579
  * @returns {Element|DocumentFragment|null}
818
580
  */
819
581
  create: function create(html) {
820
- html += '';
582
+ if (!isString(html)) return null;
821
583
  var isTagName = function isTagName(s) {
822
584
  return /^[A-Za-z][A-Za-z0-9-]*$/.test(s);
823
585
  };
@@ -830,7 +592,6 @@ var dom = {
830
592
  if (frag.childElementCount === 1 && frag.children.length === 1) {
831
593
  return frag.firstElementChild;
832
594
  }
833
- if (!frag.firstChild) return null;
834
595
  return frag.cloneNode(true);
835
596
  },
836
597
  /**
@@ -839,14 +600,13 @@ var dom = {
839
600
  * @returns {Element|null}
840
601
  */
841
602
  eq: function eq(nodeList) {
842
- var _nodeList$index;
843
603
  var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
844
604
  nodeList = Array.from(nodeList);
845
605
  if (Math.abs(index) >= nodeList.length) return null;
846
606
  if (index < 0) {
847
607
  index = nodeList.length + index;
848
608
  }
849
- return (_nodeList$index = nodeList[index]) !== null && _nodeList$index !== void 0 ? _nodeList$index : null;
609
+ return nodeList[index];
850
610
  },
851
611
  /**
852
612
  * @param {Element} el
@@ -873,13 +633,10 @@ var dom = {
873
633
  return el.parentElement.insertBefore(newEl, el);
874
634
  },
875
635
  /**
876
- * @param {Element|string} el
636
+ * @param {Element} el
877
637
  * @returns {Element}
878
638
  */
879
639
  empty: function empty(el) {
880
- if (isString(el)) {
881
- el = this.findOne(el);
882
- }
883
640
  while (el.firstChild) {
884
641
  el.removeChild(el.firstChild);
885
642
  }
@@ -894,7 +651,8 @@ var dom = {
894
651
  var elements = el instanceof Element ? [el] : Array.from(el);
895
652
  var selectorIsString = isString(selector);
896
653
  return elements.filter(function (e) {
897
- if (!(e instanceof Element)) return false;
654
+ // if (!(e instanceof Element)) return false
655
+
898
656
  return selectorIsString ? !e.matches(selector) : e !== selector;
899
657
  });
900
658
  },
@@ -930,16 +688,16 @@ var dom = {
930
688
  * @returns {Element}
931
689
  */
932
690
  replaceChildren: function replaceChildren(el) {
933
- var _this7 = this;
691
+ var _this6 = this;
934
692
  var nodes = [];
935
693
  for (var _len4 = arguments.length, children = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
936
694
  children[_key4 - 1] = arguments[_key4];
937
695
  }
938
696
  foreach(children, function (child) {
939
697
  if (isString(child)) {
940
- child = _this7.create(child);
698
+ child = _this6.create(child);
941
699
  }
942
- if (child) nodes.push(child);
700
+ nodes.push(child);
943
701
  });
944
702
  el.replaceChildren.apply(el, nodes);
945
703
  return el;
@@ -966,14 +724,36 @@ var dom = {
966
724
  top: rect.top + wOffset.top,
967
725
  left: rect.left + wOffset.left
968
726
  };
969
- }
727
+ },
728
+ /**
729
+ * @param {Node} el
730
+ * @returns {boolean}
731
+ */
732
+ isEditable: function isEditable(el) {
733
+ var _el;
734
+ if (((_el = el) === null || _el === void 0 ? void 0 : _el.nodeType) === 3) el = el.parentElement;
735
+ if (!(el instanceof HTMLElement)) return false;
736
+ return inArray(el.tagName, ['INPUT', 'TEXTAREA', 'SELECT']) || el.isContentEditable || !!this.closest(el, '[contenteditable="true"]');
737
+ },
738
+ /**
739
+ * @param {Node} node
740
+ * @returns {boolean}
741
+ */
742
+ isInDOM: function isInDOM(node) {
743
+ if (!(node instanceof Node)) return false;
744
+ var root = node.getRootNode({
745
+ composed: true
746
+ });
747
+ return root === document;
748
+ },
749
+ on: on,
750
+ off: off
970
751
  };
752
+
753
+ /* istanbul ignore next */
971
754
  if ('test' === process.env.NODE_ENV) {
972
755
  dom.__resetCustomEventsForTests = function () {
973
- var _teardownLongTap2, _teardownDblTap2;
974
- ENABLED_EVENTS.clear();
975
- (_teardownLongTap2 = _teardownLongTap) === null || _teardownLongTap2 === void 0 || _teardownLongTap2();
976
- (_teardownDblTap2 = _teardownDblTap) === null || _teardownDblTap2 === void 0 || _teardownDblTap2();
756
+ __resetCustomEventsForTests();
977
757
  };
978
758
  }
979
759
  export default dom;
package/dist/esm/index.js CHANGED
@@ -13,16 +13,81 @@ import * as traversal from './traversal.js';
13
13
  import dom, { getStyle, isDomElement, isWindow, isDocument } from './dom.js';
14
14
  import * as math from './math.js';
15
15
  import * as utils from './utils.js';
16
- import * as i18n from './Translator.js';
17
16
  import eventDispatcher from './eventDispatcher.js';
18
17
  import Mouse from './Mouse.js';
19
18
  import Translator from './Translator.js';
20
- var webf = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, stringFunctions), arrayFunctions), traversal), is), random), {}, {
21
- dom: dom,
19
+
20
+ /**
21
+ * Main entry point of js-core.
22
+ *
23
+ * Provides pure JavaScript utility functions such as string, array,
24
+ * type checking, traversal, math and other helpers.
25
+ *
26
+ * @module webf
27
+ */
28
+ var webf = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, stringFunctions), arrayFunctions), traversal), is), random), {}, {
22
29
  isWindow: isWindow,
23
30
  isDocument: isDocument,
24
31
  isDomElement: isDomElement,
25
32
  getStyle: getStyle
26
- }, math), utils), i18n);
33
+ }, math), utils);
34
+
35
+ /**
36
+ * Default export containing pure utility functions.
37
+ *
38
+ * @example
39
+ * import webf from '@webalternatif/js-core'
40
+ * webf.unique([1,2,2])
41
+ */
27
42
  export default webf;
43
+
44
+ /**
45
+ * String utility functions.
46
+ * @module stringFunctions
47
+ */
48
+
49
+ /**
50
+ * Array utility functions.
51
+ * @module arrayFunctions
52
+ */
53
+
54
+ /**
55
+ * DOM manipulation and event helpers.
56
+ * Must be imported explicitly.
57
+ *
58
+ * @example
59
+ * import { dom } from '@webalternatif/js-core'
60
+ * dom.on(el, 'click', (ev) => {
61
+ * doSomething(ev.currentTarget)
62
+ * })
63
+ *
64
+ * @module dom
65
+ */
66
+
67
+ /**
68
+ * Lightweight custom event dispatcher (pub/sub).
69
+ *
70
+ * @example
71
+ * import { eventDispatcher } from '@webalternatif/js-core'
72
+ * const dispatcher = eventDispatcher()
73
+ * dispatcher.addListener('save', (eventName, arg1, arg2) => {})
74
+ * dispatcher.dispatch('save', arg1, arg2)
75
+ *
76
+ * @module eventDispatcher
77
+ */
78
+
79
+ /**
80
+ * Mouse utilities.
81
+ * @module Mouse
82
+ */
83
+
84
+ /**
85
+ * Simple translation utility.
86
+ *
87
+ * @example
88
+ * import { Translator } from '@webalternatif/js-core'
89
+ * const t = new Translator({ en: { hi: 'Hello' } })
90
+ *
91
+ * @module Translator
92
+ */
28
93
  export { stringFunctions, arrayFunctions, traversal, is, random, getStyle, dom, math, utils, eventDispatcher, Mouse, Translator };