Skip to content

Commit a4fa134

Browse files
committed
Fix: revert to using D* CDN in examples
1 parent 0ae404b commit a4fa134

File tree

4 files changed

+15
-32
lines changed

4 files changed

+15
-32
lines changed

src/dev/examples/animation_gzip.clj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
[examples.animation-gzip.handlers :as handlers]
55
[examples.animation-gzip.rendering :as rendering]
66
[examples.animation-gzip.state :as state]
7-
[examples.common :as c]
87
[examples.utils :as u]
98
[reitit.ring :as rr]
109
[reitit.ring.middleware.exception :as reitit-exception]
@@ -13,7 +12,6 @@
1312
[starfederation.datastar.clojure.adapter.http-kit-schemas]
1413
[starfederation.datastar.clojure.adapter.ring :as ring-gen]
1514
[starfederation.datastar.clojure.adapter.ring-schemas]
16-
[starfederation.datastar.clojure.api :as d*]
1715
[starfederation.datastar.clojure.api-schemas]
1816
[starfederation.datastar.clojure.brotli :as brotli]))
1917

@@ -34,8 +32,7 @@
3432
["/pause" handlers/pause-handler]
3533
["/updates" (handlers/->updates-handler ->sse-response opts)]
3634
["/refresh" handlers/refresh-handler]
37-
["/resize" handlers/resize-handler]
38-
c/datastar-route])
35+
["/resize" handlers/resize-handler]])
3936

4037

4138
(defn ->router [->sse-handler opts]

src/dev/examples/animation_gzip/animation.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
{:animator nil
4545
:animation-tick 100
4646
:clock 0
47-
:size {:x 10 :y 10}
47+
:size {:x 50 :y 50}
4848
:color :r
4949
:pings []})
5050

src/dev/examples/animation_gzip/rendering.clj

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,18 @@
3434

3535
#_ {:clj-kondo/ignore true}
3636
(defn cell-color [state pos]
37-
(let [general-clock (:clock state)] ;; TODO: don't need the clock
38-
(dt/loopr [r 255
39-
g 255
40-
b 255]
41-
[ping (:pings state)]
42-
(let [intensity (compute-intensity ping pos)]
43-
(if (pos? intensity)
44-
(case (:color ping)
45-
:r (recur r (modify-color g intensity) (modify-color b intensity))
46-
:g (recur (modify-color r intensity) g (modify-color b intensity))
47-
:b (recur (modify-color r intensity) (modify-color g intensity) b))
48-
(recur r g b)))
49-
[r g b])))
37+
(dt/loopr [r 255
38+
g 255
39+
b 255]
40+
[ping (:pings state)]
41+
(let [intensity (compute-intensity ping pos)]
42+
(if (pos? intensity)
43+
(case (:color ping)
44+
:r (recur r (modify-color g intensity) (modify-color b intensity))
45+
:g (recur (modify-color r intensity) g (modify-color b intensity))
46+
:b (recur (modify-color r intensity) (modify-color g intensity) b))
47+
(recur r g b)))
48+
[r g b]))
5049

5150

5251

src/dev/examples/common.clj

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
(:require
33
[dev.onionpancakes.chassis.core :as h]
44
[dev.onionpancakes.chassis.compiler :as hc]
5-
[ring.util.response :as rur]
65
[starfederation.datastar.clojure.consts :as consts]))
76

87

@@ -11,25 +10,13 @@
1110
consts/version
1211
"/bundles/datastar.js"))
1312

14-
(def datastar-response
15-
(-> (slurp "../../bundles/datastar.js")
16-
rur/response
17-
(rur/content-type "text/javascript")))
18-
19-
20-
(def datastar-route
21-
["/datastar.js"
22-
(fn ([_req] datastar-response)
23-
([_req respond _raise] (respond datastar-response)))])
24-
25-
2613
(defn page-scaffold [body]
2714
(hc/compile
2815
[[h/doctype-html5]
2916
[:html
3017
[:head
3118
[:meta {:charset "UTF-8"}]
3219
[:script {:type "module"
33-
:src "/datastar.js"}]]
20+
:src cdn-url}]]
3421
[:body body]]]))
3522

0 commit comments

Comments
 (0)