From 6aad4e63cfe5ec73368f565c03c9aec59423c919 Mon Sep 17 00:00:00 2001 From: Joe Watt Date: Wed, 10 Apr 2024 13:32:52 +0800 Subject: [PATCH] cleanup imports --- src/l4_lp/swipl/js/wasm_query.cljs | 8 ++------ src/l4_lp/web_editor/guifier.cljs | 17 +++++++---------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/l4_lp/swipl/js/wasm_query.cljs b/src/l4_lp/swipl/js/wasm_query.cljs index 83c7bdf..82d65ad 100644 --- a/src/l4_lp/swipl/js/wasm_query.cljs +++ b/src/l4_lp/swipl/js/wasm_query.cljs @@ -4,10 +4,7 @@ [l4-lp.swipl.js.common.swipl-js-to-clj :as swipl-js->clj] [promesa.core :as prom] ["https://SWI-Prolog.github.io/npm-swipl-wasm/3/7/5/dynamic-import.js" - :as swipl-mod])) - -(def ^:private swipl-constructor - (jsi/get swipl-mod :SWIPL)) + :rename {SWIPL Swipl}])) (def ^:private prelude-qlf-url "resources/swipl/prelude.qlf") @@ -18,8 +15,7 @@ ;; TODO: Document and clean up this function. (defn query-and-trace! [program goal] (prom/let - [Swipl swipl-constructor - swipl (Swipl. #js {:arguments #js ["-q"]}) + [swipl (Swipl. #js {:arguments #js ["-q"]}) stack-trace (transient []) diff --git a/src/l4_lp/web_editor/guifier.cljs b/src/l4_lp/web_editor/guifier.cljs index a80d98f..0044995 100644 --- a/src/l4_lp/web_editor/guifier.cljs +++ b/src/l4_lp/web_editor/guifier.cljs @@ -3,19 +3,18 @@ [l4-lp.swipl.js.wasm-query :as swipl-wasm-query] [l4-lp.syntax.l4-to-prolog :as l4->prolog] [promesa.core :as prom] - ["https://cdn.jsdelivr.net/npm/guifier@1.0.24/dist/Guifier.js" - :as guifier-mod])) + ["https://cdn.jsdelivr.net/npm/guifier@1.0.24/dist/Guifier.js$default" + :as Guifier])) -(def ^:private guifier - {:element-id "guifier" - :constructor (jsi/get guifier-mod :default)}) +(def ^:private guifier-element-id + "guifier") (def ^:private query (-> "query" l4->prolog/l4->prolog-str)) (defn query-and-trace-and-guifier! [l4-program] (-> js/document - (jsi/call :getElementById (:element-id guifier)) + (jsi/call :getElementById guifier-element-id) (jsi/assoc! :innerHTML "")) (prom/let @@ -24,11 +23,9 @@ _ (jsi/call js/console :log "Transpiled program: " program) _ (jsi/call js/console :log "Transpiled query: " query) - stack-trace (swipl-wasm-query/query-and-trace-js! program query) - - Guifier (:constructor guifier)] + stack-trace (swipl-wasm-query/query-and-trace-js! program query)] (Guifier. #js {:data stack-trace :dataType "js" - :elementSelector (str "#" (:element-id guifier)) + :elementSelector (str "#" guifier-element-id) :withoutContainer true :readOnlyMode true}))) \ No newline at end of file