aboutsummaryrefslogtreecommitdiffstats
path: root/app/init.moon
diff options
context:
space:
mode:
Diffstat (limited to 'app/init.moon')
-rw-r--r--app/init.moon96
1 files changed, 46 insertions, 50 deletions
diff --git a/app/init.moon b/app/init.moon
index 1aaf969..daa2d47 100644
--- a/app/init.moon
+++ b/app/init.moon
@@ -1,66 +1,55 @@
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
+patch_redirs = ->
+ redirs =
+ 'center-of-mass': 'center_of_mass',
+ 'test-component': 'test_component',
+ 'play-tags': 'tags',
-experiments =
- twisted: {
- desc: 'canvas animation'
- render: -> require '.twisted'
+ { :location } = window
+ if location.search and #location.search > 1
+ name = location.search\sub 2
+ location.href = redirs[name] or name
+
+experiments = {
+ {
+ name: 'twisted',
+ desc: 'pseudo 3d animation'
},
- todo: {
- desc: 'Todo demo of a simple reactive UI framework'
- render: -> require '.todo'
+ {
+ name: 'koch',
+ desc: "lil' fractal thing",
},
- realities: {
- desc: 'draft of a paper on virtual and other realities'
- render: -> require '.realities'
+ {
+ name: 'realities',
+ desc: 'a paper on virtual and other realities'
},
- center_of_mass: {
+ {
+ name: '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'
+ {
+ name: 'todo',
+ desc: 'Todo MVC with the mmm UI framework'
},
- tags: {
- desc: 'Playground for Functional Tags'
- render: -> require '.tags'
+ {
+ name: 'test_component',
+ desc: 'test suite for the mmm reactive UI framework'
},
- tablefs: {
- desc: 'A system bigger than filesystems'
- render: -> require '.tablefs'
+ {
+ name: 'tags',
+ desc: 'organizing files with Functional Tags'
},
- koch: {
- desc: "lil' fractal thing",
- render: -> require '.koch'
+ {
+ name: 'tablefs',
+ desc: 'a (file)system to live in'
},
+}
-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 = [x for x in *experiments]
-routes.index = {
+table.insert routes, {
+ name: 'index'
route: ''
dest: 'index.html'
render: =>
@@ -87,7 +76,7 @@ routes.index = {
'.'
}
append p 'current demos:'
- append ul for name, { :desc, :route } in opairs experiments
+ append ul for { :name, :desc, :route } in *experiments
li (a name, href: route), ': ', desc
append p {
@@ -96,7 +85,14 @@ routes.index = {
}
}
+destify = (route) -> with route
+ .route or= .name
+ .dest or= "#{.route}/index.html"
+ .render or= -> require '.' .. .name
+
+routes = [ destify route for route in *routes ]
{
:routes,
+ indexed: { r.name, r for r in *routes }
render: (name) -> require ".#{name}"
}