@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,977 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WRUN -> canonical kScript run-result adapter: shapes a browser WRUN run
|
|
3
|
+
* (per-bar numeric outputs, string slots, and the renderer/drawing
|
|
4
|
+
* selection) into the SAME run-result vocabulary the kScript engines emit,
|
|
5
|
+
* so the output mounts through `safeIntegrateKScriptRunResultToTitanCharts`
|
|
6
|
+
* with zero titan changes. WRUN is not a second render surface: this adapter
|
|
7
|
+
* is the only WRUN-specific shaping, and everything downstream (container
|
|
8
|
+
* mount, styled rows, panes, legend, drawings) is the shared kScript path.
|
|
9
|
+
*
|
|
10
|
+
* Mapping:
|
|
11
|
+
* - Every declared numeric output becomes a plot output keyed by its
|
|
12
|
+
* metadata name, rows `[tsMs, value]` with NaN on non-ready bars (a NaN
|
|
13
|
+
* renders as a series gap, the kScript convention). Sheet plot 'bar' and
|
|
14
|
+
* 'histogram' mount as titan's baseline-anchored 'bar'; 'line' is
|
|
15
|
+
* 'spline'; 'area' is the engine's plotLine(fill=true) band down to the
|
|
16
|
+
* zero baseline (rows `[tsMs, value, 0]` on the multi-value fill channel
|
|
17
|
+
* with a flat two-stop `fillGradient`, the one shape the adapter's
|
|
18
|
+
* zero-baseline rule keeps filled); 'shape' is the engine's plotShape
|
|
19
|
+
* marker wire (the Shape outputs note below: glyph, `shape_where` gate,
|
|
20
|
+
* size, fill, location); 'scatter' is a titan 'point' mark with sparse
|
|
21
|
+
* rows, a mark per finite value, the way a `render.shape` selection
|
|
22
|
+
* draws. Data-only outputs (sheet plot "", the wrun ABI's
|
|
23
|
+
* color_by/width_by index sources) never mount, and neither do fully
|
|
24
|
+
* transparent ones (opacity 0 with no color ladder, a range's edge
|
|
25
|
+
* helper). Every mounted output, range and fill pair carries `labels`:
|
|
26
|
+
* each output's declared `label`, else its name in words
|
|
27
|
+
* (`wrunLegendName`, wrun-legend-name.util: `odds_by_price` -> "Odds by
|
|
28
|
+
* price", `gex_curve` -> "GEX curve"), the column the kScript engine fills
|
|
29
|
+
* from plot(label=...) and the legend, the alert pickers and the
|
|
30
|
+
* price-axis menu read, never the numbered "Plot N" fallback. The lower
|
|
31
|
+
* pane's outputs carry the same words.
|
|
32
|
+
* - Panes: an on-price result whose sheet leaves `overlay` undeclared and
|
|
33
|
+
* draws a `lower` output owns ONE lower pane: a `series` child overlay
|
|
34
|
+
* (`childOverlays`, mounted below by wrun-panel-mount.util through the
|
|
35
|
+
* same shared adapter) carrying every visual anchored on a lower output
|
|
36
|
+
* (its plots, ranges, fills, candles, boxes, output-anchored renderers,
|
|
37
|
+
* lower-panel segments, handles and sheet drawings), while the parent
|
|
38
|
+
* keeps everything on price (and the kScript container anchor when
|
|
39
|
+
* nothing is left). A sheet that declares `overlay` keeps one pane
|
|
40
|
+
* exactly as declared; an all-lower package is an offchart result and
|
|
41
|
+
* never splits, but its HUD still belongs to the chart: pane-pixel
|
|
42
|
+
* widgets (card, ladder, feed, meter) always paint on the price pane
|
|
43
|
+
* (`pane: 'onchart'`) and a corner label rides `forceOnChart` there,
|
|
44
|
+
* the kScript mixed-position channel, while its plots keep the one
|
|
45
|
+
* offchart pane. Overlay-panel handles were already on price; a
|
|
46
|
+
* lower-panel handle and a table stay on the result's own pane. The
|
|
47
|
+
* barcolor decorator always stays on the parent (it tints the main chart
|
|
48
|
+
* candles).
|
|
49
|
+
* - Sheet `fills` (between two rendered outputs) mount as the engine's
|
|
50
|
+
* fillBetween output: `series1`/`series2` refs by output key, rows
|
|
51
|
+
* `[tsMs, 0, opacity]` indexing a one-entry `colors` table; both sides
|
|
52
|
+
* must share a pane. The output carries `priceMarkers: false`: a fill has
|
|
53
|
+
* no value of its own, so the overlay's price markers never land on it.
|
|
54
|
+
* Declared static styling rides the def: width, line_style -> lineStyle,
|
|
55
|
+
* opacity folded into the color's alpha, color/colors; a color_by +
|
|
56
|
+
* colors ladder and/or a width_by + widths ladder emit per-bar styled
|
|
57
|
+
* rows through the engine's [colorIndex, widthIndex] channel (per-output
|
|
58
|
+
* `widths` table + per-bar width index column, the kScript styled-row
|
|
59
|
+
* wire shape). A styled BAR row carries its zero base explicitly,
|
|
60
|
+
* `[tsMs, value, 0, colorIndex, widthIndex]` at styleDataOffset 3 (the
|
|
61
|
+
* legacy bar contract's column order): titan's bar plotter reads the
|
|
62
|
+
* base column positionally, so a style group at column 2 became the base
|
|
63
|
+
* and a ladder bar rose from y = its color index. `displacement_bars`
|
|
64
|
+
* shifts an output's rendered timestamps by row index (see
|
|
65
|
+
* buildDisplacedTs); `displacement_bars_by` (C2, FE-only) derives that
|
|
66
|
+
* offset from a param, round(scale * param + offset) clamped to +-500,
|
|
67
|
+
* overriding the static one whenever the param resolves to a finite
|
|
68
|
+
* number (resolveWrunDisplacementBarsBy).
|
|
69
|
+
* - Fill pairs with a `colorBy` ladder emit the engine's
|
|
70
|
+
* plotLine(colors=[...], colorIndex=...) styled-row wire shape: rows
|
|
71
|
+
* [tsMs, top, bottom, colorIndex, widthIndex], styleProperties
|
|
72
|
+
* ['color','width'] at styleDataOffset 3, the ladder as both declared
|
|
73
|
+
* palette and per-bar color table, widths [1].
|
|
74
|
+
* - Sheet `ranges` mount as true bands through the SAME multi-value filled
|
|
75
|
+
* channel (titan's deltaFillSpline band renderer: both edge lines plus
|
|
76
|
+
* the tinted interior): edge_width/edge_line_style ride the def
|
|
77
|
+
* width/lineStyle, and color/colors/color_by follow the fill-pair rules.
|
|
78
|
+
* A declared `gradient` (+ `gradient_mode`) rides the output's
|
|
79
|
+
* `fillGradient` in the engine's own normalized shape, `{ stops: [[i /
|
|
80
|
+
* (n - 1), color], ...], mode? }` (the plotLine fillGradient +
|
|
81
|
+
* fillGradientMode kwargs): the gradient paints the interior, the color
|
|
82
|
+
* keys keep styling the edge lines.
|
|
83
|
+
* (Titan's other range surface, the kScript plotRange 'range' plot, is
|
|
84
|
+
* per-row rect payloads {time1, price1, time2, price2, color, fillColor}
|
|
85
|
+
* with no edge width/style or smoothing, so the declared edge contract
|
|
86
|
+
* can only ride the band channel.)
|
|
87
|
+
* - `bgcolor` renderers become 'bgcolor' decorator outputs (the kScript
|
|
88
|
+
* plotBgColor wire shape, engine golden 'bgcolor'): rows
|
|
89
|
+
* [tsMs, colorIndex] resolving through the output's 'colors' slot
|
|
90
|
+
* palette, outputRole 'background', paneParentCandidate false; the
|
|
91
|
+
* integration lane index-aligns the sparse rows to the main grid and a
|
|
92
|
+
* NaN index paints nothing.
|
|
93
|
+
* - `barcolor` renderers become 'barcolor' decorator outputs (the kScript
|
|
94
|
+
* barcolor() wire shape, engine golden 'barcolor'): the same rows
|
|
95
|
+
* [tsMs, colorIndex] over the same 'colors' slot palette, which titan's
|
|
96
|
+
* main candle series reads as a per-bar candle override (body and wick);
|
|
97
|
+
* bars with no record keep the chart's candle colors. Never a pane
|
|
98
|
+
* parent, and it stays on the parent result whatever pane its `where`
|
|
99
|
+
* output lives on: the candles it tints exist only on the price pane.
|
|
100
|
+
* - `text` renderers become `text` plot outputs with the engine's payload
|
|
101
|
+
* row shape `[tsMs, { text, price }]` (one row per selected entry);
|
|
102
|
+
* declared static color/size ride each payload (the plotText fields
|
|
103
|
+
* titan's text renderer reads).
|
|
104
|
+
* - `shape` renderers become marker plot outputs, rows `[tsMs, value]`; the
|
|
105
|
+
* declared shape resolves through the engine's own normalization (circle ->
|
|
106
|
+
* 'point', star -> 'diamond', triangleup -> 'triangle', ...), never a
|
|
107
|
+
* generic 'shape' kind (titan registers none). A `color_by` + `colors`
|
|
108
|
+
* ladder (scaffold 21) rides the engine's plotShape styled-row wire: the
|
|
109
|
+
* selection's resolved per-mark colors intern into the output's `colors`
|
|
110
|
+
* / `color` tables behind the static color (entry 0) and every mark row
|
|
111
|
+
* gains `[widthIndex, colorIndex]` at styleDataOffset 2 (styleProperties
|
|
112
|
+
* ['width', 'color']); a declared width is a one-slot `widths` table, an
|
|
113
|
+
* undeclared one leaves the table out so titan keeps its marker size.
|
|
114
|
+
* - `stats_row` renderers become `statsRow` outputs, rows `[tsMs, value]`,
|
|
115
|
+
* forwarding the declared `title`/`format`/`polarity` display metadata.
|
|
116
|
+
* - `label` renderers map to `text` decorator outputs from their single
|
|
117
|
+
* selected entry; `table` renderers emit the engine's plotTable decorator
|
|
118
|
+
* wire shape, one `[null, payload]` row carrying the grid plus the
|
|
119
|
+
* position/styling block at the engine defaults.
|
|
120
|
+
* - drawings become the run-result's `drawings` array in the kScript drawing
|
|
121
|
+
* vocabulary (`{ id, kind, pane, createdBar, props }`), x coordinates
|
|
122
|
+
* converted from the ABI's epoch seconds to chart ms.
|
|
123
|
+
* - A `minicharts` drawing (the mini-chart grid) is no drawing: it becomes
|
|
124
|
+
* the engine's plotMiniChartGrid output (plotType 'viewportMiniChartGrid',
|
|
125
|
+
* one `[null, payload]` row, the payload the vendored om mapping selected)
|
|
126
|
+
* on the parent, which the shared integration lifts into the chart's
|
|
127
|
+
* mini-chart grid overlay exactly like a kScript grid.
|
|
128
|
+
* - A `label` renderer with a corner `position` (wrun-3) becomes the
|
|
129
|
+
* engine's plotLabel wire shape (plotType 'label', one `[null, payload]`
|
|
130
|
+
* row carrying text, position, the offset as the engine's screen px and
|
|
131
|
+
* the corner's alignment in the engine's words, cornerLabelPayload); a
|
|
132
|
+
* `text` renderer with `style: "price_label"` becomes the engine's
|
|
133
|
+
* plotPriceLabel output (plotType 'priceLabel', rows
|
|
134
|
+
* `[tsMs, { text, price, ... }]`).
|
|
135
|
+
* - Indicator handles (wrun-3, `wrun-handles.util.ts`): the handle
|
|
136
|
+
* ledger's live set is already the engine's DrawingObject record per
|
|
137
|
+
* handle (`{ id: wrun_h_<kind>_<id>, kind, pane, createdBar, mutatedBar,
|
|
138
|
+
* props }`, x in ms, creation order); the adapter appends them to
|
|
139
|
+
* `drawings` after the sheet drawings and segments, resolving a lower-
|
|
140
|
+
* panel handle's pane against the result position exactly like a segment.
|
|
141
|
+
* They arrive either as the explicit `handles` option or hung on the rows
|
|
142
|
+
* array by the host (`attachWrunHandles`), so every integration route
|
|
143
|
+
* that hands the host's rows to this adapter renders them.
|
|
144
|
+
* - Sheet `boxes` mount as 'range' plot outputs carrying the kScript
|
|
145
|
+
* plotRange record per drawn bar (`[ts, { time1, time2, price1, price2,
|
|
146
|
+
* width, color, fillColor }]`, `[ts, NaN]` where the bar draws nothing,
|
|
147
|
+
* the engine's own filler) with the engine's lineage (outputRole 'range',
|
|
148
|
+
* pane parent candidate) and `showPriceDisplay: false` (a record is no
|
|
149
|
+
* value: titan never tags it, so the settings dialog must not read a tag
|
|
150
|
+
* there); sheet `segments` become one kScript line drawing
|
|
151
|
+
* per drawn bar (`props { x1, y1, x2, y2, color, width, lineStyle }`, id
|
|
152
|
+
* `<name>@<bar ts>`). Both evaluate from the output rows the host already
|
|
153
|
+
* holds (`wrun-box-segment.util.ts`), so a forming-bar re-evaluation
|
|
154
|
+
* replaces its record in place instead of stacking one.
|
|
155
|
+
* - Indicator strategies (wrun-3, OM-WRUN3-STRATEGIES-CONTRACT section 4):
|
|
156
|
+
* the shared host's engine broker's `StrategyOutput` rides the result under
|
|
157
|
+
* the run-level `strategy` key VERBATIM (declared, trades, openTrades,
|
|
158
|
+
* pendingOrders, equity, drawdown, stats, the perps series), the key the
|
|
159
|
+
* Strategy Tester reads through `extractKScriptStrategyPayloadFromRunResult`,
|
|
160
|
+
* with `combinedTimes` (every row's ts in ms) populated beside it so the
|
|
161
|
+
* tester's `entryBar` / `exitBar` resolve on the run's row grid with no
|
|
162
|
+
* time recovery. It arrives as the explicit `strategy` option or hung on
|
|
163
|
+
* the rows by the host (`attachWrunStrategy`). A result without a
|
|
164
|
+
* strategy carries neither key (byte-identical to before).
|
|
165
|
+
* - Bar `base` (frozen sheet contract): a bar/histogram output declaring
|
|
166
|
+
* `base` rides the engine's plotBar(value=[v, base]) wire, rows
|
|
167
|
+
* `[ts, value, base]` with `multiValue: true` (a color_by/width_by ladder
|
|
168
|
+
* appends its [colorIndex, widthIndex] cells at styleDataOffset 3), so
|
|
169
|
+
* titan draws each bar from `base` and colors by sign against it; an
|
|
170
|
+
* absent `base` keeps the single-value rows byte-identical.
|
|
171
|
+
* - Sheet candle groups (frozen sheet contract): four CONSECUTIVE outputs
|
|
172
|
+
* with plot `candle` are the open, high, low, close of ONE candle series
|
|
173
|
+
* and mount as the engine's plotCandle wire (plotType 'candle', rows
|
|
174
|
+
* `[ts, o, h, l, c]`, `multiValue: true`, labels from the four outputs,
|
|
175
|
+
* the FIRST output's `colors` [up, down] or its color_by ladder as styled
|
|
176
|
+
* cells at styleDataOffset 5 with widths pinned to its width, and its
|
|
177
|
+
* `panel: "overlay"` on an offchart result as `forceOnChart: true`, the
|
|
178
|
+
* plotCandle(forceOnChart=true) channel); the four single outputs never
|
|
179
|
+
* mount on their own, and a candle run that is not exactly four
|
|
180
|
+
* consecutive outputs refuses by name. The dev manifest's
|
|
181
|
+
* `options.candles` groups (line outputs by name) are untouched.
|
|
182
|
+
* - `barcolor: true` on a data-only output with `colors` (frozen sheet
|
|
183
|
+
* contract) is the engine's barcolor() decorator (output key 'barcolor',
|
|
184
|
+
* plotType 'barcolor', outputRole 'background', paneParentCandidate false,
|
|
185
|
+
* forceOnChart true): per-bar rows `[ts, colorIndex]` where the output's
|
|
186
|
+
* floored value indexes `colors` and a NaN or out-of-range value lands NaN
|
|
187
|
+
* (no tint, the engine's own per-bar filler); the integration index-aligns
|
|
188
|
+
* it to the main grid exactly like bgcolor. One barcolor output per sheet.
|
|
189
|
+
* - Shape outputs (frozen sheet contract): an output with plot `shape` is
|
|
190
|
+
* the engine's plotShape marker wire, the glyph from its `shape` key (the
|
|
191
|
+
* render.shape vocabulary through the engine's alias map, default
|
|
192
|
+
* circle), one `[ts, value]` row per ready bar whose value is finite and
|
|
193
|
+
* whose `shape_where` gate (when declared) is finite and nonzero, its
|
|
194
|
+
* `color`/`width`/`fill` as the marker palette, size and the
|
|
195
|
+
* plotShape(fill=true) flag; a shape renderer's `fill: true` is the same
|
|
196
|
+
* flag on the renderer output.
|
|
197
|
+
* - Price labels (frozen sheet contract): a price_label text renderer's
|
|
198
|
+
* `label_type`, `label_position` and `background_color` ride the payload
|
|
199
|
+
* as plotPriceLabel's `type`, `position` and `backgroundColor`, in the
|
|
200
|
+
* engine's own key order (text, price, type, position, tooltip, color,
|
|
201
|
+
* backgroundColor, fontWeight, size, opacity); absent keys leave the
|
|
202
|
+
* payload byte-identical.
|
|
203
|
+
* - Text renderers (frozen sheet contract): `x_align`/`y_align` ride each
|
|
204
|
+
* payload as plotText's `xAlign`/`yAlign`; `color_by` + `colors` color
|
|
205
|
+
* each record through the named output's value on its own row (floor;
|
|
206
|
+
* NaN keeps the static `color`), the per-bar plotText(color=...) look.
|
|
207
|
+
* - Tables (frozen sheet contract): `header_row`, `header_column`,
|
|
208
|
+
* `text_color`, `header_text_color`, `background_color`,
|
|
209
|
+
* `header_background_color`, `border_color`, `border_width`,
|
|
210
|
+
* `font_size`, `cell_padding` and `font_family` fill the plotTable
|
|
211
|
+
* payload fields of the same name (camelCase); absent keys keep the
|
|
212
|
+
* engine defaults the payload already carried.
|
|
213
|
+
* - Stats rows (frozen sheet contract): `color` (static) or `colors` ride
|
|
214
|
+
* the plotStatRow `colors` table ([primary, secondary]: diverging rows
|
|
215
|
+
* read [bull, bear], magnitude rows the first); `colors` + `color_by` put
|
|
216
|
+
* the ladder in that table and add the engine's [colorIndex, widthIndex]
|
|
217
|
+
* styled cells at styleDataOffset 2 (plotStatRow itself has no colorIndex
|
|
218
|
+
* kwarg, so the per-bar cells ride the shared kScript styled-row channel;
|
|
219
|
+
* titan's stats strip reads the table by polarity). A stats row declared
|
|
220
|
+
* (or painted by its switch param) `visible: false` (scaffold 42) mounts
|
|
221
|
+
* nothing: the selection skips it, and so does this mapping for a
|
|
222
|
+
* selection made elsewhere (a daemon's result) that still carries it.
|
|
223
|
+
* - forceOnChart (frozen sheet contract): an output with `panel: "overlay"`
|
|
224
|
+
* on an offchart result carries `forceOnChart: true`, the only field
|
|
225
|
+
* plotLine(forceOnChart=true) adds to the plain wire; a text, shape or
|
|
226
|
+
* bgcolor renderer with `panel: "overlay"` carries the same flag on its
|
|
227
|
+
* output (plotBgColor / plotShape(forceOnChart=true); plotText has no
|
|
228
|
+
* such kwarg, titan reads the flag on every output).
|
|
229
|
+
* - Boxes and segments past the last loaded bar: a bar-offset anchor beyond
|
|
230
|
+
* the last row extrapolates its timestamp one bar interval per bar
|
|
231
|
+
* (buildDisplacedTs) instead of clamping to the last row, the engine's
|
|
232
|
+
* own arithmetic for a record it projects past the last bar (time2 = ts
|
|
233
|
+
* + k * interval, a line.new x2 alike); anchors inside the range, and
|
|
234
|
+
* before the first loaded bar (still clamped to the first row), keep
|
|
235
|
+
* their row timestamps byte-identical.
|
|
236
|
+
* - Range `fill: false` (frozen sheet contract): the engine's UNFILLED
|
|
237
|
+
* two-value plotLine(value=[upper, lower]) wire, two edge lines and no
|
|
238
|
+
* interior (plotType 'spline', multiValue, `fill: false`, labels [upper,
|
|
239
|
+
* lower], the color keys as the line palette, no styleDataOffset unless a
|
|
240
|
+
* color_by ladder adds its styled cells at 3); absent keeps the band.
|
|
241
|
+
* - Table ladders (frozen sheet contract): `header_background_color_by` +
|
|
242
|
+
* `header_background_colors`, `border_color_by` + `border_colors` and
|
|
243
|
+
* `position_by` + `positions` (the `position` words) pick the plotTable
|
|
244
|
+
* headerBackgroundColor, borderColor and position through the named
|
|
245
|
+
* output's value on the selected table snapshot's row (floor through
|
|
246
|
+
* ladderSlot), and `font_size_by`'s value IS the fontSize (finite and
|
|
247
|
+
* > 0): the engine's plotTable kwargs as evaluated on the bar that emitted
|
|
248
|
+
* the table. A non-finite value keeps the static key.
|
|
249
|
+
* - Table `cell_styles` (frozen sheet contract): keyed by cell slot name, a
|
|
250
|
+
* styled cell mounts as the engine's plotTable object cell in its own key
|
|
251
|
+
* order (value, color, textColor, align, colspan), the `color_by` /
|
|
252
|
+
* `text_color_by` ladders read at the snapshot row (a non-finite rung
|
|
253
|
+
* falls back to the static key, else omits it); a colspan k cell drops
|
|
254
|
+
* the next k - 1 cells of its grid row, the engine's shorter row.
|
|
255
|
+
* Unstyled cells stay plain strings. A cell's `tooltip` (frozen authoring
|
|
256
|
+
* contract C1.6) names a declared string slot: its text on the snapshot
|
|
257
|
+
* row rides the object cell as `tooltip`, after `align` (the engine's
|
|
258
|
+
* rich-cell order); an unwritten slot there leaves the cell without one.
|
|
259
|
+
* - Table `rows_by` (C1.6): the named output's value on the snapshot row,
|
|
260
|
+
* floored and clamped to 0..rows, is how many leading grid rows mount (the
|
|
261
|
+
* kScript plotTable data array as long as that bar built it); a
|
|
262
|
+
* non-finite value mounts every row, 0 mounts no table, and a rowspan
|
|
263
|
+
* reaching past the last painted row stops there.
|
|
264
|
+
* - Styled tables (kit scaffold 37, the capability round): every styled sheet
|
|
265
|
+
* key maps to the engine's plotTable key of the same name, present only
|
|
266
|
+
* when declared. Table level: `offset` -> offset, `width` -> width,
|
|
267
|
+
* `column_widths` -> columnWidths, `header_rows` -> headerRows,
|
|
268
|
+
* `background_opacity` -> backgroundOpacity, `background_gradient` ->
|
|
269
|
+
* backgroundGradient, `gradient_direction` -> gradientDirection,
|
|
270
|
+
* `border_style` -> borderStyle, `corner_radius` -> cornerRadius,
|
|
271
|
+
* `grid_color` / `grid_width` / `grid_style` / `grid_lines` -> gridColor /
|
|
272
|
+
* gridWidth / gridStyle / gridLines, `font_weight` -> fontWeight, `align`
|
|
273
|
+
* / `valign` -> align / valign; the ladder triplet (`<key>_by` + `<key>s`,
|
|
274
|
+
* or `<key>_packed_by`) now rides `text_color`, `header_text_color`,
|
|
275
|
+
* `background_color` and `grid_color` too, read at the snapshot row like
|
|
276
|
+
* the frozen pair. Cell level: `rowspan` (after colspan, the engine's key
|
|
277
|
+
* order; the cells it covers below drop like colspan's), `color_packed_by`
|
|
278
|
+
* / `text_color_packed_by`, then `valign`, `font_size` -> fontSize,
|
|
279
|
+
* `font_weight` -> fontWeight, `opacity`, `gradient` and
|
|
280
|
+
* `gradient_direction` -> gradientDirection (the engine honours a cell's
|
|
281
|
+
* own direction). A slot may sit at several grid cells: its spans are
|
|
282
|
+
* judged and cover at each occurrence, walked in grid order, and a cell
|
|
283
|
+
* under another span never spans itself (the engine's occupancy layout).
|
|
284
|
+
* Words outside the kit's `WRUN_TABLE_*` lists, spans past the grid, a
|
|
285
|
+
* `column_widths` count other than `cols`, `header_rows` over `rows`, an
|
|
286
|
+
* opacity outside 0..1 or a gradient outside 2..8 stops refuse by name
|
|
287
|
+
* (`wrun-table-look.util.ts`). Text stays the slot's words verbatim on
|
|
288
|
+
* this path: the engine draws plain canvas text, never markup or a link
|
|
289
|
+
* (G1); the plain-text rule on the words themselves (G2) is the string
|
|
290
|
+
* slot boundary's.
|
|
291
|
+
* - Price-label backgrounds (frozen sheet contract): `background_color_by` +
|
|
292
|
+
* `background_colors` pick each record's plotPriceLabel backgroundColor
|
|
293
|
+
* through the named output's value on the record's own row (NaN keeps the
|
|
294
|
+
* static `background_color`, else no key).
|
|
295
|
+
* - Price-label tooltips (frozen sheet contract): `tooltip_from` names
|
|
296
|
+
* another text renderer whose record on the SAME row is this record's
|
|
297
|
+
* plotPriceLabel `tooltip` (null on a row it has no record for); the
|
|
298
|
+
* source renderer never mounts on its own. A plain text renderer refuses
|
|
299
|
+
* the key: plotText's tooltip is one output-level string, never per record.
|
|
300
|
+
* - Price-label packed backgrounds (frozen sheet contract):
|
|
301
|
+
* `background_color_packed_by` names an output whose value on the record's
|
|
302
|
+
* own row IS its plotPriceLabel backgroundColor, packed and decoded like
|
|
303
|
+
* `color_packed_by` (a value that does not decode keeps the static
|
|
304
|
+
* `background_color`, else no key); it refuses beside
|
|
305
|
+
* `background_color_by`, naming an undeclared output, or on plain text.
|
|
306
|
+
* - Price-label weight and opacity (frozen sheet contract): the static
|
|
307
|
+
* `font_weight` and `opacity` ride each payload as plotPriceLabel's
|
|
308
|
+
* `fontWeight` and `opacity` in the engine's key order (..., color,
|
|
309
|
+
* backgroundColor, fontWeight, size, opacity) through the engine's clamps
|
|
310
|
+
* (fontWeight the nearest hundred in 100..800, opacity 0..1); a value that
|
|
311
|
+
* is not a finite number, or either key on plain text, refuses by name.
|
|
312
|
+
* - Template string slots (frozen sheet contract): a `{{slot}}` placeholder
|
|
313
|
+
* in a renderer `tooltip` template naming a declared string slot reads that
|
|
314
|
+
* slot's text on the row the template resolves at (a price label's own
|
|
315
|
+
* row; an unwritten slot reads empty), so a per-record tooltip costs no
|
|
316
|
+
* source renderer. A name that is an output keeps its value.
|
|
317
|
+
* - Shape renderer packed colours and glow (frozen sheet contract):
|
|
318
|
+
* `color_packed_by` on a shape renderer (in place of `color_by`) colours
|
|
319
|
+
* each mark from the named output's packed value on its row, the engine's
|
|
320
|
+
* plotShape(colors=[<colour>]) per bar: the decoded colours intern into the
|
|
321
|
+
* output's `color` table behind the static `color` (else from the first
|
|
322
|
+
* mark's, the engine's first-call seed) and every mark rides the
|
|
323
|
+
* [widthIndex, colorIndex] styled cells; a value that does not decode draws
|
|
324
|
+
* the static `color`, else no mark. `glow` is the output's plotShape(glow=
|
|
325
|
+
* ...) through the engine's clampGlow (a boolean as declared, px up to 30,
|
|
326
|
+
* 0 = false); a boolean param paints it through `style_targets` like any
|
|
327
|
+
* sheet location. Absent, the output carries neither.
|
|
328
|
+
* - Handle look defaults (frozen sheet contract): the top-level
|
|
329
|
+
* `handle_defaults` puts a label's `sticky_right` / `font_weight` and a
|
|
330
|
+
* line's `sticky_right` on each handle record's props as the engine's
|
|
331
|
+
* label.new / line.new `stickyRight` and `fontWeight` (fontWeight before
|
|
332
|
+
* stickyRight, the engine's key order) unless the record carries the prop
|
|
333
|
+
* itself; unknown kinds and props refuse by name.
|
|
334
|
+
* - Shape aliases: om's render.shape spellings `arrow_up` / `arrow_down`
|
|
335
|
+
* resolve like the engine's `arrowup` / `arrowdown` (the arrowUp /
|
|
336
|
+
* arrowDown markers) instead of falling back to a circle.
|
|
337
|
+
* - Packed colours (frozen sheet contract): `color_packed_by: "<output>"`, in
|
|
338
|
+
* place of a `color_by` ladder on a line or bar output, the first output of
|
|
339
|
+
* a candle group, a barcolor output, a range, and text, shape, stats_row
|
|
340
|
+
* and bgcolor renderers (tables: `header_background_color_packed_by` /
|
|
341
|
+
* `border_color_packed_by`; price labels: `background_color_packed_by`),
|
|
342
|
+
* reads the named output's per-bar value as a
|
|
343
|
+
* packed RGBA number, ((r * 256 + g) * 256 + b) * 1024 + round(alpha *
|
|
344
|
+
* 1000), decoded with arithmetic to `rgba(r, g, b, a)`. Like the engine's
|
|
345
|
+
* colorIndex=<colour>, the table is built on the fly: the distinct decoded
|
|
346
|
+
* colours in first-seen row order, each row's styled cell indexing it as
|
|
347
|
+
* the per-bar `color` table, while `colors` keeps the declaration's static
|
|
348
|
+
* palette (barcolor and bgcolor intern into their one `colors` table). A
|
|
349
|
+
* value that does not decode (non-finite, negative, fractional, alpha
|
|
350
|
+
* thousandths past 1000) resolves like a NaN rung: the static colour, else
|
|
351
|
+
* none. It refuses beside `color_by`, naming an undeclared output, or on a
|
|
352
|
+
* declaration that draws no colour of its own.
|
|
353
|
+
* - kScript price-axis tags, opt-in (frozen sheet contract): a sheet with
|
|
354
|
+
* the top-level `price_display: "per_output"` gets the kScript engine's
|
|
355
|
+
* output lineage (`outputRole` + `paneParentCandidate`) for the plot each
|
|
356
|
+
* output replaces, 'main' + true on a line or bar output, a candle group
|
|
357
|
+
* and an unfilled range (plotLine, plotBar, plotCandle, the two-value
|
|
358
|
+
* plotLine), 'fill' + true on a filled range and a fill pair
|
|
359
|
+
* (plotLine(fill=true)), 'marker' + false on a shape output and a shape
|
|
360
|
+
* renderer (plotShape), and each declaration's `show_price_display` (an
|
|
361
|
+
* output's, a candle group's first output's, a range's, a shape
|
|
362
|
+
* renderer's) forwarded verbatim as the engine's plot(showPriceDisplay=...)
|
|
363
|
+
* `showPriceDisplay` (false drops the tag, true forces one; a non-boolean
|
|
364
|
+
* refuses by name). The chart's container-native price-axis default reads
|
|
365
|
+
* the lineage: a run with roles tags every role-bearing value plot and
|
|
366
|
+
* never a mark, like the script it replaces. The marks also take the rest
|
|
367
|
+
* of the engine's plotShape wire: a [ts, NaN] row for every run row up to
|
|
368
|
+
* the last bar the call ran (every row; an `omit_if_empty` shape output's
|
|
369
|
+
* last mark), which the kScript lane keeps for a declared marker, so the
|
|
370
|
+
* overlay's timeline seed (the single legend readout's series) comes out
|
|
371
|
+
* as the script's: its first mark series whenever no value plot is finite
|
|
372
|
+
* on every row. Absent (any other value
|
|
373
|
+
* refuses by name), those outputs carry neither and `show_price_display`
|
|
374
|
+
* is ignored, so the tags stay what a sheet run always drew (a run without
|
|
375
|
+
* roles tags only its first output; one whose only roles came from boxes,
|
|
376
|
+
* backgrounds or barcolor tags none). Either way a mark (a shape or
|
|
377
|
+
* scatter output, a shape renderer) carries `showPriceDisplay: false`
|
|
378
|
+
* unless it declares a tag (B17, wrunMarkTag): a sparse series' last mark
|
|
379
|
+
* is no live level, so a first-plot mark tags nothing either. A mark
|
|
380
|
+
* without those NaN rows (off per_output, and a scatter output on any
|
|
381
|
+
* sheet) still ends on the last run row: one [ts, NaN] row there when that
|
|
382
|
+
* bar holds no mark (markEndRow), kept through the row filter by
|
|
383
|
+
* `markerSkeleton: true`, so the overlay's Price line, Axis label and Name
|
|
384
|
+
* label, which read a plot's last row, read the forming bar as on the
|
|
385
|
+
* engine's plotShape, never an old mark.
|
|
386
|
+
* - `custom_title` (frozen sheet contract, top level) is the kScript
|
|
387
|
+
* define(customTitle=...) legend suffix: resolved against the run's param
|
|
388
|
+
* values (`params`, else the declared defaults) by resolveWrunCustomTitle
|
|
389
|
+
* and emitted as `define.customTitle` in both define shapes, so the chart
|
|
390
|
+
* shows it verbatim and every rerun after a settings edit emits the new
|
|
391
|
+
* text; a non-string refuses by name.
|
|
392
|
+
* - Run-dependent sizes (frozen sheet contract), what a kScript size select
|
|
393
|
+
* drives: `size_by` on a text renderer (plain and price_label) and a
|
|
394
|
+
* label renderer is each record's plotText / plotPriceLabel / plotLabel
|
|
395
|
+
* `size`, the named output's value on the record's own row through the
|
|
396
|
+
* engine's own clamp (round, 1..30), else the static `size`. `width_by` on
|
|
397
|
+
* a shape renderer IS each mark's width (finite and > 0, else the static
|
|
398
|
+
* `width`); on a plot 'shape' output it is the om schema's output ladder
|
|
399
|
+
* (`width_by` + `widths`, both or neither), the value indexing `widths`.
|
|
400
|
+
* Either way the marks ride the engine's plotShape(width=...) wire:
|
|
401
|
+
* [widthIndex, colorIndex] cells at styleDataOffset 2 (styleProperties
|
|
402
|
+
* ['width', 'color']) into a `widths` table, the def `width` the last ready
|
|
403
|
+
* row's (the engine's last call). A `*_by` naming an undeclared output, and
|
|
404
|
+
* a renderer `width_by` beside a `widths` ladder, refuse by name.
|
|
405
|
+
* - `show_price_display_by` (frozen sheet contract, same gate as
|
|
406
|
+
* `show_price_display`) on an output, a range or a shape renderer is the
|
|
407
|
+
* kScript showPriceDisplay=<input>: the named output's value on the last
|
|
408
|
+
* ready row, nonzero = true and zero = false; NaN falls back to the static
|
|
409
|
+
* key (else the role default). An undeclared output refuses by name.
|
|
410
|
+
* - Per-run stroke widths (frozen sheet contract, FE-only keys the om schema
|
|
411
|
+
* ignores, since it refuses a width of 0): `stroke_width_by` on a line or
|
|
412
|
+
* bar output and `edge_width_by` on a range are the kScript
|
|
413
|
+
* plotLine(width=<input>): the named output's value on the last ready row
|
|
414
|
+
* when finite and >= 0 is the def `width` (and the one-slot styled `widths`
|
|
415
|
+
* table), else the static `width` / `edge_width`. 0 draws no stroke (titan
|
|
416
|
+
* skips a line at width 0; the legend entry and the axis tag stay). Not a
|
|
417
|
+
* ladder; an undeclared output refuses by name.
|
|
418
|
+
* - `omit_if_empty: true` (frozen sheet contract) on a line, bar or shape
|
|
419
|
+
* output, a candle group's first output or a range is the kScript plot
|
|
420
|
+
* call inside an `if`: kScript lists a plot only once its call ran, so a
|
|
421
|
+
* run that never gave the declaration a value (a line or bar: no finite
|
|
422
|
+
* value on any ready row; a shape: no mark; a candle: no row with all four
|
|
423
|
+
* values finite; a range: no row with both edges finite) leaves it out
|
|
424
|
+
* entirely: no legend entry, no axis tag, no pane parent, and a sheet fill
|
|
425
|
+
* on it drops with it (the run and every other plot and fill go on).
|
|
426
|
+
* Absent, or on a run that did give it a value, the output is
|
|
427
|
+
* byte-identical.
|
|
428
|
+
* - `role: "guide"` (frozen sheet contract, a line output, read only under
|
|
429
|
+
* `price_display: "per_output"`) is the kScript hline the output stands
|
|
430
|
+
* for, mounted as the engine's hline wire: plotType 'hline' with one
|
|
431
|
+
* constant `value` (the last value the run gave the output) and no rows,
|
|
432
|
+
* the guide lineage (`outputRole` 'guide', `paneParentCandidate` false),
|
|
433
|
+
* so the legend never lists it (a guide is a decorator) and it never
|
|
434
|
+
* parents the pane, while titan's hline rule draws it across the pane and
|
|
435
|
+
* folds its value into the pane autoscale like the hline it replaces;
|
|
436
|
+
* `showPriceDisplay` defaults to true (the hline's own tag) unless
|
|
437
|
+
* `show_price_display` (or `_by`) says otherwise. A per-bar colour or width
|
|
438
|
+
* ladder on a guide refuses by name.
|
|
439
|
+
* - `location` (frozen sheet contract) on a shape output or a shape renderer
|
|
440
|
+
* is the kScript plotShape(location=...) placement, in the engine's
|
|
441
|
+
* vocabulary ('absolute', 'aboveBar', 'belowBar', 'top', 'bottom'), riding
|
|
442
|
+
* the marker output as the engine's `location` field titan's marker
|
|
443
|
+
* renderer reads (aboveBar / belowBar offset the mark from the bar's high /
|
|
444
|
+
* low on the price pane). Absent keeps the mark on its value.
|
|
445
|
+
* - Box handles are painted, not copied: titan's box painter fills with
|
|
446
|
+
* `bgcolor ?? backgroundColor` and never reads `fillOpacity`, so the
|
|
447
|
+
* ledger's box opacity (the fill takes the opacity) replaces the alpha of
|
|
448
|
+
* `fillColor` / `backgroundColor` on every run and the prop leaves the
|
|
449
|
+
* record. A sheet `box` drawing's `line_style` rides `borderStyle`, the
|
|
450
|
+
* box.new field titan dashes by (it never reads `lineStyle` on a box).
|
|
451
|
+
* - Line fills (wrun contract C1, kScript linefill.new parity): a line
|
|
452
|
+
* record carrying `fillTo` + `fillColor` (its `fill_to` style prop and
|
|
453
|
+
* `fill` colour) becomes the line without those keys plus one titan
|
|
454
|
+
* `linefill` drawing `wrun_h_linefill_<id>` (line1Id = the line, line2Id
|
|
455
|
+
* = the target, the colour opaque and its alpha as `opacity`), placed
|
|
456
|
+
* after the later of the two lines, only when the target line landed in
|
|
457
|
+
* the same overlay's list on the same pane (withWrunLineFills).
|
|
458
|
+
* - `mount_order: "first_value"` (frozen sheet contract, top level, opt-in)
|
|
459
|
+
* mounts outputs, candle groups and ranges in the order the kScript engine
|
|
460
|
+
* creates its outputs, its call order for every call that runs from bar 0
|
|
461
|
+
* (an input-toggled one included): every output in sheet order and each
|
|
462
|
+
* range right after its later-declared edge output (the sheet carries no
|
|
463
|
+
* cross-kind declaration order); `omit_if_empty` only filters, it never
|
|
464
|
+
* moves a declaration. Mount order is titan's legend order and, for
|
|
465
|
+
* plots of one layer (lines, bars, bands; titan paints bgcolor, then
|
|
466
|
+
* fillBetween, then those, then text, each in mount order), its paint
|
|
467
|
+
* order. Absent keeps declaration order with every range after every
|
|
468
|
+
* output, byte-identical.
|
|
469
|
+
* - A range's `legend: false` (frozen sheet contract, FE-only) is a kScript
|
|
470
|
+
* fillBetween: the band paints as before and its output carries
|
|
471
|
+
* `legend: false`, which kScriptLegendLines reads, so it is never a legend
|
|
472
|
+
* line (nor in the derived overlay palette), and `priceMarkers: false`,
|
|
473
|
+
* which the marker sync reads (nestedPriceMarkers), so the overlay's Price
|
|
474
|
+
* line, Axis label and Name label never land on it, like the engine's own
|
|
475
|
+
* 'fillBetween' output (no value of its own; a tag on the band's upper edge
|
|
476
|
+
* repeated the edge line's). A non-boolean refuses by name. Absent (D31),
|
|
477
|
+
* an unlabelled range whose upper edge is a listed line is unlisted the
|
|
478
|
+
* same way (it would repeat that line's name, value and tag); a range with
|
|
479
|
+
* its own `label`, one whose upper edge draws no line (the kScript
|
|
480
|
+
* plotLine(value=[a, b], fill=true) port), or `legend: true` is listed and
|
|
481
|
+
* keeps the markers, as the engine's two-value band does.
|
|
482
|
+
* - `wrunSheetOverlayPalette` is the palette both loaders mount a sheet
|
|
483
|
+
* overlay with (the overlay's `settings.colors`: the collapsed-legend chip;
|
|
484
|
+
* a legend dot reads its own output): the top-level `legend_palette`
|
|
485
|
+
* (frozen sheet contract) exactly when declared, even empty (none mounted:
|
|
486
|
+
* the control's amber fallback), the way a kScript overlay mounts its
|
|
487
|
+
* colour inputs' defaults; absent, `wrunSheetLegendColors`, the colour of
|
|
488
|
+
* each legend line in mount order instead of the control's amber
|
|
489
|
+
* fallback. A malformed `legend_palette` refuses every run by name.
|
|
490
|
+
* - Typed-inputs presentation keys (WRUN-INPUTS-PLAN 1.3, 1.4), all
|
|
491
|
+
* optional, a sheet without them byte-identical:
|
|
492
|
+
* - an output's `format` (one of the frozen words, wrun-pane-format.util)
|
|
493
|
+
* rides the mounted output as `format`, an FE-only field the legend
|
|
494
|
+
* reads off the run output (kScriptLegendLineFormat) to print that line;
|
|
495
|
+
* `legend: false` rides as the `legend: false` kScriptLegendLines reads
|
|
496
|
+
* (drawn all the same, never a legend line, nor in the derived palette);
|
|
497
|
+
* `glow` (px, a line output) is the engine's plotOutput.glow and
|
|
498
|
+
* `corner` (px, a bar output) the histogram corner radius the engine
|
|
499
|
+
* lights on its next pin. A malformed key, `glow` off a line or `corner`
|
|
500
|
+
* off a bar refuses by name; `visible` is validated here and applied
|
|
501
|
+
* after integration (applyWrunOutputVisibility).
|
|
502
|
+
* - `legend_title` (top level, the kit's legend({ title })) is the legend
|
|
503
|
+
* suffix with `{{param}}` placeholders, resolved against the run's param
|
|
504
|
+
* values (a select as its label, a toggle as true / false) and emitted as
|
|
505
|
+
* `define.customTitle`; it wins over `custom_title` when both exist.
|
|
506
|
+
* - a text or label renderer's `style`: `plain` (or none) is text,
|
|
507
|
+
* `price_label` the engine's price tag as declared, and `callout`,
|
|
508
|
+
* `pill`, `badge` the same plotPriceLabel path with the look
|
|
509
|
+
* wrunTextStyleLook normalizes them into (`type: 'callout'`; `type:
|
|
510
|
+
* 'simple'` with the engine's box `shape` and a `border`). A corner label
|
|
511
|
+
* and a label drawing carry the style word as written.
|
|
512
|
+
* - a text or label renderer's and a label drawing's `tooltip` template
|
|
513
|
+
* resolves on the record's own row (`{{name}}`, `{{name:format}}` a
|
|
514
|
+
* declared output there, `{{label}}` its text, `{{value}}` its y): per
|
|
515
|
+
* record on the price-label path (a `tooltip_from` source wins), once
|
|
516
|
+
* on the last ready row for plain text (plotText has one tooltip).
|
|
517
|
+
* - `presentation` (legend entries, HUD cards) and an output's `hover`,
|
|
518
|
+
* `tooltip`, `hint` and `badges` never reach the run result: the legend,
|
|
519
|
+
* the HUD and the hover card read them off the sheet
|
|
520
|
+
* (wrun-legend-hover, wrun-hover.util).
|
|
521
|
+
* - WRUN-STYLE (FREEZE.md 3.5.4): this file is wiring only. The look of
|
|
522
|
+
* every surface lives with its area util and reaches the result through
|
|
523
|
+
* frozen seams: outputs through `wrunOutputLookPatch` and the guide,
|
|
524
|
+
* candle, shape-ladder, area-fill, stacked, fill-ladder and inset helpers
|
|
525
|
+
* (wrun-output-style.util); panes through `planWrunPanes` (one `series`
|
|
526
|
+
* child per drawn pane, named by the pane, the default keeps "lower"; a
|
|
527
|
+
* pane placed on price is an onchart child; `define.pane` / `paneAxis`
|
|
528
|
+
* from `wrunPaneDefine`); docked levels through `wrunLevelsChild` /
|
|
529
|
+
* `wrunLevelsSpansChild` with the shared scale computed once; heatmaps,
|
|
530
|
+
* profiles and matrices through wrun-canvases.util; widgets through
|
|
531
|
+
* `wrunWidgetEngineProps` / `wrunLadderEngineStyle` /
|
|
532
|
+
* `wrunWidgetRecordPatch`; geometry drawings through
|
|
533
|
+
* `wrunDrawingStyleWire` (plus every kind's tooltip template); text, label
|
|
534
|
+
* and shape renderers through `wrunTextLookPayload`,
|
|
535
|
+
* `wrunCornerLabelLook`, `wrunShapeRendererLook` and
|
|
536
|
+
* `wrunBgcolorLineLook`. Theme tokens ride every colour unresolved (a
|
|
537
|
+
* token is visible, keeps its word through the opacity rewrites and
|
|
538
|
+
* decodes from the packed sentinel); the mount doors resolve them.
|
|
539
|
+
*/
|
|
540
|
+
import { type WrunIndicatorMetadata, type WrunMetadataOutput, type WrunMetadataParam, type WrunOutputRow, type WrunRenderer } from '../../interfaces/wrun-runtime.interface.js';
|
|
541
|
+
import type { RuntimeDiagnostic } from '../../interfaces/kscript-diagnostics.interface.js';
|
|
542
|
+
import type { ParsedPanel } from './om-panel.util.js';
|
|
543
|
+
import type { StrategyOutput } from '@orangecharts/indicator-kit/host';
|
|
544
|
+
import { type WrunBatchedChildOverlay } from '../wrun/wrun-batched-marks.util.js';
|
|
545
|
+
import { type WrunCanvasChildOverlay, type WrunCellRows } from '../wrun/wrun-canvases.util.js';
|
|
546
|
+
import { type WrunHandleRecord } from '../wrun/wrun-handles.util.js';
|
|
547
|
+
import { type WrunLevelsChildOverlay } from '../wrun/wrun-levels-child.util.js';
|
|
548
|
+
import { type WrunRenderBudget, type WrunRenderSelection, type WrunSelectContext } from '../wrun/wrun-render-select.util.js';
|
|
549
|
+
import { type WrunVisibilityChart } from './wrun-visibility-chart.util.js';
|
|
550
|
+
import { type WrunBuildMemo } from '../wrun/wrun-build-memo.util.js';
|
|
551
|
+
import { type WrunVisibilityTarget } from '../wrun/wrun-visibility-table.js';
|
|
552
|
+
/** Presentation fill pair: renders the region between two declared numeric
|
|
553
|
+
* outputs as one multi-value filled plot (the kScript
|
|
554
|
+
* `plotLine(value=[a, b], fill=true)` shape). WRUN metadata declares fill
|
|
555
|
+
* boundaries as separate line outputs (e.g. vwap's `*_fill_hi`/`*_fill_lo`
|
|
556
|
+
* columns), so the pairing is a per-package presentation hint. */
|
|
557
|
+
export interface WrunFillPair {
|
|
558
|
+
top: string;
|
|
559
|
+
bottom: string;
|
|
560
|
+
color?: string;
|
|
561
|
+
/** Per-bar color ladder: name of a declared (typically data-only) output
|
|
562
|
+
* whose per-bar value indexes `colors`, the kScript
|
|
563
|
+
* `plotLine(colors=[...], colorIndex=...)` channel (and the wrun ABI's
|
|
564
|
+
* `color_by` output styling). Requires `colors`. */
|
|
565
|
+
colorBy?: string;
|
|
566
|
+
/** With `colorBy`: the ladder's color table, in the engine's wire order
|
|
567
|
+
* (the fill's rows gain the trailing [colorIndex, widthIndex] style
|
|
568
|
+
* columns and the output carries the table as both declared palette
|
|
569
|
+
* `colors` and per-bar table `color`). Without `colorBy`: a sign palette
|
|
570
|
+
* for the band renderer, [0] above the reference and [1] below (the
|
|
571
|
+
* kScript momentum-fill cloud shape). */
|
|
572
|
+
colors?: string[];
|
|
573
|
+
/** Bezier-smooth the fill edges; default false, the engine's plotLine
|
|
574
|
+
* default. */
|
|
575
|
+
smooth?: boolean;
|
|
576
|
+
/** Drop the two boundary line outputs from the result (the fill already
|
|
577
|
+
* draws their edges); default keeps them. */
|
|
578
|
+
hideSources?: boolean;
|
|
579
|
+
}
|
|
580
|
+
/** Presentation candle group: four declared outputs mounted as ONE candle
|
|
581
|
+
* plot (the kScript `plotCandle(value=[o, h, l, c])` shape, rows
|
|
582
|
+
* `[ts, open, high, low, close]`). */
|
|
583
|
+
export interface WrunCandleGroup {
|
|
584
|
+
open: string;
|
|
585
|
+
high: string;
|
|
586
|
+
low: string;
|
|
587
|
+
close: string;
|
|
588
|
+
/** Output key for the mounted candle plot; default = the close output. */
|
|
589
|
+
name?: string;
|
|
590
|
+
/** [bullish (close >= open), bearish] palette, the kScript plotCandle
|
|
591
|
+
* colors order; absent falls to the chart theme's candle colors. */
|
|
592
|
+
colors?: string[];
|
|
593
|
+
/** Drop the four boundary outputs from the result; default keeps them. */
|
|
594
|
+
hideSources?: boolean;
|
|
595
|
+
}
|
|
596
|
+
export interface WrunRunResultOptions {
|
|
597
|
+
metadata: WrunIndicatorMetadata;
|
|
598
|
+
rows: ReadonlyArray<WrunOutputRow>;
|
|
599
|
+
selection?: WrunRenderSelection;
|
|
600
|
+
/** The counter used to build an explicit selection, before merging handles. */
|
|
601
|
+
renderBudget?: WrunRenderBudget;
|
|
602
|
+
/** Run-level wrun-4 snapshots, indexed by the sheet's frame declarations. */
|
|
603
|
+
frames?: ReadonlyArray<string | undefined>;
|
|
604
|
+
title?: string;
|
|
605
|
+
/** The param values the run computed with, by name (the sheet's
|
|
606
|
+
* `custom_title` resolves against them; absent = the declared defaults). */
|
|
607
|
+
params?: Readonly<Record<string, number>>;
|
|
608
|
+
/** The text settings the run computed with, by name (wrun-5; the legend
|
|
609
|
+
* templates insert the plain words; absent = the declared words). */
|
|
610
|
+
texts?: Readonly<Record<string, string>>;
|
|
611
|
+
/** Chart side of the whole result; declared per package by the dev
|
|
612
|
+
* manifest (fixtures default to the original script's declaration). */
|
|
613
|
+
position?: 'onchart' | 'offchart';
|
|
614
|
+
axis?: boolean;
|
|
615
|
+
/** A note the legend paints after the title's args, in the same muted grey ("draft · only in
|
|
616
|
+
* this browser" for an editor draft, wrun-draft-legend-note.util): inserted as LITERAL legend
|
|
617
|
+
* text, every full run and every tick. Absent = nothing appended. */
|
|
618
|
+
legendNote?: string;
|
|
619
|
+
/** Optional per-output color overrides by output name. */
|
|
620
|
+
colors?: Readonly<Record<string, string>>;
|
|
621
|
+
fills?: ReadonlyArray<WrunFillPair>;
|
|
622
|
+
candles?: ReadonlyArray<WrunCandleGroup>;
|
|
623
|
+
/** wrun-3: the handle ledger's live set (wire records in creation order).
|
|
624
|
+
* Absent = the set the host attached to `rows`, if any. */
|
|
625
|
+
handles?: ReadonlyArray<WrunHandleRecord>;
|
|
626
|
+
/** wrun-3: the engine broker's output for the run. Absent = the
|
|
627
|
+
* output the host attached to `rows`, if any. */
|
|
628
|
+
strategy?: StrategyOutput;
|
|
629
|
+
/** The rows ran at another interval than the chart's (a built-in twin's
|
|
630
|
+
* Timeframe, wrun-run-interval.util): their timeline rides as
|
|
631
|
+
* `combinedTimes` on the result and its lower pane, so the adapter's
|
|
632
|
+
* run-interval projection places bar-index drawings on the chart's bars. */
|
|
633
|
+
runTimeline?: boolean;
|
|
634
|
+
/** WRUN-STYLE: the chart's price digits and names, handed to the
|
|
635
|
+
* selection (card and widget text) and to every child builder that
|
|
636
|
+
* prints a price (`priceDigits`). */
|
|
637
|
+
selectContext?: WrunSelectContext;
|
|
638
|
+
/** WRUN-STYLE: the run's celled source rows (book, volume profile,
|
|
639
|
+
* intrabar, candles), the data the price canvases (heatmaps, profiles)
|
|
640
|
+
* draw from. */
|
|
641
|
+
cellRows?: WrunCellRows;
|
|
642
|
+
/** A live tick: the heatmap children build from the newest this-many rows
|
|
643
|
+
* only and sample no colour scale (wrun-canvases.util `tailRows`); full
|
|
644
|
+
* runs, reseeds and pans leave it absent. */
|
|
645
|
+
canvasTailRows?: number;
|
|
646
|
+
/** A live tick's changed tail for the batched children (WRUN-BATCHED-MARKS): the timestamp the
|
|
647
|
+
* tick re-evaluated from (the previous forming bar's on a roll); each child builds only the rows
|
|
648
|
+
* at or after it and is merged row by row (wrun-batched-marks.util `tailFromTs`). Full runs,
|
|
649
|
+
* reseeds and pans leave it absent: every child builds its whole window under the cell budget. */
|
|
650
|
+
batchedTailFromTs?: number;
|
|
651
|
+
/** WRUN-STYLE: the mounted overlay's id, handed to the levels child
|
|
652
|
+
* builders (absent = the sheet id stands in). */
|
|
653
|
+
overlayId?: string;
|
|
654
|
+
/** WRUN-STYLE: the chart interval in ms for the time-anchored profiles
|
|
655
|
+
* (absent = the smallest bar spacing of the rows). */
|
|
656
|
+
intervalMs?: number;
|
|
657
|
+
/** WRUN-STYLE: the chart's exchange and price tick for the profile children. */
|
|
658
|
+
exchange?: string;
|
|
659
|
+
priceTick?: number;
|
|
660
|
+
/** The served TPO block for the chart market (TPO_AGG, else VOLUME_PROFILE_AGG: the native TPO's catalog mirror); absent on a mirror miss. */
|
|
661
|
+
tpoBlockSize?: number;
|
|
662
|
+
/** A live tick's build memo (wrun-build-memo.util): an output or band mount none of whose columns changed on the
|
|
663
|
+
* newest row replays what it wrote last build. Full runs, reseeds and pans leave it absent. */
|
|
664
|
+
buildMemo?: WrunBuildMemo;
|
|
665
|
+
}
|
|
666
|
+
interface WrunRunResultOutput {
|
|
667
|
+
plotType: string;
|
|
668
|
+
data: unknown[][];
|
|
669
|
+
colors?: string[];
|
|
670
|
+
[key: string]: unknown;
|
|
671
|
+
}
|
|
672
|
+
/** Where a series child sits (WRUN-STYLE OT08, OT20, OT24): the pane's
|
|
673
|
+
* declared name (the default pane keeps "lower"), its place (below the
|
|
674
|
+
* chart, or over the candles on its own hidden scale) and its declared
|
|
675
|
+
* height share. */
|
|
676
|
+
export interface WrunSeriesChildPane {
|
|
677
|
+
name: string;
|
|
678
|
+
place: 'below' | 'price';
|
|
679
|
+
height?: number;
|
|
680
|
+
}
|
|
681
|
+
/** A result's define, the parent's and a child pane's alike: the title,
|
|
682
|
+
* side and axis flag, `customTitle` (the resolved `custom_title`) only when
|
|
683
|
+
* the sheet declares one, plus the declared pane's scale look (`pane`,
|
|
684
|
+
* WRUN-STYLE OT18) and axis number format (`paneAxis`, OT19, app-only)
|
|
685
|
+
* when the result homes in a declared pane. */
|
|
686
|
+
export interface WrunRunDefine {
|
|
687
|
+
title: string;
|
|
688
|
+
position: 'onchart' | 'offchart';
|
|
689
|
+
axis: boolean;
|
|
690
|
+
customTitle?: string;
|
|
691
|
+
pane?: Record<string, unknown>;
|
|
692
|
+
paneAxis?: Record<string, unknown>;
|
|
693
|
+
}
|
|
694
|
+
/** A child pane's define: the parent's shape with its own position. */
|
|
695
|
+
export type WrunSeriesChildDefine = WrunRunDefine;
|
|
696
|
+
/** The lower pane of an on-price result: a time-series child overlay whose
|
|
697
|
+
* result rides the shared kScript adapter exactly like the parent's. */
|
|
698
|
+
export interface WrunSeriesChildResult {
|
|
699
|
+
define: WrunSeriesChildDefine;
|
|
700
|
+
outputs: Record<string, WrunRunResultOutput>;
|
|
701
|
+
drawings?: WrunRunResult['drawings'];
|
|
702
|
+
/** The parent's run timeline when the rows ran at another interval (`runTimeline`). */
|
|
703
|
+
combinedTimes?: number[];
|
|
704
|
+
/** The declared pane behind this child (absent on the undeclared default pane). */
|
|
705
|
+
pane?: WrunSeriesChildPane;
|
|
706
|
+
}
|
|
707
|
+
/** Foreign panels and docked plots own separate engine overlays. Putting
|
|
708
|
+
* them in `outputs` gives the first foreign output the parent's whole pane.
|
|
709
|
+
* A `series` child is one of the parent's own panes (see the pane note
|
|
710
|
+
* above); the levels, heatmap, profile and matrix variants are the docked
|
|
711
|
+
* and price-canvas children their builders shape (wrun-levels-child.util,
|
|
712
|
+
* wrun-canvases.util); the marks, spans and rays variants the batched
|
|
713
|
+
* children wrun-batched-marks.util shapes from the parent's own outputs. */
|
|
714
|
+
export type WrunChildOverlay = {
|
|
715
|
+
kind: 'panel';
|
|
716
|
+
name: string;
|
|
717
|
+
frame: ParsedPanel;
|
|
718
|
+
} | {
|
|
719
|
+
kind: 'inset';
|
|
720
|
+
name: string;
|
|
721
|
+
data: unknown[][];
|
|
722
|
+
settings: Record<string, unknown>;
|
|
723
|
+
} | WrunLevelsChildOverlay | WrunCanvasChildOverlay | WrunBatchedChildOverlay | {
|
|
724
|
+
kind: 'series';
|
|
725
|
+
name: string;
|
|
726
|
+
result: WrunSeriesChildResult;
|
|
727
|
+
};
|
|
728
|
+
/** Bar thickness (CSS px) the engine caps a sparse ladder's docked bars to. */
|
|
729
|
+
export declare const WRUN_LEVELS_LADDER_THICKNESS_PX = 4;
|
|
730
|
+
/** The engine's docked levels fill each bar to the midpoints of its price
|
|
731
|
+
* neighbours, the volume-profile geometry: two swing levels far apart become
|
|
732
|
+
* one solid block. A ladder (fewer than three prices, or unequal gaps between
|
|
733
|
+
* them) therefore caps its bars to thin marks centred on their prices; a
|
|
734
|
+
* uniform grid of three or more prices is a profile and keeps contiguous bins
|
|
735
|
+
* (a profile keeps its empty bins as null values, it never skips them). */
|
|
736
|
+
export declare function wrunLevelsThicknessPx(prices: readonly number[]): number | undefined;
|
|
737
|
+
/** Why a fill side draws no plot (the om reference's reasons; `omitted` is its run-time drop, which the chart
|
|
738
|
+
* makes silently like `visible_by`'s). */
|
|
739
|
+
export type WrunFillSideUndrawn = 'data_only' | 'inset' | 'candle_member';
|
|
740
|
+
/**
|
|
741
|
+
* The fill-side rule, the kit's (`wrunFillSideUndrawn` / `wrunFillSideDrawable`, om's sdk
|
|
742
|
+
* wrun-chart-output/fill-side.ts: the validator warns by it, the cloud renderer drops by it): why a fill may not
|
|
743
|
+
* name `output` as a side, or null when a chart draws it as a plot on its pane. A data-only output (`plot: ""`)
|
|
744
|
+
* draws nothing, an inset draws in its own strip, and a candle group (a run of `candle` outputs consecutive by
|
|
745
|
+
* index, four to a candle) mounts under its first member, so its high, low and close draw no plot of their own;
|
|
746
|
+
* every other output is drawn, a transparent one included (it mounts painting nothing). `outputs` (the sheet's)
|
|
747
|
+
* only places a candle output in its group. The run path never loads the kit bundle, so this is the chart's copy
|
|
748
|
+
* and the build's one fill-side rule: `wrun-style-rows-contract.spec.ts` holds its verdict, and the build's, to
|
|
749
|
+
* the kit's over the kitchen-sink sheet.
|
|
750
|
+
*/
|
|
751
|
+
export declare function wrunFillSideUndrawn(output: Pick<WrunMetadataOutput, 'index' | 'plot'>, outputs: ReadonlyArray<Pick<WrunMetadataOutput, 'index' | 'plot'>>): WrunFillSideUndrawn | null;
|
|
752
|
+
/** A sheet entry the build dropped instead of failing the run, recorded for the author: the om reference's
|
|
753
|
+
* record field for field (the cloud renderer makes the same drop), a warning row's own shape. Its message
|
|
754
|
+
* rides `notices` too, so the author sees it beside the canvas notices. */
|
|
755
|
+
export interface WrunRunNote extends RuntimeDiagnostic {
|
|
756
|
+
type: 'validation';
|
|
757
|
+
stage: 'render';
|
|
758
|
+
severity: 'warning';
|
|
759
|
+
code: 'wrun_fill_side_not_drawn';
|
|
760
|
+
/** `wrun_fill_<i>`, i the fill's place in `fills`. */
|
|
761
|
+
plotId: string;
|
|
762
|
+
details: {
|
|
763
|
+
fill: number;
|
|
764
|
+
between: [string, string];
|
|
765
|
+
side: string;
|
|
766
|
+
reason: WrunFillSideUndrawn | 'omitted';
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
export interface WrunRunResult {
|
|
770
|
+
define: WrunRunDefine;
|
|
771
|
+
outputs: Record<string, WrunRunResultOutput>;
|
|
772
|
+
/** The overlay's container spans the run (kScriptContainerSpansRun): the integration lays it over
|
|
773
|
+
* the chart's bars from its first row through the run's last bar, as a kScript container spans
|
|
774
|
+
* its engine timeline. Its outputs arrive as [ts, value] rows the shared preparation keeps only
|
|
775
|
+
* where finite, so without it the parent stopped at the densest output's last value and the
|
|
776
|
+
* legend's hovered and resting rows landed on that bar for every cell. */
|
|
777
|
+
containerSpansRun?: true;
|
|
778
|
+
childOverlays?: WrunChildOverlay[];
|
|
779
|
+
/** A bad written snapshot fails the run before any chart mutation. */
|
|
780
|
+
failureReason?: string;
|
|
781
|
+
/** The sheet entries the build dropped instead of failing the run (absent when none). */
|
|
782
|
+
notes?: WrunRunNote[];
|
|
783
|
+
/** Every child's author-facing notices in child order (a TPO whose rows the
|
|
784
|
+
* rows-per-period cap coarsened); absent when no child has one. The run
|
|
785
|
+
* still draws: these are warnings (`wrunRunNoticesOf`). */
|
|
786
|
+
notices?: string[];
|
|
787
|
+
drawings?: Array<{
|
|
788
|
+
id: string;
|
|
789
|
+
kind: string;
|
|
790
|
+
pane: 'onchart' | 'offchart';
|
|
791
|
+
createdBar: number;
|
|
792
|
+
/** wrun-3 handles: the last row a geometry, style or color call touched. */
|
|
793
|
+
mutatedBar?: number;
|
|
794
|
+
props: Record<string, unknown>;
|
|
795
|
+
/** The Style target whose Visible row hides the record (wrun-visibility-table.ts, the `drawing`
|
|
796
|
+
* group: `drawing:<kind>:<name>`, `segment:<name>`, `handles:<kind>`); the drawing door drops a
|
|
797
|
+
* hidden target's records before the set mounts (kscript-drawings.util). */
|
|
798
|
+
styleTarget?: string;
|
|
799
|
+
}>;
|
|
800
|
+
/** wrun-3 strategies: the engine's StrategyOutput verbatim (the Strategy
|
|
801
|
+
* Tester's payload), present exactly when the run carried one. */
|
|
802
|
+
strategy?: StrategyOutput;
|
|
803
|
+
/** With `strategy` (or `runTimeline`): every row's timestamp in ms, the
|
|
804
|
+
* run's bar timeline (`entryBar` / `exitBar` and drawing bars index it). */
|
|
805
|
+
combinedTimes?: number[];
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* The sheet every strict reader of a declaration reads (the render selection, and the chart-name frame guard
|
|
809
|
+
* through buildWrunOverlayRunResult): every declaration a Style row switched off in the visibility table's
|
|
810
|
+
* `skip` group (wrun-visibility-table.ts; the settings seam painted `visible: false` on it) left out of its
|
|
811
|
+
* section, so it is never selected (no frame parsed, no render budget spent), and the `visible` key taken off
|
|
812
|
+
* every other one, so no strict reader downstream sees the FE-only flag (a panel frame refuses any key outside
|
|
813
|
+
* the panel grammar, wrun-frame-host parseWrunPanelFrame), whoever wrote it: the seam deletes the key for a
|
|
814
|
+
* declaration switched back on, a sheet may still carry `visible: true`. The mounts skip the same declarations
|
|
815
|
+
* by the flag (isWrunStyleTargetHidden), so a selection made elsewhere stays honoured. The outputs keep every
|
|
816
|
+
* entry and its key (their places are the rows' columns: an inset output answers at its renderer's mount, and
|
|
817
|
+
* `visible` is an output's own kit key). The sheet itself when no declaration carries the key.
|
|
818
|
+
*/
|
|
819
|
+
export declare function wrunSelectionSheet(metadata: WrunIndicatorMetadata): WrunIndicatorMetadata;
|
|
820
|
+
export declare function buildWrunRunResult(options: WrunRunResultOptions): WrunRunResult;
|
|
821
|
+
/** A run result's author-facing notices (every canvas child's, in child
|
|
822
|
+
* order; a fresh array, empty when there are none). A run seam publishes
|
|
823
|
+
* them as warning rows (wrun-canvases.util `wrunCanvasNoticeDiagnostics`). */
|
|
824
|
+
export declare function wrunRunNoticesOf(runResult: Pick<WrunRunResult, 'notices'> | null | undefined): string[];
|
|
825
|
+
/** The sheet's `legend_title` template against the run's param values
|
|
826
|
+
* (else the declared defaults): each `{{param}}` placeholder becomes the
|
|
827
|
+
* param's rendered value; a placeholder naming no param stays as written.
|
|
828
|
+
* `texts` is the run's text settings by name (absent = the declared words):
|
|
829
|
+
* the words are inserted after the one placeholder pass and never re-read
|
|
830
|
+
* as a template (a typed `{{close}}` arrives literally). */
|
|
831
|
+
export declare function resolveWrunLegendTitle(template: string, params: ReadonlyArray<WrunMetadataParam>, values?: Readonly<Record<string, number>>, texts?: Readonly<Record<string, string>>): string;
|
|
832
|
+
/** The legend colours of a mounted result's outputs: entry i is the colour
|
|
833
|
+
* legend line i paints (titan's legend text colour, alpha stripped, so the
|
|
834
|
+
* chip reads opaque like a kScript colour input). The lines are the
|
|
835
|
+
* outputs the adapter mounts, in mount order, that the legend lists
|
|
836
|
+
* (kScriptLegendLines: value plots, never a guide, mark, candle,
|
|
837
|
+
* background, data-only output or a `legend: false` range). A result with
|
|
838
|
+
* no legend line gets the first visible colour it draws (its outputs, then
|
|
839
|
+
* `renderers`, the sheet's declarations). Empty when nothing draws a
|
|
840
|
+
* colour (the control's amber fallback). The lower pane (the `series`
|
|
841
|
+
* child, wrun-panel-mount.util) mounts with its own result's colours the
|
|
842
|
+
* same way. */
|
|
843
|
+
export declare function wrunResultLegendColors(outputs: Readonly<Record<string, WrunRunResultOutput>>, renderers?: ReadonlyArray<WrunRenderer>): string[];
|
|
844
|
+
/** The legend palette a sheet overlay mounts with, the overlay's
|
|
845
|
+
* `settings.colors` (a kScript overlay's comes from its colour inputs or
|
|
846
|
+
* plot-call literals; a sheet has neither, so without it every sheet
|
|
847
|
+
* overlay fell back to '#FFC300': an amber collapsed-legend chip, single
|
|
848
|
+
* readout and legend slots): wrunResultLegendColors over the sheet shaped
|
|
849
|
+
* on a synthetic run where every output is finite from the first row, so
|
|
850
|
+
* an `omit_if_empty` output keeps its slot and `mount_order: "first_value"`
|
|
851
|
+
* is the declaration order with each range right after its later-declared
|
|
852
|
+
* edge output (a real run only leaves omitted ones out). The sheet's lines
|
|
853
|
+
* are the parent's outputs and then its lower pane's (the `series` child
|
|
854
|
+
* the pane split moves `lower` outputs into when the package homes on
|
|
855
|
+
* price): the parent overlay's slots read the head of the list in its own
|
|
856
|
+
* mount order whether or not the run split, and a package that homes
|
|
857
|
+
* offchart never splits, so its palette is the whole sheet's either way.
|
|
858
|
+
* Empty (the control's fallback) when the sheet draws no colour or would
|
|
859
|
+
* refuse a run anyway; the run is where it refuses by name. `extras` are
|
|
860
|
+
* the dev manifest's presentation hints, the options the run itself gets. */
|
|
861
|
+
export declare function wrunSheetLegendColors(metadata: WrunIndicatorMetadata, extras?: Pick<WrunRunResultOptions, 'colors' | 'fills' | 'candles'>): string[];
|
|
862
|
+
/** THE overlay palette a sheet overlay mounts with (both loaders, and the
|
|
863
|
+
* gate, read this): a sheet with colour settings (colour params, colour
|
|
864
|
+
* arrays, om colour knobs) takes their CURRENT colours under `settings` in
|
|
865
|
+
* row order, a colour array flattened (the kScript control's own rule, its
|
|
866
|
+
* colour inputs' values in declaration order; no settings = the declared
|
|
867
|
+
* defaults); else the sheet's `legend_palette` exactly when declared (an
|
|
868
|
+
* empty one mounts none, the control's amber fallback); else the palette
|
|
869
|
+
* derived from its legend lines (wrunSheetLegendColors). A malformed
|
|
870
|
+
* `legend_palette` mounts none; every run refuses it by name. */
|
|
871
|
+
export declare function wrunSheetOverlayPalette(metadata: WrunIndicatorMetadata, extras?: Pick<WrunRunResultOptions, 'colors' | 'fills' | 'candles'>, settings?: unknown): string[];
|
|
872
|
+
/** A colour at a multiplied alpha (WRUN-STYLE OT30, conventions 3): a theme
|
|
873
|
+
* token scales its own alpha and stays a token (it resolves at paint
|
|
874
|
+
* time); any other colour goes through the shared opacity multiply
|
|
875
|
+
* (wrun-output-style.util). No alpha, or 1, keeps the colour as written.
|
|
876
|
+
* Exported for the style tier's in-place patch (wrun-style-patch.util),
|
|
877
|
+
* which folds an output's opacity into its static colour exactly as the
|
|
878
|
+
* mount below does. */
|
|
879
|
+
export declare function fadeTo(color: string, alpha: number | undefined): string;
|
|
880
|
+
export { getWrunVisibilityChart, registerWrunVisibilityChart, type WrunVisibilityChart, } from './wrun-visibility-chart.util.js';
|
|
881
|
+
/** The frozen style-row key of an output's Visible row. */
|
|
882
|
+
export declare function wrunOutputVisibleRowKey(output: string): string;
|
|
883
|
+
/** The visibility an output should have: the Style page row when the
|
|
884
|
+
* settings carry one (a boolean), else the sheet's `visible` (default true).
|
|
885
|
+
* An output a boolean param owns (`owned`, wrunVisibilityOwnedOutputs of the
|
|
886
|
+
* sheet) reads the sheet alone: its `visible` is the param's flag as the
|
|
887
|
+
* settings paint it, and a Visible row saved under an earlier package
|
|
888
|
+
* version never overrides it. */
|
|
889
|
+
export declare function wrunOutputVisibleState(output: Pick<WrunMetadataOutput, 'name' | 'visible'>, settings: unknown, owned?: ReadonlySet<string>): boolean;
|
|
890
|
+
/** Every overlay a result's outputs may mount under: the parent, then each
|
|
891
|
+
* series child the result may own (WRUN-STYLE OT08: the default lower pane
|
|
892
|
+
* and each declared or named pane). */
|
|
893
|
+
export declare function wrunOutputHostIds(parentId: string, metadata: Pick<WrunIndicatorMetadata, 'panes' | 'outputs'>): string[];
|
|
894
|
+
/** One `nested` Style target as the visibility apply reaches it (wrunNestedVisibilityTargets). */
|
|
895
|
+
export interface WrunNestedVisibilityTarget {
|
|
896
|
+
/** The Style target (`__style__<target>__visible`). */
|
|
897
|
+
target: string;
|
|
898
|
+
/** Each plot the target mounts, as the keys it may answer to, in lookup order (the first key a
|
|
899
|
+
* plot answers to wins: a box mounted beside an output of its name keys `<name>__renderer`). */
|
|
900
|
+
plots: ReadonlyArray<ReadonlyArray<string>>;
|
|
901
|
+
/** The state the settings ask for. */
|
|
902
|
+
visible: boolean;
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* The visibility table's `nested` targets of a sheet (wrun-visibility-table.ts: a drawn output, the
|
|
906
|
+
* candle tint, a range, a fill, a box), each with the plots it mounts and the state it should have:
|
|
907
|
+
* its Visible row when the settings carry one (a boolean), else its declaration's `visible` (default
|
|
908
|
+
* true); a target a boolean param owns reads the painted sheet alone (wrunOutputVisibleState). An
|
|
909
|
+
* area with a fill ladder mounts its fill band as a second plot (`<output>__area_fill`, OT31) that
|
|
910
|
+
* follows the output; the candle tint mounts under `barcolor`; a range and a fill under their plot
|
|
911
|
+
* keys (`<upper>__range<N>`, `<first>__fillBetween<N>`, N its place in its section). A fill whose
|
|
912
|
+
* two sides are both hidden by their own Visible rows is hidden too: its sides stay mounted (hidden
|
|
913
|
+
* in place), so it never throws and never paints between two hidden lines. One list for the apply
|
|
914
|
+
* and the in-place patch (wrun-style-patch.util), read from the table, never a list of its own.
|
|
915
|
+
*/
|
|
916
|
+
export declare function wrunNestedVisibilityTargets(metadata: WrunIndicatorMetadata, settings: unknown, targets?: ReadonlyArray<WrunVisibilityTarget>): WrunNestedVisibilityTarget[];
|
|
917
|
+
/**
|
|
918
|
+
* Apply every `nested` Style target's visibility to its mounted plots (wrunNestedVisibilityTargets:
|
|
919
|
+
* the outputs, the candle tint, the ranges, the fills, the boxes): the parent's own plots (nested
|
|
920
|
+
* target `<parentId>:<key>`) and each series pane's (nested under the series child,
|
|
921
|
+
* `<parentId>::series:<pane>`), through the one nested-hide call titan honours on every plot family
|
|
922
|
+
* (`changeVisibilityOverlay(host, visible, { targetId })`: the plot's `isHidden`, which the paint
|
|
923
|
+
* loop, the behind-candles fill route and the candle tint all read). A target that mounted nowhere
|
|
924
|
+
* (an omitted output, a band the market leaves out) is skipped, so the engine never logs an invalid
|
|
925
|
+
* target; a plot one target took is no other's. A plot whose wanted state was already pushed is
|
|
926
|
+
* left alone whatever its mounted state (the user's flip stands); a hidden host (the legend eye, the
|
|
927
|
+
* pane eye) is left alone whole, so its cascade keeps the children hidden and the reconcile waits for
|
|
928
|
+
* the first apply after it shows again. `chart` overrides the registry (callers that hold the
|
|
929
|
+
* instance, and specs). `metadata` is the sheet as the settings paint it: a target a boolean param
|
|
930
|
+
* owns shows by its `visible`.
|
|
931
|
+
*/
|
|
932
|
+
export declare function applyWrunOutputVisibility(chartIndex: number, parentId: string, metadata: WrunIndicatorMetadata, settings: unknown, chart?: WrunVisibilityChart): void;
|
|
933
|
+
/** The series child's name: the lower pane is one per result for now (named
|
|
934
|
+
* lower panes are a later kit change), so its overlay id is
|
|
935
|
+
* `<parent>::series:lower` on every host. */
|
|
936
|
+
export declare const WRUN_LOWER_PANE_CHILD_NAME = "lower";
|
|
937
|
+
/** The series child's overlay id (`<parent>::series:<name>`), the id the
|
|
938
|
+
* mount (wrun-panel-mount.util) gives the lower pane. */
|
|
939
|
+
export declare function wrunSeriesChildId(overlayId: string, name: string): string;
|
|
940
|
+
/** The plot key a sheet range mounts under (its upper edge and its place in `ranges`). */
|
|
941
|
+
export declare function wrunRangePlotKey(upper: string, rangeAt: number): string;
|
|
942
|
+
/** The plot key a sheet fill mounts under (its first side and its place in `fills`). */
|
|
943
|
+
export declare function wrunFillBetweenPlotKey(first: string, fillAt: number): string;
|
|
944
|
+
/**
|
|
945
|
+
* The row series a run result can mount per bar (WRUN-MARKS-CONTRACT design 5: the integrated-row
|
|
946
|
+
* budget's admission, wrun-run-retained.util): a plot per drawn output and a second one for an area
|
|
947
|
+
* whose fill follows its own ladder (OT31), one per sheet range, box and fill, one per per-bar
|
|
948
|
+
* renderer, and one per fill pair and candle group the run target adds. Each holds at most one row
|
|
949
|
+
* per bar (a point or shape output and a gated renderer hold fewer), and an output a setting hides
|
|
950
|
+
* or one drawn on no bar mounts none (the preflight counts what draws, `wrunIntegratedRowsView`), so
|
|
951
|
+
* bars times this bounds the preflight's count from above. A sheet that mounts nothing per bar (a
|
|
952
|
+
* batched-only sheet such as Big Trades) answers 0.
|
|
953
|
+
*/
|
|
954
|
+
export declare function wrunSheetRowSeriesPerBar(metadata: WrunIndicatorMetadata, target?: {
|
|
955
|
+
fills?: ReadonlyArray<unknown>;
|
|
956
|
+
candles?: ReadonlyArray<unknown>;
|
|
957
|
+
}): number;
|
|
958
|
+
/**
|
|
959
|
+
* The rows a run result mounts once per run beside its per-bar series (WRUN-MARKS-CONTRACT design 5: the
|
|
960
|
+
* integrated-row budget's reserve, wrun-run-retained.util): one per table and label renderer and one per mini-chart
|
|
961
|
+
* grid drawing (`draw.minicharts`, the engine's plotMiniChartGrid row). The preflight counts them with the bars'
|
|
962
|
+
* rows (`countOverlayOutputRows`), so the budget the bars share is the 400,000 less these. Each mounts one row at
|
|
963
|
+
* most and none when the run selects nothing for it, so the sheet's count is a declared upper bound, known before
|
|
964
|
+
* any row runs (where the run's window is decided); an inset rides its own child, which the preflight never counts.
|
|
965
|
+
*/
|
|
966
|
+
export declare function wrunSheetFixedRows(metadata: WrunIndicatorMetadata): number;
|
|
967
|
+
/** The display offset `displacement_bars_by` resolves to, either way. */
|
|
968
|
+
export declare const WRUN_DISPLACEMENT_BARS_LIMIT = 500;
|
|
969
|
+
/** Titan's card layer keeps 8 CSS px of pane padding, which puts a right-
|
|
970
|
+
* anchored meter on the pane-side pills of the price-axis tags (High, Low,
|
|
971
|
+
* the last price: about 46 px into the plot, arrow included). With no
|
|
972
|
+
* declared offset the meter moves inward past them; a declared offset is
|
|
973
|
+
* the author's own placement and stays as written. Titan defaults the
|
|
974
|
+
* anchor to top_right; a positive x offset moves inward on a right anchor
|
|
975
|
+
* (titan cards.md). The clearance is the chart chrome's own
|
|
976
|
+
* (kscript-drawing-safe-area.util, WRUN-STYLE DW06). */
|
|
977
|
+
export declare const WRUN_METER_AXIS_TAG_CLEARANCE_PX = 56;
|