# `Hakushi.Node`
[🔗](https://github.com/hattoriai/hakushi/blob/v0.1.0/lib/hakushi/node.ex#L1)

A node of a canvas: a box at a place, drawn by the `:node` slot of its
`type`.

    %Hakushi.Node{id: "users", type: "table", x: 120, y: 80, data: %{name: "users"}}

  * `id` - a string, unique in the canvas.
  * `type` - the name of the `:node` slot that draws it (`"default"`
    unless set).
  * `x`, `y` - the place of its top left corner, in the canvas's units
    (pixels at 100%).
  * `width`, `height` - its size; `nil` (the default) for the size of its
    content. A node that people resize gets both.
  * `data` - anything of the app's: the slot gets the node, and draws it
    from its data. It stays on the server; the browser has only what the
    slot renders.
  * `locked` - a locked node does not move, resize or go away, in the
    browser or on the server.
  * `parent` - the id of the node it is in (a frame, a group), or `nil`.
    A node moves with its parent and goes with it; people put a node in
    a group by dropping it there, and take it out by dragging it out.
    See [Groups](groups.md).

# `id`

```elixir
@type id() :: String.t()
```

# `t`

```elixir
@type t() :: %Hakushi.Node{
  data: term(),
  height: number() | nil,
  id: id(),
  locked: boolean(),
  parent: id() | nil,
  type: String.t(),
  width: number() | nil,
  x: number(),
  y: number()
}
```

# `new`

```elixir
@spec new(t() | map() | keyword()) :: t()
```

Makes a node of a map or a keyword list: the struct's keys as atoms or
strings. Raises on a node without an id, or with a place that is not a
number.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
