-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb4155c
commit 81e07a2
Showing
15 changed files
with
129 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./src/user-library"; |
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,17 @@ | ||
{ | ||
"name": "@echo/components-library", | ||
"private": true, | ||
"version": "1.0.0", | ||
"scripts": { | ||
"lint": "eslint . --ext ts --report-unused-disable-directives --max-warnings 0", | ||
"typecheck": "tsc --noEmit" | ||
}, | ||
"dependencies": { | ||
"@echo/components-shared-controllers": "^1.0.0", | ||
"@echo/core-types": "^1.0.0", | ||
"@echo/services-bootstrap-runtime": "^1.0.0", | ||
"effect": "^3.6.5", | ||
"lit": "^3.2.0", | ||
"@lit/task": "^1.0.1" | ||
} | ||
} |
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,44 @@ | ||
import { StreamEffectController } from "@echo/components-shared-controllers"; | ||
import { EffectFnController } from "@echo/components-shared-controllers/src/effect-fn.controller"; | ||
import { Library, Player } from "@echo/core-types"; | ||
import { LitElement, html } from "lit"; | ||
import { customElement } from "lit/decorators.js"; | ||
import { map } from "lit/directives/map.js"; | ||
|
||
/** | ||
* Component that displays the user's library of albums and allows them to | ||
* play them. | ||
*/ | ||
@customElement("user-library") | ||
export class UserLibrary extends LitElement { | ||
private _library = new StreamEffectController(this, Library.observeAlbums); | ||
private _playAlbum = new EffectFnController(this, Player.playAlbum); | ||
|
||
render() { | ||
return this._library.render({ | ||
initial: () => html`<h1>Loading...</h1>`, | ||
item: (albums) => html` | ||
<div> | ||
<br /> | ||
${map( | ||
albums, | ||
(album) => html` | ||
<div key="{album.id}"> | ||
<h3>${album.name}</h3> | ||
<p>${album.artist.name}</p> | ||
<button @click=${() => this._playAlbum.run(album)}>Play</button> | ||
<hr /> | ||
</div> | ||
`, | ||
)} | ||
</div> | ||
`, | ||
}); | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
userLibrary: UserLibrary; | ||
} | ||
} |
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 @@ | ||
/// <reference types="vite/client" /> |
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,7 @@ | ||
{ | ||
"include": [ | ||
"src", | ||
"index.ts" | ||
], | ||
"extends": "../../../tsconfig.json" | ||
} |
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
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
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
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,18 @@ | ||
import { LitElement, html } from "lit"; | ||
import { customElement } from "lit/decorators.js"; | ||
|
||
/** | ||
* Description of what the {{properCase name}} component does. | ||
*/ | ||
@customElement("{{dashCase name}}") | ||
export class {{pascalCase name}} extends LitElement { | ||
render() { | ||
return html`<h1>{{pascalCase name}}</h1>`; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"{{dashCase name}}": {{pascalCase name}}; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,18 +1 @@ | ||
import { LitElement, html } from "lit"; | ||
import { customElement } from "lit/decorators.js"; | ||
|
||
/** | ||
* Description of what the {{properCase name}} component does. | ||
*/ | ||
@customElement("{{dashCase name}}") | ||
export class {{pascalCase name}} extends LitElement { | ||
render() { | ||
return html`<h1>{{pascalCase name}}</h1>`; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"{{dashCase name}}": {{pascalCase name}}; | ||
} | ||
} | ||
export * from "./src/{{dashCase name}}"; |
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 @@ | ||
/// <reference types="vite/client" /> |