@gloom-sh/terminal 0.20.14 → 0.20.17

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.
Files changed (186) hide show
  1. package/package.json +1 -1
  2. package/src/api-client/data.ts +13 -3
  3. package/src/api-client/index.ts +54 -0
  4. package/src/api-client/install-experiments.ts +8 -7
  5. package/src/api-client/paths.ts +2 -1
  6. package/src/api-client/product-waitlist.ts +63 -0
  7. package/src/api-client/request.ts +4 -2
  8. package/src/api-client/types/billing.ts +45 -0
  9. package/src/api-client/types/econ.ts +3 -0
  10. package/src/api-client/yearly-plan.ts +132 -0
  11. package/src/app/global-shortcuts.ts +5 -3
  12. package/src/app/pane-runtime/index.tsx +2 -2
  13. package/src/app/pane-runtime/plugin-bindings.ts +3 -1
  14. package/src/app/pane-runtime/ticker-open-runtime.ts +6 -1
  15. package/src/app/since-last-visit/keys.ts +26 -0
  16. package/src/app/since-last-visit/model.ts +266 -0
  17. package/src/app/since-last-visit/strip.tsx +193 -0
  18. package/src/app/since-last-visit/use-since-last-visit.ts +289 -0
  19. package/src/app/since-last-visit/visit-tracker.ts +191 -0
  20. package/src/app.tsx +15 -0
  21. package/src/cli/commands/fred-series.ts +3 -1
  22. package/src/cli/commands/market.ts +8 -4
  23. package/src/cli/commands/overview.ts +65 -13
  24. package/src/cli/commands/system.ts +29 -1
  25. package/src/cli/commands/ticker.ts +12 -5
  26. package/src/cli/csv-export.ts +73 -0
  27. package/src/cli/desktop-pane-shot-api-policy.ts +4 -1
  28. package/src/cli/desktop-pane-shot-browser.ts +2 -1
  29. package/src/cli/desktop-pane-shot-view.ts +3 -7
  30. package/src/cli/desktop-pane-shot.ts +29 -30
  31. package/src/cli/help.ts +5 -2
  32. package/src/cli/history-rows.ts +24 -0
  33. package/src/cli/index.ts +4 -0
  34. package/src/cli/options.ts +29 -1
  35. package/src/cli/pane-functions/catalog.ts +41 -4
  36. package/src/cli/pane-functions/function-help.ts +1 -1
  37. package/src/cli/pane-functions/headless.ts +70 -3
  38. package/src/cli/pane-functions/index.ts +4 -4
  39. package/src/cli/pane-functions/resolver.ts +43 -0
  40. package/src/cli/pane-functions/screenshot-bridge.ts +4 -2
  41. package/src/cli/pane-functions/screenshot-payload.ts +3 -0
  42. package/src/cli/report-tables.ts +37 -8
  43. package/src/cli/result.ts +3 -6
  44. package/src/cli/shot-temp-dir.ts +30 -0
  45. package/src/cli/suffixed-listing-rows.ts +11 -0
  46. package/src/components/chart/composite/composite-chart.tsx +3 -3
  47. package/src/components/chart/composite/legend.tsx +37 -7
  48. package/src/components/command-bar/commands/direct/index.ts +31 -8
  49. package/src/components/command-bar/commands/registry.ts +7 -0
  50. package/src/components/command-bar/routes/root/command-items.ts +8 -0
  51. package/src/components/command-bar/routes/root/results.ts +16 -0
  52. package/src/components/company-logo.tsx +10 -3
  53. package/src/components/data-table/sections.ts +6 -1
  54. package/src/components/layout/pane/title.ts +6 -2
  55. package/src/components/layout/shell/index.tsx +5 -1
  56. package/src/components/layout/shell/ticker-link-menu.ts +12 -9
  57. package/src/components/ticker/badge/format.ts +12 -3
  58. package/src/components/ticker/badge/index.tsx +9 -3
  59. package/src/components/ticker/list-table-view.tsx +119 -17
  60. package/src/components/ui/data-table/display-columns.ts +19 -0
  61. package/src/components/ui/data-table/hooks.ts +2 -3
  62. package/src/components/ui/data-table/index.tsx +43 -9
  63. package/src/components/ui/data-table/types.ts +21 -0
  64. package/src/components/ui/data-table/visible-range.ts +11 -1
  65. package/src/core/state/app/layout-reducer.ts +3 -1
  66. package/src/core/state/app/layout.ts +2 -2
  67. package/src/data/config/layout.ts +14 -0
  68. package/src/data/config/store/normalize.ts +11 -1
  69. package/src/i18n/es.ts +38 -0
  70. package/src/i18n/ja.ts +38 -0
  71. package/src/i18n/ko.ts +38 -0
  72. package/src/i18n/zh-cn.ts +38 -0
  73. package/src/i18n/zh-tw.ts +38 -0
  74. package/src/layout/pane-follow.ts +141 -4
  75. package/src/layout/pane-layout-move.ts +10 -7
  76. package/src/layout/ticker-navigation.ts +13 -19
  77. package/src/layout/ticker-retarget.ts +3 -2
  78. package/src/market-data/market/index-level.ts +19 -0
  79. package/src/plugins/builtin/account-management/keyboard.ts +14 -0
  80. package/src/plugins/builtin/account-management/model.ts +2 -0
  81. package/src/plugins/builtin/account-management/pane.tsx +79 -7
  82. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +97 -0
  83. package/src/plugins/builtin/account-management/yearly-plan-row.tsx +359 -0
  84. package/src/plugins/builtin/awards/pane.tsx +12 -10
  85. package/src/plugins/builtin/changelog/index.tsx +6 -44
  86. package/src/plugins/builtin/changelog/versions.ts +17 -68
  87. package/src/plugins/builtin/chart-composer/pane.tsx +4 -1
  88. package/src/plugins/builtin/cloud/askg/executor.ts +2 -1
  89. package/src/plugins/builtin/cloud/askg/sources.ts +2 -1
  90. package/src/plugins/builtin/cpi/pane.tsx +1 -1
  91. package/src/plugins/builtin/credit-conditions/series.ts +2 -2
  92. package/src/plugins/builtin/debt-maturities/model.ts +1 -1
  93. package/src/plugins/builtin/earnings/board-model.ts +12 -0
  94. package/src/plugins/builtin/earnings/board-table.ts +8 -5
  95. package/src/plugins/builtin/earnings/board.tsx +38 -18
  96. package/src/plugins/builtin/earnings/highlight.ts +47 -0
  97. package/src/plugins/builtin/earnings/history-table.ts +1 -1
  98. package/src/plugins/builtin/earnings/index.tsx +1 -1
  99. package/src/plugins/builtin/earnings-calls/pane.tsx +2 -2
  100. package/src/plugins/builtin/econ/calendar-model.ts +2 -0
  101. package/src/plugins/builtin/econ/fred-catalog.ts +1 -256
  102. package/src/plugins/builtin/econ-statistics/cache.ts +1 -1
  103. package/src/plugins/builtin/econ-statistics/client.ts +11 -10
  104. package/src/plugins/builtin/econ-statistics/detail.tsx +1 -0
  105. package/src/plugins/builtin/econ-statistics/headless.ts +42 -6
  106. package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
  107. package/src/plugins/builtin/econ-statistics/pane.tsx +7 -2
  108. package/src/plugins/builtin/econ-statistics/stats.ts +2 -1
  109. package/src/plugins/builtin/econ-statistics/view.ts +9 -3
  110. package/src/plugins/builtin/estimate-revisions/model.ts +1 -1
  111. package/src/plugins/builtin/exposure/index.tsx +1 -1
  112. package/src/plugins/builtin/macro-day/model.ts +6 -4
  113. package/src/plugins/builtin/market-valuation/detail.tsx +3 -3
  114. package/src/plugins/builtin/market-valuation/headless.ts +11 -4
  115. package/src/plugins/builtin/market-valuation/pane.tsx +3 -1
  116. package/src/plugins/builtin/market-valuation/view.ts +14 -0
  117. package/src/plugins/builtin/news/wire/news/detail-view.tsx +20 -8
  118. package/src/plugins/builtin/pe-band/pane.tsx +1 -1
  119. package/src/plugins/builtin/portfolio-list/cli/render.ts +8 -1
  120. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +176 -17
  121. package/src/plugins/builtin/portfolio-list/pane/groups.tsx +220 -0
  122. package/src/plugins/builtin/portfolio-list/pane/index.tsx +90 -15
  123. package/src/plugins/builtin/portfolio-list/table.tsx +13 -1
  124. package/src/plugins/builtin/research/corporate-actions-pane.tsx +4 -2
  125. package/src/plugins/builtin/research/relative-valuation-headless.ts +15 -5
  126. package/src/plugins/builtin/research/relative-valuation-model.ts +7 -1
  127. package/src/plugins/builtin/research/relative-valuation-pane.tsx +7 -4
  128. package/src/plugins/builtin/shared/fred-catalog.ts +256 -0
  129. package/src/plugins/builtin/shared/headless-options.ts +1 -1
  130. package/src/plugins/builtin/shared/series-cache.ts +3 -0
  131. package/src/plugins/builtin/shared/series-detail-chart.tsx +3 -0
  132. package/src/plugins/builtin/short-interest/watch-pane.tsx +7 -7
  133. package/src/plugins/builtin/social-mentions/model.ts +2 -2
  134. package/src/plugins/builtin/thirteenf/pane.tsx +1 -1
  135. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +16 -0
  136. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +8 -4
  137. package/src/plugins/builtin/ticker-detail/financials/model.ts +51 -16
  138. package/src/plugins/builtin/ticker-detail/financials/nopat.ts +16 -0
  139. package/src/plugins/builtin/ticker-detail/financials/ratios.ts +44 -13
  140. package/src/plugins/builtin/ticker-detail/financials/schema.ts +33 -2
  141. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +4 -2
  142. package/src/plugins/builtin/ticker-detail/headless-schema.ts +30 -4
  143. package/src/plugins/builtin/ticker-detail/headless.ts +254 -34
  144. package/src/plugins/builtin/ticker-detail/overview/model.ts +7 -3
  145. package/src/plugins/builtin/ticker-detail/pharma-signals/eligibility.ts +32 -0
  146. package/src/plugins/builtin/ticker-detail/pharma-signals/tab.tsx +162 -0
  147. package/src/plugins/builtin/ticker-detail/pharma-signals/waitlist.ts +126 -0
  148. package/src/plugins/builtin/ticker-detail/research-groups.ts +6 -4
  149. package/src/plugins/builtin/ticker-detail/research-tabs.ts +11 -0
  150. package/src/plugins/builtin/time-sales/headless.ts +4 -1
  151. package/src/plugins/builtin/time-sales/pane.tsx +2 -0
  152. package/src/plugins/builtin/time-sales/window.ts +12 -0
  153. package/src/plugins/builtin/treasury-auctions/client.ts +4 -0
  154. package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +2 -0
  155. package/src/plugins/builtin/treasury-daily/client.ts +23 -11
  156. package/src/portfolio/column-values.ts +20 -8
  157. package/src/portfolio/suffixed-listings.ts +3 -1
  158. package/src/portfolio/watchlist-groups.ts +212 -0
  159. package/src/react/ticker-source.ts +3 -1
  160. package/src/renderers/dom/styles.css +7 -0
  161. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -0
  162. package/src/sources/gloomberb-cloud/fred-publisher.ts +25 -0
  163. package/src/sources/gloomberb-cloud/fred-series.ts +1 -1
  164. package/src/state/app/bootstrap.ts +11 -0
  165. package/src/state/app/context/index.tsx +6 -0
  166. package/src/sync/collections-contributor.ts +5 -2
  167. package/src/sync/config-merge.ts +10 -2
  168. package/src/sync/sanitize.ts +28 -0
  169. package/src/telemetry/usage-counts.ts +17 -0
  170. package/src/time-series/base-series.ts +3 -0
  171. package/src/time-series/chart-seed.ts +1 -1
  172. package/src/time-series/financial-period-coverage.ts +4 -12
  173. package/src/time-series/ice-credit.ts +1 -0
  174. package/src/time-series/parsed-history-cache.ts +1 -1
  175. package/src/time-series/resolve.ts +1 -1
  176. package/src/time-series/types.ts +1 -0
  177. package/src/time-series/use-chart-resolution.ts +6 -1
  178. package/src/types/config.ts +32 -0
  179. package/src/types/headless.ts +9 -2
  180. package/src/types/plugin-context.ts +5 -0
  181. package/src/types/ticker.ts +14 -0
  182. package/src/ui/ascii-font.ts +1 -4
  183. package/src/utils/async-deadline.ts +2 -2
  184. package/src/utils/csv.ts +44 -5
  185. package/src/utils/futures-generic.ts +3 -0
  186. package/src/utils/throttled-fetch.ts +15 -1
