Commit graph

282 commits

Author SHA1 Message Date
Simon Hausmann
51282976db Remove type-check from api/node
tsc is already invoked during the CI compile step, where it checks type.

For the tsc invocation to work, we need to build the Rust module first, which slows down the fmt_lint_typecheck CI job.
2024-12-19 13:00:10 +01:00
Simon Hausmann
b2a4286f10 Node.js: Fix links to Slint Language Docs 2024-12-18 12:08:34 +01:00
Simon Hausmann
1ba2a6f0f0 Node.js: Upgrade TypeDoc
Typedoc complains about the links from the reference to the cover.md.
I couldn't find a way to make those warnings go away, but the links work.
As a remedy, `treatWarningsAsErrors` is removed temporarily.

Similarly, the relative links aren't supported either, so link to the latest
Slint docs.

Fixes #6488
2024-12-17 09:33:56 +01:00
Simon Hausmann
f58224cc0f Update api/node/thirdparty.hbs
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-16 21:54:37 +01:00
Simon Hausmann
c8653819e3 Include cargo-about output in the Typedoc generated docs
... by injecting the .html file after building the docs.
2024-12-16 21:54:37 +01:00
Nigel Breslaw
92534a8a27
1.9 Organise docs folder. (#7005)
Move astro files to docs/astro
2024-12-05 15:40:04 +02:00
Nigel Breslaw
4c1ececc67
1.9 docs: Flesh out docs guide 2024-12-05 00:19:37 +02:00
dependabot[bot]
511d49ea17 build(deps): bump @napi-rs/cli from 2.16.5 to 2.18.4
Bumps [@napi-rs/cli](https://github.com/napi-rs/napi-rs) from 2.16.5 to 2.18.4.
- [Release notes](https://github.com/napi-rs/napi-rs/releases)
- [Commits](https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@2.16.5...@napi-rs/cli@2.18.4)

---
updated-dependencies:
- dependency-name: "@napi-rs/cli"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-26 09:01:23 +01:00
Simon Hausmann
d1d7a26cb3
Add arm64 node packages (#6908) 2024-11-25 18:07:58 +01:00
dependabot[bot]
e659a686ea build(deps-dev): bump @ava/typescript from 4.1.0 to 5.0.0
Bumps [@ava/typescript](https://github.com/avajs/typescript) from 4.1.0 to 5.0.0.
- [Release notes](https://github.com/avajs/typescript/releases)
- [Commits](https://github.com/avajs/typescript/compare/v4.1.0...v5.0.0)

---
updated-dependencies:
- dependency-name: "@ava/typescript"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-25 09:54:42 +01:00
dependabot[bot]
5c15e967c8 build(deps-dev): bump ava from 5.3.0 to 6.2.0
Bumps [ava](https://github.com/avajs/ava) from 5.3.0 to 6.2.0.
- [Release notes](https://github.com/avajs/ava/releases)
- [Commits](https://github.com/avajs/ava/compare/v5.3.0...v6.2.0)

---
updated-dependencies:
- dependency-name: ava
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-25 08:14:55 +01:00
Simon Hausmann
1888e58735 Add API to set the XDG app id
ChangeLog: Added function to set the XDG app id on Wayland/X11. This needs to be added with respective function names in the language sections.

Fixes #1332
2024-11-22 11:24:06 +01:00
dependabot[bot]
9226051e17
build(deps): bump jimp from 0.22.8 to 1.6.0 (#6860)
* build(deps): bump jimp from 0.22.8 to 1.6.0

Bumps [jimp](https://github.com/jimp-dev/jimp) from 0.22.8 to 1.6.0.
- [Release notes](https://github.com/jimp-dev/jimp/releases)
- [Changelog](https://github.com/jimp-dev/jimp/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jimp-dev/jimp/compare/v0.22.8...v1.6.0)

---
updated-dependencies:
- dependency-name: jimp
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

* Fix import

---------

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 11:58:24 +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
Olivier Goffart
766aa8d95b Prospective CI fix for warnings about unexpected cfg
```
error: unexpected `cfg` condition value: `noop`
  --> api/node/rust/lib.rs:17:1
   |
17 | #[napi]
   | ^^^^^^^
   |
   = note: expected values for `feature` are: `accessibility`, `backend-linuxkms`, `backend-linuxkms-noseat`, `backend-qt`, `backend-winit`, `backend-winit-wayland`, `backend-winit-x11`, `default`, `renderer-femtovg`, `renderer-skia`, `renderer-skia-opengl`, `renderer-skia-vulkan`, `renderer-software`, and `testing`
   = help: consider adding `noop` as a feature in `Cargo.toml`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
   = note: `-D unexpected-cfgs` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unexpected_cfgs)]`
   = note: this error originates in the attribute macro `napi` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unexpected `cfg` condition value: `used_linker`
  --> api/node/rust/lib.rs:17:1
   |
17 | #[napi]
   | ^^^^^^^
   |
   = note: expected values for `feature` are: `accessibility`, `backend-linuxkms`, `backend-linuxkms-noseat`, `backend-qt`, `backend-winit`, `backend-winit-wayland`, `backend-winit-x11`, `default`, `renderer-femtovg`, `renderer-skia`, `renderer-skia-opengl`, `renderer-skia-vulkan`, `renderer-software`, and `testing`
   = help: consider adding `used_linker` as a feature in `Cargo.toml`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
   = note: this error originates in the attribute macro `napi::bindgen_prelude::ctor` (in Nightly builds, run with -Z macro-backtrace for more info)a

...
```
2024-11-20 09:24:55 +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
Simon Hausmann
bc3a672e73 Remove slightly confusing log when the slint-ui npm package gets installed locally
This would appear also when running `pnpm install` globally. If there's diagnostic output to be generated for this situation, it needs to go elsewhere.
2024-11-14 12:59:33 +01:00
Simon Hausmann
e0d9ba5556 Comment out console.log call that doesn't quite work
It shows `Error loading rust-module.cjs: {error}`, which isn't very helpful.
2024-11-14 12:44:20 +01:00
Simon Hausmann
9f7e407eff Fix fallback to source builds
Continue to run build-on-demand.mjs to permit a fallback to a
from-source build for users who run `npm install slint-ui` on a platform
where we don't provide binaries for (such as linux-armv7/64). However,
this is only done when run from the installed package, not from git.
From git, the prestart trick remains in use.
2024-11-14 12:25:42 +01:00
Nigel Breslaw
0461abfc73 Avoid building Rust on pnpm install 2024-11-14 12:25:42 +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
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
FloVanGH
181739d624
node: add tests for color set (#6646) 2024-10-24 17:45:27 +00:00
Milian Wolff
0f6c3a4fd7 Use SmolStr in more places of the compiler infrastructure
This removes a lot of allocations and speeds up the compiler step
a bit. Sadly, this patch is very invasive as it touches a lot of
files. That said, each individual hunk is pretty trivial.

For a non-trivial real-world example, the impact is significant,
we get rid of ~29% of all allocations and improve the runtime by
about 4.8% (measured until the viewer loop would start).

Before:
```
Benchmark 1: ./target/release/slint-viewer ../slint-perf/app.slint
  Time (mean ± σ):     664.2 ms ±   6.7 ms    [User: 589.2 ms, System: 74.0 ms]
  Range (min … max):   659.0 ms … 682.4 ms    10 runs

        allocations:            4886888
        temporary allocations:  857508
```

After:
```
Benchmark 1: ./target/release/slint-viewer ../slint-perf/app.slint
  Time (mean ± σ):     639.5 ms ±  17.8 ms    [User: 556.9 ms, System: 76.2 ms]
  Range (min … max):   621.4 ms … 666.5 ms    10 runs

        allocations:            3544318
        temporary allocations:  495685
```
2024-10-17 18:04:58 +02:00
Simon Hausmann
feee9aa056 Clean up file loader callback
This will have to be async in the future in its entirety, not just smaller parts.
2024-10-14 14:31:52 +02:00
FloVanGH
fe596179da
node: added fileloader to LoadData. (#6530) 2024-10-14 07:33:42 +02:00
FloVanGH
300c66fef3
node: added getting started (bun) to cover.md (#6516)
* Update api/node/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-10-11 06:12:50 +00:00
FloVanGH
ccf5f04087
node: added initTranslations function (#6504) 2024-10-10 16:37:33 +02:00
FloVanGH
f01ac8fc39
node: added url support to loadFile (#6507) 2024-10-10 11:43:32 +00:00
Florian Blasius
610a23b487 removed slint tags from cover.md 2024-10-10 07:32:24 +02:00
Florian Blasius
99702779a6 node: added structs and enums doc to cover.md 2024-10-10 07:13:42 +02:00
FloVanGH
499a522f99
node: better ergonomics for structs and enums (#6500) 2024-10-10 04:12:32 +00:00
Nigel Breslaw
6beb0c3f02
chore: Update npm dependencies
Update biome
Update typescript
Update esbuild
2024-10-08 13:13:49 +03:00
Nigel Breslaw
a97b7c7d92
Replace npm with pnpm
Replaces the use of NPM with PNPM. This should make it quick and easy to update any of the dependencies as dependabot will now see everything in one go.
2024-10-07 15:38:26 +03:00
Olivier Goffart
1c3eb46752 Fixup dead links to the old tutorial 2024-10-03 10:15:52 +02:00
FloVanGH
9d3a8c9dd2
node: added support for enums (#6421) 2024-10-01 16:49:39 +02:00
Simon Hausmann
51a241edd6
Node.js: If a JS callback throws an exception, report the exception t… (#6416)
As a drive-by, this introduces a macro that allows for explicit logging to console.error (which goes to stderr). This is something we should gradually start using, as it allows for capturing on the Node.js side (by the user or our tests).
2024-10-01 13:57:50 +02:00
Simon Hausmann
fdec55cd47 Node.js: Fix tense in error messages produced when exceptions are throw
At this point the exception _was_ thrown.
2024-10-01 13:28:48 +02:00
Simon Hausmann
5c612cda61 Fix biome invocations after re-organizing the files
After commit 25ae55b5dd, ignore dist/ as
well as the .cjs file that `npm run format` would complain about.
2024-10-01 13:27:00 +02:00
FloVanGH
4b880a7b49
node: less unwraps (#6388)
* Update api/node/rust/interpreter/value.rs

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-10-01 08:47:53 +00:00
FloVanGH
25ae55b5dd
Improve source structure in the node api (#6164)
* Update api/node/typescript/models.ts

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

* Code review feedback
---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-09-30 08:49:35 +00:00
Olivier Goffart
fc324a4db2 Update MSRV to 1.77 2024-09-26 09:14:58 +02:00
ogoffart
eb273a63ee Bump version number to 1.9.0 2024-09-25 11:49:15 +00:00
Nigel Breslaw
b36a66e405
Enable more js/tsc biome rules
noUselessConstructor
useNodejsImportProtocol
noImplicitAnyLet
2024-09-13 10:04:39 +02:00
Nigel Breslaw
2bee820ccf
Start to enable default javscript/typescript lint rules
This enables the recommended rules useConst and useImportType
2024-09-12 16:08:52 +02:00
Nigel Breslaw
a218c945ad
Use Biome across monorepo and for Slintpad (#6080)
Puts a shared biome.json in the root.
Deletes the prettier config files.
Deletes the unused pre-commit hooks.
Applies biome linting and formatting to the slintpad project.
2024-09-11 13:07:55 +02:00
FloVanGH
e79dcc4bec
Use same vscode-ext lint and format also for api/node (#6039)
* Use vscode ext lint and format also for api/node
* Re-use biome config file from VS code instead of duplicating it
* Remove package-lock.json again
* Don't bother running the biome formatter on Windows

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-09-09 09:22:33 +02:00
ogoffart
4dd7d96a28 Bump version number to 1.8.0 2024-08-15 12:44:46 +00:00
ogoffart
bbf7edc5a3 Bump version number to 1.7.2 2024-08-09 09:52:17 +00:00