-
Notifications
You must be signed in to change notification settings - Fork 320
add docs #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
add docs #263
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
e205f51
add docs
296ed71
add includes
f5c4219
fix config
077d593
moar docs
b08d4f3
forgot includes
d1129c2
forgot build stuff for github pages
97f5594
trying to fix 404
99c0e22
working through feedback chgs
b3f5511
spacing
ca1f949
Run the formatting script from @43081j
936ce4d
build
504383a
Revert "build"
3f65c47
Revert "Run the formatting script from @43081j"
434f4fd
roll back stuff and remove _site from repo
96ee542
feedback and content
584dfbf
Bundle scripts; consolidate annotations example
keanulee 83f7c84
Output _includes as a collection
keanulee af281ed
Remove duplicate projects/
keanulee 5678cb3
Refactor StackBlitz embed
keanulee 58d6079
Update docs/_includes/prevnext.html
keanulee 4621ed2
stack-blitz loading state
keanulee e26e45b
Port layout/styles from other docs
keanulee 202bb16
Remove custom font
keanulee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,10 @@ | ||
| name: LitElement docs | ||
| description: A lightweight library for creating custom elements | ||
| exclude: [package.json, polymer.json, src, node_modules, package-lock.json] | ||
| markdown: kramdown | ||
| kramdown: | ||
| parse_block_html: true | ||
| projects: includes/projects | ||
| collections: | ||
| includes: | ||
| output: true |
This file contains hidden or 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,109 @@ | ||
| title: LitElement Documentation | ||
| toc: | ||
| try: | ||
| title: Try LitElement | ||
| url: /try/ | ||
| toc: | ||
| create: | ||
| title: Create your first custom element | ||
| url: /try/create | ||
| use: | ||
| title: Use your element in a web page | ||
| url: /try/use | ||
| properties: | ||
| title: Declare and use properties | ||
| url: /try/properties | ||
| expressions: | ||
| title: Add a loop and an “if” statement | ||
| url: /try/expressions | ||
| events: | ||
| title: Add an event handler | ||
| url: /try/events | ||
| style: | ||
| title: Style your element template | ||
| url: /try/style | ||
| docs: | ||
| title: API Documentation | ||
| url: /docs/ | ||
| toc: | ||
| create: | ||
| title: Create an element | ||
| url: /docs/create | ||
| toc: | ||
| index: | ||
| title: Overview | ||
| url: /docs/create/index | ||
| extend: | ||
| title: Extend the LitElement base class | ||
| url: /docs/create/extend | ||
| typescript: | ||
| title: Use TypeScript decorators to create a custom element | ||
| url: /docs/create/typescript | ||
| renderroot: | ||
| title: Customize an element's render root | ||
| url: /docs/create/renderroot | ||
| design: | ||
| title: Designing an element | ||
| url: /docs/create/design | ||
| import: | ||
| title: Import an existing element | ||
| url: /docs/import | ||
| templates: | ||
| title: Write a template | ||
| url: /docs/templates/ | ||
| toc: | ||
| index: | ||
| title: Write a template | ||
| url: /docs/templates/index | ||
| expressions: | ||
| title: Use plain JavaScript expressions in a template | ||
| url: /docs/templates/expressions | ||
| annotations: | ||
| title: Bind data to a child element in a template | ||
| url: /docs/templates/annotations | ||
| compose: | ||
| title: Compose and nest lit-element templates | ||
| url: /docs/templates/compose | ||
| slots: | ||
| title: Render light DOM children in a template | ||
| url: /docs/templates/slots | ||
| design: | ||
| title: Designing efficient LitElement templates | ||
| url: /docs/templates/design | ||
| properties: | ||
| title: Work with properties | ||
| url: /docs/properties | ||
| lifecycle: | ||
| title: Work with the element lifecycle | ||
| url: /docs/lifecycle/ | ||
| toc: | ||
| index: | ||
| title: The LitElement update lifecycle | ||
| url: /docs/lifecycle/index | ||
| tasks: | ||
| title: Perform tasks during the element update lifecycle | ||
| url: /docs/lifecycle/tasks | ||
| examples: | ||
| title: Example use cases | ||
| url: /docs/lifecycle/examples | ||
| methods: | ||
| title: Update lifecycle methods and Promises | ||
| url: /docs/lifecycle/methods | ||
| events: | ||
| title: Work with events | ||
| url: /docs/events | ||
| reuse: | ||
| title: Create reusable features | ||
| url: /docs/reuse | ||
| style: | ||
| title: Style elements with CSS | ||
| url: /docs/style | ||
| api: | ||
| title: API reference | ||
| url: /docs/api | ||
| tools: | ||
| title: Tools | ||
| url: /tools/ | ||
| about: | ||
| title: About LitElement | ||
| url: /about |
This file contains hidden or 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 @@ | ||
| <script async src="https://www.googletagmanager.com/gtag/js?id={{site.google_analytics}}"></script> | ||
| <script> | ||
| window.dataLayer = window.dataLayer || []; | ||
| function gtag(){dataLayer.push(arguments);} | ||
| gtag('js', new Date()); | ||
| gtag('config', '{{site.google_analytics}}'); | ||
| </script> |
This file contains hidden or 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,21 @@ | ||
|
|
||
| <div><a href="{{site.baseurl}}{{section.url}}">{{section.title}}</a></div> | ||
|
|
||
| <h1><a href="{{site.baseurl}}{{topic.url}}">{{topic.title}}</a></h1> | ||
|
|
||
| {%- if topic.toc -%} | ||
| <ul> | ||
| {%- for item in topic.toc -%} | ||
| {%- if item[1].url == self.url -%} | ||
| <li class="current"><a href="{{site.baseurl}}{{item[1].url}}">{{item[1].title}}</a></li> | ||
| {%- else -%} | ||
| <li><a href="{{site.baseurl}}{{item[1].url}}">{{item[1].title}}</a></li> | ||
| {%- endif -%} | ||
| {%- endfor -%} | ||
| </ul> | ||
| <hr /> | ||
| <h2><a href="{{site.baseurl}}{{subtopic.url}}">{{subtopic.title}}</a></h2> | ||
|
|
||
| {%- endif -%} | ||
|
|
||
| {{ content }} |
This file contains hidden or 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,13 @@ | ||
| {%- comment -%} Note: No HTML indentation to prevent markdown processing. {%- endcomment -%} | ||
| <div class="prevnext"> | ||
| <div class="next"> | ||
| {% if include.nexturl %} | ||
| <a href="{{include.nexturl}}">Next: {{include.nexttitle}} >></a> | ||
| {% endif %} | ||
| </div> | ||
| <div class="prev"> | ||
| {% if include.prevurl %} | ||
| <a href="{{include.prevurl}}"><< Previous: {{include.prevtitle}}</a> | ||
| {% endif %} | ||
| </div> | ||
| </div> |
This file contains hidden or 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,4 @@ | ||
| <stack-blitz | ||
| folder="{{ site.baseurl }}/{{ site.projects }}/{{ include.folder | default: template }}" | ||
| openFile="{{ include.openFile | default: custom-element.js }}"> | ||
| </stack-blitz> |
44 changes: 44 additions & 0 deletions
44
docs/_includes/projects/docs/annotations/custom-element.js
This file contains hidden or 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 { LitElement, html } from '@polymer/lit-element'; | ||
|
|
||
| class CustomElement extends LitElement { | ||
| static get properties(){ | ||
| return { | ||
| prop1: String, | ||
| prop2: String, | ||
| prop3: Boolean, | ||
| prop4: String | ||
| }; | ||
| } | ||
| constructor(){ | ||
| super(); | ||
| this.prop1='text'; | ||
| this.prop2='attr'; | ||
| this.prop3=true; | ||
| this.prop4='fries'; | ||
| } | ||
| render(){ | ||
| return html` | ||
| <div>Bind to a child element's text node. ${this.prop1}</div> | ||
|
|
||
| <div id="${this.prop2}">Bind to a child element's attribute.</div> | ||
|
|
||
| <p>Bind to a child element's boolean attribute. | ||
| <input type="checkbox" checked="${this.prop3}"/> | ||
| </p> | ||
|
|
||
| <p>Bind to a child element's property. | ||
| <input type="checkbox" .value="${this.prop4}"/> | ||
| </p> | ||
|
|
||
| <p><button id="pie" @click="${(e) => this.handlePls(e)}"> | ||
| Bind to a child element's event handler. | ||
| </button></p> | ||
| `; | ||
| } | ||
| handlePls(e){ | ||
| var id = e.target.id; | ||
| console.log(id + '.'); | ||
| } | ||
| } | ||
|
|
||
| customElements.define('custom-element', CustomElement); | ||
This file contains hidden or 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,19 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <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-loader.js"></script> | ||
|
|
||
| <title>lit-element code sample</title> | ||
|
|
||
| <script type="module" src="./custom-element.js"></script> | ||
| </head> | ||
|
|
||
| <body> | ||
| <custom-element></custom-element> | ||
| </body> | ||
|
|
||
| </html> |
This file contains hidden or 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 @@ | ||
| import './custom-element.js'; |
This file contains hidden or 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,14 @@ | ||
| { | ||
| "title": "lit-element code sample", | ||
| "description": "lit-element code sample", | ||
| "files": [ | ||
| "custom-element.js", | ||
| "index.html", | ||
| "index.ts" | ||
| ], | ||
| "dependencies": { | ||
| "@polymer/lit-element": "latest", | ||
| "@webcomponents/webcomponentsjs": "latest" | ||
| }, | ||
| "template": "typescript" | ||
| } |
This file contains hidden or 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 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <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> | ||
|
|
||
| </head> | ||
|
|
||
| <body> | ||
| <my-app></my-app> | ||
| </body> | ||
|
|
||
| </html> |
This file contains hidden or 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 @@ | ||
| import './my-app.js'; |
This file contains hidden or 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,14 @@ | ||
| { | ||
| "title": "lit-element code sample", | ||
| "description": "lit-element code sample", | ||
| "files": [ | ||
| "my-app.js", | ||
| "index.html", | ||
| "index.ts" | ||
| ], | ||
| "dependencies": { | ||
| "@polymer/lit-element": "latest", | ||
| "@webcomponents/webcomponentsjs": "latest" | ||
| }, | ||
| "template": "typescript" | ||
| } |
This file contains hidden or 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,51 @@ | ||
| import { LitElement, html } from '@polymer/lit-element'; | ||
|
|
||
| class MyApp extends LitElement { | ||
| static get properties(){ | ||
| return { | ||
| headerText: { type: String }, | ||
| menu: { type: Array }, | ||
| footerText: { type: String } | ||
| }; | ||
| } | ||
| constructor(){ | ||
| super(); | ||
| this.headerText="My App"; | ||
| this.menu = [ | ||
| { 'url': '/design', title: 'Design'}, | ||
| { 'url': '/how', title: 'How-tos'}, | ||
| { 'url': '/about', title: 'About'} | ||
| ]; | ||
| this.footerText="Copyright (c) Me, 2018"; | ||
| this.myBool = true; | ||
| } | ||
|
|
||
| static get headerTemplate(){ | ||
| return html` | ||
| <header>${this.headerText}</header> | ||
| `; | ||
| } | ||
| static get navTemplate(){ | ||
| return html` | ||
| <nav> | ||
| ${this.menu.map(i => { return html` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can avoid the inner curly and the return inside the map if you want. static get navTemplate() {
return html `
<nav>
${this.menu.map(i => html`
<li><a href="${i.url}">${i.title}</a></li>
`)}
</nav>
`;
} |
||
| <li><a href="${i.url}">${i.title}</a></li> | ||
| `;})} | ||
| </nav> | ||
| `; | ||
| } | ||
| static get footerTemplate(){ | ||
| return html` | ||
| <footer>${this.footerText}</footer> | ||
| `; | ||
| } | ||
|
|
||
| render(){ | ||
| return html` | ||
| ${this.headerTemplate()} | ||
| ${this.navTemplate()} | ||
| ${this.footerTemplate()} | ||
| `; | ||
| } | ||
| } | ||
| customElements.define('my-app', MyApp); | ||
This file contains hidden or 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,16 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <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> | ||
|
|
||
| <script type="module" src="./my-element.js"></script> | ||
| <title>lit-element code sample</title> | ||
| </head> | ||
| <body> | ||
| <my-element></my-element> | ||
| </body> | ||
| </html> |
This file contains hidden or 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 @@ | ||
| import './my-element.js'; |
This file contains hidden or 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,14 @@ | ||
| { | ||
| "files": [ | ||
| "my-element.js", | ||
| "index.html", | ||
| "index.ts" | ||
| ], | ||
| "title": "lit-element code sample", | ||
| "description": "lit-element code sample", | ||
| "template": "typescript", | ||
| "dependencies": { | ||
| "@polymer/lit-element": "latest", | ||
| "@webcomponents/webcomponentsjs": "latest" | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is more conventional for the opening curly brace is separated from the parentheses by a space: