@pixerate/editor-react 0.15.0 → 0.17.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 +6 -2
- package/dist/canvas/index.cjs +484 -119
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +122 -3
- package/dist/canvas/index.d.ts +122 -3
- package/dist/canvas/index.js +380 -0
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-I3E4KSA2.js +515 -0
- package/dist/chunk-I3E4KSA2.js.map +1 -0
- package/dist/chunk-JR5ZBDR7.js +2012 -0
- package/dist/chunk-JR5ZBDR7.js.map +1 -0
- package/dist/chunk-XWFU2CSG.js +167 -0
- package/dist/chunk-XWFU2CSG.js.map +1 -0
- package/dist/chunk-ZU54BMDC.js +2128 -0
- package/dist/chunk-ZU54BMDC.js.map +1 -0
- package/dist/generation/index.cjs +525 -0
- package/dist/generation/index.cjs.map +1 -0
- package/dist/generation/index.d.cts +124 -0
- package/dist/generation/index.d.ts +124 -0
- package/dist/generation/index.js +19 -0
- package/dist/generation/index.js.map +1 -0
- package/dist/image-editor/index.cjs +988 -337
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +92 -2
- package/dist/image-editor/index.d.ts +92 -2
- package/dist/image-editor/index.js +17 -3
- package/dist/index.cjs +3628 -754
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +226 -5
- package/dist/index.d.ts +226 -5
- package/dist/index.js +868 -77
- package/dist/index.js.map +1 -1
- package/dist/persistence/index.cjs +191 -0
- package/dist/persistence/index.cjs.map +1 -0
- package/dist/persistence/index.d.cts +77 -0
- package/dist/persistence/index.d.ts +77 -0
- package/dist/persistence/index.js +9 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/spreadsheet/index.cjs +949 -111
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +121 -7
- package/dist/spreadsheet/index.d.ts +121 -7
- package/dist/spreadsheet/index.js +11 -1
- package/dist/tokens/index.cjs +395 -0
- package/dist/tokens/index.cjs.map +1 -0
- package/dist/tokens/index.d.cts +54 -0
- package/dist/tokens/index.d.ts +54 -0
- package/dist/tokens/index.js +375 -0
- package/dist/tokens/index.js.map +1 -0
- package/package.json +26 -2
- package/dist/chunk-LPFZMZ3L.js +0 -1461
- package/dist/chunk-LPFZMZ3L.js.map +0 -1
- package/dist/chunk-QVQYYHJ5.js +0 -1161
- package/dist/chunk-QVQYYHJ5.js.map +0 -1
package/dist/canvas/index.d.cts
CHANGED
|
@@ -2,8 +2,9 @@ import * as React$1 from 'react';
|
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { AgentPresence } from '@pixerate/editor/agent';
|
|
4
4
|
import * as _pixerate_editor_canvas from '@pixerate/editor/canvas';
|
|
5
|
-
import { CanvasNode, CanvasEdge, IncrementalLayoutOptions, XYPosition, GraphDifferences, Rect, CanvasLayoutOptions, Side, PlaceBesideOptions, getCenteredNodePosition, CanvasDockingCallbacks, DockStrategy, ExplodeNodeOptions, CollapseNodeOptions, ExplosionSnapshot, ArrangeHistoryTarget, SnapGuidesOptions, NodeRectOptions, GuideLine, CanvasArrangeAction, ArrangeShortcutBinding, CanvasScenesOptions, CanvasViewport, CanvasScenesStore, CanvasScene, FitViewportOptions, ShapeDescription } from '@pixerate/editor/canvas';
|
|
6
|
-
export { AlignEdge, ArrangeShortcutBinding, CONNECTION_LINE_TYPES, CanvasArrangeAction, CanvasClipboardPayload, CanvasConnectionLineType, CanvasDockingCallbacks, CanvasEdge, CanvasHeightOptions, CanvasLayoutOptions, CanvasNode, CanvasNodeUpdate, CanvasScene, CanvasScenesState, CanvasScenesStore, CanvasViewport, Clock, CollapseNodeOptions, CombineShapeNodesOptions, CombineShapeNodesRefusal, CombineShapeNodesResult, ConnectorSnap, ConnectorSnapTarget, CubicSegment, DEFAULT_ARRANGE_SHORTCUTS, DirectionalDisplacementOptions, DisplacementDirection, DistributeAxis, DistributeMode, DockStrategy, EllipseShape, ExplodeNodeOptions, ExplosionSnapshot, FanOutTrajectoryOptions, FitCubicsOptions, FitPathDataOptions, FlattenOptions, GraphDifferences, GuideIndex, GuideLine, IncrementalLayoutOptions, ManualClock, MeasureGuide, MeasureSelectionOptions, MeasureSelectionResult, MultiPolygon, NodeTransition, PathCommand, PathShape, PlaceBesideOptions, Point, PolygonBooleanOperation, PolygonBooleanOptions, PolygonFillRule, PolygonInput, PolygonOperand, PolygonPiece, PolygonRing, PolygonToPathOptions, PolygonWithHoles, Position, RESIZE_HANDLES, Rect, RectShape, ReflowDisplacementOptions, RegularPolygonShape, ResizeHandle, SHAPE_DATA_KEY, SHAPE_KINDS, SHAPE_NODE_TYPE, SHAPE_OPERATIONS, ShapeDescription, ShapeKind, ShapeNodePolygonOptions, ShapeOperation, ShapePaint, ShapeRenderData, ShapeSize, Side, SizeDimension, SnapGuidesOptions, SnapNodeResizeOptions, SnapNodeResizeResult, SnapResizeOptions, SnapResizeResult, SnapResult, StarShape, TrajectoryFunction, TrajectoryPoint, XYPosition, ZOrderOperation, alignNodes, applyNodeUpdates, applyShapeCombination, blendLayout, boundsOf, calculateDagreReflowDisplacement, calculateDirectionalDisplacement, canCombineShapeNodes, canvasHeight, centerNodes, centre, combineShapeNodes, computeNodesBoundingBox, computeSnapGuides, connectedOnly, createBezierTrajectory, createCanvasScenesStore, createFanOutTrajectory, createGuideIndex, createNodeGuideIndex, cubicPointAt, cubicsToPathData, defaultEasing, distributeNodes, dividePolygons, ensureLayout, estimateCanvasHeight, estimateNodeSize, findConnectorSnap, fitCubicRun, fitCubics, fitFreehandPath, fitPathData, fitViewportToNodes, fitViewportToRect, flattenSvgPath, flowSide, getAbsolutePosition, getCenteredNodePosition, getLayoutedNodes, getNodeRect, getNodeShape, getNodeSize, getResizingNodeRect, getShapeRenderData, getShapeSvg, handlePoint, inferResizeHandle, intersectPolygons, invertNodeUpdates, isEventFromTextInput, isLocked, isMeasureModifierHeld, isShapeDescription, isShapeNode, isStraightCubic, isValidCanvasNode, isValidUrl, layoutBounds, linearPositionTrajectory, linearTrajectory, lockNodes, matchArrangeShortcut, matchSize, measureBetween, measureLabel, measureSelection, measureToLine, multiPolygonArea, multiPolygonBounds, nearestHandlePositions, oppositePosition, overlaps, parseCanvasClipboardData, parseCanvasScenes, parseSvgPath, placeBeside, pointInMultiPolygon, pointInRings, polygonArea, polygonBoolean, polygonToSvgPath, positionToSide, readStyleSize, realClock, remapPastedNodes, reorderNodes, repositionNodesTo, resizeHandleAxes, revertShapeCombination, ringSignedArea, runMultiNodeTransition, serializeCanvasNodes, shapeNodeToPolygon, shapeToPolygon, sideToPosition, simplifyRing, snapNodeDrag, snapNodeResize, snapResize, snapToGrid, subtractPolygons, toggleLockNodes, unionPolygons, unlockNodes, withStyleSize, xorPolygons } from '@pixerate/editor/canvas';
|
|
5
|
+
import { CanvasNode, CanvasEdge, IncrementalLayoutOptions, XYPosition, GraphDifferences, Rect, CanvasLayoutOptions, Side, PlaceBesideOptions, getCenteredNodePosition, CanvasDockingCallbacks, DockStrategy, ExplodeNodeOptions, CollapseNodeOptions, ExplosionSnapshot, ArrangeHistoryTarget, SnapGuidesOptions, NodeRectOptions, AutoLayoutOptions, GuideLine, CanvasArrangeAction, ArrangeShortcutBinding, CanvasScenesOptions, CanvasViewport, CanvasScenesStore, CanvasScene, FitViewportOptions, ShapeDescription, AutoLayoutMeasure, CanvasTokenOptions } from '@pixerate/editor/canvas';
|
|
6
|
+
export { AUTO_LAYOUT_DATA_KEY, AlignEdge, ArrangeShortcutBinding, AutoLayout, AutoLayoutAlignContent, AutoLayoutAlignCross, AutoLayoutAlignMain, AutoLayoutCellAlign, AutoLayoutChild, AutoLayoutConstraints, AutoLayoutGrid, AutoLayoutGridArea, AutoLayoutGridCell, AutoLayoutGridGeometry, AutoLayoutGridTrack, AutoLayoutHorizontalConstraint, AutoLayoutInsertTarget, AutoLayoutMeasure, AutoLayoutMode, AutoLayoutOptions, AutoLayoutPadding, AutoLayoutSize, AutoLayoutSizing, AutoLayoutSizingPair, AutoLayoutVerticalConstraint, BezierCommand, BezierPath, BezierPathInput, CANVAS_TOKEN_PROPERTIES, CHILD_LAYOUT_DATA_KEY, CONNECTION_LINE_TYPES, CanvasArrangeAction, CanvasAutoLayoutController, CanvasAutoLayoutControllerOptions, CanvasClipboardPayload, CanvasConnectionLineType, CanvasDockingCallbacks, CanvasEdge, CanvasHeightOptions, CanvasLayoutOptions, CanvasNode, CanvasNodeUpdate, CanvasScene, CanvasScenesState, CanvasScenesStore, CanvasTokenBindingInfo, CanvasTokenOptions, CanvasTokenProperty, CanvasViewport, Clock, CollapseNodeOptions, CombineShapeNodesOptions, CombineShapeNodesRefusal, CombineShapeNodesResult, ConnectorSnap, ConnectorSnapTarget, CubicSegment, DEFAULT_ARRANGE_SHORTCUTS, DirectionalDisplacementOptions, DisplacementDirection, DistributeAxis, DistributeMode, DividePathsResult, DockStrategy, EllipseShape, ExplodeNodeOptions, ExplosionSnapshot, FanOutTrajectoryOptions, FitCubicsOptions, FitPathDataOptions, FlattenOptions, GraphDifferences, GuideIndex, GuideLine, IncrementalLayoutOptions, ManualClock, MeasureGuide, MeasureSelectionOptions, MeasureSelectionResult, MultiPolygon, NodeTransition, OffsetPathOptions, OffsetShapeNodesOptions, 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, StarShape, StrokeCap, StrokeJoin, TOKEN_BINDINGS_DATA_KEY, TOKEN_MODES_DATA_KEY, TrajectoryFunction, TrajectoryPoint, XYPosition, ZOrderOperation, alignNodes, applyConstraints, applyNodeUpdates, applyShapeCombination, applyShapeReplacement, bezierPathArea, bezierPathBounds, bezierPathLength, bezierPathPointAtLength, bezierPathSignedArea, bezierPathToSvg, bindCanvasToken, blendLayout, boundsOf, calculateDagreReflowDisplacement, calculateDirectionalDisplacement, canCombineShapeNodes, canOffsetShapeNodes, canOutlineShapeNodeStrokes, canvasHeight, centerNodes, centre, clampLayoutSize, combineShapeNodes, computeNodesBoundingBox, computeSnapGuides, connectedOnly, countPathSegments, createBezierTrajectory, createCanvasAutoLayoutController, createCanvasScenesStore, createFanOutTrajectory, createGuideIndex, createNodeGuideIndex, cubicPointAt, cubicsToPathData, dashContours, defaultEasing, detachTokenBindings, distanceToBezierPath, distributeNodes, dividePaths, dividePolygons, ensureLayout, estimateCanvasHeight, estimateNodeSize, excludePaths, findConnectorSnap, fitCubicRun, fitCubics, fitFreehandPath, fitPathData, fitViewportToNodes, fitViewportToRect, flattenSvgPath, flowSide, getAbsolutePosition, getAutoLayout, getAutoLayoutGrid, getAutoLayoutInsertTarget, getBindableTokenProperties, getCanvasTokenProperty, getCenteredNodePosition, getChildLayout, getEffectiveTokenModes, getFlowChildren, getLayoutParent, getLayoutSizing, getLayoutedNodes, getNodeRect, getNodeShape, getNodeSize, getNodeTokenBindings, getNodeTokenModes, getResizingNodeRect, getShapeRenderData, getShapeSvg, getTokenPropertyScope, getTokensForProperty, handlePoint, hasVisibleStroke, inferResizeHandle, inspectNodeTokens, intersectPaths, intersectPolygons, invertNodeUpdates, isAutoLayoutFrame, isEventFromTextInput, isLocked, isMeasureModifierHeld, isShapeDescription, isShapeNode, isStraightCubic, isValidCanvasNode, isValidUrl, layoutAll, layoutBounds, layoutFrame, layoutUp, layoutUpMany, linearPositionTrajectory, linearTrajectory, lockNodes, makeSizingCoherent, matchArrangeShortcut, matchSize, measureBetween, measureLabel, measureSelection, measureToLine, mergeNodeUpdates, moveLayoutChild, multiPolygonArea, multiPolygonBounds, nearestHandlePositions, normalizeBezierPath, offsetPath, offsetShapeNodes, oppositePosition, outlineShapeNodeStrokes, outlineStroke, overlaps, parseCanvasClipboardData, parseCanvasScenes, parseSvgPath, pathBoolean, placeBeside, pointInBezierPath, pointInMultiPolygon, pointInRings, polygonArea, polygonBoolean, polygonToSvgPath, positionToSide, pruneCanvasTokenModes, readNodeStyleProperty, readStyleSize, realClock, relayoutUpdates, remapPastedNodes, reorderNodes, repositionNodesTo, resizeHandleAxes, resolveCanvasTokens, resolvePadding, revertShapeCombination, ringSignedArea, runMultiNodeTransition, serializeCanvasNodes, setCanvasTokenMode, shapeNodeToBezierPath, shapeNodeToPolygon, shapeToBezierPath, shapeToPolygon, sideToPosition, simplifyRing, snapNodeDrag, snapNodeResize, snapResize, snapToGrid, strokeOutlineRings, subtractPaths, subtractPolygons, toBezierPath, toggleLockNodes, transformBezierPath, unionPolygons, unitePaths, unlockNodes, withStyleSize, writeNodeStyleProperty, xorPolygons } from '@pixerate/editor/canvas';
|
|
7
|
+
import { TokenState, TokenStore, TokenModeContext } from '@pixerate/editor/tokens';
|
|
7
8
|
|
|
8
9
|
interface AgentPresenceLayerProps {
|
|
9
10
|
presences: AgentPresence[];
|
|
@@ -164,6 +165,8 @@ interface UseCanvasArrangeOptions<TNode extends CanvasNode = CanvasNode> {
|
|
|
164
165
|
/** Turns drag snapping off (default `true`). */
|
|
165
166
|
snapping?: boolean;
|
|
166
167
|
rectOptions?: NodeRectOptions;
|
|
168
|
+
/** Re-run auto layout around arranged nodes in the same undo step (see `useCanvasAutoLayout`). */
|
|
169
|
+
autoLayout?: boolean | AutoLayoutOptions;
|
|
167
170
|
}
|
|
168
171
|
/**
|
|
169
172
|
* React hook for Freeform-style arrangement on React Flow: align, distribute, make same size,
|
|
@@ -195,6 +198,10 @@ declare function useCanvasArrange<TNode extends CanvasNode = CanvasNode>(options
|
|
|
195
198
|
exclude: (ids?: Iterable<string>, o?: _pixerate_editor_canvas.CombineShapeNodesOptions) => _pixerate_editor_canvas.CombineShapeNodesResult<TNode>;
|
|
196
199
|
divide: (ids?: Iterable<string>, o?: _pixerate_editor_canvas.CombineShapeNodesOptions) => _pixerate_editor_canvas.CombineShapeNodesResult<TNode>;
|
|
197
200
|
canCombineShapes: (ids?: Iterable<string>) => boolean;
|
|
201
|
+
offsetShapes(distance: number, ids?: Iterable<string>, offsetOptions?: _pixerate_editor_canvas.OffsetShapeNodesOptions): _pixerate_editor_canvas.ShapePathEditResult<TNode>;
|
|
202
|
+
canOffsetShapes: (ids?: Iterable<string>) => boolean;
|
|
203
|
+
outlineStroke(ids?: Iterable<string>, outlineOptions?: _pixerate_editor_canvas.OutlineShapeStrokesOptions): _pixerate_editor_canvas.ShapePathEditResult<TNode>;
|
|
204
|
+
canOutlineStroke: (ids?: Iterable<string>) => boolean;
|
|
198
205
|
runAction(action: CanvasArrangeAction): boolean;
|
|
199
206
|
beginDrag(ids?: Iterable<string>): void;
|
|
200
207
|
drag(ids?: Iterable<string>): _pixerate_editor_canvas.SnapNodeDragResult | null;
|
|
@@ -359,4 +366,116 @@ interface ShapeNodeProps {
|
|
|
359
366
|
*/
|
|
360
367
|
declare function ShapeNode({ data, width, height, selected, className, children }: ShapeNodeProps): React__default.JSX.Element | null;
|
|
361
368
|
|
|
362
|
-
|
|
369
|
+
interface UseCanvasAutoLayoutOptions<TNode extends CanvasNode = CanvasNode> {
|
|
370
|
+
nodes: TNode[];
|
|
371
|
+
setNodes: (updater: TNode[] | ((prev: TNode[]) => TNode[])) => void;
|
|
372
|
+
/** When set, the hook's actions (add / remove / resize / reorder / apply) are undoable steps. */
|
|
373
|
+
history?: ArrangeHistoryTarget;
|
|
374
|
+
/** Turns automatic relayout off (`applyAutoLayout` still works). Default `true`. */
|
|
375
|
+
enabled?: boolean;
|
|
376
|
+
/** Reorder flow children by dragging them within their frame (default `true`). */
|
|
377
|
+
dragReorder?: boolean;
|
|
378
|
+
/** Text measuring and size hooks (default: xyflow `measured` sizes). */
|
|
379
|
+
measure?: AutoLayoutMeasure;
|
|
380
|
+
rectOptions?: NodeRectOptions;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* React hook for Figma-style auto layout on React Flow sub-flows. Frames are nodes with
|
|
384
|
+
* `data.layout`; their children (`parentId`) are stacked, wrapped or placed on a grid, with
|
|
385
|
+
* hug / fill / fixed sizing, min / max, padding, alignment and constraints.
|
|
386
|
+
*
|
|
387
|
+
* Pass every `onNodesChange` batch through `noteChanges` before applying it
|
|
388
|
+
* (`onNodesChange={(c) => setNodes((n) => applyNodeChanges(autoLayout.noteChanges(c), n))}`):
|
|
389
|
+
* after the nodes update the hook relayouts frames whose children were measured, resized,
|
|
390
|
+
* added or removed, and turns drags of a flow child inside its frame into a reorder (one
|
|
391
|
+
* undoable step). Render `guides` (the drop marker) with `<CanvasGuidesLayer>`.
|
|
392
|
+
*/
|
|
393
|
+
declare function useCanvasAutoLayout<TNode extends CanvasNode = CanvasNode>(options: UseCanvasAutoLayoutOptions<TNode>): {
|
|
394
|
+
/** Drop marker of the active reorder drag (flow coordinates). */
|
|
395
|
+
guides: GuideLine[];
|
|
396
|
+
hasPending: boolean;
|
|
397
|
+
applyAutoLayout(frameId?: string): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
398
|
+
layoutUpdates(ids: Iterable<string>): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
399
|
+
relayout(ids: Iterable<string>): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
400
|
+
addNode(node: TNode, addOptions?: {
|
|
401
|
+
index?: number;
|
|
402
|
+
}): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
403
|
+
removeNodes(ids: Iterable<string>): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
404
|
+
resizeNode(id: string, size: {
|
|
405
|
+
width?: number;
|
|
406
|
+
height?: number;
|
|
407
|
+
}): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
408
|
+
moveChild(childId: string, index: number): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
409
|
+
getInsertTarget(id: string, point?: _pixerate_editor_canvas.XYPosition): _pixerate_editor_canvas.AutoLayoutInsertTarget | undefined;
|
|
410
|
+
beginReorderDrag(id: string): void;
|
|
411
|
+
dragReorder(id: string, point?: _pixerate_editor_canvas.XYPosition): _pixerate_editor_canvas.AutoLayoutInsertTarget | undefined;
|
|
412
|
+
endReorderDrag(id: string, point?: _pixerate_editor_canvas.XYPosition): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
413
|
+
noteChanges<TChange extends _pixerate_editor_canvas.PositionChangeLike>(changes: TChange[]): TChange[];
|
|
414
|
+
noteRemoved(removed: Iterable<{
|
|
415
|
+
id: string;
|
|
416
|
+
parentId?: string;
|
|
417
|
+
}>): void;
|
|
418
|
+
flush(): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
419
|
+
isFrame: (id: string) => boolean;
|
|
420
|
+
};
|
|
421
|
+
type CanvasAutoLayout = ReturnType<typeof useCanvasAutoLayout>;
|
|
422
|
+
|
|
423
|
+
interface UseCanvasTokensOptions<TNode extends CanvasNode> extends Omit<CanvasTokenOptions, 'modes'> {
|
|
424
|
+
store: TokenStore;
|
|
425
|
+
nodes: TNode[];
|
|
426
|
+
setNodes: (update: TNode[] | ((nodes: TNode[]) => TNode[])) => void;
|
|
427
|
+
/** Modes for nodes without an explicit mode up their tree (e.g. the page's). */
|
|
428
|
+
modes?: TokenModeContext;
|
|
429
|
+
}
|
|
430
|
+
interface CanvasTokens {
|
|
431
|
+
state: TokenState;
|
|
432
|
+
/** Binds (or with `null` unbinds) a property of the nodes; throws `TokenError` when refused. */
|
|
433
|
+
bind: (ids: Iterable<string>, propertyKey: string, variableId: string | null) => void;
|
|
434
|
+
/** Sets (or with `null` clears) an explicit mode on frames / groups; descendants follow. */
|
|
435
|
+
setMode: (ids: Iterable<string>, collectionId: string, modeId: string | null) => void;
|
|
436
|
+
/** The modes a node is in (its own, inherited, then the root `modes`). */
|
|
437
|
+
modesOf: (nodeId: string) => Record<string, string>;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Keeps token-bound node properties resolved: whenever the token store, the nodes or the root
|
|
441
|
+
* modes change, bound values are written into the nodes (only when something changed, so it
|
|
442
|
+
* does not loop). Deleting a variable detaches the nodes bound to it, keeping their values.
|
|
443
|
+
*/
|
|
444
|
+
declare function useCanvasTokens<TNode extends CanvasNode>(options: UseCanvasTokensOptions<TNode>): CanvasTokens;
|
|
445
|
+
|
|
446
|
+
interface TokenBindingPickerProps<TNode extends CanvasNode = CanvasNode> {
|
|
447
|
+
state: TokenState;
|
|
448
|
+
nodes: TNode[];
|
|
449
|
+
/** Nodes to bind (the first one decides which properties are listed). */
|
|
450
|
+
selectedIds: readonly string[];
|
|
451
|
+
/** Receives the nodes with the binding applied and resolved. */
|
|
452
|
+
onChange: (nodes: TNode[]) => void;
|
|
453
|
+
options?: CanvasTokenOptions;
|
|
454
|
+
/** Limit to these property keys (in this order). */
|
|
455
|
+
properties?: readonly string[];
|
|
456
|
+
onError?: (error: Error) => void;
|
|
457
|
+
className?: string;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Inspector rows that bind node properties (fill, stroke, opacity, radius, gap, padding, text
|
|
461
|
+
* colour / size, …) to variables of the right type and scope, showing each resolved value.
|
|
462
|
+
*/
|
|
463
|
+
declare function TokenBindingPicker<TNode extends CanvasNode = CanvasNode>({ state, nodes, selectedIds, onChange, options, properties, onError, className, }: TokenBindingPickerProps<TNode>): React__default.JSX.Element | null;
|
|
464
|
+
interface TokenModeSwitcherProps<TNode extends CanvasNode = CanvasNode> {
|
|
465
|
+
state: TokenState;
|
|
466
|
+
nodes: TNode[];
|
|
467
|
+
/** Frames / groups whose explicit mode is set (the first one's choice is shown). */
|
|
468
|
+
nodeIds: readonly string[];
|
|
469
|
+
onChange: (nodes: TNode[]) => void;
|
|
470
|
+
options?: CanvasTokenOptions;
|
|
471
|
+
/** Show collections with a single mode too (default `false`). */
|
|
472
|
+
showSingleMode?: boolean;
|
|
473
|
+
className?: string;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Per-collection mode pickers for the selected frames: "Auto" (inherit from the parent, then
|
|
477
|
+
* the root modes, then the default mode) or an explicit mode that descendants inherit.
|
|
478
|
+
*/
|
|
479
|
+
declare function TokenModeSwitcher<TNode extends CanvasNode = CanvasNode>({ state, nodes, nodeIds, onChange, options, showSingleMode, className, }: TokenModeSwitcherProps<TNode>): React__default.JSX.Element | null;
|
|
480
|
+
|
|
481
|
+
export { AgentPresenceLayer, type AgentPresenceLayerProps, type CanvasArrange, type CanvasAutoLayout, type CanvasGraphTarget, CanvasGuidesLayer, type CanvasGuidesLayerProps, type CanvasMeasure, type CanvasScenes, type CanvasTokens, ShapeNode, type ShapeNodeProps, TokenBindingPicker, type TokenBindingPickerProps, TokenModeSwitcher, type TokenModeSwitcherProps, type UseCanvasArrangeOptions, type UseCanvasArrangeShortcutsOptions, type UseCanvasAutoLayoutOptions, type UseCanvasClipboardOptions, type UseCanvasDockingOptions, type UseCanvasGraphOptions, type UseCanvasLayoutOptions, type UseCanvasMeasureOptions, type UseCanvasScenesOptions, type UseCanvasShortcutsOptions, type UseCanvasTokensOptions, type UseStreamingCanvasOptions, useCanvasArrange, useCanvasArrangeShortcuts, useCanvasAutoLayout, useCanvasClipboard, useCanvasDocking, useCanvasExplosion, useCanvasGraph, useCanvasLayout, useCanvasMeasure, useCanvasScenes, useCanvasShortcuts, useCanvasTokens, useStreamingCanvas };
|
package/dist/canvas/index.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import * as React$1 from 'react';
|
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { AgentPresence } from '@pixerate/editor/agent';
|
|
4
4
|
import * as _pixerate_editor_canvas from '@pixerate/editor/canvas';
|
|
5
|
-
import { CanvasNode, CanvasEdge, IncrementalLayoutOptions, XYPosition, GraphDifferences, Rect, CanvasLayoutOptions, Side, PlaceBesideOptions, getCenteredNodePosition, CanvasDockingCallbacks, DockStrategy, ExplodeNodeOptions, CollapseNodeOptions, ExplosionSnapshot, ArrangeHistoryTarget, SnapGuidesOptions, NodeRectOptions, GuideLine, CanvasArrangeAction, ArrangeShortcutBinding, CanvasScenesOptions, CanvasViewport, CanvasScenesStore, CanvasScene, FitViewportOptions, ShapeDescription } from '@pixerate/editor/canvas';
|
|
6
|
-
export { AlignEdge, ArrangeShortcutBinding, CONNECTION_LINE_TYPES, CanvasArrangeAction, CanvasClipboardPayload, CanvasConnectionLineType, CanvasDockingCallbacks, CanvasEdge, CanvasHeightOptions, CanvasLayoutOptions, CanvasNode, CanvasNodeUpdate, CanvasScene, CanvasScenesState, CanvasScenesStore, CanvasViewport, Clock, CollapseNodeOptions, CombineShapeNodesOptions, CombineShapeNodesRefusal, CombineShapeNodesResult, ConnectorSnap, ConnectorSnapTarget, CubicSegment, DEFAULT_ARRANGE_SHORTCUTS, DirectionalDisplacementOptions, DisplacementDirection, DistributeAxis, DistributeMode, DockStrategy, EllipseShape, ExplodeNodeOptions, ExplosionSnapshot, FanOutTrajectoryOptions, FitCubicsOptions, FitPathDataOptions, FlattenOptions, GraphDifferences, GuideIndex, GuideLine, IncrementalLayoutOptions, ManualClock, MeasureGuide, MeasureSelectionOptions, MeasureSelectionResult, MultiPolygon, NodeTransition, PathCommand, PathShape, PlaceBesideOptions, Point, PolygonBooleanOperation, PolygonBooleanOptions, PolygonFillRule, PolygonInput, PolygonOperand, PolygonPiece, PolygonRing, PolygonToPathOptions, PolygonWithHoles, Position, RESIZE_HANDLES, Rect, RectShape, ReflowDisplacementOptions, RegularPolygonShape, ResizeHandle, SHAPE_DATA_KEY, SHAPE_KINDS, SHAPE_NODE_TYPE, SHAPE_OPERATIONS, ShapeDescription, ShapeKind, ShapeNodePolygonOptions, ShapeOperation, ShapePaint, ShapeRenderData, ShapeSize, Side, SizeDimension, SnapGuidesOptions, SnapNodeResizeOptions, SnapNodeResizeResult, SnapResizeOptions, SnapResizeResult, SnapResult, StarShape, TrajectoryFunction, TrajectoryPoint, XYPosition, ZOrderOperation, alignNodes, applyNodeUpdates, applyShapeCombination, blendLayout, boundsOf, calculateDagreReflowDisplacement, calculateDirectionalDisplacement, canCombineShapeNodes, canvasHeight, centerNodes, centre, combineShapeNodes, computeNodesBoundingBox, computeSnapGuides, connectedOnly, createBezierTrajectory, createCanvasScenesStore, createFanOutTrajectory, createGuideIndex, createNodeGuideIndex, cubicPointAt, cubicsToPathData, defaultEasing, distributeNodes, dividePolygons, ensureLayout, estimateCanvasHeight, estimateNodeSize, findConnectorSnap, fitCubicRun, fitCubics, fitFreehandPath, fitPathData, fitViewportToNodes, fitViewportToRect, flattenSvgPath, flowSide, getAbsolutePosition, getCenteredNodePosition, getLayoutedNodes, getNodeRect, getNodeShape, getNodeSize, getResizingNodeRect, getShapeRenderData, getShapeSvg, handlePoint, inferResizeHandle, intersectPolygons, invertNodeUpdates, isEventFromTextInput, isLocked, isMeasureModifierHeld, isShapeDescription, isShapeNode, isStraightCubic, isValidCanvasNode, isValidUrl, layoutBounds, linearPositionTrajectory, linearTrajectory, lockNodes, matchArrangeShortcut, matchSize, measureBetween, measureLabel, measureSelection, measureToLine, multiPolygonArea, multiPolygonBounds, nearestHandlePositions, oppositePosition, overlaps, parseCanvasClipboardData, parseCanvasScenes, parseSvgPath, placeBeside, pointInMultiPolygon, pointInRings, polygonArea, polygonBoolean, polygonToSvgPath, positionToSide, readStyleSize, realClock, remapPastedNodes, reorderNodes, repositionNodesTo, resizeHandleAxes, revertShapeCombination, ringSignedArea, runMultiNodeTransition, serializeCanvasNodes, shapeNodeToPolygon, shapeToPolygon, sideToPosition, simplifyRing, snapNodeDrag, snapNodeResize, snapResize, snapToGrid, subtractPolygons, toggleLockNodes, unionPolygons, unlockNodes, withStyleSize, xorPolygons } from '@pixerate/editor/canvas';
|
|
5
|
+
import { CanvasNode, CanvasEdge, IncrementalLayoutOptions, XYPosition, GraphDifferences, Rect, CanvasLayoutOptions, Side, PlaceBesideOptions, getCenteredNodePosition, CanvasDockingCallbacks, DockStrategy, ExplodeNodeOptions, CollapseNodeOptions, ExplosionSnapshot, ArrangeHistoryTarget, SnapGuidesOptions, NodeRectOptions, AutoLayoutOptions, GuideLine, CanvasArrangeAction, ArrangeShortcutBinding, CanvasScenesOptions, CanvasViewport, CanvasScenesStore, CanvasScene, FitViewportOptions, ShapeDescription, AutoLayoutMeasure, CanvasTokenOptions } from '@pixerate/editor/canvas';
|
|
6
|
+
export { AUTO_LAYOUT_DATA_KEY, AlignEdge, ArrangeShortcutBinding, AutoLayout, AutoLayoutAlignContent, AutoLayoutAlignCross, AutoLayoutAlignMain, AutoLayoutCellAlign, AutoLayoutChild, AutoLayoutConstraints, AutoLayoutGrid, AutoLayoutGridArea, AutoLayoutGridCell, AutoLayoutGridGeometry, AutoLayoutGridTrack, AutoLayoutHorizontalConstraint, AutoLayoutInsertTarget, AutoLayoutMeasure, AutoLayoutMode, AutoLayoutOptions, AutoLayoutPadding, AutoLayoutSize, AutoLayoutSizing, AutoLayoutSizingPair, AutoLayoutVerticalConstraint, BezierCommand, BezierPath, BezierPathInput, CANVAS_TOKEN_PROPERTIES, CHILD_LAYOUT_DATA_KEY, CONNECTION_LINE_TYPES, CanvasArrangeAction, CanvasAutoLayoutController, CanvasAutoLayoutControllerOptions, CanvasClipboardPayload, CanvasConnectionLineType, CanvasDockingCallbacks, CanvasEdge, CanvasHeightOptions, CanvasLayoutOptions, CanvasNode, CanvasNodeUpdate, CanvasScene, CanvasScenesState, CanvasScenesStore, CanvasTokenBindingInfo, CanvasTokenOptions, CanvasTokenProperty, CanvasViewport, Clock, CollapseNodeOptions, CombineShapeNodesOptions, CombineShapeNodesRefusal, CombineShapeNodesResult, ConnectorSnap, ConnectorSnapTarget, CubicSegment, DEFAULT_ARRANGE_SHORTCUTS, DirectionalDisplacementOptions, DisplacementDirection, DistributeAxis, DistributeMode, DividePathsResult, DockStrategy, EllipseShape, ExplodeNodeOptions, ExplosionSnapshot, FanOutTrajectoryOptions, FitCubicsOptions, FitPathDataOptions, FlattenOptions, GraphDifferences, GuideIndex, GuideLine, IncrementalLayoutOptions, ManualClock, MeasureGuide, MeasureSelectionOptions, MeasureSelectionResult, MultiPolygon, NodeTransition, OffsetPathOptions, OffsetShapeNodesOptions, 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, StarShape, StrokeCap, StrokeJoin, TOKEN_BINDINGS_DATA_KEY, TOKEN_MODES_DATA_KEY, TrajectoryFunction, TrajectoryPoint, XYPosition, ZOrderOperation, alignNodes, applyConstraints, applyNodeUpdates, applyShapeCombination, applyShapeReplacement, bezierPathArea, bezierPathBounds, bezierPathLength, bezierPathPointAtLength, bezierPathSignedArea, bezierPathToSvg, bindCanvasToken, blendLayout, boundsOf, calculateDagreReflowDisplacement, calculateDirectionalDisplacement, canCombineShapeNodes, canOffsetShapeNodes, canOutlineShapeNodeStrokes, canvasHeight, centerNodes, centre, clampLayoutSize, combineShapeNodes, computeNodesBoundingBox, computeSnapGuides, connectedOnly, countPathSegments, createBezierTrajectory, createCanvasAutoLayoutController, createCanvasScenesStore, createFanOutTrajectory, createGuideIndex, createNodeGuideIndex, cubicPointAt, cubicsToPathData, dashContours, defaultEasing, detachTokenBindings, distanceToBezierPath, distributeNodes, dividePaths, dividePolygons, ensureLayout, estimateCanvasHeight, estimateNodeSize, excludePaths, findConnectorSnap, fitCubicRun, fitCubics, fitFreehandPath, fitPathData, fitViewportToNodes, fitViewportToRect, flattenSvgPath, flowSide, getAbsolutePosition, getAutoLayout, getAutoLayoutGrid, getAutoLayoutInsertTarget, getBindableTokenProperties, getCanvasTokenProperty, getCenteredNodePosition, getChildLayout, getEffectiveTokenModes, getFlowChildren, getLayoutParent, getLayoutSizing, getLayoutedNodes, getNodeRect, getNodeShape, getNodeSize, getNodeTokenBindings, getNodeTokenModes, getResizingNodeRect, getShapeRenderData, getShapeSvg, getTokenPropertyScope, getTokensForProperty, handlePoint, hasVisibleStroke, inferResizeHandle, inspectNodeTokens, intersectPaths, intersectPolygons, invertNodeUpdates, isAutoLayoutFrame, isEventFromTextInput, isLocked, isMeasureModifierHeld, isShapeDescription, isShapeNode, isStraightCubic, isValidCanvasNode, isValidUrl, layoutAll, layoutBounds, layoutFrame, layoutUp, layoutUpMany, linearPositionTrajectory, linearTrajectory, lockNodes, makeSizingCoherent, matchArrangeShortcut, matchSize, measureBetween, measureLabel, measureSelection, measureToLine, mergeNodeUpdates, moveLayoutChild, multiPolygonArea, multiPolygonBounds, nearestHandlePositions, normalizeBezierPath, offsetPath, offsetShapeNodes, oppositePosition, outlineShapeNodeStrokes, outlineStroke, overlaps, parseCanvasClipboardData, parseCanvasScenes, parseSvgPath, pathBoolean, placeBeside, pointInBezierPath, pointInMultiPolygon, pointInRings, polygonArea, polygonBoolean, polygonToSvgPath, positionToSide, pruneCanvasTokenModes, readNodeStyleProperty, readStyleSize, realClock, relayoutUpdates, remapPastedNodes, reorderNodes, repositionNodesTo, resizeHandleAxes, resolveCanvasTokens, resolvePadding, revertShapeCombination, ringSignedArea, runMultiNodeTransition, serializeCanvasNodes, setCanvasTokenMode, shapeNodeToBezierPath, shapeNodeToPolygon, shapeToBezierPath, shapeToPolygon, sideToPosition, simplifyRing, snapNodeDrag, snapNodeResize, snapResize, snapToGrid, strokeOutlineRings, subtractPaths, subtractPolygons, toBezierPath, toggleLockNodes, transformBezierPath, unionPolygons, unitePaths, unlockNodes, withStyleSize, writeNodeStyleProperty, xorPolygons } from '@pixerate/editor/canvas';
|
|
7
|
+
import { TokenState, TokenStore, TokenModeContext } from '@pixerate/editor/tokens';
|
|
7
8
|
|
|
8
9
|
interface AgentPresenceLayerProps {
|
|
9
10
|
presences: AgentPresence[];
|
|
@@ -164,6 +165,8 @@ interface UseCanvasArrangeOptions<TNode extends CanvasNode = CanvasNode> {
|
|
|
164
165
|
/** Turns drag snapping off (default `true`). */
|
|
165
166
|
snapping?: boolean;
|
|
166
167
|
rectOptions?: NodeRectOptions;
|
|
168
|
+
/** Re-run auto layout around arranged nodes in the same undo step (see `useCanvasAutoLayout`). */
|
|
169
|
+
autoLayout?: boolean | AutoLayoutOptions;
|
|
167
170
|
}
|
|
168
171
|
/**
|
|
169
172
|
* React hook for Freeform-style arrangement on React Flow: align, distribute, make same size,
|
|
@@ -195,6 +198,10 @@ declare function useCanvasArrange<TNode extends CanvasNode = CanvasNode>(options
|
|
|
195
198
|
exclude: (ids?: Iterable<string>, o?: _pixerate_editor_canvas.CombineShapeNodesOptions) => _pixerate_editor_canvas.CombineShapeNodesResult<TNode>;
|
|
196
199
|
divide: (ids?: Iterable<string>, o?: _pixerate_editor_canvas.CombineShapeNodesOptions) => _pixerate_editor_canvas.CombineShapeNodesResult<TNode>;
|
|
197
200
|
canCombineShapes: (ids?: Iterable<string>) => boolean;
|
|
201
|
+
offsetShapes(distance: number, ids?: Iterable<string>, offsetOptions?: _pixerate_editor_canvas.OffsetShapeNodesOptions): _pixerate_editor_canvas.ShapePathEditResult<TNode>;
|
|
202
|
+
canOffsetShapes: (ids?: Iterable<string>) => boolean;
|
|
203
|
+
outlineStroke(ids?: Iterable<string>, outlineOptions?: _pixerate_editor_canvas.OutlineShapeStrokesOptions): _pixerate_editor_canvas.ShapePathEditResult<TNode>;
|
|
204
|
+
canOutlineStroke: (ids?: Iterable<string>) => boolean;
|
|
198
205
|
runAction(action: CanvasArrangeAction): boolean;
|
|
199
206
|
beginDrag(ids?: Iterable<string>): void;
|
|
200
207
|
drag(ids?: Iterable<string>): _pixerate_editor_canvas.SnapNodeDragResult | null;
|
|
@@ -359,4 +366,116 @@ interface ShapeNodeProps {
|
|
|
359
366
|
*/
|
|
360
367
|
declare function ShapeNode({ data, width, height, selected, className, children }: ShapeNodeProps): React__default.JSX.Element | null;
|
|
361
368
|
|
|
362
|
-
|
|
369
|
+
interface UseCanvasAutoLayoutOptions<TNode extends CanvasNode = CanvasNode> {
|
|
370
|
+
nodes: TNode[];
|
|
371
|
+
setNodes: (updater: TNode[] | ((prev: TNode[]) => TNode[])) => void;
|
|
372
|
+
/** When set, the hook's actions (add / remove / resize / reorder / apply) are undoable steps. */
|
|
373
|
+
history?: ArrangeHistoryTarget;
|
|
374
|
+
/** Turns automatic relayout off (`applyAutoLayout` still works). Default `true`. */
|
|
375
|
+
enabled?: boolean;
|
|
376
|
+
/** Reorder flow children by dragging them within their frame (default `true`). */
|
|
377
|
+
dragReorder?: boolean;
|
|
378
|
+
/** Text measuring and size hooks (default: xyflow `measured` sizes). */
|
|
379
|
+
measure?: AutoLayoutMeasure;
|
|
380
|
+
rectOptions?: NodeRectOptions;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* React hook for Figma-style auto layout on React Flow sub-flows. Frames are nodes with
|
|
384
|
+
* `data.layout`; their children (`parentId`) are stacked, wrapped or placed on a grid, with
|
|
385
|
+
* hug / fill / fixed sizing, min / max, padding, alignment and constraints.
|
|
386
|
+
*
|
|
387
|
+
* Pass every `onNodesChange` batch through `noteChanges` before applying it
|
|
388
|
+
* (`onNodesChange={(c) => setNodes((n) => applyNodeChanges(autoLayout.noteChanges(c), n))}`):
|
|
389
|
+
* after the nodes update the hook relayouts frames whose children were measured, resized,
|
|
390
|
+
* added or removed, and turns drags of a flow child inside its frame into a reorder (one
|
|
391
|
+
* undoable step). Render `guides` (the drop marker) with `<CanvasGuidesLayer>`.
|
|
392
|
+
*/
|
|
393
|
+
declare function useCanvasAutoLayout<TNode extends CanvasNode = CanvasNode>(options: UseCanvasAutoLayoutOptions<TNode>): {
|
|
394
|
+
/** Drop marker of the active reorder drag (flow coordinates). */
|
|
395
|
+
guides: GuideLine[];
|
|
396
|
+
hasPending: boolean;
|
|
397
|
+
applyAutoLayout(frameId?: string): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
398
|
+
layoutUpdates(ids: Iterable<string>): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
399
|
+
relayout(ids: Iterable<string>): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
400
|
+
addNode(node: TNode, addOptions?: {
|
|
401
|
+
index?: number;
|
|
402
|
+
}): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
403
|
+
removeNodes(ids: Iterable<string>): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
404
|
+
resizeNode(id: string, size: {
|
|
405
|
+
width?: number;
|
|
406
|
+
height?: number;
|
|
407
|
+
}): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
408
|
+
moveChild(childId: string, index: number): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
409
|
+
getInsertTarget(id: string, point?: _pixerate_editor_canvas.XYPosition): _pixerate_editor_canvas.AutoLayoutInsertTarget | undefined;
|
|
410
|
+
beginReorderDrag(id: string): void;
|
|
411
|
+
dragReorder(id: string, point?: _pixerate_editor_canvas.XYPosition): _pixerate_editor_canvas.AutoLayoutInsertTarget | undefined;
|
|
412
|
+
endReorderDrag(id: string, point?: _pixerate_editor_canvas.XYPosition): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
413
|
+
noteChanges<TChange extends _pixerate_editor_canvas.PositionChangeLike>(changes: TChange[]): TChange[];
|
|
414
|
+
noteRemoved(removed: Iterable<{
|
|
415
|
+
id: string;
|
|
416
|
+
parentId?: string;
|
|
417
|
+
}>): void;
|
|
418
|
+
flush(): _pixerate_editor_canvas.CanvasNodeUpdate[];
|
|
419
|
+
isFrame: (id: string) => boolean;
|
|
420
|
+
};
|
|
421
|
+
type CanvasAutoLayout = ReturnType<typeof useCanvasAutoLayout>;
|
|
422
|
+
|
|
423
|
+
interface UseCanvasTokensOptions<TNode extends CanvasNode> extends Omit<CanvasTokenOptions, 'modes'> {
|
|
424
|
+
store: TokenStore;
|
|
425
|
+
nodes: TNode[];
|
|
426
|
+
setNodes: (update: TNode[] | ((nodes: TNode[]) => TNode[])) => void;
|
|
427
|
+
/** Modes for nodes without an explicit mode up their tree (e.g. the page's). */
|
|
428
|
+
modes?: TokenModeContext;
|
|
429
|
+
}
|
|
430
|
+
interface CanvasTokens {
|
|
431
|
+
state: TokenState;
|
|
432
|
+
/** Binds (or with `null` unbinds) a property of the nodes; throws `TokenError` when refused. */
|
|
433
|
+
bind: (ids: Iterable<string>, propertyKey: string, variableId: string | null) => void;
|
|
434
|
+
/** Sets (or with `null` clears) an explicit mode on frames / groups; descendants follow. */
|
|
435
|
+
setMode: (ids: Iterable<string>, collectionId: string, modeId: string | null) => void;
|
|
436
|
+
/** The modes a node is in (its own, inherited, then the root `modes`). */
|
|
437
|
+
modesOf: (nodeId: string) => Record<string, string>;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Keeps token-bound node properties resolved: whenever the token store, the nodes or the root
|
|
441
|
+
* modes change, bound values are written into the nodes (only when something changed, so it
|
|
442
|
+
* does not loop). Deleting a variable detaches the nodes bound to it, keeping their values.
|
|
443
|
+
*/
|
|
444
|
+
declare function useCanvasTokens<TNode extends CanvasNode>(options: UseCanvasTokensOptions<TNode>): CanvasTokens;
|
|
445
|
+
|
|
446
|
+
interface TokenBindingPickerProps<TNode extends CanvasNode = CanvasNode> {
|
|
447
|
+
state: TokenState;
|
|
448
|
+
nodes: TNode[];
|
|
449
|
+
/** Nodes to bind (the first one decides which properties are listed). */
|
|
450
|
+
selectedIds: readonly string[];
|
|
451
|
+
/** Receives the nodes with the binding applied and resolved. */
|
|
452
|
+
onChange: (nodes: TNode[]) => void;
|
|
453
|
+
options?: CanvasTokenOptions;
|
|
454
|
+
/** Limit to these property keys (in this order). */
|
|
455
|
+
properties?: readonly string[];
|
|
456
|
+
onError?: (error: Error) => void;
|
|
457
|
+
className?: string;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Inspector rows that bind node properties (fill, stroke, opacity, radius, gap, padding, text
|
|
461
|
+
* colour / size, …) to variables of the right type and scope, showing each resolved value.
|
|
462
|
+
*/
|
|
463
|
+
declare function TokenBindingPicker<TNode extends CanvasNode = CanvasNode>({ state, nodes, selectedIds, onChange, options, properties, onError, className, }: TokenBindingPickerProps<TNode>): React__default.JSX.Element | null;
|
|
464
|
+
interface TokenModeSwitcherProps<TNode extends CanvasNode = CanvasNode> {
|
|
465
|
+
state: TokenState;
|
|
466
|
+
nodes: TNode[];
|
|
467
|
+
/** Frames / groups whose explicit mode is set (the first one's choice is shown). */
|
|
468
|
+
nodeIds: readonly string[];
|
|
469
|
+
onChange: (nodes: TNode[]) => void;
|
|
470
|
+
options?: CanvasTokenOptions;
|
|
471
|
+
/** Show collections with a single mode too (default `false`). */
|
|
472
|
+
showSingleMode?: boolean;
|
|
473
|
+
className?: string;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Per-collection mode pickers for the selected frames: "Auto" (inherit from the parent, then
|
|
477
|
+
* the root modes, then the default mode) or an explicit mode that descendants inherit.
|
|
478
|
+
*/
|
|
479
|
+
declare function TokenModeSwitcher<TNode extends CanvasNode = CanvasNode>({ state, nodes, nodeIds, onChange, options, showSingleMode, className, }: TokenModeSwitcherProps<TNode>): React__default.JSX.Element | null;
|
|
480
|
+
|
|
481
|
+
export { AgentPresenceLayer, type AgentPresenceLayerProps, type CanvasArrange, type CanvasAutoLayout, type CanvasGraphTarget, CanvasGuidesLayer, type CanvasGuidesLayerProps, type CanvasMeasure, type CanvasScenes, type CanvasTokens, ShapeNode, type ShapeNodeProps, TokenBindingPicker, type TokenBindingPickerProps, TokenModeSwitcher, type TokenModeSwitcherProps, type UseCanvasArrangeOptions, type UseCanvasArrangeShortcutsOptions, type UseCanvasAutoLayoutOptions, type UseCanvasClipboardOptions, type UseCanvasDockingOptions, type UseCanvasGraphOptions, type UseCanvasLayoutOptions, type UseCanvasMeasureOptions, type UseCanvasScenesOptions, type UseCanvasShortcutsOptions, type UseCanvasTokensOptions, type UseStreamingCanvasOptions, useCanvasArrange, useCanvasArrangeShortcuts, useCanvasAutoLayout, useCanvasClipboard, useCanvasDocking, useCanvasExplosion, useCanvasGraph, useCanvasLayout, useCanvasMeasure, useCanvasScenes, useCanvasShortcuts, useCanvasTokens, useStreamingCanvas };
|