Skip to content
This repository was archived by the owner on Jan 7, 2026. It is now read-only.

Commit 67e1c49

Browse files
committed
feat(plugin-types): add methods to modify the index for shapes
1 parent 40f69fd commit 67e1c49

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

libs/plugin-types/index.d.ts

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,17 @@ export interface Board extends ShapeBase {
257257
// Container Properties
258258
/**
259259
* The children shapes contained within the board.
260+
* When writing into this property, you can only reorder the shapes, not
261+
* changing the structure. If the new shapes don't match the current shapes
262+
* it will give a validation error.
263+
*
264+
* @example
265+
* ```js
266+
* board.children = board.children.reverse();
267+
* ```
260268
*/
261-
readonly children: Shape[];
269+
children: Shape[];
270+
262271
/**
263272
* Appends a child shape to the board.
264273
* @param child The child shape to append.
@@ -269,6 +278,7 @@ export interface Board extends ShapeBase {
269278
* ```
270279
*/
271280
appendChild(child: Shape): void;
281+
272282
/**
273283
* Inserts a child shape at the specified index within the board.
274284
* @param index The index at which to insert the child shape.
@@ -3475,6 +3485,11 @@ export interface ShapeBase extends PluginData {
34753485
*/
34763486
readonly parent: Shape | null;
34773487

3488+
/**
3489+
* Returns the index of the current shape in the parent
3490+
*/
3491+
readonly parentIndex: number;
3492+
34783493
/**
34793494
* The x-coordinate of the shape's position.
34803495
*/
@@ -3656,6 +3671,16 @@ export interface ShapeBase extends PluginData {
36563671
*/
36573672
readonly layoutCell?: LayoutChildProperties;
36583673

3674+
/**
3675+
* Changes the index inside the parent of the current shape.
3676+
* This method will shift the indexes of the shapes around that position to
3677+
* match the index.
3678+
* If the index is greater than the number of elements it will positioned last.
3679+
*
3680+
* @param index the new index for the shape to be in
3681+
*/
3682+
setParentIndex(index: number): void;
3683+
36593684
/**
36603685
* @return Returns true if the current shape is inside a component instance
36613686
*/
@@ -3761,6 +3786,26 @@ export interface ShapeBase extends PluginData {
37613786
*/
37623787
rotate(angle: number, center?: { x: number; y: number } | null): void;
37633788

3789+
/**
3790+
* Moves the current shape to the front of its siblings
3791+
*/
3792+
bringToFront(): void;
3793+
3794+
/**
3795+
* Moves the current shape one position forward in its list of siblings
3796+
*/
3797+
bringForward(): void;
3798+
3799+
/**
3800+
* Moves the current shape to the back of its siblings
3801+
*/
3802+
sendToBack(): void;
3803+
3804+
/**
3805+
* Moves the current shape one position backwards in its list of siblings
3806+
*/
3807+
sendBackward(): void;
3808+
37643809
/**
37653810
* Generates an export from the current shape.
37663811
*

0 commit comments

Comments
 (0)