@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,434 @@
1
+ /**
2
+ * A browser-run Indicator's params as TECHNICAL_SCRIPT script inputs: the
3
+ * ONE builder every mount uses (the registry loader's pane-first and
4
+ * download mounts, the editor's draft lane, the dev fixture loader, the
5
+ * hosted lane), the dialog layout built from those rows, the param values a
6
+ * run computes with, and the sheet's legend title template resolved against
7
+ * a run's param values.
8
+ *
9
+ * Settings-dialog keys on a param (frozen sheet contract, registry-validated:
10
+ * the om param schema is a non-strict object and the registry serves the
11
+ * sheet as published):
12
+ * - `label`: the row label, the kScript input label, printed verbatim (never
13
+ * re-cased). Absent = the name read as words (the legend's rule,
14
+ * wrunNameWords: `band_pct` reads "Band pct", `atr_len` "ATR len"). A
15
+ * `description` is never the label: it is the row's hint when the param
16
+ * declares no `hint` of its own.
17
+ * - `type`: 'number' (the default), 'int' (whole steps), 'boolean' (the
18
+ * dialog's toggle), 'select' (a labelled choice), 'color' (a colour
19
+ * row), 'time' (an instant, chart-pickable), 'price' (a level,
20
+ * chart-pickable), 'multi' (labelled chips, a bitmask at the module) or
21
+ * 'symbol' (a market picker). The module only ever receives numbers: the
22
+ * dialog writes a toggle as true/false, a select as its numeric-string
23
+ * value, a colour as its string, a symbol as "EXCHANGE:SYMBOL", and the
24
+ * run reads every flat setting back through wrunParamValuesFromSettings,
25
+ * so a toggle arrives as 1/0, a select as its option value, a colour as
26
+ * its packed number (wrun-color-settings.util), a time as epoch seconds,
27
+ * a multi as its bitmask and a symbol as 0 (the browser host applies the
28
+ * pick to the bound inputs instead).
29
+ * - `color_array`: N consecutive colour params render as ONE colour-array
30
+ * row named by the key (the kScript `color[]` input), member i = element i
31
+ * (the row lists the member params in `members`, frozen contract C1).
32
+ * - `style` (om): a style-only knob renders by its bound property (a colour
33
+ * row, a number field for width / opacity, a solid / dashed / dotted
34
+ * select for lineStyle) and never reaches init().
35
+ * - `step`: the number field's step; an 'int' steps by 1 unless declared.
36
+ * - `group`: the dialog group (its tabs; "Tab/Section" nests a section).
37
+ * - `option_labels`: a select's labels, parallel to `options` (the schema's
38
+ * numeric option values) or, without `options`, to the integers min..max.
39
+ * - Typed-inputs keys (WRUN-INPUTS-PLAN 1.1): `hint`, `row`, `when`,
40
+ * `hide`, `slider` and `host` ride the row verbatim; `hidden` and
41
+ * `host_fill` rows are never rendered; `range` / `list` / `session`
42
+ * members and a `unit` pair each collapse into ONE virtual composite row
43
+ * named by the composite (`virtual: true`, `members` in the frozen
44
+ * order: range [lo, hi], list [slot_0 .. slot_n-1, count], session
45
+ * [start, end, tz], unit [value, unit]) while every member keeps its own
46
+ * hidden row (the flat list is the persistence whitelist, and values
47
+ * live under the member keys: the composite row holds no value of its
48
+ * own).
49
+ * - `visible_by` (kit 0.69.0) rides the row as `visibleBy` (a composite's
50
+ * from its lead member, a Style row's from its output), so the dialog
51
+ * marks the row hidden on a market whose size unit the list leaves out
52
+ * (wrunRowVisibleHere) without the sheet; its value stays.
53
+ * Every number field carries its declared min/max (and step) in
54
+ * `constraints`, the only place the settings dialog reads bounds from.
55
+ *
56
+ * Style rows (frozen `__style__<target>__<property>` keys, fix-round
57
+ * contract C1: target = an output name, `text:<name>`, `heatmap:<name>`,
58
+ * `profile:<name>`, `levels:<name>`, or a batched section `marks:<name>`,
59
+ * `spans:<name>` or `rays:<name>`; every drawn kind past those through the
60
+ * visibility table, wrun-visibility-table.ts, the one list of targets every
61
+ * builder here reads: a band `range:<upper>/<lower>#<n>` or
62
+ * `fill:<first>/<second>#<n>`, `box:`, `segment:`, `drawing:<kind>:`,
63
+ * `handles:<kind>`, `matrix:` and `panel:` targets, every renderer kind as
64
+ * `text:<name>`, the candle tint and an inset output by name, each with a
65
+ * Visible row): one row per drawn target and
66
+ * property whose write PAINTS for it (a line: visible, width, lineStyle,
67
+ * color; an area adds opacity; a bar or histogram: visible, color, opacity,
68
+ * or one `colors` row for a two-tone pair; a mark: visible, width, color; a
69
+ * candle group: visible, width on its first output; a per-bar colour or
70
+ * width ladder (or a line's own gradient or split colours) drops the static
71
+ * row it replaces, see stylePropertiesOf; a text or label renderer: visible,
72
+ * color; a heatmap, a price profile or a docked level: visible plus the
73
+ * declared colours it paints; a batched section: visible, its colours and
74
+ * opacity, a ray its width and line style too, see childStyleRows),
75
+ * defaults from the declaration, skipped when a param of the sheet already
76
+ * paints that (target, property) (declaredStyleKnobs; an output's visible
77
+ * only when a boolean param owns it, wrunVisibilityOwners). They are FE-only
78
+ * declared inputs: persisted by name, painted into the sheet by the run
79
+ * path, never sent to a host, and the only rows of the 'redraw' tier (a save
80
+ * of nothing else restyles the mounted outputs in place, wrun-style-tier.util
81
+ * and wrun-style-patch.util; a `colors` row and a prefixed target's rows
82
+ * repaint through a rerun). A cloud record mounts the same rows (the registry
83
+ * loader builds both lanes' records here, over the full sheet): the one pass
84
+ * paints either row source's batch through the chart's own builders.
85
+ *
86
+ * The layout (buildWrunScriptLayout) groups the flat rows into pages and
87
+ * sections: from the sheet's `layout` when it declares one (params before
88
+ * the first page land on the 'general' page; a composite places once,
89
+ * whether the layout names it or its members; a section's toggle param is
90
+ * drawn by the section header, never as a row), else one page per `group`
91
+ * tab with 'general' first, the tabs a sheet without `layout` always had,
92
+ * a param that paints a drawn output moved onto the Style page beside it (a
93
+ * boolean that owns outputs' visibility in the first one's Visible slot);
94
+ * the 'style' page follows when style rows exist (a layout page the author
95
+ * titled like it holds them instead, after its own rows). A page or tab named
96
+ * as a built-in page (General, and Style while style rows exist) lands on
97
+ * that page, never a second tab with its label. It needs only the rows
98
+ * for hints and picks, so an overlay restored without its sheet still lays
99
+ * out (by group tabs).
100
+ */
101
+ import type { WrunIndicatorMetadata, WrunMetadataParam, WrunParamHost, WrunParamType, WrunPreset, WrunVisibleBy } from '../../interfaces/wrun-runtime.interface.js';
102
+ import { type WrunVisibilitySheet, type WrunVisibilityTarget } from './wrun-visibility-table.js';
103
+ import { type WrunWordsShape } from './wrun-setting-words.util.js';
104
+ export { wrunParamChoices, type WrunParamChoice } from './wrun-color-settings.util.js';
105
+ /** The page every param before the first `page()` (and every ungrouped
106
+ * param of a sheet without `layout`) lands on. */
107
+ export declare const WRUN_GENERAL_PAGE_ID = "general";
108
+ /** The derived Style page (appended when style rows exist). */
109
+ export declare const WRUN_STYLE_PAGE_ID = "style";
110
+ /** The Style page's first section: a colour param over several drawn outputs. */
111
+ export declare const WRUN_STYLE_COLORS_SECTION_ID = "colors";
112
+ /** A settings row's control: a param's own, the colour-array row a kScript
113
+ * `color[]` input's colour params share, a virtual composite (range, list,
114
+ * session, unit), a layout-only divider or note, or a derived style row. */
115
+ export type WrunScriptInputType = WrunParamType | 'color[]' | 'range' | 'list' | 'session' | 'unit' | 'divider' | 'note' | 'style';
116
+ /** The properties a style row sets (frozen style-row keys); `colors` is a
117
+ * list of swatches (contract C1): a two-tone bar's pair, a price profile's
118
+ * buy / sell pair, a heatmap's or a TPO's palette stops. */
119
+ export type WrunStyleProperty = 'visible' | 'width' | 'lineStyle' | 'color' | 'opacity' | 'colors';
120
+ /** What one swatch of a `colors` style row paints, in value order: a bar's
121
+ * sign palette is `up` (value at or above its base) then `down`; a price
122
+ * profile's pair is `buy` then `sell`; a colour ladder's rung or a palette
123
+ * stop is a `stop`. */
124
+ export type WrunStyleSwatch = 'up' | 'down' | 'buy' | 'sell' | 'stop';
125
+ export interface WrunScriptInputDeclaration {
126
+ name: string;
127
+ label: string;
128
+ type: WrunScriptInputType;
129
+ /** A colour row's default is its colour string, a colour-array row's the
130
+ * members' colour strings, a symbol row's the "EXCHANGE:SYMBOL" string, a
131
+ * composite's its members' defaults in member order (a list: the default
132
+ * slots), a style row's the property value (visible boolean, width
133
+ * number, lineStyle name, colour string, opacity number). */
134
+ defaultValue: number | boolean | string | string[] | number[];
135
+ constraints?: {
136
+ min?: number;
137
+ max?: number;
138
+ step?: number;
139
+ };
140
+ /** A select's values as numeric strings: the dialog and the settings
141
+ * checks compare strings, and the run reads them back through Number()
142
+ * (a lineStyle knob's or style row's values are the style names). */
143
+ options?: string[];
144
+ /** A select's labels, parallel to `options` (the dialog shows these). */
145
+ optionLabels?: string[];
146
+ group?: string;
147
+ /** 'refetch' on every param, composite and layout row (an edit reruns the
148
+ * package); 'redraw' with `affectsCompute: false` on a style row only,
149
+ * which never reaches init() (wrun-style-tier.util). */
150
+ settingsTier: 'refetch' | 'redraw';
151
+ affectsCompute: boolean;
152
+ /** Placement, set by buildWrunScriptLayout on every row it places and
153
+ * absent on the flat list (a flat row has no place yet, and the rows a
154
+ * sheet without typed keys yields stay exactly what they were): the page
155
+ * id, the section title, the position in the layout walk. */
156
+ page?: string;
157
+ section?: string;
158
+ order?: number;
159
+ hint?: string;
160
+ row?: string;
161
+ when?: string;
162
+ hide?: boolean;
163
+ slider?: boolean;
164
+ /** Never rendered: a composite member, a host-filled param, an author-hidden param. */
165
+ hidden?: boolean;
166
+ /** The size units of the markets where the row shows (kit 0.69.0: the
167
+ * param's `visible_by`, a composite's lead member's, a Style row's
168
+ * output's), carried so the dialog decides without the sheet: on any
169
+ * other market it hides the row (wrunRowVisibleHere) and its value stays. */
170
+ visibleBy?: WrunVisibleBy;
171
+ /** A composite row: holds no value of its own, its members do. */
172
+ virtual?: boolean;
173
+ /** range [lo, hi]; list [slot_0 .. slot_n-1, count]; session [start, end, tz]; unit [value, unit];
174
+ * a colour-array (`color[]`) row, which is no composite (its value is the
175
+ * colour list stored under its own name), its member params in element
176
+ * order. Frozen contract C1 (WRUN-PARITY-PLAN): "a `color[]` row carries
177
+ * `members: string[]`", so a lane holding only the rows (the cloud
178
+ * createScript's socket worker) rebuilds one colour param per member
179
+ * (wrunSheetParamsFromDeclarations) and packs element i as member i. */
180
+ members?: string[];
181
+ /** A host-applied param (the sheet's `host`): the browser host rewrites
182
+ * the bound inputs' field, interval or market from it, and the cloud
183
+ * applies the same picks from the hosted map (C1). Carried on the row so
184
+ * the layout and the dialog know it without the sheet (a hosted overlay
185
+ * restored by a reload has only its persisted rows). */
186
+ host?: WrunParamHost;
187
+ /** Layout-set: the chart pick a time / price row offers. */
188
+ pick?: 'time' | 'price';
189
+ /** A style row: the target (an output name or a contract C1 target such
190
+ * as `text:<name>`) and property it paints. */
191
+ styleOf?: {
192
+ output: string;
193
+ property: WrunStyleProperty;
194
+ };
195
+ /** Layout-set (a sheet without a declared layout): a param placed on one
196
+ * output's Style line because it paints that drawn output and no other
197
+ * (`property`: the knob it stands for there, absent = ahead of the line's
198
+ * knobs, with its own words). The row keeps its own control. */
199
+ styleLine?: {
200
+ output: string;
201
+ property?: WrunStyleProperty;
202
+ };
203
+ /** A `colors` style row: what each swatch paints, in value order. */
204
+ swatches?: WrunStyleSwatch[];
205
+ /** A text row (wrun-5): the UTF-8 byte cap the field enforces and whether
206
+ * it takes several lines (a text area; newlines survive). Carried on the
207
+ * row so the dialog and the hosted lanes know them without the sheet. */
208
+ maxBytes?: number;
209
+ multiline?: boolean;
210
+ }
211
+ export interface WrunScriptSection {
212
+ /** A section the builder names (the Style page's shared colours,
213
+ * WRUN_STYLE_COLORS_SECTION_ID): the dialog draws its localized title by
214
+ * id, `title` is the English fallback. */
215
+ id?: string;
216
+ title?: string;
217
+ /** The toggle param the section header draws (its own row is never placed). */
218
+ toggle?: string;
219
+ collapsed?: boolean;
220
+ when?: string;
221
+ /** Flat declarations (and layout-only divider / note rows) with `page`,
222
+ * `section` and `order` set. */
223
+ rows: WrunScriptInputDeclaration[];
224
+ }
225
+ export interface WrunScriptPage {
226
+ /** 'general', 'style', or the slug of an author page / group tab title
227
+ * (unique within the layout; the frozen `wrun-page-<id>-btn` test id).
228
+ * An author page or group tab named General is 'general' itself; one
229
+ * named Style (or as the dialog shows the Style page) is 'style' itself
230
+ * when the sheet has style rows (it holds them). */
231
+ id: string;
232
+ /** The author's title. On the two built-in pages it is an English
233
+ * fallback only: the dialog draws its localized word by `id` (this module
234
+ * stays free of i18n, it loads in the worker's graph). */
235
+ title: string;
236
+ sections: WrunScriptSection[];
237
+ }
238
+ export interface WrunScriptLayout {
239
+ pages: WrunScriptPage[];
240
+ presets: WrunPreset[];
241
+ hasLayout: boolean;
242
+ }
243
+ /** The sheet slice the builders read: params always; every section the
244
+ * visibility table lists (the Style rows' targets, wrun-visibility-table.ts
245
+ * WrunVisibilitySheet: no list of its own here), input sources (host
246
+ * bindings), layout and presets when present. */
247
+ export type WrunScriptInputsSheet = Pick<WrunIndicatorMetadata, 'params'> & WrunVisibilitySheet & Partial<Pick<WrunIndicatorMetadata, 'inputSources' | 'layout' | 'presets'>>;
248
+ /**
249
+ * The words a settings row prints: its label verbatim (an author's words are
250
+ * never re-cased: "ATRs" stays "ATRs"), else the name read as words. A label
251
+ * that is the bare name (what an older build stamped on a param without one)
252
+ * reads as words too. The kScript dialog's Title Case is for kScript rows
253
+ * only (technical-script-input-rendering formatTechnicalScriptLabel).
254
+ */
255
+ export declare function wrunRowLabel(row: Pick<WrunScriptInputDeclaration, 'name' | 'label'>): string;
256
+ /** How a sheet's rows are built. */
257
+ export interface WrunRowBuildOptions {
258
+ /**
259
+ * The sheet is a port's (isWrunTwinPort): a row whose control already
260
+ * shows its choices as words or a swatch (a select, a multi, a toggle, a
261
+ * colour) takes its hint from `hint` only. There a port's `description` is
262
+ * the encoding legend written for agents ("Source (0 close, 1 open, 2
263
+ * high, 3 low)", "(0 off, 1 on)", "packed RGBA"), and the kScript script
264
+ * the port stands in for showed no tooltip. A port's number rows keep
265
+ * their description ("Width of the DI lines"); an authored Indicator keeps
266
+ * every description as its hint.
267
+ */
268
+ port?: boolean;
269
+ }
270
+ /** The style-row name (frozen): `__style__<output>__<property>`. */
271
+ export declare function wrunStyleRowName(output: string, property: WrunStyleProperty): string;
272
+ /** The control a param renders as: its declared `type` when the sheet gives
273
+ * what that control needs (a select needs a choice set, a multi its
274
+ * labels), else the number field every param rendered as before the key. */
275
+ export declare function wrunParamControlType(param: WrunMetadataParam): WrunParamType;
276
+ /** A param's setting-words shape (wrun-setting-words.util): its control
277
+ * kind, its choices as the dialog's row lists them (a line-style knob's
278
+ * words, a select's option values and labels, a multi's bit labels), its
279
+ * declared default, and a session start or end as a clock. */
280
+ export declare function wrunParamWordsShape(param: WrunMetadataParam): WrunWordsShape;
281
+ /**
282
+ * Every drawn entry of a sheet as a Style target, in the visibility table's
283
+ * order (wrun-visibility-table.ts WRUN_VISIBILITY_RULES' key order, each
284
+ * section in declaration order, the outputs in output order): what the Style
285
+ * page offers a Visible row for, and what the visibility apply and the
286
+ * render selection read (wrun-run-result.util). Each entry through the
287
+ * table's one-entry read (wrunVisibilityEntryTarget, the frozen identities);
288
+ * the walk adds what only the whole sheet tells: a candle group draws once, as
289
+ * its first output, and a text renderer whose records only feed another's
290
+ * tooltips (`tooltip_from`) never mounts.
291
+ */
292
+ export declare function wrunVisibilityTargets(sheet: WrunVisibilitySheet): WrunVisibilityTarget[];
293
+ /** True for a Style target whose line the dialog titles with its own localized words (a draw-API
294
+ * handle kind): its section carries the target as its `id`. */
295
+ export declare function isWrunLocalizedStyleTarget(target: string): boolean;
296
+ /** The overlay's scriptInputs for a sheet (what the settings dialog renders
297
+ * and the persist whitelist names), in param order: a colour-array row sits
298
+ * at its first member's position, a composite row at its first member's
299
+ * followed by the members' hidden rows, the style rows after every param.
300
+ * A param row refetches (a compute param always reaches init(), and a
301
+ * colour param's pick is an init arg the module may read besides the sheet
302
+ * locations it paints). A style row is the redraw tier: a save whose every
303
+ * changed row is one (or an om style knob) restyles the mounted outputs in
304
+ * place from the sheet the new settings paint (wrunSheetWithSettings,
305
+ * wrun-style-patch.util), and anything that patch cannot reach reruns. */
306
+ export declare function buildWrunScriptInputs(metadata: WrunScriptInputsSheet, options?: WrunRowBuildOptions): WrunScriptInputDeclaration[];
307
+ /** The rows as the dialog shows them on a market of size unit `sizeUnit` (wrunChartSizeUnit): a
308
+ * row whose `visibleBy` leaves the unit out is hidden like a composite member, never placed, its
309
+ * value kept (the run still reads it and the dialog's Reset still resets it). The rows themselves
310
+ * when none hides. */
311
+ export declare function wrunRowsOnMarket(rows: ReadonlyArray<WrunScriptInputDeclaration>, sizeUnit: number): WrunScriptInputDeclaration[];
312
+ /**
313
+ * The rows an overlay persisted, drawn with the sheet's words: every row the
314
+ * sheet builds now (a param, a composite, a colour array, a member) takes
315
+ * its label and hint from that build, matched by name (a unit composite and
316
+ * its value member, which share a name, each from its own kind). An older
317
+ * build stamped a param's description as its label and no hint; the saved
318
+ * indicator reads the same as a fresh add without a rerun. Values, types and
319
+ * every other key stay as persisted; a style row (its label is its property
320
+ * key) and a row the sheet no longer builds keep their own; a row whose
321
+ * words already match is returned as is. `options` builds the words as the
322
+ * mount did (a port's hint rule, WrunRowBuildOptions), so a row persisted
323
+ * before the rule reads without its encoding legend.
324
+ */
325
+ export declare function wrunRowsWithSheetWords(rows: ReadonlyArray<WrunScriptInputDeclaration>, sheet: WrunScriptInputsSheet | undefined, options?: WrunRowBuildOptions): WrunScriptInputDeclaration[];
326
+ /**
327
+ * The rows an overlay persisted, with every Style row its sheet offers now
328
+ * that they lack appended in the builder's order: an overlay added before a
329
+ * kind had a Visible row (a band, a box, a shape or table renderer, a
330
+ * drawing, a handle kind) gains it when the settings dialog opens, without a
331
+ * rerun or a fresh add. A row that exists is never rewritten (its value, its
332
+ * words and its place stay) and no param row is ever added (the mount and
333
+ * the cloud reconcile own those). The rows themselves (the same array) when
334
+ * nothing is missing or the sheet is unknown, so a caller's change test is
335
+ * one identity check.
336
+ */
337
+ export declare function wrunRowsWithMissingStyleRows<Row extends {
338
+ name?: unknown;
339
+ }>(rows: ReadonlyArray<Row>, sheet: WrunScriptInputsSheet | undefined): ReadonlyArray<Row | WrunScriptInputDeclaration>;
340
+ /**
341
+ * The dialog layout of a sheet's rows: pages of sections of rows (copies of
342
+ * the flat declarations, `page` / `section` / `order` set, `pick` on time /
343
+ * price rows). The same layout on both lanes: the cloud applies every
344
+ * host-applied pick the browser applies (a source or timeframe pick as its
345
+ * select index, a market pick as its `EXCHANGE:SYMBOL` text, frozen contract
346
+ * C1 of WRUN-PARITY-PLAN), so no row carries a lane hint and `cloudRun`
347
+ * changes nothing (kept so the dialog's call compiles until it drops it).
348
+ * With a sheet `layout`: pages, sections, dividers and notes in source
349
+ * order, params before the first page on the 'general' page, a param the
350
+ * layout never names appended there; a param a section names as its
351
+ * `toggle` is drawn by that section's header and never as a row of its own.
352
+ * Without one: one page per `group` tab
353
+ * ('general' first, then first appearance), "Tab/Section" nesting a section,
354
+ * exactly the tabs the dialog drew before layouts, except that a param that
355
+ * paints a drawn output sits on the Style page (stylePlacements: on that
356
+ * output's line, or in the shared colours section that opens the page) and a
357
+ * group page left empty never appears. Hidden rows (composite members,
358
+ * host-filled and author-hidden params, and any row, a Style row included,
359
+ * the dialog hides on the chart's market) are never placed. The 'style' page
360
+ * follows when style rows exist, one section per styled target that holds a
361
+ * row (a drawn output whose every knob a param owns counts: the params
362
+ * placed on its line), titled by the legend's rule (styleTargetTitle). A
363
+ * page or group tab named as a built-in page (builtInPageId: General or
364
+ * Style, or as the dialog shows the Style page, `stylePageTitle`, the
365
+ * dialog's localized word; trimmed, any case) is that page instead, so the
366
+ * dialog never shows two tabs with one label: its rows join the 'general'
367
+ * page (an author's layout page named General makes that page where it
368
+ * stands, unless params before the first page made it already, and the rows
369
+ * the layout never names join it); the first page named Style takes the
370
+ * 'style' id in its place, a tab named Style fills the Style page, still
371
+ * last, and either way the output sections follow its own rows. Without
372
+ * style rows there is no Style page to land on: the page or tab keeps its
373
+ * own slug, as before.
374
+ */
375
+ export declare function buildWrunScriptLayout(metadata: WrunScriptInputsSheet, declarations: ReadonlyArray<WrunScriptInputDeclaration>, opts: {
376
+ cloudRun?: boolean;
377
+ stylePageTitle?: string;
378
+ }): WrunScriptLayout;
379
+ /**
380
+ * A value in the row's UI storage type (the frozen table the preset
381
+ * normalizer below spells out), undefined when the row cannot store it: a
382
+ * toggle a boolean (a 1/0 number or an on/off word reads), a select its
383
+ * numeric option string (an option label or an index into the options
384
+ * resolves; an index past them is no value), a colour a colour string (a
385
+ * packed number decodes), a colour array its declared members (an
386
+ * undecodable element its member's default, the slots never shift), a multi
387
+ * its bitmask, a time epoch seconds, a symbol its non-empty string, a style
388
+ * row its property value (a `colors` row its swatches, each a colour or a
389
+ * theme token), everything else a finite number. The preset
390
+ * normalizer and the dialog's row read (wrun-dialog-rows readRowValue)
391
+ * share it, so a value persisted under an older package version (a packed
392
+ * colour number under what is now a colour row, a 1 under a toggle, a
393
+ * dropped option's index under a select) reads as the kind the republished
394
+ * sheet declares; the persisted value itself is rewritten only by an edit
395
+ * or a reset.
396
+ */
397
+ export declare function coerceWrunRowValue(row: WrunScriptInputDeclaration, raw: unknown): unknown;
398
+ /**
399
+ * A preset's values in the dialog's storage types (frozen contract, plan
400
+ * 1.2): a toggle a boolean, a select its numeric option string (a label or
401
+ * an index resolve to it), a colour a string (a packed number decodes), a
402
+ * multi its bitmask, a time epoch seconds (a `YYYY-MM-DD HH:MM` UTC text
403
+ * parses), a symbol its string, a style row its property value, everything
404
+ * else a number. A key naming no declaration, a virtual composite (values
405
+ * live under its members) or a value the row cannot store is dropped, so
406
+ * the result applies as ONE settings patch of declared keys.
407
+ */
408
+ export declare function normalizePresetValues(preset: WrunPreset, declarations: ReadonlyArray<WrunScriptInputDeclaration>): Record<string, unknown>;
409
+ /** The overlay palette of a sheet with colour settings (colour params,
410
+ * colour arrays, om colour knobs): their CURRENT colours under `settings` in
411
+ * row order, a colour array flattened (no settings = the declared defaults).
412
+ * Undefined for a sheet without colour settings, whose palette
413
+ * (`legend_palette`, else derived) never follows a setting. The loaders
414
+ * mount it (wrunSheetOverlayPalette) and every full run stamps it on the
415
+ * live overlay (wrun-overlay-run.util), since a settings save drops a
416
+ * TECHNICAL_SCRIPT's `colors`. Style rows never enter it. */
417
+ export declare function wrunRunOverlayPalette(metadata: WrunScriptInputsSheet, settings?: unknown): string[] | undefined;
418
+ export { wrunParamValuesFromSettings, type WrunHostFillContext } from './wrun-param-values.util.js';
419
+ export { wrunTwinComputeInputNames } from './wrun-twin-compute-inputs.util.js';
420
+ /**
421
+ * The legend suffix a sheet's `custom_title` template (the kScript
422
+ * define(customTitle=...) text) reads as for one run. Resolved here, not by
423
+ * the chart: titan's own token pass (`/\$[a-zA-Z0-9]+/` against the flat
424
+ * settings' raw values) can never see a snake_case param name, and a select
425
+ * would read as its index. Each `$<param name>` token (longest name first,
426
+ * and never the prefix of a longer identifier, so `$len` leaves `$len_fast`
427
+ * alone) becomes the run's value (else the declared default) rendered like
428
+ * a kScript input's; a falsy value keeps the literal token, and a token
429
+ * naming no param stays as written. `texts` is the run's text settings by
430
+ * name (wrunTextParamValuesFromSettings; absent = the declared words): a
431
+ * text token becomes the plain words, inserted after the token pass and
432
+ * never re-read as a template (a typed `$len` arrives literally).
433
+ */
434
+ export declare function resolveWrunCustomTitle(template: string, params: ReadonlyArray<WrunMetadataParam>, values?: Readonly<Record<string, number>>, texts?: Readonly<Record<string, string>>): string;