diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2018-11-09 13:14:56 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2018-11-09 13:14:56 +0000 |
| commit | fa977b6a5d6f6063479a97917810ef393c312e76 (patch) | |
| tree | b21984147c34293fe91e76eef13bfd969b3a7368 /root | |
| parent | add $order mechanism (diff) | |
| parent | add deploy script (diff) | |
| download | mmm-fa977b6a5d6f6063479a97917810ef393c312e76.tar.gz mmm-fa977b6a5d6f6063479a97917810ef393c312e76.zip | |
Merge branch 'new-tup'
Diffstat (limited to 'root')
19 files changed, 189 insertions, 79 deletions
diff --git a/root/Tupdefault.lua b/root/Tupdefault.lua new file mode 100644 index 0000000..e4e433c --- /dev/null +++ b/root/Tupdefault.lua @@ -0,0 +1,30 @@ +facets = tup.glob '*' +inputs = '' +for i, file in ipairs(facets) do + inputs = inputs .. " '" .. file .. "'" +end + +LUA_PATH = {} +LUA_PATH += root .. '/?.lua' +LUA_PATH += root .. '/?.server.lua' +LUA_PATH += root .. '/?/init.lua' +LUA_PATH += root .. '/?/init.server.lua' +LUA_PATH = 'LUA_PATH="' .. table.concat(LUA_PATH, ';') .. '"' + +bundle = LUA_PATH .. ' moon ' .. root .. '/bundle_fileder.moon' +render = LUA_PATH .. ' moon ' .. root .. '/render.moon' + +facets += '<children>' +facets += root .. '/<modules>' + +tup.rule( + facets, + '^ BNDL %d^ ' .. bundle .. ' %d ' .. inputs .. ' -- %<children>', + { '$bundle.lua', '../<children>' } +) + +tup.rule( + '$bundle.lua', + '^ HTML %d^ ' .. render .. ' ' .. root, + 'index.html' +) diff --git a/root/articles/mmmfs/gallery.moon b/root/articles/mmmfs/gallery.moon deleted file mode 100644 index 4713101..0000000 --- a/root/articles/mmmfs/gallery.moon +++ /dev/null @@ -1,49 +0,0 @@ -import define_fileders from require 'mmm.mmmfs' -import div, h1, a, img, br from require 'mmm.dom' - -Fileder = define_fileders ... - -with Fileder { - 'name: alpha': 'gallery', - 'title: text/plain': "A Gallery of 25 random pictures, come in!", - 'preview: fn -> mmm/dom': => div { - 'the first pic as a little taste:', - br!, - img src: @children[1]\get 'preview', 'URL -> image/png' - } - 'fn -> mmm/dom': => - link = (child) -> a { - href: '#', - onclick: -> BROWSER\navigate child.path - img src: child\gett 'preview', 'URL -> image/png' - } - - content = [link child for child in *@children] - table.insert content, 1, h1 'gallery index' - div content - - 'slideshow: fn -> mmm/dom': => - import ReactiveVar, text, elements from require 'mmm.component' - - index = ReactiveVar 1 - - prev = (i) -> math.max 1, i - 1 - next = (i) -> math.min #@children, i + 1 - - e = elements - e.div { - e.div { - e.a 'prev', href: '#', onclick: -> index\transform prev - index\map (i) -> text " image ##{i} " - e.a 'next', href: '#', onclick: -> index\transform next - }, - index\map (i) -> img src: @children[i]\gett nil, 'URL -> image/png' - } - } - for i=1,25 - id = 120 + i - .children[i] = Fileder { - 'name: alpha': "image#{id}" - 'URL -> image/png': "https://picsum.photos/600/600/?image=#{id}" - 'preview: URL -> image/png': "https://picsum.photos/200/200/?image=#{id}" - } diff --git a/root/articles/mmmfs/gallery/link_to_image/URL -> image$png b/root/articles/mmmfs/gallery/link_to_image/URL -> image$png new file mode 100644 index 0000000..7cf76ff --- /dev/null +++ b/root/articles/mmmfs/gallery/link_to_image/URL -> image$png @@ -0,0 +1 @@ +https://picsum.photos/600/600/?image=101 diff --git a/root/articles/mmmfs/gallery/link_to_image/preview: URL -> image$png b/root/articles/mmmfs/gallery/link_to_image/preview: URL -> image$png new file mode 100644 index 0000000..2b2233b --- /dev/null +++ b/root/articles/mmmfs/gallery/link_to_image/preview: URL -> image$png @@ -0,0 +1 @@ +https://picsum.photos/200/200/?image=101 diff --git a/root/articles/mmmfs/gallery/preview: text$moonscript -> fn -> mmm$dom.moon b/root/articles/mmmfs/gallery/preview: text$moonscript -> fn -> mmm$dom.moon new file mode 100644 index 0000000..5285629 --- /dev/null +++ b/root/articles/mmmfs/gallery/preview: text$moonscript -> fn -> mmm$dom.moon @@ -0,0 +1,7 @@ +import div, img, br from require 'mmm.dom' + +=> div { + 'the first pic as a little taste:', + br!, + img src: @children[1]\get 'preview', 'URL -> image/png' +} diff --git a/root/articles/mmmfs/gallery/slideshow: text$moonscript -> fn -> mmm$component.moon b/root/articles/mmmfs/gallery/slideshow: text$moonscript -> fn -> mmm$component.moon new file mode 100644 index 0000000..0178ac2 --- /dev/null +++ b/root/articles/mmmfs/gallery/slideshow: text$moonscript -> fn -> mmm$component.moon @@ -0,0 +1,19 @@ +import ReactiveVar, text, elements from require 'mmm.component' +import div, a, img from elements + +=> + index = ReactiveVar 1 + + prev = (i) -> math.max 1, i - 1 + next = (i) -> math.min #@children, i + 1 + + div { + div { + a 'prev', href: '#', onclick: -> index\transform prev + index\map (i) -> text " image ##{i} " + a 'next', href: '#', onclick: -> index\transform next + }, + index\map (i) -> + child = assert @children[i], "image not found!" + img src: @children[i]\gett 'URL -> image/png' + } diff --git a/root/articles/mmmfs/gallery/text$moonscript -> fn -> mmm$dom.moon b/root/articles/mmmfs/gallery/text$moonscript -> fn -> mmm$dom.moon new file mode 100644 index 0000000..9bdac54 --- /dev/null +++ b/root/articles/mmmfs/gallery/text$moonscript -> fn -> mmm$dom.moon @@ -0,0 +1,12 @@ +import div, h1, a, img, br from require 'mmm.dom' + +=> + link = (child) -> a { + href: '#', + onclick: -> BROWSER\navigate child.path + img src: child\gett 'preview', 'URL -> image/png' + } + + content = [link child for child in *@children] + table.insert content, 1, h1 'gallery index' + div content diff --git a/root/articles/mmmfs/gallery/title: text$plain b/root/articles/mmmfs/gallery/title: text$plain new file mode 100644 index 0000000..ad74eec --- /dev/null +++ b/root/articles/mmmfs/gallery/title: text$plain @@ -0,0 +1 @@ +A Gallery of 25 random pictures, come on in! diff --git a/root/articles/mmmfs/ignore -> text\$markdown.md b/root/articles/mmmfs/ignore -> text\$markdown.md deleted file mode 100644 index 1c1b4f9..0000000 --- a/root/articles/mmmfs/ignore -> text\$markdown.md +++ /dev/null @@ -1,7 +0,0 @@ -## this is a markdown version or something. - -There's no content here so switch back to the real one! -(Assuming there is a switching UI by the time you are reading this, which I assume since you are reading this at all. -If you are reading this in the source, then c'mon, just scroll past and give me a break.) - -(the switching UI has now been built.) diff --git a/root/articles/mmmfs/language_support/javascript/text$javascript -> mmm$dom.js b/root/articles/mmmfs/language_support/javascript/text$javascript -> mmm$dom.js new file mode 100644 index 0000000..de56531 --- /dev/null +++ b/root/articles/mmmfs/language_support/javascript/text$javascript -> mmm$dom.js @@ -0,0 +1,15 @@ +const e = (elem, children) => { + const node = document.createElement(elem); + + if (typeof children === 'string') + node.innerText = children; + else + children.forEach(child => node.appendChild(child)); + + return node; +}; + +return e('article', [ + e('h1', 'JavaScript'), + e('p', 'JavaScript is supported natively in the browser but is not currently pre-rendered on the server.'), +]); diff --git a/root/articles/mmmfs/language_support/javascript/title: text$plain b/root/articles/mmmfs/language_support/javascript/title: text$plain new file mode 100644 index 0000000..581fbc7 --- /dev/null +++ b/root/articles/mmmfs/language_support/javascript/title: text$plain @@ -0,0 +1 @@ +JavaScript diff --git a/root/articles/mmmfs/language_support/lua/text$lua -> mmm$dom.lua b/root/articles/mmmfs/language_support/lua/text$lua -> mmm$dom.lua new file mode 100644 index 0000000..62e79f1 --- /dev/null +++ b/root/articles/mmmfs/language_support/lua/text$lua -> mmm$dom.lua @@ -0,0 +1,9 @@ +local d = require 'mmm.dom' + +local lua = d.a { 'Lua', href = 'https://www.lua.org/' } +local fengari = d.a { 'fengari.io', href = 'https://fengari.io/' } + +return d.article { + d.h1 'Lua', + d.p { lua, ' is fully supported using ', fengari, ' on the Client.' } +} diff --git a/root/articles/mmmfs/language_support/lua/title: text$plain b/root/articles/mmmfs/language_support/lua/title: text$plain new file mode 100644 index 0000000..0f9d550 --- /dev/null +++ b/root/articles/mmmfs/language_support/lua/title: text$plain @@ -0,0 +1 @@ +Lua diff --git a/root/articles/mmmfs/language_support/moonscript/text$moonscript -> mmm$dom.moon b/root/articles/mmmfs/language_support/moonscript/text$moonscript -> mmm$dom.moon new file mode 100644 index 0000000..5cc50e6 --- /dev/null +++ b/root/articles/mmmfs/language_support/moonscript/text$moonscript -> mmm$dom.moon @@ -0,0 +1,10 @@ +import a, article, h1, p from require 'mmm.dom' + +moonscript = a 'MoonScript', href: 'https://moonscript.org/' +lua = a 'Lua', href: 'https://www.lua.org/' +fengari = a 'fengari.io', href: 'https://fengari.io/' + +article { + h1 'MoonScript', + p moonscript, " is compiled to ", lua, " on the server, which is then executed on the client using ", fengari, "." +} diff --git a/root/articles/mmmfs/language_support/moonscript/title: text$plain b/root/articles/mmmfs/language_support/moonscript/title: text$plain new file mode 100644 index 0000000..f8871ac --- /dev/null +++ b/root/articles/mmmfs/language_support/moonscript/title: text$plain @@ -0,0 +1 @@ +MoonScript diff --git a/root/articles/mmmfs/language_support/preview: text$markdown b/root/articles/mmmfs/language_support/preview: text$markdown new file mode 100644 index 0000000..d6c2845 --- /dev/null +++ b/root/articles/mmmfs/language_support/preview: text$markdown @@ -0,0 +1,6 @@ +this Fileder contains some minimal examples showing support for various languages `mmmfs` supports currently. + +Language support is mostly limited by the fact that `mmmfs` currently targets web browsers, +on the server any scripting language that can be executed can theoretically be integrated with minimal effort. + +Using the inspector mode to view the source of the Fileders below is encouraged. diff --git a/root/articles/mmmfs/language_support/text$moonscript -> fn -> mmm$dom.moon b/root/articles/mmmfs/language_support/text$moonscript -> fn -> mmm$dom.moon new file mode 100644 index 0000000..4ae0679 --- /dev/null +++ b/root/articles/mmmfs/language_support/text$moonscript -> fn -> mmm$dom.moon @@ -0,0 +1,16 @@ +import article, h1, p, ul, li, a from require 'mmm.dom' + +single = (a) -> a + +=> + children = for child in *@children + title = child\gett 'title: text/plain' + li a title, href: child.path, onclick: (e) => + e\preventDefault! + BROWSER\navigate child.path + + article { + h1 single @gett 'title: text/plain' + p single @gett 'preview: mmm/dom' + ul children + } diff --git a/root/articles/mmmfs/language_support/title: text$plain b/root/articles/mmmfs/language_support/title: text$plain new file mode 100644 index 0000000..ae06474 --- /dev/null +++ b/root/articles/mmmfs/language_support/title: text$plain @@ -0,0 +1 @@ +scripting language support diff --git a/root/articles/mmmfs/text$moonscript -> fn -> mmm$dom.moon b/root/articles/mmmfs/text$moonscript -> fn -> mmm$dom.moon index 5619747..de28192 100644 --- a/root/articles/mmmfs/text$moonscript -> fn -> mmm$dom.moon +++ b/root/articles/mmmfs/text$moonscript -> fn -> mmm$dom.moon @@ -28,12 +28,53 @@ table.insert args, style: { 'list-style': 'none', 'font-size': '0.8em' } ol table.unpack args - append h1 'mmmfs', style: { 'margin-bottom': 0 } -- @TODO: s/filesystem/a way of organizing files/g - append p "a file and operating system to live in", style: { 'margin-top': 0, 'margin-bottom': '1em' } + append h1 'mmmfs', style: { 'margin-bottom': 0 } + append p "a file and operating system to live in", style: { 'margin-top': 0, 'padding-bottom': '0.2em', 'border-bottom': '1px solid black' } + + append h2 "motivation" + append p "Today, computer users are losing more and more control over their data. Between web and cloud + applications holding customer data hostage for providing the services, unappealing and limited mobile file + browsing experiences and the non-interoperable, proprietary file formats holding on to their own data has + become infeasible for many users. mmmfs is an attempt at rethinking file-systems and the computer user + experience to give control back to and empower users." + + append p "mmmfs tries to provide a filesystem that is powerful enough to let you use it as your canvas for thinking, + and working at the computer. mmmfs is made for more than just storing information. Files in mmmfs can interact + and morph to create complex behaviours." + + append p "Let us take as an example the simple task of collecting and arranging a mixed collection of images and texts + in order to brainstorm. To create an assemblage of pictures and text, many might be tempted to open an + Application like Microsoft Word or Adobe Photoshop and create a new document there. Both photoshop files and + word documents are capable of containing texts and images, but when the files are saved, direct access to the + contained data is lost. It is for example a non-trivial and unenjoyable task to edit an image file contained + in a word document in another application and have the changes apply to the document. In the same way, + text contained in a photoshop document cannot be edited in a text editor of your choice." + + append p "mmmfs tries to change all this. In mmmfs, files can contain other files and so the collage document + becomes a container for the collected images and texts just as a regular directory would. This way the individual + files remain accessible and can be modified whenever necessary, while the collage document can be edited to + change the order, sizes and spatial arrangement of it's content if this is wanted, for example." + + append p "The mmmfs file-type system also allows storing types of information that have become impractical to use + with current filesystems simply because noone has cared to make suitable applications for them. It is not common + practice, for example, to store direct links to online content on the disk for example. In mmmfs, a link to a + picture can be stored wherever an actual picture is expected for example, the system will take care of retrieving + the real picture as necessary." -- @TODO: motivation / outline problem + need - -- @TODO: quote http://pchiusano.github.io/2013-05-22/future-of-software.html on Applications + -- * applications don't let users *do* things (http://pchiusano.github.io/2013-05-22/future-of-software.html) + -- * applications are just (collections of) files - most users don't know this (anymore) + -- * users should know their system and how to move around in it + -- * filesystem trees are only *okay* for organizing information: + -- - users sooner or later choose something smarter because: + -- * filesystems work the same in every folder, even though the context can be very different + -- * appliances put their complex, structured data into opaque blocks + -- * the FS should be able to solve the structure issue + -- * the benefit is interoperability: edit the image of your report + -- * in image editor while the document editor automatically refreshes + -- * file formats dont mean much to users, they are meant for applications - let applications take care of converting them + -- * report.doc, report.pdf, report_orignal.pdf, report_old.doc, report2.doc.... append p do fileder = footnote "fileder: file + folder. 'node', 'table' etc. are too general to be used all over." @@ -91,52 +132,46 @@ }, } - append div for child in *@children preview child append h2 "details" -- @TODO s/parts: dimensions, aspects? - -- @TODO: first mention both properties & children; then go into detail + -- @TODO: first mention both facets & children; then go into detail -- @TODO: main content append do name = html.i 'name' type = html.i 'type' - p "Fileders are made up of two main parts. The first is the list of ", (html.i 'properties'), ", + p "Fileders are made up of two main parts. The first is the list of ", (html.i 'facets'), ", which are values identified by a ", name, " and ", type, ". These values are queried using strings like ", (code 'title: text/plain'), " or ", (code 'mmm/dom'), ", which describe both the ", name, - " of a property (", (moon '"title"'), " and ", (moon '""'), ", the unnamed/main property) and the ", type, - " of a property. Property types can be something resembling a MIME-type or a more complex structure - (see ", (html.i "type chains"), " below). A fileder can have multiple properties of different types - set that share a ", name, ". In this case the overlapping properties are considered equivalent and the one + " of a facet (", (moon '"title"'), " and ", (moon '""'), ", the unnamed/main facet) and the ", type, + " of a facet. Facet types can be something resembling a MIME-type or a more complex structure + (see ", (html.i "type chains"), " below). A fileder can have multiple facets of different types + set that share a ", name, ". In this case the overlapping facets are considered equivalent and the one with the most appropriate ", type, " is selected, depending on the query. - The unnamed property is considered a fileder's 'main content', i.e. what you are interested in when viewing it." + The unnamed facet is considered a fileder's 'main content', i.e. what you are interested in when viewing it." append p "The second part of a fileder is the list of it's children, which are fileders itself. The children are stored in an ordered list and currently identified by their ", (code 'name: alpha'), - " property for UI and navigation purposes only (not sure if this is a good idea tbh)." - --- append do --- github = footnote a 's-ol/mmm', href: 'https://github.com/s-ol/mmm/tree/master/app/mmmfs' --- "Oh and also everything is on github and stuff", github, --- " if you care about that." + " facet for UI and navigation purposes only (not sure if this is a good idea tbh)." append do mmmdom = code ('mmm/dom'), footnote span (code 'mmm/dom'), " is a polymorphic content type; on the server it is just an HTML string (like ", (code 'text/html'), "), but on the client it is a JS DOM Element instance." - p "What you are viewing right now is the main property of the root fileder. - The property is queried as ", mmmdom, ", a website fragment (DOM node). This website fragment + p "What you are viewing right now is the main facet of the root fileder. + The facet is queried as ", mmmdom, ", a website fragment (DOM node). This website fragment is then added to the page in the main content area, where you are most likely reading it right now." p "Anyway, this node is set up as a very generic sort of index thing and just lists its children-fileders' alongside this text part you are reading.", br!, "For each child it displays the ", (code 'title: text/plain'), - " and shows the ", (code 'preview: mmm/dom'), " property (if set)." + " and shows the ", (code 'preview: mmm/dom'), " facet (if set)." append h3 "converts" - append p "So far I have always listed properties as they are being queried, but a main feature of mmmfs is + append p "So far I have always listed facets as they are being queried, but a main feature of mmmfs is type conversion. This means that you generally ask for content in whichever format suits your application, and rely on the type resolution mechanism to make that happen." @@ -159,7 +194,7 @@ preview title, content ]] append p "Here the code that renders these previews. You can see it ", (html.i "asks"), " for the - properties ", (code 'title: text/plain'), ' and ', (code 'preview: mmm/dom'), "), but the values don't actually have to + facets ", (code 'title: text/plain'), ' and ', (code 'preview: mmm/dom'), "), but the values don't actually have to be ", (html.i "defined"), " as these types. For example, the markdown child below only provides ", (code 'preview'), " as ", (code 'text/markdown'), ":" @@ -189,7 +224,7 @@ Fileder { ]] append h3 "type chains" - append p "In addition, a property type can be encoded using multiple types in a ", (code 'type chain'), ". + append p "In addition, a facet type can be encoded using multiple types in a ", (code 'type chain'), ". For example the root node you are viewing currently is actually defined as ", (code 'fn -> mmm/dom'), ", meaning it's value is a pre moon function returing a regular ", (code 'mmm/dom'), " value." |
