@thednp/tween 0.0.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.
package/dist/react.cjs ADDED
@@ -0,0 +1,61 @@
1
+ let react = require("react");
2
+ let _thednp_tween = require("@thednp/tween");
3
+
4
+ //#region src/react/index.ts
5
+ function useTween(initialValues) {
6
+ const [state, setState] = (0, react.useState)({ ...initialValues });
7
+ const tweenRef = (0, react.useRef)(null);
8
+ const configureRef = (0, react.useRef)(null);
9
+ if (!tweenRef.current) tweenRef.current = new _thednp_tween.Tween(initialValues).onUpdate((newState) => {
10
+ setState({ ...newState });
11
+ });
12
+ (0, react.useEffect)(() => {
13
+ if (tweenRef.current && configureRef.current) configureRef.current(tweenRef.current);
14
+ return () => {
15
+ tweenRef.current?.stop();
16
+ };
17
+ }, []);
18
+ const setup = (configure) => {
19
+ configureRef.current = configure;
20
+ };
21
+ return [
22
+ state,
23
+ tweenRef.current,
24
+ setup
25
+ ];
26
+ }
27
+ function useTimeline(initialValues) {
28
+ const [state, setState] = (0, react.useState)({ ...initialValues });
29
+ const timelineRef = (0, react.useRef)(null);
30
+ const configureRef = (0, react.useRef)(null);
31
+ if (!timelineRef.current) timelineRef.current = new _thednp_tween.Timeline(initialValues).onUpdate((newState) => setState({ ...newState }));
32
+ (0, react.useEffect)(() => {
33
+ if (timelineRef.current) {
34
+ timelineRef.current.clear();
35
+ if (configureRef.current) configureRef.current(timelineRef.current);
36
+ }
37
+ return () => {
38
+ timelineRef.current?.stop();
39
+ };
40
+ }, []);
41
+ const setup = (configure) => {
42
+ configureRef.current = configure;
43
+ };
44
+ return [
45
+ state,
46
+ timelineRef.current,
47
+ setup
48
+ ];
49
+ }
50
+
51
+ //#endregion
52
+ exports.useTimeline = useTimeline;
53
+ exports.useTween = useTween;
54
+ Object.keys(_thednp_tween).forEach(function (k) {
55
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
56
+ enumerable: true,
57
+ get: function () { return _thednp_tween[k]; }
58
+ });
59
+ });
60
+
61
+ //# sourceMappingURL=react.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.cjs","names":[],"sources":["../src/react/index.ts"],"sourcesContent":["// import * as React from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { Timeline, Tween, type TweenProps } from \"@thednp/tween\";\n\nexport * from \"@thednp/tween\";\n\nexport function useTween<T extends TweenProps>(initialValues: T) {\n const [state, setState] = useState<T>({ ...initialValues });\n const tweenRef = useRef<Tween<T> | null>(null);\n const configureRef = useRef<((tween: Tween<T>) => void) | null>(null);\n\n if (!tweenRef.current) {\n tweenRef.current = new Tween(initialValues).onUpdate((newState) => {\n setState({ ...newState });\n });\n }\n\n useEffect(() => {\n // istanbul ignore next @preserve\n if (tweenRef.current && configureRef.current) {\n configureRef.current(tweenRef.current);\n }\n return () => {\n tweenRef.current?.stop();\n };\n }, []);\n\n const setup = (configure: (tween: Tween<T>) => void) => {\n configureRef.current = configure;\n };\n\n return [state, tweenRef.current, setup] as [T, Tween<T>, typeof setup];\n}\n\nexport function useTimeline<T extends TweenProps>(\n initialValues: T,\n) {\n const [state, setState] = useState<T>({ ...initialValues });\n const timelineRef = useRef<Timeline<T> | null>(null);\n const configureRef = useRef<((timeline: Timeline<T>) => void) | null>(null);\n\n if (!timelineRef.current) {\n timelineRef.current = new Timeline(initialValues).onUpdate((newState) =>\n setState({ ...newState })\n );\n }\n\n useEffect(() => {\n // istanbul ignore else @preserve\n if (timelineRef.current) {\n timelineRef.current.clear(); // always reset before possible re-config\n\n // istanbul ignore else @preserve\n if (configureRef.current) {\n configureRef.current(timelineRef.current);\n }\n }\n\n return () => {\n timelineRef.current?.stop();\n };\n }, []);\n\n const setup = (configure: (timeline: Timeline<T>) => void) => {\n configureRef.current = configure;\n };\n\n return [state, timelineRef.current, setup] as [T, Timeline<T>, typeof setup];\n}\n"],"mappings":";;;;AAMA,SAAgB,SAA+B,eAAkB;CAC/D,MAAM,CAAC,OAAO,gCAAwB,EAAE,GAAG,eAAe,CAAC;CAC3D,MAAM,6BAAmC,KAAK;CAC9C,MAAM,iCAA0D,KAAK;AAErE,KAAI,CAAC,SAAS,QACZ,UAAS,UAAU,IAAI,oBAAM,cAAc,CAAC,UAAU,aAAa;AACjE,WAAS,EAAE,GAAG,UAAU,CAAC;GACzB;AAGJ,4BAAgB;AAEd,MAAI,SAAS,WAAW,aAAa,QACnC,cAAa,QAAQ,SAAS,QAAQ;AAExC,eAAa;AACX,YAAS,SAAS,MAAM;;IAEzB,EAAE,CAAC;CAEN,MAAM,SAAS,cAAyC;AACtD,eAAa,UAAU;;AAGzB,QAAO;EAAC;EAAO,SAAS;EAAS;EAAM;;AAGzC,SAAgB,YACd,eACA;CACA,MAAM,CAAC,OAAO,gCAAwB,EAAE,GAAG,eAAe,CAAC;CAC3D,MAAM,gCAAyC,KAAK;CACpD,MAAM,iCAAgE,KAAK;AAE3E,KAAI,CAAC,YAAY,QACf,aAAY,UAAU,IAAI,uBAAS,cAAc,CAAC,UAAU,aAC1D,SAAS,EAAE,GAAG,UAAU,CAAA,CACzB;AAGH,4BAAgB;AAEd,MAAI,YAAY,SAAS;AACvB,eAAY,QAAQ,OAAO;AAG3B,OAAI,aAAa,QACf,cAAa,QAAQ,YAAY,QAAQ;;AAI7C,eAAa;AACX,eAAY,SAAS,MAAM;;IAE5B,EAAE,CAAC;CAEN,MAAM,SAAS,cAA+C;AAC5D,eAAa,UAAU;;AAGzB,QAAO;EAAC;EAAO,YAAY;EAAS;EAAM"}
@@ -0,0 +1,9 @@
1
+ import { Timeline, Tween, TweenProps } from "@thednp/tween";
2
+ export * from "@thednp/tween";
3
+
4
+ //#region src/react/index.d.ts
5
+ declare function useTween<T extends TweenProps>(initialValues: T): [T, Tween<T>, (configure: (tween: Tween<T>) => void) => void];
6
+ declare function useTimeline<T extends TweenProps>(initialValues: T): [T, Timeline<T>, (configure: (timeline: Timeline<T>) => void) => void];
7
+ //#endregion
8
+ export { useTimeline, useTween };
9
+ //# sourceMappingURL=react.d.cts.map
@@ -0,0 +1,9 @@
1
+ import { Timeline, Tween, TweenProps } from "@thednp/tween";
2
+ export * from "@thednp/tween";
3
+
4
+ //#region src/react/index.d.ts
5
+ declare function useTween<T extends TweenProps>(initialValues: T): [T, Tween<T>, (configure: (tween: Tween<T>) => void) => void];
6
+ declare function useTimeline<T extends TweenProps>(initialValues: T): [T, Timeline<T>, (configure: (timeline: Timeline<T>) => void) => void];
7
+ //#endregion
8
+ export { useTimeline, useTween };
9
+ //# sourceMappingURL=react.d.mts.map
package/dist/react.mjs ADDED
@@ -0,0 +1,55 @@
1
+ import { useEffect, useRef, useState } from "react";
2
+ import { Timeline, Tween } from "@thednp/tween";
3
+
4
+ export * from "@thednp/tween"
5
+
6
+ //#region src/react/index.ts
7
+ function useTween(initialValues) {
8
+ const [state, setState] = useState({ ...initialValues });
9
+ const tweenRef = useRef(null);
10
+ const configureRef = useRef(null);
11
+ if (!tweenRef.current) tweenRef.current = new Tween(initialValues).onUpdate((newState) => {
12
+ setState({ ...newState });
13
+ });
14
+ useEffect(() => {
15
+ if (tweenRef.current && configureRef.current) configureRef.current(tweenRef.current);
16
+ return () => {
17
+ tweenRef.current?.stop();
18
+ };
19
+ }, []);
20
+ const setup = (configure) => {
21
+ configureRef.current = configure;
22
+ };
23
+ return [
24
+ state,
25
+ tweenRef.current,
26
+ setup
27
+ ];
28
+ }
29
+ function useTimeline(initialValues) {
30
+ const [state, setState] = useState({ ...initialValues });
31
+ const timelineRef = useRef(null);
32
+ const configureRef = useRef(null);
33
+ if (!timelineRef.current) timelineRef.current = new Timeline(initialValues).onUpdate((newState) => setState({ ...newState }));
34
+ useEffect(() => {
35
+ if (timelineRef.current) {
36
+ timelineRef.current.clear();
37
+ if (configureRef.current) configureRef.current(timelineRef.current);
38
+ }
39
+ return () => {
40
+ timelineRef.current?.stop();
41
+ };
42
+ }, []);
43
+ const setup = (configure) => {
44
+ configureRef.current = configure;
45
+ };
46
+ return [
47
+ state,
48
+ timelineRef.current,
49
+ setup
50
+ ];
51
+ }
52
+
53
+ //#endregion
54
+ export { useTimeline, useTween };
55
+ //# sourceMappingURL=react.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.mjs","names":[],"sources":["../src/react/index.ts"],"sourcesContent":["// import * as React from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { Timeline, Tween, type TweenProps } from \"@thednp/tween\";\n\nexport * from \"@thednp/tween\";\n\nexport function useTween<T extends TweenProps>(initialValues: T) {\n const [state, setState] = useState<T>({ ...initialValues });\n const tweenRef = useRef<Tween<T> | null>(null);\n const configureRef = useRef<((tween: Tween<T>) => void) | null>(null);\n\n if (!tweenRef.current) {\n tweenRef.current = new Tween(initialValues).onUpdate((newState) => {\n setState({ ...newState });\n });\n }\n\n useEffect(() => {\n // istanbul ignore next @preserve\n if (tweenRef.current && configureRef.current) {\n configureRef.current(tweenRef.current);\n }\n return () => {\n tweenRef.current?.stop();\n };\n }, []);\n\n const setup = (configure: (tween: Tween<T>) => void) => {\n configureRef.current = configure;\n };\n\n return [state, tweenRef.current, setup] as [T, Tween<T>, typeof setup];\n}\n\nexport function useTimeline<T extends TweenProps>(\n initialValues: T,\n) {\n const [state, setState] = useState<T>({ ...initialValues });\n const timelineRef = useRef<Timeline<T> | null>(null);\n const configureRef = useRef<((timeline: Timeline<T>) => void) | null>(null);\n\n if (!timelineRef.current) {\n timelineRef.current = new Timeline(initialValues).onUpdate((newState) =>\n setState({ ...newState })\n );\n }\n\n useEffect(() => {\n // istanbul ignore else @preserve\n if (timelineRef.current) {\n timelineRef.current.clear(); // always reset before possible re-config\n\n // istanbul ignore else @preserve\n if (configureRef.current) {\n configureRef.current(timelineRef.current);\n }\n }\n\n return () => {\n timelineRef.current?.stop();\n };\n }, []);\n\n const setup = (configure: (timeline: Timeline<T>) => void) => {\n configureRef.current = configure;\n };\n\n return [state, timelineRef.current, setup] as [T, Timeline<T>, typeof setup];\n}\n"],"mappings":";;;;;;AAMA,SAAgB,SAA+B,eAAkB;CAC/D,MAAM,CAAC,OAAO,YAAY,SAAY,EAAE,GAAG,eAAe,CAAC;CAC3D,MAAM,WAAW,OAAwB,KAAK;CAC9C,MAAM,eAAe,OAA2C,KAAK;AAErE,KAAI,CAAC,SAAS,QACZ,UAAS,UAAU,IAAI,MAAM,cAAc,CAAC,UAAU,aAAa;AACjE,WAAS,EAAE,GAAG,UAAU,CAAC;GACzB;AAGJ,iBAAgB;AAEd,MAAI,SAAS,WAAW,aAAa,QACnC,cAAa,QAAQ,SAAS,QAAQ;AAExC,eAAa;AACX,YAAS,SAAS,MAAM;;IAEzB,EAAE,CAAC;CAEN,MAAM,SAAS,cAAyC;AACtD,eAAa,UAAU;;AAGzB,QAAO;EAAC;EAAO,SAAS;EAAS;EAAM;;AAGzC,SAAgB,YACd,eACA;CACA,MAAM,CAAC,OAAO,YAAY,SAAY,EAAE,GAAG,eAAe,CAAC;CAC3D,MAAM,cAAc,OAA2B,KAAK;CACpD,MAAM,eAAe,OAAiD,KAAK;AAE3E,KAAI,CAAC,YAAY,QACf,aAAY,UAAU,IAAI,SAAS,cAAc,CAAC,UAAU,aAC1D,SAAS,EAAE,GAAG,UAAU,CAAA,CACzB;AAGH,iBAAgB;AAEd,MAAI,YAAY,SAAS;AACvB,eAAY,QAAQ,OAAO;AAG3B,OAAI,aAAa,QACf,cAAa,QAAQ,YAAY,QAAQ;;AAI7C,eAAa;AACX,eAAY,SAAS,MAAM;;IAE5B,EAAE,CAAC;CAEN,MAAM,SAAS,cAA+C;AAC5D,eAAa,UAAU;;AAGzB,QAAO;EAAC;EAAO,YAAY;EAAS;EAAM"}
package/dist/solid.cjs ADDED
@@ -0,0 +1,81 @@
1
+ let _thednp_tween = require("@thednp/tween");
2
+ let solid_js = require("solid-js");
3
+
4
+ //#region src/solid/ministore.ts
5
+ const STATE_PROXY = "_proxy";
6
+ const isPlainObject = (value) => typeof value === "object" && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
7
+ function defineStateProxy(key, value, target) {
8
+ const [get, set] = (0, solid_js.createSignal)(value);
9
+ Object.defineProperties(target, {
10
+ [STATE_PROXY]: {
11
+ value: 1,
12
+ enumerable: false,
13
+ configurable: false,
14
+ writable: false
15
+ },
16
+ [key]: {
17
+ get,
18
+ set,
19
+ enumerable: true
20
+ }
21
+ });
22
+ }
23
+ function createMiniState(obj, parentReceiver) {
24
+ if (Object.prototype.hasOwnProperty.call(obj, STATE_PROXY)) return obj;
25
+ for (const [key, value] of Object.entries(obj)) if (isPlainObject(value)) parentReceiver[key] = createMiniState(value, {});
26
+ else defineStateProxy(key, value, parentReceiver);
27
+ return parentReceiver;
28
+ }
29
+ function deepMerge(target, source) {
30
+ const sourceEntries = Object.entries(source);
31
+ const len = sourceEntries.length;
32
+ let i = 0;
33
+ while (i < len) {
34
+ const [key, value] = sourceEntries[i];
35
+ i++;
36
+ if (!Object.prototype.hasOwnProperty.call(source, key) || key === "__proto__" || key === "constructor" || key === "prototype") continue;
37
+ if (value && typeof value === "object" && !Array.isArray(value)) {
38
+ if (!target[key]) target[key] = {};
39
+ deepMerge(target[key], value);
40
+ } else target[key] = value;
41
+ }
42
+ }
43
+ function miniStore(init) {
44
+ return createMiniState(init, {});
45
+ }
46
+
47
+ //#endregion
48
+ //#region src/solid/index.ts
49
+ function createTween(initialValues) {
50
+ const store = miniStore({ ...initialValues });
51
+ const tween = new _thednp_tween.Tween(initialValues).onUpdate((newState) => {
52
+ deepMerge(store, newState);
53
+ });
54
+ (0, solid_js.onCleanup)(() => {
55
+ tween.stop();
56
+ });
57
+ return [store, tween];
58
+ }
59
+ function createTimeline(initialValues) {
60
+ const store = miniStore({ ...initialValues });
61
+ const timeline = new _thednp_tween.Timeline(initialValues).onUpdate((newState) => {
62
+ deepMerge(store, newState);
63
+ });
64
+ (0, solid_js.onCleanup)(() => {
65
+ timeline.stop();
66
+ timeline.clear();
67
+ });
68
+ return [store, timeline];
69
+ }
70
+
71
+ //#endregion
72
+ exports.createTimeline = createTimeline;
73
+ exports.createTween = createTween;
74
+ Object.keys(_thednp_tween).forEach(function (k) {
75
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
76
+ enumerable: true,
77
+ get: function () { return _thednp_tween[k]; }
78
+ });
79
+ });
80
+
81
+ //# sourceMappingURL=solid.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solid.cjs","names":["Tween","Timeline"],"sources":["../src/solid/ministore.ts","../src/solid/index.ts"],"sourcesContent":["import { createSignal } from \"solid-js\";\nimport { type TweenProps } from \"@thednp/tween\";\n\nconst STATE_PROXY = \"_proxy\";\n\nconst isPlainObject = (\n value: unknown,\n): value is Record<string, unknown> =>\n typeof value === \"object\" &&\n !Array.isArray(value) &&\n Object.getPrototypeOf(value) === Object.prototype;\n\nfunction defineStateProxy<T extends Omit<TweenProps, \"_proxy\">>(\n key: keyof T,\n value: T[keyof T],\n target: T,\n) {\n const [get, set] = createSignal(value);\n Object.defineProperties(target, {\n [STATE_PROXY]: {\n value: 1,\n enumerable: false,\n configurable: false,\n writable: false,\n },\n [key]: { get, set, enumerable: true },\n });\n}\n\nfunction createMiniState<T extends TweenProps>(\n obj: T,\n parentReceiver: TweenProps,\n) {\n // istanbul ignore next @preserve\n if (Object.prototype.hasOwnProperty.call(obj, STATE_PROXY)) return obj;\n for (const [key, value] of Object.entries(obj)) {\n if (isPlainObject(value)) {\n parentReceiver[key] = createMiniState(value, {});\n } else {\n defineStateProxy(key, value, parentReceiver);\n }\n }\n\n return parentReceiver as T;\n}\n\nexport function deepMerge<T extends TweenProps>(target: T, source: T) {\n const sourceEntries = Object.entries(source);\n const len = sourceEntries.length;\n let i = 0;\n\n while (i < len) {\n const [key, value] = sourceEntries[i] as [keyof T, T[keyof T]];\n i++;\n\n // istanbul ignore if @preserve\n if (\n !Object.prototype.hasOwnProperty.call(source, key) ||\n key === \"__proto__\" ||\n key === \"constructor\" ||\n key === \"prototype\"\n ) {\n continue;\n }\n if (\n value && typeof value === \"object\" &&\n !Array.isArray(value)\n ) {\n // istanbul ignore next @preserve\n if (!target[key]) target[key] = {} as never;\n deepMerge(target[key] as never, value);\n } else {\n target[key] = value;\n }\n }\n}\n\nexport function miniStore<T extends TweenProps>(init: T) {\n return createMiniState(init, {}) as T;\n}\n","import { Timeline, Tween, type TweenProps } from \"@thednp/tween\";\nimport { onCleanup } from \"solid-js\";\nimport { deepMerge, miniStore } from \"./ministore.ts\";\n\nexport * from \"@thednp/tween\";\n\nexport function createTween<T extends TweenProps>(initialValues: T) {\n const store = miniStore({ ...initialValues });\n\n const tween = new Tween(initialValues).onUpdate((newState) => {\n deepMerge(store, newState);\n });\n\n onCleanup(() => {\n tween.stop();\n });\n\n return [store, tween] as [T, Tween<T>];\n}\n\nexport function createTimeline<T extends TweenProps>(initialValues: T) {\n const store = miniStore({ ...initialValues });\n\n const timeline = new Timeline(initialValues).onUpdate((newState) => {\n deepMerge(store, newState);\n });\n\n onCleanup(() => {\n timeline.stop();\n timeline.clear();\n });\n\n return [store, timeline] as [T, Timeline<T>];\n}\n"],"mappings":";;;;AAGA,MAAM,cAAc;AAEpB,MAAM,iBACJ,UAEA,OAAO,UAAU,YACjB,CAAC,MAAM,QAAQ,MAAM,IACrB,OAAO,eAAe,MAAM,KAAK,OAAO;AAE1C,SAAS,iBACP,KACA,OACA,QACA;CACA,MAAM,CAAC,KAAK,kCAAoB,MAAM;AACtC,QAAO,iBAAiB,QAAQ;GAC7B,cAAc;GACb,OAAO;GACP,YAAY;GACZ,cAAc;GACd,UAAU;GACX;GACA,MAAM;GAAE;GAAK;GAAK,YAAY;GAAM;EACtC,CAAC;;AAGJ,SAAS,gBACP,KACA,gBACA;AAEA,KAAI,OAAO,UAAU,eAAe,KAAK,KAAK,YAAY,CAAE,QAAO;AACnE,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,IAAI,CAC5C,KAAI,cAAc,MAAM,CACtB,gBAAe,OAAO,gBAAgB,OAAO,EAAE,CAAC;KAEhD,kBAAiB,KAAK,OAAO,eAAe;AAIhD,QAAO;;AAGT,SAAgB,UAAgC,QAAW,QAAW;CACpE,MAAM,gBAAgB,OAAO,QAAQ,OAAO;CAC5C,MAAM,MAAM,cAAc;CAC1B,IAAI,IAAI;AAER,QAAO,IAAI,KAAK;EACd,MAAM,CAAC,KAAK,SAAS,cAAc;AACnC;AAGA,MACE,CAAC,OAAO,UAAU,eAAe,KAAK,QAAQ,IAAI,IAClD,QAAQ,eACR,QAAQ,iBACR,QAAQ,YAER;AAEF,MACE,SAAS,OAAO,UAAU,YAC1B,CAAC,MAAM,QAAQ,MAAK,EACpB;AAEA,OAAI,CAAC,OAAO,KAAM,QAAO,OAAO,EAAE;AAClC,aAAU,OAAO,MAAe,MAAM;QAEtC,QAAO,OAAO;;;AAKpB,SAAgB,UAAgC,MAAS;AACvD,QAAO,gBAAgB,MAAM,EAAE,CAAC;;;;;ACxElC,SAAgB,YAAkC,eAAkB;CAClE,MAAM,QAAQ,UAAU,EAAE,GAAG,eAAe,CAAC;CAE7C,MAAM,QAAQ,IAAIA,oBAAM,cAAc,CAAC,UAAU,aAAa;AAC5D,YAAU,OAAO,SAAS;GAC1B;AAEF,+BAAgB;AACd,QAAM,MAAM;GACZ;AAEF,QAAO,CAAC,OAAO,MAAM;;AAGvB,SAAgB,eAAqC,eAAkB;CACrE,MAAM,QAAQ,UAAU,EAAE,GAAG,eAAe,CAAC;CAE7C,MAAM,WAAW,IAAIC,uBAAS,cAAc,CAAC,UAAU,aAAa;AAClE,YAAU,OAAO,SAAS;GAC1B;AAEF,+BAAgB;AACd,WAAS,MAAM;AACf,WAAS,OAAO;GAChB;AAEF,QAAO,CAAC,OAAO,SAAS"}
@@ -0,0 +1,9 @@
1
+ import { Timeline, Tween, TweenProps } from "@thednp/tween";
2
+ export * from "@thednp/tween";
3
+
4
+ //#region src/solid/index.d.ts
5
+ declare function createTween<T extends TweenProps>(initialValues: T): [T, Tween<T>];
6
+ declare function createTimeline<T extends TweenProps>(initialValues: T): [T, Timeline<T>];
7
+ //#endregion
8
+ export { createTimeline, createTween };
9
+ //# sourceMappingURL=solid.d.cts.map
@@ -0,0 +1,9 @@
1
+ import { Timeline, Tween, TweenProps } from "@thednp/tween";
2
+ export * from "@thednp/tween";
3
+
4
+ //#region src/solid/index.d.ts
5
+ declare function createTween<T extends TweenProps>(initialValues: T): [T, Tween<T>];
6
+ declare function createTimeline<T extends TweenProps>(initialValues: T): [T, Timeline<T>];
7
+ //#endregion
8
+ export { createTimeline, createTween };
9
+ //# sourceMappingURL=solid.d.mts.map
package/dist/solid.mjs ADDED
@@ -0,0 +1,75 @@
1
+ import { Timeline, Tween } from "@thednp/tween";
2
+ import { createSignal, onCleanup } from "solid-js";
3
+
4
+ export * from "@thednp/tween"
5
+
6
+ //#region src/solid/ministore.ts
7
+ const STATE_PROXY = "_proxy";
8
+ const isPlainObject = (value) => typeof value === "object" && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
9
+ function defineStateProxy(key, value, target) {
10
+ const [get, set] = createSignal(value);
11
+ Object.defineProperties(target, {
12
+ [STATE_PROXY]: {
13
+ value: 1,
14
+ enumerable: false,
15
+ configurable: false,
16
+ writable: false
17
+ },
18
+ [key]: {
19
+ get,
20
+ set,
21
+ enumerable: true
22
+ }
23
+ });
24
+ }
25
+ function createMiniState(obj, parentReceiver) {
26
+ if (Object.prototype.hasOwnProperty.call(obj, STATE_PROXY)) return obj;
27
+ for (const [key, value] of Object.entries(obj)) if (isPlainObject(value)) parentReceiver[key] = createMiniState(value, {});
28
+ else defineStateProxy(key, value, parentReceiver);
29
+ return parentReceiver;
30
+ }
31
+ function deepMerge(target, source) {
32
+ const sourceEntries = Object.entries(source);
33
+ const len = sourceEntries.length;
34
+ let i = 0;
35
+ while (i < len) {
36
+ const [key, value] = sourceEntries[i];
37
+ i++;
38
+ if (!Object.prototype.hasOwnProperty.call(source, key) || key === "__proto__" || key === "constructor" || key === "prototype") continue;
39
+ if (value && typeof value === "object" && !Array.isArray(value)) {
40
+ if (!target[key]) target[key] = {};
41
+ deepMerge(target[key], value);
42
+ } else target[key] = value;
43
+ }
44
+ }
45
+ function miniStore(init) {
46
+ return createMiniState(init, {});
47
+ }
48
+
49
+ //#endregion
50
+ //#region src/solid/index.ts
51
+ function createTween(initialValues) {
52
+ const store = miniStore({ ...initialValues });
53
+ const tween = new Tween(initialValues).onUpdate((newState) => {
54
+ deepMerge(store, newState);
55
+ });
56
+ onCleanup(() => {
57
+ tween.stop();
58
+ });
59
+ return [store, tween];
60
+ }
61
+ function createTimeline(initialValues) {
62
+ const store = miniStore({ ...initialValues });
63
+ const timeline = new Timeline(initialValues).onUpdate((newState) => {
64
+ deepMerge(store, newState);
65
+ });
66
+ onCleanup(() => {
67
+ timeline.stop();
68
+ timeline.clear();
69
+ });
70
+ return [store, timeline];
71
+ }
72
+
73
+ //#endregion
74
+ export { createTimeline, createTween };
75
+ //# sourceMappingURL=solid.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solid.mjs","names":[],"sources":["../src/solid/ministore.ts","../src/solid/index.ts"],"sourcesContent":["import { createSignal } from \"solid-js\";\nimport { type TweenProps } from \"@thednp/tween\";\n\nconst STATE_PROXY = \"_proxy\";\n\nconst isPlainObject = (\n value: unknown,\n): value is Record<string, unknown> =>\n typeof value === \"object\" &&\n !Array.isArray(value) &&\n Object.getPrototypeOf(value) === Object.prototype;\n\nfunction defineStateProxy<T extends Omit<TweenProps, \"_proxy\">>(\n key: keyof T,\n value: T[keyof T],\n target: T,\n) {\n const [get, set] = createSignal(value);\n Object.defineProperties(target, {\n [STATE_PROXY]: {\n value: 1,\n enumerable: false,\n configurable: false,\n writable: false,\n },\n [key]: { get, set, enumerable: true },\n });\n}\n\nfunction createMiniState<T extends TweenProps>(\n obj: T,\n parentReceiver: TweenProps,\n) {\n // istanbul ignore next @preserve\n if (Object.prototype.hasOwnProperty.call(obj, STATE_PROXY)) return obj;\n for (const [key, value] of Object.entries(obj)) {\n if (isPlainObject(value)) {\n parentReceiver[key] = createMiniState(value, {});\n } else {\n defineStateProxy(key, value, parentReceiver);\n }\n }\n\n return parentReceiver as T;\n}\n\nexport function deepMerge<T extends TweenProps>(target: T, source: T) {\n const sourceEntries = Object.entries(source);\n const len = sourceEntries.length;\n let i = 0;\n\n while (i < len) {\n const [key, value] = sourceEntries[i] as [keyof T, T[keyof T]];\n i++;\n\n // istanbul ignore if @preserve\n if (\n !Object.prototype.hasOwnProperty.call(source, key) ||\n key === \"__proto__\" ||\n key === \"constructor\" ||\n key === \"prototype\"\n ) {\n continue;\n }\n if (\n value && typeof value === \"object\" &&\n !Array.isArray(value)\n ) {\n // istanbul ignore next @preserve\n if (!target[key]) target[key] = {} as never;\n deepMerge(target[key] as never, value);\n } else {\n target[key] = value;\n }\n }\n}\n\nexport function miniStore<T extends TweenProps>(init: T) {\n return createMiniState(init, {}) as T;\n}\n","import { Timeline, Tween, type TweenProps } from \"@thednp/tween\";\nimport { onCleanup } from \"solid-js\";\nimport { deepMerge, miniStore } from \"./ministore.ts\";\n\nexport * from \"@thednp/tween\";\n\nexport function createTween<T extends TweenProps>(initialValues: T) {\n const store = miniStore({ ...initialValues });\n\n const tween = new Tween(initialValues).onUpdate((newState) => {\n deepMerge(store, newState);\n });\n\n onCleanup(() => {\n tween.stop();\n });\n\n return [store, tween] as [T, Tween<T>];\n}\n\nexport function createTimeline<T extends TweenProps>(initialValues: T) {\n const store = miniStore({ ...initialValues });\n\n const timeline = new Timeline(initialValues).onUpdate((newState) => {\n deepMerge(store, newState);\n });\n\n onCleanup(() => {\n timeline.stop();\n timeline.clear();\n });\n\n return [store, timeline] as [T, Timeline<T>];\n}\n"],"mappings":";;;;;;AAGA,MAAM,cAAc;AAEpB,MAAM,iBACJ,UAEA,OAAO,UAAU,YACjB,CAAC,MAAM,QAAQ,MAAM,IACrB,OAAO,eAAe,MAAM,KAAK,OAAO;AAE1C,SAAS,iBACP,KAC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qC,eAAkB;CACrE,MAAM,QAAQ,UAAU,EAAE,GAAG,eAAe,CAAC;CAE7C,MAAM,WAAW,IAAI,SAAS,cAAc,CAAC,UAAU,aAAa;AAClE,YAAU,OAAO,SAAS;GAC1B;AAEF,iBAAgB;AACd,WAAS,MAAM;AACf,WAAS,OAAO;GAChB;AAEF,QAAO,CAAC,OAAO,SAAS"}
@@ -0,0 +1,2 @@
1
+ var TWEEN=(function(o){"use strict";let S=()=>performance.now();const p=()=>S();function I(t){S=t}const f=[];function d(t){const e=t;f.includes(e)||(f.push(e),g||O())}function P(t){f.splice(f.indexOf(t),1)}let g=0;function O(t=p()){let e=0;for(;e<f.length;)f[e].update(t)?e+=1:f.splice(e,1);f.length===0?(cancelAnimationFrame(g),g=0):g=requestAnimationFrame(O)}class M{_interpolators=new Map;_state;_startIsSet=!1;_startFired=!1;_propsStart={};_propsEnd={};_isPlaying=!1;_duration=1e3;_delay=0;_easing=e=>e;_startTime=0;_onUpdate;_onComplete;_onStart;_onStop;constructor(e){return this._state=e,this}get isPlaying(){return this._isPlaying}start(e=p(),s=!1){return this._isPlaying?this:((!this._startIsSet||s)&&(this._startIsSet=!0,this._setProps(this._state,this._propsStart,this._propsEnd,s)),this._isPlaying=!0,this._startTime=e,this._startTime+=this._delay,d(this),this)}startFromLast(e=p()){return this.start(e,!0)}stop(){return this._isPlaying?(P(this),this._isPlaying=!1,this._onStop?.(this._state),this):this}from(e){return Object.assign(this._propsStart,e),this._startIsSet=!1,this}to(e){return this._propsEnd=e,this._startIsSet=!1,this}duration(e=1){return this._duration=e*1e3,this}delay(e=0){return this._delay=e*1e3,this}easing(e=s=>s){return this._easing=e,this}getDuration(){return this._duration}update(e=p(),s){if(!this._isPlaying)if(s)this.start(e,!0);else return!1;if(e<this._startTime)return!0;!this._startFired&&this._onStart&&(this._onStart(this._state),this._startFired=!0);let r=(e-this._startTime)/this._duration;r=this._duration===0||r>1?1:r;const i=this._easing(r);return this._setState(this._state,this._propsStart,this._propsEnd,i),this._onUpdate?.(this._state,r,i),r===1?(this._onComplete?.(this._state),this._isPlaying=!1,!1):!0}onStart(e){return this._onStart=e,this}onUpdate(e){return this._onUpdate=e,this}onComplete(e){return this._onComplete=e,this}onStop(e){return this._onStop=e,this}_setState(e,s,r,i){const n=Object.entries(r),_=n.length;let a=0;for(;a<_;){const[h,l]=n[a];if(a++,s[h]===void 0)continue;const u=s[h];if(u.constructor===l?.constructor)if(this._interpolators.has(h)){const c=this._interpolators.get(h);e[h]=c(u,l,i)}else typeof l=="number"?e[h]=u+(l-u)*i:typeof l=="object"&&this._setState(e[h],u,l,i)}}_setProps(e,s,r,i){const n=Object.keys(r);for(const _ of n){const a=e[_];(typeof s[_]>"u"||i)&&(s[_]=a)}}use(e,s){return this._interpolators.has(e)||this._interpolators.set(e,s),this}}class T{state;_state;_entries=[];_labels=new Map;_progress=0;_duration=0;_time=0;_pauseTime=0;_lastTime;_isPlaying=!1;_repeat=0;_initialRepeat=0;_interpolators=new Map;_onStart;_onStop;_onPause;_onResume;_onUpdate;_onComplete;constructor(e){this.state=e,this._state={...e}}to({duration:e=1,easing:s=n=>n,...r},i="+=0"){const n=this._resolvePosition(i),_=r,a=e*1e3;this._entries.push({to:_,startTime:n,duration:a,easing:s,hasStarted:!1});const h=n+a;return this._duration=Math.max(this._duration,h),this}play(){return this._pauseTime?this.resume():this._isPlaying?this:(this._isPlaying=!0,this._lastTime=void 0,this._time=0,this._resetState(),this._updateEntries(0),this._onStart?.(this.state,0),d(this),this)}pause(){return this._isPlaying?(this._isPlaying=!1,this._pauseTime=p(),this._onPause?.(this.state,this.progress),this):this}resume(e=p()){if(this._isPlaying)return this;this._isPlaying=!0;const s=e-this._pauseTime;return this._pauseTime=0,this._lastTime=(this._lastTime||e)+s,this._onResume?.(this.state,this.progress),d(this),this}stop(){return this._isPlaying?(this._isPlaying=!1,this._time=0,this._pauseTime=0,P(this),this._resetState(),this._updateEntries(0),this._onStop?.(this.state,this._progress),this):this}repeat(e=0){return this._repeat=e,this._initialRepeat=e,this}seek(e){const s=this._resolvePosition(e);return this._resetState(),this._time=Math.max(0,s),this._updateEntries(this._time),this}label(e,s){return this._labels.set(e,this._resolvePosition(s)),this}onStart(e){return this._onStart=e,this}onPause(e){return this._onPause=e,this}onResume(e){return this._onResume=e,this}onStop(e){return this._onStop=e,this}onUpdate(e){return this._onUpdate=e,this}onComplete(e){return this._onComplete=e,this}get progress(){return this._progress}get duration(){return this._duration}get isPlaying(){return this._isPlaying}get isPaused(){return!this._isPlaying&&this._pauseTime>0}update(e=p()){if(!this._isPlaying)return!1;this._lastTime===void 0&&(this._lastTime=e);const s=e-this._lastTime;return this._lastTime=e,this._time+=s,this._updateEntries(this._time),this._progress===1&&(this._repeat===0?(this._isPlaying=!1,this._repeat=this._initialRepeat,this._onComplete?.(this.state,1)):(this._repeat!==1/0&&this._repeat--,this._time=0,this._resetState(),this._updateEntries(0))),this._isPlaying}_updateEntries(e){this._progress=this._duration===0||e>=this._duration?1:e/this._duration;let s=0;const r=this._entries.length;for(;s<r;){const i=this._entries[s],n=e-i.startTime,_=Math.max(0,Math.min(1,n/i.duration));if(!i.hasStarted&&_>0){i.hasStarted=!0,i.startValues={};for(const a in i.to)i.startValues[a]=this.state[a]}i.hasStarted&&this._setState(this.state,i.startValues,i.to,i.easing(_)),s+=1}this._onUpdate?.(this.state,this._progress)}_resolvePosition(e){if(typeof e=="number")return e*1e3;if(typeof e=="string"){const s=this._labels.get(e);if(s!==void 0)return s;if(e.startsWith("+=")||e.startsWith("-=")){let r=parseFloat(e.slice(2));return isNaN(r)&&(r=0),r*=1e3,e.startsWith("+=")?this._duration+r:Math.max(0,this._duration-r)}}return this._duration}_setState(e,s,r,i){const n=Object.entries(r),_=n.length;let a=0;for(;a<_;){const[h,l]=n[a];if(a++,s[h]===void 0)continue;const u=s[h];if(u.constructor===l?.constructor)if(this._interpolators.has(h)){const c=this._interpolators.get(h);e[h]=c(u,l,i)}else typeof l=="number"?e[h]=u+(l-u)*i:typeof l=="object"&&this._setState(e[h],u,l,i)}}_resetState(){Object.assign(this.state,this._state);let e=0;const s=this._entries.length;for(;e<s;){const r=this._entries[e];r.hasStarted=!1,r.startValues=void 0,e+=1}}clear(){return this._entries.length=0,this._duration=0,this._labels.clear(),this._time=0,this._progress=0,this._pauseTime=0,this._lastTime=void 0,this._repeat=this._initialRepeat,this}use(e,s){return this._interpolators.has(e)||this._interpolators.set(e,s),this}}const y=Object.freeze({Linear:Object.freeze({None(t){return t},In(t){return t},Out(t){return t},InOut(t){return t}}),Quadratic:Object.freeze({In(t){return t*t},Out(t){return t*(2-t)},InOut(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}}),Cubic:Object.freeze({In(t){return t*t*t},Out(t){return--t*t*t+1},InOut(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}}),Quartic:Object.freeze({In(t){return t*t*t*t},Out(t){return 1- --t*t*t*t},InOut(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}}),Quintic:Object.freeze({In(t){return t*t*t*t*t},Out(t){return--t*t*t*t*t+1},InOut(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}}),Sinusoidal:Object.freeze({In(t){return 1-Math.sin((1-t)*Math.PI/2)},Out(t){return Math.sin(t*Math.PI/2)},InOut(t){return .5*(1-Math.sin(Math.PI*(.5-t)))}}),Exponential:Object.freeze({In(t){return t===0?0:Math.pow(1024,t-1)},Out(t){return t===1?1:1-Math.pow(2,-10*t)},InOut(t){return t===0?0:t===1?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)}}),Circular:Object.freeze({In(t){return 1-Math.sqrt(1-t*t)},Out(t){return Math.sqrt(1- --t*t)},InOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}}),Elastic:Object.freeze({In(t){return t===0?0:t===1?1:-Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI)},Out(t){return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t-.1)*5*Math.PI)+1},InOut(t){return t===0?0:t===1?1:(t*=2,t<1?-.5*Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin((t-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In(t){return t===1?1:t*t*((1.70158+1)*t-1.70158)},Out(t){return t===0?0:--t*t*((1.70158+1)*t+1.70158)+1},InOut(t){const e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)}}),Bounce:Object.freeze({In(t){return 1-y.Bounce.Out(1-t)},Out(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut(t){return t<.5?y.Bounce.In(t*2)*.5:y.Bounce.Out(t*2-1)*.5+.5}}),pow(t=4){return t=t<Number.EPSILON?Number.EPSILON:t,t=t>1e4?1e4:t,{In(e){return e**t},Out(e){return 1-(1-e)**t},InOut(e){return e<.5?(e*2)**t/2:(1-(2-e*2)**t)/2+.5}}}}),b=(t,e,s)=>{if(s===0&&t.length!==e.length)return console.warn("Array length mismatch. Returning first array."),t;const r=[],i=e.length;let n=0;for(;n<i;)r.push(t[n]+(e[n]-t[n])*s),n+=1;return r},w=(t,e,s)=>{if(s===0&&t.length!==e.length)return console.warn("Path length mismatch. Returning start path."),t;const r=[];for(let i=0;i<e.length;i+=1){const[n,_]=[t[i][0],t[i].slice(1)],[a,h]=[e[i][0],e[i].slice(1)],l=n!==a;if(s===0&&(_.length!==h.length||l))return console.warn((l?"PathCommand":"Params")+" mismatch at index: "+i+". Returning start path."),t;if(n.toUpperCase()==="Z")r.push(["Z"]);else{const u=[];for(let c=0;c<h.length;c+=1)u.push(_[c]+(h[c]-_[c])*s);r.push([a,...u])}}return r};return o.Easing=y,o.Queue=f,o.Runtime=O,o.Timeline=T,o.Tween=M,o.addToQueue=d,o.interpolateArray=b,o.interpolatePath=w,o.now=p,o.removeFromQueue=P,o.setNow=I,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),o})({});
2
+ //# sourceMappingURL=tween.iife.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tween.iife.js","sources":["../src/Now.ts","../src/Runtime.ts","../src/Tween.ts","../src/Timeline.ts","../src/Easing.ts","../src/interpolators/array.ts","../src/interpolators/path.ts"],"sourcesContent":["let _nowFunc = () => performance.now();\n\nexport const now = (): number => {\n return _nowFunc();\n};\n\nexport function setNow(nowFunction: typeof _nowFunc) {\n _nowFunc = nowFunction;\n}\n","// Runtime.ts\nimport { type Tween } from \"./Tween.ts\";\nimport { type Timeline } from \"./Timeline.ts\";\nimport { now } from \"./Now.ts\";\nimport { TweenProps } from \"./types.ts\";\n\ntype AnimationItem<T extends TweenProps = never> = Tween<T> | Timeline<T>;\n\nexport const Queue: AnimationItem[] = [];\n\nexport function addToQueue<T extends TweenProps>(\n newItem: AnimationItem<T>,\n): void {\n const item = newItem as unknown as AnimationItem<never>;\n if (Queue.includes(item)) return;\n Queue.push(item);\n if (!rafID) Runtime();\n}\n\nexport function removeFromQueue<T extends TweenProps>(\n removedItem: AnimationItem<T>,\n): void {\n Queue.splice(\n Queue.indexOf(removedItem as unknown as AnimationItem<never>),\n 1,\n );\n}\n\nlet rafID = 0;\n\nexport function Runtime(t = now()) {\n let i = 0;\n while (i < Queue.length) {\n if (Queue[i].update(t)) {\n i += 1;\n } else {\n Queue.splice(i, 1);\n }\n }\n\n if (Queue.length === 0) {\n cancelAnimationFrame(rafID);\n rafID = 0;\n } else rafID = requestAnimationFrame(Runtime);\n}\n","// Tween.ts\nimport type {\n BaseTweenProps,\n DeepPartial,\n EasingFunction,\n InterpolatorFunction,\n TweenCallback,\n TweenProps,\n TweenUpdateCallback,\n} from \"./types.ts\";\nimport { addToQueue, removeFromQueue } from \"./Runtime.ts\";\nimport { now } from \"./Now.ts\";\n\nexport class Tween<T extends TweenProps = never> {\n private _interpolators = new Map<string, InterpolatorFunction>();\n private _state: T;\n private _startIsSet = false;\n private _startFired = false;\n private _propsStart: TweenProps = {};\n private _propsEnd: TweenProps = {};\n private _isPlaying = false;\n private _duration = 1000;\n private _delay = 0;\n private _easing: EasingFunction = (t) => t;\n private _startTime: number = 0;\n private _onUpdate?: TweenUpdateCallback<T>;\n private _onComplete?: TweenCallback<T>;\n private _onStart?: TweenCallback<T>;\n private _onStop?: TweenCallback<T>;\n\n constructor(initialValues: T) {\n this._state = initialValues;\n return this;\n }\n\n get isPlaying(): boolean {\n return this._isPlaying;\n }\n\n start(time = now(), overrideStart = false) {\n if (this._isPlaying) return this;\n // istanbul ignore else @preserve\n if (!this._startIsSet || /* istanbul ignore next */ overrideStart) {\n this._startIsSet = true;\n\n this._setProps(\n this._state,\n this._propsStart,\n this._propsEnd,\n overrideStart,\n );\n }\n this._isPlaying = true;\n this._startTime = time;\n this._startTime += this._delay;\n addToQueue(this);\n return this;\n }\n startFromLast(time = now()) {\n return this.start(time, true);\n }\n stop() {\n if (!this._isPlaying) return this;\n removeFromQueue(this);\n this._isPlaying = false;\n this._onStop?.(this._state);\n return this;\n }\n from(startValues: Partial<T>) {\n // this._propsStart = startValues as T;\n Object.assign(this._propsStart, startValues);\n this._startIsSet = false;\n\n return this;\n }\n to(endValues: DeepPartial<T>) {\n this._propsEnd = endValues as TweenProps;\n this._startIsSet = false;\n\n return this;\n }\n duration(seconds = 1) {\n this._duration = seconds * 1000;\n return this;\n }\n delay(seconds = 0) {\n this._delay = seconds * 1000;\n return this;\n }\n\n easing(easing: EasingFunction = (t: number) => t) {\n this._easing = easing;\n return this;\n }\n getDuration() {\n return this._duration;\n }\n /**\n * @param time - The current time\n * @param autoStart - When true, calling update will implicitly call start()\n * as well. Note, if you stop() or end() the tween, but are still calling\n * update(), it will start again!\n *\n * @returns true if the tween is still playing after the update, false\n * otherwise (calling update on a paused tween still returns true because\n * it is still playing, just paused).\n */\n update(time = now(), autoStart?: boolean) {\n // istanbul ignore else\n if (!this._isPlaying) {\n // istanbul ignore else\n if (autoStart) this.start(time, true);\n else return false;\n }\n\n // istanbul ignore else\n if (time < this._startTime) return true;\n\n // istanbul ignore else\n if (!this._startFired && this._onStart) {\n this._onStart(this._state);\n this._startFired = true;\n }\n\n let elapsed = (time - this._startTime) / this._duration;\n elapsed = this._duration === 0 || elapsed > 1 ? 1 : elapsed;\n const progress = this._easing(elapsed);\n\n this._setState(\n this._state,\n this._propsStart,\n this._propsEnd,\n progress,\n );\n\n this._onUpdate?.(this._state, elapsed, progress);\n\n // istanbul ignore else\n if (elapsed === 1) {\n this._onComplete?.(this._state);\n this._isPlaying = false;\n\n return false;\n }\n return true;\n }\n\n onStart(callback: TweenCallback<T>) {\n this._onStart = callback;\n return this;\n }\n onUpdate(callback?: TweenUpdateCallback<T>) {\n this._onUpdate = callback;\n return this;\n }\n onComplete(callback: TweenCallback<T>) {\n this._onComplete = callback;\n return this;\n }\n onStop(callback: TweenCallback<T>) {\n this._onStop = callback;\n return this;\n }\n\n private _setState(\n object: TweenProps | BaseTweenProps,\n valuesStart: TweenProps | BaseTweenProps,\n valuesEnd: Partial<T> | TweenProps | BaseTweenProps,\n value: number,\n ): void {\n const endEntries = Object.entries(valuesEnd);\n const len = endEntries.length;\n\n let i = 0;\n while (i < len) {\n const [property, end] = endEntries[i];\n i++;\n // Don't update properties that do not exist in the source object\n // istanbul ignore else\n if (valuesStart[property] === undefined) continue;\n\n const start = valuesStart[property];\n\n // Protect against non matching properties.\n // istanbul ignore else @preserve\n if (start.constructor !== end?.constructor) continue;\n\n // Protect against non numeric properties.\n // istanbul ignore else @preserve\n if (this._interpolators.has(property)) {\n const interpolator = this._interpolators.get(property)!;\n object[property] = interpolator(start as never, end as never, value);\n } else if (typeof end === \"number\") {\n object[property] = (start as number) +\n (end - (start as number)) * value;\n } else if (typeof end === \"object\") {\n this._setState(\n object[property] as BaseTweenProps,\n start as BaseTweenProps,\n end as BaseTweenProps,\n value,\n );\n }\n }\n }\n private _setProps(\n obj: T,\n propsStart: TweenProps,\n propsEnd: TweenProps,\n overrideStartingValues: boolean,\n ): void {\n const endKeys = Object.keys(propsEnd);\n\n for (const property of endKeys) {\n const startValue = obj[property];\n\n // Save the starting value, but only once unless override is requested.\n // istanbul ignore else\n if (\n typeof propsStart[property] === \"undefined\" ||\n overrideStartingValues\n ) {\n propsStart[property] = startValue;\n }\n }\n }\n use(\n property: string,\n interpolateFn: InterpolatorFunction,\n ): this {\n // istanbul ignore else\n if (!this._interpolators.has(property)) {\n this._interpolators.set(property, interpolateFn);\n }\n return this;\n }\n}\n","// Timeline.ts\nimport type {\n BaseTweenProps,\n DeepPartial,\n InterpolatorFunction,\n Position,\n TimelineCallback,\n TimelineEntry,\n TimelineEntryConfig,\n TweenProps,\n} from \"./types.ts\";\nimport { addToQueue, removeFromQueue } from \"./Runtime.ts\";\nimport { now } from \"./Now.ts\";\n\nexport class Timeline<T extends TweenProps = never> {\n public state: T;\n private _state: T;\n private _entries: TimelineEntry<T>[] = [];\n private _labels = new Map<string, number>();\n private _progress = 0;\n private _duration = 0;\n private _time = 0;\n private _pauseTime = 0;\n private _lastTime?: number;\n private _isPlaying = false;\n private _repeat = 0;\n private _initialRepeat = 0;\n private _interpolators = new Map<string, InterpolatorFunction>();\n private _onStart?: TimelineCallback<T>;\n private _onStop?: TimelineCallback<T>;\n private _onPause?: TimelineCallback<T>;\n private _onResume?: TimelineCallback<T>;\n private _onUpdate?: TimelineCallback<T>;\n private _onComplete?: TimelineCallback<T>;\n\n constructor(initialState: T) {\n this.state = initialState;\n this._state = { ...initialState };\n }\n\n to(\n {\n duration = 1,\n easing = (t) => t,\n ...values\n }: DeepPartial<T> & TimelineEntryConfig,\n position: Position = \"+=0\",\n ): this {\n const startTime = this._resolvePosition(position);\n const to = values as TweenProps & DeepPartial<T>;\n const entryDuration = duration * 1000;\n\n this._entries.push({\n to,\n startTime,\n duration: entryDuration,\n easing,\n hasStarted: false,\n });\n\n const endTime = startTime + entryDuration;\n this._duration = Math.max(this._duration, endTime);\n\n return this;\n }\n\n play(): this {\n if (this._pauseTime) return this.resume();\n if (this._isPlaying) return this;\n\n this._isPlaying = true;\n this._lastTime = undefined;\n this._time = 0;\n this._resetState();\n this._updateEntries(0);\n this._onStart?.(this.state, 0);\n\n addToQueue(this);\n return this;\n }\n\n pause(): this {\n if (!this._isPlaying) return this;\n this._isPlaying = false;\n this._pauseTime = now();\n this._onPause?.(this.state, this.progress);\n return this;\n }\n\n resume(time = now()): this {\n if (this._isPlaying) return this;\n this._isPlaying = true;\n const dif = time - this._pauseTime;\n this._pauseTime = 0;\n this._lastTime = (this._lastTime || time) + dif;\n this._onResume?.(this.state, this.progress);\n\n addToQueue(this);\n return this;\n }\n\n stop(): this {\n if (!this._isPlaying) return this;\n this._isPlaying = false;\n this._time = 0;\n this._pauseTime = 0;\n removeFromQueue(this);\n this._resetState();\n this._updateEntries(0);\n this._onStop?.(this.state, this._progress);\n return this;\n }\n\n repeat(count = 0): this {\n this._repeat = count;\n this._initialRepeat = count;\n return this;\n }\n\n seek(pointer: number | string): this {\n const elapsed = this._resolvePosition(pointer);\n this._resetState();\n this._time = Math.max(0, elapsed);\n this._updateEntries(this._time);\n return this;\n }\n\n label(name: string, position?: Position): this {\n this._labels.set(name, this._resolvePosition(position));\n return this;\n }\n\n onStart(cb: TimelineCallback<T>): this {\n this._onStart = cb;\n return this;\n }\n\n onPause(cb: TimelineCallback<T>): this {\n this._onPause = cb;\n return this;\n }\n\n onResume(cb: TimelineCallback<T>): this {\n this._onResume = cb;\n return this;\n }\n\n onStop(cb: TimelineCallback<T>): this {\n this._onStop = cb;\n return this;\n }\n\n onUpdate(cb: TimelineCallback<T>): this {\n this._onUpdate = cb;\n return this;\n }\n\n onComplete(cb: TimelineCallback<T>): this {\n this._onComplete = cb;\n return this;\n }\n\n get progress(): number {\n return this._progress;\n }\n\n get duration(): number {\n return this._duration;\n }\n\n get isPlaying(): boolean {\n return this._isPlaying;\n }\n\n get isPaused(): boolean {\n return !this._isPlaying && this._pauseTime > 0;\n }\n\n update(time = now()) {\n if (!this._isPlaying) return false;\n if (this._lastTime === undefined) this._lastTime = time;\n const delta = time - this._lastTime;\n this._lastTime = time;\n this._time += delta;\n\n this._updateEntries(this._time);\n\n // istanbul ignore else\n if (this._progress === 1) {\n // istanbul ignore else\n if (this._repeat === 0) {\n this._isPlaying = false;\n this._repeat = this._initialRepeat;\n\n this._onComplete?.(this.state, 1);\n } else {\n // istanbul ignore else @preserve\n if (this._repeat !== Infinity) this._repeat--;\n this._time = 0;\n this._resetState();\n this._updateEntries(0);\n }\n }\n return this._isPlaying;\n }\n\n private _updateEntries(elapsed: number) {\n this._progress = this._duration === 0 || elapsed >= this._duration\n ? 1\n : elapsed / this._duration;\n\n let i = 0;\n const entriesLen = this._entries.length;\n while (i < entriesLen) {\n const entry = this._entries[i];\n const localTime = elapsed - entry.startTime;\n const tweenElapsed = Math.max(0, Math.min(1, localTime / entry.duration));\n\n if (!entry.hasStarted && tweenElapsed > 0) {\n entry.hasStarted = true;\n entry.startValues = {};\n for (const key in entry.to) {\n entry.startValues[key] = this.state[key];\n }\n }\n\n if (entry.hasStarted) {\n this._setState(\n this.state,\n entry.startValues as TweenProps & DeepPartial<T>,\n entry.to as TweenProps & DeepPartial<T>,\n entry.easing(tweenElapsed),\n );\n }\n i += 1;\n }\n\n this._onUpdate?.(this.state, this._progress);\n }\n\n private _resolvePosition(pos?: Position): number {\n if (typeof pos === \"number\") return pos * 1000;\n\n // istanbul ignore else @preserve\n if (typeof pos === \"string\") {\n // First try label\n const labelTime = this._labels.get(pos);\n if (labelTime !== undefined) return labelTime;\n\n // Then relative\n // istanbul ignore else @preserve\n if (pos.startsWith(\"+=\") || pos.startsWith(\"-=\")) {\n let offset = parseFloat(pos.slice(2));\n if (isNaN(offset)) offset = 0;\n offset *= 1000;\n return pos.startsWith(\"+=\")\n ? this._duration + offset\n : Math.max(0, this._duration - offset);\n }\n }\n\n // fallback to current duration\n return this._duration;\n }\n\n private _setState(\n object: TweenProps | BaseTweenProps,\n valuesStart: TweenProps | BaseTweenProps,\n valuesEnd: Partial<T> | TweenProps | BaseTweenProps,\n value: number,\n ): void {\n const endEntries = Object.entries(valuesEnd);\n const len = endEntries.length;\n let i = 0;\n\n while (i < len) {\n const [property, end] = endEntries[i];\n i++;\n if (valuesStart[property] === undefined) continue;\n\n const start = valuesStart[property];\n\n if (start.constructor !== end?.constructor) continue;\n\n // istanbul ignore else @preserve\n if (this._interpolators.has(property)) {\n const interpolator = this._interpolators.get(property)!;\n object[property] = interpolator(start as never, end as never, value);\n } else if (typeof end === \"number\") {\n object[property] = (start as number) +\n (end - (start as number)) * value;\n } else if (typeof end === \"object\") {\n this._setState(\n object[property] as BaseTweenProps,\n start as BaseTweenProps,\n end as BaseTweenProps,\n value,\n );\n }\n }\n }\n\n private _resetState() {\n Object.assign(this.state, this._state);\n let i = 0;\n const entriesLen = this._entries.length;\n while (i < entriesLen) {\n const entry = this._entries[i];\n entry.hasStarted = false;\n entry.startValues = undefined;\n i += 1;\n }\n }\n\n clear() {\n this._entries.length = 0;\n this._duration = 0;\n this._labels.clear();\n this._time = 0;\n this._progress = 0;\n this._pauseTime = 0;\n this._lastTime = undefined;\n // Optionally reset repeat if you want fresh repeats on remount\n this._repeat = this._initialRepeat;\n return this;\n }\n\n use(\n property: string,\n interpolateFn: InterpolatorFunction,\n ): this {\n if (!this._interpolators.has(property)) {\n this._interpolators.set(property, interpolateFn);\n }\n return this;\n }\n}\n","// Easing.ts\nimport type { EasingFunction, EasingFunctionGroup } from \"./types.ts\";\n\n/**\n * The Ease class provides a collection of easing functions for use with tween.js.\n */\n\nexport const Easing = Object.freeze({\n Linear: Object.freeze<EasingFunctionGroup & { None: EasingFunction }>({\n None(amount: number): number {\n return amount;\n },\n In(amount: number): number {\n return amount;\n },\n Out(amount: number): number {\n return amount;\n },\n InOut(amount: number): number {\n return amount;\n },\n }),\n\n Quadratic: Object.freeze(\n <EasingFunctionGroup> {\n In(amount: number): number {\n return amount * amount;\n },\n Out(amount: number): number {\n return amount * (2 - amount);\n },\n InOut(amount: number): number {\n if ((amount *= 2) < 1) {\n return 0.5 * amount * amount;\n }\n\n return -0.5 * (--amount * (amount - 2) - 1);\n },\n },\n ),\n\n Cubic: Object.freeze(\n <EasingFunctionGroup> {\n In(amount: number): number {\n return amount * amount * amount;\n },\n Out(amount: number): number {\n return --amount * amount * amount + 1;\n },\n InOut(amount: number): number {\n if ((amount *= 2) < 1) {\n return 0.5 * amount * amount * amount;\n }\n return 0.5 * ((amount -= 2) * amount * amount + 2);\n },\n },\n ),\n\n Quartic: Object.freeze(\n <EasingFunctionGroup> {\n In(amount: number): number {\n return amount * amount * amount * amount;\n },\n Out(amount: number): number {\n return 1 - --amount * amount * amount * amount;\n },\n InOut(amount: number): number {\n if ((amount *= 2) < 1) {\n return 0.5 * amount * amount * amount * amount;\n }\n\n return -0.5 * ((amount -= 2) * amount * amount * amount - 2);\n },\n },\n ),\n\n Quintic: Object.freeze(\n <EasingFunctionGroup> {\n In(amount: number): number {\n return amount * amount * amount * amount * amount;\n },\n Out(amount: number): number {\n return --amount * amount * amount * amount * amount + 1;\n },\n InOut(amount: number): number {\n if ((amount *= 2) < 1) {\n return 0.5 * amount * amount * amount * amount * amount;\n }\n\n return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);\n },\n },\n ),\n\n Sinusoidal: Object.freeze(\n <EasingFunctionGroup> {\n In(amount: number): number {\n return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2);\n },\n Out(amount: number): number {\n return Math.sin((amount * Math.PI) / 2);\n },\n InOut(amount: number): number {\n return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount)));\n },\n },\n ),\n\n Exponential: Object.freeze(\n <EasingFunctionGroup> {\n In(amount: number): number {\n return amount === 0 ? 0 : Math.pow(1024, amount - 1);\n },\n Out(amount: number): number {\n return amount === 1 ? 1 : 1 - Math.pow(2, -10 * amount);\n },\n InOut(amount: number): number {\n if (amount === 0) {\n return 0;\n }\n\n if (amount === 1) {\n return 1;\n }\n\n if ((amount *= 2) < 1) {\n return 0.5 * Math.pow(1024, amount - 1);\n }\n\n return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);\n },\n },\n ),\n\n Circular: Object.freeze(\n <EasingFunctionGroup> {\n In(amount: number): number {\n return 1 - Math.sqrt(1 - amount * amount);\n },\n Out(amount: number): number {\n return Math.sqrt(1 - --amount * amount);\n },\n InOut(amount: number): number {\n if ((amount *= 2) < 1) {\n return -0.5 * (Math.sqrt(1 - amount * amount) - 1);\n }\n return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);\n },\n },\n ),\n\n Elastic: Object.freeze(\n <EasingFunctionGroup> {\n In(amount: number): number {\n if (amount === 0) {\n return 0;\n }\n\n if (amount === 1) {\n return 1;\n }\n\n return (\n -Math.pow(2, 10 * (amount - 1)) *\n Math.sin((amount - 1.1) * 5 * Math.PI)\n );\n },\n Out(amount: number): number {\n if (amount === 0) {\n return 0;\n }\n\n if (amount === 1) {\n return 1;\n }\n return (\n Math.pow(2, -10 * amount) * Math.sin((amount - 0.1) * 5 * Math.PI) + 1\n );\n },\n InOut(amount: number): number {\n if (amount === 0) {\n return 0;\n }\n\n if (amount === 1) {\n return 1;\n }\n\n amount *= 2;\n\n if (amount < 1) {\n return (\n -0.5 *\n Math.pow(2, 10 * (amount - 1)) *\n Math.sin((amount - 1.1) * 5 * Math.PI)\n );\n }\n\n return (\n 0.5 *\n Math.pow(2, -10 * (amount - 1)) *\n Math.sin((amount - 1.1) * 5 * Math.PI) +\n 1\n );\n },\n },\n ),\n\n Back: Object.freeze(\n <EasingFunctionGroup> {\n In(amount: number): number {\n const s = 1.70158;\n return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s);\n },\n Out(amount: number): number {\n const s = 1.70158;\n return amount === 0\n ? 0\n : --amount * amount * ((s + 1) * amount + s) + 1;\n },\n InOut(amount: number): number {\n const s = 1.70158 * 1.525;\n if ((amount *= 2) < 1) {\n return 0.5 * (amount * amount * ((s + 1) * amount - s));\n }\n return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);\n },\n },\n ),\n\n Bounce: Object.freeze(\n <EasingFunctionGroup> {\n In(amount: number): number {\n return 1 - Easing.Bounce.Out(1 - amount);\n },\n Out(amount: number): number {\n if (amount < 1 / 2.75) {\n return 7.5625 * amount * amount;\n } else if (amount < 2 / 2.75) {\n return 7.5625 * (amount -= 1.5 / 2.75) * amount + 0.75;\n } else if (amount < 2.5 / 2.75) {\n return 7.5625 * (amount -= 2.25 / 2.75) * amount + 0.9375;\n } else {\n return 7.5625 * (amount -= 2.625 / 2.75) * amount + 0.984375;\n }\n },\n InOut(amount: number): number {\n if (amount < 0.5) {\n return Easing.Bounce.In(amount * 2) * 0.5;\n }\n return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;\n },\n },\n ),\n\n pow(power = 4): EasingFunctionGroup {\n power = power < Number.EPSILON ? Number.EPSILON : power;\n power = power > 10000 ? 10000 : power;\n return {\n In(amount: number): number {\n return amount ** power;\n },\n Out(amount: number): number {\n return 1 - (1 - amount) ** power;\n },\n InOut(amount: number): number {\n if (amount < 0.5) {\n return (amount * 2) ** power / 2;\n }\n return (1 - (2 - amount * 2) ** power) / 2 + 0.5;\n },\n };\n },\n});\n","// interpolators/array.ts\nimport { InterpolatorFunction } from \"../types.ts\";\n\nexport const interpolateArray: InterpolatorFunction<number[]> = <\n T extends number[],\n>(\n start: T,\n end: T,\n value: number,\n) => {\n if (value === 0 && start.length !== end.length) {\n console.warn(\"Array length mismatch. Returning first array.\");\n return start;\n }\n const result = [] as unknown as T;\n const len = end.length;\n let i = 0;\n\n while (i < len) {\n result.push(start[i] + (end[i] - start[i]) * value);\n i += 1;\n }\n return result;\n};\n","// interpolators/path.ts\nimport type {\n CubeValues,\n InterpolatorFunction,\n LineValues,\n MorphPathArray,\n MorphPathSegment,\n} from \"../types.ts\";\n\n/**\n * NOTE: Path interpolation only works when both paths have:\n * - Identical command structure (same number and order of M/L/C/Z)\n * - Corresponding coordinates to interpolate\n * Complex morphs (square → triangle) require preprocessing (e.g. KUTE.JS, Flubber)\n * @param start - A starting PathArray value\n * @param end - A starting PathArray value\n * @param t - The progress\n * @returns The interpolated PathArray value\n */\n\nexport const interpolatePath: InterpolatorFunction<MorphPathArray> = <\n T extends MorphPathArray,\n>(\n start: T,\n end: T,\n t: number,\n): T => {\n if (t === 0 && start.length !== end.length) {\n console.warn(\"Path length mismatch. Returning start path.\");\n return start;\n }\n const result = [] as unknown as T;\n\n for (let i = 0; i < end.length; i += 1) {\n const [pathCommand1, values1] = [\n start[i][0],\n start[i].slice(1) as LineValues | CubeValues,\n ];\n const [pathCommand2, values2] = [\n end[i][0],\n end[i].slice(1) as LineValues | CubeValues,\n ];\n const commandMismatch = pathCommand1 !== pathCommand2;\n\n if (t === 0 && (values1.length !== values2.length || commandMismatch)) {\n console.warn(\n (commandMismatch ? \"PathCommand\" : \"Params\") +\n \" mismatch at index: \" +\n i +\n \". Returning start path.\",\n );\n return start;\n }\n\n if (pathCommand1.toUpperCase() === \"Z\") {\n result.push([\"Z\"]);\n } else {\n const resValues = [] as unknown as CubeValues | LineValues;\n\n for (let j = 0; j < values2.length; j += 1) {\n resValues.push(values1[j] + (values2[j] - values1[j]) * t);\n }\n result.push([pathCommand2, ...resValues] as MorphPathSegment);\n }\n }\n\n return result;\n};\n"],"names":["_nowFunc","now","setNow","nowFunction","Queue","addToQueue","newItem","item","rafID","Runtime","removeFromQueue","removedItem","i","Tween","t","initialValues","time","overrideStart","startValues","endValues","seconds","easing","autoStart","elapsed","progress","callback","object","valuesStart","valuesEnd","value","endEntries","len","property","end","start","interpolator","obj","propsStart","propsEnd","overrideStartingValues","endKeys","startValue","interpolateFn","Timeline","initialState","duration","values","position","startTime","to","entryDuration","endTime","dif","count","pointer","name","cb","delta","entriesLen","entry","localTime","tweenElapsed","key","pos","labelTime","offset","Easing","amount","s","power","interpolateArray","result","interpolatePath","pathCommand1","values1","pathCommand2","values2","commandMismatch","resValues","j"],"mappings":"oCAAA,IAAIA,EAAW,IAAM,YAAY,IAAA,EAE1B,MAAMC,EAAM,IACVD,EAAA,EAGF,SAASE,EAAOC,EAA8B,CACnDH,EAAWG,CACb,CCAO,MAAMC,EAAyB,CAAA,EAE/B,SAASC,EACdC,EACM,CACN,MAAMC,EAAOD,EACTF,EAAM,SAASG,CAAI,IACvBH,EAAM,KAAKG,CAAI,EACVC,GAAOC,EAAA,EACd,CAEO,SAASC,EACdC,EACM,CACNP,EAAM,OACJA,EAAM,QAAQO,CAA8C,EAC5D,CAAA,CAEJ,CAEA,IAAIH,EAAQ,EAEL,SAASC,EAAQ,EAAIR,IAAO,CACjC,IAAIW,EAAI,EACR,KAAOA,EAAIR,EAAM,QACXA,EAAMQ,CAAC,EAAE,OAAO,CAAC,EACnBA,GAAK,EAELR,EAAM,OAAOQ,EAAG,CAAC,EAIjBR,EAAM,SAAW,GACnB,qBAAqBI,CAAK,EAC1BA,EAAQ,GACHA,EAAQ,sBAAsBC,CAAO,CAC9C,CC/BO,MAAMI,CAAoC,CACvC,mBAAqB,IACrB,OACA,YAAc,GACd,YAAc,GACd,YAA0B,CAAA,EAC1B,UAAwB,CAAA,EACxB,WAAa,GACb,UAAY,IACZ,OAAS,EACT,QAA2BC,GAAMA,EACjC,WAAqB,EACrB,UACA,YACA,SACA,QAER,YAAYC,EAAkB,CAC5B,YAAK,OAASA,EACP,IACT,CAEA,IAAI,WAAqB,CACvB,OAAO,KAAK,UACd,CAEA,MAAMC,EAAOf,IAAOgB,EAAgB,GAAO,CACzC,OAAI,KAAK,WAAmB,OAExB,CAAC,KAAK,aAAgBA,KACxB,KAAK,YAAc,GAEnB,KAAK,UACH,KAAK,OACL,KAAK,YACL,KAAK,UACLA,CAAA,GAGJ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AAE,MAAM,CAAC,CAAA,EAEZ,CAACyC,EAAcC,CAAO,EAAI,CAC9B3C,EAAI,CAAC,EAAE,CAAC,EACRA,EAAI,CAAC,EAAE,MAAM,CAAC,CAAA,EAEV4C,EAAkBJ,IAAiBE,EAEzC,GAAI7D,IAAM,IAAM4D,EAAQ,SAAWE,EAAQ,QAAUC,GACnD,eAAQ,MACLA,EAAkB,cAAgB,UACjC,uBACA,EACA,yBAAA,EAEG3C,EAGT,GAAIuC,EAAa,YAAA,IAAkB,IACjCF,EAAO,KAAK,CAAC,GAAG,CAAC,MACZ,CACL,MAAMO,EAAY,CAAA,EAElB,QAASC,EAAI,EAAGA,EAAIH,EAAQ,OAAQG,GAAK,EACvCD,EAAU,KAAKJ,EAAQK,CAAC,GAAKH,EAAQG,CAAC,EAAIL,EAAQK,CAAC,GAAKjE,CAAC,EAE3DyD,EAAO,KAAK,CAACI,EAAc,GAAGG,CAAS,CAAqB,CAC9D,CACF,CAEA,OAAOP,CACT"}
package/package.json ADDED
@@ -0,0 +1,96 @@
1
+ {
2
+ "name": "@thednp/tween",
3
+ "version": "0.0.1",
4
+ "description": "✨ A Typescript sourced tweening engine with Tween and Timeline",
5
+ "homepage": "https://github.com/thednp/tween",
6
+ "author": "thednp",
7
+ "license": "MIT",
8
+ "type": "module",
9
+ "browser": "./dist/index.iife.js",
10
+ "main": "./dist/index.cjs",
11
+ "module": "./dist/index.mjs",
12
+ "files": [
13
+ "wiki",
14
+ "dist",
15
+ "package.json",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "exports": {
20
+ ".": {
21
+ "require": "./dist/index.cjs",
22
+ "import": "./dist/index.mjs"
23
+ },
24
+ "./react": {
25
+ "require": "./dist/react.cjs",
26
+ "import": "./dist/react.mjs"
27
+ },
28
+ "./solid": {
29
+ "require": "./dist/solid.cjs",
30
+ "import": "./dist/solid.mjs"
31
+ },
32
+ "./package.json": "./package.json"
33
+ },
34
+ "bugs": {
35
+ "url": "https://github.com/thednp/tween/issues"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public",
39
+ "registry": "https://registry.npmjs.org/"
40
+ },
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/thednp/tween.git"
44
+ },
45
+ "keywords": [
46
+ "tween",
47
+ "timeline",
48
+ "cubic-bezier",
49
+ "cubic-tween",
50
+ "easing",
51
+ "ease",
52
+ "easing functions",
53
+ "animation engine",
54
+ "animation",
55
+ "animations",
56
+ "typescript"
57
+ ],
58
+ "devDependencies": {
59
+ "@testing-library/dom": "^10.4.1",
60
+ "@testing-library/react": "^16.3.1",
61
+ "@types/node": "^25.0.6",
62
+ "@vitest/coverage-istanbul": "^4.0.17",
63
+ "@vitest/ui": "^4.0.17",
64
+ "happy-dom": "^20.1.0",
65
+ "tsdown": "0.20.0-beta.1",
66
+ "typescript": "^5.9.3",
67
+ "vite": "^7.3.1",
68
+ "vite-plugin-strip-comments": "^0.0.6",
69
+ "vitest": "^4.0.17"
70
+ },
71
+ "packageManager": "pnpm@8.6.12",
72
+ "engines": {
73
+ "node": ">=20",
74
+ "pnpm": ">=8.6.0"
75
+ },
76
+ "dependencies": {
77
+ "@types/react": "^19.2.8",
78
+ "react": "^19.2.3",
79
+ "solid-js": "^1.9.10"
80
+ },
81
+ "types": "./dist/index.d.cts",
82
+ "scripts": {
83
+ "pre-test": "pnpm clean-coverage",
84
+ "clean-coverage": "rm -rf coverage .nyc_output",
85
+ "test": "pnpm pre-test && vitest",
86
+ "test-ui": "pnpm pre-test && vitest --ui",
87
+ "badges": "npx -p dependency-version-badge update-badge typescript vitest vite",
88
+ "format": "deno fmt src",
89
+ "lint": "pnpm lint:ts && pnpm lint:types",
90
+ "lint:ts": "deno lint src",
91
+ "lint:types": "tsc --noEmit",
92
+ "fix:ts": "deno lint src --fix",
93
+ "build_": "vite build",
94
+ "build": "tsdown && vite build"
95
+ }
96
+ }
package/wiki/Easing.md ADDED
@@ -0,0 +1,58 @@
1
+ ## Easing
2
+
3
+ ### Available `Easing` functions
4
+
5
+ There are a few existing easing functions provided with *@thednp/tween*. They are grouped by the type of equation they represent: Linear, Quadratic, Cubic, Quartic, Quintic, Sinusoidal, Exponential, Circular, Elastic, Back and Bounce, and then by the easing type: In, Out and InOut.
6
+
7
+ Here's a complete list:
8
+
9
+ * `Easing.Linear.None` (default)
10
+ * `Easing.Quadratic.In` / `Easing.Quadratic.Out` / `Easing.Quadratic.InOut`
11
+ * `Easing.Cubic.In` / `Easing.Cubic.Out` / `Easing.Cubic.InOut`
12
+ * `Easing.Quartic.In` / `Easing.Quartic.Out` / `Easing.Quartic.InOut`
13
+ * `Easing.Quintic.In` / `Easing.Quintic.Out` / `Easing.Quintic.InOut`
14
+ * `Easing.Sinusoidal.In` / `Easing.Sinusoidal.Out` / `Easing.Sinusoidal.InOut`
15
+ * `Easing.Exponential.In` / `Easing.Exponential.Out` / `Easing.Exponential.InOut`
16
+ * `Easing.Circular.In` / `Easing.Circular.Out` / `Easing.Circular.InOut`
17
+ * `Easing.Elastic.In` / `Easing.Elastic.Out` / `Easing.Elastic.InOut`
18
+ * `Easing.Back.In` / `Easing.Back.Out` / `Easing.Back.InOut`
19
+ * `Easing.Bounce.In` / `Easing.Bounce.Out` / `Easing.Bounce.InOut`
20
+ * `Easing.pow` - allows for creation of custom easing functions
21
+
22
+ Probably the names won't be saying anything to you unless you're familiar with these concepts already, so it is probably the time to check the [Graphs](https://github.com/tweenjs/tween.js/blob/main/examples/03_graphs.html) example, which graphs all the curves in one page so you can compare how they look at a glance.
23
+
24
+ `Easing` also has a function called `pow()`. This function generates easing functions for different curves depending on arguments. You can check the relevance of the arguments to curves in the [example of pow easing](https://github.com/tweenjs/tween.js/blob/main/examples/17_generate_pow.html) page.
25
+
26
+ _Credit where credit is due:_ these functions are derived from the original set of equations that Robert Penner graciously made available as free software a few years ago, but have been optimised to play nicely with JavaScript.
27
+
28
+
29
+
30
+ ### Using a custom easing function
31
+
32
+ Not only can you use any of the existing functions, but you can also provide your own, as long as it follows a couple of conventions:
33
+
34
+ - it must accept one parameter:
35
+ - `k`: the easing progress, or how far along the duration of the tween we are. Allowed values are in the range [0, 1].
36
+ - it must return a value based on the input parameters.
37
+
38
+ The easing function is only called _once per tween_ on each update, no matter how many properties are to be changed. The result is then used with the initial value and the difference (the _deltas_) between this and the final values, as in this pseudocode:
39
+
40
+ For the performance-obsessed people out there: the deltas are calculated only when `start()` is called on a tween.
41
+
42
+ So let's suppose you wanted to use a custom easing function that eased the values but applied a Math.floor to the output, so only the integer part would be returned, resulting in a sort of step-ladder output:
43
+
44
+ ```ts
45
+ function tenStepEasing(k: number) {
46
+ return Math.floor(k * 10) / 10
47
+ }
48
+ ```
49
+
50
+ And you could use it in a tween by simply calling its easing method, as we've seen before:
51
+
52
+ ```ts
53
+ tween.easing(tenStepEasing)
54
+ ```
55
+
56
+ ### External Easing Library
57
+
58
+ Other easing functions can be created and used, see [BezierEasing](https://github.com/thednp/bezier-easing).