Skip to content

Commit

Permalink
update workflow; bump 0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Jan 29, 2018
1 parent afc964f commit 9478a4a
Show file tree
Hide file tree
Showing 17 changed files with 3,287 additions and 3,557 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

coir.edn -diff linguist-generated
calcit.edn -diff linguist-generated
yarn.lock -diff
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ It's like local dropdown menu component in React.js .

### Develop

https://github.com/mvc-works/coworkflow
https://github.com/mvc-works/calcit-workflow

### License

Expand Down
23 changes: 11 additions & 12 deletions build.boot
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@

(defn read-password [guide]
(String/valueOf (.readPassword (System/console) guide nil)))

(set-env!
:resource-paths #{"src"}
:dependencies '[])
:dependencies '[]
:repositories #(conj % ["clojars" {:url "https://clojars.org/repo/"
:username "jiyinyiyong"
:password (read-password "Clojars password: ")}]))

(def +version+ "0.2.0")
(def +version+ "0.2.1")

(deftask build []
(deftask deploy []
(comp
(pom :project 'respo/inflow-popup
:version +version+
:description "Local popup component for Respo"
:url "https://github.com/Respo/inflow-popup"
:scm {:url "https://github.com/mvc-works/coworkflow"}
:scm {:url "https://github.com/Respo/inflow-popup"}
:license {"MIT" "http://opensource.org/licenses/mit-license.php"})
(jar)
(install)
(target)))

(deftask deploy []
(set-env!
:repositories #(conj % ["clojars" {:url "https://clojars.org/repo/"}]))
(comp
(build)
(push :repo "clojars" :gpg-sign (not (.endsWith +version+ "-SNAPSHOT")))))
(push :repo "clojars" :gpg-sign false)))
3,149 changes: 3,149 additions & 0 deletions calcit.edn

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion coir.edn

This file was deleted.

2 changes: 0 additions & 2 deletions entry/dev.js

This file was deleted.

2 changes: 0 additions & 2 deletions entry/release.js

This file was deleted.

32 changes: 9 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@
"cdn": "rsync -avr --progress dist/* tiye.me:cdn/inflow-popup",
"tiye": "rsync -avr --progress dist/{index.html,manifest.json} tiye.me:repo/Respo/inflow-popup/",
"upload": "yarn cdn && yarn tiye",
"release": "shadow-cljs release browser --debug",
"release": "shadow-cljs release browser",
"watch": "shadow-cljs watch browser",
"compile-ssr": "shadow-cljs compile ssr",
"html-dev": "env=dev node target/ssr.js",
"html": "node target/ssr.js",
"hmr": "webpack-dev-server --config webpack.dev.coffee --hot-only",
"webpack": "webpack --config webpack.release.coffee --hide-modules --progress",
"dev": "yarn compile-ssr && yarn html-dev && yarn dev-manifest && yarn hmr",
"html-dev": "env=dev node target/ssr.js && cp entry/manifest.json target/",
"html": "node target/ssr.js && cp entry/manifest.json dist/",
"index.html": "yarn compile-ssr && yarn html-dev",
"del": "rm -rf dist/*",
"serve": "http-server dist",
"dev-manifest": "cp entry/manifest.json target/",
"manifest": "cp entry/manifest.json dist/",
"build": "yarn del && yarn release && yarn webpack && yarn compile-ssr && yarn html && yarn manifest"
"serve": "http-server dist -s",
"build": "yarn del && yarn release && yarn compile-ssr && yarn html",
"build2": "shadow-cljs clj-run build.release/-main"
},
"repository": {
"type": "git",
Expand All @@ -28,18 +25,7 @@
"author": "jiyinyiyong",
"license": "MIT",
"devDependencies": {
"coffeescript": "^2.0.1",
"css-loader": "^0.28.7",
"extract-text-webpack-plugin": "^3.0.1",
"file-loader": "^1.1.5",
"http-server": "^0.10.0",
"shadow-cljs": "^2.0.31",
"source-map-loader": "^0.2.2",
"style-loader": "^0.19.0",
"uglifyjs-webpack-plugin": "^1.0.0-beta.3",
"url-loader": "^0.6.2",
"webpack": "^3.8.1",
"webpack-dev-server": "^2.9.3",
"webpack-manifest-plugin": "^1.3.2"
"http-server": "^0.11.1",
"shadow-cljs": "^2.0.146"
}
}
23 changes: 13 additions & 10 deletions shadow-cljs.edn
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@

