Commit graph

75 commits

Author SHA1 Message Date
Olivier Goffart
f8b7989c0b Access the properties in the parent component of a repeated element
This required some refactoring of the EvaluationContext structure to include the parent context
2020-06-22 14:38:38 +02:00
Olivier Goffart
1bb8d94ab8 Support array for model in rust and in the interpreter 2020-06-19 19:46:59 +02:00
Olivier Goffart
864e74601d Add a Model type for
I guess in the future we want to make model a type that knows its inside
2020-06-19 13:13:19 +02:00
Olivier Goffart
be8f127317 Object and array parsing 2020-06-18 15:22:30 +02:00
Simon Hausmann
9df888578f Expose a ComponentWindow type in Rust
This comes with a factory function that re-directs to the backend and a
run member function to replace
sixtyfps_runtime_run_component_with_gl_renderer. For now it's all still
hidden in the generated run() method.
2020-06-17 19:15:18 +02:00
Olivier Goffart
58b450b7de Supress warning about unused variable and add a small test
No need to chack that the signal exist since `emit_signal` will
actually return an error in that case already, and this is not
possible to call emit_signal on a invalid signal from the public
API

The test is unrelated
2020-06-12 11:11:45 +02:00
Simon Hausmann
84d8eaa130 Add support for emitting signals for nodejs and the interpreter
This also enables the property and signal accessor test case for js.
2020-06-12 10:38:01 +02:00
Simon Hausmann
1a7a95a890 Reformat to pass CI 2020-06-10 18:53:57 +02:00
Olivier Goffart
300cb26208 Rename the interpreter crate to sixtyfps_interpreter 2020-06-10 08:41:49 +02:00
Simon Hausmann
1404cb73ae Add support for embedding resources in the rust generator
This is relatively straight-forward via a pass in the compiler to
collect the resources to embed and then use include_bytes! (once per
resource).

What's really annoying is that the rust resource enum can't store a
&'static [u8] because cbindgen doesn't represent that, probably because
the slice representation isn't guaranteed to stay as it is. So instead
this, for now, uses raw pointers.
2020-06-09 22:54:29 +02:00
Simon Hausmann
5bae6e01a5 Prepare for the ability to embed image data
The Image's source property used to be a string. Now it is a Resource
enum, which can either be None or an absolute file path to the image on
disk. This also replaces the internal Image type.

The compiler internally resolves the img bang expression to a resource
reference, which shall remain just an absolute path. For now the target
generator passes that through, but in the future the target generator
may choose a target specific way of embedding the data and thus
generating a different Resource type in the final code (through
compile_expression in the cpp and rust generator).

The C++ binding is a bit messy as cbindgen doesn't really support
exporting enums that can be constructed on the C++ side. So instead we
use cbindgen to merely export the type internally and only use the tag
from it then. The public API is then a custom Resource type that is
meant to be binary compatible.
2020-06-09 22:54:29 +02:00
Simon Hausmann
afd7319ae5 Rename corelib to sixtyfps_corelib
This is consistent with the other packages and since corelib is now also
a cdylib, libsixtyfps_corelib.so looks much better than libcorelib.so
:-)
2020-06-09 13:27:18 +02:00
Olivier Goffart
3651885d87 Move the compiler binary in tools/
And rename sixtyfps_compiler to sixtyfps_compilerlib
2020-06-05 09:23:38 +02:00
Olivier Goffart
7a8c549625 Be able to read or write properties from JS 2020-06-04 15:48:39 +02:00
Simon Hausmann
a2c5e66bee Rename gl renderer backend package
Use a full prefixed name (sixtyfps_rendering_backend_gl) to ensure that
the created static lib can be installed without file conflicts (libgl is
not a unique name).
2020-06-04 15:30:41 +02:00
Olivier Goffart
ec8baa81f2 formating 2020-06-04 14:05:17 +02:00
Olivier Goffart
7b8df5ca9d Use interior mutability for the cache
So we do not need a mutable reference to the Component
2020-06-04 14:03:30 +02:00
Olivier Goffart
e4366efb67 Do not require the component to be static to show a window 2020-06-04 13:44:40 +02:00
Olivier Goffart
aa08ee1148 Fix signal connection from JS
Since we do not have persistent handle, I need to find a place to save the
callback, so i save them in a property of the component
2020-06-04 12:49:33 +02:00
Olivier Goffart
49d2aec7e2 Node: add possibility to add signal handler
Right now, this only works once and then panic the second time
2020-06-04 12:49:33 +02:00
Olivier Goffart
5ee09398e8 Node: Allow to init properties to value 2020-06-03 17:33:45 +02:00
Olivier Goffart
30d61452ba Interpreter and node API: some refactoring towards being able to set properties from JS 2020-06-03 17:33:43 +02:00
Olivier Goffart
fd829fc89f Some more refactoring of the interpreter
Move the content of lib.rs to a module so we can have some
kind of public api in the lib.rs
2020-06-03 17:33:26 +02:00
Olivier Goffart
0a48252702 Interpreter: implement the ComponentVTable properly
with the drop and construct function
2020-06-03 17:33:26 +02:00
Olivier Goffart
13c7e0dec8 Begin working on a Node API
Currently, the followinf command in the example/nodetest directory works:
    npm install ../../api/sixtyfps-node && node main.js
2020-06-03 17:33:05 +02:00