|
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)
|
|
332 | 365 | :: :column "\"Frameworks" $ [] (:: :link |Respo "|virtual DOM library" |https://github.com/Respo/respo.calcit) (:: :link |Phlox "|virtual DOM like wrapper on top of PIXI" |https://github.com/Quamolit/phlox.calcit) (:: :link "\"Lagopus" "\"thin WebGPU abstraction" "\"https://github.com/Triadica/lagopus") (:: :link |Quamolit "|what if we make animations in React's way?" |https://github.com/Quamolit/quamolit.calcit) (:: :link |Quaterfoil "|thin virtual DOM wrapper over three.js" |https://github.com/Quamolit/quatrefoil.calcit) (:: :link |Cumulo "|template for tiny realtime apps" |https://github.com/Cumulo/cumulo-workflow.calcit)
|
333 | 366 | :: :column "\"Tools" $ [] (:: :link "|Calcit IR viewer" nil |https://github.com/calcit-lang/calcit-ir-viewer) (:: :link "|Calcit Error viewer" nil |https://github.com/calcit-lang/calcit-error-viewer) (:: :link "\"Calcit binding for clipboard" nil "\"https://github.com/calcit-lang/calcit-clipboard") (:: :link "\"Calcit JSON" "\"JSON binding" "\"https://github.com/calcit-lang/calcit-json")
|
334 | 367 | :: :column "\"Videos" $ [] (:: :link "\"Calcit 开发记录: list-match 语法" nil "\"https://www.bilibili.com/video/BV1Su4y1X7kg/") (:: :link "\"Calcit 0.7 变更记录, Tag, Tuple 和多态" nil "\"https://www.bilibili.com/video/BV11L411v7Vk/") (:: :link "\"Calcit 更新: caps 命令下载依赖" nil "\"https://www.bilibili.com/video/BV11A41127UW/") (:: :link "\"Calcit 开发记录: bundle_calcit 增加热替换支持" nil "\"https://www.bilibili.com/video/BV1WU4y1S7KK/") (:: :link "|Calcit-js 开发的阶段介绍 2021-11" nil |https://www.bilibili.com/video/BV1Yg411K73P) (:: :link "|calcit-js 开发记录(21-01-22) 关于 ternary-tree.ts 重构" nil |https://www.bilibili.com/video/BV1Ht4y167Fg) (:: :link "|calcit-js 阶段介绍(2021-01)" nil |https://www.bilibili.com/video/BV1H5411n7su) (:: :link "|calcit-runner 阶段记录介绍(2021-01)" nil |https://www.bilibili.com/video/BV1cK4y1W7dZ)
|
335 |
| - :: :column "\"Articles" $ [] (:: :link "\"design decision: rename \"keyword\" to \"tag\" #209" nil "\"https://github.com/calcit-lang/calcit/discussions/209") (:: :link "|Calcit 脚本语言一些基础介绍" nil |https://zhuanlan.zhihu.com/p/394791973) (:: :link "|Introducing calcit-js: toy language inspired by cljs" nil |https://clojureverse.org/t/introducing-calcit-js-toy-language-inspired-by-cljs/7097) (:: :link "|An indentation way to Lisp" nil |https://github.com/calcit-lang/calcit-runner/discussions/123) (:: :link "|Problems encountered in generating js" nil |https://github.com/calcit-lang/calcit-runner.nim/discussions/148) (:: :link "|calcit-js 的 JavaScript 代码生成与疑难" nil |https://github.com/calcit-lang/calcit-runner.nim/discussions/184) (:: :link "|ternary-tree.ts: 关于初期的性能优化(on early optimizations)" nil |https://github.com/calcit-lang/ternary-tree.ts/discussions/7) (:: :link "|A trick for cheaper persistent list in JavaScript" nil |https://clojureverse.org/t/a-trick-for-cheaper-persistent-list-in-javascript/7172) |
| 368 | + :: :column "\"Articles" $ [] (:: :link "\"Calcit 相比 Clojure 一些有意思的元编程能力 #226" nil "\"https://github.com/calcit-lang/calcit/discussions/226") (:: :link "\"design decision: rename \"keyword\" to \"tag\" #209" nil "\"https://github.com/calcit-lang/calcit/discussions/209") (:: :link "|Calcit 脚本语言一些基础介绍" nil |https://zhuanlan.zhihu.com/p/394791973) (:: :link "|Introducing calcit-js: toy language inspired by cljs" nil |https://clojureverse.org/t/introducing-calcit-js-toy-language-inspired-by-cljs/7097) (:: :link "|An indentation way to Lisp" nil |https://github.com/calcit-lang/calcit-runner/discussions/123) (:: :link "|Problems encountered in generating js" nil |https://github.com/calcit-lang/calcit-runner.nim/discussions/148) (:: :link "|calcit-js 的 JavaScript 代码生成与疑难" nil |https://github.com/calcit-lang/calcit-runner.nim/discussions/184) (:: :link "|ternary-tree.ts: 关于初期的性能优化(on early optimizations)" nil |https://github.com/calcit-lang/ternary-tree.ts/discussions/7) (:: :link "|A trick for cheaper persistent list in JavaScript" nil |https://clojureverse.org/t/a-trick-for-cheaper-persistent-list-in-javascript/7172) |
336 | 369 | |doc-features $ %{} :CodeEntry (:doc |)
|
337 | 370 | :code $ quote
|
338 | 371 | def doc-features $ [] (:: :feature "\"Immutable" "\"Values and states are represented in different data structures, which is the semantics from functional programming. Internally it's [rpds](https://docs.rs/rpds/) in Rust and a custom [2-3 tree](https://github.com/calcit-lang/ternary-tree.ts) in JavaScript.") (:: :feature "\"Lisp(Code is Data)" "\"Calcit-js was designed based on experiences from ClojureScript, with a bunch of builtin macros. It offers similar experiences to ClojureScript. So Calcit offers much power via macros, while keeping its core simple.") (:: :feature "\"Indentations-based Syntax" "\"With `bundle_calcit` command, Calcit code can be written as an indentation-based language. So you don't have to match parentheses like in Clojure. It also means now you need to handle indentations very carefully.") (:: :feature "\"Hot code swapping" "\"Calcit was built with hot swapping in mind. Combined with [calcit-editor](https://github.com/calcit-lang/editor), it watches code changes by default, and re-runs program on updates. For calcit-js, it works with Vite and Webpack to reload, learning from Elm, ClojureScript and React.") (:: :feature "\"ES Modules Syntax" "\"To leverage the power of modern browsers with help of Vite, we need another ClojureScript that emits `import`/`export` for Vite. Calcit-js does this! And this page is built with Calcit-js as well, open Console to find out more.")
|
|
0 commit comments