@flighthq/node 0.2.1-next.841.373388f → 0.3.0-edge.1516.1b4fb2b

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.
Files changed (82) hide show
  1. package/dist/boundsRectangle.d.ts +12 -1
  2. package/dist/boundsRectangle.d.ts.map +1 -1
  3. package/dist/boundsRectangle.js +51 -5
  4. package/dist/boundsRectangle.js.map +1 -1
  5. package/dist/contract.d.ts +18 -0
  6. package/dist/contract.d.ts.map +1 -0
  7. package/dist/contract.js +18 -0
  8. package/dist/contract.js.map +1 -0
  9. package/dist/hasAppearance.d.ts +1 -1
  10. package/dist/hasAppearance.d.ts.map +1 -1
  11. package/dist/hasBlendMode.d.ts +1 -1
  12. package/dist/hasBlendMode.d.ts.map +1 -1
  13. package/dist/hasBoundsRectangle.d.ts +2 -2
  14. package/dist/hasBoundsRectangle.d.ts.map +1 -1
  15. package/dist/hasBoundsRectangle.js +1 -0
  16. package/dist/hasBoundsRectangle.js.map +1 -1
  17. package/dist/hasClip.d.ts +1 -1
  18. package/dist/hasClip.d.ts.map +1 -1
  19. package/dist/hasMaterial.d.ts +1 -1
  20. package/dist/hasMaterial.d.ts.map +1 -1
  21. package/dist/hasTransform2d.d.ts +1 -1
  22. package/dist/hasTransform2d.d.ts.map +1 -1
  23. package/dist/hasTransform3d.d.ts +1 -1
  24. package/dist/hasTransform3d.d.ts.map +1 -1
  25. package/dist/hasTransform3d.js +1 -1
  26. package/dist/hasTransform3d.js.map +1 -1
  27. package/dist/hierarchy.d.ts +1 -1
  28. package/dist/hierarchy.d.ts.map +1 -1
  29. package/dist/hierarchy.js +2 -2
  30. package/dist/hierarchy.js.map +1 -1
  31. package/dist/index.d.ts +1 -16
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +1 -16
  34. package/dist/index.js.map +1 -1
  35. package/dist/node.d.ts +1 -1
  36. package/dist/node.d.ts.map +1 -1
  37. package/dist/node.js +6 -5
  38. package/dist/node.js.map +1 -1
  39. package/dist/nodeColorAdjustment.d.ts +20 -0
  40. package/dist/nodeColorAdjustment.d.ts.map +1 -0
  41. package/dist/nodeColorAdjustment.js +60 -0
  42. package/dist/nodeColorAdjustment.js.map +1 -0
  43. package/dist/nodeTransform2d.d.ts +1 -1
  44. package/dist/nodeTransform2d.d.ts.map +1 -1
  45. package/dist/nodeTransform2d.js +3 -3
  46. package/dist/nodeTransform2d.js.map +1 -1
  47. package/dist/nodeTransform3d.d.ts +1 -1
  48. package/dist/nodeTransform3d.d.ts.map +1 -1
  49. package/dist/nodeTransform3d.js +2 -2
  50. package/dist/nodeTransform3d.js.map +1 -1
  51. package/dist/revision.d.ts +2 -2
  52. package/dist/revision.d.ts.map +1 -1
  53. package/dist/revision.js +1 -1
  54. package/dist/stageFit.d.ts +1 -1
  55. package/dist/stageFit.d.ts.map +1 -1
  56. package/dist/stageFit.js +1 -3
  57. package/dist/stageFit.js.map +1 -1
  58. package/dist/traversal.d.ts +2 -2
  59. package/dist/traversal.d.ts.map +1 -1
  60. package/dist/traversal.js +1 -1
  61. package/dist/traversal.js.map +1 -1
  62. package/dist/viewport.d.ts +1 -1
  63. package/dist/viewport.d.ts.map +1 -1
  64. package/dist/viewport.js +1 -1
  65. package/dist/viewport.js.map +1 -1
  66. package/package.json +11 -5
  67. package/src/boundsRectangle.test.ts +62 -4
  68. package/src/hasAppearance.test.ts +1 -1
  69. package/src/hasBlendMode.test.ts +2 -2
  70. package/src/hasBoundsRectangle.test.ts +10 -2
  71. package/src/hasClip.test.ts +1 -1
  72. package/src/hasMaterial.test.ts +1 -1
  73. package/src/hasTransform2d.test.ts +1 -1
  74. package/src/hasTransform3d.test.ts +2 -2
  75. package/src/hierarchy.test.ts +5 -5
  76. package/src/node.test.ts +3 -3
  77. package/src/nodeColorAdjustment.test.ts +58 -0
  78. package/src/nodeTransform2d.test.ts +4 -4
  79. package/src/nodeTransform3d.test.ts +8 -2
  80. package/src/revision.test.ts +2 -2
  81. package/src/stageFit.test.ts +8 -2
  82. package/src/traversal.test.ts +2 -3
