Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions docs/_data/try.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@ toc:
create:
title: 1. Create
url: /try/create
import:
title: 2. Import
url: /try/import
properties:
title: 3. Properties
title: 2. Properties
url: /try/properties
logic:
title: 4. Logic
title: 3. Logic
url: /try/logic
events:
title: 5. Events
title: 4. Events
url: /try/events
style:
title: 6. Style
title: 5. Style
url: /try/style

9 changes: 3 additions & 6 deletions docs/_includes/projects/try/create/after/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="/node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script>
<script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script>
<title>lit-element code sample</title>
<title>LitElement Example</title>
</head>
<body>
<my-element></my-element>
Expand Down
4 changes: 2 additions & 2 deletions docs/_includes/projects/try/create/after/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"index.html",
"index.ts"
],
"title": "lit-element code sample",
"description": "lit-element code sample",
"title": "LitElement Example",
"description": "LitElement Example",
"template": "typescript",
"dependencies": {
"lit-element": "latest",
Expand Down
15 changes: 0 additions & 15 deletions docs/_includes/projects/try/create/after/my-element.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
/**
* Try LitElement https://lit-element.polymer-project.org/try
* Completed code for 1. Create
*/

/**
* DONE: Import the LitElement base class and html helper function.
*/
import { LitElement, html } from 'lit-element';

/**
* DONE: Create a class for your element that extends the LitElement
* base class.
*/
class MyElement extends LitElement {
render() {
return html`
Expand All @@ -20,7 +8,4 @@ class MyElement extends LitElement {
}
}

/**
* DONE: Register the new element with the browser.
*/
customElements.define('my-element', MyElement);
10 changes: 4 additions & 6 deletions docs/_includes/projects/try/create/before/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="/node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script>
<script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script>
<title>lit-element code sample</title>
<title>LitElement Example</title>
</head>
<body>
<p>TODO: Implement <code>my-element</code>!</p>
<my-element></my-element>
</body>
</html>
4 changes: 2 additions & 2 deletions docs/_includes/projects/try/create/before/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"index.html",
"index.ts"
],
"title": "lit-element code sample",
"description": "lit-element code sample",
"title": "LitElement Example",
"description": "LitElement Example",
"template": "typescript",
"dependencies": {
"lit-element": "latest",
Expand Down
5 changes: 0 additions & 5 deletions docs/_includes/projects/try/create/before/my-element.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* Try LitElement https://lit-element.polymer-project.org/try
* Starting code for 1. Create
*/

/**
* TODO: Import the LitElement base class and html helper function.
*/
Expand Down
12 changes: 3 additions & 9 deletions docs/_includes/projects/try/events/after/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="/node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script>
<script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script>
<title>lit-element code sample</title>

<title>LitElement Example</title>
</head>

<body>
<my-element></my-element>
</body>

</html>
8 changes: 4 additions & 4 deletions docs/_includes/projects/try/events/after/manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"title": "lit-element code sample",
"description": "lit-element code sample",
"files": [
"my-element.js",
"index.html",
"index.ts"
],
"title": "LitElement Example",
"description": "LitElement Example",
"template": "typescript",
"dependencies": {
"lit-element": "latest",
"@webcomponents/webcomponentsjs": "latest"
},
"template": "typescript"
}
}
24 changes: 5 additions & 19 deletions docs/_includes/projects/try/events/after/my-element.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* Try LitElement https://lit-element.polymer-project.org/try
* Completed code for 5. Events
*/

import { LitElement, html } from 'lit-element';

class MyElement extends LitElement {
Expand All @@ -15,29 +10,20 @@ class MyElement extends LitElement {
}
constructor() {
super();
this.message='Hello world! From my-element';
this.message = 'Hello world! From my-element';
this.myArray = ['an','array','of','test','data'];
this.myBool = true;
}

render() {
return html`
<p>${this.message}</p>
<ul>
${this.myArray.map(item => html`<li>${item}</li>`)}
</ul>
${this.myBool?
html`<p>Render some HTML if myBool is true</p>`:
<ul>${this.myArray.map(item => html`<li>${item}</li>`)}</ul>
${this.myBool ?
html`<p>Render some HTML if myBool is true</p>` :
html`<p>Render some other HTML if myBool is false</p>`}

<!-- DONE: Add an event listener. -->
<button @click="${this.clickHandler}">Click</button>
<button @click=${this.clickHandler}>Click</button>
`;
}

/**
* DONE: Implement an event handler.
*/
clickHandler(event) {
console.log(event.target);
this.myBool = !this.myBool;
Expand Down
12 changes: 3 additions & 9 deletions docs/_includes/projects/try/events/before/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="/node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script>
<script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script>
<title>lit-element code sample</title>

<title>LitElement Example</title>
</head>

<body>
<my-element></my-element>
</body>

</html>
8 changes: 4 additions & 4 deletions docs/_includes/projects/try/events/before/manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"title": "lit-element code sample",
"description": "lit-element code sample",
"files": [
"my-element.js",
"index.html",
"index.ts"
],
"title": "LitElement Example",
"description": "LitElement Example",
"template": "typescript",
"dependencies": {
"lit-element": "latest",
"@webcomponents/webcomponentsjs": "latest"
},
"template": "typescript"
}
}
25 changes: 6 additions & 19 deletions docs/_includes/projects/try/events/before/my-element.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* Try LitElement https://lit-element.polymer-project.org/try
* Starting code for 5. Events
*/

import { LitElement, html } from 'lit-element';

class MyElement extends LitElement {
Expand All @@ -15,28 +10,20 @@ class MyElement extends LitElement {
}
constructor() {
super();
this.message='Hello world! From my-element';
this.message = 'Hello world! From my-element';
this.myArray = ['an','array','of','test','data'];
this.myBool = true;
}

render() {
return html`
<p>${this.message}</p>
<ul>
${this.myArray.map(item => html`<li>${item}</li>`)}
</ul>
${this.myBool?
html`<p>Render some HTML if myBool is true</p>`:
<ul>${this.myArray.map(item => html`<li>${item}</li>`)}</ul>
${this.myBool ?
html`<p>Render some HTML if myBool is true</p>` :
html`<p>Render some other HTML if myBool is false</p>`}

<!-- TODO: Add an event listener. -->
<button>Click</button>
<!-- TODO: Add a button with an event listener -->
`;
}

/**
* TODO: Implement an event handler.
*/
// TODO: Add an event handler
}
customElements.define('my-element', MyElement);
18 changes: 0 additions & 18 deletions docs/_includes/projects/try/import/after/index.html

This file was deleted.

2 changes: 0 additions & 2 deletions docs/_includes/projects/try/import/after/index.ts

This file was deleted.

14 changes: 0 additions & 14 deletions docs/_includes/projects/try/import/after/manifest.json

This file was deleted.

10 changes: 0 additions & 10 deletions docs/_includes/projects/try/import/after/my-element.js

This file was deleted.

17 changes: 0 additions & 17 deletions docs/_includes/projects/try/import/before/index.html

This file was deleted.

2 changes: 0 additions & 2 deletions docs/_includes/projects/try/import/before/index.ts

This file was deleted.

14 changes: 0 additions & 14 deletions docs/_includes/projects/try/import/before/manifest.json

This file was deleted.

10 changes: 0 additions & 10 deletions docs/_includes/projects/try/import/before/my-element.js

This file was deleted.

Loading