Skip to content

Commit eb72001

Browse files
authored
Merge pull request #15 from calcit-lang/scrolls
refine scroll areas; add link to mdbook
2 parents 70ac521 + 8d2dc94 commit eb72001

File tree

8 files changed

+652
-228
lines changed

8 files changed

+652
-228
lines changed

.github/workflows/npm-publish.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
name: npm publish
3+
4+
on:
5+
release:
6+
types: [created]
7+
8+
jobs:
9+
publish-npm:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- uses: actions/setup-node@v2
15+
with:
16+
node-version: 16
17+
registry-url: https://registry.npmjs.org/
18+
19+
- run: npm publish
20+
env:
21+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.npmignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
.github/
3+
book/
4+
js-out/
5+
docs/
6+
calcit.cirru
7+
compact.cirru
8+
yarn.lock
9+
.*.cirru
10+
index.html
11+
main.mjs

assets/main.css

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
@import url("./github-gist.css");
3-
@import url("../node_modules/github-markdown-css/github-markdown.css");
4-
@import url("../node_modules/cirru-color/assets/cirru.css");
3+
@import url("github-markdown-css/github-markdown.css");
4+
@import url("cirru-color/assets/cirru.css");
55

66
body {
77
margin: 0;
@@ -24,7 +24,8 @@ body * {
2424
}
2525

2626
::-webkit-scrollbar-thumb {
27-
background-color: hsla(200,80%,76%,0.8);
27+
background-color: hsla(180,60%,76%,0.8);
28+
border-radius: 2px;
2829
}
2930

3031
::-webkit-scrollbar-corner {
@@ -41,6 +42,7 @@ pre {
4142
padding: 2px 8px;
4243
line-height: 1.4;
4344
min-width: 400px;
45+
border-radius: 4px;
4446
}
4547

4648
.doc-entry:hover {

calcit.cirru

Lines changed: 539 additions & 199 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compact.cirru

Lines changed: 66 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
{} (:package |docs-workflow)
33
:configs $ {} (:init-fn |docs-workflow.main/main!) (:reload-fn |docs-workflow.main/reload!)
44
:modules $ [] |respo.calcit/ |lilac/ |memof/ |respo-ui.calcit/ |respo-markdown.calcit/ |reel.calcit/ |respo-router.calcit/ |alerts.calcit/
5-
:version |0.0.4
5+
:version |0.0.5
66
:entries $ {}
77
:files $ {}
88
|docs-workflow.comp.container $ {}
99
:ns $ quote
1010
ns docs-workflow.comp.container $ :require (respo-ui.core :as ui)
1111
respo-ui.core :refer $ hsl
12-
respo.core :refer $ defcomp defeffect <> >> div button textarea span input list->
12+
respo.core :refer $ defcomp defeffect <> >> div button textarea span input list-> a
1313
respo.comp.space :refer $ =<
1414
reel.comp.reel :refer $ comp-reel
1515
respo-md.comp.md :refer $ comp-md
@@ -46,7 +46,9 @@
4646
def style-entry $ {} (:padding "\"0 8px") (:cursor :pointer) (:transition-duration "\"200ms") (:line-height 2.4)
4747
:border-bottom $ str "\"1px solid " (hsl 0 0 92)
4848
:border-left $ str "\"0px solid " (hsl 200 90 60)
49-
:background-color $ hsl 0 0 100 0.6
49+
|style-title $ quote
50+
def style-title $ {} (:font-family ui/font-fancy) (:font-size 18) (:font-weight 300)
51+
:color $ hsl 0 0 60
5052
|comp-container $ quote
5153
defcomp comp-container (reel docs)
5254
let
@@ -56,6 +58,7 @@
5658
state $ or (:data states)
5759
{}
5860
:selected $ []
61+
:key $ first docs
5962
:history $ []
6063
selected $ :selected state
6164
history $ :history state
@@ -67,7 +70,8 @@
6770
:render $ fn (on-close)
6871
div
6972
{} $ :style
70-
{} $ :padding "\"0 16px"
73+
merge ui/expand $ {} (:padding "\"16px 16px 120px")
74+
:border-top $ str "\"1px solid " (hsl 0 0 94)
7175
comp-nav-tree docs ([])
7276
fn (path d!)
7377
d! cursor $ next-path state path
@@ -76,28 +80,33 @@
7680
:style $ merge ui/fullscreen ui/global ui/row
7781
div
7882
{} $ :style
79-
{} (:padding "\"0 8px") (:width "\"20%") (:min-width 266) (:background-color :white)
83+
merge ui/column $ {} (:padding "\"0 8px") (:width "\"20%") (:min-width 266) (:background-color :white)
8084
:border-right $ str "\"1px solid " (hsl 0 0 94)
8185
div
8286
{}
8387
:style $ {} (:position :absolute) (:right 8) (:top 4)
8488
:on-click $ fn (e d!) (.show quick-modal d!)
85-
<> "\"Quick Jump" $ {} (:cursor :pointer) (:font-family ui/font-fancy)
89+
<> "\"Quick Jump" $ merge
90+
{} (:cursor :pointer) (:font-family ui/font-fancy)
8691
div
8792
{} $ :style
88-
{} $ :margin-top 12
89-
<> "\"Pages" $ {} (:font-family ui/font-fancy)
93+
merge ui/row-parted $ {} (:margin-top 12)
94+
<> "\"Pages" style-title
95+
a $ {} (:href "\"mdbook.html") (:inner-text "\"mdbook")
96+
:style $ {} (:font-size 12) (:font-family ui/font-fancy) (:opacity 0.3)
9097
comp-parent-menu selected docs $ fn (path d!)
9198
d! cursor $ next-path state path
9299
let
93100
parent-path $ or (butlast selected) ([])
94101
entries $ find-entries docs parent-path
95-
comp-page-entries (last selected) parent-path entries $ fn (xs d!)
96-
d! cursor $ next-path state xs
102+
div
103+
{} $ :style ui/expand
104+
comp-page-entries (last selected) parent-path entries $ fn (xs d!)
105+
d! cursor $ next-path state xs
97106
div
98107
{} $ :style
99108
{} $ :margin-top 20
100-
<> "\"Histories" $ {} (:font-family ui/font-fancy)
109+
<> "\"Histories" style-title
101110
comp-history-menu history docs $ fn (path d!)
102111
d! cursor $ next-path state path
103112
let
@@ -106,17 +115,15 @@
106115
{} $ :style ui/expand
107116
let
108117
children $ or (:children target) ([])
109-
if (empty? children) nil $ div
110-
{} $ :style
111-
{} $ :padding "\"16px"
112-
div ({})
113-
<> "\"Children pages" $ {} (:font-family ui/font-fancy)
114-
comp-page-entries nil (:selected state) children $ fn (xs d!)
118+
if (empty? children) nil $ comp-child-entries (:selected state) children
119+
fn (xs d!)
115120
d! cursor $ next-path state xs
116121
comp-doc-page target
117122
=< nil 120
118123
.render quick-modal
119124
when dev? $ comp-reel (>> states :reel) reel ({})
125+
|style-child-entry $ quote
126+
def style-child-entry $ {} (:padding "\"0 8px") (:cursor :pointer) (:transition-duration "\"200ms") (:line-height 2.4)
120127
|find-target $ quote
121128
defn find-target (entries path)
122129
if (empty? path) nil $ let
@@ -143,7 +150,8 @@
143150
target $ find-target docs sub-path
144151
[] idx $ div
145152
{}
146-
:style $ {} (:cursor :pointer) (:font-style :italic)
153+
:style $ {} (:cursor :pointer) (:font-style :italic) (:font-family ui/font-fancy)
154+
:color $ hsl 0 0 40
147155
:background-color $ hsl 180 90 94
148156
:on-click $ fn (e d!) (on-select sub-path d!)
149157
<> $ str "\"< "
@@ -174,9 +182,14 @@
174182
div
175183
{} (:class-name "\"doc-entry")
176184
:style $ merge style-entry
177-
if selected? $ {} (:background-color :white)
185+
if selected? $ {}
178186
:border-left $ str "\"10px solid " (hsl 200 90 70)
179187
<> $ :title entry
188+
=< 8 nil
189+
if
190+
not $ empty? (:children entry)
191+
<> "\"☰" $ {}
192+
:color $ hsl 180 80 60
180193
|comp-doc-page $ quote
181194
defcomp comp-doc-page (target)
182195
if (some? target)
@@ -221,6 +234,30 @@
221234
target $ find-target entries path
222235
:children target
223236
do (js/console.warn "\"no entries found for" entries path) ([])
237+
|comp-child-entries $ quote
238+
defcomp comp-child-entries (parent-path entries on-select)
239+
div
240+
{} $ :style
241+
{} (:padding "\"8px") (:min-width 320) (:max-width 400) (:background-color :white) (:margin "\"8px 12px") (:border-radius "\"4px")
242+
:border $ str "\"1px solid " (hsl 0 0 86)
243+
<> "\"Child pages" style-title
244+
list-> ({})
245+
-> entries $ map-indexed
246+
fn (idx entry)
247+
[] idx $ div
248+
{} $ :on-click
249+
fn (e d!)
250+
on-select
251+
conj parent-path $ :key entry
252+
, d!
253+
div
254+
{} (:class-name "\"doc-entry") (:style style-child-entry)
255+
<> $ :title entry
256+
=< 8 nil
257+
if
258+
not $ empty? (:children entry)
259+
<> "\"☰" $ {}
260+
:color $ hsl 180 80 60
224261
|docs-workflow.schema $ {}
225262
:ns $ quote (ns docs-workflow.schema)
226263
:defs $ {}
@@ -241,8 +278,13 @@
241278
:content $ load-doc "\"design.md"
242279
{} (:title "\"Overview") (:key :overview)
243280
:content $ load-doc "\"overview.md"
281+
:children $ []
282+
{} (:title "\"Cirru") (:key :cirru)
283+
:content $ load-doc "\"cirru.md"
244284
{} (:title "\"About") (:key :about)
245285
:content $ load-doc "\"about.md"
286+
{} (:title "\"Cirru") (:key :cirru)
287+
:content $ load-doc "\"cirru.md"
246288
|load-doc $ quote
247289
defmacro load-doc (filename)
248290
read-file $ str "\"docs/" filename
@@ -270,10 +312,6 @@
270312
docs-workflow.config :as config
271313
"\"./calcit.build-errors" :default build-errors
272314
"\"bottom-tip" :default hud!
273-
"\"highlight.js" :default hljs
274-
"\"highlight.js/lib/languages/bash" :default bash-lang
275-
"\"highlight.js/lib/languages/clojure" :default clojure-lang
276-
"\"highlight.js/lib/languages/rust" :default rust-lang
277315
:defs $ {}
278316
|render-app! $ quote
279317
defn render-app! () $ render! mount-target (comp-container @*reel schema/docs) dispatch!
@@ -286,7 +324,7 @@
286324
|*reel $ quote
287325
defatom *reel $ -> reel-schema/reel (assoc :base schema/store) (assoc :store schema/store)
288326
|main! $ quote
289-
defn main! () (.!registerLanguage hljs "\"clojure" clojure-lang) (.!registerLanguage hljs "\"bash" bash-lang) (.!registerLanguage hljs "\"rust" rust-lang)
327+
defn main! () (config/register-languages!)
290328
println "\"Running mode:" $ if config/dev? "\"dev" "\"release"
291329
if config/dev? $ load-console-formatter!
292330
render-app!
@@ -313,9 +351,12 @@
313351
hud! "\"ok~" "\"Ok"
314352
hud! "\"error" build-errors
315353
|docs-workflow.config $ {}
316-
:ns $ quote (ns docs-workflow.config)
354+
:ns $ quote
355+
ns docs-workflow.config $ :require ("\"highlight.js/lib/languages/rust" :default rust-lang) ("\"highlight.js/lib/languages/clojure" :default clojure-lang) ("\"highlight.js/lib/languages/bash" :default bash-lang) ("\"highlight.js" :default hljs)
317356
:defs $ {}
318357
|dev? $ quote
319358
def dev? $ = "\"dev" (get-env "\"mode")
320359
|site $ quote
321360
def site $ {} (:storage-key "\"workflow")
361+
|register-languages! $ quote
362+
defn register-languages! () (.!registerLanguage hljs "\"clojure" clojure-lang) (.!registerLanguage hljs "\"bash" bash-lang) (.!registerLanguage hljs "\"rust" rust-lang)

docs/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
- [Guide](guide.md)
66
- [Design](design.md)
77
- [Overview](overview.md)
8+
- [Cirru demo](cirru.md)
89
- [About](about.md)
10+
- [Cirru demo](cirru.md)

docs/cirru.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Cirru
2+
3+
```cirru
4+
defn main ()
5+
println |demo
6+
```

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"version": "0.0.4",
2+
"version": "0.0.5",
3+
"name": "@calcit/docs-workflow",
34
"dependencies": {
45
"@calcit/procs": "^0.5.28"
56
},

0 commit comments

Comments
 (0)