Refactor clojure demos.
This commit is contained in:
parent
10041e2365
commit
4a5248ca6c
|
|
@ -0,0 +1,27 @@
|
||||||
|
{:paths ["src"]
|
||||||
|
:deps {org.clojure/core.async {:mvn/version "1.6.673"}
|
||||||
|
org.clojure/clojurescript {:mvn/version "1.12.134"}
|
||||||
|
|
||||||
|
reagent/reagent {:mvn/version "1.1.1"}
|
||||||
|
tick/tick {:mvn/version "0.5.0"}
|
||||||
|
metosin/reitit {:mvn/version "0.5.18"}
|
||||||
|
|
||||||
|
cljs-ajax/cljs-ajax {:mvn/version "0.8.4"}
|
||||||
|
|
||||||
|
datascript/datascript {:mvn/version "1.4.0"}
|
||||||
|
org.clojure/data.xml {:mvn/version "0.2.0-alpha9"}
|
||||||
|
metosin/spec-tools {:mvn/version "0.10.6"}
|
||||||
|
promesa/promesa {:mvn/version "11.0.678"}
|
||||||
|
funcool/promesa {:mvn/version "11.0.678"}
|
||||||
|
org.babashka/sci {:mvn/version "0.15.56"}
|
||||||
|
org.babashka/sci.configs {:git/url "https://github.com/babashka/sci.configs.git"
|
||||||
|
:sha "a785be2090991bf99ddc1c8cb4923a7217f6e098"}
|
||||||
|
com.github.seancorfield/honeysql {:mvn/version "2.7.1425"}
|
||||||
|
|
||||||
|
olymk2/tachyon-reagent {:git/url "https://gitlab.com/olymk2/tachyon-reagent.git"
|
||||||
|
:sha "e422af7b41266f7bc90ab78a24fb93f32be61385"}
|
||||||
|
olymk2/cl-eorg {:git/url "https://gitlab.com/olymk2/cl-org.git"
|
||||||
|
:sha "13e57f11da75516844922fe28bfd6aa7692b7c34"}}
|
||||||
|
|
||||||
|
:aliases {:test {:extra-paths ["test"]
|
||||||
|
:extra-deps {}}}}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"name": "clojure-demos",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Clojure demos base",
|
||||||
|
"dependencies": {
|
||||||
|
"@codemirror/language": "^6.0.0",
|
||||||
|
"@codemirror/legacy-modes": "^6.0.0",
|
||||||
|
"@codemirror/state": "^6.0.0",
|
||||||
|
"@codemirror/theme-one-dark": "^6.0.0",
|
||||||
|
"@codemirror/view": "^6.0.0",
|
||||||
|
"@nextjournal/lang-clojure": "^1.0.0",
|
||||||
|
"react": "^18.0.0",
|
||||||
|
"react-dom": "^18.0.0",
|
||||||
|
"tarts": "^1.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -126,9 +126,7 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="app">loading here</div>
|
<div id="app">loading here</div>
|
||||||
<script
|
<script src="/js/base.js" type="application/javascript"></script>
|
||||||
src="/cljs-out/main_bundle.js"
|
<script src="/js/app.js" type="application/javascript"></script>
|
||||||
type="application/javascript"
|
|
||||||
></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
(ns com.oly.static-sites.core
|
(ns com.oly.static-sites.clojure-demos.core
|
||||||
(:require
|
(:require
|
||||||
["@codemirror/language" :refer [LanguageSupport StreamLanguage]]
|
["@codemirror/language" :refer [LanguageSupport StreamLanguage]]
|
||||||
["@codemirror/legacy-modes/mode/yaml" :refer [yaml]]
|
["@codemirror/legacy-modes/mode/yaml" :refer [yaml]]
|
||||||
|
|
@ -12,12 +12,12 @@
|
||||||
[cl-eorg.html :as h :refer [body headers org->replacements]]
|
[cl-eorg.html :as h :refer [body headers org->replacements]]
|
||||||
[cl-eorg.parser :as o :refer [parse]]
|
[cl-eorg.parser :as o :refer [parse]]
|
||||||
[cl-eorg.themes.tachyon :refer [tachyon-theme]]
|
[cl-eorg.themes.tachyon :refer [tachyon-theme]]
|
||||||
[com.oly.static-sites.components
|
[com.oly.static-sites.clojure-demos.components
|
||||||
:refer [header-lvl1 header-lvl2 header-lvl3 notification]]
|
:refer [header-lvl1 header-lvl2 header-lvl3 notification]]
|
||||||
[com.oly.static-sites.helpers :refer [slugify]]
|
[com.oly.static-sites.clojure-demos.helpers :refer [slugify]]
|
||||||
[com.oly.static-sites.state :refer [site-state]]
|
[com.oly.static-sites.clojure-demos.state :refer [site-state]]
|
||||||
[com.oly.static-sites.tailwind-theme :refer [tailwind-theme]]
|
[com.oly.static-sites.clojure-demos.tailwind-theme :refer [tailwind-theme]]
|
||||||
[clojure.data.xml :as xml]
|
;; [clojure.data.xml :as xml]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[honey.sql :as sql]
|
[honey.sql :as sql]
|
||||||
[promesa.core :as promesa]
|
[promesa.core :as promesa]
|
||||||
|
|
@ -31,11 +31,12 @@
|
||||||
[sci.configs.funcool.promesa :as sci-promesa]
|
[sci.configs.funcool.promesa :as sci-promesa]
|
||||||
[sci.configs.reagent.reagent :as sci-reagent]
|
[sci.configs.reagent.reagent :as sci-reagent]
|
||||||
[sci.configs.tonsky.datascript :as sci-datascript]
|
[sci.configs.tonsky.datascript :as sci-datascript]
|
||||||
[com.oly.static-sites.routes :refer [site-data routes]]
|
[com.oly.static-sites.clojure-demos.routes :refer [site-data routes]]
|
||||||
[com.oly.static-sites.sitemap :as sm #_#_:refer [spit-pwa-sitemap]]
|
[com.oly.static-sites.clojure-demos.sitemap :as sm #_#_:refer [spit-pwa-sitemap]]
|
||||||
|
[com.oly.static-sites.ui-tachyon.core :as ui]
|
||||||
[tick.core :as t]
|
[tick.core :as t]
|
||||||
(com.oly.static-sites.sci-init :refer [sci-ctx yaml-mode]))
|
(com.oly.static-sites.clojure-demos.sci-init :refer [sci-ctx yaml-mode]))
|
||||||
#_(:require-macros [com.oly.static-sites.sitemap :as sm #_#_:refer [spit-pwa-sitemap]]))
|
#_(:require-macros [com.oly.static-sites.clojure-demos.sitemap :as sm #_#_:refer [spit-pwa-sitemap]]))
|
||||||
|
|
||||||
|
|
||||||
(defn fetch-selected-text
|
(defn fetch-selected-text
|
||||||
|
|
@ -216,27 +217,15 @@
|
||||||
articles)])
|
articles)])
|
||||||
|
|
||||||
;; form one component to render a nav link
|
;; form one component to render a nav link
|
||||||
(defn navbar-link [{:keys [href title text key] :or {text nil title nil}}]
|
(defn navbar-link [opts]
|
||||||
[:a.link.m-2 {:key (or key href) :class "hover:text-grey-200" :href href :title title} text])
|
(ui/navbar-link opts))
|
||||||
|
|
||||||
;; form one component to render a navbar
|
;; form one component to render a navbar
|
||||||
(defn navbar [links]
|
(defn navbar [links]
|
||||||
[:header.text-white.bg-zinc-900.p-6.pl-12.w-full
|
(ui/navbar links))
|
||||||
(into [:nav.uppercase.font-medium.text-sm] (mapv navbar-link links))]
|
|
||||||
#_[:header.bg-black-90.w-100.ph3.pv3.pv4-ns.ph4-m.ph5-l
|
|
||||||
(into [:nav.f6.fw6.ttu.tracked] (mapv navbar-link links))])
|
|
||||||
|
|
||||||
(defn footer []
|
(defn footer []
|
||||||
[:footer.bg-zinc-800.text-slate-400.p-8.m-auto.w-full
|
(ui/footer))
|
||||||
[:div.m-auto {:class "w-4/5"}
|
|
||||||
[:a.hover:text-slate-200
|
|
||||||
{:target "_blank" :href "https://matrix.to/#/@oly:matrix.org"}
|
|
||||||
"Contact me"]]]
|
|
||||||
#_[:div
|
|
||||||
[:footer.bg-near-black.white-80.pv4.ph3.ph5-m.ph6-l.mid-gray.w-full
|
|
||||||
[:a.f6.dib.ph2.link.mid-gray.dim
|
|
||||||
{:target "_blank" :href "https://matrix.to/#/@oly:matrix.org"}
|
|
||||||
"Contact me"]]])
|
|
||||||
|
|
||||||
(def toc (partial contains? (into #{} (map keyword [:HEADER1 :HEADER2 :HEADER3 :HEADER4 :HEADER5 :HEADER6]))))
|
(def toc (partial contains? (into #{} (map keyword [:HEADER1 :HEADER2 :HEADER3 :HEADER4 :HEADER5 :HEADER6]))))
|
||||||
(def org-code (partial contains? (into #{} (map keyword [:SRC]))))
|
(def org-code (partial contains? (into #{} (map keyword [:SRC]))))
|
||||||
|
|
@ -279,7 +268,9 @@
|
||||||
:link (rfe/href :page {:page "reagent-demo"})
|
:link (rfe/href :page {:page "reagent-demo"})
|
||||||
:img-src "https://raw.githubusercontent.com/reagent-project/reagent/master/logo/logo-text.png"}]}]])
|
:img-src "https://raw.githubusercontent.com/reagent-project/reagent/master/logo/logo-text.png"}]}]])
|
||||||
|
|
||||||
(defn grouped-list [data]
|
|
||||||
|
|
||||||
|
(defn grouped-lists-page [data]
|
||||||
[articles
|
[articles
|
||||||
{:title (-> data :title)
|
{:title (-> data :title)
|
||||||
:body (-> data :intro)
|
:body (-> data :intro)
|
||||||
|
|
@ -291,23 +282,30 @@
|
||||||
:img-src (:icon-image demo)})
|
:img-src (:icon-image demo)})
|
||||||
(-> data :demos))}])
|
(-> data :demos))}])
|
||||||
|
|
||||||
|
(defn lists-page [data]
|
||||||
|
[articles
|
||||||
|
{:title (-> data :title)
|
||||||
|
:body (-> data :intro)
|
||||||
|
:articles
|
||||||
|
(mapv (fn fmt-map [demo]
|
||||||
|
{:title (:title demo)
|
||||||
|
:description (:description demo)
|
||||||
|
:link (rfe/href :page {:page (:page demo)})
|
||||||
|
:img-src (:icon-image demo)})
|
||||||
|
(-> data :demos))}])
|
||||||
|
|
||||||
|
(defn list-view [route]
|
||||||
|
(let [group (keyword (name (:name (:data route))))]
|
||||||
|
(if-let [page-data (-> site-data :pages group)]
|
||||||
|
(lists-page page-data)
|
||||||
|
[:div "Page not found"])))
|
||||||
|
|
||||||
(defn grouped-page [route]
|
(defn grouped-page [route]
|
||||||
(let [group (keyword (name (:name (:data route))))]
|
(let [group (keyword (name (:name (:data route))))]
|
||||||
(if (vector? (-> site-data :pages group ))
|
(if (vector? (-> site-data :pages group ))
|
||||||
(into [:div]
|
(into [:div]
|
||||||
(mapv #(grouped-list %) (-> site-data :pages group)))
|
(mapv #(lists-page %) (-> site-data :pages group)))
|
||||||
(grouped-list (-> site-data :pages group )))
|
(lists-page (-> site-data :pages group )))))
|
||||||
|
|
||||||
#_[:<> [articles
|
|
||||||
{:title (-> site-data :pages group :title)
|
|
||||||
:body (-> site-data :pages group :intro)
|
|
||||||
:articles
|
|
||||||
(mapv (fn fmt-map [demo]
|
|
||||||
{:title (:title demo)
|
|
||||||
:description (:description demo)
|
|
||||||
:link (rfe/href :page {:page (:page demo)})
|
|
||||||
:img-src (:icon-image demo)})
|
|
||||||
(-> site-data :pages group :demos))}]]))
|
|
||||||
|
|
||||||
(defn default-page [route]
|
(defn default-page [route]
|
||||||
(let [demo-key (keyword (-> route :parameters :path :page))
|
(let [demo-key (keyword (-> route :parameters :path :page))
|
||||||
|
|
@ -371,9 +369,11 @@
|
||||||
(case view
|
(case view
|
||||||
:homepage home-page
|
:homepage home-page
|
||||||
:grouped-page grouped-page
|
:grouped-page grouped-page
|
||||||
|
:grouped-lists grouped-lists-page
|
||||||
|
:list list-view
|
||||||
:default-page-header default-page-header
|
:default-page-header default-page-header
|
||||||
:about-page about-page
|
:about-page about-page
|
||||||
grouped-page))
|
lists-page))
|
||||||
|
|
||||||
;; top level component contains nav and adds in the select page into a containing element
|
;; top level component contains nav and adds in the select page into a containing element
|
||||||
;; we are adding in a style sheet but this will often be done in index.html
|
;; we are adding in a style sheet but this will often be done in index.html
|
||||||
|
|
@ -432,7 +432,7 @@
|
||||||
;; Generate the sitemap at start, routes are stored as plain data in cljc files
|
;; Generate the sitemap at start, routes are stored as plain data in cljc files
|
||||||
;; this means cljs and clj can read and manipulate them
|
;; this means cljs and clj can read and manipulate them
|
||||||
(sm/spit-pwa-sitemap
|
(sm/spit-pwa-sitemap
|
||||||
"resources/public/sitemap.xml"
|
"bases/clojure-demos/resources/public/sitemap.xml"
|
||||||
"https://clojure-demos.digitaloctave.com")
|
"https://clojure-demos.digitaloctave.com")
|
||||||
|
|
||||||
;; we defonce the startup so that hot reloading does not reinitialize the state of the site
|
;; we defonce the startup so that hot reloading does not reinitialize the state of the site
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
(ns com.oly.static-sites.clojure-demos.interface
|
||||||
|
(:require [com.oly.static-sites.clojure-demos.routes :as routes]))
|
||||||
|
|
||||||
|
(def routes routes/routes)
|
||||||
|
(def site-data routes/site-data)
|
||||||
|
|
@ -24,7 +24,14 @@
|
||||||
:page "clojureclr-basics"}
|
:page "clojureclr-basics"}
|
||||||
{:title "ClojureDart"
|
{:title "ClojureDart"
|
||||||
:description "Clojure for dart, use clojure to build apps using flutter"
|
:description "Clojure for dart, use clojure to build apps using flutter"
|
||||||
:page "clojuredart-info"}]}
|
:page "clojuredart-info"}
|
||||||
|
{:title "LetGO"
|
||||||
|
:description "Clojure for go, use clojure to build apps using go runtime"
|
||||||
|
:page "clojureletgo-info"}
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
}
|
||||||
:dsl {:title "DSL's"
|
:dsl {:title "DSL's"
|
||||||
:key :dsl
|
:key :dsl
|
||||||
:intro "A domain-specific language (DSL) is a language designed to be used for a specific task or domain, clojure has a rich set of DSL some popular DSL's are listed on this page with example's on usage. "
|
:intro "A domain-specific language (DSL) is a language designed to be used for a specific task or domain, clojure has a rich set of DSL some popular DSL's are listed on this page with example's on usage. "
|
||||||
|
|
@ -114,23 +121,23 @@
|
||||||
|
|
||||||
["/terminology/"
|
["/terminology/"
|
||||||
{:name :terminology
|
{:name :terminology
|
||||||
:view :grouped-page}]
|
:view :list}]
|
||||||
|
|
||||||
["/dialects/"
|
["/dialects/"
|
||||||
{:name :dialects
|
{:name :dialects
|
||||||
:view :grouped-page}]
|
:view :list}]
|
||||||
|
|
||||||
["/examples/"
|
["/examples/"
|
||||||
{:name :examples
|
{:name :examples
|
||||||
:view :grouped-page}]
|
:view :list}]
|
||||||
|
|
||||||
["/devops/"
|
["/devops/"
|
||||||
{:name :devops
|
{:name :devops
|
||||||
:view :grouped-page}]
|
:view :list}]
|
||||||
|
|
||||||
["/dsl/"
|
["/dsl/"
|
||||||
{:name :dsl
|
{:name :dsl
|
||||||
:view :grouped-page}]
|
:view :list}]
|
||||||
|
|
||||||
["/about/"
|
["/about/"
|
||||||
{:name :about
|
{:name :about
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
(ns com.oly.static-sites.interface
|
|
||||||
(:require [com.oly.static-sites.routes :as routes]))
|
|
||||||
|
|
||||||
(def routes routes/routes)
|
|
||||||
(def site-data routes/site-data)
|
|
||||||
|
|
@ -100,7 +100,7 @@
|
||||||
["/about"
|
["/about"
|
||||||
{:name :about
|
{:name :about
|
||||||
:view #'about-page}]
|
:view #'about-page}]
|
||||||
["/book/{*path}"
|
#_["/book/{*path}"
|
||||||
{:name :book
|
{:name :book
|
||||||
:view 'book
|
:view 'book
|
||||||
:parameters {:path string?}}]
|
:parameters {:path string?}}]
|
||||||
|
|
@ -135,8 +135,8 @@
|
||||||
(let [search (r/atom "")]
|
(let [search (r/atom "")]
|
||||||
(fn [{:keys [sidebar body]}]
|
(fn [{:keys [sidebar body]}]
|
||||||
[:div.h-100.flex.items-stretch
|
[:div.h-100.flex.items-stretch
|
||||||
#_[:div.dn.db-l.pa3.bg-blue {:style {:flex-basis "20rem" :flex-grow "1"}} sidebar]
|
[:div.dn.db-l.pa3.bg-blue {:style {:flex-basis "20rem" :flex-grow "1"}} sidebar]
|
||||||
#_[:div.ma3.pa3 {:style {:flex-basis "0" :flex-grow "999"}}
|
[:div.ma3.pa3 {:style {:flex-basis "0" :flex-grow "999"}}
|
||||||
[ui-search search]
|
[ui-search search]
|
||||||
body]])))
|
body]])))
|
||||||
|
|
||||||
|
|
@ -163,6 +163,7 @@
|
||||||
active-search (r/cursor state [:search :active])
|
active-search (r/cursor state [:search :active])
|
||||||
org-index (r/cursor state [:index])]
|
org-index (r/cursor state [:index])]
|
||||||
(fn [content]
|
(fn [content]
|
||||||
|
|
||||||
[:<>
|
[:<>
|
||||||
[:link {:rel "stylesheet" :href "https://unpkg.com/tachyons@4.12.0/css/tachyons.min.css"}]
|
[:link {:rel "stylesheet" :href "https://unpkg.com/tachyons@4.12.0/css/tachyons.min.css"}]
|
||||||
[:link {:rel "stylesheet" :href "https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/fontawesome.min.css"}]
|
[:link {:rel "stylesheet" :href "https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/fontawesome.min.css"}]
|
||||||
|
|
@ -180,7 +181,8 @@
|
||||||
[article-list-author-media-flipped
|
[article-list-author-media-flipped
|
||||||
"Articles"
|
"Articles"
|
||||||
(search-articles {:search @search})])
|
(search-articles {:search @search})])
|
||||||
content]
|
content
|
||||||
|
]
|
||||||
:sidebar [:div
|
:sidebar [:div
|
||||||
[profile-card {:name "Oly" :tagline "Earthling, Software Engineer" :img-src "/images/default/me.png"}]
|
[profile-card {:name "Oly" :tagline "Earthling, Software Engineer" :img-src "/images/default/me.png"}]
|
||||||
[:ul.list.pl0.measure.center
|
[:ul.list.pl0.measure.center
|
||||||
|
|
@ -200,110 +202,6 @@
|
||||||
[:a.black.f3.link.hover-green
|
[:a.black.f3.link.hover-green
|
||||||
{:href (rfe/href :book {:path ""})} "Book test"]]]]}]]])))
|
{:href (rfe/href :book {:path ""})} "Book test"]]]]}]]])))
|
||||||
|
|
||||||
(defn book-page [front back current-page page degrees callback]
|
|
||||||
[:div.outline.w-50.v-mid.absolute.center.bg-blue.r0
|
|
||||||
{:onMouseUp #(when (<= current-page page) (callback inc))
|
|
||||||
:style {:left "50%" :height "105px"
|
|
||||||
:backface-visibility "hidden"
|
|
||||||
:transform (str "rotate3D(0,1,0,"
|
|
||||||
degrees
|
|
||||||
#_(if (<= (+ 1 current-page) page)
|
|
||||||
0
|
|
||||||
180)
|
|
||||||
"deg")}}
|
|
||||||
|
|
||||||
[:div.w-100.h-100.absolute.bg-green
|
|
||||||
{:onMouseUp #(when (> current-page page) (callback dec))
|
|
||||||
:style {:backface-visibility "hidden"
|
|
||||||
:transform
|
|
||||||
(str "rotate3D(0,1,0,"
|
|
||||||
180
|
|
||||||
"deg")}}
|
|
||||||
(+ 1 page)
|
|
||||||
"-" degrees "-"
|
|
||||||
back]
|
|
||||||
page "-" degrees "-" front])
|
|
||||||
|
|
||||||
(defn rotate-test
|
|
||||||
[]
|
|
||||||
(let [current-page (r/atom 1)
|
|
||||||
flick (fn [dir] (prn dir)
|
|
||||||
(swap! current-page dir))
|
|
||||||
pages (vec (search-articles {}))
|
|
||||||
p (r/track! (fn []
|
|
||||||
(prn @current-page)
|
|
||||||
(prn (- @current-page 1))
|
|
||||||
(prn (+ 4 @current-page))
|
|
||||||
(subvec pages 0 4 #_#_(- @current-page 1) (+ 4 @current-page))))]
|
|
||||||
(fn []
|
|
||||||
[:div
|
|
||||||
(str (count pages))
|
|
||||||
(str (nth @p 1))
|
|
||||||
(str @current-page)
|
|
||||||
[:div.flex.relative.center
|
|
||||||
[:<>
|
|
||||||
[book-page
|
|
||||||
(:title (nth @p 2))
|
|
||||||
(:title (nth @p 3))
|
|
||||||
@current-page 3
|
|
||||||
(if (<= (* 180 (- @current-page 2)) 0) 0 (* 180 (- @current-page 2)))
|
|
||||||
flick]
|
|
||||||
[book-page
|
|
||||||
(:title (first @p))
|
|
||||||
(:title (second @p))
|
|
||||||
@current-page 1
|
|
||||||
(* 180 (- 1 @current-page))
|
|
||||||
flick]]]
|
|
||||||
|
|
||||||
@current-page])))
|
|
||||||
|
|
||||||
;(partition 4 [1 2 3 4 5 6 7 8 9 10])
|
|
||||||
;(mod 360 180)
|
|
||||||
(defn book-pages
|
|
||||||
[& pages]
|
|
||||||
(let [current-page (r/atom 0)
|
|
||||||
flick (fn [idx dir] (swap! current-page dir))]
|
|
||||||
(fn [pages]
|
|
||||||
[:div.flex.relative.center @current-page
|
|
||||||
(doall
|
|
||||||
(->> pages
|
|
||||||
(map-indexed (fn [idx page] [(+ 1 idx) page]))
|
|
||||||
(reverse)
|
|
||||||
;(partition 4)
|
|
||||||
;(first)
|
|
||||||
(map (fn [[idx page]]
|
|
||||||
[:<> {:key idx}
|
|
||||||
[:div.outline.w-50.v-mid.absolute.center.bg-blue
|
|
||||||
{:onMouseUp #(flick idx inc)
|
|
||||||
:class (when (>= @current-page idx) "r0")
|
|
||||||
:style {:left "50%" :height "1050px"
|
|
||||||
:transform (if (< idx @current-page)
|
|
||||||
;(str "rotate3D(0,1,0,360deg)")
|
|
||||||
(str "rotate3D(0,1,0," (* @current-page 180) "deg)")
|
|
||||||
(str "rotate3D(0,1,0," (* @current-page 180) "deg)")
|
|
||||||
;(str "rotate3D(0,1,0," (* (- 1 idx) 180) "deg)")
|
|
||||||
)
|
|
||||||
:z-index (if (> idx @current-page) "1" "0")}}
|
|
||||||
[:div (when (= idx (+ 1 @current-page)) {:style {:transform "rotateY(180deg)"}}) "back page"
|
|
||||||
idx
|
|
||||||
page]]]))))])))
|
|
||||||
|
|
||||||
(defn book [{:keys [path-params] :as route}]
|
|
||||||
(let [document (r/cursor state [:document :hiccup])]
|
|
||||||
(fn [{:keys [path-params] :as route}]
|
|
||||||
[:<>
|
|
||||||
[rotate-test]
|
|
||||||
#_[book-pages
|
|
||||||
|
|
||||||
(mapv (fn [article] [:div.p1 (str article)
|
|
||||||
|
|
||||||
[title-text-image {:title article
|
|
||||||
:content (into [:div]
|
|
||||||
(vec
|
|
||||||
(rest
|
|
||||||
@doc)))}
|
|
||||||
(:details @document)]]) (search-articles {}))]])))
|
|
||||||
|
|
||||||
(defn ^:dev/after-load reagent-render [hiccup]
|
(defn ^:dev/after-load reagent-render [hiccup]
|
||||||
(swap! state update :refresh inc)
|
(swap! state update :refresh inc)
|
||||||
(dom/render [hiccup] (js/document.getElementById "app")))
|
(dom/render [hiccup] (js/document.getElementById "app")))
|
||||||
|
|
@ -315,33 +213,25 @@
|
||||||
;; load in the latest document
|
;; load in the latest document
|
||||||
(fn []
|
(fn []
|
||||||
@update
|
@update
|
||||||
(prn "render")
|
(swap! state assoc :search {:active false})
|
||||||
(swap! state assoc :search {:active false})
|
|
||||||
|
|
||||||
(when (-> @current-page :data :init)
|
(when (-> @current-page :data :init)
|
||||||
((-> @current-page :data :init) nil)
|
((-> @current-page :data :init) nil)
|
||||||
((-> @current-page :data :init) (-> @current-page :parameters :path :path)))
|
((-> @current-page :data :init) (-> @current-page :parameters :path :path)))
|
||||||
(when (-> @current-page :data :state)
|
(when (-> @current-page :data :state)
|
||||||
((-> @current-page :data :state) (-> @current-page :parameters :path :path)))
|
((-> @current-page :data :state) (-> @current-page :parameters :path :path)))
|
||||||
[layout [(-> @current-page :data :view) (-> @current-page)]]
|
[layout [(-> @current-page :data :view) (-> @current-page)]])))
|
||||||
#_(case (-> @current-page :data :name)
|
|
||||||
:homepage [layout [page-homepage @current-page]]
|
|
||||||
:archive [layout [archive @current-page]]
|
|
||||||
:posts [layout [post @current-page]]
|
|
||||||
:book [layout [book @current-page]]
|
|
||||||
:about [layout [about-page @current-page]]
|
|
||||||
[layout [:div "default"]]))))
|
|
||||||
|
|
||||||
(defn init []
|
(defn init []
|
||||||
(rfe/start!
|
(rfe/start!
|
||||||
router
|
router
|
||||||
(fn [m]
|
(fn [m]
|
||||||
(swap! state assoc :current-route m)
|
(prn m)
|
||||||
;;(switch-to-latest (-> @state :current-route :parameters :path :path))
|
(swap! state assoc
|
||||||
|
:current-route m)
|
||||||
|
(switch-to-latest (-> @state :current-route :parameters :path :path))
|
||||||
)
|
)
|
||||||
{:use-fragment false})
|
{:use-fragment false})
|
||||||
|
|
||||||
(prn "init")
|
|
||||||
(GET "/documents/org-meta-index.edn"
|
(GET "/documents/org-meta-index.edn"
|
||||||
{:handler (fn [response]
|
{:handler (fn [response]
|
||||||
(->> (reader/read-string response)
|
(->> (reader/read-string response)
|
||||||
|
|
@ -355,11 +245,6 @@
|
||||||
(select-initial-page (-> @state :current-route :parameters :path :path)))})
|
(select-initial-page (-> @state :current-route :parameters :path :path)))})
|
||||||
(reagent-render render-page))
|
(reagent-render render-page))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;(defonce start (init))
|
|
||||||
|
|
||||||
;;(comment )
|
;;(comment )
|
||||||
;; (-> @state :document)
|
;; (-> @state :document)
|
||||||
;; (latest-article)
|
;; (latest-article)
|
||||||
|
|
|
||||||
|
|
@ -53,13 +53,12 @@
|
||||||
(defn line-step
|
(defn line-step
|
||||||
"Given if the move to the next position is valid"
|
"Given if the move to the next position is valid"
|
||||||
[board size step x1 y1 x2 y2 cords]
|
[board size step x1 y1 x2 y2 cords]
|
||||||
(prn "1")
|
|
||||||
(if (outside-grid-edge? size x2 y2) #_(and
|
(if (outside-grid-edge? size x2 y2) #_(and
|
||||||
(piece-at-destination? [x1 y1] [x2 y2] board))
|
(piece-at-destination? [x1 y1] [x2 y2] board))
|
||||||
(do (prn "2") (conj cords nil))
|
(do (conj cords nil))
|
||||||
(if (opposite-piece? [x1 y1] [x2 y2] board)
|
(if (opposite-piece? [x1 y1] [x2 y2] board)
|
||||||
(do (prn "4") (conj cords nil))
|
(do (conj cords nil))
|
||||||
(do (prn "3") (conj cords [step x2 y2]))
|
(do (conj cords [step x2 y2]))
|
||||||
)))
|
)))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -68,7 +67,6 @@
|
||||||
We can abstract this because all that change's is which axes we calculate on
|
We can abstract this because all that change's is which axes we calculate on
|
||||||
Just adjust the x1-fn x2-fn y1-fn y2-fn fn's"
|
Just adjust the x1-fn x2-fn y1-fn y2-fn fn's"
|
||||||
[[x y] size x1-fn y1-fn x2-fn y2-fn board]
|
[[x y] size x1-fn y1-fn x2-fn y2-fn board]
|
||||||
(prn "move")
|
|
||||||
(loop [step 1
|
(loop [step 1
|
||||||
cords-set-one []
|
cords-set-one []
|
||||||
cords-set-two []]
|
cords-set-two []]
|
||||||
|
|
@ -106,7 +104,7 @@
|
||||||
[[x y] size board] (line-move [x y] size + - - + board))
|
[[x y] size board] (line-move [x y] size + - - + board))
|
||||||
|
|
||||||
(defn line-projection [[x y] size board]
|
(defn line-projection [[x y] size board]
|
||||||
(concat (line-horizontal [x y] size board)
|
(concat (drop-last (line-horizontal [x y] size board))
|
||||||
(line-vertical [x y] size board)))
|
(line-vertical [x y] size board)))
|
||||||
|
|
||||||
(defn diagonal-projection [[x y] size board]
|
(defn diagonal-projection [[x y] size board]
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,7 @@
|
||||||
moveable-square "O "
|
moveable-square "O "
|
||||||
:else (if (= (calculate-black-white pos) :black)
|
:else (if (= (calculate-black-white pos) :black)
|
||||||
black-square
|
black-square
|
||||||
white-square
|
white-square)))
|
||||||
)))
|
|
||||||
(assoc :colour (if (= square :black)
|
(assoc :colour (if (= square :black)
|
||||||
white-square
|
white-square
|
||||||
black-square)
|
black-square)
|
||||||
|
|
|
||||||
|
|
@ -15,100 +15,6 @@
|
||||||
;;/addwidget https://blog-test.digitaloctave.com/chess?roomI=!YOyzcCyoomnjylcOFP:matrix.org&widgetId=dochess
|
;;/addwidget https://blog-test.digitaloctave.com/chess?roomI=!YOyzcCyoomnjylcOFP:matrix.org&widgetId=dochess
|
||||||
(def widget (atom {}))
|
(def widget (atom {}))
|
||||||
|
|
||||||
(defn send-to-parent
|
|
||||||
([action]
|
|
||||||
(prn (str "sending " action))
|
|
||||||
(.postMessage
|
|
||||||
js/window.parent
|
|
||||||
#js {:api "fromWidget",
|
|
||||||
:v "1.0"
|
|
||||||
:widgetId (:widget-id @widget)
|
|
||||||
:action action}, "*"))
|
|
||||||
([action data]
|
|
||||||
(prn (str "sending d " action))
|
|
||||||
(.postMessage
|
|
||||||
js/window.parent
|
|
||||||
#js {:api "fromWidget",
|
|
||||||
:v "1.0"
|
|
||||||
:action action
|
|
||||||
:widgetId (:widget-id @widget)
|
|
||||||
:requestId "request1"
|
|
||||||
:data data}, "*"))
|
|
||||||
([action hm-key data]
|
|
||||||
(prn (str "sending kv " action))
|
|
||||||
(prn (clj->js {:api "fromWidget",
|
|
||||||
:v "1.0"
|
|
||||||
:action action
|
|
||||||
:widgetId (:widget-id @widget)
|
|
||||||
(keyword hm-key) data
|
|
||||||
}))
|
|
||||||
(.postMessage
|
|
||||||
js/window.parent
|
|
||||||
(clj->js {:api "fromWidget",
|
|
||||||
:v "1.0"
|
|
||||||
:action action
|
|
||||||
:widgetId @widget
|
|
||||||
(keyword hm-key) data
|
|
||||||
}), "*"))
|
|
||||||
|
|
||||||
)
|
|
||||||
|
|
||||||
(defn site-startup []
|
|
||||||
(prn "site start up")
|
|
||||||
;; experiment in matrix widget api
|
|
||||||
#_(.addEventListener js/window "message"
|
|
||||||
(fn [event]
|
|
||||||
(prn "message from element ")
|
|
||||||
(.log js/console event)
|
|
||||||
(.log js/console (.-data event))
|
|
||||||
(prn (aget event "data" "api"))
|
|
||||||
(prn (aget event "data" "action"))
|
|
||||||
(prn (aget event "data" "widgetId"))
|
|
||||||
(when (= (aget event "data" "api") "toWidget")
|
|
||||||
(prn (str "msg type " (aget event "data" "action") ))
|
|
||||||
(case (aget event "data" "action")
|
|
||||||
"m.room.message" (prn "type msg")
|
|
||||||
"m.room.member" (prn "type member")
|
|
||||||
"capabilities"
|
|
||||||
(do
|
|
||||||
(prn "sending capabilities")
|
|
||||||
(swap! widget assoc :widget-id (aget event "data" "widgetId"))
|
|
||||||
(send-to-parent "capabilities" :capabilities #js ["m.capability.screenshot"]))
|
|
||||||
|
|
||||||
"notify_capabilities"
|
|
||||||
(do
|
|
||||||
(send-to-parent "capabilities" :capabilities #js ["m.capability.screenshot"]))
|
|
||||||
(do
|
|
||||||
(prn "unhandled action " (str (aget event "data" "action")))
|
|
||||||
(prn (aget event "data"))))
|
|
||||||
|
|
||||||
#_(prn (.-origin event))
|
|
||||||
#_(prn (.-data event)))))
|
|
||||||
|
|
||||||
|
|
||||||
(send-to-parent "ready")
|
|
||||||
(send-to-parent "widget_ready")
|
|
||||||
(send-to-parent "m.room.message" #js {:body "testing from widget" :msgtype "m.text"})
|
|
||||||
#_(.postMessage js/window.parent #js {:api "fromWidget",
|
|
||||||
:v "1.0"
|
|
||||||
:action "ready"
|
|
||||||
#_#_:action "supported_api_versions"}, "*")
|
|
||||||
|
|
||||||
|
|
||||||
#_(.postMessage js/window.parent #js {:api "fromWidget",
|
|
||||||
:v "1.0"
|
|
||||||
:action "content_loaded"
|
|
||||||
#_#_:action "supported_api_versions"}, "*")
|
|
||||||
#_(prn "send capability message")
|
|
||||||
|
|
||||||
#_(.postMessage js/window.parent #js {:api "fromWidget",
|
|
||||||
:v "1.0"
|
|
||||||
:action "capabilities"
|
|
||||||
:capabilities #js []
|
|
||||||
#_#_:action "supported_api_versions"}, "*")
|
|
||||||
|
|
||||||
)
|
|
||||||
|
|
||||||
#_(def game-state-viking (r/atom {:board viking-start-state}))
|
#_(def game-state-viking (r/atom {:board viking-start-state}))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -126,15 +32,6 @@
|
||||||
results))))
|
results))))
|
||||||
|
|
||||||
|
|
||||||
(defn setup []
|
|
||||||
(prn "register listener")
|
|
||||||
(.addEventListener js/window "load"
|
|
||||||
(fn [event]
|
|
||||||
(prn "on load")
|
|
||||||
(site-startup))))
|
|
||||||
|
|
||||||
(defonce test-event (setup))
|
|
||||||
|
|
||||||
(defn get-square [board-state pos]
|
(defn get-square [board-state pos]
|
||||||
(get @board-state [:board pos] {}))
|
(get @board-state [:board pos] {}))
|
||||||
|
|
||||||
|
|
@ -163,7 +60,6 @@
|
||||||
(defn highlight-moves
|
(defn highlight-moves
|
||||||
([pos] (highlight-moves pos game-state))
|
([pos] (highlight-moves pos game-state))
|
||||||
([pos board-state]
|
([pos board-state]
|
||||||
(prn "highlight moves")
|
|
||||||
(->> (fetch-selected-piece-moves
|
(->> (fetch-selected-piece-moves
|
||||||
(first (filter (fn [[k v]] (:selected v)) (-> @board-state :board)))
|
(first (filter (fn [[k v]] (:selected v)) (-> @board-state :board)))
|
||||||
(-> @board-state :board))
|
(-> @board-state :board))
|
||||||
|
|
@ -182,14 +78,17 @@
|
||||||
8 (str " bg-green-800 "))
|
8 (str " bg-green-800 "))
|
||||||
:pos [x y]}))))))
|
:pos [x y]}))))))
|
||||||
|
|
||||||
(defn clear-keys [key]
|
(defn clear-keys
|
||||||
(swap! game-state
|
([key] (clear-keys game-state key))
|
||||||
assoc :board
|
([board-state key]
|
||||||
(reduce-kv (fn [m pos piece]
|
(swap! board-state
|
||||||
(assoc m pos (dissoc piece key))) {} (-> @game-state :board))))
|
assoc :board
|
||||||
|
(reduce-kv (fn [m pos piece]
|
||||||
|
(assoc m pos (dissoc piece key))) {}
|
||||||
|
(-> @board-state :board)))))
|
||||||
|
|
||||||
(defn get-selected-square []
|
(defn get-selected-square [board-state]
|
||||||
(last (filter (fn [[_ square]] (true? (:selected square))) (-> @game-state :board))))
|
(last (filter (fn [[_ square]] (true? (:selected square))) (-> @board-state :board))))
|
||||||
|
|
||||||
(defn piece-attribute-match?
|
(defn piece-attribute-match?
|
||||||
[src-piece dest-piece attrib]
|
[src-piece dest-piece attrib]
|
||||||
|
|
@ -225,7 +124,6 @@
|
||||||
nil
|
nil
|
||||||
(when
|
(when
|
||||||
(valid-move? (:pos dest-square) (-> @board-state :board))
|
(valid-move? (:pos dest-square) (-> @board-state :board))
|
||||||
(prn "--------------")
|
|
||||||
(switch-player)
|
(switch-player)
|
||||||
(when (take-piece? selected-piece dest-square)
|
(when (take-piece? selected-piece dest-square)
|
||||||
(prn (str "taking " dest-square))
|
(prn (str "taking " dest-square))
|
||||||
|
|
@ -243,18 +141,16 @@
|
||||||
(defn click-square
|
(defn click-square
|
||||||
([evt p] (click-square game-state evt p))
|
([evt p] (click-square game-state evt p))
|
||||||
([board-state evt p]
|
([board-state evt p]
|
||||||
(prn @game-state)
|
(let [[selected-pos {selected-piece :piece}] (get-selected-square board-state)
|
||||||
(let [[selected-pos {selected-piece :piece}] (get-selected-square)
|
|
||||||
clicked-square p]
|
clicked-square p]
|
||||||
(prn "click square")
|
(prn "click square" p)
|
||||||
(clear-keys :highlight)
|
(clear-keys board-state :highlight)
|
||||||
(when (piece-attribute-match? (current-player) selected-piece :colour)
|
(when (piece-attribute-match? (current-player) selected-piece :colour)
|
||||||
(when selected-pos
|
(when selected-pos
|
||||||
(prn "previously selected piece")
|
|
||||||
(move-piece board-state selected-piece clicked-square)))
|
(move-piece board-state selected-piece clicked-square)))
|
||||||
|
|
||||||
(clear-keys :selected)
|
(clear-keys board-state :selected)
|
||||||
(clear-keys :highlight)
|
(clear-keys board-state :highlight)
|
||||||
;; set new square as selected
|
;; set new square as selected
|
||||||
(update-square board-state (:pos p) (assoc (get-square board-state (:pos p)) :selected true))
|
(update-square board-state (:pos p) (assoc (get-square board-state (:pos p)) :selected true))
|
||||||
(highlight-moves (:pos p) board-state))))
|
(highlight-moves (:pos p) board-state))))
|
||||||
|
|
@ -289,10 +185,9 @@
|
||||||
(if (:pieces query-params)
|
(if (:pieces query-params)
|
||||||
(chess-board-setup (chars->map (:pieces query-params)))
|
(chess-board-setup (chars->map (:pieces query-params)))
|
||||||
(chess-board-setup start-state))
|
(chess-board-setup start-state))
|
||||||
|
|
||||||
(fn [{:keys [path-params] :as route}]
|
(fn [{:keys [path-params] :as route}]
|
||||||
[:div
|
[:div
|
||||||
(let [[pos piece] (get-selected-square)]
|
(let [[pos piece] (get-selected-square game-state)]
|
||||||
[:div
|
[:div
|
||||||
[:div (str @widget)]
|
[:div (str @widget)]
|
||||||
[:div (if (-> @game-state :player-one :selected)
|
[:div (if (-> @game-state :player-one :selected)
|
||||||
|
|
@ -312,10 +207,9 @@
|
||||||
[:div (board 11 (-> @v/game-state :board))]]))
|
[:div (board 11 (-> @v/game-state :board))]]))
|
||||||
|
|
||||||
(comment
|
(comment
|
||||||
|
|
||||||
(board-test 5)
|
(board-test 5)
|
||||||
(board 5 (-> @game-state :board))
|
(board 5 (-> @game-state :board))
|
||||||
(get-selected-square)
|
(get-selected-square game-state)
|
||||||
@game-state)
|
@game-state)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,6 @@
|
||||||
[?e :relative-path ?path]]})
|
[?e :relative-path ?path]]})
|
||||||
|
|
||||||
(defn check-match [re-patt title]
|
(defn check-match [re-patt title]
|
||||||
(prn re-patt)
|
|
||||||
(prn title)
|
|
||||||
(re-find re-patt title))
|
(re-find re-patt title))
|
||||||
|
|
||||||
(defn db-search-filter
|
(defn db-search-filter
|
||||||
|
|
@ -47,7 +45,6 @@
|
||||||
(update-in [:where] #(conj % [`(~'re-find ~re-search ~'?title)])))))
|
(update-in [:where] #(conj % [`(~'re-find ~re-search ~'?title)])))))
|
||||||
|
|
||||||
(defn search-articles [search]
|
(defn search-articles [search]
|
||||||
(prn (db-search-filter search))
|
|
||||||
(->>
|
(->>
|
||||||
(d/q (db-search-filter search) @conn)
|
(d/q (db-search-filter search) @conn)
|
||||||
(flatten)
|
(flatten)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
(ns com.oly.static-sites.portfolio.clojure-demos-scenes
|
||||||
|
(:require [portfolio.dumdom :as d]
|
||||||
|
[com.oly.static-sites.ui-tachyon.core :as ui]))
|
||||||
|
|
||||||
|
(d/defscene navbar-scene
|
||||||
|
(ui/navbar [{:href "/" :text "Home"}
|
||||||
|
{:href "/dialects" :text "Dialects"}
|
||||||
|
{:href "/dsl" :text "DSLs"}
|
||||||
|
{:href "/examples" :text "Examples"}
|
||||||
|
{:href "/about" :text "About"}]))
|
||||||
|
|
||||||
|
(d/defscene footer-scene
|
||||||
|
ui/footer)
|
||||||
|
|
||||||
|
(d/defscene article-card-scene
|
||||||
|
(ui/article-card
|
||||||
|
{:title "Clojure Basics"
|
||||||
|
:description "Getting started with clojure syntax"
|
||||||
|
:img-src "https://clojure.org/images/clojure-logo-120b.png"}))
|
||||||
|
|
||||||
|
(d/defscene articles-list-scene
|
||||||
|
(ui/articles-list
|
||||||
|
{:title "Clojure Demos"
|
||||||
|
:articles [{:title "Clojure Basics"
|
||||||
|
:description "Getting started with clojure syntax datatype's sequences conditions"
|
||||||
|
:img-src "https://clojure.org/images/clojure-logo-120b.png"}
|
||||||
|
{:title "Reagent Demo"
|
||||||
|
:description "React application using reagent"
|
||||||
|
:img-src "https://raw.githubusercontent.com/reagent-project/reagent/master/logo/logo-text.png"}
|
||||||
|
{:title "Honey SQL Demo"
|
||||||
|
:description "Build SQL queries with Clojure data structures"
|
||||||
|
:img-src "https://miro.medium.com/max/1400/1*CEYFj5R57UFyCXts2nsBqA.png"}]}))
|
||||||
|
|
||||||
|
(d/defscene notification-scene
|
||||||
|
ui/notification)
|
||||||
|
|
||||||
|
(d/defscene header-with-link-scene
|
||||||
|
(ui/header-with-link "Example Header" 1))
|
||||||
|
|
||||||
|
(d/defscene grouped-articles-list-scene
|
||||||
|
(ui/grouped-articles-list
|
||||||
|
{:title "Clojure Demos"
|
||||||
|
:groups [{:title "Dialects & Interop"
|
||||||
|
:articles [{:title "Clojure"
|
||||||
|
:description "The original language running on the jvm with access to the java eco system"
|
||||||
|
:img-src "https://clojure.org/images/clojure-logo-120b.png"}
|
||||||
|
{:title "Clojurescript"
|
||||||
|
:description "Clojure running in the browser or on top of node, with access to the js eco system."
|
||||||
|
:img-src "https://clojurescript.org/images/cljs-logo-60b.png"}]}
|
||||||
|
{:title "DSL's"
|
||||||
|
:articles [{:title "Hiccup HTML Demo"
|
||||||
|
:description "Hiccup is a DSL for generating HTML it uses data structures over strings to generate html"
|
||||||
|
:icon-image "https://miro.medium.com/max/1400/1*CEYFj5R57UFyCXts2nsBqA.png"}
|
||||||
|
{:title "Honey SQL Demo"
|
||||||
|
:description "Similar to honey but for SQL allows you to split apart your complex queries into parts and compose them together."
|
||||||
|
:icon-image "https://miro.medium.com/max/1400/1*CEYFj5R57UFyCXts2nsBqA.png"}]}]}))
|
||||||
|
|
||||||
|
(d/defscene full-page-scene
|
||||||
|
ui/full-page)
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
(ns com.oly.static-sites.portfolio.core
|
(ns com.oly.static-sites.portfolio.core
|
||||||
(:require [dumdom.core :as dumdom]
|
(:require [dumdom.core :as dumdom]
|
||||||
[com.oly.static-sites.portfolio.page :as c]))
|
[com.oly.static-sites.portfolio.page :as c]
|
||||||
|
[com.oly.static-sites.portfolio.clojure-demos-scenes]))
|
||||||
|
|
||||||
(defn launch
|
(defn launch
|
||||||
"Site entry point"
|
"Site entry point"
|
||||||
|
|
|
||||||
81
deps.edn
81
deps.edn
|
|
@ -1,9 +1,10 @@
|
||||||
{:paths ["development/src" "bases/portfolio/src" "bases/do-blog/src"]
|
{:mvn/repos {"clojars" {:url "https://repo.clojars.org/"}}
|
||||||
|
:paths ["development/src" "bases/portfolio/src" "bases/do-blog/src" "components/ui-tachyon/src"]
|
||||||
:deps {cjohansen/dumdom {:mvn/version "2023.11.06"}
|
:deps {cjohansen/dumdom {:mvn/version "2023.11.06"}
|
||||||
org.clojure/clojurescript {:mvn/version "1.12.134"}
|
org.clojure/clojurescript {:mvn/version "1.12.134"}
|
||||||
no.cjohansen/portfolio {:mvn/version "2026.03.1"}}
|
no.cjohansen/portfolio {:mvn/version "2026.03.1"}}
|
||||||
:aliases {:dev {:extra-paths ["development/src" "bases/portfolio/src" "bases/do-blog/src"]
|
:aliases {:dev {:extra-paths ["development/src" "bases/portfolio/src" "bases/do-blog/src"]
|
||||||
:extra-deps {org.clojure/clojure {:mvn/version "1.10.3"}
|
:extra-deps {org.clojure/clojure {:mvn/version "1.12.0"}
|
||||||
org.clojure/clojurescript {:mvn/version "1.12.134"}
|
org.clojure/clojurescript {:mvn/version "1.12.134"}
|
||||||
|
|
||||||
org.clojure/tools.deps.alpha {:mvn/version "0.12.1003"}
|
org.clojure/tools.deps.alpha {:mvn/version "0.12.1003"}
|
||||||
|
|
@ -17,34 +18,64 @@
|
||||||
no.cjohansen/portfolio {:mvn/version "2026.03.1"}
|
no.cjohansen/portfolio {:mvn/version "2026.03.1"}
|
||||||
djblue/portal {:mvn/version "0.48.0"}}}
|
djblue/portal {:mvn/version "0.48.0"}}}
|
||||||
|
|
||||||
:blog {:extra-paths ["components/ui-hiccup/src"
|
:blog {:extra-paths ["components/ui-hiccup/src"
|
||||||
"development/src" "bases/do-blog/src"
|
"components/ui-tachyon/src"
|
||||||
"bases/do-blog/test"]
|
"development/src" "bases/do-blog/src"
|
||||||
:extra-deps {
|
"bases/do-blog/test"]
|
||||||
org.clojure/core.async {:mvn/version "1.6.673"}
|
:extra-deps {
|
||||||
org.clojure/clojurescript {:mvn/version "1.12.134"}
|
org.clojure/core.async {:mvn/version "1.6.673"}
|
||||||
|
org.clojure/clojurescript {:mvn/version "1.12.134"}
|
||||||
|
|
||||||
reagent/reagent {:mvn/version "1.1.1"}
|
reagent/reagent {:mvn/version "1.1.1"}
|
||||||
tick/tick {:mvn/version "0.5.0"}
|
tick/tick {:mvn/version "0.5.0"}
|
||||||
metosin/reitit {:mvn/version "0.5.18"}
|
metosin/reitit {:mvn/version "0.5.18"}
|
||||||
|
|
||||||
cljs-ajax/cljs-ajax {:mvn/version "0.8.4"}
|
cljs-ajax/cljs-ajax {:mvn/version "0.8.4"}
|
||||||
|
|
||||||
datascript/datascript {:mvn/version "1.4.0"}
|
datascript/datascript {:mvn/version "1.4.0"}
|
||||||
olymk2/tachyon-reagent {:git/url "https://gitlab.com/olymk2/tachyon-reagent.git"
|
olymk2/tachyon-reagent {:git/url "https://gitlab.com/olymk2/tachyon-reagent.git"
|
||||||
:sha "e422af7b41266f7bc90ab78a24fb93f32be61385"}
|
:sha "e422af7b41266f7bc90ab78a24fb93f32be61385"}
|
||||||
olymk2/cl-eorg {:git/url "https://gitlab.com/olymk2/cl-org.git"
|
olymk2/cl-eorg {:git/url "https://gitlab.com/olymk2/cl-org.git"
|
||||||
:sha "13e57f11da75516844922fe28bfd6aa7692b7c34"}
|
:sha "13e57f11da75516844922fe28bfd6aa7692b7c34"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:clojure-demos {:extra-paths ["development/src"
|
||||||
|
"bases/clojure-demos/src"
|
||||||
|
"components/ui-tachyon/src"]
|
||||||
|
:extra-deps {
|
||||||
|
org.clojure/core.async {:mvn/version "1.6.673"}
|
||||||
|
org.clojure/clojurescript {:mvn/version "1.12.134"}
|
||||||
|
|
||||||
|
reagent/reagent {:mvn/version "1.1.1"}
|
||||||
|
tick/tick {:mvn/version "0.5.0"}
|
||||||
|
metosin/reitit {:mvn/version "0.5.18"}
|
||||||
|
|
||||||
|
cljs-ajax/cljs-ajax {:mvn/version "0.8.4"}
|
||||||
|
|
||||||
|
datascript/datascript {:mvn/version "1.4.0"}
|
||||||
|
org.clojure/data.xml {:mvn/version "0.2.0-alpha9"}
|
||||||
|
metosin/spec-tools {:mvn/version "0.10.6"}
|
||||||
|
funcool/promesa {:mvn/version "11.0.678"}
|
||||||
|
org.babashka/sci {:mvn/version "0.15.56"}
|
||||||
|
org.babashka/sci.configs {:git/url "https://github.com/babashka/sci.configs.git"
|
||||||
|
:sha "a785be2090991bf99ddc1c8cb4923a7217f6e098"}
|
||||||
|
com.github.seancorfield/honeysql {:mvn/version "2.7.1425"}
|
||||||
|
|
||||||
|
olymk2/tachyon-reagent {:git/url "https://gitlab.com/olymk2/tachyon-reagent.git"
|
||||||
|
:sha "e422af7b41266f7bc90ab78a24fb93f32be61385"}
|
||||||
|
olymk2/cl-eorg {:git/url "https://gitlab.com/olymk2/cl-org.git"
|
||||||
|
:sha "13e57f11da75516844922fe28bfd6aa7692b7c34"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
:shadow-cljs-run
|
:shadow-cljs-run
|
||||||
{:extra-deps {thheller/shadow-cljs {:mvn/version "3.3.6"}
|
{:extra-deps {thheller/shadow-cljs {:mvn/version "3.3.6"}
|
||||||
cider/cider-nrepl {:mvn/version "0.58.0"}
|
cider/cider-nrepl {:mvn/version "0.58.0"}
|
||||||
refactor-nrepl/refactor-nrepl {:mvn/version "3.11.0"}
|
refactor-nrepl/refactor-nrepl {:mvn/version "3.11.0"}
|
||||||
cider/piggieback {:mvn/version "0.5.3"}}
|
cider/piggieback {:mvn/version "0.5.3"}}
|
||||||
:extra-paths ["dev" "bases/do-blog/src" "components/ui_hiccup/src"]
|
:extra-paths ["bases/do-blog/src" "bases/clojure-demos/src" "components/ui-hiccup/src" "components/ui-tachyon/src"]
|
||||||
:main-opts ["-m" "shadow.cljs.devtools.cli"]}
|
:main-opts ["-m" "shadow.cljs.devtools.cli"]}
|
||||||
|
|
||||||
:test {:extra-paths []}
|
:test {:extra-paths []}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
(:require [portfolio.ui :as ui]
|
(:require [portfolio.ui :as ui]
|
||||||
[portfolio.dumdom :as d]
|
[portfolio.dumdom :as d]
|
||||||
[portfolio.dom :as r]
|
[portfolio.dom :as r]
|
||||||
[blog.chess-scene :as chess]
|
[blog.chess-scenes :as chess]
|
||||||
[com.oly.static-sites.portfolio.page :as c]))
|
[com.oly.static-sites.portfolio.page :as c]))
|
||||||
|
|
||||||
(d/defscene circle-flow
|
(d/defscene circle-flow
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
|
"workspaces": [
|
||||||
|
"bases/*"
|
||||||
|
],
|
||||||
"directories": {
|
"directories": {
|
||||||
"test": "test"
|
"test": "test"
|
||||||
},
|
},
|
||||||
|
|
@ -25,8 +28,8 @@
|
||||||
"@sentry/react": "^6.19.7",
|
"@sentry/react": "^6.19.7",
|
||||||
"@sentry/tracing": "^6.19.7",
|
"@sentry/tracing": "^6.19.7",
|
||||||
"axe-core": "4.7.0",
|
"axe-core": "4.7.0",
|
||||||
"react": "^17.0.2",
|
"react": "^18.0.0",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^18.0.0",
|
||||||
"snabbdom": "3.5.1"
|
"snabbdom": "3.5.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,3 +12,12 @@ docker build -t europe-west2-docker.pkg.dev/blog-9d51d/blog/caddy .
|
||||||
|
|
||||||
docker push europe-west2-docker.pkg.dev/blog-9d51d/blog/caddy
|
docker push europe-west2-docker.pkg.dev/blog-9d51d/blog/caddy
|
||||||
clj -M:blog:shadow-cljs-run watch app ui blog blog-tests
|
clj -M:blog:shadow-cljs-run watch app ui blog blog-tests
|
||||||
|
|
||||||
|
|
||||||
|
* Clojure demos
|
||||||
|
|
||||||
|
#+BEGIN_SRC shell
|
||||||
|
clj -M:clojure-demos:shadow-cljs-run watch clojure-demos
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
{:deps {:aliases [:blog]}
|
{:deps {:aliases [:blog :clojure-demos]}
|
||||||
:dev-http {8080 ["bases/do-blog/resources/public" "classpath:public"]
|
:dev-http {8080 ["bases/do-blog/resources/public" "classpath:public"]
|
||||||
8081 ["development/resources/public/" "classpath:public"]}
|
8082 ["bases/clojure-demos/resources/public" "classpath:public"]
|
||||||
|
8081 ["development/resources/public/" "classpath:public"]
|
||||||
|
}
|
||||||
;:nrepl {:middleware [refactor-nrepl.middleware/wrap-refactor]}
|
;:nrepl {:middleware [refactor-nrepl.middleware/wrap-refactor]}
|
||||||
;;:nrepl {:middleware [refactor-nrepl.middleware/wrap-refactor]}
|
;;:nrepl {:middleware [refactor-nrepl.middleware/wrap-refactor]}
|
||||||
;; :source ["devlopment/src" "bases/portfolio/src"] ;;"src"
|
;; :source ["devlopment/src" "bases/portfolio/src"] ;;"src"
|
||||||
|
|
@ -19,7 +21,6 @@
|
||||||
"https://unpkg.com/tachyons@4.12.0/css/tachyons.min.css"]}
|
"https://unpkg.com/tachyons@4.12.0/css/tachyons.min.css"]}
|
||||||
:html-file {
|
:html-file {
|
||||||
:path "development/resources/public/portfolio.html"}
|
:path "development/resources/public/portfolio.html"}
|
||||||
|
|
||||||
:compiler-options {:infer-externs :auto :output-feature-set :es6}
|
:compiler-options {:infer-externs :auto :output-feature-set :es6}
|
||||||
;; :modules {:base {:entries [com.oly.static-sites.portfolio.core]}
|
;; :modules {:base {:entries [com.oly.static-sites.portfolio.core]}
|
||||||
;; ;; :app {:init-fn com.oly.static-sites.portfolio.core/launch
|
;; ;; :app {:init-fn com.oly.static-sites.portfolio.core/launch
|
||||||
|
|
@ -28,18 +29,16 @@
|
||||||
;; ;; :portfolio {;;:init-fn design/launch
|
;; ;; :portfolio {;;:init-fn design/launch
|
||||||
;; ;; :depends-on #{:app}}
|
;; ;; :depends-on #{:app}}
|
||||||
;; }
|
;; }
|
||||||
:devtools {:after-load app.main/reload!}}
|
}
|
||||||
:app {:output-dir "development/resources/public/js"
|
;; :app {:output-dir "development/resources/public/js"
|
||||||
;:asset-path "."
|
;; ;:asset-path "."
|
||||||
:target :browser
|
;; :target :browser
|
||||||
:compiler-options {:infer-externs :auto :output-feature-set :es6}
|
;; :compiler-options {:infer-externs :auto :output-feature-set :es6}
|
||||||
:modules {:base {:entries []}
|
;; :modules {:base {:entries []}
|
||||||
:app {:init-fn com.oly.static-sites.portfolio.core/launch
|
;; :app {:init-fn com.oly.static-sites.portfolio.core/launch
|
||||||
:depends-on #{:base}}
|
;; :depends-on #{:base}}
|
||||||
:portfolio {:init-fn design/launch
|
;; }
|
||||||
:depends-on #{:base}}
|
;; :devtools {:after-load app.main/reload!}}
|
||||||
}
|
|
||||||
:devtools {:after-load app.main/reload!}}
|
|
||||||
:blog {:output-dir "bases/do-blog/resources/public/js"
|
:blog {:output-dir "bases/do-blog/resources/public/js"
|
||||||
;:asset-path "."
|
;:asset-path "."
|
||||||
:target :browser
|
:target :browser
|
||||||
|
|
@ -48,8 +47,19 @@
|
||||||
:app {:init-fn com.oly.static-sites.do-blog.core/init
|
:app {:init-fn com.oly.static-sites.do-blog.core/init
|
||||||
:depends-on #{:base}}
|
:depends-on #{:base}}
|
||||||
}
|
}
|
||||||
:devtools {:after-load app.main/reload!}
|
}
|
||||||
|
|
||||||
|
:clojure-demos {:output-dir "bases/clojure-demos/resources/public/js"
|
||||||
|
;:asset-path "."
|
||||||
|
:target :browser
|
||||||
|
:compiler-options {:infer-externs :auto :output-feature-set :es6 :externs ["datascript/externs.js"]
|
||||||
|
:warnings {:undeclared-var false}}
|
||||||
|
:modules {:base {:entries []}
|
||||||
|
:app {:init-fn com.oly.static-sites.clojure-demos.core/startup!
|
||||||
|
:depends-on #{:base}}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:blog-tests {:target :browser-test
|
:blog-tests {:target :browser-test
|
||||||
:test-dir "development/resources/public/test/"
|
:test-dir "development/resources/public/test/"
|
||||||
:ns-regexp "-test$"
|
:ns-regexp "-test$"
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,6 @@
|
||||||
:auto-add false}
|
:auto-add false}
|
||||||
:tag-patterns {:stable "stable-*"
|
:tag-patterns {:stable "stable-*"
|
||||||
:release "v[0-9]*"}
|
:release "v[0-9]*"}
|
||||||
:projects {"development" {:alias "dev"}}}
|
:projects {"development" {:alias "dev"}}
|
||||||
|
:components {"ui-tachyon" {:alias "ui-tachyon"}
|
||||||
|
"ui-hiccup" {:alias "ui-hiccup"}}}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue