Commit graph

141 commits

Author SHA1 Message Date
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
Simon Hausmann
9f440c2699 Node.js: Document global singletons 2024-01-23 17:51:01 +01:00
Simon Hausmann
dd0805c8fc Node.js: Add binaries for macOS and Windows
These are built with the default features of the interpreter crate, as
unfortunately napi-rs doesn't allow us to select features on the command
line yet. The next version (3.0) will add that, then we can keep the
binaries in sync.

So meanwhile, these are basically winit/femtovg/software enabled
binaries.

cc #1991
2024-01-17 11:48:54 +01:00
Simon Hausmann
787a8d6bfb Node.js: Include napi generated module loader in npm package
That might help with build-on-demand.mjs trying to load it :)
2024-01-16 09:28:21 +01:00
Simon Hausmann
c9f11f7f72 Node.js: Add missing error argument to arrow function for debugging build-on-demand.mjs 2024-01-16 09:13:11 +01:00
Simon Hausmann
732f9fa4ba Node.js: Add some debug output to the build-on-demand.js
Maybe this will tell us why it doesn't work.
2024-01-15 15:09:47 +01:00
Tobias Hunger
f2025ecf2d Test: Add explicit test for our time mocking infrastructure 2024-01-10 11:41:55 +01:00
Simon Hausmann
29621043f7 Node.js: Add fullscreen setter for Window
Amends 779aff0b39
2024-01-09 18:55:28 +01:00
Simon Hausmann
55e3a0418a Fix typedoc warning about unused parameters 2024-01-02 10:58:18 +01:00
Simon Hausmann
cdc2ccec3b Fix missing types from Node.js API docs
Commit 84fd6dc08c changed the import
from "rust-module" to "rust-module.cjs", which unfortunately broke
typedoc's visibility into the types. Revert back to using the import
without extension. With the given tsconfig files that works now and
typedoc publishes the docs for the re-exported types again.

Fixes #4153
2023-12-14 13:16:00 +01:00
Simon Hausmann
b64de8ead8 Exclude npm package tarballs from ... npm package tarballs 2023-12-12 21:10:00 +01:00
Simon Hausmann
78b6c8e02c Prepare for fetching slint npm binary packages from the @slint-ui/slint-ui-binary-* scope
That way we keep things clean on the top-level.
2023-12-12 14:34:17 +01:00
Simon Hausmann
8c1c87a600 Add support for building on demand
If binary packages are installed, then loading rust-module.cjs will work and
we don't need to do anything.
Otherwise, fall back to building.
2023-12-12 14:34:17 +01:00
ogoffart
b081c489d6 Bump version number to 1.4.0 2023-12-11 11:21:37 +00:00
Tobias Hunger
2bdcbc8e9f
core: Add a double-click callback to the TouchArea (#4060)
Co-authored-by: Simon Hausmann <hausmann@gmail.com>
Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2023-12-08 12:12:41 +01:00
ogoffart
b9255ab8e2 Bump version number to 1.3.2 2023-12-01 08:05:15 +00:00
Simon Hausmann
d4e51b810e
Node.js: Add some keywords and description to package.json (#4018) 2023-11-27 18:26:52 +01:00
Florian Blasius
5af7095fc9
move mapmodel to private_api (#4015)
Moved MapModel to private api because it is not ready now until the notify mechanism for node models is improved.
2023-11-27 13:11:31 +01:00
Simon Hausmann
e4cc80aeea
Fix typescript errors shown in VS code when editing node test files (#3999)
The nodenext module resolution was only passed to ts-node, but vscode didn't see it.
Use a dedicated tsconfig.json for vscode as well as ts-node.
2023-11-24 17:22:38 +08:00
Florian Blasius
b19cbba7ad
node: added MapModel (#3946)
---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2023-11-23 12:20:06 +01:00
ogoffart
0a5bf6c37b Bump version number to 1.3.1 2023-11-23 07:47:07 +00:00
FliPPeDround
1d643dd6c2 fix: use loadSource in loadSource api test 2023-11-22 08:11:53 +01:00
FliPPeDround
2920e15f4a feat: export loadSource api 2023-11-22 08:11:53 +01:00
Simon Hausmann
84fd6dc08c Clean up Node.js port build system
- Instead of building index.js with esbuild and generating types with
  tsc, use tsc to build index.js and index.d.ts.
- Use ts-node instead of swc for typescript based tests, as that
  works with es modules.
- Remove "syntax_check" target from package.json as that's now
  implied with "compile".
- Sadly this requires one "as any" cast as tsc somehow fails to
  determine the right type info for node-fetch.

Unfortunately index.js can't be an ES module without breaking
compatiblity. It would imply that the Node.js port can't be used with
require() anymore. So even thought that would simplify things further,
it's not part of this PR.
2023-11-21 07:20:21 +01:00
Florian Blasius
80bcdee646
added requestRedraw to node window (#3940) 2023-11-16 06:49:49 +01:00
Florian Blasius
440f1a5a1d
Added more documentation to the node port (#3938)
* Added more documentation to the node port

* Update api/node/index.ts

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

* Update api/node/index.ts

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

* Update api/node/index.ts

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

* code review feedback

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2023-11-16 06:49:16 +01:00
Florian Blasius
450443d8f8
Florian/fix node nightly (#3937) 2023-11-15 19:03:43 +01:00
Florian Blasius
a1c14e1126
create index.d.ts on compile (#3923) 2023-11-13 15:42:13 +01:00
Simon Hausmann
df7657dc2d
doc: fix typo 2023-11-11 00:28:52 +08:00
Florian Blasius
1d30ff9352
node: code cleanup (#3894) 2023-11-09 18:43:09 +01:00
Florian Blasius
bb9ba91255
moved slint classed to private_api (#3893) 2023-11-09 16:03:08 +01:00
Florian Blasius
9e393a6f74
Florian/node model notify (#3892) 2023-11-09 14:19:15 +01:00
Simon Hausmann
1c0ebe4c0e Node.js docs: Add some missing type mappings 2023-11-08 19:52:50 +01:00
Simon Hausmann
ad21ecb2c5 Node.js docs: Link to SlintBrush, SlintImageData for getters 2023-11-08 19:52:50 +01:00
Simon Hausmann
ad95dc3ad7 Various changes to the Node.js docs
- Make the walkthrough actually work
- Fix incorrect file paths
- Link between loadFile and the component instantiation section, as well as ComponentHandle
- Declare that loadFile may throw an exception
2023-11-08 19:52:50 +01:00
Simon Hausmann
33048000b6 Bump napi dependencies 2023-11-07 11:50:49 +01:00
Simon Hausmann
8dcab7fc71 Fix build with current napi 2023-11-07 11:45:44 +01:00
Simon Hausmann
432103d38f Node.js: Seal modules and component instances 2023-11-06 18:32:01 +01:00
Simon Hausmann
7b61e455eb Initial implementation of a Slint event loop sitting on top of Node.js
At the moment this is implemented using polling.

cc #2477
2023-11-06 11:37:45 +01:00
Florian Blasius
e3dbefafa5
node: implement access for globals (#3815) 2023-11-02 11:01:40 +01:00
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
Olivier Goffart
3662c39e1d node: Make sure that the test shows why the napi build fails 2023-10-31 12:28:31 +01:00