coily 0.6.0 → 0.7.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Tim Morris
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/api.cjs CHANGED
@@ -13,23 +13,18 @@ var __privateAdd$5 = (obj, member, value) => {
13
13
  throw TypeError("Cannot add the same private member more than once");
14
14
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
15
15
  };
16
- var _solvers, _callbacks;
16
+ var _solvers;
17
17
  class Scheduler {
18
18
  constructor() {
19
19
  __privateAdd$5(this, _solvers, /* @__PURE__ */ new Set());
20
- __privateAdd$5(this, _callbacks, /* @__PURE__ */ new Set());
21
20
  }
22
21
  tick(delta) {
23
- for (const callback of __privateGet$5(this, _callbacks).values()) {
24
- callback(delta);
25
- }
26
22
  for (const solver of __privateGet$5(this, _solvers).values()) {
27
23
  solver.tick(delta);
28
24
  if (solver.resting) {
29
25
  __privateGet$5(this, _solvers).delete(solver);
30
26
  }
31
27
  }
32
- __privateGet$5(this, _callbacks).clear();
33
28
  }
34
29
  add(solver) {
35
30
  __privateGet$5(this, _solvers).add(solver);
@@ -40,12 +35,8 @@ class Scheduler {
40
35
  has(solver) {
41
36
  return __privateGet$5(this, _solvers).has(solver);
42
37
  }
43
- once(callback) {
44
- __privateGet$5(this, _callbacks).add(callback);
45
- }
46
38
  }
47
39
  _solvers = new WeakMap();
48
- _callbacks = new WeakMap();
49
40
 
50
41
  var __accessCheck$4 = (obj, member, msg) => {
51
42
  if (!member.has(obj))
@@ -190,7 +181,7 @@ var __privateMethod = (obj, member, method) => {
190
181
  __accessCheck$2(obj, member, "access private method");
191
182
  return method;
192
183
  };
193
- var _mass, _tension, _damping, _state, _underdampedSolver, _criticallyDampedSolver, _overdampedSolver, _currentSolver, _solverNeedsUpdate, _solverNeedsReset, _emitter, _updateSolver, updateSolver_fn, _solver$1, _state2, _dampedFrequency, _t, _c1, _c2, _solver2, _state3, _t2, _c12, _c22, _solver3, _state4, _dampedFrequency2, _t3, _c13, _c23;
184
+ var _mass, _tension, _damping, _state, _underdampedSolver, _criticallyDampedSolver, _overdampedSolver, _currentSolver, _needsUpdate, _needsReset, _emitter, _updateSolver, updateSolver_fn, _solver$1, _state2, _dampedFrequency, _t, _c1, _c2, _solver2, _state3, _t2, _c12, _c22, _solver3, _state4, _dampedFrequency2, _t3, _c13, _c23;
194
185
  class Solver {
195
186
  constructor(options) {
196
187
  __privateAdd$2(this, _updateSolver);
@@ -202,8 +193,8 @@ class Solver {
202
193
  __privateAdd$2(this, _criticallyDampedSolver, null);
203
194
  __privateAdd$2(this, _overdampedSolver, null);
204
195
  __privateAdd$2(this, _currentSolver, void 0);
205
- __privateAdd$2(this, _solverNeedsUpdate, false);
206
- __privateAdd$2(this, _solverNeedsReset, false);
196
+ __privateAdd$2(this, _needsUpdate, false);
197
+ __privateAdd$2(this, _needsReset, false);
207
198
  __privateAdd$2(this, _emitter, void 0);
208
199
  __privateSet$2(this, _mass, options.mass);
209
200
  __privateSet$2(this, _tension, options.tension);
@@ -221,35 +212,35 @@ class Solver {
221
212
  }
222
213
  set mass(value) {
223
214
  __privateSet$2(this, _mass, value);
224
- __privateSet$2(this, _solverNeedsUpdate, true);
215
+ __privateSet$2(this, _needsUpdate, true);
225
216
  }
226
217
  get tension() {
227
218
  return __privateGet$2(this, _tension);
228
219
  }
229
220
  set tension(value) {
230
221
  __privateSet$2(this, _tension, value);
231
- __privateSet$2(this, _solverNeedsUpdate, true);
222
+ __privateSet$2(this, _needsUpdate, true);
232
223
  }
233
224
  get damping() {
234
225
  return __privateGet$2(this, _damping);
235
226
  }
236
227
  set damping(value) {
237
228
  __privateSet$2(this, _damping, value);
238
- __privateSet$2(this, _solverNeedsUpdate, true);
229
+ __privateSet$2(this, _needsUpdate, true);
239
230
  }
240
231
  get position() {
241
232
  return __privateGet$2(this, _state).position;
242
233
  }
243
234
  set position(value) {
244
235
  __privateGet$2(this, _state).position = value;
245
- __privateSet$2(this, _solverNeedsReset, true);
236
+ __privateSet$2(this, _needsReset, true);
246
237
  }
247
238
  get velocity() {
248
239
  return __privateGet$2(this, _state).velocity;
249
240
  }
250
241
  set velocity(value) {
251
242
  __privateGet$2(this, _state).velocity = value;
252
- __privateSet$2(this, _solverNeedsReset, true);
243
+ __privateSet$2(this, _needsReset, true);
253
244
  }
254
245
  get precision() {
255
246
  return __privateGet$2(this, _state).precision;
@@ -270,24 +261,31 @@ class Solver {
270
261
  return __privateGet$2(this, _damping) / this.criticalDamping;
271
262
  }
272
263
  tick(dt) {
273
- if (__privateGet$2(this, _solverNeedsUpdate)) {
264
+ if (__privateGet$2(this, _needsUpdate)) {
274
265
  __privateMethod(this, _updateSolver, updateSolver_fn).call(this);
275
- __privateSet$2(this, _solverNeedsUpdate, false);
266
+ __privateSet$2(this, _needsUpdate, false);
276
267
  }
277
- if (__privateGet$2(this, _solverNeedsReset)) {
268
+ if (__privateGet$2(this, _needsReset)) {
278
269
  __privateGet$2(this, _currentSolver).reset();
279
- __privateSet$2(this, _solverNeedsReset, false);
270
+ __privateSet$2(this, _needsReset, false);
280
271
  }
281
272
  const previousPosition = __privateGet$2(this, _state).position;
282
273
  const previousVelocity = __privateGet$2(this, _state).velocity;
274
+ const previousResting = __privateGet$2(this, _state).resting;
283
275
  __privateGet$2(this, _currentSolver).tick(dt);
284
276
  if (__privateGet$2(this, _state).position !== previousPosition || __privateGet$2(this, _state).velocity !== previousVelocity) {
285
277
  __privateGet$2(this, _emitter).emit("update");
286
278
  }
279
+ if (__privateGet$2(this, _state).resting !== previousResting) {
280
+ __privateGet$2(this, _emitter).emit("rest");
281
+ }
287
282
  }
288
283
  onUpdate(callback) {
289
284
  return __privateGet$2(this, _emitter).on("update", callback);
290
285
  }
286
+ onRest(callback) {
287
+ return __privateGet$2(this, _emitter).on("rest", callback);
288
+ }
291
289
  }
292
290
  _mass = new WeakMap();
293
291
  _tension = new WeakMap();
@@ -297,8 +295,8 @@ _underdampedSolver = new WeakMap();
297
295
  _criticallyDampedSolver = new WeakMap();
298
296
  _overdampedSolver = new WeakMap();
299
297
  _currentSolver = new WeakMap();
300
- _solverNeedsUpdate = new WeakMap();
301
- _solverNeedsReset = new WeakMap();
298
+ _needsUpdate = new WeakMap();
299
+ _needsReset = new WeakMap();
302
300
  _emitter = new WeakMap();
303
301
  _updateSolver = new WeakSet();
304
302
  updateSolver_fn = function() {
@@ -445,13 +443,13 @@ var __privateSet$1 = (obj, member, value, setter) => {
445
443
  setter ? setter.call(obj, value) : member.set(obj, value);
446
444
  return value;
447
445
  };
448
- var _target, _solver, _scheduler$1, _optimisticTarget;
446
+ var _target, _solver, _scheduler$1, _newTarget;
449
447
  class Spring {
450
448
  constructor(scheduler, options) {
451
449
  __privateAdd$1(this, _target, void 0);
452
450
  __privateAdd$1(this, _solver, void 0);
453
451
  __privateAdd$1(this, _scheduler$1, void 0);
454
- __privateAdd$1(this, _optimisticTarget, void 0);
452
+ __privateAdd$1(this, _newTarget, void 0);
455
453
  invariant(options.mass > 0, "Mass must be greater than 0");
456
454
  invariant(options.tension > 0, "Tension must be greater than 0");
457
455
  invariant(
@@ -472,25 +470,22 @@ class Spring {
472
470
  precision: options.precsiion ?? 2
473
471
  }));
474
472
  __privateSet$1(this, _scheduler$1, scheduler);
475
- __privateSet$1(this, _optimisticTarget, __privateGet$1(this, _target));
473
+ __privateSet$1(this, _newTarget, __privateGet$1(this, _target));
476
474
  if (!__privateGet$1(this, _solver).resting) {
477
475
  __privateGet$1(this, _scheduler$1).add(__privateGet$1(this, _solver));
478
476
  }
479
477
  }
480
478
  get target() {
481
- return __privateGet$1(this, _optimisticTarget);
479
+ return __privateGet$1(this, _target);
482
480
  }
483
481
  set target(value) {
484
- if (value !== __privateGet$1(this, _optimisticTarget)) {
485
- __privateSet$1(this, _optimisticTarget, value);
486
- __privateGet$1(this, _scheduler$1).once(() => {
487
- if (!__privateGet$1(this, _scheduler$1).has(__privateGet$1(this, _solver))) {
488
- __privateGet$1(this, _scheduler$1).add(__privateGet$1(this, _solver));
489
- }
490
- const currentValue = this.value;
491
- __privateSet$1(this, _target, __privateGet$1(this, _optimisticTarget));
492
- __privateGet$1(this, _solver).position = currentValue - __privateGet$1(this, _target);
493
- });
482
+ if (value !== __privateGet$1(this, _target)) {
483
+ if (!__privateGet$1(this, _scheduler$1).has(__privateGet$1(this, _solver))) {
484
+ __privateGet$1(this, _scheduler$1).add(__privateGet$1(this, _solver));
485
+ }
486
+ const currentValue = this.value;
487
+ __privateSet$1(this, _target, value);
488
+ __privateGet$1(this, _solver).position = currentValue - __privateGet$1(this, _target);
494
489
  }
495
490
  }
496
491
  get value() {
@@ -557,11 +552,14 @@ class Spring {
557
552
  onUpdate(callback) {
558
553
  return __privateGet$1(this, _solver).onUpdate(callback);
559
554
  }
555
+ onRest(callback) {
556
+ return __privateGet$1(this, _solver).onRest(callback);
557
+ }
560
558
  }
561
559
  _target = new WeakMap();
562
560
  _solver = new WeakMap();
563
561
  _scheduler$1 = new WeakMap();
564
- _optimisticTarget = new WeakMap();
562
+ _newTarget = new WeakMap();
565
563
 
566
564
  var __accessCheck = (obj, member, msg) => {
567
565
  if (!member.has(obj))
package/dist/api.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as SpringSystem } from './shared/coily.86bacb03.cjs';
2
- export { a as Spring } from './shared/coily.86bacb03.cjs';
1
+ import { S as SpringSystem } from './shared/coily.87d79480.cjs';
2
+ export { a as Spring } from './shared/coily.87d79480.cjs';
3
3
 
4
4
  declare function createSpringSystem(): SpringSystem;
5
5
 
package/dist/api.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as SpringSystem } from './shared/coily.86bacb03.mjs';
2
- export { a as Spring } from './shared/coily.86bacb03.mjs';
1
+ import { S as SpringSystem } from './shared/coily.87d79480.mjs';
2
+ export { a as Spring } from './shared/coily.87d79480.mjs';
3
3
 
4
4
  declare function createSpringSystem(): SpringSystem;
5
5
 
package/dist/api.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as SpringSystem } from './shared/coily.86bacb03.js';
2
- export { a as Spring } from './shared/coily.86bacb03.js';
1
+ import { S as SpringSystem } from './shared/coily.87d79480.js';
2
+ export { a as Spring } from './shared/coily.87d79480.js';
3
3
 
4
4
  declare function createSpringSystem(): SpringSystem;
5
5
 
package/dist/api.mjs CHANGED
@@ -11,23 +11,18 @@ var __privateAdd$5 = (obj, member, value) => {
11
11
  throw TypeError("Cannot add the same private member more than once");
12
12
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
13
13
  };
14
- var _solvers, _callbacks;
14
+ var _solvers;
15
15
  class Scheduler {
16
16
  constructor() {
17
17
  __privateAdd$5(this, _solvers, /* @__PURE__ */ new Set());
18
- __privateAdd$5(this, _callbacks, /* @__PURE__ */ new Set());
19
18
  }
20
19
  tick(delta) {
21
- for (const callback of __privateGet$5(this, _callbacks).values()) {
22
- callback(delta);
23
- }
24
20
  for (const solver of __privateGet$5(this, _solvers).values()) {
25
21
  solver.tick(delta);
26
22
  if (solver.resting) {
27
23
  __privateGet$5(this, _solvers).delete(solver);
28
24
  }
29
25
  }
30
- __privateGet$5(this, _callbacks).clear();
31
26
  }
32
27
  add(solver) {
33
28
  __privateGet$5(this, _solvers).add(solver);
@@ -38,12 +33,8 @@ class Scheduler {
38
33
  has(solver) {
39
34
  return __privateGet$5(this, _solvers).has(solver);
40
35
  }
41
- once(callback) {
42
- __privateGet$5(this, _callbacks).add(callback);
43
- }
44
36
  }
45
37
  _solvers = new WeakMap();
46
- _callbacks = new WeakMap();
47
38
 
48
39
  var __accessCheck$4 = (obj, member, msg) => {
49
40
  if (!member.has(obj))
@@ -188,7 +179,7 @@ var __privateMethod = (obj, member, method) => {
188
179
  __accessCheck$2(obj, member, "access private method");
189
180
  return method;
190
181
  };
191
- var _mass, _tension, _damping, _state, _underdampedSolver, _criticallyDampedSolver, _overdampedSolver, _currentSolver, _solverNeedsUpdate, _solverNeedsReset, _emitter, _updateSolver, updateSolver_fn, _solver$1, _state2, _dampedFrequency, _t, _c1, _c2, _solver2, _state3, _t2, _c12, _c22, _solver3, _state4, _dampedFrequency2, _t3, _c13, _c23;
182
+ var _mass, _tension, _damping, _state, _underdampedSolver, _criticallyDampedSolver, _overdampedSolver, _currentSolver, _needsUpdate, _needsReset, _emitter, _updateSolver, updateSolver_fn, _solver$1, _state2, _dampedFrequency, _t, _c1, _c2, _solver2, _state3, _t2, _c12, _c22, _solver3, _state4, _dampedFrequency2, _t3, _c13, _c23;
192
183
  class Solver {
193
184
  constructor(options) {
194
185
  __privateAdd$2(this, _updateSolver);
@@ -200,8 +191,8 @@ class Solver {
200
191
  __privateAdd$2(this, _criticallyDampedSolver, null);
201
192
  __privateAdd$2(this, _overdampedSolver, null);
202
193
  __privateAdd$2(this, _currentSolver, void 0);
203
- __privateAdd$2(this, _solverNeedsUpdate, false);
204
- __privateAdd$2(this, _solverNeedsReset, false);
194
+ __privateAdd$2(this, _needsUpdate, false);
195
+ __privateAdd$2(this, _needsReset, false);
205
196
  __privateAdd$2(this, _emitter, void 0);
206
197
  __privateSet$2(this, _mass, options.mass);
207
198
  __privateSet$2(this, _tension, options.tension);
@@ -219,35 +210,35 @@ class Solver {
219
210
  }
220
211
  set mass(value) {
221
212
  __privateSet$2(this, _mass, value);
222
- __privateSet$2(this, _solverNeedsUpdate, true);
213
+ __privateSet$2(this, _needsUpdate, true);
223
214
  }
224
215
  get tension() {
225
216
  return __privateGet$2(this, _tension);
226
217
  }
227
218
  set tension(value) {
228
219
  __privateSet$2(this, _tension, value);
229
- __privateSet$2(this, _solverNeedsUpdate, true);
220
+ __privateSet$2(this, _needsUpdate, true);
230
221
  }
231
222
  get damping() {
232
223
  return __privateGet$2(this, _damping);
233
224
  }
234
225
  set damping(value) {
235
226
  __privateSet$2(this, _damping, value);
236
- __privateSet$2(this, _solverNeedsUpdate, true);
227
+ __privateSet$2(this, _needsUpdate, true);
237
228
  }
238
229
  get position() {
239
230
  return __privateGet$2(this, _state).position;
240
231
  }
241
232
  set position(value) {
242
233
  __privateGet$2(this, _state).position = value;
243
- __privateSet$2(this, _solverNeedsReset, true);
234
+ __privateSet$2(this, _needsReset, true);
244
235
  }
245
236
  get velocity() {
246
237
  return __privateGet$2(this, _state).velocity;
247
238
  }
248
239
  set velocity(value) {
249
240
  __privateGet$2(this, _state).velocity = value;
250
- __privateSet$2(this, _solverNeedsReset, true);
241
+ __privateSet$2(this, _needsReset, true);
251
242
  }
252
243
  get precision() {
253
244
  return __privateGet$2(this, _state).precision;
@@ -268,24 +259,31 @@ class Solver {
268
259
  return __privateGet$2(this, _damping) / this.criticalDamping;
269
260
  }
270
261
  tick(dt) {
271
- if (__privateGet$2(this, _solverNeedsUpdate)) {
262
+ if (__privateGet$2(this, _needsUpdate)) {
272
263
  __privateMethod(this, _updateSolver, updateSolver_fn).call(this);
273
- __privateSet$2(this, _solverNeedsUpdate, false);
264
+ __privateSet$2(this, _needsUpdate, false);
274
265
  }
275
- if (__privateGet$2(this, _solverNeedsReset)) {
266
+ if (__privateGet$2(this, _needsReset)) {
276
267
  __privateGet$2(this, _currentSolver).reset();
277
- __privateSet$2(this, _solverNeedsReset, false);
268
+ __privateSet$2(this, _needsReset, false);
278
269
  }
279
270
  const previousPosition = __privateGet$2(this, _state).position;
280
271
  const previousVelocity = __privateGet$2(this, _state).velocity;
272
+ const previousResting = __privateGet$2(this, _state).resting;
281
273
  __privateGet$2(this, _currentSolver).tick(dt);
282
274
  if (__privateGet$2(this, _state).position !== previousPosition || __privateGet$2(this, _state).velocity !== previousVelocity) {
283
275
  __privateGet$2(this, _emitter).emit("update");
284
276
  }
277
+ if (__privateGet$2(this, _state).resting !== previousResting) {
278
+ __privateGet$2(this, _emitter).emit("rest");
279
+ }
285
280
  }
286
281
  onUpdate(callback) {
287
282
  return __privateGet$2(this, _emitter).on("update", callback);
288
283
  }
284
+ onRest(callback) {
285
+ return __privateGet$2(this, _emitter).on("rest", callback);
286
+ }
289
287
  }
290
288
  _mass = new WeakMap();
291
289
  _tension = new WeakMap();
@@ -295,8 +293,8 @@ _underdampedSolver = new WeakMap();
295
293
  _criticallyDampedSolver = new WeakMap();
296
294
  _overdampedSolver = new WeakMap();
297
295
  _currentSolver = new WeakMap();
298
- _solverNeedsUpdate = new WeakMap();
299
- _solverNeedsReset = new WeakMap();
296
+ _needsUpdate = new WeakMap();
297
+ _needsReset = new WeakMap();
300
298
  _emitter = new WeakMap();
301
299
  _updateSolver = new WeakSet();
302
300
  updateSolver_fn = function() {
@@ -443,13 +441,13 @@ var __privateSet$1 = (obj, member, value, setter) => {
443
441
  setter ? setter.call(obj, value) : member.set(obj, value);
444
442
  return value;
445
443
  };
446
- var _target, _solver, _scheduler$1, _optimisticTarget;
444
+ var _target, _solver, _scheduler$1, _newTarget;
447
445
  class Spring {
448
446
  constructor(scheduler, options) {
449
447
  __privateAdd$1(this, _target, void 0);
450
448
  __privateAdd$1(this, _solver, void 0);
451
449
  __privateAdd$1(this, _scheduler$1, void 0);
452
- __privateAdd$1(this, _optimisticTarget, void 0);
450
+ __privateAdd$1(this, _newTarget, void 0);
453
451
  invariant(options.mass > 0, "Mass must be greater than 0");
454
452
  invariant(options.tension > 0, "Tension must be greater than 0");
455
453
  invariant(
@@ -470,25 +468,22 @@ class Spring {
470
468
  precision: options.precsiion ?? 2
471
469
  }));
472
470
  __privateSet$1(this, _scheduler$1, scheduler);
473
- __privateSet$1(this, _optimisticTarget, __privateGet$1(this, _target));
471
+ __privateSet$1(this, _newTarget, __privateGet$1(this, _target));
474
472
  if (!__privateGet$1(this, _solver).resting) {
475
473
  __privateGet$1(this, _scheduler$1).add(__privateGet$1(this, _solver));
476
474
  }
477
475
  }
478
476
  get target() {
479
- return __privateGet$1(this, _optimisticTarget);
477
+ return __privateGet$1(this, _target);
480
478
  }
481
479
  set target(value) {
482
- if (value !== __privateGet$1(this, _optimisticTarget)) {
483
- __privateSet$1(this, _optimisticTarget, value);
484
- __privateGet$1(this, _scheduler$1).once(() => {
485
- if (!__privateGet$1(this, _scheduler$1).has(__privateGet$1(this, _solver))) {
486
- __privateGet$1(this, _scheduler$1).add(__privateGet$1(this, _solver));
487
- }
488
- const currentValue = this.value;
489
- __privateSet$1(this, _target, __privateGet$1(this, _optimisticTarget));
490
- __privateGet$1(this, _solver).position = currentValue - __privateGet$1(this, _target);
491
- });
480
+ if (value !== __privateGet$1(this, _target)) {
481
+ if (!__privateGet$1(this, _scheduler$1).has(__privateGet$1(this, _solver))) {
482
+ __privateGet$1(this, _scheduler$1).add(__privateGet$1(this, _solver));
483
+ }
484
+ const currentValue = this.value;
485
+ __privateSet$1(this, _target, value);
486
+ __privateGet$1(this, _solver).position = currentValue - __privateGet$1(this, _target);
492
487
  }
493
488
  }
494
489
  get value() {
@@ -555,11 +550,14 @@ class Spring {
555
550
  onUpdate(callback) {
556
551
  return __privateGet$1(this, _solver).onUpdate(callback);
557
552
  }
553
+ onRest(callback) {
554
+ return __privateGet$1(this, _solver).onRest(callback);
555
+ }
558
556
  }
559
557
  _target = new WeakMap();
560
558
  _solver = new WeakMap();
561
559
  _scheduler$1 = new WeakMap();
562
- _optimisticTarget = new WeakMap();
560
+ _newTarget = new WeakMap();
563
561
 
564
562
  var __accessCheck = (obj, member, msg) => {
565
563
  if (!member.has(obj))
package/dist/loop.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { S as SpringSystem } from './shared/coily.86bacb03.cjs';
1
+ import { S as SpringSystem } from './shared/coily.87d79480.cjs';
2
2
 
3
3
  declare function start(system: SpringSystem): () => void;
4
4
 
package/dist/loop.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { S as SpringSystem } from './shared/coily.86bacb03.mjs';
1
+ import { S as SpringSystem } from './shared/coily.87d79480.mjs';
2
2
 
3
3
  declare function start(system: SpringSystem): () => void;
4
4
 
package/dist/loop.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { S as SpringSystem } from './shared/coily.86bacb03.js';
1
+ import { S as SpringSystem } from './shared/coily.87d79480.js';
2
2
 
3
3
  declare function start(system: SpringSystem): () => void;
4
4
 
@@ -27,16 +27,15 @@ declare class Solver {
27
27
  get dampingRatio(): number;
28
28
  tick(dt: number): void;
29
29
  onUpdate(callback: () => void): () => void;
30
+ onRest(callback: () => void): () => void;
30
31
  }
31
32
 
32
- type TickCallback = (delta: number) => void;
33
33
  declare class Scheduler {
34
34
  #private;
35
35
  tick(delta: number): void;
36
36
  add(solver: Solver): void;
37
37
  remove(solver: Solver): void;
38
38
  has(solver: Solver): boolean;
39
- once(callback: TickCallback): void;
40
39
  }
41
40
 
42
41
  interface SpringOptions$1 {
@@ -66,6 +65,7 @@ declare class Spring {
66
65
  set precision(value: number);
67
66
  get resting(): boolean;
68
67
  onUpdate(callback: () => void): () => void;
68
+ onRest(callback: () => void): () => void;
69
69
  }
70
70
 
71
71
  interface SpringOptions {
@@ -27,16 +27,15 @@ declare class Solver {
27
27
  get dampingRatio(): number;
28
28
  tick(dt: number): void;
29
29
  onUpdate(callback: () => void): () => void;
30
+ onRest(callback: () => void): () => void;
30
31
  }
31
32
 
32
- type TickCallback = (delta: number) => void;
33
33
  declare class Scheduler {
34
34
  #private;
35
35
  tick(delta: number): void;
36
36
  add(solver: Solver): void;
37
37
  remove(solver: Solver): void;
38
38
  has(solver: Solver): boolean;
39
- once(callback: TickCallback): void;
40
39
  }
41
40
 
42
41
  interface SpringOptions$1 {
@@ -66,6 +65,7 @@ declare class Spring {
66
65
  set precision(value: number);
67
66
  get resting(): boolean;
68
67
  onUpdate(callback: () => void): () => void;
68
+ onRest(callback: () => void): () => void;
69
69
  }
70
70
 
71
71
  interface SpringOptions {
@@ -27,16 +27,15 @@ declare class Solver {
27
27
  get dampingRatio(): number;
28
28
  tick(dt: number): void;
29
29
  onUpdate(callback: () => void): () => void;
30
+ onRest(callback: () => void): () => void;
30
31
  }
31
32
 
32
- type TickCallback = (delta: number) => void;
33
33
  declare class Scheduler {
34
34
  #private;
35
35
  tick(delta: number): void;
36
36
  add(solver: Solver): void;
37
37
  remove(solver: Solver): void;
38
38
  has(solver: Solver): boolean;
39
- once(callback: TickCallback): void;
40
39
  }
41
40
 
42
41
  interface SpringOptions$1 {
@@ -66,6 +65,7 @@ declare class Spring {
66
65
  set precision(value: number);
67
66
  get resting(): boolean;
68
67
  onUpdate(callback: () => void): () => void;
68
+ onRest(callback: () => void): () => void;
69
69
  }
70
70
 
71
71
  interface SpringOptions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coily",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "Simulate values using spring physics",
5
5
  "author": "Tim Morris <timthewebguy@gmail.com>",
6
6
  "homepage": "https://github.com/tkofh/coily#readme",
@@ -32,10 +32,6 @@
32
32
  "type": "git",
33
33
  "url": "git+https://github.com/tkofh/coily.git"
34
34
  },
35
- "scripts": {
36
- "build": "unbuild",
37
- "prepublish": "bun run build"
38
- },
39
35
  "bugs": {
40
36
  "url": "https://github.com/tkofh/coily/issues"
41
37
  },
@@ -45,8 +41,12 @@
45
41
  "unbuild": "^2.0.0",
46
42
  "vitest": "^1.3.1"
47
43
  },
48
- "gitHead": "96019bee6135f93006c3fd52d23846afd6271c66",
49
44
  "dependencies": {
50
45
  "tickloop": "^0.5.0"
46
+ },
47
+ "scripts": {
48
+ "build": "unbuild",
49
+ "test": "vitest",
50
+ "prepublish": "bun run build"
51
51
  }
52
- }
52
+ }