- #4485
57b00630
- Add "browser" export condition entrypoints to any package.json files with "node" export conditions. This fixes Node test runners emulating browser environments that were incorrectly loading the "node" entrypoints instead of the browser code. - Updated dependencies [
e901c582
]:- @lit-labs/[email protected]
-
#4473
9a4d569f
- Add a warning in dev mode when binding this.requestUpdate directly as an event listener. -
#4413
f60a3a2c
- Remove unused internal parameters torequestUpdate()
-
#4387
bf551b5b
- EnsurerenderRoot
exists before first update (#4268) -
#4282
c7922a0c
Thanks @MaxArt2501! - Fix a bug where accessing a@query
decorated field with thecache
flag set before the first update would result innull
being cached permanently.null
will no longer be cached before the first update and inDEV_MODE
now raises a warning. -
#4388
839ca0f8
- Fixes bug where adding or removing controllers during a reactive controller lifecycle would affect the execution of other controllers (#4266). Controllers can now be added/removed during lifecycle without affecting others.
-
#4284
89a5b088
- Allownull
to be in the type of@query()
decorated fields -
#4306
c28ebba1
- Update dependency version to refer to stable versions, rather than pre-release versions of our own packages.
-
#4146
0f6878dc
- Generated accessor for reactive properties now wrap user accessors and automatically callthis.requestUpdate()
in the setter. As in previous versions, users can still specifynoAccessor: true
, in which case they should callthis.requestUpdate()
themselves in the setter if they want to trigger a reactive update. -
#4254
1040f758
- Change the type ofReactiveElement.renderRoot
and return type ofReactiveElement.createRenderRoot()
to beHTMLElement | DocumentFragment
to match each other and lit-html'srender()
method. -
#3850
7e8491d4
- Delete deprecated queryAssignedNodes behavior and arguments. Migrate deprecated usage with a selector argument to use@queryAssignedElements
. E.g.:@queryAssignedNodes('list', true, '.item')
to@queryAssignedElements({slot: '', flatten: false, selector: '.item'})
.
-
#4183
6470807f
- Make the decorators work with theaccessor
keyword whenexperimentalDecorators
is true. -
#3816
be72f66b
- Use Symbol.for in accessor to keep things easy for HMR. -
#3710
09949234
- Addundefined
to the return type of PropertyValues.get()
-
#4146
0f6878dc
- Generated accessor for reactive properties now wrap user accessors and automatically callthis.requestUpdate()
in the setter. As in previous versions, users can still specifynoAccessor: true
, in which case they should callthis.requestUpdate()
themselves in the setter if they want to trigger a reactive update.
-
#4183
6470807f
- Make the decorators work with theaccessor
keyword whenexperimentalDecorators
is true.
-
#3850
7e8491d4
- Delete deprecated queryAssignedNodes behavior and arguments.Migrate deprecated usage with a selector argument to use
@queryAssignedElements
. E.g.:@queryAssignedNodes('list', true, '.item')
to@queryAssignedElements({slot: '', flatten: false, selector: '.item'})
.
-
#3816
be72f66b
- Use Symbol.for in accessor to keep things easy for HMR. -
Updated dependencies [
23326c6b
]:- @lit-labs/[email protected]
- #4031
8057c78d
- Rename ReactiveElement._initialize to __initialize, make it private, and remove the @internal annotation. This will help prevent collisions with subclasses that implement their own _initialize method, while using development builds.
- #3561
e5c254e9
- Fix built-in shimming ofHTMLElement
for Node build ofreactive-element
to respect existingHTMLElement
in global
-
#3522
72fcf0d7
- When running in Node, Lit now automatically includes minimal DOM shims which are sufficient for most SSR (Server Side Rendering) use-cases, removing the need to import the global DOM shim from@lit-labs/ssr
.The new
@lit-labs/ssr-dom-shim
package has been introduced, which exports anHTMLElement
,CustomElementRegistry
, and defaultcustomElements
singleton.The existing
@lit-labs/ssr
global DOM shim can still be used, and is compatible with the new package, because@lit-labs/ssr
imports from@lit-labs/ssr-dom-shim
. Importing the global DOM shim adds more APIs to the global object, such as a globalHTMLElement
,TreeWalker
,fetch
, and other APIs. It is recommended that users try to remove usage of the@lit-labs/ssr
DOM shim, and instead rely on the more minimal, automatic shimming that@lit/reactive-element
now provides automatically.
- Updated dependencies [
72fcf0d7
]:- @lit-labs/[email protected]
- #3507
b152db29
-lit-html
andreactive-element
now include development Node builds with unminified code and dev warnings.
- #3222
486739ec
- FixCSSStyleSheet is not defined
error that would occur when importing a Lit component in Node when both staticstyles
and the@property
decorator were used.
- #3156
ae6f6808
- Lit and its underlying libraries can now be imported directly from Node without crashing, without the need to load the @lit-labs/ssr dom-shim library. Note that actually rendering from a Node context still requires the @lit-labs/ssr dom-shim, and the appropriate integration between @lit-labs/ssr and your framework/tool.
- #3132
2fe2053f
- Added "types" entry to package exports. This tells newer versions of TypeScript where to look for typings for each module.
- #2978
634d4560
- Changed the caching behavior of the css`` template literal tag so that same-text styles do not share a CSSStyleSheet. Note that this may be a breaking change in some very unusual scenarios on Chromium and Firefox > 101 only.
- #2635
ae358703
- Make the event debug logger lazier, doing even less work (with no side effects) even in dev mode unless the page has opted in.
- #2401
2c9d0008
- Added a devlog events system that may be used for debugging and visualizing Lit's internals.
-
#2518
bbbf21d4
- Fix breaking change in the PropertyValues type. Make PropertyValues compatible with Map<string, string> and other Map types. -
#2526
a50d188a
- Export PropertyValueMap such that JavaScript generated by Google Closure Compiler can reference this type. Do not directly import thePropertyValueMap
interface.
-
#2482
6ea3d6c4
- Update the definition of the PropertyValues type to give better types to.get(k)
..get(k)
is now defined to return the correct type when usingPropertyValues<this>
and a parameter that's a key of the element class. -
#2464
df4e1a46
- Fix type signature in queryAssignedNodes JSDoc code example. -
#2457
48d69184
- Add JSDoc to thewillUpdate
lifecycle callback. Expand the docs forfirstUpdated
, andattributeChangedCallback
. Minor code sample fixes.
-
#2370
7453e365
- Replace square bracket links with thelinkcode
JSDoc tag. Editors will create a jump to definition hyperlink for the linkcode tag if the identifier is in scope. -
#2410
b9a6962b
- Correct the link path of CONTRIBUTING.md in README.md files
- #2392
dc3301ce
- Fix@queryAssignedElements
decorator so it is compatible with legacy browsers. UsesHTMLSlotElement.assignedElements
if available with a graceful fallback onHTMLSlotElement.assignedNodes
which is supported by polyfills.
- #2327
49ecf623
- AddqueryAssignedElements
decorator for a declarative API that callsHTMLSlotElement.assignedElements()
on a specified slot.selector
option allows filtering returned elements with a CSS selector.
- #2360
08e7fc56
- Update@queryAssignedNodes
and@queryAssignedElements
documentation for better lit.dev API generation.
- #2338
26e3fb7b
- Deprecate@queryAssignedNodes
API in preference for the new options object API which mirrors the@queryAssignedElements
API. Update the documentation for both@queryAssignedNodes
and@queryAssignedElements
to better document the expected return type annotation.
- #2146
8bb33c88
- Work around a Chrome bug with trusted types: https://crbug.com/993268
- #2236
5fc3818a
- PreventpolyfillSupport.noPatchSupported
from implicitly beingany
. Deduplicate types forDevMode
-suffixed polyfill support functions.
- #2160
90a8c123
- Prevents the dev-mode error about shadowed properties from being thrown in certain cases where the property intentionally has no generated descriptor.
@lit/reactive-element
is a new package that factors out the base class that provides the reactive update lifecycle based on property/attribute changes toLitElement
(what was previously calledUpdatingElement
) into a separate package.LitElement
now extendsReactiveElement
to addlit-html
rendering via therender()
callback. See ReactiveElement API for more details.UpdatingElement
has been renamed toReactiveElement
.- The
updating-element
package has been renamed to@lit/reactive-element
. - The
@internalProperty
decorator has been renamed to@state
. - For consistency, renamed
_getUpdateComplete
togetUpdateComplete
. - When a property declaration is
reflect: true
and itstoAttribute
function returnsundefined
the attribute is now removed where previously it was left unchanged (#872). - Errors that occur during the update cycle were previously squelched to allow subsequent updates to proceed normally. Now errors are re-fired asynchronously so they can be detected. Errors can be observed via an
unhandledrejection
event handler on window. - ReactiveElement's
renderRoot
is now created when the element'sconnectedCallback
is initially run. - Removed
requestUpdateInternal
. TherequestUpdate
method is now identical to this method and should be used instead. - The
initialize
method has been removed. This work is now done in the element constructor.
- Adds
static addInitializer
for adding a function which is called with the element instance when is created. This can be used, for example, to create decorators which hook into element lifecycle by creating a reactive controller (#1663). - Added ability to add a controller to an element. A controller can implement callbacks that tie into element lifecycle, including
hostConnected
,hostDisconnected
,hostUpdate
, andhostUpdated
. To ensure it has access to the element lifecycle, a controller should be added in the element's constructor. To add a controller to the element, calladdController(controller)
. - Added
removeController(controller)
which can be used to remove a controller from aReactiveElement
. - Added
willUpdate(changedProperties)
lifecycle method to UpdatingElement. This is called before theupdate
method and can be used to compute derived state needed for updating. This method is intended to be called during server side rendering and should not manipulate element DOM.
-
#2103
15a8356d
- Updates theexports
field ofpackage.json
files to replace the subpath folder mapping syntax with an explicit list of all exported files.The
/
-suffixed syntax for subpath folder mapping originally used in these files is deprecated. Rather than update to the new syntax, this change replaces these mappings with individual entries for all exported files so that (a) users must import using extensions and (b) bundlers or other tools that don't resolve subpath folder mapping exactly as Node.js does won't break these packages' expectations around how they're imported.
- #2097
2b8dd1c7
- AddsscheduleUpdate()
to control update timing. This should be implemented instead ofperformUpdate()
; however, existing overrides ofperformUpdate()
will continue to work.
- #2072
7adfbb0c
- Remove unneededmatches
support in @queryAssignedNodes. Update styling tests to use static bindings where needed. Fix TODOs related to doc links.
- #2112
61fc9452
- Throws rather than warns in dev mode when an element has a class field that shadows a reactive property. The element is in a broken state in this case.
- #2075
724a9aab
- Ensures dev mode warnings do not spam by taking care to issue unique warnings only once.
- #2065
8b6e2415
- Fixes #2062. To match Lit1 behavior, the @query decorator returns null (rather than undefined) if a decorated property is accessed before first update. Likewise, a @queryAll decorated property returns [] rather than undefined.
- #2043
761375ac
- Update some internal types to avoid castingglobalThis
toany
to retrieve globals where possible.
- #2002
ff0d1556
- Fixes polyfill-support styling issues: styling should be fully applied by firstUpdated/update time; late added styles are now retained (matching Lit1 behavior)
- #2034
5768cc60
- Reverts the change in Lit 2 to pause ReactiveElement's update cycle while the element is disconnected. The update cycle for elements will now run while disconnected as in Lit 1, however AsyncDirectives must now check thethis.isConnected
flag duringupdate
to ensure that e.g. subscriptions that could lead to memory leaks are not made when AsyncDirectives update while disconnected.
- #1918
72877fd
- Changed the caching strategy used in CSSResults returned from the css tag to cache the stylesheet rather than individual CSSResults.
- #1942
c8fe1d4
- For minified class fields on classes in lit libraries, added prefix to stable properties to avoid collisions with user properties.
- #1917
550a218
- Use a brand property instead of instanceof to identify CSSResults to make the checks compatible with multiple copies of the @lit/reactive-element package.
- #1959
6938995
- Changed prefix used for minifying class field names on lit libraries to stay within ASCII subset, to avoid needing to explicitly set the charset for scripts in some browsers.
- #1972
a791514b
- Properties that must remain unminified are now compatible with build tools other than rollup/terser.
-
#2050
8758e06
- Fix syntax highlighting in some documentation examples -
(Since 1.0.0-rc.2) Reverted change of the
css
tag's return to CSSResultGroup, which was a breaking change. Thecss
tag again returns aCSSResult
object. -
(Since 1.0.0-rc.2) Remove the
CSSResultFlatArray
type alias incss-tag.ts
.
Changes below were based on the Keep a Changelog format. All changes above are generated automatically by Changesets.
- (Since 1.0.0-rc.1) [Breaking] Change the type name
Warnings
toWarningKind
#1854.
- (Since 1.0.0-pre.3) A controller's
hostConnected
is called only once if an element is upgraded to a custom element #1731.
- (Since 1.0.0-pre.2) The
createRenderRoot
method is now called only once #1679.
- (Since 1.0.0-pre.1) Adds
static addInitializer
for adding a function which is called with the element instance when is created. This can be used, for example, to create decorators which hook into element lifecycle by creating a reactive controller (#1663). - (Since 1.0.0-pre.1) Added
removeController(controller)
which can be used to remove a controller from aReactiveElement
.
-
(Since 1.0.0-pre.1) A controller's
hostUpdated
method is now called before the host'sfirstUpdated
method (#1650). -
(Since 1.0.0-pre.1) Fixed
@query
decorator when cache flag is used and code is compiled with Babel (#1591). -
(Since 1.0.0-pre.1) Renamed all decorator modules to use kebab-case filename convention rather than camelCase.
-
(Since 1.0.0-pre.1)
ReactiveController
callbacks all now begin withhost
, for examplehostConnected
,hostDisconnected
,hostUpdate
,hostUpdated
. -
(Since 1.0.0-pre.1) If a
Controller
is added after a host element is connected, itsconnected
will be called. -
(Since 1.0.0-pre.1) Removed
willUpdate
fromReactiveController
. -
(Since 1.0.0-pre.1) Renamed
Controller
'sdis/connectedCallback
methods. -
(Since 1.0.0-pre.1) Renamed
Controller
toReactiveController
. -
Made JSCompiler_renameProperty block scoped so that it's inlined in the Terser prod build. Closure should compile from the development build, or after a custom TypeScript compilation.
-
[Breaking] (since 3.0.0-pre1)
UpdatingElement
has been renamed toReactiveElement
. -
[Breaking] (since 3.0.0-pre1) The
updating-element
package has been renamed to@lit/reactive-element
. -
[Breaking] (since 3.0.0-pre1) The
@internalProperty
decorator has been renamed to@state
. -
[Breaking] For consistency, renamed
_getUpdateComplete
togetUpdateComplete
. -
[Breaking] When a property declaration is
reflect: true
and itstoAttribute
function returnsundefined
the attribute is now removed where previously it was left unchanged (#872). -
Errors that occur during the update cycle were previously squelched to allow subsequent updates to proceed normally. Now errors are re-fired asynchronously so they can be detected. Errors can be observed via an
unhandledrejection
event handler on window. -
UpdatingElement's
renderRoot
is now created when the element'sconnectedCallback
is initially run. -
[Breaking] Update callbacks will only be called when the element is connected to the document. If an element is disconnected while an update is pending, or if an update is requested while the element is disconnected, update callbacks will be called if/when the element is re-connected.
-
Console warnings added for removed API and other element problems in developer mode. Some warnings are errors and are always issued while others are optional. Optional warnings can be configured per class via
MyElement.enable/disableWarning
. Making changes in update warns by default and can be toggled viaMyElement.disableWarning('change-in-update)
; migration warnings are off by default and can be toggled viaMyElement.enableWarning('migration')
. -
Added ability to add a controller to an element. A controller can implement callbacks that tie into element lifecycle, including
connectedCallback
,disconnectedCallback
,willUpdate
,update
, andupdated
. To ensure it has access to the element lifecycle, a controller should be added in the element's constructor. To add a controller to the element, calladdController(controller)
. -
Added
willUpdate(changedProperties)
lifecycle method to UpdatingElement. This is called before theupdate
method and can be used to compute derived state needed for updating. This method is intended to be called during server side rendering and should not manipulate element DOM. -
UpdatingElement moved from
lit-element
package toupdating-element
package.
- [Breaking] Removed
requestUpdateInternal
. TherequestUpdate
method is now identical to this method and should be used instead. - [Breaking] The
initialize
method has been removed. This work is now done in the element constructor.
- Fixes an issue with
queryAssignedNodes
when applying a selector on a slot that included text nodes on older browsers not supporting Element.matches #1088.