gloomberb 0.19.3 → 0.19.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.
Files changed (104) hide show
  1. package/package.json +2 -2
  2. package/src/api-client/errors.ts +8 -0
  3. package/src/api-client/index.ts +18 -0
  4. package/src/api-client/request.ts +295 -42
  5. package/src/api-client/socket.ts +95 -0
  6. package/src/app/keybindings/actions.ts +1 -1
  7. package/src/app/pane-runtime/index.tsx +1 -1
  8. package/src/app/pane-runtime/ticker-inspector-runtime.ts +1 -1
  9. package/src/app/pane-runtime/ticker-open-runtime.ts +1 -1
  10. package/src/app/pane-runtime/ticker-open-target.ts +12 -2
  11. package/src/cli/desktop-pane-shot-api-policy.ts +10 -2
  12. package/src/cli/desktop-pane-shot.ts +2 -1
  13. package/src/components/command-bar/action-runtime.ts +2 -0
  14. package/src/components/command-bar/commands/direct/runtime.ts +3 -3
  15. package/src/components/command-bar/helpers.ts +2 -0
  16. package/src/components/command-bar/list/model.ts +9 -0
  17. package/src/components/command-bar/pane-actions.ts +46 -35
  18. package/src/components/command-bar/pane-templates/workflow.ts +6 -0
  19. package/src/components/command-bar/panel/index.tsx +30 -3
  20. package/src/components/command-bar/panel/types.ts +7 -0
  21. package/src/components/command-bar/routes/root/results.ts +4 -4
  22. package/src/components/command-bar/routes/root/selection.ts +3 -2
  23. package/src/components/command-bar/routes/ticker-search/actions.ts +21 -16
  24. package/src/components/command-bar/routing/launch-request.ts +3 -2
  25. package/src/components/command-bar/routing/list-state.ts +4 -1
  26. package/src/components/command-bar/surface/index.tsx +15 -1
  27. package/src/components/layout/floating-pane.tsx +10 -0
  28. package/src/components/layout/pane/frame.tsx +6 -0
  29. package/src/components/layout/pane/header.tsx +244 -42
  30. package/src/components/layout/pane/index.tsx +20 -2
  31. package/src/components/layout/shell/active-drag.ts +128 -27
  32. package/src/components/layout/shell/drag/index.ts +99 -96
  33. package/src/components/layout/shell/drag/live.ts +3 -17
  34. package/src/components/layout/shell/drag/magnets.ts +198 -0
  35. package/src/components/layout/shell/drag/overlays.tsx +77 -75
  36. package/src/components/layout/shell/drag/runtime.ts +12 -7
  37. package/src/components/layout/shell/index.tsx +66 -32
  38. package/src/components/layout/shell/native/pointer-runtime.ts +7 -2
  39. package/src/components/layout/shell/native/surfaces.ts +1 -9
  40. package/src/components/layout/shell/native/window-state.ts +21 -25
  41. package/src/components/layout/shell/pane/layers.tsx +153 -24
  42. package/src/components/layout/shell/shortcuts.ts +4 -1
  43. package/src/components/layout/shell/terminal-pointer-runtime.ts +24 -1
  44. package/src/components/layout/shell/window-mode/overlays.tsx +14 -6
  45. package/src/components/layout/status-bar.tsx +75 -6
  46. package/src/core/app-runtime.ts +4 -1
  47. package/src/core/connection-health.ts +76 -1
  48. package/src/core/state/app/command-bar-launch.ts +12 -0
  49. package/src/core/state/app/layout.ts +4 -3
  50. package/src/core/state/app/types.ts +4 -1
  51. package/src/data/config/layout.ts +2 -2
  52. package/src/data/config/store/fold-panes.ts +6 -1
  53. package/src/i18n/es.ts +8 -1
  54. package/src/i18n/ja.ts +8 -1
  55. package/src/i18n/ko.ts +8 -1
  56. package/src/i18n/zh-cn.ts +8 -1
  57. package/src/i18n/zh-tw.ts +8 -1
  58. package/src/layout/pane-follow.ts +3 -2
  59. package/src/layout/pane-layout-move.ts +2 -1
  60. package/src/layout/pane-manager/dock-stack.ts +38 -0
  61. package/src/layout/pane-manager/dock-tree.ts +76 -15
  62. package/src/layout/pane-manager/docking.ts +48 -6
  63. package/src/layout/pane-manager/floating-actions.ts +12 -3
  64. package/src/layout/pane-manager/floating-placement.ts +189 -0
  65. package/src/layout/pane-manager/floating.ts +23 -4
  66. package/src/layout/pane-manager/gridlock.ts +16 -4
  67. package/src/layout/pane-manager/hidden-panes.ts +30 -1
  68. package/src/layout/pane-manager/index.ts +2 -0
  69. package/src/layout/pane-manager/layout-state.ts +17 -0
  70. package/src/layout/pane-manager/types.ts +4 -1
  71. package/src/layout/ticker-retarget.ts +88 -0
  72. package/src/layout-marketplace/cloud.ts +9 -1
  73. package/src/market-data/connection-follow.ts +68 -0
  74. package/src/market-data/coordinator/entries.ts +15 -3
  75. package/src/market-data/coordinator/financials.ts +20 -7
  76. package/src/market-data/coordinator/index.ts +217 -4
  77. package/src/market-data/coordinator/quotes.ts +10 -0
  78. package/src/market-data/hooks.tsx +31 -0
  79. package/src/news/aggregator.ts +12 -1
  80. package/src/plugins/builtin/buildout/company/pane.tsx +2 -1
  81. package/src/plugins/builtin/buildout/model/index.ts +6 -0
  82. package/src/plugins/builtin/buildout/pane/index.tsx +2 -1
  83. package/src/plugins/builtin/chart-composer/index.tsx +13 -0
  84. package/src/plugins/builtin/chat/controller/index.ts +10 -3
  85. package/src/plugins/builtin/chat/controller/session-runtime.ts +9 -2
  86. package/src/plugins/builtin/chat/status-widget.tsx +3 -1
  87. package/src/plugins/builtin/help/index.tsx +1 -1
  88. package/src/plugins/builtin/sectors/client.ts +18 -8
  89. package/src/plugins/builtin/sectors/index.tsx +19 -5
  90. package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -1
  91. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +25 -2
  92. package/src/react/async-resource.ts +12 -0
  93. package/src/remote/controller.ts +3 -1
  94. package/src/renderers/browser/app-services.ts +8 -1
  95. package/src/renderers/browser/cloud-transport.ts +6 -1
  96. package/src/renderers/cloudflare/worker.ts +24 -2
  97. package/src/renderers/dom/styles.css +32 -0
  98. package/src/shares/portable-layout.ts +99 -2
  99. package/src/sources/provider-router/index.ts +2 -2
  100. package/src/sources/provider-router/sources.ts +26 -1
  101. package/src/sync/core-contributors.ts +18 -4
  102. package/src/time-series/resolve.ts +12 -0
  103. package/src/types/config.ts +17 -1
  104. package/src/types/plugin.ts +6 -0
