@orangecharts/wrun-chart-host 0.1.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 +72 -0
- package/dist/constants/governed-exchanges.constants.d.ts +11 -0
- package/dist/constants/governed-exchanges.constants.js +11 -0
- package/dist/constants/indicator-sets.constants.d.ts +8 -0
- package/dist/constants/indicator-sets.constants.js +8 -0
- package/dist/constants/interval.constants.d.ts +34 -0
- package/dist/constants/interval.constants.js +121 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +28 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +65 -0
- package/dist/constants/tpo-color-schemes.constants.d.ts +30 -0
- package/dist/constants/tpo-color-schemes.constants.js +32 -0
- package/dist/host-env.d.ts +102 -0
- package/dist/host-env.js +26 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.js +96 -0
- package/dist/indicators/controls/tpo-letter.util.d.ts +2 -0
- package/dist/indicators/controls/tpo-letter.util.js +13 -0
- package/dist/indicators/controls/tpo-session.util.d.ts +99 -0
- package/dist/indicators/controls/tpo-session.util.js +389 -0
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +64 -0
- package/dist/interfaces/kscript-diagnostics.interface.js +1 -0
- package/dist/interfaces/om-panel-data.interface.d.ts +103 -0
- package/dist/interfaces/om-panel-data.interface.js +7 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +2659 -0
- package/dist/interfaces/wrun-runtime.interface.js +55 -0
- package/dist/utility/chart/calendar-interval.util.d.ts +24 -0
- package/dist/utility/chart/calendar-interval.util.js +81 -0
- package/dist/utility/chart/candle-bar-end.util.d.ts +15 -0
- package/dist/utility/chart/candle-bar-end.util.js +23 -0
- package/dist/utility/chart/cme-realtime.util.d.ts +24 -0
- package/dist/utility/chart/cme-realtime.util.js +53 -0
- package/dist/utility/chart/interval-ladder.util.d.ts +27 -0
- package/dist/utility/chart/interval-ladder.util.js +92 -0
- package/dist/utility/chart/kscript-drawing-prep.util.d.ts +40 -0
- package/dist/utility/chart/kscript-drawing-prep.util.js +184 -0
- package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +95 -0
- package/dist/utility/chart/kscript-drawing-safe-area.util.js +805 -0
- package/dist/utility/chart/kscript-legend-entries.util.d.ts +166 -0
- package/dist/utility/chart/kscript-legend-entries.util.js +538 -0
- package/dist/utility/chart/kscript-output-role.util.d.ts +32 -0
- package/dist/utility/chart/kscript-output-role.util.js +215 -0
- package/dist/utility/chart/kscript-provenance-keys.util.d.ts +22 -0
- package/dist/utility/chart/kscript-provenance-keys.util.js +56 -0
- package/dist/utility/chart/kscript-run-result-normalize.util.d.ts +53 -0
- package/dist/utility/chart/kscript-run-result-normalize.util.js +476 -0
- package/dist/utility/chart/kscript-run-result-shape.util.d.ts +14 -0
- package/dist/utility/chart/kscript-run-result-shape.util.js +66 -0
- package/dist/utility/chart/kscript-titancharts-container.util.d.ts +29 -0
- package/dist/utility/chart/kscript-titancharts-container.util.js +151 -0
- package/dist/utility/chart/kscript-viewport-overlays.util.d.ts +83 -0
- package/dist/utility/chart/kscript-viewport-overlays.util.js +443 -0
- package/dist/utility/chart/om-panel-push-style.util.d.ts +78 -0
- package/dist/utility/chart/om-panel-push-style.util.js +301 -0
- package/dist/utility/chart/om-panel.util.d.ts +166 -0
- package/dist/utility/chart/om-panel.util.js +815 -0
- package/dist/utility/chart/om-series.util.d.ts +42 -0
- package/dist/utility/chart/om-series.util.js +330 -0
- package/dist/utility/chart/om-target.util.d.ts +11 -0
- package/dist/utility/chart/om-target.util.js +24 -0
- package/dist/utility/chart/om-widget.util.d.ts +148 -0
- package/dist/utility/chart/om-widget.util.js +413 -0
- package/dist/utility/chart/overlay-output-budget.util.d.ts +16 -0
- package/dist/utility/chart/overlay-output-budget.util.js +109 -0
- package/dist/utility/chart/overlay-paint-flags.util.d.ts +24 -0
- package/dist/utility/chart/overlay-paint-flags.util.js +55 -0
- package/dist/utility/chart/profile-row-height.util.d.ts +21 -0
- package/dist/utility/chart/profile-row-height.util.js +110 -0
- package/dist/utility/chart/session-interval.util.d.ts +1 -0
- package/dist/utility/chart/session-interval.util.js +35 -0
- package/dist/utility/chart/technical-script-legend-value.util.d.ts +18 -0
- package/dist/utility/chart/technical-script-legend-value.util.js +53 -0
- package/dist/utility/chart/trading-day.util.d.ts +70 -0
- package/dist/utility/chart/trading-day.util.js +238 -0
- package/dist/utility/chart/wrun-legend-name.util.d.ts +25 -0
- package/dist/utility/chart/wrun-legend-name.util.js +87 -0
- package/dist/utility/chart/wrun-run-result.util.d.ts +977 -0
- package/dist/utility/chart/wrun-run-result.util.js +5179 -0
- package/dist/utility/chart/wrun-visibility-chart.util.d.ts +25 -0
- package/dist/utility/chart/wrun-visibility-chart.util.js +22 -0
- package/dist/utility/indicators/heatmap-sensitivity.util.d.ts +62 -0
- package/dist/utility/indicators/heatmap-sensitivity.util.js +82 -0
- package/dist/utility/number-format.util.d.ts +68 -0
- package/dist/utility/number-format.util.js +188 -0
- package/dist/utility/v2/opra-governed.util.d.ts +1 -0
- package/dist/utility/v2/opra-governed.util.js +13 -0
- package/dist/utility/wrun/wrun-auto-row.util.d.ts +54 -0
- package/dist/utility/wrun/wrun-auto-row.util.js +96 -0
- package/dist/utility/wrun/wrun-batched-marks.util.d.ts +341 -0
- package/dist/utility/wrun/wrun-batched-marks.util.js +938 -0
- package/dist/utility/wrun/wrun-batched-readout.util.d.ts +75 -0
- package/dist/utility/wrun/wrun-batched-readout.util.js +171 -0
- package/dist/utility/wrun/wrun-box-segment.util.d.ts +185 -0
- package/dist/utility/wrun/wrun-box-segment.util.js +570 -0
- package/dist/utility/wrun/wrun-build-memo.util.d.ts +133 -0
- package/dist/utility/wrun/wrun-build-memo.util.js +301 -0
- package/dist/utility/wrun/wrun-builtin-twin-ports.util.d.ts +25 -0
- package/dist/utility/wrun/wrun-builtin-twin-ports.util.js +75 -0
- package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-builtin-twin.util.js +40 -0
- package/dist/utility/wrun/wrun-canvas-cache.util.d.ts +28 -0
- package/dist/utility/wrun/wrun-canvas-cache.util.js +56 -0
- package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +69 -0
- package/dist/utility/wrun/wrun-canvas-readout.util.js +53 -0
- package/dist/utility/wrun/wrun-canvases.util.d.ts +295 -0
- package/dist/utility/wrun/wrun-canvases.util.js +1432 -0
- package/dist/utility/wrun/wrun-cap-notice.util.d.ts +77 -0
- package/dist/utility/wrun/wrun-cap-notice.util.js +296 -0
- package/dist/utility/wrun/wrun-card-style.util.d.ts +154 -0
- package/dist/utility/wrun/wrun-card-style.util.js +539 -0
- package/dist/utility/wrun/wrun-chart-context.util.d.ts +89 -0
- package/dist/utility/wrun/wrun-chart-context.util.js +213 -0
- package/dist/utility/wrun/wrun-chart-names.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-chart-names.util.js +33 -0
- package/dist/utility/wrun/wrun-chart-time.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-chart-time.util.js +23 -0
- package/dist/utility/wrun/wrun-child-overlay-id.util.d.ts +13 -0
- package/dist/utility/wrun/wrun-child-overlay-id.util.js +44 -0
- package/dist/utility/wrun/wrun-color-facts.util.d.ts +40 -0
- package/dist/utility/wrun/wrun-color-facts.util.js +88 -0
- package/dist/utility/wrun/wrun-color-settings.lazy.d.ts +26 -0
- package/dist/utility/wrun/wrun-color-settings.lazy.js +9 -0
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +351 -0
- package/dist/utility/wrun/wrun-color-settings.util.js +1363 -0
- package/dist/utility/wrun/wrun-footprint-modes.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-footprint-modes.util.js +24 -0
- package/dist/utility/wrun/wrun-frames.d.ts +217 -0
- package/dist/utility/wrun/wrun-frames.js +1021 -0
- package/dist/utility/wrun/wrun-handles.util.d.ts +792 -0
- package/dist/utility/wrun/wrun-handles.util.js +2050 -0
- package/dist/utility/wrun/wrun-heatmap-cell-budget.util.d.ts +156 -0
- package/dist/utility/wrun/wrun-heatmap-cell-budget.util.js +342 -0
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +218 -0
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +667 -0
- package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +40 -0
- package/dist/utility/wrun/wrun-hosted-wire.util.js +27 -0
- package/dist/utility/wrun/wrun-hover.util.d.ts +182 -0
- package/dist/utility/wrun/wrun-hover.util.js +534 -0
- package/dist/utility/wrun/wrun-hud-looks.util.d.ts +246 -0
- package/dist/utility/wrun/wrun-hud-looks.util.js +587 -0
- package/dist/utility/wrun/wrun-integration-budget.util.d.ts +47 -0
- package/dist/utility/wrun/wrun-integration-budget.util.js +122 -0
- package/dist/utility/wrun/wrun-latest-snapshot.d.ts +19 -0
- package/dist/utility/wrun/wrun-latest-snapshot.js +7 -0
- package/dist/utility/wrun/wrun-levels-child.util.d.ts +131 -0
- package/dist/utility/wrun/wrun-levels-child.util.js +514 -0
- package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +75 -0
- package/dist/utility/wrun/wrun-lifecycle.contract.js +9 -0
- package/dist/utility/wrun/wrun-market-facts.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-market-facts.util.js +238 -0
- package/dist/utility/wrun/wrun-output-style.util.d.ts +344 -0
- package/dist/utility/wrun/wrun-output-style.util.js +1239 -0
- package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +84 -0
- package/dist/utility/wrun/wrun-overlay-identity.util.js +142 -0
- package/dist/utility/wrun/wrun-overlay-result.util.d.ts +120 -0
- package/dist/utility/wrun/wrun-overlay-result.util.js +219 -0
- package/dist/utility/wrun/wrun-pack.util.d.ts +70 -0
- package/dist/utility/wrun/wrun-pack.util.js +301 -0
- package/dist/utility/wrun/wrun-pane-format.util.d.ts +180 -0
- package/dist/utility/wrun/wrun-pane-format.util.js +299 -0
- package/dist/utility/wrun/wrun-panel-style.lazy.d.ts +25 -0
- package/dist/utility/wrun/wrun-panel-style.lazy.js +15 -0
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +174 -0
- package/dist/utility/wrun/wrun-panel-style.util.js +726 -0
- package/dist/utility/wrun/wrun-param-values.util.d.ts +69 -0
- package/dist/utility/wrun/wrun-param-values.util.js +230 -0
- package/dist/utility/wrun/wrun-refusal.util.d.ts +263 -0
- package/dist/utility/wrun/wrun-refusal.util.js +1259 -0
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +199 -0
- package/dist/utility/wrun/wrun-registry-errors.util.js +257 -0
- package/dist/utility/wrun/wrun-render-select.util.d.ts +336 -0
- package/dist/utility/wrun/wrun-render-select.util.js +1157 -0
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +434 -0
- package/dist/utility/wrun/wrun-script-inputs.util.js +1971 -0
- package/dist/utility/wrun/wrun-setting-words.lazy.d.ts +20 -0
- package/dist/utility/wrun/wrun-setting-words.lazy.js +9 -0
- package/dist/utility/wrun/wrun-setting-words.util.d.ts +79 -0
- package/dist/utility/wrun/wrun-setting-words.util.js +176 -0
- package/dist/utility/wrun/wrun-socket-row-store.d.ts +98 -0
- package/dist/utility/wrun/wrun-socket-row-store.js +417 -0
- package/dist/utility/wrun/wrun-style-flags.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-style-flags.util.js +21 -0
- package/dist/utility/wrun/wrun-style-words.util.d.ts +148 -0
- package/dist/utility/wrun/wrun-style-words.util.js +439 -0
- package/dist/utility/wrun/wrun-table-look.util.d.ts +125 -0
- package/dist/utility/wrun/wrun-table-look.util.js +225 -0
- package/dist/utility/wrun/wrun-text-look.util.d.ts +51 -0
- package/dist/utility/wrun/wrun-text-look.util.js +227 -0
- package/dist/utility/wrun/wrun-text-params.util.d.ts +106 -0
- package/dist/utility/wrun/wrun-text-params.util.js +171 -0
- package/dist/utility/wrun/wrun-tpo-rows.util.d.ts +71 -0
- package/dist/utility/wrun/wrun-tpo-rows.util.js +438 -0
- package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +14 -0
- package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +58 -0
- package/dist/utility/wrun/wrun-visibility-table.d.ts +437 -0
- package/dist/utility/wrun/wrun-visibility-table.js +237 -0
- package/dist/utility/wrun/wrun-volume-profile.util.d.ts +37 -0
- package/dist/utility/wrun/wrun-volume-profile.util.js +278 -0
- package/package.json +38 -0
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import isoWeek from 'dayjs/plugin/isoWeek.js';
|
|
3
|
+
import timezone from 'dayjs/plugin/timezone.js';
|
|
4
|
+
import utc from 'dayjs/plugin/utc.js';
|
|
5
|
+
import { getTradingDayAnchor, getTradingDayTpoTimeRange } from '../../utility/chart/trading-day.util.js';
|
|
6
|
+
dayjs.extend(utc);
|
|
7
|
+
dayjs.extend(isoWeek);
|
|
8
|
+
dayjs.extend(timezone);
|
|
9
|
+
export const TPO_TRADING_HOUR_TIME_RANGES = {
|
|
10
|
+
'Pre-Market': { start_time: '04:00', end_time: '09:30', timezone: 'ET' },
|
|
11
|
+
Regular: { start_time: '09:30', end_time: '16:00', timezone: 'ET' },
|
|
12
|
+
'Post-Market': { start_time: '16:00', end_time: '20:00', timezone: 'ET' },
|
|
13
|
+
Asia: { start_time: '00:00', end_time: '06:00', timezone: 'UTC' },
|
|
14
|
+
'Asia Full': { start_time: '00:00', end_time: '09:00', timezone: 'UTC' },
|
|
15
|
+
London: { start_time: '06:00', end_time: '12:00', timezone: 'UTC' },
|
|
16
|
+
'London Full': { start_time: '08:00', end_time: '17:00', timezone: 'UTC' },
|
|
17
|
+
'New York': { start_time: '12:00', end_time: '20:00', timezone: 'UTC' },
|
|
18
|
+
'New York Full': { start_time: '08:00', end_time: '17:00', timezone: 'ET' },
|
|
19
|
+
'Pre-Close': { start_time: '20:00', end_time: '00:00', timezone: 'UTC' },
|
|
20
|
+
'All Hours': { start_time: '00:00', end_time: '00:00', timezone: 'UTC' },
|
|
21
|
+
Custom: { start_time: '00:00', end_time: '00:00', timezone: 'UTC' },
|
|
22
|
+
};
|
|
23
|
+
function parseTpoTimeToMinutes(value) {
|
|
24
|
+
const match = String(value ?? '').match(/^(\d{1,2}):(\d{2})$/);
|
|
25
|
+
if (!match)
|
|
26
|
+
return undefined;
|
|
27
|
+
const hours = Number(match[1]);
|
|
28
|
+
const minutes = Number(match[2]);
|
|
29
|
+
if (!Number.isInteger(hours) || !Number.isInteger(minutes))
|
|
30
|
+
return undefined;
|
|
31
|
+
if (hours < 0 || hours > 23 || minutes < 0 || minutes > 59)
|
|
32
|
+
return undefined;
|
|
33
|
+
return hours * 60 + minutes;
|
|
34
|
+
}
|
|
35
|
+
function isTpoCrossDay(customTimeRange) {
|
|
36
|
+
if (!customTimeRange)
|
|
37
|
+
return false;
|
|
38
|
+
const startMinutes = parseTpoTimeToMinutes(customTimeRange.start_time);
|
|
39
|
+
const endMinutes = parseTpoTimeToMinutes(customTimeRange.end_time);
|
|
40
|
+
if (startMinutes === undefined || endMinutes === undefined)
|
|
41
|
+
return false;
|
|
42
|
+
return startMinutes >= endMinutes;
|
|
43
|
+
}
|
|
44
|
+
function getTpoCrossDayOffset(customTimeRange) {
|
|
45
|
+
if (!customTimeRange || !isTpoCrossDay(customTimeRange))
|
|
46
|
+
return 0;
|
|
47
|
+
return (parseTpoTimeToMinutes(customTimeRange.end_time) ?? 0) * 60;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The venue anchor these settings run on. It is venue knowledge, never
|
|
51
|
+
* persisted: a workspace row restored on load carries none until an interval
|
|
52
|
+
* switch restamps it (synchronizeOverlays), and the fetch reads that row, so a
|
|
53
|
+
* CME TPO fetched UTC days on load and New York trading days after the first
|
|
54
|
+
* interval change, moving every day's edge. Absent means "not stamped yet":
|
|
55
|
+
* derive it from the overlay's exchange. An explicit null (cleared on a switch
|
|
56
|
+
* to a UTC-day venue) stands.
|
|
57
|
+
*/
|
|
58
|
+
function resolveTpoTradingDayAnchor(settings) {
|
|
59
|
+
if (settings.tradingDayAnchor !== undefined)
|
|
60
|
+
return settings.tradingDayAnchor;
|
|
61
|
+
return typeof settings.exchange === 'string' ? getTradingDayAnchor(settings.exchange) : undefined;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The trading-day anchored time range that APPLIES to these settings, or
|
|
65
|
+
* undefined. The anchor only shapes the default full-day case: an explicit
|
|
66
|
+
* custom range, a non-'All Hours' trading hour, a non-Daily session type, or
|
|
67
|
+
* active custom sessions each keep their existing behavior.
|
|
68
|
+
*/
|
|
69
|
+
export function resolveTradingDayTpoTimeRange(settings) {
|
|
70
|
+
if (!settings || settings.customTimeRange)
|
|
71
|
+
return undefined;
|
|
72
|
+
const tradingHour = typeof settings.tradingHour === 'string' ? settings.tradingHour : undefined;
|
|
73
|
+
if (tradingHour && tradingHour !== 'All Hours')
|
|
74
|
+
return undefined;
|
|
75
|
+
if ((settings.sessionType ?? 'Daily') !== 'Daily')
|
|
76
|
+
return undefined;
|
|
77
|
+
if (resolveTpoCustomSessionsSetting(settings))
|
|
78
|
+
return undefined;
|
|
79
|
+
return getTradingDayTpoTimeRange(resolveTpoTradingDayAnchor(settings));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Precedence: explicit custom range, then the trading-day anchored range
|
|
83
|
+
* (which itself yields to non-'All Hours' trading hours and custom
|
|
84
|
+
* sessions), then the trading-hour preset table.
|
|
85
|
+
*/
|
|
86
|
+
export function resolveTpoSettingsTimeRange(settings) {
|
|
87
|
+
if (settings.customTimeRange)
|
|
88
|
+
return settings.customTimeRange;
|
|
89
|
+
const anchored = resolveTradingDayTpoTimeRange(settings);
|
|
90
|
+
if (anchored)
|
|
91
|
+
return anchored;
|
|
92
|
+
const tradingHour = typeof settings.tradingHour === 'string' ? settings.tradingHour : undefined;
|
|
93
|
+
if (!tradingHour)
|
|
94
|
+
return undefined;
|
|
95
|
+
return TPO_TRADING_HOUR_TIME_RANGES[tradingHour];
|
|
96
|
+
}
|
|
97
|
+
function timezoneName(value) {
|
|
98
|
+
const raw = String(value || 'UTC');
|
|
99
|
+
if (raw.toUpperCase() === 'ET')
|
|
100
|
+
return 'America/New_York';
|
|
101
|
+
return raw || 'UTC';
|
|
102
|
+
}
|
|
103
|
+
function unixInTimeZone(timestamp, zone) {
|
|
104
|
+
try {
|
|
105
|
+
return dayjs.unix(timestamp).tz(zone);
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return dayjs.unix(timestamp).utc();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const zonedDayByZone = new Map();
|
|
112
|
+
function zonedDayFor(timestamp, zone) {
|
|
113
|
+
const cached = zonedDayByZone.get(zone);
|
|
114
|
+
if (cached && timestamp >= cached.startUnix && timestamp < cached.endUnix)
|
|
115
|
+
return cached;
|
|
116
|
+
const dayStart = unixInTimeZone(timestamp, zone).startOf('day');
|
|
117
|
+
const fresh = { dayStart, startUnix: dayStart.unix(), endUnix: dayStart.add(1, 'day').unix() };
|
|
118
|
+
zonedDayByZone.set(zone, fresh);
|
|
119
|
+
return fresh;
|
|
120
|
+
}
|
|
121
|
+
const WALL_TIME_MEMO_CAP = 512;
|
|
122
|
+
const wallTimeUnixMemo = new Map();
|
|
123
|
+
/**
|
|
124
|
+
* The instant whose wall clock in `zone` reads `minutes` past midnight on
|
|
125
|
+
* `day`'s calendar date. Parsing the wall string with dayjs.tz is DST-exact:
|
|
126
|
+
* `startOf('day').add(minutes, 'minute')` counts REAL minutes, which drifts
|
|
127
|
+
* by the offset delta on 23h/25h transition days. For UTC zones both agree.
|
|
128
|
+
*/
|
|
129
|
+
function wallTimeOnDay(day, minutes, zone) {
|
|
130
|
+
const hours = String(Math.floor(minutes / 60)).padStart(2, '0');
|
|
131
|
+
const mins = String(minutes % 60).padStart(2, '0');
|
|
132
|
+
const wall = `${day.format('YYYY-MM-DD')} ${hours}:${mins}`;
|
|
133
|
+
try {
|
|
134
|
+
return dayjs.tz(wall, zone);
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return dayjs.utc(wall);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/** `wallTimeOnDay(...).unix()`, memoised per (day, minutes, zone): the same few wall times are asked every tick. */
|
|
141
|
+
function wallTimeUnixOnDay(day, dayKey, minutes, zone) {
|
|
142
|
+
const key = `${dayKey}|${minutes}|${zone}`;
|
|
143
|
+
const hit = wallTimeUnixMemo.get(key);
|
|
144
|
+
if (hit !== undefined)
|
|
145
|
+
return hit;
|
|
146
|
+
const value = wallTimeOnDay(day, minutes, zone).unix();
|
|
147
|
+
if (wallTimeUnixMemo.size >= WALL_TIME_MEMO_CAP)
|
|
148
|
+
wallTimeUnixMemo.clear();
|
|
149
|
+
wallTimeUnixMemo.set(key, value);
|
|
150
|
+
return value;
|
|
151
|
+
}
|
|
152
|
+
export function resolveTpoTimeRangeWindow(timestamp, customTimeRange) {
|
|
153
|
+
if (!customTimeRange)
|
|
154
|
+
return undefined;
|
|
155
|
+
const startMinutes = parseTpoTimeToMinutes(customTimeRange.start_time);
|
|
156
|
+
const endMinutes = parseTpoTimeToMinutes(customTimeRange.end_time);
|
|
157
|
+
if (startMinutes === undefined || endMinutes === undefined)
|
|
158
|
+
return undefined;
|
|
159
|
+
const zone = timezoneName(customTimeRange.timezone);
|
|
160
|
+
// Cached zoned day plus memoised wall times: the same instants as the
|
|
161
|
+
// per-call dayjs chain, compared as unix seconds (`isBefore` on instants).
|
|
162
|
+
const { dayStart } = zonedDayFor(timestamp, zone);
|
|
163
|
+
const dayKey = dayStart.format('YYYY-MM-DD');
|
|
164
|
+
const previousDay = dayStart.subtract(1, 'day');
|
|
165
|
+
const nextDay = dayStart.add(1, 'day');
|
|
166
|
+
const previousKey = previousDay.format('YYYY-MM-DD');
|
|
167
|
+
const nextKey = nextDay.format('YYYY-MM-DD');
|
|
168
|
+
const startToday = wallTimeUnixOnDay(dayStart, dayKey, startMinutes, zone);
|
|
169
|
+
const endToday = wallTimeUnixOnDay(dayStart, dayKey, endMinutes, zone);
|
|
170
|
+
if (startMinutes === endMinutes) {
|
|
171
|
+
const crossesIntoToday = timestamp < startToday;
|
|
172
|
+
const start = crossesIntoToday ? wallTimeUnixOnDay(previousDay, previousKey, startMinutes, zone) : startToday;
|
|
173
|
+
const end = crossesIntoToday ? startToday : wallTimeUnixOnDay(nextDay, nextKey, startMinutes, zone);
|
|
174
|
+
return { startSec: start, endSec: end, fullSession: true };
|
|
175
|
+
}
|
|
176
|
+
if (startMinutes < endMinutes) {
|
|
177
|
+
return { startSec: startToday, endSec: endToday, fullSession: false };
|
|
178
|
+
}
|
|
179
|
+
const isPostMidnightContinuation = timestamp < endToday;
|
|
180
|
+
const start = isPostMidnightContinuation
|
|
181
|
+
? wallTimeUnixOnDay(previousDay, previousKey, startMinutes, zone)
|
|
182
|
+
: startToday;
|
|
183
|
+
const end = isPostMidnightContinuation ? endToday : wallTimeUnixOnDay(nextDay, nextKey, endMinutes, zone);
|
|
184
|
+
return { startSec: start, endSec: end, fullSession: false };
|
|
185
|
+
}
|
|
186
|
+
export function containsTpoWindowTime(timestamp, window) {
|
|
187
|
+
return timestamp >= window.startSec && timestamp < window.endSec;
|
|
188
|
+
}
|
|
189
|
+
export function getTpoSessionStart(timestamp, sessionType, customTimeRange) {
|
|
190
|
+
const timeWindow = resolveTpoTimeRangeWindow(timestamp, customTimeRange);
|
|
191
|
+
if (sessionType === 'Daily' && timeWindow)
|
|
192
|
+
return timeWindow.startSec;
|
|
193
|
+
const date = dayjs.unix(timestamp).utc();
|
|
194
|
+
const offset = getTpoCrossDayOffset(customTimeRange);
|
|
195
|
+
switch (sessionType) {
|
|
196
|
+
case 'Weekly':
|
|
197
|
+
return date.startOf('isoWeek').unix() + offset;
|
|
198
|
+
case 'Monthly':
|
|
199
|
+
return date.startOf('month').unix() + offset;
|
|
200
|
+
case 'Daily':
|
|
201
|
+
default:
|
|
202
|
+
return date.startOf('day').unix() + offset;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
export function getNextTpoSessionStart(timestamp, sessionType, customTimeRange) {
|
|
206
|
+
const timeWindow = resolveTpoTimeRangeWindow(timestamp, customTimeRange);
|
|
207
|
+
if (sessionType === 'Daily' && timeWindow) {
|
|
208
|
+
// The next session opens at the window's start wall time on the next
|
|
209
|
+
// wall day, computed wall-exactly: a flat +24h drifts by an hour across
|
|
210
|
+
// DST transitions (23h/25h days).
|
|
211
|
+
const zone = timezoneName(customTimeRange?.timezone);
|
|
212
|
+
const startMinutes = parseTpoTimeToMinutes(customTimeRange?.start_time) ?? 0;
|
|
213
|
+
const startDay = unixInTimeZone(timeWindow.startSec, zone).startOf('day');
|
|
214
|
+
return wallTimeOnDay(startDay.add(1, 'day'), startMinutes, zone).unix();
|
|
215
|
+
}
|
|
216
|
+
const date = dayjs.unix(timestamp).utc();
|
|
217
|
+
const offset = getTpoCrossDayOffset(customTimeRange);
|
|
218
|
+
switch (sessionType) {
|
|
219
|
+
case 'Weekly':
|
|
220
|
+
return date.add(1, 'week').startOf('isoWeek').unix() + offset;
|
|
221
|
+
case 'Monthly':
|
|
222
|
+
return date.add(1, 'month').startOf('month').unix() + offset;
|
|
223
|
+
case 'Daily':
|
|
224
|
+
default:
|
|
225
|
+
return date.add(1, 'day').startOf('day').unix() + offset;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function formatTpoLetter(index) {
|
|
229
|
+
if (!Number.isInteger(index) || index < 0) {
|
|
230
|
+
throw new RangeError(`TPO letter index must be a non-negative integer: ${index}`);
|
|
231
|
+
}
|
|
232
|
+
if (index < 26) {
|
|
233
|
+
return String.fromCharCode(65 + index);
|
|
234
|
+
}
|
|
235
|
+
if (index < 52) {
|
|
236
|
+
return String.fromCharCode(97 + index - 26);
|
|
237
|
+
}
|
|
238
|
+
let n = index - 52;
|
|
239
|
+
let width = 2;
|
|
240
|
+
let bucketSize = 26 * 26;
|
|
241
|
+
while (n >= bucketSize) {
|
|
242
|
+
n -= bucketSize;
|
|
243
|
+
width++;
|
|
244
|
+
bucketSize *= 26;
|
|
245
|
+
}
|
|
246
|
+
const chars = new Array(width);
|
|
247
|
+
for (let i = width - 1; i >= 0; i--) {
|
|
248
|
+
chars[i] = String.fromCharCode(65 + (n % 26));
|
|
249
|
+
n = Math.floor(n / 26);
|
|
250
|
+
}
|
|
251
|
+
return chars.join('');
|
|
252
|
+
}
|
|
253
|
+
export function generateTpoLetters(blockIds, _sessionType, _tpoBlockSizeMinutes) {
|
|
254
|
+
return blockIds.map(formatTpoLetter);
|
|
255
|
+
}
|
|
256
|
+
/** Editable starting template (Asia / London / New York / Close, UTC) — a
|
|
257
|
+
* default for the editor, never a hard-coded behavior. */
|
|
258
|
+
export const DEFAULT_TPO_CUSTOM_SESSION_SEGMENTS = [
|
|
259
|
+
{ label: 'Asia', start: '00:00', end: '06:00', color: '#4f8cff' },
|
|
260
|
+
{ label: 'London', start: '06:00', end: '12:00', color: '#22c39b' },
|
|
261
|
+
{ label: 'New York', start: '12:00', end: '20:00', color: '#f2a33c' },
|
|
262
|
+
{ label: 'Close', start: '20:00', end: '00:00', color: '#a06bff' },
|
|
263
|
+
];
|
|
264
|
+
const MINUTES_PER_DAY = 1440;
|
|
265
|
+
const SECONDS_PER_DAY = 86_400;
|
|
266
|
+
function parseTpoSegmentEndToMinutes(value) {
|
|
267
|
+
if (String(value ?? '') === '24:00')
|
|
268
|
+
return MINUTES_PER_DAY;
|
|
269
|
+
const minutes = parseTpoTimeToMinutes(value);
|
|
270
|
+
if (minutes === undefined)
|
|
271
|
+
return undefined;
|
|
272
|
+
return minutes === 0 ? MINUTES_PER_DAY : minutes;
|
|
273
|
+
}
|
|
274
|
+
/** Validate + order user segments; null when the set is unusable (bad times,
|
|
275
|
+
* zero-length, or overlapping segments). Gaps between segments are allowed,
|
|
276
|
+
* and one segment may wrap past midnight. */
|
|
277
|
+
export function normalizeTpoCustomSessionSegments(value) {
|
|
278
|
+
if (!Array.isArray(value) || value.length === 0)
|
|
279
|
+
return null;
|
|
280
|
+
const parsed = [];
|
|
281
|
+
for (const raw of value) {
|
|
282
|
+
if (!raw || typeof raw !== 'object')
|
|
283
|
+
return null;
|
|
284
|
+
const segment = raw;
|
|
285
|
+
const startMinute = parseTpoTimeToMinutes(segment.start);
|
|
286
|
+
const clockEndMinute = parseTpoSegmentEndToMinutes(segment.end);
|
|
287
|
+
if (startMinute === undefined || clockEndMinute === undefined)
|
|
288
|
+
return null;
|
|
289
|
+
if (clockEndMinute === startMinute)
|
|
290
|
+
return null;
|
|
291
|
+
const endMinute = clockEndMinute < startMinute ? clockEndMinute + MINUTES_PER_DAY : clockEndMinute;
|
|
292
|
+
parsed.push({
|
|
293
|
+
label: String(segment.label ?? '').trim() || `Session ${parsed.length + 1}`,
|
|
294
|
+
start: String(segment.start),
|
|
295
|
+
end: String(segment.end),
|
|
296
|
+
color: String(segment.color ?? '').trim() || '#4f8cff',
|
|
297
|
+
startMinute,
|
|
298
|
+
endMinute,
|
|
299
|
+
index: 0,
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
parsed.sort((a, b) => a.startMinute - b.startMinute);
|
|
303
|
+
for (let i = 1; i < parsed.length; i++) {
|
|
304
|
+
if (parsed[i].startMinute < parsed[i - 1].endMinute)
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
// Only the last segment can wrap (an earlier one fails the pass above); its
|
|
308
|
+
// post-midnight tail must close before the first segment opens.
|
|
309
|
+
if (parsed[parsed.length - 1].endMinute - MINUTES_PER_DAY > parsed[0].startMinute)
|
|
310
|
+
return null;
|
|
311
|
+
parsed.forEach((segment, index) => {
|
|
312
|
+
segment.index = index;
|
|
313
|
+
});
|
|
314
|
+
return parsed;
|
|
315
|
+
}
|
|
316
|
+
export function resolveTpoCustomSessionsSetting(settings) {
|
|
317
|
+
const config = settings?.customSessions;
|
|
318
|
+
if (!config || config.enabled !== true)
|
|
319
|
+
return null;
|
|
320
|
+
// Segments repeat on a 24h cycle; Weekly/Monthly sessions keep the plain path.
|
|
321
|
+
if ((settings?.sessionType ?? 'Daily') !== 'Daily')
|
|
322
|
+
return null;
|
|
323
|
+
return normalizeTpoCustomSessionSegments(config.segments);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Fetch-alignment range for an active custom-session set, or undefined to keep
|
|
327
|
+
* plain UTC-day alignment. The fetch window must be cut where no session is
|
|
328
|
+
* open, or its edge returns a session fragment: that instant is UTC midnight
|
|
329
|
+
* until a segment wraps past it, then it is the wrapped session's end.
|
|
330
|
+
*/
|
|
331
|
+
export function resolveTpoCustomSessionsAlignmentRange(segments) {
|
|
332
|
+
const last = segments[segments.length - 1];
|
|
333
|
+
if (!last || last.endMinute <= MINUTES_PER_DAY)
|
|
334
|
+
return undefined;
|
|
335
|
+
// start === end is resolveTpoTimeRangeWindow's full-session shape: a 24h
|
|
336
|
+
// cycle anchored at that wall time.
|
|
337
|
+
return { start_time: last.end, end_time: last.end, timezone: 'UTC' };
|
|
338
|
+
}
|
|
339
|
+
/** Data-affecting projection of the custom-session config (colors excluded):
|
|
340
|
+
* used for cache keys and refetch triggers. Empty string when inactive. */
|
|
341
|
+
export function tpoCustomSessionsDataKey(settings) {
|
|
342
|
+
const segments = resolveTpoCustomSessionsSetting(settings);
|
|
343
|
+
if (!segments)
|
|
344
|
+
return '';
|
|
345
|
+
return JSON.stringify(segments.map(({ label, start, end }) => [label, start, end]));
|
|
346
|
+
}
|
|
347
|
+
function toTpoCustomSessionWindow(segment, startDaySec) {
|
|
348
|
+
return {
|
|
349
|
+
startSec: startDaySec + segment.startMinute * 60,
|
|
350
|
+
endSec: startDaySec + segment.endMinute * 60,
|
|
351
|
+
index: segment.index,
|
|
352
|
+
label: segment.label,
|
|
353
|
+
color: segment.color,
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
/** The segment window containing `timestamp` (unix seconds, UTC), or null when
|
|
357
|
+
* the timestamp falls in a gap between segments. */
|
|
358
|
+
export function getTpoCustomSessionWindow(timestamp, segments) {
|
|
359
|
+
const dayStart = dayjs.unix(timestamp).utc().startOf('day').unix();
|
|
360
|
+
const minuteOfDay = Math.floor((timestamp - dayStart) / 60);
|
|
361
|
+
// The post-midnight tail of the wrapping segment (always the last one)
|
|
362
|
+
// belongs to the session that opened the previous day.
|
|
363
|
+
const last = segments[segments.length - 1];
|
|
364
|
+
if (last && minuteOfDay < last.endMinute - MINUTES_PER_DAY) {
|
|
365
|
+
return toTpoCustomSessionWindow(last, dayStart - SECONDS_PER_DAY);
|
|
366
|
+
}
|
|
367
|
+
for (const segment of segments) {
|
|
368
|
+
if (minuteOfDay >= segment.startMinute && minuteOfDay < segment.endMinute) {
|
|
369
|
+
return toTpoCustomSessionWindow(segment, dayStart);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return null;
|
|
373
|
+
}
|
|
374
|
+
/** The next segment start strictly after `timestamp` (same day or the first
|
|
375
|
+
* segment of the next day). */
|
|
376
|
+
export function getNextTpoCustomSessionStart(timestamp, segments) {
|
|
377
|
+
const dayStart = dayjs.unix(timestamp).utc().startOf('day').unix();
|
|
378
|
+
const minuteOfDay = (timestamp - dayStart) / 60;
|
|
379
|
+
for (const segment of segments) {
|
|
380
|
+
if (segment.startMinute > minuteOfDay)
|
|
381
|
+
return dayStart + segment.startMinute * 60;
|
|
382
|
+
}
|
|
383
|
+
return dayStart + SECONDS_PER_DAY + segments[0].startMinute * 60;
|
|
384
|
+
}
|
|
385
|
+
/** Flat 4-stop ramps (one per segment) for titan's periodPalettes, so a
|
|
386
|
+
* period's paletteIndex — the segment index — colors the whole profile. */
|
|
387
|
+
export function buildTpoCustomSessionPeriodPalettes(segments) {
|
|
388
|
+
return segments.map((segment) => [segment.color, segment.color, segment.color, segment.color]);
|
|
389
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export type RuntimeDiagnosticStage = 'resolve' | 'fetch' | 'compute' | 'render' | 'boundary';
|
|
2
|
+
export type RuntimeDiagnosticSeverity = 'error' | 'warning' | 'info';
|
|
3
|
+
export interface RuntimeDiagnostic {
|
|
4
|
+
stage: RuntimeDiagnosticStage;
|
|
5
|
+
severity: RuntimeDiagnosticSeverity;
|
|
6
|
+
message: string;
|
|
7
|
+
code: string;
|
|
8
|
+
suggestedFix?: string;
|
|
9
|
+
line?: number;
|
|
10
|
+
column?: number;
|
|
11
|
+
plotId?: string;
|
|
12
|
+
sourceId?: string;
|
|
13
|
+
barIndex?: number;
|
|
14
|
+
generation?: number;
|
|
15
|
+
type?: 'parse' | 'init' | 'execution' | 'validation' | 'range_change';
|
|
16
|
+
/**
|
|
17
|
+
* Structured payload for machine-consumable notices (engine
|
|
18
|
+
* DATA_COVERAGE_SHORT carries {kind, builtin, period, haveBars, anchor,
|
|
19
|
+
* backingInterval, neededFromTs, haveFromTs, symbol, exchange}). The FE
|
|
20
|
+
* builds localized user copy from these fields; the raw engine message
|
|
21
|
+
* stays in `message` for author-facing surfaces.
|
|
22
|
+
*/
|
|
23
|
+
details?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
/** `details` of a FE_KSCRIPT_PERF_SLOW row: what the chip and the compact card show. */
|
|
26
|
+
export interface KScriptPerfSlowDetails {
|
|
27
|
+
cost: 'render' | 'apply' | 'both';
|
|
28
|
+
/** Preformatted for the chip label: "118 ms/s" (render) or "640 ms" (per update). */
|
|
29
|
+
rate: string;
|
|
30
|
+
paintMsPerSecond?: number;
|
|
31
|
+
updateMs?: number;
|
|
32
|
+
/** Heatmap cells mounted (produced with the cell budget). */
|
|
33
|
+
cells?: number;
|
|
34
|
+
rows?: number;
|
|
35
|
+
series?: number;
|
|
36
|
+
/** Rows in the run window (outputRows.length). */
|
|
37
|
+
bars?: number;
|
|
38
|
+
}
|
|
39
|
+
/** `details` of a FE_EXECUTION_PAUSED row: the remembered pause plus whether it was restored from the workspace. */
|
|
40
|
+
export interface KScriptPauseDetails {
|
|
41
|
+
by: 'chart' | 'user';
|
|
42
|
+
cause: 'breaker' | 'integration' | 'slow-render' | 'slow-apply' | 'user';
|
|
43
|
+
at: number;
|
|
44
|
+
updateMs?: number;
|
|
45
|
+
paintMsPerSecond?: number;
|
|
46
|
+
streak?: number;
|
|
47
|
+
overMs?: number;
|
|
48
|
+
restored: boolean;
|
|
49
|
+
/** The pause suspended the overlay's paint (kscriptPauseSuspendsPaint, titan's door): nothing of it
|
|
50
|
+
* draws until Resume, and the card says so. On the row only, never on the remembered pause. */
|
|
51
|
+
hidden?: boolean;
|
|
52
|
+
/** With `hidden`: the engine keeps the suspended overlay's last picture (titan's
|
|
53
|
+
* `paintSuspendRetainsPicture`), so the card says it is frozen, not hidden. On the row only. */
|
|
54
|
+
retained?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/** `details` of a FE_KSCRIPT_DRAWINGS_CAPPED (trim) or FE_KSCRIPT_CELLS_CAPPED row. */
|
|
57
|
+
export interface KScriptCapDetails {
|
|
58
|
+
kind: 'drawings' | 'cells';
|
|
59
|
+
total: number;
|
|
60
|
+
drawn: number;
|
|
61
|
+
cap: number;
|
|
62
|
+
bars?: number;
|
|
63
|
+
drawnBars?: number;
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent push lanes' series and panel payloads (the daemon's `SET_SERIES` and `SET_PANEL` collab actions): pure
|
|
3
|
+
* types, split out of collab.interface.ts (which re-exports them) so the panel and series parsers (om-panel.util,
|
|
4
|
+
* om-series.util) read them without the collab protocol's enums, chart types and agent bridge. They ride the
|
|
5
|
+
* `@orangecharts/wrun-chart-host` package (docs/features/kscript/wrun/wrun-chart-host.md).
|
|
6
|
+
*/
|
|
7
|
+
/** Arbitrary daemon-computed series. Wire seconds become ms only in the parser. */
|
|
8
|
+
export interface SetSeriesData {
|
|
9
|
+
chartIndex: number;
|
|
10
|
+
payloadId: string;
|
|
11
|
+
/** Monotonic per (workspace, payloadId); equal revisions may reapply. */
|
|
12
|
+
revision: number;
|
|
13
|
+
/** A clear carries only this flag and chartIndex, payloadId, revision. */
|
|
14
|
+
clear?: true;
|
|
15
|
+
series?: {
|
|
16
|
+
id: string;
|
|
17
|
+
title: string;
|
|
18
|
+
kind: 'line' | 'area' | 'histogram' | 'step' | 'markers' | 'levels' | 'inset';
|
|
19
|
+
pane: 'overlay' | 'lower' | 'main';
|
|
20
|
+
/** Lower pane only: every live series of one group shares one pane and one value scale. */
|
|
21
|
+
group?: string;
|
|
22
|
+
/** Overlay only: an independent price-pane axis when set to own. */
|
|
23
|
+
scale?: 'shared' | 'own';
|
|
24
|
+
color?: string;
|
|
25
|
+
width?: number;
|
|
26
|
+
unit?: string;
|
|
27
|
+
cadence_s?: 60 | 300 | 900 | 1800 | 3600 | 14400 | 86400 | 604800;
|
|
28
|
+
};
|
|
29
|
+
levels?: {
|
|
30
|
+
dock: 'right' | 'left';
|
|
31
|
+
width_frac?: number;
|
|
32
|
+
poc?: boolean;
|
|
33
|
+
labels?: boolean;
|
|
34
|
+
thickness_px?: number;
|
|
35
|
+
};
|
|
36
|
+
inset?: {
|
|
37
|
+
dock: 'top' | 'bottom';
|
|
38
|
+
height_px?: number;
|
|
39
|
+
shape?: 'histogram' | 'area' | 'line';
|
|
40
|
+
};
|
|
41
|
+
times?: number[];
|
|
42
|
+
prices?: number[];
|
|
43
|
+
values?: (number | null)[];
|
|
44
|
+
colors?: string[];
|
|
45
|
+
labels_text?: string[];
|
|
46
|
+
source?: {
|
|
47
|
+
kind: 'watch' | 'push' | 'metric' | 'custom';
|
|
48
|
+
ref: string;
|
|
49
|
+
computedAtMs: number;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** A styled table cell (WRUN-STYLE g1 SC14 SC22 SC35 SC40): text or a number
|
|
53
|
+
* (`value`, printed through its column's format), the bar or spark accent
|
|
54
|
+
* (`color`), its own background, text look, alignment and spans. Colours are
|
|
55
|
+
* colour words (`#rrggbb`, `#rrggbbaa` or a `theme.*` token). */
|
|
56
|
+
export interface PanelTableCell {
|
|
57
|
+
text?: string;
|
|
58
|
+
value?: number;
|
|
59
|
+
color?: string;
|
|
60
|
+
bar?: number;
|
|
61
|
+
spark?: number[];
|
|
62
|
+
text_color?: string;
|
|
63
|
+
background_color?: string;
|
|
64
|
+
opacity?: number;
|
|
65
|
+
gradient?: string[];
|
|
66
|
+
align?: 'left' | 'center' | 'right';
|
|
67
|
+
valign?: 'top' | 'middle' | 'bottom';
|
|
68
|
+
colspan?: number;
|
|
69
|
+
rowspan?: number;
|
|
70
|
+
font_size?: number;
|
|
71
|
+
font_weight?: 'normal' | 'medium' | 'bold';
|
|
72
|
+
}
|
|
73
|
+
/** A bars value cell with its own colour (SC19), ahead of `color_mode`. */
|
|
74
|
+
export interface PanelBarCell {
|
|
75
|
+
value: number | null;
|
|
76
|
+
color?: string;
|
|
77
|
+
}
|
|
78
|
+
/** Socket-owned foreign-domain panels, replaced as a complete payload. */
|
|
79
|
+
export interface SetPanelData {
|
|
80
|
+
chartIndex: number;
|
|
81
|
+
payloadId: string;
|
|
82
|
+
revision: number;
|
|
83
|
+
clear?: true;
|
|
84
|
+
panel?: {
|
|
85
|
+
id: string;
|
|
86
|
+
title: string;
|
|
87
|
+
kind: 'bars' | 'line' | 'scatter' | 'histogram' | 'pie' | 'heatmap' | 'table' | 'tiles';
|
|
88
|
+
/** `number` (SC08) keys line, bars and scatter rows by finite decimals. */
|
|
89
|
+
x: 'time' | 'index' | 'category' | 'number';
|
|
90
|
+
place: 'below' | 'side';
|
|
91
|
+
orientation?: 'vertical' | 'horizontal';
|
|
92
|
+
series?: {
|
|
93
|
+
name: string;
|
|
94
|
+
color?: string;
|
|
95
|
+
}[];
|
|
96
|
+
stacked?: boolean;
|
|
97
|
+
labels?: boolean;
|
|
98
|
+
bins?: number;
|
|
99
|
+
hole?: number;
|
|
100
|
+
};
|
|
101
|
+
rows?: (string | number | null | number[] | PanelTableCell | PanelBarCell)[][];
|
|
102
|
+
source?: SetSeriesData['source'];
|
|
103
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent push lanes' series and panel payloads (the daemon's `SET_SERIES` and `SET_PANEL` collab actions): pure
|
|
3
|
+
* types, split out of collab.interface.ts (which re-exports them) so the panel and series parsers (om-panel.util,
|
|
4
|
+
* om-series.util) read them without the collab protocol's enums, chart types and agent bridge. They ride the
|
|
5
|
+
* `@orangecharts/wrun-chart-host` package (docs/features/kscript/wrun/wrun-chart-host.md).
|
|
6
|
+
*/
|
|
7
|
+
export {};
|