Edit this topic

Shape

: shell

: shape

: /modules/core/ui/services/shape.js

: https://github.com/DecentCMS/DecentCMS/blob/master/modules/core/ui/services/shape.js

class: Shape

new Shape(shell)

An API to manipulate shapes.

Param
shell

Shape.place(root, path, shape, order)

Places a shape into the shape tree above a root shape. If shapes along the path don't exist, they are created as anonymous shapes (in other words, zones).

Param Type Description
root object The root shape.
path string The '/'-separated path where the shape must be added.
shape object The shape to add.
order string The dotted order string describing where the shape will be added on the last part of the path.

Shape.meta(shape) ⇒ object

Gets or creates the meta object for a shape.

Returns: object - The meta object for the shape.

Param Type Description
shape object The shape.

Shape.temp(shape) ⇒ object

Gets or creates the temporary storage object for a shape. This is an object that can be used for temporary storage of data that should not be persisted.

Returns: object - The temp object for the shape.

Param Type Description
shape object The shape.

Shape.parseOrder(orderString) ⇒ Array

Parses a dotted path into an array of orders. For example: "1.42.after.1" -> [1, 42, 'after', 1]

Returns: Array - The parsed array of orders.

Param Type Description
orderString string The order string to parse.

Shape.insert(shapes, shape, [order])

Inserts a shape into an array of shapes at the specified order. As a side effect, the parsed order is added as shape.meta.order.

Param Type Description
shapes Array The array of shapes where the shape must be inserted.
shape object The shape to insert.
[order] string The order string.