aboutsummaryrefslogtreecommitdiffstats
path: root/app/init.moon
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2018-10-19 14:12:16 +0000
committers-ol <s-ol@users.noreply.github.com>2018-10-19 14:12:16 +0000
commit87c165036718abc9b94ca69ea7144c356dd45e3b (patch)
treea5c7b7b9519045b007e9758c4facecb343c9b710 /app/init.moon
parentsmall cleaning (diff)
downloadmmm-87c165036718abc9b94ca69ea7144c356dd45e3b.tar.gz
mmm-87c165036718abc9b94ca69ea7144c356dd45e3b.zip
build fixes
Diffstat (limited to 'app/init.moon')
-rw-r--r--app/init.moon94
1 files changed, 94 insertions, 0 deletions
diff --git a/app/init.moon b/app/init.moon
new file mode 100644
index 0000000..6895782
--- /dev/null
+++ b/app/init.moon
@@ -0,0 +1,94 @@
+require = relative ...
+import opairs from require 'lib.ordered'
+
+merge = (tables) ->
+ first = table.remove tables, 1
+ for tbl in *tables
+ for k,v in pairs tbl
+ first[k] = v
+ first
+
+experiments =
+ twisted: {
+ desc: 'canvas animation'
+ render: -> require '.twisted'
+ },
+ todo: {
+ desc: 'Todo demo of a simple reactive UI framework'
+ render: -> require '.todo'
+ },
+ realities: {
+ desc: 'draft of a paper on virtual and other realities'
+ render: -> require '.realities'
+ },
+ center_of_mass: {
+ desc: 'aligning characters by their centers of mass'
+ render: -> require '.center_of_mass'
+ },
+ test_component: {
+ desc: 'Test suite for the UI framework'
+ render: -> require '.test_component'
+ },
+ tags: {
+ desc: 'Playground for Functional Tags'
+ render: -> require '.tags'
+ },
+
+destify = (name, route) ->
+ name, with route
+ .route = name
+ .dest = "#{name}/index.html"
+
+routes = { destify k,v for k,v in pairs experiments }
+
+patch_redirs = ->
+ redirs =
+ 'center-of-mass': 'center_of_mass',
+ 'test-component': 'test_component',
+ 'play-tags': 'tags',
+
+ { :location } = window
+ if location.search and #location.search > 1
+ name = location.search\sub 2
+ location.href = redirs[name] or name
+
+routes.index = {
+ route: ''
+ dest: 'index.html'
+ render: =>
+ import h1, p, a, br, ul, tt, li from require 'lib.html'
+ import opairs from require 'lib.ordered'
+
+ moon = '\xe2\x98\xbd'
+
+ -- redirects for old-style URIs
+ on_client patch_redirs
+
+ -- menu
+ append h1 'mmm'
+ append p {
+ tt 'mmm'
+ ' is not the '
+ tt 'www'
+ ', because it runs on '
+ a { 'MoonScript', href: 'https://moonscript.org' }
+ '.'
+ br!
+ 'You can find the source code of everything '
+ a { 'here', href: 'https://github.com/s-ol/mmm' }
+ '.'
+ }
+ append p 'current demos:'
+ append ul for name, { :desc, :route } in opairs experiments
+ li (a name, href: route), ': ', desc
+
+ append p {
+ "made with #{moon} by "
+ a { 's-ol', href: 'https://twitter.com/S0lll0s' }
+ }
+}
+
+{
+ :routes,
+ render: (name) -> require ".#{name}"
+}