Skip to content

Commit

Permalink
Merge lit-html-1.x into security (#1829)
Browse files Browse the repository at this point in the history
* Remove trusted types mention from changelog

* Adds rendering test composing parts and slots (#1077)

* Adds rendering test composing parts and slots

Tests if #1046 has been addressed in the webcomponents polyfills.

* Update @webcomponents/webcomponentsjs dev dependency to required version

* Add 1.2.0 release notes (#1104)

* Don't disturb imperatively added classes in classMap (#1112)

Fix #1111

Revert classMap to previous implementation, but don't use classList or className.

* Fix lint errors (#1116)

* Prepare 1.2.0-pre.1 release (#1117)

* Link changelog issue (#1118)

* Prepare 1.2.0 release (#1128)

* Use downlevel-dts, test compile in TS 3.4 (#1129)

* Use downlevel-dts, test compile in TS 3.4

Related to lit/lit-element#935

Haven't heard anything about this being a problem for lit-html, but better to be ahead of any issues.

* Lock typescript version at ~3.8

Prevent breakage for devs coming into the lit-html repo and doing `npm install` after a new breaking release of TypeScript

* Prepare 1.2.1 release (#1130)

* Update new task template

* Update lint dependencies (#1099)

* Update a broken link in the documentation. (#1138)

* Doc usability improvements. Fixes #1133. (#1147)

* Doc usability improvements. Fixes #1133.

* Address feedback.

* Fix typo. (#1152)

* Update issue templates

added label

* Restore trusted types (#1153)

* Revert "Revert "Add trusted types support to lit html (#970)""

This reverts commit cedf4b3.

It also refactors the trusted types tests so that they can run with native trusted types enabled.

Also revamp the trusted types tests, and run all lit-html tests with trusted types enabled on browsers that support it natively.

* Adds the correct path information to the release notes links for #1163 (#1164)

* Updating links in guide to point to correct guides

https://lit-html.polymer-project.org/guide/release-notes

* Didn't need to actually go down a level in the dir

* Update docs/guide/release-notes/1.2.0.md

Co-authored-by: Arthur Evans <arthure@google.com>

* Update docs/guide/release-notes/1.2.0.md

Co-authored-by: Arthur Evans <arthure@google.com>

* Update docs/guide/release-notes/1.2.0.md

Co-authored-by: Arthur Evans <arthure@google.com>

Co-authored-by: Arthur Evans <arthure@google.com>

* Correct copyright dates. (#1171)

* Add BLM banner (#1172)

* docs: fixed small error (#1180)

Since this is just a typo fix in the README, I'm going to go ahead and merge it.

* Fix api doc (#1178)

* Fixes #1177.

* Fix links.

* Remove unneeded typedoc tags.

* Redirect old API URLs.

* Update firefox and edge logo (#1161)

Co-authored-by: Arthur Evans <arthure@google.com>

* Update dev server recommendations (#1059)

* Update dev server recommendations

Came here to fix a broken link, got more than I bargained for. Other recommendations (like linting and IDE plugins) may need updating as well.

* Address comments.

* Fix typos, add notes on attribute prefixes. (#933)

* Fix typos, add notes on attribute prefixes.

* More detail on strings param

* Run format.

* Make IDE plugins links, change recommendation (#956)

* Make IDE plugins links, change recommendation

I think we should recommend runem.lit-plugin because it supports type checking of template bindings, and it seems to be robust (I ran it across all of google3 and there were only a small number of issues, which I'm sending out PRs for)

* Address feedback, update linting suggestion.

* Address more feedback.

Co-authored-by: Arthur Evans <arthure@google.com>

* Bump lodash from 4.17.15 to 4.17.19 in /docs (#1183)

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Arthur Evans <arthure@google.com>

* Set type in package.json to "module" (#1146)

This would let Node >=13 to load lit-html as ES modules without any other bundling tools.

Move check-version-tracker file extension to .cjs to continue loading it as cjs.

* Fix trusted types tests. (#1193)

* Fix trusted types tests.

Also fix support for trusted types in the unsafeSVG directive.

Have to handle IE separately in unsafe-svg because apparently the svgElement.innerHTML setter is a no op in IE :/

* chore(shady-render): export shadyTemplateFactory (#1135)

* Update changelog for 1.3.0

* Prepare 1.3.0-pre.1 release

* Add 1.3.0 release notes (#1202)

* Prep 1.3.0 release

* Update package lock

* Remove ts3.4 typings before generating

* Update Tachometer

* Add chromedriver as a devDependency

* Fix flaky async-append test

* Update build docs (#1201)

* Revised build docs WIP.

* Update build docs. Fixes #1148.

* Address feedback.

* Address feedback, fix typos.

* Create lit-html-next-bug-report.md (#1308)

* Create lit-html-next-bug-report.md

Add issue template

* Apply suggestions from code review

* Create lit-element@next-major issue template (#1320)

* Create lit-element-next-bug-report.md

* Apply suggestions from code review

* Fix issue template formatting

* Fix styleMap example (#1433)

Example function has a body, hence it doesn't have an implicit return value. An explicit return value is needed for the example to make sense.

* Fix typos in 03-styling-templates.md (#1511)

* Fix typos in 06-template-reference.md (#1562)

* [lit-html] add Lit 2 directive syntax to Lit 1 (#1654)

Co-authored-by: Kevin Schaaf <kschaaf@google.com>
Co-authored-by: Russell Bicknell <bicknellr@google.com>

* Small fixes to 1.3.0 release ntoes (#1719)

* Correct evasive typo (#1725)

change "current" -> "currently"

* Small tweaks to forward-compat directives (#1748)

* [lit-html] Update Twitter handle from polymer -> buildWithLit (#1779)

* Add version banner, landing page redirect. (#1786)

* [lit-html] Prepare v1.4.0 release (#1809)

Co-authored-by: Justin Fagnani <justinfagnani@google.com>
Co-authored-by: Steve Orvell <sorvell@google.com>
Co-authored-by: Abraham Williams <4braham@gmail.com>
Co-authored-by: Peter Burns <rictic@google.com>
Co-authored-by: Abdón Rodríguez Davila <a@abdonrd.com>
Co-authored-by: Lukas Papay <papay.lukas@gmail.com>
Co-authored-by: Arthur Evans <arthure@google.com>
Co-authored-by: nicolejadeyee <nicolejadeyee@gmail.com>
Co-authored-by: Paul Kinlan <paul.kinlan@gmail.com>
Co-authored-by: 0xflotus <0xflotus@gmail.com>
Co-authored-by: Felix Schulze Sindern <47390169+FelixSchuSi@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: vikerman <vikerman@users.noreply.github.com>
Co-authored-by: Manuel Martín <manuel.martin@gmail.com>
Co-authored-by: tikotus <jahvenni@gmail.com>
Co-authored-by: Nicolás Font <nicolasfont@gmail.com>
Co-authored-by: Vadim Filimonov <philimonovvadim@gmail.com>
Co-authored-by: Elliott Marquez <emarquez@google.com>
Co-authored-by: Kevin Schaaf <kschaaf@google.com>
Co-authored-by: Todd Pressley <todd.pressley1@gmail.com>
Co-authored-by: Elliott Marquez <me@elliottmarquez.dev>
  • Loading branch information
22 people committed May 3, 2021
1 parent 5698a09 commit 52ba3d4
Show file tree
Hide file tree
Showing 76 changed files with 18,399 additions and 2,265 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Expand Up @@ -21,6 +21,7 @@
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/triple-slash-reference": "off",
"@typescript-eslint/no-parameter-properties": "error",

"@typescript-eslint/no-unused-vars": ["warn", {
"argsIgnorePattern": "^_"
Expand Down
51 changes: 51 additions & 0 deletions .github/ISSUE_TEMPLATE/lit-element-next-bug-report.md
@@ -0,0 +1,51 @@
---
name: LitElement lit-next preview bug report
about: Use this template to report an issue with the LitElement PREVIEW release (lit-element@next-major)
title: '[lit-element] '
labels: 'lit-next'
assignees: ''

---

<!--
Please read our contribution guidelines:
https://github.com/Polymer/lit-html/blob/master/CONTRIBUTING.md#filing-issues
Before filing a new issue, please check whether it's been reported already. Issues for the next major versions will have the label lit-next.
-->

# Description
A clear and concise description of what the bug is.

# Lit versions

<!--
Run this command from your code or in the console:
console.log(`lit-element: ${window.litElementVersions} lit-html: ${window.litHtmlVersions}`);
Or run the following command on the command line:
npm ls lit-html lit-element
-->

# Steps to Reproduce

1. Write this code...

2. See this output...

## Live Reproduction Link
<!-- Please create a live reproduction on StackBlitz by forking this project: -->
https://stackblitz.com/edit/lit-element-next

## Expected Results
<!-- A clear and concise description of what you expected to happen. -->

## Actual Results
<!-- Example: Error is thrown -->

## Browsers Affected
<!-- Check all that apply -->
- [ ] Chrome
- [ ] Firefox
- [ ] Edge
- [ ] Safari
49 changes: 49 additions & 0 deletions .github/ISSUE_TEMPLATE/lit-html-next-bug-report.md
@@ -0,0 +1,49 @@
---
name: lit-html lit-next preview bug report
about: Use this template to report an issue with the lit-html PREVIEW release (lit-html@next-major)
title: '[lit-html] '
labels: 'lit-next'
assignees: ''

---

<!--
Please read our contribution guidelines:
https://github.com/Polymer/lit-html/blob/master/CONTRIBUTING.md#filing-issues
-->

# Description
A clear and concise description of what the bug is.

# lit-html version

<!-- Check window.litHtmlVersions or npm ls lit-html -->

# Steps to Reproduce

1. Write this code

```ts
import {html, render} from 'lit-html';

render(html`Reproduction Here`, document.body);
```

2. See this output...

## Live Reproduction Link
<!-- Please create a live reproduction on StackBlitz by forking this project: -->
https://stackblitz.com/edit/lit-html-next

## Expected Results
<!-- A clear and concise description of what you expected to happen. -->

## Actual Results
<!-- Example: Error is thrown -->

## Browsers Affected
<!-- Check all that apply -->
- [ ] Chrome
- [ ] Firefox
- [ ] Edge
- [ ] Safari
16 changes: 7 additions & 9 deletions .github/ISSUE_TEMPLATE/new-task-template.md
Expand Up @@ -2,19 +2,17 @@
name: New Task Template
about: Use this template when you are creating a new task
title: ''
labels: ''
labels: 'Focus Area: Core Libraries'
assignees: ''

---

## Initiative / goal
One to two sentences that describe:
-Who wants the functionality
-What it is they want
-Why they want it
## Description
- Who wants the functionality
- What it is they want
- Why they want it
- Functional description of task/subtask

### Scope
Description of task/subtask

## Acceptance criteria and must have scope
## Acceptance criteria
What the card must do in order to accept it as complete. Acceptance Criteria must be concrete or measurable.
29 changes: 29 additions & 0 deletions .github/workflows/test_old_compile.yml
@@ -0,0 +1,29 @@
name: Build in TSC 3.4

on: [push, pull_request]


jobs:
build_old:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12

- name: NPM install
run: npm ci

- name: Build
run: npm run build

- name: Install typescript@~3.4
run: npm install typescript@~3.4

- name: Print TypeScript version
run: npx tsc --version

- name: Type check .d.ts files
run: npx tsc ts3.4/lit-html.d.ts ts3.4/directives/*.d.ts --noEmit -t esnext --moduleResolution Node
7 changes: 7 additions & 0 deletions .gitignore
Expand Up @@ -11,10 +11,17 @@
/lit-html.d.ts.map
/lit-html.js
/lit-html.js.map
/directive.d.ts*
/directive.js*
/async-directive.d.ts*
/async-directive.js*
/directive-helpers.d.ts*
/directive-helpers.js*
/test/**/*.d.ts
/test/**/*.d.ts.map
/test/**/*.js
/test/**/*.js.map
/ts3.4/

/lit-html.bundled.js

Expand Down
9 changes: 2 additions & 7 deletions .vscode/settings.json
@@ -1,8 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.formatOnType": true,
// Need to test the behavior of otherwise invalid code.
"lit-plugin.disable": true
}
"typescript.tsdk": "node_modules/typescript/lib"
}
33 changes: 29 additions & 4 deletions CHANGELOG.md
Expand Up @@ -16,19 +16,44 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
* Added interop with the proposed Trusted Types spec: https://github.com/WICG/trusted-types ([#970](https://github.com/Polymer/lit-html/pull/970))
* Added a sanitization system, for integrating with DOM value sanitizers to prevent XSS attacks. See the docs on the SanitizerFactory type and the setSanitizerFactory function for details.

## Unreleased
<!-- ## [X.Y.Z] - YYYY-MM-DD -->
<!-- ## Unreleased -->
<!-- ### Changed -->
<!-- ### Added -->
<!-- ### Fixed -->
<!-- ### Removed -->

## [1.4.0] - 2021-04-26

### Added

* The lit-html 2.0 directive API has been added in order to enable writing libraries that work against both lit-html 1.4 and 2.0, easing upgrades. ([#1654](https://github.com/Polymer/lit-html/pull/1654)) See the [README](./README.md) for more information.

## [1.3.0] - 2020-08-19

### Changed
* Set the "type" field in package.json to "module. ([#1146](https://github.com/Polymer/lit-html/pull/1146))

### Added
* Added support for [Trusted Types](https://github.com/WICG/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](https://github.com/Polymer/lit-html/pull/1153))
* Export the `shadyTemplateFactory` from `lib/shady-render.js` ([#1135](https://github.com/Polymer/lit-html/pull/1135))

## [1.2.1] - 2020-03-19

### Fixed
* 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.

## [1.2.0] - 2020-03-18

### Added
* Added `unsafeSVG` directive to bind SVG source inside SVGs. ([#304](https://github.com/Polymer/lit-html/issues/304))
* Added `templateContent()` directive for stamping out the contents of an HTML template into a text binding. ([#1058](https://github.com/Polymer/lit-html/issues/1058))
* Added the `live()` directive. Fixes #877
* Added the `live()` directive. ([#877](https://github.com/Polymer/lit-html/issues/877))

### Fixed
* Fixed a bug where `classMap` and `styleMap` directives wouldn't render mutated objects. ([#972](https://github.com/Polymer/lit-html/issues/972))
* Fixed a bug where ifDefined() would set an attribute even when the value didn't change. ([#890](https://github.com/Polymer/lit-html/issues/890))
* Change `classMap` directive to set classes correctly on SVGs ([1070#](https://github.com/Polymer/lit-html/issues/1070)).

* Change `classMap` directive to set classes correctly on SVGs ([#1070](https://github.com/Polymer/lit-html/issues/1070)).

## [1.1.2] - 2019-08-12

Expand Down
35 changes: 31 additions & 4 deletions README.md
@@ -1,16 +1,16 @@
# lit-html
Efficient, Expressive, Extensible HTML templates in JavaScript

[![Build Status](https://travis-ci.org/Polymer/lit-html.svg?branch=master)](https://travis-ci.org/Polymer/lit-html)
[![Build Status](https://travis-ci.org/lit/lit.svg?branch=lit-html-1.4.x)](https://travis-ci.org/Polymer/lit-html)
[![Published on npm](https://img.shields.io/npm/v/lit-html.svg)](https://www.npmjs.com/package/lit-html)
[![Join our Slack](https://img.shields.io/badge/slack-join%20chat-4a154b.svg)](https://www.polymer-project.org/slack-invite)
[![Mentioned in Awesome lit-html](https://awesome.re/mentioned-badge.svg)](https://github.com/web-padawan/awesome-lit-html)
[![Join our Slack](https://img.shields.io/badge/slack-join%20chat-4a154b.svg)](https://lit.dev/slack-invite/)
[![Mentioned in Awesome Lit](https://awesome.re/mentioned-badge.svg)](https://github.com/web-padawan/awesome-lit)

## Documentation

Full documentation is available at [lit-html.polymer-project.org](https://lit-html.polymer-project.org).

Docs source is in the `docs` folder. To build the site youself, see the instructions in [docs/README.md](docs/README.md).
Docs source is in the `docs` folder. To build the site yourself, see the instructions in [docs/README.md](docs/README.md).

## Overview

Expand Down Expand Up @@ -42,6 +42,33 @@ render(helloTemplate('Kevin'), document.body);
$ npm install lit-html
```

## Forward compatibility with lit-html 2.0

lit-html 2.0 has a new directive authoring API that has been back-ported to lit-html 1.4 in order to ease upgrading.

The lit-html 2.0 directive API is available in new modules whose paths are the same in lit-html 1.4 and 2.0, allowing code to import and use the APIs against either version.

You can import the new APIs like so:

```ts
import {html} from 'lit-html';
import {directive, Directive, Part, PartInfo, PartType} from 'lit-html/directive.js';
```

Then implement a directive class and convert it to a directive function:

```ts
class MyDirective extends Directive {
// ...
}
/** My directive docs **/
export const myDirective = directive(MyDirective);
```

**Important note:** The `AsyncDirective` base class is available, but lit-html 1.4 does _not_ implement the `disconnected` and `reconnected` callbacks.

For more details on upgrading see the [Update custom directive implementations](https://lit.dev/docs/releases/upgrade/#update-custom-directive-implementations) guide.

## Contributing

Please see [CONTRIBUTING.md](./CONTRIBUTING.md).
File renamed without changes.
23 changes: 0 additions & 23 deletions docs/_api/copy_api.sh

This file was deleted.

6 changes: 3 additions & 3 deletions docs/_api/readme.md
Expand Up @@ -6,9 +6,9 @@ Import the main lit-html functions from the [`lit-html`](./modules/lit_html.html
import {render, html, svg} from 'lit-html';
```

- [html](./modules/lit_html.html#html)
- [svg](./modules/lit_html.html#svg)
- [render](./modules/lit_html.html#render)
- [html](./modules/_lit_html_.html#html)
- [svg](./modules/_lit_html_.html#svg)
- [render](./modules/_lit_html_.html#render)

## Directives
lit-html comes with a set of directives. You can import them as individual modules from the `lit-html/directives/` folder:
Expand Down
4 changes: 2 additions & 2 deletions docs/_includes/default.html
Expand Up @@ -25,13 +25,13 @@
<div class="wrapper">
<div class="social-links">
<a target="_blank" href="https://github.com/Polymer/lit-html" rel="noopener" aria-label="Github"><img src="/images/logos/logo_github.svg"></a>
<a target="_blank" href="https://twitter.com/polymer" rel="noopener" aria-label="Twitter"><img src="/images/logos/logo_twitter.svg"></a>
<a target="_blank" href="https://twitter.com/buildWithLit" rel="noopener" aria-label="Twitter"><img src="/images/logos/logo_twitter.svg"></a>
<a target="_blank" href="https://groups.google.com/forum/#!forum/polymer-dev" rel="noopener" aria-label="Email"><img src="/images/logos/logo_email.svg"></a>
<a target="_blank" href="https://www.polymer-project.org/slack-invite" rel="noopener" aria-label="Slack"><img src="/images/logos/logo_slack.svg"></a>
</div>
<div class="attribution">
Brought to you by <a href="https://www.polymer-project.org">The Polymer Project</a>.<br>
Copyright 2018 The Polymer Project Authors. Code licensed under the
Copyright 2017–{{ "now" | date:"%Y" }} The Polymer Project Authors. Code licensed under the
<a target="_blank" href="http://polymer.github.io/LICENSE.txt">BSD License</a>.
Documentation licensed under CC BY 3.0.
</div>
Expand Down
1 change: 1 addition & 0 deletions docs/_includes/post.html
Expand Up @@ -16,6 +16,7 @@
</nav>

<article>
{% include version-banner.html %}
<h1>{{ title }}</h1>

{{ content | toc }}
Expand Down
7 changes: 7 additions & 0 deletions docs/_includes/version-banner.html
@@ -0,0 +1,7 @@
<div class="version-banner">
<img src="/images/flame.svg">
<p>
lit-html is now part of the Lit library–see the new site at <a href="https://lit.dev">lit.dev</a>.
This site documents lit-html 1.0, no longer the current version.
</p>
</div>
10 changes: 7 additions & 3 deletions docs/app.yaml
Expand Up @@ -11,15 +11,19 @@ libraries:
default_expiration: "1m"

handlers:
- url: /api
static_dir: api
secure: always

- url: /css
static_dir: css
secure: always
- url: /images
static_dir: images
secure: always
- url: /api/assets
static_dir: api/assets
secure: always
- url: /api/.*
script: main.app
secure: always
- url: /.*
script: main.app
secure: always

0 comments on commit 52ba3d4

Please sign in to comment.