@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.
- package/dist/boundsRectangle.d.ts +12 -1
- package/dist/boundsRectangle.d.ts.map +1 -1
- package/dist/boundsRectangle.js +51 -5
- package/dist/boundsRectangle.js.map +1 -1
- package/dist/contract.d.ts +18 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +18 -0
- package/dist/contract.js.map +1 -0
- package/dist/hasAppearance.d.ts +1 -1
- package/dist/hasAppearance.d.ts.map +1 -1
- package/dist/hasBlendMode.d.ts +1 -1
- package/dist/hasBlendMode.d.ts.map +1 -1
- package/dist/hasBoundsRectangle.d.ts +2 -2
- package/dist/hasBoundsRectangle.d.ts.map +1 -1
- package/dist/hasBoundsRectangle.js +1 -0
- package/dist/hasBoundsRectangle.js.map +1 -1
- package/dist/hasClip.d.ts +1 -1
- package/dist/hasClip.d.ts.map +1 -1
- package/dist/hasMaterial.d.ts +1 -1
- package/dist/hasMaterial.d.ts.map +1 -1
- package/dist/hasTransform2d.d.ts +1 -1
- package/dist/hasTransform2d.d.ts.map +1 -1
- package/dist/hasTransform3d.d.ts +1 -1
- package/dist/hasTransform3d.d.ts.map +1 -1
- package/dist/hasTransform3d.js +1 -1
- package/dist/hasTransform3d.js.map +1 -1
- package/dist/hierarchy.d.ts +1 -1
- package/dist/hierarchy.d.ts.map +1 -1
- package/dist/hierarchy.js +2 -2
- package/dist/hierarchy.js.map +1 -1
- package/dist/index.d.ts +1 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -16
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +6 -5
- package/dist/node.js.map +1 -1
- package/dist/nodeColorAdjustment.d.ts +20 -0
- package/dist/nodeColorAdjustment.d.ts.map +1 -0
- package/dist/nodeColorAdjustment.js +60 -0
- package/dist/nodeColorAdjustment.js.map +1 -0
- package/dist/nodeTransform2d.d.ts +1 -1
- package/dist/nodeTransform2d.d.ts.map +1 -1
- package/dist/nodeTransform2d.js +3 -3
- package/dist/nodeTransform2d.js.map +1 -1
- package/dist/nodeTransform3d.d.ts +1 -1
- package/dist/nodeTransform3d.d.ts.map +1 -1
- package/dist/nodeTransform3d.js +2 -2
- package/dist/nodeTransform3d.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.d.ts.map +1 -1
- package/dist/revision.js +1 -1
- package/dist/stageFit.d.ts +1 -1
- package/dist/stageFit.d.ts.map +1 -1
- package/dist/stageFit.js +1 -3
- package/dist/stageFit.js.map +1 -1
- package/dist/traversal.d.ts +2 -2
- package/dist/traversal.d.ts.map +1 -1
- package/dist/traversal.js +1 -1
- package/dist/traversal.js.map +1 -1
- package/dist/viewport.d.ts +1 -1
- package/dist/viewport.d.ts.map +1 -1
- package/dist/viewport.js +1 -1
- package/dist/viewport.js.map +1 -1
- package/package.json +11 -5
- package/src/boundsRectangle.test.ts +62 -4
- package/src/hasAppearance.test.ts +1 -1
- package/src/hasBlendMode.test.ts +2 -2
- package/src/hasBoundsRectangle.test.ts +10 -2
- package/src/hasClip.test.ts +1 -1
- package/src/hasMaterial.test.ts +1 -1
- package/src/hasTransform2d.test.ts +1 -1
- package/src/hasTransform3d.test.ts +2 -2
- package/src/hierarchy.test.ts +5 -5
- package/src/node.test.ts +3 -3
- package/src/nodeColorAdjustment.test.ts +58 -0
- package/src/nodeTransform2d.test.ts +4 -4
- package/src/nodeTransform3d.test.ts +8 -2
- package/src/revision.test.ts +2 -2
- package/src/stageFit.test.ts +8 -2
- 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 {
|
|
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';
|
package/src/revision.test.ts
CHANGED
|
@@ -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,
|
package/src/stageFit.test.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { createMatrix } from '@flighthq/geometry';
|
|
2
|
-
import type {
|
|
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 {
|
package/src/traversal.test.ts
CHANGED
|
@@ -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
|
});
|