- #4782
99703a03
- Revert the Terser plugin for Rollup torollup-plugin-terser
from@rollup/plugin-terser
due to a bug that prevented our minified name prefixing from working.
- #4646
abf30b3e
- The value provided by theref()
directive will always beundefined
when the element is disconnected.
-
#4523
1a32b61e
- Add a DEV_MODE error to catch duplicate attribute bindings that otherwise create silent errors. -
#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. -
#4515
dca963f7
- Fix a memory leak when patching directive constructors for SSR.
- #4309
949a5467
- Adds two new types: UncompiledTemplateResult and MaybeCompiledTemplateResult. Currently UncompiledTemplateResult is the same as TemplateResult, and MaybeCompiledTemplateResult is the union of the compiled and uncompiled types.
- #4345
02b8d620
- Add a dev mode warning if a static value such asliteral
orunsafeStatic
is detected within the non-statichtml
tag function. These should only be used with the statichtml
tag function imported fromlit-html/static.js
orlit/static-html.js
.
-
#4240
edf998c9
Thanks @remziatay! - Improved the type inferece of thechoose()
directive to properly restrict the case type inferred from provided value. Note: If this change creates a type error in your code, there must have been an unreachable case that can be removed, or the type of yourvalue
might be missing a valid case in the union. -
#4310
8f674ab3
Thanks @megheaiulian! - Thewhen()
directive now calls the case functions with the provided condition value as an argument. This allows the narrowing of types for the condition value based on its truthiness when used as a parameter for the case function.
-
#3765
92cedaa2
- Remove experimental hydrate modules. These are available from@lit-labs/ssr-client
. -
#3751
dfd747cf
- Simplify lit-html attribute handling for standards-compliant browsers that iterate attributes in source order -
#3750
c3e473b4
- Use toggleAttribute() to simplify boolean attribute parts
-
#3751
dfd747cf
- Simplify lit-html attribute handling for standards-compliant browsers that iterate attributes in source order -
#3750
c3e473b4
- Use toggleAttribute() to simplify boolean attribute parts -
#3765
92cedaa2
- Remove experimental hydrate modules. These are available from@lit-labs/ssr-client
.
- #3993
e2c50569
- Fix return type ofisTemplateResult
helper to include theCompiledTemplateResult
and fix thecache
directive to work correctly withCompiledTemplateResult
s. Also add an explicitisCompiledTemplateResult
helper.
-
#3968
5bb40831
- Allow undefined to be passed to the ref() directive -
#3987
bb2560f1
- Change theh
field ofCompiledTemplate
s to aTemplateStringsArray
preventing the spoofing ofCompiledTemplate
s by JSON injection attacks. This should not be a breaking change for most users unless you're using CompiledTemplates. This is a necessary security fix, similar to #2307.
- #3888
0f30e6fb
- Fix a memory leak cause by lit-html's shared TreeWalker holding a reference to the last tree it walked.
-
#3825
343187b1
-static-html
no longer adds an item toTemplateResult
's value array for the last consumed static value. This fixes an error with server-side rendering of static html. -
#3766
4431cbb8
- Fix styleMap initial render of mixed-case custom props
-
#3720
575fb578
-lit-html/experimental-hydrate.js
andlit-element/experimental-hydrate-support.js
have been moved to@lit-labs/ssr-client
.The modules in the original location have been marked deprecated and will be removed in a future version.
-
#3667
e00f6f52
- [SSR only] Improved how nodes with attribute/property/event/element bindings are rendered in SSR, to avoid adding comments inside of "raw text elements" like<textarea>
. Fixes #3663.Note:
@lit-labs/ssr
andlit-html
must be updated together.
-
#3615
4d698430
- Don't throw inChildPart.parentNode
if theparentNode
is null -
#3583
88a40177
- [SSR only] Add more detail to some hydration errors
- #3526
65e56655
- Disable ShadyDOM noPatch in Node dev build. This fixes the issue of throwing due to undefinedwindow
.
-
#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.
- #3507
b152db29
-lit-html
andreactive-element
now include development Node builds with unminified code and dev warnings.
- #3318
21313077
- Adds anisServer
variable export tolit
andlit-html/is-server.js
which will betrue
in Node andfalse
in the browser. This can be used when authoring components to change behavior based on whether or not the component is executing in an SSR context.
- #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.
-
#3003
daddeb34
- Lit'sasync-directive
now re-exports everything from thedirective
module. -
#3199
0725fdb4
- In DEV_MODE, render a warning instead of rendering a template's host in the template.Most commonly this would happen when rendering
${this}
in a LitElement's template, which has the counterintuitive behavior of removing the element from the DOM, because when rendering the element's template we attach it into its own shadow root, which removes it from the DOM, causing it simply disappear. This is especially problematic with a fast HMR system. -
#3186
3766ae4c
-StaticValue
interface type is now exported.
-
#3130
1f0567f1
- Export the underlying type of thekeyed
directive. -
#3132
2fe2053f
- Added "types" entry to package exports. This tells newer versions of TypeScript where to look for typings for each module.
- #2952
a78cc3b7
- Fix SSR hydration bug relating to and other void elements having attribute bindings.
-
#2828
b3b6bc33
- Remove private Lit 2 migration helpers:INTERNAL
andclearContainerForLit2MigrationOnly
. This logic is no longer depended on.
- #2732
3e181bcb
- Enforce use of file extensions in imports. Fixes an issue with older TypeScript compilers.
-
#2657
a6069c40
- Remove readonly restriction fromStyleInfo
interface as addition, deletion, and updating of styles is valid. ExpandedstyleMap
documentation with links to lit.dev. -
#2642
badc532c
- Add an additional security brand check to StaticValues; Similar to #2307 -
#2691
171143bd
- Fixesref
bug when auto-bound class method used as a callback could incorrectly receiveundefined
. -
#2661
9a3a38cd
- Give a clearer error message when rendering into null/undefined -
#2646
365cd09a
- Clarify that hacking around the template strings array brand error can create security vulnerabilities.
- #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.
-
#2498
2a1dc7a1
- Replace 'rare' with 'invalid' in svg tag function JSDocs. -
#2479
89560520
- Expand JSDocs for thesvg
tagged template literal (TTL). The new documentation makes it more clear that thesvg
tag function should only be used for SVG fragments, and not for the<svg>
HTML element.
-
#2399
5ac025bf
- Correct typo inasync-directive
module comment -
#2410
b9a6962b
- Correct the link path of CONTRIBUTING.md in README.md files
- #2307
221cb0a9
- Added an additional check to prevent spoofing of internal lit types in data bindings.
- #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.
-
The
templateFactory
option ofRenderOptions
has been removed. -
TemplateProcessor
has been removed. -
Symbols are not converted to a string before mutating DOM, so passing a Symbol to an attribute or text binding will result in an exception.
-
The
shady-render
module has been removed and is now part ofplatform-support
, and Lit's polyfill support now adds the following limitations: (1) Bindings in style elements are no longer supported. Previously these could not change and in the future they may be supported via static bindings. (2)ShadyCSS.styleElement
is no longer called automatically. This must be called whenever dynamic changes that affect styling are made that involve css custom property shimming (older browsers) or changes to custom properties used via the deprecated@apply
feature. It was previously called only on first render, and it is now up to the user to decide when this should be called. See Polyfills for more details. -
render()
no longer clears the container it's rendered to. It now appends to the container by default. -
Expressions in comments are no longer rendered or updated. See Valid expression locations for more details.
-
Template caching happens per callsite, not per template-tag/callsize pair. This means some rare forms of highly dynamic template tags are no longer supported.
-
Arrays and other iterables passed to attribute bindings are not specially handled. Arrays will be rendered with their default toString representation. This means that
html`<div class=${['a', 'b']}>
will render<div class="a,b">
instead of<div class="a b">
. To get the old behavior, usearray.join(' ')
. -
Multiple bindings in a single attribute value don't require the attribute value is quoted, as long as there is no whitespace or other attribute-ending character in the attribute value.
html`<div id=${a}-${b}>`
-
The directive and part APIs are significantly different. See Custom Directives and the Upgrade Guide for more details.
-
The
Directive
base class anddirective()
factory function are now exported from thelit-html/directive.js
module. -
NodePart
has been renamed toChildPart
, along with other methods and variables that use the "Node" naming, likePartType.Node
which is nowPartType.CHILD
. -
The part exports (
ChildPart
,AttributePart
, etc) have been change to interface-only exports. The constructors are no longer exported. Directive authors should use helpers indirective-helpers.js
to construct parts. -
The
eventContext
render option has been changed tohost
. -
#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. -
#1764
0b4d6eda
- Don't allow classMap to remove static classes. This keeps classMap consistent with building a string out of the classnames to be applied.
- Added
renderBefore
to render options. If specified, content is rendered before the node given via render options, e.g.{renderBefore: node}
. - Added development mode, which can be enabled by setting the
development
Node exports condition. See Development and production builds for more details. - All usage of
instanceof
has been removed, making rendering more likely to work when multiple instances of the library interact. - Template processing is more robust to expressions in places other than text and attribute values.
render
now returns theChildPart
that was created/updated byrender
.- Added
AsyncDirective
, which is aDirective
subclass whosedisconnected
callback will be called when the part containing the directive is cleared (or transitively cleared by a Part higher in the tree) or manually disconnected using thesetConnected
API, and whosereconnected
callback will be called when manually re-connected usingsetConnected
. When implementingdisconnected
, thereconnected
callback should also be implemented to return the directive to a usable state. Note thatLitElement
will disconnect directives upon element disconnection, and re-connect directives upon element re-connection. See Async directives for more details. - Added
setConnected(isConnected: boolean)
toChildPart
; when called withfalse
, thedisconnected
callback will be run on any directives contained within the part (directly or transitively), but without clearing or causing a re-render to the tree. When called withtrue
, any such directives'reconnected
callback will be called prior to its nextupdate
/render
callbacks. Note thatLitElement
will call this method by default on the rendered part in itsconnectedCallback
anddisconnectedCallback
. - Added the
static-html
module, a statichtml
tag function, aliteral
tag function, andunsafeStatic()
, which allows template authors to add strings to the static structure of the template, before it's parsed as HTML. See Static expressions for more details. - Added
lit-html/directive-helpers.js
module with helpers for creating custom directives. See Custom directives for more details. - Rendering
null
,undefined
, or empty string in aChildPart
now has the same affect as renderingnothing
: it does not produce an empty text node. When rendering into an element with Shadow DOM, this makes it harder to inadvertently prevent<slot>
fallback content from rendering. - Nested directives whose parent returns
noChange
are now unchanged. This allows theguard
directive to guard directive values (#1519). - Added optional
creationScope
toRenderOptions
, which controls the node from which the template is cloned from. - Added support for running with Trusted Types enforced.
-
#1922
8189f094
- BindingnoChange
into an interpolated attribute expression now no longer removes the attribute on first render - instead it acts like an empty string. This is mostly noticable when usinguntil()
without a fallback in interpolated attributes.
-
#2070
a48f39c8
- Throw instead of rendering an innocuous value into a style or script when security hooks are enabled. -
#2044
662209c3
- Improves disconnection handling for first-partyAsyncDirective
s (until
,asyncAppend
,asyncReplace
) so that the directive (and any DOM associated with it) can be garbage collected before any promises they are awaiting resolve.
- #2098
b3121ab7
- Fix ChildPart parentNode for top-level parts to return the parentNode they will be inserted into, rather than the DocumentFragment they were cloned into. Fixes #2032.
-
#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.
- #2074
d6b385e3
- (Cleanup) Added missing tests to close out TODOs in the code. FixedunsafeHTML
andunsafeSVG
to render no content (empty string) for valuesundefined
,null
, andnothing
.
- #1922
8189f094
- BindingnoChange
into an interpolated attribute expression now no longer removes the attribute on first render - instead it acts like an empty string. This is mostly noticable when usinguntil()
without a fallback in interpolated attributes.
- #2114
b4bd9f7c
- Parts are not supported inside thetemplate
ortextarea
tags. In dev mode, we indicate if parts are placed here so the developer can remove them.
- #2072
7adfbb0c
- Remove unneededmatches
support in @queryAssignedNodes. Update styling tests to use static bindings where needed. Fix TODOs related to doc links.
- #1764
0b4d6eda
- Don't allow classMap to remove static classes. This keeps classMap consistent with building a string out of the classnames to be applied.
- #2070
a48f39c8
- Throw instead of rendering an innocuous value into a style or script when security hooks are enabled.
- #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.
- #2046
043a16fb
- In development mode, constructing anEventPart
from an improperly formed attribute will now throw: the attribute must contain only a single expression and the surrounding two strings must be the empty string. Before, constructing anEventPart
with extra expressions or surrounding text would cause that part to be silently and incorrectly treated as anAttributePart
.
- #2043
761375ac
- Update some internal types to avoid castingglobalThis
toany
to retrieve globals where possible.
- #1959
69389958
- Changed all prefixes used for minifying object and class properties from greek characters to ASCII, to avoid requiring an explicit script charset on some browser/webview environments.
- #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.
- #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.
- #1991
f05be301
- Fixed bug where Template.createElement was not patchable by polyfill-support when compiled using closure compiler, leading to incorrect style scoping.
- #1990
56e8efd3
- Fixed an error thrown when an empty<style></style>
tag is rendered while using the @apply shim under native Shadow DOM.
- #2044
662209c3
- Improves disconnection handling for first-partyAsyncDirective
s (until
,asyncAppend
,asyncReplace
) so that the directive (and any DOM associated with it) can be garbage collected before any promises they are awaiting resolve.
- #1972
a791514b
- Properties that must remain unminified are now compatible with build tools other than rollup/terser.
Changes below were based on the Keep a Changelog format. All changes above are generated automatically by Changesets.
- Exported the
Ref
interface.
- Add dependency on trustedtypes typings.
- Added
defer-hydration
attribute handling toexperimental-hydrate
, which helps coordinate ordered wakeup of custom elements during hydration. - Added support for running with Trusted Types enforced.
- (Since 2.0.0-pre.7) Renamed
hydrate
module toexperimental-hydrate
to reflect its experimental nature. Experimental modules may undergo breaking changes within otherwise non-major releases.
- Added optional
creationScope
toRenderOptions
, which controls the node from which the template is cloned from. - (Since 2.0.0-pre.6) Reintroduced the
SVGTemplateResult
type. (#1623)
-
@apply
now functions correctly under native Shadow DOM when template parts are used. (#1739). -
styleMap()
now removes properties if the value is set toundefined
ornull
, as opposed to not being a property of the style object. (#1665).
- (Since 2.0.0-pre.4) Added
asyncappend
andasyncReplace
directives.
- Nested directives whose parent returns
noChange
are now unchanged. This allows theguard
directive to guard directive values (#1519).
- (Since 2.0.0-pre.4) Removes second
klass
argument fromisDirectiveResult
since it is generally not version-agnostic to test directives usinginstanceof
. A newgetDirectiveClass
helper is introduced, which allows for directive class branding checks instead. - (Since 2.0.0-pre.4)
DisconnectableDirective
was renamed toAsyncDirective
, and its module name was renamed fromdisconnectable-directive
toasync-directive
. - (Since 2.0.0-pre.4) Rendering
null
,undefined
, or empty string in aChildPart
now has the same affect as renderingnothing
: it does not produce an empty text node. When rendering into an element with Shadow DOM, this makes it harder to inadvertently prevent<slot>
fallback content from rendering. - (Since 2.0.0-pre.4)
DisconnectableDirective
'sdisconnectedCallback
andreconnectedCallback
were renamed todisconnected
andreconnected
. - (Since 2.0.0-pre.4) Renamed
platform-support
topolyfill-support
.
-
render
now returns theNodePart
that was created/updated byrender
. -
Added
DisconnectableDirective
, which is aDirective
subclass whosedisconnectedCallback
will be called when the part containing the directive is cleared (or transitively cleared by a Part higher in the tree) or manually disconnected using thesetConnected
API, and whosereconnectedCallback
will be called when manually re-connected usingsetConnected
. When implementingdisconnectedCallback
,reconnectedCallback
should also be implemented to return the directive to a usable state. Note thatLitElement
will disconnect directives upon element disconnection, and re-connect directives upon element re-connection. -
Added
setConnected(isConnected: boolean)
toNodePart
; when called withfalse
,disconnectedCallback
will be run on any directives contained within the part (directly or transitively), but without clearing or causing a re-render to the tree. When called withtrue
, any such directives'reconnectedCallback
will be called prior to its nextupdate
/render
callbacks. Note thatLitElement
will call this method by default on the rendered part in itsconnectedCallback
anddisconnectedCallback
. -
Added
unsafeStatic()
, which allows template authors to add strings to the static structure of the template, before it's parsed as HTML. -
Added
isPrimitive()
,isTemplateResult()
, andisDirectiveResult()
tolit-html/directive-helpers.js
.
-
Directives that asynchronously update their part value must now extend
DisconnectableDirective
and callthis.setValue()
, a new API exposed on theDisconnectableDirective
class. Directives that render synchronously to theirupdate
lifecycle should simply return the value to be committed to their part fromupdate
/render
. -
The
Directive
base class anddirective()
factory function are now exported from thelit-html/directive.js
module. -
(since 2.0.0-pre.3) The Part type constants (
NODE_PART
, etc) are removed from the mainlit-html
module and exported as an enum-object namedPartType
fromlit-html/directive.js
. UsePartType.NODE
instead ofNODE_TYPE
. -
(since 2.0.0-pre.3))
lit-html/parts.js
has been renamed tolit-html/directive-helpers.js
. -
(since 2.0.0-pre.3)) Originally in
lit-html/parts.js
,createAndInsertPart()
andinsertPartBefore()
have been combined into a singleinsertPart()
function inlit-html/directive-helpers.js
.detachNodePart()
andrestoreNodePart()
have been removed in favor of moving parts withinsertPart()
. -
(since 2.0.0-pre.3)
NodePart
has been renamed toChildPart
, along with other methods and variables that use the "Node" naming, likePartType.Node
which is nowPartType.CHILD
. -
(since 2.0.0-pre.3) The
DirectiveClass
,DirectiveParameters
andPartInfo
types have been moved fromlit-html
tolit-html/directive.ts
. -
(since 2.0.0-pre.3) The part exports (
ChildPart
,AttributePart
, etc) have been change to interface-only exports. The constructors are no longer exported. Directive authors should use helpers indirective-helpers.js
to construct parts. -
(since 2.0.0-pre.3) The
setPartValue
function indirective-helpers.js
has been renamed tosetChildPartValue
and now only supports ChildParts. Directives that require updating their container part outside therender
/update
lifecycle should extendDisconnectableDirective
and usethis.setValue()
. -
(since 2.0.0-pre.3) The
eventContext
render option has been changed tohost
.
- The
shady-render
module has been removed and is now part ofplatform-support
. There are also a couple of breaking changes. (1) Bindings in style elements are no longer supported. Previously these could not change and in the future they may be supported via static bindings. (2)ShadyCSS.styleElement
is no longer called automatically. This must be called whenever dynamic changes that affect styling are made that involve css custom property shimming (older browsers) or changes to custom properties used via the deprecated@apply
feature. It was previously called only on first render, and it is now up to the user to decide when this should be called. render()
no longer clears the container it's rendered to. It now appends to the container by default.- Expressions in comments are not rendered or updated.
- Template caching happens per callsite, not per template-tag/callsize pair. This means some rare forms of highly dynamic template tags are no longer supported.
- Arrays and other iterables passed to attribute bindings are not specially handled. Arrays will be rendered with their default toString representation. This means that
html`<div class=${['a', 'b']}>
will render<div class="a,b">
instead of<div class="a b">
. To get the old behavior, usearray.join(' ')
. - Multiple bindings in a single attribute value don't require the attribute value is quoted, as long as there is no whitespace or other attribute-ending character in the attribute value.
html`<div id=${a}-${b}>
- The directive and part APIs are significantly different. See the README for more details.
- Added
renderBefore
to render options. If specified, content is rendered before the node given via render options, e.g.{renderBefore: node}
. - Added development mode, which can be enabled by setting the
development
Node exports condition. SeeREADME.md
for more details.
- All usage of
instanceof
has been removed, making rendering more likely to work when multiple instances of the library interact. - Template processing is more robust to expressions in places other than text and attribute values.
- The
templateFactory
option ofRenderOptions
has been removed. - TemplateProcessor has been removed.
- Symbols are not converted to a string before mutating DOM, so passing a Symbol to an attribute or text binding will result in an exception.
- The
asyncAppend
andasyncReplace
directives are not implemented.
- Set the "type" field in package.json to "module. (#1146)
- Added support for Trusted Types. This support uses a policy named 'lit-html' for parsing the static parts of html literals, and ensures that we pass trusted type values through to the DOM when used in bindings. (#1153)
- Export the
shadyTemplateFactory
fromlib/shady-render.js
(#1135)
- Added 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
unsafeSVG
directive to bind SVG source inside SVGs. (#304) - Added
templateContent()
directive for stamping out the contents of an HTML template into a text binding. (#1058) - Added the
live()
directive. (#877)
- Fixed a bug where
classMap
andstyleMap
directives wouldn't render mutated objects. (#972) - Fixed a bug where ifDefined() would set an attribute even when the value didn't change. (#890)
- Change
classMap
directive to set classes correctly on SVGs (#1070).
- Fixed a bug where bindings in comments could be written as text in some cases. (#926)
render
andshady-render
now both accept any value that is renderable byNodePart
. (#910)
- Many small performance enhancements.
- Private names are now named with a
__
prefix (#859).
- Setup continuous benchmarking with Tachometer (#887).
- Prevent empty styles from causing exceptions or breaking rendering when using
shady-render
(#760). - Primitive values in attributes are now always simply stringified, regardless of whether they are iterable. (#830)
- Adopt and upgrade template fragments after processing for parts (#831).
- Fixed bindings with attribute-like expressions preceeding them (#855).
- Fixed errors with bindings in HTML comments (#882).
- Tons of docs updates (#746), (#675), (#724), (#753), (#764), (#763), (#765), (#767), (#768), (#734), (#771), (#766), (#773), (#770), (#769), (#777), (#776), (#754), (#779)
- Global version of
lit-html
on window (#790).
- Removed use of
any
outside of test code (#741).
- Performance improvements to template processing. (#690)
- Added the
nothing
sentinel value which can be used to clear a part. (#673)
- Fixed #702: a bug with the
unsafeHTML
directive when changing between unsafe and other values. (#703) - Fixed #708: a bug with the
until
directive where placeholders could overwrite resolved Promises. (#721)
- Documentation updates.
- Fixed typing for template_polyfill
createElement
call.
until()
can now take any number of sync or async arguments. (#555)guard()
supports multiple dependencies. If the first argument toguard()
is an array, the array items are checked for equality to previous values. (#666)- Renamed
classMap.js
andstyleMap.js
files to kebab-case. (#644)
- Added
cache()
directive. (#646) - Removed Promise as a supposed node-position value type. (#555)
- Added a minimal
<template>
polyfill.
- Removed the
when()
directive. Users may achieve similar behavior by wrapping a ternary with thecache()
directive.
- Bound attribute names are rewritten to avoid IE/Edge removing SVG and style attributes. (#640)
- Ensure shady-render prepares styling for a scope before attaching child elements. (#664)
- Handle CSS Custom Variables in the styleMap directive. #642)
- Directives are now defined by passing the entire directive factory function to
directive()
. (#562)
- Fix issue on obscure browsers that do not accept event listener objects by using callback as event part listener (#581)
- Fix KeyFn and ItemTemplate types (#570)
- Don't use export * to workaround rollup bug (#556)
eventContext
is no longer used as thethis
value for event listener objects (object with ahandleEvent
method), as the object itself is supposed to be thethis
value. (#576)
- Re-implemented repeat directive for better performance (#501)
- Updated TypeScript dependency to 3.1
render()
now takes an options object as the third argument. (#523)
- Event listeners are called with a configurable
this
reference, which is set via theeventContext
option torender()
. (#523) - Support for event listener options, by passing the listener itself as both the second and third arguments to add/removeEventListener().
- Moved upgrading of custom elements in template fragments to a common location in TemplateInstance (#489)
- Rewrite render() to reuse the logic in NodePart. render() now supports all the data types that NodeParts do. (#491)
- Fixed bug when using the ShadyCSS @apply` shim. (#502)
- Added
classMap
andstyleMap
directives (#486)
- Fixed bug in asyncReplace when rerendering the same iterable (#485)
- Update properties before upgrading custom elements (#455)
- Cache the ShadyCSS version lookup (#477)
- Eliminated a cycle in the module import graph (#472)
- Remove the default value for the templateProcessor parameter in TemplateResult#constuctor, making it a required parameter (#472)
- Added support for property, event, and boolean bindings to default syntax (#398)
- Added guard directive (#438)
- Added when directive (#439)
- Split implementation into multiple small modules and merged lit-html.js and core.js (#436)
- Moved directives into top-level
directives/
directory (#436) - Replaced
PartCallback
withTemplateProcessor
(#405) - Unified
NodePart
andAttributePart
interfaces (#400)- AttributePart#setValue() takes a single value
Part
has separatesetValue()
andcommit()
phases- Added
AttributeCommitter
to commit attribute values once for multipleAttributeParts
- Removed lit-extended.js (#436)
- Render initial undefined values in attributes (#377)
- Handle case-sensitive attributes like
viewBox
correctly (#376) - Support bindings in
<template>
elements (#343) - Don’t break templates when HTML comments have bindings in them (#446)
- IE: Don't use Set() constructor arguments (#401)
- Handle forms as Node instead of iterable (#404)
- Update values after upgrading custom elements (#385)
- Dirty check primitive values passed to unsafeHTML() (#384)
- Handle forms as Node instead of iterable (#404)
- Upgrade disconnected custom elements before setting properties on them. (#442)
- Fix style attribute bindings in IE (#448)
- Added
noChange
- Value in favour ofdirectiveValue
(deprecated).- A
noChange
- Value signals that a value was handled by a directive and should not be written to the DOM
- A
- Updated shady-render to render styles in order, work with
@apply
, and work in browers where CSS Custom Properties must be polyfilled, like IE 11. - Introduced API to modify template contents safely without breaking template parts
insertNodeIntoTemplate(template: Template, node: Node, refNode: Node|null)
removeNodesFromTemplate(template: Template, nodesToRemove: Set<Node>)
- Added IE11 support
- Declarative events in lit-extended are more efficient when handlers change
- Refactored how template tags and
render()
are implemented so that all specialization of template syntax is done in tags, notrender()
, allowing for the mixing-in of templates of different syntaxes, and for hooks inrender()
to change templates before they're initially processed. - Added ShadyCSS support in lib/shady-render.js. It's exported render function
will pass templates to ShadyCSS's
prepareTemplate()
function to process style tags and elements in the template for emulate CSS scoping. - lit-extended: Attribute bindings with a
?
suffix on the name now act as boolean attributes. The attribute will be removed for falsey values and set to''
for truthy values, matching the HTML specification behavior for boolean attributes. - Fixed a bug where directives rendered incorrectly on AttributeParts and PropertyParts
- Allow all valid HTML attribute names, including emoji and Angular-style
(foo)=
and[foo]=
names. - Drastically improved performance of the
repeat
directive. - Fixed an issue with expressions directly following elements.
- Fixed numerous bugs with the
repeat
directive. - Performance improvements for template setup
- Internal code cleanup
- Support synchronous thenables
- Added the
asyncAppend
andasyncReplace
directives to handle async iterable values in expressions.
- Added the
svg
template tag for creating partial SVG content - Support for expressions inside tables and other elements with limited permitted content
- Only remove whitespace between elements, or at the start or end of elements
- Fixed bugs with rendering iterables
- A few IE/Edge fixes. Closer to full support.
- Fixed removing event handlers when setting them to
undefined
. - Allow the text "{{}}" to appear in templates.
- Optimized clearing of Parts.
- Added
unsafeHTML()
directive to bind values as HTML source. - Optimizations, simplification and bug fixes of Array handling code.
- Update to extension API: added partCallback parameter to
render()
. - Added the
directive()
decorator function to create directives. Functions values are no longer treated as directive by default, simplifying declarative event handlers.