oc-flight-deck 0.4.0 → 0.5.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.
@@ -1,34 +1,34 @@
1
- // Plain-string views of the Flight Deck rail.
2
- //
3
- // Keeping the text layer pure makes it trivial to test, and leaves the JSX in
4
- // index.tsx to do nothing but wrap these strings in themed <text> elements.
5
- // The live rows come from ./stats.ts and are read-only: nothing here mutates
6
- // session state, and nothing leaves the process.
7
-
8
- import type { FlightDeckConfig } from "./config.js";
9
- import { MAX_LINES } from "./config.js";
10
- import { statRows, type StatSource } from "./stats.js";
11
-
12
- /**
13
- * Sidebar lines to render, or an empty list when the sidebar rail is disabled.
14
- *
15
- * Configured `lines` render first (branding, separators, any fixed text), then
16
- * the live rows named by `sidebar.rows`. With `sidebar.persist` (the default)
17
- * every named row renders exactly once, using `sidebar.placeholder` when the
18
- * host has no data yet; with `persist: false` rows with no data are omitted.
19
- */
20
- export function sidebarLines(config: FlightDeckConfig, source: StatSource = {}): readonly string[] {
21
- if (!config.sidebar.enabled) return [];
22
- const layout = { ...config.layout, persist: config.sidebar.persist, placeholder: config.sidebar.placeholder };
23
- return [...config.sidebar.lines, ...statRows(config.sidebar.rows, source, layout)].slice(0, MAX_LINES);
24
- }
25
-
26
- /** Footer text to render, or `undefined` when the footer rail is disabled. */
27
- export function footerLine(config: FlightDeckConfig): string | undefined {
28
- return config.footer.enabled ? config.footer.text : undefined;
29
- }
30
-
31
- /** Index of the first live row, so the caller can theme branding apart from data. */
32
- export function liveRowOffset(config: FlightDeckConfig): number {
33
- return config.sidebar.enabled ? config.sidebar.lines.length : 0;
34
- }
1
+ // Plain-string views of the Flight Deck rail.
2
+ //
3
+ // Keeping the text layer pure makes it trivial to test, and leaves the JSX in
4
+ // index.tsx to do nothing but wrap these strings in themed <text> elements.
5
+ // The live rows come from ./stats.ts and are read-only: nothing here mutates
6
+ // session state, and nothing leaves the process.
7
+
8
+ import type { FlightDeckConfig } from "./config.js";
9
+ import { MAX_LINES } from "./config.js";
10
+ import { statRows, type StatSource } from "./stats.js";
11
+
12
+ /**
13
+ * Sidebar lines to render, or an empty list when the sidebar rail is disabled.
14
+ *
15
+ * Configured `lines` render first (branding, separators, any fixed text), then
16
+ * the live rows named by `sidebar.rows`. With `sidebar.persist` (the default)
17
+ * every named row renders exactly once, using `sidebar.placeholder` when the
18
+ * host has no data yet; with `persist: false` rows with no data are omitted.
19
+ */
20
+ export function sidebarLines(config: FlightDeckConfig, source: StatSource = {}): readonly string[] {
21
+ if (!config.sidebar.enabled) return [];
22
+ const layout = { ...config.layout, persist: config.sidebar.persist, placeholder: config.sidebar.placeholder };
23
+ return [...config.sidebar.lines, ...statRows(config.sidebar.rows, source, layout)].slice(0, MAX_LINES);
24
+ }
25
+
26
+ /** Footer text to render, or `undefined` when the footer rail is disabled. */
27
+ export function footerLine(config: FlightDeckConfig): string | undefined {
28
+ return config.footer.enabled ? config.footer.text : undefined;
29
+ }
30
+
31
+ /** Index of the first live row, so the caller can theme branding apart from data. */
32
+ export function liveRowOffset(config: FlightDeckConfig): number {
33
+ return config.sidebar.enabled ? config.sidebar.lines.length : 0;
34
+ }