Commit graph

1614 commits

Author SHA1 Message Date
Olivier Goffart
e44f7d7a4c LSP: fix reloading loaded dependencies
The change in https://github.com/slint-ui/slint/pull/6747
invalidated the cache, but it was only reloaded when one of the dependent was reloaded.
We need to reload the cache for all open file so that LSP feature continue to work on
open document even if they get no changes
2024-11-26 14:27:56 +01:00
Tobias Hunger
6534ac9ab4 live-preview: Do not show components in selection popup
The component was mentioned when it was used in the code, so
filter out the frame for the component defintiton itself.
2024-11-26 10:30:18 +01:00
Tobias Hunger
326758b8d0 live-preview: Elide text in the selection popup 2024-11-25 22:52:41 +01:00
dependabot[bot]
888fc275a6
build(deps): bump typescript from 5.2.2 to 5.7.2 (#6897)
NOTE: This updates typescript to 5.72 for all projects except api/node which cannot be updated
till typedoc is also updated.

* build(deps): bump typescript from 5.2.2 to 5.7.2

Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.2.2 to 5.7.2.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.2.2...v5.7.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nigel Breslaw <nigel.breslaw@slint.dev>
2024-11-25 19:32:07 +02:00
dependabot[bot]
e5285e0607
build(deps): bump the playwright group with 2 updates (#6901)
Bumps the playwright group with 2 updates: [@playwright/test](https://github.com/microsoft/playwright) and [playwright](https://github.com/microsoft/playwright).


Updates `@playwright/test` from 1.48.2 to 1.49.0
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.48.2...v1.49.0)

Updates `playwright` from 1.48.2 to 1.49.0
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.48.2...v1.49.0)

---
updated-dependencies:
- dependency-name: "@playwright/test"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: playwright
- dependency-name: playwright
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: playwright
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-25 17:56:17 +02:00
szecket
613b2982f1
experiment for highlighting UX (#6837)
* experiment for highlighting UX

this works really well but ideally goes back to what was selected before right click OR the selection actually moves rather than the hover color

* live-preview: Unselect in SelectionPopup again

When un-hovering some item to preview it's selection,
switch selection back to the original selection.

---------

Co-authored-by: Tobias Hunger <tobias.hunger@slint.dev>
2024-11-23 02:57:08 +13:00
Nigel Breslaw
47ab230cad
Setup a Playwright smoke test for Slintpad (#6874)
Remove cypress.
Use vite preview to serve the built bundle.
Setup playwright.
Run smoke test in CI.
2024-11-22 15:52:31 +02:00
szecket
ba14285332
Szecket/cupertino colours (#6801)
* creating a lookup table of colors based on the set on apple docs
then selecting from these colors rather than always typing hex
also added an in property for setting selected color (future)

* splitting out method of changing selection colour for later

* forgot to pull CupertinoColors from import

* Squashed commit of the following:

commit 4924aa908d6e039a7bf1f79ede3dc7c26f71007f
Author: szecket <szecket@magrittescow.com>
Date:   Fri Nov 15 17:31:45 2024 -0500

    use  defined Palette for states

commit 80711ee7188f37b1b29ce11855b6a636d7a39306
Author: szecket <szecket@magrittescow.com>
Date:   Fri Nov 15 17:29:51 2024 -0500

    make control colour consistent with style and other controls

commit 1cfd39e6da6643600e8b553dfab2418c8552cdc4
Author: szecket <szecket@magrittescow.com>
Date:   Fri Nov 15 13:58:07 2024 -0500

    selection of controls when focused is not current cupertino style and too strong

commit 4bf4ae6ad385e118687f752362b34e079c03fe22
Author: szecket <szecket@magrittescow.com>
Date:   Fri Nov 15 13:42:58 2024 -0500

    make foreground color contrast when selected

* removing property that is only in cupertino
2024-11-22 08:18:27 +13:00
Olivier Goffart
bc628116b6 LSP: test named callback arguments 2024-11-21 09:53:17 +01:00
Olivier Goffart
6e91b9bc91 Give name to the builtin element's callback argument 2024-11-21 09:53:17 +01:00
Olivier Goffart
f225f79d49 compiler: Put the argument names in the Type
That simplifies things a bit and will allow to have names for builtin callback and functions
2024-11-21 09:53:17 +01:00
dependabot[bot]
75b843c14b
build(deps-dev): bump vite from 5.4.8 to 5.4.11 (#6861) 2024-11-21 08:06:37 +02:00
dependabot[bot]
ad8a23571a
build(deps): bump @biomejs/biome from 1.9.3 to 1.9.4 (#6863)
* build(deps): bump @biomejs/biome from 1.9.3 to 1.9.4

Bumps [@biomejs/biome](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome) from 1.9.3 to 1.9.4.
- [Release notes](https://github.com/biomejs/biome/releases)
- [Changelog](https://github.com/biomejs/biome/blob/main/CHANGELOG.md)
- [Commits](https://github.com/biomejs/biome/commits/cli/v1.9.4/packages/@biomejs/biome)

---
updated-dependencies:
- dependency-name: "@biomejs/biome"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* format:fix

* Ignore lint item

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nigel Breslaw <nigel.breslaw@slint.dev>
2024-11-21 00:28:19 +02:00
szecket
db83921f1d hover change and position of window 2024-11-19 20:20:14 +01:00
szecket
0aed233f55 live-preview: move filename and lock height 2024-11-19 20:20:14 +01:00
Tobias Hunger
11169ef149 live-preview: Prettify file names in Selection Popup 2024-11-19 20:20:14 +01:00
Tobias Hunger
defe76649b live-preview: Show hint for right click 2024-11-19 20:20:14 +01:00
Tobias Hunger
f5682ea2e8 live-preview: Fix height calculation 2024-11-19 20:20:14 +01:00
Tobias Hunger
828385b918 live-preview: Sort some properties 2024-11-19 20:20:14 +01:00
Tobias Hunger
004ade9d44 live-preview: Implement a UI for the selection stack 2024-11-19 20:20:14 +01:00
Tobias Hunger
9d5b9fb46a live-preview: Implement a selection stack
... that provides a model containing all the elements
at a position sorted from "front" to "back" with extra
information so that we can present the data in a nice UI
in the next step.

The selection code now filters out builtins and ignore nodes
when collecting nodes. So the following filter step does not
need to take those into account anymore.

Whether a selection candidate is actually a part of the root
component or not is now handled by looking at whether the
elements text range is inside the root component's text
range. This is closer to what users expect to happen I think.
2024-11-19 20:20:14 +01:00
Milian Wolff
f6da161dbb
Reduce SmolStr <-> &str conversions and copies (#6688)
SmolStr has an Arc internally for large strings. This allows
cheap copies of large strings, but we lose that ability
when we convert the SmolStr to a &str and then reconstruct a
SmolStr from that slice.

I was hoping for some larger gains here, considering the impact
of this code change, but it only removes ~50k allocations,
while the impact on the runtime is not noticeable at all.

Still, I believe this is the right thing to do.

Before:
```
        allocations:            2338981

  Time (mean ± σ):     988.3 ms ±  17.9 ms    [User: 690.2 ms, System: 206.4 ms]
  Range (min … max):   956.4 ms … 1016.3 ms    10 runs
```

After:
```
        allocations:            2287723

  Time (mean ± σ):     989.8 ms ±  23.2 ms    [User: 699.2 ms, System: 197.6 ms]
  Range (min … max):   945.3 ms … 1021.4 ms    10 runs
```
2024-11-19 10:07:16 +01:00
Olivier Goffart
014b58c81a
C++: allow to configure bundled translation 2024-11-18 15:57:08 +01:00
szecket
418f279abd
Sub attributes2 (#6749)
* spacing correction

* converted all property value blocks to widgets

* added secondary controls for color and string

* added secondary visuals to make hierarchy more visible

* live-preview: Wire up color widget with the backend

It lets you select colors based on the sliders, but it will
*only* apply the color when you hit enter on the text field
with the color string...

Not nice, but at least it does not keep losing state as it
round-trips the change through the code and compiler and
gets the state reset all the time.

* more dummy data

* cleanup of property sheet based on new controls

* added secondary visuals to make hierarchy more visible

correct extraneous changes

---------

Co-authored-by: Tobias Hunger <tobias.hunger@slint.dev>
2024-11-19 02:55:30 +13:00
Olivier Goffart
e7cf28531d slint-compiler: Don't use signed distance fields by default 2024-11-18 13:24:59 +01:00
Tobias Hunger
a1d6ce3814 live-preview: Stay in select-mode after selecting something 2024-11-15 14:19:12 +01:00
Tobias Hunger
b86a8e41ce live-preview: Remove dead code related to design mode
That mode can no longer get enabled, so get rid of
the entire thing.
2024-11-15 14:18:56 +01:00
Nigel Breslaw
08d90a5f13
Next gen docs for 1.9 (#6766)
Co-authored-by: Aurindam Jana <aurindam.jana@slint.dev>
Co-authored-by: Tobias Hunger <tobias.hunger@slint.dev>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-11-14 15:52:35 +01:00
Olivier Goffart
5b3ea5cdd5 LSP: record dependencies and invalid all dependents when a dependencies changes
Fixes #5797
2024-11-14 14:35:22 +01:00
Tobias Hunger
cfb29c51ae live-preview: Move drop mark colors into styling.slint 2024-11-14 14:07:37 +01:00
Tobias Hunger
51d8205e08 live-preview: Use another seelction color for interactive building blocks
... like TouchArea and such. This might help a bit with what
you are actually selecting.
2024-11-14 14:07:37 +01:00
Tobias Hunger
88f705a777 live-preview: Move selection colors into styling.slint 2024-11-14 13:24:38 +01:00
Olivier Goffart
9cbc4aa6ce LSP: report that we use UTF-8 to client that supports it
Version 3.17 of the spec added a `position_encoding` field in the
ServerCapabilities, so use that.

Note that the spec says that UTF-16 is mendatory, and vscode only
support utf-16, meaning we currently have a bug when having non-ascii in
the source (#5669)
2024-11-08 12:13:26 +01:00
Tobias Hunger
a765da347c live-preview: Unconfuse selection with a drop shadow
Unconfuse selecting something with a drop shadow. That is a
extra compiler-generated element that gets added before
the actual element we are looking for.
2024-11-07 18:33:50 +01:00
Olivier Goffart
34332cc8b3 LSP: completion of callback snippet including argument names 2024-11-07 10:07:25 +01:00
Olivier Goffart
59b8c1cf73 LSP: refactor resolve_element_scope
to do the snippet in that function
2024-11-07 10:07:25 +01:00
Tobias Hunger
74785691f5 slintpad: Fix goto definition again
... by implementing it manually again :-/ And by
not using the EditorService that I thought was handling that.

And of course a TS map silently falls when your key is a Url,
so that needed fixing, too.

Fixes: #6706
2024-11-07 09:34:56 +01:00
Olivier Goffart
e3ea25f48c LSP: Signature Help 2024-11-06 13:27:29 +01:00
szecket
c52fdd71bc
preview: attempting a header change to optimize usability (#6720)
changed the interaction for header view
both library and properties can be shown anytime
and selection is is a toggle button at any time
suggestions:
goes hand in hand with the selection mode
likely requires settings for toggle or single
select.

attempting a header change to optimize usability
TODO: make dragging from library automatically
into edit mode

the toggle that existed is the same as toggling a button - whcih can sit next to the closed library and properties.
properties should be editable while selection is active so those should be openable / visible whether in edit mode or not.

STILL TODO:
- make dragging from library automatically into edit mode
- add settings to either single select 'inspect' button or toggle on off
- change display of active icon OR add icon for toggled mode for clearer display than blue icon for inspect
2024-11-05 18:51:38 +01:00
Olivier Goffart
d27c5dc198 LSP: add the function and callback argument name on the tooltips 2024-11-04 17:09:57 +01:00
Brandon Fowler
6da0f55b05
Associate PopupWindows with an ID for their active popup (#6693)
Popups are stored in a HashMap and are assigned an ID so popup.close(); closes the correct popup and so a single PopupWindow cannot be opened multiple times
2024-11-04 09:17:55 +01:00
Tobias Hunger
d30dfc0175 slintpad: Always show preview when the first editor is opened
This makes sure we always have soemthing in the preview.
2024-11-02 19:22:47 +01:00
Tobias Hunger
f6731eb582 slintpad: Properly dispose of editors and related data
This makes sure we send content invalidation when closing
editors (by opening a new project).
2024-11-02 19:22:47 +01:00
Olivier Goffart
6bb0e6038f
Merge the Callback and Function type
There is no need for two of these
This simplify some code

Amend efdecf0a13
2024-10-28 14:36:30 +01:00
Milian Wolff
6e9e66ea7d Refactor typeregister's BUILTIN_ENUMS => BUILTIN.enums
This will allow us to add more buildin types to this thread local
in follow-up patches, to reduce the number of thread local slots.
2024-10-28 09:39:54 +01:00
Milian Wolff
69c68b22b2 Also wrap langtype::Type::Struct in an Rc
This makes copying such types much cheaper and will allow us to
intern common struct types in the future too. This further
drops the sample cost for langtype.rs from ~6.6% down to 4.0%.

We are now also able to share/intern common struct types.

Before:
```
  Time (mean ± σ):      1.073 s ±  0.021 s    [User: 0.759 s, System: 0.215 s]
  Range (min … max):    1.034 s …  1.105 s    10 runs

        allocations:            3074261
```

After:
```
  Time (mean ± σ):      1.034 s ±  0.026 s    [User: 0.733 s, System: 0.201 s]
  Range (min … max):    1.000 s …  1.078 s    10 runs

        allocations:            2917476
```
2024-10-28 09:39:54 +01:00
Milian Wolff
efdecf0a13 Wrap langtype::Type::{Callback,Function} data in an Rc
This allows us to cheaply copy the langtype::Type values which
contain such a type. The runtime impact is small and barely noticable
but a sampling profiler shows a clear reduction in samples pointing
at langtype.rs, roughly reducing that from ~8.6% inclusive cost
down to 6.6% inclusive cost.

Furthermore, this allows us to share/intern common types.

Before:
```
Benchmark 1: ./target/release/slint-viewer ../slint-perf/app.slint
  Time (mean ± σ):      1.089 s ±  0.026 s    [User: 0.771 s, System: 0.216 s]
  Range (min … max):    1.046 s …  1.130 s    10 runs

        allocations:            3152149
```

After:
```
  Time (mean ± σ):      1.073 s ±  0.021 s    [User: 0.759 s, System: 0.215 s]
  Range (min … max):    1.034 s …  1.105 s    10 runs

        allocations:            3074261
```
2024-10-28 09:39:54 +01:00
Simon Hausmann
a98d4709be Move printer demo and energy-monitor into new top-level demos/ folder
These are showing off use-cases for Slint, but they're not examples showing individual Slint features.

Also removed the old printerdemo while at it.
2024-10-25 12:09:32 +02:00
Simon Hausmann
18f645f814 WIP: Being adding support for generating SDF glyphs 2024-10-23 09:12:30 +02:00
Tobias Hunger
10de1e664b live-preview: Default to "native" as expected (if that is available!) 2024-10-22 14:50:41 +02:00