diff --git a/v2/cmd/wails/internal/commands/initialise/templates/generate/assets/lit-ts/frontend/src/my-element.ts b/v2/cmd/wails/internal/commands/initialise/templates/generate/assets/lit-ts/frontend/src/my-element.ts index 1b313b759..27fd71e45 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/generate/assets/lit-ts/frontend/src/my-element.ts +++ b/v2/cmd/wails/internal/commands/initialise/templates/generate/assets/lit-ts/frontend/src/my-element.ts @@ -73,7 +73,7 @@ export class MyElement extends LitElement { resultText = "Please enter your name below 👇" greet() { - let thisName = (this.shadowRoot.getElementById('name') as HTMLInputElement)?.value; + let thisName = (this.shadowRoot?.getElementById('name') as HTMLInputElement)?.value; if (thisName) { Greet(thisName).then(result => { this.resultText = result diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/package.json b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/package.json index e4567f274..01aa1512c 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/package.json +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/package.json @@ -2,6 +2,7 @@ "name": "frontend", "private": true, "version": "0.0.0", + "type": "module", "main": "dist/my-element.es.js", "exports": { ".": "./dist/my-element.es.js" @@ -16,10 +17,10 @@ "build": "tsc && vite build" }, "dependencies": { - "lit": "^2.0.2" + "lit": "^2.2.8" }, "devDependencies": { - "vite": "^2.9.9", - "typescript": "^4.5.4" + "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/lit-ts/frontend/src/my-element.ts b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/src/my-element.ts index 1b313b759..27fd71e45 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/src/my-element.ts +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/src/my-element.ts @@ -73,7 +73,7 @@ export class MyElement extends LitElement { resultText = "Please enter your name below 👇" greet() { - let thisName = (this.shadowRoot.getElementById('name') as HTMLInputElement)?.value; + let thisName = (this.shadowRoot?.getElementById('name') as HTMLInputElement)?.value; if (thisName) { Greet(thisName).then(result => { this.resultText = result diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/tsconfig.json b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/tsconfig.json index 91a731fd8..7710a47c4 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/tsconfig.json +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/tsconfig.json @@ -1,7 +1,11 @@ { "compilerOptions": { - "module": "esnext", - "lib": ["es2017", "dom", "dom.iterable"], + "module": "ESNext", + "lib": [ + "ES2020", + "DOM", + "DOM.Iterable" + ], "declaration": true, "emitDeclarationOnly": true, "outDir": "./types", @@ -10,7 +14,7 @@ "noUnusedParameters": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, - "moduleResolution": "node", + "moduleResolution": "Node", "isolatedModules": true, "allowSyntheticDefaultImports": true, "experimentalDecorators": true, diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/tsconfig.node.json b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/tsconfig.node.json index e993792cb..9d31e2aed 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/tsconfig.node.json +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-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/lit-ts/frontend/wailsjs/runtime/runtime.d.ts b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/wailsjs/runtime/runtime.d.ts index 8d816307f..14f322e4c 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/wailsjs/runtime/runtime.d.ts +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-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/lit-ts/frontend/wailsjs/runtime/runtime.js b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/wailsjs/runtime/runtime.js index 8e8531a5f..26dbb224c 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/wailsjs/runtime/runtime.js +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/frontend/wailsjs/runtime/runtime.js @@ -149,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); } @@ -161,6 +165,10 @@ export function Quit() { window.runtime.Quit(); } -export function ScreenGetAll() { - return window.runtime.ScreenGetAll(); -} \ No newline at end of file +export function Hide() { + window.runtime.Hide(); +} + +export function Show() { + window.runtime.Show(); +} diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/frontend/package.json b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/frontend/package.json index cb172cb12..10c9a760e 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/frontend/package.json +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/frontend/package.json @@ -2,6 +2,7 @@ "name": "frontend", "private": true, "version": "0.0.0", + "type": "module", "main": "dist/my-element.es.js", "exports": { ".": "./dist/my-element.es.js" @@ -14,9 +15,9 @@ "build": "vite build" }, "dependencies": { - "lit": "^2.0.2" + "lit": "^2.2.8" }, "devDependencies": { - "vite": "^2.9.9" + "vite": "^3.0.7" } } \ No newline at end of file diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/frontend/src/favicon.svg b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/frontend/src/favicon.svg deleted file mode 100644 index de4aeddc1..000000000 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/frontend/src/favicon.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/frontend/wailsjs/runtime/runtime.d.ts b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/frontend/wailsjs/runtime/runtime.d.ts index 8d816307f..14f322e4c 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/frontend/wailsjs/runtime/runtime.d.ts +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/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/lit/frontend/wailsjs/runtime/runtime.js b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/frontend/wailsjs/runtime/runtime.js index 900cc8a00..26dbb224c 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/frontend/wailsjs/runtime/runtime.js +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/frontend/wailsjs/runtime/runtime.js @@ -149,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); } @@ -161,7 +165,10 @@ export function Quit() { window.runtime.Quit(); } -export function ScreenGetAll() { - return window.runtime.ScreenGetAll(); +export function Hide() { + window.runtime.Hide(); } +export function Show() { + window.runtime.Show(); +}