{:source-paths ["src"]
:dependencies [[mvc-works/hsl "0.1.2"]
[mvc-works/shell-page "0.1.3"]
[mvc-works/verbosely "0.1.0-rc2"]
[respo/ui "0.2.0"]
[respo/reel "0.2.0-alpha3"]
[mvc-works/verbosely "0.1.2"]
[mvc-works/keycode "0.1.3"]
[respo/value "0.2.1"]
[respo "0.6.4"]]
[mvc-works/shell-page "0.1.6"]
[respo "0.8.14"]
[respo/ui "0.3.2"]
[respo/value "0.2.4"]
[respo/reel "0.2.4"]]
:open-file-command ["subl" ["%s:%s:%s" :file :line :column]]
:builds {:browser {:target :browser
:output-dir "target/browser"
:asset-path "/browser"
:output-dir "target/"
:asset-path "./"
:modules {:main {:entries [inflow-popup.main]
:depends-on #{:lib}}
:lib {:entries [respo.core respo.macros
respo.comp.inspect]}}
:devtools {:after-load inflow-popup.main/reload!
:preloads [shadow.cljs.devtools.client.hud]}
:preloads [shadow.cljs.devtools.client.hud]
:http-root "target"
:http-port 7001}
:compiler-options {:infer-externs :auto}
:release {:output-dir "dist/"
:module-hash-names 8
:build-options {:manifest-name "cljs-manifest.json"}}}
:build-options {:manifest-name "assets.edn"}}}
:ssr {:target :node-script
:output-to "target/ssr.js"
:main inflow-popup.render/main!
Expand Down
19 changes: 9 additions & 10 deletions src/inflow_popup/comp/container.cljs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

(ns inflow-popup.comp.container
(:require-macros [respo.macros :refer [defcomp cursor-> <> div input span]])
(:require [hsl.core :refer [hsl]]
[respo.core :refer [create-comp]]
[respo.macros :refer [defcomp cursor-> <> div input span]]
[respo.comp.inspect :refer [comp-inspect]]
[inflow-popup.comp.dialog :refer [comp-dialog]]
[inflow-popup.comp.dropdown :refer [comp-dropdown]]
Expand All @@ -14,12 +13,10 @@

(def example-data ["Clojure" "PureScript" "Reason" "Elm" "Haskell"])

(defn on-close [mutate!] (fn [] (mutate! :show?)))
(def initial-state {:show? false, :selected (first example-data)})

(defn on-click [state] (fn [e d! m!] (m! (update state :show? not))))

(def initial-state {:show? false, :selected (first example-data)})

(defcomp
comp-container
(reel)
Expand All @@ -29,10 +26,10 @@
(div
{:style (merge layout/row widget/card)}
(div {:style layout/field-area} (<> "a dialog"))
(div {:style widget/button, :event {:click (on-click state)}} (<> "Toggle"))
(div {:style widget/button, :on-click (on-click state)} (<> "Toggle"))
(if (:show? state)
(comp-dialog
(fn [mutate!] (mutate! *cursor* (update state :show? not)))
(fn [mutate!] (mutate! %cursor (update state :show? not)))
(div {} (<> "Inside")))))
(div
{:style (merge layout/row widget/card)}
Expand All @@ -43,6 +40,8 @@
states
example-data
(:selected state)
(fn [next-item m!] (m! *cursor* (assoc state :selected next-item)))))
(comp-inspect state nil)
(comp-reel reel {}))))
(fn [next-item m!] (m! %cursor (assoc state :selected next-item)))))
(comp-inspect "state" state nil)
(cursor-> :reel comp-reel states reel {}))))

(defn on-close [mutate!] (fn [] (mutate! :show?)))
7 changes: 3 additions & 4 deletions src/inflow_popup/comp/dialog.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

(ns inflow-popup.comp.dialog
(:require-macros [respo.macros :refer [defcomp cursor-> <> div span]])
(:require [respo.core :refer [create-comp]]
(:require [respo.macros :refer [defcomp cursor-> <> div span]]
[inflow-popup.style.layout :as layout]
[inflow-popup.style.widget :as widget]
[inflow-popup.style.decoration :as decoration]))
Expand All @@ -13,5 +12,5 @@
(on-close element-inside)
(div
{:style (merge layout/float-fullscreen decoration/dim layout/hold-center {:z-index 100}),
:event {:click (fn [e d! m!] (on-close m!))}}
(div {:event {:click on-focus}, :style widget/card} element-inside)))
:on-click (fn [e d! m!] (on-close m!))}
(div {:on-click on-focus, :style widget/card} element-inside)))
49 changes: 24 additions & 25 deletions src/inflow_popup/comp/dropdown.cljs
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@

(ns inflow-popup.comp.dropdown
(:require-macros [respo.macros :refer [defcomp cursor-> <> div span style]])
(:require [hsl.core :refer [hsl]]
[respo.core :refer [create-comp]]
[respo.macros :refer [defcomp cursor-> list-> <> div span style]]
[inflow-popup.style.layout :as layout]
[inflow-popup.style.widget :as widget]))

(def style-icon {:width "32px", :font-size "10px"})