@@ -0,0 +1,30 @@
1
+ import { mkdtemp, rm } from "fs/promises";
2
+ import { tmpdir } from "os";
3
+ import { join } from "path";
4
+ import { logFailure } from "../utils/log-failure";
5
+
6
+ type RemoveFolder = (
7
+ path: string,
8
+ options: { recursive: true; force: true; maxRetries: number; retryDelay: number },
9
+ ) => Promise<void>;
10
+
11
+ /**
12
+ * Hands `use` a fresh folder under the system temp folder and removes it
13
+ * afterwards. Removal is best effort: on Windows Chrome's helper processes can
14
+ * hold files in its profile for a moment after the browser exits, so the
15
+ * removal retries and, if the folder is still locked, leaves it behind rather
16
+ * than replacing what `use` returned (or threw) with the lock error.
17
+ */
18
+ export async function withShotTempDir<T>(
19
+ prefix: string,
20
+ use: (dir: string) => Promise<T>,
21
+ remove: RemoveFolder = rm,
22
+ ): Promise<T> {
23
+ const dir = await mkdtemp(join(tmpdir(), prefix));
24
+ try {
25
+ return await use(dir);
26
+ } finally {
27
+ await remove(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 })
28
+ .catch(logFailure("cli.screenshot", "Could not remove a capture's temporary folder"));
29
+ }
30
+ }
@@ -1,5 +1,6 @@
1
1
  import { saveConfig } from "../data/config/store";
