blob: 70fe417f45757193933c552946af3cd436fa4dcb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
(page "index.html"
(:require [app.rpc :as rpc]
[cljs.pprint :refer [pprint]]
[cljsjs.semantic-ui :as ui]
[Blockly]))
(rpc/init)
(defc= state rpc/state)
(defc= error rpc/error)
(def toolbox
"<xml>
<block type=\"controls_if\"></block>
<block type=\"logic_compare\"></block>
<block type=\"controls_repeat_ext\"></block>
<block type=\"math_number\"></block>
<block type=\"math_arithmetic\"></block>
<block type=\"text\"></block>
<block type=\"text_print\"></block>
</xml>")
(defelem blockly-workspace
[{:keys [options] :as attr} kids]
(let [elem (div (dissoc attr :options) kids)]
(with-init!
(set! (.-workspace elem)
(.inject js/Blockly elem (clj->js options))))
elem))
(html
(head
(link :rel "stylesheet" :type "text/css"
:href "cljsjs/semantic-ui/common/semantic.min.css")
(script :src "blocks_compressed.js")
(script :src "en.js")
(title "Tankputer"))
(body
(h1 "Tankputer")
(textarea :text (cell= (with-out-str (pprint state))))))
;; vim: set expandtab ts=2 sw=2 filetype=clojure :
|