coily 0.12.1 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as defineSpring, a as Spring2D, c as Spring2DWithOffset, d as SpringPosition, f as SpringTarget, g as SpringState, h as SpringOptions, i as TickerOptions, l as Vector2, m as SpringConfig, n as SpringSystemOptions, o as Spring2DPosition, p as SpringWithOffset, r as createSpringSystem, s as Spring2DTarget, t as SpringSystem, u as Spring } from "./system-
|
|
1
|
+
import { _ as defineSpring, a as Spring2D, c as Spring2DWithOffset, d as SpringPosition, f as SpringTarget, g as SpringState, h as SpringOptions, i as TickerOptions, l as Vector2, m as SpringConfig, n as SpringSystemOptions, o as Spring2DPosition, p as SpringWithOffset, r as createSpringSystem, s as Spring2DTarget, t as SpringSystem, u as Spring } from "./system-coAFNYnb.js";
|
|
2
2
|
export { type Spring, type Spring2D, type Spring2DPosition, type Spring2DTarget, type Spring2DWithOffset, type SpringConfig, type SpringOptions, type SpringPosition, type SpringState, type SpringSystem, type SpringSystemOptions, type SpringTarget, type SpringWithOffset, type TickerOptions, type Vector2, createSpringSystem, defineSpring };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { r as defineSpring, t as createSpringSystem } from "./system-
|
|
1
|
+
import { r as defineSpring, t as createSpringSystem } from "./system-Bzrx4uso.js";
|
|
2
2
|
export { createSpringSystem, defineSpring };
|
|
@@ -39,8 +39,8 @@ var SpringConfig = class SpringConfig {
|
|
|
39
39
|
dampingRatio: 1,
|
|
40
40
|
duration: 500
|
|
41
41
|
});
|
|
42
|
-
/** @internal Incremented by `
|
|
43
|
-
|
|
42
|
+
/** @internal Incremented by `assign` to signal mutations. Do not read or write directly. */
|
|
43
|
+
_version = 0;
|
|
44
44
|
mass;
|
|
45
45
|
tension;
|
|
46
46
|
damping;
|
|
@@ -122,12 +122,10 @@ var SpringConfig = class SpringConfig {
|
|
|
122
122
|
this.criticalDamping = 2 * this.mass * this.naturalFrequency;
|
|
123
123
|
this.dampingRatio = this.damping / this.criticalDamping;
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
target.#version++;
|
|
130
|
-
const t = target;
|
|
125
|
+
/** @internal Copies physical parameters from `source` onto this config and bumps `_version`. */
|
|
126
|
+
assign(source) {
|
|
127
|
+
this._version++;
|
|
128
|
+
const t = this;
|
|
131
129
|
t.mass = source.mass;
|
|
132
130
|
t.tension = source.tension;
|
|
133
131
|
t.damping = source.damping;
|
|
@@ -375,14 +373,14 @@ var Motion = class {
|
|
|
375
373
|
configure(config) {
|
|
376
374
|
this.#config = config;
|
|
377
375
|
this.#state.configure(config);
|
|
378
|
-
this.#configVersion =
|
|
376
|
+
this.#configVersion = config._version;
|
|
379
377
|
this.#needsUpdate = true;
|
|
380
378
|
}
|
|
381
379
|
tick(dt, emit = true) {
|
|
382
380
|
invariant(this.#currentSolver, "Cannot tick a disposed motion");
|
|
383
|
-
if (
|
|
381
|
+
if (this.#config._version !== this.#configVersion) {
|
|
384
382
|
this.#state.configure(this.#config);
|
|
385
|
-
this.#configVersion =
|
|
383
|
+
this.#configVersion = this.#config._version;
|
|
386
384
|
this.#needsUpdate = true;
|
|
387
385
|
}
|
|
388
386
|
const needsTimeRemaining = this.#needsUpdate || this.#needsReset;
|
|
@@ -549,7 +547,7 @@ var Spring = class {
|
|
|
549
547
|
precision: value.precision
|
|
550
548
|
});
|
|
551
549
|
this.#motion.configure(this.#config);
|
|
552
|
-
} else
|
|
550
|
+
} else this.#config.assign(value);
|
|
553
551
|
this.#motions.add(this.#motion);
|
|
554
552
|
} else if (this.#ownsConfig) {
|
|
555
553
|
this.#ownsConfig = false;
|
|
@@ -75,7 +75,6 @@ type SpringOptions = DirectOptions | TensionRatioOptions | TensionBounceOptions
|
|
|
75
75
|
* Immutable spring configuration.
|
|
76
76
|
*/
|
|
77
77
|
declare class SpringConfig {
|
|
78
|
-
#private;
|
|
79
78
|
static readonly default: SpringConfig;
|
|
80
79
|
readonly mass: number;
|
|
81
80
|
readonly tension: number;
|
|
@@ -87,8 +86,6 @@ declare class SpringConfig {
|
|
|
87
86
|
readonly precisionMultiplier: number;
|
|
88
87
|
readonly restingMagnitude: number;
|
|
89
88
|
constructor(input: SpringOptions);
|
|
90
|
-
static version(config: SpringConfig): number;
|
|
91
|
-
static assign(target: SpringConfig, source: SpringConfig): void;
|
|
92
89
|
/**
|
|
93
90
|
* Analytically estimates the time remaining for a spring to come to rest,
|
|
94
91
|
* given the current displacement and velocity.
|
package/dist/vue.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as SpringOptions, l as Vector2, m as SpringConfig, n as SpringSystemOptions, t as SpringSystem } from "./system-
|
|
1
|
+
import { h as SpringOptions, l as Vector2, m as SpringConfig, n as SpringSystemOptions, t as SpringSystem } from "./system-coAFNYnb.js";
|
|
2
2
|
import * as vue from "vue";
|
|
3
3
|
import { App, MaybeRefOrGetter, Ref, SlotsType } from "vue";
|
|
4
4
|
|
package/dist/vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as SpringConfig, t as createSpringSystem } from "./system-
|
|
1
|
+
import { n as SpringConfig, t as createSpringSystem } from "./system-Bzrx4uso.js";
|
|
2
2
|
import { computed, customRef, defineComponent, getCurrentScope, inject, onBeforeUnmount, onMounted, onScopeDispose, provide, toRefs, toValue, watchSyncEffect } from "vue";
|
|
3
3
|
//#region src/vue/system.ts
|
|
4
4
|
const SpringSystemKey = Symbol.for("coily/spring-system");
|