@gloom-sh/terminal 0.19.5 → 0.19.6
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/package.json +1 -1
- package/patches/@opentui%2Fcore@0.3.2.patch +86 -25
- package/src/api-client/equity-screener.ts +23 -0
- package/src/app/pane-runtime/index.tsx +2 -0
- package/src/app/pane-runtime/plugin-bindings.ts +10 -1
- package/src/app.tsx +63 -16
- package/src/cli/commands/market.ts +149 -10
- package/src/cli/commands/search.ts +21 -3
- package/src/cli/commands/ticker.ts +74 -33
- package/src/cli/glossary.ts +3 -3
- package/src/cli/known-gaps.ts +8 -0
- package/src/cli/listing-arg.ts +12 -0
- package/src/cli/pane-functions/capabilities.ts +2 -0
- package/src/cli/pane-functions/catalog.ts +22 -4
- package/src/cli/pane-functions/function-help.ts +8 -5
- package/src/cli/pane-functions/headless.ts +4 -3
- package/src/cli/pane-functions/resolver.ts +75 -2
- package/src/cli/quote-answer.ts +9 -0
- package/src/cli/symbol-list.ts +54 -2
- package/src/cli/symbol-rows.ts +14 -2
- package/src/cli/ticker-resolution.ts +89 -20
- package/src/components/chart/composite/axis-overlays.tsx +60 -27
- package/src/components/chart/composite/composite-chart.tsx +118 -63
- package/src/components/chart/composite/cursor-source.ts +111 -0
- package/src/components/chart/composite/format.ts +168 -6
- package/src/components/chart/composite/legend.tsx +8 -4
- package/src/components/chart/composite/panel-labels.ts +20 -1
- package/src/components/chart/composite/panel-surface.tsx +201 -92
- package/src/components/chart/composite/price-axis-labels.tsx +92 -46
- package/src/components/chart/composite/price-series.ts +31 -8
- package/src/components/chart/composite/scene.ts +154 -59
- package/src/components/chart/composite/series-axis-tags.tsx +4 -2
- package/src/components/chart/composite/time-axis.ts +13 -5
- package/src/components/chart/composite/time-scale.ts +211 -56
- package/src/components/chart/composite/types.ts +11 -1
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +32 -12
- package/src/components/chart/curve/curve-surface.tsx +5 -2
- package/src/components/chart/curve/model.ts +4 -1
- package/src/components/chart/native/use-bitmap-metrics.ts +81 -0
- package/src/components/chart/static/series.ts +3 -0
- package/src/components/command-bar/commands/collection-list.ts +81 -0
- package/src/components/command-bar/commands/direct/index.ts +6 -0
- package/src/components/command-bar/commands/registry.ts +8 -0
- package/src/components/command-bar/layout-items/current-layout.ts +22 -1
- package/src/components/command-bar/layout-items/focused-pane.ts +22 -1
- package/src/components/command-bar/pane-templates/items.ts +19 -3
- package/src/components/command-bar/pane-templates/workflow.ts +5 -0
- package/src/components/command-bar/routes/root/results.ts +23 -3
- package/src/components/command-bar/routes/root/selection.ts +4 -2
- package/src/components/command-bar/routes/root/shortcut-feedback.ts +1 -1
- package/src/components/command-bar/routes/root/shortcut-items.ts +3 -4
- package/src/components/command-bar/routes/root/shortcuts.ts +58 -14
- package/src/components/command-bar/routes/root/ticker-first.ts +32 -0
- package/src/components/command-bar/surface/environment.ts +2 -0
- package/src/components/command-bar/view-model.ts +7 -0
- package/src/components/command-bar/workflow/ops.ts +2 -1
- package/src/components/command-bar/workflow/tickers.ts +20 -0
- package/src/components/layout/shell/menu.ts +15 -1
- package/src/components/layout/shell/pane/actions.ts +4 -0
- package/src/components/layout/shell/ticker-link-menu.ts +12 -3
- package/src/components/layout/status-bar.tsx +20 -0
- package/src/components/onboarding/onboarding-keyboard.ts +5 -1
- package/src/components/onboarding/onboarding-wizard.tsx +15 -4
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +8 -5
- package/src/components/onboarding/use-onboarding-progress.ts +20 -1
- package/src/components/price-sparkline/view.tsx +14 -6
- package/src/components/ticker/badge/index.tsx +8 -4
- package/src/components/ticker/badge/list.tsx +23 -7
- package/src/components/ui/column-grid.tsx +8 -2
- package/src/components/ui/data-table/opentui/model.ts +4 -1
- package/src/components/ui/tabs.tsx +5 -2
- package/src/core/state/app/layout.ts +18 -3
- package/src/core/state/app/state.ts +2 -0
- package/src/core/state/app/types.ts +5 -0
- package/src/data/config/layout.ts +3 -0
- package/src/data/config/store/normalize.ts +39 -4
- package/src/i18n/es.ts +10 -0
- package/src/i18n/ja.ts +10 -0
- package/src/i18n/ko.ts +10 -0
- package/src/i18n/zh-cn.ts +10 -0
- package/src/i18n/zh-tw.ts +10 -0
- package/src/layout/pane-manager/floating-placement.ts +7 -4
- package/src/layout/pane-manager/floating.ts +5 -2
- package/src/market-data/bond-funds.ts +19 -0
- package/src/market-data/futures-contract.ts +14 -3
- package/src/market-data/market/freshness.ts +18 -0
- package/src/market-data/market/status.ts +15 -2
- package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
- package/src/plugins/builtin/bond-calculator/index.tsx +1 -1
- package/src/plugins/builtin/bond-calculator/model.ts +14 -5
- package/src/plugins/builtin/bond-calculator/pane.tsx +1 -1
- package/src/plugins/builtin/buildout/cells.tsx +25 -45
- package/src/plugins/builtin/buildout/detail/company.tsx +3 -3
- package/src/plugins/builtin/buildout/detail/index.tsx +1 -1
- package/src/plugins/builtin/buildout/detail/intel.tsx +4 -7
- package/src/plugins/builtin/buildout/detail/site.tsx +4 -4
- package/src/plugins/builtin/buildout/detail/ui.tsx +39 -38
- package/src/plugins/builtin/buildout/format.ts +23 -1
- package/src/plugins/builtin/buildout/model/types.ts +1 -0
- package/src/plugins/builtin/buildout/pane/index.tsx +2 -8
- package/src/plugins/builtin/buildout/table-model.ts +12 -4
- package/src/plugins/builtin/cds/headless.ts +1 -0
- package/src/plugins/builtin/cds/index.tsx +1 -1
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +28 -3
- package/src/plugins/builtin/correlation/headless.ts +3 -2
- package/src/plugins/builtin/crypto-board/pane.tsx +5 -4
- package/src/plugins/builtin/debt-maturities/headless.ts +11 -2
- package/src/plugins/builtin/debt-maturities/model.ts +66 -0
- package/src/plugins/builtin/debt-maturities/pane.tsx +23 -4
- package/src/plugins/builtin/earnings-ripple/pane.tsx +1 -1
- package/src/plugins/builtin/econ/calendar-model.ts +28 -6
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/criterion-editor.tsx +4 -16
- package/src/plugins/builtin/equity-screener/headless.ts +4 -2
- package/src/plugins/builtin/equity-screener/ideas.ts +67 -3
- package/src/plugins/builtin/equity-screener/model.ts +180 -12
- package/src/plugins/builtin/equity-screener/pane.tsx +52 -12
- package/src/plugins/builtin/equity-screener/screen-check.ts +7 -4
- package/src/plugins/builtin/equity-screener/watchlist.ts +33 -0
- package/src/plugins/builtin/futures-curve/client.ts +19 -0
- package/src/plugins/builtin/futures-curve/headless.ts +52 -13
- package/src/plugins/builtin/futures-curve/index.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +77 -6
- package/src/plugins/builtin/futures-curve/pane.tsx +19 -3
- package/src/plugins/builtin/macro-day/client.ts +41 -0
- package/src/plugins/builtin/macro-day/headless.ts +19 -9
- package/src/plugins/builtin/macro-day/model.ts +3 -1
- package/src/plugins/builtin/market-movers/index.tsx +4 -3
- package/src/plugins/builtin/mna/distress/headless.ts +1 -0
- package/src/plugins/builtin/perps/pane.tsx +3 -1
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +17 -0
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +2 -1
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -1
- package/src/plugins/builtin/rate-path/headless.ts +24 -10
- package/src/plugins/builtin/research/event-model.ts +10 -3
- package/src/plugins/builtin/research/events-headless.ts +20 -2
- package/src/plugins/builtin/sec/fund-facts.ts +17 -1
- package/src/plugins/builtin/sec/index.tsx +1 -1
- package/src/plugins/builtin/shared/members-menu.tsx +103 -38
- package/src/plugins/builtin/short-interest/publications-model.ts +22 -1
- package/src/plugins/builtin/short-interest/publications-pane.tsx +13 -4
- package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
- package/src/plugins/builtin/time-sales/pane.tsx +3 -2
- package/src/plugins/builtin/trace-bonds/client.ts +7 -4
- package/src/plugins/builtin/trace-bonds/index.tsx +1 -1
- package/src/plugins/builtin/volatility/client.ts +6 -1
- package/src/plugins/builtin/volatility/headless.ts +0 -1
- package/src/plugins/builtin/yield-curve/curves.ts +15 -0
- package/src/plugins/builtin/yield-curve/headless.ts +6 -1
- package/src/plugins/builtin/yield-curve/index.tsx +5 -8
- package/src/plugins/host-modules.ts +22 -3
- package/src/plugins/host-smoke.ts +6 -3
- package/src/portfolio/collection-name.ts +19 -0
- package/src/renderers/browser/http-proxy-transport.ts +78 -8
- package/src/renderers/cloudflare/http-proxy.ts +13 -2
- package/src/renderers/cloudflare/proxy-session.ts +47 -24
- package/src/renderers/cloudflare/worker.ts +15 -2
- package/src/renderers/desktop/geometry.ts +279 -0
- package/src/renderers/desktop/screen-setup.ts +246 -0
- package/src/renderers/desktop/sequential-window-host.ts +179 -0
- package/src/renderers/desktop/test-utils.ts +71 -0
- package/src/renderers/desktop/window-controller.ts +433 -0
- package/src/renderers/desktop/window-host.ts +70 -0
- package/src/renderers/desktop/window-layouts.ts +630 -0
- package/src/renderers/dom/data-frames.ts +15 -4
- package/src/renderers/electrobun/bun/application-menu/click.ts +1 -0
- package/src/renderers/electrobun/bun/application-menu/index.ts +4 -1
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +19 -8
- package/src/renderers/electrobun/bun/desktop/backend.ts +320 -19
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +4 -14
- package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
- package/src/renderers/electrobun/bun/desktop/screen-setup-file.ts +55 -0
- package/src/renderers/electrobun/bun/desktop/state-broadcaster.ts +44 -8
- package/src/renderers/electrobun/bun/desktop/workspace/index.ts +298 -97
- package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +44 -6
- package/src/renderers/electrobun/bun/index.ts +4 -97
- package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +306 -0
- package/src/renderers/electrobun/bun/window/focus.ts +0 -25
- package/src/renderers/electrobun/bun/window/remembered-frame.ts +4 -82
- package/src/renderers/electrobun/shared/protocol.ts +44 -2
- package/src/renderers/electrobun/view/backend-rpc.ts +15 -0
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +63 -3
- package/src/renderers/electrobun/view/main.tsx +13 -7
- package/src/series/fred-argument.ts +17 -0
- package/src/sources/provider-router/financial-routes.ts +7 -1
- package/src/state/app/context/index.tsx +16 -2
- package/src/state/desktop-windows.ts +63 -0
- package/src/sync/other-window-tabs.ts +62 -0
- package/src/tickers/company-name-listing.ts +23 -3
- package/src/tickers/listing-fate.ts +147 -1
- package/src/tickers/terminal-codes.ts +5 -0
- package/src/time-series/types.ts +6 -0
- package/src/types/config.ts +10 -1
- package/src/types/desktop-window.ts +71 -2
- package/src/types/financials.ts +4 -0
- package/src/types/headless.ts +19 -0
- package/src/types/plugin.ts +6 -0
- package/src/ui/index.tsx +14 -13
- package/src/ui/same-props.ts +58 -0
- package/src/utils/cli-output.ts +33 -4
- package/src/utils/format.ts +7 -2
- package/src/utils/futures-generic.ts +12 -0
- package/src/utils/http-proxy-upstream.ts +6 -2
- package/src/utils/plugin-proxy-hosts.json +0 -4
- package/src/utils/plugin-proxy-hosts.ts +22 -0
- package/src/utils/sec-filings.ts +7 -1
|
@@ -58,7 +58,7 @@ export function normalizeLoadedConfig(
|
|
|
58
58
|
const defaults = createDefaultConfig(dataDir);
|
|
59
59
|
const migration = migrateSavedConfig(saved, dataDir, host);
|
|
60
60
|
const candidate = migration.config;
|
|
61
|
-
const directLayout = sanitizeLayout(candidate.layout, defaults.layout);
|
|
61
|
+
const directLayout = sanitizeLayout(candidate.layout, defaults.layout, {}, savedPaneIds(candidate.layouts));
|
|
62
62
|
const layouts = sanitizeSavedLayouts(candidate.layouts, directLayout);
|
|
63
63
|
const activeLayoutIndex = sanitizeActiveLayoutIndex(candidate.activeLayoutIndex, layouts.length);
|
|
64
64
|
const layout = cloneLayout(layouts[activeLayoutIndex]?.layout ?? directLayout);
|
|
@@ -139,7 +139,7 @@ export function normalizeLoadedConfig(
|
|
|
139
139
|
|
|
140
140
|
export function normalizeConfigForSave(config: AppConfig): AppConfig {
|
|
141
141
|
const defaults = createDefaultConfig(config.dataDir);
|
|
142
|
-
const directLayout = sanitizeLayout(config.layout, defaults.layout);
|
|
142
|
+
const directLayout = sanitizeLayout(config.layout, defaults.layout, {}, savedPaneIds(config.layouts));
|
|
143
143
|
const sanitizedLayouts = sanitizeSavedLayouts(config.layouts, directLayout);
|
|
144
144
|
const activeLayoutIndex = sanitizeActiveLayoutIndex(config.activeLayoutIndex, sanitizedLayouts.length || 1);
|
|
145
145
|
const layout = cloneLayout(sanitizedLayouts[activeLayoutIndex]?.layout ?? directLayout);
|
|
@@ -469,10 +469,44 @@ function sanitizeLayoutOrigin(value: unknown): LayoutOrigin | undefined {
|
|
|
469
469
|
const sanitizedLayouts = new WeakMap<object, LayoutConfig>();
|
|
470
470
|
const sanitizedPaneStates = new WeakMap<object, { layout: LayoutConfig; result: ReturnType<typeof sanitizeSavedPaneState> }>();
|
|
471
471
|
|
|
472
|
-
|
|
472
|
+
/** Every pane id on a saved tab: the panes a link on another tab may follow. */
|
|
473
|
+
function savedPaneIds(value: unknown): ReadonlySet<string> {
|
|
474
|
+
const ids = new Set<string>();
|
|
475
|
+
if (!Array.isArray(value)) return ids;
|
|
476
|
+
for (const entry of value) {
|
|
477
|
+
const instances = isRecord(entry) && isRecord(entry.layout) ? entry.layout.instances : null;
|
|
478
|
+
if (!Array.isArray(instances)) continue;
|
|
479
|
+
for (const instance of instances) {
|
|
480
|
+
if (isRecord(instance) && typeof instance.instanceId === "string") ids.add(instance.instanceId);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return ids;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* The panes a layout's links reach on other tabs. Links stay within a tab,
|
|
488
|
+
* except where another desktop window shows the tab a pane was moved to;
|
|
489
|
+
* those are kept, and every other dangling link is cut as before.
|
|
490
|
+
*/
|
|
491
|
+
function crossTabSources(value: LayoutConfig, paneIds: ReadonlySet<string>): ReadonlySet<string> | undefined {
|
|
492
|
+
if (!Array.isArray(value.instances)) return undefined;
|
|
493
|
+
const own = new Set(value.instances.map((instance) => instance?.instanceId));
|
|
494
|
+
const sources = new Set<string>();
|
|
495
|
+
for (const instance of value.instances) {
|
|
496
|
+
const binding = instance?.binding;
|
|
497
|
+
if (binding?.kind !== "follow" || typeof binding.sourceInstanceId !== "string") continue;
|
|
498
|
+
if (!own.has(binding.sourceInstanceId) && paneIds.has(binding.sourceInstanceId)) sources.add(binding.sourceInstanceId);
|
|
499
|
+
}
|
|
500
|
+
return sources.size > 0 ? sources : undefined;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
function sanitizeSavedLayoutOnce(value: unknown, fallbackLayout: LayoutConfig, paneIds: ReadonlySet<string>): LayoutConfig {
|
|
473
504
|
// An invalid value sanitizes to a copy of the fallback, which is not a
|
|
474
505
|
// function of the value alone.
|
|
475
506
|
if (!isLayoutConfig(value)) return sanitizeLayout(value, fallbackLayout);
|
|
507
|
+
const external = crossTabSources(value, paneIds);
|
|
508
|
+
// A link to another tab depends on the other tabs too: those are not cached.
|
|
509
|
+
if (external) return sanitizeLayout(value, fallbackLayout, {}, external);
|
|
476
510
|
const cached = sanitizedLayouts.get(value);
|
|
477
511
|
if (cached) return cached;
|
|
478
512
|
const layout = sanitizeLayout(value, fallbackLayout);
|
|
@@ -497,6 +531,7 @@ function sanitizeSavedLayouts(
|
|
|
497
531
|
return [{ name: "Default", layout: cloneLayout(fallbackLayout) }];
|
|
498
532
|
}
|
|
499
533
|
|
|
534
|
+
const paneIds = savedPaneIds(value);
|
|
500
535
|
const layouts = value
|
|
501
536
|
.filter((entry): entry is SavedLayout =>
|
|
502
537
|
!!entry
|
|
@@ -504,7 +539,7 @@ function sanitizeSavedLayouts(
|
|
|
504
539
|
&& typeof (entry as SavedLayout).name === "string",
|
|
505
540
|
)
|
|
506
541
|
.map((entry) => {
|
|
507
|
-
const layout = sanitizeSavedLayoutOnce(entry.layout, fallbackLayout);
|
|
542
|
+
const layout = sanitizeSavedLayoutOnce(entry.layout, fallbackLayout, paneIds);
|
|
508
543
|
const placedPaneIds = new Set(getPlacedPaneInstanceIds(layout));
|
|
509
544
|
const paneState = sanitizeSavedPaneStateOnce((entry as { paneState?: unknown }).paneState, layout);
|
|
510
545
|
return {
|
package/src/i18n/es.ts
CHANGED
|
@@ -249,6 +249,15 @@ export const es: Record<string, string> = {
|
|
|
249
249
|
"Copy Screenshot": "Copiar captura",
|
|
250
250
|
"Share Pane": "Compartir panel",
|
|
251
251
|
"Pop Out": "Abrir en ventana",
|
|
252
|
+
"New Window": "Ventana nueva",
|
|
253
|
+
"Main Window": "Ventana principal",
|
|
254
|
+
"Window {number}": "Ventana {number}",
|
|
255
|
+
"Move to {window}": "Mover a {window}",
|
|
256
|
+
"Move to New Window": "Mover a una ventana nueva",
|
|
257
|
+
"Move Layout to {window}": "Mover diseño a {window}",
|
|
258
|
+
"Move Layout to New Window": "Mover diseño a una ventana nueva",
|
|
259
|
+
"Unlink from Pane in Another Window": "Desvincular del panel de otra ventana",
|
|
260
|
+
"Open another app window with its own layout tabs, for another screen": "Abrir otra ventana de la app con sus propias pestañas de diseño, para otra pantalla",
|
|
252
261
|
"Move Window...": "Mover ventana...",
|
|
253
262
|
"Change Ticker...": "Cambiar ticker...",
|
|
254
263
|
"Change Ticker": "Cambiar ticker",
|
|
@@ -1259,6 +1268,7 @@ export const es: Record<string, string> = {
|
|
|
1259
1268
|
"{count}m": "{count} min",
|
|
1260
1269
|
"{count}h": "{count} h",
|
|
1261
1270
|
"delayed data · upgrade": "datos diferidos · mejorar",
|
|
1271
|
+
"upgrade": "mejorar",
|
|
1262
1272
|
"real-time news": "noticias en tiempo real",
|
|
1263
1273
|
"Pro trial · {days}d left": "Prueba Pro · quedan {days} d",
|
|
1264
1274
|
"{delay} delayed": "{delay} de retraso",
|
package/src/i18n/ja.ts
CHANGED
|
@@ -250,6 +250,15 @@ export const ja: Record<string, string> = {
|
|
|
250
250
|
"Copy Screenshot": "スクリーンショットをコピー",
|
|
251
251
|
"Share Pane": "ペインを共有",
|
|
252
252
|
"Pop Out": "別ウィンドウで表示",
|
|
253
|
+
"New Window": "新規ウィンドウ",
|
|
254
|
+
"Main Window": "メインウィンドウ",
|
|
255
|
+
"Window {number}": "ウィンドウ {number}",
|
|
256
|
+
"Move to {window}": "{window} へ移動",
|
|
257
|
+
"Move to New Window": "新規ウィンドウへ移動",
|
|
258
|
+
"Move Layout to {window}": "レイアウトを {window} へ移動",
|
|
259
|
+
"Move Layout to New Window": "レイアウトを新規ウィンドウへ移動",
|
|
260
|
+
"Unlink from Pane in Another Window": "別ウィンドウのパネルとのリンクを解除",
|
|
261
|
+
"Open another app window with its own layout tabs, for another screen": "別の画面用に、専用のレイアウトタブを持つアプリウィンドウをもう一つ開く",
|
|
253
262
|
"Move Window...": "ウィンドウを移動...",
|
|
254
263
|
"Change Ticker...": "銘柄を変更...",
|
|
255
264
|
"Change Ticker": "銘柄を変更",
|
|
@@ -679,6 +688,7 @@ export const ja: Record<string, string> = {
|
|
|
679
688
|
"Pro trial {days}d": "Pro トライアル{days}日",
|
|
680
689
|
"Pro trial — ends {date}": "Pro トライアル — {date} まで",
|
|
681
690
|
"delayed data · upgrade": "データ遅延 · アップグレード",
|
|
691
|
+
"upgrade": "アップグレード",
|
|
682
692
|
"real-time news": "リアルタイムニュース",
|
|
683
693
|
"AI command bar": "AI コマンドバー",
|
|
684
694
|
"{amount}/mo": "{amount}/月",
|
package/src/i18n/ko.ts
CHANGED
|
@@ -248,6 +248,15 @@ export const ko: Record<string, string> = {
|
|
|
248
248
|
"Copy Screenshot": "스크린샷 복사",
|
|
249
249
|
"Share Pane": "창 공유",
|
|
250
250
|
"Pop Out": "별도 창으로 열기",
|
|
251
|
+
"New Window": "새 창",
|
|
252
|
+
"Main Window": "메인 창",
|
|
253
|
+
"Window {number}": "창 {number}",
|
|
254
|
+
"Move to {window}": "{window}(으)로 이동",
|
|
255
|
+
"Move to New Window": "새 창으로 이동",
|
|
256
|
+
"Move Layout to {window}": "레이아웃을 {window}(으)로 이동",
|
|
257
|
+
"Move Layout to New Window": "레이아웃을 새 창으로 이동",
|
|
258
|
+
"Unlink from Pane in Another Window": "다른 창의 패널과 연결 해제",
|
|
259
|
+
"Open another app window with its own layout tabs, for another screen": "다른 화면용으로 자체 레이아웃 탭이 있는 앱 창을 하나 더 열기",
|
|
251
260
|
"Move Window...": "창 이동...",
|
|
252
261
|
"Change Ticker...": "종목 변경...",
|
|
253
262
|
"Change Ticker": "종목 변경",
|
|
@@ -677,6 +686,7 @@ export const ko: Record<string, string> = {
|
|
|
677
686
|
"Pro trial {days}d": "Pro 체험 {days}일",
|
|
678
687
|
"Pro trial — ends {date}": "Pro 체험 — {date} 종료",
|
|
679
688
|
"delayed data · upgrade": "지연 데이터 · 업그레이드",
|
|
689
|
+
"upgrade": "업그레이드",
|
|
680
690
|
"real-time news": "실시간 뉴스",
|
|
681
691
|
"AI command bar": "AI 명령 바",
|
|
682
692
|
"{amount}/mo": "{amount}/월",
|
package/src/i18n/zh-cn.ts
CHANGED
|
@@ -250,6 +250,15 @@ export const zhCN: Record<string, string> = {
|
|
|
250
250
|
"Copy Screenshot": "复制截图",
|
|
251
251
|
"Share Pane": "分享窗格",
|
|
252
252
|
"Pop Out": "弹出窗口",
|
|
253
|
+
"New Window": "新建窗口",
|
|
254
|
+
"Main Window": "主窗口",
|
|
255
|
+
"Window {number}": "窗口 {number}",
|
|
256
|
+
"Move to {window}": "移到{window}",
|
|
257
|
+
"Move to New Window": "移到新窗口",
|
|
258
|
+
"Move Layout to {window}": "将布局移到{window}",
|
|
259
|
+
"Move Layout to New Window": "将布局移到新窗口",
|
|
260
|
+
"Unlink from Pane in Another Window": "取消与其他窗口面板的链接",
|
|
261
|
+
"Open another app window with its own layout tabs, for another screen": "为另一块屏幕再打开一个带有独立布局标签的应用窗口",
|
|
253
262
|
"Move Window...": "移动窗口...",
|
|
254
263
|
"Change Ticker...": "更改股票代码...",
|
|
255
264
|
"Change Ticker": "更改股票代码",
|
|
@@ -679,6 +688,7 @@ export const zhCN: Record<string, string> = {
|
|
|
679
688
|
"Pro trial {days}d": "Pro 试用 {days} 天",
|
|
680
689
|
"Pro trial — ends {date}": "Pro 试用 — {date} 结束",
|
|
681
690
|
"delayed data · upgrade": "数据延迟 · 升级",
|
|
691
|
+
"upgrade": "升级",
|
|
682
692
|
"real-time news": "实时新闻",
|
|
683
693
|
"AI command bar": "AI 命令栏",
|
|
684
694
|
"{amount}/mo": "{amount}/月",
|
package/src/i18n/zh-tw.ts
CHANGED
|
@@ -250,6 +250,15 @@ export const zhTW: Record<string, string> = {
|
|
|
250
250
|
"Copy Screenshot": "複製截圖",
|
|
251
251
|
"Share Pane": "分享窗格",
|
|
252
252
|
"Pop Out": "彈出視窗",
|
|
253
|
+
"New Window": "新增視窗",
|
|
254
|
+
"Main Window": "主視窗",
|
|
255
|
+
"Window {number}": "視窗 {number}",
|
|
256
|
+
"Move to {window}": "移到{window}",
|
|
257
|
+
"Move to New Window": "移到新視窗",
|
|
258
|
+
"Move Layout to {window}": "將版面設定移到{window}",
|
|
259
|
+
"Move Layout to New Window": "將版面設定移到新視窗",
|
|
260
|
+
"Unlink from Pane in Another Window": "取消與其他視窗面板的連結",
|
|
261
|
+
"Open another app window with its own layout tabs, for another screen": "為另一個螢幕再開啟一個擁有獨立版面設定標籤的應用程式視窗",
|
|
253
262
|
"Move Window...": "移動視窗...",
|
|
254
263
|
"Change Ticker...": "變更股票代號...",
|
|
255
264
|
"Change Ticker": "變更股票代號",
|
|
@@ -679,6 +688,7 @@ export const zhTW: Record<string, string> = {
|
|
|
679
688
|
"Pro trial {days}d": "Pro 試用 {days} 天",
|
|
680
689
|
"Pro trial — ends {date}": "Pro 試用 — {date} 結束",
|
|
681
690
|
"delayed data · upgrade": "資料延遲 · 升級",
|
|
691
|
+
"upgrade": "升級",
|
|
682
692
|
"real-time news": "即時新聞",
|
|
683
693
|
"AI command bar": "AI 命令列",
|
|
684
694
|
"{amount}/mo": "{amount}/月",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LayoutConfig } from "../../types/config";
|
|
2
2
|
import { getDockLeafLayouts, type LayoutBounds } from "./dock-tree";
|
|
3
|
-
import { clampFloatingRect, MIN_FLOAT_HEIGHT, MIN_FLOAT_WIDTH, type FloatingRect } from "./floating";
|
|
3
|
+
import { clampFloatingRect, MIN_FLOAT_HEIGHT, MIN_FLOAT_WIDTH, NARROW_FLOAT_AREA_WIDTH, type FloatingRect } from "./floating";
|
|
4
4
|
|
|
5
5
|
/** What a new floating pane keeps clear of beyond the other floating panes. */
|
|
6
6
|
export interface FloatingPlacementOptions {
|
|
@@ -63,7 +63,9 @@ function screenRect(layout: LayoutConfig, instanceId: string, area: LayoutBounds
|
|
|
63
63
|
* and of the focused pane, shrunk to it when it is a little small, and centred
|
|
64
64
|
* in it; otherwise one step down and right of the frontmost window, a cascade.
|
|
65
65
|
* It never lands exactly on another window, and never covers all of the
|
|
66
|
-
* focused pane when there is any other way.
|
|
66
|
+
* focused pane when there is any other way. An area narrower than
|
|
67
|
+
* NARROW_FLOAT_AREA_WIDTH is never searched for a narrower spot: the window
|
|
68
|
+
* spans it and cascades down.
|
|
67
69
|
*/
|
|
68
70
|
export function placeFloatingRect(
|
|
69
71
|
layout: LayoutConfig,
|
|
@@ -79,10 +81,11 @@ export function placeFloatingRect(
|
|
|
79
81
|
const focused = focusedId ? screenRect(layout, focusedId, area) : null;
|
|
80
82
|
const obstacles: LayoutBounds[] = [...others];
|
|
81
83
|
if (focused && !others.some((entry) => entry.instanceId === focusedId)) obstacles.push(focused);
|
|
82
|
-
const
|
|
84
|
+
const narrow = area.width < NARROW_FLOAT_AREA_WIDTH;
|
|
85
|
+
const width = narrow ? area.width : Math.min(size.width, area.width);
|
|
83
86
|
const height = Math.min(size.height, area.height);
|
|
84
87
|
|
|
85
|
-
if (obstacles.length <= MAX_FREE_SEARCH_OBSTACLES) {
|
|
88
|
+
if (!narrow && obstacles.length <= MAX_FREE_SEARCH_OBSTACLES) {
|
|
86
89
|
const spot = bestFreeSpot(area, obstacles, width, height);
|
|
87
90
|
if (spot) return clampFloatingRect(spot, termWidth, termHeight);
|
|
88
91
|
}
|
|
@@ -53,12 +53,15 @@ export function clampFloatingRectWithinBounds(rect: FloatingRect, bounds: Layout
|
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
/**
|
|
56
|
+
/** An area narrower than this opens a new floating pane across its full width: 60% of it is too narrow to read a pane in. */
|
|
57
|
+
export const NARROW_FLOAT_AREA_WIDTH = 60;
|
|
58
|
+
|
|
59
|
+
/** A new floating pane's size: its own default, or 60% of the area each way; the full width of a narrow area. */
|
|
57
60
|
export function defaultFloatingSize(termWidth: number, termHeight: number, def?: PaneDef): { width: number; height: number } {
|
|
58
61
|
const { width, height } = clampFloatingRect({
|
|
59
62
|
x: 0,
|
|
60
63
|
y: 0,
|
|
61
|
-
width: def?.defaultFloatingSize?.width ?? Math.floor(termWidth * 0.6),
|
|
64
|
+
width: termWidth < NARROW_FLOAT_AREA_WIDTH ? termWidth : def?.defaultFloatingSize?.width ?? Math.floor(termWidth * 0.6),
|
|
62
65
|
height: def?.defaultFloatingSize?.height ?? Math.floor(termHeight * 0.6),
|
|
63
66
|
}, termWidth, termHeight);
|
|
64
67
|
return { width, height };
|
|
@@ -60,6 +60,25 @@ export function bondFigures(bond: FundBondFacts): BondFigure[] {
|
|
|
60
60
|
return figures;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
/** How a fund's DV01 is derived, said beside it: the sponsor publishes a duration, not a DV01. */
|
|
64
|
+
export const DV01_FROM_DURATION = "price × duration ÷ 10,000";
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* A bond fund's dollar value of a basis point per share, derived from its
|
|
68
|
+
* duration: price × duration ÷ 10,000 (IEF at $91.76 and 6.82 yrs: $0.0626),
|
|
69
|
+
* what a curve trade is sized by. Null without a positive price and duration.
|
|
70
|
+
*/
|
|
71
|
+
export function durationDv01PerShare(price: number | null | undefined, bond: FundBondFacts | null | undefined): number | null {
|
|
72
|
+
const duration = bond?.duration?.value;
|
|
73
|
+
if (price == null || !Number.isFinite(price) || price <= 0 || duration == null || !Number.isFinite(duration) || duration <= 0) return null;
|
|
74
|
+
return price * duration / 10_000;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** A DV01 per share in dollars: `$0.0626 per share`. */
|
|
78
|
+
export function formatDv01PerShare(value: number): string {
|
|
79
|
+
return `$${value.toFixed(4)} per share`;
|
|
80
|
+
}
|
|
81
|
+
|
|
63
82
|
/** `Municipal, CA (single-state)`, `Municipal, national` or `Taxable`: what a bond fund is for tax. */
|
|
64
83
|
export function bondClassText(bond: FundBondFacts): string {
|
|
65
84
|
if (bond.kind === "taxable") return "Taxable";
|
|
@@ -78,6 +78,15 @@ function contractCode(symbol: string): string {
|
|
|
78
78
|
return parsePublicTickerKey(symbol).symbol.replace(/\.[A-Z]+$/, "");
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* A listed contract as `CTM` names it: its quote symbol without the venue,
|
|
83
|
+
* GCZ26 for GCZ26.CMX and Cboe's VX/X6 for VIX November, so `quote` and the
|
|
84
|
+
* curve write one contract alike. Its archive code where it has no symbol.
|
|
85
|
+
*/
|
|
86
|
+
export function futuresContractCode(contract: { contract: string | null; contractSymbol?: string | null }): string {
|
|
87
|
+
return contract.contractSymbol ? contract.contractSymbol.replace(/\.[A-Z]+$/, "") : contract.contract ?? "";
|
|
88
|
+
}
|
|
89
|
+
|
|
81
90
|
/**
|
|
82
91
|
* The Contract block: the contract an alias or a generic prices, its terms and
|
|
83
92
|
* the dates a long faces delivery. A line with nothing to say is left out, so
|
|
@@ -85,7 +94,8 @@ function contractCode(symbol: string): string {
|
|
|
85
94
|
*/
|
|
86
95
|
export function futuresContractLines(terms: FuturesContractTermsPayload, symbol: string): FuturesContractLine[] {
|
|
87
96
|
const lines: FuturesContractLine[] = [];
|
|
88
|
-
|
|
97
|
+
const code = terms.contract ? futuresContractCode(terms) : null;
|
|
98
|
+
if (code && code !== contractCode(symbol)) lines.push({ key: "contract", label: "Contract", value: code });
|
|
89
99
|
if (terms.spec) lines.push(...futuresSpecLines(terms.spec));
|
|
90
100
|
else {
|
|
91
101
|
// A root the server sends no terms for still says what its price counts: Dutch TTF gas is EUR / MWh.
|
|
@@ -297,9 +307,10 @@ export function futuresChangeBasis(
|
|
|
297
307
|
}
|
|
298
308
|
|
|
299
309
|
/** A listed contract as code and month: "NGX26 (Nov 2026)". */
|
|
300
|
-
function contractWithMonth(contract: { contract: string; deliveryMonth: string }): string {
|
|
310
|
+
function contractWithMonth(contract: { contract: string; contractSymbol: string; deliveryMonth: string }): string {
|
|
301
311
|
const month = deliveryMonthLabel(contract.deliveryMonth);
|
|
302
|
-
|
|
312
|
+
const code = futuresContractCode(contract);
|
|
313
|
+
return month ? `${code} (${month})` : code;
|
|
303
314
|
}
|
|
304
315
|
|
|
305
316
|
/**
|
|
@@ -296,6 +296,24 @@ export function isVenueTradingDay(exchange: string | undefined, date: string): b
|
|
|
296
296
|
return isLocalTradingDay(canonicalExchange(exchange), date);
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
+
/**
|
|
300
|
+
* The venue's session a local `date` belongs to: the date itself when the
|
|
301
|
+
* venue trades on it (isVenueTradingDay), otherwise the latest trading day
|
|
302
|
+
* before it, as a print stamped on a Saturday or a holiday follows the last
|
|
303
|
+
* session and opens none of its own. Null for round-the-clock venues and when
|
|
304
|
+
* no trading day falls within the lookback.
|
|
305
|
+
*/
|
|
306
|
+
export function venueSessionOnOrBefore(exchange: string | undefined, date: string): string | null {
|
|
307
|
+
const canonical = canonicalExchange(exchange);
|
|
308
|
+
const day = isoLocalDateToUtcDay(date);
|
|
309
|
+
if (day == null || ALWAYS_OPEN_EXCHANGES.has(canonical)) return null;
|
|
310
|
+
for (let offset = 0; offset <= SESSION_LOOKBACK_DAYS; offset++) {
|
|
311
|
+
const iso = new Date((day - offset) * MS_PER_DAY).toISOString().slice(0, 10);
|
|
312
|
+
if (isLocalTradingDay(canonical, iso)) return iso;
|
|
313
|
+
}
|
|
314
|
+
return null;
|
|
315
|
+
}
|
|
316
|
+
|
|
299
317
|
/** `weekendDays` replaces the venue's days off (historySourceWeekendDays). */
|
|
300
318
|
function isLocalTradingDay(exchange: string, date: string, weekendDays?: readonly number[]): boolean {
|
|
301
319
|
const weekday = localWeekday(date);
|
|
@@ -5,7 +5,7 @@ import { canonicalExchange, isKnownExchangeCode } from "../../utils/exchanges";
|
|
|
5
5
|
import { quoteTradingDay } from "../quotes/day-range";
|
|
6
6
|
import { isQuoteBeforeLatestSession } from "../quotes/freshness";
|
|
7
7
|
import { delistingLabel, delistingStateLabel } from "../quotes/delisting";
|
|
8
|
-
import { preMarketOpenOn, regularSessionCloseOn } from "./freshness";
|
|
8
|
+
import { preMarketOpenOn, regularSessionCloseOn, venueSessionOnOrBefore } from "./freshness";
|
|
9
9
|
import { futuresWeekendClosure } from "./futures-week";
|
|
10
10
|
|
|
11
11
|
const CLOSED_CHANGE_MUTING_RATIO = 0.55;
|
|
@@ -323,6 +323,18 @@ function reportedRegularMove(quote: Quote, close: number): CompletedRegularSessi
|
|
|
323
323
|
return changePercent == null ? null : { change, changePercent };
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
+
/**
|
|
327
|
+
* The session a quote's day belongs to: its trading day (quoteTradingDay), or
|
|
328
|
+
* for a print stamped on a day its venue does not trade (a Saturday after
|
|
329
|
+
* midnight New York, a holiday), the latest session before it. No session is
|
|
330
|
+
* read into a non-trading day.
|
|
331
|
+
*/
|
|
332
|
+
function quoteSessionDay(quote: Quote): string | null {
|
|
333
|
+
const day = quoteTradingDay(quote);
|
|
334
|
+
if (!day) return null;
|
|
335
|
+
return venueSessionOnOrBefore(quote.listingExchangeName || quote.exchangeName, day) ?? day;
|
|
336
|
+
}
|
|
337
|
+
|
|
326
338
|
/**
|
|
327
339
|
* The regular session the quote's day follows, once it is over: after hours,
|
|
328
340
|
* overnight, and through a weekend or holiday until the next pre-market, and
|
|
@@ -344,7 +356,8 @@ function completedRegularSession(quote: Quote): CompletedRegularSession | null {
|
|
|
344
356
|
const today = quoteTradingDay(quote);
|
|
345
357
|
return reported && closeDate && today && closeDate < today ? { close, reported, date: closeDate } : null;
|
|
346
358
|
}
|
|
347
|
-
|
|
359
|
+
// A print after the close, a weekend print included, never headlines over that close.
|
|
360
|
+
if (closeDate ? closeDate === quoteSessionDay(quote) : state === "POST") {
|
|
348
361
|
return closeDate ? { close, reported, date: closeDate } : { close, reported };
|
|
349
362
|
}
|
|
350
363
|
}
|
|
@@ -45,7 +45,8 @@ export const bondCalculatorHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
45
45
|
{ label: "Macaulay duration", value: a.macaulayDuration, formatted: `${a.macaulayDuration.toFixed(4)} years` },
|
|
46
46
|
{ label: "Modified duration", value: a.modifiedDuration, formatted: `${a.modifiedDuration.toFixed(4)} years` },
|
|
47
47
|
{ label: "Convexity", value: a.convexity, formatted: a.convexity.toFixed(4) },
|
|
48
|
-
|
|
48
|
+
// The price change for a 1bp fall in yield, per 100 face as the prices are: 0.045493 is $45.49 on $100,000.
|
|
49
|
+
{ label: "DV01", value: a.dv01, formatted: `${a.dv01.toFixed(6)} per 100 face` },
|
|
49
50
|
{ label: "Treasury spread", value: result.spread?.spreadBps ?? null, formatted: result.spread ? `${result.spread.spreadBps.toFixed(1)} bp as of ${result.spread.asOf}` : "Unavailable" },
|
|
50
51
|
] },
|
|
51
52
|
{ title: "Cash flows per 100 face", columns: [{ key: "date", header: "Payment" }, { key: "amount", header: "Cash", format: (n) => Number(n).toFixed(4) }, { key: "presentValue", header: "Present value", format: (n) => Number(n).toFixed(4) }], rows: a.cashFlows.map((flow) => ({ ...flow })) },
|
|
@@ -5,6 +5,6 @@ import { fixedIncomeShortcut } from "../fixed-income/shortcut";
|
|
|
5
5
|
export const bondCalculatorModule: PluginModule = {
|
|
6
6
|
paneTemplates: [fixedIncomeShortcut({ id: "bond-calculator-pane", paneId: "bond-calculator", label: "Bond Calculator",
|
|
7
7
|
description: "Price, yield, accrued interest, duration, convexity and Treasury spread for a fixed coupon bond.",
|
|
8
|
-
keywords: ["yas", "bond", "calculator", "yield", "price", "duration", "dv01"], shortcut: { prefix: "YAS" },
|
|
8
|
+
keywords: ["yas", "bond", "calculator", "yield", "price", "duration", "dv01", "hedge ratio", "steepener", "flattener"], shortcut: { prefix: "YAS" },
|
|
9
9
|
headless: bondCalculatorHeadless, createInstance: () => ({}) }, "bonds", "calculator")],
|
|
10
10
|
};
|
|
@@ -20,18 +20,27 @@ export function defaultBondDraft(now = new Date()): BondDraft {
|
|
|
20
20
|
frequency: "2", dayCount: "act-act-icma", endOfMonth: false };
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
/**
|
|
24
|
+
* A coupon or yield typed with a decimal comma (`3,875`, `-0,25`) reads as the
|
|
25
|
+
* decimal it is: a percent rate is never in the thousands, so `3,875` is
|
|
26
|
+
* 3.875%, not 3875. A clean price keeps the dot it is told to use.
|
|
27
|
+
*/
|
|
28
|
+
const DECIMAL_COMMA_RATE = /^([+-]?\d+),(\d+)$/;
|
|
29
|
+
|
|
30
|
+
function inputNumber(value: string, label: string, decimalComma = false): number {
|
|
31
|
+
const comma = decimalComma ? DECIMAL_COMMA_RATE.exec(value.trim()) : null;
|
|
32
|
+
const text = comma ? `${comma[1]}.${comma[2]}` : value.trim();
|
|
33
|
+
if (!text || !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(text)) throw new Error(numberErrorMessage(`${label} must be a number`, value));
|
|
34
|
+
const number = Number(text);
|
|
26
35
|
if (!Number.isFinite(number)) throw new Error(`${label} must be finite`);
|
|
27
36
|
return number;
|
|
28
37
|
}
|
|
29
38
|
|
|
30
39
|
export function calculateBond(draft: BondDraft, curve: readonly TreasuryBenchmarkPoint[] = []) {
|
|
31
40
|
if (!["yield", "price"].includes(draft.mode)) throw new Error("Select price or yield input");
|
|
32
|
-
const terms: BondTerms = { settlement: draft.settlement, maturity: draft.maturity, couponPercent: inputNumber(draft.coupon, "Coupon"),
|
|
41
|
+
const terms: BondTerms = { settlement: draft.settlement, maturity: draft.maturity, couponPercent: inputNumber(draft.coupon, "Coupon", true),
|
|
33
42
|
frequency: Number(draft.frequency) as BondTerms["frequency"], dayCount: draft.dayCount as BondTerms["dayCount"], endOfMonth: draft.endOfMonth };
|
|
34
|
-
const quote =
|
|
43
|
+
const quote = draft.mode === "yield" ? inputNumber(draft.quote, "Yield", true) : inputNumber(draft.quote, "Clean price");
|
|
35
44
|
const yieldPercent = draft.mode === "yield" ? quote : solveBondYield(terms, quote);
|
|
36
45
|
const analytics = priceBond(terms, yieldPercent);
|
|
37
46
|
const spread = treasurySpread(terms, yieldPercent, curve);
|
|
@@ -122,7 +122,7 @@ export function BondCalculatorPane({ focused, width, height }: PaneProps) {
|
|
|
122
122
|
[{ label: "Clean price", value: fixed(result.analytics.cleanPrice) }, { label: "Yield", value: `${fixed(result.analytics.yieldPercent)}%` }],
|
|
123
123
|
[{ label: "Dirty price", value: fixed(result.analytics.dirtyPrice) }, { label: "Accrued", value: fixed(result.analytics.accruedInterest) }],
|
|
124
124
|
[{ label: "Macaulay", value: `${fixed(result.analytics.macaulayDuration)} yr` }, { label: "Modified", value: `${fixed(result.analytics.modifiedDuration)} yr` }],
|
|
125
|
-
[{ label: "Convexity", value: `${fixed(result.analytics.convexity)} yr²` }, { label: "DV01
|
|
125
|
+
[{ label: "Convexity", value: `${fixed(result.analytics.convexity)} yr²` }, { label: "DV01", value: `${fixed(result.analytics.dv01, 6)} per 100 face` }],
|
|
126
126
|
] : [];
|
|
127
127
|
return <Box flexDirection="column" width={width} height={height}>
|
|
128
128
|
{tabStrip}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { TextAttributes } from "../../../ui";
|
|
2
|
-
import {
|
|
2
|
+
import type { DataTableCell } from "../../../components";
|
|
3
3
|
import { colors } from "../../../theme/colors";
|
|
4
4
|
import { formatRelativeTime } from "../../../utils/datetime-format";
|
|
5
5
|
import {
|
|
6
|
-
CompanyCell,
|
|
7
6
|
FavoriteCell,
|
|
7
|
+
ListingBadges,
|
|
8
8
|
} from "./detail";
|
|
9
|
+
import type { DatasetTicker } from "./detail/ui";
|
|
9
10
|
import type { BuildoutColumn, BuildoutRow } from "./model/types";
|
|
10
11
|
import {
|
|
11
12
|
activityColor,
|
|
@@ -26,6 +27,19 @@ function moneyCell(value: string | null | undefined, color: string): DataTableCe
|
|
|
26
27
|
return { text: moneyText(value), ...(amount == null ? {} : { value: amount }), color };
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
/**
|
|
31
|
+
* The dataset's tickers in one cell: a chip for each the app can open, bold
|
|
32
|
+
* plain text for one it cannot read, and the same for every row of the column.
|
|
33
|
+
*/
|
|
34
|
+
function tickerCell(tickers: readonly DatasetTicker[], width: number, selected: boolean): DataTableCell | null {
|
|
35
|
+
const symbols = tickers.flatMap((entry) => tickerSymbol(entry.ticker) ?? []);
|
|
36
|
+
if (symbols.length === 0) return null;
|
|
37
|
+
return {
|
|
38
|
+
text: symbols.join(" "),
|
|
39
|
+
content: <ListingBadges tickers={tickers} width={width} fallbackColor={selected ? colors.selectedText : colors.textBright} />,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
29
43
|
interface BuildoutCellContext {
|
|
30
44
|
favoriteBusyKey: string | null;
|
|
31
45
|
/** The row's last star did not take. */
|
|
@@ -78,17 +92,10 @@ export function renderBuildoutCell(
|
|
|
78
92
|
),
|
|
79
93
|
};
|
|
80
94
|
}
|
|
95
|
+
case "ticker":
|
|
96
|
+
return tickerCell([company], column.width, rowState.selected) ?? { text: "", value: null };
|
|
81
97
|
case "company":
|
|
82
|
-
return {
|
|
83
|
-
text: company.ticker ? `${company.ticker} ${company.name}` : company.name,
|
|
84
|
-
content: (
|
|
85
|
-
<CompanyCell
|
|
86
|
-
company={company}
|
|
87
|
-
width={column.width}
|
|
88
|
-
selected={rowState.selected}
|
|
89
|
-
/>
|
|
90
|
-
),
|
|
91
|
-
};
|
|
98
|
+
return { text: company.name, color: colors.text };
|
|
92
99
|
case "description":
|
|
93
100
|
return { text: text(company.description), color: colors.textDim };
|
|
94
101
|
case "sectorTech":
|
|
@@ -147,22 +154,9 @@ export function renderBuildoutCell(
|
|
|
147
154
|
return { text: site.name, color: colors.text };
|
|
148
155
|
case "type":
|
|
149
156
|
return { text: text(site.type), color: colors.textDim };
|
|
150
|
-
case "owner":
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return {
|
|
154
|
-
text: ownerTicker,
|
|
155
|
-
content: (
|
|
156
|
-
<TickerBadgeList
|
|
157
|
-
symbols={[ownerTicker]}
|
|
158
|
-
width={column.width}
|
|
159
|
-
fallbackColor={rowState.selected ? colors.selectedText : colors.textBright}
|
|
160
|
-
/>
|
|
161
|
-
),
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
return { text: text(site.ownerName), color: colors.textDim };
|
|
165
|
-
}
|
|
157
|
+
case "owner":
|
|
158
|
+
return tickerCell([{ ticker: site.ownerTicker }], column.width, rowState.selected)
|
|
159
|
+
?? { text: text(site.ownerName), color: colors.textDim };
|
|
166
160
|
case "location":
|
|
167
161
|
return { text: text(location), color: colors.textDim };
|
|
168
162
|
case "park":
|
|
@@ -185,23 +179,9 @@ export function renderBuildoutCell(
|
|
|
185
179
|
switch (column.id) {
|
|
186
180
|
case "time":
|
|
187
181
|
return { text: formatRelativeTime(update.publishedAt), color: colors.textDim };
|
|
188
|
-
case "companies":
|
|
189
|
-
|
|
190
|
-
.map((company) =>
|
|
191
|
-
.filter((symbol): symbol is string => symbol != null);
|
|
192
|
-
return symbols.length > 0
|
|
193
|
-
? {
|
|
194
|
-
text: symbols.join(" "),
|
|
195
|
-
content: (
|
|
196
|
-
<TickerBadgeList
|
|
197
|
-
symbols={symbols}
|
|
198
|
-
width={column.width}
|
|
199
|
-
fallbackColor={rowState.selected ? colors.selectedText : colors.textBright}
|
|
200
|
-
/>
|
|
201
|
-
),
|
|
202
|
-
}
|
|
203
|
-
: { text: text(update.companies?.map((company) => company.name).filter(Boolean).join(", ")), color: colors.textDim };
|
|
204
|
-
}
|
|
182
|
+
case "companies":
|
|
183
|
+
return tickerCell(update.companies ?? [], column.width, rowState.selected)
|
|
184
|
+
?? { text: text(update.companies?.map((company) => company.name).filter(Boolean).join(", ")), color: colors.textDim };
|
|
205
185
|
case "headline":
|
|
206
186
|
return { text: update.headline, color: colors.text };
|
|
207
187
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Section
|
|
1
|
+
import { Section } from "../../../../components";
|
|
2
2
|
import { ClippedText } from "../../../../components/ui/display";
|
|
3
3
|
import { formatMarketPriceWithCurrency, liveQuoteFormatOptions } from "../../../../market-data/market/format";
|
|
4
4
|
import { useInlineTickerQuote } from "../../../../state/hooks/inline-tickers";
|
|
@@ -11,7 +11,7 @@ import { formatCompact } from "../../../../utils/format";
|
|
|
11
11
|
import { truncateWithEllipsis } from "../../../../utils/text-wrap";
|
|
12
12
|
import { activityLabel, criticalityColor, dateShort, metricColor, metricNumber, textOrNull, tickerSymbol } from "../format";
|
|
13
13
|
import type { BuildoutCompany } from "../model/types";
|
|
14
|
-
import { DetailListLine, DetailSpecGrid, MarkdownBlock, RelatedCompaniesLine, type DetailSpec, type InlineTickerCatalog } from "./ui";
|
|
14
|
+
import { DetailListLine, DetailSpecGrid, ListingBadges, MarkdownBlock, RelatedCompaniesLine, type DetailSpec, type InlineTickerCatalog } from "./ui";
|
|
15
15
|
import { dateCell, detailListValues, recommendationColor, valueWithOriginal } from "./values";
|
|
16
16
|
import { regularSessionValuationPrice } from "../../../../market-data/quotes/regular-session-valuation";
|
|
17
17
|
|
|
@@ -116,7 +116,7 @@ export function CompanyDetail({
|
|
|
116
116
|
<>
|
|
117
117
|
{company.ticker ? (
|
|
118
118
|
<Box flexDirection="row" height={1}>
|
|
119
|
-
<
|
|
119
|
+
<ListingBadges tickers={[company]} width={Math.min(bodyWidth, 16)} />
|
|
120
120
|
</Box>
|
|
121
121
|
) : null}
|
|
122
122
|
<CompanyOverviewGrid
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Badge
|
|
1
|
+
import { Badge } from "../../../../components";
|
|
2
2
|
import { RemoteImage } from "../../../../components/ui";
|
|
3
3
|
import { colors } from "../../../../theme/colors";
|
|
4
4
|
import { Box, Text } from "../../../../ui";
|
|
5
|
-
import { dateDetail, intelSourceDomains
|
|
5
|
+
import { dateDetail, intelSourceDomains } from "../format";
|
|
6
6
|
import type { BuildoutRow } from "../model/types";
|
|
7
|
-
import { InlineSources, MarkdownBlock, type InlineTickerCatalog } from "./ui";
|
|
7
|
+
import { InlineSources, ListingBadges, MarkdownBlock, type InlineTickerCatalog } from "./ui";
|
|
8
8
|
|
|
9
9
|
type BuildoutIntel = Extract<BuildoutRow, { kind: "intel" }>["item"];
|
|
10
10
|
|
|
@@ -29,10 +29,7 @@ export function IntelDetail({
|
|
|
29
29
|
</Box>
|
|
30
30
|
{(item.companies?.length ?? 0) > 0 && (
|
|
31
31
|
<Box marginTop={1} height={1}>
|
|
32
|
-
<
|
|
33
|
-
symbols={item.companies!.map((company) => tickerSymbol(company.ticker) ?? "")}
|
|
34
|
-
width={Math.min(bodyWidth, 56)}
|
|
35
|
-
/>
|
|
32
|
+
<ListingBadges tickers={item.companies!} width={Math.min(bodyWidth, 56)} />
|
|
36
33
|
</Box>
|
|
37
34
|
)}
|
|
38
35
|
{item.imageUrl ? (
|