@fulate/ui 1.0.15 → 2.0.11

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.
Files changed (48) hide show
  1. package/README.md +96 -14
  2. package/dist/bitmap.d.ts +15 -0
  3. package/dist/circle.d.ts +2 -1
  4. package/dist/connection/commands.d.ts +3 -3
  5. package/dist/connection/types.d.ts +5 -1
  6. package/dist/connection-port-decoration.d.ts +18 -2
  7. package/dist/editor/capability.d.ts +38 -6
  8. package/dist/editor/frame-flush.d.ts +3 -4
  9. package/dist/editor/properties.d.ts +31 -0
  10. package/dist/editor/shape-capability.d.ts +13 -0
  11. package/dist/editor/shape.d.ts +17 -20
  12. package/dist/editor/transform.d.ts +1 -3
  13. package/dist/editor-vector-path.d.ts +70 -0
  14. package/dist/floating.d.ts +12 -2
  15. package/dist/group.d.ts +17 -8
  16. package/dist/image.d.ts +21 -19
  17. package/dist/index.d.ts +14 -7
  18. package/dist/index.js +2857 -1696
  19. package/dist/line/base.d.ts +65 -28
  20. package/dist/line/geometry.d.ts +28 -0
  21. package/dist/line/index.d.ts +2 -0
  22. package/dist/line/label.d.ts +58 -0
  23. package/dist/line/orthogonal.d.ts +23 -0
  24. package/dist/line/straight.d.ts +7 -3
  25. package/dist/line-tree/history-delta.d.ts +2 -0
  26. package/dist/line-tree/index.d.ts +20 -12
  27. package/dist/line-tree/topology.d.ts +1 -4
  28. package/dist/line-tree/transform.d.ts +2 -0
  29. package/dist/line-tree/types.d.ts +3 -2
  30. package/dist/polygon.d.ts +19 -37
  31. package/dist/rectangle.d.ts +5 -4
  32. package/dist/ripple.d.ts +18 -4
  33. package/dist/scrollbars.d.ts +36 -0
  34. package/dist/scrollview.d.ts +27 -21
  35. package/dist/text/block.d.ts +5 -1
  36. package/dist/text/editing.d.ts +54 -12
  37. package/dist/text/index.d.ts +23 -20
  38. package/dist/text/layout.d.ts +9 -2
  39. package/dist/text/paint.d.ts +3 -2
  40. package/dist/text/style.d.ts +4 -0
  41. package/dist/triangle.d.ts +10 -5
  42. package/dist/worker-surface-worker.d.ts +4 -1
  43. package/dist/worker-surface-worker.js +13 -10
  44. package/dist/worker-surface.d.ts +1 -0
  45. package/dist/workspace.d.ts +3 -3
  46. package/package.json +33 -33
  47. package/dist/authored-path.d.ts +0 -28
  48. package/dist/vector-path.d.ts +0 -58
