@gloom-sh/terminal 0.20.10 → 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/patches/@opentui%2Fcore@0.3.2.patch +16 -0
- 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 +366 -0
- package/src/api-client/socket-features.ts +75 -0
- package/src/api-client/socket-frames.ts +161 -0
- package/src/api-client/socket-listeners.ts +207 -0
- package/src/api-client/socket-quotes.ts +332 -0
- package/src/api-client/socket.ts +168 -983
- 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/brokers/signed-in/adapter.ts +19 -5
- package/src/brokers/signed-in/client.ts +13 -1
- package/src/brokers/signed-in/sign-in-dialog.tsx +33 -9
- 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/chart/native/kitty/manager.ts +2 -0
- package/src/components/chart/native/surface/manager.ts +211 -11
- package/src/components/command-bar/action-runtime.ts +2 -0
- package/src/components/command-bar/panel/index.tsx +2 -13
- package/src/components/command-bar/panel/layout.ts +1 -7
- package/src/components/command-bar/panel/runtime.ts +0 -1
- package/src/components/command-bar/panel/types.ts +0 -2
- 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/data-table/column-menu.tsx +89 -0
- package/src/components/data-table/sort-menu.tsx +9 -2
- package/src/components/data-table/view.tsx +33 -6
- package/src/components/form-modal/content.tsx +10 -0
- package/src/components/index.ts +1 -1
- 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/footer/index.tsx +25 -11
- package/src/components/layout/pane/footer/model.ts +62 -20
- package/src/components/layout/pane/header.tsx +140 -31
- package/src/components/layout/pane/sidebar.tsx +138 -20
- package/src/components/layout/pane/status-footer.ts +3 -1
- package/src/components/layout/shell/active-drag.ts +18 -13
- package/src/components/layout/shell/drag/magnets.ts +34 -18
- 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/ticker/list-table-view.tsx +5 -0
- package/src/components/ui/button.tsx +48 -4
- package/src/components/ui/data-table/column-order.ts +180 -0
- package/src/components/ui/data-table/index.tsx +12 -1
- package/src/components/ui/data-table/opentui/index.tsx +291 -32
- package/src/components/ui/data-table/opentui/model.ts +43 -4
- package/src/components/ui/data-table/types.ts +56 -0
- package/src/components/ui/data-table/use-column-order.ts +135 -0
- package/src/components/ui/index.ts +1 -1
- 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/components/ui/table-layout.ts +120 -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/docs/snapshot.json +3 -2
- package/src/i18n/es.ts +2 -0
- package/src/i18n/ja.ts +2 -0
- package/src/i18n/ko.ts +2 -0
- package/src/i18n/zh-cn.ts +2 -0
- package/src/i18n/zh-tw.ts +2 -0
- package/src/layout/pane-manager/dock-tree.ts +19 -0
- package/src/layout/pane-manager/index.ts +3 -0
- package/src/market-data/coordinator/index.ts +4 -3
- package/src/market-data/coordinator/quotes.ts +12 -4
- 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 +31 -0
- package/src/market-data/quotes/live-valuation.ts +32 -5
- package/src/market-data/quotes/regular-session-valuation.ts +1 -1
- 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/detail.tsx +5 -3
- package/src/plugins/builtin/broker-manager/index.tsx +7 -6
- package/src/plugins/builtin/broker-manager/model.ts +15 -6
- package/src/plugins/builtin/broker-manager/pane-actions.tsx +11 -4
- package/src/plugins/builtin/broker-manager/sign-in-end.ts +50 -19
- package/src/plugins/builtin/broker-manager/table.ts +10 -4
- 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 +35 -19
- package/src/plugins/builtin/cloud/askg/pane.tsx +4 -0
- package/src/plugins/builtin/cloud/askg/tool-timeline.tsx +2 -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/equity-screener/live.ts +74 -18
- package/src/plugins/builtin/equity-screener/model.ts +19 -4
- package/src/plugins/builtin/equity-screener/pane.tsx +19 -14
- package/src/plugins/builtin/equity-screener/refresh-anchor.ts +45 -0
- package/src/plugins/builtin/equity-screener/results.ts +22 -2
- package/src/plugins/builtin/equity-screener/screen-check.ts +9 -3
- 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/futures/index.tsx +15 -1
- package/src/plugins/builtin/futures/table.tsx +1 -1
- package/src/plugins/builtin/fx-matrix/index.tsx +32 -19
- package/src/plugins/builtin/holders/pane.tsx +30 -20
- package/src/plugins/builtin/insider/table.tsx +10 -7
- package/src/plugins/builtin/insider/tickers.tsx +1 -1
- package/src/plugins/builtin/iv-history/events.ts +5 -0
- package/src/plugins/builtin/iv-history/headless.ts +15 -9
- package/src/plugins/builtin/jobs/index.tsx +1 -0
- package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -0
- package/src/plugins/builtin/macro-day/headless.ts +15 -6
- 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 +3 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
- package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
- package/src/plugins/builtin/perps/cascade-tabs.tsx +2 -1
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -31
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +19 -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 +15 -1
- package/src/plugins/builtin/rate-path/pane.tsx +2 -0
- package/src/plugins/builtin/realized-vol/headless.ts +28 -2
- package/src/plugins/builtin/revenue-breakdown/pane.tsx +2 -0
- package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -1
- package/src/plugins/builtin/risk-factors/index.tsx +1 -0
- package/src/plugins/builtin/seasonality/pane.tsx +2 -1
- 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/thirteenf/pane.tsx +2 -0
- package/src/plugins/builtin/ticker-detail/financials/model.ts +28 -6
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +26 -9
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +58 -35
- 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 +6 -3
- package/src/plugins/builtin/vol-surface/pane.tsx +7 -3
- package/src/plugins/builtin/world-indices/index.tsx +5 -1
- package/src/plugins/builtin/yield-curve/index.tsx +2 -1
- 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/data-table/column-drag.ts +147 -0
- package/src/renderers/dom/data-table/index.tsx +22 -0
- package/src/renderers/dom/data-table/row.tsx +27 -5
- 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 +47 -5
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -1
- package/src/renderers/opentui/chart-surface.tsx +1 -0
- package/src/renderers/opentui/frame-hits.ts +33 -0
- package/src/renderers/opentui/host.tsx +2 -0
- package/src/renderers/opentui/native-surface.ts +14 -21
- package/src/renderers/opentui/test-utils.tsx +3 -0
- 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 +46 -1
- package/src/state/pane-unsent-work.ts +47 -0
- package/src/test-support/app-store.ts +24 -1
- 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/time-series/live-quotes.ts +3 -9
- 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 +24 -0
- package/src/ui/pointer-drag.ts +11 -2
- package/src/utils/double-escape-close.ts +42 -0
- package/src/utils/fundamentals.ts +14 -3
- package/src/utils/fx-status.ts +30 -7
- package/src/utils/network-failure.ts +23 -0
- package/src/utils/share-multiples.cases.json +780 -2
- package/src/utils/share-multiples.ts +154 -24
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Dispatch } from "react";
|
|
2
|
-
import type
|
|
2
|
+
import { appReducer, type AppAction, type AppContextStoreValue, type AppState } from "../state/app/context";
|
|
3
3
|
|
|
4
4
|
const ignoreAction: Dispatch<AppAction> = () => {};
|
|
5
5
|
const noUnsubscribe = () => {};
|
|
@@ -19,3 +19,26 @@ export function createStaticAppStore(
|
|
|
19
19
|
subscribe: () => noUnsubscribe,
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* An `AppContext` value that runs the app's reducer on every dispatch and
|
|
25
|
+
* notifies its subscribers, for a suite that checks what the app's own
|
|
26
|
+
* actions did to the state (a pane setting written, a layout saved).
|
|
27
|
+
*/
|
|
28
|
+
export function createReducerAppStore(state: AppState): AppContextStoreValue {
|
|
29
|
+
let current = state;
|
|
30
|
+
const listeners = new Set<() => void>();
|
|
31
|
+
return {
|
|
32
|
+
dispatch: (action) => {
|
|
33
|
+
current = appReducer(current, action);
|
|
34
|
+
for (const listener of listeners) listener();
|
|
35
|
+
},
|
|
36
|
+
getState: () => current,
|
|
37
|
+
subscribe: (listener) => {
|
|
38
|
+
listeners.add(listener);
|
|
39
|
+
return () => {
|
|
40
|
+
listeners.delete(listener);
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -14,6 +14,7 @@ export function TestShellPaneKeys(options: Partial<ShellPaneKeyOptions> & { focu
|
|
|
14
14
|
askAboutFocusedPane: none,
|
|
15
15
|
cancelActiveDrag: () => {},
|
|
16
16
|
closeAllFloatingPanes: none,
|
|
17
|
+
closeFocusedFloatingPane: none,
|
|
17
18
|
closeFocusedPane: none,
|
|
18
19
|
copyFocusedPaneScreenshot: none,
|
|
19
20
|
exportFocusedPaneCsv: none,
|
|
@@ -26,11 +27,15 @@ export function TestShellPaneKeys(options: Partial<ShellPaneKeyOptions> & { focu
|
|
|
26
27
|
overlayOpen: false,
|
|
27
28
|
popOutFocusedPane: none,
|
|
28
29
|
shareFocusedPane: none,
|
|
30
|
+
showAdjacentStackTab: none,
|
|
29
31
|
startWindowMode: () => {},
|
|
30
32
|
toggleFocusedPaneFullscreen: none,
|
|
31
33
|
toggleFocusedPaneFloating: none,
|
|
32
34
|
toggleFocusedPaneNewLayout: none,
|
|
33
35
|
...options,
|
|
36
|
+
// Esc Esc closes as the shell's close does unless the test passes its own.
|
|
37
|
+
closeFocusedPaneOnEscape: options.closeFocusedPaneOnEscape
|
|
38
|
+
?? (options.closeFocusedPane ? () => options.closeFocusedPane!({ focusNextFloating: true }) : none),
|
|
34
39
|
});
|
|
35
40
|
return null;
|
|
36
41
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { afterAll, afterEach, beforeEach } from "bun:test";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The paths a running app reports itself on: crash reports and usage counts
|
|
5
|
+
* (`/telemetry/`), research activity (`/activity/`) and command-search reports
|
|
6
|
+
* (`/assist/searches`). The web app reaches them under `/api`.
|
|
7
|
+
*/
|
|
8
|
+
const TELEMETRY_PATH = /^(?:\/api)?\/(?:telemetry\/|activity\/|assist\/searches$)/;
|
|
9
|
+
|
|
10
|
+
/** Whether a request is one the app sends about itself, on any host but the machine's own. */
|
|
11
|
+
function isTelemetryRequest(input: RequestInfo | URL): boolean {
|
|
12
|
+
try {
|
|
13
|
+
const url = new URL(input instanceof Request ? input.url : String(input));
|
|
14
|
+
if (url.hostname === "127.0.0.1" || url.hostname === "localhost" || url.hostname === "[::1]") return false;
|
|
15
|
+
return TELEMETRY_PATH.test(url.pathname);
|
|
16
|
+
} catch {
|
|
17
|
+
// Intentional ignore: a relative or malformed URL names no telemetry endpoint.
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const attempts: string[] = [];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Tests never send usage counts or crash reports: `test-env.ts` turns them off
|
|
26
|
+
* for the whole process and for every process a test starts. A test that
|
|
27
|
+
* checks telemetry itself opts in and stubs the transport
|
|
28
|
+
* (`setCloudApiFetchTransport`), so nothing reaches `globalThis.fetch`.
|
|
29
|
+
*
|
|
30
|
+
* This is the net under that: a telemetry request that does reach the real
|
|
31
|
+
* `fetch` is refused and fails the test running when it was made (a fire and
|
|
32
|
+
* forget caller swallows the refusal, so throwing alone would pass), or the
|
|
33
|
+
* run's final check when it was made after the last test.
|
|
34
|
+
*/
|
|
35
|
+
const realFetch = globalThis.fetch;
|
|
36
|
+
const guardedFetch = Object.assign(
|
|
37
|
+
(input: RequestInfo | URL, init?: RequestInit) => {
|
|
38
|
+
if (isTelemetryRequest(input)) {
|
|
39
|
+
const url = input instanceof Request ? input.url : String(input);
|
|
40
|
+
attempts.push(`${init?.method ?? (input instanceof Request ? input.method : "GET")} ${url}`);
|
|
41
|
+
return Promise.reject(new Error(`Telemetry request blocked in tests: ${url}`));
|
|
42
|
+
}
|
|
43
|
+
return realFetch(input, init);
|
|
44
|
+
},
|
|
45
|
+
realFetch,
|
|
46
|
+
) as typeof fetch;
|
|
47
|
+
globalThis.fetch = guardedFetch;
|
|
48
|
+
|
|
49
|
+
function failOnAttempts(): void {
|
|
50
|
+
if (attempts.length === 0) return;
|
|
51
|
+
const sent = attempts.splice(0);
|
|
52
|
+
throw new Error(
|
|
53
|
+
`A test sent telemetry to the real service: ${sent.join(", ")}. Tests run with telemetry off; `
|
|
54
|
+
+ "a test that exercises telemetry must stub the Cloud API transport (setCloudApiFetchTransport).",
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
afterEach(failOnAttempts);
|
|
59
|
+
afterAll(failOnAttempts);
|
|
60
|
+
|
|
61
|
+
const OPT_OUT_ENV = ["GLOOMBERB_NO_TELEMETRY", "DO_NOT_TRACK"] as const;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* For a test file, or a `describe`, that checks what the app sends about
|
|
65
|
+
* itself: clears the opt-out `test-env.ts` sets for each test and restores it
|
|
66
|
+
* after. Stub where the report goes (`setCloudApiFetchTransport`, the host's
|
|
67
|
+
* `send`, the `apiClient` method) as well: a report that reaches the real
|
|
68
|
+
* `fetch` fails the test.
|
|
69
|
+
*/
|
|
70
|
+
export function allowTelemetryInTests(): void {
|
|
71
|
+
let saved: Array<string | undefined> = [];
|
|
72
|
+
beforeEach(() => {
|
|
73
|
+
saved = OPT_OUT_ENV.map((name) => process.env[name]);
|
|
74
|
+
for (const name of OPT_OUT_ENV) delete process.env[name];
|
|
75
|
+
});
|
|
76
|
+
afterEach(() => {
|
|
77
|
+
OPT_OUT_ENV.forEach((name, index) => {
|
|
78
|
+
const value = saved[index];
|
|
79
|
+
if (value === undefined) delete process.env[name];
|
|
80
|
+
else process.env[name] = value;
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
@@ -5,3 +5,15 @@
|
|
|
5
5
|
* first in bunfig.toml's preload, so it runs before anything imports React.
|
|
6
6
|
*/
|
|
7
7
|
process.env.NODE_ENV = "test";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Tests never send crash reports or usage counts. Each test home looks like a
|
|
11
|
+
* brand-new install to the service, so a run that reached it would count dozens
|
|
12
|
+
* of installs that exist for the length of one test. Set here, the opt-out also
|
|
13
|
+
* reaches every process a test starts with the inherited environment (a CLI
|
|
14
|
+
* run, a packaged entry), which the in-process guard in `telemetry-guard.ts`
|
|
15
|
+
* cannot see. A test that checks telemetry itself calls `allowTelemetryInTests`
|
|
16
|
+
* from that file and stubs where the report goes.
|
|
17
|
+
*/
|
|
18
|
+
process.env.GLOOMBERB_NO_TELEMETRY = "1";
|
|
19
|
+
process.env.DO_NOT_TRACK = "1";
|
package/src/theme/colors.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { blendForContrast, blendForContrastOnSurfaces, blendHex, higherContrast } from "./color-utils";
|
|
2
2
|
import { getTheme, DEFAULT_THEME, type Theme } from "./themes";
|
|
3
|
-
import { hoverColour, placeholderColour, themeCssVariables } from "./ui-tokens";
|
|
3
|
+
import { hoverColour, inactiveSelectionColour, inactiveSelectionTextColour, placeholderColour, themeCssVariables } from "./ui-tokens";
|
|
4
4
|
|
|
5
5
|
export type ThemeColors = Readonly<Omit<Theme, "name" | "description">>;
|
|
6
6
|
|
|
@@ -94,6 +94,22 @@ export function hoverBg(palette: ThemeColors = colors): string {
|
|
|
94
94
|
return hoverColour(palette);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
/**
|
|
98
|
+
* The chosen row of a list or table in a pane that is not focused (ui-tokens
|
|
99
|
+
* `inactiveSelectionColour`); the focused pane's chosen row is `selected`.
|
|
100
|
+
*/
|
|
101
|
+
export function inactiveSelectedBg(palette: ThemeColors = colors): string {
|
|
102
|
+
return inactiveSelectionColour(palette);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Text on the inactive selection (`inactiveSelectedBg`): the row's own colour,
|
|
107
|
+
* lifted where it would not read there (ui-tokens `inactiveSelectionTextColour`).
|
|
108
|
+
*/
|
|
109
|
+
export function inactiveSelectedText(color: string, palette: ThemeColors = colors): string {
|
|
110
|
+
return inactiveSelectionTextColour(color, palette);
|
|
111
|
+
}
|
|
112
|
+
|
|
97
113
|
/**
|
|
98
114
|
* Placeholder text in a field (ui-tokens `placeholderColour`); `surface` is
|
|
99
115
|
* what the field sits on when that is not the page or a panel.
|
package/src/theme/ui-tokens.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { blendForContrast, blendHex, higherContrast } from "./color-utils";
|
|
1
|
+
import { blendForContrast, blendHex, contrastRatio, higherContrast } from "./color-utils";
|
|
2
2
|
import { SUBTLE_TEXT_MIN, type Theme } from "./themes";
|
|
3
3
|
|
|
4
4
|
type Palette = Readonly<Omit<Theme, "name" | "description">>;
|
|
@@ -74,6 +74,55 @@ export function hoverColour(palette: Palette): string {
|
|
|
74
74
|
return blendHex(palette.bg, palette.selected, 0.5);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* The least contrast the inactive selection keeps with the page and with a
|
|
79
|
+
* panel, either of which a list sits on: below it the row reads as a shadow
|
|
80
|
+
* in a theme whose selection sits close to its background (high contrast,
|
|
81
|
+
* blue, midnight).
|
|
82
|
+
*/
|
|
83
|
+
export const INACTIVE_SELECTION_MIN = 1.3;
|
|
84
|
+
/** The least contrast any text keeps on the inactive selection, tones and muted text included. */
|
|
85
|
+
export const INACTIVE_SELECTION_TEXT_MIN = 3;
|
|
86
|
+
/** How far from the panel toward the selection the inactive selection starts, steps and stops. */
|
|
87
|
+
const INACTIVE_SELECTION_BLEND = { from: 0.35, step: 0.01, to: 0.6 } as const;
|
|
88
|
+
|
|
89
|
+
const inactiveSelectionCache = new Map<string, string>();
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The chosen row of a list or table whose pane does not have the keyboard:
|
|
93
|
+
* from a third of the way from the panel to the selection, as far on as it
|
|
94
|
+
* takes to stand apart from the page and a panel (INACTIVE_SELECTION_MIN),
|
|
95
|
+
* and never past 0.6, so the row still says where the cursor is without
|
|
96
|
+
* reading as the one the keys move.
|
|
97
|
+
*/
|
|
98
|
+
export function inactiveSelectionColour(palette: Palette): string {
|
|
99
|
+
const key = `${palette.panel}|${palette.bg}|${palette.selected}`;
|
|
100
|
+
const cached = inactiveSelectionCache.get(key);
|
|
101
|
+
if (cached) return cached;
|
|
102
|
+
const { from, step, to } = INACTIVE_SELECTION_BLEND;
|
|
103
|
+
let fill = blendHex(palette.panel, palette.selected, to);
|
|
104
|
+
for (let ratio = from; ratio < to; ratio = Math.round((ratio + step) * 100) / 100) {
|
|
105
|
+
const candidate = blendHex(palette.panel, palette.selected, ratio);
|
|
106
|
+
if (contrastRatio(candidate, palette.bg) >= INACTIVE_SELECTION_MIN && contrastRatio(candidate, palette.panel) >= INACTIVE_SELECTION_MIN) {
|
|
107
|
+
fill = candidate;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (inactiveSelectionCache.size > 64) inactiveSelectionCache.clear();
|
|
112
|
+
inactiveSelectionCache.set(key, fill);
|
|
113
|
+
return fill;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* A row's text colour on the inactive selection: as it is where it reads at
|
|
118
|
+
* INACTIVE_SELECTION_TEXT_MIN, lifted toward black or white only as far as
|
|
119
|
+
* it takes where it does not (a muted label, a theme's down tone).
|
|
120
|
+
*/
|
|
121
|
+
export function inactiveSelectionTextColour(color: string, palette: Palette): string {
|
|
122
|
+
const fill = inactiveSelectionColour(palette);
|
|
123
|
+
return blendForContrast(color, fill, higherContrast("#000000", "#ffffff", fill), INACTIVE_SELECTION_TEXT_MIN);
|
|
124
|
+
}
|
|
125
|
+
|
|
77
126
|
/**
|
|
78
127
|
* The colour roles the palette names indirectly, as `--gloom-*` variables:
|
|
79
128
|
* styles.css and inline styles read these, never a blend of their own.
|
|
@@ -15,6 +15,7 @@ import { currencyPairSpelling } from "../utils/currency-pair";
|
|
|
15
15
|
import { savedAbroadForBareSymbol } from "./search/bare-symbol";
|
|
16
16
|
import { parseListingWithdrawal, withdrawalLabel } from "../market-data/quotes/delisting";
|
|
17
17
|
import type { ListingWithdrawal } from "../types/financials";
|
|
18
|
+
import { isRateLimited, isTransientServiceFailure } from "../sources/provider-errors";
|
|
18
19
|
|
|
19
20
|
export interface ListingStore {
|
|
20
21
|
loadTicker(symbol: string): Promise<TickerRecord | null>;
|
|
@@ -59,7 +60,15 @@ function ownSymbol(listed: string | undefined, asked: string): { symbol: string
|
|
|
59
60
|
* every command names; whether a venue it leaves out trades the symbol is the
|
|
60
61
|
* listing's own quote's to say (`quotedOnVenue`).
|
|
61
62
|
*/
|
|
62
|
-
export async function listingVenues(
|
|
63
|
+
export async function listingVenues(
|
|
64
|
+
symbol: string,
|
|
65
|
+
{ store, dataProvider }: ListingDeps,
|
|
66
|
+
/**
|
|
67
|
+
* Throw a search failure that says nothing of the symbol (a busy moment, the
|
|
68
|
+
* request limit, no connection) rather than answer that no venue lists it.
|
|
69
|
+
*/
|
|
70
|
+
{ failTransient = false }: { failTransient?: boolean } = {},
|
|
71
|
+
): Promise<ListingVenue[]> {
|
|
63
72
|
const query = `${symbol}:`;
|
|
64
73
|
if (!listingChoiceQuery(query)) return [];
|
|
65
74
|
const tickers = new Map((await store.loadAllTickers()).map((ticker) => [ticker.metadata.ticker.toUpperCase(), ticker] as const));
|
|
@@ -77,6 +86,7 @@ export async function listingVenues(symbol: string, { store, dataProvider }: Lis
|
|
|
77
86
|
};
|
|
78
87
|
venues = only?.exchange ? [{ ...only, exchange: canonicalExchange(only.exchange) }] : [];
|
|
79
88
|
} catch (error) {
|
|
89
|
+
if (failTransient && (isTransientServiceFailure(error) || isRateLimited(error))) throw error;
|
|
80
90
|
// One listing settles the picker; several are its choices.
|
|
81
91
|
if (!(error instanceof AmbiguousTickerError) || error instanceof AmbiguousContractError) return [];
|
|
82
92
|
venues = error.listings.flatMap((listing) => {
|