@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.
Files changed (198) hide show
  1. package/README.md +72 -0
  2. package/dist/constants/governed-exchanges.constants.d.ts +11 -0
  3. package/dist/constants/governed-exchanges.constants.js +11 -0
  4. package/dist/constants/indicator-sets.constants.d.ts +8 -0
  5. package/dist/constants/indicator-sets.constants.js +8 -0
  6. package/dist/constants/interval.constants.d.ts +34 -0
  7. package/dist/constants/interval.constants.js +121 -0
  8. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +28 -0
  9. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +65 -0
  10. package/dist/constants/tpo-color-schemes.constants.d.ts +30 -0
  11. package/dist/constants/tpo-color-schemes.constants.js +32 -0
  12. package/dist/host-env.d.ts +102 -0
  13. package/dist/host-env.js +26 -0
  14. package/dist/index.d.ts +93 -0
  15. package/dist/index.js +96 -0
  16. package/dist/indicators/controls/tpo-letter.util.d.ts +2 -0
  17. package/dist/indicators/controls/tpo-letter.util.js +13 -0
  18. package/dist/indicators/controls/tpo-session.util.d.ts +99 -0
  19. package/dist/indicators/controls/tpo-session.util.js +389 -0
  20. package/dist/interfaces/kscript-diagnostics.interface.d.ts +64 -0
  21. package/dist/interfaces/kscript-diagnostics.interface.js +1 -0
  22. package/dist/interfaces/om-panel-data.interface.d.ts +103 -0
  23. package/dist/interfaces/om-panel-data.interface.js +7 -0
  24. package/dist/interfaces/wrun-runtime.interface.d.ts +2659 -0
  25. package/dist/interfaces/wrun-runtime.interface.js +55 -0
  26. package/dist/utility/chart/calendar-interval.util.d.ts +24 -0
  27. package/dist/utility/chart/calendar-interval.util.js +81 -0
  28. package/dist/utility/chart/candle-bar-end.util.d.ts +15 -0
  29. package/dist/utility/chart/candle-bar-end.util.js +23 -0
  30. package/dist/utility/chart/cme-realtime.util.d.ts +24 -0
  31. package/dist/utility/chart/cme-realtime.util.js +53 -0
  32. package/dist/utility/chart/interval-ladder.util.d.ts +27 -0
  33. package/dist/utility/chart/interval-ladder.util.js +92 -0
  34. package/dist/utility/chart/kscript-drawing-prep.util.d.ts +40 -0
  35. package/dist/utility/chart/kscript-drawing-prep.util.js +184 -0
  36. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +95 -0
  37. package/dist/utility/chart/kscript-drawing-safe-area.util.js +805 -0
  38. package/dist/utility/chart/kscript-legend-entries.util.d.ts +166 -0
  39. package/dist/utility/chart/kscript-legend-entries.util.js +538 -0
  40. package/dist/utility/chart/kscript-output-role.util.d.ts +32 -0
  41. package/dist/utility/chart/kscript-output-role.util.js +215 -0
  42. package/dist/utility/chart/kscript-provenance-keys.util.d.ts +22 -0
  43. package/dist/utility/chart/kscript-provenance-keys.util.js +56 -0
  44. package/dist/utility/chart/kscript-run-result-normalize.util.d.ts +53 -0
  45. package/dist/utility/chart/kscript-run-result-normalize.util.js +476 -0
  46. package/dist/utility/chart/kscript-run-result-shape.util.d.ts +14 -0
  47. package/dist/utility/chart/kscript-run-result-shape.util.js +66 -0
  48. package/dist/utility/chart/kscript-titancharts-container.util.d.ts +29 -0
  49. package/dist/utility/chart/kscript-titancharts-container.util.js +151 -0
  50. package/dist/utility/chart/kscript-viewport-overlays.util.d.ts +83 -0
  51. package/dist/utility/chart/kscript-viewport-overlays.util.js +443 -0
  52. package/dist/utility/chart/om-panel-push-style.util.d.ts +78 -0
  53. package/dist/utility/chart/om-panel-push-style.util.js +301 -0
  54. package/dist/utility/chart/om-panel.util.d.ts +166 -0
  55. package/dist/utility/chart/om-panel.util.js +815 -0
  56. package/dist/utility/chart/om-series.util.d.ts +42 -0
  57. package/dist/utility/chart/om-series.util.js +330 -0
  58. package/dist/utility/chart/om-target.util.d.ts +11 -0
  59. package/dist/utility/chart/om-target.util.js +24 -0
  60. package/dist/utility/chart/om-widget.util.d.ts +148 -0
  61. package/dist/utility/chart/om-widget.util.js +413 -0
  62. package/dist/utility/chart/overlay-output-budget.util.d.ts +16 -0
  63. package/dist/utility/chart/overlay-output-budget.util.js +109 -0
  64. package/dist/utility/chart/overlay-paint-flags.util.d.ts +24 -0
  65. package/dist/utility/chart/overlay-paint-flags.util.js +55 -0
  66. package/dist/utility/chart/profile-row-height.util.d.ts +21 -0
  67. package/dist/utility/chart/profile-row-height.util.js +110 -0
  68. package/dist/utility/chart/session-interval.util.d.ts +1 -0
  69. package/dist/utility/chart/session-interval.util.js +35 -0
  70. package/dist/utility/chart/technical-script-legend-value.util.d.ts +18 -0
  71. package/dist/utility/chart/technical-script-legend-value.util.js +53 -0
  72. package/dist/utility/chart/trading-day.util.d.ts +70 -0
  73. package/dist/utility/chart/trading-day.util.js +238 -0
  74. package/dist/utility/chart/wrun-legend-name.util.d.ts +25 -0
  75. package/dist/utility/chart/wrun-legend-name.util.js +87 -0
  76. package/dist/utility/chart/wrun-run-result.util.d.ts +977 -0
  77. package/dist/utility/chart/wrun-run-result.util.js +5179 -0
  78. package/dist/utility/chart/wrun-visibility-chart.util.d.ts +25 -0
  79. package/dist/utility/chart/wrun-visibility-chart.util.js +22 -0
  80. package/dist/utility/indicators/heatmap-sensitivity.util.d.ts +62 -0
  81. package/dist/utility/indicators/heatmap-sensitivity.util.js +82 -0
  82. package/dist/utility/number-format.util.d.ts +68 -0
  83. package/dist/utility/number-format.util.js +188 -0
  84. package/dist/utility/v2/opra-governed.util.d.ts +1 -0
  85. package/dist/utility/v2/opra-governed.util.js +13 -0
  86. package/dist/utility/wrun/wrun-auto-row.util.d.ts +54 -0
  87. package/dist/utility/wrun/wrun-auto-row.util.js +96 -0
  88. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +341 -0
  89. package/dist/utility/wrun/wrun-batched-marks.util.js +938 -0
  90. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +75 -0
  91. package/dist/utility/wrun/wrun-batched-readout.util.js +171 -0
  92. package/dist/utility/wrun/wrun-box-segment.util.d.ts +185 -0
  93. package/dist/utility/wrun/wrun-box-segment.util.js +570 -0
  94. package/dist/utility/wrun/wrun-build-memo.util.d.ts +133 -0
  95. package/dist/utility/wrun/wrun-build-memo.util.js +301 -0
  96. package/dist/utility/wrun/wrun-builtin-twin-ports.util.d.ts +25 -0
  97. package/dist/utility/wrun/wrun-builtin-twin-ports.util.js +75 -0
  98. package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +9 -0
  99. package/dist/utility/wrun/wrun-builtin-twin.util.js +40 -0
  100. package/dist/utility/wrun/wrun-canvas-cache.util.d.ts +28 -0
  101. package/dist/utility/wrun/wrun-canvas-cache.util.js +56 -0
  102. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +69 -0
  103. package/dist/utility/wrun/wrun-canvas-readout.util.js +53 -0
  104. package/dist/utility/wrun/wrun-canvases.util.d.ts +295 -0
  105. package/dist/utility/wrun/wrun-canvases.util.js +1432 -0
  106. package/dist/utility/wrun/wrun-cap-notice.util.d.ts +77 -0
  107. package/dist/utility/wrun/wrun-cap-notice.util.js +296 -0
  108. package/dist/utility/wrun/wrun-card-style.util.d.ts +154 -0
  109. package/dist/utility/wrun/wrun-card-style.util.js +539 -0
  110. package/dist/utility/wrun/wrun-chart-context.util.d.ts +89 -0
  111. package/dist/utility/wrun/wrun-chart-context.util.js +213 -0
  112. package/dist/utility/wrun/wrun-chart-names.util.d.ts +23 -0
  113. package/dist/utility/wrun/wrun-chart-names.util.js +33 -0
  114. package/dist/utility/wrun/wrun-chart-time.util.d.ts +12 -0
  115. package/dist/utility/wrun/wrun-chart-time.util.js +23 -0
  116. package/dist/utility/wrun/wrun-child-overlay-id.util.d.ts +13 -0
  117. package/dist/utility/wrun/wrun-child-overlay-id.util.js +44 -0
  118. package/dist/utility/wrun/wrun-color-facts.util.d.ts +40 -0
  119. package/dist/utility/wrun/wrun-color-facts.util.js +88 -0
  120. package/dist/utility/wrun/wrun-color-settings.lazy.d.ts +26 -0
  121. package/dist/utility/wrun/wrun-color-settings.lazy.js +9 -0
  122. package/dist/utility/wrun/wrun-color-settings.util.d.ts +351 -0
  123. package/dist/utility/wrun/wrun-color-settings.util.js +1363 -0
  124. package/dist/utility/wrun/wrun-footprint-modes.util.d.ts +23 -0
  125. package/dist/utility/wrun/wrun-footprint-modes.util.js +24 -0
  126. package/dist/utility/wrun/wrun-frames.d.ts +217 -0
  127. package/dist/utility/wrun/wrun-frames.js +1021 -0
  128. package/dist/utility/wrun/wrun-handles.util.d.ts +792 -0
  129. package/dist/utility/wrun/wrun-handles.util.js +2050 -0
  130. package/dist/utility/wrun/wrun-heatmap-cell-budget.util.d.ts +156 -0
  131. package/dist/utility/wrun/wrun-heatmap-cell-budget.util.js +342 -0
  132. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +218 -0
  133. package/dist/utility/wrun/wrun-hosted-wire-caps.js +667 -0
  134. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +40 -0
  135. package/dist/utility/wrun/wrun-hosted-wire.util.js +27 -0
  136. package/dist/utility/wrun/wrun-hover.util.d.ts +182 -0
  137. package/dist/utility/wrun/wrun-hover.util.js +534 -0
  138. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +246 -0
  139. package/dist/utility/wrun/wrun-hud-looks.util.js +587 -0
  140. package/dist/utility/wrun/wrun-integration-budget.util.d.ts +47 -0
  141. package/dist/utility/wrun/wrun-integration-budget.util.js +122 -0
  142. package/dist/utility/wrun/wrun-latest-snapshot.d.ts +19 -0
  143. package/dist/utility/wrun/wrun-latest-snapshot.js +7 -0
  144. package/dist/utility/wrun/wrun-levels-child.util.d.ts +131 -0
  145. package/dist/utility/wrun/wrun-levels-child.util.js +514 -0
  146. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +75 -0
  147. package/dist/utility/wrun/wrun-lifecycle.contract.js +9 -0
  148. package/dist/utility/wrun/wrun-market-facts.util.d.ts +116 -0
  149. package/dist/utility/wrun/wrun-market-facts.util.js +238 -0
  150. package/dist/utility/wrun/wrun-output-style.util.d.ts +344 -0
  151. package/dist/utility/wrun/wrun-output-style.util.js +1239 -0
  152. package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +84 -0
  153. package/dist/utility/wrun/wrun-overlay-identity.util.js +142 -0
  154. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +120 -0
  155. package/dist/utility/wrun/wrun-overlay-result.util.js +219 -0
  156. package/dist/utility/wrun/wrun-pack.util.d.ts +70 -0
  157. package/dist/utility/wrun/wrun-pack.util.js +301 -0
  158. package/dist/utility/wrun/wrun-pane-format.util.d.ts +180 -0
  159. package/dist/utility/wrun/wrun-pane-format.util.js +299 -0
  160. package/dist/utility/wrun/wrun-panel-style.lazy.d.ts +25 -0
  161. package/dist/utility/wrun/wrun-panel-style.lazy.js +15 -0
  162. package/dist/utility/wrun/wrun-panel-style.util.d.ts +174 -0
  163. package/dist/utility/wrun/wrun-panel-style.util.js +726 -0
  164. package/dist/utility/wrun/wrun-param-values.util.d.ts +69 -0
  165. package/dist/utility/wrun/wrun-param-values.util.js +230 -0
  166. package/dist/utility/wrun/wrun-refusal.util.d.ts +263 -0
  167. package/dist/utility/wrun/wrun-refusal.util.js +1259 -0
  168. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +199 -0
  169. package/dist/utility/wrun/wrun-registry-errors.util.js +257 -0
  170. package/dist/utility/wrun/wrun-render-select.util.d.ts +336 -0
  171. package/dist/utility/wrun/wrun-render-select.util.js +1157 -0
  172. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +434 -0
  173. package/dist/utility/wrun/wrun-script-inputs.util.js +1971 -0
  174. package/dist/utility/wrun/wrun-setting-words.lazy.d.ts +20 -0
  175. package/dist/utility/wrun/wrun-setting-words.lazy.js +9 -0
  176. package/dist/utility/wrun/wrun-setting-words.util.d.ts +79 -0
  177. package/dist/utility/wrun/wrun-setting-words.util.js +176 -0
  178. package/dist/utility/wrun/wrun-socket-row-store.d.ts +98 -0
  179. package/dist/utility/wrun/wrun-socket-row-store.js +417 -0
  180. package/dist/utility/wrun/wrun-style-flags.util.d.ts +18 -0
  181. package/dist/utility/wrun/wrun-style-flags.util.js +21 -0
  182. package/dist/utility/wrun/wrun-style-words.util.d.ts +148 -0
  183. package/dist/utility/wrun/wrun-style-words.util.js +439 -0
  184. package/dist/utility/wrun/wrun-table-look.util.d.ts +125 -0
  185. package/dist/utility/wrun/wrun-table-look.util.js +225 -0
  186. package/dist/utility/wrun/wrun-text-look.util.d.ts +51 -0
  187. package/dist/utility/wrun/wrun-text-look.util.js +227 -0
  188. package/dist/utility/wrun/wrun-text-params.util.d.ts +106 -0
  189. package/dist/utility/wrun/wrun-text-params.util.js +171 -0
  190. package/dist/utility/wrun/wrun-tpo-rows.util.d.ts +71 -0
  191. package/dist/utility/wrun/wrun-tpo-rows.util.js +438 -0
  192. package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +14 -0
  193. package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +58 -0
  194. package/dist/utility/wrun/wrun-visibility-table.d.ts +437 -0
  195. package/dist/utility/wrun/wrun-visibility-table.js +237 -0
  196. package/dist/utility/wrun/wrun-volume-profile.util.d.ts +37 -0
  197. package/dist/utility/wrun/wrun-volume-profile.util.js +278 -0
  198. package/package.json +38 -0
