Skip to content

Commit

Permalink
get a text preview area; refine layout; alpha release
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Jun 25, 2020
1 parent 22ade90 commit d269f70
Show file tree
Hide file tree
Showing 9 changed files with 766 additions and 522 deletions.
910 changes: 565 additions & 345 deletions calcit.cirru

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

{
:paths ["src"]
:deps {
cirru/favored-edn {:mvn/version "0.1.3"}
}
:aliases {
:release {
:extra-deps {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"author": "jiyinyiyong",
"license": "MIT",
"devDependencies": {
"shadow-cljs": "^2.10.7"
"shadow-cljs": "^2.10.13"
},
"dependencies": {
"feather-icons": "^4.28.0",
Expand Down
2 changes: 1 addition & 1 deletion release.edn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{:version "0.0.1-a1"
{:version "0.0.1-a2"
:group-id "memkits"
:artifact-id "edn-tree-viewer"
:skip-tag true
Expand Down
9 changes: 5 additions & 4 deletions shadow-cljs.edn
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
:cache-blockers #{cumulo-util.build}
:dependencies [
[mvc-works/hsl "0.1.2"]
[mvc-works/shell-page "0.1.10"]
[respo "0.12.1"]
[respo/ui "0.3.14"]
[respo/alerts "0.5.4"]
[mvc-works/shell-page "0.1.13"]
[respo "0.12.3"]
[respo/ui "0.3.15-a1"]
[respo/alerts "0.5.5"]
[respo/markdown "0.2.5"]
[respo/feather "0.1.1"]
[respo/reel "0.4.1"]
[cumulo/util "0.1.12"]
[cirru/favored-edn "0.1.3"]
[medley "1.3.0"]
[applied-science/js-interop "0.2.7"]
[org.clojure/core.incubator "0.1.4"]
Expand Down
5 changes: 4 additions & 1 deletion src/edn_tree_viewer/comp/container.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@
:input-style {:font-family ui/font-code, :min-height 320}}
(fn [result d!] (d! cursor {:data (read-string result)})))
(=< nil 8)
(comp-edn-tree-viewer (>> states :viewer) (state :data) {})
(comp-edn-tree-viewer
(>> states :viewer)
(state :data)
{:border (str "1px solid " (hsl 0 0 90)), :width 800, :height 400})
(when dev? (comp-reel (>> states :reel) reel {})))))
29 changes: 23 additions & 6 deletions src/edn_tree_viewer/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
[respo-ui.core :as ui]
[respo.core
:refer
[defcomp defeffect <> >> list-> div button textarea span input style]]
[defcomp defeffect <> >> list-> div button textarea span input style pre code]]
[respo.comp.space :refer [=<]]
[edn-tree-viewer.config :refer [dev?]]))
[edn-tree-viewer.config :refer [dev?]]
[favored-edn.core :refer [write-edn]]))

(defcomp
comp-literal
Expand Down Expand Up @@ -119,7 +120,7 @@
(empty? xs) data
(nil? data) nil
(map? data) (recur (get data (first xs)) (rest xs))
(vector? data) (recur (nth data (first xs)) (rest xs))
(vector? data) (if (number? (first xs)) (recur (nth data (first xs)) (rest xs)) nil)
(seq? data) (recur (nth data (first xs)) (rest xs))
:else nil))

Expand All @@ -133,7 +134,7 @@
{:innerHTML ".clickable-item:hover {\n background-color: hsl(0,0%,95%);\n cursor: pointer;\n}\n",
:scoped true})
(list->
{:style {:font-size 13}}
{:style (merge ui/row {:font-size 13})}
(->> state
:path
(map-indexed
Expand All @@ -146,7 +147,10 @@
(d! cursor (assoc state :path (vec (take (inc idx) (state :path))))))}
(comp-literal k))]))))
(list->
{:style (merge ui/row {:overflow :auto, :font-size 13})}
{:style (merge
ui/expand
ui/row
{:overflow :auto, :font-size 13, :border-top (str "1px solid " (hsl 0 0 90))})}
(concat
(->> state
:path
Expand Down Expand Up @@ -195,4 +199,17 @@
:path
(-> (take idx (state :path)) vec (conj result))))))
:else (div {} (comp-title "Literal") (comp-literal d))))]))))
[[(count (state :path)) (=< 400 nil)]])))))
[[-2
(div
{:style (merge
ui/expand
{:border-left (str "1px solid " (hsl 0 0 90)),
:padding "6px 0px",
:min-width "max-content",
:flex-shrink 0,
:white-space :pre,
:font-family ui/font-code,
:line-height "20px",
:padding-bottom 200})}
(code {:inner-text (write-edn (get-in data (:path state)))}))]
[-1 (div {:style {:width 200}})]])))))
4 changes: 2 additions & 2 deletions src/edn_tree_viewer/page.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
(merge
base-info
{:styles [(<< "http://~(get-ip!):8100/main.css") "/entry/main.css"],
:scripts ["/client.js"],
:scripts [{:src "/client.js", :defer? true}],
:inline-styles []})))

(defn prod-page []
Expand All @@ -33,7 +33,7 @@
(merge
base-info
{:styles [(:release-ui config/site)],
:scripts (map #(-> % :output-name prefix-cdn) assets),
:scripts (map (fn [x] {:src (-> x :output-name prefix-cdn), :defer? true}) assets),
:ssr "respo-ssr",
:inline-styles [(slurp "./entry/main.css")]}))))

Expand Down

0 comments on commit d269f70

Please sign in to comment.