@pixerate/editor-react 0.40.0 → 0.42.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/dist/animation-editor/index.cjs +192 -0
- package/dist/animation-editor/index.cjs.map +1 -0
- package/dist/animation-editor/index.d.cts +61 -0
- package/dist/animation-editor/index.d.ts +61 -0
- package/dist/animation-editor/index.js +162 -0
- package/dist/animation-editor/index.js.map +1 -0
- package/dist/canvas/index.cjs +536 -313
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +155 -6
- package/dist/canvas/index.d.ts +155 -6
- package/dist/canvas/index.js +221 -0
- package/dist/canvas/index.js.map +1 -1
- package/dist/index.cjs +439 -412
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +52 -26
- package/dist/index.js.map +1 -1
- package/package.json +11 -3
package/dist/canvas/index.d.cts
CHANGED
|
@@ -2,10 +2,10 @@ import * as React$1 from 'react';
|
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { AgentPresence } from '@pixerate/editor/agent';
|
|
4
4
|
import * as _pixerate_editor_canvas from '@pixerate/editor/canvas';
|
|
5
|
-
import { CanvasNode, CanvasEdge, IncrementalLayoutOptions, XYPosition, GraphDifferences, Rect, CanvasLayoutOptions, Side, PlaceBesideOptions, getCenteredNodePosition, CanvasDockingCallbacks, DockStrategy, ExplodeNodeOptions, CollapseNodeOptions, ExplosionSnapshot, ArrangeHistoryTarget, SnapGuidesOptions, NodeRectOptions, AutoLayoutOptions, GuideLine, CanvasArrangeAction, ArrangeShortcutBinding, CanvasScenesOptions, CanvasViewport, CanvasScenesStore, CanvasScene, FitViewportOptions, FreehandTool, FreehandStrokeStyle, FreehandStroke, FreehandDrawOptions, ShapeDescription, AutoLayoutMeasure, CanvasTokenOptions, AnimationHistoryTarget, Clock, AnimationLoopMode, AnimatableProperty, CanvasComponentSyncOptions, CanvasComponentsController } from '@pixerate/editor/canvas';
|
|
5
|
+
import { CanvasNode, CanvasEdge, IncrementalLayoutOptions, XYPosition, GraphDifferences, Rect, CanvasLayoutOptions, Side, PlaceBesideOptions, getCenteredNodePosition, CanvasDockingCallbacks, DockStrategy, ExplodeNodeOptions, CollapseNodeOptions, ExplosionSnapshot, ArrangeHistoryTarget, SnapGuidesOptions, NodeRectOptions, AutoLayoutOptions, GuideLine, CanvasArrangeAction, ArrangeShortcutBinding, CanvasScenesOptions, CanvasViewport, CanvasScenesStore, CanvasScene, FitViewportOptions, FreehandTool, FreehandStrokeStyle, FreehandStroke, FreehandDrawOptions, ShapeDescription, AutoLayoutMeasure, CanvasTokenOptions, AnimationHistoryTarget, Clock, AnimationLoopMode, AnimatableProperty, CanvasComponentSyncOptions, CanvasComponentsController, DiagramLayoutOptions, MermaidFlowNode, MermaidFlowEdge, DiagramLayout, DiagramSvgOptions } from '@pixerate/editor/canvas';
|
|
6
6
|
export { ANIMATABLE_PROPERTIES, ANIMATION_DATA_KEY, ANIMATION_EASING_LABELS, ANIMATION_EASING_PRESETS, ANIMATION_TIME_EPSILON, AUTO_LAYOUT_DATA_KEY, AddCanvasVariantOptions, AlignEdge, AnimatableProperty, AnimateNodeOptions, AnimationDocument, AnimationEasing, AnimationEasingPreset, AnimationEditError, AnimationEditErrorCode, AnimationFrame, AnimationHistoryTarget, AnimationKeyframe, AnimationKeyframeClipboard, AnimationLoopMode, AnimationMotionPath, AnimationOverrides, AnimationPlayer, AnimationPlayerOptions, AnimationPlayerState, AnimationTrack, AnimationValue, AnimationValueType, ArrangeShortcutBinding, AutoLayout, AutoLayoutAlignContent, AutoLayoutAlignCross, AutoLayoutAlignMain, AutoLayoutCellAlign, AutoLayoutChild, AutoLayoutConstraints, AutoLayoutGrid, AutoLayoutGridArea, AutoLayoutGridCell, AutoLayoutGridGeometry, AutoLayoutGridTrack, AutoLayoutHorizontalConstraint, AutoLayoutInsertTarget, AutoLayoutMeasure, AutoLayoutMode, AutoLayoutOptions, AutoLayoutPadding, AutoLayoutSize, AutoLayoutSizing, AutoLayoutSizingPair, AutoLayoutVerticalConstraint, BezierCommand, BezierPath, BezierPathInput, CANVAS_COMPONENT_DRAG_TYPE, CANVAS_GRADIENT_PRESETS, CANVAS_TOKEN_PROPERTIES, CHILD_LAYOUT_DATA_KEY, CONNECTION_LINE_TYPES, CSS_ANIMATION_PROPERTIES, CUBIC_BEZIER_PRESETS, CanvasAnimationController, CanvasAnimationControllerOptions, CanvasAnimationState, CanvasArrangeAction, CanvasAutoLayoutController, CanvasAutoLayoutControllerOptions, CanvasClipboardPayload, CanvasComponentInfo, CanvasComponentPropertyDef, CanvasComponentPropertyField, CanvasComponentResult, CanvasComponentSetInfo, CanvasComponentSyncOptions, CanvasComponentsController, CanvasComponentsControllerOptions, CanvasConnectionLineType, CanvasDockingCallbacks, CanvasDrawControllerOptions, CanvasEdge, CanvasGradientDef, CanvasHeightOptions, CanvasInstanceInfo, CanvasLayoutOptions, CanvasLinearGradient, CanvasNode, CanvasNodeUpdate, CanvasRadialGradient, CanvasScene, CanvasScenesState, CanvasScenesStore, CanvasTokenBindingInfo, CanvasTokenOptions, CanvasTokenProperty, CanvasViewport, Clock, CollapseNodeOptions, CombineShapeNodesOptions, CombineShapeNodesRefusal, CombineShapeNodesResult, ConnectorSnap, ConnectorSnapTarget, CssAnimationExport, CssExportOptions, CubicBezierEasing, CubicSegment, DEFAULT_ARRANGE_SHORTCUTS, DirectionalDisplacementOptions, DisplacementDirection, DistributeAxis, DistributeMode, DividePathsResult, DockStrategy, EllipseShape, ExplodeNodeOptions, ExplosionSnapshot, FanOutTrajectoryOptions, FitCubicsOptions, FitPathDataOptions, FlattenOptions, FreehandStroke, FreehandStrokeStyle, FreehandTool, GradientStop, GraphDifferences, GuideIndex, GuideLine, IncrementalLayoutOptions, KeyframeDragState, KeyframePatch, KeyframeRef, KeyframeSnap, MAX_KEYFRAME_REFS, ManualClock, MeasureGuide, MeasureSelectionOptions, MeasureSelectionResult, MultiPolygon, NodeAnimation, NodeTransition, OffsetPathOptions, OffsetShapeNodesOptions, OklabColor, OutlineShapeStrokesOptions, OutlineStrokeOptions, PathBooleanResult, PathCommand, PathOperand, PathOperandInput, PathOpsOptions, PathShape, PlaceBesideOptions, Point, PolygonBooleanOperation, PolygonBooleanOptions, PolygonFillRule, PolygonInput, PolygonOperand, PolygonPiece, PolygonRing, PolygonToPathOptions, PolygonWithHoles, Position, RESIZE_HANDLES, Rect, RectShape, ReflowDisplacementOptions, RegularPolygonShape, ResizeHandle, SHAPE_DATA_KEY, SHAPE_KINDS, SHAPE_NODE_TYPE, SHAPE_OPERATIONS, SetCanvasVariantPropertiesOptions, ShapeDescription, ShapeKind, ShapeNodePolygonOptions, ShapeOperation, ShapePaint, ShapePathEditOperation, ShapePathEditRefusal, ShapePathEditResult, ShapeRenderData, ShapeSize, Side, SizeDimension, SnapGuidesOptions, SnapNodeResizeOptions, SnapNodeResizeResult, SnapResizeOptions, SnapResizeResult, SnapResult, SpringEasing, StarShape, StrokeCap, StrokeJoin, StrokeToShapeNodeOptions, SvgGradientDef, SvgGradientStop, TOKEN_BINDINGS_DATA_KEY, TOKEN_MODES_DATA_KEY, TimelineKeyframe, TimelineRow, TrajectoryFunction, TrajectoryPoint, WebAnimationSpec, XYPosition, ZOrderOperation, addCanvasVariant, addKeyframesAtTime, alignNodes, angleToSvgLinearCoords, animateNode, applyAnimation, applyAnimationOverrides, applyConstraints, applyNodeUpdates, applyShapeCombination, applyShapeReplacement, bezierPathArea, bezierPathBounds, bezierPathLength, bezierPathPointAtLength, bezierPathSignedArea, bezierPathToSvg, bindCanvasComponentProperty, bindCanvasToken, blendLayout, boundsOf, calculateDagreReflowDisplacement, calculateDirectionalDisplacement, canCombineShapeNodes, canOffsetShapeNodes, canOutlineShapeNodeStrokes, canvasHeight, centerNodes, centre, clampAnimationValue, clampLayoutSize, combineCanvasComponentsAsVariants, combineShapeNodes, computeNodesBoundingBox, computeSnapGuides, connectedOnly, copyKeyframes, countPathSegments, createAnimationPlayer, createBezierTrajectory, createCanvasAnimationController, createCanvasAutoLayoutController, createCanvasComponent, createCanvasComponentsController, createCanvasDrawController, createCanvasInstance, createCanvasScenesStore, createDefaultStrokeStyle, createFanOutTrajectory, createGuideIndex, createNodeGuideIndex, cubicBezierAt, cubicPointAt, cubicsToPathData, dashContours, defaultEasing, deleteKeyframes, detachCanvasInstance, detachTokenBindings, distanceToBezierPath, distributeNodes, dividePaths, dividePolygons, easingFromInfluence, easingLabel, easingToCss, ensureLayout, estimateCanvasHeight, estimateNodeSize, evaluateAnimation, evaluateEasing, evaluateTrack, excludePaths, exportCssAnimation, findConnectorSnap, findStrokesAtPoint, fitCubicRun, fitCubics, fitFreehandPath, fitPathData, fitViewportToNodes, fitViewportToRect, flattenSvgPath, flowSide, formatAnimationTime, formatOklab, getAbsolutePosition, getAnimatableProperty, getAnimatedProperties, getAnimatedValue, getAnimationDuration, getAnimationTrack, getAutoLayout, getAutoLayoutGrid, getAutoLayoutInsertTarget, getBindableTokenProperties, getCanvasComponentDragId, getCanvasTokenProperty, getCenteredNodePosition, getChildLayout, getComponentSourceId, getCssPropertyAnimations, getEffectiveTokenModes, getFlowChildren, getInstanceData, getInstanceStatus, getKeyframeTimes, getLayoutParent, getLayoutSizing, getLayoutedNodes, getNextVariantValues, getNodeAnimation, getNodeOverrides, getNodeRect, getNodeShape, getNodeSize, getNodeTokenBindings, getNodeTokenModes, getResizingNodeRect, getShapeRenderData, getShapeSvg, getTimelineRows, getTimelineTicks, getTokenPropertyScope, getTokensForProperty, gradientToSvgDef, handlePoint, hasVisibleStroke, inferResizeHandle, inspectCanvasInstance, inspectNodeTokens, interpolateAnimationValue, intersectPaths, intersectPolygons, invertNodeUpdates, isAnimationEasing, isAnimationKeyframe, isAutoLayoutFrame, isCanvasComponent, isCanvasComponentSet, isCanvasGradient, isCanvasInstance, isCssExportExact, isEventFromTextInput, isKeyframeSelected, isLocked, isMeasureModifierHeld, isNodeAnimated, isShapeDescription, isShapeNode, isStraightCubic, isValidCanvasNode, isValidUrl, layoutAll, layoutBounds, layoutFrame, layoutUp, layoutUpMany, linearPositionTrajectory, linearTrajectory, listCanvasComponents, lockNodes, makeSizingCoherent, matchArrangeShortcut, matchSize, measureBetween, measureLabel, measureSelection, measureToLine, mergeNodeUpdates, mixColorsOklab, moveKeyframes, moveLayoutChild, multiPolygonArea, multiPolygonBounds, nearestHandlePositions, normalizeBezierPath, normalizeKeyframes, offsetPath, offsetShapeNodes, oklabToRgb, oppositePosition, outlineShapeNodeStrokes, outlineStroke, overlaps, parseCanvasClipboardData, parseCanvasScenes, parseCssEasing, parseCssGradient, parseKeyframeClipboard, parseOklab, parseSvgPath, pasteKeyframes, pathBoolean, placeBeside, playWebAnimations, pointInBezierPath, pointInMultiPolygon, pointInRings, polygonArea, polygonBoolean, polygonToSvgPath, positionToSide, pruneCanvasTokenModes, pushCanvasInstanceOverrides, readAnimatableValue, readNodeStyleProperty, readStyleSize, realClock, recordAnimationChanges, relayoutUpdates, remapPastedNodes, removeCanvasVariant, removeTrack, renameCanvasVariantProperty, renameCanvasVariantValue, reorderNodes, repositionNodesTo, resetCanvasInstanceOverrides, resizeHandleAxes, resolveCanvasGradient, resolveCanvasTokens, resolveEasing, resolvePadding, restoreCanvasMainComponent, revertShapeCombination, rgbToOklab, ringSignedArea, runMultiNodeTransition, sampleAnimationFrames, scaleKeyframes, serializeCanvasNodes, setCanvasComponentProperty, setCanvasInstanceProperties, setCanvasTokenMode, setCanvasVariantProperties, setKeyframe, setKeyframeEasing, setMotionPath, setTrackEnabled, shapeNodeToBezierPath, shapeNodeToPolygon, shapeToBezierPath, shapeToPolygon, sideToPosition, simplifyRing, snapKeyframeDelta, snapNodeDrag, snapNodeResize, snapResize, snapTimeToFrame, snapToGrid, springAt, streamlinePoints, strokeOutlineRings, strokePointsToPathData, strokeToShapeNode, subtractPaths, subtractPolygons, swapCanvasInstance, syncAllCanvasInstances, syncCanvasComponents, syncCanvasInstance, timeToX, toBezierPath, toWebAnimations, toggleLockNodes, transformBezierPath, unionPolygons, unitePaths, unlockNodes, updateKeyframe, withNodeAnimation, withStyleSize, wouldCreateComponentCycle, wrapAnimationTime, writeNodeStyleProperty, xToTime, xorPolygons } from '@pixerate/editor/canvas';
|
|
7
7
|
import { TokenState, TokenStore, TokenModeContext } from '@pixerate/editor/tokens';
|
|
8
|
-
import
|
|
8
|
+
import { DiagramControllerOptions, DiagramController, DiagramState, MermaidDocument, EditOp, DiagramActionResult, DiagramPlacement, PresenceClock, PresenceStore, DiagramDirector, PresenceState } from '@pixerate/editor/diagram';
|
|
9
9
|
|
|
10
10
|
interface AgentPresenceLayerProps {
|
|
11
11
|
presences: AgentPresence[];
|
|
@@ -572,7 +572,7 @@ declare function useCanvasAnimation<TNode extends CanvasNode = CanvasNode>(optio
|
|
|
572
572
|
/** The nodes evaluated at the playhead; render these. */
|
|
573
573
|
displayNodes: TNode[];
|
|
574
574
|
clipboard: _pixerate_editor_canvas.AnimationKeyframeClipboard | null;
|
|
575
|
-
player:
|
|
575
|
+
player: _pixerate_editor_canvas.AnimationPlayer;
|
|
576
576
|
getState: () => _pixerate_editor_canvas.CanvasAnimationState;
|
|
577
577
|
subscribe(listener: (state: _pixerate_editor_canvas.CanvasAnimationState) => void): () => void;
|
|
578
578
|
refresh(): void;
|
|
@@ -594,10 +594,10 @@ declare function useCanvasAnimation<TNode extends CanvasNode = CanvasNode>(optio
|
|
|
594
594
|
display: (nodes?: readonly TNode[] | undefined) => TNode[];
|
|
595
595
|
applyDisplayChanges(next: TNode[]): _pixerate_editor_canvas.KeyframeRef[];
|
|
596
596
|
addKeyframe(ids?: Iterable<string>, keys?: readonly string[], time?: number): _pixerate_editor_canvas.KeyframeRef[];
|
|
597
|
-
setKeyframe(nodeId: string, property: string, value:
|
|
597
|
+
setKeyframe(nodeId: string, property: string, value: _pixerate_editor_canvas.AnimationValue, time?: number, easing?: _pixerate_editor_canvas.AnimationEasing | string): void;
|
|
598
598
|
updateKeyframe(ref: _pixerate_editor_canvas.KeyframeRef, patch: _pixerate_editor_canvas.KeyframePatch): void;
|
|
599
599
|
deleteKeyframes(refs?: readonly _pixerate_editor_canvas.KeyframeRef[]): boolean;
|
|
600
|
-
setEasing(easing:
|
|
600
|
+
setEasing(easing: _pixerate_editor_canvas.AnimationEasing | string | null, refs?: readonly _pixerate_editor_canvas.KeyframeRef[]): boolean;
|
|
601
601
|
setTrackEnabled(nodeId: string, property: string, enabled: boolean): void;
|
|
602
602
|
removeTrack(nodeId: string, property: string): void;
|
|
603
603
|
setMotionPath(nodeId: string, motionPath: {
|
|
@@ -766,4 +766,153 @@ interface CanvasInstanceInspectorProps<TNode extends CanvasNode = CanvasNode> {
|
|
|
766
766
|
*/
|
|
767
767
|
declare function CanvasInstanceInspector<TNode extends CanvasNode = CanvasNode>({ nodes, nodeId, components, onError, className }: CanvasInstanceInspectorProps<TNode>): React__default.JSX.Element | null;
|
|
768
768
|
|
|
769
|
-
|
|
769
|
+
interface UseMermaidDiagramOptions extends DiagramControllerOptions {
|
|
770
|
+
/** Layout spacing and node measuring for new nodes (stored positions always win). */
|
|
771
|
+
layoutOptions?: DiagramLayoutOptions;
|
|
772
|
+
}
|
|
773
|
+
type Placed = {
|
|
774
|
+
id: string;
|
|
775
|
+
position: {
|
|
776
|
+
x: number;
|
|
777
|
+
y: number;
|
|
778
|
+
};
|
|
779
|
+
parentId?: string;
|
|
780
|
+
};
|
|
781
|
+
interface UseMermaidDiagramResult {
|
|
782
|
+
controller: DiagramController;
|
|
783
|
+
state: DiagramState;
|
|
784
|
+
document: MermaidDocument;
|
|
785
|
+
/** The Mermaid text (with the `%% @pixerate` layout comment). */
|
|
786
|
+
source: string;
|
|
787
|
+
/** Canvas nodes (groups first, children relative to their group) and edges. */
|
|
788
|
+
nodes: MermaidFlowNode[];
|
|
789
|
+
edges: MermaidFlowEdge[];
|
|
790
|
+
layout: DiagramLayout;
|
|
791
|
+
apply: (ops: EditOp | EditOp[], label?: string) => DiagramActionResult;
|
|
792
|
+
/** Replaces the source; `clearHistory` when opening a different diagram. */
|
|
793
|
+
load: (source: string, options?: {
|
|
794
|
+
clearHistory?: boolean;
|
|
795
|
+
}) => DiagramActionResult;
|
|
796
|
+
/** Stores where dragged nodes ended up (pass every canvas node as `all` so groups carry their contents). */
|
|
797
|
+
moveNodes: (moved: readonly Placed[], all?: readonly Placed[]) => DiagramActionResult | null;
|
|
798
|
+
connect: (source: string, target: string, label?: string) => DiagramActionResult;
|
|
799
|
+
/** Removes nodes / groups (with their edges) and edges by id, as one undo step. */
|
|
800
|
+
remove: (ids: readonly string[]) => DiagramActionResult;
|
|
801
|
+
rename: (id: string, label: string) => DiagramActionResult;
|
|
802
|
+
select: (ids: readonly string[]) => void;
|
|
803
|
+
undo: () => void;
|
|
804
|
+
redo: () => void;
|
|
805
|
+
}
|
|
806
|
+
/** The controller's state (re-renders on every change). */
|
|
807
|
+
declare function useDiagramState(controller: DiagramController): DiagramState;
|
|
808
|
+
/**
|
|
809
|
+
* A Mermaid diagram on a React Flow canvas: subscribes to a `DiagramController` (or creates
|
|
810
|
+
* one from options), lays it out and returns canvas nodes and edges with bound edits. Every
|
|
811
|
+
* edit rewrites only the statements it touches; positions go into `%% @pixerate`.
|
|
812
|
+
*/
|
|
813
|
+
declare function useMermaidDiagram(controllerOrOptions?: DiagramController | UseMermaidDiagramOptions): UseMermaidDiagramResult;
|
|
814
|
+
interface UseMermaidStreamOptions extends DiagramLayoutOptions {
|
|
815
|
+
/** True once the whole source has arrived (unconnected nodes are shown then). */
|
|
816
|
+
complete?: boolean;
|
|
817
|
+
/** Glide duration between layouts in ms (default 300; 0 jumps). */
|
|
818
|
+
duration?: number;
|
|
819
|
+
}
|
|
820
|
+
interface UseMermaidStreamResult {
|
|
821
|
+
document: MermaidDocument | null;
|
|
822
|
+
nodes: MermaidFlowNode[];
|
|
823
|
+
edges: MermaidFlowEdge[];
|
|
824
|
+
/** The layout being shown (mid-glide while `settled` is false). */
|
|
825
|
+
layout: DiagramLayout | null;
|
|
826
|
+
settled: boolean;
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Draws Mermaid that is still being written (e.g. a model's reply): nodes appear once an
|
|
830
|
+
* edge places them and glide to their new places as the layout grows. Read-only.
|
|
831
|
+
*/
|
|
832
|
+
declare function useMermaidStream(source: string, options?: UseMermaidStreamOptions): UseMermaidStreamResult;
|
|
833
|
+
|
|
834
|
+
/** Node data as `mermaidToCanvas` produces it. */
|
|
835
|
+
interface MermaidDiagramNodeData {
|
|
836
|
+
node?: {
|
|
837
|
+
id: string;
|
|
838
|
+
label: string;
|
|
839
|
+
shape: string;
|
|
840
|
+
data?: Record<string, unknown>;
|
|
841
|
+
};
|
|
842
|
+
group?: {
|
|
843
|
+
id: string;
|
|
844
|
+
label: string;
|
|
845
|
+
};
|
|
846
|
+
resolvedStyles?: Record<string, string>;
|
|
847
|
+
[key: string]: unknown;
|
|
848
|
+
}
|
|
849
|
+
interface MermaidDiagramNodeProps {
|
|
850
|
+
id?: string;
|
|
851
|
+
data: MermaidDiagramNodeData;
|
|
852
|
+
width?: number;
|
|
853
|
+
height?: number;
|
|
854
|
+
selected?: boolean;
|
|
855
|
+
className?: string;
|
|
856
|
+
/** Rendered over the node, e.g. React Flow `<Handle>`s. */
|
|
857
|
+
children?: React__default.ReactNode;
|
|
858
|
+
[key: string]: unknown;
|
|
859
|
+
}
|
|
860
|
+
/** Mermaid `style` / `classDef` declarations as the CSS the node paints with. */
|
|
861
|
+
declare function mermaidNodeStyle(styles?: Record<string, string>, selected?: boolean): React__default.CSSProperties;
|
|
862
|
+
/**
|
|
863
|
+
* Headless Mermaid node: draws the node's shape (flowchart, state, class, ER) as SVG with
|
|
864
|
+
* its label, painted from its Mermaid styles. Register it as the `mermaid-node` React Flow
|
|
865
|
+
* node type and pass `<Handle>`s as children.
|
|
866
|
+
*/
|
|
867
|
+
declare function MermaidDiagramNode({ data, width, height, selected, className, children }: MermaidDiagramNodeProps): React__default.JSX.Element | null;
|
|
868
|
+
/** Headless Mermaid group (subgraph, composite state, namespace): a titled frame. Register as `mermaid-group`. */
|
|
869
|
+
declare function MermaidDiagramGroup({ data, selected, className, children }: MermaidDiagramNodeProps): React__default.JSX.Element | null;
|
|
870
|
+
|
|
871
|
+
interface MermaidThumbnailProps extends DiagramSvgOptions {
|
|
872
|
+
/** Mermaid text, or an already parsed document. */
|
|
873
|
+
source: string | MermaidDocument;
|
|
874
|
+
className?: string;
|
|
875
|
+
/** Shown for families that cannot be drawn here (sequence, Gantt, …) and empty diagrams. */
|
|
876
|
+
fallback?: React__default.ReactNode;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* A static preview of a flowchart, state, class or ER diagram (no canvas, no Mermaid runtime):
|
|
880
|
+
* `mermaidThumbnailSvg` fitted inside `maxWidth` × `maxHeight` (default 240 × 160).
|
|
881
|
+
*/
|
|
882
|
+
declare function MermaidThumbnail({ source, className, fallback, ...options }: MermaidThumbnailProps): React__default.JSX.Element;
|
|
883
|
+
|
|
884
|
+
interface UseDiagramDirectorOptions {
|
|
885
|
+
/** Where nodes are drawn now, e.g. `() => diagram.layout` from `useMermaidDiagram`. */
|
|
886
|
+
placement: () => DiagramPlacement;
|
|
887
|
+
/** 1 = natural speed; 2 = twice as fast. */
|
|
888
|
+
speed?: number;
|
|
889
|
+
clock?: PresenceClock;
|
|
890
|
+
/** Hide a cursor this long after its last call (ms, default 1500). */
|
|
891
|
+
linger?: number;
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* A `PresenceStore` and `DiagramDirector` for a diagram, created once: pass `director` to
|
|
895
|
+
* `createDiagramToolProvider` so agent edits are acted out by a cursor, and `presence` to
|
|
896
|
+
* `<DiagramPresenceLayer>` to draw it.
|
|
897
|
+
*/
|
|
898
|
+
declare function useDiagramDirector(controller: DiagramController, options: UseDiagramDirectorOptions): {
|
|
899
|
+
presence: PresenceStore;
|
|
900
|
+
director: DiagramDirector;
|
|
901
|
+
};
|
|
902
|
+
/** The presence store's state (re-renders on every cursor move). */
|
|
903
|
+
declare function usePresenceState(presence: PresenceStore): PresenceState;
|
|
904
|
+
|
|
905
|
+
interface DiagramPresenceLayerProps {
|
|
906
|
+
presence: PresenceStore;
|
|
907
|
+
/** The canvas viewport (React Flow's `useViewport()`), to place cursors given in canvas coordinates. */
|
|
908
|
+
viewport: {
|
|
909
|
+
x: number;
|
|
910
|
+
y: number;
|
|
911
|
+
zoom: number;
|
|
912
|
+
};
|
|
913
|
+
className?: string;
|
|
914
|
+
}
|
|
915
|
+
/** Agent cursors and their notes over a canvas, from a `PresenceStore` (see `DiagramDirector`). */
|
|
916
|
+
declare function DiagramPresenceLayer({ presence, viewport, className }: DiagramPresenceLayerProps): React__default.JSX.Element | null;
|
|
917
|
+
|
|
918
|
+
export { AgentPresenceLayer, type AgentPresenceLayerProps, AnimationTimeline, type AnimationTimelineProps, type CanvasAnimation, type CanvasArrange, type CanvasAutoLayout, type CanvasComponents, CanvasComponentsPanel, type CanvasComponentsPanelActions, type CanvasComponentsPanelProps, type CanvasDraw, type CanvasDrawActions, CanvasDrawLayer, type CanvasDrawLayerProps, type CanvasDrawState, type CanvasGraphTarget, CanvasGuidesLayer, type CanvasGuidesLayerProps, CanvasInstanceInspector, type CanvasInstanceInspectorActions, type CanvasInstanceInspectorProps, type CanvasMeasure, type CanvasScenes, type CanvasTokens, DiagramPresenceLayer, type DiagramPresenceLayerProps, MermaidDiagramGroup, MermaidDiagramNode, type MermaidDiagramNodeData, type MermaidDiagramNodeProps, MermaidThumbnail, type MermaidThumbnailProps, ShapeNode, type ShapeNodeProps, TokenBindingPicker, type TokenBindingPickerProps, TokenModeSwitcher, type TokenModeSwitcherProps, type UseCanvasAnimationOptions, type UseCanvasArrangeOptions, type UseCanvasArrangeShortcutsOptions, type UseCanvasAutoLayoutOptions, type UseCanvasClipboardOptions, type UseCanvasComponentsOptions, type UseCanvasDockingOptions, type UseCanvasDrawOptions, type UseCanvasGraphOptions, type UseCanvasLayoutOptions, type UseCanvasMeasureOptions, type UseCanvasScenesOptions, type UseCanvasShortcutsOptions, type UseCanvasTokensOptions, type UseDiagramDirectorOptions, type UseMermaidDiagramOptions, type UseMermaidDiagramResult, type UseMermaidStreamOptions, type UseMermaidStreamResult, type UseStreamingCanvasOptions, mermaidNodeStyle, useCanvasAnimation, useCanvasArrange, useCanvasArrangeShortcuts, useCanvasAutoLayout, useCanvasClipboard, useCanvasComponents, useCanvasDocking, useCanvasDraw, useCanvasExplosion, useCanvasGraph, useCanvasLayout, useCanvasMeasure, useCanvasScenes, useCanvasShortcuts, useCanvasTokens, useDiagramDirector, useDiagramState, useMermaidDiagram, useMermaidStream, usePresenceState, useStreamingCanvas };
|
package/dist/canvas/index.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import * as React$1 from 'react';
|
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { AgentPresence } from '@pixerate/editor/agent';
|
|
4
4
|
import * as _pixerate_editor_canvas from '@pixerate/editor/canvas';
|
|
5
|
-
import { CanvasNode, CanvasEdge, IncrementalLayoutOptions, XYPosition, GraphDifferences, Rect, CanvasLayoutOptions, Side, PlaceBesideOptions, getCenteredNodePosition, CanvasDockingCallbacks, DockStrategy, ExplodeNodeOptions, CollapseNodeOptions, ExplosionSnapshot, ArrangeHistoryTarget, SnapGuidesOptions, NodeRectOptions, AutoLayoutOptions, GuideLine, CanvasArrangeAction, ArrangeShortcutBinding, CanvasScenesOptions, CanvasViewport, CanvasScenesStore, CanvasScene, FitViewportOptions, FreehandTool, FreehandStrokeStyle, FreehandStroke, FreehandDrawOptions, ShapeDescription, AutoLayoutMeasure, CanvasTokenOptions, AnimationHistoryTarget, Clock, AnimationLoopMode, AnimatableProperty, CanvasComponentSyncOptions, CanvasComponentsController } from '@pixerate/editor/canvas';
|
|
5
|
+
import { CanvasNode, CanvasEdge, IncrementalLayoutOptions, XYPosition, GraphDifferences, Rect, CanvasLayoutOptions, Side, PlaceBesideOptions, getCenteredNodePosition, CanvasDockingCallbacks, DockStrategy, ExplodeNodeOptions, CollapseNodeOptions, ExplosionSnapshot, ArrangeHistoryTarget, SnapGuidesOptions, NodeRectOptions, AutoLayoutOptions, GuideLine, CanvasArrangeAction, ArrangeShortcutBinding, CanvasScenesOptions, CanvasViewport, CanvasScenesStore, CanvasScene, FitViewportOptions, FreehandTool, FreehandStrokeStyle, FreehandStroke, FreehandDrawOptions, ShapeDescription, AutoLayoutMeasure, CanvasTokenOptions, AnimationHistoryTarget, Clock, AnimationLoopMode, AnimatableProperty, CanvasComponentSyncOptions, CanvasComponentsController, DiagramLayoutOptions, MermaidFlowNode, MermaidFlowEdge, DiagramLayout, DiagramSvgOptions } from '@pixerate/editor/canvas';
|
|
6
6
|
export { ANIMATABLE_PROPERTIES, ANIMATION_DATA_KEY, ANIMATION_EASING_LABELS, ANIMATION_EASING_PRESETS, ANIMATION_TIME_EPSILON, AUTO_LAYOUT_DATA_KEY, AddCanvasVariantOptions, AlignEdge, AnimatableProperty, AnimateNodeOptions, AnimationDocument, AnimationEasing, AnimationEasingPreset, AnimationEditError, AnimationEditErrorCode, AnimationFrame, AnimationHistoryTarget, AnimationKeyframe, AnimationKeyframeClipboard, AnimationLoopMode, AnimationMotionPath, AnimationOverrides, AnimationPlayer, AnimationPlayerOptions, AnimationPlayerState, AnimationTrack, AnimationValue, AnimationValueType, ArrangeShortcutBinding, AutoLayout, AutoLayoutAlignContent, AutoLayoutAlignCross, AutoLayoutAlignMain, AutoLayoutCellAlign, AutoLayoutChild, AutoLayoutConstraints, AutoLayoutGrid, AutoLayoutGridArea, AutoLayoutGridCell, AutoLayoutGridGeometry, AutoLayoutGridTrack, AutoLayoutHorizontalConstraint, AutoLayoutInsertTarget, AutoLayoutMeasure, AutoLayoutMode, AutoLayoutOptions, AutoLayoutPadding, AutoLayoutSize, AutoLayoutSizing, AutoLayoutSizingPair, AutoLayoutVerticalConstraint, BezierCommand, BezierPath, BezierPathInput, CANVAS_COMPONENT_DRAG_TYPE, CANVAS_GRADIENT_PRESETS, CANVAS_TOKEN_PROPERTIES, CHILD_LAYOUT_DATA_KEY, CONNECTION_LINE_TYPES, CSS_ANIMATION_PROPERTIES, CUBIC_BEZIER_PRESETS, CanvasAnimationController, CanvasAnimationControllerOptions, CanvasAnimationState, CanvasArrangeAction, CanvasAutoLayoutController, CanvasAutoLayoutControllerOptions, CanvasClipboardPayload, CanvasComponentInfo, CanvasComponentPropertyDef, CanvasComponentPropertyField, CanvasComponentResult, CanvasComponentSetInfo, CanvasComponentSyncOptions, CanvasComponentsController, CanvasComponentsControllerOptions, CanvasConnectionLineType, CanvasDockingCallbacks, CanvasDrawControllerOptions, CanvasEdge, CanvasGradientDef, CanvasHeightOptions, CanvasInstanceInfo, CanvasLayoutOptions, CanvasLinearGradient, CanvasNode, CanvasNodeUpdate, CanvasRadialGradient, CanvasScene, CanvasScenesState, CanvasScenesStore, CanvasTokenBindingInfo, CanvasTokenOptions, CanvasTokenProperty, CanvasViewport, Clock, CollapseNodeOptions, CombineShapeNodesOptions, CombineShapeNodesRefusal, CombineShapeNodesResult, ConnectorSnap, ConnectorSnapTarget, CssAnimationExport, CssExportOptions, CubicBezierEasing, CubicSegment, DEFAULT_ARRANGE_SHORTCUTS, DirectionalDisplacementOptions, DisplacementDirection, DistributeAxis, DistributeMode, DividePathsResult, DockStrategy, EllipseShape, ExplodeNodeOptions, ExplosionSnapshot, FanOutTrajectoryOptions, FitCubicsOptions, FitPathDataOptions, FlattenOptions, FreehandStroke, FreehandStrokeStyle, FreehandTool, GradientStop, GraphDifferences, GuideIndex, GuideLine, IncrementalLayoutOptions, KeyframeDragState, KeyframePatch, KeyframeRef, KeyframeSnap, MAX_KEYFRAME_REFS, ManualClock, MeasureGuide, MeasureSelectionOptions, MeasureSelectionResult, MultiPolygon, NodeAnimation, NodeTransition, OffsetPathOptions, OffsetShapeNodesOptions, OklabColor, OutlineShapeStrokesOptions, OutlineStrokeOptions, PathBooleanResult, PathCommand, PathOperand, PathOperandInput, PathOpsOptions, PathShape, PlaceBesideOptions, Point, PolygonBooleanOperation, PolygonBooleanOptions, PolygonFillRule, PolygonInput, PolygonOperand, PolygonPiece, PolygonRing, PolygonToPathOptions, PolygonWithHoles, Position, RESIZE_HANDLES, Rect, RectShape, ReflowDisplacementOptions, RegularPolygonShape, ResizeHandle, SHAPE_DATA_KEY, SHAPE_KINDS, SHAPE_NODE_TYPE, SHAPE_OPERATIONS, SetCanvasVariantPropertiesOptions, ShapeDescription, ShapeKind, ShapeNodePolygonOptions, ShapeOperation, ShapePaint, ShapePathEditOperation, ShapePathEditRefusal, ShapePathEditResult, ShapeRenderData, ShapeSize, Side, SizeDimension, SnapGuidesOptions, SnapNodeResizeOptions, SnapNodeResizeResult, SnapResizeOptions, SnapResizeResult, SnapResult, SpringEasing, StarShape, StrokeCap, StrokeJoin, StrokeToShapeNodeOptions, SvgGradientDef, SvgGradientStop, TOKEN_BINDINGS_DATA_KEY, TOKEN_MODES_DATA_KEY, TimelineKeyframe, TimelineRow, TrajectoryFunction, TrajectoryPoint, WebAnimationSpec, XYPosition, ZOrderOperation, addCanvasVariant, addKeyframesAtTime, alignNodes, angleToSvgLinearCoords, animateNode, applyAnimation, applyAnimationOverrides, applyConstraints, applyNodeUpdates, applyShapeCombination, applyShapeReplacement, bezierPathArea, bezierPathBounds, bezierPathLength, bezierPathPointAtLength, bezierPathSignedArea, bezierPathToSvg, bindCanvasComponentProperty, bindCanvasToken, blendLayout, boundsOf, calculateDagreReflowDisplacement, calculateDirectionalDisplacement, canCombineShapeNodes, canOffsetShapeNodes, canOutlineShapeNodeStrokes, canvasHeight, centerNodes, centre, clampAnimationValue, clampLayoutSize, combineCanvasComponentsAsVariants, combineShapeNodes, computeNodesBoundingBox, computeSnapGuides, connectedOnly, copyKeyframes, countPathSegments, createAnimationPlayer, createBezierTrajectory, createCanvasAnimationController, createCanvasAutoLayoutController, createCanvasComponent, createCanvasComponentsController, createCanvasDrawController, createCanvasInstance, createCanvasScenesStore, createDefaultStrokeStyle, createFanOutTrajectory, createGuideIndex, createNodeGuideIndex, cubicBezierAt, cubicPointAt, cubicsToPathData, dashContours, defaultEasing, deleteKeyframes, detachCanvasInstance, detachTokenBindings, distanceToBezierPath, distributeNodes, dividePaths, dividePolygons, easingFromInfluence, easingLabel, easingToCss, ensureLayout, estimateCanvasHeight, estimateNodeSize, evaluateAnimation, evaluateEasing, evaluateTrack, excludePaths, exportCssAnimation, findConnectorSnap, findStrokesAtPoint, fitCubicRun, fitCubics, fitFreehandPath, fitPathData, fitViewportToNodes, fitViewportToRect, flattenSvgPath, flowSide, formatAnimationTime, formatOklab, getAbsolutePosition, getAnimatableProperty, getAnimatedProperties, getAnimatedValue, getAnimationDuration, getAnimationTrack, getAutoLayout, getAutoLayoutGrid, getAutoLayoutInsertTarget, getBindableTokenProperties, getCanvasComponentDragId, getCanvasTokenProperty, getCenteredNodePosition, getChildLayout, getComponentSourceId, getCssPropertyAnimations, getEffectiveTokenModes, getFlowChildren, getInstanceData, getInstanceStatus, getKeyframeTimes, getLayoutParent, getLayoutSizing, getLayoutedNodes, getNextVariantValues, getNodeAnimation, getNodeOverrides, getNodeRect, getNodeShape, getNodeSize, getNodeTokenBindings, getNodeTokenModes, getResizingNodeRect, getShapeRenderData, getShapeSvg, getTimelineRows, getTimelineTicks, getTokenPropertyScope, getTokensForProperty, gradientToSvgDef, handlePoint, hasVisibleStroke, inferResizeHandle, inspectCanvasInstance, inspectNodeTokens, interpolateAnimationValue, intersectPaths, intersectPolygons, invertNodeUpdates, isAnimationEasing, isAnimationKeyframe, isAutoLayoutFrame, isCanvasComponent, isCanvasComponentSet, isCanvasGradient, isCanvasInstance, isCssExportExact, isEventFromTextInput, isKeyframeSelected, isLocked, isMeasureModifierHeld, isNodeAnimated, isShapeDescription, isShapeNode, isStraightCubic, isValidCanvasNode, isValidUrl, layoutAll, layoutBounds, layoutFrame, layoutUp, layoutUpMany, linearPositionTrajectory, linearTrajectory, listCanvasComponents, lockNodes, makeSizingCoherent, matchArrangeShortcut, matchSize, measureBetween, measureLabel, measureSelection, measureToLine, mergeNodeUpdates, mixColorsOklab, moveKeyframes, moveLayoutChild, multiPolygonArea, multiPolygonBounds, nearestHandlePositions, normalizeBezierPath, normalizeKeyframes, offsetPath, offsetShapeNodes, oklabToRgb, oppositePosition, outlineShapeNodeStrokes, outlineStroke, overlaps, parseCanvasClipboardData, parseCanvasScenes, parseCssEasing, parseCssGradient, parseKeyframeClipboard, parseOklab, parseSvgPath, pasteKeyframes, pathBoolean, placeBeside, playWebAnimations, pointInBezierPath, pointInMultiPolygon, pointInRings, polygonArea, polygonBoolean, polygonToSvgPath, positionToSide, pruneCanvasTokenModes, pushCanvasInstanceOverrides, readAnimatableValue, readNodeStyleProperty, readStyleSize, realClock, recordAnimationChanges, relayoutUpdates, remapPastedNodes, removeCanvasVariant, removeTrack, renameCanvasVariantProperty, renameCanvasVariantValue, reorderNodes, repositionNodesTo, resetCanvasInstanceOverrides, resizeHandleAxes, resolveCanvasGradient, resolveCanvasTokens, resolveEasing, resolvePadding, restoreCanvasMainComponent, revertShapeCombination, rgbToOklab, ringSignedArea, runMultiNodeTransition, sampleAnimationFrames, scaleKeyframes, serializeCanvasNodes, setCanvasComponentProperty, setCanvasInstanceProperties, setCanvasTokenMode, setCanvasVariantProperties, setKeyframe, setKeyframeEasing, setMotionPath, setTrackEnabled, shapeNodeToBezierPath, shapeNodeToPolygon, shapeToBezierPath, shapeToPolygon, sideToPosition, simplifyRing, snapKeyframeDelta, snapNodeDrag, snapNodeResize, snapResize, snapTimeToFrame, snapToGrid, springAt, streamlinePoints, strokeOutlineRings, strokePointsToPathData, strokeToShapeNode, subtractPaths, subtractPolygons, swapCanvasInstance, syncAllCanvasInstances, syncCanvasComponents, syncCanvasInstance, timeToX, toBezierPath, toWebAnimations, toggleLockNodes, transformBezierPath, unionPolygons, unitePaths, unlockNodes, updateKeyframe, withNodeAnimation, withStyleSize, wouldCreateComponentCycle, wrapAnimationTime, writeNodeStyleProperty, xToTime, xorPolygons } from '@pixerate/editor/canvas';
|
|
7
7
|
import { TokenState, TokenStore, TokenModeContext } from '@pixerate/editor/tokens';
|
|
8
|
-
import
|
|
8
|
+
import { DiagramControllerOptions, DiagramController, DiagramState, MermaidDocument, EditOp, DiagramActionResult, DiagramPlacement, PresenceClock, PresenceStore, DiagramDirector, PresenceState } from '@pixerate/editor/diagram';
|
|
9
9
|
|
|
10
10
|
interface AgentPresenceLayerProps {
|
|
11
11
|
presences: AgentPresence[];
|
|
@@ -572,7 +572,7 @@ declare function useCanvasAnimation<TNode extends CanvasNode = CanvasNode>(optio
|
|
|
572
572
|
/** The nodes evaluated at the playhead; render these. */
|
|
573
573
|
displayNodes: TNode[];
|
|
574
574
|
clipboard: _pixerate_editor_canvas.AnimationKeyframeClipboard | null;
|
|
575
|
-
player:
|
|
575
|
+
player: _pixerate_editor_canvas.AnimationPlayer;
|
|
576
576
|
getState: () => _pixerate_editor_canvas.CanvasAnimationState;
|
|
577
577
|
subscribe(listener: (state: _pixerate_editor_canvas.CanvasAnimationState) => void): () => void;
|
|
578
578
|
refresh(): void;
|
|
@@ -594,10 +594,10 @@ declare function useCanvasAnimation<TNode extends CanvasNode = CanvasNode>(optio
|
|
|
594
594
|
display: (nodes?: readonly TNode[] | undefined) => TNode[];
|
|
595
595
|
applyDisplayChanges(next: TNode[]): _pixerate_editor_canvas.KeyframeRef[];
|
|
596
596
|
addKeyframe(ids?: Iterable<string>, keys?: readonly string[], time?: number): _pixerate_editor_canvas.KeyframeRef[];
|
|
597
|
-
setKeyframe(nodeId: string, property: string, value:
|
|
597
|
+
setKeyframe(nodeId: string, property: string, value: _pixerate_editor_canvas.AnimationValue, time?: number, easing?: _pixerate_editor_canvas.AnimationEasing | string): void;
|
|
598
598
|
updateKeyframe(ref: _pixerate_editor_canvas.KeyframeRef, patch: _pixerate_editor_canvas.KeyframePatch): void;
|
|
599
599
|
deleteKeyframes(refs?: readonly _pixerate_editor_canvas.KeyframeRef[]): boolean;
|
|
600
|
-
setEasing(easing:
|
|
600
|
+
setEasing(easing: _pixerate_editor_canvas.AnimationEasing | string | null, refs?: readonly _pixerate_editor_canvas.KeyframeRef[]): boolean;
|
|
601
601
|
setTrackEnabled(nodeId: string, property: string, enabled: boolean): void;
|
|
602
602
|
removeTrack(nodeId: string, property: string): void;
|
|
603
603
|
setMotionPath(nodeId: string, motionPath: {
|
|
@@ -766,4 +766,153 @@ interface CanvasInstanceInspectorProps<TNode extends CanvasNode = CanvasNode> {
|
|
|
766
766
|
*/
|
|
767
767
|
declare function CanvasInstanceInspector<TNode extends CanvasNode = CanvasNode>({ nodes, nodeId, components, onError, className }: CanvasInstanceInspectorProps<TNode>): React__default.JSX.Element | null;
|
|
768
768
|
|
|
769
|
-
|
|
769
|
+
interface UseMermaidDiagramOptions extends DiagramControllerOptions {
|
|
770
|
+
/** Layout spacing and node measuring for new nodes (stored positions always win). */
|
|
771
|
+
layoutOptions?: DiagramLayoutOptions;
|
|
772
|
+
}
|
|
773
|
+
type Placed = {
|
|
774
|
+
id: string;
|
|
775
|
+
position: {
|
|
776
|
+
x: number;
|
|
777
|
+
y: number;
|
|
778
|
+
};
|
|
779
|
+
parentId?: string;
|
|
780
|
+
};
|
|
781
|
+
interface UseMermaidDiagramResult {
|
|
782
|
+
controller: DiagramController;
|
|
783
|
+
state: DiagramState;
|
|
784
|
+
document: MermaidDocument;
|
|
785
|
+
/** The Mermaid text (with the `%% @pixerate` layout comment). */
|
|
786
|
+
source: string;
|
|
787
|
+
/** Canvas nodes (groups first, children relative to their group) and edges. */
|
|
788
|
+
nodes: MermaidFlowNode[];
|
|
789
|
+
edges: MermaidFlowEdge[];
|
|
790
|
+
layout: DiagramLayout;
|
|
791
|
+
apply: (ops: EditOp | EditOp[], label?: string) => DiagramActionResult;
|
|
792
|
+
/** Replaces the source; `clearHistory` when opening a different diagram. */
|
|
793
|
+
load: (source: string, options?: {
|
|
794
|
+
clearHistory?: boolean;
|
|
795
|
+
}) => DiagramActionResult;
|
|
796
|
+
/** Stores where dragged nodes ended up (pass every canvas node as `all` so groups carry their contents). */
|
|
797
|
+
moveNodes: (moved: readonly Placed[], all?: readonly Placed[]) => DiagramActionResult | null;
|
|
798
|
+
connect: (source: string, target: string, label?: string) => DiagramActionResult;
|
|
799
|
+
/** Removes nodes / groups (with their edges) and edges by id, as one undo step. */
|
|
800
|
+
remove: (ids: readonly string[]) => DiagramActionResult;
|
|
801
|
+
rename: (id: string, label: string) => DiagramActionResult;
|
|
802
|
+
select: (ids: readonly string[]) => void;
|
|
803
|
+
undo: () => void;
|
|
804
|
+
redo: () => void;
|
|
805
|
+
}
|
|
806
|
+
/** The controller's state (re-renders on every change). */
|
|
807
|
+
declare function useDiagramState(controller: DiagramController): DiagramState;
|
|
808
|
+
/**
|
|
809
|
+
* A Mermaid diagram on a React Flow canvas: subscribes to a `DiagramController` (or creates
|
|
810
|
+
* one from options), lays it out and returns canvas nodes and edges with bound edits. Every
|
|
811
|
+
* edit rewrites only the statements it touches; positions go into `%% @pixerate`.
|
|
812
|
+
*/
|
|
813
|
+
declare function useMermaidDiagram(controllerOrOptions?: DiagramController | UseMermaidDiagramOptions): UseMermaidDiagramResult;
|
|
814
|
+
interface UseMermaidStreamOptions extends DiagramLayoutOptions {
|
|
815
|
+
/** True once the whole source has arrived (unconnected nodes are shown then). */
|
|
816
|
+
complete?: boolean;
|
|
817
|
+
/** Glide duration between layouts in ms (default 300; 0 jumps). */
|
|
818
|
+
duration?: number;
|
|
819
|
+
}
|
|
820
|
+
interface UseMermaidStreamResult {
|
|
821
|
+
document: MermaidDocument | null;
|
|
822
|
+
nodes: MermaidFlowNode[];
|
|
823
|
+
edges: MermaidFlowEdge[];
|
|
824
|
+
/** The layout being shown (mid-glide while `settled` is false). */
|
|
825
|
+
layout: DiagramLayout | null;
|
|
826
|
+
settled: boolean;
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Draws Mermaid that is still being written (e.g. a model's reply): nodes appear once an
|
|
830
|
+
* edge places them and glide to their new places as the layout grows. Read-only.
|
|
831
|
+
*/
|
|
832
|
+
declare function useMermaidStream(source: string, options?: UseMermaidStreamOptions): UseMermaidStreamResult;
|
|
833
|
+
|
|
834
|
+
/** Node data as `mermaidToCanvas` produces it. */
|
|
835
|
+
interface MermaidDiagramNodeData {
|
|
836
|
+
node?: {
|
|
837
|
+
id: string;
|
|
838
|
+
label: string;
|
|
839
|
+
shape: string;
|
|
840
|
+
data?: Record<string, unknown>;
|
|
841
|
+
};
|
|
842
|
+
group?: {
|
|
843
|
+
id: string;
|
|
844
|
+
label: string;
|
|
845
|
+
};
|
|
846
|
+
resolvedStyles?: Record<string, string>;
|
|
847
|
+
[key: string]: unknown;
|
|
848
|
+
}
|
|
849
|
+
interface MermaidDiagramNodeProps {
|
|
850
|
+
id?: string;
|
|
851
|
+
data: MermaidDiagramNodeData;
|
|
852
|
+
width?: number;
|
|
853
|
+
height?: number;
|
|
854
|
+
selected?: boolean;
|
|
855
|
+
className?: string;
|
|
856
|
+
/** Rendered over the node, e.g. React Flow `<Handle>`s. */
|
|
857
|
+
children?: React__default.ReactNode;
|
|
858
|
+
[key: string]: unknown;
|
|
859
|
+
}
|
|
860
|
+
/** Mermaid `style` / `classDef` declarations as the CSS the node paints with. */
|
|
861
|
+
declare function mermaidNodeStyle(styles?: Record<string, string>, selected?: boolean): React__default.CSSProperties;
|
|
862
|
+
/**
|
|
863
|
+
* Headless Mermaid node: draws the node's shape (flowchart, state, class, ER) as SVG with
|
|
864
|
+
* its label, painted from its Mermaid styles. Register it as the `mermaid-node` React Flow
|
|
865
|
+
* node type and pass `<Handle>`s as children.
|
|
866
|
+
*/
|
|
867
|
+
declare function MermaidDiagramNode({ data, width, height, selected, className, children }: MermaidDiagramNodeProps): React__default.JSX.Element | null;
|
|
868
|
+
/** Headless Mermaid group (subgraph, composite state, namespace): a titled frame. Register as `mermaid-group`. */
|
|
869
|
+
declare function MermaidDiagramGroup({ data, selected, className, children }: MermaidDiagramNodeProps): React__default.JSX.Element | null;
|
|
870
|
+
|
|
871
|
+
interface MermaidThumbnailProps extends DiagramSvgOptions {
|
|
872
|
+
/** Mermaid text, or an already parsed document. */
|
|
873
|
+
source: string | MermaidDocument;
|
|
874
|
+
className?: string;
|
|
875
|
+
/** Shown for families that cannot be drawn here (sequence, Gantt, …) and empty diagrams. */
|
|
876
|
+
fallback?: React__default.ReactNode;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* A static preview of a flowchart, state, class or ER diagram (no canvas, no Mermaid runtime):
|
|
880
|
+
* `mermaidThumbnailSvg` fitted inside `maxWidth` × `maxHeight` (default 240 × 160).
|
|
881
|
+
*/
|
|
882
|
+
declare function MermaidThumbnail({ source, className, fallback, ...options }: MermaidThumbnailProps): React__default.JSX.Element;
|
|
883
|
+
|
|
884
|
+
interface UseDiagramDirectorOptions {
|
|
885
|
+
/** Where nodes are drawn now, e.g. `() => diagram.layout` from `useMermaidDiagram`. */
|
|
886
|
+
placement: () => DiagramPlacement;
|
|
887
|
+
/** 1 = natural speed; 2 = twice as fast. */
|
|
888
|
+
speed?: number;
|
|
889
|
+
clock?: PresenceClock;
|
|
890
|
+
/** Hide a cursor this long after its last call (ms, default 1500). */
|
|
891
|
+
linger?: number;
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* A `PresenceStore` and `DiagramDirector` for a diagram, created once: pass `director` to
|
|
895
|
+
* `createDiagramToolProvider` so agent edits are acted out by a cursor, and `presence` to
|
|
896
|
+
* `<DiagramPresenceLayer>` to draw it.
|
|
897
|
+
*/
|
|
898
|
+
declare function useDiagramDirector(controller: DiagramController, options: UseDiagramDirectorOptions): {
|
|
899
|
+
presence: PresenceStore;
|
|
900
|
+
director: DiagramDirector;
|
|
901
|
+
};
|
|
902
|
+
/** The presence store's state (re-renders on every cursor move). */
|
|
903
|
+
declare function usePresenceState(presence: PresenceStore): PresenceState;
|
|
904
|
+
|
|
905
|
+
interface DiagramPresenceLayerProps {
|
|
906
|
+
presence: PresenceStore;
|
|
907
|
+
/** The canvas viewport (React Flow's `useViewport()`), to place cursors given in canvas coordinates. */
|
|
908
|
+
viewport: {
|
|
909
|
+
x: number;
|
|
910
|
+
y: number;
|
|
911
|
+
zoom: number;
|
|
912
|
+
};
|
|
913
|
+
className?: string;
|
|
914
|
+
}
|
|
915
|
+
/** Agent cursors and their notes over a canvas, from a `PresenceStore` (see `DiagramDirector`). */
|
|
916
|
+
declare function DiagramPresenceLayer({ presence, viewport, className }: DiagramPresenceLayerProps): React__default.JSX.Element | null;
|
|
917
|
+
|
|
918
|
+
export { AgentPresenceLayer, type AgentPresenceLayerProps, AnimationTimeline, type AnimationTimelineProps, type CanvasAnimation, type CanvasArrange, type CanvasAutoLayout, type CanvasComponents, CanvasComponentsPanel, type CanvasComponentsPanelActions, type CanvasComponentsPanelProps, type CanvasDraw, type CanvasDrawActions, CanvasDrawLayer, type CanvasDrawLayerProps, type CanvasDrawState, type CanvasGraphTarget, CanvasGuidesLayer, type CanvasGuidesLayerProps, CanvasInstanceInspector, type CanvasInstanceInspectorActions, type CanvasInstanceInspectorProps, type CanvasMeasure, type CanvasScenes, type CanvasTokens, DiagramPresenceLayer, type DiagramPresenceLayerProps, MermaidDiagramGroup, MermaidDiagramNode, type MermaidDiagramNodeData, type MermaidDiagramNodeProps, MermaidThumbnail, type MermaidThumbnailProps, ShapeNode, type ShapeNodeProps, TokenBindingPicker, type TokenBindingPickerProps, TokenModeSwitcher, type TokenModeSwitcherProps, type UseCanvasAnimationOptions, type UseCanvasArrangeOptions, type UseCanvasArrangeShortcutsOptions, type UseCanvasAutoLayoutOptions, type UseCanvasClipboardOptions, type UseCanvasComponentsOptions, type UseCanvasDockingOptions, type UseCanvasDrawOptions, type UseCanvasGraphOptions, type UseCanvasLayoutOptions, type UseCanvasMeasureOptions, type UseCanvasScenesOptions, type UseCanvasShortcutsOptions, type UseCanvasTokensOptions, type UseDiagramDirectorOptions, type UseMermaidDiagramOptions, type UseMermaidDiagramResult, type UseMermaidStreamOptions, type UseMermaidStreamResult, type UseStreamingCanvasOptions, mermaidNodeStyle, useCanvasAnimation, useCanvasArrange, useCanvasArrangeShortcuts, useCanvasAutoLayout, useCanvasClipboard, useCanvasComponents, useCanvasDocking, useCanvasDraw, useCanvasExplosion, useCanvasGraph, useCanvasLayout, useCanvasMeasure, useCanvasScenes, useCanvasShortcuts, useCanvasTokens, useDiagramDirector, useDiagramState, useMermaidDiagram, useMermaidStream, usePresenceState, useStreamingCanvas };
|