-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Enable lit css importing (#9550)
Fixes #9532
- Loading branch information
Showing
6 changed files
with
97 additions
and
0 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
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,27 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<title>My Project</title> | ||
<style> | ||
body { | ||
margin: 0; | ||
width: 100vw; | ||
height: 100vh; | ||
} | ||
|
||
#outlet { | ||
height: 100%; | ||
} | ||
</style> | ||
<custom-style> | ||
<style include="lumo-color lumo-typography"></style> | ||
</custom-style> | ||
<!-- index.ts is included here automatically (either by the dev server or during the build) --> | ||
</head> | ||
|
||
<body theme="light"> | ||
<div id="outlet"></div> | ||
</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,23 @@ | ||
import {Flow} from '@vaadin/flow-frontend/Flow'; | ||
import {Router} from '@vaadin/router'; | ||
|
||
const {serverSideRoutes} = new Flow({ | ||
imports: () => import('../target/frontend/generated-flow-imports'), | ||
}); | ||
|
||
const routes = [ | ||
// for client-side, place routes below (more info https://vaadin.com/docs/v15/flow/typescript/creating-routes.html) | ||
{ | ||
path: 'hello', | ||
component: 'hello-world-view', | ||
action: async () => { | ||
await import('./typescript/hello-world-view'); | ||
}, | ||
}, | ||
// for server-side, the next magic line sends all unmatched routes: | ||
...serverSideRoutes, // IMPORTANT: this must be the last entry in the array | ||
] | ||
; | ||
|
||
export const router = new Router(document.querySelector('#outlet')); | ||
router.setRoutes(routes); |
5 changes: 5 additions & 0 deletions
5
flow-tests/test-themes/frontend/typescript/hello-world-view.css
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,5 @@ | ||
:host { | ||
display: block; | ||
padding: 1em; | ||
background-color: orange; | ||
} |
20 changes: 20 additions & 0 deletions
20
flow-tests/test-themes/frontend/typescript/hello-world-view.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,20 @@ | ||
import '@vaadin/vaadin-text-field'; | ||
import { customElement, html, LitElement } from 'lit-element'; | ||
import styles from './hello-world-view.css'; | ||
|
||
|
||
@customElement('hello-world-view') | ||
export class HelloWorldView extends LitElement { | ||
name: string = ''; | ||
|
||
static styles = [styles]; | ||
|
||
render() { | ||
return html` | ||
<vaadin-text-field label="Your name" @value-changed="${this.nameChanged}"></vaadin-text-field> | ||
`; | ||
} | ||
nameChanged(e: CustomEvent) { | ||
this.name = e.detail.value; | ||
} | ||
} |
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