@gloom-sh/terminal 0.20.11 → 0.20.12
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 +2 -1
- package/src/api-client/awards.ts +16 -0
- package/src/api-client/central-bank-rates.ts +5 -0
- package/src/api-client/data.ts +55 -2
- package/src/api-client/index.ts +18 -1
- package/src/api-client/request.ts +86 -3
- package/src/api-client/socket-connection.ts +12 -1
- package/src/api-client/socket.ts +21 -3
- package/src/api-client/supply-chain-graph.ts +4 -2
- package/src/api-client/supply-chain.ts +8 -0
- package/src/api-client/types/econ.ts +10 -7
- package/src/api-client/types/filings-and-calls.ts +8 -0
- package/src/app/global-shortcuts.ts +2 -1
- package/src/app/keybindings/actions.ts +19 -0
- package/src/app/pane-runtime/index.tsx +18 -3
- package/src/app/pane-runtime/layout-placement.ts +63 -0
- package/src/app/pane-runtime/ticker-open-runtime.ts +10 -2
- package/src/capabilities/chart-series.ts +4 -1
- package/src/cli/board-coins.ts +10 -1
- package/src/cli/commands/crypto-hints.ts +3 -2
- package/src/cli/commands/fred-series.ts +0 -54
- package/src/cli/commands/market.ts +209 -31
- package/src/cli/commands/overview.ts +47 -14
- package/src/cli/commands/search.ts +37 -8
- package/src/cli/commands/ticker.ts +15 -4
- package/src/cli/desktop-pane-shot.ts +27 -2
- package/src/cli/fx-quote-rate.ts +1 -1
- package/src/cli/glossary.ts +14 -5
- package/src/cli/history-catalog-series.ts +85 -0
- package/src/cli/index.ts +1 -1
- package/src/cli/list-progress.ts +45 -0
- package/src/cli/listing-arg.ts +71 -7
- package/src/cli/name-entries.ts +8 -4
- package/src/cli/not-a-ticker.ts +2 -2
- package/src/cli/pane-functions/freshness.ts +50 -3
- package/src/cli/pane-functions/index.ts +7 -4
- package/src/cli/pane-functions/market-session.ts +66 -14
- package/src/cli/pane-functions/options.ts +5 -0
- package/src/cli/pane-functions/resolver.ts +9 -2
- package/src/cli/pane-functions/screenshot-assessment.ts +28 -3
- package/src/cli/pane-functions/screenshot-types.ts +6 -0
- package/src/cli/quote-answer.ts +49 -10
- package/src/cli/quote-list-reads.ts +87 -0
- package/src/cli/report-tables.ts +70 -13
- package/src/cli/result.ts +24 -2
- package/src/cli/symbol-list.ts +31 -4
- package/src/cli/terminal-code-hints.ts +83 -0
- package/src/cli/ticker-resolution.ts +2 -1
- package/src/cli/treasury-yields.ts +5 -0
- package/src/components/command-bar/action-runtime.ts +2 -0
- package/src/components/command-bar/routing/launch-request.ts +2 -1
- package/src/components/command-bar/routing/navigation-state.ts +4 -2
- package/src/components/command-bar/workflow/types.ts +6 -0
- package/src/components/layout/detached-pane-shell.tsx +3 -0
- package/src/components/layout/double-escape-close.ts +34 -3
- package/src/components/layout/floating-pane.tsx +10 -4
- package/src/components/layout/pane/cycle-order.ts +66 -2
- package/src/components/layout/pane/header.tsx +140 -31
- package/src/components/layout/pane/sidebar.tsx +13 -5
- package/src/components/layout/pane/status-footer.ts +3 -1
- package/src/components/layout/shell/drag/runtime.ts +5 -0
- package/src/components/layout/shell/index.tsx +25 -0
- package/src/components/layout/shell/menu.ts +9 -0
- package/src/components/layout/shell/pane/actions.ts +36 -0
- package/src/components/layout/shell/pane/management-shortcuts.ts +27 -3
- package/src/components/layout/shell/pane-occlusion.ts +40 -0
- package/src/components/layout/shell/shortcuts.ts +17 -1
- package/src/components/layout/shell/terminal-pointer-runtime.ts +39 -6
- package/src/components/layout/shell/window-mode/index.ts +5 -16
- package/src/components/layout/shell/window-mode/overlays.tsx +3 -1
- package/src/components/market-board/index.tsx +14 -5
- package/src/components/metric-treemap/index.tsx +3 -1
- package/src/components/ui/button.tsx +48 -4
- package/src/components/ui/data-table/opentui/index.tsx +24 -9
- package/src/components/ui/data-table/types.ts +7 -0
- package/src/components/ui/inline-quick-add.tsx +19 -3
- package/src/components/ui/list-view.tsx +11 -5
- package/src/components/ui/query-bar.tsx +16 -1
- package/src/components/ui/selection-fill.ts +39 -0
- package/src/core/state/app/layout-reducer.ts +2 -1
- package/src/core/state/app/pane-choices.ts +68 -0
- package/src/core/state/app/state.ts +14 -6
- package/src/core/state/app/types.ts +8 -0
- package/src/layout/pane-manager/dock-tree.ts +19 -0
- package/src/layout/pane-manager/index.ts +3 -0
- package/src/market-data/market/freshness.ts +33 -0
- package/src/market-data/market/status.ts +5 -1
- package/src/market-data/quotes/contributions.ts +10 -0
- package/src/market-data/quotes/freshness.ts +19 -0
- package/src/market-data/quotes/live-valuation.ts +31 -4
- package/src/market-data/quotes/resolution.ts +4 -0
- package/src/market-data/quotes/time.ts +0 -14
- package/src/plugins/builtin/account-management/index.tsx +1 -0
- package/src/plugins/builtin/awards/detail.tsx +12 -4
- package/src/plugins/builtin/awards/headless.ts +29 -8
- package/src/plugins/builtin/awards/model.ts +36 -2
- package/src/plugins/builtin/awards/pane.tsx +7 -4
- package/src/plugins/builtin/broker-manager/index.tsx +1 -0
- package/src/plugins/builtin/broker-trading/index.tsx +1 -1
- package/src/plugins/builtin/central-bank-rates/headless.ts +6 -6
- package/src/plugins/builtin/central-bank-rates/index.tsx +1 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +21 -3
- package/src/plugins/builtin/central-bank-rates/pane.tsx +15 -5
- package/src/plugins/builtin/chart-composer/headless.ts +5 -1
- package/src/plugins/builtin/chart-composer/pane.tsx +1 -0
- package/src/plugins/builtin/chat/content/handle-prompt.tsx +4 -0
- package/src/plugins/builtin/chat/controller/realtime.ts +17 -1
- package/src/plugins/builtin/chat/message/terminal.tsx +4 -1
- package/src/plugins/builtin/chat/sidebar.tsx +3 -4
- package/src/plugins/builtin/cloud/askg/pane.tsx +4 -0
- package/src/plugins/builtin/cloud/plugin.tsx +1 -0
- package/src/plugins/builtin/cloud/team/module.tsx +1 -0
- package/src/plugins/builtin/cloud/thesis/detail.tsx +9 -4
- package/src/plugins/builtin/commodity-balances/pane.tsx +13 -5
- package/src/plugins/builtin/company-kpis/model.ts +3 -3
- package/src/plugins/builtin/connections/index.ts +1 -0
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +9 -5
- package/src/plugins/builtin/credit-boards/client.ts +5 -0
- package/src/plugins/builtin/credit-boards/headless.ts +1 -6
- package/src/plugins/builtin/credit-boards/model.ts +0 -6
- package/src/plugins/builtin/credit-boards/series.ts +19 -8
- package/src/plugins/builtin/credit-boards/sovr-pane.tsx +9 -5
- package/src/plugins/builtin/crypto-etf-flows/headless.ts +23 -13
- package/src/plugins/builtin/crypto-etf-flows/pane.tsx +8 -3
- package/src/plugins/builtin/debt-maturities/headless.ts +16 -7
- package/src/plugins/builtin/debt-maturities/model.ts +9 -15
- package/src/plugins/builtin/debt-maturities/pane.tsx +9 -10
- package/src/plugins/builtin/earnings/board-model.ts +33 -4
- package/src/plugins/builtin/earnings/board.tsx +15 -3
- package/src/plugins/builtin/earnings/calendar.tsx +10 -6
- package/src/plugins/builtin/earnings/client.ts +0 -9
- package/src/plugins/builtin/earnings/headless.ts +10 -7
- package/src/plugins/builtin/earnings/history.tsx +21 -14
- package/src/plugins/builtin/earnings-calls/data.ts +24 -4
- package/src/plugins/builtin/earnings-calls/format.ts +23 -5
- package/src/plugins/builtin/earnings-calls/headless.ts +23 -3
- package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
- package/src/plugins/builtin/earnings-calls/model.ts +11 -1
- package/src/plugins/builtin/earnings-calls/pane.tsx +2 -5
- package/src/plugins/builtin/econ/calendar-model.ts +27 -0
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -0
- package/src/plugins/builtin/econ/index.tsx +9 -2
- package/src/plugins/builtin/econ-statistics/headless.ts +3 -1
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -1
- package/src/plugins/builtin/fear-greed/headless.ts +16 -13
- package/src/plugins/builtin/fear-greed/pane.tsx +12 -4
- package/src/plugins/builtin/filing-events/index.tsx +1 -0
- package/src/plugins/builtin/fx-matrix/index.tsx +30 -19
- package/src/plugins/builtin/insider/table.tsx +10 -7
- package/src/plugins/builtin/insider/tickers.tsx +1 -1
- package/src/plugins/builtin/iv-history/headless.ts +9 -8
- package/src/plugins/builtin/jobs/index.tsx +1 -0
- package/src/plugins/builtin/macro-day/headless.ts +3 -3
- package/src/plugins/builtin/macro-day/model.ts +1 -1
- package/src/plugins/builtin/macro-day/releases.ts +25 -16
- package/src/plugins/builtin/market-movers/index.tsx +20 -8
- package/src/plugins/builtin/market-movers/model.ts +5 -0
- package/src/plugins/builtin/market-movers/session-body.tsx +2 -1
- package/src/plugins/builtin/money-markets/headless.ts +12 -2
- package/src/plugins/builtin/money-markets/pane.tsx +10 -1
- package/src/plugins/builtin/options/view.tsx +1 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -31
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +6 -1
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +22 -8
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +6 -8
- package/src/plugins/builtin/portfolio-list/table.tsx +10 -1
- package/src/plugins/builtin/realized-vol/headless.ts +28 -2
- package/src/plugins/builtin/risk-factors/index.tsx +1 -0
- package/src/plugins/builtin/shared/source-footer.ts +70 -0
- package/src/plugins/builtin/short-interest/publications-pane.tsx +5 -1
- package/src/plugins/builtin/short-volume/pane.tsx +5 -1
- package/src/plugins/builtin/social-mentions/outliers.tsx +10 -1
- package/src/plugins/builtin/social-mentions/pane.tsx +7 -0
- package/src/plugins/builtin/supply-chain/client.ts +3 -1
- package/src/plugins/builtin/supply-chain/flow.tsx +25 -8
- package/src/plugins/builtin/supply-chain/graph-client.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-evidence.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-model.ts +12 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +9 -8
- package/src/plugins/builtin/supply-chain/graph.tsx +12 -6
- package/src/plugins/builtin/supply-chain/headless.ts +13 -7
- package/src/plugins/builtin/supply-chain/model.ts +68 -11
- package/src/plugins/builtin/supply-chain/pane.tsx +9 -6
- package/src/plugins/builtin/supply-chain/row-evidence.tsx +5 -5
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +14 -1
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +2 -0
- package/src/plugins/builtin/ticker-detail/pane.tsx +48 -24
- package/src/plugins/builtin/ticker-detail/quote-footer.ts +5 -0
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +6 -3
- package/src/plugins/builtin/treasury-auctions/after.ts +50 -23
- package/src/plugins/builtin/treasury-auctions/cache.ts +23 -5
- package/src/plugins/builtin/treasury-auctions/headless.ts +226 -37
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +11 -5
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +27 -25
- package/src/plugins/builtin/treasury-auctions/hk.ts +60 -8
- package/src/plugins/builtin/treasury-auctions/index.tsx +3 -0
- package/src/plugins/builtin/treasury-auctions/keys.ts +27 -0
- package/src/plugins/builtin/treasury-auctions/like.ts +137 -0
- package/src/plugins/builtin/treasury-auctions/model.ts +100 -22
- package/src/plugins/builtin/treasury-auctions/pane.tsx +39 -11
- package/src/plugins/builtin/vol-surface/heat-grid.tsx +4 -2
- package/src/plugins/builtin/vol-surface/pane.tsx +5 -2
- package/src/plugins/runtime/index.tsx +1 -0
- package/src/plugins/runtime/state.ts +20 -0
- package/src/portfolio/column-values.ts +8 -2
- package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
- package/src/public/react.ts +7 -0
- package/src/react/auto-refresh.ts +29 -0
- package/src/renderers/browser/deeplink-bridge.ts +24 -3
- package/src/renderers/dom/desktop/query-bar.tsx +229 -60
- package/src/renderers/dom/host/overflow-fade-px.ts +2 -0
- package/src/renderers/dom/host/overflow-fade.ts +1 -2
- package/src/renderers/dom/styles.css +25 -5
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -1
- package/src/series/types.ts +2 -0
- package/src/sources/gloomberb-cloud/fred-attribution.ts +86 -0
- package/src/sources/gloomberb-cloud/index.ts +25 -1
- package/src/sources/gloomberb-cloud/normalizers.ts +22 -3
- package/src/sources/provider-errors.ts +64 -1
- package/src/sources/provider-router/batches.ts +19 -0
- package/src/sources/provider-router/index.ts +7 -1
- package/src/state/app/context/index.tsx +24 -1
- package/src/state/pane-unsent-work.ts +47 -0
- package/src/test-support/shell-pane-keys.tsx +5 -0
- package/src/test-support/telemetry-guard.ts +83 -0
- package/src/test-support/test-env.ts +12 -0
- package/src/theme/colors.ts +17 -1
- package/src/theme/ui-tokens.ts +50 -1
- package/src/tickers/listing-venues.ts +11 -1
- package/src/tickers/search/japanese-names.json +1 -0
- package/src/tickers/search/japanese-names.ts +152 -0
- package/src/tickers/terminal-codes.ts +55 -6
- package/src/time-series/base-series.ts +3 -0
- package/src/types/data-provider.ts +6 -0
- package/src/types/financials.ts +11 -0
- package/src/types/plugin-contributions.ts +7 -0
- package/src/types/plugin-panes.ts +7 -0
- package/src/ui/host.tsx +6 -0
- package/src/utils/double-escape-close.ts +42 -0
- package/src/utils/fx-status.ts +30 -7
- package/src/utils/network-failure.ts +23 -0
|
@@ -10,9 +10,10 @@ import { cardSurfaceStyle } from "../../../components/ui/card";
|
|
|
10
10
|
import { TOOLTIP_SURFACE_STYLE } from "../../../components/ui/frame";
|
|
11
11
|
import { blendHex } from "../../../theme/colors";
|
|
12
12
|
import { useThemeColors } from "../../../theme/theme-context";
|
|
13
|
+
import { useSelectionFill } from "../../../components/ui/selection-fill";
|
|
13
14
|
import { useStaticChartBitmapSize } from "../../../components/chart/composite/bitmap";
|
|
14
15
|
import { fillOpaque, fillRect, parseHex } from "../../../components/chart/native/raster/primitives";
|
|
15
|
-
import { counterpartyKind, counterpartyLabel, disclosedValue, dollars, nativeValue, periodText, roleLabel, ROLE_COLORS, scopeWords, shareParts, fitShareBasis, type FlowBand, type ShareParts } from "./model";
|
|
16
|
+
import { counterpartyKind, counterpartyKindLabel, counterpartyLabel, disclosedValue, dollars, isRelatedParty, nativeValue, periodText, relationshipLabel, roleLabel, ROLE_COLORS, scopeWords, shareParts, fitShareBasis, type FlowBand, type ShareParts } from "./model";
|
|
16
17
|
import { entityTicker } from "./graph-model";
|
|
17
18
|
import { flowChipLabel, flowGeometry, RELATED_LABEL_CELLS, ribbonY, type FlowRibbon, type PositionedNode } from "./flow-layout";
|
|
18
19
|
import { evidenceDate, evidenceLabel, trustTier } from "./trust";
|
|
@@ -35,8 +36,21 @@ function shareText(share: ShareParts, cells: number): string {
|
|
|
35
36
|
return `${share.value} ${fitShareBasis(share, cells - displayWidth(share.value) - 1)}`;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* The line a card shows under the name, in `cells` cells: a related party
|
|
41
|
+
* says so first ("related group · 9,515,093.66 CNY"), on the card itself and
|
|
42
|
+
* not only in its tooltip, then the disclosed figure. A card too narrow for
|
|
43
|
+
* both whole says "related ·" so the figure keeps its digits.
|
|
44
|
+
*/
|
|
39
45
|
function nodeMetric(node: PositionedNode, focusId: string | undefined, cells: number): string {
|
|
46
|
+
const row = node.row!;
|
|
47
|
+
if (!isRelatedParty(row)) return nodeFigure(node, focusId, cells);
|
|
48
|
+
const lines = [`${counterpartyKindLabel(row, true)} · `, "related · "].map((label) => `${label}${nodeFigure(node, focusId, cells - displayWidth(label))}`);
|
|
49
|
+
return lines.find((line) => displayWidth(line) <= cells) ?? lines.at(-1)!;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The disclosed figure a card shows under the name, in the reporting company's own terms, in `cells` cells. */
|
|
53
|
+
function nodeFigure(node: PositionedNode, focusId: string | undefined, cells: number): string {
|
|
40
54
|
const row = node.row!;
|
|
41
55
|
if (trustTier(row) !== 1) return `${evidenceLabel(row)} · ${evidenceDate(row)}`;
|
|
42
56
|
if (node.weight !== null && node.weightBasis === "usd") return dollars(row);
|
|
@@ -248,7 +262,7 @@ export function SupplyFlow({ rows, symbol, focusName, focusId, width, height, fo
|
|
|
248
262
|
function flowNodeName(node: PositionedNode): string {
|
|
249
263
|
if (node.more) return `Show ${node.more} more ${node.role ? ROLE_PLURAL[node.role].toLowerCase() : node.band}`;
|
|
250
264
|
const name = node.row ? counterpartyLabel(node.row) : node.label;
|
|
251
|
-
const role = node.role ? roleLabel(node.role) : node.band;
|
|
265
|
+
const role = node.row ? relationshipLabel(node.row) : node.role ? roleLabel(node.role) : node.band;
|
|
252
266
|
return `Open ${name}, ${role}`;
|
|
253
267
|
}
|
|
254
268
|
|
|
@@ -297,6 +311,9 @@ function FlowCard({ node, focusId, desktop, active, onPress, onHover }: {
|
|
|
297
311
|
node: PositionedNode; focusId?: string; desktop: boolean; active: boolean; onPress: () => void; onHover: (on: boolean) => void;
|
|
298
312
|
}) {
|
|
299
313
|
const colors = useThemeColors();
|
|
314
|
+
// The chosen card is the flow's cursor: quieter while the pane does not have the keys.
|
|
315
|
+
const selectionFill = useSelectionFill();
|
|
316
|
+
const chosenText = (own: string) => (selectionFill.lit ? colors.selectedText : selectionFill.ink(own));
|
|
300
317
|
const role = node.role;
|
|
301
318
|
const accent = role ? ROLE_COLORS[role] : colors.textMuted;
|
|
302
319
|
const company = node.row ? counterpartyKind(node.row) === "company" : false;
|
|
@@ -307,7 +324,7 @@ function FlowCard({ node, focusId, desktop, active, onPress, onHover }: {
|
|
|
307
324
|
const nameWidth = Math.max(4, inner - (ticker ? displayWidth(ticker) + 1 : 0));
|
|
308
325
|
const titleColor = node.more ? colors.textDim : company ? colors.textBright : colors.text;
|
|
309
326
|
return <Box position="absolute" left={node.x} top={node.y} width={node.width} height={node.more ? 1 : node.height} flexDirection="column"
|
|
310
|
-
backgroundColor={desktop ? undefined : node.more ? undefined : active ?
|
|
327
|
+
backgroundColor={desktop ? undefined : node.more ? undefined : active ? selectionFill.bg : blendHex(colors.bg, accent, 0.12)}
|
|
311
328
|
// The card, in the relationship's colour; "+N more" is the same card without a fill, its rule dotted.
|
|
312
329
|
style={desktop ? { ...cardSurfaceStyle({ selected: active, accent, padding: "0 var(--gloom-space-sm)" }),
|
|
313
330
|
...(node.more ? { background: "transparent", borderLeftStyle: "dotted" } : {}), cursor: "pointer" } : undefined}
|
|
@@ -316,12 +333,12 @@ function FlowCard({ node, focusId, desktop, active, onPress, onHover }: {
|
|
|
316
333
|
{/* The ticker shows only beside the whole name. On the desktop that is CSS: the row wraps, one line shows, and a ticker that does not fit goes to the hidden line. */}
|
|
317
334
|
<Box flexDirection="row" height={1} overflow="hidden" style={desktop ? { flexWrap: "wrap" } : undefined}>
|
|
318
335
|
{!desktop ? <Text fg={node.more ? colors.textMuted : accent}>▍</Text> : null}
|
|
319
|
-
<ClippedText fg={active && !desktop ?
|
|
336
|
+
<ClippedText fg={active && !desktop ? chosenText(titleColor) : titleColor} attributes={company ? TextAttributes.BOLD : 0} text={name} width={nameWidth} />
|
|
320
337
|
{ticker && (desktop || displayWidth(name) + displayWidth(ticker) + 1 <= inner)
|
|
321
|
-
? <Text fg={colors.textDim} style={desktop ? { flex: "0 0 auto" } : undefined}>{` ${ticker}`}</Text> : null}
|
|
338
|
+
? <Text fg={active && !desktop ? selectionFill.ink(colors.textDim) : colors.textDim} style={desktop ? { flex: "0 0 auto" } : undefined}>{` ${ticker}`}</Text> : null}
|
|
322
339
|
</Box>
|
|
323
340
|
{metric ? <Box height={1} paddingLeft={desktop ? 0 : 1} overflow="hidden">
|
|
324
|
-
<ClippedText fg={active && !desktop ? colors.
|
|
341
|
+
<ClippedText fg={active && !desktop ? chosenText(colors.textDim) : colors.textDim} text={metric} width={inner - (desktop ? 0 : 1)} />
|
|
325
342
|
</Box> : null}
|
|
326
343
|
</Box>;
|
|
327
344
|
}
|
|
@@ -350,7 +367,7 @@ function FlowTooltip({ node, focusId, width, desktop, anchor }: { node: Position
|
|
|
350
367
|
const share = shareParts(row, focusId);
|
|
351
368
|
const lines = [
|
|
352
369
|
share ? `${share.value} ${share.basis}` : nativeValue(row) !== null || row.usd !== null ? disclosedValue(row) : "No figure disclosed",
|
|
353
|
-
`${
|
|
370
|
+
`${relationshipLabel(row)} · ${periodText(row)}`,
|
|
354
371
|
trustTier(row) === 1
|
|
355
372
|
? `${evidenceLabel(row)} · ${entityTicker(row.reportingEntity) ?? row.reportingEntity.name} ${row.form ?? "filing"}${row.filedDate ? ` filed ${row.filedDate}` : ""}`
|
|
356
373
|
: `${evidenceLabel(row)} · ${evidenceDate(row)}`,
|
|
@@ -39,7 +39,7 @@ export function validateGraph(data: GraphPayload): GraphPayload {
|
|
|
39
39
|
const link = links.get(key), a = entry.nodeIds[index], b = entry.nodeIds[index + 1];
|
|
40
40
|
if (!link || !(link.from === a && link.to === b || link.to === a && link.from === b)) throw 0;
|
|
41
41
|
});
|
|
42
|
-
if (entry.exposure && (entry.linkIds.some(id => graphEvidenceRow(links.get(id)!.evidence.find(item => item.id === links.get(id)!.primaryEvidenceId)!).tier !== 1) || entry.exposure.estimated !==
|
|
42
|
+
if (entry.exposure && (entry.linkIds.some(id => graphEvidenceRow(links.get(id)!.evidence.find(item => item.id === links.get(id)!.primaryEvidenceId)!).tier !== 1) || entry.exposure.estimated !== entry.hops > 1 || !Number.isFinite(entry.exposure.pct) || entry.exposure.pct < 0 || entry.exposure.pct > 100
|
|
43
43
|
|| !entry.nodeIds.includes(entry.exposure.denominatorEntityId) || !["revenue", "receivables", "cost", "purchases"].includes(entry.exposure.basis) || !validPeriodMonths(entry.exposure.periodMonths))) throw 0;
|
|
44
44
|
};
|
|
45
45
|
data.paths.forEach(path);
|
|
@@ -12,7 +12,7 @@ export function graphEvidenceRow(evidence: GraphEvidence): SupplyRow {
|
|
|
12
12
|
pctOfRevenue: evidence.pctOfRevenue ?? null, pctBasis: evidence.pctBasis ?? null, pctScope: evidence.pctScope ?? null,
|
|
13
13
|
usd: evidence.usd ?? null, usdBasis: evidence.usdBasis ?? null,
|
|
14
14
|
nativeAmount: evidence.nativeAmount ?? null, nativeCurrency: evidence.nativeCurrency ?? null, nativeScale: evidence.nativeScale ?? null,
|
|
15
|
-
jurisdiction: evidence.jurisdiction, entityScope: evidence.entityScope,
|
|
15
|
+
jurisdiction: evidence.jurisdiction, entityScope: evidence.entityScope, ...(evidence.relatedParty ? { relatedParty: true } : {}),
|
|
16
16
|
confidence: evidence.confidence, quote: evidence.quote, quoteLanguage: evidence.quoteLanguage ?? null,
|
|
17
17
|
quoteGloss: evidence.quoteGloss, sectionRef: evidence.sectionRef, sourceAttribution: evidence.sourceAttribution,
|
|
18
18
|
quoteMatchMode: evidence.quoteMatchMode ?? null, filingUrl: evidence.filingUrl, accession: evidence.accession ?? null,
|
|
@@ -12,6 +12,13 @@ export const entityKey = (entity: SupplyEntity) => entity.ticker ? publicTickerK
|
|
|
12
12
|
export const entityTicker = (entity: Pick<SupplyEntity, "ticker" | "exchange">) =>
|
|
13
13
|
entity.ticker && entity.exchange && !isUsListingExchange(entity.exchange) ? getListingSymbol(entity.ticker, entity.exchange) : entity.ticker;
|
|
14
14
|
export const entityLabel = (entity: SupplyEntity) => entityTicker(entity) ?? entity.name;
|
|
15
|
+
/**
|
|
16
|
+
* A trade link whose every disclosure is a related-party (connected) trade,
|
|
17
|
+
* as the server labels a table row: the graph names it one rather than a
|
|
18
|
+
* plain supplier or customer.
|
|
19
|
+
*/
|
|
20
|
+
export const relatedPartyLink = (link: Pick<GraphPayload["links"][number], "relationship" | "evidence">) =>
|
|
21
|
+
link.relationship === "commerce" && link.evidence.length > 0 && link.evidence.every(item => item.relatedParty === true);
|
|
15
22
|
/**
|
|
16
23
|
* A route in the direction goods move: a supplier's route ends at the focus
|
|
17
24
|
* company ("WPM → NEM" for a streamer buying from a miner), a customer's
|
|
@@ -22,11 +29,15 @@ export function pathLabel(path: GraphPath, data: GraphPayload) {
|
|
|
22
29
|
const labels = path.nodeIds.map(id => nodes.get(id) ? entityLabel(nodes.get(id)!) : id);
|
|
23
30
|
return (path.id.startsWith("upstream|") ? labels.reverse() : labels).join(" → ");
|
|
24
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* "6% est. of A revenue" for a product of shares along a route; one hop's
|
|
34
|
+
* share is the one its report files, "4.5% of A revenue", never an estimate.
|
|
35
|
+
*/
|
|
25
36
|
export function exposureLabel(path: GraphPath, data: GraphPayload) {
|
|
26
37
|
const exposure = path.exposure;
|
|
27
38
|
if (!exposure) return "--";
|
|
28
39
|
const denominator = data.nodes.find(node => node.id === exposure.denominatorEntityId);
|
|
29
|
-
return `${Number(exposure.pct.toPrecision(4))}
|
|
40
|
+
return `${Number(exposure.pct.toPrecision(4))}%${exposure.estimated ? " est." : ""} of ${denominator ? entityLabel(denominator) : exposure.denominatorEntityId} ${exposure.basis}`;
|
|
30
41
|
}
|
|
31
42
|
export interface GraphNode { entity: SupplyEntity; column: number; hops: number; path: GraphPath | null; related: boolean; }
|
|
32
43
|
/** A selected path has priority over other positions so every highlighted hop remains connected. */
|
|
@@ -15,10 +15,10 @@ import { useOpenDescription } from "../shared/open-description";
|
|
|
15
15
|
import { UpgradeLabel } from "../shared/locked-rows";
|
|
16
16
|
import { isCloudSessionRequired, useResearchCloudSession } from "../shared/research-cloud-session";
|
|
17
17
|
import { cachedGraph, graphOptions, loadGraph, validateGraph } from "./graph-client";
|
|
18
|
-
import { entityKey, entityLabel, entityTicker, exposureLabel, pathLabel } from "./graph-model";
|
|
18
|
+
import { entityKey, entityLabel, entityTicker, exposureLabel, pathLabel, relatedPartyLink } from "./graph-model";
|
|
19
19
|
import { SupplyGraph } from "./graph";
|
|
20
20
|
import { graphEvidenceRow } from "./graph-evidence";
|
|
21
|
-
import { disclosedValue, dollars, nativeValue, periodText, ROLE_COLORS, roleLabel, shareParts } from "./model";
|
|
21
|
+
import { disclosedValue, dollars, nativeValue, periodText, relationshipLabel, ROLE_COLORS, roleLabel, shareParts } from "./model";
|
|
22
22
|
import { SupplySources, SupplyVerification } from "./row-evidence";
|
|
23
23
|
import { evidenceDate, evidenceLabel, isUnconfirmed, trustTier } from "./trust";
|
|
24
24
|
import { scrollByLines } from "../../../state/pane-scroll-registry";
|
|
@@ -28,7 +28,7 @@ import { displayWidth } from "../../../utils/format";
|
|
|
28
28
|
import { useRemoteUiNode } from "../../../remote/semantic-tree";
|
|
29
29
|
import { logFailure } from "../../../utils/log-failure";
|
|
30
30
|
|
|
31
|
-
const PATH_COLUMNS: DataTableColumn[] = [{ id: "route", label: "Route", width: 40, align: "left" }, { id: "relationships", label: "Relationships", width: 22, align: "left" }, { id: "hops", label: "Hops", width: 6, align: "right" }, { id: "score", label: "Score", width: 9, align: "right" }, { id: "confidence", label: "Confidence", width: 12, align: "right" }, { id: "exposure", label: "
|
|
31
|
+
const PATH_COLUMNS: DataTableColumn[] = [{ id: "route", label: "Route", width: 40, align: "left" }, { id: "relationships", label: "Relationships", width: 22, align: "left" }, { id: "hops", label: "Hops", width: 6, align: "right" }, { id: "score", label: "Score", width: 9, align: "right" }, { id: "confidence", label: "Confidence", width: 12, align: "right" }, { id: "exposure", label: "Exposure", width: 35, align: "left" }];
|
|
32
32
|
const SOURCE_LABELS = { xbrl: "Structured filing", filing_text: "Filing text", press_release: "Company release", call: "Earnings call", news: "News", web: "Website", import: "Imported record" };
|
|
33
33
|
const TIER_LABELS = { structured: "Structured", primary: "Primary", secondary: "Secondary", imported: "Imported" };
|
|
34
34
|
|
|
@@ -68,7 +68,7 @@ function PathEvidence({ data, path, width, focused, onRecenter }: { data: GraphP
|
|
|
68
68
|
const figures: StatItem[] = [
|
|
69
69
|
{ id: "score", label: "Path score", value: path.score.toFixed(4) },
|
|
70
70
|
{ id: "confidence", label: "Confidence", value: `${Math.round(path.confidence * 100)}%` },
|
|
71
|
-
{ id: "exposure", label: "
|
|
71
|
+
{ id: "exposure", label: "Exposure", value: exposureLabel(path, data), detail: path.exposure ? periodText(path.exposure) : undefined, wide: true },
|
|
72
72
|
];
|
|
73
73
|
const company = (entity: SupplyEntity) => desktop && entity.ticker ? <Badge label={entityTicker(entity)!} tone="accent" />
|
|
74
74
|
: <Text fg={entity.aggregate || entity.anonymous ? colors.textDim : colors.textBright} attributes={TextAttributes.BOLD}>{entityLabel(entity)}</Text>;
|
|
@@ -89,7 +89,7 @@ function PathEvidence({ data, path, width, focused, onRecenter }: { data: GraphP
|
|
|
89
89
|
return <Box key={evidence.id} flexDirection="column" paddingBottom={1}>
|
|
90
90
|
<Box flexDirection="row" gap={1}><Badge tone={isUnconfirmed(row) ? "neutral" : "accent"} label={evidenceLabel(row)} />
|
|
91
91
|
{row.leadStatus === "verified" ? <Badge tone="positive" label="Verified" /> : null}</Box>
|
|
92
|
-
<KeyValueRow label="Disclosure" value={`${evidence.reporter.name} · ${
|
|
92
|
+
<KeyValueRow label="Disclosure" value={`${evidence.reporter.name} · ${relationshipLabel(row)}`} color={ROLE_COLORS[evidence.role]} labelWidth={20} />
|
|
93
93
|
<KeyValueRow label="Evidence class" value={`${TIER_LABELS[evidence.tier]} · ${SOURCE_LABELS[evidence.sourceKind]}`} detail={`${Math.round(evidence.confidence * 100)}% confidence`} labelWidth={20} />
|
|
94
94
|
<KeyValueRow label="Period" value={periodText(row)} detail={trustTier(row) === 1 ? `filed ${row.filedDate ?? "--"}` : `published ${evidenceDate(row)}`} labelWidth={20} />
|
|
95
95
|
{row.entityScope === "group" && !row.counterparty.aggregate ? <KeyValueRow label="Metric scope" value="Corporate group" labelWidth={20} /> : null}
|
|
@@ -201,11 +201,12 @@ export function SupplyGraphPane({ symbol, tab, width, height, focused }: { symbo
|
|
|
201
201
|
</Box> : undefined };
|
|
202
202
|
}
|
|
203
203
|
if (column.id === "relationships") {
|
|
204
|
-
|
|
205
|
-
const
|
|
204
|
+
// A related-party trade reads as one: its counterparty is the company's parent, group or a sister company.
|
|
205
|
+
const relationships = [...new Set(path.linkIds.map(id => { const link = data.links.find(entry => entry.id === id)!; return relatedPartyLink(link) ? "related" : link.relationship; }))];
|
|
206
|
+
const label = (relationship: typeof relationships[number]) => relationship === "commerce" ? "Trade" : relationship === "related" ? "Related-party trade" : roleLabel(relationship);
|
|
206
207
|
return { text: relationships.map(label).join(" / "), content: <Box flexDirection="row" height={1} gap={1} overflow="hidden">
|
|
207
208
|
{relationships.map(relationship => {
|
|
208
|
-
const color = relationship === "commerce" ? colors.textMuted : ROLE_COLORS[relationship];
|
|
209
|
+
const color = relationship === "commerce" || relationship === "related" ? colors.textMuted : ROLE_COLORS[relationship];
|
|
209
210
|
return <Box key={relationship} flexDirection="row" gap={1} flexShrink={0}>
|
|
210
211
|
{desktop ? <Box width={1} height={1} alignItems="center" justifyContent="center"><Box style={{ width: 6, height: 6, borderRadius: "50%", backgroundColor: color }} /></Box>
|
|
211
212
|
: <Text fg={color}>●</Text>}
|
|
@@ -5,6 +5,7 @@ import type { ChartVectorShape } from "../../../ui/host";
|
|
|
5
5
|
import type { GraphPath, GraphPayload } from "../../../api-client/supply-chain-graph";
|
|
6
6
|
import type { SupplyEntity, SupplyRole } from "../../../api-client/supply-chain";
|
|
7
7
|
import { useThemeColors } from "../../../theme/theme-context";
|
|
8
|
+
import { useSelectionFill } from "../../../components/ui/selection-fill";
|
|
8
9
|
import { useShortcut } from "../../../react/input";
|
|
9
10
|
import { useScrollBoxLayout } from "../../../components/use-scrollbox-layout";
|
|
10
11
|
import { isPlainKey } from "../../../utils/keyboard";
|
|
@@ -13,7 +14,7 @@ import { ClippedText } from "../../../components/ui/display";
|
|
|
13
14
|
import { cardSurfaceStyle } from "../../../components/ui/card";
|
|
14
15
|
import { useStaticChartBitmapSize } from "../../../components/chart/composite/bitmap";
|
|
15
16
|
import { drawLine, fillOpaque, parseHex } from "../../../components/chart/native/raster/primitives";
|
|
16
|
-
import { entityLabel, entityTicker, graphNodes } from "./graph-model";
|
|
17
|
+
import { entityLabel, entityTicker, graphNodes, relatedPartyLink } from "./graph-model";
|
|
17
18
|
import { ROLE_COLORS } from "./model";
|
|
18
19
|
import { blendHex } from "../../../theme/colors";
|
|
19
20
|
|
|
@@ -23,6 +24,9 @@ export function SupplyGraph({ data, width, height, focused, selectedId, selected
|
|
|
23
24
|
}) {
|
|
24
25
|
const scrollRef = useRef<ScrollBoxRenderable>(null);
|
|
25
26
|
const colors = useThemeColors(), desktop = !!useUiCapabilities().nativePaneChrome;
|
|
27
|
+
// The chosen card is the graph's cursor: quieter while the pane does not have the keys.
|
|
28
|
+
const selectionFill = useSelectionFill();
|
|
29
|
+
const chosenText = (own: string) => (selectionFill.lit ? colors.selectedText : selectionFill.ink(own));
|
|
26
30
|
const nodes = useMemo(() => graphNodes(data, collapsed, selectedPath), [data, collapsed, selectedPath]);
|
|
27
31
|
const [pages, setPages] = useState<Record<number, number>>({});
|
|
28
32
|
useEffect(() => setPages({}), [data]);
|
|
@@ -142,11 +146,13 @@ export function SupplyGraph({ data, width, height, focused, selectedId, selected
|
|
|
142
146
|
const prefix = collapsed.includes(node.entity.id) ? "+ " : "";
|
|
143
147
|
const name = prefix + (showTicker ? node.entity.name : entityLabel(node.entity));
|
|
144
148
|
const nameWidth = inner - (showTicker ? tickerWidth : 0);
|
|
145
|
-
|
|
149
|
+
// A related-party trade with the company before it on the path reads as one, never as a plain supplier or customer.
|
|
150
|
+
const link = node.path ? data.links.find(entry => entry.id === node.path!.linkIds.at(-1)) : undefined;
|
|
151
|
+
const relation = kind ?? (node.related ? `${node.hops > 1 ? "via " : ""}${role}` : link && relatedPartyLink(link) ? `related-party ${role}` : role);
|
|
146
152
|
const confidence = `${Math.round((node.path?.confidence ?? 0) * 100)}%`;
|
|
147
153
|
const detail = node.hops ? `${node.hops}H · ${relation}${inner >= displayWidth(relation ?? "") + 12 ? ` · ${confidence}` : ""}` : showTicker ? "Focus company" : node.entity.name;
|
|
148
154
|
return <Box key={node.entity.id} position="absolute" left={node.x} top={node.y} width={cellWidth - 3} height={2} zIndex={10} flexDirection="column" overflow="hidden"
|
|
149
|
-
backgroundColor={desktop ? undefined : active ?
|
|
155
|
+
backgroundColor={desktop ? undefined : active ? selectionFill.bg : node.hops ? blendHex(colors.bg, accent, 0.12) : colors.panel}
|
|
150
156
|
// The flow's card (flow.tsx): in the relationship's colour, the focus company plain.
|
|
151
157
|
style={desktop ? { ...cardSurfaceStyle({ selected: active, accent: role ? accent : undefined, padding: "0 0 0 var(--gloom-space-sm)" }), cursor: "pointer" } : undefined}
|
|
152
158
|
onMouseOver={() => onSelect(node.entity.id)} data-gloom-role="supply-graph-node">
|
|
@@ -154,10 +160,10 @@ export function SupplyGraph({ data, width, height, focused, selectedId, selected
|
|
|
154
160
|
<Box flexDirection="column" width="100%">
|
|
155
161
|
<Box flexDirection="row" height={1} gap={desktop ? 1 : 0} overflow="hidden">
|
|
156
162
|
{!desktop ? <Text fg={accent}>▍</Text> : null}
|
|
157
|
-
<ClippedText fg={active && !desktop ? colors.
|
|
158
|
-
{showTicker ? desktop ? <Badge label={ticker!} tone="accent" /> : <Text fg={active ? colors.
|
|
163
|
+
<ClippedText fg={active && !desktop ? chosenText(company ? colors.textBright : colors.textDim) : company ? colors.textBright : colors.textDim} attributes={company ? TextAttributes.BOLD : 0} text={name} width={nameWidth} />
|
|
164
|
+
{showTicker ? desktop ? <Badge label={ticker!} tone="accent" /> : <Text fg={active ? chosenText(colors.textDim) : colors.textDim}>{` ${ticker}`}</Text> : null}
|
|
159
165
|
</Box>
|
|
160
|
-
<Box height={1} paddingLeft={desktop ? 0 : 1} overflow="hidden"><ClippedText fg={active && !desktop ? colors.
|
|
166
|
+
<Box height={1} paddingLeft={desktop ? 0 : 1} overflow="hidden"><ClippedText fg={active && !desktop ? chosenText(colors.textDim) : colors.textDim} text={detail} width={inner} /></Box>
|
|
161
167
|
</Box>
|
|
162
168
|
</Button>
|
|
163
169
|
</Box>;
|
|
@@ -7,7 +7,8 @@ import { evidenceDate, evidenceLabel, isUnconfirmed, matchesSupplyOptions, suppl
|
|
|
7
7
|
import { fetchSupplyGraph, graphOptions } from "./graph-client";
|
|
8
8
|
import { entityTicker, exposureLabel, pathLabel } from "./graph-model";
|
|
9
9
|
import { graphEvidenceRow } from "./graph-evidence";
|
|
10
|
-
import { counterpartyName, disclosedValue, disclosureText, earlierRows, isTaggedFact, lockedDisclosures, nativeValue, periodText,
|
|
10
|
+
import { counterpartyKind, counterpartyName, disclosedValue, disclosureText, earlierRows, isRelatedParty, isTaggedFact, lockedDisclosures, nativeValue, periodText, relationshipLabel, shareParts, supplyEmptyText, supplyPreviewNote,
|
|
11
|
+
supplyRoleCounts } from "./model";
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* The Table tab's columns, printed as the pane prints them: the share with
|
|
@@ -24,10 +25,14 @@ function tableColumns(rows: HeadlessPaneRow[], sources: ReadonlyMap<HeadlessPane
|
|
|
24
25
|
const valued = rows.some((row) => { const source = sources.get(row); return !!source && (nativeValue(source) !== null || source.usd !== null); });
|
|
25
26
|
const lengths = rows.some((row) => sources.get(row)?.periodMonths != null);
|
|
26
27
|
return [
|
|
27
|
-
|
|
28
|
+
// The text names a company with its subsidiaries (X及其子公司) as the group, as the pane's label beside the name does
|
|
29
|
+
// (the Role says whether it is a related party); a cohort or an undisclosed name already says what it is.
|
|
30
|
+
{ key: "counterparty", header: "Counterparty", format: cell(counterpartyName),
|
|
31
|
+
textFormat: cell((row) => counterpartyKind(row) === "company" && row.entityScope === "group" ? `${counterpartyName(row)} (group)` : counterpartyName(row)) },
|
|
28
32
|
{ key: "evidenceTier", header: "Evidence" },
|
|
29
33
|
{ key: "ticker", header: "Ticker" },
|
|
30
|
-
|
|
34
|
+
// A related-party trade reads as one, never as a plain supplier or customer.
|
|
35
|
+
{ key: "role", header: "Role", format: cell(relationshipLabel) },
|
|
31
36
|
// Exports keep the share a number, what it is a share of beside it in the Table's words ("% of total revenue (gold sales)").
|
|
32
37
|
{ key: "pct", header: "Share", unitKey: "shareUnit", unitColumn: true, format: cell((row) => shareParts(row, focusId)?.value ?? null),
|
|
33
38
|
textFormat: cell((row) => { const share = shareParts(row, focusId); return share ? `${share.value} ${share.basis}` : null; }) },
|
|
@@ -43,7 +48,7 @@ function tableColumns(rows: HeadlessPaneRow[], sources: ReadonlyMap<HeadlessPane
|
|
|
43
48
|
const pathColumns = [
|
|
44
49
|
{ key: "route", header: "Route" }, { key: "hops", header: "Hops" },
|
|
45
50
|
{ key: "score", header: "Rank score", description: "Product of normalized edge weights; not a probability." },
|
|
46
|
-
{ key: "confidence", header: "Confidence" }, { key: "exposureLabel", header: "
|
|
51
|
+
{ key: "confidence", header: "Confidence" }, { key: "exposureLabel", header: "Exposure" },
|
|
47
52
|
];
|
|
48
53
|
/**
|
|
49
54
|
* What a graph disclosure says in words: the text itself, or for a tagged
|
|
@@ -82,14 +87,15 @@ function graphReport(data: GraphPayload, target: string): HeadlessBundleResult {
|
|
|
82
87
|
sections.push({ title: "Disclosure evidence", columns: [
|
|
83
88
|
{ key: "reporter", header: "Reporting company" }, { key: "from", header: "Supplier / from" }, { key: "to", header: "Customer / to" },
|
|
84
89
|
// The share in the Table's words, its reporter named ("27% of NEM total revenue (gold sales)"); exports keep pct and denominator apart.
|
|
85
|
-
{ key: "role", header: "Role"
|
|
90
|
+
{ key: "role", header: "Role", textFormat: (value, row) => row.relatedParty ? `related-party ${String(value)}` : String(value) },
|
|
91
|
+
{ key: "pct", header: "Share", textFormat: (_value, row) => String(row.share ?? "-") },
|
|
86
92
|
{ key: "period", header: "Period", textFormat: (value, row) => periodText({ period: String(value), periodMonths: row.periodMonths as number | null }) },
|
|
87
93
|
{ key: "filed", header: "Filed" }, { key: "confidence", header: "Confidence" },
|
|
88
94
|
// A tagged XBRL fact prints the link's filing sentence when one names the same pair, otherwise the fact in words; exports keep the stored text.
|
|
89
95
|
{ key: "quote", header: "Quote", textFormat: (value, row) => row.statement == null ? String(value ?? "") : String(row.statement) }, { key: "filingUrl", header: "Filing" },
|
|
90
96
|
], rows: data.links.flatMap(link => link.evidence.map(item => ({ id: item.id, linkId: link.id, primary: item.id === link.primaryEvidenceId,
|
|
91
97
|
statement: graphStatement(item, link.evidence), share: graphShare(item),
|
|
92
|
-
reporter: item.reporter.name, from: item.from.name, to: item.to.name, role: item.role, pct: item.pctOfRevenue ?? null,
|
|
98
|
+
reporter: item.reporter.name, from: item.from.name, to: item.to.name, role: item.role, relatedParty: isRelatedParty(item), pct: item.pctOfRevenue ?? null,
|
|
93
99
|
denominator: item.pctBasis && !(item.sourceKind === "xbrl" && item.pctScope) ? `${item.reporter.name} ${item.pctBasis}${item.pctScope ? ` (${item.pctScope})` : ""}` : null,
|
|
94
100
|
pctBasis: item.pctBasis, pctScope: item.pctScope, period: item.period, periodMonths: item.periodMonths ?? null, filed: item.filedDate, asOf: item.asOf,
|
|
95
101
|
confidence: item.confidence, quote: item.quote, quoteLanguage: item.quoteLanguage, quoteGloss: item.quoteGloss ?? null,
|
|
@@ -155,7 +161,7 @@ export const supplyChainHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
155
161
|
const record = (row: SupplyRow) => sourced(row, { counterparty: row.counterparty.name, ticker: entityTicker(row.counterparty), aggregate: row.counterparty.aggregate, role: row.role, direction: row.direction,
|
|
156
162
|
pct: row.pctOfRevenue, shareUnit: shareOf(row), pctBasis: row.pctBasis, pctScope: row.pctScope, usd: row.usd, usdBasis: row.usdBasis, period: row.period, periodMonths: row.periodMonths ?? null, fiscalYear: row.fiscalYear,
|
|
157
163
|
nativeAmount: row.nativeAmount ?? null, nativeCurrency: row.nativeCurrency ?? null, nativeScale: row.nativeScale ?? null,
|
|
158
|
-
jurisdiction: row.jurisdiction ?? null, entityScope: row.entityScope ?? null,
|
|
164
|
+
jurisdiction: row.jurisdiction ?? null, entityScope: row.entityScope ?? null, relatedParty: isRelatedParty(row),
|
|
159
165
|
evidenceTier: evidenceLabel(row), tier: trustTier(row), claimType: row.claimType, corroboration: row.corroboration ?? 1,
|
|
160
166
|
leadStatus: row.leadStatus ?? "none", whyUnconfirmed: row.whyUnconfirmed ?? null,
|
|
161
167
|
firstSeenAt: row.firstSeenAt, lastSeenAt: row.lastSeenAt, lastConfirmedAt: row.lastConfirmedAt,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SupplyChainPayload, SupplyOptions, SupplyRole, SupplyRow } from "../../../api-client/supply-chain";
|
|
1
|
+
import type { SupplyChainPayload, SupplyEvidenceItem, SupplyOptions, SupplyRole, SupplyRow } from "../../../api-client/supply-chain";
|
|
2
2
|
import { currentThemeColorSet, SERIES_COLORS } from "../../../theme/series-colors";
|
|
3
3
|
import { companyNameCase, shortCompanyName } from "../../../tickers/company-name";
|
|
4
4
|
import { clipToDisplayWidth, displayWidth } from "../../../utils/format";
|
|
@@ -33,11 +33,29 @@ export function counterpartyLabel(row: SupplyRow): string {
|
|
|
33
33
|
// Cohort labels arrive in title case from XBRL member names; generic words read lower case, names keep theirs.
|
|
34
34
|
return name.replace(GENERIC_WORDS, (word) => word.toLowerCase()).replace(/^./, (first) => first.toUpperCase());
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* A related-party (connected) trade the report prints: the counterparty is
|
|
38
|
+
* the company's parent, its group or a company under the same control. The
|
|
39
|
+
* server labels a row one only when every disclosure behind it is one.
|
|
40
|
+
*/
|
|
41
|
+
export const isRelatedParty = (row: Pick<SupplyRow, "relatedParty">) => row.relatedParty === true;
|
|
42
|
+
/** A company and its subsidiaries ("X及其子公司"): the figure is the group's, not X's alone. */
|
|
43
|
+
const namedGroup = (row: SupplyRow) => row.entityScope === "group" && !row.counterparty.aggregate;
|
|
44
|
+
/**
|
|
45
|
+
* What the counterparty is beside its name, the same in the table, the flow
|
|
46
|
+
* and the graph: a cohort group, an undisclosed name, a related party (so a
|
|
47
|
+
* parent's group never reads as a plain supplier or customer), and a company
|
|
48
|
+
* with its subsidiaries as a group. `short` for a narrow column.
|
|
49
|
+
*/
|
|
36
50
|
export const counterpartyKindLabel = (row: SupplyRow, short = false) => {
|
|
37
51
|
const kind = counterpartyKind(row);
|
|
38
|
-
if (
|
|
39
|
-
|
|
52
|
+
if (kind === "group") return short ? "group" : `${row.role} group`;
|
|
53
|
+
if (kind === "undisclosed") return short ? "undisclosed" : `undisclosed ${row.role}`;
|
|
54
|
+
if (isRelatedParty(row)) return namedGroup(row) ? short ? "related group" : "related-party group" : "related party";
|
|
55
|
+
return namedGroup(row) ? short ? "group" : "corporate group" : null;
|
|
40
56
|
};
|
|
57
|
+
/** The relationship in words: "Related-party supplier" for a related-party trade, else the role. */
|
|
58
|
+
export const relationshipLabel = (row: Pick<SupplyRow, "role" | "relatedParty">) => isRelatedParty(row) ? `Related-party ${row.role}` : roleLabel(row.role);
|
|
41
59
|
|
|
42
60
|
/** A filer's segment or product scope in plain words: "Compute And Networking Segment" reads "Compute & Networking". */
|
|
43
61
|
export function scopeWords(scope: string): string {
|
|
@@ -144,8 +162,8 @@ export function counterpartyName(row: SupplyRow): string {
|
|
|
144
162
|
}
|
|
145
163
|
export const roleLabel = (role: SupplyRole) => role[0]!.toUpperCase() + role.slice(1);
|
|
146
164
|
|
|
147
|
-
/** A listing code that reads as no word: 0700:HKEX, 1211.HK, 7203. */
|
|
148
|
-
const numberedListing = (value: string) => /^\d[\dA-Z]*(?:[.:][A-Z]+)?$/i.test(value.trim());
|
|
165
|
+
/** A listing code that reads as no word: 0700:HKEX, 1211.HK, 7203, and on SGX C38U:SGX or D05.SI, whose letters spell none either. */
|
|
166
|
+
const numberedListing = (value: string) => /^\d[\dA-Z]*(?:[.:][A-Z]+)?$/i.test(value.trim()) || /^[A-Z]{1,2}\d[\dA-Z]*[.:](?:SGX|SI)$/i.test(value.trim());
|
|
149
167
|
|
|
150
168
|
/**
|
|
151
169
|
* The focus company as the direction labels name it ("AAPL says"): its ticker
|
|
@@ -236,12 +254,14 @@ export function supplyEmptyText(data: Pick<SupplyChainPayload, "symbol" | "entit
|
|
|
236
254
|
const country = /^[A-Z]{2}$/.test(code) ? code : null;
|
|
237
255
|
const exchange = data.entity?.exchange?.trim().toUpperCase() ?? "";
|
|
238
256
|
const customerSide = `A customer's filings name its suppliers: try the customer's side, such as ${command("AAPL")}.`;
|
|
239
|
-
|
|
257
|
+
// Not yet available, never an error: what is read so far names none.
|
|
258
|
+
const none = `Relationships for ${data.symbol} are not yet available:`;
|
|
259
|
+
if (country && FILING_COUNTRIES.has(country)) return `${none} no filing, announcement or call read so far names one.`;
|
|
240
260
|
if ((country && REPORT_COUNTRIES.has(country)) || REPORT_EXCHANGES.has(exchange)) {
|
|
241
|
-
return
|
|
261
|
+
return `${none} no annual report, announcement or call read so far names one. ${customerSide}`;
|
|
242
262
|
}
|
|
243
|
-
if (!country) return
|
|
244
|
-
return
|
|
263
|
+
if (!country) return `${none} no filing, announcement or call read so far names one. ${customerSide}`;
|
|
264
|
+
return `${none} SPLC reads company filings from the US and Korea and annual reports from Hong Kong, mainland China `
|
|
245
265
|
+ `and Singapore, plus announcements and calls, and none read so far names one. ${customerSide}`;
|
|
246
266
|
}
|
|
247
267
|
|
|
@@ -253,10 +273,47 @@ export function supplyPreviewNote(data: Pick<SupplyChainPayload, "previewRowsPer
|
|
|
253
273
|
|
|
254
274
|
export const percentage = (row: SupplyRow) => row.pctOfRevenue === null || trustTier(row) !== 1 || isUnconfirmed(row) || !activeRelationship(row) ? "--" : `${Number(row.pctOfRevenue.toFixed(2))}% ${row.pctScope ? "scoped " : ""}${row.pctBasis ?? ""}`;
|
|
255
275
|
export const dollars = (row: SupplyRow) => row.usd === null ? "--" : `${row.usdBasis === "derived" ? "≈ " : ""}$${revenueAmount(row.usd)} ${row.usdBasis}`;
|
|
256
|
-
|
|
276
|
+
/** A disclosed scale in words, as the filing prints it: 万元 is ten thousand yuan, 亿元 a hundred million. */
|
|
277
|
+
const SCALE_WORDS: ReadonlyMap<number, string> = new Map([[1, ""], [1_000, " thousand"], [10_000, " ten thousand"], [1_000_000, " million"], [100_000_000, " hundred million"], [1_000_000_000, " billion"]]);
|
|
278
|
+
const scaleLabel = (scale: number) => SCALE_WORDS.get(scale) ?? ` ×${scale.toLocaleString("en-US")}`;
|
|
279
|
+
/** A source value's printed unit as its multiplier: "ten_thousands" (万元) is 10,000. */
|
|
280
|
+
const UNIT_SCALES: Readonly<Record<string, number>> = { units: 1, thousands: 1_000, ten_thousands: 10_000, millions: 1_000_000, hundred_millions: 100_000_000, billions: 1_000_000_000 };
|
|
281
|
+
/** What a source value measures, in words: "related_party_group_purchases" reads "Related-party purchases". */
|
|
282
|
+
export function sourceValueLabel(kind: string | null): string {
|
|
283
|
+
if (!kind) return "Source value";
|
|
284
|
+
const related = /^related_party_(?:group_)?(sales|purchases)$/.exec(kind);
|
|
285
|
+
if (related) return `Related-party ${related[1]}`;
|
|
286
|
+
const words = kind.replace(/_/g, " ").trim();
|
|
287
|
+
return words ? words[0]!.toUpperCase() + words.slice(1) : "Source value";
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* A source value in its currency and printed unit, as a row's value reads:
|
|
291
|
+
* "26,909,758,882.26 CNY", "12,345 CNY ten thousand", "4.5%". An amount in a
|
|
292
|
+
* unit of a currency takes the row's currency when its own line names none,
|
|
293
|
+
* and is not shown without one: "9,771,378 ten thousand" says nothing.
|
|
294
|
+
*/
|
|
295
|
+
export function sourceValueText(item: Pick<SupplyEvidenceItem, "value" | "valueUnit" | "currency">, rowCurrency?: string | null): string | null {
|
|
296
|
+
if (item.value === null) return null;
|
|
297
|
+
const scale = item.valueUnit ? UNIT_SCALES[item.valueUnit] : undefined;
|
|
298
|
+
const amount = printedAmount(item.value, scale);
|
|
299
|
+
if (scale !== undefined) {
|
|
300
|
+
const currency = item.currency || rowCurrency;
|
|
301
|
+
return currency ? `${amount} ${currency}${scaleLabel(scale)}` : null;
|
|
302
|
+
}
|
|
303
|
+
if (item.valueUnit === "percent" || item.valueUnit === "per cent") return `${amount}%`;
|
|
304
|
+
return [amount, item.currency, item.valueUnit].filter(Boolean).join(" ");
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* An amount as printed, in its unit. One in units of the currency with a
|
|
308
|
+
* fraction is in cents, to two places: a related-party total of
|
|
309
|
+
* 822,340,444.90 never reads 822,340,444.9.
|
|
310
|
+
*/
|
|
311
|
+
function printedAmount(value: number, scale: number | undefined): string {
|
|
312
|
+
return value.toLocaleString("en-US", { maximumFractionDigits: 12, minimumFractionDigits: scale === 1 && !Number.isInteger(value) ? 2 : 0 });
|
|
313
|
+
}
|
|
257
314
|
/** Retain the original currency and disclosed scale; never imply an FX conversion. */
|
|
258
315
|
export const nativeValue = (row: SupplyRow) => row.nativeAmount == null || !row.nativeCurrency || !row.nativeScale ? null
|
|
259
|
-
: `${row.nativeAmount
|
|
316
|
+
: `${printedAmount(row.nativeAmount, row.nativeScale)} ${row.nativeCurrency}${scaleLabel(row.nativeScale)}`;
|
|
260
317
|
export const disclosedValue = (row: SupplyRow) => nativeValue(row) ?? dollars(row);
|
|
261
318
|
const QUOTE_LANGUAGES: Record<string, string> = { ko: "Korean", ja: "Japanese", zh: "Chinese", "zh-TW": "Chinese", "zh-Hant": "Chinese", "zh-Hans": "Chinese", en: "English" };
|
|
262
319
|
export const quoteLanguageLabel = (row: Pick<SupplyRow, "quoteLanguage">) => QUOTE_LANGUAGES[row.quoteLanguage ?? ""] ?? row.quoteLanguage ?? "original language";
|
|
@@ -31,7 +31,7 @@ import { SupplyFlow } from "./flow";
|
|
|
31
31
|
import { SupplyGraphPane } from "./graph-pane";
|
|
32
32
|
import { entityTicker } from "./graph-model";
|
|
33
33
|
import {
|
|
34
|
-
cellText, counterpartyKind, counterpartyKindLabel, counterpartyLabel, counterpartyName, disclosedValue, earlierRows, fitShareBasis, focusCompanyLabel, focusCompanyName, receivablesConcentration, lockedDisclosures, nativeValue, percentage, ROLE_COLORS, roleLabel,
|
|
34
|
+
cellText, counterpartyKind, counterpartyKindLabel, counterpartyLabel, counterpartyName, disclosedValue, earlierRows, fitShareBasis, focusCompanyLabel, focusCompanyName, receivablesConcentration, lockedDisclosures, nativeValue, percentage, relationshipLabel, ROLE_COLORS, roleLabel,
|
|
35
35
|
periodDate, shareParts, sortRows, supplyEmptyText, supplyPreviewNote, supplyRoleCounts, type SupplySort,
|
|
36
36
|
} from "./model";
|
|
37
37
|
import { RowEvidence } from "./row-evidence";
|
|
@@ -97,7 +97,9 @@ function tableColumns(width: number, desktop: boolean, locked: boolean, valueWid
|
|
|
97
97
|
// Wide enough for the longest whole wording beside its bar and figure ("27% of total revenue (gold sales)"), within a cap;
|
|
98
98
|
// a narrow pane keeps its 26 cells, so the name keeps its room and the share reads its shorter basis.
|
|
99
99
|
const whole = Math.max(0, ...bases.map((forms) => forms[0]!));
|
|
100
|
-
|
|
100
|
+
// With no share on any row (a related-party table states amounts, not shares) the column keeps its header and the names take the room.
|
|
101
|
+
const shareWidth = !bases.length ? SHARE_BAR_MIN_CELLS + 1
|
|
102
|
+
: Math.max(wide ? 34 : medium ? 30 : 26, Math.min(wide ? 64 : medium ? 52 : 26, (wide ? 8 : 5) + SHARE_FIGURE_CELLS + 2 + whole));
|
|
101
103
|
const share: DataTableColumn = { id: "pct", label: "Share", width: shareWidth, align: "left" };
|
|
102
104
|
let columns: DataTableColumn[] = [
|
|
103
105
|
name,
|
|
@@ -298,8 +300,8 @@ function SupplyView({ symbol, listingName, width, height, focused }: Pick<PanePr
|
|
|
298
300
|
case "corroboration": return { text: String(row.corroboration ?? 1), value: row.corroboration ?? 1, color: colors.textDim, content: <Text fg={colors.textDim}>{row.corroboration ?? 1}</Text> };
|
|
299
301
|
case "name": {
|
|
300
302
|
const company = counterpartyKind(row) === "company";
|
|
301
|
-
// The kind label never gives way to a long cohort name; a column too narrow for the name says it in
|
|
302
|
-
// The desktop always says it
|
|
303
|
+
// The kind label never gives way to a long cohort name; a column too narrow for the name says it in its short form.
|
|
304
|
+
// The desktop always says it short ("group", "related group"): the Role column beside it names the role, and the name takes the room.
|
|
303
305
|
const full = counterpartyKindLabel(row);
|
|
304
306
|
const kind = !desktop && full && displayWidth(counterpartyLabel(row)) + displayWidth(full) + 4 <= column.width ? full : counterpartyKindLabel(row, true);
|
|
305
307
|
const ticker = !columns.some((entry) => entry.id === "ticker") ? entityTicker(row.counterparty) : null;
|
|
@@ -316,7 +318,8 @@ function SupplyView({ symbol, listingName, width, height, focused }: Pick<PanePr
|
|
|
316
318
|
if (!ticker) return { text: "", value: null };
|
|
317
319
|
return { text: ticker, color: colors.textBright, content: desktop ? <Badge label={ticker} tone="accent" /> : undefined };
|
|
318
320
|
}
|
|
319
|
-
|
|
321
|
+
// The text a copy or export reads names a related party; the cell draws the role beside the name's chip.
|
|
322
|
+
case "role": return { text: relationshipLabel(row), content: <Box flexDirection="row" height={1} overflow="hidden">
|
|
320
323
|
<Text fg={ROLE_COLORS[row.role]}>●</Text>
|
|
321
324
|
<Text fg={ink ?? ROLE_COLORS[row.role]}>{` ${roleLabel(row.role)}`}</Text>
|
|
322
325
|
</Box> };
|
|
@@ -349,7 +352,7 @@ function SupplyView({ symbol, listingName, width, height, focused }: Pick<PanePr
|
|
|
349
352
|
const flowFigures = bodyHeight < 26 ? figures.slice(0, flowFigureColumns) : figures;
|
|
350
353
|
const selectedShare = selected ? shareParts(selected, focusId) : null;
|
|
351
354
|
const flowMeta = selected ? `${entityTicker(selected.reportingEntity) ?? selected.reportingEntity.name} ${evidenceLabel(selected)} · ${selectedShare ? `${selectedShare.value} ${selectedShare.basis}`
|
|
352
|
-
: nativeValue(selected) !== null || selected.usd !== null ? disclosedValue(selected) : `${
|
|
355
|
+
: nativeValue(selected) !== null || selected.usd !== null ? disclosedValue(selected) : `${relationshipLabel(selected)}, no figure disclosed`}` : undefined;
|
|
353
356
|
return <Box width={width} height={height} flexDirection="column">
|
|
354
357
|
{strip}
|
|
355
358
|
<PaneStatusBody loading={!data && resource.loading} error={!data && resource.error !== SUPPLY_UNAVAILABLE ? resource.error : null}
|
|
@@ -6,7 +6,7 @@ import { scrollByLines } from "../../../state/pane-scroll-registry";
|
|
|
6
6
|
import { useThemeColors } from "../../../theme/theme-context";
|
|
7
7
|
import { Box, Text, useUiCapabilities, type ScrollBoxRenderable } from "../../../ui";
|
|
8
8
|
import { isPlainKey } from "../../../utils/keyboard";
|
|
9
|
-
import { counterpartyKind,
|
|
9
|
+
import { counterpartyKind, disclosedValue, disclosureText, dollars, isTaggedFact, nativeValue, periodText, relationshipLabel, ROLE_COLORS, shareParts, sourceLabel, sourceValueLabel, sourceValueText } from "./model";
|
|
10
10
|
import { canShowQuote, corroborationLabel, evidenceDate, evidenceLabel, isUnconfirmed, tierLabel } from "./trust";
|
|
11
11
|
import { DisclosureQuote } from "./disclosure-quote";
|
|
12
12
|
|
|
@@ -42,7 +42,7 @@ export function SupplySources({ row, width, onOpenSource }: { row: SupplyRow; wi
|
|
|
42
42
|
<KeyValueRow label="Publisher" value={item.publisher} detail={item.publishedAt.slice(0, 10)} labelWidth={20} />
|
|
43
43
|
<KeyValueRow label="Evidence" value={tierLabel(item.tier)} detail={item.status !== "active" ? item.status : item.textOrigin === "asr" ? "Speech transcript" : undefined} labelWidth={20} />
|
|
44
44
|
{item.verificationStatus === "lead" ? <KeyValueRow label="Verification" value="Unconfirmed supporting item" labelWidth={20} /> : null}
|
|
45
|
-
{item.
|
|
45
|
+
{sourceValueText(item, row.nativeCurrency) ? <KeyValueRow label={sourceValueLabel(item.valueKind)} value={sourceValueText(item, row.nativeCurrency)!} labelWidth={20} /> : null}
|
|
46
46
|
{canShowQuote(item) && item.quote ? <DisclosureQuote role={row.role} quote={item.quote} quoteLanguage={item.quoteLanguage} width={width} /> : <KeyValueRow label="Quotation" value={item.textOrigin === "snippet" ? "Original text not verified" : "Link only"} labelWidth={20} />}
|
|
47
47
|
{canShowQuote(item) && item.englishGloss ? <SourceGloss text={item.englishGloss} width={width} /> : null}
|
|
48
48
|
{sourceLink(item.url, "Open source")}
|
|
@@ -76,7 +76,7 @@ export function RowEvidence({ row, focusId, width, height, focused }: { row: Sup
|
|
|
76
76
|
{ id: "published", label: "Published", value: evidenceDate(row), detail: evidenceLabel(row) },
|
|
77
77
|
{ id: "confidence", label: "Confidence", value: `${Math.round(row.confidence * 100)}%` },
|
|
78
78
|
];
|
|
79
|
-
const kind =
|
|
79
|
+
const kind = counterpartyKind(row);
|
|
80
80
|
return <Box width={width} height={desktop ? undefined : height} flexGrow={1} flexBasis={0} minHeight={0}>
|
|
81
81
|
<DetailScrollBody ref={scrollRef} resetScrollKey={row.id}>
|
|
82
82
|
<StatGrid items={figures} width={width} />
|
|
@@ -85,8 +85,8 @@ export function RowEvidence({ row, focusId, width, height, focused }: { row: Sup
|
|
|
85
85
|
<Box flexDirection="row" gap={1}><Badge tone={isUnconfirmed(row) ? "neutral" : "accent"} label={evidenceLabel(row)} />
|
|
86
86
|
{row.leadStatus === "verified" ? <Badge tone="positive" label="Verified" /> : null}</Box>
|
|
87
87
|
<KeyValueRow label="Reporting company" value={row.reportingEntity.name} labelWidth={20} />
|
|
88
|
-
<KeyValueRow label="Relationship" value={`${
|
|
89
|
-
{kind ? <KeyValueRow label="Counterparty type" value={
|
|
88
|
+
<KeyValueRow label="Relationship" value={`${relationshipLabel(row)} · ${row.direction === "in" ? "inbound" : row.direction === "out" ? "outbound" : "mutual"}`} color={ROLE_COLORS[row.role]} labelWidth={20} />
|
|
89
|
+
{kind !== "company" ? <KeyValueRow label="Counterparty type" value={kind === "group" ? row.entityScope === "group" ? "Named corporate group" : "Aggregate concentration group" : "Undisclosed by the filer"} labelWidth={20} /> : null}
|
|
90
90
|
{row.entityScope === "group" && !row.counterparty.aggregate ? <KeyValueRow label="Metric scope" value="Corporate group" labelWidth={20} /> : null}
|
|
91
91
|
{native && row.usd !== null ? <KeyValueRow label="USD amount" value={dollars(row)} labelWidth={20} /> : null}
|
|
92
92
|
<SupplyVerification row={row} />
|
|
@@ -110,6 +110,7 @@ export function CompactRangeBar({
|
|
|
110
110
|
currency,
|
|
111
111
|
priceOptions,
|
|
112
112
|
endpoints = "price",
|
|
113
|
+
note,
|
|
113
114
|
}: {
|
|
114
115
|
current: number;
|
|
115
116
|
low: number;
|
|
@@ -130,6 +131,11 @@ export function CompactRangeBar({
|
|
|
130
131
|
priceOptions: MarketFormatOptions;
|
|
131
132
|
/** Shared by ranges drawn together, as `endpointWidth` is (rangeEndpointStyle). */
|
|
132
133
|
endpoints?: RangeEndpointStyle;
|
|
134
|
+
/**
|
|
135
|
+
* Muted context after the high, where the range is not the source's own
|
|
136
|
+
* (`daily bars`): shown only while the track keeps RANGE_MIN_TRACK_WIDTH.
|
|
137
|
+
*/
|
|
138
|
+
note?: string;
|
|
133
139
|
}) {
|
|
134
140
|
const { nativePaneChrome } = useUiCapabilities();
|
|
135
141
|
const range = high - low;
|
|
@@ -140,7 +146,9 @@ export function CompactRangeBar({
|
|
|
140
146
|
const shownLabelWidth = useShortLabel ? displayWidth(shortLabel) : labelWidth;
|
|
141
147
|
const endpointOptions = { ...priceOptions, maxWidth: endpointWidth };
|
|
142
148
|
const [lowText, highText] = formatRangeEndpoints(low, high, currency, endpointOptions, endpoints);
|
|
143
|
-
const
|
|
149
|
+
const noteCells = note ? displayWidth(note) + 1 : 0;
|
|
150
|
+
const shownNote = note && width - rangeRowChrome(shownLabelWidth, endpointWidth) - noteCells >= RANGE_MIN_TRACK_WIDTH ? note : null;
|
|
151
|
+
const barWidth = Math.max(1, width - rangeRowChrome(shownLabelWidth, endpointWidth) - (shownNote ? noteCells : 0));
|
|
144
152
|
|
|
145
153
|
// The desktop and the web size the row and its track by CSS, so the high end keeps to the pane's edge on every frame of a
|
|
146
154
|
// resize; the label, the endpoints and which of them show are still worked out from `width`, at each catch-up.
|
|
@@ -176,6 +184,11 @@ export function CompactRangeBar({
|
|
|
176
184
|
<Box width={endpointWidth} flexShrink={0} overflow="hidden">
|
|
177
185
|
<Text fg={colors.text}>{highText}</Text>
|
|
178
186
|
</Box>
|
|
187
|
+
{shownNote && (
|
|
188
|
+
<Box width={noteCells} flexShrink={0} overflow="hidden" data-gloom-role="range-note">
|
|
189
|
+
<Text fg={colors.textDim}>{` ${shownNote}`}</Text>
|
|
190
|
+
</Box>
|
|
191
|
+
)}
|
|
179
192
|
</Box>
|
|
180
193
|
);
|
|
181
194
|
}
|
|
@@ -587,6 +587,8 @@ function ResolvedOverviewTab({ width, height, focused = false, ticker, financial
|
|
|
587
587
|
high={yearRange.high}
|
|
588
588
|
label={yearRangeLabel}
|
|
589
589
|
shortLabel={t("52W")}
|
|
590
|
+
// A range the service read from the stored daily bars, the source's being no year's, says so.
|
|
591
|
+
note={quote.yearRangeBasis === "daily-bars" ? t("daily bars") : undefined}
|
|
590
592
|
labelWidth={rangeLabelWidth}
|
|
591
593
|
endpointWidth={rangeEndpointCells}
|
|
592
594
|
width={rangeWidth}
|