diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/frontend/package.json b/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/frontend/package.json index d465e2c1..f0106ca9 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/frontend/package.json +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/frontend/package.json @@ -2,20 +2,21 @@ "name": "frontend", "private": true, "version": "0.0.0", + "type": "module", "scripts": { "dev": "vite", "build": "tsc && vite build", "preview": "vite preview" }, "dependencies": { - "react": "^18.0.0", - "react-dom": "^18.0.0" + "react": "^18.2.0", + "react-dom": "^18.2.0" }, "devDependencies": { - "@types/react": "^18.0.0", - "@types/react-dom": "^18.0.0", - "@vitejs/plugin-react": "^1.3.0", - "typescript": "^4.6.3", - "vite": "^2.9.9" + "@types/react": "^18.0.17", + "@types/react-dom": "^18.0.6", + "@vitejs/plugin-react": "^2.0.1", + "typescript": "^4.6.4", + "vite": "^3.0.7" } } \ No newline at end of file diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/frontend/tsconfig.node.json b/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/frontend/tsconfig.node.json index e993792c..9d31e2ae 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/frontend/tsconfig.node.json +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/frontend/tsconfig.node.json @@ -1,8 +1,9 @@ { "compilerOptions": { "composite": true, - "module": "esnext", - "moduleResolution": "node" + "module": "ESNext", + "moduleResolution": "Node", + "allowSyntheticDefaultImports": true }, "include": ["vite.config.ts"] } diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/frontend/wailsjs/runtime/runtime.d.ts b/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/frontend/wailsjs/runtime/runtime.d.ts index 8d816307..14f322e4 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/frontend/wailsjs/runtime/runtime.d.ts +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/frontend/wailsjs/runtime/runtime.d.ts @@ -18,6 +18,13 @@ export interface Size { h: number; } +export interface Screen { + isCurrent: boolean; + isPrimary: boolean; + width: number + height: number +} + // Environment information such as platform, buildtype, ... export interface EnvironmentInfo { buildType: string; @@ -171,6 +178,10 @@ export function WindowUnminimise(): void; // Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels. export function WindowSetBackgroundColour(R: number, G: number, B: number, A: number): void; +// [ScreenGetAll](https://wails.io/docs/reference/runtime/window#screengetall) +// Gets the all screens. Call this anew each time you want to refresh data from the underlying windowing system. +export function ScreenGetAll(): Promise; + // [BrowserOpenURL](https://wails.io/docs/reference/runtime/browser#browseropenurl) // Opens the given URL in the system browser. export function BrowserOpenURL(url: string): void; @@ -182,3 +193,11 @@ export function Environment(): Promise; // [Quit](https://wails.io/docs/reference/runtime/intro#quit) // Quits the application. export function Quit(): void; + +// [Hide](https://wails.io/docs/reference/runtime/intro#hide) +// Hides the application. +export function Hide(): void; + +// [Show](https://wails.io/docs/reference/runtime/intro#show) +// Shows the application. +export function Show(): void; diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/frontend/wailsjs/runtime/runtime.js b/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/frontend/wailsjs/runtime/runtime.js index 1975663e..26dbb224 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/frontend/wailsjs/runtime/runtime.js +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/frontend/wailsjs/runtime/runtime.js @@ -109,10 +109,6 @@ export function WindowSetMinSize(width, height) { window.runtime.WindowSetMinSize(width, height); } -export function ScreenGetAll() { - return window.runtime.ScreenGetAll(); -} - export function WindowSetPosition(x, y) { window.runtime.WindowSetPosition(x, y); } @@ -153,6 +149,10 @@ export function WindowSetBackgroundColour(R, G, B, A) { window.runtime.WindowSetBackgroundColour(R, G, B, A); } +export function ScreenGetAll() { + return window.runtime.ScreenGetAll(); +} + export function BrowserOpenURL(url) { window.runtime.BrowserOpenURL(url); } @@ -164,3 +164,11 @@ export function Environment() { export function Quit() { window.runtime.Quit(); } + +export function Hide() { + window.runtime.Hide(); +} + +export function Show() { + window.runtime.Show(); +} diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/react/frontend/package.json b/v2/cmd/wails/internal/commands/initialise/templates/templates/react/frontend/package.json index 3c147070..3b34e1f8 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/react/frontend/package.json +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/react/frontend/package.json @@ -2,19 +2,20 @@ "name": "frontend", "private": true, "version": "0.0.0", + "type": "module", "scripts": { "dev": "vite", "build": "vite build", "preview": "vite preview" }, "dependencies": { - "react": "^18.0.0", - "react-dom": "^18.0.0" + "react": "^18.2.0", + "react-dom": "^18.2.0" }, "devDependencies": { - "@types/react": "^18.0.0", - "@types/react-dom": "^18.0.0", - "@vitejs/plugin-react": "^1.3.0", - "vite": "^2.9.9" + "@types/react": "^18.0.17", + "@types/react-dom": "^18.0.6", + "@vitejs/plugin-react": "^2.0.1", + "vite": "^3.0.7" } } \ No newline at end of file diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/react/frontend/wailsjs/runtime/runtime.d.ts b/v2/cmd/wails/internal/commands/initialise/templates/templates/react/frontend/wailsjs/runtime/runtime.d.ts index 8d816307..14f322e4 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/react/frontend/wailsjs/runtime/runtime.d.ts +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/react/frontend/wailsjs/runtime/runtime.d.ts @@ -18,6 +18,13 @@ export interface Size { h: number; } +export interface Screen { + isCurrent: boolean; + isPrimary: boolean; + width: number + height: number +} + // Environment information such as platform, buildtype, ... export interface EnvironmentInfo { buildType: string; @@ -171,6 +178,10 @@ export function WindowUnminimise(): void; // Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels. export function WindowSetBackgroundColour(R: number, G: number, B: number, A: number): void; +// [ScreenGetAll](https://wails.io/docs/reference/runtime/window#screengetall) +// Gets the all screens. Call this anew each time you want to refresh data from the underlying windowing system. +export function ScreenGetAll(): Promise; + // [BrowserOpenURL](https://wails.io/docs/reference/runtime/browser#browseropenurl) // Opens the given URL in the system browser. export function BrowserOpenURL(url: string): void; @@ -182,3 +193,11 @@ export function Environment(): Promise; // [Quit](https://wails.io/docs/reference/runtime/intro#quit) // Quits the application. export function Quit(): void; + +// [Hide](https://wails.io/docs/reference/runtime/intro#hide) +// Hides the application. +export function Hide(): void; + +// [Show](https://wails.io/docs/reference/runtime/intro#show) +// Shows the application. +export function Show(): void; diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/react/frontend/wailsjs/runtime/runtime.js b/v2/cmd/wails/internal/commands/initialise/templates/templates/react/frontend/wailsjs/runtime/runtime.js index cada3c9b..26dbb224 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/react/frontend/wailsjs/runtime/runtime.js +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/react/frontend/wailsjs/runtime/runtime.js @@ -117,10 +117,6 @@ export function WindowGetPosition() { return window.runtime.WindowGetPosition(); } -export function ScreenGetAll() { - return window.runtime.ScreenGetAll(); -} - export function WindowHide() { window.runtime.WindowHide(); } @@ -153,6 +149,10 @@ export function WindowSetBackgroundColour(R, G, B, A) { window.runtime.WindowSetBackgroundColour(R, G, B, A); } +export function ScreenGetAll() { + return window.runtime.ScreenGetAll(); +} + export function BrowserOpenURL(url) { window.runtime.BrowserOpenURL(url); } @@ -164,3 +164,11 @@ export function Environment() { export function Quit() { window.runtime.Quit(); } + +export function Hide() { + window.runtime.Hide(); +} + +export function Show() { + window.runtime.Show(); +}