@flighthq/skeleton2d 0.5.1-next.3302.76ece6b → 0.5.1-next.4304.322dc96

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.3302.76ece6b](https://github.com/flighthq/flight/tree/76ece6bee38e3d07816f341b7f017bfcec3e8e29/packages/skeleton2d)
17
- - [License](https://github.com/flighthq/flight/blob/76ece6bee38e3d07816f341b7f017bfcec3e8e29/LICENSE.md)
16
+ - [Source for @flighthq/skeleton2d@0.5.1-next.4304.322dc96](https://github.com/flighthq/flight/tree/322dc963fc5a404a31bc0cc612e906de504ea024/packages/skeleton2d)
17
+ - [License](https://github.com/flighthq/flight/blob/322dc963fc5a404a31bc0cc612e906de504ea024/LICENSE.md)
@@ -1,3 +1,4 @@
1
+ import type { LogState } from '@flighthq/log/contract';
1
2
  export declare function disableSkeleton2DGuards(): void;
2
3
  /**
3
4
  * Installs the caller-facing skeleton guards (opt-in, dev-only). Idempotent.
@@ -17,6 +18,8 @@ export declare function disableSkeleton2DGuards(): void;
17
18
  * The messages live here rather than beside the code that knows the fact, so a shipped build that never
18
19
  * imports this module carries neither them nor `@flighthq/log`. Every case also has a `has*`/`explain*`
19
20
  * query for a caller that wants the fact as data instead of a log line.
21
+ *
22
+ * Warnings go to the caller-owned `logState`, stamped with `nowMs`, the caller's clock reading at enable.
20
23
  */
21
- export declare function enableSkeleton2DGuards(): void;
24
+ export declare function enableSkeleton2DGuards(logState: LogState, nowMs: number): void;
22
25
  //# sourceMappingURL=enableSkeleton2DGuards.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"enableSkeleton2DGuards.d.ts","sourceRoot":"","sources":["../src/enableSkeleton2DGuards.ts"],"names":[],"mappings":"AAOA,wBAAgB,uBAAuB,IAAI,IAAI,CAG9C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAG7C"}
1
+ {"version":3,"file":"enableSkeleton2DGuards.d.ts","sourceRoot":"","sources":["../src/enableSkeleton2DGuards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAQvD,wBAAgB,uBAAuB,IAAI,IAAI,CAG9C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAG9E"}
@@ -24,18 +24,20 @@ export function disableSkeleton2DGuards() {
24
24
  * The messages live here rather than beside the code that knows the fact, so a shipped build that never
25
25
  * imports this module carries neither them nor `@flighthq/log`. Every case also has a `has*`/`explain*`
26
26
  * query for a caller that wants the fact as data instead of a log line.
27
+ *
28
+ * Warnings go to the caller-owned `logState`, stamped with `nowMs`, the caller's clock reading at enable.
27
29
  */
28
- export function enableSkeleton2DGuards() {
29
- setSkeleton2DCoercedInterpolationGuard(warnOnCoercedInterpolation);
30
- setSkeleton2DDeformLengthGuard(warnOnDeformLengthMismatch);
30
+ export function enableSkeleton2DGuards(logState, nowMs) {
31
+ setSkeleton2DCoercedInterpolationGuard((report) => warnOnCoercedInterpolation(logState, nowMs, report));
32
+ setSkeleton2DDeformLengthGuard((report) => warnOnDeformLengthMismatch(logState, nowMs, report));
31
33
  }
32
- function warnOnCoercedInterpolation(report) {
33
- logOnce(`skeleton2d:coerced-interpolation:${report.subject}`, LogLevel.Warn, {
34
+ function warnOnCoercedInterpolation(logState, nowMs, report) {
35
+ logOnce(logState, nowMs, `skeleton2d:coerced-interpolation:${report.subject}`, LogLevel.Warn, {
34
36
  message: `A ${report.subject} channel states '${report.stated}' interpolation but is walked as '${report.applied}'. The value it carries cannot be blended — an attachment index between two table entries names art nobody authored, and a draw order between two orderings gives fractional sort keys — so the step is forced and the stated easing has no effect. Author the track as '${report.applied}' to say what actually happens, or drive a blendable property instead.`,
35
37
  }, 'skeleton2d');
36
38
  }
37
- function warnOnDeformLengthMismatch(report) {
38
- logOnce(`skeleton2d:deform-length:${report.subject}`, LogLevel.Warn, {
39
+ function warnOnDeformLengthMismatch(logState, nowMs, report) {
40
+ logOnce(logState, nowMs, `skeleton2d:deform-length:${report.subject}`, LogLevel.Warn, {
39
41
  message: `Deform offsets on '${report.subject}' carry ${report.offsets} values but the vertex stream they address needs ${report.addressed}. The offsets are ignored rather than partly applied: a stream of the wrong length has no correct prefix, so consuming what fits would deform some vertices and silently leave the rest in their setup pose. Re-export the attachment, or check that the deform timeline belongs to this attachment.`,
40
42
  }, 'skeleton2d');
41
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"enableSkeleton2DGuards.js","sourceRoot":"","sources":["../src/enableSkeleton2DGuards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,sCAAsC,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAE/G,6DAA6D;AAC7D,MAAM,UAAU,uBAAuB;IACrC,sCAAsC,CAAC,IAAI,CAAC,CAAC;IAC7C,8BAA8B,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,sBAAsB;IACpC,sCAAsC,CAAC,0BAA0B,CAAC,CAAC;IACnE,8BAA8B,CAAC,0BAA0B,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,0BAA0B,CAAC,MAAgD;IAClF,OAAO,CACL,oCAAoC,MAAM,CAAC,OAAO,EAAE,EACpD,QAAQ,CAAC,IAAI,EACb;QACE,O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EACL,oCAAoC,MAAM,CAAC,OAAO,EAAE,EACpD,QAAQ,CAAC,IAAI,EACb;QACE,OAAO,EAAE,KAAK,MAAM,CAAC,OAAO,oBAAoB,MAAM,CAAC,MAAM,qCAAqC,MAAM,CAAC,OAAO,4QAA4Q,MAAM,CAAC,OAAO,wEAAwE;KACnd,EACD,YAAY,CACb,CAAC;AACJ,CAAC;AAED,SAAS,0BAA0B,CACjC,QAAkB,EAClB,KAAa,EACb,MAAgD;IAEhD,OAAO,CACL,QAAQ,EACR,KAAK,EACL,4BAA4B,MAAM,CAAC,OAAO,EAAE,EAC5C,QAAQ,CAAC,IAAI,EACb;QACE,OAAO,EAAE,sBAAsB,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC,OAAO,oDAAoD,MAAM,CAAC,SAAS,sSAAsS;KACjb,EACD,YAAY,CACb,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flighthq/skeleton2d",
3
- "version": "0.5.1-next.3302.76ece6b",
3
+ "version": "0.5.1-next.4304.322dc96",
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.3302.76ece6b",
42
- "@flighthq/entity": "0.5.1-next.3302.76ece6b",
43
- "@flighthq/geometry": "0.5.1-next.3302.76ece6b",
44
- "@flighthq/log": "0.5.1-next.3302.76ece6b",
45
- "@flighthq/node": "0.5.1-next.3302.76ece6b",
46
- "@flighthq/math": "0.5.1-next.3302.76ece6b",
47
- "@flighthq/path": "0.5.1-next.3302.76ece6b",
48
- "@flighthq/registry": "0.5.1-next.3302.76ece6b",
49
- "@flighthq/types": "0.5.1-next.3302.76ece6b"
41
+ "@flighthq/animation": "0.5.1-next.4304.322dc96",
42
+ "@flighthq/entity": "0.5.1-next.4304.322dc96",
43
+ "@flighthq/geometry": "0.5.1-next.4304.322dc96",
44
+ "@flighthq/log": "0.5.1-next.4304.322dc96",
45
+ "@flighthq/node": "0.5.1-next.4304.322dc96",
46
+ "@flighthq/math": "0.5.1-next.4304.322dc96",
47
+ "@flighthq/path": "0.5.1-next.4304.322dc96",
48
+ "@flighthq/registry": "0.5.1-next.4304.322dc96",
49
+ "@flighthq/types": "0.5.1-next.4304.322dc96"
50
50
  },
51
51
  "devDependencies": {
52
52
  "typescript": "^5.3.0"
@@ -1,6 +1,7 @@
1
1
  import { allocateEntity, finishEntity } from '@flighthq/entity/contract';
2
+ import { createPath } from '@flighthq/path/contract';
2
3
  import type { Bone2D, Path, PathAttachment2D, Skeleton2DDeformLengthMismatch, Skin2D } from '@flighthq/types/contract';
3
- import { EntityRuntimeKey, PathAttachment2DKind, PathCommand, TransformMode2D } from '@flighthq/types/contract';
4
+ import { PathAttachment2DKind, PathCommand, TransformMode2D } from '@flighthq/types/contract';
4
5
  import { describe, expect, it } from 'vitest';
5
6
 
6
7
  import { deformSkeleton2DPathAttachment } from './deformPathAttachment2D.ts';
@@ -26,7 +27,7 @@ function makeBone(overrides: Partial<Bone2D> = {}): Bone2D {
26
27
  }
27
28
 
28
29
  function emptyPath(): Path {
29
- return { [EntityRuntimeKey]: undefined, commands: [], data: [], winding: 'nonZero' };
30
+ return createPath('nonZero');
30
31
  }
31
32
 
32
33
  function weightedPath(skin: Skin2D, pointCount: number, commands: number[]): PathAttachment2D {
@@ -1,28 +1,29 @@
1
- import { clearLogOnceKeys, setLogSink } from '@flighthq/log/contract';
1
+ import type { LogState } from '@flighthq/log/contract';
2
+ import { createLogState, setLogSink } from '@flighthq/log/contract';
2
3
  import type { LogEntry } from '@flighthq/types/contract';
3
4
 
4
5
  import { disableSkeleton2DGuards, enableSkeleton2DGuards } from './enableSkeleton2DGuards.ts';
5
6
  import { reportSkeleton2DCoercedInterpolation, reportSkeleton2DDeformLengthMismatch } from './skeleton2dGuards.ts';
6
7
 
7
- // Each case uses its own subject string. `logOnce` keys are process-wide with no reset, which is the
8
- // behaviour a shipped app wants — one warning per subject, not one per frame — but it means two cases
9
- // sharing a subject would have the second silently suppressed by the first.
8
+ // Each case uses its own subject string. `logOnce` keys last for the LogState's lifetime, which is the
9
+ // behaviour a shipped app wants — one warning per subject, not one per frame. Every case gets a fresh
10
+ // state here, so no case can be silently suppressed by another.
10
11
  const entries: LogEntry[] = [];
12
+ let logState: LogState;
11
13
 
12
14
  beforeEach(() => {
13
- clearLogOnceKeys();
15
+ logState = createLogState();
14
16
  entries.length = 0;
15
- setLogSink((entry) => void entries.push(entry));
17
+ setLogSink(logState, (entry) => void entries.push(entry));
16
18
  });
17
19
 
18
20
  afterEach(() => {
19
21
  disableSkeleton2DGuards();
20
- setLogSink(null);
21
22
  });
22
23
 
23
24
  describe('disableSkeleton2DGuards', () => {
24
25
  it('silences both cases again', () => {
25
- enableSkeleton2DGuards();
26
+ enableSkeleton2DGuards(logState, 0);
26
27
  disableSkeleton2DGuards();
27
28
 
28
29
  reportSkeleton2DCoercedInterpolation('DisabledChannel', 'Linear', 'Step');
@@ -40,7 +41,7 @@ describe('enableSkeleton2DGuards', () => {
40
41
  });
41
42
 
42
43
  it('names what was stated and what actually happens to a coerced channel', () => {
43
- enableSkeleton2DGuards();
44
+ enableSkeleton2DGuards(logState, 0);
44
45
 
45
46
  reportSkeleton2DCoercedInterpolation('StatedAndApplied', 'Linear', 'Step');
46
47
 
@@ -52,7 +53,7 @@ describe('enableSkeleton2DGuards', () => {
52
53
  });
53
54
 
54
55
  it('reports both lengths on a deform mismatch, and why nothing was applied', () => {
55
- enableSkeleton2DGuards();
56
+ enableSkeleton2DGuards(logState, 0);
56
57
 
57
58
  reportSkeleton2DDeformLengthMismatch('BothLengths', 6, 8);
58
59
 
@@ -63,7 +64,7 @@ describe('enableSkeleton2DGuards', () => {
63
64
  });
64
65
 
65
66
  it('keys the coercion message per subject, so two families both get heard', () => {
66
- enableSkeleton2DGuards();
67
+ enableSkeleton2DGuards(logState, 0);
67
68
 
68
69
  reportSkeleton2DCoercedInterpolation('PerSubjectOne', 'Linear', 'Step');
69
70
  reportSkeleton2DCoercedInterpolation('PerSubjectTwo', 'Linear', 'Step');
@@ -74,8 +75,8 @@ describe('enableSkeleton2DGuards', () => {
74
75
  });
75
76
 
76
77
  it('installs one guard however many times it is enabled', () => {
77
- enableSkeleton2DGuards();
78
- enableSkeleton2DGuards();
78
+ enableSkeleton2DGuards(logState, 0);
79
+ enableSkeleton2DGuards(logState, 0);
79
80
 
80
81
  reportSkeleton2DDeformLengthMismatch('EnabledTwice', 6, 8);
81
82