@fulate/ui 1.0.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/README.md +199 -0
- package/dist/authored-path.d.ts +28 -0
- package/dist/bitmap.d.ts +19 -0
- package/dist/circle.d.ts +23 -0
- package/dist/connection/commands.d.ts +27 -0
- package/dist/connection/endpoint-relation-index.d.ts +27 -0
- package/dist/connection/index.d.ts +4 -0
- package/dist/connection/types.d.ts +37 -0
- package/dist/connection-port-decoration.d.ts +27 -0
- package/dist/editor/capability.d.ts +150 -0
- package/dist/editor/frame-flush.d.ts +39 -0
- package/dist/editor/shape.d.ts +38 -0
- package/dist/editor/transform.d.ts +8 -0
- package/dist/floating.d.ts +9 -0
- package/dist/group.d.ts +44 -0
- package/dist/image.d.ts +52 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +5956 -0
- package/dist/line/base.d.ts +142 -0
- package/dist/line/helpers/decoration.d.ts +4 -0
- package/dist/line/index.d.ts +3 -0
- package/dist/line/straight-primitives.d.ts +8 -0
- package/dist/line/straight.d.ts +19 -0
- package/dist/line-tree/history-delta.d.ts +22 -0
- package/dist/line-tree/index.d.ts +74 -0
- package/dist/line-tree/topology.d.ts +39 -0
- package/dist/line-tree/transform.d.ts +54 -0
- package/dist/line-tree/types.d.ts +46 -0
- package/dist/paint/circle.d.ts +3 -0
- package/dist/point-controls.d.ts +6 -0
- package/dist/polygon.d.ts +52 -0
- package/dist/rectangle.d.ts +27 -0
- package/dist/ripple.d.ts +29 -0
- package/dist/scrollview.d.ts +68 -0
- package/dist/text/block.d.ts +31 -0
- package/dist/text/editing.d.ts +16 -0
- package/dist/text/index.d.ts +149 -0
- package/dist/text/layout.d.ts +101 -0
- package/dist/text/paint.d.ts +59 -0
- package/dist/text/style.d.ts +13 -0
- package/dist/triangle.d.ts +20 -0
- package/dist/vector-path.d.ts +58 -0
- package/dist/worker-surface-protocol.d.ts +26 -0
- package/dist/worker-surface-worker.d.ts +25 -0
- package/dist/worker-surface-worker.js +109 -0
- package/dist/worker-surface.d.ts +23 -0
- package/dist/workspace.d.ts +44 -0
- package/package.json +33 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { ChangeImpact, Element, ElementTransform, ElementProperties, type AnchorId, type AuthoredPathAnchor, type AuthoredSubpath, type BaseElementOption, type ConnectionPortRef, type GeometrySnapshot, type Layer, type OwnerPropertyChange, type PropertyChanges, type Root, type SegmentId, type ElementTransformBaseline, type ReferenceTransformBaseline, type ReparentTransformIntent, type TransformIntent } from "@fulate/core";
|
|
2
|
+
import { type Rect, type PointView } from "@fulate/share";
|
|
3
|
+
import { type BindableEndpoint, type EndpointConnectionRole, type EndpointRelation, type EndpointRelationBinding } from "../connection/types";
|
|
4
|
+
import { SelectionBehaviorMode, SelectionDiveMode, SelectionSnapMode, type EditorCapabilityToken } from "../editor/capability";
|
|
5
|
+
/** 省略一端表示保持,own `undefined` 表示清除该端。 */
|
|
6
|
+
export interface LineEndpointRelationPatch {
|
|
7
|
+
readonly head?: EndpointRelation | undefined;
|
|
8
|
+
readonly tail?: EndpointRelation | undefined;
|
|
9
|
+
}
|
|
10
|
+
export type LineDecoration = "none" | "arrow" | "dot";
|
|
11
|
+
export interface LineOption extends Omit<BaseElementOption<BaseLine>, "ports"> {
|
|
12
|
+
/** 普通创建传 points;JSON/History/clipboard restore 直接传 canonical subpath。 */
|
|
13
|
+
path?: readonly PointView[] | AuthoredSubpath;
|
|
14
|
+
relations?: LineEndpointRelationPatch;
|
|
15
|
+
/** 显式线色;省略时使用 Root Skin 的 `lineStroke`。 */
|
|
16
|
+
strokeColor?: string;
|
|
17
|
+
strokeWidth?: number;
|
|
18
|
+
headDecoration?: LineDecoration;
|
|
19
|
+
tailDecoration?: LineDecoration;
|
|
20
|
+
}
|
|
21
|
+
type LinePatch = Omit<LineOption, "key" | "layer" | "children">;
|
|
22
|
+
interface LineTransformOwnedState {
|
|
23
|
+
readonly path: AuthoredSubpath;
|
|
24
|
+
readonly effective?: {
|
|
25
|
+
readonly path: AuthoredSubpath;
|
|
26
|
+
readonly reference: ReferenceTransformBaseline;
|
|
27
|
+
readonly relationPatch?: LineEndpointRelationPatch;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
interface LineStateOption extends Omit<LineOption, "path" | "relations"> {
|
|
31
|
+
path?: AuthoredSubpath;
|
|
32
|
+
headRelation?: EndpointRelation;
|
|
33
|
+
tailRelation?: EndpointRelation;
|
|
34
|
+
}
|
|
35
|
+
declare class LineProperties extends ElementProperties {
|
|
36
|
+
path: AuthoredSubpath;
|
|
37
|
+
headRelation?: EndpointRelation;
|
|
38
|
+
tailRelation?: EndpointRelation;
|
|
39
|
+
strokeColor?: string;
|
|
40
|
+
strokeWidth: number;
|
|
41
|
+
headDecoration: LineDecoration;
|
|
42
|
+
tailDecoration: LineDecoration;
|
|
43
|
+
constructor(options?: LineStateOption);
|
|
44
|
+
toJSON(): Record<string, unknown>;
|
|
45
|
+
getImpact(changes: PropertyChanges): ChangeImpact;
|
|
46
|
+
}
|
|
47
|
+
export declare class LineTransform<E extends BaseLine = BaseLine> extends ElementTransform<E> {
|
|
48
|
+
private layoutPathSource;
|
|
49
|
+
private layoutPathBounds;
|
|
50
|
+
protected resolveFitSize(): void;
|
|
51
|
+
protected buildLayoutReferenceBounds(): Readonly<Rect> | null;
|
|
52
|
+
protected getWorldMatrixReferenceBounds(): Readonly<Rect> | null;
|
|
53
|
+
protected worldMatrixAffectsLocalGeometry(): boolean;
|
|
54
|
+
private resolveEndpointPoint;
|
|
55
|
+
private resolveEffectiveSubpath;
|
|
56
|
+
protected buildGeometrySnapshot(revision: number, layoutReferenceBounds?: Readonly<Rect>): GeometrySnapshot;
|
|
57
|
+
protected buildLocalHitBounds(snapshot: GeometrySnapshot): Readonly<Rect> | null;
|
|
58
|
+
protected buildVisualBounds(snapshot: GeometrySnapshot): Readonly<Rect> | null;
|
|
59
|
+
protected buildVisualOutline(snapshot: GeometrySnapshot): PointView[];
|
|
60
|
+
private getVisualPadding;
|
|
61
|
+
protected getOwnContentBoundsView(): Readonly<Rect>;
|
|
62
|
+
protected buildWorldVisualBounds(): import("@fulate/share").Bound;
|
|
63
|
+
hasInView(): boolean;
|
|
64
|
+
hasPointHint(point: PointView): boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface LineEndpointUpdate {
|
|
67
|
+
/** 仅首尾 anchor 使用;省略保持,own `undefined` 清除 relation。 */
|
|
68
|
+
readonly target?: ConnectionPortRef | undefined;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Base class for line elements. The one open authored subpath owns coordinates
|
|
72
|
+
* and stable local IDs; endpoint relations contain no geometry coordinates.
|
|
73
|
+
*/
|
|
74
|
+
export declare abstract class BaseLine extends Element<LineProperties, LineOption, LinePatch> {
|
|
75
|
+
get path(): AuthoredSubpath<AuthoredPathAnchor>;
|
|
76
|
+
get headRelation(): EndpointRelation;
|
|
77
|
+
get tailRelation(): EndpointRelation;
|
|
78
|
+
get strokeColor(): string;
|
|
79
|
+
get strokeWidth(): number;
|
|
80
|
+
get headDecoration(): LineDecoration;
|
|
81
|
+
get tailDecoration(): LineDecoration;
|
|
82
|
+
protected getResolvedStrokeColor(): string;
|
|
83
|
+
private endpointRelationIndex;
|
|
84
|
+
private worldGeometrySource;
|
|
85
|
+
private worldPointView;
|
|
86
|
+
private worldLineMatrixA;
|
|
87
|
+
private worldLineMatrixB;
|
|
88
|
+
private worldLineMatrixC;
|
|
89
|
+
private worldLineMatrixD;
|
|
90
|
+
private worldLineMatrixE;
|
|
91
|
+
private worldLineMatrixF;
|
|
92
|
+
constructor(options?: LineOption);
|
|
93
|
+
/** 把当前 source-authored relations 同步到 Root 唯一 reverse index。 */
|
|
94
|
+
private syncEndpointRelations;
|
|
95
|
+
protected getDefaultConnectionPortSchema(): any[];
|
|
96
|
+
getBindableEndpoints(): readonly BindableEndpoint[];
|
|
97
|
+
getEndpointRole(anchorId: AnchorId): EndpointConnectionRole | null;
|
|
98
|
+
getEndpointRelationBindings(): readonly EndpointRelationBinding[];
|
|
99
|
+
getEditorCapability<T>(token: EditorCapabilityToken<T>): T | undefined;
|
|
100
|
+
getSelectionBehavior(): {
|
|
101
|
+
readonly mode: SelectionBehaviorMode.Standard;
|
|
102
|
+
readonly dive: SelectionDiveMode.None;
|
|
103
|
+
readonly snap: SelectionSnapMode.Enabled;
|
|
104
|
+
};
|
|
105
|
+
getTransformPolicy(): {
|
|
106
|
+
readonly move: true;
|
|
107
|
+
readonly resize: "both";
|
|
108
|
+
readonly rotate: true;
|
|
109
|
+
readonly rotationPivot: "adjustable";
|
|
110
|
+
};
|
|
111
|
+
protected resolvePointPathPatch(path: AuthoredSubpath): LinePatch;
|
|
112
|
+
captureTransformBaseline(): ElementTransformBaseline<LineTransformOwnedState>;
|
|
113
|
+
resolveTransformChange(baseline: Readonly<ElementTransformBaseline<LineTransformOwnedState>>, intent: Readonly<TransformIntent | ReparentTransformIntent>): OwnerPropertyChange;
|
|
114
|
+
protected resolveOptions(options: LinePatch): LinePatch;
|
|
115
|
+
get headAnchor(): AuthoredPathAnchor;
|
|
116
|
+
get tailAnchor(): AuthoredPathAnchor;
|
|
117
|
+
get headPoint(): PointView | undefined;
|
|
118
|
+
get tailPoint(): PointView | undefined;
|
|
119
|
+
getAnchorIndex(anchorId: AnchorId): number;
|
|
120
|
+
getSegmentIndex(segmentId: SegmentId): number;
|
|
121
|
+
getEndpointRelation(anchorId: AnchorId): EndpointRelation;
|
|
122
|
+
resolveConnectEndpointChange(anchorId: AnchorId, target: ConnectionPortRef): OwnerPropertyChange | null;
|
|
123
|
+
resolveDisconnectEndpointChange(anchorIds: readonly AnchorId[], localPositions?: ReadonlyMap<AnchorId, PointView>): OwnerPropertyChange | null;
|
|
124
|
+
worldToLocal(x: number, y: number): PointView | null;
|
|
125
|
+
/** 返回可独立修改的 world point 结果。 */
|
|
126
|
+
getWorldLinePoints(): PointView[];
|
|
127
|
+
/** @internal Borrowed committed polyline coordinates for paint and hit tests. */
|
|
128
|
+
getWorldLinePointsView(): readonly PointView[];
|
|
129
|
+
/** @internal Borrowed effective local vertices from the canonical snapshot. */
|
|
130
|
+
getEffectiveLineVerticesView(): readonly import("@fulate/core").ResolvedVertex[];
|
|
131
|
+
getWorldSnapPointsView(): readonly PointView[];
|
|
132
|
+
addPoint(x: number, y: number, target?: ConnectionPortRef): AnchorId;
|
|
133
|
+
setLocalPoint(anchorId: AnchorId, point: PointView, endpointUpdate?: LineEndpointUpdate): void;
|
|
134
|
+
movePoint(anchorId: AnchorId, worldX: number, worldY: number): void;
|
|
135
|
+
insertPoint(segmentId: SegmentId, worldX: number, worldY: number): AnchorId;
|
|
136
|
+
removePoint(anchorId: AnchorId): void;
|
|
137
|
+
getLocalPoints(): PointView[];
|
|
138
|
+
protected onPropertiesChanged(current: LineProperties, changes: PropertyChanges): void;
|
|
139
|
+
protected onActivate(root: Root | null, layer: Layer | null): void;
|
|
140
|
+
protected onDeactivate(root: Root | null, layer: Layer | null): void;
|
|
141
|
+
}
|
|
142
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LineDecoration } from "../base";
|
|
2
|
+
import type { PointView } from "@fulate/share";
|
|
3
|
+
export declare function getDecorationLineInset(decoration: LineDecoration): number;
|
|
4
|
+
export declare function drawDecoration(ctx: CanvasRenderingContext2D, decoration: LineDecoration, from: PointView, to: PointView, color: string): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Bound, type BoundingBox, type PointView } from "@fulate/share";
|
|
2
|
+
import type { LineDecoration } from "./base";
|
|
3
|
+
export declare function tracePolyline(ctx: CanvasRenderingContext2D, points: readonly PointView[], headInset?: number, tailInset?: number): void;
|
|
4
|
+
export declare function paintPolyline(ctx: CanvasRenderingContext2D, points: readonly PointView[], strokeColor: string, strokeWidth: number, headDecoration?: LineDecoration, tailDecoration?: LineDecoration): void;
|
|
5
|
+
export declare function hasPolylinePointHint(points: readonly PointView[], point: PointView, viewportScale: number): boolean;
|
|
6
|
+
export declare function getLineVisualPadding(strokeWidth: number): number;
|
|
7
|
+
/** world-space line paint uses fixed-width stroke/decorations after pose projection. */
|
|
8
|
+
export declare function expandLineWorldVisualBounds(bounds: Readonly<BoundingBox>, padding: number): Bound;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseLine, type LineOption } from "./base";
|
|
2
|
+
import type { PointView } from "@fulate/share";
|
|
3
|
+
import { type EditorCapabilityToken, type PointEditRequest, type PointEditingScope, type PointOwnerEdit } from "../editor/capability";
|
|
4
|
+
export declare class Line extends BaseLine {
|
|
5
|
+
readonly type = "line";
|
|
6
|
+
constructor(options?: LineOption);
|
|
7
|
+
getEditorCapability<T>(token: EditorCapabilityToken<T>): T | undefined;
|
|
8
|
+
resolvePointScope(worldPoint: PointView): {
|
|
9
|
+
readonly kind: "owner";
|
|
10
|
+
};
|
|
11
|
+
hasPointScope(scope: PointEditingScope): scope is {
|
|
12
|
+
readonly kind: "owner";
|
|
13
|
+
};
|
|
14
|
+
getPointControls(_scope: PointEditingScope): import("..").PointControlDescriptor[];
|
|
15
|
+
getPointScopeOutline(_scope: PointEditingScope): any;
|
|
16
|
+
resolvePointEdit(request: PointEditRequest): PointOwnerEdit | null;
|
|
17
|
+
paint(ctx?: CanvasRenderingContext2D): void;
|
|
18
|
+
paintHover(ctx: CanvasRenderingContext2D, scale: number): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AnchorId, SubpathId } from "@fulate/core";
|
|
2
|
+
import type { LineTreeBranch, LineTreePoint, LineTreeTopology } from "./types";
|
|
3
|
+
interface LineTreeRecordState<T> {
|
|
4
|
+
readonly index: number;
|
|
5
|
+
readonly value: T;
|
|
6
|
+
}
|
|
7
|
+
interface LineTreeRecordChange<Id, Value> {
|
|
8
|
+
readonly id: Id;
|
|
9
|
+
readonly before?: LineTreeRecordState<Value>;
|
|
10
|
+
readonly after?: LineTreeRecordState<Value>;
|
|
11
|
+
}
|
|
12
|
+
export interface LineTreeTopologyDelta {
|
|
13
|
+
readonly rootSubpathId?: {
|
|
14
|
+
readonly before: SubpathId | undefined;
|
|
15
|
+
readonly after: SubpathId | undefined;
|
|
16
|
+
};
|
|
17
|
+
readonly points: readonly LineTreeRecordChange<AnchorId, LineTreePoint>[];
|
|
18
|
+
readonly branches: readonly LineTreeRecordChange<SubpathId, LineTreeBranch>[];
|
|
19
|
+
}
|
|
20
|
+
export declare function createLineTreeTopologyDelta(before: LineTreeTopology, after: LineTreeTopology): LineTreeTopologyDelta | null;
|
|
21
|
+
export declare function applyLineTreeTopologyDelta(topology: LineTreeTopology, delta: LineTreeTopologyDelta, direction: "before" | "after"): LineTreeTopology;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ChangeImpact, Element, ElementProperties, type ElementTransformBaseline, type ConnectionPortRef, type Layer, type OwnerPropertyChange, type PropertyChanges, type ReparentTransformIntent, type Root, type AnchorId, type SubpathId, type TransformIntent } from "@fulate/core";
|
|
2
|
+
import { type PointView } from "@fulate/share";
|
|
3
|
+
import { SelectionBehaviorMode, SelectionDiveMode, SelectionSnapMode, type EditorCapabilityToken, type PointEditRequest, type PointEditingScope, type PointOwnerEdit } from "../editor/capability";
|
|
4
|
+
import { type BindableEndpoint, type EndpointRelation, type EndpointRelationBinding } from "../connection/types";
|
|
5
|
+
import { LineTreeTransform } from "./transform";
|
|
6
|
+
import type { LineTreeOption, LineTreeTopology } from "./types";
|
|
7
|
+
type LineTreePatch = Omit<LineTreeOption, "key" | "children">;
|
|
8
|
+
interface LineTreeTransformOwnedState {
|
|
9
|
+
readonly topology: LineTreeTopology;
|
|
10
|
+
readonly effective?: {
|
|
11
|
+
readonly topology: LineTreeTopology;
|
|
12
|
+
readonly reference: ElementTransformBaseline["reference"];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare class LineTreeProperties extends ElementProperties {
|
|
16
|
+
topology: LineTreeTopology;
|
|
17
|
+
constructor(options?: LineTreeOption);
|
|
18
|
+
getImpact(changes: PropertyChanges): ChangeImpact;
|
|
19
|
+
}
|
|
20
|
+
export declare class LineTree extends Element<LineTreeProperties, LineTreeOption, LineTreePatch> {
|
|
21
|
+
readonly type = "lineTree";
|
|
22
|
+
get topology(): LineTreeTopology;
|
|
23
|
+
private endpointRelationIndex;
|
|
24
|
+
constructor(options?: LineTreeOption);
|
|
25
|
+
/** 把 root/leaf source relations 同步到 Root 唯一 reverse index。 */
|
|
26
|
+
private syncEndpointRelations;
|
|
27
|
+
protected getDefaultConnectionPortSchema(): any[];
|
|
28
|
+
getBindableEndpoints(): readonly BindableEndpoint[];
|
|
29
|
+
getEndpointRelationBindings(): readonly EndpointRelationBinding[];
|
|
30
|
+
readonly transform: LineTreeTransform<this>;
|
|
31
|
+
protected resolveOptions(options: LineTreePatch): LineTreePatch;
|
|
32
|
+
replaceTopology(topology: LineTreeTopology): this;
|
|
33
|
+
getEditorCapability<T>(token: EditorCapabilityToken<T>): T | undefined;
|
|
34
|
+
getSelectionBehavior(): {
|
|
35
|
+
readonly mode: SelectionBehaviorMode.Standard;
|
|
36
|
+
readonly dive: SelectionDiveMode.None;
|
|
37
|
+
readonly snap: SelectionSnapMode.Enabled;
|
|
38
|
+
};
|
|
39
|
+
getTransformPolicy(): {
|
|
40
|
+
readonly move: true;
|
|
41
|
+
readonly resize: "both";
|
|
42
|
+
readonly rotate: true;
|
|
43
|
+
readonly rotationPivot: "adjustable";
|
|
44
|
+
};
|
|
45
|
+
private materializeEffectiveTopology;
|
|
46
|
+
private preservePoseForTopology;
|
|
47
|
+
captureTransformBaseline(): ElementTransformBaseline<LineTreeTransformOwnedState>;
|
|
48
|
+
resolveTransformChange(baseline: Readonly<ElementTransformBaseline<LineTreeTransformOwnedState>>, intent: Readonly<TransformIntent | ReparentTransformIntent>): OwnerPropertyChange;
|
|
49
|
+
getWorldSnapPointsView(): readonly PointView[];
|
|
50
|
+
getEndpointRole(anchorId: AnchorId): "input" | "output";
|
|
51
|
+
getEndpointRelation(anchorId: AnchorId): EndpointRelation;
|
|
52
|
+
resolveConnectEndpointChange(anchorId: AnchorId, target: ConnectionPortRef): OwnerPropertyChange | null;
|
|
53
|
+
resolveDisconnectEndpointChange(anchorIds: readonly AnchorId[], localPositions?: ReadonlyMap<AnchorId, PointView>): OwnerPropertyChange | null;
|
|
54
|
+
resolvePointScope(point: PointView, current?: PointEditingScope): PointEditingScope | null;
|
|
55
|
+
hasPointScope(scope: PointEditingScope): boolean;
|
|
56
|
+
getPointControls(scope: PointEditingScope): import("..").PointControlDescriptor[];
|
|
57
|
+
getPointScopeOutline(scope: PointEditingScope): readonly PointView[];
|
|
58
|
+
resolvePointEdit(request: PointEditRequest): PointOwnerEdit | null;
|
|
59
|
+
getBranch(subpathId: SubpathId): import("./types").LineTreeBranch;
|
|
60
|
+
resolveSubpathAtWorldPoint(point: PointView, preferredSubpathId?: SubpathId): SubpathId;
|
|
61
|
+
/** @internal Tools 的 L 扩展只读取已提交分支的尾点。 */
|
|
62
|
+
getBranchTailSource(subpathId: SubpathId): import("./types").LineTreeBranchTailSource;
|
|
63
|
+
/** @internal Transform source-pick 只命中分支尾点,不命中树干。 */
|
|
64
|
+
resolveBranchTailAtWorldPoint(point: PointView): import("./types").LineTreeBranchTailSource;
|
|
65
|
+
paint(ctx?: CanvasRenderingContext2D): void;
|
|
66
|
+
paintHover(ctx: CanvasRenderingContext2D, scale: number): void;
|
|
67
|
+
paintBranchHighlight(ctx: CanvasRenderingContext2D, scale: number, subpathId: SubpathId): void;
|
|
68
|
+
protected onPropertiesChanged(current: LineTreeProperties, changes: PropertyChanges): void;
|
|
69
|
+
protected onActivate(root: Root | null, layer: Layer | null): void;
|
|
70
|
+
protected onDeactivate(root: Root | null, layer: Layer | null): void;
|
|
71
|
+
}
|
|
72
|
+
export { LineTreeTransform } from "./transform";
|
|
73
|
+
export { EMPTY_LINE_TREE_TOPOLOGY, DEFAULT_LINE_TREE_BRANCH_STYLE, addLineTreeBranchAtTail, createLineTreeTopology, getLineTreeBranch, getLineTreeBindableEndpoints, getLineTreeEndpointRelationBindings, getLineTreeEndpointRole, getLineTreeJunctionAnchorIds, getLineTreePoint, getLineTreePointReferenceCounts, insertLineTreePoint, moveLineTreePoint, removeLineTreeBranch, removeLineTreePoint, remapLineTreeRelations, scaleLineTreeTopology, updateLineTreeBranchStyle } from "./topology";
|
|
74
|
+
export type { LineTreeBranch, LineTreeBranchRemoval, LineTreeBranchTailSource, LineTreeBranchStyle, LineTreeBranchVertex, LineTreeOption, LineTreePoint, LineTreeTopology } from "./types";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type AnchorId, type SegmentId, type SubpathId } from "@fulate/core";
|
|
2
|
+
import type { PointView } from "@fulate/share";
|
|
3
|
+
import type { Rect } from "@fulate/share";
|
|
4
|
+
import type { LineEndpointRelationPatch } from "../line/base";
|
|
5
|
+
import type { BindableEndpoint, EndpointRelation, EndpointRelationBinding } from "../connection/types";
|
|
6
|
+
import type { LineTreeBranch, LineTreeBranchRemoval, LineTreeBranchStyle, LineTreePoint, LineTreeTopology } from "./types";
|
|
7
|
+
export declare const EMPTY_LINE_TREE_TOPOLOGY: LineTreeTopology;
|
|
8
|
+
export declare const DEFAULT_LINE_TREE_BRANCH_STYLE: LineTreeBranchStyle;
|
|
9
|
+
export declare function getLineTreeTopologyBounds(topology: LineTreeTopology): Readonly<Rect> | null;
|
|
10
|
+
export declare function createLineTreeTopology(points: readonly PointView[], style?: LineTreeBranchStyle, relations?: LineEndpointRelationPatch): LineTreeTopology;
|
|
11
|
+
export declare function getLineTreePoint(topology: LineTreeTopology, anchorId: AnchorId): LineTreePoint;
|
|
12
|
+
export declare function getLineTreeBranch(topology: LineTreeTopology, subpathId: SubpathId): LineTreeBranch;
|
|
13
|
+
export declare function getLineTreePointReferenceCounts(topology: LineTreeTopology): Map<AnchorId, number>;
|
|
14
|
+
export declare function getLineTreeJunctionAnchorIds(topology: LineTreeTopology): AnchorId[];
|
|
15
|
+
export declare function getLineTreeEndpointRelationBindings(topology: LineTreeTopology, elementKey: string): readonly EndpointRelationBinding[];
|
|
16
|
+
export declare function getLineTreeBindableEndpoints(topology: LineTreeTopology, elementKey: string): readonly BindableEndpoint[];
|
|
17
|
+
export declare function getLineTreeEndpointRole(topology: LineTreeTopology, anchorId: AnchorId): "input" | "output";
|
|
18
|
+
export declare function moveLineTreePoint(topology: LineTreeTopology, anchorId: AnchorId, point: PointView, relation: EndpointRelation | undefined): LineTreeTopology;
|
|
19
|
+
export declare function insertLineTreePoint(topology: LineTreeTopology, segmentId: SegmentId, point: PointView): {
|
|
20
|
+
topology: {
|
|
21
|
+
points: LineTreePoint[];
|
|
22
|
+
branches: LineTreeBranch[];
|
|
23
|
+
rootSubpathId: SubpathId | undefined;
|
|
24
|
+
};
|
|
25
|
+
anchorId: AnchorId;
|
|
26
|
+
};
|
|
27
|
+
export declare function removeLineTreePoint(topology: LineTreeTopology, anchorId: AnchorId): LineTreeTopology;
|
|
28
|
+
export declare function addLineTreeBranchAtTail(topology: LineTreeTopology, parentSubpathId: SubpathId, points: readonly PointView[], style?: LineTreeBranchStyle, tailRelation?: EndpointRelation): {
|
|
29
|
+
topology: {
|
|
30
|
+
points: LineTreePoint[];
|
|
31
|
+
branches: LineTreeBranch[];
|
|
32
|
+
rootSubpathId: SubpathId | undefined;
|
|
33
|
+
};
|
|
34
|
+
subpathId: SubpathId;
|
|
35
|
+
};
|
|
36
|
+
export declare function removeLineTreeBranch(topology: LineTreeTopology, subpathId: SubpathId): LineTreeBranchRemoval;
|
|
37
|
+
export declare function updateLineTreeBranchStyle(topology: LineTreeTopology, subpathId: SubpathId, style: LineTreeBranchStyle): LineTreeTopology;
|
|
38
|
+
export declare function scaleLineTreeTopology(topology: LineTreeTopology, scaleX: number, scaleY: number): LineTreeTopology;
|
|
39
|
+
export declare function remapLineTreeRelations(topology: LineTreeTopology, keyMap: ReadonlyMap<string, string>): LineTreeTopology;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ElementTransform, type AnchorId, type GeometrySnapshot, type SubpathId } from "@fulate/core";
|
|
2
|
+
import { type PointView, type Rect } from "@fulate/share";
|
|
3
|
+
import type { LineTree } from "./index";
|
|
4
|
+
import type { LineTreeBranch, LineTreeBranchTailSource, LineTreePoint } from "./types";
|
|
5
|
+
export declare class LineTreeTransform<E extends LineTree = LineTree> extends ElementTransform<E> {
|
|
6
|
+
private topologySource;
|
|
7
|
+
private pointById;
|
|
8
|
+
private branchById;
|
|
9
|
+
private junctionAnchorIds;
|
|
10
|
+
private junctionAnchorIdSet;
|
|
11
|
+
private layoutBounds;
|
|
12
|
+
private resolvedPointById;
|
|
13
|
+
private worldGeometrySource;
|
|
14
|
+
private worldBranchPoints;
|
|
15
|
+
private worldPointById;
|
|
16
|
+
private worldSnapPoints;
|
|
17
|
+
private worldMatrixA;
|
|
18
|
+
private worldMatrixB;
|
|
19
|
+
private worldMatrixC;
|
|
20
|
+
private worldMatrixD;
|
|
21
|
+
private worldMatrixE;
|
|
22
|
+
private worldMatrixF;
|
|
23
|
+
private ensureTopologyViews;
|
|
24
|
+
getPoint(anchorId: AnchorId): LineTreePoint;
|
|
25
|
+
getBranch(subpathId: SubpathId): LineTreeBranch;
|
|
26
|
+
getResolvedPoint(anchorId: AnchorId): LineTreePoint;
|
|
27
|
+
getJunctionAnchorIds(): readonly AnchorId[];
|
|
28
|
+
isJunctionAnchor(anchorId: AnchorId): boolean;
|
|
29
|
+
protected buildLayoutReferenceBounds(): Readonly<Rect>;
|
|
30
|
+
protected getWorldMatrixReferenceBounds(): Readonly<Rect>;
|
|
31
|
+
protected worldMatrixAffectsLocalGeometry(): boolean;
|
|
32
|
+
private resolveEndpointPoint;
|
|
33
|
+
protected buildGeometrySnapshot(revision: number, layoutReferenceBounds?: Readonly<Rect>): GeometrySnapshot;
|
|
34
|
+
protected buildLocalHitBounds(snapshot: GeometrySnapshot): Readonly<Rect>;
|
|
35
|
+
private getVisualPadding;
|
|
36
|
+
protected buildVisualBounds(snapshot: GeometrySnapshot): {
|
|
37
|
+
left: number;
|
|
38
|
+
top: number;
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
};
|
|
42
|
+
protected buildVisualOutline(snapshot: GeometrySnapshot): PointView[];
|
|
43
|
+
protected getOwnContentBoundsView(): Readonly<Rect>;
|
|
44
|
+
protected buildWorldVisualBounds(): import("@fulate/share").Bound;
|
|
45
|
+
hasInView(): boolean;
|
|
46
|
+
private updateWorldPoints;
|
|
47
|
+
getWorldBranchPointsView(subpathId: SubpathId): readonly PointView[];
|
|
48
|
+
getWorldPointView(anchorId: AnchorId): PointView;
|
|
49
|
+
getWorldSnapPointsView(): readonly PointView[];
|
|
50
|
+
getBranchTailSource(subpathId: SubpathId): LineTreeBranchTailSource;
|
|
51
|
+
resolveBranchTailAtWorldPoint(point: PointView): LineTreeBranchTailSource | undefined;
|
|
52
|
+
resolveSubpathAtWorldPoint(point: PointView, preferredSubpathId?: SubpathId): SubpathId;
|
|
53
|
+
hasPointHint(point: PointView): boolean;
|
|
54
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { AnchorId, BaseElementOption, SegmentId, SubpathId } from "@fulate/core";
|
|
2
|
+
import type { PointView } from "@fulate/share";
|
|
3
|
+
import type { EndpointRelation } from "../connection/types";
|
|
4
|
+
import type { LineDecoration } from "../line/base";
|
|
5
|
+
import type { LineTree } from "./index";
|
|
6
|
+
export interface LineTreePoint {
|
|
7
|
+
readonly anchorId: AnchorId;
|
|
8
|
+
readonly point: PointView;
|
|
9
|
+
readonly relation?: EndpointRelation;
|
|
10
|
+
}
|
|
11
|
+
export interface LineTreeBranchStyle {
|
|
12
|
+
/** 显式分支线色;省略时使用 Root Skin 的 `lineStroke`。 */
|
|
13
|
+
readonly strokeColor?: string;
|
|
14
|
+
readonly strokeWidth: number;
|
|
15
|
+
readonly headDecoration: LineDecoration;
|
|
16
|
+
readonly tailDecoration: LineDecoration;
|
|
17
|
+
}
|
|
18
|
+
export interface LineTreeBranchVertex {
|
|
19
|
+
readonly anchorId: AnchorId;
|
|
20
|
+
readonly segmentId?: SegmentId;
|
|
21
|
+
}
|
|
22
|
+
export interface LineTreeBranch {
|
|
23
|
+
readonly subpathId: SubpathId;
|
|
24
|
+
readonly parentSubpathId?: SubpathId;
|
|
25
|
+
readonly closed: false;
|
|
26
|
+
readonly vertices: readonly LineTreeBranchVertex[];
|
|
27
|
+
readonly style: LineTreeBranchStyle;
|
|
28
|
+
}
|
|
29
|
+
export interface LineTreeTopology {
|
|
30
|
+
readonly rootSubpathId: SubpathId | undefined;
|
|
31
|
+
readonly points: readonly LineTreePoint[];
|
|
32
|
+
readonly branches: readonly LineTreeBranch[];
|
|
33
|
+
}
|
|
34
|
+
export interface LineTreeOption extends Omit<BaseElementOption<LineTree>, "children" | "ports"> {
|
|
35
|
+
topology?: LineTreeTopology;
|
|
36
|
+
}
|
|
37
|
+
export interface LineTreeBranchRemoval {
|
|
38
|
+
readonly topology: LineTreeTopology;
|
|
39
|
+
readonly parentSubpathId: SubpathId | undefined;
|
|
40
|
+
}
|
|
41
|
+
export interface LineTreeBranchTailSource {
|
|
42
|
+
readonly subpathId: SubpathId;
|
|
43
|
+
readonly anchorId: AnchorId;
|
|
44
|
+
readonly local: PointView;
|
|
45
|
+
readonly world: PointView;
|
|
46
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type AnchorId, type ResolvedSegmentShape, type SegmentId } from "@fulate/core";
|
|
2
|
+
import type { PointView } from "@fulate/share";
|
|
3
|
+
import type { PointControlDescriptor } from "./editor/capability";
|
|
4
|
+
export declare function createAnchorPointControl(anchorId: AnchorId, local: PointView, role: "endpoint" | "vertex", deletable: boolean): PointControlDescriptor;
|
|
5
|
+
export declare function createSegmentPointControl(segmentId: SegmentId, start: PointView, end: PointView, shape?: ResolvedSegmentShape): PointControlDescriptor;
|
|
6
|
+
export declare function createHandlePointControl(segmentId: SegmentId, role: "cubic-control-1" | "cubic-control-2", local: PointView, anchorLocal: PointView): PointControlDescriptor;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type Edge, type Rect, type PointView } from "@fulate/share";
|
|
2
|
+
import { ChangeImpact, ShapeProperties, type AuthoredSubpath, type GeometrySnapshot, type OwnerPropertyChange, type PropertyChanges, type ReparentTransformIntent, type ShapeOption, type ShapeOptionPatch, type ElementTransformBaseline, type TransformIntent } from "@fulate/core";
|
|
3
|
+
import { type EditorCapabilityToken, type PointEditRequest, type PointEditingScope, type PointOwnerEdit } from "./editor/capability";
|
|
4
|
+
import { EditorShape, EditorShapeTransform } from "./editor/shape";
|
|
5
|
+
export interface PolygonOption extends ShapeOption<Polygon> {
|
|
6
|
+
/** 普通创建传 points;JSON/History/clipboard restore 直接传 canonical contour。 */
|
|
7
|
+
contour?: readonly PointView[] | AuthoredSubpath;
|
|
8
|
+
}
|
|
9
|
+
type PolygonPatch = ShapeOptionPatch<PolygonOption>;
|
|
10
|
+
interface PolygonStateOption extends Omit<PolygonOption, "contour"> {
|
|
11
|
+
contour?: AuthoredSubpath;
|
|
12
|
+
}
|
|
13
|
+
declare class PolygonProperties extends ShapeProperties {
|
|
14
|
+
contour: AuthoredSubpath;
|
|
15
|
+
constructor(options?: PolygonStateOption);
|
|
16
|
+
getImpact(changes: PropertyChanges): ChangeImpact;
|
|
17
|
+
}
|
|
18
|
+
export declare class PolygonTransform<E extends Polygon = Polygon> extends EditorShapeTransform<E> {
|
|
19
|
+
protected buildLayoutReferenceBounds(): Readonly<Rect> | null;
|
|
20
|
+
protected buildGeometrySnapshot(revision: number, layoutReferenceBounds?: Readonly<Rect>): GeometrySnapshot;
|
|
21
|
+
protected buildVisualOutline(snapshot: GeometrySnapshot): PointView[];
|
|
22
|
+
}
|
|
23
|
+
/** Polygon owns exactly one closed straight canonical contour. */
|
|
24
|
+
export declare class Polygon extends EditorShape<PolygonProperties, PolygonOption> {
|
|
25
|
+
readonly type = "polygon";
|
|
26
|
+
get contour(): AuthoredSubpath<import("@fulate/core").AuthoredPathAnchor>;
|
|
27
|
+
constructor(options?: PolygonOption);
|
|
28
|
+
protected resolveOptions(options: PolygonPatch): Partial<Omit<PolygonOption, "key" | "children">>;
|
|
29
|
+
getEditorCapability<T>(token: EditorCapabilityToken<T>): T | undefined;
|
|
30
|
+
resolvePointScope(worldPoint: PointView): {
|
|
31
|
+
readonly kind: "owner";
|
|
32
|
+
};
|
|
33
|
+
hasPointScope(scope: PointEditingScope): scope is {
|
|
34
|
+
readonly kind: "owner";
|
|
35
|
+
};
|
|
36
|
+
getPointControls(_scope: PointEditingScope): import(".").PointControlDescriptor[];
|
|
37
|
+
getPointScopeOutline(_scope: PointEditingScope): any;
|
|
38
|
+
resolvePointEdit(request: PointEditRequest): PointOwnerEdit | null;
|
|
39
|
+
captureTransformBaseline(): ElementTransformBaseline<AuthoredSubpath<import("@fulate/core").AuthoredPathAnchor>>;
|
|
40
|
+
resolveTransformChange(baseline: Readonly<ElementTransformBaseline<AuthoredSubpath>>, intent: Readonly<TransformIntent | ReparentTransformIntent>): OwnerPropertyChange;
|
|
41
|
+
protected buildPath(ctx: CanvasRenderingContext2D): void;
|
|
42
|
+
protected buildBorderPath(ctx: CanvasRenderingContext2D): void;
|
|
43
|
+
getEdgeSegment(edge: Edge): {
|
|
44
|
+
start: PointView;
|
|
45
|
+
end: PointView;
|
|
46
|
+
};
|
|
47
|
+
protected getDefaultConnectionPortSchema(): {
|
|
48
|
+
id: string;
|
|
49
|
+
localPosition: () => PointView;
|
|
50
|
+
}[];
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ChangeImpact, type ElementTransformClass, ShapeProperties, type GeometrySnapshot, type PropertyChanges, type ShapeOption, type ShapeOptionPatch } from "@fulate/core";
|
|
2
|
+
import { type Edge, type PointView } from "@fulate/share";
|
|
3
|
+
import { EditorShape, EditorShapeTransform } from "./editor/shape";
|
|
4
|
+
export interface RectangleOption<T = Rectangle> extends ShapeOption<T> {
|
|
5
|
+
radius?: number | null;
|
|
6
|
+
}
|
|
7
|
+
export type RectangleOptionPatch<O extends RectangleOption<any> = RectangleOption> = ShapeOptionPatch<O>;
|
|
8
|
+
export declare class RectangleProperties extends ShapeProperties {
|
|
9
|
+
radius: number | null;
|
|
10
|
+
constructor(options?: RectangleOption);
|
|
11
|
+
getImpact(changes: PropertyChanges): ChangeImpact;
|
|
12
|
+
}
|
|
13
|
+
/** Rectangle rounded canonical geometry companion runtime。 */
|
|
14
|
+
export declare class RectangleTransform<E extends Rectangle = Rectangle> extends EditorShapeTransform<E> {
|
|
15
|
+
protected buildGeometrySnapshot(revision: number, layoutReferenceBounds?: Readonly<import("@fulate/share").Rect>): GeometrySnapshot;
|
|
16
|
+
}
|
|
17
|
+
export declare class Rectangle<P extends RectangleProperties = RectangleProperties, O extends RectangleOption<any> = RectangleOption<any>> extends EditorShape<P, O> {
|
|
18
|
+
readonly type: string;
|
|
19
|
+
get radius(): number;
|
|
20
|
+
constructor(options?: NoInfer<O>, properties?: P, Transform?: ElementTransformClass);
|
|
21
|
+
protected buildPath(ctx: CanvasRenderingContext2D): void;
|
|
22
|
+
/**
|
|
23
|
+
* Rectangle Ports follow its width/height box. Subclasses with different
|
|
24
|
+
* Port geometry must override this method.
|
|
25
|
+
*/
|
|
26
|
+
getConnectionPortPosition(edge: Edge, ratio: number): PointView;
|
|
27
|
+
}
|
package/dist/ripple.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ChangeImpact, type Layer, type PropertyChanges, type Root } from "@fulate/core";
|
|
2
|
+
import { Rectangle, RectangleProperties, type RectangleOption } from "./rectangle";
|
|
3
|
+
export interface RippleOption extends RectangleOption<RippleOverlay> {
|
|
4
|
+
rippleColor?: string;
|
|
5
|
+
rippleOpacity?: number;
|
|
6
|
+
duration?: number;
|
|
7
|
+
}
|
|
8
|
+
declare class RippleProperties extends RectangleProperties {
|
|
9
|
+
rippleColor: string;
|
|
10
|
+
rippleOpacity: number;
|
|
11
|
+
duration: number;
|
|
12
|
+
constructor(options?: RippleOption);
|
|
13
|
+
getImpact(changes: PropertyChanges): ChangeImpact;
|
|
14
|
+
}
|
|
15
|
+
/** 拥有自身瞬时状态与 Tween,并在离开活动 Root 时结束它们。 */
|
|
16
|
+
export declare class RippleOverlay extends Rectangle<RippleProperties, RippleOption> {
|
|
17
|
+
readonly type = "ripple";
|
|
18
|
+
get rippleColor(): string;
|
|
19
|
+
get rippleOpacity(): number;
|
|
20
|
+
get duration(): number;
|
|
21
|
+
private ripples;
|
|
22
|
+
constructor(options?: RippleOption);
|
|
23
|
+
/** 从全局逻辑坐标触发涟漪 */
|
|
24
|
+
trigger(globalX: number, globalY: number): void;
|
|
25
|
+
private spawn;
|
|
26
|
+
protected onDeactivate(root: Root | null, layer: Layer | null): void;
|
|
27
|
+
protected paintHost(ctx: CanvasRenderingContext2D): void;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ChangeImpact, CustomEvent, type Layer, type PropertyChanges, type Root } from "@fulate/core";
|
|
2
|
+
import { Rectangle, RectangleProperties, RectangleTransform, type RectangleOption } from "./rectangle";
|
|
3
|
+
import type { PointView } from "@fulate/share";
|
|
4
|
+
export interface ScrollViewOption extends RectangleOption<ScrollView> {
|
|
5
|
+
scrollX?: number;
|
|
6
|
+
scrollY?: number;
|
|
7
|
+
contentWidth?: number;
|
|
8
|
+
contentHeight?: number;
|
|
9
|
+
maxWidth?: number;
|
|
10
|
+
maxHeight?: number;
|
|
11
|
+
scrollbarSize?: number;
|
|
12
|
+
scrollbarColor?: string;
|
|
13
|
+
scrollbarTrackColor?: string;
|
|
14
|
+
scrollEndThreshold?: number;
|
|
15
|
+
}
|
|
16
|
+
declare class ScrollViewProperties extends RectangleProperties {
|
|
17
|
+
scrollX: number;
|
|
18
|
+
scrollY: number;
|
|
19
|
+
maxWidth?: number;
|
|
20
|
+
maxHeight?: number;
|
|
21
|
+
scrollbarSize: number;
|
|
22
|
+
scrollbarColor: string;
|
|
23
|
+
scrollbarTrackColor: string;
|
|
24
|
+
scrollEndThreshold: number;
|
|
25
|
+
constructor(options?: ScrollViewOption);
|
|
26
|
+
getImpact(changes: PropertyChanges): ChangeImpact;
|
|
27
|
+
}
|
|
28
|
+
export declare class ScrollViewTransform<E extends ScrollView = ScrollView> extends RectangleTransform<E> {
|
|
29
|
+
private readonly childWorldMatrix;
|
|
30
|
+
protected onChildrenChanged(): void;
|
|
31
|
+
protected onDescendantDirty(): void;
|
|
32
|
+
protected getChildWorldMatrixView(): DOMMatrixReadOnly;
|
|
33
|
+
protected resolveFitSize(): void;
|
|
34
|
+
}
|
|
35
|
+
export declare class ScrollView extends Rectangle<ScrollViewProperties, ScrollViewOption> {
|
|
36
|
+
readonly type = "scrollview";
|
|
37
|
+
get scrollX(): number;
|
|
38
|
+
get scrollY(): number;
|
|
39
|
+
get maxWidth(): number;
|
|
40
|
+
get maxHeight(): number;
|
|
41
|
+
get scrollbarSize(): number;
|
|
42
|
+
get scrollbarColor(): string;
|
|
43
|
+
get scrollbarTrackColor(): string;
|
|
44
|
+
get scrollEndThreshold(): number;
|
|
45
|
+
contentWidth: number;
|
|
46
|
+
contentHeight: number;
|
|
47
|
+
private verticalThumb;
|
|
48
|
+
private horizontalThumb;
|
|
49
|
+
private dragging;
|
|
50
|
+
private dragAxis;
|
|
51
|
+
private dragStartScroll;
|
|
52
|
+
private dragStartPointer;
|
|
53
|
+
private interactionAbort;
|
|
54
|
+
constructor(options?: ScrollViewOption);
|
|
55
|
+
protected fireCallbacks(event: CustomEvent): void;
|
|
56
|
+
protected onActivate(root: Root | null, layer: Layer | null): void;
|
|
57
|
+
protected onDeactivate(root: Root | null, layer: Layer | null): void;
|
|
58
|
+
getChildClipRect(): Readonly<import("@fulate/share").Rect>;
|
|
59
|
+
/** ScrollView paints a rectangular viewport even when its border is rounded. */
|
|
60
|
+
containsChildClipPoint(point: PointView): boolean;
|
|
61
|
+
scrollTo(x: number, y: number): void;
|
|
62
|
+
scrollBy(dx: number, dy: number): void;
|
|
63
|
+
protected paintHost(ctx: CanvasRenderingContext2D): void;
|
|
64
|
+
protected paintScrollbars(ctx: CanvasRenderingContext2D): void;
|
|
65
|
+
private hitThumb;
|
|
66
|
+
private initDragInteraction;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Rect } from "@fulate/share";
|
|
2
|
+
import { TextLayoutSnapshot, type TextLayoutMetrics } from "./layout";
|
|
3
|
+
import { type ResolvedTextStyle } from "./style";
|
|
4
|
+
export interface TextBlockLayoutInput {
|
|
5
|
+
readonly text: string;
|
|
6
|
+
readonly style: ResolvedTextStyle;
|
|
7
|
+
readonly width?: number;
|
|
8
|
+
readonly height?: number;
|
|
9
|
+
readonly overflow: "hidden" | "visible";
|
|
10
|
+
readonly wordWrap?: boolean;
|
|
11
|
+
readonly maxLines?: number;
|
|
12
|
+
readonly ellipsis?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Text 与内部组合共享的唯一准备和最终排版 owner。 */
|
|
15
|
+
export declare class TextBlock {
|
|
16
|
+
private prepared;
|
|
17
|
+
private metrics;
|
|
18
|
+
private metricsKey;
|
|
19
|
+
private snapshot;
|
|
20
|
+
private snapshotKey;
|
|
21
|
+
get layout(): TextLayoutSnapshot;
|
|
22
|
+
/** Yoga 只需要这个紧凑结果;这里不生成 PaintLine/source range。 */
|
|
23
|
+
measure(input: TextBlockLayoutInput): TextLayoutMetrics;
|
|
24
|
+
/** Final width 已确定后生成一次 PaintLine snapshot,后续直接复用。 */
|
|
25
|
+
sync(input: TextBlockLayoutInput): TextLayoutSnapshot;
|
|
26
|
+
invalidate(): void;
|
|
27
|
+
private getPrepared;
|
|
28
|
+
private getLayoutKey;
|
|
29
|
+
}
|
|
30
|
+
/** 返回与共享 glyph painter 一致的文字 visual bounds。 */
|
|
31
|
+
export declare function getTextBlockVisualBounds(layout: TextLayoutSnapshot, style: ResolvedTextStyle, width: number, height: number): Rect | null;
|