@pixerate/editor-react 0.87.0 → 0.89.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 +17 -8
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +23 -8
- package/dist/canvas/index.d.ts +23 -8
- package/dist/canvas/index.js +18 -8
- package/dist/canvas/index.js.map +1 -1
- package/dist/vector/index.cjs +32 -2
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.js +34 -3
- package/dist/vector/index.js.map +1 -1
- package/package.json +3 -3
package/dist/canvas/index.d.cts
CHANGED
|
@@ -2,8 +2,8 @@ import * as React$1 from 'react';
|
|
|
2
2
|
import React__default, { RefObject } 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, CanvasCaptureToolProviderOptions, FreehandTool, FreehandStrokeStyle, FreehandStroke, FreehandPenSample, DrawStrokeInput, DrawStrokeResult, CanvasBrushPreset, FreehandDrawOptions, ShapeDescription, CanvasBrushstrokeImage, AutoLayoutMeasure, CanvasTokenOptions, AnimationHistoryTarget, Clock, AnimationLoopMode, AnimatableProperty, CanvasComponentSyncOptions, CanvasComponentsController, DiagramScene, DiagramLayoutOptions, DiagramSceneTheme, MermaidFlowNode, MermaidFlowEdge, DiagramLayout, DiagramSvgOptions, CanvasEffectsController, CanvasShapeEffect, CanvasEffectsControllerOptions, CanvasEffectsToolProviderOptions } from '@pixerate/editor/canvas';
|
|
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, BrushedPathShape, 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, CanvasBrush, CanvasBrushPaint, CanvasBrushPaintMapping, CanvasBrushPaintStop, CanvasBrushPreset, CanvasBrushSettings, CanvasBrushstroke, CanvasBrushstrokeImage, 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, DrawStrokeInput, DrawStrokeResult, EllipseShape, ExplodeNodeOptions, ExplosionSnapshot, FanOutTrajectoryOptions, FitCubicsOptions, FitPathDataOptions, FlattenOptions, FreehandPenSample, FreehandPointerLike, 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, RenderShapeBrushstrokeOptions, 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, brushstrokeScaleBucket, 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, freehandBrushstroke, getAbsolutePosition, getAnimatableProperty, getAnimatedProperties, getAnimatedValue, getAnimationDuration, getAnimationTrack, getAutoLayout, getAutoLayoutGrid, getAutoLayoutInsertTarget, getBindableTokenProperties, getBrushedShapeSvg, 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, isBrushedShape, isCanvasComponent, isCanvasComponentSet, isCanvasGradient, isCanvasInstance, isCssExportExact, isEventFromTextInput, isKeyframeSelected, isLocked, isMeasureModifierHeld, isNodeAnimated, isShapeDescription, isShapeNode, isStraightCubic, isValidCanvasNode, isValidUrl, layoutAll, layoutBounds, layoutFrame, layoutUp, layoutUpMany, linearPositionTrajectory, linearTrajectory, listCanvasBrushes, listCanvasComponents, loadCanvasBrushstrokeRenderer, 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, pathDataToPolyline, placeBeside, playWebAnimations, pointInBezierPath, pointInMultiPolygon, pointInRings, pointerPenSample, polygonArea, polygonBoolean, polygonToSvgPath, positionToSide, profileAlongPolyline, pruneCanvasTokenModes, pushCanvasInstanceOverrides, readAnimatableValue, readNodeStyleProperty, readStyleSize, realClock, recordAnimationChanges, relayoutUpdates, remapPastedNodes, removeCanvasVariant, removeTrack, renameCanvasVariantProperty, renameCanvasVariantValue, renderShapeBrushstroke, 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, validateCanvasBrush, validateCanvasBrushPaint, withNodeAnimation, withStyleSize, wouldCreateComponentCycle, wrapAnimationTime, writeNodeStyleProperty, xToTime, 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, CanvasCaptureToolProviderOptions, FreehandTool, FreehandStrokeStyle, FreehandStroke, FreehandPenSample, DrawStrokeInput, DrawStrokeResult, CanvasBrushPreset, FreehandDrawOptions, ShapeDescription, CanvasBrushSwatchOptions, CanvasBrushstrokeImage, AutoLayoutMeasure, CanvasTokenOptions, AnimationHistoryTarget, Clock, AnimationLoopMode, AnimatableProperty, CanvasComponentSyncOptions, CanvasComponentsController, DiagramScene, DiagramLayoutOptions, DiagramSceneTheme, MermaidFlowNode, MermaidFlowEdge, DiagramLayout, DiagramSvgOptions, CanvasEffectsController, CanvasShapeEffect, CanvasEffectsControllerOptions, CanvasEffectsToolProviderOptions } from '@pixerate/editor/canvas';
|
|
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, BrushedPathShape, 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, CanvasBrush, CanvasBrushPaint, CanvasBrushPaintMapping, CanvasBrushPaintStop, CanvasBrushPaper, CanvasBrushPreset, CanvasBrushSettings, CanvasBrushSwatchOptions, CanvasBrushstroke, CanvasBrushstrokeImage, 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, DrawStrokeInput, DrawStrokeResult, EllipseShape, ExplodeNodeOptions, ExplosionSnapshot, FanOutTrajectoryOptions, FitCubicsOptions, FitPathDataOptions, FlattenOptions, FreehandPenSample, FreehandPointerLike, 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, RenderShapeBrushstrokeOptions, 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, brushstrokeScaleBucket, brushstrokeSeed, 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, freehandBrushstroke, getAbsolutePosition, getAnimatableProperty, getAnimatedProperties, getAnimatedValue, getAnimationDuration, getAnimationTrack, getAutoLayout, getAutoLayoutGrid, getAutoLayoutInsertTarget, getBindableTokenProperties, getBrushedShapeSvg, 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, isBrushedShape, isCanvasComponent, isCanvasComponentSet, isCanvasGradient, isCanvasInstance, isCssExportExact, isEventFromTextInput, isKeyframeSelected, isLocked, isMeasureModifierHeld, isNodeAnimated, isShapeDescription, isShapeNode, isStraightCubic, isValidCanvasNode, isValidUrl, layoutAll, layoutBounds, layoutFrame, layoutUp, layoutUpMany, linearPositionTrajectory, linearTrajectory, listCanvasBrushes, listCanvasComponents, loadCanvasBrushstrokeRenderer, 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, pathDataToPolyline, placeBeside, playWebAnimations, pointInBezierPath, pointInMultiPolygon, pointInRings, pointerPenSample, polygonArea, polygonBoolean, polygonToSvgPath, positionToSide, profileAlongPolyline, pruneCanvasTokenModes, pushCanvasInstanceOverrides, readAnimatableValue, readNodeStyleProperty, readStyleSize, realClock, recordAnimationChanges, relayoutUpdates, remapPastedNodes, removeCanvasVariant, removeTrack, renameCanvasVariantProperty, renameCanvasVariantValue, renderCanvasBrushSwatch, renderShapeBrushstroke, 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, validateCanvasBrush, validateCanvasBrushPaint, withNodeAnimation, withStyleSize, wouldCreateComponentCycle, wrapAnimationTime, writeNodeStyleProperty, xToTime, xorPolygons } from '@pixerate/editor/canvas';
|
|
7
7
|
import { EffectProvider } from '@pixerate/editor/effects';
|
|
8
8
|
import { AgentToolProvider, ToolRegistry } from '@pixerate/editor/tools';
|
|
9
9
|
import { TokenState, TokenStore, TokenModeContext } from '@pixerate/editor/tokens';
|
|
@@ -441,6 +441,9 @@ interface ShapeNodeProps {
|
|
|
441
441
|
width?: number;
|
|
442
442
|
height?: number;
|
|
443
443
|
selected?: boolean;
|
|
444
|
+
/** Absolute canvas position (React Flow passes it): brushed strokes sample the paper grain there. */
|
|
445
|
+
positionAbsoluteX?: number;
|
|
446
|
+
positionAbsoluteY?: number;
|
|
444
447
|
className?: string;
|
|
445
448
|
/** Rendered over the shape, e.g. React Flow `<Handle>`s or a label. */
|
|
446
449
|
children?: React__default.ReactNode;
|
|
@@ -456,7 +459,7 @@ interface ShapeNodeProps {
|
|
|
456
459
|
* effect (`shape.effect`) is drawn inside the shape or over it when a `<CanvasEffectsProvider>`
|
|
457
460
|
* gives a provider.
|
|
458
461
|
*/
|
|
459
|
-
declare function ShapeNode({ id, data, width, height, selected, className, children }: ShapeNodeProps): React__default.JSX.Element | null;
|
|
462
|
+
declare function ShapeNode({ id, data, width, height, selected, className, children, positionAbsoluteX, positionAbsoluteY }: ShapeNodeProps): React__default.JSX.Element | null;
|
|
460
463
|
|
|
461
464
|
/** The canvas zoom bucket brushed shape nodes render at (1 without a provider). */
|
|
462
465
|
declare const ShapeNodeZoomContext: React__default.Context<number>;
|
|
@@ -472,12 +475,24 @@ declare function ShapeNodeZoomProvider({ zoom, children }: {
|
|
|
472
475
|
/**
|
|
473
476
|
* The image of a brushed shape (`data.shape.brush`) for a node of `width` × `height`, or null
|
|
474
477
|
* while it renders, for unbrushed shapes, and when the brush cannot render (it then logs why).
|
|
475
|
-
* The paint engine loads on the first brushed shape.
|
|
478
|
+
* The paint engine loads on the first brushed shape. `position` is the node's absolute canvas
|
|
479
|
+
* position (React Flow's `positionAbsoluteX` / `positionAbsoluteY`): the paper grain is sampled
|
|
480
|
+
* there, so neighbouring strokes share one sheet of paper.
|
|
476
481
|
*/
|
|
477
|
-
declare function useShapeBrushstroke(shape: ShapeDescription | null | undefined, width?: number, height?: number
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
482
|
+
declare function useShapeBrushstroke(shape: ShapeDescription | null | undefined, width?: number, height?: number, position?: {
|
|
483
|
+
x: number;
|
|
484
|
+
y: number;
|
|
485
|
+
}): CanvasBrushstrokeImage | null;
|
|
486
|
+
/**
|
|
487
|
+
* The dry paint presets a freehand stroke can be brushed with (loads the paint engine on mount);
|
|
488
|
+
* with `swatches`, each with a preview image (`renderCanvasBrushSwatch`) for a brush menu.
|
|
489
|
+
*/
|
|
490
|
+
declare function useCanvasBrushes(options?: {
|
|
491
|
+
swatches?: CanvasBrushSwatchOptions;
|
|
492
|
+
}): {
|
|
493
|
+
brushes: Array<CanvasBrushPreset & {
|
|
494
|
+
swatch?: string;
|
|
495
|
+
}>;
|
|
481
496
|
loading: boolean;
|
|
482
497
|
error: string | null;
|
|
483
498
|
};
|
package/dist/canvas/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import * as React$1 from 'react';
|
|
|
2
2
|
import React__default, { RefObject } 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, CanvasCaptureToolProviderOptions, FreehandTool, FreehandStrokeStyle, FreehandStroke, FreehandPenSample, DrawStrokeInput, DrawStrokeResult, CanvasBrushPreset, FreehandDrawOptions, ShapeDescription, CanvasBrushstrokeImage, AutoLayoutMeasure, CanvasTokenOptions, AnimationHistoryTarget, Clock, AnimationLoopMode, AnimatableProperty, CanvasComponentSyncOptions, CanvasComponentsController, DiagramScene, DiagramLayoutOptions, DiagramSceneTheme, MermaidFlowNode, MermaidFlowEdge, DiagramLayout, DiagramSvgOptions, CanvasEffectsController, CanvasShapeEffect, CanvasEffectsControllerOptions, CanvasEffectsToolProviderOptions } from '@pixerate/editor/canvas';
|
|
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, BrushedPathShape, 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, CanvasBrush, CanvasBrushPaint, CanvasBrushPaintMapping, CanvasBrushPaintStop, CanvasBrushPreset, CanvasBrushSettings, CanvasBrushstroke, CanvasBrushstrokeImage, 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, DrawStrokeInput, DrawStrokeResult, EllipseShape, ExplodeNodeOptions, ExplosionSnapshot, FanOutTrajectoryOptions, FitCubicsOptions, FitPathDataOptions, FlattenOptions, FreehandPenSample, FreehandPointerLike, 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, RenderShapeBrushstrokeOptions, 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, brushstrokeScaleBucket, 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, freehandBrushstroke, getAbsolutePosition, getAnimatableProperty, getAnimatedProperties, getAnimatedValue, getAnimationDuration, getAnimationTrack, getAutoLayout, getAutoLayoutGrid, getAutoLayoutInsertTarget, getBindableTokenProperties, getBrushedShapeSvg, 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, isBrushedShape, isCanvasComponent, isCanvasComponentSet, isCanvasGradient, isCanvasInstance, isCssExportExact, isEventFromTextInput, isKeyframeSelected, isLocked, isMeasureModifierHeld, isNodeAnimated, isShapeDescription, isShapeNode, isStraightCubic, isValidCanvasNode, isValidUrl, layoutAll, layoutBounds, layoutFrame, layoutUp, layoutUpMany, linearPositionTrajectory, linearTrajectory, listCanvasBrushes, listCanvasComponents, loadCanvasBrushstrokeRenderer, 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, pathDataToPolyline, placeBeside, playWebAnimations, pointInBezierPath, pointInMultiPolygon, pointInRings, pointerPenSample, polygonArea, polygonBoolean, polygonToSvgPath, positionToSide, profileAlongPolyline, pruneCanvasTokenModes, pushCanvasInstanceOverrides, readAnimatableValue, readNodeStyleProperty, readStyleSize, realClock, recordAnimationChanges, relayoutUpdates, remapPastedNodes, removeCanvasVariant, removeTrack, renameCanvasVariantProperty, renameCanvasVariantValue, renderShapeBrushstroke, 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, validateCanvasBrush, validateCanvasBrushPaint, withNodeAnimation, withStyleSize, wouldCreateComponentCycle, wrapAnimationTime, writeNodeStyleProperty, xToTime, 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, CanvasCaptureToolProviderOptions, FreehandTool, FreehandStrokeStyle, FreehandStroke, FreehandPenSample, DrawStrokeInput, DrawStrokeResult, CanvasBrushPreset, FreehandDrawOptions, ShapeDescription, CanvasBrushSwatchOptions, CanvasBrushstrokeImage, AutoLayoutMeasure, CanvasTokenOptions, AnimationHistoryTarget, Clock, AnimationLoopMode, AnimatableProperty, CanvasComponentSyncOptions, CanvasComponentsController, DiagramScene, DiagramLayoutOptions, DiagramSceneTheme, MermaidFlowNode, MermaidFlowEdge, DiagramLayout, DiagramSvgOptions, CanvasEffectsController, CanvasShapeEffect, CanvasEffectsControllerOptions, CanvasEffectsToolProviderOptions } from '@pixerate/editor/canvas';
|
|
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, BrushedPathShape, 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, CanvasBrush, CanvasBrushPaint, CanvasBrushPaintMapping, CanvasBrushPaintStop, CanvasBrushPaper, CanvasBrushPreset, CanvasBrushSettings, CanvasBrushSwatchOptions, CanvasBrushstroke, CanvasBrushstrokeImage, 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, DrawStrokeInput, DrawStrokeResult, EllipseShape, ExplodeNodeOptions, ExplosionSnapshot, FanOutTrajectoryOptions, FitCubicsOptions, FitPathDataOptions, FlattenOptions, FreehandPenSample, FreehandPointerLike, 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, RenderShapeBrushstrokeOptions, 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, brushstrokeScaleBucket, brushstrokeSeed, 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, freehandBrushstroke, getAbsolutePosition, getAnimatableProperty, getAnimatedProperties, getAnimatedValue, getAnimationDuration, getAnimationTrack, getAutoLayout, getAutoLayoutGrid, getAutoLayoutInsertTarget, getBindableTokenProperties, getBrushedShapeSvg, 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, isBrushedShape, isCanvasComponent, isCanvasComponentSet, isCanvasGradient, isCanvasInstance, isCssExportExact, isEventFromTextInput, isKeyframeSelected, isLocked, isMeasureModifierHeld, isNodeAnimated, isShapeDescription, isShapeNode, isStraightCubic, isValidCanvasNode, isValidUrl, layoutAll, layoutBounds, layoutFrame, layoutUp, layoutUpMany, linearPositionTrajectory, linearTrajectory, listCanvasBrushes, listCanvasComponents, loadCanvasBrushstrokeRenderer, 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, pathDataToPolyline, placeBeside, playWebAnimations, pointInBezierPath, pointInMultiPolygon, pointInRings, pointerPenSample, polygonArea, polygonBoolean, polygonToSvgPath, positionToSide, profileAlongPolyline, pruneCanvasTokenModes, pushCanvasInstanceOverrides, readAnimatableValue, readNodeStyleProperty, readStyleSize, realClock, recordAnimationChanges, relayoutUpdates, remapPastedNodes, removeCanvasVariant, removeTrack, renameCanvasVariantProperty, renameCanvasVariantValue, renderCanvasBrushSwatch, renderShapeBrushstroke, 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, validateCanvasBrush, validateCanvasBrushPaint, withNodeAnimation, withStyleSize, wouldCreateComponentCycle, wrapAnimationTime, writeNodeStyleProperty, xToTime, xorPolygons } from '@pixerate/editor/canvas';
|
|
7
7
|
import { EffectProvider } from '@pixerate/editor/effects';
|
|
8
8
|
import { AgentToolProvider, ToolRegistry } from '@pixerate/editor/tools';
|
|
9
9
|
import { TokenState, TokenStore, TokenModeContext } from '@pixerate/editor/tokens';
|
|
@@ -441,6 +441,9 @@ interface ShapeNodeProps {
|
|
|
441
441
|
width?: number;
|
|
442
442
|
height?: number;
|
|
443
443
|
selected?: boolean;
|
|
444
|
+
/** Absolute canvas position (React Flow passes it): brushed strokes sample the paper grain there. */
|
|
445
|
+
positionAbsoluteX?: number;
|
|
446
|
+
positionAbsoluteY?: number;
|
|
444
447
|
className?: string;
|
|
445
448
|
/** Rendered over the shape, e.g. React Flow `<Handle>`s or a label. */
|
|
446
449
|
children?: React__default.ReactNode;
|
|
@@ -456,7 +459,7 @@ interface ShapeNodeProps {
|
|
|
456
459
|
* effect (`shape.effect`) is drawn inside the shape or over it when a `<CanvasEffectsProvider>`
|
|
457
460
|
* gives a provider.
|
|
458
461
|
*/
|
|
459
|
-
declare function ShapeNode({ id, data, width, height, selected, className, children }: ShapeNodeProps): React__default.JSX.Element | null;
|
|
462
|
+
declare function ShapeNode({ id, data, width, height, selected, className, children, positionAbsoluteX, positionAbsoluteY }: ShapeNodeProps): React__default.JSX.Element | null;
|
|
460
463
|
|
|
461
464
|
/** The canvas zoom bucket brushed shape nodes render at (1 without a provider). */
|
|
462
465
|
declare const ShapeNodeZoomContext: React__default.Context<number>;
|
|
@@ -472,12 +475,24 @@ declare function ShapeNodeZoomProvider({ zoom, children }: {
|
|
|
472
475
|
/**
|
|
473
476
|
* The image of a brushed shape (`data.shape.brush`) for a node of `width` × `height`, or null
|
|
474
477
|
* while it renders, for unbrushed shapes, and when the brush cannot render (it then logs why).
|
|
475
|
-
* The paint engine loads on the first brushed shape.
|
|
478
|
+
* The paint engine loads on the first brushed shape. `position` is the node's absolute canvas
|
|
479
|
+
* position (React Flow's `positionAbsoluteX` / `positionAbsoluteY`): the paper grain is sampled
|
|
480
|
+
* there, so neighbouring strokes share one sheet of paper.
|
|
476
481
|
*/
|
|
477
|
-
declare function useShapeBrushstroke(shape: ShapeDescription | null | undefined, width?: number, height?: number
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
482
|
+
declare function useShapeBrushstroke(shape: ShapeDescription | null | undefined, width?: number, height?: number, position?: {
|
|
483
|
+
x: number;
|
|
484
|
+
y: number;
|
|
485
|
+
}): CanvasBrushstrokeImage | null;
|
|
486
|
+
/**
|
|
487
|
+
* The dry paint presets a freehand stroke can be brushed with (loads the paint engine on mount);
|
|
488
|
+
* with `swatches`, each with a preview image (`renderCanvasBrushSwatch`) for a brush menu.
|
|
489
|
+
*/
|
|
490
|
+
declare function useCanvasBrushes(options?: {
|
|
491
|
+
swatches?: CanvasBrushSwatchOptions;
|
|
492
|
+
}): {
|
|
493
|
+
brushes: Array<CanvasBrushPreset & {
|
|
494
|
+
swatch?: string;
|
|
495
|
+
}>;
|
|
481
496
|
loading: boolean;
|
|
482
497
|
error: string | null;
|
|
483
498
|
};
|
package/dist/canvas/index.js
CHANGED
|
@@ -1358,6 +1358,7 @@ import {
|
|
|
1358
1358
|
brushstrokeScaleBucket,
|
|
1359
1359
|
isBrushedShape,
|
|
1360
1360
|
listCanvasBrushes,
|
|
1361
|
+
renderCanvasBrushSwatch,
|
|
1361
1362
|
renderShapeBrushstroke
|
|
1362
1363
|
} from "@pixerate/editor/canvas";
|
|
1363
1364
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
@@ -1366,13 +1367,16 @@ function ShapeNodeZoomProvider({ zoom, children }) {
|
|
|
1366
1367
|
const bucket = brushstrokeScaleBucket(zoom);
|
|
1367
1368
|
return /* @__PURE__ */ jsx4(ShapeNodeZoomContext.Provider, { value: bucket, children });
|
|
1368
1369
|
}
|
|
1369
|
-
function useShapeBrushstroke(shape, width, height) {
|
|
1370
|
+
function useShapeBrushstroke(shape, width, height, position) {
|
|
1370
1371
|
const zoom = useContext(ShapeNodeZoomContext);
|
|
1371
1372
|
const brushed = isBrushedShape(shape) ? shape : null;
|
|
1372
1373
|
const vb = brushed?.viewBox;
|
|
1373
1374
|
const nodeScale = vb && width && height && vb[2] > 0 && vb[3] > 0 ? Math.max(width / vb[2], height / vb[3]) : 1;
|
|
1374
1375
|
const dpr = typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1;
|
|
1375
1376
|
const scale = brushstrokeScaleBucket(zoom * nodeScale, dpr);
|
|
1377
|
+
const unit = vb && width && vb[2] > 0 ? width / vb[2] : 1;
|
|
1378
|
+
const ox = Math.round((position?.x ?? 0) - (vb?.[0] ?? 0) * unit);
|
|
1379
|
+
const oy = Math.round((position?.y ?? 0) - (vb?.[1] ?? 0) * unit);
|
|
1376
1380
|
const [image, setImage] = useState6(null);
|
|
1377
1381
|
useEffect7(() => {
|
|
1378
1382
|
if (!brushed) {
|
|
@@ -1380,7 +1384,7 @@ function useShapeBrushstroke(shape, width, height) {
|
|
|
1380
1384
|
return;
|
|
1381
1385
|
}
|
|
1382
1386
|
let live = true;
|
|
1383
|
-
renderShapeBrushstroke(brushed, { scale }).then(
|
|
1387
|
+
renderShapeBrushstroke(brushed, { scale, origin: { x: ox, y: oy }, unit }).then(
|
|
1384
1388
|
(img) => live && setImage(img),
|
|
1385
1389
|
(error) => {
|
|
1386
1390
|
if (!live) return;
|
|
@@ -1391,21 +1395,23 @@ function useShapeBrushstroke(shape, width, height) {
|
|
|
1391
1395
|
return () => {
|
|
1392
1396
|
live = false;
|
|
1393
1397
|
};
|
|
1394
|
-
}, [brushed, scale]);
|
|
1398
|
+
}, [brushed, scale, ox, oy, unit]);
|
|
1395
1399
|
return image;
|
|
1396
1400
|
}
|
|
1397
|
-
function useCanvasBrushes() {
|
|
1401
|
+
function useCanvasBrushes(options = {}) {
|
|
1398
1402
|
const [state, setState] = useState6({ brushes: [], loading: true, error: null });
|
|
1403
|
+
const swatches = options.swatches ? JSON.stringify(options.swatches) : "";
|
|
1399
1404
|
useEffect7(() => {
|
|
1400
1405
|
let live = true;
|
|
1401
|
-
|
|
1406
|
+
const opts = swatches ? JSON.parse(swatches) : null;
|
|
1407
|
+
listCanvasBrushes().then(async (list) => opts ? Promise.all(list.map(async (b) => ({ ...b, swatch: await renderCanvasBrushSwatch(b.id, opts) }))) : list).then(
|
|
1402
1408
|
(brushes) => live && setState({ brushes, loading: false, error: null }),
|
|
1403
1409
|
(error) => live && setState({ brushes: [], loading: false, error: error instanceof Error ? error.message : String(error) })
|
|
1404
1410
|
);
|
|
1405
1411
|
return () => {
|
|
1406
1412
|
live = false;
|
|
1407
1413
|
};
|
|
1408
|
-
}, []);
|
|
1414
|
+
}, [swatches]);
|
|
1409
1415
|
return useMemo6(() => state, [state]);
|
|
1410
1416
|
}
|
|
1411
1417
|
|
|
@@ -1556,9 +1562,9 @@ function CanvasEffectsPanel({ controller, nodeId, shape, sceneId, className = ""
|
|
|
1556
1562
|
|
|
1557
1563
|
// src/canvas/ShapeNode.tsx
|
|
1558
1564
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1559
|
-
function ShapeNode({ id, data, width, height, selected, className = "", children }) {
|
|
1565
|
+
function ShapeNode({ id, data, width, height, selected, className = "", children, positionAbsoluteX, positionAbsoluteY }) {
|
|
1560
1566
|
const shape = data?.shape;
|
|
1561
|
-
const brushImage = useShapeBrushstroke(isShapeDescription2(shape) ? shape : null, width, height);
|
|
1567
|
+
const brushImage = useShapeBrushstroke(isShapeDescription2(shape) ? shape : null, width, height, { x: positionAbsoluteX ?? 0, y: positionAbsoluteY ?? 0 });
|
|
1562
1568
|
if (!isShapeDescription2(shape)) return null;
|
|
1563
1569
|
const render = getShapeRenderData(shape, { width, height }, { id: id || data?.id });
|
|
1564
1570
|
return /* @__PURE__ */ jsxs5(
|
|
@@ -2796,6 +2802,8 @@ import {
|
|
|
2796
2802
|
validateCanvasBrushPaint,
|
|
2797
2803
|
renderShapeBrushstroke as renderShapeBrushstroke2,
|
|
2798
2804
|
getBrushedShapeSvg,
|
|
2805
|
+
renderCanvasBrushSwatch as renderCanvasBrushSwatch2,
|
|
2806
|
+
brushstrokeSeed,
|
|
2799
2807
|
loadCanvasBrushstrokeRenderer,
|
|
2800
2808
|
brushstrokeScaleBucket as brushstrokeScaleBucket2,
|
|
2801
2809
|
pathDataToPolyline,
|
|
@@ -3228,6 +3236,7 @@ export {
|
|
|
3228
3236
|
blendLayout,
|
|
3229
3237
|
boundsOf,
|
|
3230
3238
|
brushstrokeScaleBucket2 as brushstrokeScaleBucket,
|
|
3239
|
+
brushstrokeSeed,
|
|
3231
3240
|
calculateDagreReflowDisplacement,
|
|
3232
3241
|
calculateDirectionalDisplacement2 as calculateDirectionalDisplacement,
|
|
3233
3242
|
canCombineShapeNodes,
|
|
@@ -3432,6 +3441,7 @@ export {
|
|
|
3432
3441
|
removeTrack,
|
|
3433
3442
|
renameCanvasVariantProperty,
|
|
3434
3443
|
renameCanvasVariantValue,
|
|
3444
|
+
renderCanvasBrushSwatch2 as renderCanvasBrushSwatch,
|
|
3435
3445
|
renderShapeBrushstroke2 as renderShapeBrushstroke,
|
|
3436
3446
|
reorderNodes,
|
|
3437
3447
|
repositionNodesTo,
|