Last active 1752987531

Inline import the compiled TailwindCSS and Phoenix LiveView ViewHook and make it available to components

Revision 7af640f228e474971d4ac7505420d8514fc9e052

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