diff --git a/assets/styles/base.css b/assets/styles/base.css deleted file mode 100644 index 8178f5c..0000000 --- a/assets/styles/base.css +++ /dev/null @@ -1,16 +0,0 @@ -html, body { - margin: 0; - min-height: 100vh; - overflow: auto; -} - -body { - background-color: #000; - color: #fff; - - padding: 0; -} - -a { - color: #0f0; -} diff --git a/favicon.ico b/favicon.ico deleted file mode 100644 index 69c2f64..0000000 Binary files a/favicon.ico and /dev/null differ diff --git a/index.html b/index.html deleted file mode 100644 index d6d4439..0000000 --- a/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - json as html - - - - - diff --git a/js/main.mjs b/main.mjs similarity index 52% rename from js/main.mjs rename to main.mjs index e4947fd..b13c3e8 100644 --- a/js/main.mjs +++ b/main.mjs @@ -2,7 +2,7 @@ function use_as_array (val) { return Array.isArray(val) ? val : [val]; } -function json_as_html (json, state = new Map()) { +export function json_as_html (json, state = new Map()) { if (json instanceof Node) { return json; } @@ -28,33 +28,3 @@ function json_as_html (json, state = new Map()) { return elem; } - - - -const demo = [ - "div", - [ - ["id", "wrapper"] - ], - [ - ["h1", [], "header :)"], - ["p", [], "paragraph! meow"], - ["p", [], "another paragraph!! this is so cool"], - state => ["button", [ - ["onclick", _ => { - state.set("clicked", true); - render(); - }] - ], "it can even do buttons!"], - state => ["p", [], state.get("clicked") ? "clicked" : "not clicked"], - ], -]; - -const state = new Map(); - -function render () { - document.body.innerHTML = ""; - document.body.appendChild(json_as_html(demo, state)); -} - -render();