Commit graph

474 commits

Author SHA1 Message Date
Olivier Goffart
af50c2c2c2 Do not panic if the document contains a global but no normal component
Fixes #2005

(Unfortunately, we can't make a driver test for this becasue the
behavior with the interpreter is different than with the compilers.
The interpreter errors out, while the compiler should just generate
nothing)
2022-12-19 11:54:15 -08:00
Olivier Goffart
69df22e2fb Update resvg dependencies 2022-12-18 08:49:19 -08:00
ogoffart
ce07d078ce Bump version number to 0.3.4 2022-12-16 09:36:15 +00:00
Olivier Goffart
57d2e99723 Fix panic when a PopupWindow is a children of an optimized element 2022-12-15 07:01:58 -08:00
Olivier Goffart
3e8a681f36 Don't optimize properties used by functions 2022-12-15 05:43:24 -08:00
Olivier Goffart
52813224a5 Fix rust compilation of functions returning nothing 2022-12-15 14:17:03 +01:00
Olivier Goffart
aeed3b48fc Parser: fix parsing of "public function" in release mode
`consume()` does not advance whitespace, while `peek()` does.  And the
`peek()` in the debug_assert meant that the behavior was different in
release and debug mode.
Use `expect` instead of consume as it skip over white space
2022-12-15 12:52:21 +01:00
Simon Hausmann
554d153e35 Limit re-exporting of types
- Only allow one module re-export per file
- Warn when a re-exported type clashes with a locally exported type, and prioritize the local type.
2022-12-09 11:05:08 +01:00
Simon Hausmann
8faf57fa40 Minor fix to export * from "blah" parsing
Use the star token directly.
2022-12-09 11:05:08 +01:00
Simon Hausmann
b38fe7c5f0 Clean up internal Exports struct
- Use deref instead of `.0` tuple access (looks neater)
- Provide a convenience find() function that also makes use of the sorting
2022-12-09 11:05:08 +01:00
Simon Hausmann
6f19ab38e7 Use re-exports in the styles to simplify their code 2022-12-09 11:05:08 +01:00
Simon Hausmann
03fe599890 Add support for re-exporting modules
Use `export * from "somewhere.slint"` to avoid having to repeat all the
types of an existing module in order to re-export all of the types.
2022-12-09 11:05:08 +01:00
Simon Hausmann
6c01ad858c Clean up setup of exported names and components/types
Replace the intermediate NamedExport and SeenExport structs and the hash
table to find duplicates with a simpler algorithm:

1. Collect all exports into a vector, sorted, with duplicates
2. Eliminate duplicates and issue warnings accordingly and insert the
   result into a second vector.

As a bonus, the resulting vector of exports is now sorted.
2022-12-09 11:05:08 +01:00
Olivier Goffart
ccf3e8e9e9 C++: Generate image texture data for software renderer 2022-12-09 09:25:48 +01:00
Olivier Goffart
b2e22dc7cd Apply suggestions from code review
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-12-06 14:56:25 +01:00
Olivier Goffart
3c5aeb5897 Test for binding loops involving functions 2022-12-06 14:56:25 +01:00
Olivier Goffart
ed07cd825d Make functions private by default unless annotated with 'public' 2022-12-06 14:56:25 +01:00
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