@plastic-js/tsumiki 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/components/DatePickerMobile/index.js +3 -1
  2. package/dist/components/DatePickerMobile/index.js.map +1 -1
  3. package/dist/components/DatePickerMobile/wheel.js +28 -14
  4. package/dist/components/DatePickerMobile/wheel.js.map +1 -1
  5. package/dist/node_modules/framesync/dist/es/create-render-step.js +54 -0
  6. package/dist/node_modules/framesync/dist/es/create-render-step.js.map +1 -0
  7. package/dist/node_modules/framesync/dist/es/index.js +61 -0
  8. package/dist/node_modules/framesync/dist/es/index.js.map +1 -0
  9. package/dist/node_modules/framesync/dist/es/on-next-frame.js +8 -0
  10. package/dist/node_modules/framesync/dist/es/on-next-frame.js.map +1 -0
  11. package/dist/node_modules/hey-listen/dist/hey-listen.es.js +15 -0
  12. package/dist/node_modules/hey-listen/dist/hey-listen.es.js.map +1 -0
  13. package/dist/node_modules/popmotion/dist/es/animations/generators/decay.js +24 -0
  14. package/dist/node_modules/popmotion/dist/es/animations/generators/decay.js.map +1 -0
  15. package/dist/node_modules/popmotion/dist/es/animations/generators/keyframes.js +40 -0
  16. package/dist/node_modules/popmotion/dist/es/animations/generators/keyframes.js.map +1 -0
  17. package/dist/node_modules/popmotion/dist/es/animations/generators/spring.js +96 -0
  18. package/dist/node_modules/popmotion/dist/es/animations/generators/spring.js.map +1 -0
  19. package/dist/node_modules/popmotion/dist/es/animations/index.js +94 -0
  20. package/dist/node_modules/popmotion/dist/es/animations/index.js.map +1 -0
  21. package/dist/node_modules/popmotion/dist/es/animations/inertia.js +74 -0
  22. package/dist/node_modules/popmotion/dist/es/animations/inertia.js.map +1 -0
  23. package/dist/node_modules/popmotion/dist/es/animations/utils/detect-animation-from-options.js +21 -0
  24. package/dist/node_modules/popmotion/dist/es/animations/utils/detect-animation-from-options.js.map +1 -0
  25. package/dist/node_modules/popmotion/dist/es/animations/utils/elapsed.js +14 -0
  26. package/dist/node_modules/popmotion/dist/es/animations/utils/elapsed.js.map +1 -0
  27. package/dist/node_modules/popmotion/dist/es/animations/utils/find-spring.js +68 -0
  28. package/dist/node_modules/popmotion/dist/es/animations/utils/find-spring.js.map +1 -0
  29. package/dist/node_modules/popmotion/dist/es/easing/index.js +28 -0
  30. package/dist/node_modules/popmotion/dist/es/easing/index.js.map +1 -0
  31. package/dist/node_modules/popmotion/dist/es/easing/utils.js +13 -0
  32. package/dist/node_modules/popmotion/dist/es/easing/utils.js.map +1 -0
  33. package/dist/node_modules/popmotion/dist/es/utils/clamp.js +6 -0
  34. package/dist/node_modules/popmotion/dist/es/utils/clamp.js.map +1 -0
  35. package/dist/node_modules/popmotion/dist/es/utils/hsla-to-rgba.js +35 -0
  36. package/dist/node_modules/popmotion/dist/es/utils/hsla-to-rgba.js.map +1 -0
  37. package/dist/node_modules/popmotion/dist/es/utils/inc.js +6 -0
  38. package/dist/node_modules/popmotion/dist/es/utils/inc.js.map +1 -0
  39. package/dist/node_modules/popmotion/dist/es/utils/interpolate.js +69 -0
  40. package/dist/node_modules/popmotion/dist/es/utils/interpolate.js.map +1 -0
  41. package/dist/node_modules/popmotion/dist/es/utils/mix-color.js +45 -0
  42. package/dist/node_modules/popmotion/dist/es/utils/mix-color.js.map +1 -0
  43. package/dist/node_modules/popmotion/dist/es/utils/mix-complex.js +61 -0
  44. package/dist/node_modules/popmotion/dist/es/utils/mix-complex.js.map +1 -0
  45. package/dist/node_modules/popmotion/dist/es/utils/mix.js +6 -0
  46. package/dist/node_modules/popmotion/dist/es/utils/mix.js.map +1 -0
  47. package/dist/node_modules/popmotion/dist/es/utils/pipe.js +7 -0
  48. package/dist/node_modules/popmotion/dist/es/utils/pipe.js.map +1 -0
  49. package/dist/node_modules/popmotion/dist/es/utils/progress.js +9 -0
  50. package/dist/node_modules/popmotion/dist/es/utils/progress.js.map +1 -0
  51. package/dist/node_modules/popmotion/dist/es/utils/velocity-per-second.js +8 -0
  52. package/dist/node_modules/popmotion/dist/es/utils/velocity-per-second.js.map +1 -0
  53. package/dist/node_modules/popmotion/node_modules/tslib/tslib.es6.js +13 -0
  54. package/dist/node_modules/popmotion/node_modules/tslib/tslib.es6.js.map +1 -0
  55. package/dist/node_modules/style-value-types/dist/es/color/hex.js +39 -0
  56. package/dist/node_modules/style-value-types/dist/es/color/hex.js.map +1 -0
  57. package/dist/node_modules/style-value-types/dist/es/color/hsla.js +16 -0
  58. package/dist/node_modules/style-value-types/dist/es/color/hsla.js.map +1 -0
  59. package/dist/node_modules/style-value-types/dist/es/color/index.js +20 -0
  60. package/dist/node_modules/style-value-types/dist/es/color/index.js.map +1 -0
  61. package/dist/node_modules/style-value-types/dist/es/color/rgba.js +15 -0
  62. package/dist/node_modules/style-value-types/dist/es/color/rgba.js.map +1 -0
  63. package/dist/node_modules/style-value-types/dist/es/color/utils.js +19 -0
  64. package/dist/node_modules/style-value-types/dist/es/color/utils.js.map +1 -0
  65. package/dist/node_modules/style-value-types/dist/es/complex/index.js +58 -0
  66. package/dist/node_modules/style-value-types/dist/es/complex/index.js.map +1 -0
  67. package/dist/node_modules/style-value-types/dist/es/numbers/index.js +13 -0
  68. package/dist/node_modules/style-value-types/dist/es/numbers/index.js.map +1 -0
  69. package/dist/node_modules/style-value-types/dist/es/numbers/units.js +16 -0
  70. package/dist/node_modules/style-value-types/dist/es/numbers/units.js.map +1 -0
  71. package/dist/node_modules/style-value-types/dist/es/utils.js +13 -0
  72. package/dist/node_modules/style-value-types/dist/es/utils.js.map +1 -0
  73. package/package.json +3 -2
