diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5182705..5af7239 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Changelog
+## v0.7.0
+
+- Upgrade to Material 3 Web Components (https://material-web.dev/).
+- Use Web Test Runner instead of Karma.
+
## v0.6.6
- Add a scrollbar to the right panel of the Matches tab.
diff --git a/README.md b/README.md
index 4085d28..6376613 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,9 @@ page can understand what is shown, but also useful to experts, by offering a
convenient interactive user interface with matcher, metric and filter settings.
The presented data should be easily reproducible and up-to-date.
-In contrast to more traditional
+Codec-Compare is based on
+[Rate-Complexity Clouds](https://doi.org/10.1109/PCS65673.2025.11417613) rather
+than Rate-Distortion Curves. In contrast to more traditional
[comparative benchmarks](https://storage.googleapis.com/avif-comparison/index.html),
Codec-Compare aims to aggregate statistics after comparing pairs of two
similarly encoded images, to avoid some of the bias brought by comparing already
@@ -82,7 +84,7 @@ Codec-Compare has:
`npm run build`).
- A `vite.config.js` Vite configuration file (used by `npm run dev` and `npm
run build`).
- - A `karma.conf.js` Karma configuration file (used by `npm run test`).
+ - A `web-test-runner.config.mjs` configuration file (used by `npm run test`).
Note: See
https://lit.dev/docs/components/properties/#avoiding-issues-with-class-fields
diff --git a/index.html b/index.html
index fa13fd4..74fa120 100644
--- a/index.html
+++ b/index.html
@@ -20,19 +20,21 @@
Codec Compare
+
+
-
diff --git a/karma.conf.js b/karma.conf.js
deleted file mode 100644
index 75cb5bd..0000000
--- a/karma.conf.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * @license
- * Copyright 2023 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * See http://karma-runner.github.io/6.4/config/files.html#loading-assets.
- * @param {!Object} config
- */
-module.exports = (config) => {
- config.set({
- frameworks: ['jasmine', 'karma-typescript'],
- plugins: [
- 'karma-jasmine', 'karma-chrome-launcher', 'karma-typescript',
- 'karma-spec-reporter'
- ],
- karmaTypescriptConfig: {
- tsconfig: './tsconfig.json',
- bundlerOptions:
- {transforms: [require('karma-typescript-es6-transform')()]}
- },
- files: [
- {pattern: 'src/**/*.ts'},
- {pattern: 'assets/**', watched: false, included: false, served: true}
- ],
- proxies: {'/assets/': '/base/assets/'},
- preprocessors: {'src/**/*.ts': ['karma-typescript']},
- reporters: ['spec', 'karma-typescript'],
- colors: true,
- logLevel: config.LOG_INFO,
- browsers: ['ChromeHeadless'],
- // Makes "karma start" return. Avoids the need for Ctrl+C after "npm test".
- singleRun: true
- });
-};
\ No newline at end of file
diff --git a/package.json b/package.json
index 91c1ec4..e06f060 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "codec_compare",
- "version": "0.6.6",
+ "version": "0.7.0",
"description": "Codec performance comparison tool",
"publisher": "Google LLC",
"author": "Yannis Guyon",
@@ -10,37 +10,22 @@
"build": "vite build",
"postbuild": "./postbuild.sh",
"preview": "vite preview --open",
- "test": "karma start"
+ "test": "web-test-runner \"src/**/*_test.ts\" --node-resolve"
},
"devDependencies": {
- "@types/jasmine": "^5.1.4",
- "@types/node": "^20.10.4",
+ "@types/jasmine": "^5.1.5",
+ "@types/node": "^22.10.2",
"@types/plotly.js-dist": "npm:@types/plotly.js@^2.12.30",
- "jasmine-core": "^5.1.1",
- "karma": "^6.4.2",
- "karma-chrome-launcher": "^3.2.0",
- "karma-jasmine": "^5.1.0",
- "karma-spec-reporter": "^0.0.36",
- "karma-typescript": "^5.5.4",
- "karma-typescript-es6-transform": "^5.5.4",
- "typescript": "^5.3.3",
- "vite": "^6.3.2"
+ "@web/dev-server-esbuild": "^1.0.4",
+ "@web/test-runner": "^0.19.0",
+ "jasmine-core": "^5.5.0",
+ "typescript": "^5.7.2",
+ "vite": "^6.3.2",
+ "web-test-runner-jasmine": "^0.0.6"
},
"dependencies": {
- "@material/mwc-button": "^0.27.0",
- "@material/mwc-checkbox": "^0.27.0",
- "@material/mwc-fab": "^0.27.0",
- "@material/mwc-icon": "^0.27.0",
- "@material/mwc-icon-button": "^0.27.0",
- "@material/mwc-linear-progress": "^0.27.0",
- "@material/mwc-menu": "^0.27.0",
- "@material/mwc-slider": "^0.27.0",
- "@material/mwc-snackbar": "^0.27.0",
- "@material/mwc-switch": "^0.27.0",
- "@material/mwc-tab": "^0.27.0",
- "@material/mwc-tab-bar": "^0.27.0",
- "@material/mwc-textfield": "^0.27.0",
- "lit": "^3.1.0",
- "plotly.js-dist": "^2.27.1"
+ "@material/web": "^1.4.1",
+ "lit": "^3.2.1",
+ "plotly.js-dist": "^2.35.3"
}
}
diff --git a/readme_preview.png b/readme_preview.png
index 5c5d806..b5b19e2 100644
Binary files a/readme_preview.png and b/readme_preview.png differ
diff --git a/src/batch_name_ui.ts b/src/batch_name_ui.ts
index f29e0b0..e9f7251 100644
--- a/src/batch_name_ui.ts
+++ b/src/batch_name_ui.ts
@@ -42,7 +42,7 @@ export class BatchNameUi extends LitElement {
vertical-align: middle;
}
.mono {
- background: var(--mdc-theme-background);
+ background: var(--md-sys-color-background);
font-family: monospace;
vertical-align: middle;
}
diff --git a/src/batch_selection_actions_ui.ts b/src/batch_selection_actions_ui.ts
index 6746711..8fe7e84 100644
--- a/src/batch_selection_actions_ui.ts
+++ b/src/batch_selection_actions_ui.ts
@@ -12,7 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import '@material/mwc-icon-button';
+import '@material/web/iconbutton/icon-button';
+import '@material/web/icon/icon';
import {css, html, LitElement} from 'lit';
import {customElement, property} from 'lit/decorators.js';
@@ -36,26 +37,27 @@ export class BatchSelectionActionsUi extends LitElement {
const batchSelection = this.state.batchSelections[this.batchSelectionIndex];
return html`
- {
batchSelection.isDisplayed = !batchSelection.isDisplayed;
dispatch(EventType.MATCHED_DATA_POINTS_CHANGED);
this.requestUpdate();
}}>
-
+ ${
+ batchSelection.isDisplayed ? 'visibility' : 'visibility_off'}
+
`;
}
static override styles = css`
- mwc-icon-button {
- color: var(--mdc-theme-text);
- /* Make the background disk that appears when hovered slightly bigger
- * than the icon itself, which is 24px. */
- --mdc-icon-button-size: 28px;
- /* Tighten the buttons to save space. */
- margin: -2px;
+ md-icon-button {
+ color: var(--md-sys-color-text);
+ --md-icon-button-icon-size: 20px;
+ --md-icon-button-state-layer-width: 24px;
+ --md-icon-button-state-layer-height: 24px;
+ /* The touch area is hardcoded as at least 48px by 48px. */
+ overflow: hidden;
}
`;
}
diff --git a/src/batch_selection_test.ts b/src/batch_selection_test.ts
index 41818dc..ecafcb1 100644
--- a/src/batch_selection_test.ts
+++ b/src/batch_selection_test.ts
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import 'jasmine';
-
import {BatchSelection} from './batch_selection';
import {Batch, Field} from './entry';
import {dispatch, EventType} from './events';
diff --git a/src/batch_selection_ui.ts b/src/batch_selection_ui.ts
index 5d9bb54..2ac21dc 100644
--- a/src/batch_selection_ui.ts
+++ b/src/batch_selection_ui.ts
@@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import '@material/mwc-button';
import './filtered_images_ui';
import './filters_ui';
diff --git a/src/batch_selections_ui.ts b/src/batch_selections_ui.ts
index 1467cde..308ec06 100644
--- a/src/batch_selections_ui.ts
+++ b/src/batch_selections_ui.ts
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import '@material/mwc-icon';
+import '@material/web/icon/icon';
import './batch_selection_actions_ui';
import {css, html, LitElement} from 'lit';
@@ -111,7 +111,7 @@ export class BatchSelectionsUi extends LitElement {
EventType.FILTERED_DATA_INFO_REQUEST,
{batchIndex: batchSelection.batch.index});
}}>
- filter_alt
+ filter_alt
${field.displayName}=${this.filterChipText(field, fieldFilter)}
`;
}
@@ -187,14 +187,14 @@ export class BatchSelectionsUi extends LitElement {
static override styles = css`
:host {
box-shadow: rgba(0, 0, 0, 0.5) 0px 0px 6px 0px;
- /* Necessary for mwc-menus to work properly without hacks. */
+ /* Necessary for md-menus to work properly without hacks. */
overflow: visible;
/* Does not work without overflow: hidden; */
border-radius: 5px;
}
table {
- color: var(--mdc-theme-text);
+ color: var(--md-sys-color-text);
width: 100%;
white-space: nowrap;
border-collapse: collapse;
@@ -206,21 +206,21 @@ export class BatchSelectionsUi extends LitElement {
border-style: solid;
}
th {
- border-color: var(--mdc-theme-background);
- background: var(--mdc-theme-surface);
+ border-color: var(--md-sys-color-background);
+ background: var(--md-sys-color-surface);
font-size: 20px;
}
td {
- border-color: var(--mdc-theme-surface);
+ border-color: var(--md-sys-color-surface);
font-family: monospace;
font-size: 16px;
}
tr {
- background: var(--mdc-theme-background);
+ background: var(--md-sys-color-background);
}
tr:hover {
- box-shadow: inset 0 0 8px 4px var(--mdc-theme-surface);
+ box-shadow: inset 0 0 8px 4px var(--md-sys-color-surface);
}
tr:not(:hover) batch-selection-actions-ui {
/* Dim the action buttons when the table row is not hovered. */
@@ -249,12 +249,12 @@ export class BatchSelectionsUi extends LitElement {
}
#filterChip {
- --mdc-icon-size: 12px;
+ --md-icon-size: 12px;
font-size: 10px;
padding: 2px 4px;
border-radius: 30px;
- background: var(--mdc-theme-primary);
- color: var(--mdc-theme-background);
+ background: var(--md-sys-color-primary);
+ color: var(--md-sys-color-background);
display: flex;
align-items: center;
justify-content: center;
@@ -265,8 +265,8 @@ export class BatchSelectionsUi extends LitElement {
}
.referenceBatchChip {
- background: var(--mdc-theme-primary);
- color: var(--mdc-theme-background);
+ background: var(--md-sys-color-primary);
+ color: var(--md-sys-color-background);
border-radius: 16px;
padding: 2px 8px;
font-size: 12px;
diff --git a/src/batch_selections_ui_test.ts b/src/batch_selections_ui_test.ts
index b64febb..563c957 100644
--- a/src/batch_selections_ui_test.ts
+++ b/src/batch_selections_ui_test.ts
@@ -11,8 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-
-import 'jasmine';
import './batch_selections_ui';
import {Batch, Field} from './entry';
diff --git a/src/batch_ui.ts b/src/batch_ui.ts
index 16e60a6..70fe6f3 100644
--- a/src/batch_ui.ts
+++ b/src/batch_ui.ts
@@ -12,7 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import '@material/mwc-button';
+import '@material/web/button/filled-button';
+import '@material/web/icon/icon';
import './batch_name_ui';
import './constants_table_ui';
import './fields_table_ui';
@@ -62,49 +63,50 @@ export class BatchUi extends LitElement {
-
-
+ Download batch
+ download
+
${
this.state.batches.length <= 2 ?
html`` :
batchIndex === refIndex ?
- // disabled mwc-button title does not appear. Use a div.
+ // disabled md-filled-button title does not appear. Use a div.
html`
@@ -181,8 +179,8 @@ export class FiltersUi extends LitElement {
padding: 0 15px;
height: 40px;
border-radius: 30px;
- background: var(--mdc-theme-primary);
- color: var(--mdc-theme-background);
+ background: var(--md-sys-color-primary);
+ color: var(--md-sys-color-background);
display: flex;
align-items: center;
gap: 5px;
@@ -190,23 +188,30 @@ export class FiltersUi extends LitElement {
}
h2 {
margin: 0;
- color: var(--mdc-theme-text);
+ color: var(--md-sys-color-text);
}
#addFilterParent {
- /* mwc-menu and its anchor need a parent with position set to relative. */
+ /* md-menu and its anchor need a parent with position set to relative. */
position: relative;
}
- mwc-menu {
+ #addFilterButton {
+ --md-filled-button-label-text-line-height: 1em;
+ --md-filled-button-container-height: 32px;
+ }
+ md-menu {
/* Otherwise the menu is clipped by the parent's overflow:hidden.
* Unfortunately this prevents the menu from properly reducing in height
* when there is not enough space to display all items.
*/
position: fixed;
/* This way all items should fit on screen. */
- --mdc-menu-item-height: 20px;
- /* Otherwise the menu is rendered under the mwc checkboxes. */
+ --md-menu-item-one-line-container-height: 20px;
+ --md-menu-item-top-space: 0;
+ --md-menu-item-bottom-space: 0;
+ /* Otherwise the menu is rendered under the md checkboxes. */
z-index: 6;
+ white-space: nowrap;
}
.menuItemDisabled {
color: grey;
diff --git a/src/gallery_ui.ts b/src/gallery_ui.ts
index 8696012..2d2d247 100644
--- a/src/gallery_ui.ts
+++ b/src/gallery_ui.ts
@@ -12,7 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import '@material/mwc-icon';
+import '@material/web/button/filled-button';
+import '@material/web/checkbox/checkbox';
+import '@material/web/icon/icon';
import './batch_name_ui';
import './matcher_ui';
@@ -110,34 +112,34 @@ export class GalleryUi extends LitElement {
${Array.from(this.tagToAssetNames.keys()).map(tag => html`
- addTag(tag)}
+ addTag(tag)}
title="Enable all assets tagged as ${tag}">
- add
+ add
${tag}
-
+
- removeTag(tag)}
+ removeTag(tag)}
title="Disable all assets tagged as ${tag}">
- remove
+ remove
${tag}
-
+
+
+
`;
}
return html`
@@ -241,7 +243,7 @@ export class GalleryUi extends LitElement {
}
table {
- color: var(--mdc-theme-text);
+ color: var(--md-sys-color-text);
border-collapse: collapse;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.2);
}
@@ -252,16 +254,16 @@ export class GalleryUi extends LitElement {
border-style: solid;
}
th {
- border-color: var(--mdc-theme-background);
- background: var(--mdc-theme-surface);
+ border-color: var(--md-sys-color-background);
+ background: var(--md-sys-color-surface);
}
td {
- border-color: var(--mdc-theme-surface);
+ border-color: var(--md-sys-color-surface);
font-family: monospace;
word-break: break-word;
}
tr {
- background: var(--mdc-theme-background);
+ background: var(--md-sys-color-background);
}
#tags td {
@@ -283,7 +285,7 @@ export class GalleryUi extends LitElement {
overflow: hidden;
overflow-wrap: break-word;
text-align: center;
- color: var(--mdc-theme-text);
+ color: var(--md-sys-color-text);
box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 4px 0px;
}
#gallery > a {
@@ -317,12 +319,12 @@ export class GalleryUi extends LitElement {
.linkOverlay:hover{
opacity: 1;
}
- .linkOverlay > mwc-icon {
- color: var(--mdc-theme-background);
+ .linkOverlay > md-icon {
+ color: var(--md-sys-color-background);
font-size: 16px;
}
- mwc-checkbox {
+ md-checkbox {
position: absolute;
top: 0;
left: 0;
@@ -339,8 +341,8 @@ export class GalleryUi extends LitElement {
padding: 2px 4px;
border-radius: 3px;
font-size: 12px;
- color: var(--mdc-theme-background);
- background: var(--mdc-theme-primary);
+ color: var(--md-sys-color-background);
+ background: var(--md-sys-color-primary);
}
`;
}
diff --git a/src/help_ui.ts b/src/help_ui.ts
index 1f467c3..ae603cd 100644
--- a/src/help_ui.ts
+++ b/src/help_ui.ts
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import '@material/mwc-fab';
-import '@material/mwc-icon';
+import '@material/web/fab/fab';
+import '@material/web/icon/icon';
import {css, html, LitElement} from 'lit';
import {customElement, property, query} from 'lit/decorators.js';
@@ -199,7 +199,7 @@ export class HelpUi extends LitElement {
bits-per-pixel usually seen on the web
- open_in_new.
+ open_in_new.
Click the visibility button to show or hide a specific batch in the plot
and in the SUMMARY tab. ${
this.rdMode ? html`
@@ -229,9 +229,9 @@ export class HelpUi extends LitElement {
matched pairs based on that asset accross all batches.`}
Each image can be toggled on or off across all batches.
Images can be toggled on or off in bulk using the filter tags.
- "addTAG" enables all images associated with that
+ "addTAG" enables all images associated with that
TAG.
- "removeTAG" disables all images associated with that
+ "removeTAG" disables all images associated with that
TAG.
`;
@@ -270,18 +270,18 @@ export class HelpUi extends LitElement {
For an introduction to image file formats, please see this
- Wikipedia article open_in_new.
+ Wikipedia article open_in_new.
For any question or comment on this tool, please open an issue on
- GitHub open_in_new.
+ GitHub open_in_new.
-
-
+
+ close
+
`;
}
@@ -340,9 +340,9 @@ export class HelpUi extends LitElement {
a {
color: white;
}
-
- mwc-icon {
- font-size: 0.8em;
+ md-icon {
+ vertical-align: middle;
+ --md-icon-size: 1em;
}
`;
}
\ No newline at end of file
diff --git a/src/histogram_test.ts b/src/histogram_test.ts
index 47680a0..0c24727 100644
--- a/src/histogram_test.ts
+++ b/src/histogram_test.ts
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import 'jasmine';
-
import {mergeHistograms} from './batch_merger';
import {BatchSelection} from './batch_selection';
import {Batch, Field, FieldId} from './entry';
diff --git a/src/loading_ui.ts b/src/loading_ui.ts
index 746fe47..33b079f 100644
--- a/src/loading_ui.ts
+++ b/src/loading_ui.ts
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import '@material/mwc-linear-progress';
+import '@material/web/progress/linear-progress';
import {css, html, LitElement} from 'lit';
import {customElement, property} from 'lit/decorators.js';
@@ -25,14 +25,11 @@ export class LoadingUi extends LitElement {
@property({type: Number}) progress = 0;
override render() {
- const progressFirstHalf = Math.min(1, this.progress * 2);
- const progressSecondHalf = Math.max(0, this.progress * 2 - 1);
return html`
${this.text}
-
-
+
+
`;
}
@@ -49,7 +46,7 @@ export class LoadingUi extends LitElement {
align-items: center;
overflow: hidden;
z-index: 10;
- background: var(--mdc-theme-surface);
+ background: var(--md-sys-color-surface);
opacity: 1;
transition: opacity 0.3s;
cursor: wait;
@@ -57,7 +54,7 @@ export class LoadingUi extends LitElement {
.card {
padding: 16px;
- background: var(--mdc-theme-background);
+ background: var(--md-sys-color-background);
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.2);
border-radius: 20px;
display: flex;
@@ -70,7 +67,7 @@ export class LoadingUi extends LitElement {
p {
margin: 10px;
padding: 0;
- color: var(--mdc-theme-text);
+ color: var(--md-sys-color-text);
font-size: 26px;
}
`;
diff --git a/src/match_image_ui.ts b/src/match_image_ui.ts
index c4e6f54..a0ac068 100644
--- a/src/match_image_ui.ts
+++ b/src/match_image_ui.ts
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import '@material/mwc-icon';
+import '@material/web/icon/icon';
import './batch_name_ui';
import './filtered_images_ui';
import './filters_ui';
@@ -86,8 +86,8 @@ export class MatchImageUi extends LitElement {
`;
}
@@ -138,8 +137,8 @@ export class MatchesUi extends LitElement {
padding: 0 15px;
height: 40px;
border-radius: 30px;
- background: var(--mdc-theme-primary);
- color: var(--mdc-theme-background);
+ background: var(--md-sys-color-primary);
+ color: var(--md-sys-color-background);
display: flex;
align-items: center;
gap: 5px;
@@ -150,7 +149,7 @@ export class MatchesUi extends LitElement {
margin: 0;
}
- mwc-button mwc-icon {
+ md-filled-button md-icon {
margin-left: 8px;
font-size: 16px;
}
diff --git a/src/metric_test.ts b/src/metric_test.ts
index f98dc9b..a16e344 100644
--- a/src/metric_test.ts
+++ b/src/metric_test.ts
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import 'jasmine';
-
import {Batch, Field} from './entry';
import {Match} from './matcher';
import {computeStats, FieldMetric} from './metric';
diff --git a/src/metric_ui.ts b/src/metric_ui.ts
index 317c55a..df9fdb9 100644
--- a/src/metric_ui.ts
+++ b/src/metric_ui.ts
@@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import '@material/mwc-icon';
-import './mwc_button_fit';
+import '@material/web/icon/icon';
import './tooltip_ui';
import {css, html, LitElement} from 'lit';
@@ -33,24 +32,23 @@ export class MetricUi extends LitElement {
private renderDeleteButton() {
if (this.isFirst && this.isLast) {
- // title on a disabled mwc-button-fit does not work. Encapsulate in a div.
+ // title on a disabled button does not work. Encapsulate in a div.
return html`
- delete
+
+ delete
+
`;
}
- return html` {
+ return html`
+ {
this.metric.enabled = false;
dispatch(EventType.MATCHER_OR_METRIC_CHANGED);
}}
- title="Delete metric"
- >delete`;
+ title="Delete metric">
+ delete
+ `;
}
override render() {
@@ -71,7 +69,7 @@ export class MetricUi extends LitElement {
static override styles = css`
:host {
- background-color: var(--mdc-theme-surface);
+ background-color: var(--md-sys-color-surface);
margin: 0;
padding: 6px;
border-radius: 6px;
@@ -82,12 +80,14 @@ export class MetricUi extends LitElement {
}
p {
margin: 0;
- color: var(--mdc-theme-text);
+ color: var(--md-sys-color-text);
font-size: 20px;
}
- mwc-icon {
- font-size: 20px;
+ md-filled-icon-button {
+ --md-filled-icon-button-icon-size: 20px;
+ --md-filled-icon-button-container-width: 24px;
+ --md-filled-icon-button-container-height: 24px;
}
`;
}
diff --git a/src/metrics_ui.ts b/src/metrics_ui.ts
index d4dd023..f36c41e 100644
--- a/src/metrics_ui.ts
+++ b/src/metrics_ui.ts
@@ -12,12 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import '@material/mwc-fab';
-import '@material/mwc-menu';
+import '@material/web/fab/fab';
+import '@material/web/menu/menu';
+import '@material/web/menu/menu-item';
+import '@material/web/icon/icon';
import './metric_ui';
-import {Fab} from '@material/mwc-fab';
-import {Menu} from '@material/mwc-menu';
+import {MdFab} from '@material/web/fab/fab';
+import {MdMenu} from '@material/web/menu/menu';
+import {MenuItem} from '@material/web/menu/menu-item';
import {css, html, LitElement} from 'lit';
import {customElement, property, query} from 'lit/decorators.js';
@@ -30,8 +33,8 @@ import {State} from './state';
export class MetricsUi extends LitElement {
@property({attribute: false}) state!: State;
- @query('#addMetricMenu') private readonly addMetricMenu!: Menu;
- @query('#addMetricButton') private readonly addMetricButton!: Fab;
+ @query('#addMetricMenu') private readonly addMetricMenu!: MdMenu;
+ @query('#addMetricButton') private readonly addMetricButton!: MdFab;
override connectedCallback() {
super.connectedCallback();
@@ -44,35 +47,32 @@ export class MetricsUi extends LitElement {
return html`${this.state.metrics.map((metric: FieldMetric) => {
const fieldName =
this.state.batches[0].fields[metric.fieldIndices[0]].displayName;
- return metric.enabled ?
- html`${fieldName}` :
- html`${fieldName}`;
+ return metric.enabled ? html`
+ ${fieldName}` :
+ html` {
+ metric.enabled = true;
+ dispatch(EventType.MATCHER_OR_METRIC_CHANGED);
+ }}>${fieldName}`;
})}`;
}
private renderAddMetricMenu() {
- // mwc-menu and its anchor need a parent with position set to relative.
+ // md-menu and its anchor need a parent with position set to relative.
return html`
- {
- this.addMetricMenu.show();
+ this.addMetricMenu.open = !this.addMetricMenu.open;
}}
- id="addMetricButton">
- {
- this.state.metrics[e.detail.index].enabled = true;
- dispatch(EventType.MATCHER_OR_METRIC_CHANGED);
- }}>
+ id="addMetricButton">
+ add
+
+
${this.renderAddMetricMenuItems()}
-
+
`;
}
@@ -106,7 +106,7 @@ export class MetricsUi extends LitElement {
static override styles = css`
:host {
- background: var(--mdc-theme-background);
+ background: var(--md-sys-color-background);
padding: 6px;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.2);
border-radius: 16px;
@@ -120,13 +120,17 @@ export class MetricsUi extends LitElement {
align-self: flex-end;
margin-left: auto;
}
- .menuItemDisabled {
- color: grey;
- }
#addMetricButton {
- /* Save screen space. */
- margin: -6px;
+ --md-fab-container-width: 32px;
+ --md-fab-container-height: 32px;
+ --md-fab-icon-size: 20px;
+ }
+
+ md-menu-item {
+ --md-menu-item-one-line-container-height: 20px;
+ --md-menu-item-top-space: 0;
+ --md-menu-item-bottom-space: 0;
}
`;
}
diff --git a/src/mwc_button_fit.ts b/src/mwc_button_fit.ts
deleted file mode 100644
index 8e008bf..0000000
--- a/src/mwc_button_fit.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2023 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-import {Button} from '@material/mwc-button';
-import {customElement} from 'lit/decorators.js';
-
-/** Same as but with custom width and height. */
-@customElement('mwc-button-fit')
-export class MwcButtonFit extends Button {
- protected override firstUpdated() {
- const button = this.shadowRoot!.querySelector('button')!;
- button.style.minWidth = '0';
- button.style.height = 'auto';
- button.style.padding = '2px 4px';
- }
-}
\ No newline at end of file
diff --git a/src/panel_ui.ts b/src/panel_ui.ts
index 7bae1da..90e7f20 100644
--- a/src/panel_ui.ts
+++ b/src/panel_ui.ts
@@ -12,18 +12,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import '@material/mwc-button';
-import '@material/mwc-fab';
-import '@material/mwc-menu';
-import '@material/mwc-tab-bar';
-import '@material/mwc-tab';
+import '@material/web/button/filled-button';
+import '@material/web/fab/fab';
+import '@material/web/menu/menu';
+import '@material/web/menu/menu-item';
+import '@material/web/tabs/tabs';
+import '@material/web/tabs/secondary-tab';
import './batch_name_ui';
import './batch_selection_ui';
import './batch_ui';
import './matches_ui';
+import '@material/web/icon/icon';
-import {ActionDetail} from '@material/mwc-list';
-import {Menu} from '@material/mwc-menu';
+import {MdMenu} from '@material/web/menu/menu';
+import {MenuItem} from '@material/web/menu/menu-item';
import {css, html, LitElement} from 'lit';
import {customElement, property, query} from 'lit/decorators.js';
@@ -43,7 +45,7 @@ export class PanelUi extends LitElement {
/** Currently displayed component. */
private currentTab = BatchTab.METADATA;
- @query('#selectionMenu') private readonly selectionMenu!: Menu;
+ @query('#selectionMenu') private readonly selectionMenu!: MdMenu;
override connectedCallback() {
super.connectedCallback();
@@ -111,34 +113,32 @@ export class PanelUi extends LitElement {
}}>
${
@@ -146,46 +146,46 @@ export class PanelUi extends LitElement {
// Rate-Distortion curve mode does not use any batch as reference.
'' :
batchIndex === this.state.referenceBatchSelectionIndex ?
- // disabled mwc-button title does not appear. Use a div.
+ // disabled md-filled-button title does not appear. Use a div.
html`