generated from Phlox-GL/phlox-workflow.cljs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d0b1de0
Showing
16 changed files
with
2,223 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
calcit.edn -diff linguist-generated | ||
calcit.cirru -diff | ||
yarn.lock -diff linguist-generated |
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 @@ | ||
|
||
/target/ | ||
/dist | ||
/node_modules | ||
.cpcache/ | ||
.shadow-cljs/ | ||
|
||
.nrepl-port |
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,17 @@ | ||
|
||
Phlox Workflow(WIP) | ||
---- | ||
|
||
Workflow based on [phlox](https://github.com/Quamolit/phlox) and Calcit Editor. | ||
|
||
### Usage | ||
|
||
WIP | ||
|
||
### Workflow | ||
|
||
Workflow https://github.com/mvc-works/phlox-workflow | ||
|
||
### License | ||
|
||
MIT |
Large diffs are not rendered by default.
Oops, something went wrong.
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,24 @@ | ||
|
||
(ns build.main | ||
(:require [shadow.cljs.devtools.api :as shadow] | ||
[clojure.java.shell :refer [sh]])) | ||
|
||
(defn sh! [command] | ||
(println command) | ||
(println (:out (sh "bash" "-c" command)))) | ||
|
||
(defn build-cdn [] | ||
(sh! "rm -rf dist/*") | ||
(shadow/release :client) | ||
(shadow/compile :page) | ||
(sh! "release=true cdn=true node target/page.js")) | ||
|
||
(defn build [] | ||
(sh! "rm -rf dist/*") | ||
(shadow/release :client) | ||
(shadow/compile :page) | ||
(sh! "release=true node target/page.js")) | ||
|
||
(defn page [] | ||
(shadow/compile :page) | ||
(sh! "node target/page.js")) |
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,11 @@ | ||
|
||
body { | ||
margin: 0; | ||
overscroll-behavior-y: none; | ||
font-family: Josefin Sans, Hind; | ||
} | ||
|
||
body * { | ||
box-sizing: border-box; | ||
flex-shrink: 0; | ||
} |
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,30 @@ | ||
{ | ||
"name": "phlox", | ||
"version": "0.1.0", | ||
"description": "a PIXI DSL in ClojureScript", | ||
"main": "index.js", | ||
"scripts": { | ||
"watch": "shadow-cljs watch client test", | ||
"serve": "http-server dist -s", | ||
"build-cdn": "shadow-cljs clj-run build.main/build-cdn", | ||
"build": "shadow-cljs clj-run build.main/build", | ||
"up": "yarn build-cdn && tiye-up", | ||
"page": "shadow-cljs clj-run build.main/page", | ||
"ln": "cd target && rm -f entry && ln -s ../entry" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:mvc-works/calcit-workflow.git" | ||
}, | ||
"author": "jiyinyiyong", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"http-server": "^0.12.1", | ||
"shadow-cljs": "^2.8.83" | ||
}, | ||
"dependencies": { | ||
"color": "^3.1.2", | ||
"pixi.js": "^5.2.1", | ||
"shortid": "^2.2.15" | ||
} | ||
} |
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 @@ | ||
{ | ||
:source-paths ["src" "cli"] | ||
:cache-blockers #{cumulo-util.build} | ||
:dependencies [ | ||
[mvc-works/hsl "0.1.2"] | ||
[mvc-works/shell-page "0.1.10"] | ||
[cumulo/util "0.1.10"] | ||
[respo "0.11.5"] | ||
[quamolit/phlox "0.0.1-a3"] | ||
[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/"} | ||
} | ||
:open-file-command [ | ||
"subl" | ||
["%s:%s:%s" :file :line :column] | ||
] | ||
:dev-http {7000 "target/"} | ||
:builds { | ||
:client { | ||
:target :browser, :output-dir "target/", :asset-path "./" | ||
:modules { | ||
:client {:init-fn phlox.main/main!} | ||
} | ||
:devtools {:after-load phlox.main/reload!, :loader-mode :script} | ||
:compiler-options {:infer-externs :auto} | ||
:release { | ||
:output-dir "dist/", :module-hash-names 8 | ||
:build-options {:manifest-name "assets.edn"} | ||
} | ||
} | ||
:page { | ||
:target :node-script, :output-to "target/page.js", :main phlox.page/main! | ||
:devtools {:after-load phlox.page/main!} | ||
} | ||
:test {:target :node-test, :output-to "target/test.js", :ns-regexp "test$"} | ||
} | ||
} |
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,23 @@ | ||
|
||
(ns phlox.config ) | ||
|
||
(def cdn? | ||
(cond | ||
(exists? js/window) false | ||
(exists? js/process) (= "true" js/process.env.cdn) | ||
:else false)) | ||
|
||
(def dev? | ||
(let [debug? (do ^boolean js/goog.DEBUG)] | ||
(cond | ||
(exists? js/window) debug? | ||
(exists? js/process) (not= "true" js/process.env.release) | ||
:else true))) | ||
|
||
(def site | ||
{:dev-ui "http://localhost:8100/main.css", | ||
:release-ui "http://cdn.tiye.me/favored-fonts/main.css", | ||
:cdn-url "http://cdn.tiye.me/phlox-workflow/", | ||
:title "Phlox", | ||
:icon "http://cdn.tiye.me/logo/quamolit.png", | ||
:storage-key "phlox-workflow"}) |
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,11 @@ | ||
|
||
(ns phlox.container | ||
(:require [phlox.core :refer [defcomp rect circle text container graphics create-list]] | ||
[phlox.util :refer [hslx]])) | ||
|
||
(defcomp | ||
comp-container | ||
(store) | ||
(container | ||
{} | ||
(text {:text "DEMO", :style {:fill (hslx 240 80 80), :font-family "Josefin Sans"}}))) |
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,28 @@ | ||
|
||
(ns phlox.main | ||
(:require ["pixi.js" :as PIXI] | ||
[phlox.core :refer [render!]] | ||
[phlox.container :refer [comp-container]] | ||
[phlox.schema :as schema])) | ||
|
||
(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))) | ||
|
||
(defn main! [] | ||
(comment js/console.log PIXI) | ||
(render! (comp-container @*store) dispatch! {}) | ||
(add-watch *store :change (fn [] (render! (comp-container @*store) dispatch! {}))) | ||
(println "App Started")) | ||
|
||
(defn reload! [] | ||
(println "Code updated") | ||
(render! (comp-container @*store) dispatch! {:swap? true})) |
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,38 @@ | ||
|
||
(ns phlox.page | ||
(:require [shell-page.core :refer [make-page spit slurp]] | ||
[phlox.schema :as schema] | ||
[cljs.reader :refer [read-string]] | ||
[phlox.config :as config] | ||
[cumulo-util.build :refer [get-ip!]]) | ||
(:require-macros [clojure.core.strint :refer [<<]])) | ||
|
||
(def base-info | ||
{:title (:title config/site), :icon (:icon config/site), :ssr nil, :inline-html nil}) | ||
|
||
(defn dev-page [] | ||
(make-page | ||
"" | ||
(merge | ||
base-info | ||
{:styles [(<< "http://~(get-ip!):8100/main.css")], | ||
:scripts ["/client.js"], | ||
:inline-styles [(slurp "./entry/main.css")]}))) | ||
|
||
(defn prod-page [] | ||
(let [assets (read-string (slurp "dist/assets.edn")) | ||
cdn (if config/cdn? (:cdn-url config/site) "") | ||
prefix-cdn (fn [x] (str cdn x))] | ||
(make-page | ||
"" | ||
(merge | ||
base-info | ||
{:styles [(:release-ui config/site)], | ||
:scripts (map #(-> % :output-name prefix-cdn) assets), | ||
:inline-styles [(slurp "./entry/main.css")]})))) | ||
|
||
(defn main! [] | ||
(println "Running mode:" (if config/dev? "dev" "release")) | ||
(if config/dev? | ||
(spit "target/index.html" (dev-page)) | ||
(spit "dist/index.html" (prod-page)))) |
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,4 @@ | ||
|
||
(ns phlox.schema ) | ||
|
||
(def store {:tab :drafts, :x 0}) |
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,5 @@ | ||
|
||
(ns phlox.updater ) | ||
|
||
(defn updater [store op op-data op-id op-time] | ||
(case op :content (assoc store :content op-data) :hydrate-storage op-data store)) |
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,10 @@ | ||
|
||
{} | ||
:host |tiye.me | ||
:uploads $ [] | ||
{} | ||
:from |dist/* | ||
:to |cdn/phlox-workflow/ | ||
{} | ||
:from |dist/index.html | ||
:to |repo/Quamolit/phlox-workflow/ |
Oops, something went wrong.