Backed out 2 changesets (bug 1801426, bug 1790483) for causing bc failures on browser_all_files_referenced.js. CLOSED TREE

Backed out changeset af5a48a4b3d3 (bug 1801426)
Backed out changeset f4f8e2b95246 (bug 1790483)
This commit is contained in:
Stanca Serban 2022-11-23 03:09:29 +02:00
parent 4132af0d50
commit 6219c6dbcb
18 changed files with 288 additions and 4697 deletions

View file

@ -170,6 +170,9 @@ _OPT\.OBJ/
^tools/browsertime/node_modules/ ^tools/browsertime/node_modules/
^tools/lint/eslint/eslint-plugin-mozilla/node_modules/ ^tools/lint/eslint/eslint-plugin-mozilla/node_modules/
^browser/components/newtab/node_modules/ ^browser/components/newtab/node_modules/
^toolkit/content/vendor/lit/node_modules/
# Bug 1790483 Ignore lit - development only for now.
^toolkit/content/widgets/vendor/lit.all.mjs
^tools/esmify/node_modules/ ^tools/esmify/node_modules/
# Ignore talos virtualenv and tp5n files. # Ignore talos virtualenv and tp5n files.

View file

@ -37,6 +37,12 @@ def storybook_launch(command_context):
description="Install Storybook node dependencies.", description="Install Storybook node dependencies.",
) )
def storybook_install(command_context): def storybook_install(command_context):
# Bug 1790483: First, we need to make sure lit is installed
run_mach(
command_context,
"npm",
args=["run", "vendor", "--prefix=toolkit/content/vendor/lit"],
)
return run_npm(command_context, args=["ci"]) return run_npm(command_context, args=["ci"])

View file

@ -112,8 +112,6 @@ toolkit.jar:
content/global/elements/videocontrols.js (widgets/videocontrols.js) content/global/elements/videocontrols.js (widgets/videocontrols.js)
content/global/elements/tree.js (widgets/tree.js) content/global/elements/tree.js (widgets/tree.js)
content/global/elements/wizard.js (widgets/wizard.js) content/global/elements/wizard.js (widgets/wizard.js)
content/global/vendor/lit.all.mjs (widgets/vendor/lit.all.mjs)
content/global/lit-utils.mjs (widgets/lit-utils.mjs)
content/global/neterror/aboutNetErrorCodes.js (neterror/aboutNetErrorCodes.js) content/global/neterror/aboutNetErrorCodes.js (neterror/aboutNetErrorCodes.js)
content/global/neterror/supportpages/connection-not-secure.html (neterror/supportpages/connection-not-secure.html) content/global/neterror/supportpages/connection-not-secure.html (neterror/supportpages/connection-not-secure.html)
content/global/neterror/supportpages/time-errors.html (neterror/supportpages/time-errors.html) content/global/neterror/supportpages/time-errors.html (neterror/supportpages/time-errors.html)

View file

