Skip to content

Commit e2ffa60

Browse files
Lit 3.0 (#16)
1 parent 97738ce commit e2ffa60

File tree

1 file changed

+125
-0
lines changed

1 file changed

+125
-0
lines changed

rfcs/0002-lit-3.0.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
---
2+
Status: Active
3+
Champions: @justinfagnani
4+
PR: https://github.com/lit/rfcs/pull/16
5+
---
6+
7+
# Lit 3.0
8+
9+
A proposal for the next major release of Lit
10+
11+
## Objective
12+
13+
Allow us to make a few breaking changes that will let us reduce some engineering complexity, and very lightly reduce bundle size.
14+
15+
### Goals
16+
- Require no code changes from developers using non-deprecated Lit 2.0 APIs
17+
- Drop IE support
18+
- Publish ES2021
19+
- Remove APIs deprecated in Lit 2.0
20+
21+
### Non-Goals
22+
- Drop support for the Shady DOM polyfill
23+
- Not require additional polyfills for older browsers
24+
25+
## Motivation
26+
27+
### IE Support removal
28+
29+
IE11 is now unsupported by Microsoft, most major websites, many frameworks, and apparently most of our users. The times we've asked our users if they need IE support, we haven't heard from anyone that they do at all. While this doesn't mean we don't have any users who require IE11 support, all signs point to it finally being time for us to move on.
30+
31+
Doing so will let us turn down our flaky IE11 test runners and remove some IE-specific workarounds.
32+
33+
### Publishing ES2021
34+
35+
We published Lit 1.0 packages as ES2019 because of spotty browser support for some ES2021 features like logical assignment. The situation is much better now, and publishing native optional chaining and logical assignment expressions will give us a small bundle size and perf improvement.
36+
37+
### Clean up deprecated APIs
38+
39+
We need to start the habit of regularly removing previously deprecated APIs to keep the codebase clean.
40+
41+
## Detailed Design
42+
43+
### 2.x deprecations
44+
45+
* `UpdatingElement` is not currently deprecated and needs to be.
46+
* All other moved APIs are deprecated.
47+
48+
### IE11 removal
49+
50+
- Turn down our IE test runners
51+
- Remove workaround for IE normalizing text nodes during clone ([source](https://github.com/lit/lit/blob/f2eb97962c7e77373b3b8861ab59639de22da3d0/packages/lit-html/src/lit-html.ts#L974))
52+
- Simplify bound attribute handling ([source](https://github.com/lit/lit/blob/f2eb97962c7e77373b3b8861ab59639de22da3d0/packages/lit-html/src/lit-html.ts#L911))
53+
- Simplify `styleMap()` style removal ([source](https://github.com/lit/lit/blob/f2eb97962c7e77373b3b8861ab59639de22da3d0/packages/lit-html/src/directives/style-map.ts#L82))
54+
- Use `globalThis` ([source](https://github.com/lit/lit/blob/f2eb97962c7e77373b3b8861ab59639de22da3d0/packages/lit-html/src/lit-html.ts#L15))
55+
- Use `toggleAttribute()` ([source](https://github.com/lit/lit/blob/f2eb97962c7e77373b3b8861ab59639de22da3d0/packages/lit-html/src/lit-html.ts#L1893))
56+
- Use `Element.prototype.after()`, `.before()`, `.replaceChildren()` where beneficial
57+
- Remove test conditional on IE11 (and Chrome 41) ([example](https://github.com/lit/lit/blob/main/packages/lit-html/src/test/directives/style-map_test.ts#L14))
58+
- Use `for..of` loops instead of `forEach()`.
59+
60+
### Publish ES2021
61+
62+
- Update tsconfig target and lib to es2022
63+
- Remove unused catch bindings ([source](https://github.com/lit/lit/blob/f2eb97962c7e77373b3b8861ab59639de22da3d0/packages/reactive-element/src/reactive-element.ts#L351))
64+
- Verify code size against regressions
65+
66+
### Misc / Old API removal
67+
- Remove `UpdatingElement` export from lit-element.ts ([source](https://github.com/lit/lit/blob/f2eb97962c7e77373b3b8861ab59639de22da3d0/packages/lit-element/src/lit-element.ts#L84))
68+
- Remove extra exports from lit-element/index.ts ([source](https://github.com/lit/lit/blob/f2eb97962c7e77373b3b8861ab59639de22da3d0/packages/lit-element/src/index.ts#L10))
69+
- Move SSR hydration support modules to `@lit-labs/ssr-client`
70+
- Remove `requestUpdateThenable` ([source](https://github.com/lit/lit/blob/f2eb97962c7e77373b3b8861ab59639de22da3d0/packages/reactive-element/src/reactive-element.ts#L42))
71+
- Remove old API warnings ([source](https://github.com/lit/lit/blob/f2eb97962c7e77373b3b8861ab59639de22da3d0/packages/reactive-element/src/reactive-element.ts#L810))
72+
73+
74+
## Implementation Considerations
75+
76+
### Implementation Plan
77+
78+
#### Branches
79+
80+
As recommended by [changesets prereleases documentation](https://github.com/changesets/changesets/blob/main/docs/prereleases.md) we will work on a separate `3.0` branch, and regularly merge `main` into it. When 3.0 is ready, we will create a `2.x` branch, then merge `3.0` into `main`.
81+
82+
### Backward Compatibility
83+
84+
There should be no required _code_ changes for users of non-deprecated* APIs.
85+
86+
There are potential interop considerations between versions of Lit, though only when sharing objects between version, like a directive from one version and a template from another. We should be ok because of the work we did to eliminate `instanceof` checks and ensure stable APIs on implementation objects that could be shared between versions.
87+
88+
\* _If we have deprecated everything properly. For the `UpdatingElement` export at least, we did miss deprecating it._
89+
90+
### Testing Plan
91+
92+
How will this proposal be tested? Are unit tests sufficient, or do we need integration tests? Is any unique testing infrastructure required?
93+
94+
### Performance and Code Size Impact
95+
96+
This should have a very small positive impact on code size and perf due to using more native JS syntax.
97+
98+
### Interoperability
99+
100+
Since there are no new features, there is no impact on web component ecosystem interoperability.
101+
102+
### Security Impact
103+
104+
No changes
105+
106+
### Documentation Plan
107+
108+
* Prerelease blog post
109+
* Blog post
110+
* Add version selector for v3 docs
111+
* Update tooling and workflow docs
112+
* Clarify and simplify the support policy.
113+
* Describe exactly which versions are supported (tested) in a table
114+
* Remove reverences to IE
115+
* Update API docs. The only removals would be `UpdatingElement` and the decorators, etc., exports from `lit-element.js`. Instead of an entirely new set of API docs, maybe we can somehow preserve and mark those as removed.
116+
117+
## Downsides
118+
119+
The breaking changes could effect non-IE browsers that we don't have test coverage for (UC Browser, Cobalt, etc). We really have no way of knowing, since these browsers aren't testable on common CI systems.
120+
121+
Publishing ES2021 could break existing toolchains that don't support the syntax. Sites like unpkg.com have slightly older parsers (only when using the `?module` flag for unpkg). We will need to deal with this eventually as we want to adopt native class fields, decorators, etc. The lit.dev playground will continue to work as it doesn't use the unpkg `?module` flag.
122+
123+
## Alternatives
124+
125+
We don't have to do a breaking change at all, for now.

0 commit comments

Comments
 (0)