@gloom-sh/terminal 0.20.17 → 0.20.18
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 +3 -1
- package/src/account/auth-dialog.tsx +19 -1
- package/src/account/billing.ts +2 -1
- package/src/account/heard-from-question.tsx +235 -0
- package/src/account/heard-from.ts +97 -0
- package/src/api-client/data.ts +3 -2
- package/src/api-client/heard-from.ts +72 -0
- package/src/api-client/index.ts +63 -6
- package/src/api-client/mna.ts +18 -0
- package/src/api-client/supply-chain.ts +9 -0
- package/src/api-client/types/billing.ts +35 -1
- package/src/app/global-shortcuts.ts +5 -3
- package/src/app/pro-welcome/keys.ts +27 -0
- package/src/app/pro-welcome/model.ts +158 -0
- package/src/app/pro-welcome/row.tsx +176 -0
- package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
- package/src/app/runtime/external-profile-changes.ts +135 -0
- package/src/app.tsx +33 -2
- package/src/architecture/core-builtin-allowlist.json +1 -1
- package/src/architecture/floating-promise-allowlist.json +0 -1
- package/src/architecture/shortcut-labels-allowlist.json +1 -0
- package/src/cli/alert-listing.ts +98 -0
- package/src/cli/commands/market.ts +138 -22
- package/src/cli/commands/overview.ts +7 -1
- package/src/cli/commands/plugins.ts +3 -2
- package/src/cli/commands/search.ts +30 -6
- package/src/cli/context.ts +16 -5
- package/src/cli/csv-export.ts +2 -1
- package/src/cli/desktop-pane-shot.ts +72 -9
- package/src/cli/glossary.ts +64 -10
- package/src/cli/history-demergers.ts +117 -0
- package/src/cli/history-rows.ts +6 -2
- package/src/cli/index.ts +1 -0
- package/src/cli/known-gaps.ts +16 -0
- package/src/cli/known-us-stocks.ts +18 -0
- package/src/cli/listing-arg.ts +105 -15
- package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
- package/src/cli/pane-functions/catalog-snapshot.json +866 -0
- package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
- package/src/cli/pane-functions/catalog.ts +50 -16
- package/src/cli/pane-functions/data.ts +16 -4
- package/src/cli/pane-functions/dom.ts +24 -6
- package/src/cli/pane-functions/freshness.ts +17 -1
- package/src/cli/pane-functions/index.ts +100 -42
- package/src/cli/pane-functions/resolver.ts +8 -5
- package/src/cli/pane-functions/screenshot-assessment.ts +30 -7
- package/src/cli/pane-functions/screenshot-payload.ts +21 -0
- package/src/cli/pane-functions/screenshot-render.ts +3 -1
- package/src/cli/quote-answer.ts +32 -16
- package/src/cli/registry.ts +22 -2
- package/src/cli/result.ts +5 -4
- package/src/cli/series-search.ts +45 -6
- package/src/cli/shot-temp-dir.ts +4 -9
- package/src/components/chart/composite/legend.tsx +43 -18
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
- package/src/components/chart/composite/price-axis-labels.tsx +7 -5
- package/src/components/chart-table/header.tsx +9 -0
- package/src/components/chart-table/layout.ts +11 -11
- package/src/components/command-bar/pane-templates/items.ts +17 -1
- package/src/components/command-bar/routes/root/provider-search.ts +10 -1
- package/src/components/command-bar/routes/root/results.ts +34 -2
- package/src/components/command-bar/routes/root/runtime.ts +8 -1
- package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
- package/src/components/command-bar/workflow/alert.ts +19 -8
- package/src/components/data-table/view.tsx +15 -2
- package/src/components/form-modal/content.tsx +9 -4
- package/src/components/index.ts +1 -1
- package/src/components/layout/header.tsx +9 -5
- package/src/components/layout/pane/capture-status.ts +6 -0
- package/src/components/layout/pane/footer/index.tsx +2 -0
- package/src/components/layout/pane/footer/model.ts +113 -15
- package/src/components/layout/pane/header.tsx +16 -2
- package/src/components/market-board/index.tsx +4 -2
- package/src/components/onboarding/onboarding-frame.tsx +6 -2
- package/src/components/onboarding/onboarding-keyboard.ts +7 -1
- package/src/components/onboarding/onboarding-wizard.tsx +3 -1
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
- package/src/components/onboarding/setup-cards.ts +36 -0
- package/src/components/onboarding/use-onboarding-progress.ts +22 -1
- package/src/components/onboarding/wizard-account.ts +6 -1
- package/src/components/onboarding/wizard-model.ts +32 -6
- package/src/components/onboarding/wizard-positions.ts +1 -1
- package/src/components/sign-in-gate.tsx +3 -1
- package/src/components/toggle-list.tsx +6 -8
- package/src/components/ui/confirm-dialog.tsx +47 -7
- package/src/components/ui/data-table/types.ts +8 -0
- package/src/components/ui/display.tsx +17 -2
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/stat-grid.tsx +4 -0
- package/src/components/ui/status.tsx +13 -1
- package/src/components/ui/table-layout.ts +2 -1
- package/src/components/use-pane-notice-footer.tsx +16 -3
- package/src/data/config/store/index.ts +31 -0
- package/src/data/config/store/node.ts +61 -11
- package/src/data/config/store/normalize.ts +4 -6
- package/src/data/config/store/shared-file.ts +309 -0
- package/src/data/profile-merge.ts +299 -0
- package/src/data/sqlite/checkpointer.ts +11 -1
- package/src/data/sqlite/database.ts +1 -1
- package/src/data/ticker-repository.ts +134 -10
- package/src/data/ticker-store.ts +67 -0
- package/src/data/ticker-writes.ts +5 -0
- package/src/i18n/es.ts +27 -0
- package/src/i18n/ja.ts +27 -0
- package/src/i18n/ko.ts +27 -0
- package/src/i18n/zh-cn.ts +27 -0
- package/src/i18n/zh-tw.ts +27 -0
- package/src/layout-marketplace/gallery-desktop.tsx +2 -2
- package/src/market-data/ah-pair.ts +103 -0
- package/src/market-data/depositary-pair.ts +6 -2
- package/src/market-data/hooks.tsx +33 -2
- package/src/market-data/market/change-basis.ts +2 -1
- package/src/market-data/market/header-market.ts +11 -0
- package/src/market-data/split-terms.ts +28 -0
- package/src/plugins/builtin/account-management/footer.ts +1 -1
- package/src/plugins/builtin/account-management/keyboard.ts +4 -0
- package/src/plugins/builtin/account-management/model.ts +1 -0
- package/src/plugins/builtin/account-management/pane.tsx +75 -7
- package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
- package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
- package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
- package/src/plugins/builtin/alerts/cli-move.ts +2 -2
- package/src/plugins/builtin/alerts/cli.ts +36 -30
- package/src/plugins/builtin/alerts/constants.ts +10 -0
- package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
- package/src/plugins/builtin/alerts/format.ts +24 -8
- package/src/plugins/builtin/alerts/index.tsx +38 -9
- package/src/plugins/builtin/alerts/move-checks.ts +7 -0
- package/src/plugins/builtin/alerts/pane.tsx +1 -1
- package/src/plugins/builtin/alerts/quotes.ts +26 -2
- package/src/plugins/builtin/alerts/scheduled.ts +6 -1
- package/src/plugins/builtin/alerts/types.ts +7 -0
- package/src/plugins/builtin/analytics/manual-value.ts +61 -0
- package/src/plugins/builtin/analytics/risk-book.ts +7 -7
- package/src/plugins/builtin/analytics/risk-client.ts +26 -13
- package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
- package/src/plugins/builtin/analytics/risk-model.ts +92 -4
- package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
- package/src/plugins/builtin/awards/pane.tsx +1 -1
- package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
- package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
- package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
- package/src/plugins/builtin/chart-composer/cli-options.ts +4 -2
- package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
- package/src/plugins/builtin/chart-composer/pane.tsx +5 -2
- package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
- package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
- package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +9 -4
- package/src/plugins/builtin/company-kpis/latest.ts +45 -0
- package/src/plugins/builtin/company-kpis/model.ts +38 -8
- package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
- package/src/plugins/builtin/composite/alt-data.ts +20 -0
- package/src/plugins/builtin/composite/application.ts +14 -0
- package/src/plugins/builtin/composite/broker.ts +12 -0
- package/src/plugins/builtin/composite/credit.ts +33 -0
- package/src/plugins/builtin/composite/crypto.ts +10 -0
- package/src/plugins/builtin/composite/earnings.ts +12 -0
- package/src/plugins/builtin/composite/filings.ts +13 -0
- package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
- package/src/plugins/builtin/composite/global-markets.ts +12 -0
- package/src/plugins/builtin/composite/options-volatility.ts +23 -0
- package/src/plugins/builtin/composite/ownership.ts +23 -0
- package/src/plugins/builtin/composite/portfolio.ts +10 -0
- package/src/plugins/builtin/composite/quant.ts +15 -0
- package/src/plugins/builtin/composite/rates-macro.ts +30 -0
- package/src/plugins/builtin/composite/screeners.ts +11 -0
- package/src/plugins/builtin/composite/shared.ts +11 -0
- package/src/plugins/builtin/composite/ticker-core.ts +36 -0
- package/src/plugins/builtin/congress-trades/headless.ts +31 -3
- package/src/plugins/builtin/correlation/index.tsx +13 -17
- package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
- package/src/plugins/builtin/dividend-yield/client.ts +57 -16
- package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
- package/src/plugins/builtin/dividend-yield/model.ts +4 -3
- package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
- package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
- package/src/plugins/builtin/dividend-yield/types.ts +4 -0
- package/src/plugins/builtin/dividend-yield/view.ts +23 -12
- package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
- package/src/plugins/builtin/earnings/headless.ts +7 -4
- package/src/plugins/builtin/earnings/history-model.ts +6 -4
- package/src/plugins/builtin/earnings/history-table.ts +4 -3
- package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
- package/src/plugins/builtin/econ/calendar-model.ts +16 -0
- package/src/plugins/builtin/econ/index.tsx +3 -0
- package/src/plugins/builtin/equity-screener/headless.ts +4 -1
- package/src/plugins/builtin/equity-screener/model.ts +7 -6
- package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
- package/src/plugins/builtin/exposure/model.ts +10 -0
- package/src/plugins/builtin/exposure/pane.tsx +10 -3
- package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
- package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
- package/src/plugins/builtin/fx-matrix/index.tsx +23 -5
- package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
- package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
- package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
- package/src/plugins/builtin/mna/detail.tsx +67 -6
- package/src/plugins/builtin/mna/headless.ts +128 -13
- package/src/plugins/builtin/mna/model.ts +219 -16
- package/src/plugins/builtin/mna/pane.tsx +34 -6
- package/src/plugins/builtin/money-markets/model.ts +14 -5
- package/src/plugins/builtin/money-markets/pane.tsx +4 -3
- package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
- package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
- package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
- package/src/plugins/builtin/pe-band/client.ts +13 -1
- package/src/plugins/builtin/pe-band/headless.ts +2 -2
- package/src/plugins/builtin/pe-band/model.ts +63 -10
- package/src/plugins/builtin/pe-band/pane.tsx +5 -5
- package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
- package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
- package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
- package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
- package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +5 -1
- package/src/plugins/builtin/research/event-model.ts +31 -13
- package/src/plugins/builtin/research/headless.ts +8 -1
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
- package/src/plugins/builtin/sectors/index.tsx +6 -9
- package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
- package/src/plugins/builtin/shared/earnings-report.ts +19 -4
- package/src/plugins/builtin/shared/report-freshness.ts +2 -3
- package/src/plugins/builtin/supply-chain/client.ts +34 -9
- package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
- package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
- package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
- package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
- package/src/plugins/builtin/supply-chain/headless.ts +19 -4
- package/src/plugins/builtin/supply-chain/model.ts +50 -6
- package/src/plugins/builtin/supply-chain/pane.tsx +76 -16
- package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +51 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +25 -14
- package/src/plugins/builtin/ticker-detail/overview/model.ts +17 -1
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +9 -2
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
- package/src/plugins/builtin/volatility/model.ts +17 -0
- package/src/plugins/builtin/volatility/pane.tsx +13 -4
- package/src/plugins/builtin/world-indices/index.tsx +2 -0
- package/src/plugins/builtin/world-indices/table.tsx +15 -0
- package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
- package/src/plugins/builtin/world-venue-map/headless.ts +28 -16
- package/src/plugins/builtin/world-venue-map/index.ts +19 -6
- package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
- package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
- package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
- package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
- package/src/plugins/builtin/world-venue-map/place.ts +119 -0
- package/src/plugins/catalog-data.ts +20 -0
- package/src/plugins/catalog-lazy.ts +51 -0
- package/src/plugins/catalog-ui.ts +16 -18
- package/src/plugins/host-smoke.ts +5 -2
- package/src/portfolio/allocation.ts +79 -19
- package/src/portfolio/cash-balances.ts +76 -0
- package/src/portfolio/mutations.ts +43 -8
- package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
- package/src/renderers/desktop/window-layouts.ts +14 -0
- package/src/renderers/dom/data-table/row.tsx +2 -0
- package/src/renderers/dom/host/tabs.tsx +57 -8
- package/src/renderers/dom/styles.css +13 -5
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
- package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
- package/src/renderers/electrobun/shared/protocol.ts +4 -0
- package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
- package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
- package/src/series/standalone-catalog.ts +5 -4
- package/src/series/standalone.ts +13 -7
- package/src/sources/gloomberb-cloud/index.ts +14 -3
- package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
- package/src/sources/provider-router/financials.ts +20 -13
- package/src/sources/provider-router/index.ts +4 -0
- package/src/sources/provider-router/search.ts +1 -0
- package/src/sync/collections-contributor.ts +3 -1
- package/src/sync/config-merge.ts +10 -1
- package/src/sync/sanitize.ts +26 -2
- package/src/tickers/company-name-listing.ts +16 -2
- package/src/tickers/listing-fate.ts +12 -8
- package/src/tickers/renamed-listings.ts +43 -10
- package/src/tickers/search/home-listing.ts +28 -0
- package/src/tickers/search/index.ts +19 -7
- package/src/tickers/terminal-codes.ts +11 -1
- package/src/time-series/resolve.ts +3 -1
- package/src/time-series/spec.ts +2 -2
- package/src/time-series/types.ts +1 -1
- package/src/types/data-provider.ts +11 -0
- package/src/types/financials.ts +39 -3
- package/src/types/ticker.ts +10 -2
- package/src/utils/cli-output.ts +1 -1
- package/src/utils/declared-dividends.ts +13 -1
- package/src/utils/dividend-cash.ts +5 -1
- package/src/utils/forward-dividend.ts +4 -3
- package/src/utils/remove-folder.ts +37 -0
- package/src/utils/trailing-dividend.ts +1 -1
- package/src/plugins/builtin/composite-plugins.ts +0 -285
|
@@ -10,6 +10,7 @@ import { PriceSparkline } from "../price-sparkline/view";
|
|
|
10
10
|
import { StatGrid, type StatItem } from "../ui/stat-grid";
|
|
11
11
|
import type { TableWidthColumn } from "../ui/table-layout";
|
|
12
12
|
import { CHART_COMPACT_ROWS, chartTableChromeRows, chartTableLayout, type ChartTableLayout } from "./layout";
|
|
13
|
+
import { useRemoteUiNode } from "../../remote/semantic-tree";
|
|
13
14
|
|
|
14
15
|
const DAY_MS = 86_400_000;
|
|
15
16
|
/** Daily series shorter than this still span two weeks, so the axis reads days, not hours. */
|
|
@@ -205,6 +206,14 @@ export function ChartTableHeader(props: ChartTableHeaderProps) {
|
|
|
205
206
|
const { width, query, chart } = props;
|
|
206
207
|
const colors = useThemeColors();
|
|
207
208
|
const layout = useChartTableLayout(props);
|
|
209
|
+
const essential = props.figures?.filter((item) => item.essential === true) ?? [];
|
|
210
|
+
useRemoteUiNode(essential.length ? {
|
|
211
|
+
role: "figure-layout", label: "Essential figures",
|
|
212
|
+
metadata: {
|
|
213
|
+
figures: essential.map(({ label, value }) => ({ label, value })),
|
|
214
|
+
omitted: essential.filter((item) => !layout.figures.includes(item)).map((item) => item.label),
|
|
215
|
+
},
|
|
216
|
+
} : null);
|
|
208
217
|
const series = chart?.series;
|
|
209
218
|
const viewport = useMemo(() => {
|
|
210
219
|
if (chart?.viewport || !series?.length) return chart?.viewport;
|
|
@@ -29,7 +29,6 @@ const TABLE_MIN_BODY_ROWS = 4;
|
|
|
29
29
|
const CHART_SHARE = 0.4;
|
|
30
30
|
/** Below this many body rows the figures keep a single row. */
|
|
31
31
|
const SHORT_BODY_ROWS = 12;
|
|
32
|
-
/** The figures never take more than this share of the body. */
|
|
33
32
|
const FIGURE_SHARE = 0.25;
|
|
34
33
|
/** The share of the body figures that wrap rather than cut a date may take, beyond FIGURE_SHARE. */
|
|
35
34
|
const WRAPPED_FIGURE_SHARE = 1 / 3;
|
|
@@ -96,7 +95,10 @@ function figureRows(figures: readonly StatItem[], width: number, maxLines: numbe
|
|
|
96
95
|
*/
|
|
97
96
|
function fitFigures(figures: readonly StatItem[], width: number, maxRows: number, body: number): { figures: StatItem[]; maxLines: number } {
|
|
98
97
|
const kept = [...figures];
|
|
99
|
-
while (kept.length > 0 && figureRows(kept, width, maxRows) > maxRows)
|
|
98
|
+
while (kept.length > 0 && figureRows(kept, width, maxRows) > maxRows) {
|
|
99
|
+
const optional = kept.findLastIndex((item) => item.essential !== true);
|
|
100
|
+
kept.splice(optional >= 0 ? optional : kept.length - 1, 1);
|
|
101
|
+
}
|
|
100
102
|
return { figures: kept, maxLines: maxRows > 1 ? Math.max(maxRows, Math.floor(body * WRAPPED_FIGURE_SHARE)) : maxRows };
|
|
101
103
|
}
|
|
102
104
|
|
|
@@ -106,23 +108,19 @@ function fitFigures(figures: readonly StatItem[], width: number, maxRows: number
|
|
|
106
108
|
*
|
|
107
109
|
* - The table always keeps its header and a few rows (all of them when it has
|
|
108
110
|
* fewer), so the rows the pane is about never vanish.
|
|
109
|
-
* - The figures take at most a quarter of the body, one row when it is short
|
|
110
|
-
* or when a second row would cost the chart its place, and lose items from
|
|
111
|
-
* the end rather than spill; a whole-row figure wraps onto a second line
|
|
112
|
-
* rather than cut its detail, in rows up to a third of the body, never
|
|
113
|
-
* at the cost of a figure that fits a line.
|
|
114
111
|
* - The chart takes 40% of what is left, or everything the table does not
|
|
115
112
|
* need when all its rows fit, so no blank band opens under a short table.
|
|
116
113
|
* - Below a readable chart the band becomes a one-row strip, then nothing.
|
|
117
114
|
*/
|
|
118
115
|
export function chartTableLayout(input: ChartTableLayoutInput): ChartTableLayout {
|
|
119
116
|
const body = Math.max(0, Math.floor(input.height) - (input.queryRows ?? 0));
|
|
120
|
-
const
|
|
117
|
+
const essential = (input.figures ?? []).filter((item) => item.essential === true);
|
|
118
|
+
const essentialRows = figureRows(essential, input.width, body);
|
|
119
|
+
const figureCap = Math.max(essentialRows, body < SHORT_BODY_ROWS ? 1 : Math.max(1, Math.floor(body * FIGURE_SHARE)));
|
|
121
120
|
const layout = layoutWithFigureRows(input, body, figureCap);
|
|
122
|
-
// A readable chart is worth more than a second row of figures.
|
|
123
121
|
if (layout.mode !== "full" && layout.figureRows > 1) {
|
|
124
122
|
const tighter = layoutWithFigureRows(input, body, 1);
|
|
125
|
-
if (tighter.mode === "full") return tighter;
|
|
123
|
+
if (tighter.mode === "full" && essential.every((item) => tighter.figures.includes(item))) return tighter;
|
|
126
124
|
}
|
|
127
125
|
// Without a full chart, rows a short table leaves go back to figures that
|
|
128
126
|
// were dropped, rather than to a blank band under the table.
|
|
@@ -145,7 +143,9 @@ function layoutWithFigureRows(input: ChartTableLayoutInput, body: number, figure
|
|
|
145
143
|
const tableFit = chrome + tableRows;
|
|
146
144
|
|
|
147
145
|
// A table with no room for a single row after the figures gets the body back.
|
|
148
|
-
const
|
|
146
|
+
const essentialRows = figureRows((input.figures ?? []).filter((item) => item.essential === true), width, body);
|
|
147
|
+
const figureBudget = Math.min(figureCap, Math.max(0, body - tableMin,
|
|
148
|
+
Math.min(Math.max(1, essentialRows), body - chrome - Math.min(tableRows, 1))));
|
|
149
149
|
const { figures, maxLines: figureMaxLines } = figureBudget > 0 ? fitFigures(input.figures ?? [], width, figureBudget, body) : { figures: [], maxLines: 0 };
|
|
150
150
|
const shownRows = figures.length ? figureRows(figures, width, figureMaxLines) : 0;
|
|
151
151
|
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
PaneTemplateDef,
|
|
6
6
|
ShortcutArgError,
|
|
7
7
|
} from "../../../types/plugin";
|
|
8
|
+
import { glossaryNamesFunction } from "../../../cli/glossary";
|
|
8
9
|
import { fuzzyFilter } from "../../../utils/fuzzy-search";
|
|
9
10
|
import { discoveryOpening } from "../../../utils/lookup-token";
|
|
10
11
|
import { summarizeError } from "../helpers";
|
|
@@ -295,6 +296,20 @@ function paneTemplateDiscovery(template: PaneTemplateDef, registry: Pick<PluginR
|
|
|
295
296
|
return (template.headless ?? registry.panes?.get(template.paneId)?.headless)?.discovery;
|
|
296
297
|
}
|
|
297
298
|
|
|
299
|
+
/**
|
|
300
|
+
* A row found by a query that is, whole, a term its function shows (`var`,
|
|
301
|
+
* `value at risk` for MARS and PORT), as `catalog` finds it, where the row's
|
|
302
|
+
* own words do not carry the query already; those rank as they did. A word of
|
|
303
|
+
* a longer query, or a loose alias, finds nothing.
|
|
304
|
+
*/
|
|
305
|
+
function withShownTerm(item: ResultItem, template: PaneTemplateDef, query: string): ResultItem {
|
|
306
|
+
const codes = [template.shortcut?.prefix, ...template.shortcut?.aliases ?? []];
|
|
307
|
+
if (!codes.some((code) => !!code && glossaryNamesFunction(code, query))) return item;
|
|
308
|
+
const own = `${item.label} ${item.searchText ?? ""} ${item.detail} ${item.right ?? ""}`.toLowerCase();
|
|
309
|
+
if (query.toLowerCase().split(/\s+/).every((word) => own.includes(word))) return item;
|
|
310
|
+
return { ...item, searchText: `${query} ${item.searchText ?? ""}` };
|
|
311
|
+
}
|
|
312
|
+
|
|
298
313
|
export function buildPaneShortcutItems(options: {
|
|
299
314
|
templates: readonly PaneTemplateDef[];
|
|
300
315
|
filterQuery?: string;
|
|
@@ -328,7 +343,8 @@ export function buildPaneShortcutItems(options: {
|
|
|
328
343
|
: options.createOptions,
|
|
329
344
|
showShortcut: true,
|
|
330
345
|
});
|
|
331
|
-
|
|
346
|
+
const named = opening && opening.argument && !item.disabled ? { ...item, name: opening.argument } : item;
|
|
347
|
+
return query ? withShownTerm(named, template, query) : named;
|
|
332
348
|
});
|
|
333
349
|
|
|
334
350
|
return options.filterQuery
|
|
@@ -77,8 +77,9 @@ function buildInstantAnswer(options: {
|
|
|
77
77
|
savedSymbolKeys: ReadonlySet<string>;
|
|
78
78
|
buildTickerSearchResultItems: (candidates: TickerSearchCandidate[], query: string) => ResultItem[];
|
|
79
79
|
localTickerSearchResultItems: (query?: string, options?: { category?: string; limit?: number }) => ResultItem[];
|
|
80
|
+
homeVenue?: string | null;
|
|
80
81
|
}): InstantAnswer | null {
|
|
81
|
-
const { query, fromIndex, cached, tickers, savedSymbolKeys, buildTickerSearchResultItems, localTickerSearchResultItems } = options;
|
|
82
|
+
const { query, fromIndex, cached, tickers, savedSymbolKeys, buildTickerSearchResultItems, localTickerSearchResultItems, homeVenue } = options;
|
|
82
83
|
const localItems = () => localTickerSearchResultItems(query, { limit: 6 });
|
|
83
84
|
if (cached) {
|
|
84
85
|
return { query, items: mergeTickerSearchResultItems(query, buildTickerSearchResultItems(withMajorCoinCandidate(query, cached, tickers), query), localItems()), fromIndex: false };
|
|
@@ -92,6 +93,7 @@ function buildInstantAnswer(options: {
|
|
|
92
93
|
tickers,
|
|
93
94
|
providerResults: known,
|
|
94
95
|
totalLimit: LISTING_SEARCH_LIMIT,
|
|
96
|
+
homeVenue,
|
|
95
97
|
...QUICK_LOOK_TICKER_SEARCH_OPTIONS,
|
|
96
98
|
}), tickers);
|
|
97
99
|
if (candidates.length === 0) return null;
|
|
@@ -133,6 +135,8 @@ export function useRootProviderSearch(options: {
|
|
|
133
135
|
categoryPriorities?: CommandBarCategoryPriorities;
|
|
134
136
|
currentRoute: CommandBarRoute | null;
|
|
135
137
|
dataProvider: DataProvider;
|
|
138
|
+
/** The venue of the user's own market, whose lines of the company a word names lead (`withHomeVenueLead`). */
|
|
139
|
+
homeVenue?: string | null;
|
|
136
140
|
localTickerSearchResultItems: (query?: string, options?: { category?: string; limit?: number }) => ResultItem[];
|
|
137
141
|
portfolios: AppState["config"]["portfolios"];
|
|
138
142
|
readTickerSearchCache: (
|
|
@@ -177,6 +181,7 @@ export function useRootProviderSearch(options: {
|
|
|
177
181
|
categoryPriorities,
|
|
178
182
|
currentRoute,
|
|
179
183
|
dataProvider,
|
|
184
|
+
homeVenue = null,
|
|
180
185
|
localTickerSearchResultItems,
|
|
181
186
|
portfolios,
|
|
182
187
|
readTickerSearchCache,
|
|
@@ -218,11 +223,13 @@ export function useRootProviderSearch(options: {
|
|
|
218
223
|
savedSymbolKeys,
|
|
219
224
|
buildTickerSearchResultItems,
|
|
220
225
|
localTickerSearchResultItems,
|
|
226
|
+
homeVenue,
|
|
221
227
|
});
|
|
222
228
|
// The index is read inside; its version says when what it knows changed.
|
|
223
229
|
}, [
|
|
224
230
|
buildTickerSearchResultItems,
|
|
225
231
|
currentRoute,
|
|
232
|
+
homeVenue,
|
|
226
233
|
listingIndexVersion,
|
|
227
234
|
listingSuffix,
|
|
228
235
|
localTickerSearchResultItems,
|
|
@@ -311,6 +318,7 @@ export function useRootProviderSearch(options: {
|
|
|
311
318
|
},
|
|
312
319
|
// The rows the CLI reads a symbol's listings from, so `CAR:` offers CAR Group on ASX (its eleventh).
|
|
313
320
|
totalLimit: LISTING_SEARCH_LIMIT,
|
|
321
|
+
homeVenue,
|
|
314
322
|
...QUICK_LOOK_TICKER_SEARCH_OPTIONS,
|
|
315
323
|
}));
|
|
316
324
|
if (requestId !== rootSearchRequestIdRef.current) return;
|
|
@@ -339,6 +347,7 @@ export function useRootProviderSearch(options: {
|
|
|
339
347
|
buildTickerSearchResultItems,
|
|
340
348
|
currentRoute,
|
|
341
349
|
dataProvider,
|
|
350
|
+
homeVenue,
|
|
342
351
|
localTickerSearchResultItems,
|
|
343
352
|
rootTickerSearchArg,
|
|
344
353
|
searchBrokerId,
|
|
@@ -15,6 +15,9 @@ import {
|
|
|
15
15
|
import { matchPrefix, type Command } from "../../commands/registry";
|
|
16
16
|
import { pastedRootList } from "../../commands/collection-list";
|
|
17
17
|
import { isCollectionCommand, SECURITY_DESCRIPTION_SEARCH } from "../../helpers";
|
|
18
|
+
|
|
19
|
+
/** A command's code that is a ticker's shape too: letters, as a US listing's symbol is written. */
|
|
20
|
+
const TICKER_SHAPED_CODE = /^[A-Z]{1,5}$/;
|
|
18
21
|
import { recentPaneTemplateArg } from "../../pane-templates/items";
|
|
19
22
|
import { dedupeById, PASTED_LIST_CATEGORY } from "../../view-model";
|
|
20
23
|
import type { ResultItem } from "../../list/model";
|
|
@@ -109,6 +112,27 @@ export interface RootResultModelOptions {
|
|
|
109
112
|
tickerActionItems: () => ResultItem[];
|
|
110
113
|
}
|
|
111
114
|
|
|
115
|
+
/**
|
|
116
|
+
* The row that opens a function's code as a ticker instead (`FB as a ticker`,
|
|
117
|
+
* `CATL as a ticker`): the security search for the code. Null for a code no
|
|
118
|
+
* ticker is written like, or with no security search to open.
|
|
119
|
+
*/
|
|
120
|
+
function tickerCodeItem(
|
|
121
|
+
code: string,
|
|
122
|
+
availableCommands: Command[],
|
|
123
|
+
openModeRoute: RootResultModelOptions["openModeRoute"],
|
|
124
|
+
): ResultItem | null {
|
|
125
|
+
if (!TICKER_SHAPED_CODE.test(code) || !availableCommands.some((command) => command.id === "security-description")) return null;
|
|
126
|
+
return {
|
|
127
|
+
id: `ticker-code:${code}`,
|
|
128
|
+
label: `${code} as a ticker`,
|
|
129
|
+
detail: "Open security details after resolving a ticker",
|
|
130
|
+
category: "Search",
|
|
131
|
+
kind: "command",
|
|
132
|
+
action: () => openModeRoute("ticker-search", code, SECURITY_DESCRIPTION_SEARCH),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
112
136
|
/** An in-flight or answered request keeps its rows even if the heuristic lapses. */
|
|
113
137
|
function isAssistSectionVisible(
|
|
114
138
|
assist: AssistRowHandlers,
|
|
@@ -340,13 +364,17 @@ export function buildRootResultModel(options: RootResultModelOptions): RootResul
|
|
|
340
364
|
}))
|
|
341
365
|
: [shortcutItem];
|
|
342
366
|
shortcutRuns = templateItems.some((item) => !item.disabled);
|
|
343
|
-
const
|
|
367
|
+
const codeAlone = rootQuery.trim().toUpperCase() === rootShortcutIntent.prefix;
|
|
368
|
+
const relatedTemplateItems = codeAlone
|
|
344
369
|
? paneShortcutItems({
|
|
345
370
|
filterQuery: rootQuery,
|
|
346
371
|
includePromptableTickerTemplates: true,
|
|
347
372
|
})
|
|
348
373
|
: [];
|
|
349
|
-
|
|
374
|
+
// CATL is Catalysts and CATL's own name for itself, as FB is Send Feedback and a ticker: the listing is the
|
|
375
|
+
// row under the function, which Enter still opens.
|
|
376
|
+
const tickerItem = codeAlone ? tickerCodeItem(rootShortcutIntent.prefix, availableCommands, openModeRoute) : null;
|
|
377
|
+
items.push(...templateItems, ...(tickerItem ? [tickerItem] : []), ...relatedTemplateItems);
|
|
350
378
|
} else if (
|
|
351
379
|
rootShortcutIntent.kind !== "none"
|
|
352
380
|
&& rootShortcutIntent.source === "plugin-command"
|
|
@@ -392,6 +420,10 @@ export function buildRootResultModel(options: RootResultModelOptions): RootResul
|
|
|
392
420
|
} else if (match && !match.command.hasArg) {
|
|
393
421
|
const item = commandToItem(match.command);
|
|
394
422
|
if (item) items.push(item);
|
|
423
|
+
// FB is Send Feedback and a ticker too (VF, SB and CR are companies): the ticker is the row under the command,
|
|
424
|
+
// which Enter still runs, for someone who typed the code meaning the listing.
|
|
425
|
+
const tickerItem = match.arg ? null : tickerCodeItem(rootQuery.trim().toUpperCase(), availableCommands, openModeRoute);
|
|
426
|
+
if (tickerItem) items.push(tickerItem);
|
|
395
427
|
} else if (!rootQuery) {
|
|
396
428
|
// One row per function: a code a group above already runs as it is (a
|
|
397
429
|
// recent CHAT, Start Here's PF) is not listed again in the groups below.
|
|
@@ -19,6 +19,7 @@ import { isProviderResultItem } from "./search-providers";
|
|
|
19
19
|
import { buildRootShortcutFeedback } from "./shortcut-feedback";
|
|
20
20
|
import { commandShortcutQuery, type ShortcutIntent } from "./shortcuts";
|
|
21
21
|
import { clampIndex } from "../../../../utils/math";
|
|
22
|
+
import { homeMarketVenue, systemTimeZone } from "../../../../market-data/market/header-market";
|
|
22
23
|
|
|
23
24
|
/** Written the way a symbol is: up to five letters and a share class (AAPL, nvda, BRK.B). */
|
|
24
25
|
const SYMBOL_SHAPED_QUERY = /^[A-Za-z]{1,5}(?:[.\-/][A-Za-z]{1,2})?$/;
|
|
@@ -190,6 +191,9 @@ export function useCommandBarRootRuntime({
|
|
|
190
191
|
const tickerSearchRouteQuery = currentRoute?.kind === "mode" && currentRoute.screen === "ticker-search"
|
|
191
192
|
? currentRoute.query
|
|
192
193
|
: null;
|
|
194
|
+
// The market the header shows is the desk's own: search leads with its lines of the company a word names.
|
|
195
|
+
const headerMarket = state.config.headerMarket;
|
|
196
|
+
const homeVenue = useMemo(() => homeMarketVenue(headerMarket, systemTimeZone()), [headerMarket]);
|
|
193
197
|
|
|
194
198
|
const {
|
|
195
199
|
tickerSearchPending,
|
|
@@ -200,6 +204,7 @@ export function useCommandBarRootRuntime({
|
|
|
200
204
|
buildTickerSearchResultItems,
|
|
201
205
|
dataProvider,
|
|
202
206
|
getTickers,
|
|
207
|
+
homeVenue,
|
|
203
208
|
localTickerSearchResultItems,
|
|
204
209
|
readTickerSearchCache,
|
|
205
210
|
routeQuery: tickerSearchRouteQuery,
|
|
@@ -300,7 +305,8 @@ export function useCommandBarRootRuntime({
|
|
|
300
305
|
if (rootTickerReading) return rootTickerReading.search;
|
|
301
306
|
const trimmed = rootQuery.trim();
|
|
302
307
|
const symbolQuery = symbolSearchQuery(trimmed);
|
|
303
|
-
|
|
308
|
+
// One letter is too little to be worth a search; one digit is a Hong Kong code as people type it (5 is HSBC's 0005).
|
|
309
|
+
if (symbolQuery.length < 2 && !/^\d$/.test(symbolQuery)) return null;
|
|
304
310
|
const normalizedQuery = normalizeCommandTickerSearchText(symbolQuery);
|
|
305
311
|
// The install row for "TV" is labelled TV, but it leads on purpose and
|
|
306
312
|
// must not keep Grupo Televisa out of the list.
|
|
@@ -331,6 +337,7 @@ export function useCommandBarRootRuntime({
|
|
|
331
337
|
categoryPriorities: providerCategoryPriorities,
|
|
332
338
|
currentRoute,
|
|
333
339
|
dataProvider,
|
|
340
|
+
homeVenue,
|
|
334
341
|
localTickerSearchResultItems,
|
|
335
342
|
portfolios: state.config.portfolios,
|
|
336
343
|
readTickerSearchCache,
|
|
@@ -17,6 +17,8 @@ export function useTickerSearchRouteResults(options: {
|
|
|
17
17
|
buildTickerSearchResultItems: (candidates: TickerSearchCandidate[], query: string) => ResultItem[];
|
|
18
18
|
dataProvider: DataProvider;
|
|
19
19
|
getTickers: () => AppState["tickers"];
|
|
20
|
+
/** The venue of the user's own market, whose lines of the company a word names lead. */
|
|
21
|
+
homeVenue?: string | null;
|
|
20
22
|
localTickerSearchResultItems: (query?: string, options?: { category?: string; limit?: number }) => ResultItem[];
|
|
21
23
|
readTickerSearchCache: (
|
|
22
24
|
query: string,
|
|
@@ -41,6 +43,7 @@ export function useTickerSearchRouteResults(options: {
|
|
|
41
43
|
buildTickerSearchResultItems,
|
|
42
44
|
dataProvider,
|
|
43
45
|
getTickers,
|
|
46
|
+
homeVenue,
|
|
44
47
|
localTickerSearchResultItems,
|
|
45
48
|
readTickerSearchCache,
|
|
46
49
|
routeQuery,
|
|
@@ -104,6 +107,7 @@ export function useTickerSearchRouteResults(options: {
|
|
|
104
107
|
},
|
|
105
108
|
// The rows the CLI's search reads, so CAR Group on ASX (CAR's eleventh row) is offered too.
|
|
106
109
|
totalLimit: LISTING_SEARCH_LIMIT,
|
|
110
|
+
homeVenue,
|
|
107
111
|
...QUICK_LOOK_TICKER_SEARCH_OPTIONS,
|
|
108
112
|
});
|
|
109
113
|
if (requestId !== searchRequestIdRef.current) return;
|
|
@@ -137,6 +141,7 @@ export function useTickerSearchRouteResults(options: {
|
|
|
137
141
|
buildTickerSearchResultItems,
|
|
138
142
|
dataProvider,
|
|
139
143
|
getTickers,
|
|
144
|
+
homeVenue,
|
|
140
145
|
localTickerSearchResultItems,
|
|
141
146
|
readTickerSearchCache,
|
|
142
147
|
resetTickerSearchRoute,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useEffect, useRef } from "react";
|
|
2
2
|
import { t, tf } from "../../../i18n";
|
|
3
|
+
import { AlertListingRefusal, resolveAlertListing } from "../../../cli/alert-listing";
|
|
3
4
|
import { extendedSessionLineLabel, getLatestPrintDisplay, type SessionPriceDisplay } from "../../../market-data/market/status";
|
|
4
|
-
import type {
|
|
5
|
+
import type { ListingDeps } from "../../../tickers/listing-venues";
|
|
5
6
|
import type { Quote } from "../../../types/financials";
|
|
6
7
|
import { coerceFieldString } from "../helpers";
|
|
7
8
|
import type {
|
|
@@ -45,10 +46,14 @@ function formatAlertWorkflowQuote(quote: Quote, print: SessionPriceDisplay): str
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
function summarizeAlertWorkflowQuoteError(symbol: string, error: unknown): string {
|
|
49
|
+
if (error instanceof AlertListingRefusal) return error.details ? `${error.reason} ${error.details}` : error.reason;
|
|
48
50
|
if (error instanceof Error && error.message.trim()) return error.message;
|
|
49
51
|
return tf('No quote found for "{symbol}".', { symbol });
|
|
50
52
|
}
|
|
51
53
|
|
|
54
|
+
/** How long typing rests before the symbol is read: a company's name is a search, not one quote. */
|
|
55
|
+
const ALERT_WORKFLOW_READ_DELAY_MS = 250;
|
|
56
|
+
|
|
52
57
|
function updateAlertWorkflowFieldDescriptions(
|
|
53
58
|
fields: CommandBarWorkflowField[],
|
|
54
59
|
descriptions: Partial<Record<"symbol" | "price", string | undefined>>,
|
|
@@ -63,14 +68,17 @@ function updateAlertWorkflowFieldDescriptions(
|
|
|
63
68
|
/**
|
|
64
69
|
* Add Alert checks the symbol as it is typed, shows the quote under it and
|
|
65
70
|
* fills the target from the current price until the user types their own. Run
|
|
66
|
-
* by every form, which owns the values; it acts only in Add Alert's.
|
|
71
|
+
* by every form, which owns the values; it acts only in Add Alert's. The
|
|
72
|
+
* symbol is read as Add Alert and `alerts add` read it (`resolveAlertListing`):
|
|
73
|
+
* a company's name finds its listing, a listing that stopped trading says
|
|
74
|
+
* why it is refused, and a symbol its company left says where it went.
|
|
67
75
|
*/
|
|
68
76
|
export function useAlertWorkflowQuoteSync({
|
|
69
|
-
|
|
77
|
+
listingDeps,
|
|
70
78
|
route,
|
|
71
79
|
updateRoute,
|
|
72
80
|
}: {
|
|
73
|
-
|
|
81
|
+
listingDeps: ListingDeps;
|
|
74
82
|
route: CommandBarWorkflowRoute;
|
|
75
83
|
updateRoute: (updater: (route: CommandBarWorkflowRoute) => CommandBarWorkflowRoute) => void;
|
|
76
84
|
}): void {
|
|
@@ -122,8 +130,8 @@ export function useAlertWorkflowQuoteSync({
|
|
|
122
130
|
};
|
|
123
131
|
});
|
|
124
132
|
|
|
125
|
-
void
|
|
126
|
-
.then((quote) => {
|
|
133
|
+
const read = () => void resolveAlertListing(alertWorkflowSymbol, null, listingDeps)
|
|
134
|
+
.then(({ quote, fate }) => {
|
|
127
135
|
if (quoteRequestRef.current !== requestId) return;
|
|
128
136
|
// An alert is judged on the latest print, extended hours included: the target starts there.
|
|
129
137
|
const print = getLatestPrintDisplay(quote);
|
|
@@ -147,7 +155,8 @@ export function useAlertWorkflowQuoteSync({
|
|
|
147
155
|
...route,
|
|
148
156
|
values: nextValues,
|
|
149
157
|
fields: updateAlertWorkflowFieldDescriptions(route.fields, {
|
|
150
|
-
symbol
|
|
158
|
+
// What became of the symbol goes under its quote, which names the listing: FB is a fund now, and Meta trades as META.
|
|
159
|
+
symbol: [formatAlertWorkflowQuote(quote, print), ...fate].join("\n"),
|
|
151
160
|
price: tf("Current price {price}; edit to set the target.", { price: formatAlertWorkflowCurrentPrice(print) }),
|
|
152
161
|
}),
|
|
153
162
|
payloadMeta: {
|
|
@@ -180,5 +189,7 @@ export function useAlertWorkflowQuoteSync({
|
|
|
180
189
|
};
|
|
181
190
|
});
|
|
182
191
|
});
|
|
183
|
-
|
|
192
|
+
const timer = setTimeout(read, ALERT_WORKFLOW_READ_DELAY_MS);
|
|
193
|
+
return () => clearTimeout(timer);
|
|
194
|
+
}, [alertWorkflowActive, alertWorkflowSymbol, listingDeps, updateRoute]);
|
|
184
195
|
}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import type { ScrollBoxRenderable } from "../../ui";
|
|
12
12
|
import { useBeforeShortcut, useShortcut } from "../../react/input";
|
|
13
13
|
import { isPlainKey, isPlainKeyboardEvent } from "../../utils/keyboard";
|
|
14
|
-
import { DataTable, PaneStatusBody, type DataTableColumn, type DataTableProps, type PaneStatusBodyProps } from "../ui";
|
|
14
|
+
import { DataTable, PaneStatusBody, RowNote, type DataTableColumn, type DataTableProps, type NoticeProps, type PaneStatusBodyProps } from "../ui";
|
|
15
15
|
import { useDataTableSortMenu } from "./sort-menu";
|
|
16
16
|
import { useDataTableColumnMenuItems } from "./column-menu";
|
|
17
17
|
import { drawnTableColumns, tableFreezesFirstColumn, tableRevealLeft, tableScrollStep } from "../ui/table-layout";
|
|
@@ -146,6 +146,14 @@ export interface DataTableViewProps<
|
|
|
146
146
|
continuesRowAbove?: (item: T, index: number) => boolean;
|
|
147
147
|
rootBefore?: ReactNode;
|
|
148
148
|
rootAfter?: ReactNode;
|
|
149
|
+
/**
|
|
150
|
+
* What concerns one row, said under the table while that row is selected
|
|
151
|
+
* (`RowNote`): the whole reason behind the few words the row shows, such as
|
|
152
|
+
* a name a screen could not price or a peer whose figures are stale. Null
|
|
153
|
+
* for a row with nothing to say. A note about one row never goes in the
|
|
154
|
+
* footer, whose notes are the pane's (docs/pane-conventions.md, Row messages).
|
|
155
|
+
*/
|
|
156
|
+
rowNote?: (item: T, index: number) => string | { text: string; tone: NonNullable<NoticeProps["tone"]> } | null | undefined;
|
|
149
157
|
/**
|
|
150
158
|
* Replaces the table (header and rows) with a loading, error or empty
|
|
151
159
|
* state while `rootBefore` stays. Precedence is the caller's, as with
|
|
@@ -200,6 +208,7 @@ export function DataTableView<
|
|
|
200
208
|
continuesRowAbove,
|
|
201
209
|
rootBefore,
|
|
202
210
|
rootAfter,
|
|
211
|
+
rowNote,
|
|
203
212
|
status,
|
|
204
213
|
rootWidth,
|
|
205
214
|
rootHeight,
|
|
@@ -846,6 +855,10 @@ export function DataTableView<
|
|
|
846
855
|
}
|
|
847
856
|
});
|
|
848
857
|
|
|
858
|
+
// The selected row's note follows the cursor, as the row's highlight does.
|
|
859
|
+
const selectedItem = rowNote && effectiveSelectedIndex >= 0 && !bodyStatusShown(status) ? tableProps.items[effectiveSelectedIndex] : undefined;
|
|
860
|
+
const note = selectedItem !== undefined ? rowNote!(selectedItem, effectiveSelectedIndex) : null;
|
|
861
|
+
const noteView = note ? typeof note === "string" ? <RowNote>{note}</RowNote> : <RowNote tone={note.tone}>{note.text}</RowNote> : null;
|
|
849
862
|
return (
|
|
850
863
|
<TableViewFrame
|
|
851
864
|
width={rootWidth}
|
|
@@ -853,7 +866,7 @@ export function DataTableView<
|
|
|
853
866
|
fit={tableProps.fitRows}
|
|
854
867
|
backgroundColor={rootBackgroundColor}
|
|
855
868
|
before={rootBefore}
|
|
856
|
-
after={rootAfter}
|
|
869
|
+
after={noteView ? <>{rootAfter}{noteView}</> : rootAfter}
|
|
857
870
|
>
|
|
858
871
|
{bodyStatusShown(status) ? <PaneStatusBody {...status} /> : <DataTable<T, C>
|
|
859
872
|
{...tableProps}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment, useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
1
|
+
import { Fragment, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { apiClient } from "../../api-client";
|
|
3
3
|
import type { SignedInBroker } from "../../brokers/signed-in/client";
|
|
4
4
|
import { runBrokerSignIn, type BrokerSignInOutcome } from "../../brokers/signed-in/sign-in";
|
|
@@ -274,8 +274,10 @@ export function FormModalContent({
|
|
|
274
274
|
|
|
275
275
|
// Effects that follow what is typed run here, with the values, and each
|
|
276
276
|
// acts only in the form it belongs to, going by its workflow id.
|
|
277
|
+
const { dataProvider, tickerRepository } = runtime.getDeps();
|
|
278
|
+
const alertListingDeps = useMemo(() => ({ dataProvider, store: tickerRepository }), [dataProvider, tickerRepository]);
|
|
277
279
|
useAlertWorkflowQuoteSync({
|
|
278
|
-
|
|
280
|
+
listingDeps: alertListingDeps,
|
|
279
281
|
route,
|
|
280
282
|
updateRoute,
|
|
281
283
|
});
|
|
@@ -433,8 +435,11 @@ export function FormModalContent({
|
|
|
433
435
|
),
|
|
434
436
|
});
|
|
435
437
|
}
|
|
436
|
-
if (
|
|
437
|
-
|
|
438
|
+
if (!mountedRef.current) return;
|
|
439
|
+
if (applied) moveOn(field.id);
|
|
440
|
+
// The picker held the keyboard: give it back to the form's field, or keys go to the panes under the form.
|
|
441
|
+
requestInputFocus();
|
|
442
|
+
}, [desktop, dialog, moveOn, requestInputFocus, setValue]);
|
|
438
443
|
|
|
439
444
|
const modalWidth = Math.min(width, Math.max(1, viewport.width - 2));
|
|
440
445
|
const contentWidth = Math.max(10, modalWidth - TERMINAL_DIALOG_INSET);
|
package/src/components/index.ts
CHANGED
|
@@ -138,7 +138,7 @@ export {
|
|
|
138
138
|
DetailScrollBody, DialogFrame, DisclosureMarker, Divider, EmptyState, ExternalLink, ExternalLinkText, FieldGrid, FieldLabel,
|
|
139
139
|
fieldFrameStyle, fieldGridColumns, FRAMED_TEXTAREA_DESKTOP_STYLE, fieldGridRows, FigureList, getMessageComposerBlockHeight, GridFieldView, Icon, ICON_GLYPHS,
|
|
140
140
|
IconButton, InlineQuickAddRow, KeyValueRow, ListView, loadingText, Menu, MenuPopover,
|
|
141
|
-
MessageComposer, MultiSelectDialogButton, MultiSelectDialogContent, Notice, NumberField,
|
|
141
|
+
MessageComposer, MultiSelectDialogButton, MultiSelectDialogContent, Notice, NumberField, RowNote,
|
|
142
142
|
NumberPromptDialog, openUrl, PageStackView, PaneLinkMenu, PaneStatusBody, Popover, Prose,
|
|
143
143
|
QueryBar, RangeTrack, RatioBar, READING_WIDTH, RemoteImage, Section, SectionHeading, SegmentedControl, SelectButton, ShortcutHint,
|
|
144
144
|
Spinner, StatGrid, statGridColumns, statGridRows, Tabs, TextField, TextPromptDialog, unavailableText,
|
|
@@ -865,8 +865,10 @@ function HeaderHelpButton({ nativePaneChrome, onPress }: { nativePaneChrome: boo
|
|
|
865
865
|
export function Header({
|
|
866
866
|
onOpenHelp,
|
|
867
867
|
onRestartForUpdate,
|
|
868
|
+
commandInputAvailable = true,
|
|
868
869
|
}: {
|
|
869
870
|
onOpenHelp?: () => void;
|
|
871
|
+
commandInputAvailable?: boolean;
|
|
870
872
|
/** Applies a downloaded desktop update and relaunches; the header offers Restart only when it is given. */
|
|
871
873
|
onRestartForUpdate?: () => void;
|
|
872
874
|
}) {
|
|
@@ -893,7 +895,7 @@ export function Header({
|
|
|
893
895
|
let updateStatusColumns = Math.max(
|
|
894
896
|
0,
|
|
895
897
|
prompt.updateColumns
|
|
896
|
-
- (onOpenHelp ? terminalButtonColumns(helpButtonProps()) + TERMINAL_HELP_PADDING_COLUMNS : 0)
|
|
898
|
+
- (commandInputAvailable && onOpenHelp ? terminalButtonColumns(helpButtonProps()) + TERMINAL_HELP_PADDING_COLUMNS : 0)
|
|
897
899
|
- UPDATE_SLOT_PADDING_COLUMNS * (titleBarOverlay ? 2 : 1),
|
|
898
900
|
);
|
|
899
901
|
// Short of that, the closed prompt gives the status its empty room, down to
|
|
@@ -928,7 +930,9 @@ export function Header({
|
|
|
928
930
|
dispatch({ type: "SET_COMMAND_BAR", open: true, query: "" });
|
|
929
931
|
}, [dispatch]);
|
|
930
932
|
|
|
931
|
-
|
|
933
|
+
// An open bar always has its input, whatever opened it: without one, what
|
|
934
|
+
// the user types or pastes goes nowhere and Enter runs the first suggestion.
|
|
935
|
+
const commandPrompt = commandInputAvailable || commandBarOpen ? (
|
|
932
936
|
<HeaderCommandPrompt
|
|
933
937
|
nativePaneChrome={nativePaneChrome}
|
|
934
938
|
onOpen={openCommandBar}
|
|
@@ -936,7 +940,7 @@ export function Header({
|
|
|
936
940
|
shortcutLabel={shortcutLabel}
|
|
937
941
|
width={promptWidth}
|
|
938
942
|
/>
|
|
939
|
-
)
|
|
943
|
+
) : <Box width={promptWidth} />;
|
|
940
944
|
const marketSummary = prompt.marketColumns > 0
|
|
941
945
|
? <HeaderMarketSummary nativePaneChrome={nativePaneChrome} width={prompt.marketColumns} />
|
|
942
946
|
: null;
|
|
@@ -982,7 +986,7 @@ export function Header({
|
|
|
982
986
|
<UpdateStatus columns={updateStatusColumns} onRestart={onRestartForUpdate} status={updateStatus} />
|
|
983
987
|
</Box>
|
|
984
988
|
)}
|
|
985
|
-
{onOpenHelp ? <HeaderHelpButton nativePaneChrome onPress={onOpenHelp} /> : null}
|
|
989
|
+
{commandInputAvailable && onOpenHelp ? <HeaderHelpButton nativePaneChrome onPress={onOpenHelp} /> : null}
|
|
986
990
|
{marketSummary}
|
|
987
991
|
{showWindowControls ? <Box flexShrink={0} width={`${WINDOWS_CONTROL_GROUP_WIDTH_PX}px`} /> : null}
|
|
988
992
|
{showWindowControls ? <WindowControls /> : null}
|
|
@@ -1006,7 +1010,7 @@ export function Header({
|
|
|
1006
1010
|
<UpdateStatus columns={updateStatusColumns} onRestart={onRestartForUpdate} status={updateStatus} />
|
|
1007
1011
|
</Box>
|
|
1008
1012
|
)}
|
|
1009
|
-
{onOpenHelp ? <HeaderHelpButton nativePaneChrome={nativePaneChrome} onPress={onOpenHelp} /> : null}
|
|
1013
|
+
{commandInputAvailable && onOpenHelp ? <HeaderHelpButton nativePaneChrome={nativePaneChrome} onPress={onOpenHelp} /> : null}
|
|
1010
1014
|
{marketSummary}
|
|
1011
1015
|
{showWindowControls ? <WindowControls /> : null}
|
|
1012
1016
|
</Box>
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { createContext, useContext } from "react";
|
|
2
2
|
|
|
3
|
+
export const PaneCaptureContext = createContext(false);
|
|
4
|
+
|
|
5
|
+
export function usePaneCapture(): boolean {
|
|
6
|
+
return useContext(PaneCaptureContext);
|
|
7
|
+
}
|
|
8
|
+
|
|
3
9
|
/**
|
|
4
10
|
* True inside a `gloom shot` whose status line dates the pane's data: the
|
|
5
11
|
* pane's own `as of` text (a query bar's `asOf`) is left out, so the date is
|
|
@@ -166,6 +166,8 @@ function SegmentView({ segment, focused }: { segment: PaneFooterSegment; focused
|
|
|
166
166
|
onMouseDown={interactive ? startSegmentPress : undefined}
|
|
167
167
|
onMouseUp={interactive ? finishSegmentPress : undefined}
|
|
168
168
|
{...(interactive ? { "data-gloom-interactive": "true" } : {})}
|
|
169
|
+
// A capture reads the pane's state from its body: the notes about its data are not that state.
|
|
170
|
+
{...(!segment.icon && segment.notes?.length ? { "data-gloom-role": "pane-footer-notes" } : {})}
|
|
169
171
|
>
|
|
170
172
|
{[
|
|
171
173
|
...segment.parts.map((part, index) => (
|