5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 00:22:57 +08:00

Upgrade Lit to use Vite v3 (#1745)

* Upgrade Lit to use Vite v3

* Remove unused files
This commit is contained in:
Lea Anthony 2022-08-20 14:54:27 +10:00 committed by GitHub
parent d9a535c393
commit 4d51d9b742
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 77 additions and 32 deletions

View File

@ -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

View File

@ -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"
}
}

View File

@ -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

View File

@ -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,

View File

@ -1,8 +1,9 @@
{
"compilerOptions": {
"composite": true,
"module": "esnext",
"moduleResolution": "node"
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}

View File

@ -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<Screen[]>;
// [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<EnvironmentInfo>;
// [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;

View File

@ -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();
}
export function Hide() {
window.runtime.Hide();
}
export function Show() {
window.runtime.Show();
}

View File

@ -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"
}
}

View File

@ -1,15 +0,0 @@
<svg width="410" height="404" viewBox="0 0 410 404" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M399.641 59.5246L215.643 388.545C211.844 395.338 202.084 395.378 198.228 388.618L10.5817 59.5563C6.38087 52.1896 12.6802 43.2665 21.0281 44.7586L205.223 77.6824C206.398 77.8924 207.601 77.8904 208.776 77.6763L389.119 44.8058C397.439 43.2894 403.768 52.1434 399.641 59.5246Z" fill="url(#paint0_linear)"/>
<path d="M292.965 1.5744L156.801 28.2552C154.563 28.6937 152.906 30.5903 152.771 32.8664L144.395 174.33C144.198 177.662 147.258 180.248 150.51 179.498L188.42 170.749C191.967 169.931 195.172 173.055 194.443 176.622L183.18 231.775C182.422 235.487 185.907 238.661 189.532 237.56L212.947 230.446C216.577 229.344 220.065 232.527 219.297 236.242L201.398 322.875C200.278 328.294 207.486 331.249 210.492 326.603L212.5 323.5L323.454 102.072C325.312 98.3645 322.108 94.137 318.036 94.9228L279.014 102.454C275.347 103.161 272.227 99.746 273.262 96.1583L298.731 7.86689C299.767 4.27314 296.636 0.855181 292.965 1.5744Z" fill="url(#paint1_linear)"/>
<defs>
<linearGradient id="paint0_linear" x1="6.00017" y1="32.9999" x2="235" y2="344" gradientUnits="userSpaceOnUse">
<stop stop-color="#41D1FF"/>
<stop offset="1" stop-color="#BD34FE"/>
</linearGradient>
<linearGradient id="paint1_linear" x1="194.651" y1="8.81818" x2="236.076" y2="292.989" gradientUnits="userSpaceOnUse">
<stop stop-color="#FFEA83"/>
<stop offset="0.0833333" stop-color="#FFDD35"/>
<stop offset="1" stop-color="#FFA800"/>
</linearGradient>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -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<Screen[]>;
// [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<EnvironmentInfo>;
// [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;

View File

@ -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();
}