@@ -726,10 +726,23 @@ function withLocalSessionLayoutState(
726
726
  });
727
727
  }
728
728
 
729
+ /** A dock tree with no stack's shown tab: like stacking order, it follows whichever pane was focused last. */
730
+ function withoutShownTabs(node: unknown): unknown {
731
+ if (!isRecord(node) || node.kind !== "split") return node;
732
+ const { tabs, ...rest } = node;
733
+ return {
734
+ ...rest,
735
+ first: withoutShownTabs(node.first),
736
+ second: withoutShownTabs(node.second),
737
+ ...(tabs === undefined ? {} : { tabs: true }),
738
+ };
739
+ }
740
+
729
741
  /**
730
- * A layout as the user arranged it. Stacking order follows whichever floating
731
- * pane was focused last, and a pane in its own desktop window is one a
732
- * terminal draws inline as a floating pane, so neither tells two copies apart.
742
+ * A layout as the user arranged it. Stacking order and the tab a stack shows
743
+ * follow whichever pane was focused last, and a pane in its own desktop window
744
+ * is one a terminal draws inline as a floating pane, so none of them tells two
745
+ * copies apart.
733
746
  */
734
747
  function arrangedLayout(layout: unknown): unknown {
735
748
  if (!isRecord(layout)) return layout;
@@ -743,7 +756,7 @@ function arrangedLayout(layout: unknown): unknown {
743
756
  });
744
757
  const instanceId = (entry: unknown) => (isRecord(entry) ? String(entry.instanceId) : "");
745
758
  windows.sort((left, right) => instanceId(left).localeCompare(instanceId(right)));
746
- return { ...layout, floating: windows, detached: [] };
759
+ return { ...layout, dockRoot: withoutShownTabs(layout.dockRoot), floating: windows, detached: [] };
747
760
  }
748
761
 
749
762
  // Pulled and last synced payloads are compared on every sync and never change.
@@ -1575,6 +1588,7 @@ export function createCoreSyncContributors(): SyncContributor[] {
1575
1588
  }
1576
1589
 
