HeapsIO / domkit

CSS Components based strictly typed UI framework for Haxe
MIT License
82 stars 21 forks source link

Domkit sample in Heaps + example in docs doesn't compile #47

Open AdamRamberg opened 1 year ago

AdamRamberg commented 1 year ago

Hello there πŸ‘‹ Beginner Heaps developer here. Got here because of the Unity mess and Heaps seems like a really cool and promising engine.

Disclaimer Not sure if this issue belongs to this repo or to the Heaps repo. Let me know if you want me to report the same issue in the other repo.

The issue

I'm not able to compile either: 1) The domkit sample in the Heaps repo. 2) Adding the SampleView from the docs to the Hello Hashlink example.

Steps to reproduce #1

1) Clone Heaps repo 2) Follow the samples instruction in README.md. 2b) Generate build directory 2c) Compile for Hashlink using haxe ./build/domkit/domkit_hl.hxml from the samples directory.

The following error is shown:

/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/impl/Allocator.hx:3: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/h3d/scene/Object.hx:3: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/h3d/mat/Material.hx:3: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/h3d/scene/Object.hx:391: characters 2-9 : Warning : (WDeprecated) `@:final` is deprecated in favor of `final`
/usr/local/lib/haxe/lib/heaps/1,10,0/h3d/scene/Object.hx:622: characters 2-9 : Warning : (WDeprecated) `@:final` is deprecated in favor of `final`
/usr/local/lib/haxe/lib/heaps/1,10,0/h3d/shader/Buffers.hx:3: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/Pixels.hx:84: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/hlsdl/1,13,0/sdl/Cursor.hx:5: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/hlsdl/1,13,0/sdl/Window.hx:7: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/hlsdl/1,13,0/sdl/Event.hx:23: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/hlsdl/1,13,0/sdl/Event.hx:51: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/h2d/Font.hx:110: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/Pixels.hx:84: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/h3d/shader/Buffers.hx:3: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/impl/Allocator.hx:3: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/h2d/Font.hx:110: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/res/Image.hx:3: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/fmt/hmd/Data.hx:3: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/hlsdl/1,13,0/sdl/Sdl.hx:238: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/h2d/domkit/BaseComponents.hx:550: characters 3-37 : domkit.Identifier should be String
/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/fmt/hmd/Data.hx:3: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/res/Image.hx:3: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/Res.hx:4: characters 1-8 : Uncaught exception Failure("get_full_path")
/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/res/FileTree.hx:47: characters 15-43 : Called from here
/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/res/FileTree.hx:30: characters 16-33 : Called from here
/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/res/FileTree.hx:383: characters 10-27 : Called from here
/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/Res.hx:4: characters 1-8 : Called from here
/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/Res.hx:4: characters 1-8 : For function argument 'r'
Domkit.hx:118: characters 11-20 : Class<hxd.Res> has no field initLocal

Steps to reproduce #2

1) Clone this repo. 2) Checkout branch try-domkit 3) Compile the project by either: 3b) Hitting F5 or... 3c) Run haxe compile.hxml from the root of the repo.

The following error is shown:

/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/impl/Allocator.hx:3: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/h2d/Font.hx:110: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/Pixels.hx:84: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/h3d/shader/Buffers.hx:3: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/hxd/impl/Allocator.hx:3: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
/usr/local/lib/haxe/lib/heaps/1,10,0/h2d/Font.hx:110: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`
src/Main.hx:14: characters 13-25 : Unsupported code block
src/Main.hx:11: character 1 : Build failure

Thoughts

Seems to me (but hey I'm a noob to Hexe and Heaps) that domkit hasn't been updated to match the API changes in the heaps package. Or maybe there is a mismatch of my local deps. I followed the getting started guide to setup everything so I should have the lastest of all the packges though.

AdamRamberg commented 1 year ago

I got second issue to work πŸŽ‰ Had to do the following to get it to compile: 1) Added @:uiComp("sample-view") above the class declaration. 2) Had to replace text "Hello World!" to using a node: <text text={"Hello World"}/> 3) Had to monkey patch this in /usr/local/lib/haxe/lib/heaps/1,10,0/h2d/domkit/BaseComponents.hx:

    static function updateComponentId(p:domkit.Properties<Dynamic>) {
        cast(p.obj,h2d.Object).name = p.id.toString();
    }

I saw that πŸ‘†is fixed in master of the heaps repo, but using the git version of heaps (haxelib git heaps https://github.com/HeapsIO/heaps.git master) gave me a lot of more errors.

This is my haxelib list btw, which might be of interest to someone:

domkit: 0.2.0 [git]
format: [3.6.0]
heaps: [1.10.0]
hldx: [1.13.0]
hlopenal: [1.5.0]
hlsdl: [1.13.0]
hscript: [2.5.0]
hxcpp-debug-server: [dev:/Users/adamramberg/.vscode/extensions/vshaxe.hxcpp-debugger-1.2.4/hxcpp-debug-server]

I'm leaving the issue open since I think 2 actions are needed: 1) Add the fixes I made to SampleView in the docs page. 2) Make it possible to use domkit + heaps witout monkey patching. I'm not that involved in the project so far, so not sure how that is achieved easiest (maybe a patch release of Heaps with the update on top of the current v1.10.0?).

Let me know if I should submit PR:s for any of the above.

AdamRamberg commented 1 year ago

I also got the first issue to work for WebGL builds πŸŽ‰ Must have been some weird issue with mismatching installs of haxelibs on my machine.

However, I still can't build for HashLink. Standing in samples/builds/domkit and then running haxe ./domkit_hl.hxml runs the compiler without any errors, but there is not output file. Doing the same, but for the cursor example works fine and produces a .hl file.

bh213 commented 1 year ago

If it is of any help I just updated dependencies of my domkit sample repo with (almost) the latest versions that should work for hl and js: https://github.com/bh213/heaps-domkit-sample

AdamRamberg commented 1 year ago

If it is of any help I just updated dependencies of my domkit sample repo with (almost) the latest versions that should work for hl and js: https://github.com/bh213/heaps-domkit-sample

Very cool! Being new to the echo system, I didn't know that you were able to resolve dependencies like that. That makes it somewhat reliable between machines and functions a little like a package-lock.json right? Will definitely try that route if I decide to continue using heaps and migrate our game to it.