@flighthq/spring 0.5.1-next.903.f434bc2 → 0.5.1-next.905.5fbf787

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/README.md CHANGED
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/spring`. The `@fligh
13
13
  This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
14
14
 
15
15
  - [Flight project](https://github.com/flighthq/flight)
16
- - [Source for @flighthq/spring@0.5.1-next.903.f434bc2](https://github.com/flighthq/flight/tree/f434bc233778d75aeea61995df3a8cfaec459a85/packages/spring)
17
- - [License](https://github.com/flighthq/flight/blob/f434bc233778d75aeea61995df3a8cfaec459a85/LICENSE.md)
16
+ - [Source for @flighthq/spring@0.5.1-next.905.5fbf787](https://github.com/flighthq/flight/tree/5fbf7874064c384307542d68b4dcb6a895ff0dcf/packages/spring)
17
+ - [License](https://github.com/flighthq/flight/blob/5fbf7874064c384307542d68b4dcb6a895ff0dcf/LICENSE.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flighthq/spring",
3
- "version": "0.5.1-next.903.f434bc2",
3
+ "version": "0.5.1-next.905.5fbf787",
4
4
  "author": "Joshua Granick and other contributors",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,9 +38,9 @@
38
38
  "clean:dist": "tsx ../../scripts/clean-package-dist.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@flighthq/entity": "0.5.1-next.903.f434bc2",
42
- "@flighthq/math": "0.5.1-next.903.f434bc2",
43
- "@flighthq/types": "0.5.1-next.903.f434bc2"
41
+ "@flighthq/entity": "0.5.1-next.905.5fbf787",
42
+ "@flighthq/math": "0.5.1-next.905.5fbf787",
43
+ "@flighthq/types": "0.5.1-next.905.5fbf787"
44
44
  },
45
45
  "devDependencies": {
46
46
  "typescript": "^5.3.0"
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  applySpringImpulse,
3
3
  createSpring,
4
+ initializeSpring,
4
5
  isSpringSettled,
5
6
  resetSpring,
6
7
  updateSpring,
@@ -33,6 +34,11 @@ describe('createSpring', () => {
33
34
  expect(spring.velocity).toBe(-2);
34
35
  });
35
36
  });
37
+ describe('initializeSpring', () => {
38
+ it('is the construction initializer of createSpring', () => {
39
+ expect(typeof initializeSpring).toBe('function');
40
+ });
41
+ });
36
42
  describe('isSpringSettled', () => {
37
43
  it('is false while the spring is still moving toward the target', () => {
38
44
  const spring = createSpring(0);
@@ -80,6 +86,7 @@ describe('resetSpring', () => {
80
86
  expect(spring.velocity).toBe(12);
81
87
  });
82
88
  });
89
+
83
90
  describe('updateSpring', () => {
84
91
  it('converges monotonically to the target with no overshoot when critically damped', () => {
85
92
  const spring = createSpring(0);
@@ -211,7 +218,6 @@ describe('updateSpring', () => {
211
218
  expect(spring.velocity).not.toBe(2);
212
219
  });
213
220
  });
214
-
215
221
  describe('updateSpringAngle', () => {
216
222
  it('takes the shortest path across a degree seam in both directions', () => {
217
223
  const config = createSpringConfig(2, 1);
@@ -1,7 +1,14 @@
1
1
  import { EntityRuntimeKey } from '@flighthq/types/contract';
2
2
  import { describe, expect, it } from 'vitest';
3
3
 
4
- import { applySpringImpulse2D, createSpring2D, isSpring2DSettled, resetSpring2D, updateSpring2D } from './spring2D';
4
+ import {
5
+ applySpringImpulse2D,
6
+ createSpring2D,
7
+ initializeSpring2D,
8
+ isSpring2DSettled,
9
+ resetSpring2D,
10
+ updateSpring2D,
11
+ } from './spring2D';
5
12
  import { createSpringConfig } from './springConfig';
6
13
 
7
14
  describe('applySpringImpulse2D', () => {
@@ -36,6 +43,12 @@ describe('createSpring2D', () => {
36
43
  });
37
44
  });
38
45
 
46
+ describe('initializeSpring2D', () => {
47
+ it('is the construction initializer of createSpring2D', () => {
48
+ expect(typeof initializeSpring2D).toBe('function');
49
+ });
50
+ });
51
+
39
52
  describe('isSpring2DSettled', () => {
40
53
  it('is false until both axes rest at their targets', () => {
41
54
  const spring = createSpring2D(0, 0);
@@ -63,7 +76,6 @@ describe('resetSpring2D', () => {
63
76
  expect(spring.y).toMatchObject({ value: -20, velocity: 0 });
64
77
  });
65
78
  });
66
-
67
79
  describe('updateSpring2D', () => {
68
80
  it('moves both components toward their targets', () => {
69
81
  const spring = createSpring2D(0, 0);
@@ -1,7 +1,14 @@
1
1
  import { EntityRuntimeKey } from '@flighthq/types/contract';
2
2
  import { describe, expect, it } from 'vitest';
3
3
 
4
- import { applySpringImpulse3D, createSpring3D, isSpring3DSettled, resetSpring3D, updateSpring3D } from './spring3D';
4
+ import {
5
+ applySpringImpulse3D,
6
+ createSpring3D,
7
+ initializeSpring3D,
8
+ isSpring3DSettled,
9
+ resetSpring3D,
10
+ updateSpring3D,
11
+ } from './spring3D';
5
12
  import { createSpringConfig } from './springConfig';
6
13
 
7
14
  describe('applySpringImpulse3D', () => {
@@ -42,6 +49,12 @@ describe('createSpring3D', () => {
42
49
  });
43
50
  });
44
51
 
52
+ describe('initializeSpring3D', () => {
53
+ it('is the construction initializer of createSpring3D', () => {
54
+ expect(typeof initializeSpring3D).toBe('function');
55
+ });
56
+ });
57
+
45
58
  describe('isSpring3DSettled', () => {
46
59
  it('is false until all three axes rest at their targets', () => {
47
60
  const spring = createSpring3D(0, 0, 0);
@@ -73,7 +86,6 @@ describe('resetSpring3D', () => {
73
86
  expect(spring.z).toMatchObject({ value: -30, velocity: 0 });
74
87
  });
75
88
  });
76
-
77
89
  describe('updateSpring3D', () => {
78
90
  it('moves all three components toward their targets', () => {
79
91
  const spring = createSpring3D(0, 0, 0);
@@ -2,11 +2,13 @@ import { TAU } from '@flighthq/math/contract';
2
2
  import { describe, expect, it } from 'vitest';
3
3
 
4
4
  import {
5
- createSpringConfig,
6
- createSpringConfigFromPhysical,
7
5
  SpringPresetBouncy,
8
6
  SpringPresetGentle,
9
7
  SpringPresetStiff,
8
+ createSpringConfig,
9
+ createSpringConfigFromPhysical,
10
+ initializeSpringConfig,
11
+ initializeSpringConfigFromPhysical,
10
12
  } from './springConfig';
11
13
 
12
14
  describe('createSpringConfig', () => {
@@ -32,6 +34,17 @@ describe('createSpringConfigFromPhysical', () => {
32
34
  });
33
35
  });
34
36
 
37
+ describe('initializeSpringConfig', () => {
38
+ it('is the construction initializer of createSpringConfig', () => {
39
+ expect(typeof initializeSpringConfig).toBe('function');
40
+ });
41
+ });
42
+ describe('initializeSpringConfigFromPhysical', () => {
43
+ it('is the construction initializer of createSpringConfigFromPhysical', () => {
44
+ expect(typeof initializeSpringConfigFromPhysical).toBe('function');
45
+ });
46
+ });
47
+
35
48
  describe('spring presets', () => {
36
49
  it('exports frozen plain-data configs that can be customized by spreading', () => {
37
50
  expect(Object.isFrozen(SpringPresetBouncy)).toBe(true);