-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial support for Fulcro Only few namespaces are exposed so far, but it is already possible to render a trivial defsc component to a dom element. FIXME: Tests currently don't run due to problems with accessing `js/ReactDOMServer` * Dev support - shadow-powered dev repl Add :dev profile to deps, and shadow-cljs config to build the code and serve a page with it. The entrypoint is `dev/development.cljs`. See Readme. This makes it easy to interactively develop and test SCI configs. * Replace ana/error with a fn, not to bloat output size
- Loading branch information
Showing
30 changed files
with
931 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,6 @@ | |
.cpcache | ||
cljs-test-runner-out | ||
node_modules | ||
www/js/ | ||
.calva/ | ||
.portal/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
{:tasks | ||
{cljs-repl (shell "clj -M:test -m cljs.main -re node") | ||
test (clojure "-M:test:cljs-test-runner") | ||
test:advanced (clojure "-M:test:cljs-test-runner:cljs-test-runner-advanced")}} | ||
test:advanced (clojure "-M:test:cljs-test-runner:cljs-test-runner-advanced") | ||
dev (clojure "-M:test:dev:shadow-cli watch dev") | ||
dev:release (clojure "-M:test:dev:shadow-cli release dev") | ||
dev:release:debug (clojure "-M:test:dev:shadow-cli release dev --debug")}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(ns development | ||
"Entry point for code loaded by shadow-cljs" | ||
(:require | ||
[sci.core :as sci] | ||
[sci.configs.fulcro.fulcro :as fulcro-config])) | ||
|
||
;; Necessary to avoid the error 'Attempting to call unbound fn: #'clojure.core/*print-fn*' | ||
;; when calling `println` inside the evaluated code | ||
(enable-console-print!) | ||
(sci/alter-var-root sci/print-fn (constantly *print-fn*)) | ||
(sci/alter-var-root sci/print-err-fn (constantly *print-err-fn*)) | ||
|
||
(def full-ctx (doto (sci/init {}) | ||
(sci/merge-opts fulcro-config/config))) | ||
|
||
(defn init [] | ||
(println "Init run")) | ||
|
||
(defn reload [] | ||
(println "Reload run")) | ||
|
||
(comment | ||
(sci/eval-string* (sci/init {}) "(+ 1 2)") | ||
|
||
(sci/eval-string* full-ctx " | ||
(ns test1 | ||
(:require | ||
[com.fulcrologic.fulcro.algorithms.denormalize :as fdn] | ||
[com.fulcrologic.fulcro.application :as app] | ||
[com.fulcrologic.fulcro.components :as comp :refer [defsc]] | ||
[com.fulcrologic.fulcro.dom :as dom])) | ||
(defsc Root [this props] (dom/h3 \"Hello from Fulcro!\")) | ||
(defn build-ui-tree [] | ||
(let [client-db (comp/get-initial-state Root {})] | ||
(fdn/db->tree (comp/get-query Root client-db) client-db client-db))) | ||
(comp/with-parent-context (app/fulcro-app) | ||
(dom/render-to-str ((comp/factory Root) (build-ui-tree)))) | ||
") | ||
,) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{:deps {:aliases [:test :dev]} | ||
:nrepl {:port 9000} | ||
:dev-http {8081 "www"} | ||
:builds {:dev {:compiler-options {:output-feature-set :es8 | ||
:optimizations :advanced | ||
:source-map true | ||
:output-wrapper false} | ||
:target :browser | ||
:output-dir "www/js/dev" | ||
:asset-path "/js/dev" | ||
:modules {:dev {:init-fn development/init}} | ||
:devtools {:after-load development/reload}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(ns sci.configs.fulcro.algorithms.data-targeting | ||
(:require [sci.core :as sci] | ||
[com.fulcrologic.fulcro.algorithms.data-targeting])) | ||
|
||
(def sci-ns (sci/create-ns 'com.fulcrologic.fulcro.algorithms.data-targeting)) | ||
(def ns-def (sci/copy-ns com.fulcrologic.fulcro.algorithms.data-targeting sci-ns)) | ||
|
||
(def namespaces {'com.fulcrologic.fulcro.algorithms.data-targeting ns-def}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(ns sci.configs.fulcro.algorithms.denormalize | ||
(:require | ||
[sci.core :as sci] | ||
com.fulcrologic.fulcro.algorithms.denormalize)) | ||
|
||
(def sci-ns (sci/create-ns 'com.fulcrologic.fulcro.algorithms.denormalize)) | ||
(def ns-def (sci/copy-ns com.fulcrologic.fulcro.algorithms.denormalize sci-ns)) | ||
|
||
(def namespaces {'com.fulcrologic.fulcro.algorithms.denormalize ns-def}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(ns sci.configs.fulcro.algorithms.form-state | ||
(:require [sci.core :as sci] | ||
com.fulcrologic.fulcro.algorithms.form-state)) | ||
|
||
(def sci-ns (sci/create-ns 'com.fulcrologic.fulcro.algorithms.form-state)) | ||
(def ns-def (sci/copy-ns com.fulcrologic.fulcro.algorithms.form-state sci-ns)) | ||
|
||
(def namespaces {'com.fulcrologic.fulcro.algorithms.form-state ns-def}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(ns sci.configs.fulcro.algorithms.lookup | ||
(:require [sci.core :as sci] | ||
com.fulcrologic.fulcro.algorithms.lookup)) | ||
|
||
|
||
(def sci-ns (sci/create-ns 'com.fulcrologic.fulcro.algorithms.lookup)) | ||
(def ns-def (sci/copy-ns com.fulcrologic.fulcro.algorithms.lookup sci-ns)) | ||
|
||
(def namespaces {'com.fulcrologic.fulcro.algorithms.lookup ns-def}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(ns sci.configs.fulcro.algorithms.merge | ||
(:require | ||
[sci.core :as sci] | ||
com.fulcrologic.fulcro.algorithms.merge)) | ||
|
||
(def sci-ns (sci/create-ns 'com.fulcrologic.fulcro.algorithms.merge)) | ||
(def ns-def (sci/copy-ns com.fulcrologic.fulcro.algorithms.merge sci-ns)) | ||
|
||
(def namespaces {'com.fulcrologic.fulcro.algorithms.merge ns-def}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(ns sci.configs.fulcro.algorithms.normalize | ||
(:require [sci.core :as sci] | ||
com.fulcrologic.fulcro.algorithms.normalize)) | ||
|
||
|
||
(def sci-ns (sci/create-ns 'com.fulcrologic.fulcro.algorithms.normalize)) | ||
(def ns-def (sci/copy-ns com.fulcrologic.fulcro.algorithms.normalize sci-ns)) | ||
|
||
(def namespaces {'com.fulcrologic.fulcro.algorithms.normalize ns-def}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(ns sci.configs.fulcro.algorithms.react-interop | ||
(:require [sci.core :as sci] | ||
com.fulcrologic.fulcro.algorithms.react-interop)) | ||
|
||
(def sci-ns (sci/create-ns 'com.fulcrologic.fulcro.algorithms.react-interop)) | ||
(def ns-def (sci/copy-ns com.fulcrologic.fulcro.algorithms.react-interop sci-ns)) | ||
|
||
(def namespaces {'com.fulcrologic.fulcro.algorithms.react-interop ns-def}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(ns sci.configs.fulcro.algorithms.tempid | ||
(:require [sci.core :as sci] | ||
com.fulcrologic.fulcro.algorithms.tempid)) | ||
|
||
(def sci-ns (sci/create-ns 'com.fulcrologic.fulcro.algorithms.tempid)) | ||
(def ns-def (sci/copy-ns com.fulcrologic.fulcro.algorithms.tempid sci-ns)) | ||
|
||
(def namespaces {'com.fulcrologic.fulcro.algorithms.tempid ns-def}) |
18 changes: 18 additions & 0 deletions
18
src/sci/configs/fulcro/algorithms/tx_processing/synchronous_tx_processing.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(ns sci.configs.fulcro.algorithms.tx-processing.synchronous-tx-processing | ||
(:require [sci.core :as sci] | ||
[com.fulcrologic.fulcro.algorithms.tx-processing.synchronous-tx-processing :as stx])) | ||
|
||
(defn ^:sci/macro in-transaction [_&form _&env app-sym & body] | ||
`(let [id# (:com.fulcrologic.fulcro.application/id ~app-sym)] | ||
(swap! stx/apps-in-tx update id# conj (stx/current-thread-id)) | ||
(try | ||
~@body | ||
(finally | ||
(swap! apps-in-tx update id# pop))))) | ||
|
||
(def sci-ns (sci/create-ns 'com.fulcrologic.fulcro.algorithms.tx-processing.synchronous-tx-processing)) | ||
(def ns-def (assoc (sci/copy-ns com.fulcrologic.fulcro.algorithms.tx-processing.synchronous-tx-processing sci-ns | ||
{:exclude [in-transaction]}) | ||
'in-transaction (sci/copy-var in-transaction sci-ns))) | ||
|
||
(def namespaces {'com.fulcrologic.fulcro.algorithms.tx-processing.synchronous-tx-processing ns-def}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(ns sci.configs.fulcro.application | ||
(:require | ||
[sci.core :as sci] | ||
[com.fulcrologic.fulcro.application])) | ||
|
||
(def sci-ns (sci/create-ns 'com.fulcrologic.fulcro.application)) | ||
(def ns-def (sci/copy-ns com.fulcrologic.fulcro.application sci-ns)) | ||
|
||
(def namespaces {'com.fulcrologic.fulcro.application ns-def}) |
Oops, something went wrong.