@@ -0,0 +1,336 @@
1
+ /**
2
+ * `selectRenderables`: the WRUN renderer/drawing selection lifecycle over a
3
+ * finished row set, ported faithfully from the om reference runtime
4
+ * (openmarket packages/cli/src/runner/wrun/runtime.ts) so a package's
5
+ * declared visuals select identically under the browser host:
6
+ *
7
+ * - `text`: one entry per READY row whose slot is PRESENT (a written empty
8
+ * string is an entry; an unwritten slot skips the row).
9
+ * - `label`: the LAST ready row whose slot is present AND nonempty AND whose
10
+ * x/y outputs are finite there; later absent or empty rows never clear an
11
+ * earlier winner.
12
+ * - `table`: the LAST ready row where EVERY cell slot is present.
13
+ * - `shape`: one entry per ready row whose output is finite, gated (when
14
+ * `where` is declared) to rows where the gate output is finite and nonzero.
15
+ * With `color_by` (scaffold 21) the bgcolor ladder rule lands on the mark:
16
+ * the rung floors into `colors`, a finite out-of-range index clamps to
17
+ * entry 0, a non-finite rung selects NO mark, and each selected row
18
+ * carries its resolved `color` exactly like the daemon.
19
+ * - `stats_row`: one entry per ready row, NaN carried, never dropped; a renderer declared (or
20
+ * painted) `visible: false` selects nothing at all, no entry and no rows.
21
+ * - `bgcolor`: one entry per ready row whose `where` gate is finite and
22
+ * nonzero; with `color_by` a non-finite rung drops the row entirely (a
23
+ * background record IS a color), and the selection carries the raw rung
24
+ * for the adapter's ladder. Declared text/label color+size pass through
25
+ * untouched on the selection wrapper.
26
+ * - `barcolor`: the bgcolor selection exactly (same gate, same ladder, same
27
+ * accounting) under its own kind, so the adapter paints the bar's own
28
+ * candle instead of its background.
29
+ * - `card` drawings: the LAST ready row with finite referenced outputs and
30
+ * present referenced slots; sparks take the bounded ready-row history ending
31
+ * at that winner. An absent value declaration resolves to an empty value.
32
+ * WRUN-STYLE g3: the headline (DW01) resolves on the winning row like a
33
+ * row value; the title and the row labels resolve their `{{templates}}`
34
+ * there (DW14: a declared output or string slot by name, `{{name:format}}`
35
+ * a format word, the chart's `{{symbol}}` / `{{exchange}}` / `{{timeframe}}`
36
+ * from the select context; an unknown name stays as written), their
37
+ * references joining the complete-row gate; every number prints through
38
+ * `formatWrunNumber` (DW23: the shared words plus `pct`; an undeclared
39
+ * format keeps today's six significant digits) at the context's price
40
+ * digits.
41
+ * - `inset`: every ready row, retaining non-finite values as series gaps.
42
+ * - levels, panels, ladder, feed and matrices consume run-level frame
43
+ * snapshots. An unwritten slot selects null; invalid written content fails
44
+ * the run by slot. A levels frame also passes the declaration cross-checks
45
+ * (`checkWrunLevelsFrame`: DL-stacked, DL-scale, the DL-time-anchored
46
+ * spans shape, charged 16 per span and per row); a panel frame's chrome
47
+ * (SC17) is charged beside its rows; a matrix (MX-price-matrix) selects
48
+ * through `selectWrunMatrix` on the same budget.
49
+ * - minicharts consumes its frame the same way and selects the grid exactly
50
+ * as the chart's mini-chart grid overlay reads it, through the shared
51
+ * host's om mapping (`wrunMiniChartGridPayload`), beside
52
+ * the drawing's z; every panel and every candle counts as an entry.
53
+ * - ladder, feed and meter carry a `title` (DW15): the frame's, else the
54
+ * declared one (chart names substituted; a meter's templates resolve on
55
+ * its own row), else the declaration name.
56
+ * - meter binds the last ready row's fraction and optional string slot.
57
+ * - other drawings: the LAST ready row ONLY; all coordinates finite (and a label's
58
+ * slot present) = the object exists with `createdBar` = that row's index;
59
+ * any NaN or absent slot = no object, regardless of earlier rows. A box's
60
+ * declared `text` slot is read on that row (DW31; unwritten = no text).
61
+ *
62
+ * The expanded selection is capped at 8 MiB with the reference accounting
63
+ * (16 bytes per selected entry + 8 per carried number + UTF-8 bytes of every
64
+ * carried string, table cells charging 8 extra per cell, copied metadata
65
+ * charged once per renderer/drawing that carries it), checked incrementally
66
+ * and refusing by name (`wrun_render_result_too_large`). The run-result
67
+ * translator charges handles and strategy into this same counter.
68
+ *
69
+ * This module rides the wasm host worker (wrun-abi-host imports it), so it
70
+ * restates the template placeholder grammar (the one wrun-hover.util and the
71
+ * om runtime share) instead of importing wrun-hover.util, whose formatter
72
+ * chain pulls the i18n plugin.
73
+ */
74
+ import type { WrunDrawing, WrunFrameSlot, WrunLevels, WrunMatrix, WrunMetadataOutput, WrunOutputRow, WrunPanel, WrunRenderer } from '../../interfaces/wrun-runtime.interface.js';
75
+ import type { CardProps, FeedProps, LadderProps, MeterProps } from '../chart/om-widget.util.js';
76
+ import type { ParsedPanel } from '../chart/om-panel.util.js';
77
+ import { type WrunChartNames } from './wrun-chart-context.util.js';
78
+ import type { WrunLabelPosition, WrunTextStyle } from './wrun-handles.util.js';
79
+ import type { WrunMiniChartGridPayload } from '@orangecharts/indicator-kit/host';
80
+ import { type WrunBuildMemoSession } from './wrun-build-memo.util.js';
81
+ import { parseWrunLevelsFrame, type WrunMatrixFrame } from './wrun-frames.js';
82
+ /** The expanded render result's cap, om's (runtime.ts WRUN_RENDER_RESULT_LIMIT_BYTES): the run's
83
+ * own string budget (WRUN_STRING_RUN_LIMIT_BYTES, 8 MiB), since the selection carries the strings
84
+ * the run wrote plus per-entry overhead and a lower cap would refuse output the run already
85
+ * admitted. It guards materialization only; the worker's write caps are its own
86
+ * (wrun-abi-host: the string run limit, and wrun-4's frame transport limit). */
87
+ export declare const WRUN_RENDER_RESULT_LIMIT_BYTES: number;
88
+ export interface WrunRenderBudget {
89
+ readonly spent: number;
90
+ spend(bytes: number): void;
91
+ }
92
+ /** The kit's code for an expanded result over the render budget. */
93
+ export declare const WRUN_RENDER_RESULT_TOO_LARGE = "wrun_render_result_too_large";
94
+ /** The budget's refusal mapped to the kit's: its code (`code`) and the sentence the kit's own shaper refuses
95
+ * with, so a browser run over the budget refuses by the code a cloud run's refusal carries. */
96
+ export declare class WrunRenderBudgetRefusal extends Error {
97
+ readonly code = "wrun_render_result_too_large";
98
+ constructor(limitBytes: number);
99
+ }
100
+ /** One counter follows the selection, frame consumers, handles and strategy: the browser lane's one
101
+ * accounting of the render cap (the sandbox row source charges nothing of its own). */
102
+ export declare function createWrunRenderBudget(): WrunRenderBudget;
103
+ /** Values only: object keys are schema, strings and numbers are carried data. */
104
+ export declare function wrunRenderValueBytes(value: unknown): number;
105
+ export interface WrunRenderableSheet {
106
+ outputs: ReadonlyArray<WrunMetadataOutput>;
107
+ string_slots?: ReadonlyArray<{
108
+ index: number;
109
+ name: string;
110
+ }> | undefined;
111
+ renderers?: ReadonlyArray<WrunRenderer> | undefined;
112
+ drawings?: ReadonlyArray<WrunDrawing> | undefined;
113
+ frames?: ReadonlyArray<WrunFrameSlot>;
114
+ levels?: ReadonlyArray<WrunLevels>;
115
+ panels?: ReadonlyArray<WrunPanel>;
116
+ /** WRUN-STYLE MX-price-matrix: the declared matrices over frames. */
117
+ matrices?: ReadonlyArray<WrunMatrix>;
118
+ }
119
+ /**
120
+ * What the chart knows at selection time (WRUN-STYLE 2.5, the 5th argument
121
+ * of `selectWrunRenderables`): the chart's price digits (`"price"` formats
122
+ * and `{{name:price}}` templates print at them) and the names the chart
123
+ * header shows (`{{symbol}}`, `{{exchange}}`, `{{timeframe}}` in widget
124
+ * titles and row labels). Absent fields keep the formatter's defaults and
125
+ * leave the chart-name placeholders as written.
126
+ */
127
+ export interface WrunSelectContext {
128
+ priceDigits?: number;
129
+ chartNames?: WrunChartNames;
130
+ /** The chart market's size unit (`market.size_unit()`, kit 0.69.0 `visible_by`): an output its
131
+ * `visible_by` does not list mounts nothing, nor a renderer drawn from it. Absent reads 0. */
132
+ sizeUnit?: number;
133
+ }
134
+ interface WrunTextRowSelection {
135
+ row: number;
136
+ ts: number;
137
+ y: number;
138
+ text: string;
139
+ }
140
+ interface WrunShapeRowSelection {
141
+ row: number;
142
+ ts: number;
143
+ value: number;
144
+ /** The mark's resolved ladder color (the daemon's row shape); absent
145
+ * when the renderer declares no `color_by`. */
146
+ color?: string;
147
+ }
148
+ interface WrunStatsRowSelection {
149
+ row: number;
150
+ ts: number;
151
+ value: number;
152
+ }
153
+ /** One selected bgcolor or barcolor row: the bar to tint. The two kinds share
154
+ * the row shape; only where the tint lands differs (the background behind
155
+ * the bar, or the bar's own candle). */
156
+ interface WrunBgcolorRowSelection {
157
+ row: number;
158
+ ts: number;
159
+ /** Raw finite color_by rung (the run-result adapter floors/clamps it into
160
+ * the declared table); absent when the renderer declares no ladder. */
161
+ rung?: number;
162
+ }
163
+ interface WrunLabelSelection {
164
+ row: number;
165
+ ts: number;
166
+ x: number;
167
+ y: number;
168
+ text: string;
169
+ }
170
+ interface WrunTableSelection {
171
+ row: number;
172
+ ts: number;
173
+ /** Row-major, `rows * cols` cells in declared order. */
174
+ cells: string[];
175
+ }
176
+ type WrunRendererSelection = {
177
+ kind: 'inset';
178
+ name: string;
179
+ output: string;
180
+ dock: 'top' | 'bottom';
181
+ height_px: number;
182
+ shape: 'histogram' | 'area' | 'line';
183
+ color?: string;
184
+ rows: [number, number][];
185
+ } | {
186
+ kind: 'text';
187
+ name: string;
188
+ color?: string;
189
+ size?: number;
190
+ /** wrun-3: 'price_label' draws each row as a price tag. */
191
+ style?: WrunTextStyle;
192
+ displacement_bars?: number;
193
+ rows: WrunTextRowSelection[];
194
+ } | {
195
+ kind: 'label';
196
+ name: string;
197
+ color?: string;
198
+ size?: number;
199
+ /** wrun-3: the chart corner; x/y on the selection are then the
200
+ * optional anchor point (NaN when the sheet declares none). */
201
+ position?: WrunLabelPosition;
202
+ label: WrunLabelSelection | null;
203
+ } | {
204
+ kind: 'table';
205
+ name: string;
206
+ rows: number;
207
+ cols: number;
208
+ position?: string;
209
+ table: WrunTableSelection | null;
210
+ } | {
211
+ kind: 'shape';
212
+ name: string;
213
+ shape: string;
214
+ where?: string;
215
+ color?: string;
216
+ color_by?: string;
217
+ colors?: string[];
218
+ width?: number;
219
+ displacement_bars?: number;
220
+ rows: WrunShapeRowSelection[];
221
+ } | {
222
+ kind: 'stats_row';
223
+ name: string;
224
+ title?: string;
225
+ format?: string;
226
+ polarity?: string;
227
+ displacement_bars?: number;
228
+ rows: WrunStatsRowSelection[];
229
+ } | {
230
+ kind: 'bgcolor';
231
+ name: string;
232
+ where: string;
233
+ color?: string;
234
+ color_by?: string;
235
+ colors?: string[];
236
+ rows: WrunBgcolorRowSelection[];
237
+ } | {
238
+ /** The bgcolor selection shape, the tint on the bar's own candle. */
239
+ kind: 'barcolor';
240
+ name: string;
241
+ where: string;
242
+ color?: string;
243
+ color_by?: string;
244
+ colors?: string[];
245
+ rows: WrunBgcolorRowSelection[];
246
+ };
247
+ /** One selected drawing: at most one object per declaration, from the LAST
248
+ * ready row only. X coordinate values are in epoch SECONDS by contract; the
249
+ * chart adapter converts to ms. */
250
+ interface WrunGeometryDrawingSelection {
251
+ name: string;
252
+ kind: 'line' | 'box' | 'polyline' | 'label';
253
+ createdBar: number;
254
+ ts: number;
255
+ values: Record<string, number>;
256
+ points?: Array<{
257
+ x: number;
258
+ y: number;
259
+ }>;
260
+ text?: string;
261
+ color?: string;
262
+ width?: number;
263
+ size?: number;
264
+ line_style?: string;
265
+ }
266
+ /** The card's headline band on the winning row (DW01): the referenced
267
+ * output's formatted value (or the referenced slot's text) and the colour
268
+ * the row-colour ladder rule picks (a plain colour word rides verbatim). */
269
+ export interface WrunCardHeadlineSelection {
270
+ text: string;
271
+ color?: string;
272
+ }
273
+ /** The selected card's props: the widget props plus the headline. */
274
+ export type WrunCardSelectionProps = CardProps & {
275
+ headline?: WrunCardHeadlineSelection;
276
+ };
277
+ interface WrunCardDrawingSelection {
278
+ name: string;
279
+ kind: 'card';
280
+ createdBar: number;
281
+ ts: number;
282
+ props: WrunCardSelectionProps;
283
+ }
284
+ type WrunWidgetDrawingSelection = {
285
+ name: string;
286
+ createdBar: number;
287
+ ts: number;
288
+ } & ({
289
+ kind: 'ladder';
290
+ props: LadderProps | null;
291
+ } | {
292
+ kind: 'feed';
293
+ props: FeedProps | null;
294
+ } | {
295
+ kind: 'meter';
296
+ props: MeterProps | null;
297
+ }
298
+ /** The grid as the chart's mini-chart grid overlay reads it (null while
299
+ * the frame is unwritten) and the drawing's z (0 when the sheet leaves
300
+ * it out), om's minicharts selection. */
301
+ | {
302
+ kind: 'minicharts';
303
+ z: number;
304
+ props: WrunMiniChartGridPayload | null;
305
+ });
306
+ export type WrunDrawingSelection = WrunGeometryDrawingSelection | WrunCardDrawingSelection | WrunWidgetDrawingSelection;
307
+ /** A parsed levels frame: the pane shape, or the spans shape under
308
+ * `span: "time"` (DL-time-anchored), whatever the frame host returns. */
309
+ export type WrunLevelsSelectedFrame = ReturnType<typeof parseWrunLevelsFrame>;
310
+ type WrunLevelsSelection = Omit<WrunLevels, 'frame'> & {
311
+ frame: WrunLevelsSelectedFrame | null;
312
+ };
313
+ type WrunPanelSelection = Omit<WrunPanel, 'frame'> & {
314
+ frame: ParsedPanel | null;
315
+ };
316
+ /** A selected matrix (MX-price-matrix): the declaration with its parsed frame (null when unwritten). */
317
+ export type WrunMatrixSelection = Omit<WrunMatrix, 'frame'> & {
318
+ frame: WrunMatrixFrame | null;
319
+ };
320
+ export interface WrunRenderSelection {
321
+ renderers: WrunRendererSelection[];
322
+ drawings: WrunDrawingSelection[];
323
+ levels?: WrunLevelsSelection[];
324
+ panels?: WrunPanelSelection[];
325
+ matrices?: WrunMatrixSelection[];
326
+ }
327
+ export declare function wrunSelectionBytes(selection: WrunRenderSelection): number;
328
+ export declare function selectWrunRenderables(rows: ReadonlyArray<WrunOutputRow>, sheet: WrunRenderableSheet, frames?: ReadonlyArray<string | undefined>, budget?: WrunRenderBudget, context?: WrunSelectContext,
329
+ /** A live tick's build memo over these rows (wrun-build-memo.util): a renderer none of whose inputs changed
330
+ * on the newest row takes back its selection. */
331
+ memo?: WrunBuildMemoSession): WrunRenderSelection;
332
+ /** UTF-8 byte length of a JS string without allocating (the selection
333
+ * accounting's string unit; lone surrogates count as the 3 bytes their
334
+ * U+FFFD replacement would encode to). */
335
+ export declare function utf8ByteLength(value: string): number;
336
+ export {};