@fusion.dev/helix 0.212.2 → 0.213.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 +1 -1
- package/dist/element-events.generated.js +1 -1
- package/dist/log/line/log-line.css.js +1 -1
- package/dist/sandbox/compile.d.ts +1 -1
- package/dist/sandbox/console/sandbox-console.css.js +2 -0
- package/dist/sandbox/console/sandbox-console.d.ts +187 -0
- package/dist/sandbox/console/sandbox-console.js +192 -0
- package/dist/sandbox/index.d.ts +1 -1
- package/dist/sandbox/index.js +1 -1
- package/dist/sandbox/preview/sandbox-preview.d.ts +2 -2
- package/dist/sandbox/root/sandbox-root.d.ts +4 -4
- package/dist/sandbox/root/sandbox-root.js +4 -4
- package/dist/terminal/root/terminal-root.css.js +1 -1
- package/examples.json +1 -1
- package/lint.json +1 -1
- package/package.json +6 -6
- package/skills/helix/SKILL.md +2 -2
- package/types/jsx.d.ts +691 -357
- package/types/svelte.d.ts +1 -1
- package/types/vue.d.ts +138 -72
- package/types/words.d.ts +87 -43
- package/dist/sandbox/levels.d.ts +0 -10
- package/dist/sandbox/levels.js +0 -5
- package/dist/sandbox/terminal/sandbox-terminal.css.js +0 -2
- package/dist/sandbox/terminal/sandbox-terminal.d.ts +0 -135
- package/dist/sandbox/terminal/sandbox-terminal.js +0 -142
- /package/dist/sandbox/{terminal/sandbox-terminal.css.d.ts → console/sandbox-console.css.d.ts} +0 -0
|
@@ -259,9 +259,9 @@ registerElementEvents({
|
|
|
259
259
|
'helix-resize',
|
|
260
260
|
'helix-split',
|
|
261
261
|
],
|
|
262
|
+
'helix-sandbox-console': ['change', 'helix-before-change'],
|
|
262
263
|
'helix-sandbox-preview': ['helix-console', 'helix-resize'],
|
|
263
264
|
'helix-sandbox-source': ['helix-before-edit', 'helix-caret', 'helix-edit'],
|
|
264
|
-
'helix-sandbox-terminal': ['change', 'helix-before-change'],
|
|
265
265
|
'helix-scatter-chart': ['helix-reading-change', 'helix-reading-press'],
|
|
266
266
|
'helix-scroll-area': ['scroll', 'scrollend'],
|
|
267
267
|
'helix-select': [
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createSheet } from '@fusion.dev/helix-core';
|
|
2
|
-
export const styles = createSheet(`:host {display: block}[part~="line"] {column-gap: var(--helix-space-md);display: flex;inline-size: var(--_log-line-size, max-content);min-inline-size: 100%;padding-inline: var(--log-padding-inline, var(--helix-space-md))}[part~="line-grouped"]:not(:has(> [part="number"])) {padding-inline-start: calc(var(--log-padding-inline, var(--helix-space-md)) + max(var(--helix-size-icon-sm), calc(var(--log-digits, 2) * 1ch)) + var(--helix-space-md))}[part~="line"]:hover {background-color: color-mix(in oklab, var(--helix-color-foreground) 4%, transparent)}:where(button[part="number"]) {all: unset;box-sizing: border-box}[part="number"] {color: var(--helix-color-foreground-muted);flex: none;font-variant-numeric: tabular-nums;min-inline-size: max(var(--helix-size-icon-sm), calc(var(--log-digits, 2) * 1ch));text-align: end;text-decoration: none;user-select: none}a[part="number"]:hover, button[part="number"]:hover {color: var(--helix-color-foreground);cursor: pointer}a[part="number"]:hover {text-decoration: underline}a[part="number"]:focus-visible, button[part="number"]:focus-visible {border-radius: var(--helix-radii-sm);outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);outline-offset: calc(var(--helix-size-focus-offset) * -1)}[part="time"] {color: var(--helix-color-foreground-muted);flex: none;font-variant-numeric: tabular-nums;user-select: none}[part="text"] {flex: 1 1 auto;min-inline-size: 0;overflow-wrap: anywhere;white-space: var(--_log-white-space, pre)}[part~="line-debug"] {color: var(--helix-color-foreground-muted)}[part~="line-warn"] {background-color: color-mix(in oklab, var(--log-warn-color, var(--helix-color-warning)) 10%, transparent);color: color-mix(in oklab, var(--log-warn-color, var(--helix-color-warning)) 78%, var(--helix-color-foreground))}[part~="line-error"] {background-color: color-mix(in oklab, var(--log-error-color, var(--helix-color-danger)) 10%, transparent);color: color-mix(in oklab, var(--log-error-color, var(--helix-color-danger)) 78%, var(--helix-color-foreground))}[part~="line-marked"] {background-color: var(--log-mark-background-color, color-mix(in oklab, var(--helix-color-primary) 12%, transparent))}[part~="line-selected"] {background-color: var(--log-selected-background-color, color-mix(in oklab, var(--helix-color-info) 14%, transparent))}[part~="line-selected"] > [part="number"] {color: var(--helix-color-foreground)}[part~="run"] {background-color: var(--log-run-background-color, transparent);color: var(--log-run-color, inherit)}[part~="run-bold"] {font-weight: var(--helix-weight-semibold)}[part~="run-dim"] {opacity: 0.7}[part~="run-italic"] {font-style: italic}[part~="run-underline"] {text-decoration-line: underline}[part~="run-strike"] {text-decoration-line: line-through}[part~="run-underline"][part~="run-strike"] {text-decoration-line: underline line-through}[part="match"] {background-color: var(--log-match-background-color, var(--helix-color-warning-surface));border-radius: var(--helix-radii-sm);color: inherit}@media print {[part~="line"] {print-color-adjust: exact}}`);
|
|
2
|
+
export const styles = createSheet(`:host {display: block}[part~="line"] {column-gap: var(--helix-space-md);display: flex;inline-size: var(--_log-line-size, max-content);min-inline-size: 100%;padding-inline: var(--log-padding-inline, var(--helix-space-md))}[part~="line-grouped"]:not(:has(> [part="number"])) {padding-inline-start: calc(var(--log-padding-inline, var(--helix-space-md)) + max(var(--helix-size-icon-sm), calc(var(--log-digits, 2) * 1ch)) + var(--helix-space-md))}[part="level"], [part="count-label"] {block-size: 1px;clip-path: inset(50%);inline-size: 1px;overflow: hidden;position: absolute;white-space: nowrap}[part="count"] {align-self: center;background-color: color-mix(in oklab, var(--helix-color-foreground) 10%, transparent);border-radius: var(--helix-radii-full);color: var(--helix-color-foreground-muted);flex: none;font-size: var(--helix-text-xs);font-variant-numeric: tabular-nums;line-height: 1.4;padding-inline: var(--helix-space-xs)}[part~="line"]:hover {background-color: color-mix(in oklab, var(--helix-color-foreground) 4%, transparent)}:where(button[part="number"]) {all: unset;box-sizing: border-box}[part="number"] {color: var(--helix-color-foreground-muted);flex: none;font-variant-numeric: tabular-nums;min-inline-size: max(var(--helix-size-icon-sm), calc(var(--log-digits, 2) * 1ch));text-align: end;text-decoration: none;user-select: none}a[part="number"]:hover, button[part="number"]:hover {color: var(--helix-color-foreground);cursor: pointer}a[part="number"]:hover {text-decoration: underline}a[part="number"]:focus-visible, button[part="number"]:focus-visible {border-radius: var(--helix-radii-sm);outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);outline-offset: calc(var(--helix-size-focus-offset) * -1)}[part="time"] {color: var(--helix-color-foreground-muted);flex: none;font-variant-numeric: tabular-nums;user-select: none}[part="text"] {flex: 1 1 auto;min-inline-size: 0;overflow-wrap: anywhere;white-space: var(--_log-white-space, pre)}[part~="line-debug"] {color: var(--helix-color-foreground-muted)}[part~="line-warn"] {background-color: color-mix(in oklab, var(--log-warn-color, var(--helix-color-warning)) 10%, transparent);color: color-mix(in oklab, var(--log-warn-color, var(--helix-color-warning)) 78%, var(--helix-color-foreground))}[part~="line-error"] {background-color: color-mix(in oklab, var(--log-error-color, var(--helix-color-danger)) 10%, transparent);color: color-mix(in oklab, var(--log-error-color, var(--helix-color-danger)) 78%, var(--helix-color-foreground))}[part~="line-marked"] {background-color: var(--log-mark-background-color, color-mix(in oklab, var(--helix-color-primary) 12%, transparent))}[part~="line-selected"] {background-color: var(--log-selected-background-color, color-mix(in oklab, var(--helix-color-info) 14%, transparent))}[part~="line-selected"] > [part="number"] {color: var(--helix-color-foreground)}[part~="run"] {background-color: var(--log-run-background-color, transparent);color: var(--log-run-color, inherit)}[part~="run-bold"] {font-weight: var(--helix-weight-semibold)}[part~="run-dim"] {opacity: 0.7}[part~="run-italic"] {font-style: italic}[part~="run-underline"] {text-decoration-line: underline}[part~="run-strike"] {text-decoration-line: line-through}[part~="run-underline"][part~="run-strike"] {text-decoration-line: underline line-through}[part="match"] {background-color: var(--log-match-background-color, var(--helix-color-warning-surface));border-radius: var(--helix-radii-sm);color: inherit}@media print {[part~="line"] {print-color-adjust: exact}}`);
|
|
@@ -57,7 +57,7 @@ export declare const compilers: Map<string, Transform>;
|
|
|
57
57
|
* compiler said, such as `Error transforming app.tsx: Unexpected token (2:1)`.
|
|
58
58
|
* The frame reports it as it reports any error an example does not catch, so
|
|
59
59
|
* it shows over the example in the preview's `error` part and in the
|
|
60
|
-
*
|
|
60
|
+
* console, and only where the example imports the file.
|
|
61
61
|
*/
|
|
62
62
|
export declare const compile: (cdn: string, path: string, source: string) => Promise<string>;
|
|
63
63
|
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createSheet } from '@fusion.dev/helix-core';
|
|
2
|
+
export const styles = createSheet(`:host {block-size: var(--sandbox-console-size, 100%);display: grid;grid-template-rows: minmax(0, 1fr);min-block-size: 0}:host([controls]) {grid-template-rows: auto minmax(0, 1fr)}[part="controls"] {--helix-size-control: var(--helix-size-control-sm);--helix-size-control-loose: calc(var(--helix-size-control) * 1.2);--helix-size-control-tight: calc(var(--helix-size-control) * 0.8);align-items: center;border-block-end: var(--helix-border-thin) solid var(--helix-color-border);display: flex;font-family: var(--helix-font-sans);font-size: var(--helix-text-xs);gap: var(--helix-space-xs);justify-content: space-between;padding: var(--helix-space-2xs) var(--helix-space-sm)}[part="filter"] {background-color: transparent;border: var(--helix-border-thin) solid var(--helix-color-border);border-radius: var(--helix-radii-sm);color: var(--helix-color-foreground);font: inherit;font-size: max(var(--helix-text-field-min), var(--helix-text-xs));padding: var(--helix-space-2xs) var(--helix-space-xs)}[part="filter"]:focus-visible {outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);outline-offset: var(--helix-size-focus-offset)}[part="output"] {--log-padding-inline: var(--helix-space-sm);min-block-size: 0}@media print {[part="controls"] {display: none}}`);
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { type ConsoleDetail, HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
+
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
3
|
+
import '../../button/index.js';
|
|
4
|
+
import '../../log/index.js';
|
|
5
|
+
/** A console level, from the quietest to the loudest. */
|
|
6
|
+
type ConsoleLevel = ConsoleDetail['level'];
|
|
7
|
+
/**
|
|
8
|
+
* @summary A panel that shows what the previewed example wrote to the console.
|
|
9
|
+
*
|
|
10
|
+
* @description
|
|
11
|
+
* The sandbox receives `helix-console` events from the preview and passes them
|
|
12
|
+
* to the console. The preview is a separate document, so messages cross
|
|
13
|
+
* `postMessage` and arrive as text.
|
|
14
|
+
*
|
|
15
|
+
* **Drawn by a Log**, which keeps the newest line in view while a reader
|
|
16
|
+
* stays at the end, holds the last 200 lines, and folds a line written again
|
|
17
|
+
* straight after itself into one line with a count, so an example with a
|
|
18
|
+
* render loop does not fill the panel with the same warning. Each line keeps
|
|
19
|
+
* its console level, and a warning or an error is drawn apart.
|
|
20
|
+
*
|
|
21
|
+
* **What a screen reader hears.** Each new line is read as it arrives, its
|
|
22
|
+
* level first except a plain `log`, so an error does not sound like any other
|
|
23
|
+
* line. A repeat of the line before it is not read again. A reader moving
|
|
24
|
+
* through the lines hears a debug, warning or error line's level too.
|
|
25
|
+
*
|
|
26
|
+
* **`controls` adds a level filter and a clear button** above the log. Both
|
|
27
|
+
* are also yours to drive without them: `clear()` empties the console, and
|
|
28
|
+
* `level` hides the quieter lines.
|
|
29
|
+
*
|
|
30
|
+
* @since 0.1.0
|
|
31
|
+
* @status stable
|
|
32
|
+
* @aliases Console, Output
|
|
33
|
+
* @documentation https://fusion.dev/helix/components/sandbox
|
|
34
|
+
*
|
|
35
|
+
* @event {Event} change - Fired after the reader chose another level in the filter. `level` holds it.
|
|
36
|
+
* @event {HelixBeforeChangeEvent} helix-before-change - Fired before the level filter changes, with the level chosen, `log` for every level. Cancelable: cancel it to keep the current level.
|
|
37
|
+
*
|
|
38
|
+
* @csspart clear - The button that empties the console, under `controls`.
|
|
39
|
+
* @csspart clear-button - The clear button's inner button.
|
|
40
|
+
* @csspart clear-live - The clear button's live region, which speaks while the button is pending.
|
|
41
|
+
* @csspart clear-spinner - The ring the clear button turns while it is pending.
|
|
42
|
+
* @csspart clear-text - The clear button's words.
|
|
43
|
+
* @csspart controls - The row holding the level filter and the clear button, under `controls`.
|
|
44
|
+
* @csspart filter - The level filter, a native select, under `controls`.
|
|
45
|
+
* @csspart live - Where screen readers hear each new line. Visually hidden.
|
|
46
|
+
* @csspart output - The Log the lines are drawn in.
|
|
47
|
+
* @csspart output-after - The log's `after` part.
|
|
48
|
+
* @csspart output-before - The log's `before` part.
|
|
49
|
+
* @csspart output-dropped - The log's `dropped` part.
|
|
50
|
+
* @csspart output-empty - The log's `empty` part.
|
|
51
|
+
* @csspart output-group-content - The log's `group-content` part.
|
|
52
|
+
* @csspart output-group-duration - The log's `group-duration` part.
|
|
53
|
+
* @csspart output-group-heading - The log's `group-heading` part.
|
|
54
|
+
* @csspart output-group-mark - The log's `group-mark` part.
|
|
55
|
+
* @csspart output-group-status - The log's `group-status` part.
|
|
56
|
+
* @csspart output-group-summary - The log's `group-summary` part.
|
|
57
|
+
* @csspart output-group-summary-done - The log's `group-summary-done` part.
|
|
58
|
+
* @csspart output-group-summary-failed - The log's `group-summary-failed` part.
|
|
59
|
+
* @csspart output-group-summary-pending - The log's `group-summary-pending` part.
|
|
60
|
+
* @csspart output-group-summary-running - The log's `group-summary-running` part.
|
|
61
|
+
* @csspart output-group-summary-skipped - The log's `group-summary-skipped` part.
|
|
62
|
+
* @csspart output-line - The log's `line` part.
|
|
63
|
+
* @csspart output-line-count - The log's `line-count` part.
|
|
64
|
+
* @csspart output-line-count-label - The log's `line-count-label` part.
|
|
65
|
+
* @csspart output-line-debug - The log's `line-debug` part.
|
|
66
|
+
* @csspart output-line-error - The log's `line-error` part.
|
|
67
|
+
* @csspart output-line-grouped - The log's `line-grouped` part.
|
|
68
|
+
* @csspart output-line-level - The log's `line-level` part.
|
|
69
|
+
* @csspart output-line-marked - The log's `line-marked` part.
|
|
70
|
+
* @csspart output-line-match - The log's `line-match` part.
|
|
71
|
+
* @csspart output-line-number - The log's `line-number` part.
|
|
72
|
+
* @csspart output-line-run - The log's `line-run` part.
|
|
73
|
+
* @csspart output-line-run-bold - The log's `line-run-bold` part.
|
|
74
|
+
* @csspart output-line-run-dim - The log's `line-run-dim` part.
|
|
75
|
+
* @csspart output-line-run-italic - The log's `line-run-italic` part.
|
|
76
|
+
* @csspart output-line-run-strike - The log's `line-run-strike` part.
|
|
77
|
+
* @csspart output-line-run-underline - The log's `line-run-underline` part.
|
|
78
|
+
* @csspart output-line-selected - The log's `line-selected` part.
|
|
79
|
+
* @csspart output-line-text - The log's `line-text` part.
|
|
80
|
+
* @csspart output-line-time - The log's `line-time` part.
|
|
81
|
+
* @csspart output-line-warn - The log's `line-warn` part.
|
|
82
|
+
* @csspart output-live - The log's `live` part.
|
|
83
|
+
* @csspart output-loading - The log's `loading` part.
|
|
84
|
+
* @csspart output-log - The log's `log` part.
|
|
85
|
+
* @csspart output-resume - The log's `resume` part.
|
|
86
|
+
* @csspart output-resume-button - The log's `resume-button` part.
|
|
87
|
+
* @csspart output-resume-mark - The log's `resume-mark` part.
|
|
88
|
+
* @csspart output-row - The log's `row` part.
|
|
89
|
+
* @csspart output-toolbar - The log's `toolbar` part.
|
|
90
|
+
*
|
|
91
|
+
* @cssproperty --sandbox-console-size - Height of the console.
|
|
92
|
+
*/
|
|
93
|
+
export declare class HelixSandboxConsole extends HelixElement {
|
|
94
|
+
static tier: string;
|
|
95
|
+
/**
|
|
96
|
+
* The key this part's words are registered under, its tag:
|
|
97
|
+
* `registerWords('de', { 'helix-sandbox-console': { clearLabel: 'Leeren' } })`.
|
|
98
|
+
*/
|
|
99
|
+
static words: string;
|
|
100
|
+
/**
|
|
101
|
+
* The clear button's text, under `controls`.
|
|
102
|
+
*/
|
|
103
|
+
clearLabel: string;
|
|
104
|
+
/**
|
|
105
|
+
* Shows a level filter and a clear button above the log.
|
|
106
|
+
*
|
|
107
|
+
* Off by default, because a sandbox that puts the console in a panel often
|
|
108
|
+
* has a toolbar of its own for them.
|
|
109
|
+
*/
|
|
110
|
+
controls: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Text shown before anything has been written, and while the level filter
|
|
113
|
+
* hides every line.
|
|
114
|
+
*/
|
|
115
|
+
emptyLabel: string;
|
|
116
|
+
/**
|
|
117
|
+
* The log's name, read by screen readers.
|
|
118
|
+
*/
|
|
119
|
+
label: string;
|
|
120
|
+
/**
|
|
121
|
+
* The quietest level shown: `info` hides plain logs, `warn` shows warnings
|
|
122
|
+
* and errors, and `error` shows errors only. Absent shows every line.
|
|
123
|
+
*
|
|
124
|
+
* Lines it hides are kept, so lowering it shows them again. The filter under
|
|
125
|
+
* `controls` sets it.
|
|
126
|
+
*/
|
|
127
|
+
level?: ConsoleLevel | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* The level filter's name, read by screen readers, under `controls`.
|
|
130
|
+
*/
|
|
131
|
+
levelLabel: string;
|
|
132
|
+
/**
|
|
133
|
+
* What each choice of the level filter reads, for a page in another
|
|
134
|
+
* language, keyed by level, such as `{ warn: '…' }`. A level left out keeps
|
|
135
|
+
* its English words. As an attribute it is that object as JSON, and JSON
|
|
136
|
+
* that does not parse is no words.
|
|
137
|
+
*/
|
|
138
|
+
levelWords: Partial<Record<ConsoleLevel, string>>;
|
|
139
|
+
/**
|
|
140
|
+
* What a screen reader hears before a new line at each level, keyed by
|
|
141
|
+
* level, such as `{ warn: 'Warnung:' }`. A plain `log` hears nothing before
|
|
142
|
+
* its text, and nor does a line whose text already starts with its words,
|
|
143
|
+
* such as `Error: Boom` from `console.error(error)`. As an attribute it is
|
|
144
|
+
* that object as JSON.
|
|
145
|
+
*/
|
|
146
|
+
spokenWords: Partial<Record<ConsoleLevel, string>>;
|
|
147
|
+
private heard;
|
|
148
|
+
/** The next key a heard line takes. */
|
|
149
|
+
private said;
|
|
150
|
+
/** The line written last, which a repeat of is not read again. */
|
|
151
|
+
private last;
|
|
152
|
+
/** Lines written before the log was drawn, handed to it once it is. */
|
|
153
|
+
private waiting;
|
|
154
|
+
private get output();
|
|
155
|
+
/**
|
|
156
|
+
* Adds a line, which the log folds into the one above where they are the
|
|
157
|
+
* same, and tells a screen reader, unless it repeats the line before it.
|
|
158
|
+
*
|
|
159
|
+
* `write` rather than `append`, which every element already has from
|
|
160
|
+
* `ParentNode` and which takes nodes. Shadowing it would break
|
|
161
|
+
* `console.append(node)` for anyone who reasonably expected the DOM method.
|
|
162
|
+
*/
|
|
163
|
+
write(detail: ConsoleDetail): void;
|
|
164
|
+
/** Empties the console. */
|
|
165
|
+
clear(): void;
|
|
166
|
+
protected updated(changed: Map<PropertyKey, unknown>): void;
|
|
167
|
+
/**
|
|
168
|
+
* Takes the level the reader chose in the filter, unless a listener
|
|
169
|
+
* refused it, and then says so with the select's own `change`, which stops
|
|
170
|
+
* at the shadow root otherwise. A refusal puts the select back.
|
|
171
|
+
*
|
|
172
|
+
* The select's `input` is stopped where it starts, as Pagination's is. It is
|
|
173
|
+
* composed and comes first, so it left this element before
|
|
174
|
+
* `helix-before-change` and still left it when the change was refused.
|
|
175
|
+
*/
|
|
176
|
+
private readonly handleLevel;
|
|
177
|
+
/** The level filter and the clear button, under `controls`. */
|
|
178
|
+
private renderControls;
|
|
179
|
+
protected render(): TemplateResult;
|
|
180
|
+
static styles: CSSResultGroup;
|
|
181
|
+
}
|
|
182
|
+
declare global {
|
|
183
|
+
interface HTMLElementTagNameMap {
|
|
184
|
+
'helix-sandbox-console': HelixSandboxConsole;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
export {};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { customElement, HelixBeforeChangeEvent, HelixElement, requestChange, stopPress, words, wordsConverter, } from '@fusion.dev/helix-core';
|
|
3
|
+
import { levelSaid } from '@fusion.dev/helix-headless/log';
|
|
4
|
+
import { nothing } from 'lit';
|
|
5
|
+
import { property, state } from 'lit/decorators.js';
|
|
6
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
7
|
+
import { html } from 'lit/static-html.js';
|
|
8
|
+
import '../../button/index.js';
|
|
9
|
+
import '../../log/index.js';
|
|
10
|
+
import { styles as liveStyles } from '../../shared/live/live.css.js';
|
|
11
|
+
import { styles } from './sandbox-console.css.js';
|
|
12
|
+
const LEVELS = ['log', 'info', 'warn', 'error'];
|
|
13
|
+
const LIMIT = 200;
|
|
14
|
+
const HEARD = 5;
|
|
15
|
+
const stop = (event) => event.stopPropagation();
|
|
16
|
+
let HelixSandboxConsole = class HelixSandboxConsole extends HelixElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.clearLabel = 'Clear';
|
|
20
|
+
this.controls = false;
|
|
21
|
+
this.emptyLabel = 'Nothing written to the console yet.';
|
|
22
|
+
this.label = 'Console output';
|
|
23
|
+
this.levelLabel = 'Levels shown';
|
|
24
|
+
this.levelWords = {
|
|
25
|
+
error: 'Errors',
|
|
26
|
+
info: 'Info and above',
|
|
27
|
+
log: 'All levels',
|
|
28
|
+
warn: 'Warnings and errors',
|
|
29
|
+
};
|
|
30
|
+
this.spokenWords = {
|
|
31
|
+
error: 'Error:',
|
|
32
|
+
info: 'Info:',
|
|
33
|
+
warn: 'Warning:',
|
|
34
|
+
};
|
|
35
|
+
this.heard = [];
|
|
36
|
+
this.said = 0;
|
|
37
|
+
this.last = undefined;
|
|
38
|
+
this.waiting = [];
|
|
39
|
+
this.handleLevel = (event) => {
|
|
40
|
+
const field = event.target;
|
|
41
|
+
const taken = requestChange({
|
|
42
|
+
apply: (next) => {
|
|
43
|
+
this.level = next === 'log' ? undefined : next;
|
|
44
|
+
},
|
|
45
|
+
event: (next) => new HelixBeforeChangeEvent({ value: next }),
|
|
46
|
+
host: this,
|
|
47
|
+
next: field.value,
|
|
48
|
+
});
|
|
49
|
+
if (taken) {
|
|
50
|
+
this.relayNativeEvent(event);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
field.value = this.level ?? 'log';
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
static { this.tier = 'helix-'; }
|
|
58
|
+
static { this.words = 'helix-sandbox-console'; }
|
|
59
|
+
get output() {
|
|
60
|
+
return this.renderRoot?.querySelector('[part="output"]') ?? null;
|
|
61
|
+
}
|
|
62
|
+
write(detail) {
|
|
63
|
+
const repeat = this.last?.level === detail.level && this.last.text === detail.text;
|
|
64
|
+
this.last = detail;
|
|
65
|
+
const output = this.output;
|
|
66
|
+
if (output) {
|
|
67
|
+
output.writeLine({ level: detail.level, text: detail.text });
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this.waiting.push(detail);
|
|
71
|
+
}
|
|
72
|
+
if (!repeat) {
|
|
73
|
+
const before = levelSaid(this.spokenWords[detail.level], detail.text);
|
|
74
|
+
this.said += 1;
|
|
75
|
+
this.heard = [
|
|
76
|
+
...this.heard,
|
|
77
|
+
{ key: this.said, words: before ? `${before} ${detail.text}` : detail.text },
|
|
78
|
+
].slice(-HEARD);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
clear() {
|
|
82
|
+
this.output?.clear();
|
|
83
|
+
this.waiting = [];
|
|
84
|
+
this.last = undefined;
|
|
85
|
+
this.heard = [];
|
|
86
|
+
}
|
|
87
|
+
updated(changed) {
|
|
88
|
+
super.updated(changed);
|
|
89
|
+
const output = this.output;
|
|
90
|
+
if (output && this.waiting.length > 0) {
|
|
91
|
+
for (const detail of this.waiting.splice(0)) {
|
|
92
|
+
output.writeLine({ level: detail.level, text: detail.text });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
renderControls() {
|
|
97
|
+
if (!this.controls) {
|
|
98
|
+
return nothing;
|
|
99
|
+
}
|
|
100
|
+
const clear = this.clearLabel;
|
|
101
|
+
const button = this.tag('button');
|
|
102
|
+
return html `<div part="controls">
|
|
103
|
+
<select part="filter" aria-label=${this.levelLabel} @change=${this.handleLevel} @input=${stop}>
|
|
104
|
+
${LEVELS.map((one) => html `<option value=${one} ?selected=${(this.level ?? 'log') === one}>
|
|
105
|
+
${this.levelWords[one]}
|
|
106
|
+
</option>`)}
|
|
107
|
+
</select>
|
|
108
|
+
<${button}
|
|
109
|
+
part="clear"
|
|
110
|
+
exportparts="button: clear-button, live: clear-live, spinner: clear-spinner, text: clear-text"
|
|
111
|
+
@click=${() => this.clear()}
|
|
112
|
+
@helix-press=${stopPress}
|
|
113
|
+
>${clear}</${button}>
|
|
114
|
+
</div>`;
|
|
115
|
+
}
|
|
116
|
+
render() {
|
|
117
|
+
const log = this.tag('log');
|
|
118
|
+
return html `${this.renderControls()}<${log}
|
|
119
|
+
part="output"
|
|
120
|
+
exportparts="after: output-after, before: output-before, dropped: output-dropped, empty: output-empty,
|
|
121
|
+
group-content: output-group-content, group-duration: output-group-duration,
|
|
122
|
+
group-heading: output-group-heading, group-mark: output-group-mark,
|
|
123
|
+
group-status: output-group-status, group-summary: output-group-summary,
|
|
124
|
+
group-summary-done: output-group-summary-done,
|
|
125
|
+
group-summary-failed: output-group-summary-failed,
|
|
126
|
+
group-summary-pending: output-group-summary-pending,
|
|
127
|
+
group-summary-running: output-group-summary-running,
|
|
128
|
+
group-summary-skipped: output-group-summary-skipped, line: output-line,
|
|
129
|
+
line-count: output-line-count, line-count-label: output-line-count-label,
|
|
130
|
+
line-debug: output-line-debug, line-error: output-line-error,
|
|
131
|
+
line-grouped: output-line-grouped, line-level: output-line-level,
|
|
132
|
+
line-marked: output-line-marked, line-match: output-line-match,
|
|
133
|
+
line-number: output-line-number, line-run: output-line-run,
|
|
134
|
+
line-run-bold: output-line-run-bold, line-run-dim: output-line-run-dim,
|
|
135
|
+
line-run-italic: output-line-run-italic, line-run-strike: output-line-run-strike,
|
|
136
|
+
line-run-underline: output-line-run-underline, line-selected: output-line-selected,
|
|
137
|
+
line-text: output-line-text, line-time: output-line-time, line-warn: output-line-warn,
|
|
138
|
+
live: output-live, loading: output-loading, log: output-log, resume: output-resume,
|
|
139
|
+
resume-button: output-resume-button, resume-mark: output-resume-mark, row: output-row,
|
|
140
|
+
toolbar: output-toolbar"
|
|
141
|
+
collapse
|
|
142
|
+
empty-text=${this.emptyLabel}
|
|
143
|
+
label=${this.label}
|
|
144
|
+
level=${this.level ?? nothing}
|
|
145
|
+
limit=${LIMIT}
|
|
146
|
+
quiet
|
|
147
|
+
separation="plain"
|
|
148
|
+
wrap
|
|
149
|
+
></${log}>
|
|
150
|
+
<div part="live" role="log">
|
|
151
|
+
${repeat(this.heard, (one) => one.key, (one) => html `<p>${one.words}</p>`)}
|
|
152
|
+
</div>`;
|
|
153
|
+
}
|
|
154
|
+
static { this.styles = [liveStyles, styles]; }
|
|
155
|
+
};
|
|
156
|
+
__decorate([
|
|
157
|
+
words,
|
|
158
|
+
property({ attribute: 'clear-label' })
|
|
159
|
+
], HelixSandboxConsole.prototype, "clearLabel", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
property({ reflect: true, type: Boolean })
|
|
162
|
+
], HelixSandboxConsole.prototype, "controls", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
words,
|
|
165
|
+
property({ attribute: 'empty-label' })
|
|
166
|
+
], HelixSandboxConsole.prototype, "emptyLabel", void 0);
|
|
167
|
+
__decorate([
|
|
168
|
+
words,
|
|
169
|
+
property()
|
|
170
|
+
], HelixSandboxConsole.prototype, "label", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
property()
|
|
173
|
+
], HelixSandboxConsole.prototype, "level", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
words,
|
|
176
|
+
property({ attribute: 'level-label' })
|
|
177
|
+
], HelixSandboxConsole.prototype, "levelLabel", void 0);
|
|
178
|
+
__decorate([
|
|
179
|
+
words,
|
|
180
|
+
property({ attribute: 'level-words', converter: wordsConverter })
|
|
181
|
+
], HelixSandboxConsole.prototype, "levelWords", void 0);
|
|
182
|
+
__decorate([
|
|
183
|
+
words,
|
|
184
|
+
property({ attribute: 'spoken-words', converter: wordsConverter })
|
|
185
|
+
], HelixSandboxConsole.prototype, "spokenWords", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
state()
|
|
188
|
+
], HelixSandboxConsole.prototype, "heard", void 0);
|
|
189
|
+
HelixSandboxConsole = __decorate([
|
|
190
|
+
customElement('helix-sandbox-console')
|
|
191
|
+
], HelixSandboxConsole);
|
|
192
|
+
export { HelixSandboxConsole };
|
package/dist/sandbox/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* hardcodes `sandbox="allow-scripts allow-forms"` on its frame and never
|
|
13
13
|
* `allow-same-origin`, which is the pairing that would undo it.
|
|
14
14
|
*/
|
|
15
|
+
export * from './console/sandbox-console.js';
|
|
15
16
|
export { isRender, LAYOUT_RULES, loggedText, type ServePreviewOptions, servePreview, withoutStylesheets, } from './frame.js';
|
|
16
17
|
export * from './preview/sandbox-preview.js';
|
|
17
18
|
export type { PreviewFetch, PreviewFetched } from './relay.js';
|
|
@@ -19,6 +20,5 @@ export * from './root/sandbox-root.js';
|
|
|
19
20
|
export { type ManifestLike, manifestWords } from './source/editing.js';
|
|
20
21
|
export * from './source/sandbox-source.js';
|
|
21
22
|
export * from './status-bar/sandbox-status-bar.js';
|
|
22
|
-
export * from './terminal/sandbox-terminal.js';
|
|
23
23
|
export type { SandboxToken, SandboxTokenizer } from './tokens.js';
|
|
24
24
|
export * from './toolbar/sandbox-toolbar.js';
|
package/dist/sandbox/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
export * from './console/sandbox-console.js';
|
|
1
2
|
export { isRender, LAYOUT_RULES, loggedText, servePreview, withoutStylesheets, } from './frame.js';
|
|
2
3
|
export * from './preview/sandbox-preview.js';
|
|
3
4
|
export * from './root/sandbox-root.js';
|
|
4
5
|
export { manifestWords } from './source/editing.js';
|
|
5
6
|
export * from './source/sandbox-source.js';
|
|
6
7
|
export * from './status-bar/sandbox-status-bar.js';
|
|
7
|
-
export * from './terminal/sandbox-terminal.js';
|
|
8
8
|
export * from './toolbar/sandbox-toolbar.js';
|
|
@@ -106,7 +106,7 @@ export type PreviewMessage = PreviewConsole | PreviewFetch | PreviewPress | Prev
|
|
|
106
106
|
* sibling shown by `helix-sandbox-preview:state(failed) + .message`.
|
|
107
107
|
*
|
|
108
108
|
* **A failed preview shows the error over the example**, in the `error` part,
|
|
109
|
-
* until the next source is sent. The
|
|
109
|
+
* until the next source is sent. The console says it too, so the part is not
|
|
110
110
|
* announced, and it is the frame's description while it shows, so a screen
|
|
111
111
|
* reader reads it with the frame. Hide it with `::part(error) { display: none }`
|
|
112
112
|
* where the page draws its own.
|
|
@@ -348,7 +348,7 @@ export declare class HelixSandboxPreview extends HelixElement {
|
|
|
348
348
|
* sends arrives as `"null"`, measured. A real origin therefore means the
|
|
349
349
|
* frame is no longer showing the document it was given: `allow-scripts` lets
|
|
350
350
|
* an example navigate its own frame, and whatever it navigated to inherits
|
|
351
|
-
* `contentWindow` and could otherwise write lines into the
|
|
351
|
+
* `contentWindow` and could otherwise write lines into the console as though
|
|
352
352
|
* the example had logged them.
|
|
353
353
|
*/
|
|
354
354
|
private readonly handleMessage;
|
|
@@ -75,7 +75,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
|
75
75
|
* @aliases Playground, REPL, Editor
|
|
76
76
|
* @documentation https://fusion.dev/helix/components/sandbox
|
|
77
77
|
*
|
|
78
|
-
* @slot panel - A panel under both panes, usually a
|
|
78
|
+
* @slot panel - A panel under both panes, usually a console.
|
|
79
79
|
* @slot preview - The live preview. It comes second unless `lead` is `preview`.
|
|
80
80
|
* @slot source - The editable source pane. It comes first unless `lead` is `preview`.
|
|
81
81
|
* @slot status - A status bar, spanning both panes at the bottom.
|
|
@@ -383,7 +383,7 @@ export declare class HelixSandbox extends HelixElement {
|
|
|
383
383
|
* The parts of this sandbox it drives, wherever they sit inside it.
|
|
384
384
|
*
|
|
385
385
|
* Descendants, not children. A preview and a status bar happen to be slotted
|
|
386
|
-
* directly, but a
|
|
386
|
+
* directly, but a console lives inside the tab set that holds the panel, so
|
|
387
387
|
* a search of `children` found none and the console went nowhere. Where a
|
|
388
388
|
* consumer nests a pane is their arrangement to make.
|
|
389
389
|
*
|
|
@@ -392,7 +392,7 @@ export declare class HelixSandbox extends HelixElement {
|
|
|
392
392
|
private parts;
|
|
393
393
|
private get previews();
|
|
394
394
|
/**
|
|
395
|
-
* Hands a console line from the preview to any
|
|
395
|
+
* Hands a console line from the preview to any console slotted here.
|
|
396
396
|
*
|
|
397
397
|
* Every `helix-console` is forwarded, with no check on where it came from.
|
|
398
398
|
* Unlike a change, which any form control in a sandbox emits, this event is
|
|
@@ -401,7 +401,7 @@ export declare class HelixSandbox extends HelixElement {
|
|
|
401
401
|
* with.
|
|
402
402
|
*/
|
|
403
403
|
private readonly handleConsole;
|
|
404
|
-
private get
|
|
404
|
+
private get consoles();
|
|
405
405
|
private get statusBars();
|
|
406
406
|
/**
|
|
407
407
|
* The orientation in force.
|
|
@@ -142,8 +142,8 @@ let HelixSandbox = class HelixSandbox extends HelixElement {
|
|
|
142
142
|
};
|
|
143
143
|
this.handleConsole = (event) => {
|
|
144
144
|
const detail = event.detail;
|
|
145
|
-
for (const
|
|
146
|
-
|
|
145
|
+
for (const panel of this.consoles) {
|
|
146
|
+
panel.write(detail);
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
149
|
this.handlePanesChange = (event) => {
|
|
@@ -322,8 +322,8 @@ let HelixSandbox = class HelixSandbox extends HelixElement {
|
|
|
322
322
|
get previews() {
|
|
323
323
|
return this.parts('helix-sandbox-preview');
|
|
324
324
|
}
|
|
325
|
-
get
|
|
326
|
-
return this.parts('helix-sandbox-
|
|
325
|
+
get consoles() {
|
|
326
|
+
return this.parts('helix-sandbox-console');
|
|
327
327
|
}
|
|
328
328
|
get statusBars() {
|
|
329
329
|
return this.parts('helix-sandbox-status-bar');
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createSheet } from '@fusion.dev/helix-core';
|
|
2
|
-
export const styles = createSheet(`:host {--terminal-active-match-background-color: color-mix(in oklab, var(--helix-color-warning) 45%, var(--terminal-background-color));--terminal-active-match-border-color: var(--helix-color-warning);--terminal-ansi-black: light-dark(var(--helix-color-foreground), var(--helix-color-border));--terminal-ansi-blue: var(--helix-color-info);--terminal-ansi-bright-black: var(--helix-color-foreground-muted);--terminal-ansi-bright-blue: color-mix(in oklab, var(--terminal-ansi-blue) 75%, var(--helix-color-foreground));--terminal-ansi-bright-cyan: color-mix(in oklab, var(--terminal-ansi-cyan) 75%, var(--helix-color-foreground));--terminal-ansi-bright-green: color-mix(in oklab, var(--terminal-ansi-green) 75%, var(--helix-color-foreground));--terminal-ansi-bright-magenta: color-mix(in oklab, var(--terminal-ansi-magenta) 75%, var(--helix-color-foreground));--terminal-ansi-bright-red: color-mix(in oklab, var(--terminal-ansi-red) 75%, var(--helix-color-foreground));--terminal-ansi-bright-white: light-dark(var(--helix-color-border), var(--helix-color-foreground));--terminal-ansi-bright-yellow: color-mix(in oklab, var(--terminal-ansi-yellow) 75%, var(--helix-color-foreground));--terminal-ansi-cyan: color-mix(in oklab, var(--helix-color-info), var(--helix-color-success));--terminal-ansi-green: var(--helix-color-success);--terminal-ansi-magenta: var(--helix-color-syntax-callable);--terminal-ansi-red: var(--helix-color-danger);--terminal-ansi-white: light-dark(var(--helix-color-foreground-subtle), color-mix(in oklab, var(--helix-color-foreground-muted), var(--helix-color-foreground)));--terminal-ansi-yellow: var(--helix-color-warning);--terminal-background-color: var(--helix-color-background);--terminal-color: var(--helix-color-foreground);--terminal-cursor-color: var(--helix-color-primary);--terminal-match-background-color: color-mix(in oklab, var(--helix-color-warning) 22%, var(--terminal-background-color));--terminal-scrollbar-thumb-color: var(--helix-scrollbar-thumb-color);--terminal-selection-background-color: color-mix(in oklab, var(--helix-color-primary) 30%, transparent);display: block}:host([fill]) {inset: 0;position: absolute}[part="region"] {background-color: var(--terminal-background-color);block-size: var(--terminal-block-size, 24rem);border: var(--helix-border-thin) solid var(--terminal-border-color, var(--helix-color-border));border-radius: var(--terminal-radius, var(--helix-radii-lg));box-sizing: border-box;display: grid;grid-template-rows: [header] auto [find] auto [viewport] minmax(0, 1fr) [status] auto;overflow: hidden;position: relative}:host([fill]) [part="region"], :host(:state(fullscreen)) [part="region"] {block-size: 100%}:host([separation="plain"]) [part="region"], :host(:state(fullscreen)) [part="region"] {border: none;border-radius: 0}:host(:fullscreen) {display: block}[part="header"], [part="find-bar"], [part="status"] {--helix-size-checkbox: var(--helix-size-checkbox-sm);--helix-size-checkbox-loose: calc(var(--helix-size-checkbox) * 1.2);--helix-size-checkbox-tight: calc(var(--helix-size-checkbox) * 0.8);--helix-size-icon: var(--helix-size-icon-sm);--helix-size-icon-loose: calc(var(--helix-size-icon) * 1.2);--helix-size-icon-tight: calc(var(--helix-size-icon) * 0.8);--helix-size-control: var(--helix-size-control-sm);--helix-size-control-loose: calc(var(--helix-size-control) * 1.2);--helix-size-control-tight: calc(var(--helix-size-control) * 0.8);--helix-size-tag: var(--helix-size-tag-sm);align-items: center;background-color: var(--terminal-header-background-color, var(--helix-color-surface-raised));box-sizing: border-box;display: flex;gap: var(--helix-space-2xs);min-inline-size: 0;padding-block: var(--helix-space-2xs);padding-inline: var(--helix-space-sm) var(--helix-space-2xs)}[part="header"] {grid-row: header;border-block-end: var(--helix-border-thin) solid var(--terminal-border-color, var(--helix-color-border));min-block-size: calc(var(--helix-size-control) + var(--helix-space-2xs) * 2)}[part="header"][hidden], [part="find-bar"][hidden], [part="status"][hidden] {display: none}[part="label"] {color: var(--helix-color-foreground);display: block;flex: 1 1 auto;font-family: var(--helix-font-sans);font-size: var(--helix-text-sm);font-weight: var(--helix-weight-medium);min-inline-size: 0;overflow: hidden;text-overflow: ellipsis;white-space: nowrap}[part="actions"], [part="find-actions"] {display: contents}[part="controls"], [part="find-controls"] {flex: 0 0 auto}[part="exit-actions"] {align-items: center;display: flex;flex: 0 0 auto;gap: var(--helix-space-2xs)}:host(:state(find-open)) [part="find"], :host(:state(fullscreen)) [part="fullscreen"] {--icon-button-background-color: color-mix(in oklab, var(--helix-color-foreground) 12%, transparent);--icon-button-foreground-color: var(--helix-color-foreground)}[part="find-field"]:focus-visible {outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);outline-offset: var(--helix-size-focus-offset)}[part="find-bar"], [part="find-controls"] {--helix-size-control: calc(var(--helix-size-control-sm) * 0.8);--helix-size-control-loose: calc(var(--helix-size-control) * 1.2);--helix-size-control-tight: calc(var(--helix-size-control) * 0.8)}[part="find-bar"] {grid-row: find;border-block-end: var(--helix-border-thin) solid var(--terminal-border-color, var(--helix-color-border))}[part="find-field"] {appearance: none;background-color: var(--terminal-background-color);block-size: var(--helix-size-control);border: var(--helix-border-thin) solid var(--terminal-border-color, var(--helix-color-border));border-radius: var(--helix-radii-sm);box-sizing: border-box;color: var(--helix-color-foreground);flex: 1 1 auto;font-family: var(--helix-font-sans);font-size: max(var(--helix-text-field-min), var(--helix-text-sm));inline-size: 100%;max-inline-size: 20rem;min-inline-size: 0;padding-inline: var(--helix-space-xs)}[part="find-field"]::-webkit-search-cancel-button, [part="find-field"]::-webkit-search-decoration {appearance: none}[part="find-field"]::placeholder {color: var(--helix-color-foreground-muted)}[part="find-count"] {color: var(--helix-color-foreground-muted);flex: 1 0 auto;font-family: var(--helix-font-sans);font-size: var(--helix-text-xs);font-variant-numeric: tabular-nums;min-inline-size: 7em;padding-inline: var(--helix-space-xs);white-space: nowrap}[part="viewport"] {grid-row: viewport;color: var(--terminal-color);font-family: var(--terminal-font-family, var(--helix-font-mono));font-size: var(--terminal-font-size, var(--helix-text-sm));min-block-size: 0;overflow: auto;padding: var(--terminal-padding, var(--helix-space-xs) var(--helix-space-sm));position: relative}[part="viewport"] ::slotted(*) {block-size: 100%;inline-size: 100%}[part="viewport"]::after {background-color: var(--helix-color-foreground);content: "";inset: 0;opacity: 0;pointer-events: none;position: absolute;transition: opacity var(--helix-duration-fast) var(--helix-easing-standard)}:host(:state(bell)) [part="viewport"]::after {opacity: 0.08;transition: none}[part="status"] {grid-row: status;border-block-start: var(--helix-border-thin) solid var(--terminal-border-color, var(--helix-color-border));color: var(--helix-color-foreground-muted);flex-wrap: wrap;font-family: var(--helix-font-sans);font-size: var(--helix-text-sm);gap: var(--helix-space-xs) var(--helix-space-sm);padding-inline: var(--helix-space-sm)}[part="status"] > span {flex: 1 1 16rem;min-inline-size: 0}[part="restart"] {--button-border-color: var(--terminal-border-color, var(--helix-color-border))}@media (prefers-reduced-motion: reduce) {[part="viewport"]::after {transition: none}}@media print {[part="controls"], [part="find-bar"], [part="restart"], [part="exit-actions"] {display: none}}`);
|
|
2
|
+
export const styles = createSheet(`:host {--terminal-active-match-background-color: color-mix(in oklab, var(--helix-color-warning) 45%, var(--terminal-background-color));--terminal-active-match-border-color: var(--helix-color-warning);--terminal-ansi-black: light-dark(var(--helix-color-foreground), var(--helix-color-border));--terminal-ansi-blue: var(--helix-color-info);--terminal-ansi-bright-black: var(--helix-color-foreground-muted);--terminal-ansi-bright-blue: color-mix(in oklab, var(--terminal-ansi-blue) 75%, var(--helix-color-foreground));--terminal-ansi-bright-cyan: color-mix(in oklab, var(--terminal-ansi-cyan) 75%, var(--helix-color-foreground));--terminal-ansi-bright-green: color-mix(in oklab, var(--terminal-ansi-green) 75%, var(--helix-color-foreground));--terminal-ansi-bright-magenta: color-mix(in oklab, var(--terminal-ansi-magenta) 75%, var(--helix-color-foreground));--terminal-ansi-bright-red: color-mix(in oklab, var(--terminal-ansi-red) 75%, var(--helix-color-foreground));--terminal-ansi-bright-white: light-dark(var(--helix-color-border), var(--helix-color-foreground));--terminal-ansi-bright-yellow: color-mix(in oklab, var(--terminal-ansi-yellow) 75%, var(--helix-color-foreground));--terminal-ansi-cyan: color-mix(in oklab, var(--helix-color-info), var(--helix-color-success));--terminal-ansi-green: var(--helix-color-success);--terminal-ansi-magenta: var(--helix-color-syntax-callable);--terminal-ansi-red: var(--helix-color-danger);--terminal-ansi-white: light-dark(var(--helix-color-foreground-subtle), color-mix(in oklab, var(--helix-color-foreground-muted), var(--helix-color-foreground)));--terminal-ansi-yellow: var(--helix-color-warning);--terminal-background-color: var(--helix-color-background);--terminal-color: var(--helix-color-foreground);--terminal-cursor-color: var(--helix-color-primary);--terminal-match-background-color: color-mix(in oklab, var(--helix-color-warning) 22%, var(--terminal-background-color));--terminal-scrollbar-thumb-color: var(--helix-scrollbar-thumb-color);--terminal-selection-background-color: color-mix(in oklab, var(--helix-color-primary) 30%, transparent);display: block}:host([fill]) {inset: 0;position: absolute}[part="region"] {background-color: var(--terminal-background-color);block-size: var(--terminal-block-size, 24rem);border: var(--helix-border-thin) solid var(--terminal-border-color, var(--helix-color-border));border-radius: var(--terminal-radius, var(--helix-radii-lg));box-sizing: border-box;display: grid;grid-template-rows: [header] auto [find] auto [viewport] minmax(0, 1fr) [status] auto;overflow: hidden;position: relative}:host([fill]) [part="region"], :host(:state(fullscreen)) [part="region"] {block-size: 100%}:host([separation="plain"]) [part="region"], :host(:state(fullscreen)) [part="region"] {border: none;border-radius: 0}:host(:fullscreen) {display: block}[part="header"], [part="find-bar"], [part="status"] {--helix-size-checkbox: var(--helix-size-checkbox-sm);--helix-size-checkbox-loose: calc(var(--helix-size-checkbox) * 1.2);--helix-size-checkbox-tight: calc(var(--helix-size-checkbox) * 0.8);--helix-size-icon: var(--helix-size-icon-sm);--helix-size-icon-loose: calc(var(--helix-size-icon) * 1.2);--helix-size-icon-tight: calc(var(--helix-size-icon) * 0.8);--helix-size-control: var(--helix-size-control-sm);--helix-size-control-loose: calc(var(--helix-size-control) * 1.2);--helix-size-control-tight: calc(var(--helix-size-control) * 0.8);--helix-size-tag: var(--helix-size-tag-sm);align-items: center;background-color: var(--terminal-header-background-color, var(--helix-color-surface-raised));box-sizing: border-box;display: flex;gap: var(--helix-space-2xs);min-inline-size: 0;padding-block: var(--helix-space-2xs);padding-inline: var(--helix-space-sm) var(--helix-space-2xs)}[part="header"] {grid-row: header;border-block-end: var(--helix-border-thin) solid var(--terminal-border-color, var(--helix-color-border));min-block-size: calc(var(--helix-size-control) + var(--helix-space-2xs) * 2)}[part="header"][hidden], [part="find-bar"][hidden], [part="status"][hidden] {display: none}[part="label"] {color: var(--helix-color-foreground);display: block;flex: 1 1 auto;font-family: var(--helix-font-sans);font-size: var(--helix-text-sm);font-weight: var(--helix-weight-medium);min-inline-size: 0;overflow: hidden;text-overflow: ellipsis;white-space: nowrap}[part="actions"], [part="find-actions"] {display: contents}[part="controls"], [part="find-controls"] {flex: 0 0 auto}[part="exit-actions"] {align-items: center;display: flex;flex: 0 0 auto;gap: var(--helix-space-2xs)}:host(:state(find-open)) [part="find"], :host(:state(fullscreen)) [part="fullscreen"], [part="find-match-case"][aria-pressed="true"], [part="find-whole-word"][aria-pressed="true"], [part="find-regex"][aria-pressed="true"] {--icon-button-background-color: color-mix(in oklab, var(--helix-color-foreground) 12%, transparent);--icon-button-foreground-color: var(--helix-color-foreground)}[part="find-field"]:focus-visible {outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);outline-offset: var(--helix-size-focus-offset)}[part="find-bar"], [part="find-controls"] {--helix-size-control: calc(var(--helix-size-control-sm) * 0.8);--helix-size-control-loose: calc(var(--helix-size-control) * 1.2);--helix-size-control-tight: calc(var(--helix-size-control) * 0.8)}[part="find-bar"] {grid-row: find;border-block-end: var(--helix-border-thin) solid var(--terminal-border-color, var(--helix-color-border))}[part="find-field"] {appearance: none;background-color: var(--terminal-background-color);block-size: var(--helix-size-control);border: var(--helix-border-thin) solid var(--terminal-border-color, var(--helix-color-border));border-radius: var(--helix-radii-sm);box-sizing: border-box;color: var(--helix-color-foreground);flex: 1 1 auto;font-family: var(--helix-font-sans);font-size: max(var(--helix-text-field-min), var(--helix-text-sm));inline-size: 100%;max-inline-size: 20rem;min-inline-size: 0;padding-inline: var(--helix-space-xs)}[part="find-field"]::-webkit-search-cancel-button, [part="find-field"]::-webkit-search-decoration {appearance: none}[part="find-field"]::placeholder {color: var(--helix-color-foreground-muted)}[part="find-count"] {color: var(--helix-color-foreground-muted);flex: 1 0 auto;font-family: var(--helix-font-sans);font-size: var(--helix-text-xs);font-variant-numeric: tabular-nums;min-inline-size: 7em;padding-inline: var(--helix-space-xs);white-space: nowrap}[part="viewport"] {grid-row: viewport;color: var(--terminal-color);font-family: var(--terminal-font-family, var(--helix-font-mono));font-size: var(--terminal-font-size, var(--helix-text-sm));min-block-size: 0;overflow: auto;padding: var(--terminal-padding, var(--helix-space-xs) var(--helix-space-sm));position: relative}[part="viewport"] ::slotted(*) {block-size: 100%;inline-size: 100%}[part="viewport"]::after {background-color: var(--helix-color-foreground);content: "";inset: 0;opacity: 0;pointer-events: none;position: absolute;transition: opacity var(--helix-duration-fast) var(--helix-easing-standard)}:host(:state(bell)) [part="viewport"]::after {opacity: 0.08;transition: none}[part="status"] {grid-row: status;border-block-start: var(--helix-border-thin) solid var(--terminal-border-color, var(--helix-color-border));color: var(--helix-color-foreground-muted);flex-wrap: wrap;font-family: var(--helix-font-sans);font-size: var(--helix-text-sm);gap: var(--helix-space-xs) var(--helix-space-sm);padding-inline: var(--helix-space-sm)}[part="status"] > span {flex: 1 1 16rem;min-inline-size: 0}[part="restart"] {--button-border-color: var(--terminal-border-color, var(--helix-color-border))}@media (prefers-reduced-motion: reduce) {[part="viewport"]::after {transition: none}}@media print {[part="controls"], [part="find-bar"], [part="restart"], [part="exit-actions"] {display: none}}`);
|