-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
51 lines (48 loc) · 1.54 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html lang="zh-Hant-TW" style="display: none">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>UI demo</title>
<!-- MasterCSS -->
<script src="https://cdn.jsdelivr.net/npm/@master/[email protected]/dist/index.browser.js"></script>
<!-- UI -->
<script defer type="module" src="./src/@ui/simple-greeting.js"></script>
<script type="module">
import { LitElement, html, css, classMap, unsafeCSS, nothing } from 'https://cdn.jsdelivr.net/gh/lit/[email protected]/all/lit-all.min.js';
class SimpleGreeting extends LitElement {
static styles = css`
p {
color: blue;
}
`;
static properties = {
name: { type: String },
};
constructor() {
super();
this.name = 'Somebody';
}
render() {
return html`<p class="fg:white bg:gray-50">Hello, ${this.name}!</p>`;
}
connectedCallback() {
super.connectedCallback();
this.css = new MasterCSS({
themeDriver: 'host',
observe: false,
}).observe(this.shadowRoot);
}
disconnectedCallback() {
super.disconnectedCallback();
if (this.css) this.css.destroy();
}
}
customElements.define('simple-greeting', SimpleGreeting);
</script>
</head>
<body>
<simple-greeting name="Lit"></simple-greeting>
<p class="fg:white bg:gray-50">fg:white bg:gray-50</p>
</body>
</html>