@gloom-sh/terminal 0.20.14 → 0.20.16

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 (144) hide show
  1. package/package.json +1 -1
  2. package/src/api-client/index.ts +54 -0
  3. package/src/api-client/install-experiments.ts +8 -7
  4. package/src/api-client/paths.ts +2 -1
  5. package/src/api-client/product-waitlist.ts +63 -0
  6. package/src/api-client/request.ts +4 -2
  7. package/src/api-client/types/billing.ts +45 -0
  8. package/src/api-client/yearly-plan.ts +132 -0
  9. package/src/app/global-shortcuts.ts +5 -3
  10. package/src/app/pane-runtime/index.tsx +2 -2
  11. package/src/app/pane-runtime/plugin-bindings.ts +3 -1
  12. package/src/app/pane-runtime/ticker-open-runtime.ts +6 -1
  13. package/src/app/since-last-visit/keys.ts +26 -0
  14. package/src/app/since-last-visit/model.ts +266 -0
  15. package/src/app/since-last-visit/strip.tsx +193 -0
  16. package/src/app/since-last-visit/use-since-last-visit.ts +289 -0
  17. package/src/app/since-last-visit/visit-tracker.ts +191 -0
  18. package/src/app.tsx +15 -0
  19. package/src/cli/commands/market.ts +8 -4
  20. package/src/cli/commands/system.ts +29 -1
  21. package/src/cli/commands/ticker.ts +12 -5
  22. package/src/cli/desktop-pane-shot-api-policy.ts +4 -1
  23. package/src/cli/desktop-pane-shot-browser.ts +2 -1
  24. package/src/cli/desktop-pane-shot-view.ts +3 -7
  25. package/src/cli/desktop-pane-shot.ts +26 -28
  26. package/src/cli/help.ts +1 -0
  27. package/src/cli/history-rows.ts +24 -0
  28. package/src/cli/index.ts +4 -0
  29. package/src/cli/options.ts +29 -1
  30. package/src/cli/pane-functions/catalog.ts +41 -4
  31. package/src/cli/pane-functions/function-help.ts +1 -1
  32. package/src/cli/pane-functions/headless.ts +63 -1
  33. package/src/cli/pane-functions/index.ts +2 -2
  34. package/src/cli/pane-functions/resolver.ts +43 -0
  35. package/src/cli/pane-functions/screenshot-payload.ts +3 -0
  36. package/src/cli/report-tables.ts +20 -5
  37. package/src/cli/shot-temp-dir.ts +30 -0
  38. package/src/cli/suffixed-listing-rows.ts +11 -0
  39. package/src/components/chart/composite/composite-chart.tsx +3 -3
  40. package/src/components/command-bar/commands/direct/index.ts +31 -8
  41. package/src/components/command-bar/commands/registry.ts +7 -0
  42. package/src/components/command-bar/routes/root/command-items.ts +8 -0
  43. package/src/components/command-bar/routes/root/results.ts +16 -0
  44. package/src/components/company-logo.tsx +10 -3
  45. package/src/components/data-table/sections.ts +6 -1
  46. package/src/components/layout/pane/title.ts +6 -2
  47. package/src/components/layout/shell/index.tsx +5 -1
  48. package/src/components/layout/shell/ticker-link-menu.ts +12 -9
  49. package/src/components/ticker/badge/format.ts +12 -3
  50. package/src/components/ticker/badge/index.tsx +9 -3
  51. package/src/components/ticker/list-table-view.tsx +119 -17
  52. package/src/components/ui/data-table/display-columns.ts +16 -0
  53. package/src/components/ui/data-table/index.tsx +40 -9
  54. package/src/components/ui/data-table/types.ts +14 -0
  55. package/src/core/state/app/layout-reducer.ts +3 -1
  56. package/src/core/state/app/layout.ts +2 -2
  57. package/src/data/config/layout.ts +14 -0
  58. package/src/data/config/store/normalize.ts +11 -1
  59. package/src/i18n/es.ts +38 -0
  60. package/src/i18n/ja.ts +38 -0
  61. package/src/i18n/ko.ts +38 -0
  62. package/src/i18n/zh-cn.ts +38 -0
  63. package/src/i18n/zh-tw.ts +38 -0
  64. package/src/layout/pane-follow.ts +141 -4
  65. package/src/layout/pane-layout-move.ts +10 -7
  66. package/src/layout/ticker-navigation.ts +13 -19
  67. package/src/layout/ticker-retarget.ts +3 -2
  68. package/src/market-data/market/index-level.ts +19 -0
  69. package/src/plugins/builtin/account-management/keyboard.ts +14 -0
  70. package/src/plugins/builtin/account-management/model.ts +2 -0
  71. package/src/plugins/builtin/account-management/pane.tsx +79 -7
  72. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +97 -0
  73. package/src/plugins/builtin/account-management/yearly-plan-row.tsx +359 -0
  74. package/src/plugins/builtin/awards/pane.tsx +6 -8
  75. package/src/plugins/builtin/changelog/index.tsx +6 -44
  76. package/src/plugins/builtin/changelog/versions.ts +17 -68
  77. package/src/plugins/builtin/cloud/askg/executor.ts +2 -1
  78. package/src/plugins/builtin/cloud/askg/sources.ts +2 -1
  79. package/src/plugins/builtin/cpi/pane.tsx +1 -1
  80. package/src/plugins/builtin/debt-maturities/model.ts +1 -1
  81. package/src/plugins/builtin/earnings/board-table.ts +1 -1
  82. package/src/plugins/builtin/earnings/board.tsx +36 -16
  83. package/src/plugins/builtin/earnings/highlight.ts +47 -0
  84. package/src/plugins/builtin/earnings/history-table.ts +1 -1
  85. package/src/plugins/builtin/earnings/index.tsx +1 -1
  86. package/src/plugins/builtin/earnings-calls/pane.tsx +2 -2
  87. package/src/plugins/builtin/estimate-revisions/model.ts +1 -1
  88. package/src/plugins/builtin/exposure/index.tsx +1 -1
  89. package/src/plugins/builtin/macro-day/model.ts +6 -4
  90. package/src/plugins/builtin/market-valuation/detail.tsx +3 -3
  91. package/src/plugins/builtin/market-valuation/headless.ts +11 -4
  92. package/src/plugins/builtin/market-valuation/pane.tsx +3 -1
  93. package/src/plugins/builtin/market-valuation/view.ts +14 -0
  94. package/src/plugins/builtin/news/wire/news/detail-view.tsx +20 -8
  95. package/src/plugins/builtin/pe-band/pane.tsx +1 -1
  96. package/src/plugins/builtin/portfolio-list/cli/render.ts +8 -1
  97. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +176 -17
  98. package/src/plugins/builtin/portfolio-list/pane/groups.tsx +220 -0
  99. package/src/plugins/builtin/portfolio-list/pane/index.tsx +90 -15
  100. package/src/plugins/builtin/portfolio-list/table.tsx +13 -1
  101. package/src/plugins/builtin/research/corporate-actions-pane.tsx +4 -2
  102. package/src/plugins/builtin/research/relative-valuation-headless.ts +15 -5
  103. package/src/plugins/builtin/research/relative-valuation-model.ts +7 -1
  104. package/src/plugins/builtin/research/relative-valuation-pane.tsx +7 -4
  105. package/src/plugins/builtin/shared/headless-options.ts +1 -1
  106. package/src/plugins/builtin/social-mentions/model.ts +2 -2
  107. package/src/plugins/builtin/thirteenf/pane.tsx +1 -1
  108. package/src/plugins/builtin/ticker-detail/financials/model.ts +51 -16
  109. package/src/plugins/builtin/ticker-detail/financials/nopat.ts +16 -0
  110. package/src/plugins/builtin/ticker-detail/financials/ratios.ts +44 -13
  111. package/src/plugins/builtin/ticker-detail/financials/schema.ts +33 -2
  112. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +4 -2
  113. package/src/plugins/builtin/ticker-detail/headless-schema.ts +30 -4
  114. package/src/plugins/builtin/ticker-detail/headless.ts +254 -34
  115. package/src/plugins/builtin/ticker-detail/overview/model.ts +7 -3
  116. package/src/plugins/builtin/ticker-detail/pharma-signals/eligibility.ts +32 -0
  117. package/src/plugins/builtin/ticker-detail/pharma-signals/tab.tsx +162 -0
  118. package/src/plugins/builtin/ticker-detail/pharma-signals/waitlist.ts +126 -0
  119. package/src/plugins/builtin/ticker-detail/research-groups.ts +6 -4
  120. package/src/plugins/builtin/ticker-detail/research-tabs.ts +11 -0
  121. package/src/portfolio/column-values.ts +20 -8
  122. package/src/portfolio/suffixed-listings.ts +3 -1
  123. package/src/portfolio/watchlist-groups.ts +212 -0
  124. package/src/react/ticker-source.ts +3 -1
  125. package/src/renderers/dom/styles.css +7 -0
  126. package/src/state/app/bootstrap.ts +11 -0
  127. package/src/state/app/context/index.tsx +6 -0
  128. package/src/sync/collections-contributor.ts +5 -2
  129. package/src/sync/config-merge.ts +10 -2
  130. package/src/sync/sanitize.ts +28 -0
  131. package/src/telemetry/usage-counts.ts +17 -0
  132. package/src/time-series/chart-seed.ts +1 -1
  133. package/src/time-series/financial-period-coverage.ts +4 -12
  134. package/src/time-series/parsed-history-cache.ts +1 -1
  135. package/src/time-series/resolve.ts +1 -1
  136. package/src/time-series/use-chart-resolution.ts +6 -1
  137. package/src/types/config.ts +32 -0
  138. package/src/types/headless.ts +5 -0
  139. package/src/types/plugin-context.ts +5 -0
  140. package/src/types/ticker.ts +14 -0
  141. package/src/ui/ascii-font.ts +1 -4
  142. package/src/utils/async-deadline.ts +2 -2
  143. package/src/utils/csv.ts +44 -5
  144. package/src/utils/futures-generic.ts +3 -0
