@studiometa/js-toolkit 2.0.0-beta.9 → 2.0.0-rc.1

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 (179) hide show
  1. package/Base/index.cjs +285 -0
  2. package/Base/index.d.ts +11 -2
  3. package/Base/index.js +114 -197
  4. package/Base/managers/ChildrenManager.cjs +146 -0
  5. package/Base/managers/ChildrenManager.d.ts +9 -1
  6. package/Base/managers/ChildrenManager.js +60 -59
  7. package/Base/managers/EventsManager.cjs +183 -0
  8. package/Base/managers/EventsManager.js +72 -112
  9. package/Base/managers/OptionsManager.cjs +174 -0
  10. package/Base/managers/OptionsManager.d.ts +9 -5
  11. package/Base/managers/OptionsManager.js +60 -90
  12. package/Base/managers/RefsManager.cjs +99 -0
  13. package/Base/managers/RefsManager.js +28 -38
  14. package/Base/managers/ServicesManager.cjs +131 -0
  15. package/Base/managers/ServicesManager.js +39 -67
  16. package/Base/utils.cjs +41 -0
  17. package/Base/utils.js +12 -11
  18. package/decorators/index.cjs +45 -0
  19. package/decorators/index.d.ts +1 -0
  20. package/decorators/index.js +20 -8
  21. package/decorators/withBreakpointManager.cjs +85 -0
  22. package/decorators/withBreakpointManager.js +18 -39
  23. package/decorators/withBreakpointObserver.cjs +115 -0
  24. package/decorators/withBreakpointObserver.js +44 -86
  25. package/decorators/withDrag.cjs +53 -0
  26. package/decorators/withDrag.js +24 -26
  27. package/decorators/withExtraConfig.cjs +43 -0
  28. package/decorators/withExtraConfig.js +17 -12
  29. package/decorators/withFreezedOptions.cjs +36 -0
  30. package/decorators/withFreezedOptions.d.ts +14 -0
  31. package/decorators/withFreezedOptions.js +14 -0
  32. package/decorators/withIntersectionObserver.cjs +62 -0
  33. package/decorators/withIntersectionObserver.js +29 -32
  34. package/decorators/withMountWhenInView.cjs +69 -0
  35. package/decorators/withMountWhenInView.js +31 -52
  36. package/decorators/withScrolledInView.cjs +114 -0
  37. package/decorators/withScrolledInView.js +35 -39
  38. package/decorators/withVue2.cjs +60 -0
  39. package/decorators/withVue2.js +26 -32
  40. package/helpers/createApp.cjs +52 -0
  41. package/helpers/createApp.d.ts +2 -2
  42. package/helpers/createApp.js +12 -12
  43. package/helpers/importOnInteraction.cjs +52 -0
  44. package/helpers/importOnInteraction.js +17 -18
  45. package/helpers/importWhenIdle.cjs +49 -0
  46. package/helpers/importWhenIdle.js +14 -17
  47. package/helpers/importWhenVisible.cjs +50 -0
  48. package/helpers/importWhenVisible.js +16 -18
  49. package/helpers/index.cjs +35 -0
  50. package/helpers/index.js +10 -4
  51. package/helpers/utils.cjs +35 -0
  52. package/helpers/utils.js +7 -6
  53. package/index.cjs +33 -0
  54. package/index.js +7 -4
  55. package/package.json +14 -4
  56. package/services/Service.cjs +76 -0
  57. package/services/Service.js +19 -32
  58. package/services/drag.cjs +213 -0
  59. package/services/drag.d.ts +1 -0
  60. package/services/drag.js +64 -68
  61. package/services/index.cjs +41 -0
  62. package/services/index.js +16 -7
  63. package/services/key.cjs +104 -0
  64. package/services/key.js +28 -36
  65. package/services/load.cjs +72 -0
  66. package/services/load.js +17 -19
  67. package/services/pointer.cjs +162 -0
  68. package/services/pointer.js +43 -60
  69. package/services/raf.cjs +83 -0
  70. package/services/raf.js +20 -28
  71. package/services/resize.cjs +108 -0
  72. package/services/resize.js +33 -42
  73. package/services/scroll.cjs +131 -0
  74. package/services/scroll.js +26 -35
  75. package/utils/collide/boundingRectToCircle.cjs +34 -0
  76. package/utils/collide/boundingRectToCircle.d.ts +1 -1
  77. package/utils/collide/boundingRectToCircle.js +7 -10
  78. package/utils/collide/collideCircleCircle.cjs +34 -0
  79. package/utils/collide/collideCircleCircle.js +8 -7
  80. package/utils/collide/collideCircleRect.cjs +46 -0
  81. package/utils/collide/collideCircleRect.js +10 -12
  82. package/utils/collide/collidePointCircle.cjs +31 -0
  83. package/utils/collide/collidePointCircle.js +8 -5
  84. package/utils/collide/collidePointRect.cjs +28 -0
  85. package/utils/collide/collidePointRect.js +5 -2
  86. package/utils/collide/collideRectRect.cjs +28 -0
  87. package/utils/collide/collideRectRect.js +5 -2
  88. package/utils/collide/index.cjs +39 -0
  89. package/utils/collide/index.js +14 -6
  90. package/utils/css/classes.cjs +47 -0
  91. package/utils/css/classes.d.ts +10 -9
  92. package/utils/css/classes.js +18 -14
  93. package/utils/css/index.cjs +38 -0
  94. package/utils/css/index.d.ts +2 -2
  95. package/utils/css/index.js +13 -6
  96. package/utils/css/matrix.cjs +30 -0
  97. package/utils/css/matrix.js +7 -5
  98. package/utils/css/styles.cjs +44 -0
  99. package/utils/css/styles.d.ts +6 -18
  100. package/utils/css/styles.js +12 -12
  101. package/utils/css/transition.cjs +120 -0
  102. package/utils/css/transition.d.ts +15 -9
  103. package/utils/css/transition.js +70 -119
  104. package/utils/debounce.cjs +34 -0
  105. package/utils/debounce.js +7 -9
  106. package/utils/focusTrap.cjs +82 -0
  107. package/utils/focusTrap.js +30 -21
  108. package/utils/history.cjs +89 -0
  109. package/utils/history.js +28 -57
  110. package/utils/index.cjs +54 -0
  111. package/utils/index.d.ts +4 -1
  112. package/utils/index.js +32 -11
  113. package/utils/keyCodes.cjs +35 -0
  114. package/utils/keyCodes.js +5 -2
  115. package/utils/math/clamp.cjs +28 -0
  116. package/utils/math/clamp.js +5 -2
  117. package/utils/math/clamp01.cjs +32 -0
  118. package/utils/math/clamp01.js +6 -3
  119. package/utils/math/damp.cjs +28 -0
  120. package/utils/math/damp.js +5 -4
  121. package/utils/math/ease.cjs +88 -0
  122. package/utils/math/ease.js +50 -25
  123. package/utils/math/index.cjs +43 -0
  124. package/utils/math/index.js +17 -8
  125. package/utils/math/inertiaFinalValue.cjs +37 -0
  126. package/utils/math/inertiaFinalValue.js +8 -10
  127. package/utils/math/lerp.cjs +28 -0
  128. package/utils/math/lerp.js +5 -2
  129. package/utils/math/map.cjs +28 -0
  130. package/utils/math/map.js +5 -2
  131. package/utils/math/round.cjs +28 -0
  132. package/utils/math/round.js +5 -3
  133. package/utils/memoize.cjs +43 -0
  134. package/utils/memoize.js +10 -19
  135. package/utils/nextFrame.cjs +38 -0
  136. package/utils/nextFrame.d.ts +4 -3
  137. package/utils/nextFrame.js +13 -10
  138. package/utils/nextMicrotask.cjs +28 -0
  139. package/utils/nextMicrotask.d.ts +8 -0
  140. package/utils/nextMicrotask.js +6 -0
  141. package/utils/nextTick.cjs +30 -0
  142. package/utils/nextTick.d.ts +8 -0
  143. package/utils/nextTick.js +8 -0
  144. package/utils/object/autoBind.cjs +49 -0
  145. package/utils/object/autoBind.js +12 -22
  146. package/utils/object/getAllProperties.cjs +37 -0
  147. package/utils/object/getAllProperties.js +10 -13
  148. package/utils/object/index.cjs +33 -0
  149. package/utils/object/index.js +8 -3
  150. package/utils/object/isObject.cjs +28 -0
  151. package/utils/object/isObject.js +6 -3
  152. package/utils/scrollTo.cjs +80 -0
  153. package/utils/scrollTo.js +20 -40
  154. package/utils/string/index.cjs +47 -0
  155. package/utils/string/index.js +22 -10
  156. package/utils/string/withLeadingCharacters.cjs +32 -0
  157. package/utils/string/withLeadingCharacters.js +7 -4
  158. package/utils/string/withLeadingSlash.cjs +32 -0
  159. package/utils/string/withLeadingSlash.js +7 -4
  160. package/utils/string/withTrailingCharacters.cjs +32 -0
  161. package/utils/string/withTrailingCharacters.js +7 -4
  162. package/utils/string/withTrailingSlash.cjs +32 -0
  163. package/utils/string/withTrailingSlash.js +7 -4
  164. package/utils/string/withoutLeadingCharacters.cjs +28 -0
  165. package/utils/string/withoutLeadingCharacters.js +6 -3
  166. package/utils/string/withoutLeadingCharactersRecursive.cjs +37 -0
  167. package/utils/string/withoutLeadingCharactersRecursive.js +8 -7
  168. package/utils/string/withoutLeadingSlash.cjs +32 -0
  169. package/utils/string/withoutLeadingSlash.js +7 -4
  170. package/utils/string/withoutTrailingCharacters.cjs +28 -0
  171. package/utils/string/withoutTrailingCharacters.js +6 -3
  172. package/utils/string/withoutTrailingCharactersRecursive.cjs +37 -0
  173. package/utils/string/withoutTrailingCharactersRecursive.js +8 -7
  174. package/utils/string/withoutTrailingSlash.cjs +32 -0
  175. package/utils/string/withoutTrailingSlash.js +7 -4
  176. package/utils/throttle.cjs +36 -0
  177. package/utils/throttle.js +9 -9
  178. package/index.modern.js +0 -1
  179. package/index.umd.js +0 -1
