Commit graph

357 commits

Author SHA1 Message Date
Olivier Goffart
dfdbc942f6 Split Expression::CallbackReference and Expresison::FunctionReference 2022-12-06 14:56:25 +01:00
Olivier Goffart
4672e54f5e Compiler: make calling functions work 2022-12-06 14:56:25 +01:00
Olivier Goffart
851a910e41 Parser: Parse functions 2022-12-06 14:56:25 +01:00
Olivier Goffart
fdf5d4c0dd Fix in/out/private property on global
This is technicly a breking change. But this is also a bug and it was only
allowed since 0.3.2, so it is probably fine.

The problem is that any property access to a global was considered as being
local.
Now, change that so that property access to a global object is no longer
local, and other components can't access private property anymore
2022-12-06 10:29:44 +01:00
Simon Hausmann
755cd66398 Revert "Prospective build fix for arm cross build" and "With Rust 1.64 we can use core:ffi types instead of depending on libc"
This reverts commit 000d95670b and commit
d764796e0c to fix arm cross build and
x86-64 linux.

Let's use the core::ffi types when fontconfig-sys switches to it.
2022-12-06 09:16:03 +01:00
Simon Hausmann
11f46906a2 Centralize rust-version in Cargo.toml
Require 1.64 in the workspace and inherit the setting in package
Cargo.toml files.
2022-12-05 12:39:14 +01:00
Simon Hausmann
d764796e0c With Rust 1.64 we can use core:ffi types instead of depending on libc 2022-12-05 10:33:50 +01:00
Simon Hausmann
7122d22c88 janitor: use the new default attribute for enums 2022-12-05 10:20:39 +01:00
Olivier Goffart
20bc567b6d Don't match builtin type purely on it's base type name
Make sure this is the actual builtin type we are looking at and not a
re-defined component

Doesn't work for ListView unfortunately because ListView is not a
builtin type

CC #861
2022-12-01 12:56:59 +01:00
Olivier Goffart
d468bbec05 ListView: Warn when we have other elements than just a for
This is not supported right now, the other elements will not be part of
the layout, and two `for` will be in the same listview, creating bad
situation with the scrollbar.

This is a warning since it would be a breaking change to make it an
error.

For example, we used a FocusScope in the StandardListView implementation so
I had to go trough one level of indirection

CC: #860
2022-11-30 11:17:22 +01:00
Olivier Goffart
151df7167d Fix visibility on drop shadow
`visible:false` would't hide the drop shadow

