Skip to content

Commit

Permalink
Merge pull request #17 from Quamolit/rm-extra
Browse files Browse the repository at this point in the history
remove extra function and logs; alpha release
  • Loading branch information
TCXX committed Feb 5, 2020
2 parents 4b8d775 + c0ecaaa commit 599e77c
Show file tree
Hide file tree
Showing 11 changed files with 196 additions and 115 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

name: Run tests

on:
pull_request: {}
push:
branches:
- master

jobs:
test:
name: Tests

runs-on: ubuntu-latest

steps:
- uses: docker://timbru31/java-node:latest
- uses: actions/checkout@v2
- name: run tests
run: 'yarn && yarn shadow-cljs compile client'
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ Draw text:
:positiion {:x 1, :y 1}
:alpha 1
:style {
:color "red"
:fill "red"
:font-size 14
:font-family "Hind"
}
}
```
Expand Down
234 changes: 143 additions & 91 deletions calcit.cirru

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion meyvn.edn
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

{:pom {:group-id "quamolit",
:artifact-id "phlox",
:version "0.0.1-a4",
:version "0.0.1-a5",
:name "Pixi.js DSL in ClojureScript"}
:packaging {:jar {:enabled true
:remote-repository {:id "clojars"
Expand Down
8 changes: 4 additions & 4 deletions shadow-cljs.edn
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
[respo "0.11.5"]
[org.clojure/core.incubator "0.1.4"]
]
:repositories {
"central" {:url "https://maven.aliyun.com/nexus/content/groups/public/"}
"clojars" {:url "https://mirrors.ustc.edu.cn/clojars/"}
}
; :repositories {
; "central" {:url "https://maven.aliyun.com/nexus/content/groups/public/"}
; "clojars" {:url "https://mirrors.ustc.edu.cn/clojars/"}
; }
:open-file-command [
"subl"
["%s:%s:%s" :file :line :column]
Expand Down
16 changes: 7 additions & 9 deletions src/phlox/app/main.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@
(:require ["pixi.js" :as PIXI]
[phlox.core :refer [render!]]
[phlox.app.container :refer [comp-container]]
[phlox.app.schema :as schema]))
[phlox.app.schema :as schema]
[phlox.app.config :refer [dev?]]
["shortid" :as shortid]
[phlox.app.updater :refer [updater]]))

(defonce *store (atom schema/store))

(defn updater [store op op-data]
(case op
:add-x (update store :x (fn [x] (if (> x 10) 0 (+ x 1))))
:tab (assoc store :tab op-data)
(do (println "unknown op" op op-data) store)))

(defn dispatch! [op op-data]
(println "dispatch!" op op-data)
(reset! *store (updater @*store op op-data)))
(when dev? (println "dispatch!" op op-data))
(let [op-id (shortid/generate), op-time (.now js/Date)]
(reset! *store (updater @*store op op-data op-id op-time))))

(defn main! []
(comment js/console.log PIXI)
Expand Down
6 changes: 5 additions & 1 deletion src/phlox/app/updater.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
(ns phlox.app.updater )

(defn updater [store op op-data op-id op-time]
(case op :content (assoc store :content op-data) :hydrate-storage op-data store))
(case op
:add-x (update store :x (fn [x] (if (> x 10) 0 (+ x 1))))
:tab (assoc store :tab op-data)
:hydrate-storage op-data
(do (println "unknown op" op op-data) store)))
2 changes: 1 addition & 1 deletion src/phlox/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
(fn [] (-> pixi-app .-renderer (.resize js/window.innerWidth js/window.innerHeight)))))
(set! js/window._phloxTree @*app))
(let [expanded-app (expand-tree app)]
(js/console.log "render!" expanded-app)
(comment js/console.log "render!" expanded-app)
(if (nil? @*tree-element)
(mount-app! expanded-app dispatch!)
(rerender-app! expanded-app dispatch! options))
Expand Down
3 changes: 2 additions & 1 deletion src/phlox/render.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@
(component? old-element)
(= (:name element) (:name old-element)))
(if (and (= (:args element) (:args old-element)) (not (:swap? options)))
(do
(comment
do
(js/console.log "Same, no changes" (:name element))
(js/console.log (:args element) (:args old-element)))
(recur (:tree element) (:tree old-element) parent-element idx dispatch! options))
Expand Down
10 changes: 10 additions & 0 deletions upload.cirru
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

{}
:host |tiye.me
:uploads $ []
{}
:from |dist/*
:to |cdn/phlox/
{}
:from |dist/index.html
:to |repo/Quamolit/phlox/
6 changes: 0 additions & 6 deletions upload.edn

This file was deleted.

0 comments on commit 599e77c

Please sign in to comment.