@ -1,52 +0,0 @@
From 1f0db62374e62965f521c3a44c31c947f702d53d Mon Sep 17 00:00:00 2001
From: Mark Striemer <mstriemer@mozilla.com>
Date: Wed, 16 Nov 2022 22:54:20 -0600
Subject: [PATCH 1/2] disable terser step
---
rollup-common.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/rollup-common.js b/rollup-common.js
index ebe4b406..6fcac21a 100644
--- a/rollup-common.js
+++ b/rollup-common.js
@@ -345,7 +345,7 @@ export function litProdConfig({
virtual({
[nameCacheSeederInfile]: nameCacheSeederContents,
}),
- terser(nameCacheSeederTerserOptions),
+ // terser(nameCacheSeederTerserOptions),
skipBundleOutput,
],
},
@@ -395,7 +395,7 @@ export function litProdConfig({
// This plugin automatically composes the existing TypeScript -> raw JS
// sourcemap with the raw JS -> minified JS one that we're generating here.
sourcemaps(),
- terser(terserOptions),
+ // terser(terserOptions),
summary({
showBrotliSize: true,
showGzippedSize: true,
@@ -466,7 +466,7 @@ export function litProdConfig({
// references properties from reactive-element which will
// otherwise have different names. The default export that
// lit-element will use is minified.
- terser(terserOptions),
+ // terser(terserOptions),
summary({
showBrotliSize: true,
showGzippedSize: true,
@@ -533,7 +533,7 @@ const litMonoBundleConfig = ({
// This plugin automatically composes the existing TypeScript -> raw JS
// sourcemap with the raw JS -> minified JS one that we're generating here.
sourcemaps(),
- terser(terserOptions),
+ // terser(terserOptions),
summary({
showBrotliSize: true,
showGzippedSize: true,
--
2.32.0 (Apple Git-132)

View file

@ -1,43 +0,0 @@
From e2fb71a850fda2d1f02a19d41a3db1cd7cf8618d Mon Sep 17 00:00:00 2001
From: Mark Striemer <mstriemer@mozilla.com>
Date: Wed, 16 Nov 2022 23:07:57 -0600
Subject: [PATCH 2/2] use DOMParser not innerHTML=
---
packages/lit-html/src/lit-html.ts | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/packages/lit-html/src/lit-html.ts b/packages/lit-html/src/lit-html.ts
index 51941fdf..13914ca7 100644
--- a/packages/lit-html/src/lit-html.ts
+++ b/packages/lit-html/src/lit-html.ts
@@ -14,6 +14,8 @@ const NODE_MODE = false;
// Use window for browser builds because IE11 doesn't have globalThis.
const global = NODE_MODE ? globalThis : window;
+const __moz_domParser = new DOMParser();
+
/**
* Contains types that are part of the unstable debug API.
*
@@ -1017,9 +1019,14 @@ class Template {
// Overridden via `litHtmlPolyfillSupport` to provide platform support.
/** @nocollapse */
static createElement(html: TrustedHTML, _options?: RenderOptions) {
- const el = d.createElement('template');
- el.innerHTML = html as unknown as string;
- return el;
+ const doc = __moz_domParser.parseFromString(
+ `<template>${html}</template>`,
+ 'text/html'
+ );
+ return document.importNode(
+ doc.querySelector('template') as HTMLTemplateElement,
+ true
+ );
}
}
--
2.32.0 (Apple Git-132)

View file

@ -25,4 +25,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -21,26 +21,11 @@ import { classMap, LitElement } from "../vendor/lit.all.mjs";
## To update the lit bundle ## To update the lit bundle
Vendoring runs off of the latest tag in the https://github.com/lit/lit repo. If Using `mach`s `npm` you can update the bundle with:
the latest tag is a lit@ tag then running the vendor command will update to that
version. If the latest tag isn't for lit@, you may need to bundle manually. See
the moz.yaml file for instructions.
### Using mach vendor
``` ```
./mach vendor toolkit/content/vendor/lit/moz.yaml cd toolkit/content/vendor/lit
hg ci -m "Update to lit@<version>" ../../../../mach npm run vendor
``` ```
### Manually updating the bundle Then commit the changes.
To manually update, you'll need to checkout a copy of lit/lit, find the tag you
want and manually run our import commands.
1. Clone https://github.com/lit/lit outside of moz-central
2. Copy *.patch from this directory into the lit repo
3. git apply *.patch
4. npm install && npm run build
5. Copy packages/lit/lit-all.min.js to toolkit/content/widgets/vendor/lit.all.mjs
6. hg ci -m "Update to lit@<version>"

View file

@ -1,9 +0,0 @@
#!/bin/bash
cp *.patch lit/
cd lit
git apply *.patch
../../../../../mach npm install
../../../../../mach npm run build
cp packages/lit/lit-all.min.js ../../../widgets/vendor/lit.all.mjs
rm -rf * .*
cp ../LICENSE .

20
toolkit/content/vendor/lit/index.mjs vendored Normal file
View file

@ -0,0 +1,20 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable import/no-unassigned-import */
/* eslint-disable import/no-unresolved */
export * from "lit";
export * from "lit/directives/async-append.js";
export * from "lit/directives/async-replace.js";
export * from "lit/directives/cache.js";
export * from "lit/directives/class-map.js";
export * from "lit/directives/guard.js";
export * from "lit/directives/if-defined.js";
export * from "lit/directives/live.js";
export * from "lit/directives/ref.js";
export * from "lit/directives/repeat.js";
export * from "lit/directives/style-map.js";
export * from "lit/directives/template-content.js";
export * from "lit/directives/until.js";
export * from "lit/decorators.js";

View file

@ -0,0 +1,17 @@
--- lit.all.mjs
+++ lit.all.mjs.patched
@@ -358,8 +358,12 @@
}
}
static createElement(t7, i9) {
- const s8 = h2.createElement("template");
- return s8.innerHTML = t7, s8;
+ const parser = new DOMParser();
+ const doc = parser.parseFromString(
+ `<template>${t7}</template>`,
+ "text/html"
+ );
+ return document.importNode(doc.querySelector("template"), true);
}
};
function P(t7, i9, s8 = t7, e14) {

View file

@ -1,28 +0,0 @@
BSD 3-Clause License
Copyright (c) 2017 Google LLC. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -10,24 +10,5 @@ origin:
"Lit is a simple library for building fast, lightweight web components." "Lit is a simple library for building fast, lightweight web components."
url: "https://github.com/lit/lit" url: "https://github.com/lit/lit"
license: "BSD-3-Clause" license: "BSD-3-Clause"
release: lit@2.4.1 (2022-11-03T15:20:49-07:00). release: "2.4.0"
revision: lit@2.4.1 revision: "lit@2.4.0"
# Since this tracks the latest tag, it's possible that lit isn't the latest tag
# in lit/lit. In that case we may need to manually update lit. See README.md for
# more info.
vendoring:
url: "https://github.com/lit/lit"
source-hosting: github
tracking: tag
# lit/lit is a monorepo that publishes multiple packages. The tags for lit
# are formatted as "lit@2.4.1".
# tag-prefix: 'lit@'
vendor-directory: toolkit/content/vendor/lit/lit
update-actions:
- action: run-script
script: '{yaml_dir}/bundle-lit.sh'
cwd: '{yaml_dir}'

204
toolkit/content/vendor/lit/package-lock.json generated vendored Normal file
View file

@ -0,0 +1,204 @@
{
"name": "vendor-lit",
"version": "1.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "vendor-lit",
"version": "1.0.0",
"license": "MPL-2.0",
"dependencies": {
"lit": "^2.4.0"
},
"devDependencies": {
"esbuild": "^0.15.10",
"mkdirp": "^1.0.4"
}
},
"node_modules/@lit/reactive-element": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.4.1.tgz",
"integrity": "sha512-qDv4851VFSaBWzpS02cXHclo40jsbAjRXnebNXpm0uVg32kCneZPo9RYVQtrTNICtZ+1wAYHu1ZtxWSWMbKrBw=="
},
"node_modules/@types/trusted-types": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz",
"integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg=="
},
"node_modules/esbuild": {
"version": "0.15.10",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.10.tgz",
"integrity": "sha512-N7wBhfJ/E5fzn/SpNgX+oW2RLRjwaL8Y0ezqNqhjD6w0H2p0rDuEz2FKZqpqLnO8DCaWumKe8dsC/ljvVSSxng==",
"dev": true,
"hasInstallScript": true,
"bin": {
"esbuild": "bin/esbuild"
},
"engines": {
"node": ">=12"
},
"optionalDependencies": {
"@esbuild/android-arm": "0.15.10",
"@esbuild/linux-loong64": "0.15.10",
"esbuild-android-64": "0.15.10",
"esbuild-android-arm64": "0.15.10",
"esbuild-darwin-64": "0.15.10",
"esbuild-darwin-arm64": "0.15.10",
"esbuild-freebsd-64": "0.15.10",
"esbuild-freebsd-arm64": "0.15.10",
"esbuild-linux-32": "0.15.10",
"esbuild-linux-64": "0.15.10",
"esbuild-linux-arm": "0.15.10",
"esbuild-linux-arm64": "0.15.10",
"esbuild-linux-mips64le": "0.15.10",
"esbuild-linux-ppc64le": "0.15.10",
"esbuild-linux-riscv64": "0.15.10",
"esbuild-linux-s390x": "0.15.10",
"esbuild-netbsd-64": "0.15.10",
"esbuild-openbsd-64": "0.15.10",
"esbuild-sunos-64": "0.15.10",
"esbuild-windows-32": "0.15.10",
"esbuild-windows-64": "0.15.10",
"esbuild-windows-arm64": "0.15.10"
}
},
"node_modules/esbuild-windows-64": {
"version": "0.15.10",
"resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.10.tgz",
"integrity": "sha512-2H0gdsyHi5x+8lbng3hLbxDWR7mKHWh5BXZGKVG830KUmXOOWFE2YKJ4tHRkejRduOGDrBvHBriYsGtmTv3ntA==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=12"
}
},
"node_modules/lit": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/lit/-/lit-2.4.0.tgz",
"integrity": "sha512-fdgzxEtLrZFQU/BqTtxFQCLwlZd9bdat+ltzSFjvWkZrs7eBmeX0L5MHUMb3kYIkuS8Xlfnii/iI5klirF8/Xg==",
"dependencies": {
"@lit/reactive-element": "^1.4.0",
"lit-element": "^3.2.0",
"lit-html": "^2.4.0"
}
},
"node_modules/lit-element": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.2.2.tgz",
"integrity": "sha512-6ZgxBR9KNroqKb6+htkyBwD90XGRiqKDHVrW/Eh0EZ+l+iC+u+v+w3/BA5NGi4nizAVHGYvQBHUDuSmLjPp7NQ==",
"dependencies": {
"@lit/reactive-element": "^1.3.0",
"lit-html": "^2.2.0"
}
},
"node_modules/lit-html": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.4.0.tgz",
"integrity": "sha512-G6qXu4JNUpY6aaF2VMfaszhO9hlWw0hOTRFDmuMheg/nDYGB+2RztUSOyrzALAbr8Nh0Y7qjhYkReh3rPnplVg==",
"dependencies": {
"@types/trusted-types": "^2.0.2"
}
},
"node_modules/mkdirp": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
"dev": true,
"bin": {
"mkdirp": "bin/cmd.js"
},
"engines": {
"node": ">=10"
}
}
},
"dependencies": {
"@lit/reactive-element": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.4.1.tgz",
"integrity": "sha512-qDv4851VFSaBWzpS02cXHclo40jsbAjRXnebNXpm0uVg32kCneZPo9RYVQtrTNICtZ+1wAYHu1ZtxWSWMbKrBw=="
},
"@types/trusted-types": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz",
"integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg=="
},
"esbuild": {
"version": "0.15.10",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.10.tgz",
"integrity": "sha512-N7wBhfJ/E5fzn/SpNgX+oW2RLRjwaL8Y0ezqNqhjD6w0H2p0rDuEz2FKZqpqLnO8DCaWumKe8dsC/ljvVSSxng==",
"dev": true,
"requires": {
"@esbuild/android-arm": "0.15.10",
"@esbuild/linux-loong64": "0.15.10",
"esbuild-android-64": "0.15.10",
"esbuild-android-arm64": "0.15.10",
"esbuild-darwin-64": "0.15.10",
"esbuild-darwin-arm64": "0.15.10",
"esbuild-freebsd-64": "0.15.10",
"esbuild-freebsd-arm64": "0.15.10",
"esbuild-linux-32": "0.15.10",
"esbuild-linux-64": "0.15.10",
"esbuild-linux-arm": "0.15.10",
"esbuild-linux-arm64": "0.15.10",
"esbuild-linux-mips64le": "0.15.10",
"esbuild-linux-ppc64le": "0.15.10",
"esbuild-linux-riscv64": "0.15.10",
"esbuild-linux-s390x": "0.15.10",
"esbuild-netbsd-64": "0.15.10",
"esbuild-openbsd-64": "0.15.10",
"esbuild-sunos-64": "0.15.10",
"esbuild-windows-32": "0.15.10",
"esbuild-windows-64": "0.15.10",
"esbuild-windows-arm64": "0.15.10"
}
},
"esbuild-windows-64": {
"version": "0.15.10",
"resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.10.tgz",
"integrity": "sha512-2H0gdsyHi5x+8lbng3hLbxDWR7mKHWh5BXZGKVG830KUmXOOWFE2YKJ4tHRkejRduOGDrBvHBriYsGtmTv3ntA==",
"dev": true,
"optional": true
},
"lit": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/lit/-/lit-2.4.0.tgz",
"integrity": "sha512-fdgzxEtLrZFQU/BqTtxFQCLwlZd9bdat+ltzSFjvWkZrs7eBmeX0L5MHUMb3kYIkuS8Xlfnii/iI5klirF8/Xg==",
"requires": {
"@lit/reactive-element": "^1.4.0",
"lit-element": "^3.2.0",
"lit-html": "^2.4.0"
}
},
"lit-element": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.2.2.tgz",
"integrity": "sha512-6ZgxBR9KNroqKb6+htkyBwD90XGRiqKDHVrW/Eh0EZ+l+iC+u+v+w3/BA5NGi4nizAVHGYvQBHUDuSmLjPp7NQ==",
"requires": {
"@lit/reactive-element": "^1.3.0",
"lit-html": "^2.2.0"
}
},
"lit-html": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.4.0.tgz",
"integrity": "sha512-G6qXu4JNUpY6aaF2VMfaszhO9hlWw0hOTRFDmuMheg/nDYGB+2RztUSOyrzALAbr8Nh0Y7qjhYkReh3rPnplVg==",
"requires": {
"@types/trusted-types": "^2.0.2"
}
},
"mkdirp": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
"dev": true
}
}
}

