1
1
(in-ns 'cljfx.dev)
2
2
3
- (defn- type->string [fx-type]
4
- (str (or (* type->id* fx-type) fx-type)))
3
+ (defn- type->string [type->id fx-type]
4
+ (str (or (type->id fx-type) fx-type)))
5
5
6
- (defn- re-throw-with-stack [^Throwable ex stack]
6
+ (defn- re-throw-with-stack [type->id ^Throwable ex stack]
7
7
(if (::cause (ex-data ex))
8
8
(throw ex)
9
9
(throw (doto (ex-info
10
10
(str (ex-message ex)
11
11
" \n\n Cljfx component stack:\n "
12
- (->> stack (map type->string) (str/join " \n " ))
12
+ (->> stack
13
+ (map #(type->string type->id %))
14
+ (str/join " \n " ))
13
15
" \n " )
14
16
(with-meta {::cause ex} {:type ::hidden }))
15
17
(.setStackTrace (.getStackTrace ex))))))
62
64
(binding [*type->lifecycle* type->lifecycle
63
65
*type->id* type->id]
64
66
(when-let [explain-data (s/explain-data :cljfx/desc (assoc desc :fx/type fx-type))]
65
- (throw (ex-info (str " Invalid cljfx description of " (type->string fx-type) " type:\n "
67
+ (throw (ex-info (str " Invalid cljfx description of " (type->string type->id fx-type) " type:\n "
66
68
(explain-str explain-data))
67
69
explain-data)))))
68
70
75
77
(try
76
78
(ensure-valid-desc desc fx-type type->lifecycle type->id)
77
79
(lifecycle/create lifecycle desc opts)
78
- (catch Exception ex (re-throw-with-stack ex stack)))))
80
+ (catch Exception ex (re-throw-with-stack type->id ex stack)))))
79
81
(advance [_ component desc opts]
80
82
(let [stack (conj (::stack opts) fx-type)
81
83
opts (assoc opts ::stack stack)]
82
84
(try
83
85
(ensure-valid-desc desc fx-type type->lifecycle type->id)
84
86
(lifecycle/advance lifecycle component desc opts)
85
- (catch Exception ex (re-throw-with-stack ex stack)))))
87
+ (catch Exception ex (re-throw-with-stack type->id ex stack)))))
86
88
(delete [_ component opts]
87
89
(let [stack (conj (::stack opts) fx-type)
88
90
opts (assoc opts ::stack stack)]
89
91
(try
90
92
(lifecycle/delete lifecycle component opts)
91
- (catch Exception ex (re-throw-with-stack ex stack))))))))
93
+ (catch Exception ex (re-throw-with-stack type->id ex stack))))))))
94
+
95
+ ; ; Ensure there is state at top level
96
+ ; ; When root node is found, add listener (F12 by default) to open UI
97
+ ; ; Should be configurable if open by default or wait for root node to add listener (default)
98
+ ; ; inspector view:
99
+ ; ; 1. show tree of components
100
+ ; ; 2. for components, try to show props. by looking up something like :child* :props?
0 commit comments