|
12 | 12 | a $ {} (:inner-text title) (:class-name css/link) (:href url) (:target "\"_blank")
|
13 | 13 | |comp-bg $ %{} :CodeEntry (:doc |)
|
14 | 14 | :code $ quote
|
15 |
| - defcomp comp-bg () (println "\"@@@@@@@@@@@@@@@@\n@\n@ Well, code is not minified on purpose~\n@\n@ although it's still bundled with Vite.\n@\n@@@@@@@@@@@@@@@@") |
| 15 | + defcomp comp-bg () |
16 | 16 | ; img $ {} (:src "\"http://cdn.tiye.me/logo/calcit.png")
|
17 | 17 | :style $ {} (:width "\"60vw") (:z-index -10) (:min-width "\"480px") (:position :fixed) (:opacity 0.12) (:right 0) (:top "\"10vh")
|
18 | 18 | div $ {}
|
|
55 | 55 | <> "\"an interpreter for calcit snapshot, and hot code swapping friendly."
|
56 | 56 | =< nil 8
|
57 | 57 | =< nil 24
|
58 |
| - comp-snippet-demo |
| 58 | + comp-snippet-demo $ >> states :snippets |
| 59 | + =< nil 8 |
59 | 60 | comp-promotions
|
60 | 61 | list->
|
61 | 62 | {} $ :class-name style-cards-containers
|
|
120 | 121 | :style $ {} (:flex-wrap :wrap)
|
121 | 122 | div
|
122 | 123 | {} $ :class-name css/row-middle
|
123 |
| - button $ {} (:inner-text "\"Play snippets") |
124 |
| - :class-name $ str-spaced css/button style-promo-button style-main-button |
125 |
| - :on-click $ fn (e d!) (js/window.open "\"http://repo.calcit-lang.org/calcit-wasm-play/" "\"_blank") |
126 |
| - =< 8 nil |
| 124 | + add-link "\"GitHub" "\"https://github.com/calcit-lang/calcit/" |
| 125 | + div |
| 126 | + {} (:class-name css/row-middle) |
| 127 | + :style $ {} (:gap "\"8px") |
| 128 | + add-link "\"Browse APIs" "\"http://apis.calcit-lang.org" |
127 | 129 | button $ {} (:inner-text "\"Guidebook")
|
128 | 130 | :class-name $ str-spaced css/button style-promo-button
|
129 | 131 | :on-click $ fn (e d!) (js/window.open "\"http://repo.calcit-lang.org/guidebook/" "\"_blank")
|
130 |
| - =< 8 nil |
131 |
| - add-link "\"Browse APIs" "\"http://apis.calcit-lang.org" |
132 |
| - div |
133 |
| - {} $ :class-name css/row-middle |
134 |
| - add-link "\"GitHub" "\"https://github.com/calcit-lang/calcit/" |
| 132 | + button $ {} (:inner-text "\"Play snippets") |
| 133 | + :class-name $ str-spaced css/button style-promo-button style-main-button |
| 134 | + :on-click $ fn (e d!) (js/window.open "\"http://repo.calcit-lang.org/calcit-wasm-play/" "\"_blank") |
135 | 135 | |comp-snippet-demo $ %{} :CodeEntry (:doc |)
|
136 | 136 | :code $ quote
|
137 |
| - defcomp comp-snippet-demo () $ div ({}) |
138 |
| - pre $ {} (:class-name style-snippet) |
139 |
| - :innerHTML $ cirru-color/generateHtml "\"defcomp comp-link (link)\n tag-match link $ \n :link title sub-title url\n div ({})\n a $ {} (:href url)\n :inner-text title\n :target \"\\\"_blank\"\n :class-name style-display-link\n =< 8 nil\n <> sub-title $ str-spaced css/font-fancy style-sub-title\n" |
| 137 | + defcomp comp-snippet-demo (states) |
| 138 | + let |
| 139 | + cursor $ :cursor states |
| 140 | + state $ either (:data states) :tag-match |
| 141 | + div |
| 142 | + {} (:class-name css/row) |
| 143 | + :style $ {} (:flex-wrap :wrap) |
| 144 | + comp-tabs |
| 145 | + {} (:selected state) (:vertical? true) |
| 146 | + :style $ {} (:margin-top 20) (:padding "\"0 8px") (:min-width 160) |
| 147 | + [] (&{} :name :tag-match :title "|Pattern matching") (&{} :name :component :title |Component) (&{} :name :persistent-data :title "|Persistent data") (&{} :name :pipeline :title "|Pipeline macro") |
| 148 | + fn (info d!) |
| 149 | + d! cursor $ :name info |
| 150 | + pre $ {} |
| 151 | + :class-name $ str-spaced css/expand style-snippet |
| 152 | + :style $ {} (:min-width 300) |
| 153 | + :innerHTML $ cirru-color/generateHtml |
| 154 | + trim $ pick-demo state |
| 155 | + , "\"defcomp comp-link (link)\n tag-match link $ \n :link title sub-title url\n div ({})\n a $ {} (:href url)\n :inner-text title\n :target \"\\\"_blank\"\n :class-name style-display-link\n =< 8 nil\n <> sub-title $ str-spaced css/font-fancy style-sub-title\n" |
140 | 156 | |comp-visual $ %{} :CodeEntry (:doc |)
|
141 | 157 | :code $ quote
|
142 | 158 | defcomp comp-visual () $ div ({})
|
|
145 | 161 | {} $ :style
|
146 | 162 | {} $ :display :flex
|
147 | 163 | img $ {} (:class-name style-editor-img) (:src "\"https://cos-sh.tiye.me/cos-up/00c992c3061ed59d8c7d533b7a31433b-calcit-editor.png")
|
| 164 | + |demo-component $ %{} :CodeEntry (:doc |) |
| 165 | + :code $ quote |
| 166 | + def demo-component $ inline-content! "\"content/demo/comp.cirru" |
| 167 | + |demo-persistent-data $ %{} :CodeEntry (:doc |) |
| 168 | + :code $ quote |
| 169 | + def demo-persistent-data $ inline-content! "\"content/demo/persistent-data.cirru" |
| 170 | + |demo-pipeline $ %{} :CodeEntry (:doc |) |
| 171 | + :code $ quote |
| 172 | + def demo-pipeline $ inline-content! "\"content/demo/pipeline.cirru" |
| 173 | + |demo-tag-match $ %{} :CodeEntry (:doc |) |
| 174 | + :code $ quote |
| 175 | + def demo-tag-match $ inline-content! "\"content/demo/tag-match.cirru" |
148 | 176 | |inline-content! $ %{} :CodeEntry (:doc |)
|
149 | 177 | :code $ quote
|
150 | 178 | defmacro inline-content! (path) (read-file path)
|
| 179 | + |pick-demo $ %{} :CodeEntry (:doc |) |
| 180 | + :code $ quote |
| 181 | + defn pick-demo (k) |
| 182 | + case-default k demo-tag-match (:tag-match demo-tag-match) (:pipeline demo-pipeline) (:component demo-component) (:persistent-data demo-persistent-data) |
151 | 183 | |style-bg $ %{} :CodeEntry (:doc |)
|
152 | 184 | :code $ quote
|
153 | 185 | defstyle style-bg $ {}
|
|
220 | 252 | :background-color $ hsl 0 0 100
|
221 | 253 | :border $ str "\"1px solid " (hsl 0 0 90)
|
222 | 254 | :line-height "\"24px"
|
223 |
| - :max-width "\"calc(100vw - 64px)" |
224 | 255 | :overflow :auto
|
225 | 256 | |style-sub-title $ %{} :CodeEntry (:doc |)
|
226 | 257 | :code $ quote
|
|
240 | 271 | respo.css :refer $ defstyle
|
241 | 272 | respo-ui.css :as css
|
242 | 273 | app.schema :refer $ doc-features doc-columns
|
| 274 | + respo-ui.comp :refer $ comp-tabs |
243 | 275 | |app.config $ %{} :FileEntry
|
244 | 276 | :defs $ {}
|
245 | 277 | |cdn? $ %{} :CodeEntry (:doc |)
|
|
282 | 314 | when (some? raw)
|
283 | 315 | dispatch! :hydrate-storage $ extract-cirru-edn (js/JSON.parse raw)
|
284 | 316 | println "|App started."
|
| 317 | + println "\"@@@@@@@@@@@@@@@@\n@\n@ Well, code is not minified on purpose~\n@\n@ although it's still bundled with Vite.\n@\n@@@@@@@@@@@@@@@@" |
285 | 318 | |mount-target $ %{} :CodeEntry (:doc |)
|
286 | 319 | :code $ quote
|
287 |
| - def mount-target $ .querySelector js/document |.app |
| 320 | + def mount-target $ js/document.querySelector |.app |
288 | 321 | |persist-storage! $ %{} :CodeEntry (:doc |)
|
289 | 322 | :code $ quote
|
290 | 323 | defn persist-storage! () $ .setItem js/localStorage (:storage-key config/site)
|
|
0 commit comments