// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import * as i18n from '../../core/i18n/i18n.js'; import type * as Protocol from '../../generated/protocol.js'; import * as ComputedStyle from '../../models/computed_style/computed_style.js'; import * as UI from '../../ui/legacy/legacy.js'; import {html, render} from '../../ui/lit/lit.js'; import platformFontsWidgetStyles from './platformFontsWidget.css.js'; const UIStrings = { /** * @description Section title text content in Platform Fonts Widget of the Elements panel */ renderedFonts: 'Rendered Fonts', /** * @description Font property title text content in Platform Fonts Widget of the Elements panel */ familyName: 'Family name', /** * @description Font property title text content in Platform Fonts Widget of the Elements panel */ postScriptName: 'PostScript name', /** * @description Font property title text content in Platform Fonts Widget of the Elements panel */ fontOrigin: 'Font origin', /** * @description Text in Platform Fonts Widget of the Elements panel */ networkResource: 'Network resource', /** * @description Text in Platform Fonts Widget of the Elements panel */ localFile: 'Local file', /** * @description Text in Platform Fonts Widget of the Elements panel. Indicates a number of glyphs (characters) . */ dGlyphs: '{n, plural, =1 {(# glyph)} other {(# glyphs)}}', } as const; const str_ = i18n.i18n.registerUIStrings('panels/elements/PlatformFontsWidget.ts', UIStrings); const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_); interface PlatformFontsWidgetInput { platformFonts: Protocol.CSS.PlatformFontUsage[]|null; } type View = (input: PlatformFontsWidgetInput, output: object, target: HTMLElement) => void; export const DEFAULT_VIEW: View = (input, _output, target) => { const isEmptySection = !input.platformFonts?.length; // clang-format off render(html`