@@ -0,0 +1,96 @@
1
+ import { __rest } from "../../../../node_modules/tslib/tslib.es6.js";
2
+ import { calcAngularFreq, findSpring } from "../utils/find-spring.js";
3
+ //#region node_modules/popmotion/dist/es/animations/generators/spring.mjs
4
+ var durationKeys = ["duration", "bounce"];
5
+ var physicsKeys = [
6
+ "stiffness",
7
+ "damping",
8
+ "mass"
9
+ ];
10
+ function isSpringType(options, keys) {
11
+ return keys.some((key) => options[key] !== void 0);
12
+ }
13
+ function getSpringOptions(options) {
14
+ let springOptions = Object.assign({
15
+ velocity: 0,
16
+ stiffness: 100,
17
+ damping: 10,
18
+ mass: 1,
19
+ isResolvedFromDuration: false
20
+ }, options);
21
+ if (!isSpringType(options, physicsKeys) && isSpringType(options, durationKeys)) {
22
+ const derived = findSpring(options);
23
+ springOptions = Object.assign(Object.assign(Object.assign({}, springOptions), derived), {
24
+ velocity: 0,
25
+ mass: 1
26
+ });
27
+ springOptions.isResolvedFromDuration = true;
28
+ }
29
+ return springOptions;
30
+ }
31
+ function spring(_a) {
32
+ var { from = 0, to = 1, restSpeed = 2, restDelta } = _a, options = __rest(_a, [
33
+ "from",
34
+ "to",
35
+ "restSpeed",
36
+ "restDelta"
37
+ ]);
38
+ const state = {
39
+ done: false,
40
+ value: from
41
+ };
42
+ let { stiffness, damping, mass, velocity, duration, isResolvedFromDuration } = getSpringOptions(options);
43
+ let resolveSpring = zero;
44
+ let resolveVelocity = zero;
45
+ function createSpring() {
46
+ const initialVelocity = velocity ? -(velocity / 1e3) : 0;
47
+ const initialDelta = to - from;
48
+ const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
49
+ const undampedAngularFreq = Math.sqrt(stiffness / mass) / 1e3;
50
+ if (restDelta === void 0) restDelta = Math.min(Math.abs(to - from) / 100, .4);
51
+ if (dampingRatio < 1) {
52
+ const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
53
+ resolveSpring = (t) => {
54
+ const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
55
+ return to - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq * Math.sin(angularFreq * t) + initialDelta * Math.cos(angularFreq * t));
56
+ };
57
+ resolveVelocity = (t) => {
58
+ const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
59
+ return dampingRatio * undampedAngularFreq * envelope * (Math.sin(angularFreq * t) * (initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq + initialDelta * Math.cos(angularFreq * t)) - envelope * (Math.cos(angularFreq * t) * (initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) - angularFreq * initialDelta * Math.sin(angularFreq * t));
60
+ };
61
+ } else if (dampingRatio === 1) resolveSpring = (t) => to - Math.exp(-undampedAngularFreq * t) * (initialDelta + (initialVelocity + undampedAngularFreq * initialDelta) * t);
62
+ else {
63
+ const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
64
+ resolveSpring = (t) => {
65
+ const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
66
+ const freqForT = Math.min(dampedAngularFreq * t, 300);
67
+ return to - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) * Math.sinh(freqForT) + dampedAngularFreq * initialDelta * Math.cosh(freqForT)) / dampedAngularFreq;
68
+ };
69
+ }
70
+ }
71
+ createSpring();
72
+ return {
73
+ next: (t) => {
74
+ const current = resolveSpring(t);
75
+ if (!isResolvedFromDuration) {
76
+ const currentVelocity = resolveVelocity(t) * 1e3;
77
+ const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
78
+ const isBelowDisplacementThreshold = Math.abs(to - current) <= restDelta;
79
+ state.done = isBelowVelocityThreshold && isBelowDisplacementThreshold;
80
+ } else state.done = t >= duration;
81
+ state.value = state.done ? to : current;
82
+ return state;
83
+ },
84
+ flipTarget: () => {
85
+ velocity = -velocity;
86
+ [from, to] = [to, from];
87
+ createSpring();
88
+ }
89
+ };
90
+ }
91
+ spring.needsInterpolation = (a, b) => typeof a === "string" || typeof b === "string";
92
+ var zero = (_t) => 0;
93
+ //#endregion
94
+ export { spring };
95
+
96
+ //# sourceMappingURL=spring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spring.js","names":[],"sources":["../../../../../../../node_modules/popmotion/dist/es/animations/generators/spring.mjs"],"sourcesContent":["import { __rest } from 'tslib';\nimport { findSpring, calcAngularFreq } from '../utils/find-spring.mjs';\n\nconst durationKeys = [\"duration\", \"bounce\"];\nconst physicsKeys = [\"stiffness\", \"damping\", \"mass\"];\nfunction isSpringType(options, keys) {\n return keys.some((key) => options[key] !== undefined);\n}\nfunction getSpringOptions(options) {\n let springOptions = Object.assign({ velocity: 0.0, stiffness: 100, damping: 10, mass: 1.0, isResolvedFromDuration: false }, options);\n if (!isSpringType(options, physicsKeys) &&\n isSpringType(options, durationKeys)) {\n const derived = findSpring(options);\n springOptions = Object.assign(Object.assign(Object.assign({}, springOptions), derived), { velocity: 0.0, mass: 1.0 });\n springOptions.isResolvedFromDuration = true;\n }\n return springOptions;\n}\nfunction spring(_a) {\n var { from = 0.0, to = 1.0, restSpeed = 2, restDelta } = _a, options = __rest(_a, [\"from\", \"to\", \"restSpeed\", \"restDelta\"]);\n const state = { done: false, value: from };\n let { stiffness, damping, mass, velocity, duration, isResolvedFromDuration, } = getSpringOptions(options);\n let resolveSpring = zero;\n let resolveVelocity = zero;\n function createSpring() {\n const initialVelocity = velocity ? -(velocity / 1000) : 0.0;\n const initialDelta = to - from;\n const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));\n const undampedAngularFreq = Math.sqrt(stiffness / mass) / 1000;\n if (restDelta === undefined) {\n restDelta = Math.min(Math.abs(to - from) / 100, 0.4);\n }\n if (dampingRatio < 1) {\n const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);\n resolveSpring = (t) => {\n const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);\n return (to -\n envelope *\n (((initialVelocity +\n dampingRatio * undampedAngularFreq * initialDelta) /\n angularFreq) *\n Math.sin(angularFreq * t) +\n initialDelta * Math.cos(angularFreq * t)));\n };\n resolveVelocity = (t) => {\n const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);\n return (dampingRatio *\n undampedAngularFreq *\n envelope *\n ((Math.sin(angularFreq * t) *\n (initialVelocity +\n dampingRatio *\n undampedAngularFreq *\n initialDelta)) /\n angularFreq +\n initialDelta * Math.cos(angularFreq * t)) -\n envelope *\n (Math.cos(angularFreq * t) *\n (initialVelocity +\n dampingRatio *\n undampedAngularFreq *\n initialDelta) -\n angularFreq *\n initialDelta *\n Math.sin(angularFreq * t)));\n };\n }\n else if (dampingRatio === 1) {\n resolveSpring = (t) => to -\n Math.exp(-undampedAngularFreq * t) *\n (initialDelta +\n (initialVelocity + undampedAngularFreq * initialDelta) *\n t);\n }\n else {\n const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);\n resolveSpring = (t) => {\n const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);\n const freqForT = Math.min(dampedAngularFreq * t, 300);\n return (to -\n (envelope *\n ((initialVelocity +\n dampingRatio * undampedAngularFreq * initialDelta) *\n Math.sinh(freqForT) +\n dampedAngularFreq *\n initialDelta *\n Math.cosh(freqForT))) /\n dampedAngularFreq);\n };\n }\n }\n createSpring();\n return {\n next: (t) => {\n const current = resolveSpring(t);\n if (!isResolvedFromDuration) {\n const currentVelocity = resolveVelocity(t) * 1000;\n const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;\n const isBelowDisplacementThreshold = Math.abs(to - current) <= restDelta;\n state.done =\n isBelowVelocityThreshold && isBelowDisplacementThreshold;\n }\n else {\n state.done = t >= duration;\n }\n state.value = state.done ? to : current;\n return state;\n },\n flipTarget: () => {\n velocity = -velocity;\n [from, to] = [to, from];\n createSpring();\n },\n };\n}\nspring.needsInterpolation = (a, b) => typeof a === \"string\" || typeof b === \"string\";\nconst zero = (_t) => 0;\n\nexport { spring };\n"],"x_google_ignoreList":[0],"mappings":"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"}
@@ -0,0 +1,94 @@
1
+ import { __rest } from "../../../node_modules/tslib/tslib.es6.js";
2
+ import { interpolate } from "../utils/interpolate.js";
3
+ import { detectAnimationFromOptions } from "./utils/detect-animation-from-options.js";
4
+ import sync, { cancelSync } from "../../../../framesync/dist/es/index.js";
5
+ import { hasRepeatDelayElapsed, loopElapsed, reverseElapsed } from "./utils/elapsed.js";
6
+ //#region node_modules/popmotion/dist/es/animations/index.mjs
7
+ var framesync = (update) => {
8
+ const passTimestamp = ({ delta }) => update(delta);
9
+ return {
10
+ start: () => sync.update(passTimestamp, true),
11
+ stop: () => cancelSync.update(passTimestamp)
12
+ };
13
+ };
14
+ function animate(_a) {
15
+ var _b, _c;
16
+ var { from, autoplay = true, driver = framesync, elapsed = 0, repeat: repeatMax = 0, repeatType = "loop", repeatDelay = 0, onPlay, onStop, onComplete, onRepeat, onUpdate } = _a, options = __rest(_a, [
17
+ "from",
18
+ "autoplay",
19
+ "driver",
20
+ "elapsed",
21
+ "repeat",
22
+ "repeatType",
23
+ "repeatDelay",
24
+ "onPlay",
25
+ "onStop",
26
+ "onComplete",
27
+ "onRepeat",
28
+ "onUpdate"
29
+ ]);
30
+ let { to } = options;
31
+ let driverControls;
32
+ let repeatCount = 0;
33
+ let computedDuration = options.duration;
34
+ let latest;
35
+ let isComplete = false;
36
+ let isForwardPlayback = true;
37
+ let interpolateFromNumber;
38
+ const animator = detectAnimationFromOptions(options);
39
+ if ((_c = (_b = animator).needsInterpolation) === null || _c === void 0 ? void 0 : _c.call(_b, from, to)) {
40
+ interpolateFromNumber = interpolate([0, 100], [from, to], { clamp: false });
41
+ from = 0;
42
+ to = 100;
43
+ }
44
+ const animation = animator(Object.assign(Object.assign({}, options), {
45
+ from,
46
+ to
47
+ }));
48
+ function repeat() {
49
+ repeatCount++;
50
+ if (repeatType === "reverse") {
51
+ isForwardPlayback = repeatCount % 2 === 0;
52
+ elapsed = reverseElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback);
53
+ } else {
54
+ elapsed = loopElapsed(elapsed, computedDuration, repeatDelay);
55
+ if (repeatType === "mirror") animation.flipTarget();
56
+ }
57
+ isComplete = false;
58
+ onRepeat && onRepeat();
59
+ }
60
+ function complete() {
61
+ driverControls.stop();
62
+ onComplete && onComplete();
63
+ }
64
+ function update(delta) {
65
+ if (!isForwardPlayback) delta = -delta;
66
+ elapsed += delta;
67
+ if (!isComplete) {
68
+ const state = animation.next(Math.max(0, elapsed));
69
+ latest = state.value;
70
+ if (interpolateFromNumber) latest = interpolateFromNumber(latest);
71
+ isComplete = isForwardPlayback ? state.done : elapsed <= 0;
72
+ }
73
+ onUpdate === null || onUpdate === void 0 || onUpdate(latest);
74
+ if (isComplete) {
75
+ if (repeatCount === 0) computedDuration !== null && computedDuration !== void 0 || (computedDuration = elapsed);
76
+ if (repeatCount < repeatMax) hasRepeatDelayElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback) && repeat();
77
+ else complete();
78
+ }
79
+ }
80
+ function play() {
81
+ onPlay === null || onPlay === void 0 || onPlay();
82
+ driverControls = driver(update);
83
+ driverControls.start();
84
+ }
85
+ autoplay && play();
86
+ return { stop: () => {
87
+ onStop === null || onStop === void 0 || onStop();
88
+ driverControls.stop();
89
+ } };
90
+ }
91
+ //#endregion
92
+ export { animate };
93
+
94
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../../node_modules/popmotion/dist/es/animations/index.mjs"],"sourcesContent":["import { __rest } from 'tslib';\nimport { detectAnimationFromOptions } from './utils/detect-animation-from-options.mjs';\nimport sync, { cancelSync } from 'framesync';\nimport { interpolate } from '../utils/interpolate.mjs';\nimport { hasRepeatDelayElapsed, reverseElapsed, loopElapsed } from './utils/elapsed.mjs';\n\nconst framesync = (update) => {\n const passTimestamp = ({ delta }) => update(delta);\n return {\n start: () => sync.update(passTimestamp, true),\n stop: () => cancelSync.update(passTimestamp),\n };\n};\nfunction animate(_a) {\n var _b, _c;\n var { from, autoplay = true, driver = framesync, elapsed = 0, repeat: repeatMax = 0, repeatType = \"loop\", repeatDelay = 0, onPlay, onStop, onComplete, onRepeat, onUpdate } = _a, options = __rest(_a, [\"from\", \"autoplay\", \"driver\", \"elapsed\", \"repeat\", \"repeatType\", \"repeatDelay\", \"onPlay\", \"onStop\", \"onComplete\", \"onRepeat\", \"onUpdate\"]);\n let { to } = options;\n let driverControls;\n let repeatCount = 0;\n let computedDuration = options.duration;\n let latest;\n let isComplete = false;\n let isForwardPlayback = true;\n let interpolateFromNumber;\n const animator = detectAnimationFromOptions(options);\n if ((_c = (_b = animator).needsInterpolation) === null || _c === void 0 ? void 0 : _c.call(_b, from, to)) {\n interpolateFromNumber = interpolate([0, 100], [from, to], {\n clamp: false,\n });\n from = 0;\n to = 100;\n }\n const animation = animator(Object.assign(Object.assign({}, options), { from, to }));\n function repeat() {\n repeatCount++;\n if (repeatType === \"reverse\") {\n isForwardPlayback = repeatCount % 2 === 0;\n elapsed = reverseElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback);\n }\n else {\n elapsed = loopElapsed(elapsed, computedDuration, repeatDelay);\n if (repeatType === \"mirror\")\n animation.flipTarget();\n }\n isComplete = false;\n onRepeat && onRepeat();\n }\n function complete() {\n driverControls.stop();\n onComplete && onComplete();\n }\n function update(delta) {\n if (!isForwardPlayback)\n delta = -delta;\n elapsed += delta;\n if (!isComplete) {\n const state = animation.next(Math.max(0, elapsed));\n latest = state.value;\n if (interpolateFromNumber)\n latest = interpolateFromNumber(latest);\n isComplete = isForwardPlayback ? state.done : elapsed <= 0;\n }\n onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(latest);\n if (isComplete) {\n if (repeatCount === 0)\n computedDuration !== null && computedDuration !== void 0 ? computedDuration : (computedDuration = elapsed);\n if (repeatCount < repeatMax) {\n hasRepeatDelayElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback) && repeat();\n }\n else {\n complete();\n }\n }\n }\n function play() {\n onPlay === null || onPlay === void 0 ? void 0 : onPlay();\n driverControls = driver(update);\n driverControls.start();\n }\n autoplay && play();\n return {\n stop: () => {\n onStop === null || onStop === void 0 ? void 0 : onStop();\n driverControls.stop();\n },\n };\n}\n\nexport { animate };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;AAMA,IAAM,aAAa,WAAW;CAC1B,MAAM,iBAAiB,EAAE,YAAY,OAAO,KAAK;CACjD,OAAO;EACH,aAAa,KAAK,OAAO,eAAe,IAAI;EAC5C,YAAY,WAAW,OAAO,aAAa;CAC/C;AACJ;AACA,SAAS,QAAQ,IAAI;CACjB,IAAI,IAAI;CACR,IAAI,EAAE,MAAM,WAAW,MAAM,SAAS,WAAW,UAAU,GAAG,QAAQ,YAAY,GAAG,aAAa,QAAQ,cAAc,GAAG,QAAQ,QAAQ,YAAY,UAAU,aAAa,IAAI,UAAU,OAAO,IAAI;EAAC;EAAQ;EAAY;EAAU;EAAW;EAAU;EAAc;EAAe;EAAU;EAAU;EAAc;EAAY;CAAU,CAAC;CACjV,IAAI,EAAE,OAAO;CACb,IAAI;CACJ,IAAI,cAAc;CAClB,IAAI,mBAAmB,QAAQ;CAC/B,IAAI;CACJ,IAAI,aAAa;CACjB,IAAI,oBAAoB;CACxB,IAAI;CACJ,MAAM,WAAW,2BAA2B,OAAO;CACnD,KAAK,MAAM,KAAK,UAAU,wBAAwB,QAAQ,OAAO,KAAK,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,MAAM,EAAE,GAAG;EACtG,wBAAwB,YAAY,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,EACtD,OAAO,MACX,CAAC;EACD,OAAO;EACP,KAAK;CACT;CACA,MAAM,YAAY,SAAS,OAAO,OAAO,OAAO,OAAO,CAAC,GAAG,OAAO,GAAG;EAAE;EAAM;CAAG,CAAC,CAAC;CAClF,SAAS,SAAS;EACd;EACA,IAAI,eAAe,WAAW;GAC1B,oBAAoB,cAAc,MAAM;GACxC,UAAU,eAAe,SAAS,kBAAkB,aAAa,iBAAiB;EACtF,OACK;GACD,UAAU,YAAY,SAAS,kBAAkB,WAAW;GAC5D,IAAI,eAAe,UACf,UAAU,WAAW;EAC7B;EACA,aAAa;EACb,YAAY,SAAS;CACzB;CACA,SAAS,WAAW;EAChB,eAAe,KAAK;EACpB,cAAc,WAAW;CAC7B;CACA,SAAS,OAAO,OAAO;EACnB,IAAI,CAAC,mBACD,QAAQ,CAAC;EACb,WAAW;EACX,IAAI,CAAC,YAAY;GACb,MAAM,QAAQ,UAAU,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC;GACjD,SAAS,MAAM;GACf,IAAI,uBACA,SAAS,sBAAsB,MAAM;GACzC,aAAa,oBAAoB,MAAM,OAAO,WAAW;EAC7D;EACA,aAAa,QAAQ,aAAa,KAAK,KAAa,SAAS,MAAM;EACnE,IAAI,YAAY;GACZ,IAAI,gBAAgB,GAChB,qBAAqB,QAAQ,qBAAqB,KAAK,MAAwB,mBAAmB;GACtG,IAAI,cAAc,WACd,sBAAsB,SAAS,kBAAkB,aAAa,iBAAiB,KAAK,OAAO;QAG3F,SAAS;EAEjB;CACJ;CACA,SAAS,OAAO;EACZ,WAAW,QAAQ,WAAW,KAAK,KAAa,OAAO;EACvD,iBAAiB,OAAO,MAAM;EAC9B,eAAe,MAAM;CACzB;CACA,YAAY,KAAK;CACjB,OAAO,EACH,YAAY;EACR,WAAW,QAAQ,WAAW,KAAK,KAAa,OAAO;EACvD,eAAe,KAAK;CACxB,EACJ;AACJ"}
@@ -0,0 +1,74 @@
1
+ import { getFrameData } from "../../../../framesync/dist/es/index.js";
2
+ import { animate } from "./index.js";
3
+ import { velocityPerSecond } from "../utils/velocity-per-second.js";
4
+ //#region node_modules/popmotion/dist/es/animations/inertia.mjs
5
+ function inertia({ from = 0, velocity = 0, min, max, power = .8, timeConstant = 750, bounceStiffness = 500, bounceDamping = 10, restDelta = 1, modifyTarget, driver, onUpdate, onComplete, onStop }) {
6
+ let currentAnimation;
7
+ function isOutOfBounds(v) {
8
+ return min !== void 0 && v < min || max !== void 0 && v > max;
9
+ }
10
+ function boundaryNearest(v) {
11
+ if (min === void 0) return max;
12
+ if (max === void 0) return min;
13
+ return Math.abs(min - v) < Math.abs(max - v) ? min : max;
14
+ }
15
+ function startAnimation(options) {
16
+ currentAnimation === null || currentAnimation === void 0 || currentAnimation.stop();
17
+ currentAnimation = animate(Object.assign(Object.assign({}, options), {
18
+ driver,
19
+ onUpdate: (v) => {
20
+ var _a;
21
+ onUpdate === null || onUpdate === void 0 || onUpdate(v);
22
+ (_a = options.onUpdate) === null || _a === void 0 || _a.call(options, v);
23
+ },
24
+ onComplete,
25
+ onStop
26
+ }));
27
+ }
28
+ function startSpring(options) {
29
+ startAnimation(Object.assign({
30
+ type: "spring",
31
+ stiffness: bounceStiffness,
32
+ damping: bounceDamping,
33
+ restDelta
34
+ }, options));
35
+ }
36
+ if (isOutOfBounds(from)) startSpring({
37
+ from,
38
+ velocity,
39
+ to: boundaryNearest(from)
40
+ });
41
+ else {
42
+ let target = power * velocity + from;
43
+ if (typeof modifyTarget !== "undefined") target = modifyTarget(target);
44
+ const boundary = boundaryNearest(target);
45
+ const heading = boundary === min ? -1 : 1;
46
+ let prev;
47
+ let current;
48
+ const checkBoundary = (v) => {
49
+ prev = current;
50
+ current = v;
51
+ velocity = velocityPerSecond(v - prev, getFrameData().delta);
52
+ if (heading === 1 && v > boundary || heading === -1 && v < boundary) startSpring({
53
+ from: v,
54
+ to: boundary,
55
+ velocity
56
+ });
57
+ };
58
+ startAnimation({
59
+ type: "decay",
60
+ from,
61
+ velocity,
62
+ timeConstant,
63
+ power,
64
+ restDelta,
65
+ modifyTarget,
66
+ onUpdate: isOutOfBounds(target) ? checkBoundary : void 0
67
+ });
68
+ }
69
+ return { stop: () => currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.stop() };
70
+ }
71
+ //#endregion
72
+ export { inertia };
73
+
74
+ //# sourceMappingURL=inertia.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inertia.js","names":[],"sources":["../../../../../../node_modules/popmotion/dist/es/animations/inertia.mjs"],"sourcesContent":["import { animate } from './index.mjs';\nimport { velocityPerSecond } from '../utils/velocity-per-second.mjs';\nimport { getFrameData } from 'framesync';\n\nfunction inertia({ from = 0, velocity = 0, min, max, power = 0.8, timeConstant = 750, bounceStiffness = 500, bounceDamping = 10, restDelta = 1, modifyTarget, driver, onUpdate, onComplete, onStop, }) {\n let currentAnimation;\n function isOutOfBounds(v) {\n return (min !== undefined && v < min) || (max !== undefined && v > max);\n }\n function boundaryNearest(v) {\n if (min === undefined)\n return max;\n if (max === undefined)\n return min;\n return Math.abs(min - v) < Math.abs(max - v) ? min : max;\n }\n function startAnimation(options) {\n currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.stop();\n currentAnimation = animate(Object.assign(Object.assign({}, options), { driver, onUpdate: (v) => {\n var _a;\n onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(v);\n (_a = options.onUpdate) === null || _a === void 0 ? void 0 : _a.call(options, v);\n }, onComplete,\n onStop }));\n }\n function startSpring(options) {\n startAnimation(Object.assign({ type: \"spring\", stiffness: bounceStiffness, damping: bounceDamping, restDelta }, options));\n }\n if (isOutOfBounds(from)) {\n startSpring({ from, velocity, to: boundaryNearest(from) });\n }\n else {\n let target = power * velocity + from;\n if (typeof modifyTarget !== \"undefined\")\n target = modifyTarget(target);\n const boundary = boundaryNearest(target);\n const heading = boundary === min ? -1 : 1;\n let prev;\n let current;\n const checkBoundary = (v) => {\n prev = current;\n current = v;\n velocity = velocityPerSecond(v - prev, getFrameData().delta);\n if ((heading === 1 && v > boundary) ||\n (heading === -1 && v < boundary)) {\n startSpring({ from: v, to: boundary, velocity });\n }\n };\n startAnimation({\n type: \"decay\",\n from,\n velocity,\n timeConstant,\n power,\n restDelta,\n modifyTarget,\n onUpdate: isOutOfBounds(target) ? checkBoundary : undefined,\n });\n }\n return {\n stop: () => currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.stop(),\n };\n}\n\nexport { inertia };\n"],"x_google_ignoreList":[0],"mappings":";;;;AAIA,SAAS,QAAQ,EAAE,OAAO,GAAG,WAAW,GAAG,KAAK,KAAK,QAAQ,IAAK,eAAe,KAAK,kBAAkB,KAAK,gBAAgB,IAAI,YAAY,GAAG,cAAc,QAAQ,UAAU,YAAY,UAAW;CACnM,IAAI;CACJ,SAAS,cAAc,GAAG;EACtB,OAAQ,QAAQ,KAAA,KAAa,IAAI,OAAS,QAAQ,KAAA,KAAa,IAAI;CACvE;CACA,SAAS,gBAAgB,GAAG;EACxB,IAAI,QAAQ,KAAA,GACR,OAAO;EACX,IAAI,QAAQ,KAAA,GACR,OAAO;EACX,OAAO,KAAK,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,MAAM,CAAC,IAAI,MAAM;CACzD;CACA,SAAS,eAAe,SAAS;EAC7B,qBAAqB,QAAQ,qBAAqB,KAAK,KAAa,iBAAiB,KAAK;EAC1F,mBAAmB,QAAQ,OAAO,OAAO,OAAO,OAAO,CAAC,GAAG,OAAO,GAAG;GAAE;GAAQ,WAAW,MAAM;IACxF,IAAI;IACJ,aAAa,QAAQ,aAAa,KAAK,KAAa,SAAS,CAAC;IAC9D,CAAC,KAAK,QAAQ,cAAc,QAAQ,OAAO,KAAK,KAAa,GAAG,KAAK,SAAS,CAAC;GACnF;GAAG;GACH;EAAO,CAAC,CAAC;CACjB;CACA,SAAS,YAAY,SAAS;EAC1B,eAAe,OAAO,OAAO;GAAE,MAAM;GAAU,WAAW;GAAiB,SAAS;GAAe;EAAU,GAAG,OAAO,CAAC;CAC5H;CACA,IAAI,cAAc,IAAI,GAClB,YAAY;EAAE;EAAM;EAAU,IAAI,gBAAgB,IAAI;CAAE,CAAC;MAExD;EACD,IAAI,SAAS,QAAQ,WAAW;EAChC,IAAI,OAAO,iBAAiB,aACxB,SAAS,aAAa,MAAM;EAChC,MAAM,WAAW,gBAAgB,MAAM;EACvC,MAAM,UAAU,aAAa,MAAM,KAAK;EACxC,IAAI;EACJ,IAAI;EACJ,MAAM,iBAAiB,MAAM;GACzB,OAAO;GACP,UAAU;GACV,WAAW,kBAAkB,IAAI,MAAM,aAAa,EAAE,KAAK;GAC3D,IAAK,YAAY,KAAK,IAAI,YACrB,YAAY,MAAM,IAAI,UACvB,YAAY;IAAE,MAAM;IAAG,IAAI;IAAU;GAAS,CAAC;EAEvD;EACA,eAAe;GACX,MAAM;GACN;GACA;GACA;GACA;GACA;GACA;GACA,UAAU,cAAc,MAAM,IAAI,gBAAgB,KAAA;EACtD,CAAC;CACL;CACA,OAAO,EACH,YAAY,qBAAqB,QAAQ,qBAAqB,KAAK,IAAI,KAAK,IAAI,iBAAiB,KAAK,EAC1G;AACJ"}
@@ -0,0 +1,21 @@
1
+ import { spring } from "../generators/spring.js";
2
+ import { keyframes } from "../generators/keyframes.js";
3
+ import { decay } from "../generators/decay.js";
4
+ //#region node_modules/popmotion/dist/es/animations/utils/detect-animation-from-options.mjs
5
+ var types = {
6
+ keyframes,
7
+ spring,
8
+ decay
9
+ };
10
+ function detectAnimationFromOptions(config) {
11
+ if (Array.isArray(config.to)) return keyframes;
12
+ else if (types[config.type]) return types[config.type];
13
+ const keys = new Set(Object.keys(config));
14
+ if (keys.has("ease") || keys.has("duration") && !keys.has("dampingRatio")) return keyframes;
15
+ else if (keys.has("dampingRatio") || keys.has("stiffness") || keys.has("mass") || keys.has("damping") || keys.has("restSpeed") || keys.has("restDelta")) return spring;
16
+ return keyframes;
17
+ }
18
+ //#endregion
19
+ export { detectAnimationFromOptions };
20
+
21
+ //# sourceMappingURL=detect-animation-from-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-animation-from-options.js","names":[],"sources":["../../../../../../../node_modules/popmotion/dist/es/animations/utils/detect-animation-from-options.mjs"],"sourcesContent":["import { spring } from '../generators/spring.mjs';\nimport { keyframes } from '../generators/keyframes.mjs';\nimport { decay } from '../generators/decay.mjs';\n\nconst types = { keyframes, spring, decay };\nfunction detectAnimationFromOptions(config) {\n if (Array.isArray(config.to)) {\n return keyframes;\n }\n else if (types[config.type]) {\n return types[config.type];\n }\n const keys = new Set(Object.keys(config));\n if (keys.has(\"ease\") ||\n (keys.has(\"duration\") && !keys.has(\"dampingRatio\"))) {\n return keyframes;\n }\n else if (keys.has(\"dampingRatio\") ||\n keys.has(\"stiffness\") ||\n keys.has(\"mass\") ||\n keys.has(\"damping\") ||\n keys.has(\"restSpeed\") ||\n keys.has(\"restDelta\")) {\n return spring;\n }\n return keyframes;\n}\n\nexport { detectAnimationFromOptions };\n"],"x_google_ignoreList":[0],"mappings":";;;;AAIA,IAAM,QAAQ;CAAE;CAAW;CAAQ;AAAM;AACzC,SAAS,2BAA2B,QAAQ;CACxC,IAAI,MAAM,QAAQ,OAAO,EAAE,GACvB,OAAO;MAEN,IAAI,MAAM,OAAO,OAClB,OAAO,MAAM,OAAO;CAExB,MAAM,OAAO,IAAI,IAAI,OAAO,KAAK,MAAM,CAAC;CACxC,IAAI,KAAK,IAAI,MAAM,KACd,KAAK,IAAI,UAAU,KAAK,CAAC,KAAK,IAAI,cAAc,GACjD,OAAO;MAEN,IAAI,KAAK,IAAI,cAAc,KAC5B,KAAK,IAAI,WAAW,KACpB,KAAK,IAAI,MAAM,KACf,KAAK,IAAI,SAAS,KAClB,KAAK,IAAI,WAAW,KACpB,KAAK,IAAI,WAAW,GACpB,OAAO;CAEX,OAAO;AACX"}
@@ -0,0 +1,14 @@
1
+ //#region node_modules/popmotion/dist/es/animations/utils/elapsed.mjs
2
+ function loopElapsed(elapsed, duration, delay = 0) {
3
+ return elapsed - duration - delay;
4
+ }
5
+ function reverseElapsed(elapsed, duration, delay = 0, isForwardPlayback = true) {
6
+ return isForwardPlayback ? loopElapsed(duration + -elapsed, duration, delay) : duration - (elapsed - duration) + delay;
7
+ }
8
+ function hasRepeatDelayElapsed(elapsed, duration, delay, isForwardPlayback) {
9
+ return isForwardPlayback ? elapsed >= duration + delay : elapsed <= -delay;
10
+ }
11
+ //#endregion
12
+ export { hasRepeatDelayElapsed, loopElapsed, reverseElapsed };
13
+
14
+ //# sourceMappingURL=elapsed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elapsed.js","names":[],"sources":["../../../../../../../node_modules/popmotion/dist/es/animations/utils/elapsed.mjs"],"sourcesContent":["function loopElapsed(elapsed, duration, delay = 0) {\n return elapsed - duration - delay;\n}\nfunction reverseElapsed(elapsed, duration, delay = 0, isForwardPlayback = true) {\n return isForwardPlayback\n ? loopElapsed(duration + -elapsed, duration, delay)\n : duration - (elapsed - duration) + delay;\n}\nfunction hasRepeatDelayElapsed(elapsed, duration, delay, isForwardPlayback) {\n return isForwardPlayback ? elapsed >= duration + delay : elapsed <= -delay;\n}\n\nexport { hasRepeatDelayElapsed, loopElapsed, reverseElapsed };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,SAAS,YAAY,SAAS,UAAU,QAAQ,GAAG;CAC/C,OAAO,UAAU,WAAW;AAChC;AACA,SAAS,eAAe,SAAS,UAAU,QAAQ,GAAG,oBAAoB,MAAM;CAC5E,OAAO,oBACD,YAAY,WAAW,CAAC,SAAS,UAAU,KAAK,IAChD,YAAY,UAAU,YAAY;AAC5C;AACA,SAAS,sBAAsB,SAAS,UAAU,OAAO,mBAAmB;CACxE,OAAO,oBAAoB,WAAW,WAAW,QAAQ,WAAW,CAAC;AACzE"}
@@ -0,0 +1,68 @@
1
+ import { warning } from "../../../../../hey-listen/dist/hey-listen.es.js";
2
+ import { clamp } from "../../utils/clamp.js";
3
+ //#region node_modules/popmotion/dist/es/animations/utils/find-spring.mjs
4
+ var safeMin = .001;
5
+ var minDuration = .01;
6
+ var minDamping = .05;
7
+ function findSpring({ duration = 800, bounce = .25, velocity = 0, mass = 1 }) {
8
+ let envelope;
9
+ let derivative;
10
+ warning(duration <= 10 * 1e3, "Spring duration must be 10 seconds or less");
11
+ let dampingRatio = 1 - bounce;
12
+ dampingRatio = clamp(minDamping, 1, dampingRatio);
13
+ duration = clamp(minDuration, 10, duration / 1e3);
14
+ if (dampingRatio < 1) {
15
+ envelope = (undampedFreq) => {
16
+ const exponentialDecay = undampedFreq * dampingRatio;
17
+ const delta = exponentialDecay * duration;
18
+ const a = exponentialDecay - velocity;
19
+ const b = calcAngularFreq(undampedFreq, dampingRatio);
20
+ const c = Math.exp(-delta);
21
+ return safeMin - a / b * c;
22
+ };
23
+ derivative = (undampedFreq) => {
24
+ const delta = undampedFreq * dampingRatio * duration;
25
+ const d = delta * velocity + velocity;
26
+ const e = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq, 2) * duration;
27
+ const f = Math.exp(-delta);
28
+ const g = calcAngularFreq(Math.pow(undampedFreq, 2), dampingRatio);
29
+ return (-envelope(undampedFreq) + safeMin > 0 ? -1 : 1) * ((d - e) * f) / g;
30
+ };
31
+ } else {
32
+ envelope = (undampedFreq) => {
33
+ return -.001 + Math.exp(-undampedFreq * duration) * ((undampedFreq - velocity) * duration + 1);
34
+ };
35
+ derivative = (undampedFreq) => {
36
+ return Math.exp(-undampedFreq * duration) * ((velocity - undampedFreq) * (duration * duration));
37
+ };
38
+ }
39
+ const initialGuess = 5 / duration;
40
+ const undampedFreq = approximateRoot(envelope, derivative, initialGuess);
41
+ duration = duration * 1e3;
42
+ if (isNaN(undampedFreq)) return {
43
+ stiffness: 100,
44
+ damping: 10,
45
+ duration
46
+ };
47
+ else {
48
+ const stiffness = Math.pow(undampedFreq, 2) * mass;
49
+ return {
50
+ stiffness,
51
+ damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),
52
+ duration
53
+ };
54
+ }
55
+ }
56
+ var rootIterations = 12;
57
+ function approximateRoot(envelope, derivative, initialGuess) {
58
+ let result = initialGuess;
59
+ for (let i = 1; i < rootIterations; i++) result = result - envelope(result) / derivative(result);
60
+ return result;
61
+ }
62
+ function calcAngularFreq(undampedFreq, dampingRatio) {
63
+ return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
64
+ }
65
+ //#endregion
66
+ export { calcAngularFreq, findSpring };
67
+
68
+ //# sourceMappingURL=find-spring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-spring.js","names":[],"sources":["../../../../../../../node_modules/popmotion/dist/es/animations/utils/find-spring.mjs"],"sourcesContent":["import { warning } from 'hey-listen';\nimport { clamp } from '../../utils/clamp.mjs';\n\nconst safeMin = 0.001;\nconst minDuration = 0.01;\nconst maxDuration = 10.0;\nconst minDamping = 0.05;\nconst maxDamping = 1;\nfunction findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1, }) {\n let envelope;\n let derivative;\n warning(duration <= maxDuration * 1000, \"Spring duration must be 10 seconds or less\");\n let dampingRatio = 1 - bounce;\n dampingRatio = clamp(minDamping, maxDamping, dampingRatio);\n duration = clamp(minDuration, maxDuration, duration / 1000);\n if (dampingRatio < 1) {\n envelope = (undampedFreq) => {\n const exponentialDecay = undampedFreq * dampingRatio;\n const delta = exponentialDecay * duration;\n const a = exponentialDecay - velocity;\n const b = calcAngularFreq(undampedFreq, dampingRatio);\n const c = Math.exp(-delta);\n return safeMin - (a / b) * c;\n };\n derivative = (undampedFreq) => {\n const exponentialDecay = undampedFreq * dampingRatio;\n const delta = exponentialDecay * duration;\n const d = delta * velocity + velocity;\n const e = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq, 2) * duration;\n const f = Math.exp(-delta);\n const g = calcAngularFreq(Math.pow(undampedFreq, 2), dampingRatio);\n const factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1;\n return (factor * ((d - e) * f)) / g;\n };\n }\n else {\n envelope = (undampedFreq) => {\n const a = Math.exp(-undampedFreq * duration);\n const b = (undampedFreq - velocity) * duration + 1;\n return -safeMin + a * b;\n };\n derivative = (undampedFreq) => {\n const a = Math.exp(-undampedFreq * duration);\n const b = (velocity - undampedFreq) * (duration * duration);\n return a * b;\n };\n }\n const initialGuess = 5 / duration;\n const undampedFreq = approximateRoot(envelope, derivative, initialGuess);\n duration = duration * 1000;\n if (isNaN(undampedFreq)) {\n return {\n stiffness: 100,\n damping: 10,\n duration,\n };\n }\n else {\n const stiffness = Math.pow(undampedFreq, 2) * mass;\n return {\n stiffness,\n damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),\n duration,\n };\n }\n}\nconst rootIterations = 12;\nfunction approximateRoot(envelope, derivative, initialGuess) {\n let result = initialGuess;\n for (let i = 1; i < rootIterations; i++) {\n result = result - envelope(result) / derivative(result);\n }\n return result;\n}\nfunction calcAngularFreq(undampedFreq, dampingRatio) {\n return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);\n}\n\nexport { calcAngularFreq, findSpring, maxDamping, maxDuration, minDamping, minDuration };\n"],"x_google_ignoreList":[0],"mappings":";;;AAGA,IAAM,UAAU;AAChB,IAAM,cAAc;AAEpB,IAAM,aAAa;AAEnB,SAAS,WAAW,EAAE,WAAW,KAAK,SAAS,KAAM,WAAW,GAAG,OAAO,KAAM;CAC5E,IAAI;CACJ,IAAI;CACJ,QAAQ,YAAA,KAA0B,KAAM,4CAA4C;CACpF,IAAI,eAAe,IAAI;CACvB,eAAe,MAAM,YAAA,GAAwB,YAAY;CACzD,WAAW,MAAM,aAAA,IAA0B,WAAW,GAAI;CAC1D,IAAI,eAAe,GAAG;EAClB,YAAY,iBAAiB;GACzB,MAAM,mBAAmB,eAAe;GACxC,MAAM,QAAQ,mBAAmB;GACjC,MAAM,IAAI,mBAAmB;GAC7B,MAAM,IAAI,gBAAgB,cAAc,YAAY;GACpD,MAAM,IAAI,KAAK,IAAI,CAAC,KAAK;GACzB,OAAO,UAAW,IAAI,IAAK;EAC/B;EACA,cAAc,iBAAiB;GAE3B,MAAM,QADmB,eAAe,eACP;GACjC,MAAM,IAAI,QAAQ,WAAW;GAC7B,MAAM,IAAI,KAAK,IAAI,cAAc,CAAC,IAAI,KAAK,IAAI,cAAc,CAAC,IAAI;GAClE,MAAM,IAAI,KAAK,IAAI,CAAC,KAAK;GACzB,MAAM,IAAI,gBAAgB,KAAK,IAAI,cAAc,CAAC,GAAG,YAAY;GAEjE,QADe,CAAC,SAAS,YAAY,IAAI,UAAU,IAAI,KAAK,OACzC,IAAI,KAAK,KAAM;EACtC;CACJ,OACK;EACD,YAAY,iBAAiB;GAGzB,OAAO,QAFG,KAAK,IAAI,CAAC,eAAe,QAEjB,MADP,eAAe,YAAY,WAAW;EAErD;EACA,cAAc,iBAAiB;GAG3B,OAFU,KAAK,IAAI,CAAC,eAAe,QAE5B,MADI,WAAW,iBAAiB,WAAW;EAEtD;CACJ;CACA,MAAM,eAAe,IAAI;CACzB,MAAM,eAAe,gBAAgB,UAAU,YAAY,YAAY;CACvE,WAAW,WAAW;CACtB,IAAI,MAAM,YAAY,GAClB,OAAO;EACH,WAAW;EACX,SAAS;EACT;CACJ;MAEC;EACD,MAAM,YAAY,KAAK,IAAI,cAAc,CAAC,IAAI;EAC9C,OAAO;GACH;GACA,SAAS,eAAe,IAAI,KAAK,KAAK,OAAO,SAAS;GACtD;EACJ;CACJ;AACJ;AACA,IAAM,iBAAiB;AACvB,SAAS,gBAAgB,UAAU,YAAY,cAAc;CACzD,IAAI,SAAS;CACb,KAAK,IAAI,IAAI,GAAG,IAAI,gBAAgB,KAChC,SAAS,SAAS,SAAS,MAAM,IAAI,WAAW,MAAM;CAE1D,OAAO;AACX;AACA,SAAS,gBAAgB,cAAc,cAAc;CACjD,OAAO,eAAe,KAAK,KAAK,IAAI,eAAe,YAAY;AACnE"}
@@ -0,0 +1,28 @@
1
+ import { createAnticipate, createBackIn, createExpoIn, mirrorEasing, reverseEasing } from "./utils.js";
2
+ //#region node_modules/popmotion/dist/es/easing/index.mjs
3
+ var DEFAULT_OVERSHOOT_STRENGTH = 1.525;
4
+ var BOUNCE_FIRST_THRESHOLD = 4 / 11;
5
+ var BOUNCE_SECOND_THRESHOLD = 8 / 11;
6
+ var BOUNCE_THIRD_THRESHOLD = 9 / 10;
7
+ var easeIn = createExpoIn(2);
8
+ reverseEasing(easeIn);
9
+ var easeInOut = mirrorEasing(easeIn);
10
+ var circIn = (p) => 1 - Math.sin(Math.acos(p));
11
+ mirrorEasing(reverseEasing(circIn));
12
+ var backIn = createBackIn(DEFAULT_OVERSHOOT_STRENGTH);
13
+ reverseEasing(backIn);
14
+ mirrorEasing(backIn);
15
+ createAnticipate(DEFAULT_OVERSHOOT_STRENGTH);
16
+ var ca = 4356 / 361;
17
+ var cb = 35442 / 1805;
18
+ var cc = 16061 / 1805;
19
+ var bounceOut = (p) => {
20
+ if (p === 1 || p === 0) return p;
21
+ const p2 = p * p;
22
+ return p < BOUNCE_FIRST_THRESHOLD ? 7.5625 * p2 : p < BOUNCE_SECOND_THRESHOLD ? 9.075 * p2 - 9.9 * p + 3.4 : p < BOUNCE_THIRD_THRESHOLD ? ca * p2 - cb * p + cc : 10.8 * p * p - 20.52 * p + 10.72;
23
+ };
24
+ reverseEasing(bounceOut);
25
+ //#endregion
26
+ export { easeInOut };
27
+
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../../node_modules/popmotion/dist/es/easing/index.mjs"],"sourcesContent":["import { createExpoIn, reverseEasing, mirrorEasing, createBackIn, createAnticipate } from './utils.mjs';\n\nconst DEFAULT_OVERSHOOT_STRENGTH = 1.525;\nconst BOUNCE_FIRST_THRESHOLD = 4.0 / 11.0;\nconst BOUNCE_SECOND_THRESHOLD = 8.0 / 11.0;\nconst BOUNCE_THIRD_THRESHOLD = 9.0 / 10.0;\nconst linear = p => p;\nconst easeIn = createExpoIn(2);\nconst easeOut = reverseEasing(easeIn);\nconst easeInOut = mirrorEasing(easeIn);\nconst circIn = p => 1 - Math.sin(Math.acos(p));\nconst circOut = reverseEasing(circIn);\nconst circInOut = mirrorEasing(circOut);\nconst backIn = createBackIn(DEFAULT_OVERSHOOT_STRENGTH);\nconst backOut = reverseEasing(backIn);\nconst backInOut = mirrorEasing(backIn);\nconst anticipate = createAnticipate(DEFAULT_OVERSHOOT_STRENGTH);\nconst ca = 4356.0 / 361.0;\nconst cb = 35442.0 / 1805.0;\nconst cc = 16061.0 / 1805.0;\nconst bounceOut = (p) => {\n if (p === 1 || p === 0)\n return p;\n const p2 = p * p;\n return p < BOUNCE_FIRST_THRESHOLD\n ? 7.5625 * p2\n : p < BOUNCE_SECOND_THRESHOLD\n ? 9.075 * p2 - 9.9 * p + 3.4\n : p < BOUNCE_THIRD_THRESHOLD\n ? ca * p2 - cb * p + cc\n : 10.8 * p * p - 20.52 * p + 10.72;\n};\nconst bounceIn = reverseEasing(bounceOut);\nconst bounceInOut = (p) => p < 0.5\n ? 0.5 * (1.0 - bounceOut(1.0 - p * 2.0))\n : 0.5 * bounceOut(p * 2.0 - 1.0) + 0.5;\n\nexport { anticipate, backIn, backInOut, backOut, bounceIn, bounceInOut, bounceOut, circIn, circInOut, circOut, easeIn, easeInOut, easeOut, linear };\n"],"x_google_ignoreList":[0],"mappings":";;AAEA,IAAM,6BAA6B;AACnC,IAAM,yBAAyB,IAAM;AACrC,IAAM,0BAA0B,IAAM;AACtC,IAAM,yBAAyB,IAAM;AAErC,IAAM,SAAS,aAAa,CAAC;AACb,cAAc,MAAM;AACpC,IAAM,YAAY,aAAa,MAAM;AACrC,IAAM,UAAS,MAAK,IAAI,KAAK,IAAI,KAAK,KAAK,CAAC,CAAC;AAE3B,aADF,cAAc,MACC,CAAO;AACtC,IAAM,SAAS,aAAa,0BAA0B;AACtC,cAAc,MAAM;AAClB,aAAa,MAAM;AAClB,iBAAiB,0BAA0B;AAC9D,IAAM,KAAK,OAAS;AACpB,IAAM,KAAK,QAAU;AACrB,IAAM,KAAK,QAAU;AACrB,IAAM,aAAa,MAAM;CACrB,IAAI,MAAM,KAAK,MAAM,GACjB,OAAO;CACX,MAAM,KAAK,IAAI;CACf,OAAO,IAAI,yBACL,SAAS,KACT,IAAI,0BACA,QAAQ,KAAK,MAAM,IAAI,MACvB,IAAI,yBACA,KAAK,KAAK,KAAK,IAAI,KACnB,OAAO,IAAI,IAAI,QAAQ,IAAI;AAC7C;AACiB,cAAc,SAAS"}
@@ -0,0 +1,13 @@
1
+ //#region node_modules/popmotion/dist/es/easing/utils.mjs
2
+ var reverseEasing = (easing) => (p) => 1 - easing(1 - p);
3
+ var mirrorEasing = (easing) => (p) => p <= .5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2;
4
+ var createExpoIn = (power) => (p) => Math.pow(p, power);
5
+ var createBackIn = (power) => (p) => p * p * ((power + 1) * p - power);
6
+ var createAnticipate = (power) => {
7
+ const backEasing = createBackIn(power);
8
+ return (p) => (p *= 2) < 1 ? .5 * backEasing(p) : .5 * (2 - Math.pow(2, -10 * (p - 1)));
9
+ };
10
+ //#endregion
11
+ export { createAnticipate, createBackIn, createExpoIn, mirrorEasing, reverseEasing };
12
+
13
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../../../../../node_modules/popmotion/dist/es/easing/utils.mjs"],"sourcesContent":["const reverseEasing = easing => p => 1 - easing(1 - p);\nconst mirrorEasing = easing => p => p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2;\nconst createExpoIn = (power) => p => Math.pow(p, power);\nconst createBackIn = (power) => p => p * p * ((power + 1) * p - power);\nconst createAnticipate = (power) => {\n const backEasing = createBackIn(power);\n return p => (p *= 2) < 1\n ? 0.5 * backEasing(p)\n : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));\n};\n\nexport { createAnticipate, createBackIn, createExpoIn, mirrorEasing, reverseEasing };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,IAAM,iBAAgB,YAAU,MAAK,IAAI,OAAO,IAAI,CAAC;AACrD,IAAM,gBAAe,YAAU,MAAK,KAAK,KAAM,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,OAAO,KAAK,IAAI,EAAE,KAAK;AAC/F,IAAM,gBAAgB,WAAU,MAAK,KAAK,IAAI,GAAG,KAAK;AACtD,IAAM,gBAAgB,WAAU,MAAK,IAAI,MAAM,QAAQ,KAAK,IAAI;AAChE,IAAM,oBAAoB,UAAU;CAChC,MAAM,aAAa,aAAa,KAAK;CACrC,QAAO,OAAM,KAAK,KAAK,IACjB,KAAM,WAAW,CAAC,IAClB,MAAO,IAAI,KAAK,IAAI,GAAG,OAAO,IAAI,EAAE;AAC9C"}
@@ -0,0 +1,6 @@
1
+ //#region node_modules/popmotion/dist/es/utils/clamp.mjs
2
+ var clamp = (min, max, v) => Math.min(Math.max(v, min), max);
3
+ //#endregion
4
+ export { clamp };
5
+
6
+ //# sourceMappingURL=clamp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clamp.js","names":[],"sources":["../../../../../../node_modules/popmotion/dist/es/utils/clamp.mjs"],"sourcesContent":["const clamp = (min, max, v) => Math.min(Math.max(v, min), max);\n\nexport { clamp };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,IAAM,SAAS,KAAK,KAAK,MAAM,KAAK,IAAI,KAAK,IAAI,GAAG,GAAG,GAAG,GAAG"}
@@ -0,0 +1,35 @@
1
+ //#region node_modules/popmotion/dist/es/utils/hsla-to-rgba.mjs
2
+ function hueToRgb(p, q, t) {
3
+ if (t < 0) t += 1;
4
+ if (t > 1) t -= 1;
5
+ if (t < 1 / 6) return p + (q - p) * 6 * t;
6
+ if (t < 1 / 2) return q;
7
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
8
+ return p;
9
+ }
10
+ function hslaToRgba({ hue, saturation, lightness, alpha }) {
11
+ hue /= 360;
12
+ saturation /= 100;
13
+ lightness /= 100;
14
+ let red = 0;
15
+ let green = 0;
16
+ let blue = 0;
17
+ if (!saturation) red = green = blue = lightness;
18
+ else {
19
+ const q = lightness < .5 ? lightness * (1 + saturation) : lightness + saturation - lightness * saturation;
20
+ const p = 2 * lightness - q;
21
+ red = hueToRgb(p, q, hue + 1 / 3);
22
+ green = hueToRgb(p, q, hue);
23
+ blue = hueToRgb(p, q, hue - 1 / 3);
24
+ }
25
+ return {
26
+ red: Math.round(red * 255),
27
+ green: Math.round(green * 255),
28
+ blue: Math.round(blue * 255),
29
+ alpha
30
+ };
31
+ }
32
+ //#endregion
33
+ export { hslaToRgba };
34
+
35
+ //# sourceMappingURL=hsla-to-rgba.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hsla-to-rgba.js","names":[],"sources":["../../../../../../node_modules/popmotion/dist/es/utils/hsla-to-rgba.mjs"],"sourcesContent":["function hueToRgb(p, q, t) {\n if (t < 0)\n t += 1;\n if (t > 1)\n t -= 1;\n if (t < 1 / 6)\n return p + (q - p) * 6 * t;\n if (t < 1 / 2)\n return q;\n if (t < 2 / 3)\n return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n}\nfunction hslaToRgba({ hue, saturation, lightness, alpha }) {\n hue /= 360;\n saturation /= 100;\n lightness /= 100;\n let red = 0;\n let green = 0;\n let blue = 0;\n if (!saturation) {\n red = green = blue = lightness;\n }\n else {\n const q = lightness < 0.5\n ? lightness * (1 + saturation)\n : lightness + saturation - lightness * saturation;\n const p = 2 * lightness - q;\n red = hueToRgb(p, q, hue + 1 / 3);\n green = hueToRgb(p, q, hue);\n blue = hueToRgb(p, q, hue - 1 / 3);\n }\n return {\n red: Math.round(red * 255),\n green: Math.round(green * 255),\n blue: Math.round(blue * 255),\n alpha,\n };\n}\n\nexport { hslaToRgba };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,SAAS,SAAS,GAAG,GAAG,GAAG;CACvB,IAAI,IAAI,GACJ,KAAK;CACT,IAAI,IAAI,GACJ,KAAK;CACT,IAAI,IAAI,IAAI,GACR,OAAO,KAAK,IAAI,KAAK,IAAI;CAC7B,IAAI,IAAI,IAAI,GACR,OAAO;CACX,IAAI,IAAI,IAAI,GACR,OAAO,KAAK,IAAI,MAAM,IAAI,IAAI,KAAK;CACvC,OAAO;AACX;AACA,SAAS,WAAW,EAAE,KAAK,YAAY,WAAW,SAAS;CACvD,OAAO;CACP,cAAc;CACd,aAAa;CACb,IAAI,MAAM;CACV,IAAI,QAAQ;CACZ,IAAI,OAAO;CACX,IAAI,CAAC,YACD,MAAM,QAAQ,OAAO;MAEpB;EACD,MAAM,IAAI,YAAY,KAChB,aAAa,IAAI,cACjB,YAAY,aAAa,YAAY;EAC3C,MAAM,IAAI,IAAI,YAAY;EAC1B,MAAM,SAAS,GAAG,GAAG,MAAM,IAAI,CAAC;EAChC,QAAQ,SAAS,GAAG,GAAG,GAAG;EAC1B,OAAO,SAAS,GAAG,GAAG,MAAM,IAAI,CAAC;CACrC;CACA,OAAO;EACH,KAAK,KAAK,MAAM,MAAM,GAAG;EACzB,OAAO,KAAK,MAAM,QAAQ,GAAG;EAC7B,MAAM,KAAK,MAAM,OAAO,GAAG;EAC3B;CACJ;AACJ"}
@@ -0,0 +1,6 @@
1
+ //#region node_modules/popmotion/dist/es/utils/inc.mjs
2
+ var isNum = (v) => typeof v === "number";
3
+ //#endregion
4
+ export { isNum };
5
+
6
+ //# sourceMappingURL=inc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inc.js","names":[],"sources":["../../../../../../node_modules/popmotion/dist/es/utils/inc.mjs"],"sourcesContent":["const zeroPoint = {\n x: 0,\n y: 0,\n z: 0\n};\nconst isNum = (v) => typeof v === 'number';\n\nexport { isNum, zeroPoint };\n"],"x_google_ignoreList":[0],"mappings":";AAKA,IAAM,SAAS,MAAM,OAAO,MAAM"}
@@ -0,0 +1,69 @@
1
+ import { invariant } from "../../../../hey-listen/dist/hey-listen.es.js";
2
+ import { clamp } from "./clamp.js";
3
+ import { progress } from "./progress.js";
4
+ import { mix } from "./mix.js";
5
+ import { color } from "../../../../style-value-types/dist/es/color/index.js";
6
+ import { mixColor } from "./mix-color.js";
7
+ import { pipe } from "./pipe.js";
8
+ import { mixArray, mixComplex, mixObject } from "./mix-complex.js";
9
+ //#region node_modules/popmotion/dist/es/utils/interpolate.mjs
10
+ var mixNumber = (from, to) => (p) => mix(from, to, p);
11
+ function detectMixerFactory(v) {
12
+ if (typeof v === "number") return mixNumber;
13
+ else if (typeof v === "string") if (color.test(v)) return mixColor;
14
+ else return mixComplex;
15
+ else if (Array.isArray(v)) return mixArray;
16
+ else if (typeof v === "object") return mixObject;
17
+ }
18
+ function createMixers(output, ease, customMixer) {
19
+ const mixers = [];
20
+ const mixerFactory = customMixer || detectMixerFactory(output[0]);
21
+ const numMixers = output.length - 1;
22
+ for (let i = 0; i < numMixers; i++) {
23
+ let mixer = mixerFactory(output[i], output[i + 1]);
24
+ if (ease) mixer = pipe(Array.isArray(ease) ? ease[i] : ease, mixer);
25
+ mixers.push(mixer);
26
+ }
27
+ return mixers;
28
+ }
29
+ function fastInterpolate([from, to], [mixer]) {
30
+ return (v) => mixer(progress(from, to, v));
31
+ }
32
+ function slowInterpolate(input, mixers) {
33
+ const inputLength = input.length;
34
+ const lastInputIndex = inputLength - 1;
35
+ return (v) => {
36
+ let mixerIndex = 0;
37
+ let foundMixerIndex = false;
38
+ if (v <= input[0]) foundMixerIndex = true;
39
+ else if (v >= input[lastInputIndex]) {
40
+ mixerIndex = lastInputIndex - 1;
41
+ foundMixerIndex = true;
42
+ }
43
+ if (!foundMixerIndex) {
44
+ let i = 1;
45
+ for (; i < inputLength; i++) if (input[i] > v || i === lastInputIndex) break;
46
+ mixerIndex = i - 1;
47
+ }
48
+ const progressInRange = progress(input[mixerIndex], input[mixerIndex + 1], v);
49
+ return mixers[mixerIndex](progressInRange);
50
+ };
51
+ }
52
+ function interpolate(input, output, { clamp: isClamp = true, ease, mixer } = {}) {
53
+ const inputLength = input.length;
54
+ invariant(inputLength === output.length, "Both input and output ranges must be the same length");
55
+ invariant(!ease || !Array.isArray(ease) || ease.length === inputLength - 1, "Array of easing functions must be of length `input.length - 1`, as it applies to the transitions **between** the defined values.");
56
+ if (input[0] > input[inputLength - 1]) {
57
+ input = [].concat(input);
58
+ output = [].concat(output);
59
+ input.reverse();
60
+ output.reverse();
61
+ }
62
+ const mixers = createMixers(output, ease, mixer);
63
+ const interpolator = inputLength === 2 ? fastInterpolate(input, mixers) : slowInterpolate(input, mixers);
64
+ return isClamp ? (v) => interpolator(clamp(input[0], input[inputLength - 1], v)) : interpolator;
65
+ }
66
+ //#endregion
67
+ export { interpolate };
68
+
69
+ //# sourceMappingURL=interpolate.js.map