Upgrade from lit-element to lit. (#1706)

This commit is contained in:
Jason Robbins 2022-01-31 13:35:05 -08:00 коммит произвёл GitHub
Родитель 0fb2a22edc
Коммит 26d0f95e93
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
33 изменённых файлов: 170 добавлений и 139 удалений

79
package-lock.json сгенерированный
Просмотреть файл

@ -14,8 +14,7 @@
"@polymer/paper-listbox": "^3.0.1",
"@polymer/paper-ripple": "^3.0.1",
"@polymer/paper-styles": "^3.0.1",
"lit-element": "^2.1.0",
"lit-html": "^1.1.2",
"lit": "^2",
"node-fetch": ">=3.1.1",
"node-sass": ">=4.13.1",
"urijs": ">=1.19.7",
@ -1094,6 +1093,11 @@
"integrity": "sha512-sR9Go0U6puXoXyW9UgIiIQhRcJ8jVOvGl4BptUiXAtheMs72WcakZ1udh6J0ZOivr3o8jAM+MTCHLP8FZMbVpQ==",
"dev": true
},
"node_modules/@lit/reactive-element": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.2.1.tgz",
"integrity": "sha512-03FYfMguIWo9E1y1qcTpXzoO8Ukpn0j5o4GjNFq/iHqJEPY6pYopsU44e7NSFIgCTorr8wdUU5PfVy8VeD6Rwg=="
},
"node_modules/@mrmlnc/readdir-enhanced": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz",
@ -1348,6 +1352,11 @@
"@types/node": "*"
}
},
"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/@webcomponents/shadycss": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/@webcomponents/shadycss/-/shadycss-1.9.1.tgz",
@ -7381,6 +7390,16 @@
"node": ">= 0.8"
}
},
"node_modules/lit": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/lit/-/lit-2.1.2.tgz",
"integrity": "sha512-XacK89dJXF7BJbpiZSMvzT4RxHag7Wt+yNx7tErEVgGVlOFAeN871bj7ivotCMgYeBFWVp/hjKF/PDTk6L7gMA==",
"dependencies": {
"@lit/reactive-element": "^1.1.0",
"lit-element": "^3.1.0",
"lit-html": "^2.1.0"
}
},
"node_modules/lit-analyzer": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/lit-analyzer/-/lit-analyzer-1.2.1.tgz",
@ -7439,17 +7458,21 @@
}
},
"node_modules/lit-element": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/lit-element/-/lit-element-2.2.0.tgz",
"integrity": "sha512-Mzs3H7IO4wAnpzqreHw6dQqp9IG+h/oN8X9pgNbMZbE7x6B0aNOwP5Nveox/5HE+65ZfW2PeULEjoHkrwpTnuQ==",
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.1.2.tgz",
"integrity": "sha512-5VLn5a7anAFH7oz6d7TRG3KiTZQ5GEFsAgOKB8Yc+HDyuDUGOT2cL1CYTz/U4b/xlJxO+euP14pyji+z3Z3kOg==",
"dependencies": {
"lit-html": "^1.0.0"
"@lit/reactive-element": "^1.1.0",
"lit-html": "^2.1.0"
}
},
"node_modules/lit-html": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/lit-html/-/lit-html-1.1.2.tgz",
"integrity": "sha512-FFlUMKHKi+qG1x1iHNZ1hrtc/zHmfYTyrSvs3/wBTvaNtpZjOZGWzU7efGYVpgp6KvWeKF6ql9/KsCq6Z/mEDA=="
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.1.2.tgz",
"integrity": "sha512-fp7oBzUdc7SEmOoSUNUZ6PM8se8eaIvc3pviQ5M+iCYuCpv9E23Nnb4hlxVzGhLWMnHSrnRVooNio0aAgjjrFw==",
"dependencies": {
"@types/trusted-types": "^2.0.2"
}
},
"node_modules/load-json-file": {
"version": "1.1.0",
@ -12676,6 +12699,11 @@
"integrity": "sha512-sR9Go0U6puXoXyW9UgIiIQhRcJ8jVOvGl4BptUiXAtheMs72WcakZ1udh6J0ZOivr3o8jAM+MTCHLP8FZMbVpQ==",
"dev": true
},
"@lit/reactive-element": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.2.1.tgz",
"integrity": "sha512-03FYfMguIWo9E1y1qcTpXzoO8Ukpn0j5o4GjNFq/iHqJEPY6pYopsU44e7NSFIgCTorr8wdUU5PfVy8VeD6Rwg=="
},
"@mrmlnc/readdir-enhanced": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz",
@ -12917,6 +12945,11 @@
"@types/node": "*"
}
},
"@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=="
},
"@webcomponents/shadycss": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/@webcomponents/shadycss/-/shadycss-1.9.1.tgz",
@ -18274,6 +18307,16 @@
"resolve": "^1.1.7"
}
},
"lit": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/lit/-/lit-2.1.2.tgz",
"integrity": "sha512-XacK89dJXF7BJbpiZSMvzT4RxHag7Wt+yNx7tErEVgGVlOFAeN871bj7ivotCMgYeBFWVp/hjKF/PDTk6L7gMA==",
"requires": {
"@lit/reactive-element": "^1.1.0",
"lit-element": "^3.1.0",
"lit-html": "^2.1.0"
}
},
"lit-analyzer": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/lit-analyzer/-/lit-analyzer-1.2.1.tgz",
@ -18322,17 +18365,21 @@
}
},
"lit-element": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/lit-element/-/lit-element-2.2.0.tgz",
"integrity": "sha512-Mzs3H7IO4wAnpzqreHw6dQqp9IG+h/oN8X9pgNbMZbE7x6B0aNOwP5Nveox/5HE+65ZfW2PeULEjoHkrwpTnuQ==",
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.1.2.tgz",
"integrity": "sha512-5VLn5a7anAFH7oz6d7TRG3KiTZQ5GEFsAgOKB8Yc+HDyuDUGOT2cL1CYTz/U4b/xlJxO+euP14pyji+z3Z3kOg==",
"requires": {
"lit-html": "^1.0.0"
"@lit/reactive-element": "^1.1.0",
"lit-html": "^2.1.0"
}
},
"lit-html": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/lit-html/-/lit-html-1.1.2.tgz",
"integrity": "sha512-FFlUMKHKi+qG1x1iHNZ1hrtc/zHmfYTyrSvs3/wBTvaNtpZjOZGWzU7efGYVpgp6KvWeKF6ql9/KsCq6Z/mEDA=="
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.1.2.tgz",
"integrity": "sha512-fp7oBzUdc7SEmOoSUNUZ6PM8se8eaIvc3pviQ5M+iCYuCpv9E23Nnb4hlxVzGhLWMnHSrnRVooNio0aAgjjrFw==",
"requires": {
"@types/trusted-types": "^2.0.2"
}
},
"load-json-file": {
"version": "1.1.0",

Просмотреть файл

@ -86,8 +86,7 @@
"@polymer/paper-listbox": "^3.0.1",
"@polymer/paper-ripple": "^3.0.1",
"@polymer/paper-styles": "^3.0.1",
"lit-element": "^2.1.0",
"lit-html": "^1.1.2",
"lit": "^2",
"node-fetch": ">=3.1.1",
"node-sass": ">=4.13.1",
"urijs": ">=1.19.7",

Просмотреть файл

@ -1,4 +1,4 @@
import {LitElement, css, html} from 'lit-element';
import {LitElement, css, html} from 'lit';
import '@polymer/iron-icon';
import '@polymer/iron-collapse';

Просмотреть файл

@ -1,5 +1,4 @@
import {LitElement, css, html} from 'lit-element';
import {nothing} from 'lit-html';
import {LitElement, css, html, nothing} from 'lit';
import './chromedash-dialog';
import '@polymer/iron-icon';
import SHARED_STYLES from '../css/shared.css';
@ -198,7 +197,7 @@ class ChromedashApprovalsDialog extends LitElement {
}
findStateName(state) {
for (let item of STATE_NAMES) {
for (const item of STATE_NAMES) {
if (item[0] == state) {
return item[1];
}
@ -322,7 +321,7 @@ class ChromedashApprovalsDialog extends LitElement {
const isOpen = this.showConfigs.has(approvalDef.id);
let configExpandIcon = html`
const configExpandIcon = html`
<iron-icon
style="margin-left:4px"
@click="${() => {
@ -403,7 +402,7 @@ class ChromedashApprovalsDialog extends LitElement {
>Show all intents</label>
`;
}
let postToSelect = html`
const postToSelect = html`
<select style="margin-right:1em" id="post_to_approval_field">
<option value="0">Don't post to mailing list</option>
${APPROVAL_DEFS.map((apprDef) => html`
@ -459,7 +458,7 @@ class ChromedashApprovalsDialog extends LitElement {
const commentArea = this.shadowRoot.querySelector('#comment_area');
const newVal = commentArea && commentArea.value.trim() || '';
if (newVal != '') newNeedsSave = true;
for (let fieldId of this.changedApprovalsByField.keys()) {
for (const fieldId of this.changedApprovalsByField.keys()) {
if (this.changedApprovalsByField.get(fieldId) != -1) {
newNeedsSave = true;
}
@ -493,7 +492,7 @@ class ChromedashApprovalsDialog extends LitElement {
handleSave() {
const promises = [];
for (let fieldId of this.changedApprovalsByField.keys()) {
for (const fieldId of this.changedApprovalsByField.keys()) {
if (this.changedApprovalsByField.get(fieldId) != -1) {
promises.push(
window.csClient.setApproval(
@ -501,7 +500,7 @@ class ChromedashApprovalsDialog extends LitElement {
this.changedApprovalsByField.get(fieldId)));
}
}
for (let fieldId of this.changedConfigsByField.keys()) {
for (const fieldId of this.changedConfigsByField.keys()) {
const config = this.changedConfigsByField.get(fieldId);
promises.push(
window.csClient.setApprovalConfig(
@ -529,7 +528,7 @@ class ChromedashApprovalsDialog extends LitElement {
}
toggleConfig(approvalDef) {
let newConfigs = new Set([...this.showConfigs]); // Make a copy.
const newConfigs = new Set([...this.showConfigs]); // Make a copy.
if (newConfigs.has(approvalDef.id)) {
newConfigs.delete(approvalDef.id);
} else {

Просмотреть файл

@ -1,5 +1,4 @@
import {LitElement, css, html} from 'lit-element';
import {nothing} from 'lit-html';
import {LitElement, css, html, nothing} from 'lit';
import SHARED_STYLES from '../css/shared.css';

Просмотреть файл

@ -1,4 +1,4 @@
import {LitElement, css, html} from 'lit-element';
import {LitElement, css, html} from 'lit';
import SHARED_STYLES from '../css/shared.css';
class ChromedashCallout extends LitElement {
@ -104,7 +104,7 @@ class ChromedashCallout extends LitElement {
attachToTarget(el) {
if (this.side == 'south') {
let targetBottom = this.contentOffsetTop(el) + el.offsetHeight;
const targetBottom = this.contentOffsetTop(el) + el.offsetHeight;
this.top = targetBottom + 20;
this.left = Math.max(this.contentOffsetLeft(el) - 20, 0);
}

Просмотреть файл

@ -1,4 +1,4 @@
import {LitElement, css, html} from 'lit-element';
import {LitElement, css, html} from 'lit';
import SHARED_STYLES from '../css/shared.css';

Просмотреть файл

@ -1,4 +1,4 @@
import {LitElement, css, html} from 'lit-element';
import {LitElement, css, html} from 'lit';
import '@polymer/iron-icon';
// This is a simplfied version of chops-dialog:

Просмотреть файл

@ -1,5 +1,4 @@
import {LitElement, css, html} from 'lit-element';
import {nothing} from 'lit-html';
import {LitElement, css, html, nothing} from 'lit';
import '@polymer/iron-icon';
import './chromedash-callout';
import SHARED_STYLES from '../css/shared.css';
@ -128,7 +127,7 @@ class ChromedashFeatureDetail extends LitElement {
};
if (fieldIdMapping[fieldId]) {
value = this.feature;
for (let step of fieldIdMapping[fieldId].split('.')) {
for (const step of fieldIdMapping[fieldId].split('.')) {
if (value) {
value = value[step];
}

Просмотреть файл

@ -1,5 +1,4 @@
import {LitElement, css, html} from 'lit-element';
import {nothing} from 'lit-html';
import {LitElement, css, html, nothing} from 'lit';
import SHARED_STYLES from '../css/shared.css';
import {STATE_NAMES} from './chromedash-approvals-dialog.js';
@ -47,7 +46,7 @@ class ChromedashFeatureTable extends LitElement {
}
loadApprovalData() {
for (let feature of this.features) {
for (const feature of this.features) {
window.csClient.getApprovals(feature.id).then(res => {
const newApprovals = {...this.approvals};
newApprovals[feature.id] = res.approvals;
@ -118,7 +117,7 @@ class ChromedashFeatureTable extends LitElement {
}
_fireEvent(eventName, detail) {
let event = new CustomEvent(eventName, {
const event = new CustomEvent(eventName, {
bubbles: true,
composed: true,
detail,
@ -277,7 +276,7 @@ class ChromedashFeatureTable extends LitElement {
getActiveOwners(feature) {
const featureConfigs = this.configs[feature.id];
let allOwners = featureConfigs.map(c => c.owners).flat();
const allOwners = featureConfigs.map(c => c.owners).flat();
// TODO(jrobbins): Limit to only owners of active intents
let activeOwners = allOwners;
activeOwners = [...new Set(activeOwners)]; // de-dup.
@ -299,7 +298,7 @@ class ChromedashFeatureTable extends LitElement {
renderApprovalsSoFar(approvals) {
const result = [];
for (let stateItem of STATE_NAMES) {
for (const stateItem of STATE_NAMES) {
const state = stateItem[0];
const stateName = stateItem[1];
const approvalsWithThatState = approvals.filter(a => a.state == state);

Просмотреть файл

@ -1,6 +1,5 @@
import {LitElement, html} from 'lit-element';
import {nothing} from 'lit-html';
import {ifDefined} from 'lit-html/directives/if-defined.js';
import {LitElement, html, nothing} from 'lit';
import {ifDefined} from 'lit/directives/if-defined.js';
import {autolink} from './utils.js';
import '@polymer/iron-icon';
import './chromedash-color-status';
@ -119,7 +118,7 @@ class ChromedashFeature extends LitElement {
}
_fireEvent(eventName, detail) {
let event = new CustomEvent(eventName, {
const event = new CustomEvent(eventName, {
bubbles: true,
composed: true,
detail,
@ -314,8 +313,8 @@ class ChromedashFeature extends LitElement {
html`<p><h3>Motivation</h3></p>
<p class="${this.open ? 'preformatted' : ''}"
><span>${autolink(this.feature.motivation)}</span
></p>`
: nothing }
></p>` :
nothing }
</section>
${this.open ? html`
<section class="sidebyside">

Просмотреть файл

@ -1,4 +1,4 @@
import {LitElement, html} from 'lit-element';
import {LitElement, html} from 'lit';
// eslint-disable-next-line no-unused-vars
import './chromedash-feature';
import style from '../css/elements/chromedash-featurelist.css';
@ -82,7 +82,7 @@ class ChromedashFeaturelist extends LitElement {
}
_fireEvent(eventName, detail) {
let event = new CustomEvent(eventName, {detail});
const event = new CustomEvent(eventName, {detail});
this.dispatchEvent(event);
}

Просмотреть файл

@ -1,5 +1,4 @@
import {LitElement, css, html} from 'lit-element';
import {nothing} from 'lit-html';
import {LitElement, css, html, nothing} from 'lit';
import SHARED_STYLES from '../css/shared.css';
class ChromedashGantt extends LitElement {

Просмотреть файл

@ -1,5 +1,4 @@
import {LitElement, css, html} from 'lit-element';
import {nothing} from 'lit-html';
import {LitElement, css, html, nothing} from 'lit';
import './chromedash-color-status';
import './chromedash-dialog';
import SHARED_STYLES from '../css/shared.css';

Просмотреть файл

@ -1,5 +1,5 @@
import {LitElement, css, html} from 'lit-element';
import {ifDefined} from 'lit-html/directives/if-defined.js';
import {LitElement, css, html} from 'lit';
import {ifDefined} from 'lit/directives/if-defined.js';
import SHARED_STYLES from '../css/shared.css';
class ChromedashMetadata extends LitElement {
@ -70,7 +70,7 @@ class ChromedashMetadata extends LitElement {
}
_fireEvent(eventName, detail) {
let event = new CustomEvent(eventName, {detail});
const event = new CustomEvent(eventName, {detail});
this.dispatchEvent(event);
}
@ -150,11 +150,10 @@ class ChromedashMetadata extends LitElement {
${this._versions.map((version, index) =>
typeof this._className !== 'undefined' ?
this._className == 'canaryisdev' ?
html`<option value="${version}">${version} ${index == 3 ? 'canary/dev' : index == 4 ? 'beta' : index == 5 ? 'stable' : ''}</option>`
: this._className == 'betaisdev' ?
html`<option value="${version}">${version} ${index == 3 ? 'canary' : index == 4 ? 'dev/beta' : index == 5 ? 'stable' : ''}</option>`
: ''
:
html`<option value="${version}">${version} ${index == 3 ? 'canary/dev' : index == 4 ? 'beta' : index == 5 ? 'stable' : ''}</option>` :
this._className == 'betaisdev' ?
html`<option value="${version}">${version} ${index == 3 ? 'canary' : index == 4 ? 'dev/beta' : index == 5 ? 'stable' : ''}</option>` :
'' :
html`<option value="${version}">${version} ${index == 3 ? 'canary' : index == 4 ? 'dev' : index == 5 ? 'beta' : index == 6 ? 'stable' : ''}</option>`,
)}
</select>

Просмотреть файл

@ -1,5 +1,5 @@
import {LitElement, css, html} from 'lit-element';
import {ifDefined} from 'lit-html/directives/if-defined.js';
import {LitElement, css, html} from 'lit';
import {ifDefined} from 'lit/directives/if-defined.js';
import '@polymer/iron-icon';
import './chromedash-x-meter';
@ -77,7 +77,7 @@ class ChromedashMetrics extends LitElement {
}
_fireEvent(eventName, detail) {
let event = new CustomEvent(eventName, {detail});
const event = new CustomEvent(eventName, {detail});
this.dispatchEvent(event);
}

Просмотреть файл

@ -1,5 +1,4 @@
import {LitElement, css, html} from 'lit-element';
import {nothing} from 'lit-html';
import {LitElement, css, html, nothing} from 'lit';
import './chromedash-accordion';
import './chromedash-approvals-dialog';
import './chromedash-feature-table';

Просмотреть файл

@ -1,5 +1,4 @@
import {LitElement, css, html} from 'lit-element';
import {nothing} from 'lit-html';
import {LitElement, css, html, nothing} from 'lit';
import '@polymer/iron-icon';
import './chromedash-callout';
import SHARED_STYLES from '../css/shared.css';
@ -97,9 +96,9 @@ class ChromedashProcessOverview extends LitElement {
// if (this.inFinalStage(stage)) {
// return true;
// }
let stageOrder = this.process.stages.map(s => s.outgoing_stage);
let viewedOutgoingStageIndex = stageOrder.indexOf(stage.outgoing_stage);
let featureStageIndex = stageOrder.indexOf(this.feature.intent_stage_int);
const stageOrder = this.process.stages.map(s => s.outgoing_stage);
const viewedOutgoingStageIndex = stageOrder.indexOf(stage.outgoing_stage);
const featureStageIndex = stageOrder.indexOf(this.feature.intent_stage_int);
return (viewedOutgoingStageIndex < featureStageIndex);
}
@ -110,10 +109,10 @@ class ChromedashProcessOverview extends LitElement {
if (this.inFinalStage(stage)) {
return false;
}
let stageOrder = this.process.stages.map(s => s.outgoing_stage);
let viewedIncomingStageIndex = stageOrder.indexOf(stage.incoming_stage);
let viewedOutgoingStageIndex = stageOrder.indexOf(stage.outgoing_stage);
let featureStageIndex = stageOrder.indexOf(this.feature.intent_stage_int);
const stageOrder = this.process.stages.map(s => s.outgoing_stage);
const viewedIncomingStageIndex = stageOrder.indexOf(stage.incoming_stage);
const viewedOutgoingStageIndex = stageOrder.indexOf(stage.outgoing_stage);
const featureStageIndex = stageOrder.indexOf(this.feature.intent_stage_int);
return (viewedIncomingStageIndex <= featureStageIndex &&
viewedOutgoingStageIndex > featureStageIndex);
}
@ -123,9 +122,9 @@ class ChromedashProcessOverview extends LitElement {
if (this.inFinalStage(stage)) {
return false;
}
let stageOrder = this.process.stages.map(s => s.outgoing_stage);
let viewedIncomingStageIndex = stageOrder.indexOf(stage.incoming_stage);
let featureStageIndex = stageOrder.indexOf(this.feature.intent_stage_int);
const stageOrder = this.process.stages.map(s => s.outgoing_stage);
const viewedIncomingStageIndex = stageOrder.indexOf(stage.incoming_stage);
const featureStageIndex = stageOrder.indexOf(this.feature.intent_stage_int);
return (viewedIncomingStageIndex > featureStageIndex);
}
@ -167,7 +166,7 @@ class ChromedashProcessOverview extends LitElement {
render() {
let featureId = this.feature.id;
const featureId = this.feature.id;
return html`
<div style="position: relative">
<table>

Просмотреть файл

@ -1,5 +1,4 @@
import {LitElement, html} from 'lit-element';
import {nothing} from 'lit-html';
import {LitElement, html, nothing} from 'lit';
import style from '../css/elements/chromedash-roadmap-milestone-card.css';
class ChromedashRoadmapMilestoneCard extends LitElement {
@ -51,7 +50,7 @@ class ChromedashRoadmapMilestoneCard extends LitElement {
}
_fireEvent(eventName, detail) {
let event = new CustomEvent(eventName, {
const event = new CustomEvent(eventName, {
bubbles: true,
composed: true,
detail,

Просмотреть файл

@ -1,4 +1,4 @@
import {LitElement, html} from 'lit-element';
import {LitElement, html} from 'lit';
import '@polymer/iron-icon';
import style from '../css/elements/chromedash-roadmap.css';
@ -74,7 +74,7 @@ class ChromedashRoadmap extends LitElement {
}
set lastFutureFetchedOn(val) {
let oldVal = this._lastFutureFetchedOn;
const oldVal = this._lastFutureFetchedOn;
this._lastFutureFetchedOn = val;
this.fetchNextBatch().then(()=>{
this.requestUpdate('lastFutureFetchedOn', oldVal);
@ -85,7 +85,7 @@ class ChromedashRoadmap extends LitElement {
}
set lastPastFetchedOn(val) {
let oldVal = this._lastPastFetchedOn;
const oldVal = this._lastPastFetchedOn;
this._lastPastFetchedOn = val;
if (!this.isChromeOneFetched) {
this.fetchPreviousBatch().then(()=>{
@ -119,7 +119,7 @@ class ChromedashRoadmap extends LitElement {
const isFetchedFirstTime = this._lastFutureFetchedOn == this.channels['beta'].version;
let nextMilestones;
let milestoneNumsArray = [];
const milestoneNumsArray = [];
const cardsToFetchInAdvance = 3; // number of milestones to fetch while fetching for the first time
// promise to fetch next milestones
@ -138,17 +138,17 @@ class ChromedashRoadmap extends LitElement {
}
// promise to fetch features in next milestones
let milestoneFeaturePromise = {};
const milestoneFeaturePromise = {};
milestoneNumsArray.forEach((milestoneNum) => {
milestoneFeaturePromise[milestoneNum] = window.csClient.getFeaturesInMilestone(milestoneNum);
});
let newMilestonesInfo;
let milestoneFeatures = {};
const milestoneFeatures = {};
try {
newMilestonesInfo = await nextMilestones;
for (let milestoneNum of milestoneNumsArray) {
for (const milestoneNum of milestoneNumsArray) {
milestoneFeatures[milestoneNum] = await milestoneFeaturePromise[milestoneNum];
}
} catch (err) {
@ -173,24 +173,24 @@ class ChromedashRoadmap extends LitElement {
this.isChromeOneFetched = true;
}
let nextMilestones = window.csClient.getSpecifiedChannels(this._lastPastFetchedOn - 2,
const nextMilestones = window.csClient.getSpecifiedChannels(this._lastPastFetchedOn - 2,
this._lastPastFetchedOn - 2);
let milestoneNumsArray = [];
const milestoneNumsArray = [];
milestoneNumsArray.push(this._lastPastFetchedOn - 2);
// promise to fetch features in the earlier released milestone
let milestoneFeaturePromise = {};
const milestoneFeaturePromise = {};
milestoneNumsArray.forEach((milestoneNum) => {
milestoneFeaturePromise[milestoneNum] = window.csClient.getFeaturesInMilestone(milestoneNum);
});
let newMilestonesInfo;
let milestoneFeatures = {};
const milestoneFeatures = {};
try {
newMilestonesInfo = await nextMilestones;
for (let milestoneNum of milestoneNumsArray) {
for (const milestoneNum of milestoneNumsArray) {
milestoneFeatures[milestoneNum] = await milestoneFeaturePromise[milestoneNum];
}
} catch (err) {
@ -240,11 +240,11 @@ class ChromedashRoadmap extends LitElement {
}
computeWidthOfCard() {
let cardContainer = document.querySelector('#releases-section');
let containerWidth = cardContainer.offsetWidth;
let items = this.computeItems();
let margin=16;
let val = (containerWidth/items)-margin;
const cardContainer = document.querySelector('#releases-section');
const containerWidth = cardContainer.offsetWidth;
const items = this.computeItems();
const margin=16;
const val = (containerWidth/items)-margin;
return val;
};

Просмотреть файл

@ -1,5 +1,4 @@
import {LitElement, css, html} from 'lit-element';
import {nothing} from 'lit-html';
import {LitElement, css, html, nothing} from 'lit';
import '@polymer/iron-icon';
import SHARED_STYLES from '../css/shared.css';
@ -89,7 +88,7 @@ class ChromedashSamplePanel extends LitElement {
}
_fireEvent(eventName, detail) {
let event = new CustomEvent(eventName, {detail});
const event = new CustomEvent(eventName, {detail});
this.dispatchEvent(event);
}

Просмотреть файл

@ -1,5 +1,4 @@
import {LitElement, html} from 'lit-element';
import {nothing} from 'lit-html';
import {LitElement, html, nothing} from 'lit';
import '@polymer/iron-icon';
import style from '../css/elements/chromedash-schedule.css';
@ -132,8 +131,8 @@ class ChromedashSchedule extends LitElement {
${TEMPLATE_CONTENT[type].downloadUrl ? html`
<a href="${TEMPLATE_CONTENT[type].downloadUrl}"
title="${TEMPLATE_CONTENT[type].downloadTitle}"
target="_blank">Chrome ${this.channels[type].version}</a>`
: html`
target="_blank">Chrome ${this.channels[type].version}</a>` :
html`
Chrome ${this.channels[type].version}`}
</h1>
</div>

Просмотреть файл

@ -1,5 +1,5 @@
// TODO(yangguang): This component is not tested. Data is not available in devserver, so cannot be tested locally.
import {LitElement, css, html} from 'lit-element';
import {LitElement, css, html} from 'lit';
import SHARED_STYLES from '../css/shared.css';
class ChromedashTimeline extends LitElement {
@ -146,8 +146,8 @@ class ChromedashTimeline extends LitElement {
datatable.addRows(rowArray);
function aggregateByMonth(date) {
let month = date.getMonth();
let year = date.getFullYear();
const month = date.getMonth();
const year = date.getFullYear();
return new Date(year, month);
}
@ -288,7 +288,7 @@ ORDER BY yyyymmdd DESC, client`;
// Capitalizes the first letter of a word.
function capitalize(word) {
let letters = word.split('');
const letters = word.split('');
letters[0] = letters[0].toUpperCase();
return letters.join('');
}

Просмотреть файл

@ -1,4 +1,4 @@
import {LitElement, css, html} from 'lit-element';
import {LitElement, css, html} from 'lit';
import SHARED_STYLES from '../css/shared.css';
const DEFAULT_DURATION = 7000;

Просмотреть файл

@ -1,6 +1,5 @@
import {LitElement, css, html} from 'lit-element';
import {LitElement, css, html, nothing} from 'lit';
import SHARED_STYLES from '../css/shared.css';
import {nothing} from 'lit-html';
class ChromedashUserlist extends LitElement {

Просмотреть файл

@ -1,4 +1,4 @@
import {LitElement, css, html} from 'lit-element';
import {LitElement, css, html} from 'lit';
import SHARED_STYLES from '../css/shared.css';
class ChromedashXMeter extends LitElement {
@ -46,11 +46,11 @@ class ChromedashXMeter extends LitElement {
}
render() {
return html`
<div @click="${this.showTimeline}" style="width: ${(this.value / this.max * 100)}%">
return html`
<div @click="${this.showTimeline}" style="width: ${(this.value / this.max * 100)}%">
<span>${this.value <= 0.000001 ? '<=0.000001%' : this.value + '%'}
</span>
</div>
</span>
</div>
`;
}
}

Просмотреть файл

@ -3,7 +3,7 @@
* This file uses a similar pattern used in iron-icons (https://github.com/PolymerElements/iron-icons/blob/master/iron-icons.js)
*/
import {html} from 'lit-element';
import {html, render} from 'lit';
import '@polymer/iron-icon';
import '@polymer/iron-iconset-svg';
@ -103,5 +103,4 @@ const template = html`
</iron-iconset-svg>
`;
const element = template.getTemplateElement().content.firstElementChild;
document.head.appendChild(element);
render(template, document.body);

Просмотреть файл

@ -1,7 +1,7 @@
// This file contains helper functions for our elements.
import {html} from 'lit-element';
import {unsafeHTML} from 'lit-html/directives/unsafe-html.js';
import {html} from 'lit';
import {unsafeHTML} from 'lit/directives/unsafe-html.js';
/* Convert user-entered text into safe HTML with clickable links
* where appropriate. Returns a lit-html TemplateResult.

Просмотреть файл

@ -72,14 +72,14 @@ class ChromeStatusClient {
* Then strip off the defensive prefix from the response. */
async doFetch(resource, httpMethod, body, includeToken=true) {
const url = this.baseUrl + resource;
let headers = {
const headers = {
'accept': 'application/json',
'content-type': 'application/json',
};
if (includeToken) {
headers['X-Xsrf-Token'] = this.token;
}
let options = {
const options = {
method: httpMethod,
credentials: 'same-origin',
headers: headers,
@ -136,7 +136,7 @@ class ChromeStatusClient {
signIn(googleUser) {
// TODO(jrobbins): Consider using profile pic.
// let profile = googleUser.getBasicProfile();
let idToken = googleUser.getAuthResponse().id_token;
const idToken = googleUser.getAuthResponse().id_token;
// We don't use doPost because we don't already have a XSRF token.
return this.doFetch('/login', 'POST', {'id_token': idToken}, false);
}

Просмотреть файл

@ -16,8 +16,8 @@ const legendEl = document.querySelector('chromedash-legend');
function debounce(func, threshold_ms = 300) {
let timeout;
return function(...args) {
let context = this; // eslint-disable-line no-invalid-this
let later = () => {
const context = this; // eslint-disable-line no-invalid-this
const later = () => {
func.apply(context, args);
};
clearTimeout(timeout);

Просмотреть файл

@ -85,9 +85,9 @@ class Metric {
// Use User Timing API results if available, otherwise return
// performance.now() fallback.
if (Metric.supportsPerfNow) {
let items = window.performance.getEntriesByName(name);
const items = window.performance.getEntriesByName(name);
for (let i = 0; i < items.length; ++i) {
let item = items[i];
const item = items[i];
console.info(name, item.duration, 'ms');
}
}
@ -128,8 +128,8 @@ class Metric {
// Support: developer.mozilla.org/en-US/docs/Web/API/Performance/mark
if (Metric.supportsPerfMark) {
let startMark = `mark_${this.name}_start`;
let endMark = `mark_${this.name}_end`;
const startMark = `mark_${this.name}_start`;
const endMark = `mark_${this.name}_end`;
performance.mark(endMark);
performance.measure(this.name, startMark, endMark);
}

Просмотреть файл

@ -11,7 +11,7 @@ if (header) {
async function init() {
// Prepare data for chromedash-roadmap
const channels = await channelsPromise;
let featuresPromise = {};
const featuresPromise = {};
channelsArray.forEach((channel) => {
featuresPromise[channel] = window.csClient.getFeaturesInMilestone(channels[channel].version);
@ -19,7 +19,7 @@ async function init() {
const features = {};
for (let channel of channelsArray) {
for (const channel of channelsArray) {
features[channel] = await featuresPromise[channel];
}
@ -34,7 +34,7 @@ async function init() {
roadmapEl.channels = channels;
roadmapEl.lastFutureFetchedOn = channels[channelsArray[1]].version;
roadmapEl.lastPastFetchedOn = channels[channelsArray[1]].version;
let cardsDisplayed = roadmapEl.computeItems();
const cardsDisplayed = roadmapEl.computeItems();
roadmapEl.lastMilestoneVisible = channels[channelsArray[cardsDisplayed-1]].version;
window.csClient.getStars().then((starredFeatureIds) => {

Просмотреть файл

@ -55,7 +55,7 @@ async function init() {
}
function mapFeaturesToComponents(features) {
let set = new Set();
const set = new Set();
features.forEach(f => set.add(...f.browsers.chrome.blink_components));
const featuresMappedToComponents = {};
@ -69,7 +69,7 @@ function mapFeaturesToComponents(features) {
});
});
for (let [, feautreList] of Object.entries(featuresMappedToComponents)) {
for (const [, feautreList] of Object.entries(featuresMappedToComponents)) {
sortFeaturesByName(feautreList);
}