Commit graph

187 commits

Author SHA1 Message Date
Olivier Goffart
8aa1c5ae1b remove debugging code 2020-10-29 11:59:25 +01:00
Olivier Goffart
6d440eb7e3 Fix using global in imported files
This required doing the type resolving for the export with all
component in the export
2020-10-29 11:01:04 +01:00
Olivier Goffart
49582d2342 Lookup globals before properties 2020-10-29 11:01:04 +01:00
Olivier Goffart
49db8e20c7 Lookup global components 2020-10-29 11:01:04 +01:00
Olivier Goffart
333c96fd79 Change Type::Object to be able to hold a name
Internally, structure will be represented with a Type::Object with a name
instead of a Component with a void base type
2020-10-27 16:09:05 +01:00
Olivier Goffart
27a6ff1227 Move Type and related concepts in a different module
Leaving only the TypeRegister in the typeregister module
2020-10-23 11:17:14 +02: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
4fb87f401e Some fixes for the initializations of two way bindings within sub components
There are still more issues
2020-10-20 14:33:06 +02:00
Olivier Goffart
1de39e5769 String concatenation 2020-10-19 18:37:15 +02:00
Simon Hausmann
cf87ac804b Add support for relative lengths
Typically `some_length_prop: 40%` produces an error, but if there's a
matching property in the parent, then it will be allowed and interpreted
as relative value and creates a dynamically updated binding.
2020-10-16 18:54:04 +02:00
Simon Hausmann
6aa292eac1 Change the names of the logical and physical pixel units
The logical pixels are now just called "px" and the less frequently
used physical pixels have the "phx" suffix.

The existing markup was adapted using the syntax updater and the
following patch:

    +    if node.kind() == SyntaxKind::NumberLiteral {
    +        if node.text().ends_with("lx") {
    +            return write!(
    +                file,
    +                "{}px",
    +                node.text().as_str().split_at(node.text().as_str().len() - 2).0
    +            );
    +        }
    +        if node.text().ends_with("px") {
    +            return write!(
    +                file,
    +                "{}phx",
    +                node.text().as_str().split_at(node.text().as_str().len() - 2).0
    +            );
    +        }
    +    }

Fixes #49
2020-10-16 07:19:40 +02:00
Simon Hausmann
e5aa145927 Don't try to resolve absolute image resource urls
Until the compiler uses a proper url type, this won't work.
2020-10-13 09:45:39 +02:00
Olivier Goffart
72c80b41d0 Fix panic on wasm as we are not able to access the current directory 2020-10-05 18:16:52 +02:00
Olivier Goffart
cf670529ca Do not panic when the filename is empty 2020-10-05 15:24:21 +02:00
Simon Hausmann
7e0e7b43f0 Add support for calling focus() on TextInput elements
This allows activating text inputs in signal handlers connected for
example to buttons.

This implements parts of #55
2020-10-01 08:52:45 +02:00
Simon Hausmann
9ad8968529 Add support for the initial_focus synthetic property
Setting it will translate to a set_focus_item call in the constructor.

This implements parts of #55
2020-09-30 15:11:01 +02:00
Olivier Goffart
2d01b92c84 Ability to change part of objects from the .60 syntax 2020-09-30 11:33:36 +02:00
Olivier Goffart
4981c3ca75 Some check for the two way bindings 2020-09-23 14:06:08 +02:00
Olivier Goffart
bfe2bf2478 Ability to read properties of a struct 2020-09-17 13:53:00 +02:00
Olivier Goffart
a6504ee61b Start implementing some code that passes argument to functions and signals 2020-09-08 14:37:44 +02:00
Olivier Goffart
e10ed650ee Lookup of signal argument within a signal handler 2020-09-08 12:12:01 +02:00
Olivier Goffart
637a0e792c Some more progress in signal connection with arguments 2020-09-07 18:49:38 +02:00
Olivier Goffart
9f026c820d Parse declaration of signal with arguments 2020-09-07 17:41:24 +02:00
Olivier Goffart
9fbb40d91b Start working on a debug statement 2020-09-03 19:10:07 +02:00
Olivier Goffart
f5032ab0f8 Allow array as property
Also fix the lookup rules for the model property in a repeated element
2020-09-03 18:05:20 +02:00
Olivier Goffart
c46183a279 Allow all CSS colors
issue #53
2020-09-03 17:18:20 +02:00
Olivier Goffart
159d8b615a Some adjustment to the examples in langref 2020-09-01 14:27:00 +02:00
Patrick José Pereira
b990cccf60 Fix typo in sixtyfps_compiler/passes/resolving
Move typo expresion to expression

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-08-31 14:42:27 +02:00
Olivier Goffart
58cdaeb8dd Update license header to mention that commertial option are available 2020-08-26 13:23:42 +02:00
Simon Hausmann
2823f32692 Apply license headers to all non-binary/non-json sources 2020-08-17 17:55:20 +02:00
Simon Hausmann
fcc819e395 Add support for enums to the compiler
This replaces the duplicated text alignment enums
2020-08-07 13:15:43 +02:00
Simon Hausmann
aecf6a8878 Center text in buttons in the demo and gallery
This adds horizontal_alignment/vertical_alignment properties, along with
width/height to Text.