@@ -0,0 +1,70 @@
1
+ import { VectorPath, VectorPathProperties, VectorPathTransform, type AuthoredSubpath, type ElementOptionPatch, type ElementTransformBaseline, type ElementTransformClass, type Layer, type OwnerPropertyChange, type PaintContext, type PropertyChanges, type ReparentTransformIntent, type Root, type TransformIntent, type VectorPathCommand, type VectorPathGeometry, type VectorPathOption } from "@fulate/core";
2
+ import type { Bound, PointView, Rect } from "@fulate/share";
3
+ import { type EditorCapabilityToken, type PointControlDescriptor, type PointEditRequest, type PointEditTarget, type PointEditingScope, type PointOwnerEdit } from "./editor/capability";
4
+ import { type EditorPivotOptions, type EditorRuntimePatch } from "./editor/properties";
5
+ export interface EditorVectorPathOption<Input = readonly VectorPathCommand[], T = EditorVectorPath<any, any>> extends VectorPathOption<Input, T>, EditorPivotOptions {
6
+ }
7
+ export declare class EditorVectorPathProperties extends VectorPathProperties {
8
+ rotationPivotX: any;
9
+ rotationPivotY: any;
10
+ constructor(options?: EditorVectorPathOption<readonly VectorPathCommand[], any>);
11
+ getImpact(changes: PropertyChanges): number;
12
+ }
13
+ export declare class EditorVectorPathTransform<E extends EditorVectorPath<any, any> = EditorVectorPath> extends VectorPathTransform<E> {
14
+ protected buildWorldVisualBounds(includeShadow?: boolean): Bound;
15
+ }
16
+ /** One Core path owner with the UI's selection, Point, Transform, Snap and Port behavior. */
17
+ export declare class EditorVectorPath<P extends EditorVectorPathProperties = EditorVectorPathProperties, O extends EditorVectorPathOption<unknown, any> = EditorVectorPathOption> extends VectorPath<P, O, EditorRuntimePatch<ElementOptionPatch<O>>> {
18
+ private connectionPortDecoration;
19
+ private worldSnapPointsCache?;
20
+ constructor(options?: NoInfer<O>, properties?: P, Transform?: ElementTransformClass);
21
+ get rotationPivotX(): any;
22
+ get rotationPivotY(): any;
23
+ getEditorCapability<T>(token: EditorCapabilityToken<T>): T | undefined;
24
+ getSelectionBehavior(): {
25
+ readonly mode: import(".").SelectionBehaviorMode.Standard;
26
+ readonly dive: import(".").SelectionDiveMode.None;
27
+ readonly snap: import(".").SelectionSnapMode.Enabled;
28
+ };
29
+ getTransformPolicy(): {
30
+ readonly move: true;
31
+ readonly resize: "both";
32
+ readonly rotate: true;
33
+ readonly rotationPivot: "adjustable";
34
+ };
35
+ getSelectionFrameBounds(): Readonly<Rect> | null;
36
+ resolvePointScope(worldPoint: PointView): {
37
+ readonly kind: "owner";
38
+ };
39
+ hasPointScope(scope: PointEditingScope): scope is {
40
+ readonly kind: "owner";
41
+ };
42
+ hasPointTarget(_scope: PointEditingScope, target: PointEditTarget): boolean;
43
+ getPointControls(_scope: PointEditingScope): readonly PointControlDescriptor[];
44
+ getPointScopeOutline(_scope: PointEditingScope): any;
45
+ resolvePointEdit(request: PointEditRequest): PointOwnerEdit | null;
46
+ private findAnchor;
47
+ private findSegment;
48
+ private ownerPathChange;
49
+ captureTransformBaseline(_bakeGeometry: boolean): {
50
+ reference: import("@fulate/core").ReferenceTransformBaseline;
51
+ ownedState: VectorPathGeometry;
52
+ };
53
+ resolveTransformChange(baseline: Readonly<ElementTransformBaseline<VectorPathGeometry>>, intent: Readonly<TransformIntent | ReparentTransformIntent>): readonly OwnerPropertyChange[];
54
+ protected getMinimumAnchorCount(subpath: AuthoredSubpath): number;
55
+ /** Point pose compensation includes single-anchor layout geometry. */
56
+ protected getPathLayoutBounds(path: VectorPathGeometry): Readonly<Rect> | null;
57
+ /** Transform replaces frame dimensions only when the product has resizable geometry. */
58
+ protected getTransformedPathBounds(path: VectorPathGeometry): Readonly<Rect> | null;
59
+ protected commitConfiguredOptions(options: ElementOptionPatch<O>): void;
60
+ getWorldSnapPointsView(): readonly PointView[];
61
+ paint(paint: PaintContext): void;
62
+ /** 绘制宿主本体;`paint()` 随后统一绘制 custom Port decoration。 */
63
+ protected paintHost(paint: PaintContext): void;
64
+ /** @internal EditorVectorPathTransform 合并非节点 Port decoration bounds。 */
65
+ getConnectionPortDecorationWorldBounds(): Bound;
66
+ protected onPropertiesInstalled(current: P, changes: PropertyChanges): void;
67
+ protected onActivate(root: Root | null, layer: Layer | null): void;
68
+ protected onDeactivate(root: Root | null, layer: Layer | null): void;
69
+ private getConnectionPortDecoration;
70
+ }
@@ -3,5 +3,15 @@ import { type ComputePositionConfig } from "@floating-ui/core";
3
3
  export { flip, offset, shift } from "@floating-ui/core";
