@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,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chart's integration budget over a wrun result, as a pure policy: the rows the chart would integrate,
|
|
3
|
+
* counted the way the adapter mounts them (`wrunIntegratedRowsView`), refuse past the kScript preflight's row
|
|
4
|
+
* budget, and the drawings past the drawing budget are trimmed (`trimWrunRunDrawings`). Split out of the run
|
|
5
|
+
* executor (wrun-overlay-run.util), which keeps the throw (`applyWrunIntegrationBudget`), so the result reader
|
|
6
|
+
* core applies the same policy without the chart: it rides the `@orangecharts/wrun-chart-host` package
|
|
7
|
+
* (docs/features/kscript/wrun/wrun-chart-host.md).
|
|
8
|
+
*/
|
|
9
|
+
import { normalizeKScriptRunResultForTitanCharts } from '../chart/kscript-run-result-normalize.util.js';
|
|
10
|
+
import { countOverlayOutputRows, OVERLAY_HISTORICAL_DRAWING_BUDGET, OVERLAY_HISTORICAL_ROW_BUDGET, shouldBlockOverlayHistoricalPreflightBudget, } from '../chart/overlay-output-budget.util.js';
|
|
11
|
+
import { trimWrunRunDrawings } from './wrun-cap-notice.util.js';
|
|
12
|
+
/**
|
|
13
|
+
* The rows of a wrun result (or a set of them, keyed under `outputs`) the chart integrates, as the
|
|
14
|
+
* view the kScript preflight's row budget counts. An output that draws on no bar leaves the view: the
|
|
15
|
+
* adapter's normalizer (`normalizeKScriptRunResultForTitanCharts`) drops every row with no drawable
|
|
16
|
+
* cell, so it mounts with no rows at all, while the result holds a NaN row per bar for it (a line or a
|
|
17
|
+
* box a setting switches off). An output drawn on any bar keeps all its rows: the adapter lays it back
|
|
18
|
+
* over the chart's bars. A view the budget already fits is returned as it is (it bounds this one), so
|
|
19
|
+
* a result under the budget pays no scan, and an output's verdict is kept with its rows (a live tick's
|
|
20
|
+
* build hands the rows of an unchanged output back).
|
|
21
|
+
*/
|
|
22
|
+
export function wrunIntegratedRowsView(view) {
|
|
23
|
+
if (countOverlayOutputRows(view) <= OVERLAY_HISTORICAL_ROW_BUDGET)
|
|
24
|
+
return view;
|
|
25
|
+
return { outputs: wrunDrawnOutputs(view.outputs) };
|
|
26
|
+
}
|
|
27
|
+
/** Per output: the rows it was judged on and whether the adapter keeps any of them (it draws on some bar). */
|
|
28
|
+
const wrunRowsDrawn = new WeakMap();
|
|
29
|
+
function wrunDrawnOutputs(outputs) {
|
|
30
|
+
const drawnOutputs = {};
|
|
31
|
+
if (outputs === null || typeof outputs !== 'object')
|
|
32
|
+
return drawnOutputs;
|
|
33
|
+
for (const [key, output] of Object.entries(outputs)) {
|
|
34
|
+
if (output === null || typeof output !== 'object')
|
|
35
|
+
continue;
|
|
36
|
+
const { data, outputs: nested } = output;
|
|
37
|
+
if (!Array.isArray(data)) {
|
|
38
|
+
if (nested !== undefined)
|
|
39
|
+
drawnOutputs[key] = { outputs: wrunDrawnOutputs(nested) };
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const known = wrunRowsDrawn.get(output);
|
|
43
|
+
let drawn = known?.data === data ? known.drawn : undefined;
|
|
44
|
+
if (drawn === undefined) {
|
|
45
|
+
const kept = normalizeKScriptRunResultForTitanCharts(output).data;
|
|
46
|
+
drawn = Array.isArray(kept) && kept.length > 0;
|
|
47
|
+
wrunRowsDrawn.set(output, { data, drawn });
|
|
48
|
+
}
|
|
49
|
+
if (drawn)
|
|
50
|
+
drawnOutputs[key] = output;
|
|
51
|
+
}
|
|
52
|
+
return drawnOutputs;
|
|
53
|
+
}
|
|
54
|
+
/** The drawn series of an integrated rows view and the widest one's bar count (what the chart
|
|
55
|
+
* would mount: series x bars is the budget's count). */
|
|
56
|
+
function wrunIntegratedRowsShape(view) {
|
|
57
|
+
let series = 0;
|
|
58
|
+
let bars = 0;
|
|
59
|
+
const visit = (outputs) => {
|
|
60
|
+
if (outputs === null || typeof outputs !== 'object')
|
|
61
|
+
return;
|
|
62
|
+
for (const output of Object.values(outputs)) {
|
|
63
|
+
if (output === null || typeof output !== 'object')
|
|
64
|
+
continue;
|
|
65
|
+
const { data, outputs: nested } = output;
|
|
66
|
+
if (Array.isArray(data)) {
|
|
67
|
+
series += 1;
|
|
68
|
+
bars = Math.max(bars, data.length);
|
|
69
|
+
}
|
|
70
|
+
if (nested !== undefined)
|
|
71
|
+
visit(nested);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
visit(view.outputs);
|
|
75
|
+
return { series, bars };
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The chart's integration budget over the parent and its lower panes (a series child counts against
|
|
79
|
+
* the same budget), caps that trim and say (WRUN-COST-GUARD U4):
|
|
80
|
+
* - rows past the kScript preflight's 400k refuse, with the kScript path's diagnostic code
|
|
81
|
+
* (rows cannot be trimmed without changing the plot), counted as the chart integrates them
|
|
82
|
+
* (`wrunIntegratedRowsView`): the code in the message is what
|
|
83
|
+
* `isWrunDrawingBudgetRefusal` reads to suspend a live session and what the recovery's
|
|
84
|
+
* deterministic latch keys on;
|
|
85
|
+
* - drawings past 2,000 keep the newest by `createdBar` (`trimWrunRunDrawings`, tables and widgets
|
|
86
|
+
* untouched), and ONE run context rides the parent and its lower panes to the drawing door, the
|
|
87
|
+
* only writer of the "Drawings capped" row.
|
|
88
|
+
* Trims the result's drawings in place when the rows fit; returns the verdict and never throws (the executor's
|
|
89
|
+
* `applyWrunIntegrationBudget` throws the refusal). `details` ride the preflight check as the executor passes them.
|
|
90
|
+
*/
|
|
91
|
+
export function applyWrunIntegrationBudgetPolicy(runResult, details = {}) {
|
|
92
|
+
const results = [
|
|
93
|
+
runResult,
|
|
94
|
+
...(runResult.childOverlays ?? []).flatMap((child) => (child.kind === 'series' ? [child.result] : [])),
|
|
95
|
+
];
|
|
96
|
+
// The rows alone: the drawings are the trim's.
|
|
97
|
+
const rowsView = wrunIntegratedRowsView({
|
|
98
|
+
outputs: Object.fromEntries(results.map((result, at) => [String(at), result])),
|
|
99
|
+
});
|
|
100
|
+
const { chartIndex, indicatorId } = details;
|
|
101
|
+
if (shouldBlockOverlayHistoricalPreflightBudget(rowsView, 'wrun-preflight', { chartIndex, indicatorId })) {
|
|
102
|
+
const shape = wrunIntegratedRowsShape(rowsView);
|
|
103
|
+
// The refusal's words carry its numbers (the "Too much data" chip, the card's sentence: how
|
|
104
|
+
// many lines over how many candles, against the budget), so the user knows what to change;
|
|
105
|
+
// the code in the message stays what the latch and the live stop read.
|
|
106
|
+
return {
|
|
107
|
+
result: runResult,
|
|
108
|
+
refusal: {
|
|
109
|
+
message: `wrun integration failed: FE_KSCRIPT_OUTPUT_OVERSIZED: ${countOverlayOutputRows(rowsView)} rows exceed the ` +
|
|
110
|
+
`chart integration budget (${OVERLAY_HISTORICAL_ROW_BUDGET} rows; drawings past ` +
|
|
111
|
+
`${OVERLAY_HISTORICAL_DRAWING_BUDGET} are trimmed, rows are not); gate outputs with 'when' or narrow the span`,
|
|
112
|
+
seed: {
|
|
113
|
+
cls: 'too-big',
|
|
114
|
+
variant: 'rows',
|
|
115
|
+
params: { series: shape.series, bars: shape.bars, max: OVERLAY_HISTORICAL_ROW_BUDGET },
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
trimWrunRunDrawings(runResult);
|
|
121
|
+
return { result: runResult };
|
|
122
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The latest-values snapshot of a wrun Indicator (what the legend, the HUD and the hover read): a pure type, split
|
|
3
|
+
* out of wrun-hud-state.ts (the reactive store that keeps the snapshots, which re-exports it) so the hover and HUD
|
|
4
|
+
* look builders read it without the store's Vue reactivity. It rides the `@orangecharts/wrun-chart-host` package
|
|
5
|
+
* (docs/features/kscript/wrun/wrun-chart-host.md).
|
|
6
|
+
*/
|
|
7
|
+
export interface WrunLatestSnapshot {
|
|
8
|
+
/** The last evaluated bar's open time (ms). */
|
|
9
|
+
time: number;
|
|
10
|
+
/** Latest value per output name (NaN when the output has no value yet). */
|
|
11
|
+
values: Record<string, number>;
|
|
12
|
+
/** Latest text per string slot name. */
|
|
13
|
+
strings: Record<string, string>;
|
|
14
|
+
/** The last `WRUN_LATEST_HISTORY_LENGTH` values per output name, oldest first. */
|
|
15
|
+
history: Record<string, Float64Array>;
|
|
16
|
+
/** The init() arguments the run computed with, one per sheet param in sheet order (the
|
|
17
|
+
* rig's proof that a dialog edit reached the module). Absent on a tick republish. */
|
|
18
|
+
initArgs?: number[];
|
|
19
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The latest-values snapshot of a wrun Indicator (what the legend, the HUD and the hover read): a pure type, split
|
|
3
|
+
* out of wrun-hud-state.ts (the reactive store that keeps the snapshots, which re-exports it) so the hover and HUD
|
|
4
|
+
* look builders read it without the store's Vue reactivity. It rides the `@orangecharts/wrun-chart-host` package
|
|
5
|
+
* (docs/features/kscript/wrun/wrun-chart-host.md).
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The docked levels child of a wrun run (WRUN-STYLE g2, plus g6
|
|
3
|
+
* DL-time-anchored): one `plot.levels` declaration and its parsed frame
|
|
4
|
+
* become the engine's docked `levels` record (row contract v2, the
|
|
5
|
+
* snake_case door keys), its hover rows and its mount settings.
|
|
6
|
+
*
|
|
7
|
+
* Division of labour (FREEZE 3.5.3 and 3.5.4):
|
|
8
|
+
* - `wrunLevelsChild` / `wrunLevelsSpansChild` build the child from the
|
|
9
|
+
* declaration and the frame: rows and door settings with every colour WORD
|
|
10
|
+
* unresolved (a theme token rides to the mount door) and every font word
|
|
11
|
+
* resolved to its CSS stack (X14: the engine never sees a font word). The
|
|
12
|
+
* run-result translator calls them per level, after `wrunSharedLevelsScale`
|
|
13
|
+
* once per run (DL-scale "shared").
|
|
14
|
+
* - `checkWrunLevelsFrame` restates the kit's `validateWrunLevelsFrame`
|
|
15
|
+
* cross-checks (X22) for the render selection, refused as
|
|
16
|
+
* `wrun_frame_invalid`.
|
|
17
|
+
* - `wrunLevelsMountSettings` / `wrunLevelsMountData` resolve the colour
|
|
18
|
+
* words against the chart's palette and map `beside` / `panel` to engine
|
|
19
|
+
* ids at the mount door (panel-mount's `childConfig`), which also keeps the
|
|
20
|
+
* hover rows under the child id (`rememberWrunLevelsHoverRows`) for the
|
|
21
|
+
* legend-hover surface (`wrunLevelsHoverRow`).
|
|
22
|
+
*
|
|
23
|
+
* Every new word is opt-in (conventions 10): a declaration that carries none
|
|
24
|
+
* of them builds today's rows and settings byte for byte, except that a
|
|
25
|
+
* labelled row now carries its text in cell 3 (the app writes every label it
|
|
26
|
+
* wants, `label_fallback: 'none'`), which prints exactly what the engine
|
|
27
|
+
* printed for it.
|
|
28
|
+
*/
|
|
29
|
+
import type { WrunLevels } from '../../interfaces/wrun-runtime.interface.js';
|
|
30
|
+
import { type WrunColorTheme } from './wrun-style-words.util.js';
|
|
31
|
+
import { type WrunLevelsFrame, type WrunLevelsSpansFrame } from './wrun-frames.js';
|
|
32
|
+
/** A levels declaration as the sheet or the render selection carries it (the
|
|
33
|
+
* selection replaces `frame` with the parsed snapshot). */
|
|
34
|
+
export type WrunLevelsDeclaration = Omit<WrunLevels, 'frame'> & {
|
|
35
|
+
frame?: unknown;
|
|
36
|
+
};
|
|
37
|
+
/** What the run hands every levels child builder: the mounted overlay id
|
|
38
|
+
* (child ids derive from it), the chart's price digits (the `price` format
|
|
39
|
+
* word) and the run's shared scale (`wrunSharedLevelsScale`). */
|
|
40
|
+
export interface WrunLevelsChildContext {
|
|
41
|
+
overlayId: string;
|
|
42
|
+
priceDigits?: number;
|
|
43
|
+
sharedScaleMax?: number;
|
|
44
|
+
}
|
|
45
|
+
/** One series cell of a hover row: the declared series name, its value text
|
|
46
|
+
* and its colour (a word until `rememberWrunLevelsHoverRows` resolves it). */
|
|
47
|
+
export interface WrunLevelsHoverSeries {
|
|
48
|
+
name: string;
|
|
49
|
+
valueText: string;
|
|
50
|
+
color: string;
|
|
51
|
+
}
|
|
52
|
+
/** The hover card of one docked row (DL-hover): the row's price, its value
|
|
53
|
+
* text (DL-value-format), one entry per declared series and the frame's
|
|
54
|
+
* tooltip for the row. */
|
|
55
|
+
export interface WrunLevelsHoverRow {
|
|
56
|
+
price: number;
|
|
57
|
+
valueText: string;
|
|
58
|
+
series: WrunLevelsHoverSeries[];
|
|
59
|
+
tooltip?: string;
|
|
60
|
+
}
|
|
61
|
+
/** The levels variant of the run result's child union: the engine's docked
|
|
62
|
+
* rows and door settings (colour words unresolved), the lower-pane choice
|
|
63
|
+
* (DL-lower-pane) and the hover rows (DL-hover) in frame row order. */
|
|
64
|
+
export type WrunLevelsChildOverlay = {
|
|
65
|
+
kind: 'levels';
|
|
66
|
+
name: string;
|
|
67
|
+
data: unknown[][];
|
|
68
|
+
settings: Record<string, unknown>;
|
|
69
|
+
panel?: 'lower';
|
|
70
|
+
hover?: WrunLevelsHoverRow[];
|
|
71
|
+
};
|
|
72
|
+
/** The child id of a levels declaration (`<parent>::levels:<name>`, the id
|
|
73
|
+
* panel-mount gives every docked child). */
|
|
74
|
+
export declare function wrunLevelsChildId(overlayId: string, name: string): string;
|
|
75
|
+
/** The lower pane an on-price package owns: the series child
|
|
76
|
+
* `<parent>::series:lower` (wrun-run-result.util's `wrunSeriesChildId` with
|
|
77
|
+
* `WRUN_LOWER_PANE_CHILD_NAME`, restated here so the builder stays a leaf;
|
|
78
|
+
* pinned by the spec). */
|
|
79
|
+
export declare function wrunLevelsLowerPaneId(overlayId: string): string;
|
|
80
|
+
/** True for the spans shape of a parsed levels frame. */
|
|
81
|
+
export declare function isWrunLevelsSpansFrame(frame: unknown): frame is WrunLevelsSpansFrame;
|
|
82
|
+
/**
|
|
83
|
+
* The docked child of one `plot.levels` declaration over its pane frame
|
|
84
|
+
* (span "pane"): rows on row contract v2 and every door key of g2, colour
|
|
85
|
+
* words unresolved. Null without a frame (no snapshot written yet).
|
|
86
|
+
*/
|
|
87
|
+
export declare function wrunLevelsChild(level: WrunLevelsDeclaration, frame: WrunLevelsFrame | null | undefined, ctx: WrunLevelsChildContext): WrunLevelsChildOverlay | null;
|
|
88
|
+
/**
|
|
89
|
+
* The docked child of a span "time" declaration (DL-time-anchored): every
|
|
90
|
+
* span's rows concatenated as `[price, value, color?, label?, startMs,
|
|
91
|
+
* endMs]`, settings `span: 'time'` beside today's levels settings and the
|
|
92
|
+
* shared paint keys. Null without a frame.
|
|
93
|
+
*/
|
|
94
|
+
export declare function wrunLevelsSpansChild(level: WrunLevelsDeclaration, frame: WrunLevelsSpansFrame | null | undefined, ctx: WrunLevelsChildContext): WrunLevelsChildOverlay | null;
|
|
95
|
+
/**
|
|
96
|
+
* The run's shared scale (DL-scale): the largest own extent over the
|
|
97
|
+
* sheet's "shared" levels that have a pane frame (`frames` keyed by level
|
|
98
|
+
* name), undefined when none has one. Every "shared" level then takes it as
|
|
99
|
+
* `scale_max`, so the largest row among them fills each dock.
|
|
100
|
+
*/
|
|
101
|
+
export declare function wrunSharedLevelsScale(levels: ReadonlyArray<WrunLevelsDeclaration>, frames: ReadonlyMap<string, WrunLevelsFrame | null>): number | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* The declaration cross-checks of a parsed levels frame (the kit's
|
|
104
|
+
* `validateWrunLevelsFrame`, restated per X22 with its messages): the shape
|
|
105
|
+
* the level's `span` takes (DL-time-anchored), `series` against the declared
|
|
106
|
+
* series and `colors` beside `series` (DL-stacked), `scale_max` needing scale
|
|
107
|
+
* "fixed" (DL-scale). Throws `wrun_frame_invalid: slot '<slot>': <message>`.
|
|
108
|
+
*/
|
|
109
|
+
export declare function checkWrunLevelsFrame(level: WrunLevelsDeclaration, frame: WrunLevelsFrame | WrunLevelsSpansFrame, slot: string): void;
|
|
110
|
+
/**
|
|
111
|
+
* A levels child's engine settings at the mount door: every colour word
|
|
112
|
+
* (the colour keys, `segment_colors[]`, `gradient[]`) resolved against the
|
|
113
|
+
* chart's palette, `beside` mapped to the neighbour's child id, and a
|
|
114
|
+
* lower-pane child (DL-lower-pane) docked on `pane_id`: the parent itself
|
|
115
|
+
* when it lives offchart, else the on-price package's series child.
|
|
116
|
+
*/
|
|
117
|
+
export declare function wrunLevelsMountSettings(child: WrunLevelsChildOverlay, theme: WrunColorTheme, ids: {
|
|
118
|
+
overlayId: string;
|
|
119
|
+
parentOffchart: boolean;
|
|
120
|
+
}): Record<string, unknown>;
|
|
121
|
+
/** A levels child's rows at the mount door: row cell 2 (a colour word)
|
|
122
|
+
* resolved against the chart's palette; every other cell as built. */
|
|
123
|
+
export declare function wrunLevelsMountData(child: WrunLevelsChildOverlay, theme: WrunColorTheme): unknown[][];
|
|
124
|
+
/** Keeps a mounted child's hover rows under its id, series colours resolved
|
|
125
|
+
* against the chart's palette (the swatches paint them as given). */
|
|
126
|
+
export declare function rememberWrunLevelsHoverRows(childId: string, rows: ReadonlyArray<WrunLevelsHoverRow>, theme: WrunColorTheme): void;
|
|
127
|
+
/** Drops a child's hover rows (unmount). */
|
|
128
|
+
export declare function forgetWrunLevelsHoverRows(childId: string): void;
|
|
129
|
+
/** The hover row of a mounted child at the engine's row index (the row's
|
|
130
|
+
* position in the sender's data), undefined when the child keeps none. */
|
|
131
|
+
export declare function wrunLevelsHoverRow(childId: string, index: number): WrunLevelsHoverRow | undefined;
|