-
Notifications
You must be signed in to change notification settings - Fork 32
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
0 parents
commit 3741707
Showing
99 changed files
with
12,393 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight'); | ||
|
||
module.exports = function (eleventyConfig) { | ||
eleventyConfig.addPlugin(syntaxHighlight); | ||
eleventyConfig.addPassthroughCopy('docs-src/docs.css'); | ||
eleventyConfig.addPassthroughCopy('docs-src/.nojekyll'); | ||
eleventyConfig.addPassthroughCopy( | ||
'node_modules/@webcomponents/webcomponentsjs' | ||
); | ||
eleventyConfig.addPassthroughCopy('node_modules/lit/polyfill-support.js'); | ||
return { | ||
dir: { | ||
input: 'docs-src', | ||
output: 'docs', | ||
}, | ||
templateExtensionAliases: { | ||
'11ty.cjs': '11ty.js', | ||
'11tydata.cjs': '11tydata.js', | ||
}, | ||
}; | ||
}; |
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,6 @@ | ||
node_modules/* | ||
docs/* | ||
docs-src/* | ||
rollup-config.js | ||
custom-elements.json | ||
web-dev-server.config.js |
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,51 @@ | ||
{ | ||
"root": true, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 2020, | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"env": { | ||
"browser": true | ||
}, | ||
"rules": { | ||
"no-prototype-builtins": "off", | ||
"@typescript-eslint/ban-types": "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-unused-vars": [ | ||
"warn", | ||
{ | ||
"argsIgnorePattern": "^_" | ||
} | ||
] | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["rollup.config.js", "web-test-runner.config.js"], | ||
"env": { | ||
"node": true | ||
} | ||
}, | ||
{ | ||
"files": [ | ||
"*_test.ts", | ||
"**/custom_typings/*.ts", | ||
"packages/labs/ssr/src/test/integration/tests/**", | ||
"packages/labs/ssr/src/lib/util/parse5-utils.ts" | ||
], | ||
"rules": { | ||
"@typescript-eslint/no-explicit-any": "off" | ||
} | ||
} | ||
] | ||
} |
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,26 @@ | ||
/node_modules/ | ||
/lib/ | ||
/test/ | ||
custom-elements.json | ||
# top level source | ||
my-element.js | ||
my-element.js.map | ||
my-element.d.ts | ||
my-element.d.ts.map | ||
# only generated for size check | ||
my-element.bundled.js | ||
|
||
lwc-button.js | ||
lwc-button.js.map | ||
lwc-button.d.ts | ||
lwc-button.d.ts.map | ||
# only generated for size check | ||
lwc-button.bundled.js | ||
|
||
|
||
lwc-modal.js | ||
lwc-modal.js.map | ||
lwc-modal.d.ts | ||
lwc-modal.d.ts.map | ||
# only generated for size check | ||
lwc-modal.bundled.js |
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 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"singleQuote": true, | ||
"bracketSpacing": false, | ||
"arrowParens": "always" | ||
} |
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,9 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. | ||
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp | ||
|
||
// List of extensions which should be recommended for users of this workspace. | ||
"recommendations": ["runem.lit-plugin"], | ||
// List of extensions recommended by VS Code that should not be recommended for users of this workspace. | ||
"unwantedRecommendations": [] | ||
} |
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,47 @@ | ||
# @lit/lit-starter-ts | ||
|
||
## 1.0.5 | ||
|
||
### Patch Changes | ||
|
||
- [#3561](https://github.com/lit/lit/pull/3561) [`e5c254e9`](https://github.com/lit/lit/commit/e5c254e96cb5d0f770ec616332e231559325c5c5) - Update dependency `@rollup/plugin-replace` | ||
|
||
## 1.0.4 | ||
|
||
### Patch Changes | ||
|
||
- [#2922](https://github.com/lit/lit/pull/2922) [`da9db86a`](https://github.com/lit/lit/commit/da9db86a33cba710d439e254df2492f9f6dcbbee) - Update dependencies and remove unused dependencies | ||
|
||
## 1.0.3 | ||
|
||
### Patch Changes | ||
|
||
- [#2757](https://github.com/lit/lit/pull/2757) [`55841c14`](https://github.com/lit/lit/commit/55841c14f52891357dd93680d3bc5b1da6c89c8a) - Update Rollup and Rollup plugins | ||
|
||
## 1.0.2 | ||
|
||
### Patch Changes | ||
|
||
- [#2535](https://github.com/lit/lit/pull/2535) [`d1359856`](https://github.com/lit/lit/commit/d1359856698d1af381b335fb757f9282574690b0) - Update the README to indicate that issues and PRs should be filed on the main Lit repo. | ||
|
||
## 1.0.1 | ||
|
||
### Patch Changes | ||
|
||
- [#2300](https://github.com/lit/lit/pull/2300) [`8b9dcb4d`](https://github.com/lit/lit/commit/8b9dcb4d10e4161083146ae40d0b12174a63d31d) - Fix starter kits so `npm run serve` serves the root directory, and add a link to the `/dev/index.html` component example from `/`. | ||
|
||
- Updated dependencies [[`fcc2b3d0`](https://github.com/lit/lit/commit/fcc2b3d0054e69e6f76588ea9f440117b6d0deed), [`49ecf623`](https://github.com/lit/lit/commit/49ecf6239033e9578184d46116e6b89676d091db), [`1d563e83`](https://github.com/lit/lit/commit/1d563e830c02a2d1a22e1e939f1ace971b1d1ae7)]: | ||
- [email protected] | ||
|
||
## 1.0.0 | ||
|
||
### Patch Changes | ||
|
||
- [#2113](https://github.com/lit/lit/pull/2113) [`5b2f3642`](https://github.com/lit/lit/commit/5b2f3642ff91931b5b01f8bdd2ed98aba24f1047) - Dependency upgrades including TypeScript 4.4.2 | ||
|
||
- [#2103](https://github.com/lit/lit/pull/2103) [`15a8356d`](https://github.com/lit/lit/commit/15a8356ddd59a1e80880a93acd21fadc9c24e14b) - Added Lit dev mode to test and serve commands, controlled via the MODE=dev or MODE=prod environment variables. | ||
|
||
- [#2117](https://github.com/lit/lit/pull/2117) [`eff2fbc7`](https://github.com/lit/lit/commit/eff2fbc7e45cfc2a7b8df21e18c84619dfbcb277) - Updated starter templates to use open-wc analyzer for generating custom-elements.json, and updated basic API docs generater included in the template to the new manifest format. | ||
|
||
- Updated dependencies [[`15a8356d`](https://github.com/lit/lit/commit/15a8356ddd59a1e80880a93acd21fadc9c24e14b), [`5fabe2b5`](https://github.com/lit/lit/commit/5fabe2b5ae4ab8fba9dc2d23a69105d32e4c0705), [`5b2f3642`](https://github.com/lit/lit/commit/5b2f3642ff91931b5b01f8bdd2ed98aba24f1047), [`5fabe2b5`](https://github.com/lit/lit/commit/5fabe2b5ae4ab8fba9dc2d23a69105d32e4c0705), [`5fabe2b5`](https://github.com/lit/lit/commit/5fabe2b5ae4ab8fba9dc2d23a69105d32e4c0705), [`0312f3e5`](https://github.com/lit/lit/commit/0312f3e533611eb3f4f9381594485a33ad003b74)]: | ||
- [email protected] |
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,28 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2019 Google LLC. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,134 @@ | ||
# LitElement TypeScript starter | ||
|
||
This project includes a sample component using LitElement with TypeScript. | ||
|
||
This template is generated from the `lit-starter-ts` package in [the main Lit | ||
repo](https://github.com/lit/lit). Issues and PRs for this template should be | ||
filed in that repo. | ||
|
||
## Setup | ||
|
||
Install dependencies: | ||
|
||
```bash | ||
npm i | ||
``` | ||
|
||
## Build | ||
|
||
This sample uses the TypeScript compiler to produce JavaScript that runs in modern browsers. | ||
|
||
To build the JavaScript version of your component: | ||
|
||
```bash | ||
npm run build | ||
``` | ||
|
||
To watch files and rebuild when the files are modified, run the following command in a separate shell: | ||
|
||
```bash | ||
npm run build:watch | ||
``` | ||
|
||
Both the TypeScript compiler and lit-analyzer are configured to be very strict. You may want to change `tsconfig.json` to make them less strict. | ||
|
||
## Testing | ||
|
||
This sample uses modern-web.dev's | ||
[@web/test-runner](https://www.npmjs.com/package/@web/test-runner) 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, which will run your tests against Lit's development mode (with more verbose errors) as well as against Lit's production mode: | ||
|
||
```bash | ||
npm test | ||
``` | ||
|
||
For local testing during development, the `test:dev:watch` command will run your tests in Lit's development mode (with verbose errors) on every change to your source files: | ||
|
||
```bash | ||
npm test:watch | ||
``` | ||
|
||
Alternatively the `test:prod` and `test:prod:watch` commands will run your tests in Lit's production mode. | ||
|
||
## Dev Server | ||
|
||
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: | ||
|
||
```bash | ||
npm run serve | ||
``` | ||
|
||
There is a development HTML file located at `/dev/index.html` that you can view at http://localhost:8000/dev/index.html. Note that this command will serve your code using Lit's development mode (with more verbose errors). To serve your code against Lit's production mode, use `npm run serve:prod`. | ||
|
||
## Editing | ||
|
||
If you use VS Code, we highly recommend 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 | ||
- Type-checking | ||
- Code completion | ||
- Hover-over docs | ||
- Jump to definition | ||
- Linting | ||
- Quick Fixes | ||
|
||
The project is setup to recommend lit-plugin to VS Code users if they don't already have it installed. | ||
|
||
## Linting | ||
|
||
Linting of TypeScript files is provided by [ESLint](eslint.org) and [TypeScript ESLint](https://github.com/typescript-eslint/typescript-eslint). In addition, [lit-analyzer](https://www.npmjs.com/package/lit-analyzer) is used to type-check and lint lit-html templates with the same engine and rules as lit-plugin. | ||
|
||
The rules are mostly the recommended rules from each project, but some have been turned off to make LitElement usage easier. The recommended rules are pretty strict, so you may want to relax them by editing `.eslintrc.json` and `tsconfig.json`. | ||
|
||
To lint the project run: | ||
|
||
```bash | ||
npm run lint | ||
``` | ||
|
||
## Formatting | ||
|
||
[Prettier](https://prettier.io/) is used for code formatting. It has been pre-configured according to the Lit's style. You can change this in `.prettierrc.json`. | ||
|
||
Prettier has not been configured to run when committing files, but this can be added with Husky and `pretty-quick`. See the [prettier.io](https://prettier.io/) site for instructions. | ||
|
||
## Static Site | ||
|
||
This project includes a simple website generated with the [eleventy](https://11ty.dev) static site generator and the templates and pages in `/docs-src`. The site is generated to `/docs` and intended to be checked in so that GitHub pages can serve the site [from `/docs` on the master branch](https://help.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site). | ||
|
||
To enable the site go to the GitHub settings and change the GitHub Pages "Source" setting to "master branch /docs folder".</p> | ||
|
||
To build the site, run: | ||
|
||
```bash | ||
npm run docs | ||
``` | ||
|
||
To serve the site locally, run: | ||
|
||
```bash | ||
npm run docs:serve | ||
``` | ||
|
||
To watch the site files, and re-build automatically, run: | ||
|
||
```bash | ||
npm run docs:watch | ||
``` | ||
|
||
The site will usually be served at http://localhost:8000. | ||
|
||
## Bundling and minification | ||
|
||
This starter project doesn't include any build-time optimizations like bundling or minification. We recommend publishing components as unoptimized JavaScript modules, and performing build-time optimizations at the application level. This gives build tools the best chance to deduplicate code, remove dead code, and so on. | ||
|
||
For information on building application projects that include LitElement components, see [Build for production](https://lit.dev/docs/tools/production/) on the Lit site. | ||
|
||
## More information | ||
|
||
See [Get started](https://lit.dev/docs/getting-started/) on the Lit site for more information. |
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 @@ | ||
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 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,28 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<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="../lwc-button.js"></script> | ||
<script type="module" src="../lwc-modal.js"></script> | ||
<style> | ||
p { | ||
border: solid 1px blue; | ||
padding: 8px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<my-element> | ||
<p>This is child content 2</p> | ||
</my-element> | ||
|
||
|
||
<lwc-button on-connect="(nwcUrl) => alert('Connected')"></lwc-button> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Ignore files with a leading underscore; useful for e.g. readmes in source documentation | ||
_*.md |
Empty file.
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 @@ | ||
This directory contains the sources for the static site contained in the /docs/ directory. The site is based on the [eleventy](11ty.dev) static site generator. | ||
|
||
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". | ||
|
||
To view the site locally, run `npm run docs:serve`. | ||
|
||
To edit the site, add to or edit the files in this directory then run `npm run docs` to build the site. The built files must be checked in and pushed to GitHub to appear on GitHub pages. |
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,16 @@ | ||
/** | ||
* @license | ||
* Copyright 2021 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
const fs = require('fs'); | ||
|
||
module.exports = () => { | ||
const customElements = JSON.parse( | ||
fs.readFileSync('custom-elements.json', 'utf-8') | ||
); | ||
return { | ||
customElements, | ||
}; | ||
}; |
Oops, something went wrong.