diff --git a/deps.edn b/deps.edn index ec931d3..b380d7d 100644 --- a/deps.edn +++ b/deps.edn @@ -7,7 +7,7 @@ org.clojure/clojure {:mvn/version "1.11.4"} org.clojure/clojurescript {:mvn/version "1.11.132"} org.clojure/core.async {:mvn/version "1.6.681"} - com.fulcrologic/fulcro-devtools-remote {:mvn/version "0.2.4"} + com.fulcrologic/fulcro-devtools-remote {:mvn/version "0.2.5"} com.cognitect/transit-cljs {:mvn/version "0.8.280"}} :aliases {:tool {:extra-paths ["src/client" "src/ui" "src/chrome" "src/electron" "resources"] :extra-deps {com.wsscode/pathom {:mvn/version "2.4.0"} diff --git a/script/release-chrome b/script/release-chrome index e51023a..47cbf7a 100755 --- a/script/release-chrome +++ b/script/release-chrome @@ -5,5 +5,5 @@ mkdir -p releases rm -rf releases/chrome cp -rf shells/chrome releases cd releases/chrome -rm -rf icons.sketch js/extension/cljs-runtime/ js/devtool/manifest.edn manifest.edn js/content-script/cljs-runtime screenshot-* +rm -rf icons.sketch js/extension/cljs-runtime/ js/devtool/cljs-runtime js/devtool/manifest.edn manifest.edn js/content-script/cljs-runtime screenshot-* zip -r ../fulcro-inspect-chrome-$(jq -r '.version' manifest.json).zip * diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 3ae257a..d98c7c3 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -9,7 +9,7 @@ :output-dir "shells/chrome/js/extension" :asset-path "js/extension" :runtime :custom - :modules {:service-worker {:init-fn com.fulcrologic.devtools.chrome.background-worker/init}}} + :modules {:service-worker {:entries [com.fulcrologic.devtools.chrome.background-worker]}}} :chrome-content-script {:target :browser :output-dir "shells/chrome/js/content-script" :asset-path "js/content-script" diff --git a/shells/chrome/manifest.json b/shells/chrome/manifest.json index 89aa524..97a1a97 100644 --- a/shells/chrome/manifest.json +++ b/shells/chrome/manifest.json @@ -37,4 +37,4 @@ "matches":[""], "run_at":"document_idle"}], "manifest_version":3, - "version":"4.0.3"} + "version":"4.0.4"} diff --git a/src/lib/fulcro/inspect/tool.cljc b/src/lib/fulcro/inspect/tool.cljc index db36caa..aa9282d 100644 --- a/src/lib/fulcro/inspect/tool.cljc +++ b/src/lib/fulcro/inspect/tool.cljc @@ -1,7 +1,9 @@ (ns fulcro.inspect.tool (:require + [com.fulcrologic.devtools.common.protocols :as dp] [com.fulcrologic.devtools.common.resolvers :as res] [com.fulcrologic.devtools.common.target :as ct] + [com.fulcrologic.fulcro.inspect.devtool-api :as dapi] [com.fulcrologic.fulcro.inspect.inspect-client :refer [app-uuid db-changed! ilet record-history-entry! state-atom]] [com.fulcrologic.fulcro.inspect.target-impl :refer [apps* handle-inspect-event]] @@ -29,3 +31,10 @@ (record-history-entry! app @state*) (tools/register-tool! app (partial handle-inspect-event tconn)) (add-watch state* id #(db-changed! app %3 %4)))))) + +(defn focus-inspector! [app-or-app-id] + (let [id (if (uuid? app-or-app-id) + app-or-app-id + (:com.fulcrologic.fulcro.application/id app-or-app-id)) + conn (get @tool-connections id)] + (dp/transmit! conn id [(dapi/focus-target {:com.fulcrologic.fulcro.application/id id})]))) diff --git a/src/ui/fulcro/inspect/common.cljs b/src/ui/fulcro/inspect/common.cljs index 85ae47f..0aa7b1a 100644 --- a/src/ui/fulcro/inspect/common.cljs +++ b/src/ui/fulcro/inspect/common.cljs @@ -11,7 +11,7 @@ [com.fulcrologic.fulcro.mutations :as fm] [fulcro.inspect.lib.history :as hist] [fulcro.inspect.lib.local-storage :as storage] - [fulcro.inspect.target-api-impl] + [fulcro.inspect.devtool-api-impl] [fulcro.inspect.ui-parser :as ui-parser] [fulcro.inspect.ui.data-watcher :as data-watcher] [fulcro.inspect.ui.element :as element] diff --git a/src/ui/fulcro/inspect/target_api_impl.cljs b/src/ui/fulcro/inspect/devtool_api_impl.cljs similarity index 80% rename from src/ui/fulcro/inspect/target_api_impl.cljs rename to src/ui/fulcro/inspect/devtool_api_impl.cljs index c51322c..91e5e1b 100644 --- a/src/ui/fulcro/inspect/target_api_impl.cljs +++ b/src/ui/fulcro/inspect/devtool_api_impl.cljs @@ -1,17 +1,18 @@ -(ns fulcro.inspect.target-api-impl +(ns fulcro.inspect.devtool-api-impl (:require [com.fulcrologic.devtools.common.built-in-mutations :as bi] [com.fulcrologic.devtools.common.resolvers :as dres] [com.fulcrologic.fulcro.application :as app] [com.fulcrologic.fulcro.components :as fp] - [com.fulcrologic.fulcro.inspect.devtool-api :as tapi] + [com.fulcrologic.fulcro.inspect.devtool-api :as dapi] [com.wsscode.pathom.connect :as pc] [fulcro.inspect.lib.history :as hist] + [fulcro.inspect.ui.inspector :as inspector] [fulcro.inspect.ui.multi-inspector :as multi-inspector] [fulcro.inspect.ui.network :as network])) (dres/defmutation app-started [{:fulcro/keys [app]} params] - {::pc/sym `tapi/app-started} + {::pc/sym `dapi/app-started} (fp/transact! app `[(fulcro.inspect.common/start-app ~params)]) nil) @@ -26,19 +27,19 @@ (not connected?) (fp/transact! app [(multi-inspector/remove-all-inspectors {})]))) (dres/defmutation send-started [{:fulcro/keys [app]} params] - {::pc/sym `tapi/send-started} + {::pc/sym `dapi/send-started} (fp/transact! app [(network/request-start params)] {:ref [:network-history/id [:x (::app/id params)]]}) nil) (dres/defmutation send-finished [{:fulcro/keys [app]} params] - {::pc/sym `tapi/send-finished} + {::pc/sym `dapi/send-finished} (fp/transact! app [(network/request-finish params)] {:ref [:network-history/id [:x (::app/id params)]]}) nil) (dres/defmutation send-failed [{:fulcro/keys [app]} params] - {::pc/sym `tapi/send-failed} + {::pc/sym `dapi/send-failed} (fp/transact! app [(network/request-finish params)] {:ref [:network-history/id [:x (::app/id params)]]}) nil) @@ -50,12 +51,18 @@ {:ref [:fulcro.inspect.ui.transactions/tx-list-id [:x id]]})) (dres/defmutation optimistic-action [{:fulcro/keys [app]} params] - {::pc/sym `tapi/optimistic-action} + {::pc/sym `dapi/optimistic-action} (new-client-tx app params) nil) (dres/defmutation update-client-db [{:fulcro/keys [app]} {::app/keys [id] :history/keys [version value] :as history-step}] - {::pc/sym `tapi/db-changed} + {::pc/sym `dapi/db-changed} (fp/transact! app [(hist/save-history-step history-step)]) nil) + +(dres/defmutation focus-target [{:fulcro/keys [app]} {::app/keys [id]}] + {::pc/sym `dapi/focus-target} + (when id + (fp/transact! app [(multi-inspector/set-app {::inspector/id [:x id]})])) + nil)