@@ -82,6 +82,11 @@ export interface CliReportColumn<Row = Record<string, unknown>> {
82
82
  unitColumn?: boolean;
83
83
  /** CSV and NDJSON write the figure to the digits `format` draws (figureAsDrawn); JSON keeps it whole. */
84
84
  exportAsShown?: boolean;
85
+ /**
86
+ * A column the export gained after its others were set (RV's `Fwd P/E period`): it closes the row, after the
87
+ * fixed columns and `retrieved_at` (`appendedColumns`), so no column an earlier export had moves.
88
+ */
89
+ exportLast?: boolean;
85
90
  }
86
91
 
87
92
  /** A label/value line of a report. `unit` names the unit of a numeric `value` when `formatted` cannot say it. */
@@ -111,6 +116,8 @@ interface ResolvedColumn {
111
116
  unit?: string;
112
117
  /** The unit always has a column of its own (`unitColumn`). */
113
118
  unitColumn?: boolean;
119
+ /** The column closes the row after the fixed columns (`exportLast`). */
120
+ last?: boolean;
114
121
  }
115
122
 
116
123
  const BLANK = { kind: "blank" } as const;
@@ -397,7 +404,8 @@ function assembleTable(title: string, columns: readonly ResolvedColumn[], rowCou
397
404
  const units = columns.map((column) => rowCount === 0 && column.unit != null ? new Set([column.unit]) : numberUnits(column.cells));
398
405
  const mixed = units.map((columnUnits, index) => columnUnits.size > 1 || columns[index]!.unitColumn === true);
399
406
  const byRow = mixed.some(Boolean) ? rowUnits(columns, mixed, rowCount) : null;
400
- const layout = columns.flatMap((column, index) => {
407
+ type LayoutColumn = { header: string; value: (row: number) => CliReportValue };
408
+ const columnLayout = (column: ResolvedColumn, index: number): LayoutColumn[] => {
401
409
  const columnUnits = units[index]!;
402
410
  const cell = (row: number) => cellValue(column.cells[row] ?? BLANK);
403
411
  if (index === 0 && byRow) {
@@ -418,12 +426,18 @@ function assembleTable(title: string, columns: readonly ResolvedColumn[], rowCou
418
426
  },
419
427
  },
420
428
  ];
421
- });
429
+ };
430
+ const layoutOf = new Map<ResolvedColumn, LayoutColumn[]>(columns.map((column, index) => [column, columnLayout(column, index)]));
431
+ const layout = columns.flatMap((column) => layoutOf.get(column)!);
422
432
  if (status) layout.push({ header: status.header, value: (row: number) => status.values[row] ?? "" });