22
toolkit/content/vendor/lit/package.json vendored Normal file
View file

@ -0,0 +1,22 @@
{
"name": "vendor-lit",
"version": "1.0.0",
"description": "Vendor the lit package",
"main": "index.mjs",
"scripts": {
"build": "esbuild index.mjs --bundle --outfile=lit.all.mjs --format=esm --legal-comments=inline",
"patch": "patch lit.all.mjs lit-html-no-inner-html.patch",
"mv-dest": "mkdirp ../../widgets/vendor && mv lit.all.mjs ../../widgets/vendor/lit.all.mjs",
"vendor": "npm ci && npm run build && npm run patch && npm run mv-dest",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MPL-2.0",
"dependencies": {
"lit": "^2.4.0"
},
"devDependencies": {
"esbuild": "^0.15.10",
"mkdirp": "^1.0.4"
}
}

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at htp://mozilla.org/MPL/2.0/. */ * file, You can obtain one at htp://mozilla.org/MPL/2.0/. */
// Bug 1790483: Lit is not bundled yet, this is dev only.
// eslint-disable-next-line import/no-unresolved
import { html, ifDefined } from "../vendor/lit.all.mjs"; import { html, ifDefined } from "../vendor/lit.all.mjs";
import { MozLitElement } from "../lit-utils.mjs"; import { MozLitElement } from "../lit-utils.mjs";

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Bug 1790483: Lit is not bundled yet, this is dev only.
// eslint-disable-next-line import/no-unresolved
import { html, ifDefined } from "../vendor/lit.all.mjs"; import { html, ifDefined } from "../vendor/lit.all.mjs";
// eslint-disable-next-line import/no-unassigned-import // eslint-disable-next-line import/no-unassigned-import
import "./fx-toggle.mjs"; import "./fx-toggle.mjs";

View file

@ -2,25 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
import { LitElement } from "./vendor/lit.all.mjs"; // Bug 1790483: Lit is not bundled yet, this is dev only.
// eslint-disable-next-line import/no-unresolved
/** import { query, queryAll, LitElement } from "./vendor/lit.all.mjs";
* Helper for our replacement of @query. Used with `static queries` property.
*
* https://github.com/lit/lit/blob/main/packages/reactive-element/src/decorators/query.ts
*/
function query(el, selector) {
return () => el.renderRoot.querySelector(selector);
}
/**
* Helper for our replacement of @queryAll. Used with `static queries` property.
*
* https://github.com/lit/lit/blob/main/packages/reactive-element/src/decorators/query-all.ts
*/
function queryAll(el, selector) {
return () => el.renderRoot.querySelectorAll(selector);
}
/** /**
* MozLitElement provides extensions to the lit-provided LitElement class. * MozLitElement provides extensions to the lit-provided LitElement class.
@ -88,13 +72,9 @@ export class MozLitElement extends LitElement {
if (queries) { if (queries) {
for (let [name, selector] of Object.entries(queries)) { for (let [name, selector] of Object.entries(queries)) {
if (selector.all) { if (selector.all) {
Object.defineProperty(this, name, { queryAll(selector.all)(this, name);
get: queryAll(this, selector.all),
});
} else { } else {
Object.defineProperty(this, name, { query(selector)(this, name);
get: query(this, selector),
});
} }
} }
} }

File diff suppressed because it is too large Load diff