@pixerate/editor-react 0.16.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/canvas/index.cjs +1094 -143
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +277 -3
- package/dist/canvas/index.d.ts +277 -3
- package/dist/canvas/index.js +976 -0
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-34HEZX7J.js +2144 -0
- package/dist/chunk-34HEZX7J.js.map +1 -0
- package/dist/chunk-I3E4KSA2.js +515 -0
- package/dist/chunk-I3E4KSA2.js.map +1 -0
- package/dist/{chunk-XTFR3IMK.js → chunk-ZU54BMDC.js} +473 -160
- package/dist/chunk-ZU54BMDC.js.map +1 -0
- package/dist/generation/index.cjs +290 -0
- package/dist/generation/index.cjs.map +1 -1
- package/dist/generation/index.d.cts +66 -2
- package/dist/generation/index.d.ts +66 -2
- package/dist/generation/index.js +7 -1
- package/dist/image-editor/index.cjs +490 -187
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +34 -2
- package/dist/image-editor/index.d.ts +34 -2
- package/dist/image-editor/index.js +5 -1
- package/dist/index.cjs +2792 -823
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +188 -7
- package/dist/index.d.ts +188 -7
- package/dist/index.js +600 -158
- package/dist/index.js.map +1 -1
- package/dist/spreadsheet/index.cjs +1099 -142
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +156 -8
- package/dist/spreadsheet/index.d.ts +156 -8
- package/dist/spreadsheet/index.js +15 -3
- package/dist/tokens/index.cjs +395 -0
- package/dist/tokens/index.cjs.map +1 -0
- package/dist/tokens/index.d.cts +54 -0
- package/dist/tokens/index.d.ts +54 -0
- package/dist/tokens/index.js +375 -0
- package/dist/tokens/index.js.map +1 -0
- package/package.json +10 -2
- package/dist/chunk-7SPRQZ6H.js +0 -216
- package/dist/chunk-7SPRQZ6H.js.map +0 -1
- package/dist/chunk-FYIPXHAE.js +0 -1169
- package/dist/chunk-FYIPXHAE.js.map +0 -1
- package/dist/chunk-XTFR3IMK.js.map +0 -1
package/dist/canvas/index.d.cts
CHANGED
|
@@ -2,8 +2,9 @@ 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, ShapeDescription, AutoLayoutMeasure } from '@pixerate/editor/canvas';
|
|
6
|
-
export { AUTO_LAYOUT_DATA_KEY, AlignEdge, ArrangeShortcutBinding, AutoLayout, AutoLayoutAlignContent, AutoLayoutAlignCross, AutoLayoutAlignMain, AutoLayoutCellAlign, AutoLayoutChild, AutoLayoutConstraints, AutoLayoutGrid, AutoLayoutGridArea, AutoLayoutGridCell, AutoLayoutGridGeometry, AutoLayoutGridTrack, AutoLayoutHorizontalConstraint, AutoLayoutInsertTarget, AutoLayoutMeasure, AutoLayoutMode, AutoLayoutOptions, AutoLayoutPadding, AutoLayoutSize, AutoLayoutSizing, AutoLayoutSizingPair, AutoLayoutVerticalConstraint, CHILD_LAYOUT_DATA_KEY, CONNECTION_LINE_TYPES, CanvasArrangeAction, CanvasAutoLayoutController, CanvasAutoLayoutControllerOptions, CanvasClipboardPayload, CanvasConnectionLineType, CanvasDockingCallbacks, CanvasEdge, CanvasHeightOptions, CanvasLayoutOptions, CanvasNode, CanvasNodeUpdate, CanvasScene, CanvasScenesState, CanvasScenesStore, CanvasViewport, Clock, CollapseNodeOptions, CombineShapeNodesOptions, CombineShapeNodesRefusal, CombineShapeNodesResult, ConnectorSnap, ConnectorSnapTarget, CubicSegment, DEFAULT_ARRANGE_SHORTCUTS, DirectionalDisplacementOptions, DisplacementDirection, DistributeAxis, DistributeMode, DockStrategy, EllipseShape, ExplodeNodeOptions, ExplosionSnapshot, FanOutTrajectoryOptions, FitCubicsOptions, FitPathDataOptions, FlattenOptions, GraphDifferences, GuideIndex, GuideLine, IncrementalLayoutOptions, ManualClock, MeasureGuide, MeasureSelectionOptions, MeasureSelectionResult, MultiPolygon, NodeTransition, PathCommand, 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, ShapeDescription, ShapeKind, ShapeNodePolygonOptions, ShapeOperation, ShapePaint, ShapeRenderData, ShapeSize, Side, SizeDimension, SnapGuidesOptions, SnapNodeResizeOptions, SnapNodeResizeResult, SnapResizeOptions, SnapResizeResult, SnapResult, StarShape, TrajectoryFunction, TrajectoryPoint, XYPosition, ZOrderOperation, alignNodes, applyConstraints, applyNodeUpdates, applyShapeCombination, blendLayout, boundsOf, calculateDagreReflowDisplacement, calculateDirectionalDisplacement, canCombineShapeNodes, canvasHeight, centerNodes, centre, clampLayoutSize, combineShapeNodes, computeNodesBoundingBox, computeSnapGuides, connectedOnly, createBezierTrajectory, createCanvasAutoLayoutController, createCanvasScenesStore, createFanOutTrajectory, createGuideIndex, createNodeGuideIndex, cubicPointAt, cubicsToPathData, defaultEasing, distributeNodes, dividePolygons, ensureLayout, estimateCanvasHeight, estimateNodeSize, findConnectorSnap, fitCubicRun, fitCubics, fitFreehandPath, fitPathData, fitViewportToNodes, fitViewportToRect, flattenSvgPath, flowSide, getAbsolutePosition, getAutoLayout, getAutoLayoutGrid, getAutoLayoutInsertTarget, getCenteredNodePosition, getChildLayout, getFlowChildren, getLayoutParent, getLayoutSizing, getLayoutedNodes, getNodeRect, getNodeShape, getNodeSize, getResizingNodeRect, getShapeRenderData, getShapeSvg, handlePoint, inferResizeHandle, intersectPolygons, invertNodeUpdates, isAutoLayoutFrame, isEventFromTextInput, isLocked, isMeasureModifierHeld, isShapeDescription, isShapeNode, isStraightCubic, isValidCanvasNode, isValidUrl, layoutAll, layoutBounds, layoutFrame, layoutUp, layoutUpMany, linearPositionTrajectory, linearTrajectory, lockNodes, makeSizingCoherent, matchArrangeShortcut, matchSize, measureBetween, measureLabel, measureSelection, measureToLine, mergeNodeUpdates, moveLayoutChild, multiPolygonArea, multiPolygonBounds, nearestHandlePositions, oppositePosition, overlaps, parseCanvasClipboardData, parseCanvasScenes, parseSvgPath, placeBeside, pointInMultiPolygon, pointInRings, polygonArea, polygonBoolean, polygonToSvgPath, positionToSide, readStyleSize, realClock, relayoutUpdates, remapPastedNodes, reorderNodes, repositionNodesTo, resizeHandleAxes, resolvePadding, revertShapeCombination, ringSignedArea, runMultiNodeTransition, serializeCanvasNodes, shapeNodeToPolygon, shapeToPolygon, sideToPosition, simplifyRing, snapNodeDrag, snapNodeResize, snapResize, snapToGrid, subtractPolygons, toggleLockNodes, unionPolygons, unlockNodes, withStyleSize, xorPolygons } 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, ShapeDescription, AutoLayoutMeasure, CanvasTokenOptions, AnimationHistoryTarget, Clock, AnimationLoopMode, AnimatableProperty, CanvasComponentSyncOptions, CanvasComponentsController } from '@pixerate/editor/canvas';
|
|
6
|
+
export { ANIMATABLE_PROPERTIES, ANIMATION_DATA_KEY, ANIMATION_EASING_LABELS, ANIMATION_EASING_PRESETS, ANIMATION_TIME_EPSILON, AUTO_LAYOUT_DATA_KEY, 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_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, CanvasEdge, CanvasHeightOptions, CanvasInstanceInfo, CanvasLayoutOptions, CanvasNode, CanvasNodeUpdate, 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, 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, ShapeDescription, ShapeKind, ShapeNodePolygonOptions, ShapeOperation, ShapePaint, ShapePathEditOperation, ShapePathEditRefusal, ShapePathEditResult, ShapeRenderData, ShapeSize, Side, SizeDimension, SnapGuidesOptions, SnapNodeResizeOptions, SnapNodeResizeResult, SnapResizeOptions, SnapResizeResult, SnapResult, SpringEasing, StarShape, StrokeCap, StrokeJoin, TOKEN_BINDINGS_DATA_KEY, TOKEN_MODES_DATA_KEY, TimelineKeyframe, TimelineRow, TrajectoryFunction, TrajectoryPoint, WebAnimationSpec, XYPosition, ZOrderOperation, addKeyframesAtTime, alignNodes, 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, createCanvasInstance, createCanvasScenesStore, 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, 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, getNodeAnimation, getNodeOverrides, getNodeRect, getNodeShape, getNodeSize, getNodeTokenBindings, getNodeTokenModes, getResizingNodeRect, getShapeRenderData, getShapeSvg, getTimelineRows, getTimelineTicks, getTokenPropertyScope, getTokensForProperty, handlePoint, hasVisibleStroke, inferResizeHandle, inspectCanvasInstance, inspectNodeTokens, interpolateAnimationValue, intersectPaths, intersectPolygons, invertNodeUpdates, isAnimationEasing, isAnimationKeyframe, isAutoLayoutFrame, isCanvasComponent, isCanvasComponentSet, 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, parseKeyframeClipboard, parseOklab, parseSvgPath, pasteKeyframes, pathBoolean, placeBeside, playWebAnimations, pointInBezierPath, pointInMultiPolygon, pointInRings, polygonArea, polygonBoolean, polygonToSvgPath, positionToSide, pruneCanvasTokenModes, pushCanvasInstanceOverrides, readAnimatableValue, readNodeStyleProperty, readStyleSize, realClock, recordAnimationChanges, relayoutUpdates, remapPastedNodes, removeTrack, reorderNodes, repositionNodesTo, resetCanvasInstanceOverrides, resizeHandleAxes, resolveCanvasTokens, resolveEasing, resolvePadding, restoreCanvasMainComponent, revertShapeCombination, rgbToOklab, ringSignedArea, runMultiNodeTransition, sampleAnimationFrames, scaleKeyframes, serializeCanvasNodes, setCanvasComponentProperty, setCanvasInstanceProperties, setCanvasTokenMode, setKeyframe, setKeyframeEasing, setMotionPath, setTrackEnabled, shapeNodeToBezierPath, shapeNodeToPolygon, shapeToBezierPath, shapeToPolygon, sideToPosition, simplifyRing, snapKeyframeDelta, snapNodeDrag, snapNodeResize, snapResize, snapTimeToFrame, snapToGrid, springAt, strokeOutlineRings, 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
|
+
import { TokenState, TokenStore, TokenModeContext } from '@pixerate/editor/tokens';
|
|
7
8
|
|
|
8
9
|
interface AgentPresenceLayerProps {
|
|
9
10
|
presences: AgentPresence[];
|
|
@@ -197,6 +198,10 @@ declare function useCanvasArrange<TNode extends CanvasNode = CanvasNode>(options
|
|
|
197
198
|
exclude: (ids?: Iterable<string>, o?: _pixerate_editor_canvas.CombineShapeNodesOptions) => _pixerate_editor_canvas.CombineShapeNodesResult<TNode>;
|
|
198
199
|
divide: (ids?: Iterable<string>, o?: _pixerate_editor_canvas.CombineShapeNodesOptions) => _pixerate_editor_canvas.CombineShapeNodesResult<TNode>;
|
|
199
200
|
canCombineShapes: (ids?: Iterable<string>) => boolean;
|
|
201
|
+
offsetShapes(distance: number, ids?: Iterable<string>, offsetOptions?: _pixerate_editor_canvas.OffsetShapeNodesOptions): _pixerate_editor_canvas.ShapePathEditResult<TNode>;
|
|
202
|
+
canOffsetShapes: (ids?: Iterable<string>) => boolean;
|
|
203
|
+
outlineStroke(ids?: Iterable<string>, outlineOptions?: _pixerate_editor_canvas.OutlineShapeStrokesOptions): _pixerate_editor_canvas.ShapePathEditResult<TNode>;
|
|
204
|
+
canOutlineStroke: (ids?: Iterable<string>) => boolean;
|
|
200
205
|
runAction(action: CanvasArrangeAction): boolean;
|
|
201
206
|
beginDrag(ids?: Iterable<string>): void;
|
|
202
207
|
drag(ids?: Iterable<string>): _pixerate_editor_canvas.SnapNodeDragResult | null;
|
|
@@ -415,4 +420,273 @@ declare function useCanvasAutoLayout<TNode extends CanvasNode = CanvasNode>(opti
|
|
|
415
420
|
};
|
|
416
421
|
type CanvasAutoLayout = ReturnType<typeof useCanvasAutoLayout>;
|
|
417
422
|
|
|
418
|
-
|
|
423
|
+
interface UseCanvasTokensOptions<TNode extends CanvasNode> extends Omit<CanvasTokenOptions, 'modes'> {
|
|
424
|
+
store: TokenStore;
|
|
425
|
+
nodes: TNode[];
|
|
426
|
+
setNodes: (update: TNode[] | ((nodes: TNode[]) => TNode[])) => void;
|
|
427
|
+
/** Modes for nodes without an explicit mode up their tree (e.g. the page's). */
|
|
428
|
+
modes?: TokenModeContext;
|
|
429
|
+
}
|
|
430
|
+
interface CanvasTokens {
|
|
431
|
+
state: TokenState;
|
|
432
|
+
/** Binds (or with `null` unbinds) a property of the nodes; throws `TokenError` when refused. */
|
|
433
|
+
bind: (ids: Iterable<string>, propertyKey: string, variableId: string | null) => void;
|
|
434
|
+
/** Sets (or with `null` clears) an explicit mode on frames / groups; descendants follow. */
|
|
435
|
+
setMode: (ids: Iterable<string>, collectionId: string, modeId: string | null) => void;
|
|
436
|
+
/** The modes a node is in (its own, inherited, then the root `modes`). */
|
|
437
|
+
modesOf: (nodeId: string) => Record<string, string>;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Keeps token-bound node properties resolved: whenever the token store, the nodes or the root
|
|
441
|
+
* modes change, bound values are written into the nodes (only when something changed, so it
|
|
442
|
+
* does not loop). Deleting a variable detaches the nodes bound to it, keeping their values.
|
|
443
|
+
*/
|
|
444
|
+
declare function useCanvasTokens<TNode extends CanvasNode>(options: UseCanvasTokensOptions<TNode>): CanvasTokens;
|
|
445
|
+
|
|
446
|
+
interface TokenBindingPickerProps<TNode extends CanvasNode = CanvasNode> {
|
|
447
|
+
state: TokenState;
|
|
448
|
+
nodes: TNode[];
|
|
449
|
+
/** Nodes to bind (the first one decides which properties are listed). */
|
|
450
|
+
selectedIds: readonly string[];
|
|
451
|
+
/** Receives the nodes with the binding applied and resolved. */
|
|
452
|
+
onChange: (nodes: TNode[]) => void;
|
|
453
|
+
options?: CanvasTokenOptions;
|
|
454
|
+
/** Limit to these property keys (in this order). */
|
|
455
|
+
properties?: readonly string[];
|
|
456
|
+
onError?: (error: Error) => void;
|
|
457
|
+
className?: string;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Inspector rows that bind node properties (fill, stroke, opacity, radius, gap, padding, text
|
|
461
|
+
* colour / size, …) to variables of the right type and scope, showing each resolved value.
|
|
462
|
+
*/
|
|
463
|
+
declare function TokenBindingPicker<TNode extends CanvasNode = CanvasNode>({ state, nodes, selectedIds, onChange, options, properties, onError, className, }: TokenBindingPickerProps<TNode>): React__default.JSX.Element | null;
|
|
464
|
+
interface TokenModeSwitcherProps<TNode extends CanvasNode = CanvasNode> {
|
|
465
|
+
state: TokenState;
|
|
466
|
+
nodes: TNode[];
|
|
467
|
+
/** Frames / groups whose explicit mode is set (the first one's choice is shown). */
|
|
468
|
+
nodeIds: readonly string[];
|
|
469
|
+
onChange: (nodes: TNode[]) => void;
|
|
470
|
+
options?: CanvasTokenOptions;
|
|
471
|
+
/** Show collections with a single mode too (default `false`). */
|
|
472
|
+
showSingleMode?: boolean;
|
|
473
|
+
className?: string;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Per-collection mode pickers for the selected frames: "Auto" (inherit from the parent, then
|
|
477
|
+
* the root modes, then the default mode) or an explicit mode that descendants inherit.
|
|
478
|
+
*/
|
|
479
|
+
declare function TokenModeSwitcher<TNode extends CanvasNode = CanvasNode>({ state, nodes, nodeIds, onChange, options, showSingleMode, className, }: TokenModeSwitcherProps<TNode>): React__default.JSX.Element | null;
|
|
480
|
+
|
|
481
|
+
interface UseCanvasAnimationOptions<TNode extends CanvasNode = CanvasNode> {
|
|
482
|
+
nodes: TNode[];
|
|
483
|
+
setNodes: (updater: TNode[] | ((prev: TNode[]) => TNode[])) => void;
|
|
484
|
+
/** When set, keyframe edits are undoable steps. */
|
|
485
|
+
history?: AnimationHistoryTarget;
|
|
486
|
+
/** Ids acted on without explicit ids (default: nodes with `selected: true`). */
|
|
487
|
+
getSelectedIds?: () => string[];
|
|
488
|
+
/** Playback time source (default `realClock`); pass a `ManualClock` for tests or rendering. Read once. */
|
|
489
|
+
clock?: Clock;
|
|
490
|
+
/** Fixed timeline length (ms); omitted = the last keyframe, at least `minDuration`. Read once. */
|
|
491
|
+
duration?: number;
|
|
492
|
+
minDuration?: number;
|
|
493
|
+
loop?: AnimationLoopMode;
|
|
494
|
+
playbackRate?: number;
|
|
495
|
+
fps?: number;
|
|
496
|
+
recording?: boolean;
|
|
497
|
+
properties?: readonly AnimatableProperty[];
|
|
498
|
+
onTime?: (time: number) => void;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* React hook for keyframe animation on the canvas: a playhead player (play / pause / seek /
|
|
502
|
+
* scrub, loop, ping-pong, rate), record mode, undoable keyframe edits, multi-keyframe drags
|
|
503
|
+
* with snapping, copy / paste and CSS / Web Animations export.
|
|
504
|
+
*
|
|
505
|
+
* Render `displayNodes` (the nodes evaluated at the playhead) in React Flow and pass its edits
|
|
506
|
+
* back through `applyDisplayChanges`:
|
|
507
|
+
* `onNodesChange={(c) => animation.applyDisplayChanges(applyNodeChanges(c, animation.displayNodes))}`.
|
|
508
|
+
* Animated properties are then keyed at the playhead instead of being overwritten.
|
|
509
|
+
*/
|
|
510
|
+
declare function useCanvasAnimation<TNode extends CanvasNode = CanvasNode>(options: UseCanvasAnimationOptions<TNode>): {
|
|
511
|
+
state: _pixerate_editor_canvas.CanvasAnimationState;
|
|
512
|
+
time: number;
|
|
513
|
+
playing: boolean;
|
|
514
|
+
recording: boolean;
|
|
515
|
+
duration: number;
|
|
516
|
+
selection: readonly _pixerate_editor_canvas.KeyframeRef[];
|
|
517
|
+
drag: _pixerate_editor_canvas.KeyframeDragState | null;
|
|
518
|
+
/** The nodes evaluated at the playhead; render these. */
|
|
519
|
+
displayNodes: TNode[];
|
|
520
|
+
clipboard: _pixerate_editor_canvas.AnimationKeyframeClipboard | null;
|
|
521
|
+
player: _pixerate_editor_canvas.AnimationPlayer;
|
|
522
|
+
getState: () => _pixerate_editor_canvas.CanvasAnimationState;
|
|
523
|
+
subscribe(listener: (state: _pixerate_editor_canvas.CanvasAnimationState) => void): () => void;
|
|
524
|
+
refresh(): void;
|
|
525
|
+
play: () => void;
|
|
526
|
+
pause: () => void;
|
|
527
|
+
toggle: () => void;
|
|
528
|
+
stop: () => void;
|
|
529
|
+
seek: (time: number) => void;
|
|
530
|
+
scrub: (time: number) => void;
|
|
531
|
+
endScrub: () => void;
|
|
532
|
+
setLoop: (loop: AnimationLoopMode) => void;
|
|
533
|
+
setPlaybackRate: (rate: number) => void;
|
|
534
|
+
setDuration(ms: number | null): void;
|
|
535
|
+
setFps(value: number): void;
|
|
536
|
+
setRecording(on: boolean): void;
|
|
537
|
+
toggleRecording(): void;
|
|
538
|
+
nextKeyframe(ids?: Iterable<string>): number | null;
|
|
539
|
+
previousKeyframe(ids?: Iterable<string>): number | null;
|
|
540
|
+
display: (nodes?: readonly TNode[] | undefined) => TNode[];
|
|
541
|
+
applyDisplayChanges(next: TNode[]): _pixerate_editor_canvas.KeyframeRef[];
|
|
542
|
+
addKeyframe(ids?: Iterable<string>, keys?: readonly string[], time?: number): _pixerate_editor_canvas.KeyframeRef[];
|
|
543
|
+
setKeyframe(nodeId: string, property: string, value: _pixerate_editor_canvas.AnimationValue, time?: number, easing?: _pixerate_editor_canvas.AnimationEasing | string): void;
|
|
544
|
+
updateKeyframe(ref: _pixerate_editor_canvas.KeyframeRef, patch: _pixerate_editor_canvas.KeyframePatch): void;
|
|
545
|
+
deleteKeyframes(refs?: readonly _pixerate_editor_canvas.KeyframeRef[]): boolean;
|
|
546
|
+
setEasing(easing: _pixerate_editor_canvas.AnimationEasing | string | null, refs?: readonly _pixerate_editor_canvas.KeyframeRef[]): boolean;
|
|
547
|
+
setTrackEnabled(nodeId: string, property: string, enabled: boolean): void;
|
|
548
|
+
removeTrack(nodeId: string, property: string): void;
|
|
549
|
+
setMotionPath(nodeId: string, motionPath: {
|
|
550
|
+
d: string;
|
|
551
|
+
autoRotate?: boolean;
|
|
552
|
+
} | null): void;
|
|
553
|
+
animateNode(nodeId: string, opts: Omit<_pixerate_editor_canvas.AnimateNodeOptions, "properties">): _pixerate_editor_canvas.KeyframeRef[];
|
|
554
|
+
moveKeyframes(delta: number, refs?: readonly _pixerate_editor_canvas.KeyframeRef[]): number;
|
|
555
|
+
scaleKeyframes(factor: number, refs?: readonly _pixerate_editor_canvas.KeyframeRef[], pivot?: number): number;
|
|
556
|
+
copyKeyframes(refs?: readonly _pixerate_editor_canvas.KeyframeRef[]): _pixerate_editor_canvas.AnimationKeyframeClipboard | null;
|
|
557
|
+
pasteKeyframes(data?: _pixerate_editor_canvas.AnimationKeyframeClipboard | null, nodeIds?: readonly string[], time?: number): _pixerate_editor_canvas.KeyframeRef[];
|
|
558
|
+
selectKeyframes(refs: readonly _pixerate_editor_canvas.KeyframeRef[], mode?: "replace" | "add" | "toggle"): void;
|
|
559
|
+
clearSelection(): void;
|
|
560
|
+
beginKeyframeDrag(refs?: readonly _pixerate_editor_canvas.KeyframeRef[]): void;
|
|
561
|
+
updateKeyframeDrag(delta: number, opts?: {
|
|
562
|
+
snap?: boolean;
|
|
563
|
+
thresholdMs?: number;
|
|
564
|
+
}): _pixerate_editor_canvas.KeyframeDragState | null;
|
|
565
|
+
endKeyframeDrag(): number;
|
|
566
|
+
cancelKeyframeDrag(): void;
|
|
567
|
+
timelineRows(ids?: Iterable<string>, opts?: Omit<_pixerate_editor_canvas.TimelineRowsOptions, "selection" | "dragDelta">): _pixerate_editor_canvas.TimelineRow[];
|
|
568
|
+
sampleFrames(opts?: _pixerate_editor_canvas.SampleAnimationOptions): _pixerate_editor_canvas.AnimationFrame[];
|
|
569
|
+
exportCss(nodeId: string, opts?: _pixerate_editor_canvas.CssExportOptions & {
|
|
570
|
+
name?: string;
|
|
571
|
+
selector?: string;
|
|
572
|
+
}): _pixerate_editor_canvas.CssAnimationExport;
|
|
573
|
+
toWebAnimations(nodeId: string, opts?: _pixerate_editor_canvas.CssExportOptions): _pixerate_editor_canvas.WebAnimationSpec[];
|
|
574
|
+
destroy(): void;
|
|
575
|
+
};
|
|
576
|
+
type CanvasAnimation<TNode extends CanvasNode = CanvasNode> = ReturnType<typeof useCanvasAnimation<TNode>>;
|
|
577
|
+
|
|
578
|
+
interface AnimationTimelineProps {
|
|
579
|
+
/** The `useCanvasAnimation` result. */
|
|
580
|
+
animation: CanvasAnimation<any>;
|
|
581
|
+
/** Nodes whose tracks are listed (default: the selected nodes). */
|
|
582
|
+
nodeIds?: readonly string[];
|
|
583
|
+
/** Width of the keyframe lanes in px (default 360). */
|
|
584
|
+
width?: number;
|
|
585
|
+
/** Snap distance in screen px while dragging keyframes (default 8; hold Alt to turn snapping off). */
|
|
586
|
+
snapThreshold?: number;
|
|
587
|
+
labelOf?: (node: CanvasNode) => string;
|
|
588
|
+
className?: string;
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Compact timeline: play / pause, record toggle, playhead ruler (drag to scrub), one lane per
|
|
592
|
+
* animated property of the selected nodes with draggable keyframe diamonds (snapping to other
|
|
593
|
+
* keys, the playhead and frames; Shift-click adds to the selection, Escape cancels a drag,
|
|
594
|
+
* Delete removes), an easing picker for the selected keyframes and the loop mode.
|
|
595
|
+
*/
|
|
596
|
+
declare function AnimationTimeline({ animation, nodeIds, width, snapThreshold, labelOf, className }: AnimationTimelineProps): React__default.JSX.Element;
|
|
597
|
+
|
|
598
|
+
interface UseCanvasComponentsOptions<TNode extends CanvasNode = CanvasNode> extends CanvasComponentSyncOptions {
|
|
599
|
+
nodes: TNode[];
|
|
600
|
+
setNodes: (updater: TNode[] | ((prev: TNode[]) => TNode[])) => void;
|
|
601
|
+
/** When set, every component action is one undoable step. */
|
|
602
|
+
history?: ArrangeHistoryTarget;
|
|
603
|
+
/** The selection (default: nodes with `selected`). */
|
|
604
|
+
getSelectedIds?: () => string[];
|
|
605
|
+
/** Called by `goToMainComponent` with the main (e.g. to pan the viewport to it). */
|
|
606
|
+
onReveal?: (node: TNode) => void;
|
|
607
|
+
/** Sync instances with their mains after every node change (default `true`). */
|
|
608
|
+
autoSync?: boolean;
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* React hook for Figma-style components and instances on a React Flow canvas. After every
|
|
612
|
+
* node change it records edits inside instances as overrides and rebuilds the instances of
|
|
613
|
+
* edited main components (keeping overrides). Its actions (`createComponent`,
|
|
614
|
+
* `createInstance`, `combineAsVariants`, `detachInstance`, `resetOverrides`, `pushOverrides`,
|
|
615
|
+
* `swapInstance`, `setInstanceProperties`, `restoreMainComponent`, …) are undoable steps
|
|
616
|
+
* with a `history`, and each has a `can…` check returning `true` or the reason it can't run.
|
|
617
|
+
*/
|
|
618
|
+
declare function useCanvasComponents<TNode extends CanvasNode = CanvasNode>(options: UseCanvasComponentsOptions<TNode>): {
|
|
619
|
+
sync: () => TNode[];
|
|
620
|
+
syncAll(): TNode[];
|
|
621
|
+
createComponent(ids?: Iterable<string>, createOptions?: Omit<_pixerate_editor_canvas.CreateCanvasComponentOptions, keyof CanvasComponentSyncOptions>): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
622
|
+
canCreateComponent: (ids?: Iterable<string>) => string | true;
|
|
623
|
+
combineAsVariants(ids?: Iterable<string>, combineOptions?: {
|
|
624
|
+
id?: string;
|
|
625
|
+
name?: string;
|
|
626
|
+
padding?: number;
|
|
627
|
+
}): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
628
|
+
canCombineAsVariants: (ids?: Iterable<string>) => string | true;
|
|
629
|
+
createInstance(componentId: string, createOptions?: Omit<_pixerate_editor_canvas.CreateCanvasInstanceOptions, keyof CanvasComponentSyncOptions>): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
630
|
+
canCreateInstance(componentId?: string, parentId?: string): true | string;
|
|
631
|
+
detachInstance(ids?: Iterable<string>): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
632
|
+
canDetachInstance(ids?: Iterable<string>): true | string;
|
|
633
|
+
resetOverrides(id?: string, group?: string): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
634
|
+
canResetOverrides(id?: string): true | string;
|
|
635
|
+
pushOverrides(id?: string): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
636
|
+
canPushOverrides(id?: string): true | string;
|
|
637
|
+
swapInstance(componentId: string, ids?: Iterable<string>, swapOptions?: {
|
|
638
|
+
keepTextOverridesOnly?: boolean;
|
|
639
|
+
}): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
640
|
+
canSwapInstance(componentId?: string, ids?: Iterable<string>): true | string;
|
|
641
|
+
setInstanceProperties(properties: Record<string, unknown>, ids?: Iterable<string>): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
642
|
+
canSetInstanceProperties(ids?: Iterable<string>): true | string;
|
|
643
|
+
restoreMainComponent(id?: string): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
644
|
+
canRestoreMainComponent(id?: string): true | string;
|
|
645
|
+
setComponentProperty(componentId: string, name: string, def: _pixerate_editor_canvas.CanvasComponentPropertyDef | null, propertyOptions?: {
|
|
646
|
+
newName?: string;
|
|
647
|
+
}): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
648
|
+
bindComponentProperty(layerId: string, field: _pixerate_editor_canvas.CanvasComponentPropertyField, name: string | null): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
649
|
+
goToMainComponent(id?: string): string | undefined;
|
|
650
|
+
canGoToMainComponent(id?: string): true | string;
|
|
651
|
+
list: () => {
|
|
652
|
+
components: _pixerate_editor_canvas.CanvasComponentInfo[];
|
|
653
|
+
sets: _pixerate_editor_canvas.CanvasComponentSetInfo[];
|
|
654
|
+
};
|
|
655
|
+
inspect: (id?: string) => _pixerate_editor_canvas.CanvasInstanceInfo | undefined;
|
|
656
|
+
rootInstanceOf: (id: string) => string | undefined;
|
|
657
|
+
};
|
|
658
|
+
type CanvasComponents<TNode extends CanvasNode = CanvasNode> = ReturnType<typeof useCanvasComponents<TNode>>;
|
|
659
|
+
|
|
660
|
+
interface CanvasComponentsPanelProps<TNode extends CanvasNode = CanvasNode> {
|
|
661
|
+
nodes: TNode[];
|
|
662
|
+
/** Inserts an instance of a component (or a set's default variant); called on click. */
|
|
663
|
+
onInsert: (componentId: string) => void;
|
|
664
|
+
/** Show the search field (default `true`). */
|
|
665
|
+
search?: boolean;
|
|
666
|
+
className?: string;
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Components panel: component sets (with their variants) and lone components. Click one to
|
|
670
|
+
* insert an instance, or drag it onto the canvas (the drag carries the id as
|
|
671
|
+
* `CANVAS_COMPONENT_DRAG_TYPE`; read it with `getCanvasComponentDragId`).
|
|
672
|
+
*/
|
|
673
|
+
declare function CanvasComponentsPanel<TNode extends CanvasNode = CanvasNode>({ nodes, onInsert, search, className }: CanvasComponentsPanelProps<TNode>): React__default.JSX.Element;
|
|
674
|
+
/** The actions the instance inspector runs (a components controller or hook satisfies it). */
|
|
675
|
+
type CanvasInstanceInspectorActions = Pick<CanvasComponentsController<any>, 'setInstanceProperties' | 'resetOverrides' | 'detachInstance' | 'goToMainComponent' | 'pushOverrides' | 'restoreMainComponent'>;
|
|
676
|
+
interface CanvasInstanceInspectorProps<TNode extends CanvasNode = CanvasNode> {
|
|
677
|
+
nodes: TNode[];
|
|
678
|
+
/** An instance, or a layer inside one; nothing is shown otherwise. */
|
|
679
|
+
nodeId: string | null | undefined;
|
|
680
|
+
components: CanvasInstanceInspectorActions;
|
|
681
|
+
/** Receives refusals (e.g. a property value that would nest a component in itself). */
|
|
682
|
+
onError?: (reason: string) => void;
|
|
683
|
+
className?: string;
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Instance inspector: main component (or "missing main" with Restore), variant pickers,
|
|
687
|
+
* component property controls, the overrides of its layers (each resettable), and Reset all,
|
|
688
|
+
* Detach, Go to main and Push changes.
|
|
689
|
+
*/
|
|
690
|
+
declare function CanvasInstanceInspector<TNode extends CanvasNode = CanvasNode>({ nodes, nodeId, components, onError, className }: CanvasInstanceInspectorProps<TNode>): React__default.JSX.Element | null;
|
|
691
|
+
|
|
692
|
+
export { AgentPresenceLayer, type AgentPresenceLayerProps, AnimationTimeline, type AnimationTimelineProps, type CanvasAnimation, type CanvasArrange, type CanvasAutoLayout, type CanvasComponents, CanvasComponentsPanel, type CanvasComponentsPanelProps, type CanvasGraphTarget, CanvasGuidesLayer, type CanvasGuidesLayerProps, CanvasInstanceInspector, type CanvasInstanceInspectorActions, type CanvasInstanceInspectorProps, type CanvasMeasure, type CanvasScenes, type CanvasTokens, ShapeNode, type ShapeNodeProps, TokenBindingPicker, type TokenBindingPickerProps, TokenModeSwitcher, type TokenModeSwitcherProps, type UseCanvasAnimationOptions, type UseCanvasArrangeOptions, type UseCanvasArrangeShortcutsOptions, type UseCanvasAutoLayoutOptions, type UseCanvasClipboardOptions, type UseCanvasComponentsOptions, type UseCanvasDockingOptions, type UseCanvasGraphOptions, type UseCanvasLayoutOptions, type UseCanvasMeasureOptions, type UseCanvasScenesOptions, type UseCanvasShortcutsOptions, type UseCanvasTokensOptions, type UseStreamingCanvasOptions, useCanvasAnimation, useCanvasArrange, useCanvasArrangeShortcuts, useCanvasAutoLayout, useCanvasClipboard, useCanvasComponents, useCanvasDocking, useCanvasExplosion, useCanvasGraph, useCanvasLayout, useCanvasMeasure, useCanvasScenes, useCanvasShortcuts, useCanvasTokens, useStreamingCanvas };
|