- #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.
- #2401
2c9d0008
- Added a devlog events system that may be used for debugging and visualizing Lit's internals.
- Updated dependencies [
2c9d0008
]:- lit-html@2.2.0
- @lit/reactive-element@1.3.0
-
#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
- #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.
- Updated dependencies [
08e7fc56
,fcc2b3d0
,eb5c5d2b
,49ecf623
,26e3fb7b
,d319cf5f
,1d563e83
,221cb0a9
]:- @lit/reactive-element@1.1.0
- lit-html@2.1.0
- #2236
5fc3818a
- PreventpolyfillSupport.noPatchSupported
from implicitly beingany
. Deduplicate types forDevMode
-suffixed polyfill support functions.
-
Most users should no longer import directly from
lit-element
, and instead prefer importingLitElement
from thelit
packages. The default entry point forlit-element
remains backward-compatible and includes all decorators. However, it's recommended to useimport {LitElement} from 'lit';
and import decorators fromlit/decorators
as necessary. See the Upgrade Guide for more details. -
UpdatingElement
has been moved from thelit-element
package to the@lit/reactive-element
package and renamed toReactiveElement
. See the ReactiveElement API documentation for more details. In addition, the source forcss-tag
, and alldecorators
have been moved to@lit/reactive-element
. However, all symbols are re-exported from bothlit
andlit-element
packages. -
The
@internalProperty
decorator has been renamed to@state
. -
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. -
The
lib
folder has been removed. -
Rendering of
renderRoot
/shadowRoot
) viacreateRenderRoot
and support forstatic styles
has moved fromLitElement
toReactiveElement
. -
The
createRenderRoot
method is now called just before the first update rather than in the constructor. Element code can not assume therenderRoot
exists before the elementhasUpdated
. This change was made for compatibility with SSR. -
ReactiveElement
'sinitialize
method has been removed. This work is now done in the element constructor. -
The static
render
has been removed. -
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). -
The dirty check in
attributeChangedCallback
has been removed. While technically breaking, in practice it should very rarely be (#699). -
LitElement's
adoptStyles
method has been removed. Styling is now adopted increateRenderRoot
. This method may be overridden to customize this behavior. -
LitElement's
static getStyles
method has been renamed tostatic finalizeStyles
and now takes a list of styles the user provided and returns the styles which should be used in the element. If this method is overridden to integrate into a style management system, typically thesuper
implementation should be called. -
Removed build support for TypeScript 3.4.
-
Decorators are no longer exported from the
lit-element
module. Instead, import any decorators you use fromlit/decorators/*
. -
lit-html
has been updated to 2.x. -
Support for running in older browsers has been removed from the default configuration. Import the
polyfill-support
module to support Shady DOM. Note also that Lit parts inside<style>
elements are no longer supported. See Polyfills for more details. -
For simplicity,
requestUpdate
no longer returns a Promise. Instead await theupdateComplete
Promise. -
Removed
requestUpdateInternal
. TherequestUpdate
method is now identical to this method and should be used instead. -
#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.
- A public
renderOptions
class field now exists onLitElement
and can be set/overridden to modify the options passed tolit-html
. - Adds
static shadowRootOptions
for customizing shadowRoot options. Rather than implementingcreateRenderRoot
, this property can be set. For example, to create a closed shadowRoot using delegates focus:static shadowRootOptions = {mode: 'closed', delegatesFocus: true}
. - Adds development mode, which can be enabled by setting the
development
Node exports condition. See Development and production builds for more details.
- #1964
f43b811
- Don't publish src/ to npm. - For efficiency, the
css
function now maintains a cache and will use a cached value if available when the same style text is requested. - Fixed reflecting a property when it is set in a setter of another property that is called because its attribute changed (#965).
- Fixed exceptions when parsing attributes from JSON (#722).
- Fixed issue with combining
static get properties
on an undefined superclass with@property
on a subclasss ([#890]lit/lit-element#890));
-
#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.
- #2072
7adfbb0c
- Remove unneededmatches
support in @queryAssignedNodes. Update styling tests to use static bindings where needed. Fix TODOs related to doc links.
- #2075
724a9aab
- Ensures dev mode warnings do not spam by taking care to issue unique warnings only once.
- #2056
e5667d66
- Fixed issue whereAsyncDirective
s could seethis.isConnected === true
if a LitElement performed its initial render while it was disconnected.
- #2043
761375ac
- Update some internal types to avoid castingglobalThis
toany
to retrieve globals where possible.
- #1942
c8fe1d4
- For minified class fields on classes in lit libraries, added prefix to stable properties to avoid collisions with user properties.
- #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. -
Updated dependencies [
ff0d1556
,5768cc60
,69389958
,5fabe2b5
,52a47c7e
,5fabe2b5
,5fabe2b5
,5fabe2b5
,f05be301
,5fabe2b5
,56e8efd3
,662209c3
,a791514b
,5fabe2b5
]:- lit-html@2.0.0-rc.4
Changes below were based on the Keep a Changelog format. All changes above are generated automatically by Changesets.
- (Since 3.0.0-rc.1) Improves support for customizing
observedAttributes
by ensuring thatReactiveElement.observedAttributes
is callable, allowing mixins to directly reference it (#1835).
- Added
defer-hydration
attribute handling toexperimental-hydrate-support
, which helps coordinate ordered wakeup of custom elements during hydration.
- (Since 3.0.0-pre.4) Renamed
hydrate-support
module toexperimental-hydrate-support
to reflect its experimental nature. Experimental modules may undergo breaking changes within otherwise non-major releases.
- (Since 3.0.0-pre.3) The
renderOptions
class field onLitElement
is now public.
-
(Since 3.0.0-pre.2) Renamed all decorator modules to use kebab-case filename convention rather than camelCase.
-
(Since 3.0.0-pre.2) Renamed
platform-support
topolyfill-support
. -
(Since 3.0.0-pre.2) Changed a new
index.js
file as the package entrypoint to export the main export plus the decorators again. This undoes a breaking change in 3.0.0-pre.1 which moved the decorators todecorators.js
.This new file is an upgrade helper: it's more backwards compatible, but immediately deprecated. It's recommended to import from
'lit-element/lit-element.js'
or the newlit
package withimport {LitElement} from 'lit';
.
- [Breaking] Update and render 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.
- [Breaking]
UpdatingElement
has been renamed toReactiveElement
. - [Breaking] The
updating-element
package has been renamed to@lit/reactive-element
. - [Breaking] The
@internalProperty
decorator has been renamed to@state
. - [Breaking] 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. - [Breaking]
UpdatingElement
has been moved to its own package. Theupdating-element
,css-tag
, and alldecorators
have moved to theupdating-element
package. For convenience, all decorators are re-exported inLitElement
atlit-element/decorators
andlit-element/decorators/*
. - [Breaking] The
lib
folder has been removed. - [Breaking] Rendering of
renderRoot
/shadowRoot
) viacreateRenderRoot
and support forstatic styles
has moved fromLitElement
toUpdatingElement
. - [Breaking] The
createRenderRoot
method is now called just before the first update rather than in the constructor. Element code can not assume therenderRoot
exists before the elementhasUpdated
. This change was made for compatibility with SSR. - [Breaking]
UpdatingElement
'sinitialize
method has been removed. This work is now done in the element constructor. - [Breaking] The static
render
has been removed. - [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). - [Breaking] The dirty check in
attributeChangedCallback
has been removed. While technically breaking, in practice it should very rarely be (#699). - [Breaking] LitElement's
adoptStyles
method has been removed. Styling is now adopted increateRenderRoot
. This method may be overridden to customize this behavior. - [Breaking] LitElement's
static getStyles
method has been renamed tostatic finalizeStyles
and now takes a list of styles the user provided and returns the styles which should be used in the element. If this method is overridden to integrate into a style management system, typically thesuper
implementation should be called. - [Breaking] Removed build support for TypeScript 3.4.
- [Breaking] Decorators are no longer exported from the
lit-element
module. Instead, import any decorators you use fromlit-element/decorators/*
. - [Breaking]
lit-html
has been updated to 2.x. - [Breaking] Support for running in older browsers has been removed from the default configuration. Import the
platform-support
module to support Shady DOM. Note also that Lit parts inside<style>
elements are no longer supported. - [Breaking] For simplicity,
requestUpdate
no longer returns a Promise. Instead await theupdateComplete
Promise. - [Breaking] The type of the
css
function has been changed toCSSResultGroup
and is now the same asLitElement.styles
. This avoids the need to cast thestyles
property toany
when a subclass setsstyles
to an Array and its super class set a single value (or visa versa). - For efficiency, the
css
function now maintains a cache and will use a cached value if available when the same style text is requested.
- Console warnings added for removed API and other element problems in developer mode.
- Adds
static shadowRootOptions
for customizing shadowRoot options. Rather than implementingcreateRenderRoot
, this property can be set. For example, to create a closed shadowRoot using delegates focus:static shadowRootOptions = {mode: 'closed', delegatesFocus: true}
. - Adds development mode, which can be enabled by setting the
development
Node exports condition. SeeREADME.md
for more details.
- [Breaking] Removed
requestUpdateInternal
. TherequestUpdate
method is now identical to this method and should be used instead.
- Fixed reflecting a property when it is set in a setter of another property that is called because its attribute changed (#965).
- Fixed exceptions when parsing attributes from JSON (#722).
- Fixed issue with combining
static get properties
on an undefined superclass with@property
on a subclasss ([#890]lit/lit-element#890));
- Set type in package.json to "module" (#974)
- Adds a
cache: boolean
argument to the@query
decorator as a performance optimization for properties whose queried element is not expected to change. If cache is set to true, element DOM is queried when the property is first accessed, and the value is cached so it can be immediately returned on all subsequent property accesses. (#1013) - Adds a
selector: string
argument to the@queryAssignedNodes
decorator as a convenience to filter the assigned nodes by the given selector (#1016). - The
requestUpdateInternal(name, oldValue, options)
method has been added. This method is sometimes useful to call in a custom property setter to optimize performance. It is slightly more efficient thanrequestUpdate
since it does not return theupdateComplete
property which can be overridden to do work. - The protected
performUpdate()
method may now be called to syncronously "flush" a pending update, for example via a property setter. Note, performing a synchronous update only updates the element and not any potentially pending descendants in the element's local DOM (#959). - Constructible stylesheets may now be provided directly as styles, in addition to using the
css
tagged template function (#853).
- queryAssignedNodes doesn't correctly locate default slot (#1002)
- Add TypeScript type declarations for older versions of TypeScript. We're currently testing back to TS 3.4. We can't commit to never breaking TypeScript builds, but we'll be supporting older versions as best we can.
- Added a static
getPropertyDescriptor
method to allow easier customization of property accessors. This method should return a aPropertyDescriptor
to install on the property. If no descriptor is returned, no property accessor is created. (#911) - The value returned by
render
is always rendered, even if it isn't aTemplateResult
. (#712)
- Added
@queryAsync(selector)
decorator which returns a Promise that resolves to the result of querying for the given selector after the element'supdateComplete
Promise resolves (#903). - Added
enableUpdating()
toUpdatingElement
to enable customizing when updating is enabled #860. - Added
@queryAssignedNodes(slotName, flatten)
decorator to enable querying assignedNodes for a given slot #860. - Added
getStyles()
toLitElement
to allow hooks into style gathering for component sets #866. - Added
@internalProperty(options)
decorator to define properties internal to an element. #881.
- Ensure
UpdatingElement
allows updates when properties are set after callingsuper.update()
.LitElement
renders when updates are triggered as a result of rendering (#549). - Properties annotated with the
eventOptions
decorator will now survive property renaming optimizations when used with tsickle and Closure JS Compiler. - Moved style gathering from
finalize
toinitialize
to be more lazy, and create stylesheets on the first instance initializing #866. - Fixed behavior change for components that do not implement
render()
introduced in (#712) (#917)
- Elements should now override the new
_getUpdateComplete
method instead of theupdateComplete
getter, for compatibility with TypeScript ES5 output, which does not support calling a superclass getter (e.g.super.updateComplete.then(...)
) due to TypeScript#338.
- Fixed compatibility with Closure JS Compiler optimizations relating to static properties (#732).
- css tagged template literals now allow numbers to be used in expressions (#488).
LitElement.renderRoot
is nowpublic readonly
instead ofprotected
.
- Exceptions generated during update/render do not block subsequent updates (#262).
- Initial update is scheduled at construction time rather than connected time (#594).
- A reflecting property set immediately after a corresponding attribute now reflects properly (#592).
- Properties annotated with the
@query
and@queryAll
decorators will now survive property renaming optimizations when used with tsickle and Closure JS Compiler.
- Use
lit-html
1.0 (#543).
- [Breaking] Renamed
unsafeCss
tounsafeCSS
for consistency with lit-html'sunsafeHTML
(#524) - Remove all uses of
any
outside of tests (#457)
- A bunch of docs fixes (#464), (#458), (#493), (#504), (#505), (#501), (#494), (#491), (#509), (#513), (#515), (#512), (#503), (#460), (#413), (#426), (#516), (#537), (#535), (#539), (#540)
- Build on checkout (#423)
- Adds a check to ensure
CSSStyleSheet
is constructable (#527).
- Fixed a bug causing duplicate styles when an array was returned from
static get styles
(#480).
- [Maintenance] Added script to publish dev releases automatically (#476).
- Adds
unsafeCss
for composing "unsafe" values intocss
. Note,CSSResult
is no longer constructable. (#451 and #471).
- Fixed a bug where we broke compatibility with closure compiler's property renaming optimizations. JSCompiler_renameProperty can't be a module export (#465).
- Fixed an issue with inheriting from
styles
property when extending a superclass that is never instanced. (#470). - Fixed an issue with Closure Compiler and (#470) (#476).
- README: Fixed jsfiddle reference (#435).
- Compile with Closure Compiler cleanly (#436).
- Opt
@property
decorators out of Closure Compiler renaming (#448).
- [Breaking] Property accessors are no longer wrapped when they already exist. Instead the
noAccessor
flag should be set when a user-defined accessor exists on the prototype (and in this case, user-defined accessors must callrequestUpdate
themselves). (#454). - Class fields can now be used to define styles, e.g.
static styles = css
andstyles
correctly compose when elements are extended (#456). - Styles returned via
static styles
are automatically flattend (#437). - Replace use of for/of loops over Maps with forEach (#455)
- Fix references to
@polymer/lit-element
in README and docs (#427). - Fix decorator types causing compiler errors for TypeScript users. (#431).
- [Breaking] Changed NPM package name to
lit-element
- Updated decorator implementations to support TC39 decorator API proposal (supported by Babel 7.1+) in addition to the legacy decorator API (supported by older Babel and TypeScript) (#156).
- Added
static get styles()
to allow defining element styling separate fromrender
method. This takes advantage ofadoptedStyleSheets
when possible (#391). - Added the
performUpdate
method to allow control of update timing (#290). - Updates deferred until first connection (#258).
- Export
TemplateResult
andSVGTemplateResult
(#415).
- [Breaking] The
createRenderRoot
method has moved fromUpdatingElement
toLitElement
. Therefore,UpdatingElement
no longer creates ashadowRoot
by default (#391). - [Breaking] Changes property options to add
converter
. This option works the same as the previoustype
option except that theconverter
methods now also gettype
as the second argument. This effectively changestype
to be a hint for theconverter
. A defaultconverter
is used if none is provided and it now supportsBoolean
,String
,Number
,Object
, andArray
(#264). - [Breaking] Numbers and strings now become null if their reflected attribute is removed (lit/lit-element#264)).
- [Breaking] Previously, when an attribute changed as a result of a reflecting property changing, the property was prevented from mutating again as can happen when a custom
converter
is used. Now, the oppose is also true. When a property changes as a result of an attribute changing, the attribute is prevented from mutating again (lit/lit-element#264))
- [Breaking] User defined accessors are now wrapped to enable better composition (#286)
- Type for
eventOptions
decorator now properly includespassive
andonce
options (#325)
- Use lit-html 1.0 release candidate.
- Update lit-html dependency to ^0.14.0 (#324).
- Update lit-html dependency to ^0.13.0 (#298).
- LitElement changed to a non-abstract class to be more compatible with the JavaScript mixin pattern (#227).
- Update lit-html dependency to ^0.12.0 (#244).
- Passes the component's
this
reference to lit-html as theeventContext
, allowing unbound event listener methods (#244).
- A
disconnectedCallback()
method was added to UpdatingElement (#213). - Added
@eventOptions()
decorator for setting event listener options on methods (#244).
- Fixes part rendering and css custom properties issues introduced with lit-html 0.11.3 by updating to 0.11.4 (lit/lit-element#202).
- Removed custom_typings for Polymer as they are no longer needed (lit/lit-element#186).
- Added
@query()
,@queryAll()
, and@customElement
decorators (#159)
- Significantly changed update/render lifecycle and property API. Render lifecycle
is now
requestUpdate
,shouldUpdate
,update
,render
,firstUpdated
(first time only),updated
,updateComplete
. Property options are now{attribute, reflect, type, hasChanged}
. Properties may be defined in astatic get properties
or using the@property
decorator. (lit/lit-element#132).
- Removed render helpers
classString
andstyleString
. Similar directives (classMap
andstyleMap
) have been added to lit-html and should be used instead (lit/lit-element#165 and #486).
- The
npm run checksize
command should now return the correct minified size (lit/lit-element#153). - The
firstUpdated
method should now always be called the first time the element updates, even ifshouldUpdate
initially returnedfalse
(lit/lit-element#173).