@fulate/ui 1.0.19 → 3.0.2
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 +130 -177
- package/dist/circle.d.ts +2 -1
- package/dist/connection/commands.d.ts +3 -3
- package/dist/connection/types.d.ts +5 -1
- package/dist/connection-port-decoration.d.ts +18 -2
- package/dist/editor/capability.d.ts +37 -6
- package/dist/editor/frame-flush.d.ts +3 -4
- package/dist/editor/properties.d.ts +31 -0
- package/dist/editor/shape-capability.d.ts +13 -0
- package/dist/editor/shape.d.ts +16 -19
- package/dist/editor/transform.d.ts +1 -3
- package/dist/editor-vector-path.d.ts +70 -0
- package/dist/floating.d.ts +12 -2
- package/dist/group.d.ts +17 -8
- package/dist/image.d.ts +16 -19
- package/dist/index.d.ts +15 -6
- package/dist/index.js +2757 -1555
- package/dist/line/base.d.ts +64 -27
- package/dist/line/geometry.d.ts +28 -0
- package/dist/line/index.d.ts +2 -0
- package/dist/line/label.d.ts +58 -0
- package/dist/line/orthogonal.d.ts +23 -0
- package/dist/line/serialization.d.ts +11 -0
- package/dist/line/straight.d.ts +7 -3
- package/dist/line-tree/history-delta.d.ts +2 -0
- package/dist/line-tree/index.d.ts +15 -8
- package/dist/line-tree/serialization.d.ts +2 -0
- package/dist/line-tree/transform.d.ts +1 -0
- package/dist/line-tree/types.d.ts +3 -2
- package/dist/polygon.d.ts +19 -38
- package/dist/rectangle.d.ts +5 -4
- package/dist/ripple.d.ts +18 -4
- package/dist/scrollbars.d.ts +36 -0
- package/dist/scrollview.d.ts +27 -21
- package/dist/serialization.d.ts +4 -0
- package/dist/text/block.d.ts +5 -1
- package/dist/text/editing.d.ts +54 -12
- package/dist/text/index.d.ts +22 -20
- package/dist/text/layout.d.ts +8 -2
- package/dist/text/paint.d.ts +3 -2
- package/dist/text/style.d.ts +4 -0
- package/dist/triangle.d.ts +10 -5
- package/dist/worker-surface-worker.d.ts +4 -1
- package/dist/worker-surface-worker.js +11 -8
- package/dist/worker-surface.d.ts +1 -0
- package/dist/workspace.d.ts +3 -3
- package/package.json +33 -33
- package/dist/authored-path.d.ts +0 -28
- package/dist/vector-path.d.ts +0 -58
package/dist/line/base.d.ts
CHANGED
|
@@ -1,65 +1,78 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { type LineGeometry } from "./geometry";
|
|
2
|
+
import { LineLabel } from "./label";
|
|
3
|
+
import { type OrthogonalEndpointInput } from "./orthogonal";
|
|
4
|
+
import { Element, ElementTransform, type AnchorId, type ElementPayload, type ConnectionPortRef, type ElementTransformBaseline, type GeometrySnapshot, type Layer, type OwnerPropertyChange, type PropertyChanges, type ReferenceTransformBaseline, type ReparentTransformIntent, type Root, type SegmentId, type TransformIntent } from "@fulate/core";
|
|
5
|
+
import { Bound, type PointView, type Rect } from "@fulate/share";
|
|
3
6
|
import { type BindableEndpoint, type EndpointConnectionRole, type EndpointRelation, type EndpointRelationBinding } from "../connection/types";
|
|
4
|
-
import { SelectionBehaviorMode, SelectionDiveMode, SelectionSnapMode, type EditorCapabilityToken } from "../editor/capability";
|
|
7
|
+
import { SelectionBehaviorMode, SelectionDiveMode, SelectionSnapMode, type ContentEditingConsumer, type EditorCapabilityToken } from "../editor/capability";
|
|
8
|
+
import { EditorElementProperties, type EditorElementOption, type EditorRuntimePatch } from "../editor/properties";
|
|
5
9
|
/** 省略一端表示保持,own `undefined` 表示清除该端。 */
|
|
6
10
|
export interface LineEndpointRelationPatch {
|
|
7
11
|
readonly head?: EndpointRelation | undefined;
|
|
8
12
|
readonly tail?: EndpointRelation | undefined;
|
|
9
13
|
}
|
|
10
14
|
export type LineDecoration = "none" | "arrow" | "dot";
|
|
11
|
-
export interface LineOption extends Omit<
|
|
12
|
-
/**
|
|
13
|
-
|
|
15
|
+
export interface LineOption extends Omit<EditorElementOption<BaseLine>, "ports"> {
|
|
16
|
+
/** manual 便捷创建传 points;两种模式的 canonical 创建及恢复直接传 geometry。 */
|
|
17
|
+
points?: readonly PointView[];
|
|
18
|
+
geometry?: LineGeometry;
|
|
14
19
|
relations?: LineEndpointRelationPatch;
|
|
15
20
|
/** 显式线色;省略时使用 Root Skin 的 `lineStroke`。 */
|
|
16
21
|
strokeColor?: string;
|
|
17
22
|
strokeWidth?: number;
|
|
18
23
|
headDecoration?: LineDecoration;
|
|
19
24
|
tailDecoration?: LineDecoration;
|
|
25
|
+
/** A horizontal label at half the effective route length; empty text hides it. */
|
|
26
|
+
text?: string;
|
|
20
27
|
}
|
|
21
28
|
type LinePatch = Omit<LineOption, "key" | "layer" | "children">;
|
|
22
29
|
interface LineTransformOwnedState {
|
|
23
|
-
readonly
|
|
30
|
+
readonly geometry: LineGeometry;
|
|
24
31
|
readonly effective?: {
|
|
25
|
-
readonly
|
|
32
|
+
readonly geometry: LineGeometry;
|
|
26
33
|
readonly reference: ReferenceTransformBaseline;
|
|
27
34
|
readonly relationPatch?: LineEndpointRelationPatch;
|
|
28
35
|
};
|
|
29
36
|
}
|
|
30
|
-
interface LineStateOption extends Omit<LineOption, "
|
|
31
|
-
|
|
37
|
+
interface LineStateOption extends Omit<LineOption, "points" | "relations"> {
|
|
38
|
+
geometry?: LineGeometry;
|
|
32
39
|
headRelation?: EndpointRelation;
|
|
33
40
|
tailRelation?: EndpointRelation;
|
|
34
41
|
}
|
|
35
|
-
declare class LineProperties extends
|
|
36
|
-
|
|
42
|
+
declare class LineProperties extends EditorElementProperties {
|
|
43
|
+
geometry: LineGeometry;
|
|
37
44
|
headRelation?: EndpointRelation;
|
|
38
45
|
tailRelation?: EndpointRelation;
|
|
39
46
|
strokeColor?: string;
|
|
40
47
|
strokeWidth: number;
|
|
41
48
|
headDecoration: LineDecoration;
|
|
42
49
|
tailDecoration: LineDecoration;
|
|
50
|
+
text: string;
|
|
43
51
|
constructor(options?: LineStateOption);
|
|
44
52
|
toJSON(): Record<string, unknown>;
|
|
45
|
-
getImpact(changes: PropertyChanges):
|
|
53
|
+
getImpact(changes: PropertyChanges): number;
|
|
46
54
|
}
|
|
55
|
+
/** Resolve the same world endpoint input for a Line and the editor's temporary draft. */
|
|
56
|
+
export declare function resolveOrthogonalEndpoint(root: Root | undefined, fallback: PointView, endpoint?: ConnectionPortRef): OrthogonalEndpointInput;
|
|
47
57
|
export declare class LineTransform<E extends BaseLine = BaseLine> extends ElementTransform<E> {
|
|
48
|
-
private
|
|
49
|
-
private
|
|
50
|
-
|
|
51
|
-
|
|
58
|
+
private layoutGeometrySource;
|
|
59
|
+
private layoutGeometryBounds;
|
|
60
|
+
/** @internal Authored bounds shared by dimensions and the matrix reference. */
|
|
61
|
+
buildLayoutReferenceBounds(): Readonly<Rect> | null;
|
|
52
62
|
protected getWorldMatrixReferenceBounds(): Readonly<Rect> | null;
|
|
53
63
|
protected worldMatrixAffectsLocalGeometry(): boolean;
|
|
54
64
|
private resolveEndpointPoint;
|
|
55
65
|
private resolveEffectiveSubpath;
|
|
56
66
|
protected buildGeometrySnapshot(revision: number, layoutReferenceBounds?: Readonly<Rect>): GeometrySnapshot;
|
|
57
67
|
protected buildLocalHitBounds(snapshot: GeometrySnapshot): Readonly<Rect> | null;
|
|
68
|
+
protected buildWorldHitBounds(): Bound;
|
|
69
|
+
private buildLineAndLabelBounds;
|
|
58
70
|
protected buildVisualBounds(snapshot: GeometrySnapshot): Readonly<Rect> | null;
|
|
59
71
|
protected buildVisualOutline(snapshot: GeometrySnapshot): PointView[];
|
|
60
72
|
private getVisualPadding;
|
|
61
73
|
protected getOwnContentBoundsView(): Readonly<Rect>;
|
|
62
|
-
protected buildWorldVisualBounds():
|
|
74
|
+
protected buildWorldVisualBounds(): Bound;
|
|
75
|
+
protected getOwnPNGExportBounds(): Bound;
|
|
63
76
|
hasInView(): boolean;
|
|
64
77
|
hasPointHint(point: PointView): boolean;
|
|
65
78
|
}
|
|
@@ -68,17 +81,34 @@ export interface LineEndpointUpdate {
|
|
|
68
81
|
readonly target?: ConnectionPortRef | undefined;
|
|
69
82
|
}
|
|
70
83
|
/**
|
|
71
|
-
* Base class for
|
|
72
|
-
* and
|
|
84
|
+
* Base class for manual and orthogonal Lines. Authored geometry owns coordinates
|
|
85
|
+
* and local IDs; endpoint relations contain no geometry coordinates.
|
|
73
86
|
*/
|
|
74
|
-
export declare abstract class BaseLine extends Element<LineProperties, LineOption, LinePatch
|
|
75
|
-
|
|
87
|
+
export declare abstract class BaseLine extends Element<LineProperties, LineOption, LinePatch, EditorRuntimePatch<LinePatch>> {
|
|
88
|
+
readonly transform: LineTransform<this>;
|
|
89
|
+
get width(): number;
|
|
90
|
+
get height(): number;
|
|
91
|
+
get rotationPivotX(): import("@fulate/core").OriginX;
|
|
92
|
+
get rotationPivotY(): import("@fulate/core").OriginY;
|
|
93
|
+
toJSON(): ElementPayload & {
|
|
94
|
+
geometry: LineGeometry;
|
|
95
|
+
relations?: LineEndpointRelationPatch;
|
|
96
|
+
};
|
|
97
|
+
get geometry(): LineGeometry;
|
|
98
|
+
get anchors(): readonly (import("@fulate/core").AuthoredTerminalAnchor | import("@fulate/core").AuthoredLineAnchor)[];
|
|
76
99
|
get headRelation(): EndpointRelation;
|
|
77
100
|
get tailRelation(): EndpointRelation;
|
|
78
101
|
get strokeColor(): string;
|
|
79
102
|
get strokeWidth(): number;
|
|
80
103
|
get headDecoration(): LineDecoration;
|
|
81
104
|
get tailDecoration(): LineDecoration;
|
|
105
|
+
get text(): string;
|
|
106
|
+
private textLabel;
|
|
107
|
+
/** @internal Borrow the one derived label layout; unlabeled lines allocate none. */
|
|
108
|
+
getTextLabel(): LineLabel;
|
|
109
|
+
protected beginLabelEditing(consumer: ContentEditingConsumer): import("..").ContentEditingSession;
|
|
110
|
+
/** @internal Release resources after a cleared label finishes editing. */
|
|
111
|
+
releaseEmptyTextLabel(label: LineLabel): void;
|
|
82
112
|
protected getResolvedStrokeColor(): string;
|
|
83
113
|
private endpointRelationIndex;
|
|
84
114
|
private worldGeometrySource;
|
|
@@ -92,7 +122,7 @@ export declare abstract class BaseLine extends Element<LineProperties, LineOptio
|
|
|
92
122
|
constructor(options?: LineOption);
|
|
93
123
|
/** 把当前 source-authored relations 同步到 Root 唯一 reverse index。 */
|
|
94
124
|
private syncEndpointRelations;
|
|
95
|
-
protected
|
|
125
|
+
protected getDefaultConnectionPortIds(): any[];
|
|
96
126
|
getBindableEndpoints(): readonly BindableEndpoint[];
|
|
97
127
|
getEndpointRole(anchorId: AnchorId): EndpointConnectionRole | null;
|
|
98
128
|
getEndpointRelationBindings(): readonly EndpointRelationBinding[];
|
|
@@ -102,18 +132,20 @@ export declare abstract class BaseLine extends Element<LineProperties, LineOptio
|
|
|
102
132
|
readonly dive: SelectionDiveMode.None;
|
|
103
133
|
readonly snap: SelectionSnapMode.Enabled;
|
|
104
134
|
};
|
|
135
|
+
/** Borrow effective path bounds for the editor frame, excluding paint padding. */
|
|
136
|
+
getSelectionFrameBounds(): Readonly<Rect>;
|
|
105
137
|
getTransformPolicy(): {
|
|
106
138
|
readonly move: true;
|
|
107
139
|
readonly resize: "both";
|
|
108
140
|
readonly rotate: true;
|
|
109
141
|
readonly rotationPivot: "adjustable";
|
|
110
142
|
};
|
|
111
|
-
|
|
143
|
+
resolvePointGeometryPatch(geometry: LineGeometry): LinePatch;
|
|
112
144
|
captureTransformBaseline(_bakeGeometry: boolean): ElementTransformBaseline<LineTransformOwnedState>;
|
|
113
145
|
resolveTransformChange(baseline: Readonly<ElementTransformBaseline<LineTransformOwnedState>>, intent: Readonly<TransformIntent | ReparentTransformIntent>): readonly OwnerPropertyChange[];
|
|
114
146
|
protected resolveOptions(options: LinePatch): LinePatch;
|
|
115
|
-
get headAnchor():
|
|
116
|
-
get tailAnchor():
|
|
147
|
+
get headAnchor(): import("@fulate/core").AuthoredTerminalAnchor | import("@fulate/core").AuthoredLineAnchor;
|
|
148
|
+
get tailAnchor(): import("@fulate/core").AuthoredTerminalAnchor | import("@fulate/core").AuthoredLineAnchor;
|
|
117
149
|
get headPoint(): PointView | undefined;
|
|
118
150
|
get tailPoint(): PointView | undefined;
|
|
119
151
|
getAnchorIndex(anchorId: AnchorId): number;
|
|
@@ -121,6 +153,7 @@ export declare abstract class BaseLine extends Element<LineProperties, LineOptio
|
|
|
121
153
|
getEndpointRelation(anchorId: AnchorId): EndpointRelation;
|
|
122
154
|
resolveConnectEndpointChange(anchorId: AnchorId, target: ConnectionPortRef): OwnerPropertyChange | null;
|
|
123
155
|
resolveDisconnectEndpointChange(anchorIds: readonly AnchorId[], localPositions?: ReadonlyMap<AnchorId, PointView>, patch?: Readonly<Record<string, unknown>>): OwnerPropertyChange | null;
|
|
156
|
+
/** 使用已提交的 world matrix 转换坐标。 */
|
|
124
157
|
worldToLocal(x: number, y: number): PointView | null;
|
|
125
158
|
/** 返回可独立修改的 world point 结果。 */
|
|
126
159
|
getWorldLinePoints(): PointView[];
|
|
@@ -129,13 +162,17 @@ export declare abstract class BaseLine extends Element<LineProperties, LineOptio
|
|
|
129
162
|
/** @internal Borrowed effective local vertices from the canonical snapshot. */
|
|
130
163
|
getEffectiveLineVerticesView(): readonly import("@fulate/core").ResolvedVertex[];
|
|
131
164
|
getWorldSnapPointsView(): readonly PointView[];
|
|
165
|
+
/** R0 world-coordinate writer; active scene geometry must already be prepared. */
|
|
132
166
|
addPoint(x: number, y: number, target?: ConnectionPortRef): AnchorId;
|
|
133
167
|
setLocalPoint(anchorId: AnchorId, point: PointView, endpointUpdate?: LineEndpointUpdate): void;
|
|
168
|
+
/** R0 world-coordinate writer; active scene geometry must already be prepared. */
|
|
134
169
|
movePoint(anchorId: AnchorId, worldX: number, worldY: number): void;
|
|
170
|
+
/** R0 world-coordinate writer; active scene geometry must already be prepared. */
|
|
135
171
|
insertPoint(segmentId: SegmentId, worldX: number, worldY: number): AnchorId;
|
|
136
172
|
removePoint(anchorId: AnchorId): void;
|
|
137
173
|
getLocalPoints(): PointView[];
|
|
138
|
-
|
|
174
|
+
invalidatePropertyCommit(commit: Parameters<Element["invalidatePropertyCommit"]>[0], publishRootImpact?: boolean): boolean;
|
|
175
|
+
protected onPropertiesInstalled(current: LineProperties, changes: PropertyChanges): void;
|
|
139
176
|
protected onActivate(root: Root | null, layer: Layer | null): void;
|
|
140
177
|
protected onDeactivate(root: Root | null, layer: Layer | null): void;
|
|
141
178
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type AuthoredSubpath, type AuthoredTerminalAnchor, type AuthoredLineAnchor } from "@fulate/core";
|
|
2
|
+
import { type PointView, type Rect, type ReadonlyMatrix2D } from "@fulate/share";
|
|
3
|
+
export interface ManualLineGeometry {
|
|
4
|
+
readonly mode: "manual";
|
|
5
|
+
readonly path: AuthoredSubpath<AuthoredLineAnchor | AuthoredTerminalAnchor> & {
|
|
6
|
+
readonly closed: false;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface OrthogonalLineGeometry {
|
|
10
|
+
readonly mode: "orthogonal";
|
|
11
|
+
/** First/last are endpoints; interior records are user-adjusted routing points. */
|
|
12
|
+
readonly points: readonly AuthoredTerminalAnchor[];
|
|
13
|
+
readonly margin: number;
|
|
14
|
+
}
|
|
15
|
+
export type LineGeometry = ManualLineGeometry | OrthogonalLineGeometry;
|
|
16
|
+
export declare function createManualLineGeometry(points: readonly PointView[]): ManualLineGeometry;
|
|
17
|
+
export declare const DEFAULT_ORTHOGONAL_MARGIN = 30;
|
|
18
|
+
export declare function createOrthogonalLineGeometry(points: readonly PointView[], margin?: number): OrthogonalLineGeometry;
|
|
19
|
+
export declare function getLineAnchors(geometry: LineGeometry): readonly (AuthoredLineAnchor | AuthoredTerminalAnchor)[];
|
|
20
|
+
export declare function getLineGeometryBounds(geometry: LineGeometry): Readonly<Rect> | null;
|
|
21
|
+
export declare function replaceLineAnchorPoint(geometry: LineGeometry, index: number, point: PointView): LineGeometry;
|
|
22
|
+
export declare function transformLineGeometry(geometry: LineGeometry, matrix: ReadonlyMatrix2D): LineGeometry;
|
|
23
|
+
/** Ignore matrix roundoff only when deciding a Line Point gesture's final semantic change. */
|
|
24
|
+
export declare function hasLineCoordinateChange(before: number, after: number, atStart?: boolean): boolean;
|
|
25
|
+
/** Compare authored Line edits for semantic History; whole-value writers retain reference semantics. */
|
|
26
|
+
export declare function hasLineGeometryChange(before: LineGeometry, after: LineGeometry, atStart?: boolean): boolean;
|
|
27
|
+
/** Materialize effective endpoints without changing their IDs or the geometry mode. */
|
|
28
|
+
export declare function materializeEffectiveEndpointPoints(geometry: LineGeometry, headPoint?: PointView, tailPoint?: PointView): LineGeometry;
|
package/dist/line/index.d.ts
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type PaintContext, type Root } from "@fulate/core";
|
|
2
|
+
import { type PointView, type Rect, type ReadonlyMatrix2D } from "@fulate/share";
|
|
3
|
+
import { type EditableTextContent } from "../text/editing";
|
|
4
|
+
import type { ContentEditingConsumer, ContentEditingSession } from "../editor/capability";
|
|
5
|
+
import type { BaseLine } from "./base";
|
|
6
|
+
/** One text block owned by a Line; position is derived from the committed route. */
|
|
7
|
+
export declare class LineLabel implements EditableTextContent {
|
|
8
|
+
private readonly line;
|
|
9
|
+
readonly editable = true;
|
|
10
|
+
readonly overflow = "visible";
|
|
11
|
+
readonly placeholder = "\u8F93\u5165\u6587\u5B57";
|
|
12
|
+
readonly placeholderColor = "#9ca3af";
|
|
13
|
+
private readonly block;
|
|
14
|
+
private editor;
|
|
15
|
+
private style;
|
|
16
|
+
private route;
|
|
17
|
+
private value;
|
|
18
|
+
private layoutStyle;
|
|
19
|
+
private editing;
|
|
20
|
+
private midpoint;
|
|
21
|
+
private contentWidth;
|
|
22
|
+
private contentHeight;
|
|
23
|
+
private matrix;
|
|
24
|
+
private bounds;
|
|
25
|
+
private removeSkin;
|
|
26
|
+
private removeMeasurement;
|
|
27
|
+
private placeholderMetrics;
|
|
28
|
+
constructor(line: BaseLine);
|
|
29
|
+
get text(): string;
|
|
30
|
+
get isEditing(): boolean;
|
|
31
|
+
get width(): number;
|
|
32
|
+
get height(): number;
|
|
33
|
+
get textLayout(): import("..").TextLayoutSnapshot;
|
|
34
|
+
getResolvedTextStyle(): Required<import("@fulate/core").TextStyleConfig>;
|
|
35
|
+
getPlaceholderMetrics(): TextMetrics;
|
|
36
|
+
setEditingText(value: string): void;
|
|
37
|
+
syncEditingText(value: string): void;
|
|
38
|
+
getWorldMatrixView(): ReadonlyMatrix2D;
|
|
39
|
+
toLocal(point: PointView): {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
};
|
|
43
|
+
getBounds(includeShadow?: boolean): Readonly<Rect>;
|
|
44
|
+
hasPointHint(point: PointView): boolean;
|
|
45
|
+
private sync;
|
|
46
|
+
private buildBounds;
|
|
47
|
+
/** Keep a segment's single drag control on its visible portion beside the label. */
|
|
48
|
+
getSegmentControlPoint(from: PointView, to: PointView): PointView;
|
|
49
|
+
beginEditing(consumer: ContentEditingConsumer): ContentEditingSession | undefined;
|
|
50
|
+
private invalidateBounds;
|
|
51
|
+
private readonly handleSkinTextChanged;
|
|
52
|
+
private readonly invalidateText;
|
|
53
|
+
private readonly handleTextMeasurementChanged;
|
|
54
|
+
activate(root: Root): void;
|
|
55
|
+
dispose(): void;
|
|
56
|
+
clipLine(ctx: CanvasRenderingContext2D, padding?: number): void;
|
|
57
|
+
paint(paint: PaintContext): void;
|
|
58
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PointView, Rect } from "@fulate/share";
|
|
2
|
+
export type AxisDirection = "up" | "right" | "down" | "left";
|
|
3
|
+
export interface OrthogonalEndpointInput {
|
|
4
|
+
readonly point: PointView;
|
|
5
|
+
readonly direction: AxisDirection | "auto";
|
|
6
|
+
/** Null for an authored waypoint: it constrains the approach but has no clearance box. */
|
|
7
|
+
readonly obstacle: Readonly<Rect> | null;
|
|
8
|
+
}
|
|
9
|
+
export interface OrthogonalRouteInput {
|
|
10
|
+
readonly start: OrthogonalEndpointInput;
|
|
11
|
+
readonly end: OrthogonalEndpointInput;
|
|
12
|
+
readonly margin: number;
|
|
13
|
+
}
|
|
14
|
+
export interface CanonicalWorldRoute {
|
|
15
|
+
readonly points: readonly [PointView, ...PointView[]];
|
|
16
|
+
}
|
|
17
|
+
export declare function quantizeOrthogonalDirection(normal: PointView): AxisDirection;
|
|
18
|
+
/** Canonicalize the complete world route, including joins between authored spans. */
|
|
19
|
+
export declare function simplifyOrthogonalRoute<T>(input: readonly T[], position: (value: T) => PointView): T[];
|
|
20
|
+
/** A hand-adjusted segment joins its endpoint approach along the perpendicular axis. */
|
|
21
|
+
export declare function resolveOrthogonalWaypoint(point: PointView, neighbor: PointView, endpoint: PointView): OrthogonalEndpointInput;
|
|
22
|
+
/** Routes around only the two endpoint envelopes, on a small temporary visibility grid. */
|
|
23
|
+
export declare function routeOrthogonal(input: Readonly<OrthogonalRouteInput>): CanonicalWorldRoute;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ElementPayload, ElementV2Codec } from "@fulate/core";
|
|
2
|
+
import type { LineGeometry } from "./geometry";
|
|
3
|
+
import type { LineEndpointRelationPatch } from "./base";
|
|
4
|
+
export interface LineV2 extends ElementPayload {
|
|
5
|
+
readonly type: "line";
|
|
6
|
+
geometry: LineGeometry;
|
|
7
|
+
/** Horizontal label fixed at half the effective route length. */
|
|
8
|
+
text?: string;
|
|
9
|
+
relations?: LineEndpointRelationPatch;
|
|
10
|
+
}
|
|
11
|
+
export declare const lineCodec: ElementV2Codec;
|
package/dist/line/straight.d.ts
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { BaseLine, type LineOption } from "./base";
|
|
2
|
+
import { type PaintContext } from "@fulate/core";
|
|
2
3
|
import type { PointView } from "@fulate/share";
|
|
3
|
-
import { type EditorCapabilityToken, type PointEditRequest, type PointEditingScope, type PointOwnerEdit } from "../editor/capability";
|
|
4
|
+
import { type EditorCapabilityToken, type PointEditRequest, type PointEditTarget, type PointEditingScope, type PointOwnerEdit, type PointControlDescriptor, type ContentEditingConsumer } from "../editor/capability";
|
|
4
5
|
export declare class Line extends BaseLine {
|
|
5
6
|
readonly type = "line";
|
|
6
7
|
constructor(options?: LineOption);
|
|
7
8
|
getEditorCapability<T>(token: EditorCapabilityToken<T>): T | undefined;
|
|
9
|
+
beginContentEditing(consumer: ContentEditingConsumer): import("..").ContentEditingSession;
|
|
8
10
|
resolvePointScope(worldPoint: PointView): {
|
|
9
11
|
readonly kind: "owner";
|
|
10
12
|
};
|
|
11
13
|
hasPointScope(scope: PointEditingScope): scope is {
|
|
12
14
|
readonly kind: "owner";
|
|
13
15
|
};
|
|
14
|
-
|
|
16
|
+
hasPointTarget(_scope: PointEditingScope, target: PointEditTarget): boolean;
|
|
17
|
+
getPointControls(_scope: PointEditingScope): PointControlDescriptor[];
|
|
15
18
|
getPointScopeOutline(_scope: PointEditingScope): any;
|
|
16
19
|
resolvePointEdit(request: PointEditRequest): PointOwnerEdit | null;
|
|
17
|
-
|
|
20
|
+
private resolveSegmentMove;
|
|
21
|
+
protected paintContent(paint: PaintContext): void;
|
|
18
22
|
paintHover(ctx: CanvasRenderingContext2D, scale: number): void;
|
|
19
23
|
}
|
|
@@ -17,6 +17,8 @@ export interface LineTreeTopologyDelta {
|
|
|
17
17
|
readonly points: readonly LineTreeRecordChange<AnchorId, LineTreePoint>[];
|
|
18
18
|
readonly branches: readonly LineTreeRecordChange<SubpathId, LineTreeBranch>[];
|
|
19
19
|
}
|
|
20
|
+
/** Compare semantic History endpoints without allocating a saved delta. */
|
|
21
|
+
export declare function hasLineTreeTopologyChange(before: LineTreeTopology, after: LineTreeTopology): boolean;
|
|
20
22
|
export declare function createLineTreeTopologyDelta(before: LineTreeTopology, after: LineTreeTopology): LineTreeTopologyDelta | null;
|
|
21
23
|
export declare function applyLineTreeTopologyDelta(topology: LineTreeTopology, delta: LineTreeTopologyDelta, direction: "before" | "after"): LineTreeTopology;
|
|
22
24
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { PaintContext } from "@fulate/core";
|
|
2
|
+
import { EditorElementProperties, type EditorRuntimePatch } from "../editor/properties";
|
|
3
|
+
import { Element, type ElementTransformBaseline, type ConnectionPortRef, type Layer, type OwnerPropertyChange, type PropertyChanges, type PropertyUpdates, type ReparentTransformIntent, type Root, type AnchorId, type SubpathId, type TransformIntent } from "@fulate/core";
|
|
2
4
|
import type { PointView } from "@fulate/share";
|
|
3
|
-
import { SelectionBehaviorMode, SelectionDiveMode, SelectionSnapMode, type EditorCapabilityToken, type PointEditRequest, type PointEditingScope, type PointOwnerEdit } from "../editor/capability";
|
|
5
|
+
import { SelectionBehaviorMode, SelectionDiveMode, SelectionSnapMode, type EditorCapabilityToken, type PointEditRequest, type PointEditTarget, type PointEditingScope, type PointOwnerEdit } from "../editor/capability";
|
|
4
6
|
import { type BindableEndpoint, type EndpointRelation, type EndpointRelationBinding } from "../connection/types";
|
|
5
7
|
import { LineTreeTransform } from "./transform";
|
|
6
8
|
import type { LineTreeOption, LineTreeTopology } from "./types";
|
|
@@ -12,19 +14,21 @@ interface LineTreeTransformOwnedState {
|
|
|
12
14
|
readonly reference: ElementTransformBaseline["reference"];
|
|
13
15
|
};
|
|
14
16
|
}
|
|
15
|
-
export declare class LineTreeProperties extends
|
|
17
|
+
export declare class LineTreeProperties extends EditorElementProperties {
|
|
16
18
|
topology: LineTreeTopology;
|
|
17
19
|
constructor(options?: LineTreeOption);
|
|
18
|
-
getImpact(changes: PropertyChanges):
|
|
20
|
+
getImpact(changes: PropertyChanges, updates?: PropertyUpdates): number;
|
|
19
21
|
}
|
|
20
|
-
export declare class LineTree extends Element<LineTreeProperties, LineTreeOption, LineTreePatch
|
|
22
|
+
export declare class LineTree extends Element<LineTreeProperties, LineTreeOption, LineTreePatch, EditorRuntimePatch<LineTreePatch>> {
|
|
23
|
+
get rotationPivotX(): import("@fulate/core").OriginX;
|
|
24
|
+
get rotationPivotY(): import("@fulate/core").OriginY;
|
|
21
25
|
readonly type = "lineTree";
|
|
22
26
|
get topology(): LineTreeTopology;
|
|
23
27
|
private endpointRelationIndex;
|
|
24
28
|
constructor(options?: LineTreeOption);
|
|
25
29
|
/** 把 root/leaf source relations 同步到 Root 唯一 reverse index。 */
|
|
26
30
|
private syncEndpointRelations;
|
|
27
|
-
protected
|
|
31
|
+
protected getDefaultConnectionPortIds(): any[];
|
|
28
32
|
getBindableEndpoints(): readonly BindableEndpoint[];
|
|
29
33
|
getEndpointRelationBindings(): readonly EndpointRelationBinding[];
|
|
30
34
|
readonly transform: LineTreeTransform<this>;
|
|
@@ -36,6 +40,8 @@ export declare class LineTree extends Element<LineTreeProperties, LineTreeOption
|
|
|
36
40
|
readonly dive: SelectionDiveMode.None;
|
|
37
41
|
readonly snap: SelectionSnapMode.Enabled;
|
|
38
42
|
};
|
|
43
|
+
/** Borrow effective path bounds for the editor frame, excluding paint padding. */
|
|
44
|
+
getSelectionFrameBounds(): Readonly<import("@fulate/share").Rect>;
|
|
39
45
|
getTransformPolicy(): {
|
|
40
46
|
readonly move: true;
|
|
41
47
|
readonly resize: "both";
|
|
@@ -54,6 +60,7 @@ export declare class LineTree extends Element<LineTreeProperties, LineTreeOption
|
|
|
54
60
|
resolveDisconnectEndpointChange(anchorIds: readonly AnchorId[], localPositions?: ReadonlyMap<AnchorId, PointView>, patch?: Readonly<Record<string, unknown>>): OwnerPropertyChange | null;
|
|
55
61
|
resolvePointScope(point: PointView, current?: PointEditingScope): PointEditingScope | null;
|
|
56
62
|
hasPointScope(scope: PointEditingScope): boolean;
|
|
63
|
+
hasPointTarget(scope: PointEditingScope, target: PointEditTarget): boolean;
|
|
57
64
|
getPointControls(scope: PointEditingScope): import("..").PointControlDescriptor[];
|
|
58
65
|
getPointScopeOutline(scope: PointEditingScope): readonly PointView[];
|
|
59
66
|
resolvePointEdit(request: PointEditRequest): PointOwnerEdit | null;
|
|
@@ -63,10 +70,10 @@ export declare class LineTree extends Element<LineTreeProperties, LineTreeOption
|
|
|
63
70
|
getBranchTailSource(subpathId: SubpathId): import("./types").LineTreeBranchTailSource;
|
|
64
71
|
/** @internal Transform source-pick 只命中分支尾点,不命中树干。 */
|
|
65
72
|
resolveBranchTailAtWorldPoint(point: PointView): import("./types").LineTreeBranchTailSource;
|
|
66
|
-
paint
|
|
73
|
+
protected paintContent(paint: PaintContext): void;
|
|
67
74
|
paintHover(ctx: CanvasRenderingContext2D, scale: number): void;
|
|
68
75
|
paintBranchHighlight(ctx: CanvasRenderingContext2D, scale: number, subpathId: SubpathId): void;
|
|
69
|
-
protected
|
|
76
|
+
protected onPropertiesInstalled(current: LineTreeProperties, changes: PropertyChanges): void;
|
|
70
77
|
protected onActivate(root: Root | null, layer: Layer | null): void;
|
|
71
78
|
protected onDeactivate(root: Root | null, layer: Layer | null): void;
|
|
72
79
|
}
|
|
@@ -49,6 +49,7 @@ export declare class LineTreeTransform<E extends LineTree = LineTree> extends El
|
|
|
49
49
|
protected buildWorldVisualBounds(): import("@fulate/share").Bound;
|
|
50
50
|
hasInView(): boolean;
|
|
51
51
|
private updateWorldPoints;
|
|
52
|
+
/** 借用已提交 geometry/matrix 的分支投影;下一次 geometry 或 pose 变化后失效。 */
|
|
52
53
|
getWorldBranchPointsView(subpathId: SubpathId): readonly PointView[];
|
|
53
54
|
getWorldPointView(anchorId: AnchorId): PointView;
|
|
54
55
|
getWorldSnapPointsView(): readonly PointView[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type EditorElementOption } from "../editor/properties";
|
|
2
|
+
import type { AnchorId, SegmentId, SubpathId } from "@fulate/core";
|
|
2
3
|
import type { PointView } from "@fulate/share";
|
|
3
4
|
import type { EndpointRelation } from "../connection/types";
|
|
4
5
|
import type { LineDecoration } from "../line/base";
|
|
@@ -31,7 +32,7 @@ export interface LineTreeTopology {
|
|
|
31
32
|
readonly points: readonly LineTreePoint[];
|
|
32
33
|
readonly branches: readonly LineTreeBranch[];
|
|
33
34
|
}
|
|
34
|
-
export interface LineTreeOption extends Omit<
|
|
35
|
+
export interface LineTreeOption extends Omit<EditorElementOption<LineTree>, "children" | "ports"> {
|
|
35
36
|
topology?: LineTreeTopology;
|
|
36
37
|
}
|
|
37
38
|
export interface LineTreeBranchRemoval {
|
package/dist/polygon.d.ts
CHANGED
|
@@ -1,53 +1,34 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export interface PolygonOption extends ShapeOption<Polygon> {
|
|
6
|
-
/** 普通创建传 points;JSON/History/clipboard restore 直接传 canonical contour。 */
|
|
7
|
-
contour?: readonly PointView[] | AuthoredSubpath;
|
|
1
|
+
import { type GeometrySnapshot, type ShapeOptionPatch, type VectorPathGeometry } from "@fulate/core";
|
|
2
|
+
import { type Edge, type PointView, type Rect } from "@fulate/share";
|
|
3
|
+
import { EditorVectorPath, EditorVectorPathProperties, EditorVectorPathTransform, type EditorVectorPathOption } from "./editor-vector-path";
|
|
4
|
+
export interface PolygonOption extends EditorVectorPathOption<readonly PointView[], Polygon> {
|
|
8
5
|
}
|
|
9
6
|
type PolygonPatch = ShapeOptionPatch<PolygonOption>;
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
declare class PolygonProperties extends EditorVectorPathProperties {
|
|
8
|
+
constructor(options?: Omit<PolygonOption, "path"> & {
|
|
9
|
+
path?: VectorPathGeometry;
|
|
10
|
+
});
|
|
12
11
|
}
|
|
13
|
-
declare class
|
|
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> {
|
|
12
|
+
export declare class PolygonTransform<E extends Polygon = Polygon> extends EditorVectorPathTransform<E> {
|
|
19
13
|
protected buildLayoutReferenceBounds(): Readonly<Rect> | null;
|
|
20
14
|
protected buildGeometrySnapshot(revision: number, layoutReferenceBounds?: Readonly<Rect>): GeometrySnapshot;
|
|
21
15
|
protected buildVisualOutline(snapshot: GeometrySnapshot): PointView[];
|
|
22
16
|
}
|
|
23
|
-
/**
|
|
24
|
-
export declare class Polygon extends
|
|
17
|
+
/** A closed straight path with polygon deletion and edge-port semantics. */
|
|
18
|
+
export declare class Polygon extends EditorVectorPath<PolygonProperties, PolygonOption> {
|
|
25
19
|
readonly type = "polygon";
|
|
26
|
-
get contour(): AuthoredSubpath<import("@fulate/core").AuthoredPathAnchor>;
|
|
27
20
|
constructor(options?: PolygonOption);
|
|
28
|
-
protected resolveOptions(options: PolygonPatch): Partial<Omit<PolygonOption, "
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
hasPointScope(scope: PointEditingScope): scope is {
|
|
34
|
-
readonly kind: "owner";
|
|
35
|
-
};
|
|
36
|
-
getPointControls(_scope: PointEditingScope): import(".").PointControlDescriptor[];
|
|
37
|
-
getPointScopeOutline(_scope: PointEditingScope): any;
|
|
38
|
-
private resolvePointContourPatch;
|
|
39
|
-
resolvePointEdit(request: PointEditRequest): PointOwnerEdit | null;
|
|
40
|
-
captureTransformBaseline(_bakeGeometry: boolean): ElementTransformBaseline<AuthoredSubpath<import("@fulate/core").AuthoredPathAnchor>>;
|
|
41
|
-
resolveTransformChange(baseline: Readonly<ElementTransformBaseline<AuthoredSubpath>>, intent: Readonly<TransformIntent | ReparentTransformIntent>): readonly OwnerPropertyChange[];
|
|
42
|
-
protected buildPath(ctx: CanvasRenderingContext2D): void;
|
|
43
|
-
protected buildBorderPath(ctx: CanvasRenderingContext2D): void;
|
|
21
|
+
protected resolveOptions(options: PolygonPatch): Partial<Omit<PolygonOption, "children" | "key">>;
|
|
22
|
+
protected getMinimumAnchorCount(): number;
|
|
23
|
+
protected getPathLayoutBounds(path: VectorPathGeometry): Readonly<Rect> | null;
|
|
24
|
+
protected getTransformedPathBounds(path: VectorPathGeometry): Readonly<Rect> | null;
|
|
44
25
|
getEdgeSegment(edge: Edge): {
|
|
45
26
|
start: PointView;
|
|
46
27
|
end: PointView;
|
|
47
28
|
};
|
|
48
|
-
protected
|
|
49
|
-
|
|
50
|
-
localPosition:
|
|
51
|
-
}
|
|
29
|
+
protected getDefaultConnectionPortIds(patch?: Readonly<Record<string, unknown>>): string[];
|
|
30
|
+
protected getDefaultConnectionPortGeometry(portId: string): {
|
|
31
|
+
localPosition: PointView;
|
|
32
|
+
};
|
|
52
33
|
}
|
|
53
34
|
export {};
|
package/dist/rectangle.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EditorShapeProperties, type EditorShapeOption } from "./editor/properties";
|
|
2
|
+
import { type ElementTransformClass, type GeometrySnapshot, type PropertyChanges, type ShapeOptionPatch } from "@fulate/core";
|
|
2
3
|
import { type Edge, type PointView } from "@fulate/share";
|
|
3
4
|
import { EditorShape, EditorShapeTransform } from "./editor/shape";
|
|
4
|
-
export interface RectangleOption<T = Rectangle> extends
|
|
5
|
+
export interface RectangleOption<T = Rectangle> extends EditorShapeOption<T> {
|
|
5
6
|
radius?: number | null;
|
|
6
7
|
}
|
|
7
8
|
export type RectangleOptionPatch<O extends RectangleOption<any> = RectangleOption> = ShapeOptionPatch<O>;
|
|
8
|
-
export declare class RectangleProperties extends
|
|
9
|
+
export declare class RectangleProperties extends EditorShapeProperties {
|
|
9
10
|
radius: number | null;
|
|
10
11
|
constructor(options?: RectangleOption);
|
|
11
|
-
getImpact(changes: PropertyChanges):
|
|
12
|
+
getImpact(changes: PropertyChanges): number;
|
|
12
13
|
}
|
|
13
14
|
/** Rectangle rounded canonical geometry companion runtime。 */
|
|
14
15
|
export declare class RectangleTransform<E extends Rectangle = Rectangle> extends EditorShapeTransform<E> {
|
package/dist/ripple.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import type { PaintContext } from "@fulate/core";
|
|
2
|
+
import { type Layer, type Node, type PropertyChanges, type Root, type RootFrameLayoutOwner } from "@fulate/core";
|
|
3
|
+
import { Rectangle, RectangleProperties, RectangleTransform, type RectangleOption } from "./rectangle";
|
|
3
4
|
export interface RippleOption extends RectangleOption<RippleOverlay> {
|
|
4
5
|
rippleColor?: string;
|
|
5
6
|
rippleOpacity?: number;
|
|
@@ -10,20 +11,33 @@ declare class RippleProperties extends RectangleProperties {
|
|
|
10
11
|
rippleOpacity: number;
|
|
11
12
|
duration: number;
|
|
12
13
|
constructor(options?: RippleOption);
|
|
13
|
-
getImpact(changes: PropertyChanges):
|
|
14
|
+
getImpact(changes: PropertyChanges): number;
|
|
15
|
+
}
|
|
16
|
+
declare class RippleTransform<E extends RippleOverlay = RippleOverlay> extends RectangleTransform<E> implements RootFrameLayoutOwner {
|
|
17
|
+
private parentCommitRemove;
|
|
18
|
+
get key(): string;
|
|
19
|
+
private readonly scheduleLayout;
|
|
20
|
+
bindParent(): void;
|
|
21
|
+
deactivate(root: Root | null): void;
|
|
22
|
+
flushLayout(): void;
|
|
23
|
+
updateTransform(parentLayoutDirty?: boolean): void;
|
|
14
24
|
}
|
|
15
25
|
/** 拥有自身瞬时状态与 Tween,并在离开活动 Root 时结束它们。 */
|
|
16
26
|
export declare class RippleOverlay extends Rectangle<RippleProperties, RippleOption> {
|
|
17
27
|
readonly type = "ripple";
|
|
28
|
+
readonly transform: RippleTransform<this>;
|
|
18
29
|
get rippleColor(): string;
|
|
19
30
|
get rippleOpacity(): number;
|
|
20
31
|
get duration(): number;
|
|
21
32
|
private ripples;
|
|
22
33
|
constructor(options?: RippleOption);
|
|
34
|
+
protected onParentInstalled(previousParent?: Node): void;
|
|
35
|
+
protected onActivate(root: Root | null, layer: Layer | null): void;
|
|
36
|
+
protected onPropertiesInstalled(current: RippleProperties, changes: PropertyChanges): void;
|
|
23
37
|
/** 从全局逻辑坐标触发涟漪 */
|
|
24
38
|
trigger(globalX: number, globalY: number): void;
|
|
25
39
|
private spawn;
|
|
26
40
|
protected onDeactivate(root: Root | null, layer: Layer | null): void;
|
|
27
|
-
protected paintHost(
|
|
41
|
+
protected paintHost(paint: PaintContext): void;
|
|
28
42
|
}
|
|
29
43
|
export {};
|