@fusion.dev/helix-headless 0.199.1 → 0.201.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/api.json +1 -1
- package/custom-elements.json +3927 -1
- package/dist/element-events.generated.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/log/ansi.d.ts +63 -0
- package/dist/log/ansi.js +163 -0
- package/dist/log/buffer.d.ts +99 -0
- package/dist/log/buffer.js +92 -0
- package/dist/log/group/log-group.d.ts +78 -0
- package/dist/log/group/log-group.js +76 -0
- package/dist/log/index.d.ts +5 -0
- package/dist/log/index.js +4 -0
- package/dist/log/line/log-line.d.ts +108 -0
- package/dist/log/line/log-line.js +145 -0
- package/dist/log/root/log-root.d.ts +415 -0
- package/dist/log/root/log-root.js +772 -0
- package/dist/log/rows.d.ts +60 -0
- package/dist/log/rows.js +91 -0
- package/examples.json +1 -1
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +1333 -0
- package/types/svelte.d.ts +3 -0
- package/types/vue.d.ts +279 -0
- package/types/words.d.ts +71 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
+
import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
import type { LogRun } from '../ansi.js';
|
|
4
|
+
import type { LogLevel } from '../buffer.js';
|
|
5
|
+
/** How a line's time reads: the clock, or how far into the run it was written. */
|
|
6
|
+
export type LogTimes = 'absolute' | 'relative';
|
|
7
|
+
/** Milliseconds since the epoch for `at`, or undefined where it names no time. */
|
|
8
|
+
export declare const timeOf: (at: number | string | undefined) => number | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* @summary One line of a log, with its number, its time, and its text.
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Write one for each line of a log you serve whole, inside a `Log` or a
|
|
14
|
+
* `Log.Group`. The log numbers each line, counting the lines of every group,
|
|
15
|
+
* and tells it whether to show its number and its time.
|
|
16
|
+
*
|
|
17
|
+
* `level` says how much a line matters, and the styled tier draws `warn` and
|
|
18
|
+
* `error` lines apart. The text is the line's own content, so you can mark it
|
|
19
|
+
* up yourself.
|
|
20
|
+
*
|
|
21
|
+
* @since 0.199.0
|
|
22
|
+
* @status experimental
|
|
23
|
+
* @documentation https://fusion.dev/helix/components/log
|
|
24
|
+
*
|
|
25
|
+
* @slot - The text of the line.
|
|
26
|
+
*
|
|
27
|
+
* @csspart line - The row the number, the time, and the text sit in.
|
|
28
|
+
* @csspart line-debug - The row of a line at `debug`.
|
|
29
|
+
* @csspart line-error - The row of a line at `error`.
|
|
30
|
+
* @csspart line-marked - The row of a line `mark-lines` names on the log.
|
|
31
|
+
* @csspart line-warn - The row of a line at `warn`.
|
|
32
|
+
* @csspart match - Text that matches the log's `query`, in a line the log draws from data.
|
|
33
|
+
* @csspart number - The line's number, shown with `line-numbers`, and a link with `line-href`.
|
|
34
|
+
* @csspart run - A stretch of text drawn in an ANSI style, in a line the log draws from data. Its color is `--log-run-color` and its background `--log-run-background-color`.
|
|
35
|
+
* @csspart run-bold - A run drawn bold.
|
|
36
|
+
* @csspart run-dim - A run drawn faint.
|
|
37
|
+
* @csspart run-italic - A run drawn italic.
|
|
38
|
+
* @csspart run-strike - A run drawn struck through.
|
|
39
|
+
* @csspart run-underline - A run drawn underlined.
|
|
40
|
+
* @csspart text - The text of the line.
|
|
41
|
+
* @csspart time - When the line was written, shown with `timestamps`.
|
|
42
|
+
*
|
|
43
|
+
* @cssproperty --log-run-background-color - Written on a `run` with a background, in the same form as `--log-run-color`.
|
|
44
|
+
* @cssproperty --log-run-color - Written on a `run` with a text color: one of the sixteen `--log-ansi-*` colors the log publishes, or the color itself.
|
|
45
|
+
*
|
|
46
|
+
* @cssstate filtered - The log's `query` does not match the line, so it draws nothing.
|
|
47
|
+
*/
|
|
48
|
+
export declare class HelixHeadlessLogLine extends HelixElement {
|
|
49
|
+
/** The key this family's words are registered under, its styled tag. */
|
|
50
|
+
static words: string;
|
|
51
|
+
/** When the line was written: milliseconds since the epoch, or anything `Date` parses. */
|
|
52
|
+
at: number | string;
|
|
53
|
+
/** How much the line matters. Absent is `info`. */
|
|
54
|
+
level?: LogLevel;
|
|
55
|
+
/** What a screen reader hears for the link on a line's number. `{number}` is the number. */
|
|
56
|
+
lineLabel: string;
|
|
57
|
+
/** @internal Set by the log: whether the query hides the line. */
|
|
58
|
+
logFiltered: boolean;
|
|
59
|
+
/** @internal Set by the log: the link a number goes to, with `{n}` for the number. */
|
|
60
|
+
logHref: string;
|
|
61
|
+
/** @internal Set by the log: whether `mark-lines` names the line. */
|
|
62
|
+
logMarked: boolean;
|
|
63
|
+
/** @internal Set by the log: the line's number, from 1. Zero where no log has said. */
|
|
64
|
+
logNumber: number;
|
|
65
|
+
/** @internal Set by the log: whether to show the number. */
|
|
66
|
+
logNumbers: boolean;
|
|
67
|
+
/** @internal Set by the log: the text to mark in the runs, for a line drawn from data. */
|
|
68
|
+
logQuery: string;
|
|
69
|
+
/** @internal Set by the log: when the first line was written, which `relative` counts from. */
|
|
70
|
+
logStart: number | undefined;
|
|
71
|
+
/** @internal Set by the log: how to show the time, or empty to hide it. */
|
|
72
|
+
logTimes: '' | LogTimes;
|
|
73
|
+
/** @internal Set by the log: the text as styled runs, for a line drawn from data. */
|
|
74
|
+
runs: readonly LogRun[] | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* @internal Read by the log to find its lines among its children and inside
|
|
77
|
+
* its groups, which is cheaper than `instanceof`.
|
|
78
|
+
*/
|
|
79
|
+
readonly isLogLine = true;
|
|
80
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
81
|
+
/** The number, as a link where the log gave one, or as text a screen reader skips. */
|
|
82
|
+
private renderNumber;
|
|
83
|
+
/** The time, on the clock or into the run, where the log asked for one and the line has one. */
|
|
84
|
+
private renderTime;
|
|
85
|
+
/**
|
|
86
|
+
* The text: the default slot, falling back to the runs a log drew from data.
|
|
87
|
+
* The slot answers a page, and this answers the tier above.
|
|
88
|
+
*/
|
|
89
|
+
protected renderText(): TemplateResult;
|
|
90
|
+
/**
|
|
91
|
+
* The runs a log drew from data, each match of its query marked.
|
|
92
|
+
*
|
|
93
|
+
* **The parts are literals**, each name written where it is decided, so a
|
|
94
|
+
* rule reading the source finds every name a run can carry. A named color
|
|
95
|
+
* is written into `style` as the `--log-ansi-` color of that name, and any
|
|
96
|
+
* other as itself. A bright color is written apart from the rest, so a rule
|
|
97
|
+
* reading the source sees the `--log-ansi-bright-` colors read as well as
|
|
98
|
+
* the plain ones. Inverse swaps the two, each falling back to the log's own
|
|
99
|
+
* ink.
|
|
100
|
+
*/
|
|
101
|
+
private renderRuns;
|
|
102
|
+
protected render(): TemplateResult | typeof nothing;
|
|
103
|
+
}
|
|
104
|
+
declare global {
|
|
105
|
+
interface HTMLElementTagNameMap {
|
|
106
|
+
'helix-headless-log-line': HelixHeadlessLogLine;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { customElement, formatWords, HelixElement, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
3
|
+
import { html, nothing } from 'lit';
|
|
4
|
+
import { property } from 'lit/decorators.js';
|
|
5
|
+
import { markMatches } from '../rows.js';
|
|
6
|
+
const NAME = /^[a-z-]+$/;
|
|
7
|
+
export const timeOf = (at) => {
|
|
8
|
+
if (at === undefined || at === '') {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
const time = typeof at === 'number' || /^\d+$/.test(at) ? Number(at) : Date.parse(at);
|
|
12
|
+
return Number.isFinite(time) ? time : undefined;
|
|
13
|
+
};
|
|
14
|
+
const elapsed = (seconds) => {
|
|
15
|
+
const whole = Math.max(0, Math.floor(seconds));
|
|
16
|
+
const hours = Math.floor(whole / 3600);
|
|
17
|
+
const minutes = Math.floor((whole % 3600) / 60);
|
|
18
|
+
const rest = String(whole % 60).padStart(2, '0');
|
|
19
|
+
return hours > 0 ? `${hours}:${String(minutes).padStart(2, '0')}:${rest}` : `${minutes}:${rest}`;
|
|
20
|
+
};
|
|
21
|
+
let HelixHeadlessLogLine = class HelixHeadlessLogLine extends HelixElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.at = '';
|
|
25
|
+
this.lineLabel = 'Line {number}';
|
|
26
|
+
this.logFiltered = false;
|
|
27
|
+
this.logHref = '';
|
|
28
|
+
this.logMarked = false;
|
|
29
|
+
this.logNumber = 0;
|
|
30
|
+
this.logNumbers = false;
|
|
31
|
+
this.logQuery = '';
|
|
32
|
+
this.logStart = undefined;
|
|
33
|
+
this.logTimes = '';
|
|
34
|
+
this.runs = undefined;
|
|
35
|
+
this.isLogLine = true;
|
|
36
|
+
}
|
|
37
|
+
static { this.words = 'helix-log'; }
|
|
38
|
+
willUpdate(changed) {
|
|
39
|
+
super.willUpdate(changed);
|
|
40
|
+
this.toggleState('filtered', this.logFiltered);
|
|
41
|
+
}
|
|
42
|
+
renderNumber() {
|
|
43
|
+
if (!this.logNumbers || this.logNumber <= 0) {
|
|
44
|
+
return nothing;
|
|
45
|
+
}
|
|
46
|
+
const number = String(this.logNumber);
|
|
47
|
+
if (this.logHref !== '') {
|
|
48
|
+
return html `<a
|
|
49
|
+
part="number"
|
|
50
|
+
href=${this.logHref.replaceAll('{n}', number)}
|
|
51
|
+
aria-label=${formatWords(this, 'lineLabel', { number: this.logNumber })}
|
|
52
|
+
>${number}</a>`;
|
|
53
|
+
}
|
|
54
|
+
return html `<span part="number" aria-hidden="true">${number}</span>`;
|
|
55
|
+
}
|
|
56
|
+
renderTime() {
|
|
57
|
+
const time = timeOf(this.at);
|
|
58
|
+
if (this.logTimes === '' || time === undefined) {
|
|
59
|
+
return nothing;
|
|
60
|
+
}
|
|
61
|
+
const reads = this.logTimes === 'relative'
|
|
62
|
+
? elapsed((time - (this.logStart ?? time)) / 1000)
|
|
63
|
+
: new Intl.DateTimeFormat(wordsLocale(this), {
|
|
64
|
+
hour: '2-digit',
|
|
65
|
+
hourCycle: 'h23',
|
|
66
|
+
minute: '2-digit',
|
|
67
|
+
second: '2-digit',
|
|
68
|
+
}).format(time);
|
|
69
|
+
return html `<time part="time" datetime=${new Date(time).toISOString()}>${reads}</time>`;
|
|
70
|
+
}
|
|
71
|
+
renderText() {
|
|
72
|
+
return html `<slot>${this.runs ? this.renderRuns() : nothing}</slot>`;
|
|
73
|
+
}
|
|
74
|
+
renderRuns() {
|
|
75
|
+
return markMatches(this.runs ?? [], this.logQuery).map((piece) => {
|
|
76
|
+
const styled = piece.color !== undefined ||
|
|
77
|
+
piece.background !== undefined ||
|
|
78
|
+
piece.bold ||
|
|
79
|
+
piece.dim ||
|
|
80
|
+
piece.italic ||
|
|
81
|
+
piece.strike ||
|
|
82
|
+
piece.underline ||
|
|
83
|
+
piece.inverse;
|
|
84
|
+
const color = piece.inverse ? (piece.background ?? 'background') : piece.color;
|
|
85
|
+
const background = piece.inverse ? (piece.color ?? 'foreground') : piece.background;
|
|
86
|
+
const run = styled
|
|
87
|
+
? html `<span
|
|
88
|
+
part="run${piece.bold ? ' run-bold' : ''}${piece.dim ? ' run-dim' : ''}${piece.italic ? ' run-italic' : ''}${piece.underline ? ' run-underline' : ''}${piece.strike ? ' run-strike' : ''}"
|
|
89
|
+
style="${color === undefined ? '' : !NAME.test(color) ? `--log-run-color: ${color}; ` : color.startsWith('bright-') ? `--log-run-color: var(--log-ansi-bright-${color.slice(7)}); ` : `--log-run-color: var(--log-ansi-${color}); `}${background === undefined ? '' : !NAME.test(background) ? `--log-run-background-color: ${background}` : background.startsWith('bright-') ? `--log-run-background-color: var(--log-ansi-bright-${background.slice(7)})` : `--log-run-background-color: var(--log-ansi-${background})`}"
|
|
90
|
+
>${piece.text}</span>`
|
|
91
|
+
: piece.text;
|
|
92
|
+
return piece.match ? html `<mark part="match">${run}</mark>` : run;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
render() {
|
|
96
|
+
if (this.logFiltered) {
|
|
97
|
+
return nothing;
|
|
98
|
+
}
|
|
99
|
+
const level = this.level;
|
|
100
|
+
return html `<div
|
|
101
|
+
part="line${level ? { debug: ' line-debug', error: ' line-error', info: '', warn: ' line-warn' }[level] : ''}${this.logMarked ? ' line-marked' : ''}"
|
|
102
|
+
>${this.renderNumber()}${this.renderTime()}<span part="text">${this.renderText()}</span></div>`;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
__decorate([
|
|
106
|
+
property()
|
|
107
|
+
], HelixHeadlessLogLine.prototype, "at", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
property({ reflect: true })
|
|
110
|
+
], HelixHeadlessLogLine.prototype, "level", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
words,
|
|
113
|
+
property({ attribute: 'line-label' })
|
|
114
|
+
], HelixHeadlessLogLine.prototype, "lineLabel", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
property({ attribute: false })
|
|
117
|
+
], HelixHeadlessLogLine.prototype, "logFiltered", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
property({ attribute: false })
|
|
120
|
+
], HelixHeadlessLogLine.prototype, "logHref", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
property({ attribute: false })
|
|
123
|
+
], HelixHeadlessLogLine.prototype, "logMarked", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
property({ attribute: false })
|
|
126
|
+
], HelixHeadlessLogLine.prototype, "logNumber", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
property({ attribute: false })
|
|
129
|
+
], HelixHeadlessLogLine.prototype, "logNumbers", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
property({ attribute: false })
|
|
132
|
+
], HelixHeadlessLogLine.prototype, "logQuery", void 0);
|
|
133
|
+
__decorate([
|
|
134
|
+
property({ attribute: false })
|
|
135
|
+
], HelixHeadlessLogLine.prototype, "logStart", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
property({ attribute: false })
|
|
138
|
+
], HelixHeadlessLogLine.prototype, "logTimes", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
property({ attribute: false })
|
|
141
|
+
], HelixHeadlessLogLine.prototype, "runs", void 0);
|
|
142
|
+
HelixHeadlessLogLine = __decorate([
|
|
143
|
+
customElement('helix-headless-log-line')
|
|
144
|
+
], HelixHeadlessLogLine);
|
|
145
|
+
export { HelixHeadlessLogLine };
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
import { type LogGroup, type LogLine, type LogParser } from '../buffer.js';
|
|
4
|
+
import { type LogTimes } from '../line/log-line.js';
|
|
5
|
+
/** Text a log reads as it arrives: a stream, or anything `for await` reads. */
|
|
6
|
+
export type LogSource = AsyncIterable<string | Uint8Array> | ReadableStream<string | Uint8Array>;
|
|
7
|
+
/** Where `scrollToLine` puts the line, and how it gets there. */
|
|
8
|
+
export interface LogScrollOptions {
|
|
9
|
+
/** Where the line lands in the box. `center` by default. */
|
|
10
|
+
align?: 'center' | 'end' | 'nearest' | 'start';
|
|
11
|
+
/** The platform's scroll behavior. Instant when left out. */
|
|
12
|
+
behavior?: ScrollBehavior;
|
|
13
|
+
}
|
|
14
|
+
declare const HelixHeadlessLog_base: (new (...args: any[]) => import("@fusion.dev/helix-core").CollectionElement) & typeof HelixElement;
|
|
15
|
+
/**
|
|
16
|
+
* @summary Output that arrives while you watch it, such as a CI run, a deployment, or a build, in a box that follows the newest line.
|
|
17
|
+
*
|
|
18
|
+
* @description
|
|
19
|
+
* A log holds lines in the order they were written and keeps the reader at
|
|
20
|
+
* the newest one, until they scroll up to read. It stays where they left it
|
|
21
|
+
* while lines keep arriving, and a button returns them to the end
|
|
22
|
+
* (`resume-label`, "Jump to latest").
|
|
23
|
+
*
|
|
24
|
+
* **Lines arrive two ways.** For a log you serve whole, write `Log.Line`
|
|
25
|
+
* elements as children, inside `Log.Group` elements for the steps. For a log
|
|
26
|
+
* that is still being written, hand it text: `write(chunk)` takes text as it
|
|
27
|
+
* arrives, in pieces that need not end at a line break, and `source` takes a
|
|
28
|
+
* `ReadableStream` or an async iterable and reads it to the end. `lines` takes
|
|
29
|
+
* the lines as data. Text drawn from data is drawn one window at a time, so a
|
|
30
|
+
* log of a hundred thousand lines holds a screenful of elements, and the log
|
|
31
|
+
* needs a block size of its own. Do not use both ways at once.
|
|
32
|
+
*
|
|
33
|
+
* **Written text is read the way a terminal shows it.** A carriage return
|
|
34
|
+
* starts the line over, so a progress bar stays one line, and the line still
|
|
35
|
+
* being written is shown as it stands. ANSI colors and weights are drawn, in
|
|
36
|
+
* the sixteen colors the styled tier takes from your theme, and every other
|
|
37
|
+
* escape code is dropped. Give `parse` a function to read each finished line,
|
|
38
|
+
* such as a level off its prefix or a group off a marker.
|
|
39
|
+
*
|
|
40
|
+
* **Steps fold.** Lines that name a group in `groups` stand under its heading,
|
|
41
|
+
* which shows its status and how long it took and opens and closes the lines.
|
|
42
|
+
* A group a reader opens or closes fires `helix-expand` with every open group.
|
|
43
|
+
*
|
|
44
|
+
* **Search with `query`.** The log shows only the lines that hold it, marks
|
|
45
|
+
* each match, opens the groups that hold one, and says how many lines match.
|
|
46
|
+
*
|
|
47
|
+
* `line-numbers` numbers the lines from the first ever written, so a number
|
|
48
|
+
* still names its line once `limit` has let older lines go, and `line-href`
|
|
49
|
+
* makes each number a link, such as `#L{n}`. `scrollToLine(n)` takes a reader
|
|
50
|
+
* to one. `timestamps` shows each line's `at`, on the clock or as the time
|
|
51
|
+
* into the run. `mark-lines` marks lines, such as `12, 40-44`.
|
|
52
|
+
*
|
|
53
|
+
* **What a screen reader hears.** The log is a `log` and stays quiet as lines
|
|
54
|
+
* arrive, since reading a build aloud line by line helps nobody. A separate
|
|
55
|
+
* status region says each line at `error` once it arrives, each step once it
|
|
56
|
+
* finishes or fails, and the end of the run once `done` is set or `source`
|
|
57
|
+
* ends. Set `done` yourself when output you `write` is complete.
|
|
58
|
+
*
|
|
59
|
+
* The log scrolls on this tier. It carries `data-scroller`, so following the
|
|
60
|
+
* newest line and drawing a window work with no stylesheet. Give the log a
|
|
61
|
+
* block size, such as `helix-headless-log::part(log) { block-size: 20rem }`.
|
|
62
|
+
*
|
|
63
|
+
* ```js
|
|
64
|
+
* import '@fusion.dev/helix/log'
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @since 0.199.0
|
|
68
|
+
* @status experimental
|
|
69
|
+
* @category feedback
|
|
70
|
+
* @aliases Console, Terminal output, Build log, Deploy log, Log viewer, Output
|
|
71
|
+
* @documentation https://fusion.dev/helix/components/log
|
|
72
|
+
*
|
|
73
|
+
* @slot - The lines, as `Log.Line` and `Log.Group` elements.
|
|
74
|
+
* @slot resume - The control that returns to the newest line, shown while the reader is scrolled away. Defaults to a button named by `resume-label`.
|
|
75
|
+
* @slot toolbar - Controls above the log, such as a search field or a button that wraps lines.
|
|
76
|
+
*
|
|
77
|
+
* @event {HelixBeforePinEvent} helix-before-pin - Fired when the reader leaves the newest line by scrolling, or comes back to it. Cancelable.
|
|
78
|
+
* @event {HelixExpandEvent} helix-expand - Fired after a reader opens or closes a group drawn from `groups`, with the `id` of every open group in `detail.value`, separated by commas.
|
|
79
|
+
* @event {HelixPinEvent} helix-pin - Fired after the log follows the newest line or lets go of it, with `true` or `false` in `detail.value`.
|
|
80
|
+
*
|
|
81
|
+
* @csspart after - The space the rows below the drawn ones would take. Only for lines drawn from data.
|
|
82
|
+
* @csspart before - The space the rows above the drawn ones would take. Only for lines drawn from data.
|
|
83
|
+
* @csspart dropped - The line above the log that says how many earlier lines `limit` let go.
|
|
84
|
+
* @csspart empty - Shown when the log has no lines.
|
|
85
|
+
* @csspart group-content - Not drawn: a group drawn from data stands for its heading, and its lines are rows beside it.
|
|
86
|
+
* @csspart group-duration - How long a step drawn from `groups` took.
|
|
87
|
+
* @csspart group-heading - The heading of a step drawn from `groups`.
|
|
88
|
+
* @csspart group-mark - The caret of a step drawn from `groups`.
|
|
89
|
+
* @csspart group-status - The status mark of a step drawn from `groups`.
|
|
90
|
+
* @csspart group-summary - The button that opens and closes a step drawn from `groups`.
|
|
91
|
+
* @csspart group-summary-done - The button of a step drawn from `groups` that is `done`.
|
|
92
|
+
* @csspart group-summary-failed - The button of a step drawn from `groups` that `failed`.
|
|
93
|
+
* @csspart group-summary-pending - The button of a step drawn from `groups` that is `pending`.
|
|
94
|
+
* @csspart group-summary-running - The button of a step drawn from `groups` that is `running`.
|
|
95
|
+
* @csspart group-summary-skipped - The button of a step drawn from `groups` that was `skipped`.
|
|
96
|
+
* @csspart line - The row of a line drawn from data.
|
|
97
|
+
* @csspart line-debug - The row of a line drawn from data at `debug`.
|
|
98
|
+
* @csspart line-error - The row of a line drawn from data at `error`.
|
|
99
|
+
* @csspart line-marked - The row of a line drawn from data that `mark-lines` names.
|
|
100
|
+
* @csspart line-match - Text in a line drawn from data that matches `query`.
|
|
101
|
+
* @csspart line-number - The number of a line drawn from data.
|
|
102
|
+
* @csspart line-run - A stretch of a line drawn from data in an ANSI style.
|
|
103
|
+
* @csspart line-run-bold - A run drawn bold.
|
|
104
|
+
* @csspart line-run-dim - A run drawn faint.
|
|
105
|
+
* @csspart line-run-italic - A run drawn italic.
|
|
106
|
+
* @csspart line-run-strike - A run drawn struck through.
|
|
107
|
+
* @csspart line-run-underline - A run drawn underlined.
|
|
108
|
+
* @csspart line-text - The text of a line drawn from data.
|
|
109
|
+
* @csspart line-time - The time of a line drawn from data.
|
|
110
|
+
* @csspart line-warn - The row of a line drawn from data at `warn`.
|
|
111
|
+
* @csspart live - The region where screen readers hear errors, finished steps, and the end of the run.
|
|
112
|
+
* @csspart loading - Shown while `loading` is set.
|
|
113
|
+
* @csspart log - The lines, which scroll. On this tier, it needs only a block size.
|
|
114
|
+
* @csspart resume - The control shown while the reader is scrolled away from the newest line.
|
|
115
|
+
* @csspart resume-button - The button the `resume` region shows when nothing is slotted into it.
|
|
116
|
+
* @csspart resume-mark - The arrow on the default `resume-button`.
|
|
117
|
+
* @csspart row - The wrapper around one row drawn from data, a line or a group's heading.
|
|
118
|
+
* @csspart toolbar - The `toolbar` slot, above the log.
|
|
119
|
+
*
|
|
120
|
+
* @cssproperty --log-ansi-background - The background a run takes where ANSI swaps the colors and named none. Defaults to the log's own background on the styled tier.
|
|
121
|
+
* @cssproperty --log-ansi-black - The ANSI color black, which codes `30` and `40` draw.
|
|
122
|
+
* @cssproperty --log-ansi-blue - The ANSI color blue, which codes `34` and `44` draw.
|
|
123
|
+
* @cssproperty --log-ansi-bright-black - The ANSI color bright black, which codes `90` and `100` draw.
|
|
124
|
+
* @cssproperty --log-ansi-bright-blue - The ANSI color bright blue, which codes `94` and `104` draw.
|
|
125
|
+
* @cssproperty --log-ansi-bright-cyan - The ANSI color bright cyan, which codes `96` and `106` draw.
|
|
126
|
+
* @cssproperty --log-ansi-bright-green - The ANSI color bright green, which codes `92` and `102` draw.
|
|
127
|
+
* @cssproperty --log-ansi-bright-magenta - The ANSI color bright magenta, which codes `95` and `105` draw.
|
|
128
|
+
* @cssproperty --log-ansi-bright-red - The ANSI color bright red, which codes `91` and `101` draw.
|
|
129
|
+
* @cssproperty --log-ansi-bright-white - The ANSI color bright white, which codes `97` and `107` draw.
|
|
130
|
+
* @cssproperty --log-ansi-bright-yellow - The ANSI color bright yellow, which codes `93` and `103` draw.
|
|
131
|
+
* @cssproperty --log-ansi-cyan - The ANSI color cyan, which codes `36` and `46` draw.
|
|
132
|
+
* @cssproperty --log-ansi-foreground - The text color a run takes where ANSI swaps the colors and named none. Defaults to the log's own text color on the styled tier.
|
|
133
|
+
* @cssproperty --log-ansi-green - The ANSI color green, which codes `32` and `42` draw.
|
|
134
|
+
* @cssproperty --log-ansi-magenta - The ANSI color magenta, which codes `35` and `45` draw.
|
|
135
|
+
* @cssproperty --log-ansi-red - The ANSI color red, which codes `31` and `41` draw.
|
|
136
|
+
* @cssproperty --log-ansi-white - The ANSI color white, which codes `37` and `47` draw.
|
|
137
|
+
* @cssproperty --log-ansi-yellow - The ANSI color yellow, which codes `33` and `43` draw.
|
|
138
|
+
* @cssproperty --log-digits - Written on the `log`: how many digits the largest line number has, while `line-numbers` is set, so a stylesheet can size the column of numbers.
|
|
139
|
+
*
|
|
140
|
+
* @cssstate done - The run is over: `done` is set, or `source` ended.
|
|
141
|
+
* @cssstate empty - The log has no lines.
|
|
142
|
+
* @cssstate filtered - `query` is set, so only matching lines are shown.
|
|
143
|
+
* @cssstate pinned - The log follows its newest line.
|
|
144
|
+
*/
|
|
145
|
+
export declare class HelixHeadlessLog extends HelixHeadlessLog_base {
|
|
146
|
+
protected static markRules: string[];
|
|
147
|
+
/**
|
|
148
|
+
* The key this family's words are registered under, its styled tag:
|
|
149
|
+
* `registerWords('de', { 'helix-log': { resumeLabel: 'Zum Ende' } })`.
|
|
150
|
+
*/
|
|
151
|
+
static words: string;
|
|
152
|
+
/** How tall a row is assumed to be before one has been drawn, in pixels. */
|
|
153
|
+
static readonly ESTIMATE = 20;
|
|
154
|
+
/**
|
|
155
|
+
* Whether the log opens following its newest line, when `pinned` is not set.
|
|
156
|
+
* `default-pinned="false"` opens it where it starts.
|
|
157
|
+
*/
|
|
158
|
+
defaultPinned: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Whether the run is over, which a screen reader is told once.
|
|
161
|
+
*
|
|
162
|
+
* Set it when output you `write` is complete. A `source` sets it when the
|
|
163
|
+
* stream ends.
|
|
164
|
+
*/
|
|
165
|
+
get done(): boolean;
|
|
166
|
+
set done(next: boolean);
|
|
167
|
+
/** What a screen reader hears when the run is over. */
|
|
168
|
+
doneLabel: string;
|
|
169
|
+
/** What the line above the log says once `limit` has let lines go. `{count}` is how many. */
|
|
170
|
+
droppedLabel: string;
|
|
171
|
+
/** The text shown and announced when the log has no lines. */
|
|
172
|
+
emptyText: string;
|
|
173
|
+
/**
|
|
174
|
+
* What a screen reader hears when lines at `error` arrive. `{count}` is how
|
|
175
|
+
* many arrived together and `{text}` is the first of them.
|
|
176
|
+
*/
|
|
177
|
+
errorLabel: string;
|
|
178
|
+
/** The log's name, read by screen readers, where `label` is empty. */
|
|
179
|
+
fallbackLabel: string;
|
|
180
|
+
/**
|
|
181
|
+
* What a screen reader hears when a step finishes or fails. `{heading}` is
|
|
182
|
+
* the step's heading and `{status}` is `done` or `failed`.
|
|
183
|
+
*/
|
|
184
|
+
groupLabel: string;
|
|
185
|
+
/**
|
|
186
|
+
* The steps the lines from data name in `group`. A step stands where its
|
|
187
|
+
* first line is, and one with no line yet stands at the end.
|
|
188
|
+
*
|
|
189
|
+
* Replaced rather than mutated, as `lines` is: a step finishing is a new
|
|
190
|
+
* array with its `status` changed.
|
|
191
|
+
*/
|
|
192
|
+
groups: readonly LogGroup[];
|
|
193
|
+
/** The log's name, read by screen readers. */
|
|
194
|
+
label: string;
|
|
195
|
+
/**
|
|
196
|
+
* The most lines kept, or 0 to keep them all. Past it the oldest lines are
|
|
197
|
+
* let go, and the line above the log says how many.
|
|
198
|
+
*/
|
|
199
|
+
limit: number;
|
|
200
|
+
/**
|
|
201
|
+
* A link for each line number, with `{n}` where the number goes, such as
|
|
202
|
+
* `#L{n}`. Empty leaves the numbers as text.
|
|
203
|
+
*/
|
|
204
|
+
lineHref: string;
|
|
205
|
+
/**
|
|
206
|
+
* What a screen reader hears for the link on a line's number, handed to each
|
|
207
|
+
* line the log draws. `{number}` is the number.
|
|
208
|
+
*/
|
|
209
|
+
lineLabel: string;
|
|
210
|
+
/** Whether each line shows its number. */
|
|
211
|
+
lineNumbers: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* The lines as data. Reading it gives every line kept, oldest first, with
|
|
214
|
+
* the line still being written left out.
|
|
215
|
+
*
|
|
216
|
+
* Replaced rather than mutated: setting it starts the log over with these
|
|
217
|
+
* lines, and `write` adds to them. Set it or write children, not both.
|
|
218
|
+
*/
|
|
219
|
+
get lines(): readonly LogLine[];
|
|
220
|
+
set lines(next: readonly LogLine[]);
|
|
221
|
+
/** Lines to mark, as numbers and ranges such as `12, 40-44`. */
|
|
222
|
+
markLines: string;
|
|
223
|
+
/** What a screen reader hears when `query` changes. `{count}` is how many lines match. */
|
|
224
|
+
matchesLabel: string;
|
|
225
|
+
/**
|
|
226
|
+
* Reads each finished line of written text: return the fields to set, such
|
|
227
|
+
* as `level` or `group`, or `null` to drop the line. Lines in `lines` are
|
|
228
|
+
* taken as they are.
|
|
229
|
+
*/
|
|
230
|
+
get parse(): LogParser | undefined;
|
|
231
|
+
set parse(next: LogParser | undefined);
|
|
232
|
+
/**
|
|
233
|
+
* Whether the log follows its newest line.
|
|
234
|
+
*
|
|
235
|
+
* The reader's scrolling asks first: `helix-before-pin` is cancelable, so a
|
|
236
|
+
* consumer refusing it takes the decision and assigns their own value. Not
|
|
237
|
+
* reflected, for the reason `Chat` gives at its own `pinned`: a default of
|
|
238
|
+
* true would write the attribute on upgrade.
|
|
239
|
+
*/
|
|
240
|
+
get pinned(): boolean;
|
|
241
|
+
set pinned(next: boolean);
|
|
242
|
+
/** Text a line has to hold to be shown, ignoring case. Empty shows every line. */
|
|
243
|
+
query: string;
|
|
244
|
+
/** The words on the button that returns to the newest line, where `resume` is empty. */
|
|
245
|
+
resumeLabel: string;
|
|
246
|
+
/**
|
|
247
|
+
* Text to read as it arrives, to the end: a `ReadableStream` of text or
|
|
248
|
+
* bytes, such as a `fetch` response's body, or an async iterable. Bytes are
|
|
249
|
+
* read as UTF-8. The log sets `done` when it ends, and a new source stops
|
|
250
|
+
* reading the last one.
|
|
251
|
+
*/
|
|
252
|
+
get source(): LogSource | null;
|
|
253
|
+
set source(next: LogSource | null);
|
|
254
|
+
/** How near the newest line still counts as being at it, in pixels. */
|
|
255
|
+
threshold: number;
|
|
256
|
+
/**
|
|
257
|
+
* How each line shows its `at`: `absolute` on the clock, `relative` as the
|
|
258
|
+
* time since the first line. Absent shows no time.
|
|
259
|
+
*/
|
|
260
|
+
timestamps?: LogTimes;
|
|
261
|
+
/** Whether a line longer than the box wraps onto the next row. Otherwise the log scrolls sideways. */
|
|
262
|
+
wrap: boolean;
|
|
263
|
+
private pinnedState;
|
|
264
|
+
private doneState;
|
|
265
|
+
/** Whether a source is being read, which the log says with `aria-busy`. */
|
|
266
|
+
private reading;
|
|
267
|
+
/** The last thing said, and how many times something has been. */
|
|
268
|
+
private announcement;
|
|
269
|
+
private said;
|
|
270
|
+
/** The text written and handed over as data. */
|
|
271
|
+
private readonly buffer;
|
|
272
|
+
private sourceValue;
|
|
273
|
+
/** Which read of a source is current, so an older one stops writing. */
|
|
274
|
+
private readToken;
|
|
275
|
+
/** Stops the read in progress. */
|
|
276
|
+
private stopReading;
|
|
277
|
+
/** Whether each group drawn from data is open, from the first time it was seen. */
|
|
278
|
+
private readonly opened;
|
|
279
|
+
/** The rows drawn from data, worked out before each render. */
|
|
280
|
+
private view;
|
|
281
|
+
/** Whether the lines were replaced, so measurements no longer name the same rows. */
|
|
282
|
+
private fresh;
|
|
283
|
+
/** How many lines `limit` had let go at the last render. */
|
|
284
|
+
private droppedBefore;
|
|
285
|
+
/** Scroll offset the rows let go from the top took with them, owed back to a reader who is not following. */
|
|
286
|
+
private owed;
|
|
287
|
+
/** The lines written as children, in order through every group, read on each change. */
|
|
288
|
+
private childLines;
|
|
289
|
+
/** The groups written as children, in order. */
|
|
290
|
+
private childGroups;
|
|
291
|
+
/** Watches the children and their groups for lines arriving and steps changing status. */
|
|
292
|
+
private watcher;
|
|
293
|
+
/** Watches the log's box for size, which scrolling does not report. */
|
|
294
|
+
private grower;
|
|
295
|
+
/** The scroll offset this element last set, which the reader has not moved from. */
|
|
296
|
+
private stuckAt;
|
|
297
|
+
/** Until the first frame, what is in the log is what it opened with. */
|
|
298
|
+
private opening;
|
|
299
|
+
/** What the status region compared against last time. */
|
|
300
|
+
private heard;
|
|
301
|
+
private readonly virtualize;
|
|
302
|
+
/** Whether the lines are data rather than children. */
|
|
303
|
+
private get fed();
|
|
304
|
+
/** The element that scrolls, once there is one. */
|
|
305
|
+
private get log();
|
|
306
|
+
/**
|
|
307
|
+
* Every line kept, as plain text with the escape codes taken out, one to a
|
|
308
|
+
* row: what a download or a copy of the log should hold.
|
|
309
|
+
*/
|
|
310
|
+
get text(): string;
|
|
311
|
+
/**
|
|
312
|
+
* Adds text as it arrives. A line ends at each line break, and the text
|
|
313
|
+
* after the last one is the line still being written.
|
|
314
|
+
*/
|
|
315
|
+
write(chunk: string): void;
|
|
316
|
+
/**
|
|
317
|
+
* Lets every line go, and forgets which groups the reader opened, keeping
|
|
318
|
+
* `groups`, `parse`, and `limit`.
|
|
319
|
+
*/
|
|
320
|
+
clear(): void;
|
|
321
|
+
/** Puts the log back at its newest line, and follows it again. */
|
|
322
|
+
resume(): void;
|
|
323
|
+
/**
|
|
324
|
+
* Scrolls to line `number`, counted from the first line ever written, and
|
|
325
|
+
* stops following the newest. Opens a shut group the line is in. Resolves
|
|
326
|
+
* to whether the line is shown: false for a line `limit` let go or `query`
|
|
327
|
+
* hides.
|
|
328
|
+
*/
|
|
329
|
+
scrollToLine(number: number, options?: LogScrollOptions): Promise<boolean>;
|
|
330
|
+
/** Whether a group drawn from data is open: as the reader left it, or as `groups` seeded it. */
|
|
331
|
+
private isOpen;
|
|
332
|
+
/**
|
|
333
|
+
* Follows a group's `open` where the page changed it, so a page can open the
|
|
334
|
+
* step that failed. A group whose `open` did not change keeps what the
|
|
335
|
+
* reader left it at.
|
|
336
|
+
*/
|
|
337
|
+
private reopen;
|
|
338
|
+
/** Whether the reader is within `threshold` of the newest line right now. */
|
|
339
|
+
private get atBottom();
|
|
340
|
+
/** Scrolls to the newest line, and remembers where that was. */
|
|
341
|
+
private stick;
|
|
342
|
+
/** Asks to follow or let go of the newest line, and reports whether the request stood. */
|
|
343
|
+
private requestPinned;
|
|
344
|
+
/** The rows drawn from data that are in the tree, each with its place in the whole set. */
|
|
345
|
+
private drawn;
|
|
346
|
+
/**
|
|
347
|
+
* Reads the lines and groups written as children, through every group, in
|
|
348
|
+
* the order they are written. Nothing on a server, or while hydrating what
|
|
349
|
+
* one sent.
|
|
350
|
+
*/
|
|
351
|
+
private readChildren;
|
|
352
|
+
/**
|
|
353
|
+
* Tells each line written as a child its number and what the log shows, once
|
|
354
|
+
* it has hydrated, so its first render is the server's. Opens a group that
|
|
355
|
+
* holds a match while `query` is set.
|
|
356
|
+
*/
|
|
357
|
+
private tellLines;
|
|
358
|
+
/** Makes the log a tab stop while it scrolls, so a keyboard can scroll it in every browser. */
|
|
359
|
+
private markScroller;
|
|
360
|
+
/** What the status region compares, as things stand. */
|
|
361
|
+
private listen;
|
|
362
|
+
/**
|
|
363
|
+
* Says what changed since the last time it looked: lines at `error`, steps
|
|
364
|
+
* that finished or failed, the end of the run, and how many lines a new
|
|
365
|
+
* `query` matches. Nothing is said for what the log opened with.
|
|
366
|
+
*/
|
|
367
|
+
private announce;
|
|
368
|
+
/** Reads a source to its end, writing what it gives, and sets `done` when it ends. */
|
|
369
|
+
private readSource;
|
|
370
|
+
/**
|
|
371
|
+
* The log changed size, which moves nothing on its own: following, the
|
|
372
|
+
* newest line is followed.
|
|
373
|
+
*/
|
|
374
|
+
private readonly handleResize;
|
|
375
|
+
private readonly handleMutation;
|
|
376
|
+
connectedCallback(): void;
|
|
377
|
+
disconnectedCallback(): void;
|
|
378
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
379
|
+
protected updated(changed: PropertyValues): void;
|
|
380
|
+
/**
|
|
381
|
+
* The reader's own scrolling, which is the only thing that lets go of the
|
|
382
|
+
* newest line. Bound to the log in the template, since `scroll` is not
|
|
383
|
+
* composed and never reaches the host. A scroll this element made, and the
|
|
384
|
+
* log growing under a reader who has not moved, are not the reader leaving:
|
|
385
|
+
* `Chat` carries the measurement.
|
|
386
|
+
*/
|
|
387
|
+
private readonly handleScroll;
|
|
388
|
+
private readonly handleResume;
|
|
389
|
+
/** A reader opened or closed a group drawn from data. */
|
|
390
|
+
private readonly handleGroupToggle;
|
|
391
|
+
/** One row drawn from data: a line, or a group's heading. */
|
|
392
|
+
private renderRow;
|
|
393
|
+
/** When the first line kept was written, which `relative` counts from. */
|
|
394
|
+
private get firstTime();
|
|
395
|
+
/**
|
|
396
|
+
* How many digits the largest line number has, which a stylesheet sizes the
|
|
397
|
+
* column of numbers by, or 0 where nobody can know: a server, or a log with
|
|
398
|
+
* no numbers shown.
|
|
399
|
+
*/
|
|
400
|
+
private get digits();
|
|
401
|
+
/** The rows drawn from data, a window of them, between the room the rest would take. */
|
|
402
|
+
private renderRows;
|
|
403
|
+
/**
|
|
404
|
+
* The `resume` slot, with the way back drawn where nothing is slotted, behind
|
|
405
|
+
* a seam: the slot answers a page, and this answers the tier above.
|
|
406
|
+
*/
|
|
407
|
+
protected renderResume(): TemplateResult;
|
|
408
|
+
protected render(): TemplateResult;
|
|
409
|
+
}
|
|
410
|
+
declare global {
|
|
411
|
+
interface HTMLElementTagNameMap {
|
|
412
|
+
'helix-headless-log': HelixHeadlessLog;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
export {};
|