Skip to content

Commit 838c2cc

Browse files
authored
Merge pull request #20 from lit/ga-release
Update to Lit 2.0.0 (manually)
2 parents fef8212 + 66a9d1a commit 838c2cc

19 files changed

+30658
-28608
lines changed

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# @lit/lit-starter-js
2+
3+
## 1.0.0
4+
5+
### Patch Changes
6+
7+
- [#2113](https://github.com/lit/lit/pull/2113) [`5b2f3642`](https://github.com/lit/lit/commit/5b2f3642ff91931b5b01f8bdd2ed98aba24f1047) - Dependency upgrades including TypeScript 4.4.2
8+
9+
- [#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.
10+
11+
- [#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.
12+
13+
- 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)]:
14+

README.md

+13-5
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,20 @@ Mocha, Chai, and some related helpers for testing. See the
1818
[modern-web.dev testing documentation](https://modern-web.dev/docs/test-runner/overview) for
1919
more information.
2020

21-
Tests can be run with the `test` script:
21+
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:
2222

2323
```bash
2424
npm test
2525
```
2626

27+
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:
28+
29+
```bash
30+
npm test:watch
31+
```
32+
33+
Alternatively the `test:prod` and `test:prod:watch` commands will run your tests in Lit's production mode.
34+
2735
## Dev Server
2836

2937
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.
@@ -34,7 +42,7 @@ To run the dev server and open the project in a new browser tab:
3442
npm run serve
3543
```
3644

37-
There is a development HTML file located at `/dev/index.html` that you can view at http://localhost:8000/dev/index.html.
45+
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`.
3846

3947
## Editing
4048

@@ -64,7 +72,7 @@ npm run lint
6472

6573
## Formatting
6674

67-
[Prettier](https://prettier.io/) is used for code formatting. It has been pre-configured according to the Polymer Project's style. You can change this in `.prettierrc.json`.
75+
[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`.
6876

6977
Prettier has not been configured to run when commiting files, but this can be added with Husky and and `pretty-quick`. See the [prettier.io](https://prettier.io/) site for instructions.
7078

@@ -98,8 +106,8 @@ The site will usually be served at http://localhost:8000.
98106

99107
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.
100108

101-
For information on building application projects that include LitElement components, see [Build for production](https://lit-element.polymer-project.org/guide/build) on the LitElement site.
109+
For information on building application projects that include LitElement components, see [Build for production](https://lit.dev/docs/tools/production/) on the LitElement site.
102110

103111
## More information
104112

105-
See [Get started](https://lit-element.polymer-project.org/guide/start) on the LitElement site for more information.
113+
See [Get started](https://lit.dev/docs/getting-started/) on the Lit site for more information.

docs-src/.DS_Store

6 KB
Binary file not shown.

docs-src/_includes/footer.11ty.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = function (data) {
33
<footer>
44
<p>
55
Made with
6-
<a href="https://github.com/PolymerLabs/lit-starter-js">lit-starter-js</a>
6+
<a href="https://github.com/lit/lit-element-starter-js">lit-starter-js</a>
77
</p>
88
</footer>`;
99
};

docs-src/api.11ty.cjs

+69-27
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,67 @@ module.exports = class Docs {
1111
}
1212

1313
render(data) {
14-
const customElements = data.api['11tydata'].customElements;
15-
const tags = customElements.tags;
14+
const manifest = data.api['11tydata'].customElements;
15+
const elements = manifest.modules.reduce(
16+
(els, module) =>
17+
els.concat(
18+
module.declarations?.filter((dec) => dec.customElement) ?? []
19+
),
20+
[]
21+
);
1622
return `
1723
<h1>API</h1>
18-
${tags
24+
${elements
1925
.map(
20-
(tag) => `
21-
<h2>&lt;${tag.name}></h2>
26+
(element) => `
27+
<h2>&lt;${element.tagName}></h2>
2228
<div>
23-
${tag.description}
29+
${element.description}
2430
</div>
2531
${renderTable(
2632
'Attributes',
27-
['name', 'description', 'type', 'default'],
28-
tag.attributes
33+
['name', 'description', 'type.text', 'default'],
34+
element.attributes
2935
)}
3036
${renderTable(
3137
'Properties',
32-
['name', 'attribute', 'description', 'type', 'default'],
33-
tag.properties
38+
['name', 'attribute', 'description', 'type.text', 'default'],
39+
element.members.filter((m) => m.kind === 'field')
40+
)}
41+
${renderTable(
42+
'Methods',
43+
['name', 'parameters', 'description', 'return.type.text'],
44+
element.members
45+
.filter(
46+
(m) =>
47+
m.kind === 'method' &&
48+
m.privacy !== 'private' &&
49+
m.name[0] !== '_'
50+
)
51+
.map((m) => ({
52+
...m,
53+
parameters: renderTable(
54+
'',
55+
['name', 'description', 'type.text'],
56+
m.parameters
57+
),
58+
}))
59+
)}
60+
${renderTable('Events', ['name', 'description'], element.events)}
61+
${renderTable(
62+
'Slots',
63+
[['name', '(default)'], 'description'],
64+
element.slots
3465
)}
35-
${
36-
/*
37-
* Methods are not output by web-component-analyzer yet (a bug), so
38-
* this is a placeholder so that at least _something_ will be output
39-
* when that is fixed, and element maintainers will hopefully have a
40-
* signal to update this file to add the neccessary columns.
41-
*/
42-
renderTable('Methods', ['name', 'description'], tag.methods)
43-
}
44-
${renderTable('Events', ['name', 'description'], tag.events)}
45-
${renderTable('Slots', ['name', 'description'], tag.slots)}
4666
${renderTable(
4767
'CSS Shadow Parts',
4868
['name', 'description'],
49-
tag.cssParts
69+
element.cssParts
5070
)}
5171
${renderTable(
5272
'CSS Custom Properties',
5373
['name', 'description'],
54-
tag.cssProperties
74+
element.cssProperties
5575
)}
5676
`
5777
)
@@ -60,25 +80,47 @@ module.exports = class Docs {
6080
}
6181
};
6282

83+
/**
84+
* Reads a (possibly deep) path off of an object.
85+
*/
86+
const get = (obj, path) => {
87+
let fallback = '';
88+
if (Array.isArray(path)) {
89+
[path, fallback] = path;
90+
}
91+
const parts = path.split('.');
92+
while (obj && parts.length) {
93+
obj = obj[parts.shift()];
94+
}
95+
return obj == null || obj === '' ? fallback : obj;
96+
};
97+
6398
/**
6499
* Renders a table of data, plucking the given properties from each item in
65100
* `data`.
66101
*/
67102
const renderTable = (name, properties, data) => {
68-
if (data === undefined) {
103+
if (data === undefined || data.length === 0) {
69104
return '';
70105
}
71106
return `
72-
<h3>${name}</h3>
107+
${name ? `<h3>${name}</h3>` : ''}
73108
<table>
74109
<tr>
75-
${properties.map((p) => `<th>${capitalize(p)}</th>`).join('')}
110+
${properties
111+
.map(
112+
(p) =>
113+
`<th>${capitalize(
114+
(Array.isArray(p) ? p[0] : p).split('.')[0]
115+
)}</th>`
116+
)
117+
.join('')}
76118
</tr>
77119
${data
78120
.map(
79121
(i) => `
80122
<tr>
81-
${properties.map((p) => `<td>${i[p]}</td>`).join('')}
123+
${properties.map((p) => `<td>${get(i, p)}</td>`).join('')}
82124
</tr>
83125
`
84126
)

docs-src/docs.css

+1
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,5 @@ td, th {
159159
border: solid 1px #aaa;
160160
padding: 4px;
161161
text-align: left;
162+
vertical-align: top;
162163
}

docs/api/index.html

+34-24
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ <h3>Attributes</h3>
4343
</tr>
4444

4545
<tr>
46-
<td>name</td><td>The name to say "Hello" to.</td><td>string</td><td>"World"</td>
46+
<td>name</td><td>The name to say "Hello" to.</td><td>string</td><td></td>
4747
</tr>
4848

4949
<tr>
50-
<td>count</td><td>The number of times the button has been clicked.</td><td>number</td><td>0</td>
50+
<td>count</td><td>The number of times the button has been clicked.</td><td>number</td><td></td>
5151
</tr>
5252

5353
</table>
@@ -60,43 +60,53 @@ <h3>Properties</h3>
6060
</tr>
6161

6262
<tr>
63-
<td>name</td><td>name</td><td>The name to say "Hello" to.</td><td>string</td><td>"World"</td>
63+
<td>name</td><td>name</td><td>The name to say "Hello" to.</td><td>string</td><td>'World'</td>
6464
</tr>
6565

6666
<tr>
6767
<td>count</td><td>count</td><td>The number of times the button has been clicked.</td><td>number</td><td>0</td>
6868
</tr>
6969

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+
7079
<tr>
71-
<td>renderRoot</td><td>undefined</td><td>Node or ShadowRoot into which element DOM should be rendered. Defaults
72-
to an open shadowRoot.</td><td>HTMLElement | ShadowRoot</td><td>undefined</td>
73-
</tr>
80+
<td>sayHello</td><td>
81+
82+
<table>
83+
<tr>
84+
<th>Name</th><th>Description</th><th>Type</th>
85+
</tr>
7486

7587
<tr>
76-
<td>isUpdatePending</td><td>undefined</td><td>undefined</td><td>boolean</td><td>undefined</td>
88+
<td>name</td><td>The name to say "Hello" to</td><td>string</td>
7789
</tr>
7890

79-
<tr>
80-
<td>hasUpdated</td><td>undefined</td><td>undefined</td><td>boolean</td><td>undefined</td>
91+
</table>
92+
</td><td>Formats a greeting</td><td>string</td>
8193
</tr>
8294

95+
</table>
96+
97+
98+
<h3>Events</h3>
99+
<table>
100+
<tr>
101+
<th>Name</th><th>Description</th>
102+
</tr>
103+
83104
<tr>
84-
<td>updateComplete</td><td>undefined</td><td>Returns a Promise that resolves when the element has completed updating.
85-
The Promise value is a boolean that is `true` if the element completed the
86-
update without triggering another update. The Promise result is `false` if
87-
a property was set inside `updated()`. If the Promise is rejected, an
88-
exception was thrown during the update.
89-
90-
To await additional asynchronous work, override the `getUpdateComplete`
91-
method. For example, it is sometimes useful to await a rendered element
92-
before fulfilling this Promise. To do this, first await
93-
`super.getUpdateComplete()`, then any subsequent state.</td><td>Promise<boolean></td><td>undefined</td>
105+
<td>count-changed</td><td>Indicates when the count changes</td>
94106
</tr>
95107

96108
</table>
97-
98-
99-
109+
100110

101111
<h3>Slots</h3>
102112
<table>
@@ -105,7 +115,7 @@ <h3>Slots</h3>
105115
</tr>
106116

107117
<tr>
108-
<td></td><td>This element has a slot</td>
118+
<td>(default)</td><td>This element has a slot</td>
109119
</tr>
110120

111121
</table>
@@ -132,7 +142,7 @@ <h3>CSS Shadow Parts</h3>
132142
<footer>
133143
<p>
134144
Made with
135-
<a href="https://github.com/PolymerLabs/lit-starter-js">lit-starter-js</a>
145+
<a href="https://github.com/lit/lit-element-starter-js">lit-starter-js</a>
136146
</p>
137147
</footer>
138148
</body>

docs/docs.css

+1
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,5 @@ td, th {
159159
border: solid 1px #aaa;
160160
padding: 4px;
161161
text-align: left;
162+
vertical-align: top;
162163
}

docs/examples/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ <h3>HTML</h3>
6868
<footer>
6969
<p>
7070
Made with
71-
<a href="https://github.com/PolymerLabs/lit-starter-js">lit-starter-js</a>
71+
<a href="https://github.com/lit/lit-element-starter-js">lit-starter-js</a>
7272
</p>
7373
</footer>
7474
</body>

docs/examples/name-property/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ <h3>HTML</h3>
5858
<footer>
5959
<p>
6060
Made with
61-
<a href="https://github.com/PolymerLabs/lit-starter-js">lit-starter-js</a>
61+
<a href="https://github.com/lit/lit-element-starter-js">lit-starter-js</a>
6262
</p>
6363
</footer>
6464
</body>

docs/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ <h2>This is a &lt;my-element&gt;</h2>
6868
<footer>
6969
<p>
7070
Made with
71-
<a href="https://github.com/PolymerLabs/lit-starter-js">lit-starter-js</a>
71+
<a href="https://github.com/lit/lit-element-starter-js">lit-starter-js</a>
7272
</p>
7373
</footer>
7474
</body>

docs/install/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ <h3>JavaScript</h3>
4646
<footer>
4747
<p>
4848
Made with
49-
<a href="https://github.com/PolymerLabs/lit-starter-js">lit-starter-js</a>
49+
<a href="https://github.com/lit/lit-element-starter-js">lit-starter-js</a>
5050
</p>
5151
</footer>
5252
</body>

0 commit comments

Comments
 (0)