voytech / cljs-diagrams

A clojurescript relational desinger tool.
2 stars 1 forks source link

Redesign DSL #47

Closed voytech closed 5 years ago

voytech commented 6 years ago

DSL should be much more intuitive than it is now. E.g. It should be possible not only to reuse existing designer components within entities and attributes, but also You should be able to define new attributes, components within defentity macro. Code is less scattered then.

voytech commented 5 years ago

Api should be like this:

(defentity rectangle-node
  (with-layouts
    (layout :attributes l/default-flow-layout #(-> % :attributes vals) {:left 15 :top 15}))
  (with-components data options
      [(c/main % "body" {:round-x 5 :round-y 5}))
       (c/control % "connector-left" {:side :left})
       (c/control % "connector-right" {:side :right})
       (c/control % "connector-top" {:side :top})
       (c/control % "connector-bottom" {:side :bottom})])
  (with-attributes [#(stdatr/name % "<Enter name here>")
                    #(stdatr/description % "<Enter descrition here>")
                    #(stdatr/state % :open)]))