lit-live-with-tailwind.ts
· 477 B · TypeScript
Raw
import {LitElement, unsafeCSS} from 'lit'
import type {ViewHook} from 'phoenix_live_view'
import styles from '../../../priv/static/assets/app.css?inline'
declare global {
interface HTMLElement {
LitLiveHook?: ViewHook
}
}
export default class LitLiveElement extends LitElement {
static styles = [unsafeCSS(styles)]
LitLiveHook?: ViewHook
}
export const LitLiveHook = {
mounted(this: ViewHook) {
this.el.LitLiveHook = this
},
} satisfies Partial<ViewHook>
1 | import {LitElement, unsafeCSS} from 'lit' |
2 | import type {ViewHook} from 'phoenix_live_view' |
3 | import styles from '../../../priv/static/assets/app.css?inline' |
4 | |
5 | declare global { |
6 | interface HTMLElement { |
7 | LitLiveHook?: ViewHook |
8 | } |
9 | } |
10 | |
11 | export default class LitLiveElement extends LitElement { |
12 | static styles = [unsafeCSS(styles)] |
13 | LitLiveHook?: ViewHook |
14 | } |
15 | |
16 | export const LitLiveHook = { |
17 | mounted(this: ViewHook) { |
18 | this.el.LitLiveHook = this |
19 | }, |
20 | } satisfies Partial<ViewHook> |