|
108 | 108 | (fn [x] |
109 | 109 | (instance? c x))) |
110 | 110 |
|
111 | | -(defn- desc-of [c-sym] |
112 | | - (fn [desc] |
113 | | - (let [type (:fx/type desc) |
114 | | - id (*type->id* type)] |
115 | | - (if (nil? id) |
116 | | - true |
117 | | - (if-let [of (-> @registry :types id :of)] |
118 | | - (cond |
119 | | - (symbol? of) (isa? (resolve of) (resolve c-sym)) |
120 | | - (keyword? of) (recur (get desc of)) |
121 | | - :else (throw (ex-info (str "Unknown 'instance of' definition: " of) |
122 | | - {:of of}))) |
123 | | - true))))) |
124 | | - |
125 | 111 | (defmulti keyword-prop->spec-form :type) |
| 112 | + |
126 | 113 | (defn prop->spec-form [prop] |
127 | 114 | (let [{:keys [type]} prop] |
128 | 115 | (if (symbol? type) |
|
153 | 140 | (apply register-type! id :spec (make-composite-spec id :req req) :of of (when req |
154 | 141 | [:req req]))) |
155 | 142 |
|
156 | | -(load "definitions") |
| 143 | +(load "dev/definitions") |
157 | 144 |
|
158 | | -(load "extensions") |
| 145 | +(load "dev/extensions") |
159 | 146 |
|
160 | 147 | (defmulti short-keyword-prop-help-string :type) |
161 | 148 | (defmethod short-keyword-prop-help-string :default [{:keys [type]}] |
|
173 | 160 | (str "Instance of:\n" type) |
174 | 161 | (long-keyword-prop-help-syntax prop))) |
175 | 162 |
|
176 | | -(load "help") |
| 163 | +(load "dev/help") |
177 | 164 |
|
178 | 165 | (defn help |
| 166 | + ([] |
| 167 | + (let [ts (->> @registry :types)] |
| 168 | + (println "Available cljfx types:") |
| 169 | + (println |
| 170 | + (str-table |
| 171 | + (->> ts keys (sort-by str)) |
| 172 | + {:label "Cljfx type" :fn identity} |
| 173 | + {:label "Instance class" :fn #(let [of (:of (get ts %))] |
| 174 | + (if (symbol? of) (str of) ""))})))) |
179 | 175 | ([fx-type] |
180 | 176 | (cond |
181 | 177 | (or (keyword? fx-type) (qualified-symbol? fx-type)) |
|
244 | 240 | (println '???)))) |
245 | 241 |
|
246 | 242 | ;; next steps: |
247 | | -;; 1. api for looking up type and prop information: |
248 | | -;; - generic help? |
249 | | -;; 2. dev cljfx type->lifecycle wrapper that validates and contextualizes errors |
| 243 | +;; 1. dev cljfx type->lifecycle wrapper that validates and contextualizes errors |
250 | 244 | ;; in terms of a cljfx component hierarchy |
| 245 | +;; 2. documentation |
| 246 | +;; 3. release on clojars |
251 | 247 | ;; stretch goals |
252 | 248 | ;; 3. ui reference for searching the props/types/etc |
253 | 249 | ;; 4. dev cljfx type->lifecycle wrapper that adds inspector capabilities. |
|
0 commit comments