aboutsummaryrefslogtreecommitdiffstats
path: root/lib/component.server.moon
diff options
context:
space:
mode:
Diffstat (limited to 'lib/component.server.moon')
-rw-r--r--lib/component.server.moon27
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/component.server.moon b/lib/component.server.moon
index 54bb15c..91858c0 100644
--- a/lib/component.server.moon
+++ b/lib/component.server.moon
@@ -101,17 +101,16 @@ class ReactiveElement
b ..= "</#{@element}>"
b
-with exports = {
- :ReactiveVar,
- :ReactiveElement,
- :tohtml,
- :flush,
- :append,
- :text,
- }
- add = (e) -> exports[e] = (...) -> ReactiveElement e, ...
-
- for e in *{'div', 'form', 'span', 'a', 'p', 'button', 'ul', 'ol', 'li', 'i', 'b', 'u', 'tt'} do add e
- for e in *{'article', 'section', 'header', 'footer', 'content'} do add e
- for e in *{'br', 'hr', 'img', 'input', 'p', 'textarea'} do add e
- for i=1,8 do add "h" .. i
+elements = setmetatable {}, __index: (name) =>
+ with val = (...) -> ReactiveElement name, ...
+ @[name] = val
+
+{
+ :ReactiveVar,
+ :ReactiveElement,
+ :tohtml,
+ :flush,
+ :append,
+ :text,
+ :elements,
+}