niris-public-community-components 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.eleventy.cjs +21 -0
- package/.eslintignore +6 -0
- package/.eslintrc.json +51 -0
- package/.prettierrc.json +7 -0
- package/CHANGELOG.md +98 -0
- package/LICENSE +28 -0
- package/README.md +93 -0
- package/README_DEV.md +154 -0
- package/dev/README.md +1 -0
- package/dev/index.html +22 -0
- package/dev/text-area-niris.html +30 -0
- package/docs/.nojekyll +0 -0
- package/docs/api/index.html +149 -0
- package/docs/docs.css +163 -0
- package/docs/examples/index.html +75 -0
- package/docs/examples/name-property/index.html +65 -0
- package/docs/images/example1.png +0 -0
- package/docs/images/example2.png +0 -0
- package/docs/index.html +75 -0
- package/docs/install/index.html +53 -0
- package/docs/prism-okaidia.css +123 -0
- package/docs-src/.eleventyignore +2 -0
- package/docs-src/.nojekyll +0 -0
- package/docs-src/_README.md +7 -0
- package/docs-src/_data/api.11tydata.js +16 -0
- package/docs-src/_includes/example.11ty.cjs +43 -0
- package/docs-src/_includes/footer.11ty.cjs +9 -0
- package/docs-src/_includes/header.11ty.cjs +7 -0
- package/docs-src/_includes/nav.11ty.cjs +11 -0
- package/docs-src/_includes/page.11ty.cjs +37 -0
- package/docs-src/_includes/relative-path.cjs +9 -0
- package/docs-src/api.11ty.cjs +127 -0
- package/docs-src/docs.css +163 -0
- package/docs-src/examples/index.md +34 -0
- package/docs-src/examples/name-property.md +15 -0
- package/docs-src/index.md +76 -0
- package/docs-src/install.md +32 -0
- package/docs-src/package.json +3 -0
- package/index.html +17 -0
- package/my-element.js +79 -0
- package/package.json +76 -0
- package/rollup.config.js +42 -0
- package/src/my-element.ts +68 -0
- package/src/test/my-element_test.ts +62 -0
- package/src/textarea-to-niris.ts +218 -0
- package/tsconfig.json +34 -0
- package/web-dev-server.config.js +25 -0
- package/web-test-runner.config.js +120 -0
package/.eleventy.cjs
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
|
2
|
+
|
3
|
+
module.exports = function (eleventyConfig) {
|
4
|
+
eleventyConfig.addPlugin(syntaxHighlight);
|
5
|
+
eleventyConfig.addPassthroughCopy('docs-src/docs.css');
|
6
|
+
eleventyConfig.addPassthroughCopy('docs-src/.nojekyll');
|
7
|
+
eleventyConfig.addPassthroughCopy(
|
8
|
+
'node_modules/@webcomponents/webcomponentsjs'
|
9
|
+
);
|
10
|
+
eleventyConfig.addPassthroughCopy('node_modules/lit/polyfill-support.js');
|
11
|
+
return {
|
12
|
+
dir: {
|
13
|
+
input: 'docs-src',
|
14
|
+
output: 'docs',
|
15
|
+
},
|
16
|
+
templateExtensionAliases: {
|
17
|
+
'11ty.cjs': '11ty.js',
|
18
|
+
'11tydata.cjs': '11tydata.js',
|
19
|
+
},
|
20
|
+
};
|
21
|
+
};
|
package/.eslintignore
ADDED
package/.eslintrc.json
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
{
|
2
|
+
"root": true,
|
3
|
+
"extends": [
|
4
|
+
"eslint:recommended",
|
5
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
6
|
+
"plugin:@typescript-eslint/recommended"
|
7
|
+
],
|
8
|
+
"parser": "@typescript-eslint/parser",
|
9
|
+
"parserOptions": {
|
10
|
+
"ecmaVersion": 2020,
|
11
|
+
"sourceType": "module"
|
12
|
+
},
|
13
|
+
"plugins": ["@typescript-eslint"],
|
14
|
+
"env": {
|
15
|
+
"browser": true
|
16
|
+
},
|
17
|
+
"rules": {
|
18
|
+
"no-prototype-builtins": "off",
|
19
|
+
"@typescript-eslint/ban-types": "off",
|
20
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
21
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
22
|
+
"@typescript-eslint/no-explicit-any": "error",
|
23
|
+
"@typescript-eslint/no-empty-function": "off",
|
24
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
25
|
+
"@typescript-eslint/no-unused-vars": [
|
26
|
+
"warn",
|
27
|
+
{
|
28
|
+
"argsIgnorePattern": "^_"
|
29
|
+
}
|
30
|
+
]
|
31
|
+
},
|
32
|
+
"overrides": [
|
33
|
+
{
|
34
|
+
"files": ["rollup.config.js", "web-test-runner.config.js"],
|
35
|
+
"env": {
|
36
|
+
"node": true
|
37
|
+
}
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"files": [
|
41
|
+
"*_test.ts",
|
42
|
+
"**/custom_typings/*.ts",
|
43
|
+
"packages/labs/ssr/src/test/integration/tests/**",
|
44
|
+
"packages/labs/ssr/src/lib/util/parse5-utils.ts"
|
45
|
+
],
|
46
|
+
"rules": {
|
47
|
+
"@typescript-eslint/no-explicit-any": "off"
|
48
|
+
}
|
49
|
+
}
|
50
|
+
]
|
51
|
+
}
|
package/.prettierrc.json
ADDED
package/CHANGELOG.md
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
# @lit/lit-starter-ts
|
2
|
+
|
3
|
+
## 2.0.1
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#4451](https://github.com/lit/lit/pull/4451) [`7852e130`](https://github.com/lit/lit/commit/7852e13022c9dcfcff5ed54a215c93420349e318) - Minor security fixes.
|
8
|
+
|
9
|
+
## 2.0.0
|
10
|
+
|
11
|
+
### Major Changes
|
12
|
+
|
13
|
+
- [#4141](https://github.com/lit/lit/pull/4141) [`6b515e43`](https://github.com/lit/lit/commit/6b515e43c3a24cc8a593247d3aa72d81bcc724d5) - Update TypeScript to ~5.2.0
|
14
|
+
|
15
|
+
- [#3756](https://github.com/lit/lit/pull/3756) [`f06f7972`](https://github.com/lit/lit/commit/f06f7972a027d2937fe2c68ab5af0274dec57cf4) - Drop IE11 support
|
16
|
+
|
17
|
+
### Patch Changes
|
18
|
+
|
19
|
+
- [#3814](https://github.com/lit/lit/pull/3814) [`23326c6b`](https://github.com/lit/lit/commit/23326c6b9a6abdf01998dadf5d0f20a643e457aa) - Update to TypeScript v5.0
|
20
|
+
|
21
|
+
- Updated dependencies [[`dfd747cf`](https://github.com/lit/lit/commit/dfd747cf4f7239e0c3bb7134f8acb967d0157654), [`6b515e43`](https://github.com/lit/lit/commit/6b515e43c3a24cc8a593247d3aa72d81bcc724d5), [`23c404fd`](https://github.com/lit/lit/commit/23c404fdec0cd7be834221b6ddf9b659c24ca8a2), [`1040f758`](https://github.com/lit/lit/commit/1040f75861b029527538b4ec36b2cfedcc32988a), [`0f6878dc`](https://github.com/lit/lit/commit/0f6878dc45fd95bbeb8750f277349c1392e2b3ad), [`1db01376`](https://github.com/lit/lit/commit/1db0137699b35d7e7bfac9b2ab274af4100fd7cf), [`2a01471a`](https://github.com/lit/lit/commit/2a01471a5f65fe34bad11e1099281811b8d0f79b), [`6f2833fd`](https://github.com/lit/lit/commit/6f2833fd05f2ecde5386f72d291dafc9dbae0cf7), [`c3e473b4`](https://github.com/lit/lit/commit/c3e473b499ff029b5e1aff01ca8799daf1ca1bbe), [`2eba6997`](https://github.com/lit/lit/commit/2eba69974c9e130e7483f44f9daca308345497d5), [`92cedaa2`](https://github.com/lit/lit/commit/92cedaa2c8cd8a306be3fe25d52e0e47bb044020), [`d27a77ec`](https://github.com/lit/lit/commit/d27a77ec3d3999e872df9218a2b07f90f22eb417), [`7e8491d4`](https://github.com/lit/lit/commit/7e8491d4ed9f0c39d974616c4678552ef50b81df), [`6470807f`](https://github.com/lit/lit/commit/6470807f3a0981f9d418cb26f05969912455d148), [`23326c6b`](https://github.com/lit/lit/commit/23326c6b9a6abdf01998dadf5d0f20a643e457aa), [`09949234`](https://github.com/lit/lit/commit/09949234445388d51bfb4ee24ff28a4c9f82fe17), [`f06f7972`](https://github.com/lit/lit/commit/f06f7972a027d2937fe2c68ab5af0274dec57cf4)]:
|
22
|
+
- lit@3.0.0
|
23
|
+
|
24
|
+
## 2.0.0-pre.1
|
25
|
+
|
26
|
+
### Major Changes
|
27
|
+
|
28
|
+
- [#4141](https://github.com/lit/lit/pull/4141) [`6b515e43`](https://github.com/lit/lit/commit/6b515e43c3a24cc8a593247d3aa72d81bcc724d5) - Update TypeScript to ~5.2.0
|
29
|
+
|
30
|
+
### Patch Changes
|
31
|
+
|
32
|
+
- Updated dependencies [[`6b515e43`](https://github.com/lit/lit/commit/6b515e43c3a24cc8a593247d3aa72d81bcc724d5), [`0f6878dc`](https://github.com/lit/lit/commit/0f6878dc45fd95bbeb8750f277349c1392e2b3ad), [`2a01471a`](https://github.com/lit/lit/commit/2a01471a5f65fe34bad11e1099281811b8d0f79b), [`2eba6997`](https://github.com/lit/lit/commit/2eba69974c9e130e7483f44f9daca308345497d5), [`d27a77ec`](https://github.com/lit/lit/commit/d27a77ec3d3999e872df9218a2b07f90f22eb417), [`6470807f`](https://github.com/lit/lit/commit/6470807f3a0981f9d418cb26f05969912455d148), [`09949234`](https://github.com/lit/lit/commit/09949234445388d51bfb4ee24ff28a4c9f82fe17)]:
|
33
|
+
- lit@3.0.0-pre.1
|
34
|
+
|
35
|
+
## 2.0.0-pre.0
|
36
|
+
|
37
|
+
### Major Changes
|
38
|
+
|
39
|
+
- [#3756](https://github.com/lit/lit/pull/3756) [`f06f7972`](https://github.com/lit/lit/commit/f06f7972a027d2937fe2c68ab5af0274dec57cf4) - Drop IE11 support
|
40
|
+
|
41
|
+
### Patch Changes
|
42
|
+
|
43
|
+
- [#3814](https://github.com/lit/lit/pull/3814) [`23326c6b`](https://github.com/lit/lit/commit/23326c6b9a6abdf01998dadf5d0f20a643e457aa) - Update to TypeScript v5.0
|
44
|
+
|
45
|
+
- Updated dependencies [[`dfd747cf`](https://github.com/lit/lit/commit/dfd747cf4f7239e0c3bb7134f8acb967d0157654), [`23c404fd`](https://github.com/lit/lit/commit/23c404fdec0cd7be834221b6ddf9b659c24ca8a2), [`1db01376`](https://github.com/lit/lit/commit/1db0137699b35d7e7bfac9b2ab274af4100fd7cf), [`c3e473b4`](https://github.com/lit/lit/commit/c3e473b499ff029b5e1aff01ca8799daf1ca1bbe), [`92cedaa2`](https://github.com/lit/lit/commit/92cedaa2c8cd8a306be3fe25d52e0e47bb044020), [`23326c6b`](https://github.com/lit/lit/commit/23326c6b9a6abdf01998dadf5d0f20a643e457aa), [`f06f7972`](https://github.com/lit/lit/commit/f06f7972a027d2937fe2c68ab5af0274dec57cf4)]:
|
46
|
+
- lit@3.0.0-pre.0
|
47
|
+
|
48
|
+
## 1.0.6
|
49
|
+
|
50
|
+
### Patch Changes
|
51
|
+
|
52
|
+
- [#4157](https://github.com/lit/lit/pull/4157) [`da32db2e`](https://github.com/lit/lit/commit/da32db2e67547e0f17b7132065559eba2b1d3513) Thanks [@welingtonms](https://github.com/welingtonms)! - Improve bundling and minification recommendations.
|
53
|
+
|
54
|
+
## 1.0.5
|
55
|
+
|
56
|
+
### Patch Changes
|
57
|
+
|
58
|
+
- [#3561](https://github.com/lit/lit/pull/3561) [`e5c254e9`](https://github.com/lit/lit/commit/e5c254e96cb5d0f770ec616332e231559325c5c5) - Update dependency `@rollup/plugin-replace`
|
59
|
+
|
60
|
+
## 1.0.4
|
61
|
+
|
62
|
+
### Patch Changes
|
63
|
+
|
64
|
+
- [#2922](https://github.com/lit/lit/pull/2922) [`da9db86a`](https://github.com/lit/lit/commit/da9db86a33cba710d439e254df2492f9f6dcbbee) - Update dependencies and remove unused dependencies
|
65
|
+
|
66
|
+
## 1.0.3
|
67
|
+
|
68
|
+
### Patch Changes
|
69
|
+
|
70
|
+
- [#2757](https://github.com/lit/lit/pull/2757) [`55841c14`](https://github.com/lit/lit/commit/55841c14f52891357dd93680d3bc5b1da6c89c8a) - Update Rollup and Rollup plugins
|
71
|
+
|
72
|
+
## 1.0.2
|
73
|
+
|
74
|
+
### Patch Changes
|
75
|
+
|
76
|
+
- [#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.
|
77
|
+
|
78
|
+
## 1.0.1
|
79
|
+
|
80
|
+
### Patch Changes
|
81
|
+
|
82
|
+
- [#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 `/`.
|
83
|
+
|
84
|
+
- 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)]:
|
85
|
+
- lit@2.1.0
|
86
|
+
|
87
|
+
## 1.0.0
|
88
|
+
|
89
|
+
### Patch Changes
|
90
|
+
|
91
|
+
- [#2113](https://github.com/lit/lit/pull/2113) [`5b2f3642`](https://github.com/lit/lit/commit/5b2f3642ff91931b5b01f8bdd2ed98aba24f1047) - Dependency upgrades including TypeScript 4.4.2
|
92
|
+
|
93
|
+
- [#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.
|
94
|
+
|
95
|
+
- [#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.
|
96
|
+
|
97
|
+
- 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)]:
|
98
|
+
- lit@2.0.0
|
package/LICENSE
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
BSD 3-Clause License
|
2
|
+
|
3
|
+
Copyright (c) 2019 Google LLC. All rights reserved.
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
7
|
+
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
9
|
+
list of conditions and the following disclaimer.
|
10
|
+
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
13
|
+
and/or other materials provided with the distribution.
|
14
|
+
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
16
|
+
contributors may be used to endorse or promote products derived from
|
17
|
+
this software without specific prior written permission.
|
18
|
+
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
<!-- [![npm version](https://badge.fury.io/js/angular2-expandable-list.svg)](https://badge.fury.io/js/angular2-expandable-list)
|
2
|
+
-->
|
3
|
+
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
|
4
|
+
|
5
|
+
# Niris web components
|
6
|
+
|
7
|
+
This library contains two web components:
|
8
|
+
|
9
|
+
- `<textarea-to-iris>`: Web component to, when clicking a button, show a textarea and be able to enter the suggestion or complaint there, when submitting, it will redirect us to the public website of Niris (configurable by property)
|
10
|
+
|
11
|
+
![example ](docs/images/example1.png)
|
12
|
+
|
13
|
+
![example ](docs/images/example2.png)
|
14
|
+
|
15
|
+
- `<niris-form>`: TODO...
|
16
|
+
|
17
|
+
## Prerequisites
|
18
|
+
|
19
|
+
## Table of contents
|
20
|
+
|
21
|
+
- [Project Name](#project-name)
|
22
|
+
- [Prerequisites](#prerequisites)
|
23
|
+
- [Table of contents](#table-of-contents)
|
24
|
+
- [How to use](#How-to-use)
|
25
|
+
- [Installation](#installation)
|
26
|
+
- [Styling](#styling)
|
27
|
+
- [Versioning](#versioning)
|
28
|
+
- [Authors](#authors)
|
29
|
+
- [License](#license)
|
30
|
+
|
31
|
+
## How to use
|
32
|
+
|
33
|
+
### Installation
|
34
|
+
|
35
|
+
- Install with **npm**
|
36
|
+
|
37
|
+
```
|
38
|
+
$ npm install public-community-components
|
39
|
+
```
|
40
|
+
|
41
|
+
### CDN
|
42
|
+
|
43
|
+
npm CDNs like unpkg.com can directly serve files that have been published to npm. This works great for standard JavaScript modules that the browser can load natively.
|
44
|
+
|
45
|
+
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 specifiers to full URLs.
|
46
|
+
|
47
|
+
#### HTML
|
48
|
+
|
49
|
+
```html
|
50
|
+
<script type="module" src="https://unpkg.com/my-element?module"></script>
|
51
|
+
```
|
52
|
+
|
53
|
+
#### Javascript
|
54
|
+
|
55
|
+
```
|
56
|
+
import {MyElement} from 'https://unpkg.com/my-element?module';
|
57
|
+
```
|
58
|
+
|
59
|
+
### Initialization
|
60
|
+
|
61
|
+
- HTML way
|
62
|
+
|
63
|
+
```html
|
64
|
+
<data-grid data-url="data.json"></data-grid>
|
65
|
+
<script type="module" src="./data-grid.js"></script>
|
66
|
+
```
|
67
|
+
|
68
|
+
### Styling
|
69
|
+
|
70
|
+
```css
|
71
|
+
textarea-to-niris {
|
72
|
+
--primary-color: #007bff;
|
73
|
+
--background-color: #d4d4d4;
|
74
|
+
--color: #fff;
|
75
|
+
--padding: 1rem 1rem;
|
76
|
+
--font-size: 1rem;
|
77
|
+
--border-radius: 0rem;
|
78
|
+
--font-weight: 500;
|
79
|
+
--font-family: 'Arial', sans-serif;
|
80
|
+
}
|
81
|
+
```
|
82
|
+
|
83
|
+
## Versioning
|
84
|
+
|
85
|
+
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags).
|
86
|
+
|
87
|
+
## Authors
|
88
|
+
|
89
|
+
- **Francisco Fernandez** - _Initial work_ - [Github](https://github.com/Brok3r)
|
90
|
+
|
91
|
+
## License
|
92
|
+
|
93
|
+
[BSD 3-Clause License](https://opensource.org/license/bsd-3-clause) © Andrea SonnY
|
package/README_DEV.md
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
# LitElement TypeScript starter
|
2
|
+
|
3
|
+
This project includes a sample component using LitElement with TypeScript.
|
4
|
+
|
5
|
+
This template is generated from the `lit-starter-ts` package in [the main Lit
|
6
|
+
repo](https://github.com/lit/lit). Issues and PRs for this template should be
|
7
|
+
filed in that repo.
|
8
|
+
|
9
|
+
## About this release
|
10
|
+
|
11
|
+
This is a pre-release of Lit 3.0, the next major version of Lit.
|
12
|
+
|
13
|
+
Lit 3.0 has very few breaking changes from Lit 2.0:
|
14
|
+
|
15
|
+
- Drops support for IE11
|
16
|
+
- Published as ES2021
|
17
|
+
- Removes a couple of deprecated Lit 1.x APIs
|
18
|
+
|
19
|
+
Lit 3.0 should require no changes to upgrade from Lit 2.0 for the vast majority of users. Once the full release is published, most apps and libraries will be able to extend their npm version ranges to include both 2.x and 3.x, like `"^2.7.0 || ^3.0.0"`.
|
20
|
+
|
21
|
+
Lit 2.x and 3.0 are _interoperable_: templates, base classes, directives, decorators, etc., from one version of Lit will work with those from another.
|
22
|
+
|
23
|
+
Please file any issues you find on our [issue tracker](https://github.com/lit/lit/issues).
|
24
|
+
|
25
|
+
## Setup
|
26
|
+
|
27
|
+
Install dependencies:
|
28
|
+
|
29
|
+
```bash
|
30
|
+
npm i
|
31
|
+
```
|
32
|
+
|
33
|
+
## Build
|
34
|
+
|
35
|
+
This sample uses the TypeScript compiler to produce JavaScript that runs in modern browsers.
|
36
|
+
|
37
|
+
To build the JavaScript version of your component:
|
38
|
+
|
39
|
+
```bash
|
40
|
+
npm run build
|
41
|
+
```
|
42
|
+
|
43
|
+
To watch files and rebuild when the files are modified, run the following command in a separate shell:
|
44
|
+
|
45
|
+
```bash
|
46
|
+
npm run build:watch
|
47
|
+
```
|
48
|
+
|
49
|
+
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.
|
50
|
+
|
51
|
+
## Testing
|
52
|
+
|
53
|
+
This sample uses modern-web.dev's
|
54
|
+
[@web/test-runner](https://www.npmjs.com/package/@web/test-runner) for testing. See the
|
55
|
+
[modern-web.dev testing documentation](https://modern-web.dev/docs/test-runner/overview) for
|
56
|
+
more information.
|
57
|
+
|
58
|
+
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:
|
59
|
+
|
60
|
+
```bash
|
61
|
+
npm test
|
62
|
+
```
|
63
|
+
|
64
|
+
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:
|
65
|
+
|
66
|
+
```bash
|
67
|
+
npm test:watch
|
68
|
+
```
|
69
|
+
|
70
|
+
Alternatively the `test:prod` and `test:prod:watch` commands will run your tests in Lit's production mode.
|
71
|
+
|
72
|
+
## Dev Server
|
73
|
+
|
74
|
+
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.
|
75
|
+
|
76
|
+
To run the dev server and open the project in a new browser tab:
|
77
|
+
|
78
|
+
```bash
|
79
|
+
npm run serve
|
80
|
+
```
|
81
|
+
|
82
|
+
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`.
|
83
|
+
|
84
|
+
## Editing
|
85
|
+
|
86
|
+
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:
|
87
|
+
|
88
|
+
- Syntax highlighting
|
89
|
+
- Type-checking
|
90
|
+
- Code completion
|
91
|
+
- Hover-over docs
|
92
|
+
- Jump to definition
|
93
|
+
- Linting
|
94
|
+
- Quick Fixes
|
95
|
+
|
96
|
+
The project is setup to recommend lit-plugin to VS Code users if they don't already have it installed.
|
97
|
+
|
98
|
+
## Linting
|
99
|
+
|
100
|
+
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.
|
101
|
+
|
102
|
+
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`.
|
103
|
+
|
104
|
+
To lint the project run:
|
105
|
+
|
106
|
+
```bash
|
107
|
+
npm run lint
|
108
|
+
```
|
109
|
+
|
110
|
+
## Formatting
|
111
|
+
|
112
|
+
[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`.
|
113
|
+
|
114
|
+
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.
|
115
|
+
|
116
|
+
## Static Site
|
117
|
+
|
118
|
+
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 main branch](https://help.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site).
|
119
|
+
|
120
|
+
To enable the site go to the GitHub settings and change the GitHub Pages "Source" setting to "main branch /docs folder".</p>
|
121
|
+
|
122
|
+
To build the site, run:
|
123
|
+
|
124
|
+
```bash
|
125
|
+
npm run docs
|
126
|
+
```
|
127
|
+
|
128
|
+
To serve the site locally, run:
|
129
|
+
|
130
|
+
```bash
|
131
|
+
npm run docs:serve
|
132
|
+
```
|
133
|
+
|
134
|
+
To watch the site files, and re-build automatically, run:
|
135
|
+
|
136
|
+
```bash
|
137
|
+
npm run docs:gen:watch
|
138
|
+
```
|
139
|
+
|
140
|
+
The site will usually be served at http://localhost:8000.
|
141
|
+
|
142
|
+
**Note**: The project uses Rollup to bundle and minify the source code for the docs site and not to publish to NPM. For bundling and minification, check the [Bundling and minification](#bundling-and-minification) section.
|
143
|
+
|
144
|
+
## Bundling and minification
|
145
|
+
|
146
|
+
As stated in the [static site generation](#static-site) section, the bundling and minification setup in the Rollup configuration in this project is there specifically for the docs generation.
|
147
|
+
|
148
|
+
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.
|
149
|
+
|
150
|
+
Please check the [Publishing best practices](https://lit.dev/docs/tools/publishing/#publishing-best-practices) for information on publishing reusable Web Components, and [Build for production](https://lit.dev/docs/tools/production/) for building application projects that include LitElement components, on the Lit site.
|
151
|
+
|
152
|
+
## More information
|
153
|
+
|
154
|
+
See [Get started](https://lit.dev/docs/getting-started/) on the Lit site for more information.
|
package/dev/README.md
ADDED
@@ -0,0 +1 @@
|
|
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.
|
package/dev/index.html
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="utf-8" />
|
6
|
+
<title><my-element> Demo</title>
|
7
|
+
<script src="../node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
|
8
|
+
<script src="../node_modules/lit/polyfill-support.js"></script>
|
9
|
+
<script type="module" src="../my-element.js"></script>
|
10
|
+
<style>
|
11
|
+
p {
|
12
|
+
border: solid 1px blue;
|
13
|
+
padding: 8px;
|
14
|
+
}
|
15
|
+
</style>
|
16
|
+
</head>
|
17
|
+
<body>
|
18
|
+
<my-element>
|
19
|
+
<p>This is child content</p>
|
20
|
+
</my-element>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="utf-8" />
|
6
|
+
<title><textarea-to-iris > Demo</title>
|
7
|
+
<script src="../node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
|
8
|
+
<script src="../node_modules/lit/polyfill-support.js"></script>
|
9
|
+
<script type="module" src="../textarea-to-niris.js"></script>
|
10
|
+
<style>
|
11
|
+
article {
|
12
|
+
display: flex;
|
13
|
+
flex-direction: column;
|
14
|
+
align-items: center;
|
15
|
+
justify-content: center;
|
16
|
+
}
|
17
|
+
/* example override variables */
|
18
|
+
textarea-to-niris {
|
19
|
+
--primary-color: #03599d;
|
20
|
+
--border-radius: 0rem;
|
21
|
+
}
|
22
|
+
</style>
|
23
|
+
</head>
|
24
|
+
<body>
|
25
|
+
<article>
|
26
|
+
<h1><textarea-to-iris></h1>
|
27
|
+
<textarea-to-niris formaction="http://localhost:3000/theme-searcher" />
|
28
|
+
</article>
|
29
|
+
</body>
|
30
|
+
</html>
|
package/docs/.nojekyll
ADDED
File without changes
|
@@ -0,0 +1,149 @@
|
|
1
|
+
|
2
|
+
<!doctype html>
|
3
|
+
|
4
|
+
<html lang="en">
|
5
|
+
<head>
|
6
|
+
<meta charset="utf-8">
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
8
|
+
<title><my-element> ⌲ Docs</title>
|
9
|
+
<link rel="stylesheet" href="../docs.css">
|
10
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
|
11
|
+
<link href="../prism-okaidia.css" rel="stylesheet" />
|
12
|
+
<script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
|
13
|
+
<script src="/node_modules/lit/polyfill-support.js"></script>
|
14
|
+
<script type="module" src="../my-element.bundled.js"></script>
|
15
|
+
</head>
|
16
|
+
<body>
|
17
|
+
|
18
|
+
<header>
|
19
|
+
<h1><my-element></h1>
|
20
|
+
<h2>A web component just for me.</h2>
|
21
|
+
</header>
|
22
|
+
|
23
|
+
<nav>
|
24
|
+
<a href="../">Home</a>
|
25
|
+
<a href="../examples/">Examples</a>
|
26
|
+
<a href="">API</a>
|
27
|
+
<a href="../install/">Install</a>
|
28
|
+
</nav>
|
29
|
+
<div id="main-wrapper">
|
30
|
+
<main>
|
31
|
+
|
32
|
+
<h1>API</h1>
|
33
|
+
|
34
|
+
<h2><my-element></h2>
|
35
|
+
<div>
|
36
|
+
An example element.
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<h3>Attributes</h3>
|
40
|
+
<table>
|
41
|
+
<tr>
|
42
|
+
<th>Name</th><th>Description</th><th>Type</th><th>Default</th>
|
43
|
+
</tr>
|
44
|
+
|
45
|
+
<tr>
|
46
|
+
<td>name</td><td>The name to say "Hello" to.</td><td>string</td><td>'World'</td>
|
47
|
+
</tr>
|
48
|
+
|
49
|
+
<tr>
|
50
|
+
<td>count</td><td>The number of times the button has been clicked.</td><td>number</td><td>0</td>
|
51
|
+
</tr>
|
52
|
+
|
53
|
+
</table>
|
54
|
+
|
55
|
+
|
56
|
+
<h3>Properties</h3>
|
57
|
+
<table>
|
58
|
+
<tr>
|
59
|
+
<th>Name</th><th>Attribute</th><th>Description</th><th>Type</th><th>Default</th>
|
60
|
+
</tr>
|
61
|
+
|
62
|
+
<tr>
|
63
|
+
<td>name</td><td>name</td><td>The name to say "Hello" to.</td><td>string</td><td>'World'</td>
|
64
|
+
</tr>
|
65
|
+
|
66
|
+
<tr>
|
67
|
+
<td>count</td><td>count</td><td>The number of times the button has been clicked.</td><td>number</td><td>0</td>
|
68
|
+
</tr>
|
69
|
+
|
70
|
+
</table>
|
71
|
+
|
72
|
+
|
73
|
+
<h3>Methods</h3>
|
74
|
+
<table>
|
75
|
+
<tr>
|
76
|
+
<th>Name</th><th>Parameters</th><th>Description</th><th>Return</th>
|
77
|
+
</tr>
|
78
|
+
|
79
|
+
<tr>
|
80
|
+
<td>sayHello</td><td>
|
81
|
+
|
82
|
+
<table>
|
83
|
+
<tr>
|
84
|
+
<th>Name</th><th>Description</th><th>Type</th>
|
85
|
+
</tr>
|
86
|
+
|
87
|
+
<tr>
|
88
|
+
<td>name</td><td>The name to say "Hello" to</td><td>string</td>
|
89
|
+
</tr>
|
90
|
+
|
91
|
+
</table>
|
92
|
+
</td><td>Formats a greeting</td><td>string</td>
|
93
|
+
</tr>
|
94
|
+
|
95
|
+
</table>
|
96
|
+
|
97
|
+
|
98
|
+
<h3>Events</h3>
|
99
|
+
<table>
|
100
|
+
<tr>
|
101
|
+
<th>Name</th><th>Description</th>
|
102
|
+
</tr>
|
103
|
+
|
104
|
+
<tr>
|
105
|
+
<td>count-changed</td><td>Indicates when the count changes</td>
|
106
|
+
</tr>
|
107
|
+
|
108
|
+
</table>
|
109
|
+
|
110
|
+
|
111
|
+
<h3>Slots</h3>
|
112
|
+
<table>
|
113
|
+
<tr>
|
114
|
+
<th>Name</th><th>Description</th>
|
115
|
+
</tr>
|
116
|
+
|
117
|
+
<tr>
|
118
|
+
<td>(default)</td><td>This element has a slot</td>
|
119
|
+
</tr>
|
120
|
+
|
121
|
+
</table>
|
122
|
+
|
123
|
+
|
124
|
+
<h3>CSS Shadow Parts</h3>
|
125
|
+
<table>
|
126
|
+
<tr>
|
127
|
+
<th>Name</th><th>Description</th>
|
128
|
+
</tr>
|
129
|
+
|
130
|
+
<tr>
|
131
|
+
<td>button</td><td>The button</td>
|
132
|
+
</tr>
|
133
|
+
|
134
|
+
</table>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
</main>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
<footer>
|
143
|
+
<p>
|
144
|
+
Made with
|
145
|
+
<a href="https://github.com/lit/lit-element-starter-ts">lit-starter-ts</a>
|
146
|
+
</p>
|
147
|
+
</footer>
|
148
|
+
</body>
|
149
|
+
</html>
|