2
2
  import { mergeSavedSuffixedListings } from "../portfolio/suffixed-listings";
3
+ import { withoutStaleWatchlistGroupSymbols } from "../portfolio/watchlist-groups";
3
4
  import type { CliCommandContext } from "../types/plugin";
4
5
  import { debugLog } from "../utils/debug-log";
5
6
  import { logFailure } from "../utils/log-failure";
@@ -29,6 +30,16 @@ async function mergedForWrite<TContext extends ConfigContext>(ctx: Pick<CliComma
29
30
  } catch (error) {
30
31
  logFailure("cli.suffixed-listings", "Merging suffixed listing rows failed")(error);
31
32
  }
33
+ // A ticker that left a list some other way leaves its groups too, so an add puts it in none.
34
+ try {
35
+ const ungrouped = withoutStaleWatchlistGroupSymbols(context.config, await context.store.loadAllTickers());
36
+ if (ungrouped !== context.config) {
37
+ await saveConfig(ungrouped);
38
+ context.config = ungrouped;
39
+ }
40
+ } catch (error) {
41
+ logFailure("cli.suffixed-listings", "Dropping stale watchlist group symbols failed")(error);
42
+ }
32
43
  return context;
33
44
  }
34
45
 
@@ -84,8 +84,8 @@ import type {
84
84
  CompositePanelScene,
85
85
  } from "./types";
86
86
 
87
- // Wordmark cell grid at scale 1 (27 columns of 8px, 4 rows of 12px).
88
- const WATERMARK_BASE_WIDTH_PX = 216;
87
+ // Wordmark cell grid at scale 1 (15 columns of 8px, 4 rows of 12px).
88
+ const WATERMARK_BASE_WIDTH_PX = 120;
89
89
  const WATERMARK_BASE_HEIGHT_PX = 48;
90
90
 
91
91
  /** The most lines a legend wraps to, and the plot rows each panel keeps when it does. */
@@ -1232,7 +1232,7 @@ function ThemedCompositeChart({
1232
1232
  style={plotInsetStyle}
1233
1233
  data-gloom-role={CHART_WATERMARK_ROLE}
1234
1234
  >
1235
- <AsciiText text="Gloomberb" font="wordmark" scale={watermarkScale} color={resolvedColors.textDim} />
1235
+ <AsciiText text="Gloom" font="wordmark" scale={watermarkScale} color={resolvedColors.textDim} />
1236
1236
  </Box>
1237
1237
  ) : null}
