Skip to content

Commit ad9217d

Browse files
committed
Init
0 parents  commit ad9217d

File tree

6 files changed

+45
-0
lines changed

6 files changed

+45
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.nrepl-port
2+
target

mermaid.behaviors

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[
2+
[:app :lt.objs.plugins/load-js "mermaid_compiled.js"]
3+
[:myplugin.hello :lt.plugins.mermaid/on-close-destroy]
4+
]

mermaid_compiled.js

Whitespace-only changes.

plugin.edn

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{:name "mermaid"
2+
:version "0.0.1"
3+
:author ""
4+
:source ""
5+
:desc ""
6+
:behaviors "mermaid.behaviors"}

project.clj

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
(defproject mermaid "0.0.1"
2+
:dependencies [[org.clojure/clojure "1.5.1"]])

src/lt/plugins/mermaid.cljs

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
(ns lt.plugins.mermaid
2+
(:require [lt.object :as object]
3+
[lt.objs.tabs :as tabs]
4+
[lt.objs.command :as cmd])
5+
(:require-macros [lt.macros :refer [defui behavior]]))
6+
7+
(defui hello-panel [this]
8+
[:h1 "Hello from mermaid"])
9+
10+
(object/object* ::mermaid.hello
11+
:tags [:mermaid.hello]
12+
:behaviors [::on-close-destroy]
13+
:name "mermaid"
14+
:init (fn [this]
15+
(hello-panel this)))
16+
17+
(behavior ::on-close-destroy
18+
:triggers #{:close}
19+
:desc "mermaid: Close tab and tabset as well if last tab"
20+
:reaction (fn [this]
21+
(when-let [ts (:lt.objs.tabs/tabset @this)]
22+
(when (= (count (:objs @ts)) 1)
23+
(tabs/rem-tabset ts)))
24+
(object/raise this :destroy)))
25+
26+
(def hello (object/create ::mermaid.hello))
27+
28+
(cmd/command {:command ::say-hello
29+
:desc "mermaid: Say Hello"
30+
:exec (fn []
31+
(tabs/add-or-focus! hello))})

0 commit comments

Comments
 (0)