@@ -1,30 +1,37 @@
1
- import keyCodes from './keyCodes.js';
2
- var FOCUSABLE_ELEMENTS = ['a[href]:not([tabindex^="-"]):not([inert])', 'area[href]:not([tabindex^="-"]):not([inert])', 'input:not([disabled]):not([inert])', 'select:not([disabled]):not([inert])', 'textarea:not([disabled]):not([inert])', 'button:not([disabled]):not([inert])', 'iframe:not([tabindex^="-"]):not([inert])', 'audio:not([tabindex^="-"]):not([inert])', 'video:not([tabindex^="-"]):not([inert])', '[contenteditable]:not([tabindex^="-"]):not([inert])', '[tabindex]:not([tabindex^="-"]):not([inert])'];
3
- var focusedBefore;
4
- export function saveActiveElement() {
1
+ import keyCodes from "./keyCodes.js";
2
+ const FOCUSABLE_ELEMENTS = [
3
+ 'a[href]:not([tabindex^="-"]):not([inert])',
4
+ 'area[href]:not([tabindex^="-"]):not([inert])',
5
+ "input:not([disabled]):not([inert])",
6
+ "select:not([disabled]):not([inert])",
7
+ "textarea:not([disabled]):not([inert])",
8
+ "button:not([disabled]):not([inert])",
9
+ 'iframe:not([tabindex^="-"]):not([inert])',
10
+ 'audio:not([tabindex^="-"]):not([inert])',
11
+ 'video:not([tabindex^="-"]):not([inert])',
12
+ '[contenteditable]:not([tabindex^="-"]):not([inert])',
13
+ '[tabindex]:not([tabindex^="-"]):not([inert])'
14
+ ];
15
+ let focusedBefore;
16
+ function saveActiveElement() {
5
17
  focusedBefore = document.activeElement;
6
18
  }
7
- export function trap(element, event) {
19
+ function trap(element, event) {
8
20
  if (event.keyCode !== keyCodes.TAB) {
9
21
  return;
10
22
  }
11
-
12
23
  if (!focusedBefore) {
13
24
  focusedBefore = document.activeElement;
14
25
  }
15
-
16
- var focusableChildren = Array.from(element.querySelectorAll(FOCUSABLE_ELEMENTS.join(', ')));
17
- var focusedItemIndex = document.activeElement instanceof HTMLElement ? focusableChildren.indexOf(document.activeElement) : -1;
18
-
26
+ const focusableChildren = Array.from(element.querySelectorAll(FOCUSABLE_ELEMENTS.join(", ")));
27
+ const focusedItemIndex = document.activeElement instanceof HTMLElement ? focusableChildren.indexOf(document.activeElement) : -1;
19
28
  if (!focusableChildren.length) {
20
29
  return;
21
30
  }
22
-
23
31
  if (focusedItemIndex < 0) {
24
32
  focusableChildren[0].focus();
25
33
  event.preventDefault();
26
34
  }
27
-
28
35
  if (event.shiftKey && focusedItemIndex === 0) {
29
36
  focusableChildren[focusableChildren.length - 1].focus();
30
37
  event.preventDefault();
@@ -33,16 +40,18 @@ export function trap(element, event) {
33
40
  event.preventDefault();
34
41
  }
35
42
  }
36
- export function untrap() {
37
- if (focusedBefore && typeof focusedBefore.focus === 'function') {
43
+ function untrap() {
44
+ if (focusedBefore && typeof focusedBefore.focus === "function") {
38
45
  focusedBefore.focus();
39
46
  focusedBefore = null;
40
47
  }
41
48
  }
42
- export default function useFocusTrap() {
43
- return {
44
- trap,
45
- untrap,
46
- saveActiveElement
47
- };
48
- }
49
+ function useFocusTrap() {
50
+ return { trap, untrap, saveActiveElement };
51
+ }
52
+ export {
53
+ useFocusTrap as default,
54
+ saveActiveElement,
55
+ trap,
56
+ untrap
57
+ };
@@ -0,0 +1,89 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // packages/js-toolkit/utils/history.js
23
+ var history_exports = {};
24
+ __export(history_exports, {
25
+ objectToURLSearchParams: () => objectToURLSearchParams,
26
+ push: () => push,
27
+ replace: () => replace
28
+ });
29
+ module.exports = __toCommonJS(history_exports);
30
+ var import_isObject = __toESM(require("./object/isObject.cjs"), 1);
31
+ function updateUrlSearchParam(params, name, value) {
32
+ if (value === "" || value === null || value === void 0) {
33
+ if (params.has(name)) {
34
+ params.delete(name);
35
+ }
36
+ return params;
37
+ }
38
+ if (Array.isArray(value)) {
39
+ value.forEach((val, index) => {
40
+ const arrayName = `${name}[${index}]`;
41
+ updateUrlSearchParam(params, arrayName, val);
42
+ });
43
+ return params;
44
+ }
45
+ if ((0, import_isObject.default)(value)) {
46
+ Object.entries(value).forEach(([key, val]) => {
47
+ const objectName = `${name}[${key}]`;
48
+ updateUrlSearchParam(params, objectName, val);
49
+ });
50
+ return params;
51
+ }
52
+ params.set(name, value);
53
+ return params;
54
+ }
55
+ function objectToURLSearchParams(obj, defaultSearch = typeof window === "undefined" ? "" : window.location.search) {
56
+ return Object.entries(obj).reduce((urlSearchParams, [name, value]) => updateUrlSearchParam(urlSearchParams, name, value), new URLSearchParams(defaultSearch));
57
+ }
58
+ function updateHistory(mode, options, data = {}, title = "") {
59
+ if (!window.history) {
60
+ return;
61
+ }
62
+ const { path, search, hash } = {
63
+ path: window.location.pathname,
64
+ search: new URLSearchParams(window.location.search),
65
+ hash: window.location.hash,
66
+ ...options
67
+ };
68
+ let url = path;
69
+ const mergedSearch = search instanceof URLSearchParams ? search : objectToURLSearchParams(search);
70
+ if (mergedSearch.toString()) {
71
+ url += `?${mergedSearch.toString()}`;
72
+ }
73
+ if (hash) {
74
+ if (hash.startsWith("#")) {
75
+ url += hash;
76
+ } else {
77
+ url += `#${hash}`;
78
+ }
79
+ }
80
+ const method = `${mode}State`;
81
+ window.history[method](data, title, url);
82
+ }
83
+ function push(options, data = {}, title = "") {
84
+ updateHistory("push", options, data, title);
85
+ }
86
+ function replace(options, data = {}, title = "") {
87
+ updateHistory("replace", options, data, title);
88
+ }
89
+ if (module.exports.default) module.exports = module.exports.default;
package/utils/history.js CHANGED
@@ -1,93 +1,64 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
-
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
-
7
- import isObject from './object/isObject.js';
8
-
1
+ import isObject from "./object/isObject.js";
9
2
  function updateUrlSearchParam(params, name, value) {
10
- if (value === '' || value === null || value === undefined) {
3
+ if (value === "" || value === null || value === void 0) {
11
4
  if (params.has(name)) {
12
5
  params.delete(name);
13
6
  }
14
-
15
7
  return params;
16
8
  }
17
-
18
9
  if (Array.isArray(value)) {
19
10
  value.forEach((val, index) => {
20
- var arrayName = "".concat(name, "[").concat(index, "]");
11
+ const arrayName = `${name}[${index}]`;
21
12
  updateUrlSearchParam(params, arrayName, val);
22
13
  });
23
14
  return params;
24
15
  }
25
-
26
16
  if (isObject(value)) {
27
- Object.entries(value).forEach(_ref => {
28
- var [key, val] = _ref;
29
- var objectName = "".concat(name, "[").concat(key, "]");
17
+ Object.entries(value).forEach(([key, val]) => {
18
+ const objectName = `${name}[${key}]`;
30
19
  updateUrlSearchParam(params, objectName, val);
31
20
  });
32
21
  return params;
33
22
  }
34
-
35
23
  params.set(name, value);
36
24
  return params;
37
25
  }
38
-
39
- export function objectToURLSearchParams(obj) {
40
- var defaultSearch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : typeof window === 'undefined' ? '' : window.location.search;
41
- return Object.entries(obj).reduce((urlSearchParams, _ref2) => {
42
- var [name, value] = _ref2;
43
- return updateUrlSearchParam(urlSearchParams, name, value);
44
- }, new URLSearchParams(defaultSearch));
26
+ function objectToURLSearchParams(obj, defaultSearch = typeof window === "undefined" ? "" : window.location.search) {
27
+ return Object.entries(obj).reduce((urlSearchParams, [name, value]) => updateUrlSearchParam(urlSearchParams, name, value), new URLSearchParams(defaultSearch));
45
28
  }
46
-
47
- function updateHistory(mode, options) {
48
- var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
49
- var title = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
50
-
29
+ function updateHistory(mode, options, data = {}, title = "") {
51
30
  if (!window.history) {
52
31
  return;
53
32
  }
54
-
55
- var {
56
- path,
57
- search,
58
- hash
59
- } = _objectSpread({
33
+ const { path, search, hash } = {
60
34
  path: window.location.pathname,
61
35
  search: new URLSearchParams(window.location.search),
62
- hash: window.location.hash
63
- }, options);
64
-
65
- var url = path;
66
- var mergedSearch = search instanceof URLSearchParams ? search : objectToURLSearchParams(search);
67
-
36
+ hash: window.location.hash,
37
+ ...options
38
+ };
39
+ let url = path;
40
+ const mergedSearch = search instanceof URLSearchParams ? search : objectToURLSearchParams(search);
68
41
  if (mergedSearch.toString()) {
69
- url += "?".concat(mergedSearch.toString());
42
+ url += `?${mergedSearch.toString()}`;
70
43
  }
71
-
72
44
  if (hash) {
73
- if (hash.startsWith('#')) {
45
+ if (hash.startsWith("#")) {
74
46
  url += hash;
75
47
  } else {
76
- url += "#".concat(hash);
48
+ url += `#${hash}`;
77
49
  }
78
50
  }
79
-
80
- var method = "".concat(mode, "State");
51
+ const method = `${mode}State`;
81
52
  window.history[method](data, title, url);
82
53
  }
83
-
84
- export function push(options) {
85
- var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
86
- var title = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
87
- updateHistory('push', options, data, title);
54
+ function push(options, data = {}, title = "") {
55
+ updateHistory("push", options, data, title);
88
56
  }
89
- export function replace(options) {
90
- var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
91
- var title = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
92
- updateHistory('replace', options, data, title);
93
- }
57
+ function replace(options, data = {}, title = "") {
58
+ updateHistory("replace", options, data, title);
59
+ }
60
+ export {
61
+ objectToURLSearchParams,
62
+ push,
63
+ replace
64
+ };
@@ -0,0 +1,54 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+
23
+ // packages/js-toolkit/utils/index.js
24
+ var utils_exports = {};
25
+ __export(utils_exports, {
26
+ debounce: () => import_debounce.default,
27
+ focusTrap: () => import_focusTrap.default,
28
+ historyPush: () => import_history.push,
29
+ historyReplace: () => import_history.replace,
30
+ keyCodes: () => import_keyCodes.default,
31
+ memoize: () => import_memoize.default,
32
+ nextFrame: () => import_nextFrame.default,
33
+ nextMicrotask: () => import_nextMicrotask.default,
34
+ nextTick: () => import_nextTick.default,
35
+ objectToURLSearchParams: () => import_history.objectToURLSearchParams,
36
+ scrollTo: () => import_scrollTo.default,
37
+ throttle: () => import_throttle.default
38
+ });
39
+ module.exports = __toCommonJS(utils_exports);
40
+ var import_debounce = __toESM(require("./debounce.cjs"), 1);
41
+ var import_focusTrap = __toESM(require("./focusTrap.cjs"), 1);
42
+ var import_keyCodes = __toESM(require("./keyCodes.cjs"), 1);
43
+ var import_memoize = __toESM(require("./memoize.cjs"), 1);
44
+ var import_nextFrame = __toESM(require("./nextFrame.cjs"), 1);
45
+ var import_nextTick = __toESM(require("./nextTick.cjs"), 1);
46
+ var import_nextMicrotask = __toESM(require("./nextMicrotask.cjs"), 1);
47
+ var import_throttle = __toESM(require("./throttle.cjs"), 1);
48
+ var import_scrollTo = __toESM(require("./scrollTo.cjs"), 1);
49
+ __reExport(utils_exports, require("./css/index.cjs"), module.exports);
50
+ var import_history = require("./history.cjs");
51
+ __reExport(utils_exports, require("./collide/index.cjs"), module.exports);
52
+ __reExport(utils_exports, require("./math/index.cjs"), module.exports);
53
+ __reExport(utils_exports, require("./string/index.cjs"), module.exports);
54
+ if (module.exports.default) module.exports = module.exports.default;
package/utils/index.d.ts CHANGED
@@ -3,9 +3,12 @@ export { default as focusTrap } from "./focusTrap.js";
3
3
  export { default as keyCodes } from "./keyCodes.js";
4
4
  export { default as memoize } from "./memoize.js";
5
5
  export { default as nextFrame } from "./nextFrame.js";
6
+ export { default as nextTick } from "./nextTick.js";
7
+ export { default as nextMicrotask } from "./nextMicrotask.js";
6
8
  export { default as throttle } from "./throttle.js";
9
+ export { default as scrollTo } from "./scrollTo.js";
10
+ export * from "./css/index.js";
7
11
  export * from "./collide/index.js";
8
12
  export * from "./math/index.js";
9
13
  export * from "./string/index.js";
10
- export { matrix, transition } from "./css/index.js";
11
14
  export { objectToURLSearchParams, push as historyPush, replace as historyReplace } from "./history.js";
package/utils/index.js CHANGED
@@ -1,11 +1,32 @@
1
- export { default as debounce } from './debounce.js';
2
- export { default as focusTrap } from './focusTrap.js';
3
- export { default as keyCodes } from './keyCodes.js';
4
- export { default as memoize } from './memoize.js';
5
- export { default as nextFrame } from './nextFrame.js';
6
- export { default as throttle } from './throttle.js';
7
- export { matrix, transition } from './css/index.js';
8
- export { objectToURLSearchParams, push as historyPush, replace as historyReplace } from './history.js';
9
- export * from './collide/index.js';
10
- export * from './math/index.js';
11
- export * from './string/index.js';
1
+ import { default as default2 } from "./debounce.js";
2
+ import { default as default3 } from "./focusTrap.js";
3
+ import { default as default4 } from "./keyCodes.js";
4
+ import { default as default5 } from "./memoize.js";
5
+ import { default as default6 } from "./nextFrame.js";
6
+ import { default as default7 } from "./nextTick.js";
7
+ import { default as default8 } from "./nextMicrotask.js";
8
+ import { default as default9 } from "./throttle.js";
9
+ import { default as default10 } from "./scrollTo.js";
10
+ export * from "./css/index.js";
11
+ import {
12
+ objectToURLSearchParams,
13
+ push,
14
+ replace
15
+ } from "./history.js";
16
+ export * from "./collide/index.js";
17
+ export * from "./math/index.js";
18
+ export * from "./string/index.js";
19
+ export {
20
+ default2 as debounce,
21
+ default3 as focusTrap,
22
+ push as historyPush,
23
+ replace as historyReplace,
24
+ default4 as keyCodes,
25
+ default5 as memoize,
26
+ default6 as nextFrame,
27
+ default8 as nextMicrotask,
28
+ default7 as nextTick,
29
+ objectToURLSearchParams,
30
+ default10 as scrollTo,
31
+ default9 as throttle
32
+ };
@@ -0,0 +1,35 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/js-toolkit/utils/keyCodes.js
20
+ var keyCodes_exports = {};
21
+ __export(keyCodes_exports, {
22
+ default: () => keyCodes_default
23
+ });
24
+ module.exports = __toCommonJS(keyCodes_exports);
25
+ var keyCodes_default = {
26
+ ENTER: 13,
27
+ SPACE: 32,
28
+ TAB: 9,
29
+ ESC: 27,
30
+ LEFT: 37,
31
+ UP: 38,
32
+ RIGHT: 39,
33
+ DOWN: 40
34
+ };
35
+ if (module.exports.default) module.exports = module.exports.default;
package/utils/keyCodes.js CHANGED
@@ -1,4 +1,4 @@
1
- export default {
1
+ var keyCodes_default = {
2
2
  ENTER: 13,
3
3
  SPACE: 32,
4
4
  TAB: 9,
@@ -7,4 +7,7 @@ export default {
7
7
  UP: 38,
8
8
  RIGHT: 39,
9
9
  DOWN: 40
10
- };
10
+ };
11
+ export {
12
+ keyCodes_default as default
13
+ };
@@ -0,0 +1,28 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/js-toolkit/utils/math/clamp.js
20
+ var clamp_exports = {};
21
+ __export(clamp_exports, {
22
+ default: () => clamp
23
+ });
24
+ module.exports = __toCommonJS(clamp_exports);
25
+ function clamp(value, min, max) {
26
+ return min < max ? value < min ? min : value > max ? max : value : value < max ? max : value > min ? min : value;
27
+ }
28
+ if (module.exports.default) module.exports = module.exports.default;
@@ -1,3 +1,6 @@
1
- export default function clamp(value, min, max) {
1
+ function clamp(value, min, max) {
2
2
  return min < max ? value < min ? min : value > max ? max : value : value < max ? max : value > min ? min : value;
3
- }
3
+ }
4
+ export {
5
+ clamp as default
6
+ };
@@ -0,0 +1,32 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // packages/js-toolkit/utils/math/clamp01.js
23
+ var clamp01_exports = {};
24
+ __export(clamp01_exports, {
25
+ default: () => clamp01
26
+ });
27
+ module.exports = __toCommonJS(clamp01_exports);
28
+ var import_clamp = __toESM(require("./clamp.cjs"), 1);
29
+ function clamp01(value) {
30
+ return (0, import_clamp.default)(value, 0, 1);
31
+ }
32
+ if (module.exports.default) module.exports = module.exports.default;
@@ -1,4 +1,7 @@
1
- import clamp from './clamp.js';
2
- export default function clamp01(value) {
1
+ import clamp from "./clamp.js";
2
+ function clamp01(value) {
3
3
  return clamp(value, 0, 1);
4
- }
4
+ }
5
+ export {
6
+ clamp01 as default
7
+ };
@@ -0,0 +1,28 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/js-toolkit/utils/math/damp.js
20
+ var damp_exports = {};
21
+ __export(damp_exports, {
22
+ default: () => damp
23
+ });
24
+ module.exports = __toCommonJS(damp_exports);
25
+ function damp(targetValue, currentValue, factor = 0.5, precision = 0.01) {
26
+ return Math.abs(targetValue - currentValue) < precision ? targetValue : currentValue + (targetValue - currentValue) * factor;
27
+ }
28
+ if (module.exports.default) module.exports = module.exports.default;
@@ -1,5 +1,6 @@
1
- export default function damp(targetValue, currentValue) {
2
- var factor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.5;
3
- var precision = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0.01;
1
+ function damp(targetValue, currentValue, factor = 0.5, precision = 0.01) {
4
2
  return Math.abs(targetValue - currentValue) < precision ? targetValue : currentValue + (targetValue - currentValue) * factor;
5
- }
3
+ }
4
+ export {
5
+ damp as default
6
+ };