Commit graph

221 commits

Author SHA1 Message Date
Olivier Goffart
2ece3817cc Make ModelHandle a struct
Last commit broke for structures containing models, because models are not PartialEq.
So we need to implement PartialEq for ModelHandle. Which means a struct needs to
be created
2020-10-31 13:32:19 +01:00
Olivier Goffart
359f42c5f7 Prepare the compiler to be async
This will allow the online editor to load imports from URL asynchroniously later

Since currently the compiler is only working on a single thread, and that we
never await on a future that could block, it is allowed to use the spin_on executor
2020-10-30 15:00:04 +01:00
Olivier Goffart
263df7dc63 Remove the www from all sixtyfps.io URL 2020-10-29 11:06:06 +01:00
Olivier Goffart
d3801e26d3 Change the syntax of structures to require the struct keyword 2020-10-27 16:09:05 +01:00
Olivier Goffart
aeade826fe New runtime implementation for the box layout
Currently only horizontal layout is supported
2020-10-26 14:19:12 +01:00
Olivier Goffart
76b7f1aef6 Allow dashes in identifier
Currenly, dashes are normalized to '_'.
Dashes are not allowed at the begining of an identifier.
If an identifier with a dash is not found, we also look for identifier
without a dash and if that exist, we hint the user to use spaces.

Issue #52
2020-10-22 18:32:25 +02:00
Olivier Goffart
20cfb65e53 Bump version 2020-10-22 08:41:45 +02:00
Olivier Goffart
c50b9d73d3 Document the generated C++ code 2020-10-21 11:29:25 +02:00
Olivier Goffart
45e8c94535 Some more documentation for the rust backend 2020-10-21 10:35:42 +02:00
Simon Hausmann
0c8fcb5f7a Some edits to the type mappings section of the node docs
Also use a consistent section title throughout.
2020-10-21 09:44:21 +02:00
Simon Hausmann
4f4d2b10e9 Add missing license tag 2020-10-20 18:18:24 +02:00
Simon Hausmann
e0e7aa1a91 Small typo fix
Missing letter :)
2020-10-20 18:11:01 +02:00
Simon Hausmann
8f73259cf6 Minor edit
Avoid "easy" as that may be perceived as patronizing.
2020-10-20 18:10:23 +02:00
Olivier Goffart
0c253efb0d Some changes in the rust documentation and its README 2020-10-20 18:02:28 +02:00
Olivier Goffart
65ec7e9b7d Fix panic on parse error
Properly report the errors instead.

The later passes panic if the AST is not well formed
2020-10-19 19:43:13 +02:00
Simon Hausmann
603abeabed Fix up links to markdown files from within other markdown files in the Rust docs
Our language reference .md file contains a refernce to
builtin_elements.md. Since rustdoc doesn't further process the embedded
markdown file, the .md link remains as-is and is broken. But we can fix
it up using a small snippet of JavaScript.

Fixes #87
2020-10-14 10:27:50 +02:00
Simon Hausmann
dd55f5205d Replace wildcard version with the released one for now 2020-10-13 15:10:24 +02:00
Olivier Goffart
8f206aa664 Fix typo in README 2020-10-13 14:10:01 +02:00
Olivier Goffart
c4deac88c5 Add links to crates.io 2020-10-13 11:51:00 +02:00
Olivier Goffart
a650f29abe Rename sixtyfps-rs-macro to sixtyfps-macros 2020-10-13 11:10:26 +02:00
Olivier Goffart
ba80d6f515 Do not inject the sixtyfps-docs-integration.html for docs.rs just yet 2020-10-13 10:40:43 +02:00
Olivier Goffart
6075860c9e Documentation about how to generate the doc 2020-10-13 09:54:35 +02:00
Simon Hausmann
9c23d9b571 Alternate fix for image loading in docs preview
Revert commit 9f488bba3b for now and
instead resort to an absolute url to the image. This way we
don't have to use the wrong base url.
2020-10-13 09:44:25 +02:00
Simon Hausmann
9f488bba3b Try to get the image loading work in the embedded doc preview
By specifying the CORS-friendly github raw url as base url for the interpreter,
we can load images using relative paths.