4
4
  export type { Placement } from "@floating-ui/core";
5
5
  export type ComputePositionOptions = Omit<ComputePositionConfig, "platform" | "strategy">;
6
- /** Computes world-space coordinates without mutating either element. */
7
- export declare function computePosition(reference: Element, floating: Element, options?: ComputePositionOptions): Promise<import("@floating-ui/core").ComputePositionReturn>;
6
+ /**
7
+ * Reads prepared world geometry; callers await the owning Root before use.
8
+ * Returns parent-space left/top for setOptions({ left: x, top: y }).
9
+ * Middleware dimensions, offsets and middlewareData remain in world space.
10
+ */
11
+ export declare function computePosition(reference: Element, floating: Element, options?: ComputePositionOptions): Promise<{
12
+ x: number;
13
+ y: number;
14
+ placement: import("@floating-ui/utils").Placement;
15
+ strategy: import("@floating-ui/utils").Strategy;
16
+ middlewareData: import("@floating-ui/core").MiddlewareData;
17
+ }>;
package/dist/group.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { ChangeImpact, Element, ElementTransform, type BaseElementOption, type ElementTransformBaseline, type ReparentTransformIntent, type TransformIntent } from "@fulate/core";
2
- import { Bound, type BoundingBox, type PointView, type ReadonlyMatrix2D } from "@fulate/share";
1
+ import { EditorElementProperties, type EditorElementOption, type EditorRuntimePatch } from "./editor/properties";
2
+ import { ChangeImpact, Element, ElementTransform, type ElementOptionPatch, type ElementTransformBaseline, type ReparentTransformIntent, type TransformIntent } from "@fulate/core";
3
+ import { Bound, type PointView, type ReadonlyMatrix2D } from "@fulate/share";
3
4
  import { SelectionBehaviorMode, SelectionDiveMode, SelectionSnapMode, type EditorCapabilityToken, type TransformInteractionCapability } from "./editor/capability";
4
5
  /**
5
6
  * Group 成员的逻辑范围:frame capability 优先(Text 等排除绘制溢出),否则为成员 content
@@ -14,7 +15,7 @@ interface GroupTransformChildBaseline {
14
15
  interface GroupTransformOwnedState {
15
16
  readonly children: readonly GroupTransformChildBaseline[];
16
17
  }
17
- export interface GroupOption extends BaseElementOption<Group> {
18
+ export interface GroupOption extends EditorElementOption<Group> {
18
19
  }
19
20
  export declare class GroupTransform<E extends Group = Group> extends ElementTransform<E> {
20
21
  private localContentBounds;
@@ -22,7 +23,7 @@ export declare class GroupTransform<E extends Group = Group> extends ElementTran
22
23
  protected onChildrenChanged(): void;
23
24
  protected onDescendantDirty(_child: ElementTransform, affectsContentBounds: boolean): void;
24
25
  private invalidateContentBounds;
25
- invalidate(impact: ChangeImpact, previousBounds?: Readonly<BoundingBox> | null): void;
26
+ invalidate(impact: ChangeImpact): void;
26
27
  /** @internal Group-local canonical content subtree bounds. */
27
28
  getLocalContentBoundsView(): Readonly<Bound> | null;
28
29
  /** @internal Group-local selection frame derived from child owner frames. */
@@ -35,6 +36,8 @@ export declare class GroupTransform<E extends Group = Group> extends ElementTran
35
36
  protected buildLocalSelectionFrameBounds(): Bound | null;
36
37
  protected buildLocalHitBounds(): Readonly<Bound>;
37
38
  protected containsLocalHitPoint(point: PointView): boolean;
39
+ /** Group 的 visual bounds 是成员的聚合,只由成员贡献 render coverage。 */
40
+ protected getOwnRenderCoverageBoundsView(): any;
38
41
  protected buildVisualBounds(): Readonly<Bound>;
39
42
  protected buildVisualOutline(): {
40
43
  x: number;
@@ -42,11 +45,14 @@ export declare class GroupTransform<E extends Group = Group> extends ElementTran
42
45
  }[];
