@studiometa/js-toolkit 2.2.0-alpha.1 → 2.2.2

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.
@@ -35,21 +35,34 @@ module.exports = __toCommonJS(EventsManager_exports);
35
35
  var import_getAllProperties = __toESM(require("../../utils/object/getAllProperties.cjs"), 1);
36
36
  var import_AbstractManager = __toESM(require("./AbstractManager.cjs"), 1);
37
37
  var import_RefsManager = require("./RefsManager.cjs");
38
+ var names = /* @__PURE__ */ new Map();
38
39
  function normalizeName(name) {
39
- return name.replace(/[A-Z]([A-Z].*)/g, (c) => c.toLowerCase()).replace(/[^a-zA-Z\d\s:]/g, " ").replace(/(^\w|\s+\w)/g, (c) => c.trim().toUpperCase()).trim();
40
+ if (!names.has(name)) {
41
+ names.set(name, name.replace(/[A-Z]([A-Z].*)/g, (c) => c.toLowerCase()).replace(/[^a-zA-Z\d\s:]/g, " ").replace(/(^\w|\s+\w)/g, (c) => c.trim().toUpperCase()).trim());
42
+ }
43
+ return names.get(name);
40
44
  }
45
+ var eventNames = /* @__PURE__ */ new Map();
41
46
  function normalizeEventName(name) {
42
- return name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`).replace(/^-/, "");
47
+ if (!eventNames.has(name)) {
48
+ eventNames.set(name, name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`).replace(/^-/, ""));
49
+ }
50
+ return eventNames.get(name);
51
+ }
52
+ var regexes = /* @__PURE__ */ new Map();
53
+ function getRegex(regex) {
54
+ if (!regexes.has(regex)) {
55
+ regexes.set(regex, new RegExp(regex));
56
+ }
57
+ return regexes.get(regex);
43
58
  }
44
59
  function __getEventNameByMethod(that, method, name = "") {
45
- const normalizedName = normalizeName(name);
46
- const regex = new RegExp(`^on${normalizedName}([A-Z].*)$`);
60
+ const regex = getRegex(`^on${normalizeName(name)}([A-Z].*)$`);
47
61
  const [, event] = method.match(regex);
48
62
  return normalizeEventName(event);
49
63
  }
50
64
  function __getEventMethodsByName(that, name = "") {
51
- const normalizedName = normalizeName(name);
52
- const regex = new RegExp(`^on${normalizedName}[A-Z].*$`);
65
+ const regex = getRegex(`^on${normalizeName(name)}[A-Z].*$`);
53
66
  const key = regex.toString();
54
67
  let methods = that.__methodsCache.get(key);
55
68
  if (!methods) {
@@ -1,7 +1,3 @@
1
- /**
2
- * @typedef {import('../index.js').default} Base
3
- * @typedef {import('./ChildrenManager.js').default} ChildrenManager
4
- */
5
1
  /**
6
2
  * Normalize the given name to PascalCase, such as:
7
3
  *
@@ -7,21 +7,34 @@ var __publicField = (obj, key, value) => {
7
7
  import getAllProperties from "../../utils/object/getAllProperties.js";
8
8
  import AbstractManager from "./AbstractManager.js";
9
9
  import { normalizeRefName } from "./RefsManager.js";
10
+ const names = /* @__PURE__ */ new Map();
10
11
  function normalizeName(name) {
11
- return name.replace(/[A-Z]([A-Z].*)/g, (c) => c.toLowerCase()).replace(/[^a-zA-Z\d\s:]/g, " ").replace(/(^\w|\s+\w)/g, (c) => c.trim().toUpperCase()).trim();
12
+ if (!names.has(name)) {
13
+ names.set(name, name.replace(/[A-Z]([A-Z].*)/g, (c) => c.toLowerCase()).replace(/[^a-zA-Z\d\s:]/g, " ").replace(/(^\w|\s+\w)/g, (c) => c.trim().toUpperCase()).trim());
14
+ }
15
+ return names.get(name);
12
16
  }
17
+ const eventNames = /* @__PURE__ */ new Map();
13
18
  function normalizeEventName(name) {
14
- return name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`).replace(/^-/, "");
19
+ if (!eventNames.has(name)) {
20
+ eventNames.set(name, name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`).replace(/^-/, ""));
21
+ }
22
+ return eventNames.get(name);
23
+ }
24
+ const regexes = /* @__PURE__ */ new Map();
25
+ function getRegex(regex) {
26
+ if (!regexes.has(regex)) {
27
+ regexes.set(regex, new RegExp(regex));
28
+ }
29
+ return regexes.get(regex);
15
30
  }
