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

Shape

Kind: global class

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).

Kind: static method of Shape

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.

Kind: static method of 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.

Kind: static method of Shape
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]

Kind: static method of Shape
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.

Kind: static method of Shape

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.

Shape.copy(shape) ⇒ object

Makes a deep clone of a shape, skipping temp properties throughout the tree. Circular references are skipped.

Kind: static method of Shape
Returns: object - The clone of hte shape.

Param Type Description
shape object The shape to clone.