@pixerate/editor-react 0.18.1 → 0.19.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 +5 -1
- package/dist/canvas/index.cjs +209 -7
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +27 -4
- package/dist/canvas/index.d.ts +27 -4
- package/dist/canvas/index.js +209 -7
- package/dist/canvas/index.js.map +1 -1
- package/package.json +2 -2
package/dist/canvas/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ 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
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';
|
|
6
|
+
export { ANIMATABLE_PROPERTIES, ANIMATION_DATA_KEY, ANIMATION_EASING_LABELS, ANIMATION_EASING_PRESETS, ANIMATION_TIME_EPSILON, AUTO_LAYOUT_DATA_KEY, AddCanvasVariantOptions, AlignEdge, AnimatableProperty, AnimateNodeOptions, AnimationDocument, AnimationEasing, AnimationEasingPreset, AnimationEditError, AnimationEditErrorCode, AnimationFrame, AnimationHistoryTarget, AnimationKeyframe, AnimationKeyframeClipboard, AnimationLoopMode, AnimationMotionPath, AnimationOverrides, AnimationPlayer, AnimationPlayerOptions, AnimationPlayerState, AnimationTrack, AnimationValue, AnimationValueType, ArrangeShortcutBinding, AutoLayout, AutoLayoutAlignContent, AutoLayoutAlignCross, AutoLayoutAlignMain, AutoLayoutCellAlign, AutoLayoutChild, AutoLayoutConstraints, AutoLayoutGrid, AutoLayoutGridArea, AutoLayoutGridCell, AutoLayoutGridGeometry, AutoLayoutGridTrack, AutoLayoutHorizontalConstraint, AutoLayoutInsertTarget, AutoLayoutMeasure, AutoLayoutMode, AutoLayoutOptions, AutoLayoutPadding, AutoLayoutSize, AutoLayoutSizing, AutoLayoutSizingPair, AutoLayoutVerticalConstraint, BezierCommand, BezierPath, BezierPathInput, CANVAS_COMPONENT_DRAG_TYPE, CANVAS_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, SetCanvasVariantPropertiesOptions, 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, addCanvasVariant, 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, getNextVariantValues, 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, removeCanvasVariant, removeTrack, renameCanvasVariantProperty, renameCanvasVariantValue, reorderNodes, repositionNodesTo, resetCanvasInstanceOverrides, resizeHandleAxes, 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, 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
7
|
import { TokenState, TokenStore, TokenModeContext } from '@pixerate/editor/tokens';
|
|
8
8
|
|
|
9
9
|
interface AgentPresenceLayerProps {
|
|
@@ -645,6 +645,18 @@ declare function useCanvasComponents<TNode extends CanvasNode = CanvasNode>(opti
|
|
|
645
645
|
setComponentProperty(componentId: string, name: string, def: _pixerate_editor_canvas.CanvasComponentPropertyDef | null, propertyOptions?: {
|
|
646
646
|
newName?: string;
|
|
647
647
|
}): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
648
|
+
addVariant(setId?: string, variantOptions?: Omit<_pixerate_editor_canvas.AddCanvasVariantOptions, keyof CanvasComponentSyncOptions>): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
649
|
+
canAddVariant(setId?: string, variantOptions?: Omit<_pixerate_editor_canvas.AddCanvasVariantOptions, keyof CanvasComponentSyncOptions>): true | string;
|
|
650
|
+
removeVariant(variantId?: string): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
651
|
+
canRemoveVariant(variantId?: string): true | string;
|
|
652
|
+
setVariantProperties(values: Record<string, string>, variantId?: string, variantOptions?: {
|
|
653
|
+
defaultValue?: string;
|
|
654
|
+
}): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
655
|
+
canSetVariantProperties(values?: Record<string, string>, variantId?: string): true | string;
|
|
656
|
+
renameVariantProperty(name: string, newName: string, setId?: string): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
657
|
+
canRenameVariantProperty(name?: string, newName?: string, setId?: string): true | string;
|
|
658
|
+
renameVariantValue(property: string, value: string, newValue: string, setId?: string): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
659
|
+
canRenameVariantValue(property?: string, value?: string, newValue?: string, setId?: string): true | string;
|
|
648
660
|
bindComponentProperty(layerId: string, field: _pixerate_editor_canvas.CanvasComponentPropertyField, name: string | null): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
649
661
|
goToMainComponent(id?: string): string | undefined;
|
|
650
662
|
canGoToMainComponent(id?: string): true | string;
|
|
@@ -657,10 +669,19 @@ declare function useCanvasComponents<TNode extends CanvasNode = CanvasNode>(opti
|
|
|
657
669
|
};
|
|
658
670
|
type CanvasComponents<TNode extends CanvasNode = CanvasNode> = ReturnType<typeof useCanvasComponents<TNode>>;
|
|
659
671
|
|
|
672
|
+
/** The variant-editing actions the components panel runs (a components controller or hook satisfies it). */
|
|
673
|
+
type CanvasComponentsPanelActions = Pick<CanvasComponentsController<any>, 'addVariant' | 'removeVariant' | 'setVariantProperties' | 'renameVariantProperty' | 'renameVariantValue'>;
|
|
660
674
|
interface CanvasComponentsPanelProps<TNode extends CanvasNode = CanvasNode> {
|
|
661
675
|
nodes: TNode[];
|
|
662
676
|
/** Inserts an instance of a component (or a set's default variant); called on click. */
|
|
663
677
|
onInsert: (componentId: string) => void;
|
|
678
|
+
/**
|
|
679
|
+
* Variant editing: with it, sets get "+ Variant" and a properties editor (rename properties
|
|
680
|
+
* and values inline), and variants a menu (also on right click) to edit, duplicate or remove them.
|
|
681
|
+
*/
|
|
682
|
+
components?: CanvasComponentsPanelActions;
|
|
683
|
+
/** Receives refusals (e.g. a duplicate variant combination). */
|
|
684
|
+
onError?: (reason: string) => void;
|
|
664
685
|
/** Show the search field (default `true`). */
|
|
665
686
|
search?: boolean;
|
|
666
687
|
className?: string;
|
|
@@ -668,9 +689,11 @@ interface CanvasComponentsPanelProps<TNode extends CanvasNode = CanvasNode> {
|
|
|
668
689
|
/**
|
|
669
690
|
* Components panel: component sets (with their variants) and lone components. Click one to
|
|
670
691
|
* insert an instance, or drag it onto the canvas (the drag carries the id as
|
|
671
|
-
* `CANVAS_COMPONENT_DRAG_TYPE`; read it with `getCanvasComponentDragId`).
|
|
692
|
+
* `CANVAS_COMPONENT_DRAG_TYPE`; read it with `getCanvasComponentDragId`). With `components`,
|
|
693
|
+
* sets and variants can be edited: "+ Variant", rename properties / values, edit, duplicate or
|
|
694
|
+
* remove a variant.
|
|
672
695
|
*/
|
|
673
|
-
declare function CanvasComponentsPanel<TNode extends CanvasNode = CanvasNode>({ nodes, onInsert, search, className }: CanvasComponentsPanelProps<TNode>): React__default.JSX.Element;
|
|
696
|
+
declare function CanvasComponentsPanel<TNode extends CanvasNode = CanvasNode>({ nodes, onInsert, components, onError, search, className }: CanvasComponentsPanelProps<TNode>): React__default.JSX.Element;
|
|
674
697
|
/** The actions the instance inspector runs (a components controller or hook satisfies it). */
|
|
675
698
|
type CanvasInstanceInspectorActions = Pick<CanvasComponentsController<any>, 'setInstanceProperties' | 'resetOverrides' | 'detachInstance' | 'goToMainComponent' | 'pushOverrides' | 'restoreMainComponent'>;
|
|
676
699
|
interface CanvasInstanceInspectorProps<TNode extends CanvasNode = CanvasNode> {
|
|
@@ -689,4 +712,4 @@ interface CanvasInstanceInspectorProps<TNode extends CanvasNode = CanvasNode> {
|
|
|
689
712
|
*/
|
|
690
713
|
declare function CanvasInstanceInspector<TNode extends CanvasNode = CanvasNode>({ nodes, nodeId, components, onError, className }: CanvasInstanceInspectorProps<TNode>): React__default.JSX.Element | null;
|
|
691
714
|
|
|
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 };
|
|
715
|
+
export { AgentPresenceLayer, type AgentPresenceLayerProps, AnimationTimeline, type AnimationTimelineProps, type CanvasAnimation, type CanvasArrange, type CanvasAutoLayout, type CanvasComponents, CanvasComponentsPanel, type CanvasComponentsPanelActions, 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 };
|
package/dist/canvas/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ 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
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';
|
|
6
|
+
export { ANIMATABLE_PROPERTIES, ANIMATION_DATA_KEY, ANIMATION_EASING_LABELS, ANIMATION_EASING_PRESETS, ANIMATION_TIME_EPSILON, AUTO_LAYOUT_DATA_KEY, AddCanvasVariantOptions, AlignEdge, AnimatableProperty, AnimateNodeOptions, AnimationDocument, AnimationEasing, AnimationEasingPreset, AnimationEditError, AnimationEditErrorCode, AnimationFrame, AnimationHistoryTarget, AnimationKeyframe, AnimationKeyframeClipboard, AnimationLoopMode, AnimationMotionPath, AnimationOverrides, AnimationPlayer, AnimationPlayerOptions, AnimationPlayerState, AnimationTrack, AnimationValue, AnimationValueType, ArrangeShortcutBinding, AutoLayout, AutoLayoutAlignContent, AutoLayoutAlignCross, AutoLayoutAlignMain, AutoLayoutCellAlign, AutoLayoutChild, AutoLayoutConstraints, AutoLayoutGrid, AutoLayoutGridArea, AutoLayoutGridCell, AutoLayoutGridGeometry, AutoLayoutGridTrack, AutoLayoutHorizontalConstraint, AutoLayoutInsertTarget, AutoLayoutMeasure, AutoLayoutMode, AutoLayoutOptions, AutoLayoutPadding, AutoLayoutSize, AutoLayoutSizing, AutoLayoutSizingPair, AutoLayoutVerticalConstraint, BezierCommand, BezierPath, BezierPathInput, CANVAS_COMPONENT_DRAG_TYPE, CANVAS_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, SetCanvasVariantPropertiesOptions, 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, addCanvasVariant, 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, getNextVariantValues, 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, removeCanvasVariant, removeTrack, renameCanvasVariantProperty, renameCanvasVariantValue, reorderNodes, repositionNodesTo, resetCanvasInstanceOverrides, resizeHandleAxes, 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, 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
7
|
import { TokenState, TokenStore, TokenModeContext } from '@pixerate/editor/tokens';
|
|
8
8
|
|
|
9
9
|
interface AgentPresenceLayerProps {
|
|
@@ -645,6 +645,18 @@ declare function useCanvasComponents<TNode extends CanvasNode = CanvasNode>(opti
|
|
|
645
645
|
setComponentProperty(componentId: string, name: string, def: _pixerate_editor_canvas.CanvasComponentPropertyDef | null, propertyOptions?: {
|
|
646
646
|
newName?: string;
|
|
647
647
|
}): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
648
|
+
addVariant(setId?: string, variantOptions?: Omit<_pixerate_editor_canvas.AddCanvasVariantOptions, keyof CanvasComponentSyncOptions>): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
649
|
+
canAddVariant(setId?: string, variantOptions?: Omit<_pixerate_editor_canvas.AddCanvasVariantOptions, keyof CanvasComponentSyncOptions>): true | string;
|
|
650
|
+
removeVariant(variantId?: string): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
651
|
+
canRemoveVariant(variantId?: string): true | string;
|
|
652
|
+
setVariantProperties(values: Record<string, string>, variantId?: string, variantOptions?: {
|
|
653
|
+
defaultValue?: string;
|
|
654
|
+
}): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
655
|
+
canSetVariantProperties(values?: Record<string, string>, variantId?: string): true | string;
|
|
656
|
+
renameVariantProperty(name: string, newName: string, setId?: string): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
657
|
+
canRenameVariantProperty(name?: string, newName?: string, setId?: string): true | string;
|
|
658
|
+
renameVariantValue(property: string, value: string, newValue: string, setId?: string): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
659
|
+
canRenameVariantValue(property?: string, value?: string, newValue?: string, setId?: string): true | string;
|
|
648
660
|
bindComponentProperty(layerId: string, field: _pixerate_editor_canvas.CanvasComponentPropertyField, name: string | null): _pixerate_editor_canvas.CanvasComponentResult<TNode>;
|
|
649
661
|
goToMainComponent(id?: string): string | undefined;
|
|
650
662
|
canGoToMainComponent(id?: string): true | string;
|
|
@@ -657,10 +669,19 @@ declare function useCanvasComponents<TNode extends CanvasNode = CanvasNode>(opti
|
|
|
657
669
|
};
|
|
658
670
|
type CanvasComponents<TNode extends CanvasNode = CanvasNode> = ReturnType<typeof useCanvasComponents<TNode>>;
|
|
659
671
|
|
|
672
|
+
/** The variant-editing actions the components panel runs (a components controller or hook satisfies it). */
|
|
673
|
+
type CanvasComponentsPanelActions = Pick<CanvasComponentsController<any>, 'addVariant' | 'removeVariant' | 'setVariantProperties' | 'renameVariantProperty' | 'renameVariantValue'>;
|
|
660
674
|
interface CanvasComponentsPanelProps<TNode extends CanvasNode = CanvasNode> {
|
|
661
675
|
nodes: TNode[];
|
|
662
676
|
/** Inserts an instance of a component (or a set's default variant); called on click. */
|
|
663
677
|
onInsert: (componentId: string) => void;
|
|
678
|
+
/**
|
|
679
|
+
* Variant editing: with it, sets get "+ Variant" and a properties editor (rename properties
|
|
680
|
+
* and values inline), and variants a menu (also on right click) to edit, duplicate or remove them.
|
|
681
|
+
*/
|
|
682
|
+
components?: CanvasComponentsPanelActions;
|
|
683
|
+
/** Receives refusals (e.g. a duplicate variant combination). */
|
|
684
|
+
onError?: (reason: string) => void;
|
|
664
685
|
/** Show the search field (default `true`). */
|
|
665
686
|
search?: boolean;
|
|
666
687
|
className?: string;
|
|
@@ -668,9 +689,11 @@ interface CanvasComponentsPanelProps<TNode extends CanvasNode = CanvasNode> {
|
|
|
668
689
|
/**
|
|
669
690
|
* Components panel: component sets (with their variants) and lone components. Click one to
|
|
670
691
|
* insert an instance, or drag it onto the canvas (the drag carries the id as
|
|
671
|
-
* `CANVAS_COMPONENT_DRAG_TYPE`; read it with `getCanvasComponentDragId`).
|
|
692
|
+
* `CANVAS_COMPONENT_DRAG_TYPE`; read it with `getCanvasComponentDragId`). With `components`,
|
|
693
|
+
* sets and variants can be edited: "+ Variant", rename properties / values, edit, duplicate or
|
|
694
|
+
* remove a variant.
|
|
672
695
|
*/
|
|
673
|
-
declare function CanvasComponentsPanel<TNode extends CanvasNode = CanvasNode>({ nodes, onInsert, search, className }: CanvasComponentsPanelProps<TNode>): React__default.JSX.Element;
|
|
696
|
+
declare function CanvasComponentsPanel<TNode extends CanvasNode = CanvasNode>({ nodes, onInsert, components, onError, search, className }: CanvasComponentsPanelProps<TNode>): React__default.JSX.Element;
|
|
674
697
|
/** The actions the instance inspector runs (a components controller or hook satisfies it). */
|
|
675
698
|
type CanvasInstanceInspectorActions = Pick<CanvasComponentsController<any>, 'setInstanceProperties' | 'resetOverrides' | 'detachInstance' | 'goToMainComponent' | 'pushOverrides' | 'restoreMainComponent'>;
|
|
676
699
|
interface CanvasInstanceInspectorProps<TNode extends CanvasNode = CanvasNode> {
|
|
@@ -689,4 +712,4 @@ interface CanvasInstanceInspectorProps<TNode extends CanvasNode = CanvasNode> {
|
|
|
689
712
|
*/
|
|
690
713
|
declare function CanvasInstanceInspector<TNode extends CanvasNode = CanvasNode>({ nodes, nodeId, components, onError, className }: CanvasInstanceInspectorProps<TNode>): React__default.JSX.Element | null;
|
|
691
714
|
|
|
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 };
|
|
715
|
+
export { AgentPresenceLayer, type AgentPresenceLayerProps, AnimationTimeline, type AnimationTimelineProps, type CanvasAnimation, type CanvasArrange, type CanvasAutoLayout, type CanvasComponents, CanvasComponentsPanel, type CanvasComponentsPanelActions, 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 };
|
package/dist/canvas/index.js
CHANGED
|
@@ -1901,28 +1901,64 @@ import {
|
|
|
1901
1901
|
listCanvasComponents
|
|
1902
1902
|
} from "@pixerate/editor/canvas";
|
|
1903
1903
|
import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1904
|
+
function InlineField({ value, label, onCommit }) {
|
|
1905
|
+
return /* @__PURE__ */ jsx6(
|
|
1906
|
+
"input",
|
|
1907
|
+
{
|
|
1908
|
+
type: "text",
|
|
1909
|
+
"aria-label": label,
|
|
1910
|
+
defaultValue: value,
|
|
1911
|
+
className: "min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 text-xs",
|
|
1912
|
+
onBlur: (e) => {
|
|
1913
|
+
const next = e.currentTarget.value.trim();
|
|
1914
|
+
if (next && next !== value) onCommit(next);
|
|
1915
|
+
else e.currentTarget.value = value;
|
|
1916
|
+
},
|
|
1917
|
+
onKeyDown: (e) => {
|
|
1918
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
1919
|
+
if (e.key === "Escape") {
|
|
1920
|
+
e.currentTarget.value = value;
|
|
1921
|
+
e.currentTarget.blur();
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
},
|
|
1925
|
+
value
|
|
1926
|
+
);
|
|
1927
|
+
}
|
|
1904
1928
|
function CanvasComponentsPanel({
|
|
1905
1929
|
nodes,
|
|
1906
1930
|
onInsert,
|
|
1931
|
+
components,
|
|
1932
|
+
onError,
|
|
1907
1933
|
search = true,
|
|
1908
1934
|
className = ""
|
|
1909
1935
|
}) {
|
|
1910
1936
|
const [query, setQuery] = useState5("");
|
|
1911
|
-
const
|
|
1937
|
+
const [propsOpen, setPropsOpen] = useState5(null);
|
|
1938
|
+
const [menuFor, setMenuFor] = useState5(null);
|
|
1939
|
+
const [editing, setEditing] = useState5(null);
|
|
1940
|
+
const { components: all, sets } = listCanvasComponents(nodes);
|
|
1912
1941
|
const q = query.trim().toLowerCase();
|
|
1913
1942
|
const match = (name) => !q || name.toLowerCase().includes(q);
|
|
1914
|
-
const lone =
|
|
1943
|
+
const lone = all.filter((c) => !c.setId && match(c.name));
|
|
1915
1944
|
const shownSets = sets.filter((s) => match(s.name) || s.variants.some((v) => match(v.name)));
|
|
1916
|
-
const
|
|
1945
|
+
const report = (result) => {
|
|
1946
|
+
if (result && !result.ok && result.reason) onError?.(result.reason);
|
|
1947
|
+
return !!result?.ok;
|
|
1948
|
+
};
|
|
1949
|
+
const small = "shrink-0 rounded px-1 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-40";
|
|
1950
|
+
const menuItem = "rounded px-2 py-0.5 text-left hover:bg-muted disabled:opacity-40";
|
|
1951
|
+
const item = (id, name, count, extra = {}, onContextMenu) => /* @__PURE__ */ jsxs6(
|
|
1917
1952
|
"button",
|
|
1918
1953
|
{
|
|
1919
1954
|
type: "button",
|
|
1920
1955
|
draggable: true,
|
|
1921
1956
|
"data-component-id": id,
|
|
1922
1957
|
...extra,
|
|
1923
|
-
className: "flex w-full items-center justify-between gap-2 rounded px-2 py-1 text-left text-xs hover:bg-muted",
|
|
1958
|
+
className: "flex w-full min-w-0 items-center justify-between gap-2 rounded px-2 py-1 text-left text-xs hover:bg-muted",
|
|
1924
1959
|
title: `Insert an instance of ${name}`,
|
|
1925
1960
|
onClick: () => onInsert(id),
|
|
1961
|
+
onContextMenu,
|
|
1926
1962
|
onDragStart: (e) => {
|
|
1927
1963
|
e.dataTransfer.setData(CANVAS_COMPONENT_DRAG_TYPE, id);
|
|
1928
1964
|
e.dataTransfer.setData("text/plain", name);
|
|
@@ -1950,11 +1986,165 @@ function CanvasComponentsPanel({
|
|
|
1950
1986
|
}
|
|
1951
1987
|
) : null,
|
|
1952
1988
|
shownSets.map((set) => /* @__PURE__ */ jsxs6("div", { "data-component-set": set.id, className: "flex flex-col", children: [
|
|
1953
|
-
|
|
1954
|
-
|
|
1989
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1", children: [
|
|
1990
|
+
item(set.id, set.name, set.variants.reduce((sum, v) => sum + v.instanceCount, 0), { "data-kind": "set" }),
|
|
1991
|
+
components ? /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
1992
|
+
/* @__PURE__ */ jsx6(
|
|
1993
|
+
"button",
|
|
1994
|
+
{
|
|
1995
|
+
type: "button",
|
|
1996
|
+
className: small,
|
|
1997
|
+
"data-action": "add-variant",
|
|
1998
|
+
"aria-label": `Add a variant to ${set.name}`,
|
|
1999
|
+
title: "Add a variant (duplicates the default variant)",
|
|
2000
|
+
onClick: () => report(components.addVariant(set.id)),
|
|
2001
|
+
children: "+\xA0Variant"
|
|
2002
|
+
}
|
|
2003
|
+
),
|
|
2004
|
+
/* @__PURE__ */ jsx6(
|
|
2005
|
+
"button",
|
|
2006
|
+
{
|
|
2007
|
+
type: "button",
|
|
2008
|
+
className: small,
|
|
2009
|
+
"data-action": "variant-properties",
|
|
2010
|
+
"aria-expanded": propsOpen === set.id,
|
|
2011
|
+
"aria-label": `Edit the variant properties of ${set.name}`,
|
|
2012
|
+
title: "Rename variant properties and values",
|
|
2013
|
+
onClick: () => setPropsOpen(propsOpen === set.id ? null : set.id),
|
|
2014
|
+
children: "\u2699"
|
|
2015
|
+
}
|
|
2016
|
+
)
|
|
2017
|
+
] }) : null
|
|
2018
|
+
] }),
|
|
2019
|
+
components && propsOpen === set.id ? /* @__PURE__ */ jsx6("div", { "data-variant-properties": set.id, className: "ml-3 flex flex-col gap-1 border-l border-border py-1 pl-2", children: set.options.map((option) => /* @__PURE__ */ jsxs6("div", { "data-variant-option": option.name, className: "flex flex-col gap-0.5", children: [
|
|
2020
|
+
/* @__PURE__ */ jsx6(
|
|
2021
|
+
InlineField,
|
|
2022
|
+
{
|
|
2023
|
+
value: option.name,
|
|
2024
|
+
label: `Rename property ${option.name}`,
|
|
2025
|
+
onCommit: (next) => report(components.renameVariantProperty(option.name, next, set.id))
|
|
2026
|
+
}
|
|
2027
|
+
),
|
|
2028
|
+
/* @__PURE__ */ jsx6("div", { className: "ml-2 flex flex-wrap gap-1", children: option.values.map((value) => /* @__PURE__ */ jsx6(
|
|
2029
|
+
InlineField,
|
|
2030
|
+
{
|
|
2031
|
+
value,
|
|
2032
|
+
label: `Rename ${option.name} value ${value}`,
|
|
2033
|
+
onCommit: (next) => report(components.renameVariantValue(option.name, value, next, set.id))
|
|
2034
|
+
},
|
|
2035
|
+
value
|
|
2036
|
+
)) })
|
|
2037
|
+
] }, option.name)) }) : null,
|
|
2038
|
+
/* @__PURE__ */ jsx6("div", { className: "ml-3 flex flex-col border-l border-border pl-1", children: set.variants.map((v) => /* @__PURE__ */ jsxs6("div", { "data-variant-row": v.id, className: "flex flex-col", children: [
|
|
2039
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1", children: [
|
|
2040
|
+
item(
|
|
2041
|
+
v.id,
|
|
2042
|
+
v.name,
|
|
2043
|
+
v.instanceCount,
|
|
2044
|
+
{ "data-kind": "variant" },
|
|
2045
|
+
components ? (e) => {
|
|
2046
|
+
e.preventDefault();
|
|
2047
|
+
setMenuFor(v.id);
|
|
2048
|
+
} : void 0
|
|
2049
|
+
),
|
|
2050
|
+
components ? /* @__PURE__ */ jsx6(
|
|
2051
|
+
"button",
|
|
2052
|
+
{
|
|
2053
|
+
type: "button",
|
|
2054
|
+
className: small,
|
|
2055
|
+
"data-action": "variant-menu",
|
|
2056
|
+
"aria-haspopup": "menu",
|
|
2057
|
+
"aria-expanded": menuFor === v.id,
|
|
2058
|
+
"aria-label": `Variant actions for ${v.name}`,
|
|
2059
|
+
onClick: () => setMenuFor(menuFor === v.id ? null : v.id),
|
|
2060
|
+
children: "\u22EF"
|
|
2061
|
+
}
|
|
2062
|
+
) : null
|
|
2063
|
+
] }),
|
|
2064
|
+
components && menuFor === v.id ? /* @__PURE__ */ jsxs6("div", { role: "menu", "data-variant-menu": v.id, className: "ml-2 flex flex-col rounded border border-border bg-background p-1 shadow", children: [
|
|
2065
|
+
/* @__PURE__ */ jsx6(
|
|
2066
|
+
"button",
|
|
2067
|
+
{
|
|
2068
|
+
type: "button",
|
|
2069
|
+
role: "menuitem",
|
|
2070
|
+
className: menuItem,
|
|
2071
|
+
"data-action": "edit-variant",
|
|
2072
|
+
onClick: () => {
|
|
2073
|
+
setEditing(v.id);
|
|
2074
|
+
setMenuFor(null);
|
|
2075
|
+
},
|
|
2076
|
+
children: "Edit values\u2026"
|
|
2077
|
+
}
|
|
2078
|
+
),
|
|
2079
|
+
/* @__PURE__ */ jsx6(
|
|
2080
|
+
"button",
|
|
2081
|
+
{
|
|
2082
|
+
type: "button",
|
|
2083
|
+
role: "menuitem",
|
|
2084
|
+
className: menuItem,
|
|
2085
|
+
"data-action": "duplicate-variant",
|
|
2086
|
+
onClick: () => {
|
|
2087
|
+
setMenuFor(null);
|
|
2088
|
+
report(components.addVariant(set.id, { from: v.id }));
|
|
2089
|
+
},
|
|
2090
|
+
children: "Duplicate"
|
|
2091
|
+
}
|
|
2092
|
+
),
|
|
2093
|
+
/* @__PURE__ */ jsx6(
|
|
2094
|
+
"button",
|
|
2095
|
+
{
|
|
2096
|
+
type: "button",
|
|
2097
|
+
role: "menuitem",
|
|
2098
|
+
className: menuItem,
|
|
2099
|
+
"data-action": "remove-variant",
|
|
2100
|
+
disabled: set.variants.length < 2,
|
|
2101
|
+
title: set.variants.length < 2 ? "A component set needs at least one variant." : "Its instances switch to the closest variant",
|
|
2102
|
+
onClick: () => {
|
|
2103
|
+
setMenuFor(null);
|
|
2104
|
+
report(components.removeVariant(v.id));
|
|
2105
|
+
},
|
|
2106
|
+
children: "Remove variant"
|
|
2107
|
+
}
|
|
2108
|
+
)
|
|
2109
|
+
] }) : null,
|
|
2110
|
+
components && editing === v.id ? /* @__PURE__ */ jsxs6(
|
|
2111
|
+
"form",
|
|
2112
|
+
{
|
|
2113
|
+
"data-variant-editor": v.id,
|
|
2114
|
+
className: "ml-2 flex flex-col gap-1 py-1",
|
|
2115
|
+
onSubmit: (e) => {
|
|
2116
|
+
e.preventDefault();
|
|
2117
|
+
const values = {};
|
|
2118
|
+
for (const input of e.currentTarget.querySelectorAll("input[data-variant-value]")) {
|
|
2119
|
+
values[input.dataset.variantValue] = input.value;
|
|
2120
|
+
}
|
|
2121
|
+
if (report(components.setVariantProperties(values, v.id))) setEditing(null);
|
|
2122
|
+
},
|
|
2123
|
+
children: [
|
|
2124
|
+
set.options.map((option) => /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-2", children: [
|
|
2125
|
+
/* @__PURE__ */ jsx6("span", { className: "w-16 shrink-0 truncate text-muted-foreground", children: option.name }),
|
|
2126
|
+
/* @__PURE__ */ jsx6(
|
|
2127
|
+
"input",
|
|
2128
|
+
{
|
|
2129
|
+
type: "text",
|
|
2130
|
+
"data-variant-value": option.name,
|
|
2131
|
+
"aria-label": `${option.name} value`,
|
|
2132
|
+
defaultValue: v.variant?.[option.name] ?? "",
|
|
2133
|
+
className: "min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 text-xs"
|
|
2134
|
+
}
|
|
2135
|
+
)
|
|
2136
|
+
] }, option.name)),
|
|
2137
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex gap-1", children: [
|
|
2138
|
+
/* @__PURE__ */ jsx6("button", { type: "submit", className: "rounded border border-border px-2 py-0.5 hover:bg-muted", "data-action": "save-variant", children: "Save" }),
|
|
2139
|
+
/* @__PURE__ */ jsx6("button", { type: "button", className: "rounded px-2 py-0.5 hover:bg-muted", "data-action": "cancel-variant", onClick: () => setEditing(null), children: "Cancel" })
|
|
2140
|
+
] })
|
|
2141
|
+
]
|
|
2142
|
+
}
|
|
2143
|
+
) : null
|
|
2144
|
+
] }, v.id)) })
|
|
1955
2145
|
] }, set.id)),
|
|
1956
2146
|
lone.map((c) => item(c.id, c.name, c.instanceCount, { "data-kind": "component" })),
|
|
1957
|
-
|
|
2147
|
+
all.length === 0 ? /* @__PURE__ */ jsx6("p", { className: "text-muted-foreground", children: "No components yet. Select a frame and choose Create Component." }) : null
|
|
1958
2148
|
] });
|
|
1959
2149
|
}
|
|
1960
2150
|
function CanvasInstanceInspector({
|
|
@@ -2086,6 +2276,12 @@ import {
|
|
|
2086
2276
|
setCanvasComponentProperty,
|
|
2087
2277
|
bindCanvasComponentProperty,
|
|
2088
2278
|
restoreCanvasMainComponent,
|
|
2279
|
+
addCanvasVariant,
|
|
2280
|
+
removeCanvasVariant,
|
|
2281
|
+
setCanvasVariantProperties,
|
|
2282
|
+
renameCanvasVariantProperty,
|
|
2283
|
+
renameCanvasVariantValue,
|
|
2284
|
+
getNextVariantValues,
|
|
2089
2285
|
syncCanvasComponents,
|
|
2090
2286
|
syncCanvasInstance,
|
|
2091
2287
|
syncAllCanvasInstances,
|
|
@@ -2136,6 +2332,7 @@ export {
|
|
|
2136
2332
|
TOKEN_MODES_DATA_KEY,
|
|
2137
2333
|
TokenBindingPicker,
|
|
2138
2334
|
TokenModeSwitcher,
|
|
2335
|
+
addCanvasVariant,
|
|
2139
2336
|
addKeyframesAtTime,
|
|
2140
2337
|
alignNodes,
|
|
2141
2338
|
animateNode,
|
|
@@ -2241,6 +2438,7 @@ export {
|
|
|
2241
2438
|
getLayoutParent,
|
|
2242
2439
|
getLayoutSizing,
|
|
2243
2440
|
getLayoutedNodes2 as getLayoutedNodes,
|
|
2441
|
+
getNextVariantValues,
|
|
2244
2442
|
getNodeAnimation,
|
|
2245
2443
|
getNodeOverrides,
|
|
2246
2444
|
getNodeRect,
|
|
@@ -2339,7 +2537,10 @@ export {
|
|
|
2339
2537
|
recordAnimationChanges,
|
|
2340
2538
|
relayoutUpdates,
|
|
2341
2539
|
remapPastedNodes2 as remapPastedNodes,
|
|
2540
|
+
removeCanvasVariant,
|
|
2342
2541
|
removeTrack,
|
|
2542
|
+
renameCanvasVariantProperty,
|
|
2543
|
+
renameCanvasVariantValue,
|
|
2343
2544
|
reorderNodes,
|
|
2344
2545
|
repositionNodesTo,
|
|
2345
2546
|
resetCanvasInstanceOverrides,
|
|
@@ -2358,6 +2559,7 @@ export {
|
|
|
2358
2559
|
setCanvasComponentProperty,
|
|
2359
2560
|
setCanvasInstanceProperties,
|
|
2360
2561
|
setCanvasTokenMode3 as setCanvasTokenMode,
|
|
2562
|
+
setCanvasVariantProperties,
|
|
2361
2563
|
setKeyframe,
|
|
2362
2564
|
setKeyframeEasing,
|
|
2363
2565
|
setMotionPath,
|