16
31
  function __getEventNameByMethod(that, method, name = "") {
17
- const normalizedName = normalizeName(name);
18
- const regex = new RegExp(`^on${normalizedName}([A-Z].*)$`);
32
+ const regex = getRegex(`^on${normalizeName(name)}([A-Z].*)$`);
19
33
  const [, event] = method.match(regex);
20
34
  return normalizeEventName(event);
21
35
  }
22
36
  function __getEventMethodsByName(that, name = "") {
23
- const normalizedName = normalizeName(name);
24
- const regex = new RegExp(`^on${normalizedName}[A-Z].*$`);
37
+ const regex = getRegex(`^on${normalizeName(name)}[A-Z].*$`);
25
38
  const key = regex.toString();
26
39
  let methods = that.__methodsCache.get(key);
27
40
  if (!methods) {
@@ -76,12 +76,12 @@ function __register(that, name, config) {
76
76
  }
77
77
  var OptionsManager = class extends import_AbstractManager.default {
78
78
  constructor(base) {
79
+ var _a, _b;
79
80
  super(base);
80
81
  __publicField(this, "__values", {});
81
82
  __publicField(this, "name", "Base");
82
83
  __publicField(this, "debug", false);
83
84
  __publicField(this, "log", false);
84
- var _a, _b;
85
85
  this.__hideProperties(["__values", "__defaultValues"]);
86
86
  const schema = this.__config.options || {};
87
87
  this.name = this.__config.name;
@@ -49,12 +49,12 @@ function __register(that, name, config) {
49
49
  }
50
50
  class OptionsManager extends AbstractManager {
51
51
  constructor(base) {
52
+ var _a, _b;
52
53
  super(base);
53
54
  __publicField(this, "__values", {});
54
55
  __publicField(this, "name", "Base");
55
56
  __publicField(this, "debug", false);
56
57
  __publicField(this, "log", false);
57
- var _a, _b;
58
58
  this.__hideProperties(["__values", "__defaultValues"]);
59
59
  const schema = this.__config.options || {};
60
60
  this.name = this.__config.name;
@@ -31,9 +31,9 @@ var withVue2_default = (BaseClass, Vue) => {
31
31
  var _a, _b, _c;
32
32
  return _c = class extends BaseClass {
33
33
  constructor(element) {
34
+ var _a2;
34
35
  super(element);
35
36
  __publicField(this, "$vue");
36
- var _a2;
37
37
  const vueConfig = (_a2 = this.vueConfig) != null ? _a2 : this.constructor.vueConfig;
38
38
  if (!vueConfig) {
39
39
  throw new Error("[withVue] You must define a `vueConfig` object.");
@@ -8,9 +8,9 @@ var withVue2_default = (BaseClass, Vue) => {
8
8
  var _a, _b, _c;
9
9
  return _c = class extends BaseClass {
10
10
  constructor(element) {
11
+ var _a2;
11
12
  super(element);
12
13
  __publicField(this, "$vue");
13
- var _a2;
14
14
  const vueConfig = (_a2 = this.vueConfig) != null ? _a2 : this.constructor.vueConfig;
15
15
  if (!vueConfig) {
16
16
  throw new Error("[withVue] You must define a `vueConfig` object.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studiometa/js-toolkit",
3
- "version": "2.2.0-alpha.1",
3
+ "version": "2.2.2",
4
4
  "description": "A set of useful little bits of JavaScript to boost your project! 🚀",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -39,7 +39,7 @@
39
39
  "toolkit"
40
40
  ],
41
41
  "dependencies": {
42
- "@motionone/easing": "^10.8.0",
42
+ "@motionone/easing": "^10.9.0",
43
43
  "deepmerge": "^4.2.2"
44
44
  }
45
45
  }
@@ -33,7 +33,6 @@ var import_raf = __toESM(require("../../services/raf.cjs"), 1);
33
33
  var import_scheduler = require("../scheduler.cjs");
34
34
  var id = 0;
35
35
  var running = /* @__PURE__ */ new WeakMap();
36
- var raf = (0, import_raf.default)();
37
36
  var noop = () => {
38
37
  };
39
38
  var PROGRESS_PRECISION = 1e-4;
@@ -119,6 +118,7 @@ function render(element, from, to, progress) {
119
118
  }
120
119
  function animate(element, keyframes, options = {}) {
121
120
  var _a;
121
+ const raf = (0, import_raf.default)();
122
122
  let progressValue = 0;
123
123
  let easedProgress = 0;
124
124
  if (!running.has(element)) {
@@ -1,21 +1,14 @@
1
1
  /**
2
2
  * @typedef {import('./transform.js').TransformProps} TransformProps
3
- * @typedef {import('../math/ease.js').EasingFunction} EasingFn
4
3
  * @typedef {[number, number, number, number]} BezierCurve
5
- * @typedef {{
6
- * duration?: number;
7
- * easing?: EasingFn|BezierCurve;
8
- * onProgress?: (progress: number, easedProgress: number) => void;
9
- * onFinish?: (progress: number, easedProgress: number) => void;
10
- * }} Options
11
4
  * @typedef {TransformProps & {
12
5
  * opacity?: number;
13
6
  * transformOrigin?: string;
14
- * easing?: EasingFn|BezierCurve;
7
+ * easing?: import('../math/createEases.js').EasingFunction|BezierCurve;
15
8
  * offset?: number;
16
9
  * }} Keyframe
17
10
  * @typedef {Keyframe & {
18
- * easing: EasingFn;
11
+ * easing: import('../math/createEases.js').EasingFunction;
19
12
  * offset: number;
20
13
  * }} NormalizedKeyframe
21
14
  * @typedef {{
@@ -30,22 +23,30 @@
30
23
  * Animate an element.
31
24
  * @param {HTMLElement} element
32
25
  * @param {Keyframe[]} keyframes
33
- * @param {Options} options
26
+ * @param {{
27
+ * duration?: number;
28
+ * easing?: import('../math/createEases.js').EasingFunction|BezierCurve;
29
+ * onProgress?: (progress: number, easedProgress: number) => void;
30
+ * onFinish?: (progress: number, easedProgress: number) => void;
31
+ * }} [options]
34
32
  * @returns {Animate}
35
33
  */
36
- export function animate(element: HTMLElement, keyframes: Keyframe[], options?: Options): Animate;
34
+ export function animate(element: HTMLElement, keyframes: Keyframe[], options?: {
35
+ duration?: number;
36
+ easing?: import('../math/createEases.js').EasingFunction | BezierCurve;
37
+ onProgress?: (progress: number, easedProgress: number) => void;
38
+ onFinish?: (progress: number, easedProgress: number) => void;
39
+ }): Animate;
37
40
  export type TransformProps = import('./transform.js').TransformProps;
38
- export type EasingFn = import('../math/ease.js').EasingFunction;
39
41
  export type BezierCurve = [number, number, number, number];
40
- export type Options = Options;
41
42
  export type Keyframe = TransformProps & {
42
43
  opacity?: number;
43
44
  transformOrigin?: string;
44
- easing?: EasingFn | [number, number, number, number];
45
+ easing?: import('../math/createEases.js').EasingFunction | [number, number, number, number];
45
46
  offset?: number;
46
47
  };
47
48
  export type NormalizedKeyframe = Keyframe & {
48
- easing: EasingFn;
49
+ easing: import('../math/createEases.js').EasingFunction;
49
50
  offset: number;
50
51
  };
51
52
  export type Animate = {
@@ -6,7 +6,6 @@ import useRaf from "../../services/raf.js";
6
6
  import { domScheduler as scheduler } from "../scheduler.js";
7
7
  let id = 0;
8
8
  const running = /* @__PURE__ */ new WeakMap();
9
- const raf = useRaf();
10
9
  const noop = () => {
11
10
  };
12
11
  const PROGRESS_PRECISION = 1e-4;
@@ -92,6 +91,7 @@ function render(element, from, to, progress) {
92
91
  }
93
92
  function animate(element, keyframes, options = {}) {
94
93
  var _a;
94
+ const raf = useRaf();
95
95
  let progressValue = 0;
96
96
  let easedProgress = 0;
97
97
  if (!running.has(element)) {
@@ -31,7 +31,7 @@ __export(transition_exports, {
31
31
  setClassesOrStyles: () => setClassesOrStyles
32
32
  });
33
33
  module.exports = __toCommonJS(transition_exports);
34
- var import_nextFrame = __toESM(require("../nextFrame.cjs"), 1);
34
+ var import_nextFrame = require("../nextFrame.cjs");
35
35
  var classes = __toESM(require("./classes.cjs"), 1);
36
36
  var styles = __toESM(require("./styles.cjs"), 1);
37
37
  var cache = /* @__PURE__ */ new WeakMap();
@@ -67,11 +67,11 @@ async function start(element, classesOrStyles) {
67
67
  const trs = Transition.getInstance(element);
68
68
  trs.isTransitioning = true;
69
69
  setClassesOrStyles(element, classesOrStyles.from);
70
- await (0, import_nextFrame.default)();
71
- await (0, import_nextFrame.default)();
70
+ await (0, import_nextFrame.nextFrame)();
71
+ await (0, import_nextFrame.nextFrame)();
72
72
  setClassesOrStyles(element, classesOrStyles.active);
73
- await (0, import_nextFrame.default)();
74
- await (0, import_nextFrame.default)();
73
+ await (0, import_nextFrame.nextFrame)();
74
+ await (0, import_nextFrame.nextFrame)();
75
75
  }
76
76
  async function next(element, classesOrStyles) {
77
77
  const hasTransition = testTransition(element);
@@ -83,7 +83,7 @@ async function next(element, classesOrStyles) {
83
83
  }
84
84
  setClassesOrStyles(element, classesOrStyles.from, "remove");
85
85
  setClassesOrStyles(element, classesOrStyles.to);
86
- await (0, import_nextFrame.default)();
86
+ await (0, import_nextFrame.nextFrame)();
87
87
  if (!hasTransition) {
88
88
  resolve();
89
89
  }
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import nextFrame from "../nextFrame.js";
7
+ import { nextFrame } from "../nextFrame.js";
8
8
  import * as classes from "./classes.js";
9
9
  import * as styles from "./styles.js";
10
10
  const cache = /* @__PURE__ */ new WeakMap();
package/utils/index.cjs CHANGED
@@ -31,7 +31,7 @@ __export(utils_exports, {
31
31
  isFunction: () => import_isFunction.default,
32
32
  keyCodes: () => import_keyCodes.default,
33
33
  memoize: () => import_memoize.default,
34
- nextFrame: () => import_nextFrame.default,
34
+ nextFrame: () => import_nextFrame.nextFrame,
35
35
  nextMicrotask: () => import_nextMicrotask.default,
36
36
  nextTick: () => import_nextTick.default,
37
37
  objectToURLSearchParams: () => import_history.objectToURLSearchParams,
@@ -43,7 +43,7 @@ var import_debounce = __toESM(require("./debounce.cjs"), 1);
43
43
  var import_focusTrap = __toESM(require("./focusTrap.cjs"), 1);
44
44
  var import_keyCodes = __toESM(require("./keyCodes.cjs"), 1);
45
45
  var import_memoize = __toESM(require("./memoize.cjs"), 1);
46
- var import_nextFrame = __toESM(require("./nextFrame.cjs"), 1);
46
+ var import_nextFrame = require("./nextFrame.cjs");
47
47
  var import_nextTick = __toESM(require("./nextTick.cjs"), 1);
48
48
  var import_nextMicrotask = __toESM(require("./nextMicrotask.cjs"), 1);
49
49
  var import_throttle = __toESM(require("./throttle.cjs"), 1);
package/utils/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { default as debounce } from "./debounce.js";
2
2
  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
- export { default as nextFrame } from "./nextFrame.js";
5
+ export { nextFrame } from "./nextFrame.js";
6
6
  export { default as nextTick } from "./nextTick.js";
7
7
  export { default as nextMicrotask } from "./nextMicrotask.js";
8
8
  export { default as throttle } from "./throttle.js";
package/utils/index.js CHANGED
@@ -2,13 +2,13 @@ import { default as default2 } from "./debounce.js";
2
2
  import { default as default3 } from "./focusTrap.js";
3
3
  import { default as default4 } from "./keyCodes.js";
4
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
- import { default as default11 } from "./isDefined.js";
11
- import { default as default12 } from "./isFunction.js";
5
+ import { nextFrame } from "./nextFrame.js";
6
+ import { default as default6 } from "./nextTick.js";
7
+ import { default as default7 } from "./nextMicrotask.js";
8
+ import { default as default8 } from "./throttle.js";
9
+ import { default as default9 } from "./scrollTo.js";
10
+ import { default as default10 } from "./isDefined.js";
11
+ import { default as default11 } from "./isFunction.js";
12
12
  export * from "./css/index.js";
13
13
  import {
14
14
  objectToURLSearchParams,
@@ -24,14 +24,14 @@ export {
24
24
  default3 as focusTrap,
25
25
  push as historyPush,
26
26
  replace as historyReplace,
27
- default11 as isDefined,
28
- default12 as isFunction,
27
+ default10 as isDefined,
28
+ default11 as isFunction,
29
29
  default4 as keyCodes,
30
30
  default5 as memoize,
31
- default6 as nextFrame,
32
- default8 as nextMicrotask,
33
- default7 as nextTick,
31
+ nextFrame,
32
+ default7 as nextMicrotask,
33
+ default6 as nextTick,
34
34
  objectToURLSearchParams,
35
- default10 as scrollTo,
36
- default9 as throttle
35
+ default9 as scrollTo,
36
+ default8 as throttle
37
37
  };
@@ -0,0 +1,32 @@
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/createEases.js
20
+ var createEases_exports = {};
21
+ __export(createEases_exports, {
22
+ createEaseInOut: () => createEaseInOut,
23
+ createEaseOut: () => createEaseOut
24
+ });
25
+ module.exports = __toCommonJS(createEases_exports);
26
+ function createEaseOut(easeIn) {
27
+ return (progress) => 1 - easeIn(1 - progress);
28
+ }
29
+ function createEaseInOut(easeIn) {
30
+ return (progress) => progress === 0 ? 0 : progress === 1 ? 1 : progress < 0.5 ? easeIn(progress * 2) / 2 : 1 - easeIn((1 - progress) * 2) / 2;
31
+ }
32
+ if (module.exports.default) module.exports = module.exports.default;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @typedef {(progress: number) => number} EasingFunction
3
+ */
4
+ /**
5
+ * Create an out easing function.
6
+ *
7
+ * @param {EasingFunction} easeIn The ease in function.
8
+ * @returns {EasingFunction} The out function.
9
+ */
10
+ export function createEaseOut(easeIn: EasingFunction): EasingFunction;
11
+ /**
12
+ * Create an in-out easing function.
13
+ *
14
+ * @param {EasingFunction} easeIn The ease in function.
15
+ * @returns {EasingFunction} The in-out function.
16
+ */
17
+ export function createEaseInOut(easeIn: EasingFunction): EasingFunction;
18
+ export type EasingFunction = (progress: number) => number;
@@ -0,0 +1,10 @@
1
+ function createEaseOut(easeIn) {
2
+ return (progress) => 1 - easeIn(1 - progress);
3
+ }
4
+ function createEaseInOut(easeIn) {
5
+ return (progress) => progress === 0 ? 0 : progress === 1 ? 1 : progress < 0.5 ? easeIn(progress * 2) / 2 : 1 - easeIn((1 - progress) * 2) / 2;
6
+ }
7
+ export {
8
+ createEaseInOut,
9
+ createEaseOut
10
+ };
@@ -19,8 +19,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // packages/js-toolkit/utils/math/ease.js
20
20
  var ease_exports = {};
21
21
  __export(ease_exports, {
22
- createEaseInOut: () => createEaseInOut,
23
- createEaseOut: () => createEaseOut,
24
22
  easeInCirc: () => easeInCirc,
25
23
  easeInCubic: () => easeInCubic,
26
24
  easeInExpo: () => easeInExpo,
@@ -44,45 +42,40 @@ __export(ease_exports, {
44
42
  easeOutSine: () => easeOutSine
45
43
  });
46
44
  module.exports = __toCommonJS(ease_exports);
47
- function createEaseOut(easeIn) {
48
- return (progress) => 1 - easeIn(1 - progress);
49
- }
50
- function createEaseInOut(easeIn) {
51
- return (progress) => progress === 0 ? 0 : progress === 1 ? 1 : progress < 0.5 ? easeIn(progress * 2) / 2 : 1 - easeIn((1 - progress) * 2) / 2;
52
- }
45
+ var import_createEases = require("./createEases.cjs");
53
46
  function easeInQuad(progress) {
54
47
  return progress ** 2;
55
48
  }
56
- var easeOutQuad = createEaseOut(easeInQuad);
57
- var easeInOutQuad = createEaseInOut(easeInQuad);
49
+ var easeOutQuad = (0, import_createEases.createEaseOut)(easeInQuad);
50
+ var easeInOutQuad = (0, import_createEases.createEaseInOut)(easeInQuad);
58
51
  function easeInCubic(progress) {
59
52
  return progress ** 3;
60
53
  }
61
- var easeOutCubic = createEaseOut(easeInCubic);
62
- var easeInOutCubic = createEaseInOut(easeInCubic);
54
+ var easeOutCubic = (0, import_createEases.createEaseOut)(easeInCubic);
55
+ var easeInOutCubic = (0, import_createEases.createEaseInOut)(easeInCubic);
63
56
  function easeInQuart(progress) {
64
57
  return progress ** 4;
65
58
  }
66
- var easeOutQuart = createEaseOut(easeInQuart);
67
- var easeInOutQuart = createEaseInOut(easeInQuart);
59
+ var easeOutQuart = (0, import_createEases.createEaseOut)(easeInQuart);
60
+ var easeInOutQuart = (0, import_createEases.createEaseInOut)(easeInQuart);
68
61
  function easeInQuint(progress) {
69
62
  return progress ** 5;
70
63
  }
71
- var easeOutQuint = createEaseOut(easeInQuint);
72
- var easeInOutQuint = createEaseInOut(easeInQuint);
64
+ var easeOutQuint = (0, import_createEases.createEaseOut)(easeInQuint);
65
+ var easeInOutQuint = (0, import_createEases.createEaseInOut)(easeInQuint);
73
66
  function easeInSine(progress) {
74
67
  return progress === 1 ? 1 : -Math.cos(progress * Math.PI / 2) + 1;
75
68
  }
76
- var easeOutSine = createEaseOut(easeInSine);
77
- var easeInOutSine = createEaseInOut(easeInSine);
69
+ var easeOutSine = (0, import_createEases.createEaseOut)(easeInSine);
70
+ var easeInOutSine = (0, import_createEases.createEaseInOut)(easeInSine);
78
71
  function easeInCirc(progress) {
79
72
  return -(Math.sqrt(1 - progress * progress) - 1);
80
73
  }
81
- var easeOutCirc = createEaseOut(easeInCirc);
82
- var easeInOutCirc = createEaseInOut(easeInCirc);
74
+ var easeOutCirc = (0, import_createEases.createEaseOut)(easeInCirc);
75
+ var easeInOutCirc = (0, import_createEases.createEaseInOut)(easeInCirc);
83
76
  function easeInExpo(progress) {
84
77
  return 2 ** (10 * (progress - 1));
85
78
  }
86
- var easeOutExpo = createEaseOut(easeInExpo);
87
- var easeInOutExpo = createEaseInOut(easeInExpo);
79
+ var easeOutExpo = (0, import_createEases.createEaseOut)(easeInExpo);
80
+ var easeInOutExpo = (0, import_createEases.createEaseInOut)(easeInExpo);
88
81
  if (module.exports.default) module.exports = module.exports.default;
@@ -1,22 +1,6 @@
1
1
  /**
2
- * @typedef {(progress: number) => number} EasingFunction
3
- */
4
- /**
5
- * Create an out easing function.
6
- *
7
- * @param {EasingFunction} easeIn The ease in function.
8
- * @returns {EasingFunction} The out function.
9
- */
10
- export function createEaseOut(easeIn: EasingFunction): EasingFunction;
11
- /**
12
- * Create an in-out easing function.
13
- *
14
- * @param {EasingFunction} easeIn The ease in function.
15
- * @returns {EasingFunction} The in-out function.
16
- */
17
- export function createEaseInOut(easeIn: EasingFunction): EasingFunction;
18
- /**
19
- * @type {EasingFunction}
2
+ * @param {number} progress Progress value betwen 0 and 1.
3
+ * @returns {number} Eased value between 0 and 1.
20
4
  */
21
5
  export function easeInQuad(progress: number): number;
22
6
  /**
@@ -61,18 +45,17 @@ export function easeInCirc(progress: number): number;
61
45
  * @returns {number} Eased value between 0 and 1.
62
46
  */
63
47
  export function easeInExpo(progress: number): number;
64
- export function easeOutQuad(progress: number): number;
65
- export function easeInOutQuad(progress: number): number;
66
- export function easeOutCubic(progress: number): number;
67
- export function easeInOutCubic(progress: number): number;
68
- export function easeOutQuart(progress: number): number;
69
- export function easeInOutQuart(progress: number): number;
70
- export function easeOutQuint(progress: number): number;
71
- export function easeInOutQuint(progress: number): number;
72
- export function easeOutSine(progress: number): number;
73
- export function easeInOutSine(progress: number): number;
74
- export function easeOutCirc(progress: number): number;
75
- export function easeInOutCirc(progress: number): number;
76
- export function easeOutExpo(progress: number): number;
77
- export function easeInOutExpo(progress: number): number;
78
- export type EasingFunction = (progress: number) => number;
48
+ export const easeOutQuad: import("./createEases.js").EasingFunction;
49
+ export const easeInOutQuad: import("./createEases.js").EasingFunction;
50
+ export const easeOutCubic: import("./createEases.js").EasingFunction;
51
+ export const easeInOutCubic: import("./createEases.js").EasingFunction;
52
+ export const easeOutQuart: import("./createEases.js").EasingFunction;
53
+ export const easeInOutQuart: import("./createEases.js").EasingFunction;
54
+ export const easeOutQuint: import("./createEases.js").EasingFunction;
55
+ export const easeInOutQuint: import("./createEases.js").EasingFunction;
56
+ export const easeOutSine: import("./createEases.js").EasingFunction;
57
+ export const easeInOutSine: import("./createEases.js").EasingFunction;
58
+ export const easeOutCirc: import("./createEases.js").EasingFunction;
59
+ export const easeInOutCirc: import("./createEases.js").EasingFunction;
60
+ export const easeOutExpo: import("./createEases.js").EasingFunction;
61
+ export const easeInOutExpo: import("./createEases.js").EasingFunction;
@@ -1,9 +1,4 @@
1
- function createEaseOut(easeIn) {
2
- return (progress) => 1 - easeIn(1 - progress);
3
- }
4
- function createEaseInOut(easeIn) {
5
- return (progress) => progress === 0 ? 0 : progress === 1 ? 1 : progress < 0.5 ? easeIn(progress * 2) / 2 : 1 - easeIn((1 - progress) * 2) / 2;
6
- }
1
+ import { createEaseOut, createEaseInOut } from "./createEases.js";
7
2
  function easeInQuad(progress) {
8
3
  return progress ** 2;
9
4
  }
@@ -40,8 +35,6 @@ function easeInExpo(progress) {
40
35
  const easeOutExpo = createEaseOut(easeInExpo);
41
36
  const easeInOutExpo = createEaseInOut(easeInExpo);
42
37
  export {
43
- createEaseInOut,
44
- createEaseOut,
45
38
  easeInCirc,
46
39
  easeInCubic,
47
40
  easeInExpo,
@@ -42,4 +42,5 @@ var import_map = __toESM(require("./map.cjs"), 1);
42
42
  var import_round = __toESM(require("./round.cjs"), 1);
43
43
  __reExport(math_exports, require("./ease.cjs"), module.exports);
44
44
  var ease = __toESM(require("./ease.cjs"), 1);
45
+ __reExport(math_exports, require("./createEases.cjs"), module.exports);
45
46
  if (module.exports.default) module.exports = module.exports.default;
@@ -6,4 +6,5 @@ export { default as lerp } from "./lerp.js";
6
6
  export { default as map } from "./map.js";
7
7
  export { default as round } from "./round.js";
8
8
  export * from "./ease.js";
9
+ export * from "./createEases.js";
9
10
  export * as ease from "./ease.js";
@@ -7,6 +7,7 @@ import { default as default7 } from "./map.js";
7
7
  import { default as default8 } from "./round.js";
8
8
  export * from "./ease.js";
9
9
  import * as ease from "./ease.js";
10
+ export * from "./createEases.js";
10
11
  export {
11
12
  default2 as clamp,
12
13
  default3 as clamp01,
@@ -19,9 +19,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // packages/js-toolkit/utils/nextFrame.js
20
20
  var nextFrame_exports = {};
21
21
  __export(nextFrame_exports, {
22
- default: () => nextFrame,
23
22
  getCancelRaf: () => getCancelRaf,
24
- getRaf: () => getRaf
23
+ getRaf: () => getRaf,
24
+ nextFrame: () => nextFrame
25
25
  });
26
26
  module.exports = __toCommonJS(nextFrame_exports);
27
27
  function getRaf() {
@@ -24,4 +24,4 @@ export function getCancelRaf(): (id: number) => void;
24
24
  * console.log('hello world');
25
25
  * ```
26
26
  */
27
- export default function nextFrame<T extends () => any>(fn?: T): Promise<T extends Function ? ReturnType<T> : undefined>;
27
+ export function nextFrame<T extends () => any>(fn?: T): Promise<T extends Function ? ReturnType<T> : undefined>;
@@ -10,7 +10,7 @@ function nextFrame(fn) {
10
10
  });
11
11
  }
12
12
  export {
13
- nextFrame as default,
14
13
  getCancelRaf,
15
- getRaf
14
+ getRaf,
15
+ nextFrame
16
16
  };
@@ -60,7 +60,8 @@ function getScheduler(steps) {
60
60
  return api;
61
61
  }
62
62
  var instances = /* @__PURE__ */ new Map();
63
- function useScheduler(steps = ["read", "write"]) {
63
+ var domSchedulerSteps = ["read", "write", "afterWrite"];
64
+ function useScheduler(steps = domSchedulerSteps) {
64
65
  const key = steps.join("-");
65
66
  if (instances.has(key)) {
66
67
  return instances.get(key);
@@ -69,5 +70,5 @@ function useScheduler(steps = ["read", "write"]) {
69
70
  instances.set(key, scheduler);
70
71
  return scheduler;
71
72
  }
72
- var domScheduler = useScheduler(["read", "write", "afterWrite"]);
73
+ var domScheduler = useScheduler(domSchedulerSteps);
73
74
  if (module.exports.default) module.exports = module.exports.default;
@@ -35,7 +35,8 @@ function getScheduler(steps) {
35
35
  return api;
36
36
  }
37
37
  const instances = /* @__PURE__ */ new Map();
38
- function useScheduler(steps = ["read", "write"]) {
38
+ const domSchedulerSteps = ["read", "write", "afterWrite"];
39
+ function useScheduler(steps = domSchedulerSteps) {
39
40
  const key = steps.join("-");
40
41
  if (instances.has(key)) {
41
42
  return instances.get(key);
@@ -44,7 +45,7 @@ function useScheduler(steps = ["read", "write"]) {
44
45
  instances.set(key, scheduler);
45
46
  return scheduler;
46
47
  }
47
- const domScheduler = useScheduler(["read", "write", "afterWrite"]);
48
+ const domScheduler = useScheduler(domSchedulerSteps);
48
49
  export {
49
50
  domScheduler,
50
51
  useScheduler