-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6946f50
commit a3ef938
Showing
11 changed files
with
205 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
## Advanced(Stage 3) | ||
|
||
- StoryBook | ||
- Lit | ||
- Midway Hooks | ||
- Midway Serverless | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + Lit App</title> | ||
<script type="module" src="/src/my-element.ts"></script> | ||
</head> | ||
<body> | ||
<my-element> | ||
<p>This is child content</p> | ||
</my-element> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "vite-lit-starter", | ||
"private": true, | ||
"version": "0.0.0", | ||
"main": "dist/my-element.es.js", | ||
"exports": { | ||
".": "./dist/my-element.es.js" | ||
}, | ||
"types": "types/my-element.d.ts", | ||
"files": [ | ||
"dist", | ||
"types" | ||
], | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build" | ||
}, | ||
"dependencies": { | ||
"lit": "^2.0.2" | ||
}, | ||
"devDependencies": { | ||
"vite": "^2.8.0", | ||
"typescript": "^4.5.4" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { html, css, LitElement } from 'lit'; | ||
import { customElement, property } from 'lit/decorators.js'; | ||
|
||
/** | ||
* An example element. | ||
* | ||
* @slot - This element has a slot | ||
* @csspart button - The button | ||
*/ | ||
@customElement('my-element') | ||
export class MyElement extends LitElement { | ||
static styles = css` | ||
:host { | ||
display: block; | ||
border: solid 1px gray; | ||
padding: 16px; | ||
max-width: 800px; | ||
} | ||
`; | ||
|
||
/** | ||
* The name to say "Hello" to. | ||
*/ | ||
@property() | ||
name = 'World'; | ||
|
||
/** | ||
* The number of times the button has been clicked. | ||
*/ | ||
@property({ type: Number }) | ||
count = 0; | ||
|
||
render() { | ||
return html` | ||
<h1>LinbuduLab Vite + Lit Starter</h1> | ||
<h2>Hello, ${this.name}!</h2> | ||
<button @click=${this._onClick} part="button"> | ||
Click Count: ${this.count} | ||
</button> | ||
<slot></slot> | ||
`; | ||
} | ||
|
||
private _onClick() { | ||
this.count++; | ||
} | ||
|
||
foo(): string { | ||
return 'foo'; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'my-element': MyElement; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="vite/client" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "esnext", | ||
"lib": ["es2017", "dom", "dom.iterable"], | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"outDir": "./types", | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"moduleResolution": "node", | ||
"allowSyntheticDefaultImports": true, | ||
"experimentalDecorators": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"useDefineForClassFields": false | ||
}, | ||
"include": ["src/**/*.ts"], | ||
"references": [{ "path": "./tsconfig.node.json" }] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"compilerOptions": { | ||
"composite": true, | ||
"module": "esnext", | ||
"moduleResolution": "node" | ||
}, | ||
"include": ["vite.config.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { defineConfig } from 'vite' | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
build: { | ||
lib: { | ||
entry: 'src/my-element.ts', | ||
formats: ['es'] | ||
}, | ||
rollupOptions: { | ||
external: /^lit/ | ||
} | ||
} | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.