Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust to tink_hxx v1. #41

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .haxerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "dc1fbac",
"version": "4.3.6",
"resolveLibs": "scoped"
}
3 changes: 2 additions & 1 deletion dev.hxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ tests.hxml
-lib coconut.vdom
-lib travix
-js bin/js/tests.js
-dce full
-dce full
-D no-deprecation-warnings
7 changes: 3 additions & 4 deletions haxe_libraries/coconut.data.hxml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# @install: lix --silent download "gh://github.com/MVCoconut/coconut.data#587d2c2dbc57cc24ecb52303c5e22eb97fed12cd" into coconut.data/0.12.1/github/587d2c2dbc57cc24ecb52303c5e22eb97fed12cd
# @install: lix --silent download "gh://github.com/MVCoconut/coconut.data#ca17dc7efb408b8032116493fb2e02f362382956" into coconut.data/0.12.1/github/ca17dc7efb408b8032116493fb2e02f362382956
-lib tink_anon
-lib tink_priority
-lib tink_pure
-lib tink_state
-cp ${HAXE_LIBCACHE}/coconut.data/0.12.1/github/587d2c2dbc57cc24ecb52303c5e22eb97fed12cd/src
-D coconut.data=0.12.1
--macro coconut.data.macros.Setup.run()
-cp ${HAXE_LIBCACHE}/coconut.data/0.12.1/github/ca17dc7efb408b8032116493fb2e02f362382956/src
-D coconut.data=0.12.1
6 changes: 3 additions & 3 deletions haxe_libraries/coconut.diffing.hxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @install: lix --silent download "gh://github.com/MVCoconut/coconut.diffing#043d085a3a16bfd6e44d934424a0c403d14a9578" into coconut.diffing/0.3.0/github/043d085a3a16bfd6e44d934424a0c403d14a9578
# @install: lix --silent download "gh://github.com/MVCoconut/coconut.diffing#499d62647c2ff68ad1336a311005f9f9d8cdf332" into coconut.diffing/0.5.0/github/499d62647c2ff68ad1336a311005f9f9d8cdf332
-lib coconut.ui
-cp ${HAXE_LIBCACHE}/coconut.diffing/0.3.0/github/043d085a3a16bfd6e44d934424a0c403d14a9578/src
-D coconut.diffing=0.3.0
-cp ${HAXE_LIBCACHE}/coconut.diffing/0.5.0/github/499d62647c2ff68ad1336a311005f9f9d8cdf332/src
-D coconut.diffing=0.5.0
4 changes: 2 additions & 2 deletions haxe_libraries/coconut.ui.hxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @install: lix --silent download "gh://github.com/MVCoconut/coconut.ui#0a37e3d706e1773e6623c8d425f16d0b9c96bedd" into coconut.ui/0.12.0/github/0a37e3d706e1773e6623c8d425f16d0b9c96bedd
# @install: lix --silent download "gh://github.com/MVCoconut/coconut.ui#08d710a4a62cc2fa744d16d8ff6b4cf7a08de230" into coconut.ui/0.12.0/github/08d710a4a62cc2fa744d16d8ff6b4cf7a08de230
-lib coconut.data
-lib tink_anon
-lib tink_hxx
-cp ${HAXE_LIBCACHE}/coconut.ui/0.12.0/github/0a37e3d706e1773e6623c8d425f16d0b9c96bedd/src
-cp ${HAXE_LIBCACHE}/coconut.ui/0.12.0/github/08d710a4a62cc2fa744d16d8ff6b4cf7a08de230/src
-D coconut.ui=0.12.0
2 changes: 1 addition & 1 deletion haxe_libraries/html-entities.hxml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-D html-entities=1.0.0
# @install: lix --silent download "haxelib:/html-entities#1.0.0" into html-entities/1.0.0/haxelib
-cp ${HAXE_LIBCACHE}/html-entities/1.0.0/haxelib/src
-D html-entities=1.0.0
4 changes: 2 additions & 2 deletions haxe_libraries/tink_anon.hxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @install: lix --silent download "gh://github.com/haxetink/tink_anon#3cceb2a4bd00bd5b9a4476cb889a37f1e178e805" into tink_anon/0.7.0/github/3cceb2a4bd00bd5b9a4476cb889a37f1e178e805
# @install: lix --silent download "gh://github.com/haxetink/tink_anon#0277e6e3f97a7878f1aa9aeeccc4b7be0e9c82bc" into tink_anon/0.7.0/github/0277e6e3f97a7878f1aa9aeeccc4b7be0e9c82bc
-lib tink_macro
-cp ${HAXE_LIBCACHE}/tink_anon/0.7.0/github/3cceb2a4bd00bd5b9a4476cb889a37f1e178e805/src
-cp ${HAXE_LIBCACHE}/tink_anon/0.7.0/github/0277e6e3f97a7878f1aa9aeeccc4b7be0e9c82bc/src
-D tink_anon=0.7.0
6 changes: 3 additions & 3 deletions haxe_libraries/tink_core.hxml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# @install: lix --silent download "gh://github.com/haxetink/tink_core#4be6eca2d0b6dc9f0d8749ba84b4d7a465f049b0" into tink_core/2.0.2/github/4be6eca2d0b6dc9f0d8749ba84b4d7a465f049b0
-cp ${HAXE_LIBCACHE}/tink_core/2.0.2/github/4be6eca2d0b6dc9f0d8749ba84b4d7a465f049b0/src
-D tink_core=2.0.2
# @install: lix --silent download "gh://github.com/haxetink/tink_core#323f80d2ae63036e5b324dc68775f79e98bde396" into tink_core/2.1.1/github/323f80d2ae63036e5b324dc68775f79e98bde396
-cp ${HAXE_LIBCACHE}/tink_core/2.1.1/github/323f80d2ae63036e5b324dc68775f79e98bde396/src
-D tink_core=2.1.1
4 changes: 2 additions & 2 deletions haxe_libraries/tink_hxx.hxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @install: lix --silent download "gh://github.com/haxetink/tink_hxx#0d6cda883d5ef4c1186dbad476e016b98aad68b8" into tink_hxx/0.25.0/github/0d6cda883d5ef4c1186dbad476e016b98aad68b8
# @install: lix --silent download "gh://github.com/haxetink/tink_hxx#07cada55ff0b550b47f6e1ffb888be62d1e969c4" into tink_hxx/0.25.0/github/07cada55ff0b550b47f6e1ffb888be62d1e969c4
-lib html-entities
-lib tink_anon
-lib tink_parse
-cp ${HAXE_LIBCACHE}/tink_hxx/0.25.0/github/0d6cda883d5ef4c1186dbad476e016b98aad68b8/src
-cp ${HAXE_LIBCACHE}/tink_hxx/0.25.0/github/07cada55ff0b550b47f6e1ffb888be62d1e969c4/src
-D tink_hxx=0.25.0
4 changes: 2 additions & 2 deletions haxe_libraries/tink_macro.hxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @install: lix --silent download "gh://github.com/haxetink/tink_macro#f1010a518fdefb484eaff8727ff022ba51658e53" into tink_macro/0.23.0/github/f1010a518fdefb484eaff8727ff022ba51658e53
# @install: lix --silent download "gh://github.com/haxetink/tink_macro#40d7c2fbde362ed8273698626a31cfe35c001101" into tink_macro/0.23.0/github/40d7c2fbde362ed8273698626a31cfe35c001101
-lib tink_core
-cp ${HAXE_LIBCACHE}/tink_macro/0.23.0/github/f1010a518fdefb484eaff8727ff022ba51658e53/src
-cp ${HAXE_LIBCACHE}/tink_macro/0.23.0/github/40d7c2fbde362ed8273698626a31cfe35c001101/src
-D tink_macro=0.23.0
4 changes: 2 additions & 2 deletions haxe_libraries/tink_state.hxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @install: lix --silent download "gh://github.com/haxetink/tink_state#b01eb8bd47f7264420604b5f8816dde69e5dec55" into tink_state/1.0.0-beta.3/github/b01eb8bd47f7264420604b5f8816dde69e5dec55
# @install: lix --silent download "gh://github.com/haxetink/tink_state#9fda3b07ea27e299e7f53720d6e349787477268e" into tink_state/1.0.0-beta.3/github/9fda3b07ea27e299e7f53720d6e349787477268e
-lib tink_core
-cp ${HAXE_LIBCACHE}/tink_state/1.0.0-beta.3/github/b01eb8bd47f7264420604b5f8816dde69e5dec55/src
-cp ${HAXE_LIBCACHE}/tink_state/1.0.0-beta.3/github/9fda3b07ea27e299e7f53720d6e349787477268e/src
-D tink_state=1.0.0-beta.3
18 changes: 11 additions & 7 deletions src/coconut/vdom/Html.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class Html {
case v: v;
}

