@dsh-ft/dsh-fft-paper-trading 0.4.0 → 0.5.0
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/README.md +10 -1
- package/lib/client.js +29 -0
- package/node_modules/@ftshare-lab/dsh-kline/lib/client/BetterSidebarTab.js +2 -1
- package/node_modules/@ftshare-lab/dsh-kline/lib/client/generated-view.js +15 -72
- package/node_modules/@ftshare-lab/dsh-kline/lib/client/index.js +10 -28
- package/node_modules/@ftshare-lab/dsh-kline/lib/client/mode-preferences.js +10 -7
- package/node_modules/@ftshare-lab/dsh-kline/lib/client/native-sidebar-contract.js +36 -0
- package/node_modules/@ftshare-lab/dsh-kline/lib/client/native-sidebar.js +99 -0
- package/node_modules/@ftshare-lab/dsh-kline/lib/client/ui-onboarding.js +10 -1
- package/node_modules/@ftshare-lab/dsh-kline/lib/client.js +193 -121
- package/node_modules/@ftshare-lab/dsh-kline/lib/client.js.map +1 -1
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/BetterSidebarTab.d.ts +5 -0
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/host-services.d.ts +36 -0
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/mode-preferences.d.ts +1 -1
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/native-sidebar-contract.d.ts +21 -0
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/native-sidebar.d.ts +62 -0
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/ui-onboarding.d.ts +9 -2
- package/node_modules/@ftshare-lab/dsh-kline/view/kline.html +13 -79
- package/package.json +3 -9
- package/src/client/index.js +29 -0
- package/node_modules/@dsh-ft/dsh-fft-ftshare/README.md +0 -73
- package/node_modules/@dsh-ft/dsh-fft-ftshare/catalog.json +0 -9762
- package/node_modules/@dsh-ft/dsh-fft-ftshare/catalog.meta.json +0 -7
- package/node_modules/@dsh-ft/dsh-fft-ftshare/catalog.txt +0 -250
- package/node_modules/@dsh-ft/dsh-fft-ftshare/cordis.patch.yml +0 -27
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/capabilities.d.ts +0 -47
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/capabilities.d.ts.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/capabilities.js +0 -145
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/capabilities.js.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/catalog-host.d.ts +0 -19
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/catalog-host.d.ts.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/catalog-host.js +0 -31
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/catalog-host.js.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/catalog.d.ts +0 -51
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/catalog.d.ts.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/catalog.js +0 -60
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/catalog.js.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/client.d.ts +0 -52
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/client.d.ts.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/client.js +0 -149
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/client.js.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/contract.d.ts +0 -122
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/contract.d.ts.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/contract.js +0 -24
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/contract.js.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/errors.d.ts +0 -93
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/errors.d.ts.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/errors.js +0 -261
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/errors.js.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/index.d.ts +0 -64
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/index.d.ts.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/index.js +0 -160
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/index.js.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/mask.d.ts +0 -66
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/mask.d.ts.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/mask.js +0 -106
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/mask.js.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/project.d.ts +0 -98
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/project.d.ts.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/project.js +0 -326
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/project.js.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/route.d.ts +0 -48
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/route.d.ts.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/route.js +0 -90
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/route.js.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/tools.d.ts +0 -31
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/tools.d.ts.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/tools.js +0 -132
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/tools.js.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/transport.d.ts +0 -53
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/transport.d.ts.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/transport.js +0 -147
- package/node_modules/@dsh-ft/dsh-fft-ftshare/lib/transport.js.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-ftshare/package.json +0 -82
- package/node_modules/@dsh-ft/dsh-fft-settings/README.md +0 -385
- package/node_modules/@dsh-ft/dsh-fft-settings/cordis.patch.yml +0 -18
- package/node_modules/@dsh-ft/dsh-fft-settings/docs/compatibility-dsh-0.1.6-alpha.1.md +0 -58
- package/node_modules/@dsh-ft/dsh-fft-settings/docs/extension-service-design.md +0 -351
- package/node_modules/@dsh-ft/dsh-fft-settings/docs/extension-service-sequences.html +0 -545
- package/node_modules/@dsh-ft/dsh-fft-settings/docs/ftshare-settings-er.html +0 -139
- package/node_modules/@dsh-ft/dsh-fft-settings/docs/ftshare-settings-er.svg +0 -113
- package/node_modules/@dsh-ft/dsh-fft-settings/docs/ftshare-settings-results-er.html +0 -148
- package/node_modules/@dsh-ft/dsh-fft-settings/docs/ftshare-settings-results-er.svg +0 -122
- package/node_modules/@dsh-ft/dsh-fft-settings/docs/kline-integration.md +0 -258
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/agent.d.ts +0 -24
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/agent.js +0 -26
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/brand.d.ts +0 -53
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/brand.js +0 -50
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/client.d.ts +0 -8
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/client.js +0 -822
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/client.js.map +0 -1
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/contract.d.ts +0 -14
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/contract.js +0 -14
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/core/client-transport.d.ts +0 -15
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/core/client-transport.js +0 -31
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/core/contract.d.ts +0 -62
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/core/contract.js +0 -28
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/core/module-registry.d.ts +0 -54
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/core/module-registry.js +0 -68
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/core/rpc-core.d.ts +0 -69
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/core/rpc-core.js +0 -88
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/core/shell.d.ts +0 -59
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/core/shell.js +0 -28
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/core/styles.d.ts +0 -31
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/core/styles.js +0 -43
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/core/transport.d.ts +0 -19
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/core/transport.js +0 -80
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/default-preset.d.ts +0 -52
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/default-preset.js +0 -121
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/card.d.ts +0 -24
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/card.js +0 -39
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/client-api.d.ts +0 -4
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/client-api.js +0 -11
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/contract.d.ts +0 -69
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/contract.js +0 -24
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/host.d.ts +0 -17
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/host.js +0 -32
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/index.d.ts +0 -13
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/index.js +0 -12
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/logging.d.ts +0 -15
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/logging.js +0 -1
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/model.d.ts +0 -24
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/model.js +0 -105
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/probe.d.ts +0 -11
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/probe.js +0 -142
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/rpc.d.ts +0 -4
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/rpc.js +0 -17
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/service.d.ts +0 -21
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/service.js +0 -181
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/styles.d.ts +0 -9
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/api-key/styles.js +0 -24
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/archive.d.ts +0 -87
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/archive.js +0 -156
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/card.d.ts +0 -22
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/card.js +0 -107
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/client-api.d.ts +0 -4
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/client-api.js +0 -11
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/collector.d.ts +0 -91
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/collector.js +0 -258
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/config.d.ts +0 -70
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/config.js +0 -97
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/contract.d.ts +0 -130
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/contract.js +0 -67
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/export.d.ts +0 -92
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/export.js +0 -212
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/format.d.ts +0 -42
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/format.js +0 -172
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/home.d.ts +0 -18
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/home.js +0 -39
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/host.d.ts +0 -19
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/host.js +0 -139
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/index.d.ts +0 -12
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/index.js +0 -12
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/rpc.d.ts +0 -6
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/rpc.js +0 -27
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/styles.d.ts +0 -9
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/features/logs/styles.js +0 -13
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/guidance.d.ts +0 -41
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/guidance.js +0 -88
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/index.d.ts +0 -67
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/index.js +0 -50
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/rpc.d.ts +0 -10
- package/node_modules/@dsh-ft/dsh-fft-settings/lib/rpc.js +0 -10
- package/node_modules/@dsh-ft/dsh-fft-settings/package.json +0 -80
- package/node_modules/@dsh-ft/dsh-fft-settings/src/agent.ts +0 -31
- package/node_modules/@dsh-ft/dsh-fft-settings/src/brand.ts +0 -79
- package/node_modules/@dsh-ft/dsh-fft-settings/src/client.tsx +0 -21
- package/node_modules/@dsh-ft/dsh-fft-settings/src/contract.ts +0 -14
- package/node_modules/@dsh-ft/dsh-fft-settings/src/core/client-transport.ts +0 -37
- package/node_modules/@dsh-ft/dsh-fft-settings/src/core/contract.ts +0 -57
- package/node_modules/@dsh-ft/dsh-fft-settings/src/core/module-registry.ts +0 -102
- package/node_modules/@dsh-ft/dsh-fft-settings/src/core/rpc-core.ts +0 -107
- package/node_modules/@dsh-ft/dsh-fft-settings/src/core/shell.tsx +0 -81
- package/node_modules/@dsh-ft/dsh-fft-settings/src/core/styles.ts +0 -43
- package/node_modules/@dsh-ft/dsh-fft-settings/src/core/transport.ts +0 -82
- package/node_modules/@dsh-ft/dsh-fft-settings/src/default-preset.ts +0 -151
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/api-key/card.tsx +0 -77
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/api-key/client-api.ts +0 -12
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/api-key/contract.ts +0 -63
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/api-key/host.ts +0 -36
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/api-key/index.ts +0 -13
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/api-key/logging.ts +0 -15
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/api-key/model.ts +0 -63
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/api-key/probe.ts +0 -116
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/api-key/rpc.ts +0 -18
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/api-key/service.ts +0 -157
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/api-key/styles.ts +0 -24
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/logs/archive.ts +0 -230
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/logs/card.tsx +0 -169
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/logs/client-api.ts +0 -20
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/logs/collector.ts +0 -313
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/logs/config.ts +0 -115
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/logs/contract.ts +0 -149
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/logs/export.ts +0 -274
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/logs/format.ts +0 -188
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/logs/home.ts +0 -43
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/logs/host.ts +0 -153
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/logs/index.ts +0 -12
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/logs/rpc.ts +0 -29
- package/node_modules/@dsh-ft/dsh-fft-settings/src/features/logs/styles.ts +0 -13
- package/node_modules/@dsh-ft/dsh-fft-settings/src/guidance.ts +0 -114
- package/node_modules/@dsh-ft/dsh-fft-settings/src/index.ts +0 -59
- package/node_modules/@dsh-ft/dsh-fft-settings/src/rpc.ts +0 -10
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useSyncExternalStore } from 'react';
|
|
3
3
|
import { createRoot } from 'react-dom/client';
|
|
4
4
|
import { ClassicShell } from './ClassicShell';
|
|
5
5
|
import { BetterSidebarBridge } from './BetterSidebarTab';
|
|
6
|
+
import { NativeSidebarBridgeView, registerNativeSidebar } from './native-sidebar';
|
|
6
7
|
import { isSidebarUsable } from './sidebar-integration';
|
|
7
8
|
import { InterfaceContext, readDisplayMode, resolveDisplayMode } from './mode-preferences';
|
|
8
9
|
import { captureOnboarding } from './ui-onboarding';
|
|
@@ -13,18 +14,18 @@ export function apply(ctx) {
|
|
|
13
14
|
let service;
|
|
14
15
|
const listeners = new Set();
|
|
15
16
|
const emit = () => listeners.forEach(listener => listener());
|
|
17
|
+
const subscribe = (listener) => { listeners.add(listener); return () => { listeners.delete(listener); }; };
|
|
16
18
|
const preference = readDisplayMode();
|
|
17
19
|
captureOnboarding();
|
|
20
|
+
// Registered before the router paints, so the first frame already knows
|
|
21
|
+
// whether the host owns a right column this plugin can tab into.
|
|
22
|
+
const native = registerNativeSidebar(ctx, emit);
|
|
18
23
|
function Router() {
|
|
19
|
-
const sidebar = useSyncExternalStore(
|
|
20
|
-
const
|
|
21
|
-
const available = isSidebarUsable(sidebar);
|
|
24
|
+
const sidebar = useSyncExternalStore(subscribe, () => service);
|
|
25
|
+
const nativeTab = useSyncExternalStore(subscribe, () => native.available());
|
|
26
|
+
const available = nativeTab || isSidebarUsable(sidebar);
|
|
22
27
|
const mode = resolveDisplayMode(preference, available);
|
|
23
|
-
|
|
24
|
-
// New Session screen. Keep the classic K launcher there even when the
|
|
25
|
-
// user prefers native tabs, so the plugin never loses its first entry.
|
|
26
|
-
const showClassicLauncher = mode === 'classic' || !hostHasRightSidebar;
|
|
27
|
-
return _jsxs(InterfaceContext.Provider, { value: { preference, mode, available }, children: [sidebar && _jsx(BetterSidebarBridge, { service: sidebar, sessions: ctx.sessions }), showClassicLauncher && _jsx(ClassicShell, { sessions: ctx.sessions })] });
|
|
28
|
+
return _jsxs(InterfaceContext.Provider, { value: { preference, mode, available }, children: [nativeTab && _jsx(NativeSidebarBridgeView, { bridge: native, sessions: ctx.sessions }), !nativeTab && sidebar && _jsx(BetterSidebarBridge, { service: sidebar, sessions: ctx.sessions }), mode === 'classic' && _jsx(ClassicShell, { sessions: ctx.sessions })] });
|
|
28
29
|
}
|
|
29
30
|
ctx.effect(() => {
|
|
30
31
|
const host = document.createElement('div');
|
|
@@ -47,22 +48,3 @@ export function apply(ctx) {
|
|
|
47
48
|
registerCanvasHost(ctx);
|
|
48
49
|
registerPaperTradingHost(ctx);
|
|
49
50
|
}
|
|
50
|
-
function hostRightSidebarAvailable() {
|
|
51
|
-
const control = document.querySelector('[aria-label="Open right sidebar"], [aria-label="Collapse right sidebar"]');
|
|
52
|
-
if (!control)
|
|
53
|
-
return false;
|
|
54
|
-
const style = window.getComputedStyle(control);
|
|
55
|
-
const bounds = control.getBoundingClientRect();
|
|
56
|
-
return style.display !== 'none' && style.visibility !== 'hidden' && bounds.width > 0 && bounds.height > 0;
|
|
57
|
-
}
|
|
58
|
-
function useHostRightSidebar() {
|
|
59
|
-
const [available, setAvailable] = useState(hostRightSidebarAvailable);
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
const refresh = () => setAvailable(hostRightSidebarAvailable());
|
|
62
|
-
refresh();
|
|
63
|
-
const observer = new MutationObserver(refresh);
|
|
64
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
65
|
-
return () => observer.disconnect();
|
|
66
|
-
}, []);
|
|
67
|
-
return available;
|
|
68
|
-
}
|
|
@@ -6,17 +6,20 @@ export const InterfaceContext = createContext({ preference: 'classic', mode: 'cl
|
|
|
6
6
|
export function readDisplayMode(storage = globalThis.localStorage) {
|
|
7
7
|
try {
|
|
8
8
|
const value = storage.getItem(DISPLAY_MODE_KEY);
|
|
9
|
-
|
|
9
|
+
// The right-column tab is the default now that the classic K launcher is
|
|
10
|
+
// gone; a stored preference is kept only so an older profile keeps reading.
|
|
11
|
+
return value === 'classic' || value === 'better-sidebar' ? value : 'auto';
|
|
10
12
|
}
|
|
11
13
|
catch {
|
|
12
|
-
return '
|
|
14
|
+
return 'auto';
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
|
-
export function resolveDisplayMode(
|
|
16
|
-
// A
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
|
|
17
|
+
export function resolveDisplayMode(_preference, available) {
|
|
18
|
+
// A host with a right column always gets the tab: there is no floating
|
|
19
|
+
// launcher left to fall back to, so a stored "classic" must not strand the
|
|
20
|
+
// chart. The classic value survives only for a host that offers no right
|
|
21
|
+
// column at all (see index.tsx, which then draws the classic shell).
|
|
22
|
+
return available ? 'better-sidebar' : 'classic';
|
|
20
23
|
}
|
|
21
24
|
export function readAutoOpen(storage = globalThis.localStorage) {
|
|
22
25
|
try {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { KLINE_TAB_ID, klineTabTitle } from "./sidebar-integration.js";
|
|
2
|
+
/**
|
|
3
|
+
* The static half of the native right-Sidebar integration.
|
|
4
|
+
*
|
|
5
|
+
* Kept free of JSX so the tests can import it directly: the registration itself
|
|
6
|
+
* needs a host context, but what this plugin contributes — the tab kind, the
|
|
7
|
+
* band it registers in, the chip title and the guide entry — is plain data.
|
|
8
|
+
*/
|
|
9
|
+
/** Implementation identity of the tab type; also the key its body registers under. */
|
|
10
|
+
export const NATIVE_TAB_ID = 'ftshare-kline';
|
|
11
|
+
/**
|
|
12
|
+
* The type definition this plugin contributes.
|
|
13
|
+
*
|
|
14
|
+
* A page type (no address `patterns`) is opened by kind, which is what the
|
|
15
|
+
* auto-open path does; the guide entry is how a person reaches the chart from
|
|
16
|
+
* the host's own "add tab" page. Both keep the product label separate from the
|
|
17
|
+
* internal kind, exactly like the Better Sidebar title does.
|
|
18
|
+
*/
|
|
19
|
+
export function nativeTabDefinition() {
|
|
20
|
+
return {
|
|
21
|
+
id: NATIVE_TAB_ID,
|
|
22
|
+
kind: KLINE_TAB_ID,
|
|
23
|
+
priority: 'extension',
|
|
24
|
+
title: () => klineTabTitle(),
|
|
25
|
+
guide: [{
|
|
26
|
+
id: NATIVE_TAB_ID,
|
|
27
|
+
order: 120,
|
|
28
|
+
title: () => klineTabTitle(),
|
|
29
|
+
description: nativeTabDescription,
|
|
30
|
+
}],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** One line under the guide capsule: what picking it opens, in the host language. */
|
|
34
|
+
export function nativeTabDescription(locale = globalThis.navigator?.language ?? '') {
|
|
35
|
+
return /^zh(?:-|$)/i.test(locale) ? '行情图表与关键点位分析' : 'Market chart and key-level analysis';
|
|
36
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useSyncExternalStore } from 'react';
|
|
3
|
+
import { useChartReference } from './chart-session-resolver';
|
|
4
|
+
import { KlineTabContent } from './BetterSidebarTab';
|
|
5
|
+
import { InterfaceContext, readAutoOpen, readDisplayMode } from './mode-preferences';
|
|
6
|
+
import { KLINE_TAB_ID } from './sidebar-integration';
|
|
7
|
+
import { NATIVE_TAB_ID, nativeTabDefinition } from './native-sidebar-contract';
|
|
8
|
+
export { NATIVE_TAB_ID, nativeTabDefinition, nativeTabDescription } from './native-sidebar-contract';
|
|
9
|
+
/**
|
|
10
|
+
* One tab body: the same chart the Better Sidebar tab and the paper-trading
|
|
11
|
+
* panel draw, mounted against the tab's own conversation.
|
|
12
|
+
*
|
|
13
|
+
* The interface state is the native-tab one: the chart view uses it only to
|
|
14
|
+
* know which shell it lives in, so the tab reports `better-sidebar` (the
|
|
15
|
+
* existing "native tab" value) and stays independent of the user's preference.
|
|
16
|
+
*/
|
|
17
|
+
export function NativeKlineTabBody({ sessionId, sessions, useTabInfo }) {
|
|
18
|
+
const visible = useTabInfo().tab.visible;
|
|
19
|
+
return (_jsx(InterfaceContext.Provider, { value: { preference: readDisplayMode(), mode: 'better-sidebar', available: true }, children: _jsx("div", { "data-dsh-kline-tab": "", style: { width: '100%', height: '100%', minHeight: 0, overflow: 'hidden' }, children: visible && _jsx(KlineTabContent, { sessions: sessions, conversationId: sessionId }, sessionId) }) }));
|
|
20
|
+
}
|
|
21
|
+
/** Reveal the chart tab when an analysis result lands in the conversation on screen. */
|
|
22
|
+
function NativeAutoOpen({ sessions, conversationId, bridge }) {
|
|
23
|
+
useChartReference(sessions, conversationId, () => { if (readAutoOpen())
|
|
24
|
+
bridge.open(); });
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
/** Auto-open lives in the tab's own session, exactly like the Better Sidebar path. */
|
|
28
|
+
export function NativeSidebarBridgeView({ bridge, sessions }) {
|
|
29
|
+
const list = useSyncExternalStore(listener => sessions.list.subscribe(listener), () => sessions.list.getSnapshot());
|
|
30
|
+
return list.current
|
|
31
|
+
? _jsx(NativeAutoOpen, { bridge: bridge, sessions: sessions, conversationId: list.current }, list.current)
|
|
32
|
+
: null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Register the chart tab into the host's native right Sidebar.
|
|
36
|
+
*
|
|
37
|
+
* Every host service is optional: a host without `sidebarRightTabs`, `sidebarRight`
|
|
38
|
+
* or `slots` simply gets `available() === false` and the plugin keeps working
|
|
39
|
+
* through the interfaces it does have.
|
|
40
|
+
* @param ctx - the client context to register on.
|
|
41
|
+
* @param onChange - called whenever availability changes, so the router repaints.
|
|
42
|
+
* @returns the handle the router and the auto-open path share.
|
|
43
|
+
*/
|
|
44
|
+
export function registerNativeSidebar(ctx, onChange) {
|
|
45
|
+
let registry;
|
|
46
|
+
let navigation;
|
|
47
|
+
const bridge = {
|
|
48
|
+
available: () => registry !== undefined,
|
|
49
|
+
open: () => {
|
|
50
|
+
try {
|
|
51
|
+
navigation?.openTab(KLINE_TAB_ID);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// A host with no Session on screen has nothing to open into; the next
|
|
55
|
+
// analysis result or the guide entry opens it then.
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
ctx.inject(['sidebarRightTabs', 'sidebarRight', 'slots'], scope => {
|
|
60
|
+
scope.effect(() => {
|
|
61
|
+
const tabs = scope.get('sidebarRightTabs');
|
|
62
|
+
const column = scope.get('sidebarRight');
|
|
63
|
+
const slots = scope.slots;
|
|
64
|
+
if (tabs === undefined || column === undefined || slots === undefined)
|
|
65
|
+
return () => { };
|
|
66
|
+
const disposers = [];
|
|
67
|
+
let disposeType;
|
|
68
|
+
try {
|
|
69
|
+
disposeType = tabs.register(nativeTabDefinition());
|
|
70
|
+
disposers.push(slots.inject('sidebar.right.pane.tab', () => slots.register({
|
|
71
|
+
name: 'sidebar.right.pane.tab',
|
|
72
|
+
key: NATIVE_TAB_ID,
|
|
73
|
+
inject: (sessionId) => ({ sessions: ctx.sessions, sessionId }),
|
|
74
|
+
}, NativeKlineTabBody)));
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
// A half-registered type would show the host's empty-pane notice: back
|
|
78
|
+
// both stages out and let the router choose another interface.
|
|
79
|
+
for (const dispose of disposers.reverse())
|
|
80
|
+
dispose();
|
|
81
|
+
disposeType?.();
|
|
82
|
+
console.error('[dsh-kline] native right sidebar registration failed:', error);
|
|
83
|
+
return () => { };
|
|
84
|
+
}
|
|
85
|
+
registry = tabs;
|
|
86
|
+
navigation = column;
|
|
87
|
+
onChange();
|
|
88
|
+
return () => {
|
|
89
|
+
registry = undefined;
|
|
90
|
+
navigation = undefined;
|
|
91
|
+
for (const dispose of disposers.reverse())
|
|
92
|
+
dispose();
|
|
93
|
+
disposeType?.();
|
|
94
|
+
onChange();
|
|
95
|
+
};
|
|
96
|
+
}, 'dsh-kline: native right sidebar tab');
|
|
97
|
+
});
|
|
98
|
+
return bridge;
|
|
99
|
+
}
|
|
@@ -22,11 +22,18 @@ export function onboardingKind(storage = globalThis.localStorage) {
|
|
|
22
22
|
captureOnboarding(storage);
|
|
23
23
|
return classifyOnboarding(storage, existingUser === true);
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Only a returning user gets a one-time notice.
|
|
27
|
+
*
|
|
28
|
+
* A fresh install gets no dialog at all: the chart opens straight into its
|
|
29
|
+
* workspace, because the first-run welcome that used to pitch the FTShare key
|
|
30
|
+
* is gone.
|
|
31
|
+
*/
|
|
25
32
|
export function classifyOnboarding(storage, previousUsage) {
|
|
26
33
|
try {
|
|
27
34
|
if (storage.getItem(UI_SEEN_KEY))
|
|
28
35
|
return 'none';
|
|
29
|
-
return previousUsage ? 'upgrade' : '
|
|
36
|
+
return previousUsage ? 'upgrade' : 'none';
|
|
30
37
|
}
|
|
31
38
|
catch {
|
|
32
39
|
return 'none';
|
|
@@ -36,6 +43,8 @@ export function acknowledgeOnboarding(storage = globalThis.localStorage) {
|
|
|
36
43
|
try {
|
|
37
44
|
storage.setItem(UI_SEEN_KEY, '1');
|
|
38
45
|
storage.setItem(ONBOARDING_KEY, '0.2.0');
|
|
46
|
+
// Legacy marker: older builds keyed their first-run welcome on it, and it
|
|
47
|
+
// still tells `hasPreviousUsage` that this browser has been used before.
|
|
39
48
|
storage.setItem('dsh_kline_welcome_seen_v1', '1');
|
|
40
49
|
}
|
|
41
50
|
catch { }
|