43
46
  dispose(): void;
44
47
  }
45
- export declare class Group extends Element {
48
+ export declare class Group extends Element<EditorElementProperties, GroupOption, ElementOptionPatch<GroupOption>, EditorRuntimePatch<ElementOptionPatch<GroupOption>>> {
49
+ get rotationPivotX(): import("@fulate/core").OriginX;
50
+ get rotationPivotY(): import("@fulate/core").OriginY;
46
51
  readonly type = "group";
47
52
  private readonly worldSnapPointsCache;
48
53
  readonly transform: GroupTransform<this>;
49
54
  constructor(options?: GroupOption);
55
+ protected commitConfiguredOptions(options: ElementOptionPatch<GroupOption>): void;
50
56
  getEditorCapability<T>(token: EditorCapabilityToken<T>): T | undefined;
51
57
  getSelectionBehavior(): {
52
58
  readonly mode: SelectionBehaviorMode.Standard;
@@ -59,9 +65,12 @@ export declare class Group extends Element {
59
65
  readonly rotate: true;
60
66
  readonly rotationPivot: "adjustable";
61
67
  };
62
- captureTransformBaseline(): ElementTransformBaseline<{
63
- children: GroupTransformChildBaseline[];
64
- }>;
68
+ captureTransformBaseline(bakeGeometry: boolean): {
69
+ reference: import("@fulate/core").ReferenceTransformBaseline;
70
+ ownedState: {
71
+ children: GroupTransformChildBaseline[];
72
+ };
73
+ };
65
74
  resolveTransformChange(baseline: Readonly<ElementTransformBaseline<GroupTransformOwnedState>>, intent: Readonly<TransformIntent | ReparentTransformIntent>): readonly import("@fulate/core").OwnerPropertyChange[];
66
75
  getWorldSnapPointsView(): readonly PointView[];
67
76
  getSelectionFrameBounds(): Readonly<Bound>;
package/dist/image.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { ChangeImpact, type ElementTransformClass, type Layer, type PropertyChanges, type Root } from "@fulate/core";
2
- import { RectangleProperties, RectangleTransform, type RectangleOption } from "./rectangle";
1
+ import type { PaintContext } from "@fulate/core";
2
+ import { type ElementTransformClass, type Layer, type PropertyChanges, type Root } from "@fulate/core";
3
+ import { RectangleProperties, type RectangleOption } from "./rectangle";
3
4
  import { Bitmap } from "./bitmap";
4
5
  export type ImageResizeMode = "auto" | "none";
5
6
  export interface ImageResizeOption {
@@ -15,38 +16,39 @@ export declare class ImageProperties extends RectangleProperties {
15
16
  src?: string;
16
17
  resize: Readonly<ImageResizeOption>;
17
18
  constructor(options?: ImageOption);
18
- getImpact(changes: PropertyChanges): ChangeImpact;
19
- }
20
- export declare class ImageTransform<E extends Image = Image> extends RectangleTransform<E> {
19
+ getImpact(changes: PropertyChanges): number;
21
20
  }
22
21
  export declare class Image<P extends ImageProperties = ImageProperties, O extends ImageOption<any> = ImageOption<any>> extends Bitmap<P, O> {
23
22
  readonly type: string;
23
+ get width(): number;
24
+ get height(): number;
24
25
  get src(): string;
25
26
  get resize(): Readonly<ImageResizeOption>;
26
- protected isLoaded: boolean;
27
- private renderSize;
28
- private naturalWidth;
29
- private naturalHeight;
30
- private isProcessing;
31
- private processGeneration;
27
+ /** 已完成的源仍可复用,但不再持有取消句柄。 */
28
+ private sourceLoad;
29
+ private sourceWidth;
30
+ private sourceHeight;
31
+ private externalImage;
32
+ /** Current load or decode; replacing it retires only that continuation. */
33
+ private processing;
32
34
  constructor(options?: NoInfer<O>, Transform?: ElementTransformClass, properties?: P);
35
+ /** Intrinsic width of the current image source, before authored sizing. */
36
+ get naturalWidth(): number;
37
+ /** Intrinsic height of the current image source, before authored sizing. */
38
+ get naturalHeight(): number;
33
39
  get resizeMode(): ImageResizeMode;
34
40
  get resizeQuality(): ImageBitmapOptions["resizeQuality"];
35
41
  setResize(resize: ImageResizeOption): void;
42
+ protected onPropertiesInstalled(current: P, changes: PropertyChanges): void;
36
43
  protected onPropertiesChanged(current: P, changes: PropertyChanges): void;
37
44
  protected onActivate(root: Root | null, layer: Layer | null): void;
38
45
  protected onDeactivate(root: Root | null, layer: Layer | null): void;
39
- protected paintContent(ctx: CanvasRenderingContext2D): void;
40
- paintForExport(ctx: CanvasRenderingContext2D): Promise<void>;
46
+ protected paintContent(paint: PaintContext): void;
41
47
  protected onUnmount(): void;
42
- private cancelProcessing;
43
- protected clearBitmap(): void;
44
- private setExternalImage;
48
+ /** Loads the current source and transfers only its current decoded bitmap to Bitmap. */
45
49
  protected loadAndProcess(): Promise<void>;
46
- private processImage;
47
- private applyBitmap;
48
50
  private calcAutoSize;
49
51
  /** @internal 实际绘制前按当前 Viewport 检查分辨率升级。 */
50
52
  checkResolution(): void;
51
- private loadHTMLImage;
53
+ private getSourceImage;
52
54
  }
package/dist/index.d.ts CHANGED
@@ -11,25 +11,29 @@ export { Circle, CircleTransform } from "./circle";
11
11
  export { Triangle, TriangleTransform } from "./triangle";
12
12
  export { Polygon, PolygonTransform } from "./polygon";
13
13
  export type { PolygonOption } from "./polygon";
14
- export { VectorPath, VectorPathProperties, VectorPathTransform } from "./vector-path";
15
- export type { VectorPathCommand, VectorPathGeometry, VectorPathOption } from "./vector-path";
14
+ export { EditorVectorPath, EditorVectorPathProperties, EditorVectorPathTransform } from "./editor-vector-path";
15
+ export type { EditorVectorPathOption } from "./editor-vector-path";
16
16
  export { Text, TextProperties, TextTransform, resolveTextStyle } from "./text";
17
17
  export type { TextOption, TextStyleConfig, TextStyleKey, ResolvedTextStyle } from "./text";
18
- export { Image, ImageProperties, ImageTransform } from "./image";
18
+ export { Image, ImageProperties } from "./image";
19
19
  export type { ImageOption, ImageResizeOption, ImageResizeMode } from "./image";
20
20
  export { Bitmap } from "./bitmap";
21
21
  export { WorkerSurfacePool } from "./worker-surface";
22
22
  export type { WorkerSurfaceHandle, WorkerSurfacePoolOptions } from "./worker-surface";
23
23
  export { fitWorkspace, workspaceFocusInsetsKey, Workspace, WorkspaceProperties } from "./workspace";
24
- export type { WorkspaceFocusInsetsSource, WorkspaceFitOptions, WorkspaceJSON, WorkspaceOption } from "./workspace";
24
+ export type { WorkspaceFocusInsetsSource, WorkspaceFitOptions, WorkspaceOption } from "./workspace";
25
25
  export { computePosition, flip, offset, shift } from "./floating";
26
26
  export type { ComputePositionOptions, Placement } from "./floating";
27
27
  export { Group, GroupTransform, resolveGroupMemberBounds } from "./group";
28
+ export { EditorElementProperties, EditorShapeProperties } from "./editor/properties";
29
+ export type { EditorElementOption, EditorPivotOptions, EditorRuntimePatch, EditorShapeOption } from "./editor/properties";
28
30
  export type { GroupOption } from "./group";
29
31
  export { ContentEditingCapabilityToken, PointEditingCapabilityToken, SelectionBehaviorMode, SelectionBehaviorCapabilityToken, SelectionDiveMode, SelectionSnapMode, SnapSourceCapabilityToken, TransformInteractionCapabilityToken, defineEditorCapability, getEditorCapability, isEditorCapabilityHost, resolveSelectionFrameBounds } from "./editor/capability";
30
32
  export type { ContentEditingCapability, ContentEditingConsumer, ContentEditingSession, EditorCapabilityHost, EditorCapabilityToken, PointControlDescriptor, PointEditRequest, PointEditTarget, PointEditingCapability, PointEditingScope, PointOwnerEdit, SelectionBehavior, SelectionBehaviorCapability, SnapSourceCapability, TransformInteractionCapability, TransformInteractionPolicy } from "./editor/capability";
31
33
  export { EditorFrameFlush, getEditorFrameFlush } from "./editor/frame-flush";
32
34
  export type { EditorAuthoredGesture, EditorOverlayClient, EditorSpatialClient } from "./editor/frame-flush";
35
+ export { Scrollbars, SCROLLBAR_DEFAULTS } from "./scrollbars";
36
+ export type { ScrollbarOptions } from "./scrollbars";
33
37
  export { ScrollView, ScrollViewTransform } from "./scrollview";
34
38
  export type { ScrollViewOption } from "./scrollview";
35
39
  export { RippleOverlay } from "./ripple";
@@ -37,8 +41,11 @@ export type { RippleOption } from "./ripple";
37
41
  export { BaseLine, LineTransform, Line } from "./line/index";
38
42
  export { connectionPortAccepts, connectEndpoint, disconnectEndpoint, getEndpointRelationIndex, hasConnectionPortCapacity, isEndpointRelationSource, resolveConnectionPortChanges, resolveConnectEndpointChange, resolveDisconnectEndpointChanges, EndpointRelationIndex } from "./connection";
39
43
  export type { BindableEndpoint, EndpointConnectionRole, EndpointRef, EndpointRelation, EndpointRelationBinding, EndpointRelationSource } from "./connection";
40
- export { LineTree, LineTreeProperties, LineTreeTransform, EMPTY_LINE_TREE_TOPOLOGY, DEFAULT_LINE_TREE_BRANCH_STYLE, addLineTreeBranchAtTail, createLineTreeTopology, getLineTreeBranch, getLineTreeBindableEndpoints, getLineTreeEndpointRelationBindings, getLineTreeJunctionAnchorIds, getLineTreePoint, getLineTreePointReferenceCounts, insertLineTreePoint, moveLineTreePoint, removeLineTreeBranch, removeLineTreePoint, remapLineTreeRelations, transformLineTreeTopology, updateLineTreeBranchStyle } from "./line-tree";
44
+ export { LineTree, LineTreeProperties, LineTreeTransform, EMPTY_LINE_TREE_TOPOLOGY, DEFAULT_LINE_TREE_BRANCH_STYLE, addLineTreeBranchAtTail, createLineTreeTopology, getLineTreeBranch, getLineTreeJunctionAnchorIds, getLineTreePoint, getLineTreePointReferenceCounts, insertLineTreePoint, moveLineTreePoint, removeLineTreeBranch, removeLineTreePoint, remapLineTreeRelations, transformLineTreeTopology, updateLineTreeBranchStyle } from "./line-tree";
41
45
  export type { LineTreeBranch, LineTreeBranchRemoval, LineTreeBranchTailSource, LineTreeBranchStyle, LineTreeBranchVertex, LineTreeOption, LineTreePoint, LineTreeTopology } from "./line-tree";
42
- export { applyLineTreeTopologyDelta, createLineTreeTopologyDelta } from "./line-tree/history-delta";
46
+ export { applyLineTreeTopologyDelta, createLineTreeTopologyDelta, hasLineTreeTopologyChange } from "./line-tree/history-delta";
43
47
  export type { LineTreeTopologyDelta } from "./line-tree/history-delta";
44
- export type { LineDecoration, LineEndpointRelationPatch, LineEndpointUpdate, LineOption, } from "./line/index";
48
+ export type { LineDecoration, LineEndpointRelationPatch, LineEndpointUpdate, LineOption } from "./line/index";
49
+ export * from "./line/geometry";
50
+ export * from "./line/orthogonal";
51
+ export { resolveOrthogonalEndpoint } from "./line/base";