(def style-menu
{:position "absolute",
:right 0,
:top "34px",
:box-shadow (str "0 0 4px " (hsl 0 0 0 0.4)),
:width "100%",
:color (hsl 0 0 40)})
(def item-hover-style
(style
{:attrs {:innerHTML (str
".dropdown-item:hover{"
"background-color:"
(hsl 0 0 60 0.1)
"}")}}))

(def style-button
{:height "32px",
Expand All @@ -26,16 +23,20 @@
:font-size "14px",
:position "relative"})

(def item-hover-style
(style
{:attrs {:innerHTML (str
".dropdown-item:hover{"
"background-color:"
(hsl 0 0 60 0.1)
"}")}}))

(def style-divider {:width "1px", :background-color (hsl 0 0 100 0.5)})

(def style-icon {:width "32px", :font-size "10px"})

(def style-item {:padding "0 8px"})

(def style-menu
{:position "absolute",
:right 0,
:top "34px",
:box-shadow (str "0 0 4px " (hsl 0 0 0 0.4)),
:width "100%",
:color (hsl 0 0 40)})

(def style-text
{:width "120px",
:display "inline-block",
Expand All @@ -45,21 +46,19 @@
:overflow "hidden",
:text-overflow "ellipsis"})

(def style-item {:padding "0 8px"})

(defcomp
comp-dropdown
(states candidates current on-select)
(let [state (if (some? (:data states)) (:data states) false)]
(div
{:style (merge layout/row style-button), :on {:click (fn [e d! m!] (m! (not state)))}}
(<> span current (merge layout/flex style-text))
{:style (merge layout/row style-button), :on-click (fn [e d! m!] (m! (not state)))}
(<> current (merge layout/flex style-text))
(div {:style style-divider})
(div
{:style (merge layout/hold-center style-icon)}
(span {:class-name "ion-arrow-down-b"}))
(if state
(div
(list->
{:style style-menu}
(->> candidates
(map
Expand All @@ -68,6 +67,6 @@
(div
{:class-name "dropdown-item",
:style style-item,
:on {:click (fn [e d! m!] (on-select item m!) (m! (not state)))}}
:on-click (fn [e d! m!] (on-select item m!) (m! (not state)))}
(<> item))])))))
(if state item-hover-style))))
22 changes: 10 additions & 12 deletions src/inflow_popup/render.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,35 @@
[shell-page.core :refer [make-page spit slurp]]
[inflow-popup.comp.container :refer [comp-container]]
[inflow-popup.schema :as schema]
[reel.schema :as reel-schema]))
[reel.schema :as reel-schema]
[cljs.reader :refer [read-string]]))

(def base-info {:title "Inflow pop", :icon "http://cdn.tiye.me/logo/respo.png"})
(def base-info
{:title "Inflow pop",
:icon "http://cdn.tiye.me/logo/respo.png",
:inline-styles [(slurp "./entry/main.css")]})

(defn dev-page []
(make-page
""
(merge
base-info
{:styles ["http://localhost:8100/main.css"],
:scripts ["/main.js" "/browser/lib.js" "/browser/main.js"]})))
{:styles ["http://localhost:8100/main.css"], :scripts ["/lib.js" "/main.js"]})))

(def preview? (= "preview" js/process.env.prod))

(defn prod-page []
(let [reel (-> reel-schema/reel (assoc :base schema/store) (assoc :store schema/store))
html-content (make-string (comp-container reel))
webpack-info (.parse js/JSON (slurp "dist/webpack-manifest.json"))
cljs-info (.parse js/JSON (slurp "dist/cljs-manifest.json"))
assets (read-string (slurp "dist/assets.edn"))
cdn (if preview? "" "http://cdn.tiye.me/inflow-popup/")
prefix-cdn (fn [x] (str cdn x))]
(make-page
html-content
(merge
base-info
{:styles ["http://cdn.tiye.me/favored-fonts/main.css"
(prefix-cdn (aget webpack-info "main.css"))],
:scripts (map
prefix-cdn
[(-> cljs-info (aget 0) (aget "js-name"))
(-> cljs-info (aget 1) (aget "js-name"))]),
{:styles ["http://cdn.tiye.me/favored-fonts/main.css"],
:scripts (map #(-> % :output-name prefix-cdn) assets),
:ssr "respo-ssr"}))))

(defn main! []
Expand Down
4 changes: 2 additions & 2 deletions src/inflow_popup/style/layout.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

(def flex {:flex 1})

(def float-fullscreen {:position "fixed", :width "100%", :height "100%", :top 0, :left 0})

(def hold-center
{:display "flex",
:flex-direction "column",
:justify-content "center",
:align-items "center",
:overflow "auto"})

(def float-fullscreen {:position "fixed", :width "100%", :height "100%", :top 0, :left 0})

(def row
{:display "flex",
:flex-direction "row",
Expand Down
Loading

0 comments on commit 9478a4a

Please sign in to comment.