@flighthq/skeleton2d 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/skeleton2d`. The `@f
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/skeleton2d@0.5.1-next.903.f434bc2](https://github.com/flighthq/flight/tree/f434bc233778d75aeea61995df3a8cfaec459a85/packages/skeleton2d)
17
- - [License](https://github.com/flighthq/flight/blob/f434bc233778d75aeea61995df3a8cfaec459a85/LICENSE.md)
16
+ - [Source for @flighthq/skeleton2d@0.5.1-next.905.5fbf787](https://github.com/flighthq/flight/tree/5fbf7874064c384307542d68b4dcb6a895ff0dcf/packages/skeleton2d)
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/skeleton2d",
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,15 +38,15 @@
38
38
  "clean:dist": "tsx ../../scripts/clean-package-dist.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@flighthq/animation": "0.5.1-next.903.f434bc2",
42
- "@flighthq/entity": "0.5.1-next.903.f434bc2",
43
- "@flighthq/geometry": "0.5.1-next.903.f434bc2",
44
- "@flighthq/log": "0.5.1-next.903.f434bc2",
45
- "@flighthq/node": "0.5.1-next.903.f434bc2",
46
- "@flighthq/math": "0.5.1-next.903.f434bc2",
47
- "@flighthq/path": "0.5.1-next.903.f434bc2",
48
- "@flighthq/registry": "0.5.1-next.903.f434bc2",
49
- "@flighthq/types": "0.5.1-next.903.f434bc2"
41
+ "@flighthq/animation": "0.5.1-next.905.5fbf787",
42
+ "@flighthq/entity": "0.5.1-next.905.5fbf787",
43
+ "@flighthq/geometry": "0.5.1-next.905.5fbf787",
44
+ "@flighthq/log": "0.5.1-next.905.5fbf787",
45
+ "@flighthq/node": "0.5.1-next.905.5fbf787",
46
+ "@flighthq/math": "0.5.1-next.905.5fbf787",
47
+ "@flighthq/path": "0.5.1-next.905.5fbf787",
48
+ "@flighthq/registry": "0.5.1-next.905.5fbf787",
49
+ "@flighthq/types": "0.5.1-next.905.5fbf787"
50
50
  },
51
51
  "devDependencies": {
52
52
  "typescript": "^5.3.0"
@@ -15,6 +15,7 @@ import {
15
15
  getSkeleton2DBoneIndexByName,
16
16
  getSkeleton2DBoneWorldMatrix,
17
17
  getSkeleton2DSkin,
18
+ initializeSkeleton2D,
18
19
  setSkeleton2DBindPose,
19
20
  setSkeleton2DSkin,
20
21
  validateSkeleton2D,
@@ -414,6 +415,12 @@ describe('getSkeleton2DSkin', () => {
414
415
  });
415
416
  });
416
417
 
418
+ describe('initializeSkeleton2D', () => {
419
+ it('is the construction initializer of createSkeleton2D', () => {
420
+ expect(typeof initializeSkeleton2D).toBe('function');
421
+ });
422
+ });
423
+
417
424
  describe('setSkeleton2DBindPose', () => {
418
425
  it('captures the inverse of the current world so the palette is identity at bind', () => {
419
426
  const s = createSkeleton2D([makeBone({ x: 4, rotation: 60, scaleX: 2 })]);
@@ -470,24 +477,6 @@ describe('setSkeleton2DSkin', () => {
470
477
  });
471
478
  });
472
479
 
473
- describe('validateSkeleton2D', () => {
474
- it('returns null for a valid parent-before-child skeleton', () => {
475
- const s = createSkeleton2D([makeBone(), makeBone({ parentIndex: 0 })]);
476
- expect(validateSkeleton2D(s)).toBeNull();
477
- });
478
-
479
- it('reports a child whose parentIndex is not before it', () => {
480
- const s = createSkeleton2D([makeBone({ parentIndex: 1 }), makeBone({ parentIndex: 0 })]);
481
- expect(validateSkeleton2D(s)).toContain('parent-before-child');
482
- });
483
-
484
- it('reports a mis-sized buffer', () => {
485
- const s = createSkeleton2D([makeBone()]);
486
- s.worldMatrices = new Float32Array(3);
487
- expect(validateSkeleton2D(s)).toContain('worldMatrices');
488
- });
489
- });
490
-
491
480
  // A minimal slot for wardrobe tests: no attachment until a skin supplies one.
492
481
  function testSlot(name: string, boneIndex: number): Slot2D {
493
482
  return { attachment: null, boneIndex, color: 0xffffffff, name };
@@ -506,3 +495,20 @@ function testRegion(name: string): RegionAttachment2D {
506
495
  out.y = 0;
507
496
  return finishEntity(out) as RegionAttachment2D;
508
497
  }
498
+ describe('validateSkeleton2D', () => {
499
+ it('returns null for a valid parent-before-child skeleton', () => {
500
+ const s = createSkeleton2D([makeBone(), makeBone({ parentIndex: 0 })]);
501
+ expect(validateSkeleton2D(s)).toBeNull();
502
+ });
503
+
504
+ it('reports a child whose parentIndex is not before it', () => {
505
+ const s = createSkeleton2D([makeBone({ parentIndex: 1 }), makeBone({ parentIndex: 0 })]);
506
+ expect(validateSkeleton2D(s)).toContain('parent-before-child');
507
+ });
508
+
509
+ it('reports a mis-sized buffer', () => {
510
+ const s = createSkeleton2D([makeBone()]);
511
+ s.worldMatrices = new Float32Array(3);
512
+ expect(validateSkeleton2D(s)).toContain('worldMatrices');
513
+ });
514
+ });
@@ -12,10 +12,12 @@ import { applyAnimationClipToSkeleton2D } from './applyAnimationClipToSkeleton2D
12
12
  import { cloneSkeleton2D, createSkeleton2D } from './skeleton2d';
13
13
  import {
14
14
  createSkeleton2DBoneAnimationTarget,
15
- findSkeleton2DStepKeyframe,
16
15
  createSkeleton2DSlotAnimationTarget,
16
+ findSkeleton2DStepKeyframe,
17
17
  getSkeleton2DAnimationTargetBinder,
18
18
  getSkeleton2DAnimationTargetBinderKinds,
19
+ initializeSkeleton2DBoneAnimationTarget,
20
+ initializeSkeleton2DSlotAnimationTarget,
19
21
  registerSkeleton2DAnimationTargetBinder,
20
22
  unregisterSkeleton2DAnimationTargetBinder,
21
23
  } from './skeleton2dAnimationTarget';
@@ -94,6 +96,41 @@ describe('getSkeleton2DAnimationTargetBinderKinds', () => {
94
96
  });
95
97
  });
96
98
 
99
+ describe('initializeSkeleton2DBoneAnimationTarget', () => {
100
+ it('is the construction initializer of createSkeleton2DBoneAnimationTarget', () => {
101
+ expect(typeof initializeSkeleton2DBoneAnimationTarget).toBe('function');
102
+ });
103
+ });
104
+
105
+ describe('initializeSkeleton2DSlotAnimationTarget', () => {
106
+ it('is the construction initializer of createSkeleton2DSlotAnimationTarget', () => {
107
+ expect(typeof initializeSkeleton2DSlotAnimationTarget).toBe('function');
108
+ });
109
+ });
110
+
111
+ function makeBone(): Bone2D {
112
+ return {
113
+ length: 0,
114
+ name: null,
115
+ parentIndex: -1,
116
+ rotation: 0,
117
+ scaleX: 1,
118
+ scaleY: 1,
119
+ shearX: 0,
120
+ shearY: 0,
121
+ transformMode: TransformMode2D.Normal,
122
+ x: 0,
123
+ y: 0,
124
+ };
125
+ }
126
+
127
+ function makeSkeleton(): Skeleton2D {
128
+ return createSkeleton2D([makeBone()], [{ attachment: null, boneIndex: 0, color: 0xffffffff, name: 's' }]);
129
+ }
130
+
131
+ function track(times: number[], values: number[], components: number) {
132
+ return createAnimationTrack({ components, times, values });
133
+ }
97
134
  describe('registerSkeleton2DAnimationTargetBinder', () => {
98
135
  it('binds a family this package does not own from the same single pass as bones', () => {
99
136
  const seen: number[] = [];
@@ -153,27 +190,3 @@ describe('unregisterSkeleton2DAnimationTargetBinder', () => {
153
190
  expect(getSkeleton2DAnimationTargetBinder('acme.RopeTarget')).toBeNull();
154
191
  });
155
192
  });
156
-
157
- function makeBone(): Bone2D {
158
- return {
159
- length: 0,
160
- name: null,
161
- parentIndex: -1,
162
- rotation: 0,
163
- scaleX: 1,
164
- scaleY: 1,
165
- shearX: 0,
166
- shearY: 0,
167
- transformMode: TransformMode2D.Normal,
168
- x: 0,
169
- y: 0,
170
- };
171
- }
172
-
173
- function makeSkeleton(): Skeleton2D {
174
- return createSkeleton2D([makeBone()], [{ attachment: null, boneIndex: 0, color: 0xffffffff, name: 's' }]);
175
- }
176
-
177
- function track(times: number[], values: number[], components: number) {
178
- return createAnimationTrack({ components, times, values });
179
- }
@@ -12,6 +12,7 @@ import { getSkeleton2DAnimationTargetBinder } from './skeleton2dAnimationTarget'
12
12
  import {
13
13
  createSkeleton2DDrawOrderAnimationTarget,
14
14
  createSkeleton2DDrawOrderChannel,
15
+ initializeSkeleton2DDrawOrderAnimationTarget,
15
16
  registerSkeleton2DDrawOrderAnimationBinder,
16
17
  unregisterSkeleton2DDrawOrderAnimationBinder,
17
18
  } from './skeleton2dDrawOrderTarget';
@@ -83,6 +84,12 @@ describe('createSkeleton2DDrawOrderChannel', () => {
83
84
  });
84
85
  });
85
86
 
87
+ describe('initializeSkeleton2DDrawOrderAnimationTarget', () => {
88
+ it('is the construction initializer of createSkeleton2DDrawOrderAnimationTarget', () => {
89
+ expect(typeof initializeSkeleton2DDrawOrderAnimationTarget).toBe('function');
90
+ });
91
+ });
92
+
86
93
  describe('registerSkeleton2DDrawOrderAnimationBinder', () => {
87
94
  it('claims nothing until called, so an unused family shakes out', () => {
88
95
  // Bone and slot bind without registration because posing a rig IS the package; draw order is the
@@ -188,15 +195,6 @@ describe('registerSkeleton2DDrawOrderAnimationBinder', () => {
188
195
  });
189
196
  });
190
197
 
191
- describe('unregisterSkeleton2DDrawOrderAnimationBinder', () => {
192
- it('releases the kind again', () => {
193
- registerSkeleton2DDrawOrderAnimationBinder();
194
- unregisterSkeleton2DDrawOrderAnimationBinder();
195
-
196
- expect(getSkeleton2DAnimationTargetBinder('Skeleton2D.DrawOrderTarget')).toBeNull();
197
- });
198
- });
199
-
200
198
  function rig(count: number): { list: NodeOrderList; nodes: Node[]; parent: Node } {
201
199
  const parent = createNode(TEST_NODE_KIND);
202
200
  const nodes = Array.from({ length: count }, () => createNode(TEST_NODE_KIND));
@@ -233,3 +231,11 @@ function track(
233
231
 
234
232
  // Ordering is kind-agnostic — it permutes children, whatever they draw.
235
233
  const TEST_NODE_KIND = 'Skeleton2DDrawOrderTestNode';
234
+ describe('unregisterSkeleton2DDrawOrderAnimationBinder', () => {
235
+ it('releases the kind again', () => {
236
+ registerSkeleton2DDrawOrderAnimationBinder();
237
+ unregisterSkeleton2DDrawOrderAnimationBinder();
238
+
239
+ expect(getSkeleton2DAnimationTargetBinder('Skeleton2D.DrawOrderTarget')).toBeNull();
240
+ });
241
+ });
@@ -1,6 +1,6 @@
1
1
  import { EntityRuntimeKey } from '@flighthq/types/contract';
2
2
 
3
- import { createSkin2D } from './skin2D';
3
+ import { createSkin2D, initializeSkin2D } from './skin2D';
4
4
 
5
5
  describe('createSkin2D', () => {
6
6
  it('adopts the streams it is given rather than copying them', () => {
@@ -15,3 +15,8 @@ describe('createSkin2D', () => {
15
15
  expect(EntityRuntimeKey in createSkin2D(new Uint16Array([1]), new Float32Array([0, 1, 0, 1]))).toBe(true);
16
16
  });
17
17
  });
18
+ describe('initializeSkin2D', () => {
19
+ it('is the construction initializer of createSkin2D', () => {
20
+ expect(typeof initializeSkin2D).toBe('function');
21
+ });
22
+ });