This still uses a hard-coded enumeration in the compiler, which is meant
to go away in favor of general enum support.
2020-08-07 10:02:52 +02:00
Olivier Goffart
2518af41b1 Fix for in a declared component 2020-08-04 18:51:39 +02:00
Olivier Goffart
0199b70cea if statements 2020-08-04 17:36:20 +02:00
Olivier Goffart
283387bc44 Add the self and parent implicit id 2020-08-04 15:58:40 +02:00
Olivier Goffart
5f38f03a1b Test setting signal handler and a few fix to make it work
We were not parsing CodeBlock node from the signal handler correctly,
we wer eonly taking the first expression instead of the whole codeblock

In JS, emitting signal before the show() did not update the GLOBAL_CONTEXT
needed to emit signals defined in JS
2020-08-03 15:01:10 +02:00
Olivier Goffart
feec73674f Start implementing easing curve 2020-07-29 15:19:41 +02:00
Olivier Goffart
6f30c21a98 Fix panic when connecting a non existing signal 2020-07-24 11:33:00 +02:00
Olivier Goffart
232848de9e Make sure that there is only one error reported when assigning to invalid
This also start parsing assignment ('=') as a self assignement
but the code generation is not yet implmented
2020-07-24 11:33:00 +02:00
Simon Hausmann
a9b0d84a72 Improve source file propagation
Instead of doing the SyntaxNodeWithSourceFile construction as late as
possible (in Document::from_node), we can do it as early as possible.
That'll reduce the chances of missing out the source file and prepares
for dependency loading just based on a SNWS :)

This also makes the source_file optional in the SNWS, but that's
consistent with what the diagnostics expect.
2020-07-22 16:10:02 +02:00
Olivier Goffart
bdea34d8c4 Generate an expression for states 2020-07-21 19:01:48 +02:00
Simon Hausmann
abe6888296 Collect proper per-file diagnostics in the compiler passes
When creating diagnostics in the passes, report them correctly in the
build diagnostics. There's no automated test yet, but it was manually
verified.
2020-07-21 15:27:41 +02:00
Simon Hausmann
26528a8e9c Keep track of the source file in the syntax tree
When going from the plain rowan::SyntaxNode tree to the syntax_nodes::*
elements, attach the source file and keep track of it from that point
on. That'll pave the way for proper multi-file diagnostics generated
later on from the passes, where we store syntax_nodes::* types.
2020-07-21 15:27:41 +02:00
Simon Hausmann
01fa05eeff Generalize maybe_convert_to
We don't need a concrete node, just the spanned trait impl. This simplifies the call
sites a little and reduces the noise in the upcoming patches.
2020-07-21 15:27:41 +02:00
Simon Hausmann
a5eb763c54 Eliminate another span() call site 2020-07-21 15:27:41 +02:00
Simon Hausmann
f8c0eb0bd6 Prepare for passing passing more information from syntax node to diagnostics
Let the bulk of the push_error() calls take a Spanned trait impl, so
that we can pass node on the call sites. Then when later change the
underyling trait to pass something that can also provide the source file
and we don't have to change all call sites again.
2020-07-20 16:01:15 +02:00
Simon Hausmann
4ba2425011 Use a HashSet instead of a HashMap
As pointed out by Olivier, it's possible to get the pointer back by
using ByAddress' Deref implementation.
2020-07-20 11:29:53 +02:00
Simon Hausmann
f2d6d65cd8 Fix a bug with external types using expressions
Types from external files need to be included in the inlining.
2020-07-20 10:48:53 +02:00
Simon Hausmann
e914715d88 Rename Diagnostics to FileDiagnostics
As this structure holds the diagnostics just for one file.
2020-07-16 18:25:42 +02:00
Simon Hausmann
0f0055b87c Cleanup in the expression resolution pass
It turns out that we don't need the type registry :-)
2020-07-15 13:28:56 +02:00