Last active
April 19, 2023 19:21
-
-
Save abeisgoat/a4f4f3a9fd0b6a6348768a8737344e17 to your computer and use it in GitHub Desktop.
Simplit - Simplest, Tool-less Lit boilerplate
This file contains hidden or 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
import { | |
LitElement, | |
html, | |
css, | |
} from "https://cdn.jsdelivr.net/gh/lit/dist@2/core/lit-core.min.js"; | |
export class SimpleGreeting extends LitElement { | |
static properties = { | |
name: {}, | |
}; | |
// Define scoped styles right with your component, in plain CSS | |
static styles = css` | |
:host { | |
* { | |
user-select: none; | |
-webkit-user-select: none; | |
-webkit-touch-callout: none !important; | |
touch-action: manipulation; | |
} | |
body { | |
padding: 0px; | |
margin: 0px; | |
position: fixed; | |
width: 100%; | |
height: calc(100% - env(safe-area-inset-top)); | |
overflow: hidden; | |
} | |
} | |
`; | |
constructor() { | |
super(); | |
// Declare reactive properties | |
this.name = "World"; | |
} | |
// Render the UI as a function of component state | |
render() { | |
return html`<p>Hello, ${this.name}!</p>`; | |
} | |
} | |
customElements.define("simple-greeting", SimpleGreeting); |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Simplit</title> | |
<meta charset="utf-8" /> | |
<meta | |
name="viewport" | |
content="width=400, user-scalable=no, viewport-fit=cover" | |
/> | |
<meta name="description" content="Simple Lit.dev Boilerplate" /> | |
<meta | |
name="apple-mobile-web-app-status-bar-style" | |
content="black-translucent" | |
/> | |
<script type="module" src="app.js"></script> | |
<script> | |
// Stop pinch to zoom n junk | |
document.addEventListener("click", function (e) { | |
e.preventDefault(); | |
}); | |
document.addEventListener("gesturestart", function (e) { | |
e.preventDefault(); | |
}); | |
document.addEventListener("touchstart", function (e) { | |
e.preventDefault(); | |
}); | |
</script> | |
<style> | |
* { | |
user-select: none; | |
-webkit-user-select: none; | |
-webkit-touch-callout: none !important; | |
touch-action: manipulation; | |
} | |
body { | |
padding: 0px; | |
margin: 0px; | |
position: fixed; | |
width: 100%; | |
height: calc(100% - env(safe-area-inset-top)); | |
overflow: hidden; | |
} | |
</style> | |
</head> | |
<body> | |
<simple-greeting name="Abe"></simple-greeting> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment