@fulate/core 1.0.7 → 1.0.9
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/index.js +17 -9
- package/dist/node/element-transform.d.ts +2 -0
- package/dist/node/node.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -718,13 +718,14 @@ var Node = class extends EventEmitter {
|
|
|
718
718
|
installBatchChildren(children) {
|
|
719
719
|
this.installChildren(children);
|
|
720
720
|
}
|
|
721
|
-
/** @internal
|
|
722
|
-
|
|
721
|
+
/** @internal 按当前 parent 同步最终 lifecycle context。 */
|
|
722
|
+
syncPlacementLifecycle() {
|
|
723
723
|
const parent = this.parent;
|
|
724
724
|
const shouldBeActive = parent?.isActive === true;
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
725
|
+
if (this.isActive) {
|
|
726
|
+
const targetLayer = this.isLayerNode() ? this : parent?.inject("layer") ?? null;
|
|
727
|
+
if (!shouldBeActive || this.activeLayer !== targetLayer) this.transitionLifecycle(LifecycleState.Inactive);
|
|
728
|
+
}
|
|
728
729
|
if (shouldBeActive && !this.isActive) this.transitionLifecycle(LifecycleState.Active);
|
|
729
730
|
}
|
|
730
731
|
/** @internal tree 已完整安装后登记当前 owner 的 dirty path。 */
|
|
@@ -898,7 +899,7 @@ var Node = class extends EventEmitter {
|
|
|
898
899
|
this.onActivate(root, layer);
|
|
899
900
|
for (const child of this.children) {
|
|
900
901
|
if (child.parent !== this) continue;
|
|
901
|
-
child.
|
|
902
|
+
child.syncPlacementLifecycle();
|
|
902
903
|
}
|
|
903
904
|
} finally {
|
|
904
905
|
this.lifecycleCommand = null;
|
|
@@ -2266,7 +2267,7 @@ var ElementTransform = class {
|
|
|
2266
2267
|
}
|
|
2267
2268
|
/** 在清理 visual 缓存前保存最后一次提交的 world 绘制范围。 */
|
|
2268
2269
|
captureCurrentVisualBounds() {
|
|
2269
|
-
if (this.hasGeometry()) this.captureVisualBounds(this.
|
|
2270
|
+
if (this.worldVisualBounds && this.hasGeometry()) this.captureVisualBounds(this.worldVisualBounds);
|
|
2270
2271
|
}
|
|
2271
2272
|
/** 将旧 visual bounds交给当前 transform 和所属 Layer 的 damage 跟踪。 */
|
|
2272
2273
|
captureVisualBounds(bounds) {
|
|
@@ -2294,6 +2295,7 @@ var ElementTransform = class {
|
|
|
2294
2295
|
invalidate(impact, previousBounds) {
|
|
2295
2296
|
if (impact & CHILD_LAYOUT_IMPACT) this.childLayoutDirty = true;
|
|
2296
2297
|
const visualGeometryChanged = (impact & VISUAL_GEOMETRY_IMPACT$1) !== 0;
|
|
2298
|
+
const invalidateAncestors = !this.needsCommit;
|
|
2297
2299
|
if (!this.needsCommit) {
|
|
2298
2300
|
if (visualGeometryChanged) {
|
|
2299
2301
|
if (isUndefined(previousBounds)) this.captureCurrentVisualBounds();
|
|
@@ -2302,14 +2304,20 @@ var ElementTransform = class {
|
|
|
2302
2304
|
this.hitOnlyInvalidation = !visualGeometryChanged && (impact & ChangeImpact.HitBounds) !== 0;
|
|
2303
2305
|
this.needsCommit = true;
|
|
2304
2306
|
this.currentRenderCoverageBounds = void 0;
|
|
2305
|
-
this.markDirtyAncestors();
|
|
2306
2307
|
} else if (this.hitOnlyInvalidation && visualGeometryChanged) {
|
|
2307
2308
|
this.captureCurrentVisualBounds();
|
|
2308
2309
|
this.hitOnlyInvalidation = false;
|
|
2309
2310
|
}
|
|
2310
2311
|
this.invalidateCache(impact);
|
|
2312
|
+
if (invalidateAncestors) this.markDirtyAncestors();
|
|
2311
2313
|
if (this.element.isActive && !this.resolvingFitSize) this.element.layer.invalidateLayout(this.element);
|
|
2312
2314
|
}
|
|
2315
|
+
/** A derived layout can change visual bounds during an already pending commit. @internal */
|
|
2316
|
+
invalidateLayoutBounds() {
|
|
2317
|
+
const pending = this.needsCommit;
|
|
2318
|
+
this.invalidate(ChangeImpact.VisualBounds);
|
|
2319
|
+
if (pending) this.markDirtyAncestors();
|
|
2320
|
+
}
|
|
2313
2321
|
/** 标记 local 几何需要重新构建。 */
|
|
2314
2322
|
markGeometryNeedsLayout(notifyScene = true) {
|
|
2315
2323
|
const publish = !this.needsCommit;
|
|
@@ -5733,7 +5741,7 @@ function installStructureLinks(batch) {
|
|
|
5733
5741
|
}
|
|
5734
5742
|
/** @internal 所有 fields/raw links 安装及 History 记录后同步局部 lifecycle。 */
|
|
5735
5743
|
function syncStructureLifecycles(nodes) {
|
|
5736
|
-
for (const node of nodes) node.
|
|
5744
|
+
for (const node of nodes) node.syncPlacementLifecycle();
|
|
5737
5745
|
}
|
|
5738
5746
|
//#endregion
|
|
5739
5747
|
//#region packages/core/src/mutation/change-batch.ts
|
|
@@ -192,6 +192,8 @@ export declare class ElementTransform<E extends Element = Element> {
|
|
|
192
192
|
clearPreviousVisualBounds(): void;
|
|
193
193
|
/** @internal 按影响范围失效几何并安排 Layer 提交。 */
|
|
194
194
|
invalidate(impact: ChangeImpact, previousBounds?: Readonly<BoundingBox> | null): void;
|
|
195
|
+
/** A derived layout can change visual bounds during an already pending commit. @internal */
|
|
196
|
+
invalidateLayoutBounds(): void;
|
|
195
197
|
/** 标记 local 几何需要重新构建。 */
|
|
196
198
|
markGeometryNeedsLayout(notifyScene?: boolean): void;
|
|
197
199
|
/** 安排当前元素所属 Layer 重绘。 @internal */
|
package/dist/node/node.d.ts
CHANGED
|
@@ -87,8 +87,8 @@ export declare class Node<P extends NodeProperties = NodeProperties, Child exten
|
|
|
87
87
|
detachBatchParent(): void;
|
|
88
88
|
/** @internal 接收 trusted batch 转移所有权的最终 children 快照。 */
|
|
89
89
|
installBatchChildren(children: readonly Node[]): void;
|
|
90
|
-
/** @internal
|
|
91
|
-
|
|
90
|
+
/** @internal 按当前 parent 同步最终 lifecycle context。 */
|
|
91
|
+
syncPlacementLifecycle(): void;
|
|
92
92
|
/** @internal tree 已完整安装后登记当前 owner 的 dirty path。 */
|
|
93
93
|
publishBatchStructureDirty(): void;
|
|
94
94
|
/** @internal raw links 与 placement lifecycle 同步完成后运行结构 hook。 */
|