@flighthq/node 0.1.0
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 +26 -0
- package/dist/boundsRectangle.d.ts.map +1 -0
- package/dist/boundsRectangle.js +160 -0
- package/dist/boundsRectangle.js.map +1 -0
- package/dist/hasAppearance.d.ts +3 -0
- package/dist/hasAppearance.d.ts.map +1 -0
- package/dist/hasAppearance.js +6 -0
- package/dist/hasAppearance.js.map +1 -0
- package/dist/hasBoundsRectangle.d.ts +5 -0
- package/dist/hasBoundsRectangle.d.ts.map +1 -0
- package/dist/hasBoundsRectangle.js +9 -0
- package/dist/hasBoundsRectangle.js.map +1 -0
- package/dist/hasClip.d.ts +3 -0
- package/dist/hasClip.d.ts.map +1 -0
- package/dist/hasClip.js +4 -0
- package/dist/hasClip.js.map +1 -0
- package/dist/hasMaterial.d.ts +3 -0
- package/dist/hasMaterial.d.ts.map +1 -0
- package/dist/hasMaterial.js +5 -0
- package/dist/hasMaterial.js.map +1 -0
- package/dist/hasTransform2d.d.ts +4 -0
- package/dist/hasTransform2d.d.ts.map +1 -0
- package/dist/hasTransform2d.js +19 -0
- package/dist/hasTransform2d.js.map +1 -0
- package/dist/hasTransform3d.d.ts +5 -0
- package/dist/hasTransform3d.d.ts.map +1 -0
- package/dist/hasTransform3d.js +8 -0
- package/dist/hasTransform3d.js.map +1 -0
- package/dist/hierarchy.d.ts +127 -0
- package/dist/hierarchy.d.ts.map +1 -0
- package/dist/hierarchy.js +396 -0
- package/dist/hierarchy.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/node.d.ts +21 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +109 -0
- package/dist/node.js.map +1 -0
- package/dist/revision.d.ts +40 -0
- package/dist/revision.d.ts.map +1 -0
- package/dist/revision.js +85 -0
- package/dist/revision.js.map +1 -0
- package/dist/transform2d.d.ts +16 -0
- package/dist/transform2d.d.ts.map +1 -0
- package/dist/transform2d.js +99 -0
- package/dist/transform2d.js.map +1 -0
- package/dist/transform3d.d.ts +6 -0
- package/dist/transform3d.d.ts.map +1 -0
- package/dist/transform3d.js +45 -0
- package/dist/transform3d.js.map +1 -0
- package/dist/traversal.d.ts +51 -0
- package/dist/traversal.d.ts.map +1 -0
- package/dist/traversal.js +130 -0
- package/dist/traversal.js.map +1 -0
- package/dist/viewport.d.ts +8 -0
- package/dist/viewport.d.ts.map +1 -0
- package/dist/viewport.js +78 -0
- package/dist/viewport.js.map +1 -0
- package/package.json +40 -0
- package/src/boundsRectangle.test.ts +497 -0
- package/src/hasAppearance.test.ts +47 -0
- package/src/hasBoundsRectangle.test.ts +57 -0
- package/src/hasClip.test.ts +27 -0
- package/src/hasMaterial.test.ts +30 -0
- package/src/hasTransform2d.test.ts +67 -0
- package/src/hasTransform3d.test.ts +37 -0
- package/src/hierarchy.test.ts +973 -0
- package/src/node.test.ts +265 -0
- package/src/revision.test.ts +211 -0
- package/src/transform2d.test.ts +391 -0
- package/src/transform3d.test.ts +202 -0
- package/src/traversal.test.ts +233 -0
- package/src/viewport.test.ts +228 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { acquireMatrix, copyMatrix, inverseMatrix, multiplyMatrix, releaseMatrix } from '@flighthq/geometry';
|
|
2
|
+
import { emitSignal } from '@flighthq/signals';
|
|
3
|
+
import { getNodeRuntime } from './node';
|
|
4
|
+
import { invalidateNodeLocalTransform, invalidateNodeParentReference } from './revision';
|
|
5
|
+
import { ensureNodeWorldTransformMatrix, getNodeWorldTransformMatrix } from './transform2d';
|
|
6
|
+
/**
|
|
7
|
+
* Adds a child Node instance to this Node
|
|
8
|
+
* instance. The child is added to the front (top) of all other children in
|
|
9
|
+
* this Node instance.
|
|
10
|
+
**/
|
|
11
|
+
export function addNodeChild(target, child) {
|
|
12
|
+
return addNodeChildAt(target, child, getNodeChildCount(target));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Adds a child Node instance to this Node
|
|
16
|
+
* instance. The child is added at the index position specified. An index of
|
|
17
|
+
* 0 represents the back (bottom) of the display list for this
|
|
18
|
+
* Node object.
|
|
19
|
+
**/
|
|
20
|
+
export function addNodeChildAt(target, child, index) {
|
|
21
|
+
const targetRuntime = getNodeRuntime(target);
|
|
22
|
+
let children = targetRuntime.children;
|
|
23
|
+
if (!child) {
|
|
24
|
+
throw new TypeError('Parameter child must be non-null');
|
|
25
|
+
}
|
|
26
|
+
else if (child === target) {
|
|
27
|
+
throw new TypeError('An object cannot be added as a child of itself');
|
|
28
|
+
}
|
|
29
|
+
else if (index < 0 || (children !== null && index > children.length) || (children === null && index > 0)) {
|
|
30
|
+
throwOutOfBoundsError();
|
|
31
|
+
}
|
|
32
|
+
if (!targetRuntime.canAddChild(target, child)) {
|
|
33
|
+
throw new TypeError('The specified parent object cannot add this child');
|
|
34
|
+
}
|
|
35
|
+
if (children === null) {
|
|
36
|
+
children = targetRuntime.children = [];
|
|
37
|
+
}
|
|
38
|
+
const childRuntime = getNodeRuntime(child);
|
|
39
|
+
const parent = childRuntime.parent;
|
|
40
|
+
if (parent === target) {
|
|
41
|
+
const i = children.indexOf(child);
|
|
42
|
+
if (i !== -1) {
|
|
43
|
+
if (i === index)
|
|
44
|
+
return child;
|
|
45
|
+
children.splice(i, 1);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
if (parent !== null) {
|
|
50
|
+
removeNodeChild(parent, child);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
children.splice(index, 0, child);
|
|
54
|
+
const targetSignals = targetRuntime.nodeSignals;
|
|
55
|
+
if (targetSignals !== null)
|
|
56
|
+
emitSignal(targetSignals.onChildrenChanged);
|
|
57
|
+
if (parent !== target) {
|
|
58
|
+
childRuntime.parent = target;
|
|
59
|
+
if (targetSignals !== null)
|
|
60
|
+
emitSignal(targetSignals.onChildAdded, child);
|
|
61
|
+
const childSignals = childRuntime.nodeSignals;
|
|
62
|
+
if (childSignals !== null)
|
|
63
|
+
emitSignal(childSignals.onParentChanged);
|
|
64
|
+
invalidateNodeParentReference(child);
|
|
65
|
+
}
|
|
66
|
+
return child;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Adds multiple children to `target` in order, appending each after the last. Equivalent to
|
|
70
|
+
* calling `addNodeChild` for each child but signals are still emitted per child.
|
|
71
|
+
*/
|
|
72
|
+
export function addNodeChildren(target, ...children) {
|
|
73
|
+
for (let i = 0; i < children.length; i++) {
|
|
74
|
+
addNodeChild(target, children[i]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Determines whether the specified scene node is a child of the
|
|
79
|
+
* NodeContainer instance or the instance itself.
|
|
80
|
+
**/
|
|
81
|
+
export function containsNodeChild(source, child) {
|
|
82
|
+
let current = child;
|
|
83
|
+
while (current !== source && current !== null) {
|
|
84
|
+
current = getNodeParent(current);
|
|
85
|
+
}
|
|
86
|
+
return current === source;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Calls `callback` for each direct child of `source` in index order (back to front).
|
|
90
|
+
* Stops early if `callback` returns `false`.
|
|
91
|
+
*/
|
|
92
|
+
export function forEachNodeChild(source, callback) {
|
|
93
|
+
const children = getNodeRuntime(source).children;
|
|
94
|
+
if (children === null)
|
|
95
|
+
return;
|
|
96
|
+
for (let i = 0; i < children.length; i++) {
|
|
97
|
+
if (callback(children[i], i) === false)
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Returns a read-only snapshot of all ancestors of `source`, from immediate parent toward the
|
|
103
|
+
* root. The source node itself is not included.
|
|
104
|
+
*/
|
|
105
|
+
export function getNodeAncestors(source) {
|
|
106
|
+
const result = [];
|
|
107
|
+
let current = getNodeParent(source);
|
|
108
|
+
while (current !== null) {
|
|
109
|
+
result.push(current);
|
|
110
|
+
current = getNodeParent(current);
|
|
111
|
+
}
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Returns the child scene node instance that exists at the specified
|
|
116
|
+
* index.
|
|
117
|
+
**/
|
|
118
|
+
export function getNodeChildAt(source, index) {
|
|
119
|
+
const children = getNodeRuntime(source).children;
|
|
120
|
+
if (children !== null && index >= 0 && index < children.length) {
|
|
121
|
+
return children[index];
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Returns the child scene node that exists with the specified name. If
|
|
127
|
+
* more that one child scene node has the specified name, the method
|
|
128
|
+
* returns the first object found.
|
|
129
|
+
**/
|
|
130
|
+
export function getNodeChildByName(source, name) {
|
|
131
|
+
const children = getNodeRuntime(source).children;
|
|
132
|
+
if (children !== null) {
|
|
133
|
+
for (let i = 0; i < children.length; i++) {
|
|
134
|
+
if (children[i].name === name)
|
|
135
|
+
return children[i];
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
export function getNodeChildCount(source) {
|
|
141
|
+
const children = getNodeRuntime(source).children;
|
|
142
|
+
return children !== null ? children.length : 0;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Returns the index position of a `child` Node instance.
|
|
146
|
+
**/
|
|
147
|
+
export function getNodeChildIndex(source, child) {
|
|
148
|
+
const children = getNodeRuntime(source).children;
|
|
149
|
+
if (children !== null) {
|
|
150
|
+
for (let i = 0; i < children.length; i++) {
|
|
151
|
+
if (children[i] === child)
|
|
152
|
+
return i;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return -1;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Returns the lowest common ancestor of `a` and `b`, or `null` if they share no common ancestor.
|
|
159
|
+
* If one node is an ancestor of the other, that ancestor is returned.
|
|
160
|
+
*/
|
|
161
|
+
export function getNodeCommonAncestor(a, b) {
|
|
162
|
+
// Build the ancestor set for `a`, then walk `b`'s chain to find the first match.
|
|
163
|
+
const aAncestors = new Set();
|
|
164
|
+
aAncestors.add(a);
|
|
165
|
+
let cur = getNodeParent(a);
|
|
166
|
+
while (cur !== null) {
|
|
167
|
+
aAncestors.add(cur);
|
|
168
|
+
cur = getNodeParent(cur);
|
|
169
|
+
}
|
|
170
|
+
let bCur = b;
|
|
171
|
+
while (bCur !== null) {
|
|
172
|
+
if (aAncestors.has(bCur))
|
|
173
|
+
return bCur;
|
|
174
|
+
bCur = getNodeParent(bCur);
|
|
175
|
+
}
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
export function getNodeParent(source) {
|
|
179
|
+
return getNodeRuntime(source).parent;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Returns the topmost ancestor of the node, or the node itself if it has no
|
|
183
|
+
* parent.
|
|
184
|
+
**/
|
|
185
|
+
export function getNodeRoot(source) {
|
|
186
|
+
let current = source;
|
|
187
|
+
let parent = getNodeParent(current);
|
|
188
|
+
while (parent !== null) {
|
|
189
|
+
current = parent;
|
|
190
|
+
parent = getNodeParent(current);
|
|
191
|
+
}
|
|
192
|
+
return current;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Returns `true` if `ancestor` is the same node as `descendant` or is located above
|
|
196
|
+
* `descendant` in the hierarchy.
|
|
197
|
+
*/
|
|
198
|
+
export function isNodeAncestorOf(ancestor, descendant) {
|
|
199
|
+
let current = descendant;
|
|
200
|
+
while (current !== null) {
|
|
201
|
+
if (current === ancestor)
|
|
202
|
+
return true;
|
|
203
|
+
current = getNodeParent(current);
|
|
204
|
+
}
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Removes the specified `child` Node instance from the
|
|
209
|
+
* child list of the Node instance. The `parent`
|
|
210
|
+
* property of the removed child is set to `null` , and the object
|
|
211
|
+
* is garbage collected if no other references to the child exist. The index
|
|
212
|
+
* positions of any scene nodes above the child in the
|
|
213
|
+
* Node are decreased by 1.
|
|
214
|
+
**/
|
|
215
|
+
export function removeNodeChild(target, child) {
|
|
216
|
+
if (!child)
|
|
217
|
+
return child;
|
|
218
|
+
const targetRuntime = getNodeRuntime(target);
|
|
219
|
+
const childRuntime = getNodeRuntime(child);
|
|
220
|
+
const children = targetRuntime.children;
|
|
221
|
+
if (children !== null && childRuntime.parent === target) {
|
|
222
|
+
childRuntime.parent = null;
|
|
223
|
+
const childSignals = childRuntime.nodeSignals;
|
|
224
|
+
if (childSignals !== null)
|
|
225
|
+
emitSignal(childSignals.onParentChanged);
|
|
226
|
+
invalidateNodeParentReference(child);
|
|
227
|
+
const i = children.indexOf(child);
|
|
228
|
+
if (i !== -1) {
|
|
229
|
+
children.splice(i, 1);
|
|
230
|
+
}
|
|
231
|
+
const targetSignals = targetRuntime.nodeSignals;
|
|
232
|
+
if (targetSignals !== null) {
|
|
233
|
+
emitSignal(targetSignals.onChildRemoved, child);
|
|
234
|
+
emitSignal(targetSignals.onChildrenChanged);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return child;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Removes a child Node from the specified `index`
|
|
241
|
+
* position in the child list of the Node. The
|
|
242
|
+
* `parent` property of the removed child is set to
|
|
243
|
+
* `null`, and the object is garbage collected if no other
|
|
244
|
+
* references to the child exist. The index positions of any scene nodes
|
|
245
|
+
* above the child in the Node are decreased by 1.
|
|
246
|
+
**/
|
|
247
|
+
export function removeNodeChildAt(target, index) {
|
|
248
|
+
const children = getNodeRuntime(target).children;
|
|
249
|
+
if (children !== null && index >= 0 && index < children.length) {
|
|
250
|
+
return removeNodeChild(target, children[index]);
|
|
251
|
+
}
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Removes all `child` Node instances from the child list of the Node
|
|
256
|
+
* instance. The `parent` property of the removed children is set to `null`, and the objects are
|
|
257
|
+
* garbage collected if no other references to the children exist.
|
|
258
|
+
**/
|
|
259
|
+
export function removeNodeChildren(target, beginIndex = 0, endIndex) {
|
|
260
|
+
const children = getNodeRuntime(target).children;
|
|
261
|
+
if (children === null)
|
|
262
|
+
return;
|
|
263
|
+
if (beginIndex > children.length - 1)
|
|
264
|
+
return;
|
|
265
|
+
if (endIndex === undefined) {
|
|
266
|
+
endIndex = children.length - 1;
|
|
267
|
+
}
|
|
268
|
+
if (endIndex < beginIndex || beginIndex < 0 || endIndex > children.length) {
|
|
269
|
+
throwOutOfBoundsError();
|
|
270
|
+
}
|
|
271
|
+
let numRemovals = endIndex - beginIndex;
|
|
272
|
+
while (numRemovals >= 0) {
|
|
273
|
+
removeNodeChildAt(target, beginIndex);
|
|
274
|
+
numRemovals--;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Moves a child to a new parent while preserving its world-space position.
|
|
279
|
+
* The child's local TRS fields (x, y, rotation, scaleX, scaleY) are recomputed
|
|
280
|
+
* so its visual position, rotation, and scale remain unchanged. Existing skewX/skewY
|
|
281
|
+
* values are preserved (skew is not decomposable from a general affine matrix).
|
|
282
|
+
*
|
|
283
|
+
* To reparent without preserving world position (keeping local TRS unchanged),
|
|
284
|
+
* use addNodeChild instead.
|
|
285
|
+
*/
|
|
286
|
+
export function reparentNode(child, newParent) {
|
|
287
|
+
ensureNodeWorldTransformMatrix(child);
|
|
288
|
+
const oldWorld = acquireMatrix();
|
|
289
|
+
const localM = acquireMatrix();
|
|
290
|
+
try {
|
|
291
|
+
copyMatrix(oldWorld, getNodeWorldTransformMatrix(child));
|
|
292
|
+
addNodeChild(newParent, child);
|
|
293
|
+
inverseMatrix(localM, getNodeWorldTransformMatrix(newParent));
|
|
294
|
+
multiplyMatrix(localM, localM, oldWorld);
|
|
295
|
+
const a = localM.a;
|
|
296
|
+
const b = localM.b;
|
|
297
|
+
const c = localM.c;
|
|
298
|
+
const d = localM.d;
|
|
299
|
+
child.scaleX = Math.sqrt(a * a + b * b);
|
|
300
|
+
child.scaleY = Math.sqrt(c * c + d * d);
|
|
301
|
+
if (a * d - b * c < 0) {
|
|
302
|
+
child.scaleY = -child.scaleY;
|
|
303
|
+
}
|
|
304
|
+
const skewYRad = child.skewY * DEG_TO_RAD;
|
|
305
|
+
child.rotation = (Math.atan2(b, a) - skewYRad) * RAD_TO_DEG;
|
|
306
|
+
child.x = localM.tx + (a * child.pivotX + c * child.pivotY);
|
|
307
|
+
child.y = localM.ty + (b * child.pivotX + d * child.pivotY);
|
|
308
|
+
invalidateNodeLocalTransform(child);
|
|
309
|
+
}
|
|
310
|
+
finally {
|
|
311
|
+
releaseMatrix(oldWorld);
|
|
312
|
+
releaseMatrix(localM);
|
|
313
|
+
}
|
|
314
|
+
return child;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Replaces `oldChild` with `newChild` at the same index position in `target`'s children. If
|
|
318
|
+
* `oldChild` is not a child of `target`, this is a no-op. If `newChild` is already a child of
|
|
319
|
+
* `target`, it is moved to `oldChild`'s index.
|
|
320
|
+
*/
|
|
321
|
+
export function replaceNodeChild(target, oldChild, newChild) {
|
|
322
|
+
const index = getNodeChildIndex(target, oldChild);
|
|
323
|
+
if (index === -1)
|
|
324
|
+
return;
|
|
325
|
+
removeNodeChild(target, oldChild);
|
|
326
|
+
addNodeChildAt(target, newChild, index);
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Changes the position of an existing child in the scene node container.
|
|
330
|
+
* This affects the layering of child objects.
|
|
331
|
+
**/
|
|
332
|
+
export function setNodeChildIndex(target, child, index) {
|
|
333
|
+
const targetRuntime = getNodeRuntime(target);
|
|
334
|
+
const children = targetRuntime.children;
|
|
335
|
+
if (children === null)
|
|
336
|
+
return;
|
|
337
|
+
if (index >= 0 && index <= children.length && getNodeParent(child) === target) {
|
|
338
|
+
const i = children.indexOf(child);
|
|
339
|
+
if (i !== -1 && i !== index) {
|
|
340
|
+
children.splice(i, 1);
|
|
341
|
+
children.splice(index, 0, child);
|
|
342
|
+
const targetSignals = targetRuntime.nodeSignals;
|
|
343
|
+
if (targetSignals !== null)
|
|
344
|
+
emitSignal(targetSignals.onChildrenOrderChanged);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Recursively stops the timeline execution of all MovieClips rooted at this object.
|
|
350
|
+
**/
|
|
351
|
+
// static stopAllMovieClips(): void {}
|
|
352
|
+
/**
|
|
353
|
+
* Swaps the z-order (front-to-back order) of the two specified child
|
|
354
|
+
* objects. All other child objects in the scene node container remain in
|
|
355
|
+
* the same index positions.
|
|
356
|
+
**/
|
|
357
|
+
export function swapNodeChildren(target, child1, child2) {
|
|
358
|
+
const targetRuntime = getNodeRuntime(target);
|
|
359
|
+
const children = targetRuntime.children;
|
|
360
|
+
if (children !== null && getNodeParent(child1) === target && getNodeParent(child2) === target) {
|
|
361
|
+
const index1 = children.indexOf(child1);
|
|
362
|
+
const index2 = children.indexOf(child2);
|
|
363
|
+
children[index1] = child2;
|
|
364
|
+
children[index2] = child1;
|
|
365
|
+
const targetSignals = getNodeRuntime(target).nodeSignals;
|
|
366
|
+
if (targetSignals !== null)
|
|
367
|
+
emitSignal(targetSignals.onChildrenOrderChanged);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Swaps the z-order (front-to-back order) of the child objects at the two
|
|
372
|
+
* specified index positions in the child list. All other child objects in
|
|
373
|
+
* the scene node container remain in the same index positions.
|
|
374
|
+
**/
|
|
375
|
+
export function swapNodeChildrenAt(target, index1, index2) {
|
|
376
|
+
const targetRuntime = getNodeRuntime(target);
|
|
377
|
+
const children = targetRuntime.children;
|
|
378
|
+
if (children === null || index1 === index2)
|
|
379
|
+
return;
|
|
380
|
+
const len = children.length;
|
|
381
|
+
if (index1 < 0 || index2 < 0 || index1 >= len || index2 >= len) {
|
|
382
|
+
throwOutOfBoundsError();
|
|
383
|
+
}
|
|
384
|
+
const swap = children[index1];
|
|
385
|
+
children[index1] = children[index2];
|
|
386
|
+
children[index2] = swap;
|
|
387
|
+
const targetSignals = targetRuntime.nodeSignals;
|
|
388
|
+
if (targetSignals !== null)
|
|
389
|
+
emitSignal(targetSignals.onChildrenOrderChanged);
|
|
390
|
+
}
|
|
391
|
+
function throwOutOfBoundsError() {
|
|
392
|
+
throw new RangeError('The supplied index is out of bounds.');
|
|
393
|
+
}
|
|
394
|
+
const DEG_TO_RAD = Math.PI / 180;
|
|
395
|
+
const RAD_TO_DEG = 180 / Math.PI;
|
|
396
|
+
//# sourceMappingURL=hierarchy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hierarchy.js","sourceRoot":"","sources":["../src/hierarchy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC7G,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,4BAA4B,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAE,8BAA8B,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAE5F;;;;IAII;AACJ,MAAM,UAAU,YAAY,CAAwB,MAAoB,EAAE,KAAmB;IAC3F,OAAO,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAClE,CAAC;AAED;;;;;IAKI;AACJ,MAAM,UAAU,cAAc,CAC5B,MAAoB,EACpB,KAAmB,EACnB,KAAa;IAEb,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAwB,CAAC;IACpE,IAAI,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;IAEtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,SA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AAC,EAAE,GAAG,GAAG,CAAC;AACjC,MAAM,UAAU,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './boundsRectangle';
|
|
2
|
+
export * from './hasAppearance';
|
|
3
|
+
export * from './hasBoundsRectangle';
|
|
4
|
+
export * from './hasClip';
|
|
5
|
+
export * from './hasMaterial';
|
|
6
|
+
export * from './hasTransform2d';
|
|
7
|
+
export * from './hasTransform3d';
|
|
8
|
+
export * from './hierarchy';
|
|
9
|
+
export * from './node';
|
|
10
|
+
export * from './revision';
|
|
11
|
+
export * from './transform2d';
|
|
12
|
+
export * from './transform3d';
|
|
13
|
+
export * from './traversal';
|
|
14
|
+
export * from './viewport';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './boundsRectangle';
|
|
2
|
+
export * from './hasAppearance';
|
|
3
|
+
export * from './hasBoundsRectangle';
|
|
4
|
+
export * from './hasClip';
|
|
5
|
+
export * from './hasMaterial';
|
|
6
|
+
export * from './hasTransform2d';
|
|
7
|
+
export * from './hasTransform3d';
|
|
8
|
+
export * from './hierarchy';
|
|
9
|
+
export * from './node';
|
|
10
|
+
export * from './revision';
|
|
11
|
+
export * from './transform2d';
|
|
12
|
+
export * from './transform3d';
|
|
13
|
+
export * from './traversal';
|
|
14
|
+
export * from './viewport';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Kind, MethodsOf, Node, NodeData, NodeDataFactory, NodeRuntime, NodeRuntimeFactory, NodeSignals, NodeTraits, PartialNode } from '@flighthq/types';
|
|
2
|
+
export declare function createNode<Traits extends object = NodeTraits, Data extends NodeData = NodeData, Runtime extends NodeRuntime<Traits> = NodeRuntime<Traits>>(nodeKind: Kind, obj?: Readonly<PartialNode<Node<Traits>>>, createData?: NodeDataFactory<Data>, createNodeRuntimeFactory?: NodeRuntimeFactory<Runtime>): Node<Traits> & Traits;
|
|
3
|
+
export declare function createNodeRuntime<Traits extends object = NodeTraits>(methods?: Readonly<Partial<MethodsOf<NodeRuntime<Traits>>>>): NodeRuntime<Traits>;
|
|
4
|
+
export declare function createNodeSignals(): NodeSignals;
|
|
5
|
+
export declare function defaultNodeRuntimeCanAddChild<Traits extends object>(_target: Node<Traits>, _child: Node<Traits>): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Detaches `target` from its parent, recursively removes all descendants, and clears the
|
|
8
|
+
* `nodeSignals` and `interactionSignals` registries so the node becomes eligible for garbage
|
|
9
|
+
* collection. After disposal, `target` must not be added to a graph.
|
|
10
|
+
*
|
|
11
|
+
* Nodes in this package own no non-GC resources (GPU textures, native handles); therefore no
|
|
12
|
+
* `destroyNode` counterpart exists at this tier. Higher-level packages that attach non-GC
|
|
13
|
+
* resources (render proxies, GPU textures) should call `disposeNode` first and then release those
|
|
14
|
+
* resources themselves.
|
|
15
|
+
*/
|
|
16
|
+
export declare function disposeNode<Traits extends object = NodeTraits>(target: Node<Traits>): void;
|
|
17
|
+
export declare function enableNodeSignals<Traits extends object = NodeTraits>(source: Node<Traits>): NodeSignals;
|
|
18
|
+
export declare function getNodeRuntime<Traits extends object = NodeTraits>(source: Readonly<Node<Traits>>): Readonly<NodeRuntime<Traits>>;
|
|
19
|
+
export declare function getNodeSignals<Traits extends object = NodeTraits>(source: Node<Traits>): NodeSignals | null;
|
|
20
|
+
export declare function setNodeEnabled<Traits extends object = NodeTraits>(target: Node<Traits>, value: boolean): void;
|
|
21
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAMzB,wBAAgB,UAAU,CACxB,MAAM,SAAS,MAAM,GAAG,UAAU,EAClC,IAAI,SAAS,QAAQ,GAAG,QAAQ,EAChC,OAAO,SAAS,WAAW,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,EAEzD,QAAQ,EAAE,IAAI,EACd,GAAG,CAAC,EAAE,QAAQ,CAAC,WAAW,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M,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAG7G"}
|
package/dist/node.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { createEntityRuntime, getEntityRuntime } from '@flighthq/entity';
|
|
2
|
+
import { clearSignal, createSignal } from '@flighthq/signals';
|
|
3
|
+
import { EntityRuntimeKey } from '@flighthq/types';
|
|
4
|
+
import { removeNodeChild } from './hierarchy';
|
|
5
|
+
import { invalidateNode } from './revision';
|
|
6
|
+
export function createNode(nodeKind, obj, createData, createNodeRuntimeFactory) {
|
|
7
|
+
const runtimeFactory = createNodeRuntimeFactory ?? createNodeRuntime;
|
|
8
|
+
const out = {
|
|
9
|
+
data: createData !== undefined ? createData(obj?.data) : null,
|
|
10
|
+
name: obj?.name ?? null,
|
|
11
|
+
kind: nodeKind,
|
|
12
|
+
[EntityRuntimeKey]: runtimeFactory(),
|
|
13
|
+
};
|
|
14
|
+
out.enabled = obj?.enabled ?? true;
|
|
15
|
+
return out;
|
|
16
|
+
}
|
|
17
|
+
export function createNodeRuntime(methods) {
|
|
18
|
+
const out = createEntityRuntime();
|
|
19
|
+
out.appearanceId = 0;
|
|
20
|
+
out.boundsUsingLocalBoundsId = -1;
|
|
21
|
+
out.boundsUsingLocalTransformId = -1;
|
|
22
|
+
out.canAddChild = methods?.canAddChild ?? defaultNodeRuntimeCanAddChild;
|
|
23
|
+
out.children = null;
|
|
24
|
+
out.nodeSignals = null;
|
|
25
|
+
out.interactionSignals = null;
|
|
26
|
+
out.localBoundsId = 0;
|
|
27
|
+
out.localBoundsUsingLocalBoundsId = -1;
|
|
28
|
+
out.localContentId = 0;
|
|
29
|
+
out.localTransformId = 0;
|
|
30
|
+
out.localTransformUsingLocalTransformId = -1;
|
|
31
|
+
out.parent = null;
|
|
32
|
+
out.worldBoundsUsingLocalBoundsId = -1;
|
|
33
|
+
out.worldBoundsUsingWorldTransformId = -1;
|
|
34
|
+
out.worldTransformId = 0;
|
|
35
|
+
out.worldTransformUsingLocalTransformId = -1;
|
|
36
|
+
out.worldTransformUsingParentTransformId = -1;
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
export function createNodeSignals() {
|
|
40
|
+
return {
|
|
41
|
+
onChildAdded: createSignal(),
|
|
42
|
+
onChildRemoved: createSignal(),
|
|
43
|
+
onChildrenChanged: createSignal(),
|
|
44
|
+
onChildrenOrderChanged: createSignal(),
|
|
45
|
+
onParentChanged: createSignal(),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function defaultNodeRuntimeCanAddChild(_target, _child) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Detaches `target` from its parent, recursively removes all descendants, and clears the
|
|
53
|
+
* `nodeSignals` and `interactionSignals` registries so the node becomes eligible for garbage
|
|
54
|
+
* collection. After disposal, `target` must not be added to a graph.
|
|
55
|
+
*
|
|
56
|
+
* Nodes in this package own no non-GC resources (GPU textures, native handles); therefore no
|
|
57
|
+
* `destroyNode` counterpart exists at this tier. Higher-level packages that attach non-GC
|
|
58
|
+
* resources (render proxies, GPU textures) should call `disposeNode` first and then release those
|
|
59
|
+
* resources themselves.
|
|
60
|
+
*/
|
|
61
|
+
export function disposeNode(target) {
|
|
62
|
+
const runtime = getEntityRuntime(target);
|
|
63
|
+
// Detach from parent first so the parent's children list stays consistent.
|
|
64
|
+
const parent = runtime.parent;
|
|
65
|
+
if (parent !== null) {
|
|
66
|
+
removeNodeChild(parent, target);
|
|
67
|
+
}
|
|
68
|
+
// Recursively dispose children bottom-up (snapshot the array before mutating).
|
|
69
|
+
const children = runtime.children;
|
|
70
|
+
if (children !== null) {
|
|
71
|
+
// Snapshot to avoid mutation during iteration.
|
|
72
|
+
const snapshot = children.slice();
|
|
73
|
+
for (let i = 0; i < snapshot.length; i++) {
|
|
74
|
+
disposeNode(snapshot[i]);
|
|
75
|
+
}
|
|
76
|
+
runtime.children = null;
|
|
77
|
+
}
|
|
78
|
+
// Clear all signal listeners so they cannot fire after disposal.
|
|
79
|
+
const nodeSignals = runtime.nodeSignals;
|
|
80
|
+
if (nodeSignals !== null) {
|
|
81
|
+
clearSignal(nodeSignals.onChildAdded);
|
|
82
|
+
clearSignal(nodeSignals.onChildRemoved);
|
|
83
|
+
clearSignal(nodeSignals.onChildrenChanged);
|
|
84
|
+
clearSignal(nodeSignals.onChildrenOrderChanged);
|
|
85
|
+
clearSignal(nodeSignals.onParentChanged);
|
|
86
|
+
runtime.nodeSignals = null;
|
|
87
|
+
}
|
|
88
|
+
const interactionSignals = runtime.interactionSignals;
|
|
89
|
+
if (interactionSignals !== null) {
|
|
90
|
+
// InteractionSignals fields are owned by the interaction package; we can only clear our
|
|
91
|
+
// reference so the owning package's signals are released via GC.
|
|
92
|
+
runtime.interactionSignals = null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export function enableNodeSignals(source) {
|
|
96
|
+
const runtime = getEntityRuntime(source);
|
|
97
|
+
return (runtime.nodeSignals ??= createNodeSignals());
|
|
98
|
+
}
|
|
99
|
+
export function getNodeRuntime(source) {
|
|
100
|
+
return getEntityRuntime(source);
|
|
101
|
+
}
|
|
102
|
+
export function getNodeSignals(source) {
|
|
103
|
+
return getEntityRuntime(source).nodeSignals;
|
|
104
|
+
}
|
|
105
|
+
export function setNodeEnabled(target, value) {
|
|
106
|
+
target.enabled = value;
|
|
107
|
+
invalidateNode(target);
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAa9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,e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@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Node, NodeRuntime } from '@flighthq/types';
|
|
2
|
+
export declare function computeNodeWorldTransformRevision<Traits extends object>(runtime: NodeRuntime<Traits>, parentRuntime?: Readonly<NodeRuntime<Traits>>): void;
|
|
3
|
+
export declare function getNodeAppearanceRevision<Traits extends object>(source: Readonly<Node<Traits>>): number;
|
|
4
|
+
export declare function getNodeLocalBoundsRevision<Traits extends object>(source: Readonly<Node<Traits>>): number;
|
|
5
|
+
export declare function getNodeLocalContentRevision<Traits extends object>(source: Readonly<Node<Traits>>): number;
|
|
6
|
+
export declare function getNodeLocalTransformRevision<Traits extends object>(source: Readonly<Node<Traits>>): number;
|
|
7
|
+
export declare function getNodeWorldTransformRevision<Traits extends object>(source: Readonly<Node<Traits>>): number;
|
|
8
|
+
export declare function invalidateNode<Traits extends object>(target: Node<Traits>): void;
|
|
9
|
+
/**
|
|
10
|
+
* Target object's appearance changed (excluding transforms).
|
|
11
|
+
*/
|
|
12
|
+
export declare function invalidateNodeAppearance<Traits extends object>(target: Node<Traits>): void;
|
|
13
|
+
/**
|
|
14
|
+
* Target object's own dimensions (not including children) changed.
|
|
15
|
+
*/
|
|
16
|
+
export declare function invalidateNodeLocalBounds<Traits extends object>(target: Node<Traits>): void;
|
|
17
|
+
/**
|
|
18
|
+
* Target object's own drawable surface changed (the rasterizable payload — shape commands, text,
|
|
19
|
+
* pixels — not its children and not how it is composited). Renderers re-rasterize on this; the walk
|
|
20
|
+
* and render caches re-examine the node. Distinct from appearance (compositing) and bounds (extent).
|
|
21
|
+
*/
|
|
22
|
+
export declare function invalidateNodeLocalContent<Traits extends object>(target: Node<Traits>): void;
|
|
23
|
+
/**
|
|
24
|
+
* Target object's own transform (x, y, rotation, scaleX, scaleY) changed.
|
|
25
|
+
*/
|
|
26
|
+
export declare function invalidateNodeLocalTransform<Traits extends object>(target: Node<Traits>): void;
|
|
27
|
+
/**
|
|
28
|
+
* Target object's parent changed.
|
|
29
|
+
*/
|
|
30
|
+
export declare function invalidateNodeParentReference<Traits extends object>(target: Node<Traits>): void;
|
|
31
|
+
/**
|
|
32
|
+
* Target object's visual output changed (appearance or local transform).
|
|
33
|
+
* Use this when animating properties like alpha, x, y, scaleX, scaleY, rotation.
|
|
34
|
+
*/
|
|
35
|
+
export declare function invalidateNodeRender<Traits extends object>(target: Node<Traits>): void;
|
|
36
|
+
/**
|
|
37
|
+
* Target object's child bounds have changed.
|
|
38
|
+
*/
|
|
39
|
+
export declare function invalidateNodeWorldBounds<Traits extends object>(target: Node<Traits>): void;
|
|
40
|
+
//# sourceMappingURL=revision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revision.d.ts","sourceRoot":"","sources":["../src/revision.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAIzD,wBAAgB,iCAAiC,CAAC,MAAM,SAAS,MAAM,EACrE,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,EAC5B,aAAa,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,GAC5C,IAAI,CAMN;AAED,wBAAgB,yBAAyB,CAAC,MAAM,SAAS,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAEvG;AAED,wBAAgB,0BAA0B,CAAC,MAAM,SAAS,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAExG;AAED,wBAAgB,2BAA2B,CAAC,MAAM,SAAS,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAEzG;AAED,wBAAgB,6BAA6B,CAAC,MAAM,SAAS,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAE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