1238
1238
  {axisMarkers.length > 0 ? (
@@ -106,6 +106,12 @@ function nameWords(label: string): string[] {
106
106
  return label.split(" ").filter(Boolean);
107
107
  }
108
108
 
109
+ function sharedLegendContext(series: readonly ResolvedSeries[]): string | null {
110
+ const context = series[0]?.legendContext;
111
+ return context && series.length > 1 && series.every((entry) => entry.legendContext === context
112
+ && entry.label.split(" · ")[0]!.endsWith(` ${context}`)) ? context : null;
113
+ }
114
+
109
115
  /** The shortest a legend name reads on one line: its first word whole, with one `…` for the rest ("Bab…"). */
110
116
  export function shortestLegendName(label: string): string {
111
117
  const words = nameWords(label);
@@ -303,6 +309,7 @@ export function CompositeLegend({
303
309
  const valueDates = legendValueDates(series, scene, cursorValueById);
304
310
  // A series read against the right axis while others in its panel read against the left says which is its scale.
305
311
  const leftPanels = new Set(allSeries.filter((entry) => entry.axis === "left" && !entry.hidden).map((entry) => entry.panelId));
312
+ let context: string | null = null;
306
313
  const buildEntries = (withFiscalPeriods: boolean, withAxisNotes = true) => series.map((entry) => {
307
314
  const cue = lineCues.get(entry.id) ?? null;
308
315
  const downColor = !cue && directionDownColor && seriesColorsDirection(entry) ? directionDownColor : null;
@@ -342,8 +349,11 @@ export function CompositeLegend({
342
349
  && cursorValue?.value != null && Number.isFinite(cursorValue.value)
343
350
  ? `Value ${cursorValue.value} ${entry.unit}` : "";
344
351
  const tooltip = [fullText, exactTotal, details].filter(Boolean).join(" · ");
345
- const label = entry.label;
346
- const compactLabel = withoutListingExchange(entry.compactLabel ?? label);
352
+ const metric = entry.legendContext && entry.label.split(" · ")[0]!.endsWith(` ${entry.legendContext}`) ? entry.legendContext : null;
353
+ const shortLabel = withoutListingExchange(entry.compactLabel ?? entry.label);
354
+ const compact = !context && metric && !shortLabel.endsWith(` ${metric}`) ? `${shortLabel} ${metric}` : shortLabel;
355
+ const compactLabel = context && compact.endsWith(` ${context}`) ? compact.slice(0, -context.length - 1) : compact;
356
+ const label = context ? compactLabel : entry.label;
347
357
  const labelWidth = displayWidth(label);
348
358
  const text = [label, valueText].filter(Boolean).join(" ");
349
359
  return {
@@ -354,6 +364,7 @@ export function CompositeLegend({
354
364
  markerWidth,
355
365
  label,
356
366
  compactLabel,
367
+ metric,
357
368
  text,
358
369
  width: Math.max(1, displayWidth(text)) + markerWidth,
359
370
  labelWidth,
@@ -370,9 +381,17 @@ export function CompositeLegend({
370
381
  let entries = buildEntries(true);
371
382
  type LegendEntry = (typeof entries)[number];
372
383
  const otherNames = (target: LegendEntry) => entries.filter((other) => other !== target).map((other) => other.compactLabel);
384
+ const labelParts = (target: LegendEntry, label: string) => {
385
+ const suffix = !context && target.metric && label.endsWith(` ${target.metric}`) ? ` ${target.metric}` : "";
386
+ return { name: suffix ? label.slice(0, -suffix.length) : label, suffix };
387
+ };
388
+ const cutEntryLabel = (target: LegendEntry, label: string, budget: number) => {
389
+ const { name, suffix } = labelParts(target, label);
390
+ return wholeWordsCut(name, budget - displayWidth(suffix), otherNames(target)) + suffix;
391
+ };
373
392
  const setEntryLabel = (target: LegendEntry, label: string, labelWidth: number) => {
374
393
  target.label = label;
375
- const shown = wholeWordsCut(label, labelWidth, otherNames(target));
394
+ const shown = cutEntryLabel(target, label, labelWidth);
376
395
  target.labelWidth = displayWidth(shown);
377
396
  target.text = [shown, target.valueText].filter(Boolean).join(" ");
378
397
  target.width = Math.max(1, displayWidth(target.text)) + target.markerWidth;
@@ -385,7 +404,12 @@ export function CompositeLegend({
385
404
  // line up with the query bar and tables above and below the chart.
386
405
  const inset = width > 1 ? 1 : 0;
387
406
  const leadWidth = valueDates.lead ? displayWidth(valueDates.lead) + 1 : 0;
388
- const innerWidth = Math.max(0, width - inset - leadWidth);
407
+ if (measureSeriesWidth() > width - inset - leadWidth - (accessory ? accessoryWidth ?? 14 : 0)) {
408
+ context = sharedLegendContext(series);
409
+ if (context) entries = buildEntries(true);
410
+ }
411
+ const contextWidth = context ? displayWidth(context) + 1 : 0;
412
+ const innerWidth = Math.max(0, width - inset - leadWidth - contextWidth);
389
413
  const resolvedAccessoryWidth = accessory
390
414
  ? Math.max(1, Math.min(innerWidth, Math.floor(accessoryWidth ?? 14)))
391
415
  : 0;
@@ -412,7 +436,8 @@ export function CompositeLegend({
412
436
  const key = `${apart ? "apart" : "first"}:${label}`;
413
437
  let name = known.get(key);
414
438
  if (name === undefined) {
415
- name = apart ? shortestLegendNameAmong(label, otherNames(entry)) : shortestLegendName(label);
439
+ const parts = labelParts(entry, label);
440
+ name = (apart ? shortestLegendNameAmong(parts.name, otherNames(entry)) : shortestLegendName(parts.name)) + parts.suffix;
416
441
  known.set(key, name);
417
442
  }
418
443
  return name;
@@ -446,7 +471,7 @@ export function CompositeLegend({
446
471
  Math.max(1, widthBeforeAccessory - entry.markerWidth - (entry.valueText ? displayWidth(entry.valueText) + 1 : 0)),
447
472
  );
448
473
  const wrappedWidths = entries.map((entry) => entry.markerWidth + Math.max(1, displayWidth(
449
- [wholeWordsCut(entry.compactLabel, wrappedLabelWidth(entry), otherNames(entry)), entry.valueText].filter(Boolean).join(" "),
474
+ [cutEntryLabel(entry, entry.compactLabel, wrappedLabelWidth(entry)), entry.valueText].filter(Boolean).join(" "),
450
475
  )));
451
476
  wantedRows = packLegendLines(wrappedWidths, widthBeforeAccessory).length;
452
477
  if (rows > 1) {
@@ -460,7 +485,7 @@ export function CompositeLegend({
460
485
  const widest = Math.max(...entries.map((entry) => entry.labelWidth));
461
486
  for (let cap = widest - 1; cap >= 1; cap -= 1) {
462
487
  const packed = packLegendLines(entries.map((entry) => entry.markerWidth + Math.max(1, displayWidth(
463
- [wholeWordsCut(entry.compactLabel, Math.min(cap, wrappedLabelWidth(entry)), otherNames(entry)), entry.valueText].filter(Boolean).join(" "),
488
+ [cutEntryLabel(entry, entry.compactLabel, Math.min(cap, wrappedLabelWidth(entry))), entry.valueText].filter(Boolean).join(" "),
464
489
  ))), widthBeforeAccessory);
465
490
  if (packed.length <= rows) {
466
491
  lines = packed;
@@ -707,6 +732,11 @@ export function CompositeLegend({
707
732
  <Text fg={themeColors.textMuted}>{valueDates.lead}</Text>
708
733
  </Box>
709
734
  ) : null}
735
+ {context ? (
736
+ <Box width={contextWidth} height={1} flexShrink={0} data-gloom-role="composite-chart-legend-context">
737
+ <Text fg={themeColors.textMuted}>{context}</Text>
738
+ </Box>
739
+ ) : null}
710
740
  {seriesWidth > 0 && lines ? (
711
741
  <Box flexDirection="column" width={seriesWidth} height={lineCount} flexShrink={0}>
712
742
  {lines.map((line, index) => scrollLine(line, index, index === lines!.length - 1 ? scrollRef : undefined))}
@@ -244,14 +244,26 @@ export function runDirectCommandAction(options: {
244
244
  return;
245
245
  case "export-config": {
246
246
  const exportPath = getDefaultConfigBackupPath();
247
- void exportConfig(state.config, exportPath)
248
- .then(() => {
249
- notify(`Config exported to ${exportPath}`, { type: "success" });
250
- closeAll({ revertThemePreview: false });
251
- })
252
- .catch((error) => {
253
- notify(error instanceof Error ? error.message : "Export failed.", { type: "error" });
254
- });
247
+ // A file written to the home folder, over any copy there, says where before it is written: `config` and Enter
248
+ // once wrote it without a word.
249
+ openInlineConfirm({
250
+ confirmId: "export-config",
251
+ title: "Export Config",
252
+ body: [
253
+ `This saves your layouts, portfolios, watchlists, settings and recent commands to ${exportPath}, replacing any copy there.`,
254
+ ],
255
+ confirmLabel: "Export",
256
+ cancelLabel: "Back",
257
+ onConfirm: async () => {
258
+ try {
259
+ await exportConfig(getState().config, exportPath);
260
+ notify(`Config exported to ${exportPath}`, { type: "success" });
261
+ closeAll({ revertThemePreview: false });
262
+ } catch (error) {
263
+ notify(error instanceof Error ? error.message : "Export failed.", { type: "error" });
264
+ }
265
+ },
266
+ });
255
267
  return;
256
268
  }
257
269
  case "import-config": {
@@ -342,6 +354,17 @@ export function runDirectCommandAction(options: {
342
354
  closeAll({ revertThemePreview: false });
343
355
  return;
344
356
  }
357
+ case "toggle-since-last-visit": {
358
+ // Only off is saved; on is the default.
359
+ const { sinceLastVisit, ...rest } = state.config;
360
+ const enabled = sinceLastVisit === false;
361
+ const nextConfig: AppConfig = enabled ? rest : { ...rest, sinceLastVisit: false };
362
+ dispatch({ type: "SET_CONFIG", config: nextConfig });
363
+ persistConfig(nextConfig);
364
+ notify(`${t(command.label)}: ${t(enabled ? "on" : "off")}`, { type: "success" });
365
+ closeAll({ revertThemePreview: false });
366
+ return;
367
+ }
345
368
  case "toggle-crash-reports":
346
369
  case "toggle-usage-counts":
347
370
  case "toggle-attention-counts": {
@@ -255,6 +255,13 @@ export const commands: Command[] = [
255
255
  description: "Turn quote update flashing on or off",
256
256
  category: "Config",
257
257
  },
258
+ {
259
+ id: "toggle-since-last-visit",
260
+ prefix: "",
261
+ label: "Since Last Visit",
262
+ description: "Turn on or off the strip that shows what moved in your tickers since your last visit",
263
+ category: "Config",
264
+ },
258
265
  {
259
266
  id: "font-size-increase",
260
267
  prefix: "FONT+",
@@ -176,6 +176,10 @@ export function createRootCommandItemBuilder({
176
176
  return state.config.valueFlashingEnabled ? "Currently on" : "Currently off";
177
177
  case "toggle-presentation-mode":
178
178
  return state.config.presentationMode ? "Currently on" : "Currently off";
179
+ case "toggle-since-last-visit":
180
+ return state.config.sinceLastVisit === false
181
+ ? "Currently off"
182
+ : "Currently on: what moved in your tickers shows above the layout when you come back";
179
183
  case "toggle-crash-reports":
180
184
  return state.config.telemetry?.crashReports === false ? "Currently off" : "Currently on";
181
185
  case "toggle-usage-counts":
@@ -208,6 +212,8 @@ export function createRootCommandItemBuilder({
208
212
  return state.config.telemetry?.usage === false ? "off" : "on";
209
213
  case "toggle-attention-counts":
210
214
  return state.config.telemetry?.attention === false ? "off" : "on";
215
+ case "toggle-since-last-visit":
216
+ return state.config.sinceLastVisit === false ? "off" : "on";
211
217
  case "release-channel":
212
218
  return resolveUpdateChannel(state.config);
213
219
  default:
@@ -231,6 +237,8 @@ export function createRootCommandItemBuilder({
231
237
  return "nightly stable beta prerelease update updates channel";
232
238
  case "run-setup-again":
233
239
  return "settings onboarding wizard guide first run start over desks holdings";
240
+ case "toggle-since-last-visit":
241
+ return "settings return strip what changed moves since away recap welcome back";
234
242
  case "quit":
235
243
  return "quit exit";
236
244
  default:
@@ -173,6 +173,16 @@ function buildBindKeyItem(
173
173
  };
174
174
  }
175
175
 
176
+ /** Words a query asks for the app's settings with. */
177
+ const CONFIG_QUERY_WORDS = new Set(["config", "configuration", "preferences", "prefs"]);
178
+
179
+ /** The commands that open or change one of the app's settings, in the order a settings query lists them: choices first. */
180
+ const APP_SETTING_COMMAND_IDS = [
181
+ "theme", "language", "header-market", "release-channel", "cycle-chart-renderer", "toggle-value-flashing", "toggle-since-last-visit",
182
+ "toggle-status-bar", "toggle-presentation-mode", "font-size-increase", "font-size-decrease", "toggle-crash-reports",
183
+ "toggle-usage-counts", "toggle-attention-counts", "check-for-updates",
184
+ ];
185
+
176
186
  /**
177
187
  * Ranks a provider's in-memory rows with the local matches without reordering
178
188
  * them: the provider decided which rows answer and in what order, so the block
@@ -440,6 +450,12 @@ export function buildRootResultModel(options: RootResultModelOptions): RootResul
440
450
  ...pluginItems,
441
451
  ];
442
452
  if (pastedList) items.push(pastedListItem(pastedList, executeCollectionCommand));
453
+ // `config` asks for the app's settings: each one, a choice to open first, ahead of Export and Import Config,
454
+ // which its words match by name and which write or replace a whole file.
455
+ if (CONFIG_QUERY_WORDS.has(rootQuery.trim().toLowerCase())) {
456
+ const byId = new Map(commandItems.map((item) => [item.id, item]));
457
+ items.push(...APP_SETTING_COMMAND_IDS.flatMap((id) => byId.get(id) ?? []));
458
+ }
443
459
  items.push(...rankMatchBlock(allItems, providerMatchItems, rootQuery));
444
460
  }
445
461
 
@@ -8,6 +8,7 @@ import type { DataTableCell } from "./ui/data-table";
8
8
  import { LogoMark, type LogoMarkProps } from "./ui/logo-mark";
9
9
  import { canonicalExchange, canonicalTickerKey, isUsEquityExchange } from "../utils/exchanges";
10
10
  import { tickerHasListingSuffix } from "../sources/listing-symbols";
11
+ import { isRoundTheClockCoin } from "../utils/crypto-pair";
11
12
 
12
13
  /**
13
14
  * A company's listing as the logo service knows it: one abroad by its venue
@@ -26,7 +27,7 @@ export function resolveCompanyLogoSrc(input: {
26
27
  /** The listing's venue, so a symbol a US company also uses draws its own company's logo. */
27
28
  exchange?: string;
28
29
  }): string | null {
29
- const kind = logoKindForAsset(input.assetCategory);
30
+ const kind = logoKindForAsset(input.assetCategory, input.symbol, input.exchange);
30
31
  if (!kind) return null;
31
32
  const path = cloudLogoPath(kind, kind === "ticker" ? logoListing(input.symbol, input.exchange) : input.symbol);
32
33
  return path ? `${getCloudApiBaseUrl()}${path}` : null;
@@ -124,8 +125,14 @@ export function CompanyLogo({
124
125
  );
125
126
  }
126
127
 
127
- function logoKindForAsset(assetCategory?: string): CloudLogoKind | null {
128
+ /**
129
+ * A coin is asked for on the crypto path, never as a ticker. A listing opened
130
+ * from its quote keeps no type (BTC-USD on CCC from a board row or a link), so
131
+ * without one its listing says whether it is a coin: a bare BTC is a US fund.
132
+ */
133
+ function logoKindForAsset(assetCategory?: string, symbol?: string, exchange?: string): CloudLogoKind | null {
128
134
  const kind = resolveAssetDisplayKind({ assetCategory });
129
135
  if (kind === "cash" || kind === "contract") return null;
130
- return kind === "crypto" ? "crypto" : "ticker";
136
+ if (kind === "crypto") return "crypto";
137
+ return kind === "other" && isRoundTheClockCoin(symbol, exchange) ? "crypto" : "ticker";
131
138
  }
@@ -47,8 +47,13 @@ export function isSectionedItemRow<T>(row: SectionedRow<T>): row is { kind: "ite
47
47
  return row.kind === "item";
48
48
  }
49
49
 
50
+ /** A section header's text: its label and how many rows it holds, shown or collapsed. */
51
+ export function sectionHeaderText(label: string, count: number): string {
52
+ return `${label} (${count})`;
53
+ }
54
+
50
55
  export function renderSectionedRowHeader<T>(row: SectionedRow<T>): DataTableSectionHeader | null {
51
- return row.kind === "section" ? { text: `${row.label} (${row.count})` } : null;
56
+ return row.kind === "section" ? { text: sectionHeaderText(row.label, row.count) } : null;
52
57
  }
53
58
 
54
59
  /** Row count a section list needs when the table is embedded at a fixed height. */
@@ -6,7 +6,7 @@ import {
6
6
  type PaneInstanceConfig,
7
7
  } from "../../../types/config";
8
8
  import type { PaneDef } from "../../../types/plugin";
9
- import { paneTitleMnemonic, TITLE_TICKER } from "../../../layout/pane-follow";
9
+ import { isUnlinkedFollower, paneTitleMnemonic, TITLE_TICKER } from "../../../layout/pane-follow";
10
10
  import { canFollowTickerSource, isTickerLinkPeer } from "../../../layout/ticker-navigation";
11
11
  import { withoutCryptoVenueCode } from "../../../utils/crypto-pair";
12
12
  import { displayTickerKey } from "../../../utils/exchanges";
@@ -94,9 +94,13 @@ export function getPaneDisplayTitle(
94
94
  panes?: ReadonlyMap<string, PaneDef>,
95
95
  ): string {
96
96
  const title = getBasePaneDisplayTitle(state, instance, paneDef, panes);
97
- if (instance.binding?.kind !== "follow" || !panes) return title;
97
+ if (!panes) return title;
98
98
  const research = instance.paneId === TICKER_RESEARCH_PANE_ID;
99
99
  if (!research && !canFollowTickerSource(instance, panes)) return title;
100
+ // A pane its link left (an unlink, its source closed, or another research pane took it) says
101
+ // so where it named the source, until it follows a pane again.
102
+ if (isUnlinkedFollower(instance)) return `${title} ${LINK_GLYPH} ${t("Unlinked")}`;
103
+ if (instance.binding?.kind !== "follow") return title;
100
104
 
101
105
  const source = findPaneInstance(state.config.layout, instance.binding.sourceInstanceId);
102
106
  const sourceDef = source ? panes.get(source.paneId) : null;
@@ -98,6 +98,8 @@ interface ShellProps {
98
98
  desktopWindowBridge?: DesktopWindowBridge;
99
99
  desktopDockPreview?: DesktopDockPreviewState | null;
100
100
  commandBarNativeOccluder?: LayoutBounds | null;
101
+ /** Rows of app chrome between the header and the layout (the since-last-visit strip). */
102
+ topBandRows?: number;
101
103
  }
102
104
 
103
105
  interface TransientFocusLayoutState {
@@ -114,6 +116,7 @@ export function Shell({
114
116
  desktopWindowBridge,
115
117
  desktopDockPreview,
116
118
  commandBarNativeOccluder = null,
119
+ topBandRows = 0,
117
120
  }: ShellProps) {
118
121
  const colors = useThemeColors();
119
122
  const dispatch = useAppDispatch();
@@ -143,7 +146,8 @@ export function Shell({
143
146
  const shellRef = useRef<BoxRenderable | null>(null);
144
147
 
145
148
  const chrome = useAppChromeShown();
146
- const appHeaderHeight = chrome.header ? resolveAppHeaderHeightCells({ titleBarOverlay, cellHeightPx }) : 0;
149
+ // Where the layout starts: the header, then any band of chrome under it.
150
+ const appHeaderHeight = (chrome.header ? resolveAppHeaderHeightCells({ titleBarOverlay, cellHeightPx }) : 0) + topBandRows;
147
151
  const contentHeight = Math.max(1, height - appHeaderHeight - (chrome.statusBar ? 1 : 0));
148
152
  pluginRegistry.bindHost({ getTermSize: () => ({ width, height: contentHeight }) });
149
153
 
@@ -2,13 +2,12 @@ import { tf } from "../../../i18n";
2
2
  import { updatePaneInstance } from "../../../pane-settings";
3
3
  import {
4
4
  canFollowTickerSource,
5
- followBindingReaches,
6
5
  isTickerLinkPeer,
7
6
  } from "../../../layout/ticker-navigation";
8
7
  import { isPaneInLayout } from "../../../layout/pane-manager";
9
8
  import { resolveTickerForPane, type AppState } from "../../../state/app/context";
10
9
  import { resolveInstrumentForPane } from "../../../core/state/app/instrument";
11
- import { paneTitleMnemonic, pinFollowingPane } from "../../../layout/pane-follow";
10
+ import { followBindingReaches, linkFollower, paneTitleMnemonic, pinFollowingPane } from "../../../layout/pane-follow";
12
11
  import {
13
12
  findPaneInstance,
14
13
  TICKER_RESEARCH_PANE_ID,
@@ -45,11 +44,15 @@ export function tickerLinkMenuItems({
45
44
  const linkable = research || canFollowTickerSource(instance, panes);
46
45
 
47
46
  const sourceInstanceId = instance.binding?.kind === "follow" ? instance.binding.sourceInstanceId : null;
47
+ const sourcePaneId = (id: string) => findPaneInstance(layout, id)?.paneId;
48
48
  const unlink = (symbol: string) => {
49
49
  const contract = resolveInstrumentForPane(state, instance.instanceId)?.instrument;
50
50
  persistLayout(updatePaneInstance(layout, instance.instanceId, (current) => {
51
51
  const mnemonic = research ? null : paneTitleMnemonic(current.title);
52
- return pinFollowingPane(mnemonic ? { ...current, title: mnemonic } : current, symbol, contract);
52
+ // The user's own unlink: the pane stays on its ticker until they link it again.
53
+ return pinFollowingPane(mnemonic ? { ...current, title: mnemonic } : current, symbol, contract, {
54
+ sourcePaneId: sourceInstanceId ? sourcePaneId(sourceInstanceId) : undefined,
55
+ });
53
56
  }));
54
57
  };
55
58
  const linkToSource = (nextSourceId: string) => {
@@ -59,11 +62,7 @@ export function tickerLinkMenuItems({
59
62
  if (current.instanceId === instance.instanceId) {
60
63
  // The stored title drops its ticker ("OMON AAPL" to "OMON"); the header adds the live one.
61
64
  const mnemonic = research ? null : paneTitleMnemonic(current.title);
62
- return {
63
- ...current,
64
- ...(mnemonic ? { title: mnemonic } : {}),
65
- binding: { kind: "follow" as const, sourceInstanceId: nextSourceId },
66
- };
65
+ return linkFollower(mnemonic ? { ...current, title: mnemonic } : current, nextSourceId);
67
66
  }
68
67
  // Ticker Research keeps one follower per source, so Enter on a source row has one target.
69
68
  // Any number of other panes may follow the same source.
@@ -73,7 +72,11 @@ export function tickerLinkMenuItems({
73
72
  || current.binding?.kind !== "follow"
74
73
  || current.binding.sourceInstanceId !== nextSourceId
75
74
  ) return current;
76
- return pinFollowingPane(current, resolveTickerForPane(state as AppState, current.instanceId));
75
+ // The pane it displaces follows the source again once this one leaves it.
76
+ return pinFollowingPane(current, resolveTickerForPane(state as AppState, current.instanceId), undefined, {
77
+ auto: true,
78
+ sourcePaneId: sourcePaneId(nextSourceId),
79
+ });
77
80
  }),
78
81
  });
79
82
  };
@@ -59,21 +59,30 @@ export interface TickerBadgeTextOptions {
59
59
  * worse than no price, so the badge drops back to whatever still fits.
60
60
  */
61
61
  maxTextWidth?: number;
62
+ /**
63
+ * A move in percent to say instead of the day's change, over a span the
64
+ * caller names beside the chips (since the user's last visit).
65
+ */
66
+ move?: number;
62
67
  }
63
68
 
64
69
  /**
65
- * Candidates run richest first: the day's change, then the bare symbol, which
66
- * always fits because the caller sized the column for it.
70
+ * Candidates run richest first: the move (the day's change unless the caller
71
+ * gives another), then the bare symbol, which always fits because the caller
72
+ * sized the column for it.
67
73
  */
68
74
  function tickerBadgeTextCandidates({
69
75
  symbol,
70
76
  status,
71
77
  quote,
72
78
  liveQuote = true,
79
+ move,
73
80
  }: TickerBadgeTextOptions): string[] {
74
81
  const candidates: string[] = [];
75
82
  if (liveQuote) {
76
- if (status === "ready" && quote && Number.isFinite(quote.changePercent)) {
83
+ if (status === "ready" && move != null && Number.isFinite(move)) {
84
+ candidates.push(`${symbol} ${formatTickerBadgeChange(move)}`);
85
+ } else if (status === "ready" && quote && Number.isFinite(quote.changePercent)) {
77
86
  candidates.push(`${symbol} ${formatTickerBadgeChange(quote.changePercent)}`);
78
87
  } else if (status === "loading") {
79
88
  candidates.push(`${symbol} \u2026`);
@@ -21,6 +21,8 @@ export interface TickerBadgeProps {
21
21
  maxTextWidth?: number;
22
22
  /** Trailing gap to the next chip, which the last chip in a row does not need. */
23
23
  trailingGap?: boolean;
24
+ /** A move in percent the chip says and takes its tone from, instead of the day's change. */
25
+ move?: number;
24
26
  onHoverStart?: () => void;
25
27
  onHoverEnd?: () => void;
26
28
  onOpen: (symbol: string) => void;
@@ -46,6 +48,7 @@ export function TickerBadge({
46
48
  hovered = false,
47
49
  maxTextWidth,
48
50
  trailingGap = true,
51
+ move,
49
52
  onHoverStart,
50
53
  onHoverEnd,
51
54
  onOpen,
@@ -61,11 +64,14 @@ export function TickerBadge({
61
64
  onOpen,
62
65
  });
63
66
  const quoteForDisplay = liveQuote ? quote : null;
64
- const tone = status === "ready" && quoteForDisplay
67
+ const shownMove = liveQuote && move != null && Number.isFinite(move) ? move : null;
68
+ const tone = status === "ready" && shownMove != null
69
+ ? priceColor(shownMove)
70
+ : status === "ready" && quoteForDisplay
65
71
  ? priceColor(quoteForDisplay.changePercent)
66
72
  : colors.borderFocused;
67
- const text = getTickerBadgeText({ symbol, status, quote, liveQuote, maxTextWidth });
68
- const price = hovered ? getTickerBadgeHoverText({ symbol, status, quote, liveQuote, maxTextWidth }) : null;
73
+ const text = getTickerBadgeText({ symbol, status, quote, liveQuote, maxTextWidth, move });
74
+ const price = hovered ? getTickerBadgeHoverText({ symbol, status, quote, liveQuote, maxTextWidth, move }) : null;
69
75
  const { fg: color, bg: backgroundColor } = tickerBadgeColors(tone, hovered);
70
76
  // An ambiguous symbol is worth opening: that is how the listing gets picked.
71
77
  const interactive = status !== "loading";