@fulate/core 1.0.13 → 1.0.15
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/geometry/index.d.ts +3 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +385 -250
- package/dist/layer/index.d.ts +7 -7
- package/dist/mutation/change-batch.d.ts +5 -5
- package/dist/mutation/structure-change.d.ts +31 -12
- package/dist/node/element-transform-geometry.d.ts +3 -3
- package/dist/node/element-transform.d.ts +10 -10
- package/dist/node/element.d.ts +5 -2
- package/dist/node/node.d.ts +23 -3
- package/dist/node/reference-transform.d.ts +9 -9
- package/dist/node/shape.d.ts +12 -0
- package/dist/root/index.d.ts +9 -11
- package/dist/root/viewport.d.ts +2 -2
- package/dist/utils/connection-port.d.ts +2 -2
- package/package.json +1 -1
package/dist/layer/index.d.ts
CHANGED
|
@@ -102,6 +102,8 @@ export declare class Layer<P extends LayerProperties = LayerProperties, O extend
|
|
|
102
102
|
private static FULL_REPAINT_RATIO;
|
|
103
103
|
/** 候选命中达到空间项此比例时直接完整重绘。 */
|
|
104
104
|
private static CANDIDATE_FULL_REPAINT_RATIO;
|
|
105
|
+
/** 完整重绘的 viewport 候选达到空间项此比例时改为逐 child 判断可见性。 */
|
|
106
|
+
private static VIEWPORT_CANDIDATE_RATIO;
|
|
105
107
|
/** 空间项变更超过现有项此比例时重建整个 RBush。 */
|
|
106
108
|
private static RBUSH_REBUILD_RATIO;
|
|
107
109
|
/** 将零散 damage 合并为有限数量矩形的网格。 */
|
|
@@ -193,14 +195,12 @@ export declare class Layer<P extends LayerProperties = LayerProperties, O extend
|
|
|
193
195
|
private hasPendingDamage;
|
|
194
196
|
/** 清理本次已覆盖且没有再次失效的提交前 visual bounds。 */
|
|
195
197
|
private clearPaintedDamage;
|
|
196
|
-
/**
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
*
|
|
200
|
-
* @internal
|
|
198
|
+
/**
|
|
199
|
+
* 清空并重新绘制整个 Layer Canvas。dirty-rect Layer 的元素只绘制在 visual bounds 内,
|
|
200
|
+
* 因此直接用 viewport 的 RBush 候选组织绘制树;候选密度达到阈值时逐 child 判断可见性。
|
|
201
201
|
*/
|
|
202
|
-
|
|
203
|
-
/** 从最终 damage 的 RBush hits
|
|
202
|
+
private fullRepaint;
|
|
203
|
+
/** 从最终 damage 的 RBush hits 构建一次绘制期有序邻接表;达到候选密度时返回 `null`。 */
|
|
204
204
|
private buildDirtyPaintChildren;
|
|
205
205
|
/** 裁剪到 damage 矩形,并消费已经完成组织的候选绘制树。 */
|
|
206
206
|
private paintDirtyRects;
|
|
@@ -8,15 +8,15 @@ export interface OwnerPropertyChange {
|
|
|
8
8
|
readonly patch: Readonly<Record<string, unknown>>;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* 可选 semantic History owner 消费的 actual changed fields
|
|
12
|
-
* before 是 finalize 已有的 raw configured source
|
|
13
|
-
*
|
|
11
|
+
* 可选 semantic History owner 消费的 actual changed fields 与 affected parents。
|
|
12
|
+
* before 是 finalize 已有的 raw configured source 或被替换下来的 children 原引用;
|
|
13
|
+
* sink 在语义操作结束时读取 live final,并决定是否持久化复制。
|
|
14
14
|
*/
|
|
15
15
|
export interface ChangeHistorySink {
|
|
16
16
|
/** 记录一个 owner/key 首次触及批次提供的 raw configured before。 */
|
|
17
17
|
recordPropertyChange(owner: Element, key: string, before: unknown): void;
|
|
18
|
-
/**
|
|
19
|
-
|
|
18
|
+
/** 记录一个 parent 实际改变 children 前的原数组;Core 不再修改该数组。 */
|
|
19
|
+
recordStructureChange(owner: Node, before: readonly Node[]): void;
|
|
20
20
|
}
|
|
21
21
|
/** @internal 合并 raw owner effects;单个 patch 直接借用,仅合并同 owner 字段时分配。 */
|
|
22
22
|
export declare function mergeOwnerPropertyChanges(ownerEffects: readonly OwnerPropertyChange[]): Map<Element<import("..").ElementProperties, import("..").BaseElementOption<any>, Partial<Omit<import("..").BaseElementOption<any>, "key" | "children">>>, Readonly<Record<string, unknown>>>;
|
|
@@ -4,9 +4,31 @@ export interface StructureChange {
|
|
|
4
4
|
readonly owner: Node;
|
|
5
5
|
readonly children: readonly Node[];
|
|
6
6
|
}
|
|
7
|
+
/** @internal 一个节点在一次 children 替换中的实际位置变化。 */
|
|
8
|
+
export interface ChildPlacementChange {
|
|
9
|
+
readonly node: Node;
|
|
10
|
+
/** 替换前的 index;新进入的节点为 `-1`。 */
|
|
11
|
+
readonly beforeIndex: number;
|
|
12
|
+
/** 替换后的 index;离开的节点为 `-1`。 */
|
|
13
|
+
readonly afterIndex: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @internal 两份 children 的最小差异。
|
|
17
|
+
*
|
|
18
|
+
* 只报告进入、离开,以及不在最长保序子序列中的移动节点;仅因前面插入或删除而改变
|
|
19
|
+
* index 的兄弟保持相对顺序,不属于变化。`[start, end)` 是新 children 中 raw links
|
|
20
|
+
* 可能改变的窗口,之外的公共前后缀与旧 children 完全相同。
|
|
21
|
+
*/
|
|
22
|
+
export interface ChildrenDiff {
|
|
23
|
+
readonly start: number;
|
|
24
|
+
readonly end: number;
|
|
25
|
+
readonly changes: readonly ChildPlacementChange[];
|
|
26
|
+
}
|
|
7
27
|
/** @internal affected-parent install 与 publication 共用的最终 delta。 */
|
|
8
28
|
export interface PreparedStructureChange extends StructureChange {
|
|
9
29
|
readonly before: readonly Node[];
|
|
30
|
+
readonly start: number;
|
|
31
|
+
readonly end: number;
|
|
10
32
|
readonly changed: readonly Node[];
|
|
11
33
|
}
|
|
12
34
|
/** @internal structure finalize 交给 install/publication 的局部记录。 */
|
|
@@ -14,17 +36,14 @@ export interface PreparedStructureBatch {
|
|
|
14
36
|
readonly changes: readonly PreparedStructureChange[];
|
|
15
37
|
readonly placementNodes: ReadonlySet<Node>;
|
|
16
38
|
}
|
|
17
|
-
/** @internal
|
|
18
|
-
export
|
|
19
|
-
readonly node: Node;
|
|
20
|
-
readonly beforeOwner: Node | null;
|
|
21
|
-
readonly beforeIndex: number;
|
|
22
|
-
}
|
|
39
|
+
/** @internal 计算同一 owner 两份 children 的最小 placement 差异。 */
|
|
40
|
+
export declare function diffChildren(before: readonly Node[], after: readonly Node[]): ChildrenDiff;
|
|
23
41
|
/** @internal 按 parent 对象身份合并,并只保留最终非空变化。 */
|
|
24
42
|
export declare function prepareStructureBatch(effects: readonly StructureChange[]): PreparedStructureBatch;
|
|
25
|
-
/** @internal
|
|
26
|
-
export declare function
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
43
|
+
/** @internal 直接安装 affected raw links。 */
|
|
44
|
+
export declare function installStructureLinks(batch: PreparedStructureBatch): void;
|
|
45
|
+
/**
|
|
46
|
+
* @internal 所有 fields/raw links 安装及 History 记录后,自上而下同步每个 placement 节点;
|
|
47
|
+
* parent 先完成自身迁移,同批进入它的 children 再按 parent 的最终 context 同步。
|
|
48
|
+
*/
|
|
49
|
+
export declare function syncStructureLifecycles(nodes: ReadonlySet<Node>): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Bound, type Rect } from "@fulate/share";
|
|
1
|
+
import { Bound, type ReadonlyMatrix2D, type Rect } from "@fulate/share";
|
|
2
2
|
/** Project a local rectangle into a matrix space and return its AABB. */
|
|
3
|
-
export declare function projectBounds(matrix:
|
|
3
|
+
export declare function projectBounds(matrix: ReadonlyMatrix2D, bounds: Readonly<Rect> | null): Bound;
|
|
4
4
|
/** Compare a committed matrix with a previous scalar matrix sample. */
|
|
5
|
-
export declare function matrixChanged(matrix:
|
|
5
|
+
export declare function matrixChanged(matrix: ReadonlyMatrix2D, previousA: number, previousB: number, previousC: number, previousD: number, previousE: number, previousF: number): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bound, type BoundingBox, type PointView, type Rect } from "@fulate/share";
|
|
1
|
+
import { Bound, Matrix2D, type BoundingBox, type PointView, type ReadonlyMatrix2D, type Rect } from "@fulate/share";
|
|
2
2
|
import { type GeometryPathPoint, type GeometryPathPosition, type GeometryQuery, type GeometrySnapshot } from "../geometry";
|
|
3
3
|
import type { Root } from "../root";
|
|
4
4
|
import type { Element } from "./element";
|
|
@@ -113,13 +113,13 @@ export declare class ElementTransform<E extends Element = Element> {
|
|
|
113
113
|
/** 构建权威 local 绘制边界。 */
|
|
114
114
|
protected buildVisualBounds(snapshot: GeometrySnapshot): Readonly<Rect> | null;
|
|
115
115
|
/** 覆盖后可直接提供完整 world 矩阵;返回 `null` 使用标量变换。 */
|
|
116
|
-
protected buildWorldMatrix():
|
|
116
|
+
protected buildWorldMatrix(): ReadonlyMatrix2D | null;
|
|
117
117
|
/** 返回标量 world matrix 计算使用的 transform reference bounds。 */
|
|
118
118
|
protected getWorldMatrixReferenceBounds(): Readonly<Rect> | null;
|
|
119
119
|
/** world matrix 是否参与当前元素 local geometry 的解析。 */
|
|
120
120
|
protected worldMatrixAffectsLocalGeometry(): boolean;
|
|
121
121
|
/** 返回当前节点提供给 children 的 world 坐标空间。 */
|
|
122
|
-
protected getChildWorldMatrixView():
|
|
122
|
+
protected getChildWorldMatrixView(): ReadonlyMatrix2D;
|
|
123
123
|
/** 按属性影响范围失效对应的几何缓存。 */
|
|
124
124
|
private invalidateCache;
|
|
125
125
|
/** 借用 canonical snapshot 的 transform reference bounds。 @internal */
|
|
@@ -135,19 +135,19 @@ export declare class ElementTransform<E extends Element = Element> {
|
|
|
135
135
|
/** 返回复用当前快照的几何查询对象。 */
|
|
136
136
|
getGeometryQuery(): GeometryQuery;
|
|
137
137
|
/** 立即提交自身 world 矩阵并返回副本。 */
|
|
138
|
-
updateWorldMatrix():
|
|
138
|
+
updateWorldMatrix(): Matrix2D;
|
|
139
139
|
/** 清除 world 投影;world-dependent local geometry 只在矩阵实际变化时失效。 */
|
|
140
140
|
private finishWorldMatrixCommit;
|
|
141
141
|
/** 以给定 parent reference 组合当前 authored scalar matrix。 */
|
|
142
|
-
protected writeScalarMatrix(matrix:
|
|
142
|
+
protected writeScalarMatrix(matrix: Matrix2D, parentMatrix?: ReadonlyMatrix2D): Matrix2D;
|
|
143
143
|
/** 提交作者 world matrix 并清除依赖它的投影。 */
|
|
144
144
|
private commitWorldMatrix;
|
|
145
145
|
/** 返回已提交的 world 矩阵副本,不包含 Viewport 和 DPR。 */
|
|
146
|
-
getWorldMatrix():
|
|
146
|
+
getWorldMatrix(): Matrix2D;
|
|
147
147
|
/** 借用已提交矩阵;调用方不得修改或保留。 @internal */
|
|
148
|
-
getWorldMatrixView():
|
|
148
|
+
getWorldMatrixView(): ReadonlyMatrix2D;
|
|
149
149
|
/** 借用已提交 child 坐标空间的逆矩阵。 @internal */
|
|
150
|
-
getChildWorldInverseMatrixView():
|
|
150
|
+
getChildWorldInverseMatrixView(): ReadonlyMatrix2D;
|
|
151
151
|
/** 返回已解析尺寸中心对应的 world 坐标。 */
|
|
152
152
|
getWorldCenter(): PointView;
|
|
153
153
|
/** 将 local 点转换为 world 点。 */
|
|
@@ -175,7 +175,7 @@ export declare class ElementTransform<E extends Element = Element> {
|
|
|
175
175
|
/** 将 local AABB 四角投影为当前 own world matrix 下的 world AABB。 */
|
|
176
176
|
private toWorldBounds;
|
|
177
177
|
/** 将 local AABB 四角投影到指定 reference matrix。 */
|
|
178
|
-
protected toBounds(matrix:
|
|
178
|
+
protected toBounds(matrix: ReadonlyMatrix2D, bounds: Readonly<Rect> | null): Bound;
|
|
179
179
|
/** 惰性构建当前快照对应的 local 绘制轮廓。 */
|
|
180
180
|
private getVisualOutline;
|
|
181
181
|
/** 借用已提交的 world 绘制轮廓。 @internal */
|
|
@@ -229,7 +229,7 @@ export declare class ElementTransform<E extends Element = Element> {
|
|
|
229
229
|
/** 返回排除 decoration boundary 后的 world content subtree bounds。 */
|
|
230
230
|
getContentBounds(): Bound;
|
|
231
231
|
/** 在指定 reference 中沿 canonical local matrices 解析 content subtree。 */
|
|
232
|
-
protected collectContentBoundsInReference(parentMatrix:
|
|
232
|
+
protected collectContentBoundsInReference(parentMatrix: ReadonlyMatrix2D, referenceWorldInverse: ReadonlyMatrix2D): Bound | null;
|
|
233
233
|
/** 返回当前 content subtree 在直接 parent child reference 中的 AABB。 */
|
|
234
234
|
getContentBoundsInParentView(): GeometryBoundsView | null;
|
|
235
235
|
/** 借用排除 decoration boundary 后的已提交 world content bounds。 */
|
package/dist/node/element.d.ts
CHANGED
|
@@ -103,8 +103,6 @@ export declare class Element<P extends ElementProperties = ElementProperties, O
|
|
|
103
103
|
readonly type: string;
|
|
104
104
|
/** 当前 Element 唯一的变换与几何运行时。 */
|
|
105
105
|
readonly transform: ElementTransform<this>;
|
|
106
|
-
/** @internal Layer 内用于绘制顺序命中的已提交树序号。 */
|
|
107
|
-
committedPaintOrder: number;
|
|
108
106
|
/** hover 时使用的 CSS cursor。 */
|
|
109
107
|
get cursor(): string;
|
|
110
108
|
/** 是否绘制并参与命中。 */
|
|
@@ -241,6 +239,11 @@ export declare class Element<P extends ElementProperties = ElementProperties, O
|
|
|
241
239
|
protected applyChildClip(ctx: CanvasRenderingContext2D): void;
|
|
242
240
|
/** 绘制默认 hover 轮廓。 */
|
|
243
241
|
paintHover(ctx: CanvasRenderingContext2D, scale: number): void;
|
|
242
|
+
/**
|
|
243
|
+
* @internal 把与 `paintHover()` 等价的轮廓追加到当前 path,由调用方统一描边。
|
|
244
|
+
* 返回 `false` 时调用方改用 `paintHover()` 独立绘制。
|
|
245
|
+
*/
|
|
246
|
+
traceHoverOutline(_ctx: CanvasRenderingContext2D, _scale: number): boolean;
|
|
244
247
|
/** 从当前 live owner 直接解析一次可连接 Ports。 */
|
|
245
248
|
getConnectionPorts(): readonly ResolvedConnectionPort[];
|
|
246
249
|
private resolveCurrentConnectionPortProjection;
|
package/dist/node/node.d.ts
CHANGED
|
@@ -7,6 +7,11 @@ export interface NodeCreationOptions {
|
|
|
7
7
|
/** 场景内唯一 key;省略时由 Core 自动生成。 */
|
|
8
8
|
readonly key?: string;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @internal 按同一棵树的 preorder 比较两个节点;祖先排在后代之前。只沿两条 parent 链走到
|
|
12
|
+
* 最近公共祖先,比较其下两个 child 的 sibling 标签。
|
|
13
|
+
*/
|
|
14
|
+
export declare function compareTreeOrder(left: Node, right: Node): number;
|
|
10
15
|
/** Node 派发的非冒泡生命周期事件名。 */
|
|
11
16
|
export declare enum NodeLifecycleEvent {
|
|
12
17
|
/** 首次完成 mount 初始化。 */
|
|
@@ -43,6 +48,8 @@ export declare class Node<P extends NodeProperties = NodeProperties, Child exten
|
|
|
43
48
|
nextSibling: Node | null;
|
|
44
49
|
/** 上一个 sibling;只读使用,通过树操作维护。 */
|
|
45
50
|
previousSibling: Node | null;
|
|
51
|
+
/** @internal 在当前 parent children 中递增的顺序标签;只在同一 parent 的 children 间可比较。 */
|
|
52
|
+
siblingOrder: number;
|
|
46
53
|
/** 是否已完成首次 mount 且尚未卸载。 */
|
|
47
54
|
get isMounted(): boolean;
|
|
48
55
|
/** 是否处于活动 Root/Layer 上下文。 */
|
|
@@ -67,7 +74,10 @@ export declare class Node<P extends NodeProperties = NodeProperties, Child exten
|
|
|
67
74
|
get lastChild(): Child | null;
|
|
68
75
|
/** 创建持有指定 Properties 和可选 children 的结构节点。 */
|
|
69
76
|
constructor(options?: NodeCreationOptions, properties?: P, children?: readonly Child[]);
|
|
70
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* 安装最终 children 引用,只更新 `[start, end)` 窗口及其两侧邻居的 raw links;
|
|
79
|
+
* 窗口外的公共前后缀与旧 children 相同。
|
|
80
|
+
*/
|
|
71
81
|
private installChildren;
|
|
72
82
|
/** 建立结构所有权、上下文原型链和事件冒泡 parent。 */
|
|
73
83
|
private linkChild;
|
|
@@ -81,12 +91,22 @@ export declare class Node<P extends NodeProperties = NodeProperties, Child exten
|
|
|
81
91
|
protected onStructureDirty(): void;
|
|
82
92
|
/** 在 children 提交后通知扩展点、Root 和 dirty 路径。 */
|
|
83
93
|
private markStructureDirty;
|
|
94
|
+
/**
|
|
95
|
+
* 向 Root 发布已安装的 placement 变化。hook 重入提交更新 children 后,外层提交仍发布
|
|
96
|
+
* 自己已安装的变化;Root 按每个节点当前的 parent 与 lifecycle 过滤。
|
|
97
|
+
*/
|
|
98
|
+
private publishStructureChange;
|
|
84
99
|
/** 安装一次最终 children,并在当前提交仍有效时发布结构变化。 */
|
|
85
100
|
private commitChildren;
|
|
101
|
+
/**
|
|
102
|
+
* 同步本次进入与离开节点的 lifecycle。lifecycle 回调可以同步重入修改结构,因此每个节点都按
|
|
103
|
+
* 自己与当前 owner 的实时 parent 和 lifecycle 判断,不因 children 被新提交替换而遗漏其余节点。
|
|
104
|
+
*/
|
|
105
|
+
private syncCommittedLifecycles;
|
|
86
106
|
/** @internal trusted batch 解除真实变化节点的旧 placement。 */
|
|
87
107
|
detachBatchParent(): void;
|
|
88
|
-
/** @internal 接收 trusted batch 转移所有权的最终 children
|
|
89
|
-
installBatchChildren(children: readonly Node[]): void;
|
|
108
|
+
/** @internal 接收 trusted batch 转移所有权的最终 children 与其变化窗口。 */
|
|
109
|
+
installBatchChildren(children: readonly Node[], start: number, end: number): void;
|
|
90
110
|
/** @internal 按当前 parent 同步最终 lifecycle context。 */
|
|
91
111
|
syncPlacementLifecycle(): void;
|
|
92
112
|
/** @internal tree 已完整安装后登记当前 owner 的 dirty path。 */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PointView, type Rect } from "@fulate/share";
|
|
1
|
+
import { type PointView, type ReadonlyMatrix2D, type Rect } from "@fulate/share";
|
|
2
2
|
import type { ElementOptionPatch } from "./element";
|
|
3
3
|
import { type OriginX, type OriginY } from "./properties";
|
|
4
4
|
/** 交互开始时直接借用的作者 frame 标量。 */
|
|
@@ -18,9 +18,9 @@ export interface ReferenceTransformFrame {
|
|
|
18
18
|
/** 一次连续 Transform 唯一的 frozen reference。 */
|
|
19
19
|
export interface ReferenceTransformBaseline {
|
|
20
20
|
readonly writeMode: "frame-authored" | "authored-geometry" | "pose-authored";
|
|
21
|
-
readonly startWorldMatrix:
|
|
22
|
-
readonly startParentWorldMatrix:
|
|
23
|
-
readonly startParentWorldInverseMatrix:
|
|
21
|
+
readonly startWorldMatrix: ReadonlyMatrix2D;
|
|
22
|
+
readonly startParentWorldMatrix: ReadonlyMatrix2D;
|
|
23
|
+
readonly startParentWorldInverseMatrix: ReadonlyMatrix2D;
|
|
24
24
|
readonly referenceBounds: Readonly<Rect>;
|
|
25
25
|
readonly frame: Readonly<ReferenceTransformFrame>;
|
|
26
26
|
}
|
|
@@ -31,7 +31,7 @@ export interface ElementTransformBaseline<OwnedState = unknown> {
|
|
|
31
31
|
}
|
|
32
32
|
/** 当前显示帧从 frozen baseline 直接求值的世界 intent。 */
|
|
33
33
|
export interface TransformIntent {
|
|
34
|
-
readonly worldDelta:
|
|
34
|
+
readonly worldDelta: ReadonlyMatrix2D;
|
|
35
35
|
/** 连续旋转手势从 frozen baseline 累积的未折叠 world 角度。 */
|
|
36
36
|
readonly unwrappedRotationDelta?: number;
|
|
37
37
|
/**
|
|
@@ -42,18 +42,18 @@ export interface TransformIntent {
|
|
|
42
42
|
}
|
|
43
43
|
/** 只有显式 reparent 才携带的新 parent world reference。 */
|
|
44
44
|
export interface ReparentTransformIntent extends TransformIntent {
|
|
45
|
-
readonly targetParentWorldMatrix:
|
|
45
|
+
readonly targetParentWorldMatrix: ReadonlyMatrix2D;
|
|
46
46
|
}
|
|
47
47
|
/** 已由调用方持有的最终 world pose 与目标 parent inverse。 */
|
|
48
48
|
export interface ReferenceTransformTarget {
|
|
49
|
-
readonly worldMatrix:
|
|
49
|
+
readonly worldMatrix: ReadonlyMatrix2D;
|
|
50
50
|
readonly worldCenter: PointView;
|
|
51
|
-
readonly parentInverseMatrix:
|
|
51
|
+
readonly parentInverseMatrix: ReadonlyMatrix2D;
|
|
52
52
|
}
|
|
53
53
|
/** 通用 frame patch 与 authored local 坐标 delta。 */
|
|
54
54
|
export interface ReferenceTransformResolution {
|
|
55
55
|
readonly framePatch: Readonly<ElementOptionPatch>;
|
|
56
|
-
readonly authoredLocalDelta:
|
|
56
|
+
readonly authoredLocalDelta: ReadonlyMatrix2D;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* 用 owner 已算出的精确 authored bounds 修正 bake frame 的位置。
|
package/dist/node/shape.d.ts
CHANGED
|
@@ -145,6 +145,11 @@ export declare class Shape<P extends ShapeProperties = ShapeProperties, O extend
|
|
|
145
145
|
protected buildPath(ctx: CanvasRenderingContext2D): void;
|
|
146
146
|
/** 构建 border 描边路径 */
|
|
147
147
|
protected buildBorderPath(ctx: CanvasRenderingContext2D): void;
|
|
148
|
+
/**
|
|
149
|
+
* canonical geometry 是普通矩形时,向当前 path 追加向内偏移 `inset` 的等距矩形。
|
|
150
|
+
* 直边内缩描边与轮廓裁剪逐像素一致;其他几何返回 `false`,由调用方使用轮廓裁剪。
|
|
151
|
+
*/
|
|
152
|
+
private traceInsetRectangle;
|
|
148
153
|
/** 使用 Shape 的实际路径裁剪 children。 */
|
|
149
154
|
protected applyChildClip(ctx: CanvasRenderingContext2D): void;
|
|
150
155
|
/** Shape 的 child clip 与其实际填充 path 使用同一 canonical query。 */
|
|
@@ -157,5 +162,12 @@ export declare class Shape<P extends ShapeProperties = ShapeProperties, O extend
|
|
|
157
162
|
protected paintBorder(ctx: CanvasRenderingContext2D): void;
|
|
158
163
|
/** 在隔离的 Context 状态中绘制 shadow,不影响后续 fill 和 border。 */
|
|
159
164
|
private paintShadow;
|
|
165
|
+
/** 在轮廓内侧绘制 `1 / scale` 宽的 hover 轮廓。 */
|
|
160
166
|
paintHover(ctx: CanvasRenderingContext2D, scale: number): void;
|
|
167
|
+
/**
|
|
168
|
+
* @internal 普通矩形几何且 world 矩阵保持长度时,把与 `paintHover()` 相同的内侧轮廓追加到
|
|
169
|
+
* 当前 path;调用方随后在 Viewport 变换下以 `1 / scale` 线宽统一描边。
|
|
170
|
+
* 覆写 `paintHover()` 的子类同时覆写本方法,返回 `false` 或追加自身的等价轮廓。
|
|
171
|
+
*/
|
|
172
|
+
traceHoverOutline(ctx: CanvasRenderingContext2D, scale: number): boolean;
|
|
161
173
|
}
|
package/dist/root/index.d.ts
CHANGED
|
@@ -13,11 +13,6 @@ import { RootFrameRuntime } from "./frame-runtime";
|
|
|
13
13
|
import { SceneRegistry } from "./scene-registry";
|
|
14
14
|
import { type ChangeHistorySink, type OwnerPropertyChange, type StructureChange } from "../mutation/change-batch";
|
|
15
15
|
export type { QueryAreaBounds, QueryAreaOptions, QueryAreaOrder, IteratePointOptions } from "./hit-test";
|
|
16
|
-
/** Root 当前 committed Canvas/element 绘制顺序。 */
|
|
17
|
-
export interface PaintOrderKey {
|
|
18
|
-
readonly layer: number;
|
|
19
|
-
readonly element: number;
|
|
20
|
-
}
|
|
21
16
|
/** 场景树根节点,统一管理 Layer、Viewport、输入、查询和帧提交。 */
|
|
22
17
|
export declare class Root extends Node<NodeProperties, Layer> {
|
|
23
18
|
/** Root 的序列化类型。 */
|
|
@@ -102,16 +97,19 @@ export declare class Root extends Node<NodeProperties, Layer> {
|
|
|
102
97
|
private sortLayers;
|
|
103
98
|
/** @internal 在 children 事务提交后刷新 Layer 顺序、布局、绘制和 hover。 */
|
|
104
99
|
commitStructureChange(owner: Node, changed: readonly Node[]): void;
|
|
105
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* @internal 只消费受影响 owners/subgraph,并合并 Layer 工作。离开的节点已在停用时
|
|
102
|
+
* 登记旧区域;仍在 owner 下的进入或移动节点只重绘自身子树。绘制顺序由安装期的 sibling
|
|
103
|
+
* 标签直接给出,不需要重排整层。
|
|
104
|
+
*/
|
|
106
105
|
commitBatchStructureChanges(changes: readonly {
|
|
107
106
|
readonly owner: Node;
|
|
108
107
|
readonly changed: readonly Node[];
|
|
109
108
|
}[], layerOrderImpact?: boolean): void;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
getPaintOrderKey(element: Element): PaintOrderKey | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* @internal 按跨 Layer 的已提交绘制顺序比较两个活动元素;小于 0 表示 `left` 先绘制(在下方)。
|
|
111
|
+
*/
|
|
112
|
+
comparePaintOrder(left: Element, right: Element): number;
|
|
115
113
|
/** @internal Layer zIndex 变化后重排 Canvas 并刷新 hover。 */
|
|
116
114
|
commitLayerOrderChange(): void;
|
|
117
115
|
/** @internal 注销停用的 Layer,并清除其待提交帧工作。 */
|
package/dist/root/viewport.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Root } from "./index";
|
|
2
|
-
import type { Rect, RectWithCenter } from "@fulate/share";
|
|
2
|
+
import type { ReadonlyMatrix2D, Rect, RectWithCenter } from "@fulate/share";
|
|
3
3
|
import { type PointView } from "@fulate/share";
|
|
4
4
|
import type { Layer } from "../layer";
|
|
5
5
|
/** 可序列化的 Viewport 平移和缩放快照。 */
|
|
@@ -88,7 +88,7 @@ export declare class Viewport {
|
|
|
88
88
|
* @param ctx 要更新 transform 的 Layer 2D Context。
|
|
89
89
|
* @param ownMatrix 元素已提交的 own world matrix;绘制 Layer 本身时省略。
|
|
90
90
|
*/
|
|
91
|
-
applyTransform(ctx: CanvasRenderingContext2D, ownMatrix?:
|
|
91
|
+
applyTransform(ctx: CanvasRenderingContext2D, ownMatrix?: ReadonlyMatrix2D): void;
|
|
92
92
|
/** 将倍率限制在 Root 创建时的 min/max 范围内。 */
|
|
93
93
|
private clampScale;
|
|
94
94
|
/** 提交 Viewport 状态,并决定走 CSS 预览还是完整 Canvas 重绘。 */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Edge, type PointView } from "@fulate/share";
|
|
1
|
+
import { type Edge, type PointView, type ReadonlyMatrix2D } from "@fulate/share";
|
|
2
2
|
import type { Element } from "../node/element";
|
|
3
3
|
/** Element owner 内稳定、由调用者直接提供的普通字符串 Port ID。 */
|
|
4
4
|
export type ConnectionPortId = string;
|
|
@@ -79,7 +79,7 @@ export declare const DEFAULT_CONNECTION_PORT_SCHEMA: readonly DerivedConnectionP
|
|
|
79
79
|
/** 直接从 custom definitions 解析当前 local Port;不缓存、复制或改写输入。 */
|
|
80
80
|
export declare function resolveConnectionPortSlots(element: Element, definitions: readonly ConnectionPortDefinition[]): readonly ResolvedConnectionPortSlot[];
|
|
81
81
|
/** 将 local 点投影到当前已提交 world matrix。 */
|
|
82
|
-
export declare function projectConnectionPortPoint(matrix:
|
|
82
|
+
export declare function projectConnectionPortPoint(matrix: ReadonlyMatrix2D, point: PointView): PointView;
|
|
83
83
|
/** 按 owner-local ID 读取一个已知 Port;不受发现开关影响。 */
|
|
84
84
|
export declare function getElementConnectionPort(element: Element, portId: ConnectionPortId): ResolvedConnectionPort | undefined;
|
|
85
85
|
/** 返回一个 Port 的当前 committed world 坐标。 */
|