@pixerate/editor 0.49.0 → 0.51.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/canvas/index.cjs +151 -25
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +109 -3
- package/dist/canvas/index.d.ts +109 -3
- package/dist/canvas/index.js +127 -1
- package/dist/canvas/index.js.map +1 -1
- package/dist/chart/index.cjs +197 -52
- package/dist/chart/index.cjs.map +1 -1
- package/dist/chart/index.d.cts +88 -3
- package/dist/chart/index.d.ts +88 -3
- package/dist/chart/index.js +151 -6
- package/dist/chart/index.js.map +1 -1
- package/dist/{chunk-3LHWTGHW.js → chunk-TO22LX34.js} +11 -1
- package/dist/chunk-TO22LX34.js.map +1 -0
- package/dist/{chunk-VNYRI265.cjs → chunk-YNSK4MGT.cjs} +12 -2
- package/dist/chunk-YNSK4MGT.cjs.map +1 -0
- package/dist/{controller-DtbEo3om.d.ts → controller-BdKzaxs2.d.ts} +1 -1
- package/dist/{controller-ChjCCMLl.d.cts → controller-DS3drIvy.d.cts} +1 -1
- package/dist/extensions/index.d.cts +2 -2
- package/dist/extensions/index.d.ts +2 -2
- package/dist/image-editor/index.cjs +141 -1
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +42 -1
- package/dist/image-editor/index.d.ts +42 -1
- package/dist/image-editor/index.js +140 -0
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{index-DoHqT1mq.d.cts → index-DOy9HzfC.d.cts} +1 -1
- package/dist/{index-YLZ0fKqE.d.ts → index-Dt9lzydb.d.ts} +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/{pathfinder-D98S2lV5.d.ts → pathfinder-B9xh_pCZ.d.ts} +2 -1
- package/dist/{pathfinder-DKRcXiLS.d.cts → pathfinder-QdG70sr9.d.cts} +2 -1
- package/dist/vector/index.cjs +153 -153
- package/dist/vector/index.d.cts +1 -1
- package/dist/vector/index.d.ts +1 -1
- package/dist/vector/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3LHWTGHW.js.map +0 -1
- package/dist/chunk-VNYRI265.cjs.map +0 -1
package/dist/canvas/index.d.cts
CHANGED
|
@@ -5,8 +5,8 @@ export { ANIMATION_TIME_EPSILON, AnimationKeyframe, AnimationPlayerOptions, Manu
|
|
|
5
5
|
import { b as CanvasNodeUpdate, N as NodeRectOptions, A as AlignEdge, c as AlignNodesOptions, D as DistributeAxis, a as DistributeMode, d as DistributeNodesOptions, S as SizeDimension, M as MatchSizeOptions, Z as ZOrderOperation, C as CanvasArrangeAction } from '../arrange-B6GH5Qcc.cjs';
|
|
6
6
|
export { e as ArrangeShortcutBinding, f as DEFAULT_ARRANGE_SHORTCUTS, L as LOCKED_DATA_KEY, g as LOCKED_PREVIOUS_FLAGS_KEY, h as alignNodes, i as applyNodeUpdates, j as createNodeLookup, k as distributeNodes, l as getAbsolutePosition, m as getNodeRect, n as getNodeSize, o as invertNodeUpdates, p as isLocked, q as lockNodes, r as matchArrangeShortcut, s as matchSize, t as readStyleSize, u as reorderNodes, v as toggleLockNodes, w as unlockNodes, x as withStyleSize } from '../arrange-B6GH5Qcc.cjs';
|
|
7
7
|
import { C as Command, M as MergedExecutionOptions } from '../types-DsiXGmjo.cjs';
|
|
8
|
-
import { b as StrokeJoin, c as StrokeCap, g as ShapeDescription, a as BezierPath, h as PolygonFillRule, i as PolygonRing, j as ShapeSize, B as BezierPathInput, C as CanvasGradientDef } from '../pathfinder-
|
|
9
|
-
export { A as AffineMatrix, k as BezierCommand, l as BezierContour, m as BezierPathToSvgOptions, d as BezierSegment, n as CANVAS_GRADIENT_PRESETS, o as CanvasLinearGradient, p as CanvasRadialGradient, D as DashedPath, q as DividePathsResult, E as EllipseShape, F as FlattenOptions, G as GetShapeRenderDataOptions, r as GradientStop, M as MultiPolygon, O as OffsetPathOptions, s as OutlineStrokeOptions, t as PATHFINDER_OPERATIONS, u as
|
|
8
|
+
import { b as StrokeJoin, c as StrokeCap, g as ShapeDescription, a as BezierPath, h as PolygonFillRule, i as PolygonRing, j as ShapeSize, B as BezierPathInput, C as CanvasGradientDef } from '../pathfinder-QdG70sr9.cjs';
|
|
9
|
+
export { A as AffineMatrix, k as BezierCommand, l as BezierContour, m as BezierPathToSvgOptions, d as BezierSegment, n as CANVAS_GRADIENT_PRESETS, o as CanvasLinearGradient, p as CanvasRadialGradient, D as DashedPath, q as DividePathsResult, E as EllipseShape, F as FlattenOptions, G as GetShapeRenderDataOptions, r as GradientStop, M as MultiPolygon, O as OffsetPathOptions, s as OutlineStrokeOptions, t as PATHFINDER_OPERATIONS, u as PIXERATE_BRAND_GRADIENT, v as PathBooleanOperation, w as PathBooleanResult, x as PathCommand, y as PathOperand, z as PathOperandInput, H as PathOpsError, I as PathOpsOptions, J as PathOpsReport, K as PathPiece, L as PathPointAtLength, N as PathSelectResult, Q as PathShape, e as PathfinderOperation, R as PathfinderPiece, T as PathfinderResult, f as PathfinderShape, U as PlanarChain, V as PlanarFace, W as PlanarInput, P as PlanarMap, X as PlanarMapOptions, Y as PlanarSplitEdge, Z as PlanarSplitResult, _ as PolygonBooleanOperation, $ as PolygonBooleanOptions, a0 as PolygonInput, a1 as PolygonOperand, a2 as PolygonPiece, a3 as PolygonToPathOptions, a4 as PolygonWithHoles, a5 as RectShape, a6 as RegularPolygonShape, a7 as SHAPE_KINDS, a8 as SegmentIntersection, a9 as ShapeKind, aa as ShapePaint, ab as ShapeRenderData, ac as StarShape, S as SvgGradientDef, ad as SvgGradientStop, ae as angleToSvgLinearCoords, af as arcToCubics, ag as bezierPathArea, ah as bezierPathBounds, ai as bezierPathLength, aj as bezierPathPointAtLength, ak as bezierPathSignedArea, al as bezierPathToSvg, am as closeContour, an as contourEnclosesArea, ao as contourSignedArea, ap as contoursToPath, aq as countPathSegments, ar as cutOutPiece, as as dashContours, at as distanceToBezierPath, au as dividePaths, av as dividePolygons, aw as excludePaths, ax as flattenSvgPath, ay as formatNumber, az as getShapeRenderData, aA as getShapeSvg, aB as gradientToSvgDef, aC as interiorPoint, aD as intersectPaths, aE as intersectPolygons, aF as isCanvasGradient, aG as isShapeDescription, aH as multiPolygonArea, aI as multiPolygonBounds, aJ as normalizeBezierPath, aK as offsetPath, aL as outlineStroke, aM as parseCssGradient, aN as parseSvgPath, aO as pathBoolean, aP as pathBooleanSelect, aQ as pathToContours, aR as pathfinder, aS as planarSplit, aT as pointInBezierPath, aU as pointInMultiPolygon, aV as pointInRings, aW as polygonArea, aX as polygonBoolean, aY as polygonToSvgPath, aZ as resolveCanvasGradient, a_ as ringSignedArea, a$ as segmentBounds, b0 as segmentCurvature, b1 as segmentDerivative, b2 as segmentExtrema, b3 as segmentIntersections, b4 as segmentLength, b5 as segmentNearest, b6 as segmentParamAtLength, b7 as segmentPoint, b8 as segmentTangent, b9 as shapeToPolygon, ba as simplifyRing, bb as splitSegment, bc as strokeOutlineRings, bd as subSegment, be as subtractPaths, bf as subtractPolygons, bg as toBezierPath, bh as transformBezierPath, bi as trimSegments, bj as unionPolygons, bk as unitePaths, bl as windingNumber, bm as xorPolygons } from '../pathfinder-QdG70sr9.cjs';
|
|
10
10
|
import { d as TokenModeContext, r as TokenType, o as TokenScope, f as TokenLiteral, c as TokenVariable, e as TokenResolution, T as TokenState } from '../model-C1zApQM8.cjs';
|
|
11
11
|
import { A as AnimationEasing } from '../easing-DTmX99QG.cjs';
|
|
12
12
|
export { a as ANIMATION_EASING_LABELS, b as ANIMATION_EASING_PRESETS, c as AnimationEasingPreset, C as CUBIC_BEZIER_PRESETS, d as CubicBezierEasing, E as ElasticEasing, S as SpringEasing, e as cubicBezierAt, f as easingFromInfluence, g as easingLabel, h as easingToCss, i as elasticAt, j as evaluateEasing, k as isAnimationEasing, p as parseCssEasing, r as resolveEasing, s as springAt } from '../easing-DTmX99QG.cjs';
|
|
@@ -2810,4 +2810,110 @@ declare function createCanvasDrawController<TNode extends CanvasNode = CanvasNod
|
|
|
2810
2810
|
};
|
|
2811
2811
|
type CanvasDrawController = ReturnType<typeof createCanvasDrawController>;
|
|
2812
2812
|
|
|
2813
|
-
|
|
2813
|
+
/**
|
|
2814
|
+
* UI-agnostic agent presence trajectory, inspection anchor, and cursor rotation math.
|
|
2815
|
+
*/
|
|
2816
|
+
declare const DEFAULT_CURSOR_INACTIVITY_MS = 12000;
|
|
2817
|
+
interface CanvasAgentCursor {
|
|
2818
|
+
id: string;
|
|
2819
|
+
userId?: string;
|
|
2820
|
+
x: number;
|
|
2821
|
+
y: number;
|
|
2822
|
+
username?: string;
|
|
2823
|
+
avatarUrl?: string;
|
|
2824
|
+
color?: string;
|
|
2825
|
+
isAgent?: boolean;
|
|
2826
|
+
isServiceAccount?: boolean;
|
|
2827
|
+
role?: string;
|
|
2828
|
+
statusText?: string;
|
|
2829
|
+
message?: string;
|
|
2830
|
+
note?: string;
|
|
2831
|
+
lastUpdate?: number;
|
|
2832
|
+
timeoutMs?: number;
|
|
2833
|
+
transitionDurationMs?: number;
|
|
2834
|
+
customEase?: string;
|
|
2835
|
+
targetNodeId?: string;
|
|
2836
|
+
targetNodeCenter?: {
|
|
2837
|
+
x: number;
|
|
2838
|
+
y: number;
|
|
2839
|
+
} | null;
|
|
2840
|
+
isModalOpen?: boolean;
|
|
2841
|
+
isClicking?: boolean;
|
|
2842
|
+
}
|
|
2843
|
+
/**
|
|
2844
|
+
* Deterministic string hash function used to derive consistent per-agent / per-node variances.
|
|
2845
|
+
*/
|
|
2846
|
+
declare function hashString(str: string): number;
|
|
2847
|
+
type CardInspectionZone = 'header' | 'action' | 'body' | 'footer';
|
|
2848
|
+
declare const CARD_INSPECTION_ZONES: Record<CardInspectionZone, {
|
|
2849
|
+
x: number;
|
|
2850
|
+
y: number;
|
|
2851
|
+
}>;
|
|
2852
|
+
/**
|
|
2853
|
+
* Computes a varied inspection anchor position on a node/card (default width ~250px, height ~160px).
|
|
2854
|
+
* Generates distinct natural resting spots so agents do not appear at the exact same coordinates.
|
|
2855
|
+
*/
|
|
2856
|
+
declare function getAgentCardAnchor(agentId?: string, nodeId?: string, zone?: CardInspectionZone | number, options?: {
|
|
2857
|
+
randomJitter?: boolean;
|
|
2858
|
+
width?: number;
|
|
2859
|
+
height?: number;
|
|
2860
|
+
}): {
|
|
2861
|
+
x: number;
|
|
2862
|
+
y: number;
|
|
2863
|
+
zoneName: CardInspectionZone;
|
|
2864
|
+
};
|
|
2865
|
+
interface CurvedPathOptions {
|
|
2866
|
+
arcHeight?: number;
|
|
2867
|
+
wobble?: number;
|
|
2868
|
+
}
|
|
2869
|
+
/**
|
|
2870
|
+
* Calculates coordinates along a natural curved trajectory with parabolic lift
|
|
2871
|
+
* and optional lateral sway, replacing robotic straight linear movement.
|
|
2872
|
+
*/
|
|
2873
|
+
declare function calculateCurvedPath(fromX: number, fromY: number, toX: number, toY: number, progress: number, options?: CurvedPathOptions): {
|
|
2874
|
+
x: number;
|
|
2875
|
+
y: number;
|
|
2876
|
+
};
|
|
2877
|
+
/**
|
|
2878
|
+
* Computes natural drag movement timing, parabolic arc amplitude, and grip offset
|
|
2879
|
+
* based on distance traveled and a deterministic seed.
|
|
2880
|
+
*/
|
|
2881
|
+
declare function getNaturalMovementTiming(distance: number, seedStr?: string): {
|
|
2882
|
+
duration: number;
|
|
2883
|
+
arcHeight: number;
|
|
2884
|
+
grabOffset: {
|
|
2885
|
+
x: number;
|
|
2886
|
+
y: number;
|
|
2887
|
+
};
|
|
2888
|
+
};
|
|
2889
|
+
/**
|
|
2890
|
+
* Computes variable CSS transition duration in ms based on distance and seed.
|
|
2891
|
+
*/
|
|
2892
|
+
declare function getCursorTransitionDuration(distance: number, seedStr?: string, options?: {
|
|
2893
|
+
naturalVariance?: boolean;
|
|
2894
|
+
}): number;
|
|
2895
|
+
/**
|
|
2896
|
+
* Calculates the SVG rotation angle for aligning a presence cursor arrow
|
|
2897
|
+
* toward the center of a target node.
|
|
2898
|
+
*/
|
|
2899
|
+
declare function calculateCursorArrowRotation(cursor: {
|
|
2900
|
+
x: number;
|
|
2901
|
+
y: number;
|
|
2902
|
+
isModalOpen?: boolean;
|
|
2903
|
+
}, targetCenter?: {
|
|
2904
|
+
x: number;
|
|
2905
|
+
y: number;
|
|
2906
|
+
} | null, isAgentOrServiceAccount?: boolean, isModalOpen?: boolean, currentRotation?: number): {
|
|
2907
|
+
shouldPoint: boolean;
|
|
2908
|
+
rotationDeg: number;
|
|
2909
|
+
};
|
|
2910
|
+
/**
|
|
2911
|
+
* Sanitizes an agent name by removing any leading '@' prefix(es) and trimming whitespace.
|
|
2912
|
+
*/
|
|
2913
|
+
declare function formatAgentCursorName(nameOrUsername?: string | null): string;
|
|
2914
|
+
/**
|
|
2915
|
+
* Determines whether a given presence cursor represents an autonomous agent.
|
|
2916
|
+
*/
|
|
2917
|
+
declare function isAgentCursor(cursor: Partial<CanvasAgentCursor>): boolean;
|
|
2918
|
+
|
|
2919
|
+
export { ANIMATABLE_PROPERTIES, ANIMATION_DATA_KEY, AUTO_LAYOUT_DATA_KEY, type AddCanvasVariantOptions, AlignEdge, AlignNodesOptions, type AnimatableProperty, type AnimateNodeOptions, type AnimationDocument, AnimationEasing, AnimationEditError, type AnimationEditErrorCode, type AnimationFrame, type AnimationHistoryTarget, type AnimationKeyframeClipboard, AnimationLoopMode, type AnimationMotionPath, type AnimationOverrides, AnimationPlayer, AnimationPlayerState, type AnimationPropertyOptions, type AnimationStop, AnimationTrack, AnimationValue, AnimationValueType, type ArrangeHistoryTarget, type AutoLayout, type AutoLayoutAlignContent, type AutoLayoutAlignCross, type AutoLayoutAlignMain, type AutoLayoutCellAlign, type AutoLayoutChild, type AutoLayoutConstraints, type AutoLayoutGrid, type AutoLayoutGridArea, type AutoLayoutGridCell, type AutoLayoutGridGeometry, type AutoLayoutGridTrack, type AutoLayoutHorizontalConstraint, type AutoLayoutInsertTarget, type AutoLayoutMeasure, type AutoLayoutMode, type AutoLayoutOptions, type AutoLayoutPadding, type AutoLayoutSize, type AutoLayoutSizing, type AutoLayoutSizingPair, type AutoLayoutVerticalConstraint, BezierPath, BezierPathInput, CANVAS_COMPONENT_DRAG_TYPE, CANVAS_TOKEN_PROPERTIES, CARD_INSPECTION_ZONES, CHILD_LAYOUT_DATA_KEY, COMPONENT_DATA_KEY, COMPONENT_OVERRIDES_DATA_KEY, COMPONENT_PROPERTY_REFS_DATA_KEY, COMPONENT_SET_DATA_KEY, COMPONENT_SOURCE_DATA_KEY, CONNECTION_LINE_TYPES, CSS_ANIMATION_PROPERTIES, type CanvasAgentCursor, type CanvasAnimationController, type CanvasAnimationControllerOptions, type CanvasAnimationState, CanvasArrangeAction, type CanvasArrangeController, type CanvasArrangeControllerOptions, type CanvasAutoLayoutController, type CanvasAutoLayoutControllerOptions, CanvasClipboardPayload, type CanvasComponentData, type CanvasComponentErrorCode, type CanvasComponentInfo, type CanvasComponentPropertyDef, type CanvasComponentPropertyField, type CanvasComponentPropertyType, type CanvasComponentPropertyValue, type CanvasComponentResult, type CanvasComponentSetData, type CanvasComponentSetInfo, type CanvasComponentSyncOptions, type CanvasComponentsController, type CanvasComponentsControllerOptions, type CanvasConnectionLineType, type CanvasDrawController, type CanvasDrawControllerOptions, CanvasEdge, CanvasGradientDef, type CanvasHeightOptions, type CanvasInstanceData, type CanvasInstanceInfo, type CanvasInstancePropertyInfo, CanvasLayoutOptions, CanvasNode, CanvasNodeStyle, CanvasNodeUpdate, type CanvasScene, type CanvasScenesOptions, type CanvasScenesState, CanvasScenesStore, type CanvasTokenBindingInfo, type CanvasTokenOptions, type CanvasTokenProperty, type CanvasViewport, type CardInspectionZone, Clock, type CombineShapeNodesOptions, type CombineShapeNodesRefusal, type CombineShapeNodesResult, type ConnectorSnap, type ConnectorSnapOptions, type ConnectorSnapTarget, type CreateCanvasComponentOptions, type CreateCanvasInstanceOptions, type CssAnimationExport, type CssExportOptions, type CssPropertyAnimation, type CubicSegment, type CurvedPathOptions, DEFAULT_CURSOR_INACTIVITY_MS, DEFAULT_NODE_HEIGHT, DEFAULT_NODE_WIDTH, DEFAULT_PLACEMENT_GAP, DirectionalDisplacementOptions, DistributeAxis, DistributeMode, DistributeNodesOptions, type EvaluateAnimationOptions, FanOutTrajectoryOptions, type FitCubicsOptions, type FitPathDataOptions, type FitViewportOptions, type FreehandDrawOptions, type FreehandStroke, type FreehandStrokeStyle, type FreehandTool, type GuideIndex, type GuideLine, type HatchOptions, INSTANCE_DATA_KEY, IncrementalLayoutOptions, type KeyframeDragState, type KeyframePatch, type KeyframeRangeOptions, type KeyframeRef, type KeyframeSnap, MAX_KEYFRAME_REFS, MatchSizeOptions, type MeasureGuide, type MeasureSelectionOptions, type MeasureSelectionResult, type MoveKeyframesResult, type MultiNodeTransitionOptions, type NodeAnimation, NodeRectOptions, NodeTransition, type OffsetShapeNodesOptions, type OutlineShapeStrokesOptions, PlaceBesideOptions, Point, PolygonFillRule, PolygonRing, Position, type PositionChangeLike, RESIZE_HANDLES, type RecordAnimationOptions, Rect, ReflowDisplacementOptions, type ResizeHandle, SHAPE_DATA_KEY, SHAPE_NODE_TYPE, SHAPE_OPERATIONS, type SampleAnimationOptions, type ScaleKeyframesOptions, type SerializedCanvasScenes, type SetCanvasVariantPropertiesOptions, type SetKeyframeOptions, ShapeDescription, type ShapeNodePolygonOptions, type ShapeOperation, type ShapePathEditOperation, type ShapePathEditRefusal, type ShapePathEditResult, ShapeSize, Side, SizeDimension, type SnapGuidesOptions, type SnapNodeDragOptions, type SnapNodeDragResult, type SnapNodeResizeOptions, type SnapNodeResizeResult, type SnapResizeOptions, type SnapResizeResult, type SnapResult, StreamingLayoutManager, type StreamingLayoutManagerOptions, StrokeCap, StrokeJoin, type StrokeToShapeNodeOptions, TOKEN_BINDINGS_DATA_KEY, TOKEN_MODES_DATA_KEY, type TimelineKeyframe, type TimelineRow, type TimelineRowsOptions, TrajectoryFunction, type WebAnimationSpec, XYPosition, ZOrderOperation, addCanvasVariant, addKeyframesAtTime, animateNode, applyAnimation, applyAnimationOverrides, applyConstraints, applyShapeCombination, applyShapeReplacement, bindCanvasComponentProperty, bindCanvasToken, blendLayout, boundsOf, calculateCursorArrowRotation, calculateCurvedPath, calculateDagreReflowDisplacement, calculateDirectionalDisplacement, canCombineShapeNodes, canOffsetShapeNodes, canOutlineShapeNodeStrokes, canvasHeight, centerNodes, centre, clampAnimationValue, clampLayoutSize, collectDescendantIds, combineCanvasComponentsAsVariants, combineShapeNodes, computeNodesBoundingBox, computeSnapGuides, connectedOnly, copyKeyframes, createBezierTrajectory, createCanvasAnimationController, createCanvasArrangeController, createCanvasAutoLayoutController, createCanvasComponent, createCanvasComponentsController, createCanvasDrawController, createCanvasInstance, createCanvasScenesStore, createDefaultStrokeStyle, createFanOutTrajectory, createGuideIndex, createNodeGuideIndex, cubicPointAt, cubicsToPathData, defaultEasing, deleteKeyframes, detachCanvasInstance, detachTokenBindings, diffOverrideGroups, ensureLayout, estimateCanvasHeight, estimateNodeSize, evaluateAnimation, exportCssAnimation, findConnectorSnap, findStrokesAtPoint, findVariant, fitCubicRun, fitCubicWithTangents, fitCubics, fitFreehandPath, fitPathData, fitViewportToNodes, fitViewportToRect, flowSide, formatAgentCursorName, formatAnimationTime, formatVariantName, getAgentCardAnchor, getAnimatableProperty, getAnimatedProperties, getAnimatedValue, getAnimationDuration, getAnimationTrack, getAutoLayout, getAutoLayoutGrid, getAutoLayoutInsertTarget, getBindableTokenProperties, getCanvasComponentDragId, getCanvasTokenProperty, getCenteredNodePosition, getChildLayout, getComponentData, getComponentInstances, getComponentPropertyDefs, getComponentPropertyRefs, getComponentSourceId, getCssPropertyAnimations, getCursorTransitionDuration, getDefaultVariant, getEffectiveTokenModes, getFlowChildren, getInstanceData, getInstanceProperties, getInstanceStatus, getKeyframeTimes, getLayerName, getLayoutParent, getLayoutSizing, getLayoutedNodes, getNaturalMovementTiming, getNextVariantValues, getNodeAnimation, getNodeOverrides, getNodeShape, getNodeTokenBindings, getNodeTokenModes, getOwningComponent, getOwningInstance, getResizingNodeRect, getRootInstance, getTimelineRows, getTimelineTicks, getTokenPropertyScope, getTokensForProperty, getVariantConflicts, getVariantOptions, getVariantSet, getVariantValues, handlePoint, hasVisibleStroke, hashString, hatchPath, inferResizeHandle, inspectCanvasInstance, inspectNodeTokens, isAgentCursor, isAutoLayoutFrame, isCanvasComponent, isCanvasComponentSet, isCanvasInstance, isCssExportExact, isEventFromTextInput, isInsideInstance, isKeyframeSelected, isMeasureModifierHeld, isNodeAnimated, isShapeNode, isStraightCubic, isValidCanvasEdge, isValidCanvasNode, isValidCanvasScene, isValidUrl, layoutAll, layoutBounds, layoutFrame, layoutUp, layoutUpMany, linearPositionTrajectory, linearTrajectory, listCanvasComponents, makeSizingCoherent, measureBetween, measureLabel, measureSelection, measureToLine, mergeNodeUpdates, moveKeyframes, moveLayoutChild, nearestHandlePositions, offsetShapeNodes, oppositePosition, outlineShapeNodeStrokes, overlaps, parseCanvasClipboardData, parseCanvasScenes, parseKeyframeClipboard, parseNodeStyleDeclarations, parseVariantName, pasteKeyframes, placeBeside, playWebAnimations, positionToSide, pruneCanvasTokenModes, pushCanvasInstanceOverrides, readAnimatableValue, readNodeStyleProperty, readOverrideGroup, recordAnimationChanges, relayoutUpdates, remapPastedNodes, removeCanvasVariant, removeTrack, renameCanvasVariantProperty, renameCanvasVariantValue, repositionNodesTo, resetCanvasInstanceOverrides, resizeHandleAxes, resolveCanvasTokens, resolvePadding, restoreCanvasMainComponent, revertShapeCombination, runMultiNodeTransition, sampleAnimationFrames, scaleKeyframes, serializeCanvasNodes, setCanvasComponentProperty, setCanvasInstanceProperties, setCanvasTokenMode, setCanvasVariantProperties, setKeyframe, setKeyframeEasing, setMotionPath, setTrackEnabled, shapeNodeToBezierPath, shapeNodeToPolygon, shapeToBezierPath, sideToPosition, snapKeyframeDelta, snapNodeDrag, snapNodeResize, snapResize, snapTimeToFrame, snapToGrid, streamlinePoints, strokeBoundingBox, strokePointsToPathData, strokeToShapeNode, swapCanvasInstance, syncAllCanvasInstances, syncCanvasComponents, syncCanvasInstance, timeToX, toWebAnimations, updateKeyframe, withNodeAnimation, withStyleOpacity, wouldCreateComponentCycle, writeNodeStyleProperty, writeOverrideGroup, xToTime };
|
package/dist/canvas/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export { ANIMATION_TIME_EPSILON, AnimationKeyframe, AnimationPlayerOptions, Manu
|
|
|
5
5
|
import { b as CanvasNodeUpdate, N as NodeRectOptions, A as AlignEdge, c as AlignNodesOptions, D as DistributeAxis, a as DistributeMode, d as DistributeNodesOptions, S as SizeDimension, M as MatchSizeOptions, Z as ZOrderOperation, C as CanvasArrangeAction } from '../arrange-BPAXGdMm.js';
|
|
6
6
|
export { e as ArrangeShortcutBinding, f as DEFAULT_ARRANGE_SHORTCUTS, L as LOCKED_DATA_KEY, g as LOCKED_PREVIOUS_FLAGS_KEY, h as alignNodes, i as applyNodeUpdates, j as createNodeLookup, k as distributeNodes, l as getAbsolutePosition, m as getNodeRect, n as getNodeSize, o as invertNodeUpdates, p as isLocked, q as lockNodes, r as matchArrangeShortcut, s as matchSize, t as readStyleSize, u as reorderNodes, v as toggleLockNodes, w as unlockNodes, x as withStyleSize } from '../arrange-BPAXGdMm.js';
|
|
7
7
|
import { C as Command, M as MergedExecutionOptions } from '../types-DsiXGmjo.js';
|
|
8
|
-
import { b as StrokeJoin, c as StrokeCap, g as ShapeDescription, a as BezierPath, h as PolygonFillRule, i as PolygonRing, j as ShapeSize, B as BezierPathInput, C as CanvasGradientDef } from '../pathfinder-
|
|
9
|
-
export { A as AffineMatrix, k as BezierCommand, l as BezierContour, m as BezierPathToSvgOptions, d as BezierSegment, n as CANVAS_GRADIENT_PRESETS, o as CanvasLinearGradient, p as CanvasRadialGradient, D as DashedPath, q as DividePathsResult, E as EllipseShape, F as FlattenOptions, G as GetShapeRenderDataOptions, r as GradientStop, M as MultiPolygon, O as OffsetPathOptions, s as OutlineStrokeOptions, t as PATHFINDER_OPERATIONS, u as
|
|
8
|
+
import { b as StrokeJoin, c as StrokeCap, g as ShapeDescription, a as BezierPath, h as PolygonFillRule, i as PolygonRing, j as ShapeSize, B as BezierPathInput, C as CanvasGradientDef } from '../pathfinder-B9xh_pCZ.js';
|
|
9
|
+
export { A as AffineMatrix, k as BezierCommand, l as BezierContour, m as BezierPathToSvgOptions, d as BezierSegment, n as CANVAS_GRADIENT_PRESETS, o as CanvasLinearGradient, p as CanvasRadialGradient, D as DashedPath, q as DividePathsResult, E as EllipseShape, F as FlattenOptions, G as GetShapeRenderDataOptions, r as GradientStop, M as MultiPolygon, O as OffsetPathOptions, s as OutlineStrokeOptions, t as PATHFINDER_OPERATIONS, u as PIXERATE_BRAND_GRADIENT, v as PathBooleanOperation, w as PathBooleanResult, x as PathCommand, y as PathOperand, z as PathOperandInput, H as PathOpsError, I as PathOpsOptions, J as PathOpsReport, K as PathPiece, L as PathPointAtLength, N as PathSelectResult, Q as PathShape, e as PathfinderOperation, R as PathfinderPiece, T as PathfinderResult, f as PathfinderShape, U as PlanarChain, V as PlanarFace, W as PlanarInput, P as PlanarMap, X as PlanarMapOptions, Y as PlanarSplitEdge, Z as PlanarSplitResult, _ as PolygonBooleanOperation, $ as PolygonBooleanOptions, a0 as PolygonInput, a1 as PolygonOperand, a2 as PolygonPiece, a3 as PolygonToPathOptions, a4 as PolygonWithHoles, a5 as RectShape, a6 as RegularPolygonShape, a7 as SHAPE_KINDS, a8 as SegmentIntersection, a9 as ShapeKind, aa as ShapePaint, ab as ShapeRenderData, ac as StarShape, S as SvgGradientDef, ad as SvgGradientStop, ae as angleToSvgLinearCoords, af as arcToCubics, ag as bezierPathArea, ah as bezierPathBounds, ai as bezierPathLength, aj as bezierPathPointAtLength, ak as bezierPathSignedArea, al as bezierPathToSvg, am as closeContour, an as contourEnclosesArea, ao as contourSignedArea, ap as contoursToPath, aq as countPathSegments, ar as cutOutPiece, as as dashContours, at as distanceToBezierPath, au as dividePaths, av as dividePolygons, aw as excludePaths, ax as flattenSvgPath, ay as formatNumber, az as getShapeRenderData, aA as getShapeSvg, aB as gradientToSvgDef, aC as interiorPoint, aD as intersectPaths, aE as intersectPolygons, aF as isCanvasGradient, aG as isShapeDescription, aH as multiPolygonArea, aI as multiPolygonBounds, aJ as normalizeBezierPath, aK as offsetPath, aL as outlineStroke, aM as parseCssGradient, aN as parseSvgPath, aO as pathBoolean, aP as pathBooleanSelect, aQ as pathToContours, aR as pathfinder, aS as planarSplit, aT as pointInBezierPath, aU as pointInMultiPolygon, aV as pointInRings, aW as polygonArea, aX as polygonBoolean, aY as polygonToSvgPath, aZ as resolveCanvasGradient, a_ as ringSignedArea, a$ as segmentBounds, b0 as segmentCurvature, b1 as segmentDerivative, b2 as segmentExtrema, b3 as segmentIntersections, b4 as segmentLength, b5 as segmentNearest, b6 as segmentParamAtLength, b7 as segmentPoint, b8 as segmentTangent, b9 as shapeToPolygon, ba as simplifyRing, bb as splitSegment, bc as strokeOutlineRings, bd as subSegment, be as subtractPaths, bf as subtractPolygons, bg as toBezierPath, bh as transformBezierPath, bi as trimSegments, bj as unionPolygons, bk as unitePaths, bl as windingNumber, bm as xorPolygons } from '../pathfinder-B9xh_pCZ.js';
|
|
10
10
|
import { d as TokenModeContext, r as TokenType, o as TokenScope, f as TokenLiteral, c as TokenVariable, e as TokenResolution, T as TokenState } from '../model-C1zApQM8.js';
|
|
11
11
|
import { A as AnimationEasing } from '../easing-DTmX99QG.js';
|
|
12
12
|
export { a as ANIMATION_EASING_LABELS, b as ANIMATION_EASING_PRESETS, c as AnimationEasingPreset, C as CUBIC_BEZIER_PRESETS, d as CubicBezierEasing, E as ElasticEasing, S as SpringEasing, e as cubicBezierAt, f as easingFromInfluence, g as easingLabel, h as easingToCss, i as elasticAt, j as evaluateEasing, k as isAnimationEasing, p as parseCssEasing, r as resolveEasing, s as springAt } from '../easing-DTmX99QG.js';
|
|
@@ -2810,4 +2810,110 @@ declare function createCanvasDrawController<TNode extends CanvasNode = CanvasNod
|
|
|
2810
2810
|
};
|
|
2811
2811
|
type CanvasDrawController = ReturnType<typeof createCanvasDrawController>;
|
|
2812
2812
|
|
|
2813
|
-
|
|
2813
|
+
/**
|
|
2814
|
+
* UI-agnostic agent presence trajectory, inspection anchor, and cursor rotation math.
|
|
2815
|
+
*/
|
|
2816
|
+
declare const DEFAULT_CURSOR_INACTIVITY_MS = 12000;
|
|
2817
|
+
interface CanvasAgentCursor {
|
|
2818
|
+
id: string;
|
|
2819
|
+
userId?: string;
|
|
2820
|
+
x: number;
|
|
2821
|
+
y: number;
|
|
2822
|
+
username?: string;
|
|
2823
|
+
avatarUrl?: string;
|
|
2824
|
+
color?: string;
|
|
2825
|
+
isAgent?: boolean;
|
|
2826
|
+
isServiceAccount?: boolean;
|
|
2827
|
+
role?: string;
|
|
2828
|
+
statusText?: string;
|
|
2829
|
+
message?: string;
|
|
2830
|
+
note?: string;
|
|
2831
|
+
lastUpdate?: number;
|
|
2832
|
+
timeoutMs?: number;
|
|
2833
|
+
transitionDurationMs?: number;
|
|
2834
|
+
customEase?: string;
|
|
2835
|
+
targetNodeId?: string;
|
|
2836
|
+
targetNodeCenter?: {
|
|
2837
|
+
x: number;
|
|
2838
|
+
y: number;
|
|
2839
|
+
} | null;
|
|
2840
|
+
isModalOpen?: boolean;
|
|
2841
|
+
isClicking?: boolean;
|
|
2842
|
+
}
|
|
2843
|
+
/**
|
|
2844
|
+
* Deterministic string hash function used to derive consistent per-agent / per-node variances.
|
|
2845
|
+
*/
|
|
2846
|
+
declare function hashString(str: string): number;
|
|
2847
|
+
type CardInspectionZone = 'header' | 'action' | 'body' | 'footer';
|
|
2848
|
+
declare const CARD_INSPECTION_ZONES: Record<CardInspectionZone, {
|
|
2849
|
+
x: number;
|
|
2850
|
+
y: number;
|
|
2851
|
+
}>;
|
|
2852
|
+
/**
|
|
2853
|
+
* Computes a varied inspection anchor position on a node/card (default width ~250px, height ~160px).
|
|
2854
|
+
* Generates distinct natural resting spots so agents do not appear at the exact same coordinates.
|
|
2855
|
+
*/
|
|
2856
|
+
declare function getAgentCardAnchor(agentId?: string, nodeId?: string, zone?: CardInspectionZone | number, options?: {
|
|
2857
|
+
randomJitter?: boolean;
|
|
2858
|
+
width?: number;
|
|
2859
|
+
height?: number;
|
|
2860
|
+
}): {
|
|
2861
|
+
x: number;
|
|
2862
|
+
y: number;
|
|
2863
|
+
zoneName: CardInspectionZone;
|
|
2864
|
+
};
|
|
2865
|
+
interface CurvedPathOptions {
|
|
2866
|
+
arcHeight?: number;
|
|
2867
|
+
wobble?: number;
|
|
2868
|
+
}
|
|
2869
|
+
/**
|
|
2870
|
+
* Calculates coordinates along a natural curved trajectory with parabolic lift
|
|
2871
|
+
* and optional lateral sway, replacing robotic straight linear movement.
|
|
2872
|
+
*/
|
|
2873
|
+
declare function calculateCurvedPath(fromX: number, fromY: number, toX: number, toY: number, progress: number, options?: CurvedPathOptions): {
|
|
2874
|
+
x: number;
|
|
2875
|
+
y: number;
|
|
2876
|
+
};
|
|
2877
|
+
/**
|
|
2878
|
+
* Computes natural drag movement timing, parabolic arc amplitude, and grip offset
|
|
2879
|
+
* based on distance traveled and a deterministic seed.
|
|
2880
|
+
*/
|
|
2881
|
+
declare function getNaturalMovementTiming(distance: number, seedStr?: string): {
|
|
2882
|
+
duration: number;
|
|
2883
|
+
arcHeight: number;
|
|
2884
|
+
grabOffset: {
|
|
2885
|
+
x: number;
|
|
2886
|
+
y: number;
|
|
2887
|
+
};
|
|
2888
|
+
};
|
|
2889
|
+
/**
|
|
2890
|
+
* Computes variable CSS transition duration in ms based on distance and seed.
|
|
2891
|
+
*/
|
|
2892
|
+
declare function getCursorTransitionDuration(distance: number, seedStr?: string, options?: {
|
|
2893
|
+
naturalVariance?: boolean;
|
|
2894
|
+
}): number;
|
|
2895
|
+
/**
|
|
2896
|
+
* Calculates the SVG rotation angle for aligning a presence cursor arrow
|
|
2897
|
+
* toward the center of a target node.
|
|
2898
|
+
*/
|
|
2899
|
+
declare function calculateCursorArrowRotation(cursor: {
|
|
2900
|
+
x: number;
|
|
2901
|
+
y: number;
|
|
2902
|
+
isModalOpen?: boolean;
|
|
2903
|
+
}, targetCenter?: {
|
|
2904
|
+
x: number;
|
|
2905
|
+
y: number;
|
|
2906
|
+
} | null, isAgentOrServiceAccount?: boolean, isModalOpen?: boolean, currentRotation?: number): {
|
|
2907
|
+
shouldPoint: boolean;
|
|
2908
|
+
rotationDeg: number;
|
|
2909
|
+
};
|
|
2910
|
+
/**
|
|
2911
|
+
* Sanitizes an agent name by removing any leading '@' prefix(es) and trimming whitespace.
|
|
2912
|
+
*/
|
|
2913
|
+
declare function formatAgentCursorName(nameOrUsername?: string | null): string;
|
|
2914
|
+
/**
|
|
2915
|
+
* Determines whether a given presence cursor represents an autonomous agent.
|
|
2916
|
+
*/
|
|
2917
|
+
declare function isAgentCursor(cursor: Partial<CanvasAgentCursor>): boolean;
|
|
2918
|
+
|
|
2919
|
+
export { ANIMATABLE_PROPERTIES, ANIMATION_DATA_KEY, AUTO_LAYOUT_DATA_KEY, type AddCanvasVariantOptions, AlignEdge, AlignNodesOptions, type AnimatableProperty, type AnimateNodeOptions, type AnimationDocument, AnimationEasing, AnimationEditError, type AnimationEditErrorCode, type AnimationFrame, type AnimationHistoryTarget, type AnimationKeyframeClipboard, AnimationLoopMode, type AnimationMotionPath, type AnimationOverrides, AnimationPlayer, AnimationPlayerState, type AnimationPropertyOptions, type AnimationStop, AnimationTrack, AnimationValue, AnimationValueType, type ArrangeHistoryTarget, type AutoLayout, type AutoLayoutAlignContent, type AutoLayoutAlignCross, type AutoLayoutAlignMain, type AutoLayoutCellAlign, type AutoLayoutChild, type AutoLayoutConstraints, type AutoLayoutGrid, type AutoLayoutGridArea, type AutoLayoutGridCell, type AutoLayoutGridGeometry, type AutoLayoutGridTrack, type AutoLayoutHorizontalConstraint, type AutoLayoutInsertTarget, type AutoLayoutMeasure, type AutoLayoutMode, type AutoLayoutOptions, type AutoLayoutPadding, type AutoLayoutSize, type AutoLayoutSizing, type AutoLayoutSizingPair, type AutoLayoutVerticalConstraint, BezierPath, BezierPathInput, CANVAS_COMPONENT_DRAG_TYPE, CANVAS_TOKEN_PROPERTIES, CARD_INSPECTION_ZONES, CHILD_LAYOUT_DATA_KEY, COMPONENT_DATA_KEY, COMPONENT_OVERRIDES_DATA_KEY, COMPONENT_PROPERTY_REFS_DATA_KEY, COMPONENT_SET_DATA_KEY, COMPONENT_SOURCE_DATA_KEY, CONNECTION_LINE_TYPES, CSS_ANIMATION_PROPERTIES, type CanvasAgentCursor, type CanvasAnimationController, type CanvasAnimationControllerOptions, type CanvasAnimationState, CanvasArrangeAction, type CanvasArrangeController, type CanvasArrangeControllerOptions, type CanvasAutoLayoutController, type CanvasAutoLayoutControllerOptions, CanvasClipboardPayload, type CanvasComponentData, type CanvasComponentErrorCode, type CanvasComponentInfo, type CanvasComponentPropertyDef, type CanvasComponentPropertyField, type CanvasComponentPropertyType, type CanvasComponentPropertyValue, type CanvasComponentResult, type CanvasComponentSetData, type CanvasComponentSetInfo, type CanvasComponentSyncOptions, type CanvasComponentsController, type CanvasComponentsControllerOptions, type CanvasConnectionLineType, type CanvasDrawController, type CanvasDrawControllerOptions, CanvasEdge, CanvasGradientDef, type CanvasHeightOptions, type CanvasInstanceData, type CanvasInstanceInfo, type CanvasInstancePropertyInfo, CanvasLayoutOptions, CanvasNode, CanvasNodeStyle, CanvasNodeUpdate, type CanvasScene, type CanvasScenesOptions, type CanvasScenesState, CanvasScenesStore, type CanvasTokenBindingInfo, type CanvasTokenOptions, type CanvasTokenProperty, type CanvasViewport, type CardInspectionZone, Clock, type CombineShapeNodesOptions, type CombineShapeNodesRefusal, type CombineShapeNodesResult, type ConnectorSnap, type ConnectorSnapOptions, type ConnectorSnapTarget, type CreateCanvasComponentOptions, type CreateCanvasInstanceOptions, type CssAnimationExport, type CssExportOptions, type CssPropertyAnimation, type CubicSegment, type CurvedPathOptions, DEFAULT_CURSOR_INACTIVITY_MS, DEFAULT_NODE_HEIGHT, DEFAULT_NODE_WIDTH, DEFAULT_PLACEMENT_GAP, DirectionalDisplacementOptions, DistributeAxis, DistributeMode, DistributeNodesOptions, type EvaluateAnimationOptions, FanOutTrajectoryOptions, type FitCubicsOptions, type FitPathDataOptions, type FitViewportOptions, type FreehandDrawOptions, type FreehandStroke, type FreehandStrokeStyle, type FreehandTool, type GuideIndex, type GuideLine, type HatchOptions, INSTANCE_DATA_KEY, IncrementalLayoutOptions, type KeyframeDragState, type KeyframePatch, type KeyframeRangeOptions, type KeyframeRef, type KeyframeSnap, MAX_KEYFRAME_REFS, MatchSizeOptions, type MeasureGuide, type MeasureSelectionOptions, type MeasureSelectionResult, type MoveKeyframesResult, type MultiNodeTransitionOptions, type NodeAnimation, NodeRectOptions, NodeTransition, type OffsetShapeNodesOptions, type OutlineShapeStrokesOptions, PlaceBesideOptions, Point, PolygonFillRule, PolygonRing, Position, type PositionChangeLike, RESIZE_HANDLES, type RecordAnimationOptions, Rect, ReflowDisplacementOptions, type ResizeHandle, SHAPE_DATA_KEY, SHAPE_NODE_TYPE, SHAPE_OPERATIONS, type SampleAnimationOptions, type ScaleKeyframesOptions, type SerializedCanvasScenes, type SetCanvasVariantPropertiesOptions, type SetKeyframeOptions, ShapeDescription, type ShapeNodePolygonOptions, type ShapeOperation, type ShapePathEditOperation, type ShapePathEditRefusal, type ShapePathEditResult, ShapeSize, Side, SizeDimension, type SnapGuidesOptions, type SnapNodeDragOptions, type SnapNodeDragResult, type SnapNodeResizeOptions, type SnapNodeResizeResult, type SnapResizeOptions, type SnapResizeResult, type SnapResult, StreamingLayoutManager, type StreamingLayoutManagerOptions, StrokeCap, StrokeJoin, type StrokeToShapeNodeOptions, TOKEN_BINDINGS_DATA_KEY, TOKEN_MODES_DATA_KEY, type TimelineKeyframe, type TimelineRow, type TimelineRowsOptions, TrajectoryFunction, type WebAnimationSpec, XYPosition, ZOrderOperation, addCanvasVariant, addKeyframesAtTime, animateNode, applyAnimation, applyAnimationOverrides, applyConstraints, applyShapeCombination, applyShapeReplacement, bindCanvasComponentProperty, bindCanvasToken, blendLayout, boundsOf, calculateCursorArrowRotation, calculateCurvedPath, calculateDagreReflowDisplacement, calculateDirectionalDisplacement, canCombineShapeNodes, canOffsetShapeNodes, canOutlineShapeNodeStrokes, canvasHeight, centerNodes, centre, clampAnimationValue, clampLayoutSize, collectDescendantIds, combineCanvasComponentsAsVariants, combineShapeNodes, computeNodesBoundingBox, computeSnapGuides, connectedOnly, copyKeyframes, createBezierTrajectory, createCanvasAnimationController, createCanvasArrangeController, createCanvasAutoLayoutController, createCanvasComponent, createCanvasComponentsController, createCanvasDrawController, createCanvasInstance, createCanvasScenesStore, createDefaultStrokeStyle, createFanOutTrajectory, createGuideIndex, createNodeGuideIndex, cubicPointAt, cubicsToPathData, defaultEasing, deleteKeyframes, detachCanvasInstance, detachTokenBindings, diffOverrideGroups, ensureLayout, estimateCanvasHeight, estimateNodeSize, evaluateAnimation, exportCssAnimation, findConnectorSnap, findStrokesAtPoint, findVariant, fitCubicRun, fitCubicWithTangents, fitCubics, fitFreehandPath, fitPathData, fitViewportToNodes, fitViewportToRect, flowSide, formatAgentCursorName, formatAnimationTime, formatVariantName, getAgentCardAnchor, getAnimatableProperty, getAnimatedProperties, getAnimatedValue, getAnimationDuration, getAnimationTrack, getAutoLayout, getAutoLayoutGrid, getAutoLayoutInsertTarget, getBindableTokenProperties, getCanvasComponentDragId, getCanvasTokenProperty, getCenteredNodePosition, getChildLayout, getComponentData, getComponentInstances, getComponentPropertyDefs, getComponentPropertyRefs, getComponentSourceId, getCssPropertyAnimations, getCursorTransitionDuration, getDefaultVariant, getEffectiveTokenModes, getFlowChildren, getInstanceData, getInstanceProperties, getInstanceStatus, getKeyframeTimes, getLayerName, getLayoutParent, getLayoutSizing, getLayoutedNodes, getNaturalMovementTiming, getNextVariantValues, getNodeAnimation, getNodeOverrides, getNodeShape, getNodeTokenBindings, getNodeTokenModes, getOwningComponent, getOwningInstance, getResizingNodeRect, getRootInstance, getTimelineRows, getTimelineTicks, getTokenPropertyScope, getTokensForProperty, getVariantConflicts, getVariantOptions, getVariantSet, getVariantValues, handlePoint, hasVisibleStroke, hashString, hatchPath, inferResizeHandle, inspectCanvasInstance, inspectNodeTokens, isAgentCursor, isAutoLayoutFrame, isCanvasComponent, isCanvasComponentSet, isCanvasInstance, isCssExportExact, isEventFromTextInput, isInsideInstance, isKeyframeSelected, isMeasureModifierHeld, isNodeAnimated, isShapeNode, isStraightCubic, isValidCanvasEdge, isValidCanvasNode, isValidCanvasScene, isValidUrl, layoutAll, layoutBounds, layoutFrame, layoutUp, layoutUpMany, linearPositionTrajectory, linearTrajectory, listCanvasComponents, makeSizingCoherent, measureBetween, measureLabel, measureSelection, measureToLine, mergeNodeUpdates, moveKeyframes, moveLayoutChild, nearestHandlePositions, offsetShapeNodes, oppositePosition, outlineShapeNodeStrokes, overlaps, parseCanvasClipboardData, parseCanvasScenes, parseKeyframeClipboard, parseNodeStyleDeclarations, parseVariantName, pasteKeyframes, placeBeside, playWebAnimations, positionToSide, pruneCanvasTokenModes, pushCanvasInstanceOverrides, readAnimatableValue, readNodeStyleProperty, readOverrideGroup, recordAnimationChanges, relayoutUpdates, remapPastedNodes, removeCanvasVariant, removeTrack, renameCanvasVariantProperty, renameCanvasVariantValue, repositionNodesTo, resetCanvasInstanceOverrides, resizeHandleAxes, resolveCanvasTokens, resolvePadding, restoreCanvasMainComponent, revertShapeCombination, runMultiNodeTransition, sampleAnimationFrames, scaleKeyframes, serializeCanvasNodes, setCanvasComponentProperty, setCanvasInstanceProperties, setCanvasTokenMode, setCanvasVariantProperties, setKeyframe, setKeyframeEasing, setMotionPath, setTrackEnabled, shapeNodeToBezierPath, shapeNodeToPolygon, shapeToBezierPath, sideToPosition, snapKeyframeDelta, snapNodeDrag, snapNodeResize, snapResize, snapTimeToFrame, snapToGrid, streamlinePoints, strokeBoundingBox, strokePointsToPathData, strokeToShapeNode, swapCanvasInstance, syncAllCanvasInstances, syncCanvasComponents, syncCanvasInstance, timeToX, toWebAnimations, updateKeyframe, withNodeAnimation, withStyleOpacity, wouldCreateComponentCycle, writeNodeStyleProperty, writeOverrideGroup, xToTime };
|
package/dist/canvas/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CANVAS_GRADIENT_PRESETS,
|
|
3
3
|
PATHFINDER_OPERATIONS,
|
|
4
|
+
PIXERATE_BRAND_GRADIENT,
|
|
4
5
|
PathOpsError,
|
|
5
6
|
PlanarMap,
|
|
6
7
|
SHAPE_KINDS,
|
|
@@ -86,7 +87,7 @@ import {
|
|
|
86
87
|
unitePaths,
|
|
87
88
|
windingNumber,
|
|
88
89
|
xorPolygons
|
|
89
|
-
} from "../chunk-
|
|
90
|
+
} from "../chunk-TO22LX34.js";
|
|
90
91
|
import {
|
|
91
92
|
DEFAULT_NODE_HEIGHT,
|
|
92
93
|
DEFAULT_NODE_WIDTH,
|
|
@@ -8368,6 +8369,120 @@ function createCanvasDrawController(options) {
|
|
|
8368
8369
|
eraseAt
|
|
8369
8370
|
};
|
|
8370
8371
|
}
|
|
8372
|
+
|
|
8373
|
+
// src/canvas/agent-presence.ts
|
|
8374
|
+
var DEFAULT_CURSOR_INACTIVITY_MS = 12e3;
|
|
8375
|
+
function hashString(str) {
|
|
8376
|
+
let hash = 0;
|
|
8377
|
+
for (let i = 0; i < str.length; i++) {
|
|
8378
|
+
hash = (hash << 5) - hash + str.charCodeAt(i);
|
|
8379
|
+
hash |= 0;
|
|
8380
|
+
}
|
|
8381
|
+
return Math.abs(hash);
|
|
8382
|
+
}
|
|
8383
|
+
var CARD_INSPECTION_ZONES = {
|
|
8384
|
+
header: { x: 36, y: 24 },
|
|
8385
|
+
action: { x: 180, y: 28 },
|
|
8386
|
+
body: { x: 60, y: 84 },
|
|
8387
|
+
footer: { x: 165, y: 122 }
|
|
8388
|
+
};
|
|
8389
|
+
function getAgentCardAnchor(agentId = "agent", nodeId = "node", zone = 0, options) {
|
|
8390
|
+
const zoneNames = ["header", "action", "body", "footer"];
|
|
8391
|
+
const zoneName = typeof zone === "string" ? zone : zoneNames[Math.abs(Math.floor(zone)) % zoneNames.length];
|
|
8392
|
+
const base = CARD_INSPECTION_ZONES[zoneName];
|
|
8393
|
+
const seed = hashString(`${agentId}:${nodeId}:${zoneName}`);
|
|
8394
|
+
const offsetX = seed % 17 - 8;
|
|
8395
|
+
const offsetY = (seed >> 4) % 9 - 4;
|
|
8396
|
+
const jitterX = options?.randomJitter ? (Math.random() - 0.5) * 24 : 0;
|
|
8397
|
+
const jitterY = options?.randomJitter ? (Math.random() - 0.5) * 16 : 0;
|
|
8398
|
+
const maxX = options?.width ? Math.max(24, options.width - 20) : 230;
|
|
8399
|
+
const maxY = options?.height ? Math.max(20, options.height - 15) : 145;
|
|
8400
|
+
return {
|
|
8401
|
+
x: Math.max(16, Math.min(maxX, Math.round(base.x + offsetX + jitterX))),
|
|
8402
|
+
y: Math.max(14, Math.min(maxY, Math.round(base.y + offsetY + jitterY))),
|
|
8403
|
+
zoneName
|
|
8404
|
+
};
|
|
8405
|
+
}
|
|
8406
|
+
function calculateCurvedPath(fromX, fromY, toX, toY, progress, options) {
|
|
8407
|
+
const p = Math.max(0, Math.min(1, progress));
|
|
8408
|
+
const arcHeight = options?.arcHeight ?? -30;
|
|
8409
|
+
const wobble = options?.wobble ?? 0;
|
|
8410
|
+
const arc = Math.sin(p * Math.PI) * arcHeight;
|
|
8411
|
+
const sway = Math.sin(p * Math.PI * 2) * wobble;
|
|
8412
|
+
const currentX = fromX + (toX - fromX) * p + sway;
|
|
8413
|
+
const currentY = fromY + (toY - fromY) * p + arc;
|
|
8414
|
+
return { x: currentX, y: currentY };
|
|
8415
|
+
}
|
|
8416
|
+
function getNaturalMovementTiming(distance, seedStr = "drag") {
|
|
8417
|
+
const seed = hashString(seedStr);
|
|
8418
|
+
const absDist = Math.abs(distance);
|
|
8419
|
+
const distDuration = 560 + Math.min(340, absDist / 1e3 * 300);
|
|
8420
|
+
const variance = seed % 120 - 60;
|
|
8421
|
+
const duration = Math.round(Math.max(500, Math.min(1e3, distDuration + variance)));
|
|
8422
|
+
const baseArc = -24 - Math.min(16, absDist / 1e3 * 14);
|
|
8423
|
+
const arcVariance = (seed >> 3) % 9 - 4;
|
|
8424
|
+
const arcHeight = Math.round(baseArc + arcVariance);
|
|
8425
|
+
const grabX = 24 + seed % 24;
|
|
8426
|
+
const grabY = 12 + (seed >> 2) % 14;
|
|
8427
|
+
return {
|
|
8428
|
+
duration,
|
|
8429
|
+
arcHeight,
|
|
8430
|
+
grabOffset: { x: grabX, y: grabY }
|
|
8431
|
+
};
|
|
8432
|
+
}
|
|
8433
|
+
function getCursorTransitionDuration(distance, seedStr = "cursor", options) {
|
|
8434
|
+
const seed = hashString(seedStr);
|
|
8435
|
+
const jitter = seed % 60 - 30;
|
|
8436
|
+
const variance = options?.naturalVariance ? 0.85 + Math.random() * 0.3 : 1;
|
|
8437
|
+
let baseDuration = 560;
|
|
8438
|
+
if (distance < 60) {
|
|
8439
|
+
baseDuration = 340;
|
|
8440
|
+
} else if (distance < 300) {
|
|
8441
|
+
baseDuration = 440;
|
|
8442
|
+
}
|
|
8443
|
+
const computed = Math.round((baseDuration + jitter) * variance);
|
|
8444
|
+
return Math.max(300, Math.min(650, computed));
|
|
8445
|
+
}
|
|
8446
|
+
function calculateCursorArrowRotation(cursor, targetCenter, isAgentOrServiceAccount = false, isModalOpen, currentRotation = 0) {
|
|
8447
|
+
const hasModal = isModalOpen ?? Boolean(cursor.isModalOpen);
|
|
8448
|
+
const shouldPoint = Boolean(targetCenter && (isAgentOrServiceAccount || hasModal));
|
|
8449
|
+
if (!shouldPoint || !targetCenter) {
|
|
8450
|
+
return { shouldPoint: false, rotationDeg: 0 };
|
|
8451
|
+
}
|
|
8452
|
+
const dx = targetCenter.x - cursor.x;
|
|
8453
|
+
const dy = targetCenter.y - cursor.y;
|
|
8454
|
+
const dist = Math.hypot(dx, dy);
|
|
8455
|
+
if (dist < 2) {
|
|
8456
|
+
return { shouldPoint: true, rotationDeg: currentRotation };
|
|
8457
|
+
}
|
|
8458
|
+
const angleDeg = Math.atan2(dy, dx) * (180 / Math.PI);
|
|
8459
|
+
const rawTargetDeg = angleDeg + 135;
|
|
8460
|
+
const diff = ((rawTargetDeg - currentRotation + 180) % 360 + 360) % 360 - 180;
|
|
8461
|
+
return {
|
|
8462
|
+
shouldPoint: true,
|
|
8463
|
+
rotationDeg: currentRotation + diff
|
|
8464
|
+
};
|
|
8465
|
+
}
|
|
8466
|
+
function formatAgentCursorName(nameOrUsername) {
|
|
8467
|
+
if (!nameOrUsername) return "Agent";
|
|
8468
|
+
const cleaned = nameOrUsername.trim().replace(/^@+/, "").trim();
|
|
8469
|
+
return cleaned || "Agent";
|
|
8470
|
+
}
|
|
8471
|
+
function isAgentCursor(cursor) {
|
|
8472
|
+
if (cursor.isAgent) return true;
|
|
8473
|
+
if (cursor.userId?.startsWith("agent_") || cursor.userId?.startsWith("agent-")) return true;
|
|
8474
|
+
if (cursor.id?.startsWith("agent-") || cursor.id?.startsWith("agent_")) return true;
|
|
8475
|
+
if (cursor.username?.startsWith("@agent_") || cursor.username?.startsWith("agent_")) return true;
|
|
8476
|
+
const roleLower = cursor.role?.toLowerCase() || "";
|
|
8477
|
+
if (roleLower.includes("agent") || roleLower.includes("specialist") || roleLower === "planner" || roleLower === "coordinator" || roleLower === "executor" || roleLower === "validator" || roleLower === "supervisor") {
|
|
8478
|
+
return true;
|
|
8479
|
+
}
|
|
8480
|
+
const usernameLower = (cursor.username || "").toLowerCase();
|
|
8481
|
+
if (usernameLower.includes("agent") || usernameLower.includes("specialist")) {
|
|
8482
|
+
return true;
|
|
8483
|
+
}
|
|
8484
|
+
return false;
|
|
8485
|
+
}
|
|
8371
8486
|
export {
|
|
8372
8487
|
ANIMATABLE_PROPERTIES,
|
|
8373
8488
|
ANIMATION_DATA_KEY,
|
|
@@ -8380,6 +8495,7 @@ export {
|
|
|
8380
8495
|
CANVAS_COMPONENT_DRAG_TYPE,
|
|
8381
8496
|
CANVAS_GRADIENT_PRESETS,
|
|
8382
8497
|
CANVAS_TOKEN_PROPERTIES,
|
|
8498
|
+
CARD_INSPECTION_ZONES,
|
|
8383
8499
|
CHILD_LAYOUT_DATA_KEY,
|
|
8384
8500
|
COMPONENT_DATA_KEY,
|
|
8385
8501
|
COMPONENT_OVERRIDES_DATA_KEY,
|
|
@@ -8391,6 +8507,7 @@ export {
|
|
|
8391
8507
|
CUBIC_BEZIER_PRESETS,
|
|
8392
8508
|
CanvasScenesStore,
|
|
8393
8509
|
DEFAULT_ARRANGE_SHORTCUTS,
|
|
8510
|
+
DEFAULT_CURSOR_INACTIVITY_MS,
|
|
8394
8511
|
DEFAULT_NODE_HEIGHT,
|
|
8395
8512
|
DEFAULT_NODE_WIDTH,
|
|
8396
8513
|
DEFAULT_PLACEMENT_GAP,
|
|
@@ -8400,6 +8517,7 @@ export {
|
|
|
8400
8517
|
MAX_KEYFRAME_REFS,
|
|
8401
8518
|
ManualClock,
|
|
8402
8519
|
PATHFINDER_OPERATIONS,
|
|
8520
|
+
PIXERATE_BRAND_GRADIENT,
|
|
8403
8521
|
PathOpsError,
|
|
8404
8522
|
PlanarMap,
|
|
8405
8523
|
RESIZE_HANDLES,
|
|
@@ -8432,6 +8550,8 @@ export {
|
|
|
8432
8550
|
bindCanvasToken,
|
|
8433
8551
|
blendLayout,
|
|
8434
8552
|
boundsOf,
|
|
8553
|
+
calculateCursorArrowRotation,
|
|
8554
|
+
calculateCurvedPath,
|
|
8435
8555
|
calculateDagreReflowDisplacement,
|
|
8436
8556
|
calculateDirectionalDisplacement,
|
|
8437
8557
|
canCombineShapeNodes,
|
|
@@ -8507,11 +8627,13 @@ export {
|
|
|
8507
8627
|
fitViewportToRect,
|
|
8508
8628
|
flattenSvgPath,
|
|
8509
8629
|
flowSide,
|
|
8630
|
+
formatAgentCursorName,
|
|
8510
8631
|
formatAnimationTime,
|
|
8511
8632
|
formatNumber,
|
|
8512
8633
|
formatOklab,
|
|
8513
8634
|
formatVariantName,
|
|
8514
8635
|
getAbsolutePosition,
|
|
8636
|
+
getAgentCardAnchor,
|
|
8515
8637
|
getAnimatableProperty,
|
|
8516
8638
|
getAnimatedProperties,
|
|
8517
8639
|
getAnimatedValue,
|
|
@@ -8531,6 +8653,7 @@ export {
|
|
|
8531
8653
|
getComponentPropertyRefs,
|
|
8532
8654
|
getComponentSourceId,
|
|
8533
8655
|
getCssPropertyAnimations,
|
|
8656
|
+
getCursorTransitionDuration,
|
|
8534
8657
|
getDefaultVariant,
|
|
8535
8658
|
getEffectiveTokenModes,
|
|
8536
8659
|
getFlowChildren,
|
|
@@ -8542,6 +8665,7 @@ export {
|
|
|
8542
8665
|
getLayoutParent,
|
|
8543
8666
|
getLayoutSizing,
|
|
8544
8667
|
getLayoutedNodes,
|
|
8668
|
+
getNaturalMovementTiming,
|
|
8545
8669
|
getNextVariantValues,
|
|
8546
8670
|
getNodeAnimation,
|
|
8547
8671
|
getNodeOverrides,
|
|
@@ -8567,6 +8691,7 @@ export {
|
|
|
8567
8691
|
gradientToSvgDef,
|
|
8568
8692
|
handlePoint,
|
|
8569
8693
|
hasVisibleStroke,
|
|
8694
|
+
hashString,
|
|
8570
8695
|
hatchPath,
|
|
8571
8696
|
inferResizeHandle,
|
|
8572
8697
|
inspectCanvasInstance,
|
|
@@ -8576,6 +8701,7 @@ export {
|
|
|
8576
8701
|
intersectPaths,
|
|
8577
8702
|
intersectPolygons,
|
|
8578
8703
|
invertNodeUpdates,
|
|
8704
|
+
isAgentCursor,
|
|
8579
8705
|
isAnimationEasing,
|
|
8580
8706
|
isAnimationKeyframe,
|
|
8581
8707
|
isAutoLayoutFrame,
|