@@ -0,0 +1,58 @@
1
+ import { createColorMatrixAdjustment, createTintAdjustment } from '@flighthq/adjustments/contract';
2
+ import { NodeKind } from '@flighthq/types/contract';
3
+
4
+ import { createNode, getNodeRuntime } from './node';
5
+ import {
6
+ addNodeColorAdjustment,
7
+ getNodeColorAdjustments,
8
+ setNodeColorAdjustments,
9
+ setNodeColorAdjustmentsTint,
10
+ } from './nodeColorAdjustment';
11
+
12
+ describe('addNodeColorAdjustment', () => {
13
+ it('lazily creates the stack and resolves its material-feature data', () => {
14
+ const node = createNode(NodeKind);
15
+ const adjustment = createTintAdjustment(0x7f3fffff);
16
+
17
+ addNodeColorAdjustment(node, adjustment);
18
+
19
+ expect(getNodeColorAdjustments(node)).toEqual([adjustment]);
20
+ expect(getNodeRuntime(node).resolvedColorScaleBias?.redScale).toBeCloseTo(0x7f / 255);
21
+ });
22
+ });
23
+
24
+ describe('getNodeColorAdjustments', () => {
25
+ it('returns null before a stack is authored', () => {
26
+ expect(getNodeColorAdjustments(createNode(NodeKind))).toBeNull();
27
+ });
28
+ });
29
+
30
+ describe('setNodeColorAdjustments', () => {
31
+ it('clears the resolved transform with the stack', () => {
32
+ const node = createNode(NodeKind);
33
+ setNodeColorAdjustmentsTint(node, 0xff0000ff);
34
+
35
+ setNodeColorAdjustments(node, null);
36
+
37
+ expect(getNodeRuntime(node).resolvedColorScaleBias).toBeNull();
38
+ });
39
+
40
+ it('caches a complete channel-mixing matrix without marking it unsupported', () => {
41
+ const node = createNode(NodeKind);
42
+ const matrix = [1, 0.5, 0, 0, 0.1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0];
43
+ setNodeColorAdjustments(node, [createColorMatrixAdjustment(matrix)]);
44
+ expect(getNodeRuntime(node).resolvedColorMatrix).toEqual(matrix);
45
+ expect(getNodeRuntime(node).colorAdjustmentsUnsupported).toBe(false);
46
+ });
47
+ });
48
+
49
+ describe('setNodeColorAdjustmentsTint', () => {
50
+ it('authors a packed tint through the shared adjustment model', () => {
51
+ const node = createNode(NodeKind);
52
+
53
+ setNodeColorAdjustmentsTint(node, 0x00ff00ff);
54
+
55
+ expect(getNodeRuntime(node).resolvedColorScaleBias?.greenScale).toBe(1);
56
+ expect(getNodeRuntime(node).resolvedColorScaleBias?.redScale).toBe(0);
57
+ });
58
+ });
@@ -1,4 +1,4 @@
1
- import { getEntityRuntime } from '@flighthq/entity';
1
+ import { getEntityRuntime } from '@flighthq/entity/contract';
2
2
  import {
3
3
  cloneMatrix,
4
4
  createMatrix,
@@ -7,9 +7,9 @@ import {
7
7
  equalsMatrix,
8
8
  multiplyMatrix,
9
9
  setMatrix,
10
- } from '@flighthq/geometry';
11
- import { addNodeChild, createNode } from '@flighthq/node';
12
- import type { HasTransform2D, HasTransform2DRuntime, Matrix, Node, NodeRuntime } from '@flighthq/types';
10
+ } from '@flighthq/geometry/contract';
11
+ import { addNodeChild, createNode } from '@flighthq/node/contract';
12
+ import type { HasTransform2D, HasTransform2DRuntime, Matrix, Node, NodeRuntime } from '@flighthq/types/contract';
13
13
 