Fixes: #1460
2022-11-29 17:00:52 +01:00
Olivier Goffart
261e612555 Janitor: dependencies update 2022-11-28 15:59:45 +01:00
Olivier Goffart
eee2a3d012 Fix two ways binding between globals
The previous code did not remove two ways binding that were between two
globals. Now we do the remove_aliases pass over the whole document at
once which allos to simplify aliases between globals.
2022-11-28 14:39:47 +01:00
ogoffart
fb02b4118b Bump version number to 0.3.3 2022-11-28 13:11:11 +00:00
Simon Hausmann
f2c5184bf2 Fix embedding of images referenced in globals
When doing builds that require image embedding (such as for WASM), it's crucial
to also visit the globals (after they've been collected) to catch all image references.
2022-11-24 15:04:25 +01:00
Simon Hausmann
885fcc1ac8 Express material design typographic tokens in relative-font-size
The spec at https://m3.material.io/styles/typography/type-scale-tokens defines
label-large, label-medium, etc.
relative to 16px.
2022-11-24 13:56:31 +01:00
Simon Hausmann
d8a1f2cf01 Introduce a rem unit in the type system
This allows specifying font sizes relative to the Window's
default-font-size, similar to CSS rem.
2022-11-24 11:33:38 +01:00
Florian Blasius
0b66628fc4
md: add ripple effect (#1892)
* Add `StateLayer` component
* Add `Ripple` component (used by StateLayer)
* use `StateLayer` in material `Button`
* use `StateLayer` in material `Item`
2022-11-23 17:03:46 +01:00
Olivier Goffart
609b6d3a60
Use in/out/in-out in our styles 2022-11-23 13:41:28 +01:00
Simon Hausmann
883e3c472e Fix Material Design's choice of default font
* Apply the "Roboto" family by default to the Window.
* Don't use "Roboto XXX" as that is not the name that's encoded as family name in the TrueType fonts. The variants should be chose based on the weight, not the family name.
* Don't apply the font family in the MD's LineEdit - that should not be necessary anymore.
2022-11-22 20:20:53 +01:00
Simon Hausmann
bddbd43fac Apply the default-font-family from the Style's StyleMetrics if available
This allows the style to provide a default font family.
2022-11-22 20:20:53 +01:00
Olivier Goffart
73a16a171c Janitor: upgrade a few crates 2022-11-22 18:38:05 +01:00
Simon Hausmann
fd64060b26
Fix placeholder text rendered on top of cursor when empty LineEdit is focused (#1888)
Render the placeholder underneath.
2022-11-22 17:51:41 +01:00
Olivier Goffart
395532cebd Forbid former transitions declaration with the new syntax 2022-11-22 15:16:54 +01:00
Olivier Goffart
1ad6523960 Error message wording: remove the "TODO" 2022-11-22 15:16:54 +01:00
Olivier Goffart
51933b99bb New syntax for transitions, within the state 2022-11-22 15:16:54 +01:00
Olivier Goffart
c1c52a2b86 Make the test pass without defining the SLINT_EXPERIMENTAL_SYNTAX env variable 2022-11-21 22:01:52 +01:00
Olivier Goffart
d2ade4fd98
Document and enable the in / out keywords with the old component syntax (#1879)
But it still defaults to `in-out`
2022-11-21 18:41:35 +01:00
Simon Hausmann
59d3a69688
Fix support for multiple import statements from the same path (#1868)
Importing multiple types from the same file with multiple import statements would produce an error.
2022-11-21 15:37:38 +01:00
Tobias Hunger
a4e070bdfd compiler: Add support for handling binding expressions for the LSP 2022-11-21 15:01:09 +01:00
Olivier Goffart
39aebc1f4e Use the std::ops::Range as range in the repeater
And fix the preview highlight to use that
2022-11-17 12:23:23 +01:00
Olivier Goffart
1884750960 WIP: LSP: highlight selected element in the preview 2022-11-17 12:23:23 +01:00
Florian Blasius
1e23f3c34f md: fix api of LineEdit 2022-11-17 11:42:30 +01:00
Simon Hausmann
907b58161c Add support for invoking an init callback on component and element construction
This enables imperative code to be run. To be used sparingly :-)
2022-11-17 10:12:08 +01:00
Simon Hausmann
7be00f6d60 Improve error message when a property declaration clashes with a callback
(also continue, don't allow the declaration to proceed)
2022-11-16 09:46:40 +01:00
Simon Hausmann
e6bd9dc8c4 Improve error message when a callback clashes with a property
(also continue, don't declare the the callback anyway)
2022-11-16 09:46:40 +01:00
Simon Hausmann
9bb9ac3c39 Disallow callback overrides as well 2022-11-16 08:56:30 +01:00
Simon Hausmann
27db2bdcc6 Disallow duplicated callback declarations
A duplicated callback would silently overwrite the previous declaration,
which is counter-intuitive.
2022-11-16 08:56:30 +01:00
Olivier Goffart
443a5f7657 Center element by default in their parent with the new syntax 2022-11-15 17:33:27 +01:00
Olivier Goffart
731fd45bf0 syntax_updater: Add binding for x and y for elements that would end up centered
In the new language, we plan to center the element within their parent,
so for compatibility, add explicit x and y binding putting them back in
the corner
2022-11-15 17:33:27 +01:00
Olivier Goffart
0318b52a4c remove alias pass: make sure to keep priority correctly
Fixes the bug that caused the TextEdit in the gallery to sometimes be
empty.

Generated default value without any priority means it should not be
taken against a real binding if set
2022-11-15 13:19:20 +01:00
Florian Blasius
61c39b5fa1 Add support for dispatching key events through the public platform API
This change adds `KeyPress` and `KeyRelease` variants to the
`WindowEvent` enum, along with the new `slint::Key` enum, that allows
encoding keys.
2022-11-15 10:34:17 +01:00
Florian Blasius
575f093baf
Fixed: md TextEdit text not displayed (#1854) 2022-11-14 13:40:32 +01:00
Simon Hausmann
3498ccbc91 Speed up compiler syntax tests
Use rayon to run the compiler syntax tests in parallel. On my machine
that reduces the time from 11 seconds to 1.5 seconds.
2022-11-14 13:03:55 +01:00
Olivier Goffart
d2fdd161e9 Make sure that the Clip element created for a visible binding has an empty size
The `inject_element_as_repeated_element` will create width and height
binding that we should not have.

Fixes #1846
2022-11-14 12:46:46 +01:00
Olivier Goffart
b0d538fe4b Fix rust code generation when comparing percentages
Fixes #1837
2022-11-11 16:28:44 +01:00
Olivier Goffart
6ab6ae63d4 input output property: fix semantic with two ways bindings 2022-11-11 13:02:53 +01:00
Florian Blasius
15d9a2665b
Update background of material slider (#1841) 2022-11-11 11:43:24 +01:00
Olivier Goffart
5b44cc54d9 Don't generate a native setter for out property 2022-11-09 18:48:19 +01:00
Olivier Goffart
8a7c9bc53d janitor: Fix comiler warning 2022-11-09 18:48:19 +01:00