Commit graph

282 commits

Author SHA1 Message Date
ogoffart
aa25e3cd44 Bump version number to 1.7.1 2024-07-23 12:05:34 +00:00
Bedis Nbiba
62c55dd188
js: show diagnostics when erroring (#5651)
before
```
error: Uncaught (in promise) Error: Could not compile ui/appwindow.slint
    at loadSlint (file:///home/mrcool/.cache/deno/npm/registry.npmjs.org/slint-ui/1.7.0/index.js:464:19)
    at Module.loadFile (file:///home/mrcool/.cache/deno/npm/registry.npmjs.org/slint-ui/1.7.0/index.js:644:12)
    at file:///home/mrcool/dev/deno/lab/memory/src/main.ts:3:23
```

after
```
error: Uncaught (in promise) Error: Could not compile ui/appwindow.slint
Diagnostics:
[ui/appwindow.slint:4:5] Unknown type MemoryTile
    at loadSlint (file:///home/mrcool/.cache/deno/npm/registry.npmjs.org/slint-ui/1.7.0/index.js:468:19)
    at Module.loadFile (file:///home/mrcool/.cache/deno/npm/registry.npmjs.org/slint-ui/1.7.0/index.js:648:12)
    at file:///home/mrcool/dev/deno/lab/memory/src/main.ts:3:23
```
2024-07-19 16:58:56 +02:00
Simon Hausmann
e36eb6aba6 Document behaviour of globals when exporting multiple components
Fixes #5467
2024-07-18 13:43:13 +02:00
Simon Hausmann
29fdac89ab Node.js: Don't use deprecated syntax 2024-07-18 10:37:05 +02:00
Olivier Goffart
5dfa8d56dc API review of the slint interpreter Compiler api
Closes #5466
2024-07-05 17:20:08 +02:00
Danut Enachioiu
033e4de9b9
Update language-specific docs to document that public functions can be called from the backend code (#5522)
* Examples for calling public functions in language-specific docs.

* Update the function example so it actually uses its parameter.

(This broke some c++ tests because of the unused argument warning)
2024-07-03 12:13:08 +02:00
Olivier Goffart
c250865032 Javascript: Multiple components 2024-07-02 13:38:52 +02:00
Simon Hausmann
b45945a234
Add support for async unit testing and element handle click events (#5499)
This patch adds async click functions to ElementHandle and adds timer support to the testing backend's event loop.
2024-06-27 17:05:58 +02:00
Simon Hausmann
a0db821afd Fix build with latest napi
JsExternal is now marked as deprecated, which makes our warning-are-errors CI fail. Use External<T> instead.
2024-06-25 13:53:46 +02:00
Simon Hausmann
3be6e641c6 Python: Attempt to build python packages with the same features as the nodejs/tool/etc. binaries 2024-06-18 09:43:37 -07:00
Simon Hausmann
1066acac9d Node.js: Use the same defaults as the slint rust create and interpreter crate
Fixes winit build warning about unused function
2024-06-18 17:48:17 +02:00
Simon Hausmann
41094b242f Remove unused import 2024-06-05 14:06:10 -07:00
Simon Hausmann
8aaa388328 Node.js: Use new public interpreter API 2024-06-05 14:06:10 -07:00
ogoffart
3a6e34ba45 Bump version number to 1.7.0 2024-06-04 20:34:29 +00:00
Olivier Goffart
9978cb1c0f
node: expose functions 2024-06-04 17:55:14 +02:00
Tobias Hunger
d9224cd58f janitor: Use more workspace dependencies 2024-06-04 14:58:29 +02:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Olivier Goffart
65160638a1 Node: Struct conversion should allow conversion from incomplete struct
This is also what happens in slint itself.
2024-05-09 17:02:24 +02:00
Simon Hausmann
af070f306f Fix Node.js CI
After the Rust 1.78 release, napi-rs panics on zero-sized array buffers.

Work around it by not allocating a zero-sized array buffer for this specific test.

Upstream PR: napi-rs/napi-rs#2083
2024-05-03 14:46:52 +02:00
Olivier Goffart
d4741efac0 testing: rename the init function 2024-04-18 18:45:31 +02:00
Simon Hausmann
63f1114ff2 Run Node.js tests with the testing backend
Add the ability to depend on the testing backend and opt into it
when running tests/cases, like we do for the other drivers.

The testing backend dependency is removed in the packaging step, as
we don't publish i-slint-backend-testing.
2024-04-16 07:05:03 +02:00
Simon Hausmann
8cf9256338 Fix failing Node.js test expectations
Adjust line numbers.

Amends 0cfeec1a31
2024-04-15 16:16:09 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
Updated the version from 1.1 to 1.2 
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
2024-04-15 15:18:55 +02:00
Simon Hausmann
a61ca93cd1 doc: Attempt to clarify how the factor of color's mix() function is applied 2024-04-15 09:05:54 +02:00
Chris Chinchilla
7afa34a7e1
Rename tutorial to quickstart (#4941) 2024-04-04 13:26:24 +02:00
Olivier Goffart
fd4dcfc128
Update MSRV to 1.73
A MSRV update is required to update the image crate to 0.25, otherwise
we get link error that are ficed in newer version.
Also other dependency update such as env_logger needs a newer MSRV.

Update to 1.73 because it has functions like `with_borrow` on thread
storage which we already actually use in some platform.

This is also the last release before the the drop of macOs < 10.12
in Rust 1.74
2024-03-27 09:04:31 +01:00
ogoffart
6bf40989d9 Bump version number to 1.6.0 2024-03-27 07:49:22 +00:00
ogoffart
20c570ab1d Bump version number to 1.5.1 2024-03-18 08:55:01 +00:00
Simon Hausmann
7c1c46e622 doc: Fix some typos in the Node.js README 2024-03-07 17:38:36 +01:00
Simon Hausmann
345da48a7e Node.js: Fix exception thrown when converting a Rust model into a Js Model
The wrapper returned should behave like Model<T>, which now also a
@@iterator key. That key is generated by simulation the evaluation of
`Symbol.iterator`, by first looking up `Symbol` in the global object,
and then `iterator`. When retrieving `Symbol` we casted it to a
`JsObject`, but commit
aeb0b4766d
upstream tightened the cast by adding an extract check, which fails.
Symbol is not a plain object, it's in fact a function (by use of
`Symbol()`).
2024-02-28 11:18:32 +01:00
Simon Hausmann
029385202a Improve error handling on Node.js slint::Model implementation
Don't panic, but log messages to stderr.
2024-02-26 15:02:41 +01:00
Simon Hausmann
2d9eff53f4 Node.js: Simplify ArrayModel handling in tests
Add a convenience pop() function (we already have push...) and re-use the model
instead of fetching it.
Previously we fetched it because it was converted to
a new array every time.
2024-02-26 15:02:41 +01:00
Simon Hausmann
02ae80b071 Node.js: Fix failing nodejs tests due that do writebacks
Add missing set_row_data implementation
2024-02-26 15:02:41 +01:00
Simon Hausmann
a211a104a1 Node.js: Implement Iterable<T> for Model<T>
This makes it much easier to extra data from Models, such as using them
in for loops. This is the equivalent of Model::iter() in Rust.
2024-02-26 15:02:41 +01:00
Simon Hausmann
841cb25565 Node.js: Always map Slint arrays to Model<T> in JavaScript
This gives a consistent interface - there's no more need to check the result of a property read on whether it's an array or a model.
2024-02-26 15:02:41 +01:00
Simon Hausmann
fa8e847f7c Fix bi-directional mapping of Model<T> from Node.js to Rust
A Model<T> stores a reference to a External<Rc<ModelNotify>>.
Every time such a Model<T> needs to be exposed to Slint/Rust, we create
a TypedRustModel that wraps the Rc<ModelNotify>, a strong reference to
the JS object, and the Type field for the expected data type (the
interpreter expects). The Model trait is implemented on TypedRustModel,
which means it is allocated every time the conversion is needed, but the
underlying Rc<ModelNotify> is shared and thus the (forwarded) ModelNotify.

When converting back to JavaScript, we downcast_ref to the
TypedRustModel and fetch the original JavaScript object - if available.
2024-02-26 15:02:41 +01:00
Florian Blasius
c952b028fd Use this pointer for RustModel model reference 2024-02-26 15:02:41 +01:00
Florian Blasius
e54dd09604 Start with node RustModel 2024-02-26 15:02:41 +01:00
Ralph Minderhoud
9cb1a4a4e0
Add API for minimize/maximize on Window component (#4581)
Closes #4400
2024-02-22 10:40:36 +01:00
ogoffart
a0eed4e58e Bump version number to 1.5.0 2024-02-20 17:33:11 +00:00
Florian Blasius
f03aedf14c
node: ComponentDefinition::create returns now a result instead of an optional (#4622) 2024-02-15 14:20:52 +01:00
Simon Hausmann
1055f22ac4 Node.js: Avoid unnecessary cloning of Type
There's no need to consume the Type in the value conversion.
2024-02-07 19:15:31 +01:00
Simon Hausmann
2d6edfbd6c Node.js: Fix MapModel rowData() calling map function even if the source model returned undefined
Also fix the function signature, which was wrong.
2024-02-07 19:15:02 +01:00
ogoffart
fec2b961db Bump version number to 1.4.1 2024-02-01 09:12:42 +00:00
Florian Blasius
39106acbdc
Added runEventLoopUntilQuit for node (#4444)
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-01-30 05:46:46 +00:00
Simon Hausmann
108975ad6c Add deno to the Slint-node cover docs
- We could import from `npm:...` directly, but by using an import map, the import is centrally controlled and all subsequent snippets for Node.js can also be used with Deno
- Use .mjs for the node snippet as we use ES module syntax

Unfortunately our own examples can't be equipped with a deno.json yet as
deno does not support yet imports of node modules from a local path.
2024-01-26 18:55:38 +01:00
Olivier Goffart
83adb467c0 Only depends on i-slint-backend-linuxkms on linux, even if the feature is enabled
This allows to simplify the npm build as well
2024-01-26 13:46:11 +01:00
Simon Hausmann
c10f0c7f13 Node.js: Refine features for binary npm packages
Use the same features as for the the lsp.
2024-01-26 11:23:07 +01:00
Olivier Goffart
573d4a3b50 Remove the test function for sending double_click
They are not commonly used so no need to use semi-public api for that
and it's really easy to similate with ust two clicks anyway

The previous test function were added before there was public way to
send events
2024-01-24 10:20:06 +01:00