@design.estate/dees-catalog 21.30.1 → 21.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist_bundle/bundle.js +194 -203
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/demos/charts.js +5 -3
- package/dist_ts_web/elements/00group-chart/dees-chart-area/component.d.ts +14 -3
- package/dist_ts_web/elements/00group-chart/dees-chart-area/component.js +23 -5
- package/dist_ts_web/elements/00group-chart/dees-chart-area/styles.js +7 -2
- package/dist_ts_web/elements/00group-chart/dees-chart-area/template.js +28 -32
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-base.d.ts +2 -8
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-base.js +21 -33
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-styles.d.ts +0 -7
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-styles.js +3 -42
- package/dist_ts_web/elements/00group-chart/dees-chart-frame.d.ts +41 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-frame.js +78 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-log/dees-chart-log.d.ts +10 -2
- package/dist_ts_web/elements/00group-chart/dees-chart-log/dees-chart-log.demo.d.ts +1 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-log/dees-chart-log.demo.js +7 -2
- package/dist_ts_web/elements/00group-chart/dees-chart-log/dees-chart-log.js +88 -96
- package/package.json +1 -1
- package/readme.md +18 -11
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/demos/charts.ts +4 -2
- package/ts_web/elements/00group-chart/dees-chart-area/component.ts +16 -3
- package/ts_web/elements/00group-chart/dees-chart-area/styles.ts +6 -1
- package/ts_web/elements/00group-chart/dees-chart-area/template.ts +27 -31
- package/ts_web/elements/00group-chart/dees-chart-echarts-base.ts +13 -26
- package/ts_web/elements/00group-chart/dees-chart-echarts-styles.ts +2 -42
- package/ts_web/elements/00group-chart/dees-chart-frame.ts +100 -0
- package/ts_web/elements/00group-chart/dees-chart-log/dees-chart-log.demo.ts +6 -1
- package/ts_web/elements/00group-chart/dees-chart-log/dees-chart-log.ts +81 -94
|
@@ -10,7 +10,7 @@ import * as domtools from '@design.estate/dees-domtools';
|
|
|
10
10
|
import { DeesServiceLibLoader, type IEchartsBundle, type IEchartsInstance } from '../../services/index.js';
|
|
11
11
|
import { reducedMotionQuery } from '../00motion.js';
|
|
12
12
|
import { getEchartsThemeOptions } from './dees-chart-echarts-theme.js';
|
|
13
|
-
import '
|
|
13
|
+
import { chartFrame } from './dees-chart-frame.js';
|
|
14
14
|
import './dees-legend/dees-legend.js';
|
|
15
15
|
import type { IDeesLegendItem, IDeesLegendToggleDetail } from './dees-legend/dees-legend.js';
|
|
16
16
|
import { dcLocalize } from '../../i18n/localize.js';
|
|
@@ -25,7 +25,8 @@ import { dcLocalize } from '../../i18n/localize.js';
|
|
|
25
25
|
* standard footer bar. Rows of the host's own about the chart (a notice, what the chart leaves out,
|
|
26
26
|
* figures it does not end on) go into the slots `above` and `below`, over and under the plot: at
|
|
27
27
|
* the tile's inset, the header's, with the legend still the tile's last row at its full width. A
|
|
28
|
-
* host so needs no tile of its own around a chart: the chart is the tile.
|
|
28
|
+
* host so needs no tile of its own around a chart: the chart is the tile. The frame is
|
|
29
|
+
* `chartFrame`, which `dees-chart-area` and `dees-chart-log` draw in as well. One header per tile: a
|
|
29
30
|
* chart in a pane that heads it already hands its title to the pane's header and leaves `label`
|
|
30
31
|
* and `meta` empty, and then draws no header row of its own; `summary` still names it to a screen
|
|
31
32
|
* reader.
|
|
@@ -155,33 +156,19 @@ export abstract class DeesChartEchartsBase extends DeesElement {
|
|
|
155
156
|
values: item.value === undefined ? undefined : [{ value: item.value }],
|
|
156
157
|
off: !this.legendShown(item.name),
|
|
157
158
|
}));
|
|
158
|
-
return
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
</div>
|
|
167
|
-
${this.renderRows('below')}
|
|
168
|
-
<p class="chartSummary">${this.summary || this.dataSummary()}</p>
|
|
169
|
-
${legend.length ? html`<div slot="footer" class="chartLegend"><dees-legend interactive label=${this.t('chart.series')} .items=${legend} @item-toggle=${(event: CustomEvent<IDeesLegendToggleDetail>) => {
|
|
159
|
+
return chartFrame(this, {
|
|
160
|
+
label: this.label,
|
|
161
|
+
meta: this.meta,
|
|
162
|
+
frameless: this.frameless,
|
|
163
|
+
plot: html`<div class="chartContainer" aria-hidden="true"><div class="chartPlot"></div></div>`,
|
|
164
|
+
state: message,
|
|
165
|
+
summary: this.summary || this.dataSummary(),
|
|
166
|
+
footer: legend.length ? html`<dees-legend interactive label=${this.t('chart.series')} .items=${legend} @item-toggle=${(event: CustomEvent<IDeesLegendToggleDetail>) => {
|
|
170
167
|
const hidden = new Set(this.hiddenSeries);
|
|
171
168
|
if (event.detail.on) hidden.delete(event.detail.item.label); else hidden.add(event.detail.item.label);
|
|
172
169
|
this.hiddenSeries = hidden; this.updateChart();
|
|
173
|
-
}}></dees-legend
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* The host's rows over or under the plot, from the slot `above` or `below`; no row, and no room,
|
|
179
|
-
* while nothing is slotted there. Read from the light DOM as each render runs, so the first frame
|
|
180
|
-
* already has them; a `slotchange` renders again.
|
|
181
|
-
*/
|
|
182
|
-
private renderRows(placeArg: 'above' | 'below'): TemplateResult {
|
|
183
|
-
const slotted = this.querySelector(`:scope > [slot="${placeArg}"]`) !== null;
|
|
184
|
-
return html`<div class="chartRows ${placeArg} ${slotted ? '' : 'empty'}"><slot name=${placeArg} @slotchange=${() => this.requestUpdate()}></slot></div>`;
|
|
170
|
+
}}></dees-legend>` : undefined,
|
|
171
|
+
});
|
|
185
172
|
}
|
|
186
173
|
|
|
187
174
|
public async updated(changedProperties: Map<PropertyKey, unknown>) {
|
|
@@ -1,53 +1,13 @@
|
|
|
1
1
|
import { css, cssManager } from '@design.estate/dees-element';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { tileFooterBar, tileHeaderBar } from '../00tilebar.js';
|
|
2
|
+
import { themeDefaultStyles } from '../00theme.js';
|
|
3
|
+
import { chartFrameStyles, chartInsetStyles } from './dees-chart-frame.js';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
|
-
* The region inset: `--chart-inset-inline` while frameless, unset otherwise. The chart hands it
|
|
8
|
-
* on to its tile, whose header and footer bars, the chart's title and legend, pad to it.
|
|
9
|
-
*/
|
|
10
|
-
export const chartInsetStyles = insetInlineStyles('--chart-inset-inline');
|
|
11
|
-
|
|
12
|
-
/** Shared frame for canvas and SVG chart engines. Include `chartInsetStyles` before it. */
|
|
13
|
-
export const chartFrameStyles = css`
|
|
14
|
-
:host { display: block; height: 400px; min-width: 0; font: 13px/1.5 var(--dees-font-family); color: var(--dees-color-text-primary); }
|
|
15
|
-
dees-tile { height: 100%; min-width: 0; }
|
|
16
|
-
/* The title and the legend are the tile's standard bars, as tall as any tile's, at the tile's
|
|
17
|
-
inset: the tile gets the region inset, and what the chart slots into it resets it. */
|
|
18
|
-
:host > dees-tile { --dees-inset-inline: var(--chart-inset-inline); }
|
|
19
|
-
:host > dees-tile > * { --dees-inset-inline: initial; }
|
|
20
|
-
dees-tile::part(outer) { border-color: var(--dees-color-border-subtle); }
|
|
21
|
-
.chartHeader { ${tileHeaderBar} }
|
|
22
|
-
.chartLabel { flex: 1; min-width: 0; margin: 0; font: inherit; overflow-wrap: anywhere; }
|
|
23
|
-
/* The meta text at the end of the header's line, muted as a table's subtitle; where the tile is
|
|
24
|
-
too narrow for both it wraps under the title, at its start, and the bar grows by that line. */
|
|
25
|
-
.chartHeader.hasMeta { flex-wrap: wrap; gap: var(--dees-spacing-2xs) var(--dees-spacing-md); }
|
|
26
|
-
.chartHeader.hasMeta .chartLabel { flex: 1 1 auto; }
|
|
27
|
-
.chartMeta { min-width: 0; color: var(--dees-color-text-muted); font-weight: 400; overflow-wrap: anywhere; }
|
|
28
|
-
.chartLegend { ${tileFooterBar} }
|
|
29
|
-
.chartContainer { position: absolute; inset: 0; }
|
|
30
|
-
.chartState { position: absolute; inset: 0; display: grid; place-content: center; padding: 24px; text-align: center; color: var(--dees-color-text-muted); background: var(--dees-color-bg-primary); }
|
|
31
|
-
.chartSummary { ${visuallyHidden} }
|
|
32
|
-
.expandBtn { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; margin-inline-start: auto; width: 28px; height: 28px; border: 0; border-radius: var(--dees-radius-md); background: transparent; color: var(--dees-color-text-secondary); cursor: pointer; padding: 0; }
|
|
33
|
-
.expandBtn:focus-visible { outline: var(--dees-line-width-focus-ring) solid var(--dees-color-focus-ring); outline-offset: 2px; }
|
|
34
|
-
@media (hover: hover) { .expandBtn:hover { background: var(--dees-color-hover); } }
|
|
35
|
-
@media (pointer: coarse) { .expandBtn { width: var(--dees-control-height-touch); height: var(--dees-control-height-touch); } }
|
|
36
|
-
`;
|
|
37
|
-
/**
|
|
38
|
-
* The tile's content is a column: the host's rows above, the plot, the host's rows below. The rows
|
|
39
|
-
* keep their height and sit at the tile's inset, the header's; the plot takes the rest of the
|
|
40
|
-
* host's height, or, while the host's height is `auto`, `--dees-chart-plot-height`.
|
|
41
|
-
*
|
|
42
6
|
* The element ECharts draws into fills the plot's frame, whatever position ECharts writes on it.
|
|
43
7
|
* ECharts insets its plot by 16px itself; under a region inset the frame adds the rest, so axes
|
|
44
8
|
* and labels line up with the header.
|
|
45
9
|
*/
|
|
46
10
|
const echartsPlotStyles = css`
|
|
47
|
-
dees-tile::part(content) { display: flex; flex-direction: column; }
|
|
48
|
-
.chartArea { position: relative; flex: 1 1 var(--dees-chart-plot-height, 320px); min-height: 0; }
|
|
49
|
-
.chartRows { flex: none; display: flex; flex-direction: column; gap: var(--dees-spacing-md); padding: var(--dees-spacing-md) var(--chart-inset-inline, var(--dees-spacing-lg)); }
|
|
50
|
-
.chartRows.empty { display: none; }
|
|
51
11
|
.chartContainer { inset-inline: calc(var(--chart-inset-inline, 16px) - 16px); }
|
|
52
12
|
.chartPlot { width: 100%; height: 100%; }
|
|
53
13
|
`;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { css, html, type DeesElement, type TemplateResult } from '@design.estate/dees-element';
|
|
2
|
+
import { insetInlineStyles } from '../00theme.js';
|
|
3
|
+
import { visuallyHidden } from '../00visuallyhidden.js';
|
|
4
|
+
import { tileFooterBar, tileHeaderBar } from '../00tilebar.js';
|
|
5
|
+
import '../00group-layout/dees-tile/dees-tile.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The region inset: `--chart-inset-inline` while frameless, unset otherwise. The chart hands it
|
|
9
|
+
* on to its tile, whose header and footer bars, the chart's title and legend, pad to it.
|
|
10
|
+
*/
|
|
11
|
+
export const chartInsetStyles = insetInlineStyles('--chart-inset-inline');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The frame every chart draws in, whatever draws its plot: ECharts, Lightweight Charts, a
|
|
15
|
+
* terminal. Include `chartInsetStyles` before it.
|
|
16
|
+
*
|
|
17
|
+
* The tile's content is a column: the host's rows above, the plot, the host's rows below. The rows
|
|
18
|
+
* keep their height and sit at the tile's inset, the header's; the plot takes the rest of the
|
|
19
|
+
* host's height, or, while the host's height is `auto`, `--dees-chart-plot-height`.
|
|
20
|
+
*/
|
|
21
|
+
export const chartFrameStyles = css`
|
|
22
|
+
:host { display: block; height: 400px; min-width: 0; font: 13px/1.5 var(--dees-font-family); color: var(--dees-color-text-primary); }
|
|
23
|
+
dees-tile { height: 100%; min-width: 0; }
|
|
24
|
+
/* The title and the legend are the tile's standard bars, as tall as any tile's, at the tile's
|
|
25
|
+
inset: the tile gets the region inset, and what the chart slots into it resets it. */
|
|
26
|
+
:host > dees-tile { --dees-inset-inline: var(--chart-inset-inline); }
|
|
27
|
+
:host > dees-tile > * { --dees-inset-inline: initial; }
|
|
28
|
+
dees-tile::part(outer) { border-color: var(--dees-color-border-subtle); }
|
|
29
|
+
.chartHeader { ${tileHeaderBar} }
|
|
30
|
+
/* The label, and the meta text at the end of its line, muted as a table's subtitle; where the
|
|
31
|
+
heading is too narrow for both the meta wraps under the label, at its start, and the bar grows
|
|
32
|
+
by that line. Controls of the chart's own follow the heading, at the bar's end. */
|
|
33
|
+
.chartHeading { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--dees-spacing-2xs) var(--dees-spacing-md); }
|
|
34
|
+
.chartLabel { flex: 1 1 auto; min-width: 0; margin: 0; font: inherit; overflow-wrap: anywhere; }
|
|
35
|
+
.chartMeta { min-width: 0; color: var(--dees-color-text-muted); font-weight: 400; overflow-wrap: anywhere; }
|
|
36
|
+
.chartLegend { ${tileFooterBar} }
|
|
37
|
+
dees-tile::part(content) { display: flex; flex-direction: column; }
|
|
38
|
+
.chartRows { flex: none; display: flex; flex-direction: column; gap: var(--dees-spacing-md); padding: var(--dees-spacing-md) var(--chart-inset-inline, var(--dees-spacing-lg)); }
|
|
39
|
+
.chartRows.empty { display: none; }
|
|
40
|
+
.chartArea { position: relative; flex: 1 1 var(--dees-chart-plot-height, 320px); min-height: 0; }
|
|
41
|
+
.chartContainer { position: absolute; inset: 0; }
|
|
42
|
+
.chartState { position: absolute; inset: 0; display: grid; place-content: center; padding: 24px; text-align: center; color: var(--dees-color-text-muted); background: var(--dees-color-bg-primary); }
|
|
43
|
+
.chartSummary { ${visuallyHidden} }
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
/** What a chart puts into its frame; see `chartFrame`. */
|
|
47
|
+
export interface IChartFrameContent {
|
|
48
|
+
/** The heading, in the header bar. */
|
|
49
|
+
label: string;
|
|
50
|
+
/** The muted text at the end of the heading's line. */
|
|
51
|
+
meta: string;
|
|
52
|
+
frameless: boolean;
|
|
53
|
+
/** Controls of the chart's own, in the header bar after the heading: a full-page button, a search. */
|
|
54
|
+
headerTools?: TemplateResult;
|
|
55
|
+
/** What the chart draws into; it fills `.chartArea`, which is positioned. */
|
|
56
|
+
plot: TemplateResult;
|
|
57
|
+
/** A message in place of the plot: loading, an error, no data. */
|
|
58
|
+
state?: string;
|
|
59
|
+
/** The text alternative, which a screen reader reads in place of the drawing. */
|
|
60
|
+
summary?: string;
|
|
61
|
+
/** The footer bar's content: the legend, figures about the chart. */
|
|
62
|
+
footer?: TemplateResult;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The host's rows over or under the plot, from the slot `above` or `below`; no row, and no room,
|
|
67
|
+
* while nothing is slotted there. Read from the light DOM as each render runs, so the first frame
|
|
68
|
+
* already has them; a `slotchange` renders again.
|
|
69
|
+
*/
|
|
70
|
+
const chartRows = (hostArg: DeesElement, placeArg: 'above' | 'below'): TemplateResult => {
|
|
71
|
+
const slotted = hostArg.querySelector(`:scope > [slot="${placeArg}"]`) !== null;
|
|
72
|
+
return html`<div class="chartRows ${placeArg} ${slotted ? '' : 'empty'}"><slot name=${placeArg} @slotchange=${() => hostArg.requestUpdate()}></slot></div>`;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A chart's tile (`dees-tile`): the label, with the meta at its end, and the chart's controls in
|
|
77
|
+
* the standard header bar; the host's rows `above` and `below` the plot; the footer bar. Without a
|
|
78
|
+
* label, a meta or controls the tile draws no header row; without a footer, no footer row. Render
|
|
79
|
+
* it from the host, with `chartFrameStyles` in the host's styles.
|
|
80
|
+
*/
|
|
81
|
+
export const chartFrame = (hostArg: DeesElement, contentArg: IChartFrameContent): TemplateResult => {
|
|
82
|
+
const heading = contentArg.label || contentArg.meta
|
|
83
|
+
? html`<div class="chartHeading">${contentArg.label
|
|
84
|
+
? html`<h2 class="chartLabel">${contentArg.label}</h2>`
|
|
85
|
+
: ''}${contentArg.meta ? html`<span class="chartMeta">${contentArg.meta}</span>` : ''}</div>`
|
|
86
|
+
: '';
|
|
87
|
+
return html`<dees-tile .frameless=${contentArg.frameless}>
|
|
88
|
+
${heading || contentArg.headerTools
|
|
89
|
+
? html`<div slot="header" class="chartHeader">${heading}${contentArg.headerTools ?? ''}</div>`
|
|
90
|
+
: ''}
|
|
91
|
+
${chartRows(hostArg, 'above')}
|
|
92
|
+
<div class="chartArea">
|
|
93
|
+
${contentArg.plot}
|
|
94
|
+
${contentArg.state ? html`<div class="chartState" role="status">${contentArg.state}</div>` : ''}
|
|
95
|
+
</div>
|
|
96
|
+
${chartRows(hostArg, 'below')}
|
|
97
|
+
${contentArg.summary === undefined ? '' : html`<p class="chartSummary">${contentArg.summary}</p>`}
|
|
98
|
+
${contentArg.footer ? html`<div slot="footer" class="chartLegend">${contentArg.footer}</div>` : ''}
|
|
99
|
+
</dees-tile>`;
|
|
100
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { html, css, cssManager } from '@design.estate/dees-element';
|
|
2
2
|
import type { DeesChartLog } from '../dees-chart-log/dees-chart-log.js';
|
|
3
3
|
import '@design.estate/dees-element/demotools';
|
|
4
|
+
import '../../00group-feedback/dees-hint/dees-hint.js';
|
|
4
5
|
|
|
5
6
|
export const demoFunc = () => {
|
|
6
7
|
return html`
|
|
@@ -239,6 +240,7 @@ export const demoFunc = () => {
|
|
|
239
240
|
<div class="section-title">Structured Logs (ILogEntry)</div>
|
|
240
241
|
<div class="section-description">
|
|
241
242
|
Structured log entries with level, message, and source. Supports search and keyword highlighting.
|
|
243
|
+
The log states its source beside the title, and a notice of the host's own sits over the terminal.
|
|
242
244
|
</div>
|
|
243
245
|
<div class="controls">
|
|
244
246
|
<dees-button>Add Structured Log</dees-button>
|
|
@@ -248,9 +250,12 @@ export const demoFunc = () => {
|
|
|
248
250
|
<dees-chart-log
|
|
249
251
|
id="structured-log"
|
|
250
252
|
.label=${'Production Server Logs'}
|
|
253
|
+
.meta=${'api-7f9c · eu-central'}
|
|
251
254
|
.highlightKeywords=${['error', 'failed', 'timeout']}
|
|
252
255
|
.showMetrics=${true}
|
|
253
|
-
|
|
256
|
+
>
|
|
257
|
+
<dees-hint slot="above" text="Debug entries are sampled: the server keeps one in ten."></dees-hint>
|
|
258
|
+
</dees-chart-log>
|
|
254
259
|
</div>
|
|
255
260
|
|
|
256
261
|
<!-- Raw Logs Section -->
|
|
@@ -12,13 +12,12 @@ import {
|
|
|
12
12
|
import type { SearchAddon } from '@xterm/addon-search';
|
|
13
13
|
|
|
14
14
|
import { demoFunc } from './dees-chart-log.demo.js';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { themeDefaultStyles } from '../../00theme.js';
|
|
16
|
+
import { chartFrame, chartFrameStyles, chartInsetStyles } from '../dees-chart-frame.js';
|
|
17
17
|
import {
|
|
18
18
|
DeesServiceLibLoader,
|
|
19
19
|
type IXtermSearchAddonBundle,
|
|
20
20
|
} from '../../../services/index.js';
|
|
21
|
-
import '../../00group-layout/dees-tile/dees-tile.js';
|
|
22
21
|
import '../../00group-terminal/dees-terminal-view/dees-terminal-view.js';
|
|
23
22
|
import '../dees-legend/dees-legend.js';
|
|
24
23
|
import type {
|
|
@@ -108,6 +107,10 @@ const sameEntry = (oneArg: ILogEntry, otherArg: ILogEntry | undefined): boolean
|
|
|
108
107
|
* one scroll, never one per line. Raw output (`writeRaw`, `writelnRaw`) is
|
|
109
108
|
* forwarded to the surface as it arrives and is not part of that model, so it
|
|
110
109
|
* is not repainted after a move.
|
|
110
|
+
*
|
|
111
|
+
* The log draws in the frame every chart shares (`chartFrame`): `label` and `meta` head the tile's
|
|
112
|
+
* header bar, with the search and the controls after them; the host's rows go into the slots
|
|
113
|
+
* `above` and `below` the terminal; the level counts and the rate are the footer bar.
|
|
111
114
|
*/
|
|
112
115
|
@customElement('dees-chart-log')
|
|
113
116
|
export class DeesChartLog extends DeesElement {
|
|
@@ -120,6 +123,13 @@ export class DeesChartLog extends DeesElement {
|
|
|
120
123
|
@property({ reflect: true })
|
|
121
124
|
accessor label: string = '';
|
|
122
125
|
|
|
126
|
+
/**
|
|
127
|
+
* A short text beside `label`, before the search: what the log streams or from where
|
|
128
|
+
* ("api-7f9c · eu-central"). Muted; where the header is too narrow it wraps under the label.
|
|
129
|
+
*/
|
|
130
|
+
@property({ reflect: true })
|
|
131
|
+
accessor meta: string = '';
|
|
132
|
+
|
|
123
133
|
@property({ type: Array })
|
|
124
134
|
accessor logEntries: ILogEntry[] = [];
|
|
125
135
|
|
|
@@ -138,7 +148,7 @@ export class DeesChartLog extends DeesElement {
|
|
|
138
148
|
|
|
139
149
|
/**
|
|
140
150
|
* Drop the outer frame and surface: the host already owns the surface. The log itself keeps the
|
|
141
|
-
* terminal's background; the header and the metrics bar take the region inset
|
|
151
|
+
* terminal's background; the header, the rows and the metrics bar take the region inset
|
|
142
152
|
* `--dees-inset-inline`.
|
|
143
153
|
*/
|
|
144
154
|
@property({ type: Boolean, reflect: true })
|
|
@@ -203,32 +213,18 @@ export class DeesChartLog extends DeesElement {
|
|
|
203
213
|
public static styles = [
|
|
204
214
|
themeDefaultStyles,
|
|
205
215
|
cssManager.defaultStyles,
|
|
206
|
-
|
|
216
|
+
chartInsetStyles,
|
|
217
|
+
chartFrameStyles,
|
|
207
218
|
css`
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
font-family: var(--dees-font-family);
|
|
212
|
-
color: var(--dees-color-text-primary);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
dees-tile {
|
|
216
|
-
height: 100%;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.header {
|
|
220
|
-
padding: 8px var(--chartlog-inset-inline, 12px);
|
|
221
|
-
display: flex;
|
|
222
|
-
align-items: center;
|
|
223
|
-
gap: 12px;
|
|
219
|
+
/* The heading keeps its width and the search follows it; where the bar is too narrow, the
|
|
220
|
+
search and the controls wrap onto further lines. */
|
|
221
|
+
.chartHeader {
|
|
224
222
|
flex-wrap: wrap;
|
|
223
|
+
column-gap: 12px;
|
|
225
224
|
}
|
|
226
225
|
|
|
227
|
-
.
|
|
228
|
-
|
|
229
|
-
font-size: 14px;
|
|
230
|
-
color: var(--dees-color-text-primary);
|
|
231
|
-
white-space: nowrap;
|
|
226
|
+
.chartHeading {
|
|
227
|
+
flex: 0 1 auto;
|
|
232
228
|
}
|
|
233
229
|
|
|
234
230
|
.search-box {
|
|
@@ -346,20 +342,13 @@ export class DeesChartLog extends DeesElement {
|
|
|
346
342
|
}
|
|
347
343
|
}
|
|
348
344
|
|
|
349
|
-
/* The
|
|
345
|
+
/* The frame's plot is the surface: the view fills it and fits to it. */
|
|
350
346
|
dees-terminal-view {
|
|
351
347
|
position: absolute;
|
|
352
348
|
inset: 0;
|
|
353
349
|
}
|
|
354
350
|
|
|
355
|
-
/* The
|
|
356
|
-
legend of the level counts, then the rate at the end. */
|
|
357
|
-
.metrics-bar {
|
|
358
|
-
${tileFooterBar}
|
|
359
|
-
padding-inline: var(--chartlog-inset-inline, 12px);
|
|
360
|
-
width: 100%;
|
|
361
|
-
}
|
|
362
|
-
|
|
351
|
+
/* The footer bar: the legend of the level counts, then the rate at the end. */
|
|
363
352
|
.rate {
|
|
364
353
|
margin-inline-start: auto;
|
|
365
354
|
color: var(--dees-color-text-secondary);
|
|
@@ -372,52 +361,53 @@ export class DeesChartLog extends DeesElement {
|
|
|
372
361
|
const jumpTitle = (labelArg: string): string =>
|
|
373
362
|
this.canJumpToMatch ? labelArg : this.t('chartlog.jumpUnavailable');
|
|
374
363
|
const label = this.label || this.t('chartlog.defaultLabel');
|
|
375
|
-
return
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
?disabled=${!this.canJumpToMatch}
|
|
391
|
-
@click=${() => this.searchPrevious()}
|
|
392
|
-
title=${jumpTitle(this.t('chartlog.previousMatch'))}
|
|
393
|
-
>↑</button>
|
|
394
|
-
<button
|
|
395
|
-
?disabled=${!this.canJumpToMatch}
|
|
396
|
-
@click=${() => this.searchNext()}
|
|
397
|
-
title=${jumpTitle(this.t('chartlog.nextMatch'))}
|
|
398
|
-
>↓</button>
|
|
399
|
-
</div>
|
|
364
|
+
return chartFrame(this, {
|
|
365
|
+
label,
|
|
366
|
+
meta: this.meta,
|
|
367
|
+
frameless: this.frameless,
|
|
368
|
+
headerTools: html`
|
|
369
|
+
<div class="search-box">
|
|
370
|
+
<input
|
|
371
|
+
type="text"
|
|
372
|
+
placeholder=${this.t('chartlog.search')}
|
|
373
|
+
aria-label=${this.t('chartlog.search')}
|
|
374
|
+
.value=${this.searchQuery}
|
|
375
|
+
@input=${(eventArg: InputEvent) => this.handleSearchInput(eventArg)}
|
|
376
|
+
@keydown=${(eventArg: KeyboardEvent) => this.handleSearchKeydown(eventArg)}
|
|
377
|
+
/>
|
|
378
|
+
<div class="search-nav">
|
|
400
379
|
<button
|
|
401
|
-
|
|
402
|
-
@click=${() => this.
|
|
403
|
-
title=${this.t(
|
|
404
|
-
>
|
|
405
|
-
${this.t(this.filterMode ? 'chartlog.filter' : 'chartlog.highlight')}
|
|
406
|
-
</button>
|
|
407
|
-
</div>
|
|
408
|
-
<div class="controls">
|
|
380
|
+
?disabled=${!this.canJumpToMatch}
|
|
381
|
+
@click=${() => this.searchPrevious()}
|
|
382
|
+
title=${jumpTitle(this.t('chartlog.previousMatch'))}
|
|
383
|
+
>↑</button>
|
|
409
384
|
<button
|
|
410
|
-
|
|
411
|
-
@click=${() => this.
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
</button>
|
|
415
|
-
<button class="control-button" @click=${() => this.clearLogs()}>
|
|
416
|
-
${this.t('chartlog.clear')}
|
|
417
|
-
</button>
|
|
385
|
+
?disabled=${!this.canJumpToMatch}
|
|
386
|
+
@click=${() => this.searchNext()}
|
|
387
|
+
title=${jumpTitle(this.t('chartlog.nextMatch'))}
|
|
388
|
+
>↓</button>
|
|
418
389
|
</div>
|
|
390
|
+
<button
|
|
391
|
+
class="filter-toggle ${this.filterMode ? 'active' : ''}"
|
|
392
|
+
@click=${() => this.toggleFilterMode()}
|
|
393
|
+
title=${this.t(this.filterMode ? 'chartlog.toHighlight' : 'chartlog.toFilter')}
|
|
394
|
+
>
|
|
395
|
+
${this.t(this.filterMode ? 'chartlog.filter' : 'chartlog.highlight')}
|
|
396
|
+
</button>
|
|
419
397
|
</div>
|
|
420
|
-
|
|
398
|
+
<div class="controls">
|
|
399
|
+
<button
|
|
400
|
+
class="control-button ${this.autoScroll ? 'active' : ''}"
|
|
401
|
+
@click=${() => this.toggleAutoScroll()}
|
|
402
|
+
>
|
|
403
|
+
${this.t('chartlog.autoScroll')}
|
|
404
|
+
</button>
|
|
405
|
+
<button class="control-button" @click=${() => this.clearLogs()}>
|
|
406
|
+
${this.t('chartlog.clear')}
|
|
407
|
+
</button>
|
|
408
|
+
</div>
|
|
409
|
+
`,
|
|
410
|
+
plot: html`
|
|
421
411
|
<dees-terminal-view
|
|
422
412
|
.readOnly=${true}
|
|
423
413
|
.convertEol=${true}
|
|
@@ -425,23 +415,20 @@ export class DeesChartLog extends DeesElement {
|
|
|
425
415
|
.scrollback=${this.maxEntries}
|
|
426
416
|
.label=${label}
|
|
427
417
|
></dees-terminal-view>
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
: ''}
|
|
443
|
-
</dees-tile>
|
|
444
|
-
`;
|
|
418
|
+
`,
|
|
419
|
+
footer: this.showMetrics
|
|
420
|
+
? html`
|
|
421
|
+
<dees-legend label=${this.t('chartlog.levels')} .items=${[
|
|
422
|
+
{ label: this.t('chartlog.errors', { count: this.metrics.error }), color: 'var(--dees-color-accent-error)' },
|
|
423
|
+
{ label: this.t('chartlog.warnings', { count: this.metrics.warn }), color: 'var(--dees-color-accent-warning)' },
|
|
424
|
+
{ label: this.t('chartlog.info', { count: this.metrics.info }), color: 'var(--dees-color-accent-primary)' },
|
|
425
|
+
{ label: this.t('chartlog.success', { count: this.metrics.success }), color: 'var(--dees-color-accent-success)' },
|
|
426
|
+
{ label: this.t('chartlog.debug', { count: this.metrics.debug }), color: 'var(--dees-color-text-muted)' },
|
|
427
|
+
]}></dees-legend>
|
|
428
|
+
<span class="rate">${this.t('chartlog.rate', { rate: this.t.format.intlNumberFormat({ minimumFractionDigits: 1, maximumFractionDigits: 1 }).format(this.metrics.rate) })}</span>
|
|
429
|
+
`
|
|
430
|
+
: undefined,
|
|
431
|
+
});
|
|
445
432
|
}
|
|
446
433
|
|
|
447
434
|
public updated(changedPropertiesArg: Map<string | number | symbol, unknown>): void {
|