gloomberb 0.20.3 → 0.20.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/account/auth-dialog.tsx +17 -0
- package/src/api-client/data.ts +6 -0
- package/src/api-client/fx-interventions.ts +64 -0
- package/src/api-client/index.ts +1 -0
- package/src/api-client/release-summaries.ts +21 -0
- package/src/app/keybindings/actions.ts +2 -2
- package/src/app/pane-runtime/ticker-open-runtime.ts +245 -66
- package/src/cli/commands/market.ts +77 -1
- package/src/cli/commands/news-search.ts +1 -3
- package/src/cli/commands/plugins.ts +27 -5
- package/src/cli/commands/system.ts +19 -3
- package/src/cli/commands/ticker.ts +60 -19
- package/src/cli/index.ts +8 -8
- package/src/cli/pane-functions/function-help.ts +3 -3
- package/src/cli/report-tables.ts +18 -6
- package/src/cli/result.ts +15 -7
- package/src/cli/types.ts +2 -0
- package/src/components/chart/composite/axis-overlays.tsx +22 -0
- package/src/components/chart/composite/composite-chart.tsx +54 -13
- package/src/components/chart/composite/event-captions.ts +109 -0
- package/src/components/chart/composite/event-guides.ts +74 -0
- package/src/components/chart/composite/rasterizer.ts +2 -0
- package/src/components/chart/composite/text-renderer.ts +2 -0
- package/src/components/chart/composite/types.ts +31 -0
- package/src/components/command-bar/layout-items/focused-pane.ts +5 -5
- package/src/components/command-bar/routes/root/provider-search.ts +5 -4
- package/src/components/command-bar/routes/ticker-search/results.ts +51 -0
- package/src/components/command-bar/routes/ticker-search/route.ts +3 -2
- package/src/components/layout/detached-pane-shell.tsx +1 -1
- package/src/components/layout/floating-pane.tsx +5 -1
- package/src/components/layout/pane/footer/index.tsx +21 -14
- package/src/components/layout/pane/footer/model.ts +6 -0
- package/src/components/layout/shell/action-menu-overlay.tsx +10 -5
- package/src/components/layout/shell/active-drag.ts +149 -105
- package/src/components/layout/shell/drag/drop-zones.ts +162 -0
- package/src/components/layout/shell/drag/index.ts +47 -218
- package/src/components/layout/shell/drag/live.ts +10 -3
- package/src/components/layout/shell/drag/overlays.tsx +182 -5
- package/src/components/layout/shell/drag/runtime.ts +29 -6
- package/src/components/layout/shell/drag/shared-edges.ts +156 -0
- package/src/components/layout/shell/index.tsx +11 -6
- package/src/components/layout/shell/menu.ts +11 -2
- package/src/components/layout/shell/native/pointer-runtime.ts +25 -0
- package/src/components/layout/shell/native/window-state.ts +2 -2
- package/src/components/layout/shell/pane/layers.tsx +71 -7
- package/src/components/layout/shell/terminal-pointer-runtime.ts +18 -9
- package/src/components/layout/shell/window-mode/index.ts +8 -10
- package/src/components/layout/window-edit/mode.ts +39 -7
- package/src/components/layout/window-edit/presentation.ts +1 -1
- package/src/components/onboarding/onboarding-keyboard.ts +4 -0
- package/src/components/onboarding/onboarding-wizard.tsx +8 -3
- package/src/components/ui/button.tsx +2 -0
- package/src/components/ui/choice-dialog.tsx +1 -0
- package/src/components/ui/data-table/index.tsx +4 -3
- package/src/components/ui/list-view.tsx +7 -12
- package/src/components/ui/loading.tsx +10 -3
- package/src/components/ui/menu.tsx +6 -2
- package/src/components/ui/quote.ts +14 -1
- package/src/data/config/layout.ts +5 -2
- package/src/docs/snapshot.json +29 -5
- package/src/i18n/es.ts +9 -8
- package/src/i18n/ja.ts +9 -8
- package/src/i18n/ko.ts +9 -8
- package/src/i18n/zh-cn.ts +9 -8
- package/src/i18n/zh-tw.ts +9 -8
- package/src/layout/pane-manager/floating-actions.ts +17 -0
- package/src/layout/pane-manager/floating-stack.ts +187 -0
- package/src/layout/pane-manager/floating.ts +4 -2
- package/src/layout/pane-manager/gridlock.ts +5 -1
- package/src/layout/pane-manager/index.ts +11 -0
- package/src/layout/pane-manager/layout-state.ts +10 -3
- package/src/market-data/futures-board.ts +46 -1
- package/src/market-data/futures-contract.ts +12 -3
- package/src/market-data/fx-interventions.ts +270 -0
- package/src/news/news-model.ts +44 -2
- package/src/plugins/builtin/alerts/cli.ts +4 -4
- package/src/plugins/builtin/alerts/format.ts +1 -2
- package/src/plugins/builtin/alerts/headless.ts +1 -2
- package/src/plugins/builtin/alerts/move-checks.ts +12 -6
- package/src/plugins/builtin/alerts/move.ts +30 -9
- package/src/plugins/builtin/alerts/pane.tsx +0 -2
- package/src/plugins/builtin/alerts/storage.ts +4 -2
- package/src/plugins/builtin/alerts/types.ts +12 -0
- package/src/plugins/builtin/changelog/index.tsx +292 -101
- package/src/plugins/builtin/changelog/versions.ts +293 -0
- package/src/plugins/builtin/chart-composer/intervention-events.ts +105 -0
- package/src/plugins/builtin/chart-composer/pane.tsx +21 -7
- package/src/plugins/builtin/chat/message/render-state.ts +2 -5
- package/src/plugins/builtin/cloud/askg/attached-pane.tsx +10 -5
- package/src/plugins/builtin/cloud/askg/controller.ts +141 -5
- package/src/plugins/builtin/cloud/askg/executor.ts +113 -4
- package/src/plugins/builtin/cloud/askg/manifest.ts +28 -13
- package/src/plugins/builtin/cloud/askg/model.ts +14 -4
- package/src/plugins/builtin/cloud/askg/pane.tsx +70 -46
- package/src/plugins/builtin/cloud/askg/turn-parts.tsx +70 -0
- package/src/plugins/builtin/cloud/terminal-relay/engine.ts +50 -130
- package/src/plugins/builtin/cloud/terminal-relay/policy.ts +327 -7
- package/src/plugins/builtin/cloud/terminal-relay/prompts.tsx +2 -1
- package/src/plugins/builtin/cloud/terminal-relay/redact.ts +47 -6
- package/src/plugins/builtin/commodities-energy/index.tsx +1 -3
- package/src/plugins/builtin/commodities-energy/view-state.ts +3 -0
- package/src/plugins/builtin/cot/headless.ts +14 -2
- package/src/plugins/builtin/earnings/index.tsx +2 -2
- package/src/plugins/builtin/futures/index.tsx +25 -4
- package/src/plugins/builtin/futures/model.ts +28 -32
- package/src/plugins/builtin/futures/series.ts +4 -3
- package/src/plugins/builtin/futures/table.tsx +16 -9
- package/src/plugins/builtin/futures/use-board-terms.ts +3 -3
- package/src/plugins/builtin/help/index.tsx +3 -3
- package/src/plugins/builtin/help/keybindings-editor.tsx +18 -4
- package/src/plugins/builtin/layout-manager/index.tsx +8 -8
- package/src/plugins/builtin/news/headless.ts +2 -2
- package/src/plugins/builtin/news/index.tsx +3 -3
- package/src/plugins/builtin/perps/markets-section.tsx +5 -2
- package/src/plugins/builtin/plugin-marketplace/pane.tsx +11 -11
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +3 -1
- package/src/plugins/builtin/research/event-model.ts +9 -1
- package/src/plugins/builtin/research/event-sources.ts +22 -0
- package/src/plugins/builtin/research/headless.ts +3 -3
- package/src/plugins/builtin/shared/cloud-upgrade.ts +27 -3
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +54 -5
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +28 -13
- package/src/plugins/builtin/ticker-detail/pane.tsx +7 -2
- package/src/plugins/installer.ts +45 -0
- package/src/remote/resources.ts +12 -1
- package/src/remote/schema.ts +1 -0
- package/src/remote/semantic-helpers.ts +29 -1
- package/src/remote/semantic-tree.tsx +32 -15
- package/src/renderers/cloudflare/worker.ts +16 -1
- package/src/renderers/dom/styles.css +40 -6
- package/src/renderers/share/layout-view.tsx +1 -1
- package/src/sources/gloomberb-cloud/news.ts +35 -12
- package/src/state/opening-ticker-panes.ts +47 -0
- package/src/test-support/cli-context.ts +2 -0
- package/src/test-support/preload.ts +4 -1
- package/src/tickers/instrument-kind.ts +23 -3
- package/src/types/config.ts +5 -0
- package/src/types/context-menu.ts +2 -0
- package/src/types/plugin-commands.ts +140 -0
- package/src/types/plugin-context.ts +125 -0
- package/src/types/plugin-contributions.ts +55 -0
- package/src/types/plugin-definition.ts +234 -0
- package/src/types/plugin-notifications.ts +38 -0
- package/src/types/plugin-pane-settings.ts +114 -0
- package/src/types/plugin-pane-templates.ts +160 -0
- package/src/types/plugin-panes.ts +221 -0
- package/src/types/plugin-reports.ts +35 -0
- package/src/types/plugin-shared.ts +14 -0
- package/src/types/plugin-state.ts +71 -0
- package/src/types/plugin.ts +14 -1169
- package/src/ui/index.tsx +14 -3
- package/src/updater/github-releases.ts +23 -0
- package/src/utils/cli-output.ts +22 -9
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useSyncExternalStore } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Panes placed before their ticker is found. Opening a ticker the app does
|
|
5
|
+
* not hold yet looks it up over the network (search, then its quote), which
|
|
6
|
+
* can take seconds; the pane shows at once and the lookup settles it. Until
|
|
7
|
+
* then the pane has a symbol and no ticker record, and says it is loading
|
|
8
|
+
* rather than that no ticker is selected.
|
|
9
|
+
*/
|
|
10
|
+
const opening = new Set<string>();
|
|
11
|
+
const listeners = new Set<() => void>();
|
|
12
|
+
|
|
13
|
+
function changed(): void {
|
|
14
|
+
for (const listener of listeners) listener();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Marks a pane as opening; the returned stop clears it, once. */
|
|
18
|
+
export function markTickerPaneOpening(instanceId: string): () => void {
|
|
19
|
+
opening.add(instanceId);
|
|
20
|
+
changed();
|
|
21
|
+
let stopped = false;
|
|
22
|
+
return () => {
|
|
23
|
+
if (stopped) return;
|
|
24
|
+
stopped = true;
|
|
25
|
+
if (opening.delete(instanceId)) changed();
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function isTickerPaneOpening(instanceId: string | null | undefined): boolean {
|
|
30
|
+
return !!instanceId && opening.has(instanceId);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function subscribe(listener: () => void): () => void {
|
|
34
|
+
listeners.add(listener);
|
|
35
|
+
return () => {
|
|
36
|
+
listeners.delete(listener);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Whether the pane's ticker is still being looked up. */
|
|
41
|
+
export function useTickerPaneOpening(instanceId: string | null | undefined): boolean {
|
|
42
|
+
return useSyncExternalStore(subscribe, () => isTickerPaneOpening(instanceId), () => false);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function resetOpeningTickerPanesForTests(): void {
|
|
46
|
+
opening.clear();
|
|
47
|
+
}
|
|
@@ -23,6 +23,8 @@ export function createTestCliContext(
|
|
|
23
23
|
persistence: { close: () => { closed += 1; } },
|
|
24
24
|
// Commands look up the saved listing of every symbol they are given.
|
|
25
25
|
store: { loadTicker: async () => null, loadAllTickers: async () => [] },
|
|
26
|
+
// A yen pair's notes read Japan's intervention record from Gloom Cloud; a test has none unless it brings one.
|
|
27
|
+
fxInterventions: async () => null,
|
|
26
28
|
...market,
|
|
27
29
|
});
|
|
28
30
|
const context = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { beforeEach } from "bun:test";
|
|
2
2
|
import { resetSeenPaneNoticesForTest } from "../components/pane-notice-seen";
|
|
3
3
|
import { resetListingIndexForTests } from "../tickers/search/listing-index";
|
|
4
|
+
import { resetOpeningTickerPanesForTests } from "../state/opening-ticker-panes";
|
|
4
5
|
import { resetCrashReporterForTests } from "../telemetry/crash-reports";
|
|
5
6
|
import { setCliAsciiLocaleOverride, setCliColorEnabledOverride, setCliPlainOverride, setCliWidthOverride } from "../utils/cli-output";
|
|
6
7
|
|
|
@@ -19,12 +20,14 @@ import { setCliAsciiLocaleOverride, setCliColorEnabledOverride, setCliPlainOverr
|
|
|
19
20
|
* Data warnings the user has opened are remembered the same way, and would
|
|
20
21
|
* leave a later test's footer icon muted instead of warning yellow. So are the
|
|
21
22
|
* listings search answered, which would name a later test's symbol before its
|
|
22
|
-
* own search does
|
|
23
|
+
* own search does, and so are panes still waiting on a ticker lookup, which
|
|
24
|
+
* would show a later test's pane as loading.
|
|
23
25
|
*/
|
|
24
26
|
beforeEach(() => {
|
|
25
27
|
resetCrashReporterForTests();
|
|
26
28
|
resetSeenPaneNoticesForTest();
|
|
27
29
|
resetListingIndexForTests();
|
|
30
|
+
resetOpeningTickerPanesForTests();
|
|
28
31
|
setCliAsciiLocaleOverride(null);
|
|
29
32
|
setCliColorEnabledOverride(null);
|
|
30
33
|
setCliPlainOverride(null);
|
|
@@ -149,8 +149,26 @@ export function isCryptoVenuePerpetual(type: string | null | undefined, name: st
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
/**
|
|
152
|
-
* A
|
|
153
|
-
*
|
|
152
|
+
* A quote type's code in the words the other types are written in ("Common
|
|
153
|
+
* Stock", "Depositary Receipt"), so one search lists one vocabulary. A generic
|
|
154
|
+
* EQUITY is any share, a receipt's too, so it reads as Stock, never Common
|
|
155
|
+
* Stock. A broker's own codes (STK, CASH) stay as the broker files them.
|
|
156
|
+
*/
|
|
157
|
+
const TYPE_CODE_WORDS: Record<string, string> = {
|
|
158
|
+
EQUITY: "Stock",
|
|
159
|
+
CRYPTOCURRENCY: "Cryptocurrency",
|
|
160
|
+
INDEX: "Index",
|
|
161
|
+
FUTURE: "Future",
|
|
162
|
+
MUTUALFUND: "Mutual Fund",
|
|
163
|
+
MONEYMARKET: "Money Market Fund",
|
|
164
|
+
CURRENCY: "Currency",
|
|
165
|
+
OPTION: "Option",
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* A listing's type, in plain words: a provider's type code as the words the
|
|
170
|
+
* others use, and where the type misleads (a perpetual typed as a coin), what
|
|
171
|
+
* it is. `detail` says what it is not, for a report line.
|
|
154
172
|
*/
|
|
155
173
|
export function instrumentTypeLabel(
|
|
156
174
|
type: string | null | undefined,
|
|
@@ -161,5 +179,7 @@ export function instrumentTypeLabel(
|
|
|
161
179
|
return options.detail ? "Perpetual futures price (24/7 on crypto venues; not the listed future, not spot)" : "Perpetual futures price";
|
|
162
180
|
}
|
|
163
181
|
if (classifyInstrumentType(type) === "perpetual") return "Perpetual futures";
|
|
164
|
-
|
|
182
|
+
const written = type?.trim();
|
|
183
|
+
// Only a code: a type written in words ("Equity Fund") stays as written.
|
|
184
|
+
return (written && written === written.toUpperCase() ? TYPE_CODE_WORDS[written] : undefined) ?? (written || undefined);
|
|
165
185
|
}
|
package/src/types/config.ts
CHANGED
|
@@ -132,6 +132,11 @@ export interface FloatingPaneEntry {
|
|
|
132
132
|
width: number;
|
|
133
133
|
height: number;
|
|
134
134
|
zIndex?: number;
|
|
135
|
+
/**
|
|
136
|
+
* Floating windows stacked as tabs share this key and one rect; the one
|
|
137
|
+
* in front (highest z) is shown (layout/pane-manager/floating-stack.ts).
|
|
138
|
+
*/
|
|
139
|
+
stack?: string;
|
|
135
140
|
}
|
|
136
141
|
|
|
137
142
|
interface DetachedPaneEntry {
|
|
@@ -27,6 +27,8 @@ export interface ContextMenuActionItem extends ContextMenuItemBase {
|
|
|
27
27
|
label: string;
|
|
28
28
|
onSelect?: () => void | Promise<void>;
|
|
29
29
|
submenu?: ContextMenuItem[];
|
|
30
|
+
/** The prompt the item answers (a pane's Approve), as `metadata.scope` on the menu drawn in the app. */
|
|
31
|
+
remoteScope?: string;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
export interface ContextMenuRoleItem extends ContextMenuItemBase {
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { AppConfig, LayoutConfig } from "./config";
|
|
2
|
+
import type { WizardStep } from "./plugin-shared";
|
|
3
|
+
|
|
4
|
+
export interface CommandShortcutArgContext {
|
|
5
|
+
activeTicker: string | null;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface CommandShortcutArgDef {
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
kind?: "text" | "ticker" | "ticker-list";
|
|
11
|
+
parse?: (
|
|
12
|
+
arg: string,
|
|
13
|
+
context: CommandShortcutArgContext,
|
|
14
|
+
) => Record<string, string>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface CommandResultDef {
|
|
18
|
+
id: string;
|
|
19
|
+
label: string;
|
|
20
|
+
detail?: string;
|
|
21
|
+
category?: string;
|
|
22
|
+
/** Short tag drawn left of the label, as on a search provider's row. Six characters at most. */
|
|
23
|
+
badge?: string;
|
|
24
|
+
/** Drawn muted after the label, e.g. a person's full name after their @username. */
|
|
25
|
+
name?: string;
|
|
26
|
+
right?: string;
|
|
27
|
+
keywords?: string[];
|
|
28
|
+
current?: boolean;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
execute: () => void | Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface CommandBarResultLineSegment {
|
|
34
|
+
text: string;
|
|
35
|
+
emphasis?: "match" | "muted";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface CommandBarResultLine {
|
|
39
|
+
segments: CommandBarResultLineSegment[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface CommandBarResultDef {
|
|
43
|
+
id: string;
|
|
44
|
+
label: string;
|
|
45
|
+
detail?: string;
|
|
46
|
+
/** Rendered under the label. Each entry is one additional row. */
|
|
47
|
+
lines?: CommandBarResultLine[];
|
|
48
|
+
category?: string;
|
|
49
|
+
/** Short tag drawn left of the label, e.g. a document type. Six characters at most. */
|
|
50
|
+
badge?: string;
|
|
51
|
+
/** Drawn muted after the label, e.g. a person's full name after their @username. */
|
|
52
|
+
name?: string;
|
|
53
|
+
right?: string;
|
|
54
|
+
keywords?: string[];
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
execute: () => void | Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface CommandBarSearchContext {
|
|
60
|
+
activeTicker: string | null;
|
|
61
|
+
activeCollectionId: string | null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface CommandBarSearchProvider {
|
|
65
|
+
id: string;
|
|
66
|
+
/** Section heading for these rows, e.g. "Documents". */
|
|
67
|
+
category: string;
|
|
68
|
+
/** Sort position of the section. Higher sinks. Navigation sections are negative; use a positive value to sit below them. */
|
|
69
|
+
priority?: number;
|
|
70
|
+
/** Skip the provider below this length. Default 3. */
|
|
71
|
+
minQueryLength?: number;
|
|
72
|
+
/** Default 300. Ignored by `match`. */
|
|
73
|
+
debounceMs?: number;
|
|
74
|
+
/**
|
|
75
|
+
* How long `provide` may take once it starts, in ms. Default 8000. Past it
|
|
76
|
+
* the bar aborts `signal`, drops a late answer and stops showing Searching.
|
|
77
|
+
* Ignored by `match`.
|
|
78
|
+
*/
|
|
79
|
+
timeoutMs?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Codes (`CHAT`) after which the provider is still asked, typed alone or
|
|
82
|
+
* with text after them, with the whole query. Every other provider stays
|
|
83
|
+
* quiet once a code claims the text.
|
|
84
|
+
*/
|
|
85
|
+
shortcuts?: readonly string[];
|
|
86
|
+
provide(
|
|
87
|
+
query: string,
|
|
88
|
+
context: CommandBarSearchContext,
|
|
89
|
+
signal: AbortSignal,
|
|
90
|
+
): Promise<CommandBarResultDef[]>;
|
|
91
|
+
/**
|
|
92
|
+
* Rows from what the app already holds in memory. When set, the bar calls
|
|
93
|
+
* this instead of `provide`, as it renders and on every keystroke, so it
|
|
94
|
+
* must be cheap: no request, no waiting. Its rows are ranked with the bar's
|
|
95
|
+
* own matches as they are typed and sit under Suggested in the empty bar.
|
|
96
|
+
* Keep `provide` answering the same rows for older versions of the app.
|
|
97
|
+
*/
|
|
98
|
+
match?(query: string, context: CommandBarSearchContext): CommandBarResultDef[];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface CommandDef {
|
|
102
|
+
id: string;
|
|
103
|
+
label: string;
|
|
104
|
+
keywords: string[];
|
|
105
|
+
shortcut?: string;
|
|
106
|
+
shortcutArg?: CommandShortcutArgDef;
|
|
107
|
+
buildResults?: (arg: string) => CommandResultDef[];
|
|
108
|
+
execute: (values?: Record<string, string>) => void | Promise<void>;
|
|
109
|
+
category: "navigation" | "data" | "portfolio" | "config";
|
|
110
|
+
description?: string;
|
|
111
|
+
wizard?: WizardStep[];
|
|
112
|
+
confirm?: CommandConfirmDef | ((context: CommandConfirmContext) => CommandConfirmDef | null);
|
|
113
|
+
/** @deprecated Ignored: a wizard always opens as one form with every step at once. */
|
|
114
|
+
wizardLayout?: "steps" | "form";
|
|
115
|
+
hidden?: () => boolean;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface CommandConfirmContext {
|
|
119
|
+
config: AppConfig;
|
|
120
|
+
layout: LayoutConfig;
|
|
121
|
+
activeTicker: string | null;
|
|
122
|
+
activeCollectionId: string | null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface CommandConfirmDef {
|
|
126
|
+
title: string;
|
|
127
|
+
body: string[];
|
|
128
|
+
confirmLabel?: string;
|
|
129
|
+
cancelLabel?: string;
|
|
130
|
+
tone?: "default" | "danger";
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface KeyboardShortcut {
|
|
134
|
+
id: string;
|
|
135
|
+
key: string;
|
|
136
|
+
ctrl?: boolean;
|
|
137
|
+
shift?: boolean;
|
|
138
|
+
description: string;
|
|
139
|
+
execute: () => void;
|
|
140
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { PluginCapability } from "../capabilities";
|
|
2
|
+
import type { AppTickerRepositoryPort } from "../core/app-service-ports";
|
|
3
|
+
import type { ConnectionHealthRegistry } from "../core/connection-health";
|
|
4
|
+
import type { PluginEvents } from "../plugins/event-bus";
|
|
5
|
+
import type { SeriesDefinition } from "../series/types";
|
|
6
|
+
import type { SyncContributor, SyncTransport } from "../sync/types";
|
|
7
|
+
import type { PluginLogger } from "../utils/debug-log";
|
|
8
|
+
import type { BrokerAdapter } from "./broker";
|
|
9
|
+
import type { BrokerInstanceConfig } from "./config";
|
|
10
|
+
import type { DataProvider } from "./data-provider";
|
|
11
|
+
import type { TickerFinancials } from "./financials";
|
|
12
|
+
import type { BrokerContractRef, TickerListingRef } from "./instrument";
|
|
13
|
+
import type { CommandBarSearchProvider, CommandDef, KeyboardShortcut } from "./plugin-commands";
|
|
14
|
+
import type {
|
|
15
|
+
ContextMenuProviderDef,
|
|
16
|
+
CustomColumnDef,
|
|
17
|
+
TickerAction,
|
|
18
|
+
TickerResearchTabDef,
|
|
19
|
+
} from "./plugin-contributions";
|
|
20
|
+
import type { AppNotificationDelivery, AppNotificationRequest } from "./plugin-notifications";
|
|
21
|
+
import type { PaneTemplateCreateOptions, PaneTemplateDef } from "./plugin-pane-templates";
|
|
22
|
+
import type { PaneDef } from "./plugin-panes";
|
|
23
|
+
import type {
|
|
24
|
+
PluginConfigState,
|
|
25
|
+
PluginPaneSettingsState,
|
|
26
|
+
PluginPersistence,
|
|
27
|
+
PluginResumeState,
|
|
28
|
+
PluginTeamState,
|
|
29
|
+
} from "./plugin-state";
|
|
30
|
+
import type { TickerRecord } from "./ticker";
|
|
31
|
+
|
|
32
|
+
export interface BrokerInstanceUpdateOptions {
|
|
33
|
+
label?: string;
|
|
34
|
+
enabled?: boolean;
|
|
35
|
+
replaceConfig?: boolean;
|
|
36
|
+
/** Keep this connection's data on this device, out of Gloom Cloud sync (`BrokerInstanceConfig.localOnly`). */
|
|
37
|
+
localOnly?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface BrokerInstanceCreateOptions {
|
|
41
|
+
/** Keep the new connection's data on this device from the start, before its first import. */
|
|
42
|
+
localOnly?: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface PinTickerOptions {
|
|
46
|
+
floating?: boolean;
|
|
47
|
+
paneType?: string;
|
|
48
|
+
forceNewPane?: boolean;
|
|
49
|
+
/** Preserve a contract explicitly selected from instrument search. */
|
|
50
|
+
instrument?: BrokerContractRef | null;
|
|
51
|
+
listing?: TickerListingRef;
|
|
52
|
+
/** Select this research tab once the requested ticker has resolved. */
|
|
53
|
+
tabId?: string;
|
|
54
|
+
/** Merge this state into the resolved research pane when selecting `tabId`. */
|
|
55
|
+
tabState?: Record<string, unknown>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface GloomPluginContext {
|
|
59
|
+
registerPane(pane: PaneDef): void;
|
|
60
|
+
/** Returns a disposer; templates added after setup (team views) use it. */
|
|
61
|
+
registerPaneTemplate(template: PaneTemplateDef): () => void;
|
|
62
|
+
registerCommand(command: CommandDef): void;
|
|
63
|
+
registerCommandBarSearchProvider(provider: CommandBarSearchProvider): () => void;
|
|
64
|
+
registerColumn(column: CustomColumnDef): void;
|
|
65
|
+
registerBroker(broker: BrokerAdapter): void;
|
|
66
|
+
registerCapability(capability: PluginCapability): void;
|
|
67
|
+
registerTickerResearchTab(tab: TickerResearchTabDef): void;
|
|
68
|
+
registerShortcut(shortcut: KeyboardShortcut): void;
|
|
69
|
+
registerTickerAction(action: TickerAction): void;
|
|
70
|
+
registerContextMenuProvider(provider: ContextMenuProviderDef): void;
|
|
71
|
+
/**
|
|
72
|
+
* Adds a series to the data catalog and the chart composer, at any time
|
|
73
|
+
* after setup starts (after loading a list, say). Throws when the definition
|
|
74
|
+
* is invalid or its id is taken; the returned function removes it again.
|
|
75
|
+
*/
|
|
76
|
+
registerSeries(series: SeriesDefinition): () => void;
|
|
77
|
+
registerSyncContributor(contributor: SyncContributor): () => void;
|
|
78
|
+
registerSyncTransport(transport: SyncTransport): () => void;
|
|
79
|
+
watchNewsQuery?(
|
|
80
|
+
query: import("./news-source").NewsQuery,
|
|
81
|
+
listener: (state: import("./news-source").NewsQueryState) => void,
|
|
82
|
+
): () => void;
|
|
83
|
+
|
|
84
|
+
getData(ticker: string): TickerFinancials | null;
|
|
85
|
+
getTicker(ticker: string): TickerRecord | null;
|
|
86
|
+
getConfig(): import("./config").AppConfig;
|
|
87
|
+
/** Resolve a broker registered by another plugin, without connecting it. */
|
|
88
|
+
getBrokerAdapter?(brokerType: string): BrokerAdapter | null;
|
|
89
|
+
getPaneDef(paneId: string): PaneDef | undefined;
|
|
90
|
+
|
|
91
|
+
readonly marketData: DataProvider;
|
|
92
|
+
readonly connectionHealth: ConnectionHealthRegistry;
|
|
93
|
+
readonly tickerRepository: AppTickerRepositoryPort;
|
|
94
|
+
readonly persistence: PluginPersistence;
|
|
95
|
+
readonly log: PluginLogger;
|
|
96
|
+
readonly resume: PluginResumeState;
|
|
97
|
+
readonly configState: PluginConfigState;
|
|
98
|
+
readonly paneSettings: PluginPaneSettingsState;
|
|
99
|
+
readonly teamState: PluginTeamState;
|
|
100
|
+
|
|
101
|
+
createBrokerInstance(brokerType: string, label: string, values: Record<string, unknown>, options?: BrokerInstanceCreateOptions): Promise<BrokerInstanceConfig>;
|
|
102
|
+
updateBrokerInstance(instanceId: string, values: Record<string, unknown>, options?: BrokerInstanceUpdateOptions): Promise<void>;
|
|
103
|
+
syncBrokerInstance(instanceId: string): Promise<void>;
|
|
104
|
+
removeBrokerInstance(instanceId: string): Promise<void>;
|
|
105
|
+
|
|
106
|
+
selectTicker(symbol: string, paneId?: string): void;
|
|
107
|
+
/** Focus the leftmost or rightmost docked pane. */
|
|
108
|
+
switchPanel(panel: "left" | "right"): void;
|
|
109
|
+
switchTab(tabId: string, paneId?: string): void;
|
|
110
|
+
openCommandBar(query?: string): void;
|
|
111
|
+
showPane(paneId: string): void;
|
|
112
|
+
createPaneFromTemplate(templateId: string, options?: PaneTemplateCreateOptions): void;
|
|
113
|
+
hidePane(paneId: string): void;
|
|
114
|
+
focusPane(paneId: string): void;
|
|
115
|
+
pinTicker(symbol: string, options?: PinTickerOptions): void;
|
|
116
|
+
navigateTicker(symbol: string, options?: { sourcePaneId?: string | null }): void;
|
|
117
|
+
openPaneSettings(paneId?: string): void;
|
|
118
|
+
/** Shares a pane instance (the focused pane when omitted): copies a live link to it. */
|
|
119
|
+
sharePane(paneId?: string): void;
|
|
120
|
+
|
|
121
|
+
on<K extends keyof PluginEvents>(event: K, handler: (payload: PluginEvents[K]) => void): () => void;
|
|
122
|
+
emit<K extends keyof PluginEvents>(event: K, payload: PluginEvents[K]): void;
|
|
123
|
+
|
|
124
|
+
notify(notification: AppNotificationRequest): AppNotificationDelivery | void;
|
|
125
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { AppConfig, ColumnConfig } from "./config";
|
|
3
|
+
import type { ContextMenuContext, ContextMenuItem } from "./context-menu";
|
|
4
|
+
import type { TickerFinancials } from "./financials";
|
|
5
|
+
import type { TickerInstrumentKind } from "./instrument";
|
|
6
|
+
import type { TickerRecord } from "./ticker";
|
|
7
|
+
|
|
8
|
+
export interface CustomColumnDef extends ColumnConfig {
|
|
9
|
+
render: (ticker: TickerRecord, financials: TickerFinancials | null) => string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface TickerResearchTabProps {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
focused: boolean;
|
|
16
|
+
onCapture: (capturing: boolean) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface TickerResearchTabVisibilityContext {
|
|
20
|
+
config: AppConfig;
|
|
21
|
+
ticker: TickerRecord | null;
|
|
22
|
+
financials: TickerFinancials | null | undefined;
|
|
23
|
+
hasOptionsChain: boolean;
|
|
24
|
+
/** Resolved from the quote, broker contract and saved type; `equity` when nothing says otherwise. */
|
|
25
|
+
instrumentKind: TickerInstrumentKind;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface TickerResearchTabDef {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
order: number;
|
|
32
|
+
component: (props: TickerResearchTabProps) => ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Instrument kinds this tab has data for, such as `["equity"]` for company
|
|
35
|
+
* filings. Omit when every ticker has it (chart, news, notes).
|
|
36
|
+
*/
|
|
37
|
+
instruments?: readonly TickerInstrumentKind[];
|
|
38
|
+
/** Narrower checks than `instruments`: a US listing, an options chain, a connected broker. */
|
|
39
|
+
isVisible?: (context: TickerResearchTabVisibilityContext) => boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface TickerAction {
|
|
43
|
+
id: string;
|
|
44
|
+
label: string;
|
|
45
|
+
keywords: string[];
|
|
46
|
+
filter?: (ticker: TickerRecord) => boolean;
|
|
47
|
+
execute: (ticker: TickerRecord, financials: TickerFinancials | null) => void | Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface ContextMenuProviderDef {
|
|
51
|
+
id: string;
|
|
52
|
+
order?: number;
|
|
53
|
+
contexts?: ContextMenuContext["kind"][];
|
|
54
|
+
getItems(context: ContextMenuContext): ContextMenuItem[] | null | undefined;
|
|
55
|
+
}
|