Commit graph

10295 commits

Author SHA1 Message Date
Simon Hausmann
d07f87b609 Fix build when installing as dependency in apps
napi and esbuild are not just dev dependencies. Since we distribute source packages, they are in fact
run-time dependencies, as
"npm install" will run "npm run build" and that
requires those two.
2023-11-01 11:05:33 +01:00
Simon Hausmann
c970ac7bc0 Bump softbuffer release to fix crash on X11 when quickly resizing window to become large 2023-11-01 10:49:40 +01:00
Olivier Goffart
8df1217261 Fix slint compiler panic in chiptrack
If a branch that always return has a "void value" and the side that
doesn't return has a value, we need to synthetize a default value
so the struct is complete, even if that value is not used.
2023-11-01 09:51:33 +01:00
Simon Hausmann
bac5c76fb2 Add workflow inputs to the npm publish step
Just dummy, so that they can also be used in a branch/PR.
2023-11-01 09:09:37 +01:00
Simon Hausmann
1441719f61
Fix cross-compilation of C++ interpreter API to 32-bit architecture (#3810)
cbindgen doesn't reliably tranfser the 64-bit/32-bit #ifdefs around ValueOpaque.
Instead, move Value onto the heap by using a Box.

Fixes #3653
2023-10-31 17:33:49 +01:00
Olivier Goffart
4b37d9a1f1 Fix Slintpad preview in release
This should have been part of b2645dff6c
2023-10-31 16:44:34 +01:00
Olivier Goffart
51dbd441b0 android-activity backend: Don't use the public slint crate 2023-10-31 16:22:11 +01:00
Olivier Goffart
cf9f9a4f15 Disable all backends on android 2023-10-31 16:22:11 +01:00
Olivier Goffart
d63ff9c4c6 WIP: introduce an android-activity backend 2023-10-31 16:22:11 +01:00
Simon Hausmann
26c9e3ea96
Build tool binaries on current macOS 2023-10-31 16:11:54 +01:00
Simon Hausmann
55176d1dac
Build aarch64 Darwin lsp also on latest 2023-10-31 15:41:41 +01:00
Simon Hausmann
c00eb792da Build macOS lsp binaries on latest macOS 2023-10-31 15:21:50 +01:00
Simon Hausmann
8a52de6b1e Initial attempt at GH action for publishing npm package 2023-10-31 15:19:04 +01:00
Simon Hausmann
28e0c19a1b Prospective fix for windows vscode lsp binary
Build as MSVC binary, as Skia doesn't compile with mingw toolchain (Somehow gcc flags end up in the environment).
2023-10-31 15:06:36 +01:00
Simon Hausmann
99d633c1b4 Prospective fix for failing nightly CI job
env cannot be used within a with block (https://github.com/actions/runner/issues/1189#issuecomment-1741672276)
2023-10-31 14:37:52 +01:00
Simon Hausmann
79b70782b4 Enable the winit backend and skia renderer in the tool and lsp binaries
This makes it possible to fall back to software rendering.

This change also removes the use of the Qt backend on Windows and macOS, since
the native style on those platforms
resolves to fluent/cupertino and doesn't require Qt anymore.
2023-10-31 14:28:05 +01:00
Olivier Goffart
d55803d290 Models: fix writing data doesn't update ListView model data property
This fixes a couple of bug:
 - Bug #3740 happens because `Repeater::model_set_row_data` did not use
   the inner.offset to get the instance (So that's the `val == 106` part
   of the test)
 - But I went ahead and also tested what happenned if you changed the
   model from the "outside" using the `model[i] = `, and that was not
   implemented, hence the move of the code from
   `Repeater::model_set_row_data` to `RepeaterTracker::row_changed`,
   That does need Pin though, so Pin was added everywhere
 - C++ is not affected by bug #3740, because because the C++ listview
   don't do the "allocate only visible" optimization. But the
   "val == 1106" part of the test would fail so this patch also moces
   the update from  `model_set_row_data` to `row_changed`.
   But following that we don't set the state as Dirty in `row_changed`,
   the write_to_model test started filling  because the `row_added`
   function was missing an update of the index on every further items

The change in the interpreter prevent a borrow_mut from causing trouble.
The Value really don't need to be in a RefCell anyway

Fix #3740
2023-10-31 13:41:31 +01:00
Olivier Goffart
924b2c8625 Note tests: Remove the panic as it is failling in the CI 2023-10-31 13:10:05 +01:00
Olivier Goffart
3662c39e1d node: Make sure that the test shows why the napi build fails 2023-10-31 12:28:31 +01:00
Florian Blasius
88a814c234 Revert "Implement globals for node"
This reverts commit 8412a971af.
2023-10-31 11:40:39 +01:00
Florian Blasius
8412a971af Implement globals for node 2023-10-31 11:36:25 +01:00
Florian Blasius
62a30a0e2e
node: export classes use interfaces for setters (#3804) 2023-10-31 10:36:00 +01:00
Simon Hausmann
55085d43af
Fix Node.js version of memory game not working properly (#3789)
The rules require comparing if tiles are equal, which used to be a string comparison as we just
converted the image to a path. With ImageData this doesn't
work anymore, so this patch proposes an optional path
property that makes the code also a tad bit more readable.
2023-10-31 08:50:32 +01:00
Florian Blasius
52a0cd5c13
Show warning on duplciatedd properties (#3805) 2023-10-31 07:08:40 +01:00
Olivier Goffart
b2645dff6c Wasm: use the winit spawn() api to run the event loop for the interpreter
This seems to solve the bug that the wasm interpreter (or slintpad) is
not working when compiled in release since the winit0.29 update
2023-10-30 14:17:10 +01:00
Simon Hausmann
725db9f2bb winit: Clean up event loop state handling part 2
Move all of the event processing into EventLoopState.
2023-10-30 14:17:10 +01:00
Simon Hausmann
0032d74dc2 winit: Clean up event loop state handling part 1
Encapsulate the mouse state in a struct.
2023-10-30 14:17:10 +01:00
Florian Blasius
10066c5eef
cleanup widgets according to upcoming code guidelines (#3771) 2023-10-30 10:45:25 +01:00
Tobias Hunger
23f3e61227
core: Make debug print of PropertyHandle more useful (#3780)
core: Make debug print of `PropertyHandle` more useful

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2023-10-30 09:18:45 +01:00
Simon Hausmann
f941357337 Upgrade to glutin 0.31.1 to fix window transparency on macOS
Fixes #3760
2023-10-30 08:58:25 +01:00
Olivier Goffart
85ca10d32e Disallow access to internal globals (NativeStyleMetrics and SlintInternal)
It only stay accessible in our builtin styles

Fixes #3793
2023-10-28 16:07:38 +02:00
Simon Hausmann
7fa86ce55a Update skia-safe to 0.69
For details, see https://github.com/rust-skia/rust-skia/releases/tag/0.68.0

This simplifies cross-compilation and adds risc-v builds.
2023-10-28 11:08:30 +02:00
Olivier Goffart
0c529cd345 janitor: Some no-brainer deps update 2023-10-27 19:11:38 +02:00
Olivier Goffart
9ffe26459f Layout: when using a fixed window size, dissociate the WiondowItem's size with the slint size
If you have a window like so:
```
component W inherits Window {
   width: 200px; // or some other bindings
}
```

Before this patch, it will be converted by the compiler to something like

```
component W inherits Window {
   width: 200px; // or some other bindings
   min-width: width; // (not actual property, but part of the layout_info)
   max-width: width;
}
```

When the window is on the screen, the platform backend will set the max
with and min width on the window manager window to the value from the
layout info.
But slint will also set the width and the height of the WindowItem to
the actual value.  This will break the binding for width if any, and
will also cause the min and max with do be updated, which is wrong.

We haven't had much problem with that before, but with the
ComponentContainer, this becomes a problem as we want to set the width
and height of the inner from the outer by adding a two way binding,
which cause a binding loop at runtime.

The behavior change is that if you have a fixed window size and use that
on a MCU or platform that has a different size, the window will be
cropped or padded but will no longer be resized
2023-10-27 17:45:46 +02:00
Simon Hausmann
131dd136df doc: add missing links from repeaters to array/model docs
Pointed out by a kind user :-)
2023-10-27 17:12:49 +02:00
Simon Hausmann
2310015315 janitor: Reformat JS types to match formatting of other files
(Just saved in VS code)
2023-10-27 16:42:54 +02:00
Simon Hausmann
ce0f8ddf7c janitor: reformat these files with vscode
This matches the existing formatting in the files present.
2023-10-27 16:41:06 +02:00
Olivier Goffart
aeb76593ee C++: fix string conversion from float not being round
Converting 12.3 to a string would be "12.30000001907" which is not what
one would want
2023-10-27 13:20:24 +02:00
Simon Hausmann
fff15b9018 Don't close embedded popups when clicking outside and click-on-close: false is set
cc #3712
2023-10-27 11:49:09 +02:00
Simon Hausmann
80bb7af08c node: Fix typescript setup for tests
Share tsconfig.json so that ava runs the typescript compiler also on the tests.
Similary, the syntax check now also covers the tests.

Sadly, the exception that the Slint compiler throws is not type declared,
so we have to use any.
Similarly, the object share returned by loadFile() is unknown
in terms of properties, callbacks, etc.
2023-10-27 11:39:44 +02:00
Olivier Goffart
43caf257f6 janitor: feature cleanup (std is mandatory for the interpreter)
also no need to add default for our internal features, that's counter
productive
2023-10-27 10:08:42 +02:00
Olivier Goffart
c2809cde12 wasm: Don't include all image codecs on the lsp
Saves 1M in the binary

We use the browser to render the images anyway

Note: i-slint-core still bring image with png and jpeg codecs, as well
as svg deps. We just need the image-decoders feature to load the builtin
images, of these there are only svg.
2023-10-27 10:08:42 +02:00
Olivier Goffart
a67735b5d5
Document the limitations of the software renderer
Related discussion: https://github.com/slint-ui/slint/discussions/3782

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-10-27 10:08:13 +02:00
Update Translations Bot
2f3a69f7dc Update Translations: extract strings 2023-10-27 03:04:53 +00:00
Olivier Goffart
3deb620953 Skia: disable skia software renderer for android
softbuff doen't compile on android
2023-10-26 14:52:07 +02:00
Simon Hausmann
7b4d9de590 Silence compiler warning 2023-10-26 14:41:07 +02:00
Simon Hausmann
2cf8a5b0eb Build the node package only once in debug
In the ci and on workstations the steps are the same:

1. Install (without building, which would build release)
2. Build debug
3. Run tests

Previously only on Windows the tests were run in debug, because
the "npm install" step in the nodejs test driver would overwrite a
previously created debug build. On windows they are separate DLLs, and
thus co-exist. With this patch we always build debug.
2023-10-26 14:23:23 +02:00
Olivier Goffart
c51fb14a0e Improve the slint! macro with rust-analyzer with -
We currently use the debug representation of Span to know if they are
next touching eachother as there are no stable way currently.
But that doesn't work with rust analyzer as it doesn't have a
representation we can test.
Also Span::source_text is not implemented with rust analyzer.

So just default to identifier with `-` touching instead of not touching
as this happens more often.

One can still use `(foo)-(bar)` when one really need minus

CC #685
2023-10-26 13:13:03 +02:00
Simon Hausmann
bdd275811e Bump skia-safe version
This updates to m118. See
https://github.com/rust-skia/rust-skia/releases/tag/0.67.0 for more
details.
2023-10-26 10:45:36 +02:00
Florian Blasius
0045787e1c
node: api review adjustements part I (#3766)
* Update api/node/src/types/brush.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update tests/cases/callbacks/handler_with_arg.slint

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2023-10-26 10:02:49 +02:00