According to the inspector the image is loaded successfully,
so what seems to be left to fix is an event loop related issue.
2020-10-13 09:31:42 +02:00
Olivier Goffart
dbdc8483e2 Disable the check for the SIXTYFPS_STYLE env variable on wasm 2020-10-13 09:30:18 +02:00
Olivier Goffart
1138c9dbed Normalize the spelling of SixtyFPS 2020-10-13 07:48:55 +02:00
Simon Hausmann
a37d42fa0e Add an init function to the Item vtable
This will be called by the run-time and will allow items to set up
bindings that rely on internals that should not be exposed to the
compiler/runtime.
2020-10-12 16:49:44 +02:00
Olivier Goffart
7eff181e6f sixtyfps_build: add a compile_with_config function 2020-10-12 12:35:03 +02:00
Olivier Goffart
84f0fb7b07 Display a warning when no style is selected 2020-10-12 11:50:39 +02:00
Olivier Goffart
9a909142a8 Disable wayland dependency by default 2020-10-10 16:10:22 +02:00
Simon Hausmann
67f387e628 Prepare for relative resource loading from the web
Pass the base url as path to the interpreter
2020-10-08 20:42:46 +02:00
Olivier Goffart
4169254169 StandardListView in rust 2020-10-08 16:22:16 +02:00
Simon Hausmann
a472ca7c28 Automatically embed resources when cross-compiling
Don't assume that the file system is the same
2020-10-06 23:00:17 +02:00
Olivier Goffart
1b506a1b03 Move ther model code from the rust API to the corelib
We will need it in the dynamic component
2020-10-02 18:11:35 +02:00
Olivier Goffart
c7e5b39973 Layout the items in the ListView 2020-10-02 18:07:39 +02:00
Olivier Goffart
f10c2bfd7c More ListView WIP 2020-10-02 18:07:39 +02:00
Olivier Goffart
dec06be70c WIP ListView 2020-10-02 18:07:39 +02:00
Olivier Goffart
4cf61b5617 Make the "remove done items" button work in the Todo rust example 2020-09-30 17:57:19 +02:00
Olivier Goffart
2050f08f1e Ability to make change to the model property 2020-09-30 15:04:32 +02:00
Olivier Goffart
2337eb097b Refatoring of the rust Repeater so we can take track of which items are dirty
So we do not recreate items unless they were removed and re-added
2020-09-29 14:20:43 +02:00
Olivier Goffart
d9262373aa Put RepeaterInner in a RefCell instead of having every field in a refcell 2020-09-29 14:20:43 +02:00
Simon Hausmann
e5dfb3a4c0 Implement basic focus handling
Similar to the mouse_grabber, we use a VisitChildrenResult field to
track the focus item within a component. Unlike the mouse grabber
however, it is set/cleared using dedicated focus events.

The key event now routes the key event directly to the focus item.

The focus can be requested via set_focus_item on a window, which the
TextItem does.
2020-09-25 10:43:47 +02:00
Simon Hausmann
aa5babffe1 Prepare for key event delivery to a specific focus item
Begin by routing key events through the component. In the future that
will direct the event to the focus item.
2020-09-25 10:06:15 +02:00
Simon Hausmann
2b76e9277a Prepare for allowing an item mouse handler to request focus
In the future the TextInput will request focus on mouse click,for
example.

Pass the outer-most component through to ItemVTable's input_event.

For the purpose of disambiguating this component from any nested
component instantiated by a repeater or so, it's called the
app_component.

The ComponentVTable takes a reference to a ComponentRefPin instead of a
ComponentRefPin by value, as the vtable macro gets confused otherwise
and thinks it's a self argument.
2020-09-25 10:06:15 +02:00
Simon Hausmann
7ca66d62b9 Fix crash in TextInput when deleting a left-directed selection
When selecting to the left, the anchor remains to the right of the cursor.
When deleting such a selection, we fetch the cursor and anchor using a helper
method, which ensures that the anchor is to the left of the cursor.
Finally when setting the cursor then to the anchor, we need to also
set the anchor, since both were swapped.

This also add an automated test for this scenario.
2020-09-23 17:33:09 +02:00
Olivier Goffart
e3459f39d4 Parse two ways bindings 2020-09-23 14:06:08 +02:00
Olivier Goffart
b36a9004ef Move the RepeaterInner in a Rc and use that for the ModelPeer 2020-09-21 15:23:24 +02:00
Simon Hausmann
7053aee0c8 Pass the ComponentWindow to ItemVTable::input_event 2020-09-18 16:18:48 +02:00
Olivier Goffart
cbd8c6aefc Documentation for the newly added struct type 2020-09-17 13:14:01 +02:00
Olivier Goffart
8134fe5088 Support for named type as property 2020-09-17 13:14:01 +02:00