14
14
  import { initTransform2DRuntimeTrait, initTransform2DTrait } from './hasTransform2d';
15
15
  import {
@@ -6,8 +6,14 @@ import {
6
6
  createVector3,
7
7
  multiplyMatrix4,
8
8
  setQuaternionFromAxisAngle,
9
- } from '@flighthq/geometry';
10
- import type { HasTransform3D, HasTransform3DRuntime, NodeRuntime, Transform3DNode, Vector3Like } from '@flighthq/types';
9
+ } from '@flighthq/geometry/contract';
10
+ import type {
11
+ HasTransform3D,
12
+ HasTransform3DRuntime,
13
+ NodeRuntime,
14
+ Transform3DNode,
15
+ Vector3Like,
16
+ } from '@flighthq/types/contract';
11
17
  import { describe, expect, it } from 'vitest';
12
18
 
13
19
  import { initTransform3DRuntimeTrait, initTransform3DTrait } from './hasTransform3d';
@@ -1,5 +1,5 @@
1
- import { createNode, getNodeRuntime } from '@flighthq/node';
2
- import type { Node, NodeRuntime } from '@flighthq/types';
1
+ import { createNode, getNodeRuntime } from '@flighthq/node/contract';
2
+ import type { Node, NodeRuntime } from '@flighthq/types/contract';
3
3
 
4
4
  import {
5
5
  computeNodeWorldTransformRevision,
@@ -1,5 +1,11 @@
1
- import { createMatrix } from '@flighthq/geometry';
2
- import type { HasBoundsRectangleRuntime, Node, NodeTraits, ViewportAlign, ViewportScaleMode } from '@flighthq/types';
1
+ import { createMatrix } from '@flighthq/geometry/contract';
2
+ import type {
3
+ HasBoundsRectangleRuntime,
4
+ Node,
5
+ NodeTraits,
6
+ ViewportAlign,
7
+ ViewportScaleMode,
8
+ } from '@flighthq/types/contract';
3
9
 
4
10
  import { createNode, getNodeRuntime } from './node';
5
11
  import {
@@ -1,5 +1,5 @@
1
- import type { Node, NodeTraits } from '@flighthq/types';
2
- import { NodeKind } from '@flighthq/types';
1
+ import type { Node, NodeTraits } from '@flighthq/types/contract';
2
+ import { NodeKind } from '@flighthq/types/contract';
3
3
 
4
4
  import { addNodeChild } from './hierarchy';
5
5
  import { createNode } from './node';
@@ -112,7 +112,6 @@ describe('forEachNodeAncestor', () => {
112
112
  const visited: Node<NodeTraits>[] = [];
113
113
  forEachNodeAncestor(grandchild, (n) => {
114
114
  visited.push(n);
115
- return true;
116
115
  });
117
116
  expect(visited).toEqual([childA, root]);
118
117
  });