Clojurescript library/framework for creating different kinds of diagrams. Primarily for use as dependency for cljs apps.
Why cljs library ? I cannot find answer for that question. This decision most likely tightens much potential usage, because when I would have to do some diagraming e.g. in js react or angular or vue based app, I would not consider this library as a dependency, just because it feels not natural to nest cljs in js application context. By design I would say that I support only cljs applications.
So once again, Why cljs ? I think just because I want to keep learning this language, just because I like it, just because it gives me fun to play with it. Still I do not know why I am struggling so hard to make it working. I do not have any hope it will be used by someone.
There is no rationale.
Key functionalities:
Cljs-Relation-Designer is shipped with number of display components acting as building blocks for new shapes. Types of components belonging to particular shape are determining shape features and behaviours. Including new components into primary entities (main shapes) gives more feature, more meaning and power, enabling new behaviours of the entity itself.
E.g.:
You are not restricted to predefined set of features, components, tags, behaviours or data resolvers. All above abstractions can be turned of, or new implementations can be added.
Below there is very basic usage scenario with minimal customisation. Supose You just want to add simple rectangular shape with just a title in the middle of its bounding box.
This is how shape definition looks like:
(defentity basic-rect
{:width 180 :height 150}
(with-layouts (layout ::w/weighted w/weighted-layout))
(with-components context
(component c/entity-shape "body" {:round-x 5 :round-y 5} {}
(layout-hints (match-parent-position) (match-parent-size) (weighted-origin 0 0)) ::w/weighted)
(component c/title "title" {:text "Object with header"} {}
(layout-hints (weighted-position 0.5 0.1) (weighted-origin 0.5 0)) ::w/weighted)
(component c/entity-controls)))
c/entity-shape - is a basic component representing leading appearance for rigid shapes (e.g. for presenting diagram node like uml class, object, bpmn activity or event nodes.)
c/title - is also predefined component for presenting text. This is an alias for c/text component.
c/entity-controls is predefined component-group which enables some behaviours like resizing, making relations.
And this is how to render this entity on DOM element:
(basic-rect app-state {:left 100 :top 100})
where app-state is an application state and options are usually coordinates {:left ... :top ...} relative to enclosing DOM element. app-state must be firstly initialized by project/initialize method.
Copyright © 2018, Wojciech Maka