ewvjs 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -52
- package/dist/platforms/windows.d.ts.map +1 -1
- package/dist/platforms/windows.js +9 -41
- package/dist/types.js +1 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +44 -10
- package/dist/webview.d.ts +6 -2
- package/dist/webview.d.ts.map +1 -1
- package/dist/webview.js +139 -47
- package/dist/window.d.ts +7 -13
- package/dist/window.d.ts.map +1 -1
- package/dist/window.js +187 -250
- package/native/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
- package/native/Microsoft.Web.WebView2.WinForms.dll +0 -0
- package/native/Microsoft.Web.WebView2.Wpf.dll +0 -0
- package/native/System.Buffers.dll +0 -0
- package/native/System.Collections.Immutable.dll +0 -0
- package/native/System.Memory.dll +0 -0
- package/native/System.Numerics.Vectors.dll +0 -0
- package/native/System.Reflection.Metadata.dll +0 -0
- package/native/System.Reflection.MetadataLoadContext.dll +0 -0
- package/native/System.Runtime.CompilerServices.Unsafe.dll +0 -0
- package/native/System.Text.Encoding.CodePages.dll +0 -0
- package/native/System.Text.Encodings.Web.dll +0 -0
- package/native/System.Text.Json.dll +0 -0
- package/native/System.Threading.Tasks.Extensions.dll +0 -0
- package/native/System.ValueTuple.dll +0 -0
- package/native/WebView.cjs +1 -1
- package/native/WebView.deps.json +117 -101
- package/native/WebView.dll +0 -0
- package/native/WebView.mjs +1 -1
- package/package.json +56 -55
- package/native/node_modules/node-api-dotnet/README.md +0 -80
- package/native/node_modules/node-api-dotnet/index.d.ts +0 -98
- package/native/node_modules/node-api-dotnet/linux-arm64/Microsoft.JavaScript.NodeApi.node +0 -0
- package/native/node_modules/node-api-dotnet/linux-x64/Microsoft.JavaScript.NodeApi.node +0 -0
- package/native/node_modules/node-api-dotnet/net10.0/Microsoft.JavaScript.NodeApi.DotNetHost.dll +0 -0
- package/native/node_modules/node-api-dotnet/net10.0/Microsoft.JavaScript.NodeApi.dll +0 -0
- package/native/node_modules/node-api-dotnet/net10.0/Microsoft.JavaScript.NodeApi.runtimeconfig.json +0 -14
- package/native/node_modules/node-api-dotnet/net10.0.js +0 -2
- package/native/node_modules/node-api-dotnet/net472.d.ts +0 -2
- package/native/node_modules/node-api-dotnet/net8.0/Microsoft.JavaScript.NodeApi.DotNetHost.dll +0 -0
- package/native/node_modules/node-api-dotnet/net8.0/Microsoft.JavaScript.NodeApi.dll +0 -0
- package/native/node_modules/node-api-dotnet/net8.0/Microsoft.JavaScript.NodeApi.runtimeconfig.json +0 -14
- package/native/node_modules/node-api-dotnet/net8.0.d.ts +0 -2
- package/native/node_modules/node-api-dotnet/net8.0.js +0 -2
- package/native/node_modules/node-api-dotnet/net9.0/Microsoft.JavaScript.NodeApi.DotNetHost.dll +0 -0
- package/native/node_modules/node-api-dotnet/net9.0/Microsoft.JavaScript.NodeApi.dll +0 -0
- package/native/node_modules/node-api-dotnet/net9.0/Microsoft.JavaScript.NodeApi.runtimeconfig.json +0 -14
- package/native/node_modules/node-api-dotnet/net9.0.d.ts +0 -2
- package/native/node_modules/node-api-dotnet/net9.0.js +0 -2
- package/native/node_modules/node-api-dotnet/osx-arm64/Microsoft.JavaScript.NodeApi.node +0 -0
- package/native/node_modules/node-api-dotnet/osx-x64/Microsoft.JavaScript.NodeApi.node +0 -0
- package/native/node_modules/node-api-dotnet/package.json +0 -27
- package/src/README.md +0 -125
- package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.Core.dll +0 -0
- package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.Core.xml +0 -6817
- package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.WinForms.dll +0 -0
- package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.WinForms.xml +0 -510
- package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.Wpf.dll +0 -0
- package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.Wpf.xml +0 -1902
- package/src/csharp/bin/Release/net10.0-windows/WebView.cjs +0 -26
- package/src/csharp/bin/Release/net10.0-windows/WebView.d.ts +0 -8
- package/src/csharp/bin/Release/net10.0-windows/WebView.deps.json +0 -260
- package/src/csharp/bin/Release/net10.0-windows/WebView.dll +0 -0
- package/src/csharp/bin/Release/net10.0-windows/WebView.mjs +0 -31
- package/src/csharp/bin/Release/net10.0-windows/WebView.pdb +0 -0
- package/src/csharp/bin/Release/net10.0-windows/import.cjs +0 -3
- package/src/csharp/bin/Release/net10.0-windows/runtimes/win-arm64/native/WebView2Loader.dll +0 -0
- package/src/csharp/bin/Release/net10.0-windows/runtimes/win-x64/native/WebView2Loader.dll +0 -0
- package/src/csharp/bin/Release/net10.0-windows/runtimes/win-x86/native/WebView2Loader.dll +0 -0
|
Binary file
|
package/native/node_modules/node-api-dotnet/net10.0/Microsoft.JavaScript.NodeApi.runtimeconfig.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"runtimeOptions": {
|
|
3
|
-
"tfm": "net10.0",
|
|
4
|
-
"framework": {
|
|
5
|
-
"name": "Microsoft.NETCore.App",
|
|
6
|
-
"version": "10.0.0"
|
|
7
|
-
},
|
|
8
|
-
"configProperties": {
|
|
9
|
-
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
|
|
10
|
-
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false,
|
|
11
|
-
"System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting": true
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
package/native/node_modules/node-api-dotnet/net8.0/Microsoft.JavaScript.NodeApi.DotNetHost.dll
DELETED
|
Binary file
|
|
Binary file
|
package/native/node_modules/node-api-dotnet/net8.0/Microsoft.JavaScript.NodeApi.runtimeconfig.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"runtimeOptions": {
|
|
3
|
-
"tfm": "net8.0",
|
|
4
|
-
"framework": {
|
|
5
|
-
"name": "Microsoft.NETCore.App",
|
|
6
|
-
"version": "8.0.0"
|
|
7
|
-
},
|
|
8
|
-
"configProperties": {
|
|
9
|
-
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
|
|
10
|
-
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false,
|
|
11
|
-
"System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting": true
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
package/native/node_modules/node-api-dotnet/net9.0/Microsoft.JavaScript.NodeApi.DotNetHost.dll
DELETED
|
Binary file
|
|
Binary file
|
package/native/node_modules/node-api-dotnet/net9.0/Microsoft.JavaScript.NodeApi.runtimeconfig.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"runtimeOptions": {
|
|
3
|
-
"tfm": "net9.0",
|
|
4
|
-
"framework": {
|
|
5
|
-
"name": "Microsoft.NETCore.App",
|
|
6
|
-
"version": "9.0.0"
|
|
7
|
-
},
|
|
8
|
-
"configProperties": {
|
|
9
|
-
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
|
|
10
|
-
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false,
|
|
11
|
-
"System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting": true
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
Binary file
|
|
Binary file
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "node-api-dotnet",
|
|
3
|
-
"version": "0.9.19",
|
|
4
|
-
"description": "Node-API bindings for .Net",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"author": "Microsoft",
|
|
7
|
-
"type": "commonjs",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": "./index.js",
|
|
10
|
-
"./net10.0": "./net10.0.js",
|
|
11
|
-
"./net9.0": "./net9.0.js",
|
|
12
|
-
"./net8.0": "./net8.0.js",
|
|
13
|
-
"./net472": "./net472.js"
|
|
14
|
-
},
|
|
15
|
-
"types": "./index.d.ts",
|
|
16
|
-
"keywords": [
|
|
17
|
-
"Node-API",
|
|
18
|
-
"NAPI",
|
|
19
|
-
".Net",
|
|
20
|
-
"dotnet"
|
|
21
|
-
],
|
|
22
|
-
"repository": "github:microsoft/node-api-dotnet",
|
|
23
|
-
"homepage": "https://github.com/microsoft/node-api-dotnet#readme",
|
|
24
|
-
"bugs": {
|
|
25
|
-
"url": "https://github.com/microsoft/node-api-dotnet/issues"
|
|
26
|
-
}
|
|
27
|
-
}
|
package/src/README.md
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
# Source Code Structure
|
|
2
|
-
|
|
3
|
-
The TypeScript source code is organized into logical modules for better readability and maintainability.
|
|
4
|
-
|
|
5
|
-
## Module Overview
|
|
6
|
-
|
|
7
|
-
### `index.ts`
|
|
8
|
-
Main entry point that exports the public API. This is what users import when using ewvjs.
|
|
9
|
-
|
|
10
|
-
**Exports:**
|
|
11
|
-
- `WebView` class
|
|
12
|
-
- `Window` class
|
|
13
|
-
- All type definitions
|
|
14
|
-
- Convenience functions: `create_window()`, `start()`, `expose()`
|
|
15
|
-
- Default singleton instance
|
|
16
|
-
|
|
17
|
-
### `webview.ts`
|
|
18
|
-
Contains the `WebView` class which manages the application lifecycle.
|
|
19
|
-
|
|
20
|
-
**Responsibilities:**
|
|
21
|
-
- Platform detection and initialization
|
|
22
|
-
- Window creation and lifecycle management
|
|
23
|
-
- Exposed function registry
|
|
24
|
-
- Event loop management
|
|
25
|
-
|
|
26
|
-
**Key Methods:**
|
|
27
|
-
- `create_window()` - Creates a new window instance
|
|
28
|
-
- `start()` - Starts the application event loop
|
|
29
|
-
- `expose()` - Registers Node.js functions to be callable from WebView
|
|
30
|
-
|
|
31
|
-
### `window.ts`
|
|
32
|
-
Contains the `Window` class which represents individual window instances.
|
|
33
|
-
|
|
34
|
-
**Responsibilities:**
|
|
35
|
-
- Window state management
|
|
36
|
-
- Message routing between WebView and Node.js
|
|
37
|
-
- Context menu handling
|
|
38
|
-
- Exposed function call/response handling
|
|
39
|
-
- API method delegation to platform
|
|
40
|
-
|
|
41
|
-
**Method Categories:**
|
|
42
|
-
- **Core**: `run()`, `close()`, `evaluate_js()`
|
|
43
|
-
- **State**: `maximize()`, `minimize()`, `restore()`, `show()`, `hide()`, `focus()`
|
|
44
|
-
- **Size/Position**: `getSize()`, `setSize()`, `getPosition()`, `setPosition()`, `move()`, `resize()`
|
|
45
|
-
- **Title**: `setTitle()`, `set_title()`
|
|
46
|
-
- **Title Bar**: `show_titlebar()`, `hide_titlebar()`
|
|
47
|
-
- **Cookies**: `get_cookies()`, `set_cookie()`, `clear_cookies()`
|
|
48
|
-
|
|
49
|
-
**Message Handling:**
|
|
50
|
-
- `_on_message()` - Routes messages from C# to appropriate handlers
|
|
51
|
-
- `_handleExposedFunction()` - Executes exposed Node.js functions
|
|
52
|
-
- `_handleContextMenu()` - Processes context menu requests
|
|
53
|
-
- `_handleMenuClick()` - Triggers menu item callbacks
|
|
54
|
-
|
|
55
|
-
### `types.ts`
|
|
56
|
-
Type definitions and interfaces.
|
|
57
|
-
|
|
58
|
-
**Types:**
|
|
59
|
-
- `ContextMenuItem` - Context menu item definition
|
|
60
|
-
- `WindowOptions` - Window configuration options
|
|
61
|
-
|
|
62
|
-
### `utils.ts`
|
|
63
|
-
Utility functions used across modules.
|
|
64
|
-
|
|
65
|
-
**Functions:**
|
|
66
|
-
- `getParamNames()` - Extracts parameter names from a function
|
|
67
|
-
- `generateId()` - Generates random IDs for menu items
|
|
68
|
-
|
|
69
|
-
## Data Flow
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
User Code
|
|
73
|
-
↓
|
|
74
|
-
index.ts (exports)
|
|
75
|
-
↓
|
|
76
|
-
webview.ts (creates Window instances)
|
|
77
|
-
↓
|
|
78
|
-
window.ts (manages window lifecycle)
|
|
79
|
-
↓
|
|
80
|
-
platforms/windows.ts (platform-specific implementation)
|
|
81
|
-
↓
|
|
82
|
-
csharp/WebViewWindow.cs (native WebView2 integration)
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## Message Flow (Exposed Functions)
|
|
86
|
-
|
|
87
|
-
```
|
|
88
|
-
WebView JavaScript
|
|
89
|
-
↓ postMessage([funcName, params, id])
|
|
90
|
-
C# WebViewWindow.CoreWebView2_WebMessageReceived
|
|
91
|
-
↓ SendMessageAsync()
|
|
92
|
-
window.ts _on_message()
|
|
93
|
-
↓ _handleExposedFunction()
|
|
94
|
-
Node.js Function Execution
|
|
95
|
-
↓ _sendSuccessResponse()
|
|
96
|
-
window.evaluate_js()
|
|
97
|
-
↓ resolves promise in WebView
|
|
98
|
-
WebView JavaScript receives result
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
## Best Practices
|
|
102
|
-
|
|
103
|
-
1. **Window Creation**: Always call `window.run()` after creating a window
|
|
104
|
-
2. **Exposed Functions**: Register with `expose()` before creating windows
|
|
105
|
-
3. **Cleanup**: Windows automatically clean up on close
|
|
106
|
-
4. **Error Handling**: All async methods can throw - use try/catch
|
|
107
|
-
5. **Threading**: All window operations are automatically marshaled to the correct thread
|
|
108
|
-
|
|
109
|
-
## Example Usage
|
|
110
|
-
|
|
111
|
-
```typescript
|
|
112
|
-
import ewvjs from 'ewvjs';
|
|
113
|
-
|
|
114
|
-
// Expose a Node.js function
|
|
115
|
-
ewvjs.expose('greet', (name: string) => {
|
|
116
|
-
return `Hello, ${name}!`;
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
// Create and run a window
|
|
120
|
-
const win = ewvjs.create_window('My App', '<h1>Test</h1>');
|
|
121
|
-
await win.run();
|
|
122
|
-
|
|
123
|
-
// Start the event loop
|
|
124
|
-
await ewvjs.start();
|
|
125
|
-
```
|
|
Binary file
|