433
+ // A column the export gained later (`exportLast`) closes the row, after the status and the fixed columns.
434
+ const appended = columns.flatMap((column) => column.last ? layoutOf.get(column) ?? [] : []);
435
+ const ordered = [...layout.filter((entry) => !appended.includes(entry)), ...appended];
423
436
  return {
424
437
  title,
425
- columns: layout.map((column) => column.header),
426
- rows: Array.from({ length: rowCount }, (_, row) => layout.map((column) => column.value(row))),
438
+ columns: ordered.map((column) => column.header),
439
+ rows: Array.from({ length: rowCount }, (_, row) => ordered.map((column) => column.value(row))),
440
+ ...appended.length > 0 ? { appendedColumns: appended.length } : {},
427
441
  };
428
442
  }
429
443
 
@@ -566,7 +580,8 @@ export function exportRowsTable<Row extends Record<string, unknown>>(
566
580
  };
567
581
  const unit = units[columnIndex];
568
582
  const withUnit = unit == null ? table : { ...table, unit };
569
- return column.unitColumn && column.unitKey && !inRowUnit ? { ...withUnit, unitColumn: true } : withUnit;
583
+ const last = column.exportLast ? { ...withUnit, last: true } : withUnit;
584
+ return column.unitColumn && column.unitKey && !inRowUnit ? { ...last, unitColumn: true } : last;
570
585
  });
571
586
  const statusColumn = withStatus ? {
572
587
  header: columns.some((column) => column.header.trim().toLowerCase() === "status") ? "value_status" : "status",
@@ -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 ? (
@@ -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";