Merge pull request #47 from PolymerLabs/lit-next
Merge lit-next into master
This commit is contained in:
@@ -2,8 +2,12 @@ const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
|
|||||||
|
|
||||||
module.exports = function (eleventyConfig) {
|
module.exports = function (eleventyConfig) {
|
||||||
eleventyConfig.addPlugin(syntaxHighlight);
|
eleventyConfig.addPlugin(syntaxHighlight);
|
||||||
eleventyConfig.addPassthroughCopy("docs-src/docs.css");
|
eleventyConfig.addPassthroughCopy('docs-src/docs.css');
|
||||||
eleventyConfig.addPassthroughCopy("docs-src/.nojekyll");
|
eleventyConfig.addPassthroughCopy('docs-src/.nojekyll');
|
||||||
|
eleventyConfig.addPassthroughCopy(
|
||||||
|
'node_modules/@webcomponents/webcomponentsjs'
|
||||||
|
);
|
||||||
|
eleventyConfig.addPassthroughCopy('node_modules/lit/polyfill-support.js');
|
||||||
return {
|
return {
|
||||||
dir: {
|
dir: {
|
||||||
input: 'docs-src',
|
input: 'docs-src',
|
||||||
|
|||||||
5
.eslintignore
Normal file
5
.eslintignore
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
node_modules/*
|
||||||
|
docs/*
|
||||||
|
docs-src/*
|
||||||
|
rollup-config.js
|
||||||
|
custom-elements.json
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"root": true,
|
||||||
"extends": [
|
"extends": [
|
||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
"plugin:@typescript-eslint/eslint-recommended",
|
||||||
@@ -10,17 +11,41 @@
|
|||||||
"sourceType": "module"
|
"sourceType": "module"
|
||||||
},
|
},
|
||||||
"plugins": ["@typescript-eslint"],
|
"plugins": ["@typescript-eslint"],
|
||||||
|
"env": {
|
||||||
|
"browser": true
|
||||||
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-unexpected-multiline": "off",
|
"no-prototype-builtins": "off",
|
||||||
"@typescript-eslint/indent": "off",
|
"@typescript-eslint/ban-types": "off",
|
||||||
"@typescript-eslint/explicit-function-return-type": "off",
|
"@typescript-eslint/explicit-function-return-type": "off",
|
||||||
|
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||||
|
"@typescript-eslint/no-explicit-any": "error",
|
||||||
|
"@typescript-eslint/no-empty-function": "off",
|
||||||
"@typescript-eslint/no-non-null-assertion": "off",
|
"@typescript-eslint/no-non-null-assertion": "off",
|
||||||
"@typescript-eslint/no-use-before-define": "off",
|
|
||||||
"@typescript-eslint/no-unused-vars": [
|
"@typescript-eslint/no-unused-vars": [
|
||||||
"warn",
|
"warn",
|
||||||
{
|
{
|
||||||
"argsIgnorePattern": "^_"
|
"argsIgnorePattern": "^_"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["rollup.config.js", "web-test-runner.config.js"],
|
||||||
|
"env": {
|
||||||
|
"node": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"*_test.ts",
|
||||||
|
"**/custom_typings/*.ts",
|
||||||
|
"packages/lit-ssr/src/test/integration/tests/**",
|
||||||
|
"packages/lit-ssr/src/lib/util/parse5-utils.ts"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/no-explicit-any": "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,7 +1,7 @@
|
|||||||
/node_modules/
|
node_modules/
|
||||||
/lib/
|
/lib/
|
||||||
/test/
|
/test/
|
||||||
|
custom-elements.json
|
||||||
# top level source
|
# top level source
|
||||||
my-element.js
|
my-element.js
|
||||||
my-element.js.map
|
my-element.js.map
|
||||||
|
|||||||
8
.vscode/extensions.json
vendored
8
.vscode/extensions.json
vendored
@@ -3,11 +3,7 @@
|
|||||||
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
|
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
|
||||||
|
|
||||||
// List of extensions which should be recommended for users of this workspace.
|
// List of extensions which should be recommended for users of this workspace.
|
||||||
"recommendations": [
|
"recommendations": ["runem.lit-plugin"],
|
||||||
"runem.lit-plugin"
|
|
||||||
],
|
|
||||||
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
|
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
|
||||||
"unwantedRecommendations": [
|
"unwantedRecommendations": []
|
||||||
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
8
LICENSE
8
LICENSE
@@ -1,18 +1,18 @@
|
|||||||
BSD 3-Clause License
|
BSD 3-Clause License
|
||||||
|
|
||||||
Copyright (c) 2019, The Polymer Authors. All rights reserved.
|
Copyright (c) 2019 Google LLC. All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are met:
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
list of conditions and the following disclaimer.
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
this list of conditions and the following disclaimer in the documentation
|
this list of conditions and the following disclaimer in the documentation
|
||||||
and/or other materials provided with the distribution.
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
* Neither the name of the copyright holder nor the names of its
|
3. Neither the name of the copyright holder nor the names of its
|
||||||
contributors may be used to endorse or promote products derived from
|
contributors may be used to endorse or promote products derived from
|
||||||
this software without specific prior written permission.
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,11 @@ Both the TypeScript compiler and lit-analyzer are configured to be very strict.
|
|||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
This sample uses Karma, Chai, Mocha, and the open-wc test helpers for testing. See the [open-wc testing documentation](https://open-wc.org/testing/testing.html) for more information.
|
This sample modern-web.dev's
|
||||||
|
[@web/test-runner](https://www.npmjs.com/package/@web/test-runner) along with
|
||||||
|
Mocha, Chai, and some related helpers for testing. See the
|
||||||
|
[modern-web.dev testing documentation](https://modern-web.dev/docs/test-runner/overview) for
|
||||||
|
more information.
|
||||||
|
|
||||||
Tests can be run with the `test` script:
|
Tests can be run with the `test` script:
|
||||||
|
|
||||||
@@ -40,7 +44,7 @@ npm test
|
|||||||
|
|
||||||
## Dev Server
|
## Dev Server
|
||||||
|
|
||||||
This sample uses open-wc's [es-dev-server](https://github.com/open-wc/open-wc/tree/master/packages/es-dev-server) for previewing the project without additional build steps. ES dev server handles resolving Node-style "bare" import specifiers, which aren't supported in browsers. It also automatically transpiles JavaScript and adds polyfills to support older browsers.
|
This sample uses modern-web.dev's [@web/dev-server](https://www.npmjs.com/package/@web/dev-server) for previewing the project without additional build steps. Web Dev Server handles resolving Node-style "bare" import specifiers, which aren't supported in browsers. It also automatically transpiles JavaScript and adds polyfills to support older browsers. See [modern-web.dev's Web Dev Server documentation](https://modern-web.dev/docs/dev-server/overview/) for more information.
|
||||||
|
|
||||||
To run the dev server and open the project in a new browser tab:
|
To run the dev server and open the project in a new browser tab:
|
||||||
|
|
||||||
@@ -53,6 +57,7 @@ There is a development HTML file located at `/dev/index.html` that you can view
|
|||||||
## Editing
|
## Editing
|
||||||
|
|
||||||
If you use VS Code, we highly reccomend the [lit-plugin extension](https://marketplace.visualstudio.com/items?itemName=runem.lit-plugin), which enables some extremely useful features for lit-html templates:
|
If you use VS Code, we highly reccomend the [lit-plugin extension](https://marketplace.visualstudio.com/items?itemName=runem.lit-plugin), which enables some extremely useful features for lit-html templates:
|
||||||
|
|
||||||
- Syntax highlighting
|
- Syntax highlighting
|
||||||
- Type-checking
|
- Type-checking
|
||||||
- Code completion
|
- Code completion
|
||||||
|
|||||||
@@ -33,6 +33,24 @@
|
|||||||
"description": "The number of times the button has been clicked.",
|
"description": "The number of times the button has been clicked.",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"default": "0"
|
"default": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "renderRoot",
|
||||||
|
"description": "Node or ShadowRoot into which element DOM should be rendered. Defaults\nto an open shadowRoot.",
|
||||||
|
"type": "HTMLElement | ShadowRoot"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "isUpdatePending",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "hasUpdated",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "updateComplete",
|
||||||
|
"description": "Returns a Promise that resolves when the element has completed updating.\nThe Promise value is a boolean that is `true` if the element completed the\nupdate without triggering another update. The Promise result is `false` if\na property was set inside `updated()`. If the Promise is rejected, an\nexception was thrown during the update.\n\nTo await additional asynchronous work, override the `getUpdateComplete`\nmethod. For example, it is sometimes useful to await a rendered element\nbefore fulfilling this Promise. To do this, first await\n`super.getUpdateComplete()`, then any subsequent state.",
|
||||||
|
"type": "Promise<boolean>"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"slots": [
|
"slots": [
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
|
|
||||||
This directory contains HTML files containing your element for development. By running `npm run build:watch` and `npm run serve` you can edit and see changes without bundling.
|
This directory contains HTML files containing your element for development. By running `npm run build:watch` and `npm run serve` you can edit and see changes without bundling.
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8" />
|
||||||
<title><my-element> Demo</title>
|
<title><my-element> Demo</title>
|
||||||
|
<script src="../node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
|
||||||
|
<script src="../node_modules/lit/polyfill-support.js"></script>
|
||||||
<script type="module" src="../my-element.js"></script>
|
<script type="module" src="../my-element.js"></script>
|
||||||
<style>
|
<style>
|
||||||
p {
|
p {
|
||||||
|
|||||||
2
docs-src/.eleventyignore
Normal file
2
docs-src/.eleventyignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Ignore files with a leading underscore; useful for e.g. readmes in source documentation
|
||||||
|
_*.md
|
||||||
@@ -1,7 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2021 Google LLC
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
const customElements = JSON.parse(fs.readFileSync('custom-elements.json', 'utf-8'));
|
const customElements = JSON.parse(
|
||||||
|
fs.readFileSync('custom-elements.json', 'utf-8')
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
customElements,
|
customElements,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ const relative = require('./relative-path.cjs');
|
|||||||
* This template extends the page template and adds an examples list.
|
* This template extends the page template and adds an examples list.
|
||||||
*/
|
*/
|
||||||
module.exports = function (data) {
|
module.exports = function (data) {
|
||||||
|
|
||||||
return page({
|
return page({
|
||||||
...data,
|
...data,
|
||||||
content: renderExample(data),
|
content: renderExample(data),
|
||||||
@@ -18,13 +17,22 @@ const renderExample = ({name, content, collections, page}) => {
|
|||||||
<section class="examples">
|
<section class="examples">
|
||||||
<nav class="collection">
|
<nav class="collection">
|
||||||
<ul>
|
<ul>
|
||||||
${collections.example === undefined
|
${
|
||||||
|
collections.example === undefined
|
||||||
? ''
|
? ''
|
||||||
: collections.example.map((post) => `
|
: collections.example
|
||||||
|
.map(
|
||||||
|
(post) => `
|
||||||
<li class=${post.url === page.url ? 'selected' : ''}>
|
<li class=${post.url === page.url ? 'selected' : ''}>
|
||||||
<a href="${relative(page.url, post.url)}">${post.data.description.replace('<', '<')}</a>
|
<a href="${relative(
|
||||||
|
page.url,
|
||||||
|
post.url
|
||||||
|
)}">${post.data.description.replace('<', '<')}</a>
|
||||||
</li>
|
</li>
|
||||||
`).join('')}
|
`
|
||||||
|
)
|
||||||
|
.join('')
|
||||||
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ module.exports = function(data) {
|
|||||||
<footer>
|
<footer>
|
||||||
<p>
|
<p>
|
||||||
Made with
|
Made with
|
||||||
<a href="https://github.com/PolymerLabs/lit-element-starter-ts">lit-element-starter-ts</a>
|
<a href="https://github.com/PolymerLabs/lit-starter-ts">lit-starter-ts</a>
|
||||||
</p>
|
</p>
|
||||||
</footer>`;
|
</footer>`;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,7 +16,12 @@ module.exports = function(data) {
|
|||||||
<link rel="stylesheet" href="${relative(page.url, '/docs.css')}">
|
<link rel="stylesheet" href="${relative(page.url, '/docs.css')}">
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
|
||||||
<link href="${relative(page.url, '/prism-okaidia.css')}" rel="stylesheet" />
|
<link href="${relative(page.url, '/prism-okaidia.css')}" rel="stylesheet" />
|
||||||
<script type="module" src="${relative(page.url, '/my-element.bundled.js')}"></script>
|
<script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
|
||||||
|
<script src="/node_modules/lit/polyfill-support.js"></script>
|
||||||
|
<script type="module" src="${relative(
|
||||||
|
page.url,
|
||||||
|
'/my-element.bundled.js'
|
||||||
|
)}"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
${header()}
|
${header()}
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ module.exports = class Docs {
|
|||||||
const tags = customElements.tags;
|
const tags = customElements.tags;
|
||||||
return `
|
return `
|
||||||
<h1>API</h1>
|
<h1>API</h1>
|
||||||
${tags.map((tag) => `
|
${tags
|
||||||
|
.map(
|
||||||
|
(tag) => `
|
||||||
<h2><${tag.name}></h2>
|
<h2><${tag.name}></h2>
|
||||||
<div>
|
<div>
|
||||||
${tag.description}
|
${tag.description}
|
||||||
@@ -23,41 +25,40 @@ module.exports = class Docs {
|
|||||||
${renderTable(
|
${renderTable(
|
||||||
'Attributes',
|
'Attributes',
|
||||||
['name', 'description', 'type', 'default'],
|
['name', 'description', 'type', 'default'],
|
||||||
tag.attributes)}
|
tag.attributes
|
||||||
|
)}
|
||||||
${renderTable(
|
${renderTable(
|
||||||
'Properties',
|
'Properties',
|
||||||
['name', 'attribute', 'description', 'type', 'default'],
|
['name', 'attribute', 'description', 'type', 'default'],
|
||||||
tag.properties)}
|
tag.properties
|
||||||
${/*
|
)}
|
||||||
|
${
|
||||||
|
/*
|
||||||
* Methods are not output by web-component-analyzer yet (a bug), so
|
* Methods are not output by web-component-analyzer yet (a bug), so
|
||||||
* this is a placeholder so that at least _something_ will be output
|
* this is a placeholder so that at least _something_ will be output
|
||||||
* when that is fixed, and element maintainers will hopefully have a
|
* when that is fixed, and element maintainers will hopefully have a
|
||||||
* signal to update this file to add the neccessary columns.
|
* signal to update this file to add the neccessary columns.
|
||||||
*/
|
*/
|
||||||
renderTable(
|
renderTable('Methods', ['name', 'description'], tag.methods)
|
||||||
'Methods',
|
}
|
||||||
['name', 'description'],
|
${renderTable('Events', ['name', 'description'], tag.events)}
|
||||||
tag.methods)}
|
${renderTable('Slots', ['name', 'description'], tag.slots)}
|
||||||
${renderTable(
|
|
||||||
'Events',
|
|
||||||
['name', 'description'],
|
|
||||||
tag.events)}
|
|
||||||
${renderTable(
|
|
||||||
'Slots',
|
|
||||||
['name', 'description'],
|
|
||||||
tag.slots)}
|
|
||||||
${renderTable(
|
${renderTable(
|
||||||
'CSS Shadow Parts',
|
'CSS Shadow Parts',
|
||||||
['name', 'description'],
|
['name', 'description'],
|
||||||
tag.cssParts)}
|
tag.cssParts
|
||||||
|
)}
|
||||||
${renderTable(
|
${renderTable(
|
||||||
'CSS Custom Properties',
|
'CSS Custom Properties',
|
||||||
['name', 'description'],
|
['name', 'description'],
|
||||||
tag.cssProperties)}
|
tag.cssProperties
|
||||||
`).join('')}
|
)}
|
||||||
|
`
|
||||||
|
)
|
||||||
|
.join('')}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders a table of data, plucking the given properties from each item in
|
* Renders a table of data, plucking the given properties from each item in
|
||||||
@@ -65,7 +66,7 @@ module.exports = class Docs {
|
|||||||
*/
|
*/
|
||||||
const renderTable = (name, properties, data) => {
|
const renderTable = (name, properties, data) => {
|
||||||
if (data === undefined) {
|
if (data === undefined) {
|
||||||
return ''
|
return '';
|
||||||
}
|
}
|
||||||
return `
|
return `
|
||||||
<h3>${name}</h3>
|
<h3>${name}</h3>
|
||||||
@@ -73,13 +74,17 @@ const renderTable = (name, properties, data) => {
|
|||||||
<tr>
|
<tr>
|
||||||
${properties.map((p) => `<th>${capitalize(p)}</th>`).join('')}
|
${properties.map((p) => `<th>${capitalize(p)}</th>`).join('')}
|
||||||
</tr>
|
</tr>
|
||||||
${data.map((i) => `
|
${data
|
||||||
|
.map(
|
||||||
|
(i) => `
|
||||||
<tr>
|
<tr>
|
||||||
${properties.map((p) => `<td>${i[p]}</td>`).join('')}
|
${properties.map((p) => `<td>${i[p]}</td>`).join('')}
|
||||||
</tr>
|
</tr>
|
||||||
`).join('')}
|
|
||||||
</table>
|
|
||||||
`
|
`
|
||||||
|
)
|
||||||
|
.join('')}
|
||||||
|
</table>
|
||||||
|
`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const capitalize = (s) => s[0].toUpperCase() + s.substring(1);
|
const capitalize = (s) => s[0].toUpperCase() + s.substring(1);
|
||||||
|
|||||||
@@ -55,12 +55,15 @@ title: <my-element> ⌲ Home
|
|||||||
```js
|
```js
|
||||||
import {html, render} from 'lit-html';
|
import {html, render} from 'lit-html';
|
||||||
|
|
||||||
const name="lit-html";
|
const name = 'lit-html';
|
||||||
|
|
||||||
render(html`
|
render(
|
||||||
|
html`
|
||||||
<h2>This is a <my-element></h2>
|
<h2>This is a <my-element></h2>
|
||||||
<my-element .name=${name}></my-element>
|
<my-element .name=${name}></my-element>
|
||||||
`, document.body);
|
`,
|
||||||
|
document.body
|
||||||
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -20,11 +20,13 @@ npm CDNs like [unpkg.com]() can directly serve files that have been published to
|
|||||||
For this element to work from unpkg.com specifically, you need to include the `?module` query parameter, which tells unpkg.com to rewrite "bare" module specificers to full URLs.
|
For this element to work from unpkg.com specifically, you need to include the `?module` query parameter, which tells unpkg.com to rewrite "bare" module specificers to full URLs.
|
||||||
|
|
||||||
### HTML
|
### HTML
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script type="module" src="https://unpkg.com/my-element?module"></script>
|
<script type="module" src="https://unpkg.com/my-element?module"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
### JavaScript
|
### JavaScript
|
||||||
|
|
||||||
```html
|
```html
|
||||||
import {MyElement} from 'https://unpkg.com/my-element?module';
|
import {MyElement} from 'https://unpkg.com/my-element?module';
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
<p>This directory containts the sources for the static site contained in the /docs/ directory. The site is based on the <a href="11ty.dev">eleventy</a> static site generator.</p>
|
|
||||||
<p>The site is intended to be used with GitHub pages. To enable the site go to the GitHub settings and change the GitHub Pages "Source" setting to "master branch /docs folder".</p>
|
|
||||||
<p>To view the site locally, run <code>npm run docs:serve</code>.</p>
|
|
||||||
<p>To edit the site, add to or edit the files in this directory then run <code>npm run docs</code> to build the site. The built files must be checked in and pushed to GitHub to appear on GitHub pages.</p>
|
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
<link rel="stylesheet" href="../docs.css">
|
<link rel="stylesheet" href="../docs.css">
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
|
||||||
<link href="../prism-okaidia.css" rel="stylesheet" />
|
<link href="../prism-okaidia.css" rel="stylesheet" />
|
||||||
|
<script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
|
||||||
|
<script src="/node_modules/lit/polyfill-support.js"></script>
|
||||||
<script type="module" src="../my-element.bundled.js"></script>
|
<script type="module" src="../my-element.bundled.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -65,6 +67,32 @@
|
|||||||
<td>count</td><td>count</td><td>The number of times the button has been clicked.</td><td>number</td><td>0</td>
|
<td>count</td><td>count</td><td>The number of times the button has been clicked.</td><td>number</td><td>0</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>renderRoot</td><td>undefined</td><td>Node or ShadowRoot into which element DOM should be rendered. Defaults
|
||||||
|
to an open shadowRoot.</td><td>HTMLElement | ShadowRoot</td><td>undefined</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>isUpdatePending</td><td>undefined</td><td>undefined</td><td>boolean</td><td>undefined</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>hasUpdated</td><td>undefined</td><td>undefined</td><td>boolean</td><td>undefined</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>updateComplete</td><td>undefined</td><td>Returns a Promise that resolves when the element has completed updating.
|
||||||
|
The Promise value is a boolean that is `true` if the element completed the
|
||||||
|
update without triggering another update. The Promise result is `false` if
|
||||||
|
a property was set inside `updated()`. If the Promise is rejected, an
|
||||||
|
exception was thrown during the update.
|
||||||
|
|
||||||
|
To await additional asynchronous work, override the `getUpdateComplete`
|
||||||
|
method. For example, it is sometimes useful to await a rendered element
|
||||||
|
before fulfilling this Promise. To do this, first await
|
||||||
|
`super.getUpdateComplete()`, then any subsequent state.</td><td>Promise<boolean></td><td>undefined</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
@@ -104,7 +132,7 @@
|
|||||||
<footer>
|
<footer>
|
||||||
<p>
|
<p>
|
||||||
Made with
|
Made with
|
||||||
<a href="https://github.com/PolymerLabs/lit-element-starter-ts">lit-element-starter-ts</a>
|
<a href="https://github.com/PolymerLabs/lit-starter-ts">lit-starter-ts</a>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
<link rel="stylesheet" href="../docs.css">
|
<link rel="stylesheet" href="../docs.css">
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
|
||||||
<link href="../prism-okaidia.css" rel="stylesheet" />
|
<link href="../prism-okaidia.css" rel="stylesheet" />
|
||||||
|
<script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
|
||||||
|
<script src="/node_modules/lit/polyfill-support.js"></script>
|
||||||
<script type="module" src="../my-element.bundled.js"></script>
|
<script type="module" src="../my-element.bundled.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -32,14 +34,14 @@
|
|||||||
<nav class="collection">
|
<nav class="collection">
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<li class=selected>
|
|
||||||
<a href="">A basic example</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class=>
|
<li class=>
|
||||||
<a href="name-property/">Setting the name property</a>
|
<a href="name-property/">Setting the name property</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class=selected>
|
||||||
|
<a href="">A basic example</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<div>
|
<div>
|
||||||
@@ -66,7 +68,7 @@
|
|||||||
<footer>
|
<footer>
|
||||||
<p>
|
<p>
|
||||||
Made with
|
Made with
|
||||||
<a href="https://github.com/PolymerLabs/lit-element-starter-ts">lit-element-starter-ts</a>
|
<a href="https://github.com/PolymerLabs/lit-starter-ts">lit-starter-ts</a>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
<link rel="stylesheet" href="../../docs.css">
|
<link rel="stylesheet" href="../../docs.css">
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
|
||||||
<link href="../../prism-okaidia.css" rel="stylesheet" />
|
<link href="../../prism-okaidia.css" rel="stylesheet" />
|
||||||
|
<script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
|
||||||
|
<script src="/node_modules/lit/polyfill-support.js"></script>
|
||||||
<script type="module" src="../../my-element.bundled.js"></script>
|
<script type="module" src="../../my-element.bundled.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -32,20 +34,20 @@
|
|||||||
<nav class="collection">
|
<nav class="collection">
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<li class=>
|
|
||||||
<a href="../">A basic example</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class=selected>
|
<li class=selected>
|
||||||
<a href="">Setting the name property</a>
|
<a href="">Setting the name property</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class=>
|
||||||
|
<a href="../">A basic example</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<div>
|
<div>
|
||||||
<p><my-element name="Earth"></my-element></p>
|
<p><my-element name="Earth"></my-element></p>
|
||||||
<h3>HTML</h3>
|
<h3>HTML</h3>
|
||||||
<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>my-element</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Earth<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>my-element</span><span class="token punctuation">></span></span></code></pre>
|
<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>my-element</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>Earth<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>my-element</span><span class="token punctuation">></span></span></code></pre>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -56,7 +58,7 @@
|
|||||||
<footer>
|
<footer>
|
||||||
<p>
|
<p>
|
||||||
Made with
|
Made with
|
||||||
<a href="https://github.com/PolymerLabs/lit-element-starter-ts">lit-element-starter-ts</a>
|
<a href="https://github.com/PolymerLabs/lit-starter-ts">lit-starter-ts</a>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
<link rel="stylesheet" href="docs.css">
|
<link rel="stylesheet" href="docs.css">
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
|
||||||
<link href="prism-okaidia.css" rel="stylesheet" />
|
<link href="prism-okaidia.css" rel="stylesheet" />
|
||||||
|
<script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
|
||||||
|
<script src="/node_modules/lit/polyfill-support.js"></script>
|
||||||
<script type="module" src="my-element.bundled.js"></script>
|
<script type="module" src="my-element.bundled.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -42,7 +44,7 @@
|
|||||||
<section class="columns">
|
<section class="columns">
|
||||||
<div>
|
<div>
|
||||||
<p><code><my-element></code> can be configured with attributed in plain HTML.</p>
|
<p><code><my-element></code> can be configured with attributed in plain HTML.</p>
|
||||||
<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>my-element</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>HTML<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>my-element</span><span class="token punctuation">></span></span></code></pre>
|
<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>my-element</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>HTML<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>my-element</span><span class="token punctuation">></span></span></code></pre>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p><my-element name="HTML"></my-element></p>
|
<p><my-element name="HTML"></my-element></p>
|
||||||
@@ -52,7 +54,7 @@
|
|||||||
<section class="columns">
|
<section class="columns">
|
||||||
<div>
|
<div>
|
||||||
<p><code><my-element></code> can be used with declarative rendering libraries like Angular, React, Vue, and lit-html</p>
|
<p><code><my-element></code> can be used with declarative rendering libraries like Angular, React, Vue, and lit-html</p>
|
||||||
<pre class="language-js"><code class="language-js"><span class="token keyword">import</span> <span class="token punctuation">{</span>html<span class="token punctuation">,</span> render<span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'lit-html'</span><span class="token punctuation">;</span><br><br><span class="token keyword">const</span> name<span class="token operator">=</span><span class="token string">"lit-html"</span><span class="token punctuation">;</span><br><br><span class="token function">render</span><span class="token punctuation">(</span>html<span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string"><br> <h2>This is a &lt;my-element&gt;</h2><br> <my-element .name=</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>name<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">></my-element><br></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span> document<span class="token punctuation">.</span>body<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
|
<pre class="language-js"><code class="language-js"><span class="token keyword">import</span> <span class="token punctuation">{</span>html<span class="token punctuation">,</span> render<span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'lit-html'</span><span class="token punctuation">;</span><br><br><span class="token keyword">const</span> name <span class="token operator">=</span> <span class="token string">'lit-html'</span><span class="token punctuation">;</span><br><br><span class="token function">render</span><span class="token punctuation">(</span><br> html<span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string"><br> <h2>This is a &lt;my-element&gt;</h2><br> <my-element .name=</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>name<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">></my-element><br> </span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span><br> document<span class="token punctuation">.</span>body<br><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h2>This is a <my-element></h2>
|
<h2>This is a <my-element></h2>
|
||||||
@@ -66,7 +68,7 @@
|
|||||||
<footer>
|
<footer>
|
||||||
<p>
|
<p>
|
||||||
Made with
|
Made with
|
||||||
<a href="https://github.com/PolymerLabs/lit-element-starter-ts">lit-element-starter-ts</a>
|
<a href="https://github.com/PolymerLabs/lit-starter-ts">lit-starter-ts</a>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
<link rel="stylesheet" href="../docs.css">
|
<link rel="stylesheet" href="../docs.css">
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
|
||||||
<link href="../prism-okaidia.css" rel="stylesheet" />
|
<link href="../prism-okaidia.css" rel="stylesheet" />
|
||||||
|
<script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
|
||||||
|
<script src="/node_modules/lit/polyfill-support.js"></script>
|
||||||
<script type="module" src="../my-element.bundled.js"></script>
|
<script type="module" src="../my-element.bundled.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -34,7 +36,7 @@
|
|||||||
<p>npm CDNs like <a href="">unpkg.com</a> can directly serve files that have been published to npm. This works great for standard JavaScript modules that the browser can load natively.</p>
|
<p>npm CDNs like <a href="">unpkg.com</a> can directly serve files that have been published to npm. This works great for standard JavaScript modules that the browser can load natively.</p>
|
||||||
<p>For this element to work from unpkg.com specifically, you need to include the <code>?module</code> query parameter, which tells unpkg.com to rewrite "bare" module specificers to full URLs.</p>
|
<p>For this element to work from unpkg.com specifically, you need to include the <code>?module</code> query parameter, which tells unpkg.com to rewrite "bare" module specificers to full URLs.</p>
|
||||||
<h3>HTML</h3>
|
<h3>HTML</h3>
|
||||||
<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>module<span class="token punctuation">"</span></span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>https://unpkg.com/my-element?module<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token script"></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span></code></pre>
|
<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>module<span class="token punctuation">"</span></span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>https://unpkg.com/my-element?module<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token script"></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span></code></pre>
|
||||||
<h3>JavaScript</h3>
|
<h3>JavaScript</h3>
|
||||||
<pre class="language-html"><code class="language-html">import {MyElement} from 'https://unpkg.com/my-element?module';</code></pre>
|
<pre class="language-html"><code class="language-html">import {MyElement} from 'https://unpkg.com/my-element?module';</code></pre>
|
||||||
|
|
||||||
@@ -44,7 +46,7 @@
|
|||||||
<footer>
|
<footer>
|
||||||
<p>
|
<p>
|
||||||
Made with
|
Made with
|
||||||
<a href="https://github.com/PolymerLabs/lit-element-starter-ts">lit-element-starter-ts</a>
|
<a href="https://github.com/PolymerLabs/lit-starter-ts">lit-starter-ts</a>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -52,7 +52,7 @@ pre[class*="language-"] {
|
|||||||
.token.prolog,
|
.token.prolog,
|
||||||
.token.doctype,
|
.token.doctype,
|
||||||
.token.cdata {
|
.token.cdata {
|
||||||
color: slategray;
|
color: #8292a2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.token.punctuation {
|
.token.punctuation {
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
const {createDefaultConfig} = require('@open-wc/testing-karma');
|
|
||||||
const merge = require('deepmerge');
|
|
||||||
|
|
||||||
module.exports = (config) => {
|
|
||||||
config.set(
|
|
||||||
merge(createDefaultConfig(config), {
|
|
||||||
frameworks: ['mocha', 'chai'],
|
|
||||||
client: {
|
|
||||||
mocha: {ui: 'tdd'},
|
|
||||||
},
|
|
||||||
files: [
|
|
||||||
{
|
|
||||||
pattern: config.grep ? config.grep : 'test/**/*_test.js',
|
|
||||||
type: 'module',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
// See the karma-esm docs for all options
|
|
||||||
esm: {
|
|
||||||
nodeResolve: true,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
return config;
|
|
||||||
};
|
|
||||||
26347
package-lock.json
generated
26347
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
52
package.json
52
package.json
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lit-element-starter-ts",
|
"name": "@lit/lit-starter-ts",
|
||||||
|
"private": true,
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"description": "A simple web component",
|
"description": "A simple web component",
|
||||||
"main": "my-element.js",
|
"main": "my-element.js",
|
||||||
@@ -12,57 +13,58 @@
|
|||||||
"lint": "npm run lint:lit-analyzer && npm run lint:eslint",
|
"lint": "npm run lint:lit-analyzer && npm run lint:eslint",
|
||||||
"lint:eslint": "eslint 'src/**/*.ts'",
|
"lint:eslint": "eslint 'src/**/*.ts'",
|
||||||
"lint:lit-analyzer": "lit-analyzer",
|
"lint:lit-analyzer": "lit-analyzer",
|
||||||
"format": "prettier src/* --write",
|
"format": "prettier \"**/*.{cjs,html,js,json,md,ts}\" --ignore-path ./.eslintignore --write",
|
||||||
"docs": "npm run docs:clean && npm run build && npm run analyze && npm run docs:build && npm run docs:assets && npm run docs:gen",
|
"docs": "npm run docs:clean && npm run build && npm run analyze && npm run docs:build && npm run docs:assets && npm run docs:gen",
|
||||||
"docs:clean": "rimraf docs",
|
"docs:clean": "rimraf docs",
|
||||||
"docs:gen": "eleventy --config=.eleventy.cjs",
|
"docs:gen": "eleventy --config=.eleventy.cjs",
|
||||||
"docs:gen:watch": "eleventy --config=.eleventy.cjs --watch",
|
"docs:gen:watch": "eleventy --config=.eleventy.cjs --watch",
|
||||||
"docs:build": "rollup -c --file docs/my-element.bundled.js",
|
"docs:build": "rollup -c --file docs/my-element.bundled.js",
|
||||||
"docs:assets": "cp node_modules/prismjs/themes/prism-okaidia.css docs/",
|
"docs:assets": "cp node_modules/prismjs/themes/prism-okaidia.css docs/",
|
||||||
"docs:serve": "es-dev-server --root-dir=docs --node-resolve --watch",
|
"docs:serve": "wds --root-dir=docs --node-resolve --watch",
|
||||||
"analyze": "wca analyze \"src/**/*.ts\" --outFile custom-elements.json",
|
"analyze": "wca analyze \"src/**/*.ts\" --outFile custom-elements.json",
|
||||||
"serve": "es-dev-server --node-resolve --watch",
|
"serve": "wds --watch",
|
||||||
"test": "karma start karma.conf.cjs",
|
"test": "wtr",
|
||||||
"test:watch": "karma start karma.conf.cjs --auto-watch=true --single-run=false",
|
"test:watch": "npm run test -- --watch",
|
||||||
"test:update-snapshots": "karma start karma.conf.cjs --update-snapshots",
|
|
||||||
"test:prune-snapshots": "karma start karma.conf.cjs --prune-snapshots",
|
|
||||||
"checksize": "rollup -c ; cat my-element.bundled.js | gzip -9 | wc -c ; rm my-element.bundled.js"
|
"checksize": "rollup -c ; cat my-element.bundled.js | gzip -9 | wc -c ; rm my-element.bundled.js"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"web-components",
|
"web-components",
|
||||||
"lit-element",
|
"lit-element",
|
||||||
"typescript"
|
"typescript",
|
||||||
|
"lit"
|
||||||
],
|
],
|
||||||
"author": "The Polymer Authors",
|
"author": "Google LLC",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lit-element": "^2.3.1"
|
"lit": "^2.0.0-rc.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@11ty/eleventy": "^0.10.0",
|
"@11ty/eleventy": "^0.12.1",
|
||||||
"@11ty/eleventy-plugin-syntaxhighlight": "^3.0.1",
|
"@11ty/eleventy-plugin-syntaxhighlight": "^3.0.1",
|
||||||
"@open-wc/testing": "^2.5.10",
|
"@esm-bundle/chai": "^4.1.5",
|
||||||
"@open-wc/testing-karma": "^3.3.11",
|
"@open-wc/testing": "^2.5.32",
|
||||||
"@rollup/plugin-replace": "^2.3.1",
|
"@open-wc/testing-karma": "^4.0.9",
|
||||||
"@types/chai": "^4.2.11",
|
"@rollup/plugin-node-resolve": "^9.0.0",
|
||||||
|
"@rollup/plugin-replace": "^2.3.3",
|
||||||
"@types/mocha": "^7.0.2",
|
"@types/mocha": "^7.0.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^2.27.0",
|
"@typescript-eslint/eslint-plugin": "^2.27.0",
|
||||||
"@typescript-eslint/parser": "^2.27.0",
|
"@typescript-eslint/parser": "^2.27.0",
|
||||||
"chai": "^4.2.0",
|
"@web/dev-server": "0.0.29",
|
||||||
|
"@web/dev-server-legacy": "^0.1.4",
|
||||||
|
"@web/dev-server-rollup": "^0.2.7",
|
||||||
|
"@web/test-runner": "^0.12.15",
|
||||||
|
"@web/test-runner-mocha": "^0.3.5",
|
||||||
|
"@web/test-runner-playwright": "^0.8.4",
|
||||||
|
"@webcomponents/webcomponentsjs": "^2.5.0",
|
||||||
"deepmerge": "^4.2.2",
|
"deepmerge": "^4.2.2",
|
||||||
"es-dev-server": "^1.46.1",
|
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"karma": "^4.4.1",
|
|
||||||
"karma-chai": "^0.1.0",
|
|
||||||
"karma-mocha": "^1.3.0",
|
|
||||||
"lit-analyzer": "^1.1.10",
|
"lit-analyzer": "^1.1.10",
|
||||||
"mocha": "^7.1.1",
|
"mocha": "^7.1.1",
|
||||||
"prettier": "^2.0.4",
|
"prettier": "^2.0.4",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"rollup": "^1.32.1",
|
"rollup": "^2.28.2",
|
||||||
"rollup-plugin-filesize": "^7.0.0",
|
"rollup-plugin-summary": "^1.2.3",
|
||||||
"rollup-plugin-node-resolve": "^5.2.0",
|
"rollup-plugin-terser": "^7.0.2",
|
||||||
"rollup-plugin-terser": "^5.3.0",
|
|
||||||
"typescript": "^3.8.3",
|
"typescript": "^3.8.3",
|
||||||
"web-component-analyzer": "^1.0.3"
|
"web-component-analyzer": "^1.0.3"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
* Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
|
* Copyright 2018 Google LLC
|
||||||
* This code may only be used under the BSD style license found at
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* http://polymer.github.io/LICENSE.txt
|
|
||||||
* The complete set of authors may be found at
|
|
||||||
* http://polymer.github.io/AUTHORS.txt
|
|
||||||
* The complete set of contributors may be found at
|
|
||||||
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
||||||
* Code distributed by Google as part of the polymer project is also
|
|
||||||
* subject to an additional IP rights grant found at
|
|
||||||
* http://polymer.github.io/PATENTS.txt
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import filesize from 'rollup-plugin-filesize';
|
import summary from 'rollup-plugin-summary';
|
||||||
import {terser} from 'rollup-plugin-terser';
|
import {terser} from 'rollup-plugin-terser';
|
||||||
import resolve from 'rollup-plugin-node-resolve';
|
import resolve from '@rollup/plugin-node-resolve';
|
||||||
import replace from '@rollup/plugin-replace';
|
import replace from '@rollup/plugin-replace';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -32,6 +24,7 @@ export default {
|
|||||||
replace({'Reflect.decorate': 'undefined'}),
|
replace({'Reflect.decorate': 'undefined'}),
|
||||||
resolve(),
|
resolve(),
|
||||||
terser({
|
terser({
|
||||||
|
ecma: 2017,
|
||||||
module: true,
|
module: true,
|
||||||
warnings: true,
|
warnings: true,
|
||||||
mangle: {
|
mangle: {
|
||||||
@@ -40,8 +33,6 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
filesize({
|
summary(),
|
||||||
showBrotliSize: true,
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,18 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
* Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
|
* Copyright 2019 Google LLC
|
||||||
* This code may only be used under the BSD style license found at
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* http://polymer.github.io/LICENSE.txt
|
|
||||||
* The complete set of authors may be found at
|
|
||||||
* http://polymer.github.io/AUTHORS.txt
|
|
||||||
* The complete set of contributors may be found at
|
|
||||||
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
||||||
* Code distributed by Google as part of the polymer project is also
|
|
||||||
* subject to an additional IP rights grant found at
|
|
||||||
* http://polymer.github.io/PATENTS.txt
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {LitElement, html, customElement, property, css} from 'lit-element';
|
import {LitElement, html, css} from 'lit';
|
||||||
|
import {customElement, property} from 'lit/decorators.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An example element.
|
* An example element.
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2021 Google LLC
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
import {MyElement} from '../my-element.js';
|
import {MyElement} from '../my-element.js';
|
||||||
|
|
||||||
import {fixture, html} from '@open-wc/testing';
|
import {fixture, html} from '@open-wc/testing';
|
||||||
|
|
||||||
const assert = chai.assert;
|
const assert = chai.assert;
|
||||||
@@ -47,4 +54,10 @@ suite('my-element', () => {
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('styling applied', async () => {
|
||||||
|
const el = (await fixture(html`<my-element></my-element>`)) as MyElement;
|
||||||
|
await el.updateComplete;
|
||||||
|
assert.equal(getComputedStyle(el).paddingTop, '16px');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es2017",
|
"target": "es2019",
|
||||||
"module": "es2015",
|
"module": "es2020",
|
||||||
"lib": ["es2017", "dom", "dom.iterable"],
|
"lib": ["es2020", "DOM", "DOM.Iterable"],
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationMap": true,
|
"declarationMap": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
|
"inlineSources": true,
|
||||||
"outDir": "./",
|
"outDir": "./",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
@@ -13,6 +14,8 @@
|
|||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
|
|||||||
20
web-dev-server.config.js
Normal file
20
web-dev-server.config.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2021 Google LLC
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {legacyPlugin} from '@web/dev-server-legacy';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
nodeResolve: true,
|
||||||
|
preserveSymlinks: true,
|
||||||
|
plugins: [
|
||||||
|
legacyPlugin({
|
||||||
|
polyfills: {
|
||||||
|
// Manually imported in index.html file
|
||||||
|
webcomponents: false,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
};
|
||||||
119
web-test-runner.config.js
Normal file
119
web-test-runner.config.js
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2021 Google LLC
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {legacyPlugin} from '@web/dev-server-legacy';
|
||||||
|
import {playwrightLauncher} from '@web/test-runner-playwright';
|
||||||
|
|
||||||
|
// Uncomment for testing on Sauce Labs
|
||||||
|
// Must run `npm i --save-dev @web/test-runner-saucelabs` and set
|
||||||
|
// SAUCE_USERNAME and SAUCE_USERNAME environment variables
|
||||||
|
// ===========
|
||||||
|
// import {createSauceLabsLauncher} from '@web/test-runner-saucelabs';
|
||||||
|
// const sauceLabsLauncher = createSauceLabsLauncher(
|
||||||
|
// {
|
||||||
|
// user: process.env.SAUCE_USERNAME,
|
||||||
|
// key: process.env.SAUCE_USERNAME,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 'sauce:options': {
|
||||||
|
// name: 'unit tests',
|
||||||
|
// build: `${process.env.GITHUB_REF ?? 'local'} build ${
|
||||||
|
// process.env.GITHUB_RUN_NUMBER ?? ''
|
||||||
|
// }`,
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
|
// Uncomment for testing on BrowserStack
|
||||||
|
// Must run `npm i --save-dev @web/test-runner-browserstack` and set
|
||||||
|
// BROWSER_STACK_USERNAME and BROWSER_STACK_ACCESS_KEY environment variables
|
||||||
|
// ===========
|
||||||
|
// import {browserstackLauncher as createBrowserstackLauncher} from '@web/test-runner-browserstack';
|
||||||
|
// const browserstackLauncher = (config) => createBrowserstackLauncher({
|
||||||
|
// capabilities: {
|
||||||
|
// 'browserstack.user': process.env.BROWSER_STACK_USERNAME,
|
||||||
|
// 'browserstack.key': process.env.BROWSER_STACK_ACCESS_KEY,
|
||||||
|
// project: 'my-element',
|
||||||
|
// name: 'unit tests',
|
||||||
|
// build: `${process.env.GITHUB_REF ?? 'local'} build ${
|
||||||
|
// process.env.GITHUB_RUN_NUMBER ?? ''
|
||||||
|
// }`,
|
||||||
|
// ...config,
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
const browsers = {
|
||||||
|
// Local browser testing via playwright
|
||||||
|
// ===========
|
||||||
|
chromium: playwrightLauncher({product: 'chromium'}),
|
||||||
|
firefox: playwrightLauncher({product: 'firefox'}),
|
||||||
|
webkit: playwrightLauncher({product: 'webkit'}),
|
||||||
|
|
||||||
|
// Uncomment example launchers for running on Sauce Labs
|
||||||
|
// ===========
|
||||||
|
// chromium: sauceLabsLauncher({browserName: 'chrome', browserVersion: 'latest', platformName: 'Windows 10'}),
|
||||||
|
// firefox: sauceLabsLauncher({browserName: 'firefox', browserVersion: 'latest', platformName: 'Windows 10'}),
|
||||||
|
// edge: sauceLabsLauncher({browserName: 'MicrosoftEdge', browserVersion: 'latest', platformName: 'Windows 10'}),
|
||||||
|
// ie11: sauceLabsLauncher({browserName: 'internet explorer', browserVersion: '11.0', platformName: 'Windows 10'}),
|
||||||
|
// safari: sauceLabsLauncher({browserName: 'safari', browserVersion: 'latest', platformName: 'macOS 10.15'}),
|
||||||
|
|
||||||
|
// Uncomment example launchers for running on Sauce Labs
|
||||||
|
// ===========
|
||||||
|
// chromium: browserstackLauncher({browserName: 'Chrome', os: 'Windows', os_version: '10'}),
|
||||||
|
// firefox: browserstackLauncher({browserName: 'Firefox', os: 'Windows', os_version: '10'}),
|
||||||
|
// edge: browserstackLauncher({browserName: 'MicrosoftEdge', os: 'Windows', os_version: '10'}),
|
||||||
|
// ie11: browserstackLauncher({browserName: 'IE', browser_version: '11.0', os: 'Windows', os_version: '10'}),
|
||||||
|
// safari: browserstackLauncher({browserName: 'Safari', browser_version: '14.0', os: 'OS X', os_version: 'Big Sur'}),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Prepend BROWSERS=x,y to `npm run test` to run a subset of browsers
|
||||||
|
// e.g. `BROWSERS=chromium,firefox npm run test`
|
||||||
|
const noBrowser = (b) => {
|
||||||
|
throw new Error(`No browser configured named '${b}'; using defaults`);
|
||||||
|
};
|
||||||
|
let commandLineBrowsers;
|
||||||
|
try {
|
||||||
|
commandLineBrowsers = process.env.BROWSERS?.split(',').map(
|
||||||
|
(b) => browsers[b] ?? noBrowser(b)
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.warn(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://modern-web.dev/docs/test-runner/cli-and-configuration/
|
||||||
|
export default {
|
||||||
|
rootDir: '.',
|
||||||
|
files: ['./test/**/*_test.js'],
|
||||||
|
nodeResolve: true,
|
||||||
|
preserveSymlinks: true,
|
||||||
|
browsers: commandLineBrowsers ?? Object.values(browsers),
|
||||||
|
testFramework: {
|
||||||
|
// https://mochajs.org/api/mocha
|
||||||
|
config: {
|
||||||
|
ui: 'tdd',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
// Detect browsers without modules (e.g. IE11) and transform to SystemJS
|
||||||
|
// (https://modern-web.dev/docs/dev-server/plugins/legacy/).
|
||||||
|
legacyPlugin({
|
||||||
|
polyfills: {
|
||||||
|
webcomponents: true,
|
||||||
|
// Inject lit's polyfill-support module into test files, which is required
|
||||||
|
// for interfacing with the webcomponents polyfills
|
||||||
|
custom: [
|
||||||
|
{
|
||||||
|
name: 'lit-polyfill-support',
|
||||||
|
path: 'node_modules/lit/polyfill-support.js',
|
||||||
|
test:
|
||||||
|
"!('attachShadow' in Element.prototype) || !('getRootNode' in Element.prototype) || window.ShadyDOM && window.ShadyDOM.force",
|
||||||
|
module: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user