From 1e3a1e4745c51685ca48d13561c99ae7417b0215 Mon Sep 17 00:00:00 2001 From: shinriyo Date: Wed, 14 Mar 2018 20:23:39 +0900 Subject: [PATCH 1/5] add 'git clone' instructions to the readme (#51) --- readme.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.rst b/readme.rst index 3fac7ad..41f6cfa 100644 --- a/readme.rst +++ b/readme.rst @@ -7,6 +7,8 @@ to change. To try it out, run:: + git clone https://github.com/pragmagic/karax + cd karax nimble install # For first time cd examples/todoapp From 9068686614a3cf87d6ca1cb3e42663df82d1e4bd Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Wed, 23 May 2018 22:30:06 +0100 Subject: [PATCH 2/5] General improvements and fixes (#58) * Fixes Nimble package structure. * Improves readme. * Fixes compatibility with devel. * Add nice error message when ROOT is missing. * Pass responseText instead of statusText in ajax callbacks. * Implements verbatim node. * Apparently it should just be true all the time. * Small fix to readme. * Fixes verbatim node updates. * Move karun into the `karax` directory so that it's installable. --- karax.nimble | 4 ++-- karax/kajax.nim | 2 +- karax/karax.nim | 16 ++++++++++++++++ {tools => karax/tools}/karun.nim | 0 karax/vdom.nim | 9 ++++++++- readme.rst | 6 ++++-- 6 files changed, 31 insertions(+), 6 deletions(-) rename {tools => karax/tools}/karun.nim (100%) diff --git a/karax.nimble b/karax.nimble index bc49e03..743d85b 100644 --- a/karax.nimble +++ b/karax.nimble @@ -9,6 +9,6 @@ license = "MIT" requires "nim >= 0.16.1" -skipDirs = @["examples", "experiments"] +skipDirs = @["examples", "experiments", "tests"] -bin = @["tools/karun"] +bin = @["karax/tools/karun"] diff --git a/karax/kajax.nim b/karax/kajax.nim index 800d315..80184d1 100644 --- a/karax/kajax.nim +++ b/karax/kajax.nim @@ -38,7 +38,7 @@ proc ajax*(meth, url: cstring; headers: openarray[(cstring, cstring)]; if this.status == 200: contWrapper(this.status, this.responseText) else: - contWrapper(this.status, this.statusText) + contWrapper(this.status, this.responseText) if useBinary: ajax.send(blob) else: diff --git a/karax/karax.nim b/karax/karax.nim index 19a7dfb..bd3451c 100644 --- a/karax/karax.nim +++ b/karax/karax.nim @@ -4,6 +4,8 @@ import kdom, vdom, jstrutils, compact, jdict, vstyles export kdom.Event, kdom.Blob +{.experimental: "notnil".} + proc kout*[T](x: T) {.importc: "console.log", varargs, deprecated.} ## the preferred way of debugging karax applications. Now deprecated, ## you can now use ``system.echo`` instead. @@ -135,6 +137,10 @@ proc vnodeToDom*(n: VNode; kxi: KaraxInstance): Node = if n.kind == VNodeKind.text: result = document.createTextNode(n.text) attach n + elif n.kind == VNodeKind.verbatim: + result = document.createElement("div") + result.innerHTML = n.text + return result elif n.kind == VNodeKind.vthunk: let x = callThunk(vcomponents[n.text], n) result = vnodeToDom(x, kxi) @@ -183,6 +189,8 @@ proc same(n: VNode, e: Node; nesting = 0): bool = if kxi.orphans.contains(n.id): return true if n.kind == VNodeKind.component: result = same(VComponent(n).expanded, e, nesting+1) + elif n.kind == VNodeKind.verbatim: + result = true elif n.kind == VNodeKind.vthunk or n.kind == VNodeKind.dthunk: # we don't check these for now: result = true @@ -239,6 +247,9 @@ proc eq(a, b: VNode): EqResult = if a.len != b.len: return different for i in 0.. Date: Thu, 24 May 2018 00:01:01 +0200 Subject: [PATCH 3/5] cleanup dom's PR --- karax/karax.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/karax/karax.nim b/karax/karax.nim index bd3451c..6297534 100644 --- a/karax/karax.nim +++ b/karax/karax.nim @@ -4,7 +4,8 @@ import kdom, vdom, jstrutils, compact, jdict, vstyles export kdom.Event, kdom.Blob -{.experimental: "notnil".} +when defined(nimNoNil): + {.experimental: "notnil".} proc kout*[T](x: T) {.importc: "console.log", varargs, deprecated.} ## the preferred way of debugging karax applications. Now deprecated, @@ -140,6 +141,7 @@ proc vnodeToDom*(n: VNode; kxi: KaraxInstance): Node = elif n.kind == VNodeKind.verbatim: result = document.createElement("div") result.innerHTML = n.text + attach n return result elif n.kind == VNodeKind.vthunk: let x = callThunk(vcomponents[n.text], n) From 78cad8745230079f4fdce66f3c9daea8109d2552 Mon Sep 17 00:00:00 2001 From: oskca Date: Fri, 25 May 2018 15:12:22 +0800 Subject: [PATCH 4/5] make --css works in karun (#64) * make --css works in karun * ignore karun executable in source tree --- .gitignore | 2 +- karax/tools/karun.nim | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 96bc49b..acb4ec1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ nimcache/ /tests/tester -/tools/karun +karax/tools/karun *.code-workspace *.exe diff --git a/karax/tools/karun.nim b/karax/tools/karun.nim index 92ec3d4..5501879 100644 --- a/karax/tools/karun.nim +++ b/karax/tools/karun.nim @@ -42,6 +42,7 @@ proc main = rest = rest.replace("--run ") of "css": selectedCss = css + rest = rest.replace("--css ") else: discard of cmdShortOption: if op.key == "r": From 092395ed5c49b3176c69cde987d035d6842c7f1d Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 25 May 2018 22:41:01 +0200 Subject: [PATCH 5/5] bugfix: textareas are allowed to be weird --- karax/karax.nim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/karax/karax.nim b/karax/karax.nim index 6297534..e353597 100644 --- a/karax/karax.nim +++ b/karax/karax.nim @@ -199,8 +199,9 @@ proc same(n: VNode, e: Node; nesting = 0): bool = elif toTag[n.kind] == e.nodename: result = true if n.kind != VNodeKind.text: - if e.len != n.len: - echo "expected ", e.len, " real ", n.len, toTag[n.kind], " nesting ", nesting + # BUGFIX: Microsoft's Edge gives the textarea a child containing the text node! + if e.len != n.len and n.kind != VNodeKind.textarea: + echo "expected ", n.len, " real ", e.len, " ", toTag[n.kind], " nesting ", nesting return false for i in 0 ..< n.len: if not same(n[i], e[i], nesting+1): return false