static public inline function text(value:String):RenderResult
return Text.inst.vnode(value, null, null, null);
static public function text(value:String):RenderResult
return inline TextNode.inst.vnode(value, null, null, null);//TODO: would be faster to have a dedicated text node type insteat of going through factories and all that

static public function raw(hxxMeta:HxxMeta<Element>, attr:HtmlFragmentAttr & { ?tag:String }):RenderResult {
return HtmlFragment.byTag(attr.tag).vnode(attr, hxxMeta.key, hxxMeta.ref);
Expand Down Expand Up @@ -78,20 +78,24 @@ private class HtmlFragment extends Factory<HtmlFragmentAttr, Node, Element> {

}

private class Text extends Factory<String, Node, Node> {
static public var inst(default, null):Text = new Text();
private class TextNode extends Factory<String, Node, Text> {
static public var inst(default, null):TextNode = new TextNode();

function new() {}

override public function adopt(target:Node)
override public function adopt(target:Node):Text
return
if (target.nodeType == Node.TEXT_NODE) target;
if (target.nodeType == Node.TEXT_NODE) cast target;
else null;

override function hydrate(target:Text, data:String)
if (target.textContent.length > data.length)
target.splitText(data.length);

public function create(text)
return document.createTextNode(text);

public function update(target:Node, nu, old)
public function update(target:Text, nu, old)
if (nu != old) target.textContent = nu;
}

Expand Down
2 changes: 1 addition & 1 deletion src/coconut/vdom/macros/HXX.hx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import coconut.ui.macros.Helpers;
import tink.hxx.*;

class HXX {
static final generator = new Generator(Tag.extractAllFrom(macro coconut.vdom.Html));
static final generator = new Generator();

static public function parse(e)
return Helpers.parse(e, generator, 'coconut.vdom.RenderResult.fragment');
Expand Down
2 changes: 1 addition & 1 deletion tests/Issue37.hx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Issue37 {
Renderer.mount(container, '
<Isolated>
<if ${state.value == 0}>
<button id="issue37" onclick=${state.set(state.value + 1)}/>
<button id="issue37" onclick=${() -> state.set(state.value + 1)}/>
<else>
<button id="issue37" />
</if>
Expand Down
1 change: 1 addition & 0 deletions tests/import.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import coconut.vdom.Html.*;
Loading