aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2018-10-26 13:53:23 +0000
committers-ol <s-ol@users.noreply.github.com>2018-10-26 13:53:23 +0000
commitbe7a27d275c75e77bd78233e4e393a4d9ad3957f (patch)
tree89d25a244dcb566fe557bea02c2efa17d829b1db /app
parentadd tablefs (diff)
downloadmmm-be7a27d275c75e77bd78233e4e393a4d9ad3957f.tar.gz
mmm-be7a27d275c75e77bd78233e4e393a4d9ad3957f.zip
remove submodule
Diffstat (limited to 'app')
-rw-r--r--app/index.moon44
-rw-r--r--app/init.moon96
2 files changed, 46 insertions, 94 deletions
diff --git a/app/index.moon b/app/index.moon
deleted file mode 100644
index 6c68dbe..0000000
--- a/app/index.moon
+++ /dev/null
@@ -1,44 +0,0 @@
-import h1, p, a, br, ul, tt, li from require 'lib.html'
-import opairs from require 'lib.ordered'
-
-moon = '\xe2\x98\xbd'
-demos =
- 'twisted': 'canvas animation',
- 'todo': 'Todo demo of a simple reactive UI framework',
- 'realities': 'draft of a paper on virtual and other realities',
- 'center_of_mass': 'aligning characters by their centers of mass',
- 'test_component': 'Test suite for the UI framework',
- 'tags': 'Playground for Functional Tags',
-
-on_client ->
- 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
-
-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 in opairs demos
- li (a name, href: name), ': ', desc
-
-append p {
- "made with #{moon} by "
- a { 's-ol', href: 'https://twitter.com/S0lll0s' }
-}
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}"
}