Skip to content

Commit 325a6ce

Browse files
Update docs for latest releases
1 parent 361d9ee commit 325a6ce

File tree

7 files changed

+152
-6
lines changed

7 files changed

+152
-6
lines changed

docs/api/filesystem.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,3 +439,50 @@ An instance of the [`Permissions`](#permissions) object.
439439
```js
440440
const permissions = await Neutralino.filesystem.getPermissions(NL_PATH + '/my-directory-1');
441441
```
442+
443+
## filesystem.getJoinedPath(...paths)
444+
Returns a single joined path from multiple input path segments.
445+
446+
### Parameters
447+
448+
- `...paths` String: A sequence of paths.
449+
450+
### Return String (awaited):
451+
Joined path.
452+
453+
```js
454+
let path = await Neutralino.filesystem.getJoinedPath('./myFolder', 'audio', 'myFile.mp3');
455+
console.log(path); // './myFolder/audio/myFile.mp3'
456+
```
457+
458+
## filesystem.getNormalizedPAth(path)
459+
Constructs a Unix-like path from a Windows path for cross-platform usage by replacing `\\` with `/`. This function only works on Windows and returns the same input
460+
string on non-Windows platforms.
461+
462+
### Parameters
463+
464+
- `path` String: Windows-specific path.
465+
466+
### Return String (awaited):
467+
Unix-like path.
468+
469+
```js
470+
let path = await Neutralino.filesystem.getNormalizedPath('.\\myFolder\\main.js');
471+
console.log(path); // `./myFolder/main.js`
472+
```
473+
474+
## filesystem.getUnnormalizedPAth(path)
475+
Reverts a Unix-like path created with `filesystem.getNormalizedPath(path)` to a Windows-specific path by replacing `/` with `\\`. This function only works on Windows
476+
and returns the same input string on non-Windows platforms.
477+
478+
### Parameters
479+
480+
- `path` String: Unix-like path.
481+
482+
### Return String (awaited):
483+
Windows-specific path.
484+
485+
```js
486+
let path = await Neutralino.filesystem.getUnnormalizedPath('./myFolder/main.js');
487+
console.log(path); // `.\myFolder\main.js`
488+
```

docs/api/window.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,31 @@ Converts a given DOM element to a draggable region. The user will be able to dra
184184

185185
### DraggableRegionOptions
186186

187-
- `alwaysCapture` Boolean (optional): If set to `true`, the region will always capture the pointer, ensuring that dragging is not interrupted when moving the pointer quickly. Note that it prevents child elements from receiving any pointer events. Defaults to `false`.
188-
- `dragMinDistance` Number (optional): The minimum distance between cursor's starting and current position after which dragging is started. This helps prevent accidental dragging while interacting with child elements. Defaults to `10` and is measured in CSS pixels.
187+
- `exclusions` String[] | HTMLElement[] (optional): DOM element identifiers that should be excluded from the draggable region surface, i.e., window control buttons
188+
189+
190+
### Return Object (awaited):
191+
- `exclusions` DraggableRegionExclusions: Add or remove draggable region exclusions.
192+
193+
### DraggableRegionExclusions
194+
195+
- `add(...domIds: String | HTMLElement)`: Add new elements to exclusions.
196+
- `remove(...domIds: String | HTMLElement)`: Remove elements from exclusions.
197+
- `removeAll()`: Clear exclusions.
189198

190199
```js
191200
await Neutralino.window.setDraggableRegion('myCustomTitleBar');
192201

193202
await Neutralino.window.setDraggableRegion('myCustomTitleBar', {
194-
alwaysCapture: true,
195-
dragMinDistance: 15
203+
exclusions: ['closeButton', 'helpButton']
204+
});
205+
206+
const d = await Neutralino.window.setDraggableRegion('myCustomTitleBar', {
207+
exclusions: ['windowControls', 'tags']
196208
});
209+
210+
d.exclusions.add('notifications');
211+
d.exclusions.remove('tags');
197212
```
198213

199214
## window.unsetDraggableRegion(domId)
@@ -375,3 +390,19 @@ await Neutralino.on('mainMenuItemClicked', (evt) => {
375390
console.log('Menu item:', evt.detail);
376391
});
377392
```
393+
394+
## window.print()
395+
Displays the native print dialog for the current page. Developers can use this function instead of the built-in web `window.print()` function as a cross-platform solution
396+
since macOS webview doesn't pre-implement `window.print()`.
397+
398+
```js
399+
await Neutralino.window.print();
400+
```
401+
402+
## window.beginDrag()
403+
Starts dragging the native window if the left mouse button is pressed. The draggable region API in the Neutralinojs client library uses this function internally to move
404+
the window with the pointer events web API.
405+
406+
```js
407+
await Neutralino.window.beginDrag();
408+
```

docs/cli/neu-cli.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ npx @neutralinojs/neu <command>
2323

2424
## Commands
2525

26-
### `neu create <binaryName>`
26+
### `neu create <path>`
2727

28-
Creates a new Neutralinojs app based on a template.
28+
Creates a new Neutralinojs app based on a template. Basename of `<path>` will be used as the app binary name.
29+
30+
```bash
31+
neu create myapp # Creates in ./myapp
32+
neu create . # Creates in the current directory
33+
```
2934

3035
#### Parameters
3136

docs/configuration/neutralino.config.json.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,10 @@ the client library manually via the `neutralino.js` file or from the `@neutralin
316316
Injects a preload JavaScript file to the webview instance from the app bundle. This script file will be executed before webapp resources and after `window.injectGlobals`
317317
and `window.injectClientLibrary` scripts, so you can write initialization scripts using Neutralinojs API within this source file.
318318

319+
### `modes.window.webviewArgs: string`
320+
Additional browser arguments (i.e., `--user-agent=<string>`) for the WebView2 instance on Windows. See all supported arguments from the official
321+
[WebView2 developer documentation](https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/webview-features-flags?tabs=dotnetcsharp#available-webview2-browser-flags).
322+
319323
## Chrome mode
320324
The following configuration values are used when the application starts with the chrome mode.
321325

docs/release-notes/cli.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ toc_max_heading_level: 2
55

66
## Unreleased
77

8+
## v11.5.0
9+
810
### Core: Creator
911
- Support using a specific directory with the `neu create` command, e.g., `neu create .`, `neu create myapps/myapp`, `neu create ../myapp`, etc.
1012

docs/release-notes/client-library.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,39 @@ toc_max_heading_level: 2
55

66
## Unreleased
77

8+
## v6.2.0
9+
10+
### API: draggable region API
11+
The new draggable region API implementation uses native, platform-specific window dragging event via the `window.beginDrag()` function, so now draggable regions behave the same as native window dragging with features such as window snapping, unlike the previous draggable region implementation.
12+
13+
The new draggable region API lets developers exclude specific elements (i.e., window control buttons) from the registered draggable region DOM element:
14+
15+
```js
16+
const d = await setDraggableRegion('title-bar', {
17+
exclude: ['close-btn'],
18+
})
19+
20+
// Exclude elements using DOM references or IDs
21+
d.exclusions.add('help-btn')
22+
d.exclusions.add(document.getElementById('info-btn'))
23+
d.exclusions.add('tag1', 'tag2')
24+
25+
// Remove excluded elements
26+
d.exclusions.remove('help-btn')
27+
d.exclusions.remove(document.getElementById('info-btn'))
28+
d.exclusions.remove('tag1', 'tag2')
29+
30+
// Remove all exclusions
31+
d.exclusions.removeAll()
32+
```
33+
34+
### API: window
35+
- Export the `Neutralino.window.print()` function.
36+
- Export the `window.beginDrag()` function.
37+
38+
### API: filesystem
39+
- Export `filesystem.getJoinedPath(...paths)`, `filesystem.getNormalizedPath(path)`, and `filesystem.getUnnormalizedPath(path)` functions.
40+
841
## v6.1.0
942

1043
### API: window

docs/release-notes/framework.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,30 @@ toc_max_heading_level: 2
55

66
## Unreleased
77

8+
## v6.2.0
9+
10+
### API: window
11+
- Add `Neutralino.window.print()` to display the native print dialog on all platforms. This was especially added since the macOS webview doesn't implement the `window.print()` function.
12+
- Introduce the `window.beginDrag()` function to trigger native window dragging. The new draggable region API implementation uses this function internally.
13+
14+
### API: filesystem
15+
- Add `filesystem.getJoinedPath(...paths: string[])` to create a single path by joining multiple path strings.
16+
- Add `filesystem.getNormalizedPath()` and `filesystem.getUnnormalizedPath()` functions, which make Windows paths look like Unix paths by replacing `\\` with `/` and revert normalized paths into Windows-specific paths respectively on the Windows platform. On non-Windows platforms, these functions return the same input strings.
17+
18+
### Configuration
19+
- Implement the `window.webviewArgs` configuration option to pass additional browser arguments to the WebView2 instance on Windows:
20+
```js
21+
"modes": {
22+
"window": {
23+
// ....
24+
"webviewArgs": "--user-agent=\"Custom user agent\""
25+
}
26+
}
27+
```
28+
29+
### Improvements/bugfixes
30+
- Display GUI error messages for webview initialization failures. i.e., if the WebView2 runtime is not installed on Windows and if the WebKitGTK library is not installed on GNU/Linux platforms.
31+
832
## v6.1.0
933

1034
### API: Native window main menu

0 commit comments

Comments
 (0)