1577
1590
  export const __syncContributorInternalsForTests = {
1591
+ layoutIntent,
1578
1592
  sanitizeUnknown,
1579
1593
  collectCoreConfigPayload,
1580
1594
  collectCoreCollectionsPayload,
@@ -26,6 +26,8 @@ import { TIME_RANGES, type TimeRange } from "./range";
26
26
  import type { DataProvider } from "../types/data-provider";
27
27
  import type { CorporateActionsData, EarningsAction, Quote, TickerFinancials } from "../types/financials";
28
28
  import { mergeQuoteMetadata, quoteMetadataFromQuote, quoteMetadataMatchesTarget } from "../market-data/quotes/metadata";
29
+ import { getSharedMarketDataCoordinator } from "../market-data/coordinator";
30
+ import { resolveEntryData } from "../market-data/selectors";
29
31
  import type { FredSeriesRequest } from "../sources/gloomberb-cloud/fred-series";
30
32
  import { fredCreditCoverageNotice } from "./economic";
31
33
  import {
@@ -392,6 +394,16 @@ async function resolveChartSpecPass(
392
394
  const loadQuoteMetadata = (source: Extract<ChartSeriesSpec["source"], { kind: "security" }>) => {
393
395
  const key = instrumentKey(source);
394
396
  let pending = cache.quoteMetadataByInstrument.get(key);
397
+ // The pane showing this listing has usually just read its quote: its
398
+ // currency and type answer without asking the server for the quote again.
399
+ const held = resolveEntryData(getSharedMarketDataCoordinator()?.getQuoteEntry(source.instrument));
400
+ const heldMetadata = held ? quoteMetadataFromQuote(held) : null;
401
+ if (!pending && heldMetadata?.currency && heldMetadata.instrumentType
402
+ && quoteMetadataMatchesTarget(heldMetadata, source.instrument.symbol, source.instrument.exchange)) {
403
+ pending = Promise.resolve(heldMetadata);
404
+ cache.quoteMetadataByInstrument.set(key, pending);
405
+ cache.revision += 1;
406
+ }
395
407
  if (!pending) {
396
408
  const provider = sources.dataProvider!;
397
409
  pending = Promise.resolve().then(() => provider.getQuoteMetadata
@@ -1,6 +1,7 @@
1
1
  import type { Portfolio, Watchlist } from "./ticker";
2
2
  import type { BrokerContractRef, TickerListingRef } from "./instrument";
3
3
  import type { LanguagePreference } from "../i18n/languages";
4
+ import { buildDockStack } from "../layout/pane-manager/dock-stack";
4
5
 
5
6
  export const CURRENT_CONFIG_VERSION = 28;
6
7
 
@@ -42,7 +43,8 @@ export type PaneBinding =
42
43
  export interface DockedPlacementMemory {
43
44
  path?: Array<0 | 1>;
44
45
  anchorInstanceId?: string;
45
- position?: "left" | "right" | "above" | "below";
46
+ /** "tab": a tab of the stack `anchorInstanceId` is in. */
47
+ position?: "left" | "right" | "above" | "below" | "tab";
46
48
  }
47
49
 
48
50
  export interface FloatingPlacementMemory {
@@ -114,6 +116,11 @@ export interface DockSplitNode {
114
116
  ratio: number;
115
117
  first: DockLayoutNode;
116
118
  second: DockLayoutNode;
119
+ /**
120
+ * Set on every split of a stack of tabs, with the pane it shows: the panes
121
+ * under it share one spot (see layout/pane-manager/dock-stack.ts).
122
+ */
123
+ tabs?: { active: string };
117
124
  }
118
125
 
119
126
  export type DockLayoutNode = DockPaneNode | DockSplitNode;
@@ -624,6 +631,7 @@ function cloneDockNode(node: DockLayoutNode): DockLayoutNode {
624
631
  ratio: node.ratio,
625
632
  first: cloneDockNode(node.first),
626
633
  second: cloneDockNode(node.second),
634
+ ...(node.tabs ? { tabs: { active: node.tabs.active } } : {}),
627
635
  };
628
636
  }
629
637
 
@@ -645,6 +653,14 @@ function normalizeDockNode(
645
653
 
646
654
  if ((node as DockSplitNode).kind !== "split") return null;
647
655
  const split = node as DockSplitNode;
656
+ if (split.tabs) {
657
+ // Whatever is under a stack is its tabs, nested or not: a pane put back
658
+ // at a place inside it (its remembered spot) joins it.
659
+ const plain: DockSplitNode = { kind: "split", axis: split.axis, ratio: split.ratio, first: split.first, second: split.second };
660
+ const flat = normalizeDockNode(plain, validInstanceIds, seenPaneIds);
661
+ const active = typeof split.tabs.active === "string" ? split.tabs.active : null;
662
+ return flat ? buildDockStack(getDockedPaneIdsFromNode(flat), active) : null;
663
+ }
648
664
  const first = normalizeDockNode(split.first, validInstanceIds, seenPaneIds);
649
665
  const second = normalizeDockNode(split.second, validInstanceIds, seenPaneIds);
650
666
  if (!first && !second) return null;
@@ -151,6 +151,12 @@ export interface PaneDef {
151
151
  * win over the binding.
152
152
  */
153
153
  tickerFollower?: boolean | ((pane: PaneInstanceConfig) => boolean);
154
+ /**
155
+ * A single-ticker pane that keeps its ticker somewhere besides its binding (a chart's series)
156
+ * moves it here when ticker search changes the ticker the pane shows. The host has already set
157
+ * the binding and the title; `previous` is the ticker the pane showed until now.
158
+ */
159
+ retargetTicker?(pane: PaneInstanceConfig, symbol: string, previous: string | null): PaneInstanceConfig;
154
160
  /**
155
161
  * Instrument kinds this pane has data for, such as `["equity"]` for company
156
162
  * data, as a research tab declares them. Bound to a ticker of another known