diff --git a/deps.edn b/deps.edn index dc34219..0a6ef88 100644 --- a/deps.edn +++ b/deps.edn @@ -1,8 +1,11 @@ {:deps {org.clojure/clojure {:mvn/version "1.10.0"} org.clojure/clojurescript {:mvn/version "1.11.60"} org.clojure/core.async {:mvn/version "1.6.673"} + org.clojure/data.xml {:mvn/version "0.2.0-alpha8"} funcool/promesa {:mvn/version "9.0.494"} + ;; simpler date time + tick/tick {:mvn/version "0.6.2"} ;;ajax requests cljs-ajax/cljs-ajax {:mvn/version "0.8.1"} @@ -25,7 +28,7 @@ org.babashka/sci {:mvn/version "0.7.39"} org.babashka/sci.configs {:git/url "https://github.com/babashka/sci.configs" :sha "33bd51e53700b224b4cb5bda59eb21b62f962745"} - datascript/datascript {:mvn/version "1.4.2"} + datascript/datascript {:mvn/version "1.5.1"} com.bhauman/figwheel-main {:mvn/version "0.2.18"}} diff --git a/package.json b/package.json index cdd2fe7..37e1ff5 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,9 @@ "@codemirror/state": "^6.2.0", "@codemirror/theme-one-dark": "^6.1.2", "@codemirror/view": "^6.10.1", + "@js-joda/core": "3.2.0", + "@js-joda/locale_en-us": "3.1.1", + "@js-joda/timezone": "2.5.0", "@nextjournal/lang-clojure": "^1.0.0", "axe-core": "4.7.0", "react": "^18.2.0", diff --git a/readme.org b/readme.org index db78047..05c30ab 100644 --- a/readme.org +++ b/readme.org @@ -1,3 +1,9 @@ + +Future Content + + - Dynamic html with macro for frontend generation on build. + - Complete frontend backend example wth ring retit reagent + clj -m figwheel.main --build dev --repl https://www.clojuriststogether.org/news/call-for-new-proposals.-june-survey-results./ diff --git a/resources/public/documents/examples-maps.org b/resources/public/documents/examples-maps.org index d4fec31..b1d5a5b 100644 --- a/resources/public/documents/examples-maps.org +++ b/resources/public/documents/examples-maps.org @@ -3,13 +3,21 @@ * Introduction +Below you will find some simple examples of using map api's inside clojure, you can use the inline eval for some of the example where sci supports a specific library. Install npm dependencies + +** Setup for downloaded version +Install the npm dependencies for react then launch shadow via the terminal or jack in via your IDE. +#+BEGIN_SRC html :results silent :exports none :tangle readme.org +Install dependencies with. npm install -Run the project +Run the project with the below command npx shadow-cljs server app +Alternatively jack into the project from your ide. + * Google Maps @@ -86,6 +94,8 @@ You will need to provide your own api key, the examples are blank and render a w ** Load in the google maps script by adding it to the dom +Code pulled from google + #+BEGIN_SRC clojurescript :results output :tangle src/clojure_demo/core.cljs (defn load-google-maps-script [api-key] (let [script (.createElement js/document "script")] diff --git a/resources/public/documents/examples-xml-sitemap.org b/resources/public/documents/examples-xml-sitemap.org new file mode 100644 index 0000000..92ff243 --- /dev/null +++ b/resources/public/documents/examples-xml-sitemap.org @@ -0,0 +1,182 @@ +#+TITLE: Generating xml to produce a sitemap + +* Introduction +In this example we generate a sitemap the example uses reader conditionals so the code works in clojure and clojurescript it also has a simple macro to output the file if used in the frontend. + +#+BEGIN_SRC html :results silent :exports none :tangle readme.org +Install dependencies with. +npm install + +Run the project with the below command +npx shadow-cljs server app + +Alternatively jack into the project from your ide. +#+END_SRC + +#+BEGIN_SRC edn :results silent :exports none :tangle deps.edn +{:paths ["src" "resources"] + :deps + {org.clojure/clojure {:mvn/version "1.10.0"} + org.clojure/clojurescript {:mvn/version "1.11.60"} + org.clojure/data.xml {:mvn/version "0.2.0-alpha8"} + + tick/tick {:mvn/version "0.6.2"} + reagent/reagent {:mvn/version "1.2.0"} + thheller/shadow-cljs {:mvn/version "2.24.0"}}} +#+END_SRC + +#+BEGIN_SRC edn :results silent :exports none :tangle shadow-cljs.edn +{:deps {:aliases [:dev]} + :dev-http {8080 ["resources/public/" "classpath:public"]} + :source ["src" "../../components"] + :builds {:app {:output-dir "resources/public/cljs-out/" + :asset-path "/cljs-out" + :target :browser + :compiler-options {:infer-externs :auto + :externs ["datascript/externs.js"] + :output-feature-set :es6} + :modules {:main_bundle {:init-fn clojure-demo.core/startup!}} + :devtools {:after-load app.main/reload!}}}} +#+END_SRC + +#+BEGIN_SRC json :results silent :exports none :tangle package.json +{ + "dependencies": { + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "shadow-cljs": "^2.23.3", + "webpack": "^5.74.0", + "webpack-cli": "^4.10.0" + } +} +#+END_SRC + +#+BEGIN_SRC html :results silent :exports none :tangle resources/public/index.html + + +
+ +] children) ))}))) (defn code-editor - [{:keys [export class results]} content] + [{:keys [exports class results]} content] (let [language class editor (atom nil) evaled-result (reagent/atom nil) @@ -177,7 +189,7 @@ :parent @editor}))))) :component-will-unmount (fn [_] (.destroy @view)) :reagent-render (fn [] - (if export + (if (= exports "none") nil [:div.mb-8 [:div.ba.ma-0.f5.b--black-05.pa2.overflow-auto.editor {:ref #(reset! editor %)}] @@ -297,9 +309,13 @@ :intro "Some example applications" :key ::examples :demos [{:title "Maps" - :description "" - :page "example-maps" - :icon-image "https://avatars.githubusercontent.com/u/2181346?s=200&v=4"}]} + :description "Some quick examples using frontend map api's like google maps." + :page "example-maps" + :icon-image "https://avatars.githubusercontent.com/u/2181346?s=200&v=4"} + {:title "XML sitemap" + :description "Using data.xml to generate a sitemap" + :page "example-xml-sitemap" + :icon-image "https://avatars.githubusercontent.com/u/2181346?s=200&v=4"}]} :terminology {:title "Terminology" :intro "" :key ::terminology} @@ -318,7 +334,9 @@ :ci-demo {:file "documents/ci-demo.org" :git-link "https://github.com/atomjuice/dsl-demo"} :example-maps - {:file "documents/examples-maps.org" :git-link "https://github.com/atomjuice/dsl-demo"} + {:file "documents/examples-maps.org" :git-link ""} + :example-xml-sitemap + {:file "documents/examples-xml-sitemap.org" :git-link "https://github.com/atomjuice/dsl-demo"} :containers {:file "documents/containers.org" :git-link "https://github.com/atomjuice/containers"}}})