@orangecharts/wrun-chart-host 0.11.1 → 0.15.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 (319) hide show
  1. package/README.md +1 -0
  2. package/dist/constants/feature-flags.constants.d.ts +4 -4
  3. package/dist/constants/feature-flags.constants.js +38 -52
  4. package/dist/constants/feature-limits.constants.d.ts +1 -1
  5. package/dist/constants/feature-limits.constants.js +5 -4
  6. package/dist/constants/interval.constants.d.ts +7 -0
  7. package/dist/constants/interval.constants.js +7 -0
  8. package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +20 -149
  9. package/dist/constants/scriptEditor/cme-official-scripts.constants.js +20 -309
  10. package/dist/constants/stocks-compliance.constants.d.ts +15 -0
  11. package/dist/constants/stocks-compliance.constants.js +15 -0
  12. package/dist/host-env.d.ts +69 -3
  13. package/dist/host-env.js +21 -0
  14. package/dist/host-ports.types.d.ts +36 -3
  15. package/dist/index.d.ts +18 -0
  16. package/dist/index.js +19 -0
  17. package/dist/indicators/controls/tpo-session.util.d.ts +52 -12
  18. package/dist/indicators/controls/tpo-session.util.js +113 -16
  19. package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +6 -0
  20. package/dist/instances/script-engine-worker-ohlcv-transfer.js +16 -0
  21. package/dist/interfaces/cme-realtime.interface.d.ts +8 -0
  22. package/dist/interfaces/cme-realtime.interface.js +2 -1
  23. package/dist/interfaces/feed.interface.d.ts +15 -1
  24. package/dist/interfaces/replay.interface.d.ts +5 -0
  25. package/dist/interfaces/stocks-realtime.interface.d.ts +4 -3
  26. package/dist/interfaces/stocks-realtime.interface.js +5 -4
  27. package/dist/interfaces/wrun-runtime.interface.d.ts +141 -20
  28. package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +17 -0
  29. package/dist/kscript-data/controls/live-ohlcv-merge.util.js +22 -0
  30. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +46 -40
  31. package/dist/kscript-data/controls/live-trades-merge.util.js +80 -107
  32. package/dist/market-data/billing.interface.d.ts +9 -1
  33. package/dist/market-data/venue.d.ts +1 -1
  34. package/dist/market-data/venues/index.d.ts +5 -5
  35. package/dist/market-data/venues/opra.js +3 -3
  36. package/dist/market-data/venues/stocks.contract.copy.json +6 -5
  37. package/dist/market-data/venues/stocks.d.ts +5 -5
  38. package/dist/market-data/venues/stocks.js +21 -18
  39. package/dist/settings-templates/frvp-fields.d.ts +12 -1
  40. package/dist/settings-templates/frvp-fields.js +15 -4
  41. package/dist/settings-templates/index.js +12 -5
  42. package/dist/settings-templates/indicator-fields.js +43 -2
  43. package/dist/settings-templates/tool-rules.d.ts +17 -8
  44. package/dist/settings-templates/tool-rules.js +15 -8
  45. package/dist/settings-templates/tool-tables.generated.js +4 -2
  46. package/dist/utility/auth/server-clock.util.d.ts +3 -1
  47. package/dist/utility/auth/server-clock.util.js +3 -1
  48. package/dist/utility/chart/book-live-bucket.util.js +2 -2
  49. package/dist/utility/chart/cache-alignment.util.d.ts +38 -7
  50. package/dist/utility/chart/cache-alignment.util.js +50 -13
  51. package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +2 -0
  52. package/dist/utility/chart/chart-data-fetch-generation.util.js +16 -0
  53. package/dist/utility/chart/cme-session-bucket.util.d.ts +18 -75
  54. package/dist/utility/chart/cme-session-bucket.util.js +25 -332
  55. package/dist/utility/chart/continuous-contracts.util.js +6 -5
  56. package/dist/utility/chart/display-offset.leaf.d.ts +24 -0
  57. package/dist/utility/chart/display-offset.leaf.js +41 -0
  58. package/dist/utility/chart/effective-chart-session.util.d.ts +2 -1
  59. package/dist/utility/chart/effective-chart-session.util.js +13 -5
  60. package/dist/utility/chart/feed-interval.util.d.ts +6 -20
  61. package/dist/utility/chart/feed-interval.util.js +13 -22
  62. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +27 -7
  63. package/dist/utility/chart/fetch-dedupe-policy.util.js +86 -11
  64. package/dist/utility/chart/footprint-band.util.d.ts +21 -5
  65. package/dist/utility/chart/footprint-band.util.js +53 -14
  66. package/dist/utility/chart/host-bar-placement.util.d.ts +7 -4
  67. package/dist/utility/chart/host-bar-placement.util.js +8 -2
  68. package/dist/utility/chart/indicator-inflight-registry.util.d.ts +32 -0
  69. package/dist/utility/chart/indicator-inflight-registry.util.js +52 -0
  70. package/dist/utility/chart/indicator-run-interval.util.d.ts +10 -4
  71. package/dist/utility/chart/indicator-run-interval.util.js +21 -12
  72. package/dist/utility/chart/interval-registry.util.d.ts +1 -1
  73. package/dist/utility/chart/interval-registry.util.js +1 -1
  74. package/dist/utility/chart/kscript-legend-entries.util.d.ts +12 -0
  75. package/dist/utility/chart/kscript-legend-entries.util.js +16 -0
  76. package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +1 -1
  77. package/dist/utility/chart/kscript-run-interval-projection.util.js +4 -2
  78. package/dist/utility/chart/kscript-venue-policy.util.d.ts +53 -62
  79. package/dist/utility/chart/kscript-venue-policy.util.js +85 -94
  80. package/dist/utility/chart/live-bucket.util.d.ts +39 -17
  81. package/dist/utility/chart/live-bucket.util.js +103 -57
  82. package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +58 -20
  83. package/dist/utility/chart/local-kscript-source-revalidation.util.js +98 -23
  84. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +35 -11
  85. package/dist/utility/chart/local-kscript-warmup-depth.util.js +24 -3
  86. package/dist/utility/chart/market-session-schedule.util.d.ts +8 -0
  87. package/dist/utility/chart/market-session-schedule.util.js +39 -1
  88. package/dist/utility/chart/market-session.util.d.ts +136 -0
  89. package/dist/utility/chart/market-session.util.js +341 -0
  90. package/dist/utility/chart/om-panel.util.d.ts +5 -3
  91. package/dist/utility/chart/om-panel.util.js +42 -7
  92. package/dist/utility/chart/om-target.util.d.ts +14 -1
  93. package/dist/utility/chart/om-target.util.js +22 -5
  94. package/dist/utility/chart/opra-read-access.leaf.d.ts +16 -1
  95. package/dist/utility/chart/opra-read-access.leaf.js +22 -0
  96. package/dist/utility/chart/profile-row-height.util.d.ts +49 -16
  97. package/dist/utility/chart/profile-row-height.util.js +74 -37
  98. package/dist/utility/chart/rth-session.util.d.ts +55 -20
  99. package/dist/utility/chart/rth-session.util.js +94 -46
  100. package/dist/utility/chart/session-lattice.util.d.ts +150 -0
  101. package/dist/utility/chart/session-lattice.util.js +488 -0
  102. package/dist/utility/chart/trading-day.util.d.ts +40 -2
  103. package/dist/utility/chart/trading-day.util.js +84 -7
  104. package/dist/utility/chart/us-equities-session.util.d.ts +32 -11
  105. package/dist/utility/chart/us-equities-session.util.js +44 -15
  106. package/dist/utility/chart/window-geometry.leaf.d.ts +28 -7
  107. package/dist/utility/chart/window-geometry.leaf.js +57 -8
  108. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +21 -14
  109. package/dist/utility/chart/wrun-bar-session-facts.util.js +32 -38
  110. package/dist/utility/chart/wrun-run-result.util.d.ts +38 -13
  111. package/dist/utility/chart/wrun-run-result.util.js +97 -27
  112. package/dist/utility/common/time.util.js +5 -4
  113. package/dist/utility/market-events/earnings-scope.util.d.ts +10 -5
  114. package/dist/utility/market-events/earnings-scope.util.js +17 -9
  115. package/dist/utility/market-events/market-events.util.d.ts +14 -7
  116. package/dist/utility/market-events/market-events.util.js +30 -17
  117. package/dist/utility/number-format.util.d.ts +14 -21
  118. package/dist/utility/number-format.util.js +38 -24
  119. package/dist/utility/options/option-venue-disclosure.util.d.ts +40 -6
  120. package/dist/utility/options/option-venue-disclosure.util.js +71 -11
  121. package/dist/utility/options/option-venue.util.d.ts +1 -1
  122. package/dist/utility/options/option-venue.util.js +1 -1
  123. package/dist/utility/pool-symbol.leaf.d.ts +7 -0
  124. package/dist/utility/pool-symbol.leaf.js +50 -5
  125. package/dist/utility/stocks/stock-display.util.d.ts +15 -0
  126. package/dist/utility/stocks/stock-display.util.js +37 -0
  127. package/dist/utility/symbol-selection/contract-expiry.util.js +5 -4
  128. package/dist/utility/v2/gate-plane.util.d.ts +6 -0
  129. package/dist/utility/v2/gate-plane.util.js +11 -1
  130. package/dist/utility/v2/gate-session-latch.util.d.ts +1 -1
  131. package/dist/utility/v2/gate-session-latch.util.js +3 -3
  132. package/dist/utility/v2/governed-tier.leaf.d.ts +17 -16
  133. package/dist/utility/v2/governed-tier.leaf.js +17 -16
  134. package/dist/utility/v2/stocks-governed.util.d.ts +5 -0
  135. package/dist/utility/v2/stocks-governed.util.js +14 -0
  136. package/dist/utility/v2/v2-enums.leaf.d.ts +13 -0
  137. package/dist/utility/v2/v2-enums.leaf.js +458 -0
  138. package/dist/utility/wrun/derived-roots.leaf.d.ts +21 -1
  139. package/dist/utility/wrun/derived-roots.leaf.js +27 -1
  140. package/dist/utility/wrun/derived-roots.util.d.ts +44 -32
  141. package/dist/utility/wrun/derived-roots.util.js +97 -56
  142. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -3
  143. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -3
  144. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +2 -1
  145. package/dist/utility/wrun/sources/lanes/option_daily.js +2 -1
  146. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +3 -0
  147. package/dist/utility/wrun/sources/lanes/options_flow.js +23 -5
  148. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -4
  149. package/dist/utility/wrun/sources/row-lane-registry.js +9 -4
  150. package/dist/utility/wrun/sources/row-lanes/dark_pool.d.ts +19 -0
  151. package/dist/utility/wrun/sources/row-lanes/dark_pool.js +104 -0
  152. package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
  153. package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.d.ts +20 -0
  154. package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.js +103 -0
  155. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -2
  156. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +15 -13
  157. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +49 -23
  158. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +14 -9
  159. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +75 -27
  160. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +139 -82
  161. package/dist/utility/wrun/wrun-app-layer.leaf.d.ts +78 -0
  162. package/dist/utility/wrun/wrun-app-layer.leaf.js +89 -0
  163. package/dist/utility/wrun/wrun-bar-count.util.d.ts +11 -7
  164. package/dist/utility/wrun/wrun-bar-count.util.js +12 -8
  165. package/dist/utility/wrun/wrun-batched-kinds.leaf.d.ts +13 -0
  166. package/dist/utility/wrun/wrun-batched-kinds.leaf.js +18 -0
  167. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +46 -23
  168. package/dist/utility/wrun/wrun-batched-marks.util.js +260 -62
  169. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +26 -19
  170. package/dist/utility/wrun/wrun-batched-readout.util.js +81 -27
  171. package/dist/utility/wrun/wrun-book-bands.leaf.d.ts +8 -0
  172. package/dist/utility/wrun/wrun-book-bands.leaf.js +7 -0
  173. package/dist/utility/wrun/wrun-candle-equal.leaf.d.ts +19 -0
  174. package/dist/utility/wrun/wrun-candle-equal.leaf.js +40 -0
  175. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -2
  176. package/dist/utility/wrun/wrun-canvases.util.d.ts +24 -7
  177. package/dist/utility/wrun/wrun-canvases.util.js +99 -30
  178. package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +6 -3
  179. package/dist/utility/wrun/wrun-chart-context-names.util.js +8 -4
  180. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +47 -29
  181. package/dist/utility/wrun/wrun-chart-market-facts.util.js +201 -201
  182. package/dist/utility/wrun/wrun-child-overlay-id.util.js +2 -1
  183. package/dist/utility/wrun/wrun-cme-legs-note.util.d.ts +15 -0
  184. package/dist/utility/wrun/wrun-cme-legs-note.util.js +49 -0
  185. package/dist/utility/wrun/wrun-cme-root-specs.util.d.ts +38 -0
  186. package/dist/utility/wrun/wrun-cme-root-specs.util.js +81 -0
  187. package/dist/utility/wrun/wrun-coin-lane-live.util.js +3 -0
  188. package/dist/utility/wrun/wrun-color-settings.util.d.ts +6 -1
  189. package/dist/utility/wrun/wrun-color-settings.util.js +32 -7
  190. package/dist/utility/wrun/wrun-dark-pool.util.d.ts +50 -0
  191. package/dist/utility/wrun/wrun-dark-pool.util.js +127 -0
  192. package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +67 -12
  193. package/dist/utility/wrun/wrun-declared-warmup.util.js +165 -13
  194. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +18 -8
  195. package/dist/utility/wrun/wrun-draft-legend-note.util.js +57 -11
  196. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +14 -10
  197. package/dist/utility/wrun/wrun-draft-overlay.util.js +26 -14
  198. package/dist/utility/wrun/wrun-earnings-facts.util.js +3 -2
  199. package/dist/utility/wrun/wrun-etf-funds.util.d.ts +2 -0
  200. package/dist/utility/wrun/wrun-etf-funds.util.js +4 -0
  201. package/dist/utility/wrun/wrun-held-lanes.util.js +8 -2
  202. package/dist/utility/wrun/wrun-history-as-of.util.d.ts +77 -0
  203. package/dist/utility/wrun/wrun-history-as-of.util.js +108 -0
  204. package/dist/utility/wrun/wrun-host.service.d.ts +64 -14
  205. package/dist/utility/wrun/wrun-host.service.js +137 -27
  206. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +3 -3
  207. package/dist/utility/wrun/wrun-hosted-wire-caps.js +12 -2
  208. package/dist/utility/wrun/wrun-hover.util.d.ts +8 -2
  209. package/dist/utility/wrun/wrun-hover.util.js +24 -13
  210. package/dist/utility/wrun/wrun-inert-legend.util.d.ts +13 -0
  211. package/dist/utility/wrun/wrun-inert-legend.util.js +31 -3
  212. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +7 -5
  213. package/dist/utility/wrun/wrun-input-requirements.leaf.js +16 -6
  214. package/dist/utility/wrun/wrun-install-pacer.util.d.ts +26 -0
  215. package/dist/utility/wrun/wrun-install-pacer.util.js +145 -0
  216. package/dist/utility/wrun/wrun-kit-refusal-stages.types.d.ts +22 -0
  217. package/dist/utility/wrun/wrun-kit-refusal-stages.types.js +1 -0
  218. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +12 -5
  219. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +23 -5
  220. package/dist/utility/wrun/wrun-lane-warmup.util.js +22 -4
  221. package/dist/utility/wrun/wrun-leg-close.util.d.ts +6 -5
  222. package/dist/utility/wrun/wrun-leg-close.util.js +11 -9
  223. package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +3 -1
  224. package/dist/utility/wrun/wrun-leg-fetch.util.js +9 -2
  225. package/dist/utility/wrun/wrun-levels-child.util.d.ts +2 -0
  226. package/dist/utility/wrun/wrun-levels-child.util.js +6 -0
  227. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -0
  228. package/dist/utility/wrun/wrun-live-intake.util.d.ts +15 -6
  229. package/dist/utility/wrun/wrun-live-intake.util.js +167 -47
  230. package/dist/utility/wrun/wrun-live-tick.util.d.ts +52 -8
  231. package/dist/utility/wrun/wrun-live-tick.util.js +655 -97
  232. package/dist/utility/wrun/wrun-market-facts.util.d.ts +16 -2
  233. package/dist/utility/wrun/wrun-market-facts.util.js +32 -3
  234. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +27 -27
  235. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +28 -16
  236. package/dist/utility/wrun/wrun-market-size-defaults.util.js +34 -5
  237. package/dist/utility/wrun/wrun-oi-lane.util.d.ts +10 -7
  238. package/dist/utility/wrun/wrun-oi-lane.util.js +16 -10
  239. package/dist/utility/wrun/wrun-option-strike-flow.util.js +1 -1
  240. package/dist/utility/wrun/wrun-option-views.util.d.ts +2 -2
  241. package/dist/utility/wrun/wrun-option-views.util.js +5 -2
  242. package/dist/utility/wrun/wrun-options-flow-underlying.leaf.d.ts +5 -0
  243. package/dist/utility/wrun/wrun-options-flow-underlying.leaf.js +16 -0
  244. package/dist/utility/wrun/wrun-options-stop.util.d.ts +3 -2
  245. package/dist/utility/wrun/wrun-options-stop.util.js +6 -4
  246. package/dist/utility/wrun/wrun-output-words.util.d.ts +14 -0
  247. package/dist/utility/wrun/wrun-output-words.util.js +51 -0
  248. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +116 -11
  249. package/dist/utility/wrun/wrun-overlay-drivers.util.js +208 -43
  250. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +20 -10
  251. package/dist/utility/wrun/wrun-overlay-park.util.d.ts +84 -0
  252. package/dist/utility/wrun/wrun-overlay-park.util.js +135 -0
  253. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +37 -4
  254. package/dist/utility/wrun/wrun-overlay-recovery.util.js +26 -14
  255. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +6 -1
  256. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  257. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +247 -26
  258. package/dist/utility/wrun/wrun-overlay-run.util.js +2234 -408
  259. package/dist/utility/wrun/wrun-pack.util.d.ts +8 -5
  260. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +11 -2
  261. package/dist/utility/wrun/wrun-panel-mount.util.js +122 -19
  262. package/dist/utility/wrun/wrun-panel-style.util.d.ts +4 -2
  263. package/dist/utility/wrun/wrun-panel-style.util.js +3 -2
  264. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +7 -0
  265. package/dist/utility/wrun/wrun-pin-spelling.util.js +18 -4
  266. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +26 -17
  267. package/dist/utility/wrun/wrun-pin-venues.util.js +43 -36
  268. package/dist/utility/wrun/wrun-pinned-lanes.util.d.ts +58 -0
  269. package/dist/utility/wrun/wrun-pinned-lanes.util.js +72 -0
  270. package/dist/utility/wrun/wrun-prefix-cohort.util.js +2 -1
  271. package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +22 -9
  272. package/dist/utility/wrun/wrun-prefix-lanes.util.js +145 -26
  273. package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +29 -0
  274. package/dist/utility/wrun/wrun-prefix-proof.util.js +23 -5
  275. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +9 -1
  276. package/dist/utility/wrun/wrun-refusal-surface.util.js +15 -1
  277. package/dist/utility/wrun/wrun-refusal.util.d.ts +19 -1
  278. package/dist/utility/wrun/wrun-refusal.util.js +103 -16
  279. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +20 -6
  280. package/dist/utility/wrun/wrun-registry-errors.util.js +20 -6
  281. package/dist/utility/wrun/wrun-replay-rows.util.js +6 -10
  282. package/dist/utility/wrun/wrun-run-health.util.d.ts +95 -5
  283. package/dist/utility/wrun/wrun-run-health.util.js +209 -3
  284. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +2 -2
  285. package/dist/utility/wrun/wrun-run-interval-session.util.js +2 -2
  286. package/dist/utility/wrun/wrun-run-interval.util.d.ts +9 -8
  287. package/dist/utility/wrun/wrun-run-interval.util.js +13 -11
  288. package/dist/utility/wrun/wrun-sandbox-row-source.js +5 -2
  289. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +38 -11
  290. package/dist/utility/wrun/wrun-script-inputs.util.js +194 -56
  291. package/dist/utility/wrun/wrun-session-composition.util.d.ts +81 -0
  292. package/dist/utility/wrun/wrun-session-composition.util.js +169 -0
  293. package/dist/utility/wrun/wrun-setting-words.util.d.ts +10 -7
  294. package/dist/utility/wrun/wrun-setting-words.util.js +25 -7
  295. package/dist/utility/wrun/wrun-source-rows.util.d.ts +94 -28
  296. package/dist/utility/wrun/wrun-source-rows.util.js +738 -93
  297. package/dist/utility/wrun/wrun-stream-clock.util.d.ts +45 -0
  298. package/dist/utility/wrun/wrun-stream-clock.util.js +108 -0
  299. package/dist/utility/wrun/wrun-style-names.util.d.ts +23 -0
  300. package/dist/utility/wrun/wrun-style-names.util.js +74 -0
  301. package/dist/utility/wrun/wrun-tape-coins.util.d.ts +116 -0
  302. package/dist/utility/wrun/wrun-tape-coins.util.js +110 -0
  303. package/dist/utility/wrun/wrun-tape-source.util.d.ts +62 -32
  304. package/dist/utility/wrun/wrun-tape-source.util.js +72 -34
  305. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +13 -5
  306. package/dist/utility/wrun/wrun-tier-grid.util.js +23 -13
  307. package/dist/utility/wrun/wrun-tpo-rows.util.js +2 -1
  308. package/dist/utility/wrun/wrun-trades-lane.util.d.ts +73 -0
  309. package/dist/utility/wrun/wrun-trades-lane.util.js +82 -0
  310. package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +5 -0
  311. package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +9 -2
  312. package/dist/utility/wrun/wrun-visibility-table.d.ts +13 -0
  313. package/dist/utility/wrun/wrun-visibility-table.js +9 -0
  314. package/dist/utility/wrun/wrun-volume-profile.util.js +7 -3
  315. package/dist/utils/replay/replay-buffer-math.d.ts +16 -6
  316. package/dist/utils/replay/replay-buffer-math.js +60 -30
  317. package/dist/workers/constants/socket-slots.d.ts +11 -7
  318. package/dist/workers/constants/socket-slots.js +6 -5
  319. package/package.json +5 -5
@@ -83,7 +83,16 @@
83
83
  * and wrun-style-patch.util; a `colors` row and a prefixed target's rows
84
84
  * repaint through a rerun). A cloud record mounts the same rows (the registry
85
85
  * loader builds both lanes' records here, over the full sheet): the one pass
86
- * paints either row source's batch through the chart's own builders.
86
+ * paints either row source's batch through the chart's own builders. The
87
+ * page's words for a batched section or a renderer come first from the
88
+ * sheet's `style_names` table (wrun-style-names.util, the one reader): its
89
+ * label titles the line (styleTargetTitle) and its colour names name each
90
+ * swatch of the line's colours row (`swatchNames`). Its entry for an output
91
+ * or a heatmap names colours alone (the title stays their own `label`): a
92
+ * heatmap's palette stops, an output's two-tone pair, and a `color_by` ladder
93
+ * whose every rung it names, which gains a colours row even where an unnamed
94
+ * ladder has none (three or more rungs, a line's, an inset strip's:
95
+ * outputColorList). A sheet without the table reads as before.
87
96
  *
88
97
  * The layout (buildWrunScriptLayout) groups the flat rows into pages and
89
98
  * sections: from the sheet's `layout` when it declares one (params before
@@ -108,7 +117,8 @@ import { isWrunColorWord, wrunThemeTokenOfPacked, wrunThemeTokenWord } from './w
108
117
  import { isWrunColorParam, isWrunStyleParam, wrunColorArrayKey, wrunColorPalette, wrunColorParamDefault, wrunColorSettingString, wrunLineStyles, wrunParamChoices, wrunSelectOptionValue, wrunStyleBinding, parseWrunStyleTarget, wrunVisibilityOwnedOutputs, wrunVisibilityOwners, } from './wrun-color-settings.util.js';
109
118
  import { findWrunVisibilityTarget, WRUN_HANDLE_KIND_RULES, WRUN_VISIBILITY_RULES, wrunVisibilityEntryTarget, wrunVisibilityTargetAt, } from './wrun-visibility-table.js';
110
119
  import { isTruthySetting, wrunCodedWords } from './wrun-setting-words.util.js';
111
- import { wrunRowVisibleHere } from './wrun-market-facts.util.js';
120
+ import { wrunStyleNameOf, wrunStyleSlotNames, wrunStyleTitle } from './wrun-style-names.util.js';
121
+ import { wrunRowVisibleHere, wrunVisibleBySettingKeys } from './wrun-market-facts.util.js';
112
122
  import { bitmaskValue, finiteNumber, nonEmptyString, numericValue, toggleValue, wrunMultiLabels, wrunTimeValue, } from './wrun-param-values.util.js';
113
123
  import { wrunLegendLiteral, wrunTextParamCap, wrunTextParamDefault, wrunTextValueWithinCap, } from './wrun-text-params.util.js';
114
124
  // The choice set and the one select read live beside the other settings
@@ -269,14 +279,21 @@ function rowBase(param, options) {
269
279
  ...(param.hide === true ? { hide: true } : {}),
270
280
  ...(param.slider === true ? { slider: true } : {}),
271
281
  ...(param.host === 'source' || param.host === 'interval' || param.host === 'symbol' ? { host: param.host } : {}),
272
- ...wrunRowVisibleBy(param.visible_by),
282
+ ...wrunRowVisibleBy(param.visible_by, true),
273
283
  };
274
284
  }
275
- /** A row's `visibleBy` from a declaration's `visible_by`: a copy of its size-unit list, nothing when
276
- * the word is absent or holds no list. */
277
- function wrunRowVisibleBy(visibleBy) {
285
+ /** A row's `visibleBy` from a declaration's `visible_by`: a copy of its size-unit list and, on a setting's row
286
+ * (`settingKeys`), of every setting key it names (wrunVisibleBySettingKeys, contract C-COINS item 1; an output's
287
+ * Style rows keep the size unit only), nothing when the word holds neither. */
288
+ function wrunRowVisibleBy(visibleBy, settingKeys = false) {
278
289
  const codes = visibleBy?.size_unit;
279
- return Array.isArray(codes) ? { visibleBy: { size_unit: [...codes] } } : {};
290
+ const keys = settingKeys ? wrunVisibleBySettingKeys(visibleBy) : [];
291
+ if (!Array.isArray(codes) && keys.length === 0)
292
+ return {};
293
+ const copy = Array.isArray(codes) ? { size_unit: [...codes] } : {};
294
+ for (const key of keys)
295
+ copy[key.name] = [...key.values];
296
+ return { visibleBy: copy };
280
297
  }
281
298
  /** The `<name>_unit` selects by the value param they qualify (`unit_for`). */
282
299
  function unitSelectsByValue(params) {
@@ -424,6 +441,40 @@ function twoTonePair(output, kind) {
424
441
  return colors.length === 2 ? [...colors] : undefined;
425
442
  return colors.length >= 2 ? colors.slice(0, 2) : undefined;
426
443
  }
444
+ /**
445
+ * The colour list an output's `colors` Style row recolours (contract C1), as declared:
446
+ * - a bar's two-tone pair (twoTonePair), named or not: its sign palette's up and down swatches, or its two-rung
447
+ * ladder's rungs;
448
+ * - any other list the run-result adapter paints from the output's own `colors`, only where the sheet's
449
+ * `style_names` table names every one of its slots: a `color_by` ladder of any length on an output that styles (a
450
+ * bar's of three or more rungs, a line's, a mark's: the adapter's ladder reads it whole) or on an inset strip
451
+ * (wrunInsetLook: its ladder's palette, else its sign pair, up then down). Unnamed, its swatches could say only
452
+ * "Color n", so the page offers no row for it, as before the table.
453
+ * Undefined for anything else: a packed per-bar colour, a list holding a word that is no colour, a candle tint.
454
+ */
455
+ function outputColorList(metadata, output, kind) {
456
+ const namesOf = (colors) => wrunStyleSlotNames(wrunStyleNameOf(metadata, output.name), colors.length);
457
+ const ladder = output.color_by !== undefined;
458
+ const pair = kind === undefined ? undefined : twoTonePair(output, kind);
459
+ if (pair !== undefined) {
460
+ const names = namesOf(pair);
461
+ const swatches = ladder ? ['stop', 'stop'] : ['up', 'down'];
462
+ return { colors: pair, swatches, ...(names !== undefined ? { names } : {}) };
463
+ }
464
+ const inset = output.plot === 'inset';
465
+ if (kind === undefined && !inset)
466
+ return undefined;
467
+ if (output.color_packed_by !== undefined || !Array.isArray(output.colors))
468
+ return undefined;
469
+ const declared = output.colors;
470
+ if (!declared.every((color) => nonEmptyString(color) !== undefined))
471
+ return undefined;
472
+ const colors = ladder ? [...declared] : inset && declared.length >= 2 ? declared.slice(0, 2) : [];
473
+ const names = colors.length === 0 ? undefined : namesOf(colors);
474
+ if (names === undefined)
475
+ return undefined;
476
+ return { colors, swatches: ladder ? colors.map(() => 'stop') : ['up', 'down'], names };
477
+ }
427
478
  /** True when a line strokes colours of its own and never reads its static
428
479
  * `color` (style-rows audit item 3): two or more OT13 `gradient` stops (the
429
480
  * look patch lays them as `gradientColors`, wrun-output-style.util) or an
@@ -450,16 +501,17 @@ function strokesOwnColors(output) {
450
501
  * stops, an OT14 split's up / down pair; style-rows audit item 3), whose
451
502
  * width, lineStyle and opacity rows stay; never on a candle group (its
452
503
  * colours are a pair).
453
- * - `colors`: a bar's two-tone pair (twoTonePair) in place of `color`: the
454
- * up and down swatches of its sign palette, or the two rungs of its
455
- * ladder.
504
+ * - `colors` (`hasColors`, outputColorList): a bar's two-tone pair
505
+ * (twoTonePair) in place of `color`: the up and down swatches of its sign
506
+ * palette, or the two rungs of its ladder; and a `color_by` ladder of any
507
+ * other length or kind whose every rung the sheet's `style_names` names.
456
508
  * - `opacity`: it folds into the static colour (a gradient's stops and a
457
509
  * split's pair alike) and an area's fill tint, so an area always carries
458
510
  * it, a bar when its static colour paints, and a line or mark only when
459
511
  * the sheet declares one (a declared opacity REPLACES the picked colour's
460
512
  * alpha, so it needs its own control).
461
513
  */
462
- function stylePropertiesOf(output, kind) {
514
+ function stylePropertiesOf(output, kind, hasColors) {
463
515
  const staticColor = kind !== 'candle' &&
464
516
  output.color_by === undefined &&
465
517
  output.color_packed_by === undefined &&
@@ -471,7 +523,7 @@ function stylePropertiesOf(output, kind) {
471
523
  ...(staticWidth ? ['width'] : []),
472
524
  ...(kind === 'line' || kind === 'area' ? ['lineStyle'] : []),
473
525
  ...(staticColor && !strokesOwnColors(output) ? ['color'] : []),
474
- ...(twoTonePair(output, kind) !== undefined ? ['colors'] : []),
526
+ ...(hasColors ? ['colors'] : []),
475
527
  ...(opacity ? ['opacity'] : []),
476
528
  ];
477
529
  }
@@ -534,6 +586,10 @@ const WRUN_STYLE_KEYS = {
534
586
  ['width', 'width'],
535
587
  ['line_style', 'lineStyle'],
536
588
  ]),
589
+ // A flags section's colours by part (fill, edge, text): a colour param bound to them is that row.
590
+ flags: new Map([['colors', 'colors']]),
591
+ // Every batched kind is listed (the type below): each offers a colours row, so a param bound to its keys must take
592
+ // that row's place, or the page shows two controls over one colour (flags missed it until the dark pool round).
537
593
  };
538
594
  const WRUN_OUTPUT_STYLE_KEYS = WRUN_STYLE_KEYS.outputs;
539
595
  /** An output style property word in either spelling: the om binding's
@@ -666,7 +722,7 @@ function declaredStyleKnobs(metadata) {
666
722
  function undeclaredWidthOf(kind) {
667
723
  return kind === 'mark' ? 2 : 1;
668
724
  }
669
- function styleRowDefault(output, paletteAt, property, kind) {
725
+ function styleRowDefault(output, paletteAt, property, kind, colors) {
670
726
  switch (property) {
671
727
  case 'visible':
672
728
  return output.visible !== false;
@@ -681,7 +737,7 @@ function styleRowDefault(output, paletteAt, property, kind) {
681
737
  nonEmptyString(output.colors?.[0]) ??
682
738
  WRUN_OUTPUT_DEFAULT_PALETTE[paletteAt % WRUN_OUTPUT_DEFAULT_PALETTE.length]);
683
739
  case 'colors':
684
- return twoTonePair(output, kind) ?? [];
740
+ return colors?.colors ?? [];
685
741
  default: {
686
742
  const opacity = finiteNumber(output.opacity);
687
743
  return opacity !== undefined && opacity >= 0 && opacity <= 1 ? opacity : 1;
@@ -692,7 +748,7 @@ function styleRowDefault(output, paletteAt, property, kind) {
692
748
  * construction: no init slot, it writes only its target's colour(s) /
693
749
  * width / line_style / opacity through the paint seam, or its visibility
694
750
  * after integration. */
695
- function styleRowOf(target, property, defaultValue, swatches) {
751
+ function styleRowOf(target, property, defaultValue, swatches, swatchNames) {
696
752
  return {
697
753
  name: wrunStyleRowName(target, property),
698
754
  // The property key: the dialog draws the frozen localized word for it.
@@ -703,14 +759,18 @@ function styleRowOf(target, property, defaultValue, swatches) {
703
759
  ...(property === 'width' ? { constraints: { min: 0, max: 20, step: 0.5 } } : {}),
704
760
  ...(property === 'opacity' ? { constraints: { min: 0, max: 1, step: 0.05 } } : {}),
705
761
  ...(swatches !== undefined ? { swatches } : {}),
762
+ ...(swatchNames !== undefined ? { swatchNames } : {}),
706
763
  settingsTier: 'redraw',
707
764
  affectsCompute: false,
708
765
  styleOf: { output: target, property },
709
766
  };
710
767
  }
711
- function styleRow(output, paletteAt, property, kind) {
712
- const swatches = property !== 'colors' ? undefined : output.color_by !== undefined ? ['stop', 'stop'] : ['up', 'down'];
713
- return styleRowOf(output.name, property, styleRowDefault(output, paletteAt, property, kind), swatches);
768
+ /** One Style row of a drawn output; a `colors` row recolours its colour list (outputColorList), each swatch saying
769
+ * what it paints and carrying the sheet's name for it when the table names them. */
770
+ function styleRow(output, paletteAt, property, kind, colors) {
771
+ const list = property === 'colors' ? colors : undefined;
772
+ const defaultValue = styleRowDefault(output, paletteAt, property, kind, colors);
773
+ return styleRowOf(output.name, property, defaultValue, list?.swatches, list?.names);
714
774
  }
715
775
  /** A declared colour word, as written: a hex or rgb colour, or a theme
716
776
  * token (`theme.up`); anything else (a number, an `@param` the extractor
@@ -781,7 +841,9 @@ function undeclaredTextColorOf(renderer) {
781
841
  * records only feed another's tooltips (`tooltip_from`) never draws and is
782
842
  * no target; every other renderer kind (shape, bgcolor, barcolor, table,
783
843
  * stats_row, inset) offers Visible only;
784
- * - a heatmap (`heatmap:<name>`): its declared palette;
844
+ * - a heatmap (`heatmap:<name>`): its declared palette, each stop carrying
845
+ * the sheet's name for it when the `style_names` table names every one
846
+ * (`swatchNames`);
785
847
  * - a price profile (`profile:<name>`): its colours: a footprint's buy /
786
848
  * sell pair (theme up / down when undeclared, the canvas mount's rule)
787
849
  * wherever it paints: never on a cluster, ladder or imbalance_only grid of
@@ -800,18 +862,24 @@ function undeclaredTextColorOf(renderer) {
800
862
  * its opacity (a mark's `opacity_pct` read as 0..1, default 0.3; a span's
801
863
  * 0.2; a ray's 1: the kit's defaults, mirrored in wrun-batched-marks.util
802
864
  * LOOK_DEFAULTS); a ray its width (default 1) and line style (default
803
- * solid) too. Its look, size, caption and position take no row: a param
804
- * binds them (`style_targets`);
865
+ * solid) too. A flags section (`flags:<name>`) takes its colours alone (it
866
+ * declares no opacity). Its look, size, caption and position take no row: a
867
+ * param binds them (`style_targets`). Its colours row carries the sheet's
868
+ * name for each slot when the `style_names` table names every one
869
+ * (`swatchNames`, wrun-style-names.util wrunStyleSlotNames);
805
870
  * - a band (`range:<upper>/<lower>#<n>`, `fill:<first>/<second>#<n>`), a box,
806
871
  * a segment, a sheet drawing, a draw-API handle kind, a matrix and a panel:
807
872
  * Visible only (their colours ride params or the declaration).
808
873
  */
809
- function childStyleRows(targets, declared) {
874
+ function childStyleRows(metadata, targets, declared) {
810
875
  const rows = [];
811
- const add = (target, property, defaultValue, swatches) => {
812
- if (!declared.has(`${target}.${property}`))
813
- rows.push(styleRowOf(target, property, defaultValue, swatches));
876
+ const add = (target, property, defaultValue, swatches, swatchNames) => {
877
+ if (!declared.has(`${target}.${property}`)) {
878
+ rows.push(styleRowOf(target, property, defaultValue, swatches, swatchNames));
879
+ }
814
880
  };
881
+ // A batched or heatmap colours row's slot names: the table's, when it names every slot of the list (else none).
882
+ const slotNames = (target, colors) => wrunStyleSlotNames(wrunStyleNameOf(metadata, target), colors.length);
815
883
  const stops = (palette) => palette.map(() => 'stop');
816
884
  for (const { target, section, kind, entry } of targets) {
817
885
  if (section === 'outputs')
@@ -828,7 +896,7 @@ function childStyleRows(targets, declared) {
828
896
  case 'heatmaps': {
829
897
  const palette = paletteOf(entry.palette);
830
898
  if (palette !== undefined)
831
- add(target, 'colors', palette, stops(palette));
899
+ add(target, 'colors', palette, stops(palette), slotNames(target, palette));
832
900
  break;
833
901
  }
834
902
  case 'profiles': {
@@ -859,7 +927,7 @@ function childStyleRows(targets, declared) {
859
927
  const colors = batchedColorsOf(entry.colors);
860
928
  if (colors !== undefined) {
861
929
  const swatches = colors.map((_color, at) => section === 'marks' && at < 2 ? (at === 0 ? 'sell' : 'buy') : 'stop');
862
- add(target, 'colors', colors, swatches);
930
+ add(target, 'colors', colors, swatches, slotNames(target, colors));
863
931
  }
864
932
  const opacity = section === 'marks'
865
933
  ? (finiteNumber(entry.opacity_pct) ?? 30) / 100
@@ -872,6 +940,12 @@ function childStyleRows(targets, declared) {
872
940
  }
873
941
  break;
874
942
  }
943
+ case 'flags': {
944
+ const colors = batchedColorsOf(entry.colors);
945
+ if (colors !== undefined)
946
+ add(target, 'colors', colors, stops(colors), slotNames(target, colors));
947
+ break;
948
+ }
875
949
  default:
876
950
  break;
877
951
  }
@@ -961,8 +1035,9 @@ function drawnStyleOutputs(metadata, targets = wrunVisibilityTargets(metadata))
961
1035
  : []);
962
1036
  }
963
1037
  /** The style rows of a sheet's drawn targets (wrun-visibility-table.ts, in
964
- * its order): the outputs' rows, by how each draws (a candle tint and an
965
- * inset strip offer Visible only), then every other drawn target's
1038
+ * its order): the outputs' rows, by how each draws (a candle tint offers
1039
+ * Visible only, an inset strip Visible and the colours the sheet's
1040
+ * `style_names` names: outputColorList), then every other drawn target's
966
1041
  * (childStyleRows). */
967
1042
  function styleRows(metadata) {
968
1043
  const targets = wrunVisibilityTargets(metadata);
@@ -970,18 +1045,28 @@ function styleRows(metadata) {
970
1045
  const rows = [];
971
1046
  for (const { output, paletteAt, draw } of drawnStyleOutputs(metadata, targets)) {
972
1047
  const kind = draw.style;
973
- for (const property of kind === undefined ? ['visible'] : stylePropertiesOf(output, kind)) {
1048
+ const colors = outputColorList(metadata, output, kind);
1049
+ const properties = kind !== undefined
1050
+ ? stylePropertiesOf(output, kind, colors !== undefined)
1051
+ : colors !== undefined
1052
+ ? ['visible', 'colors']
1053
+ : ['visible'];
1054
+ for (const property of properties) {
974
1055
  if (declared.has(`${output.name}.${property}`))
975
1056
  continue;
976
1057
  // The output's `visible_by` rides its Style rows: where it mounts nothing, they hide.
977
- rows.push({ ...styleRow(output, paletteAt, property, kind ?? 'line'), ...wrunRowVisibleBy(output.visible_by) });
1058
+ const row = styleRow(output, paletteAt, property, kind ?? 'line', colors);
1059
+ rows.push({ ...row, ...wrunRowVisibleBy(output.visible_by) });
978
1060
  }
979
1061
  }
980
- rows.push(...childStyleRows(targets, declared));
1062
+ rows.push(...childStyleRows(metadata, targets, declared));
981
1063
  return rows;
982
1064
  }
983
- /** The sections whose readout `label` titles their Style line. */
984
- const LABELLED_STYLE_SECTIONS = new Set(['heatmaps', 'marks', 'spans', 'rays']);
1065
+ /** The sections whose own readout `label` titles their Style line where the sheet's `style_names` table gives none
1066
+ * (wrunStyleTitle's order; a heatmap's entry in the table names its colours alone, so a heatmap always reads its
1067
+ * own). A renderer's line takes the table's label or its name: a renderer key named `label` says something else and
1068
+ * titles nothing. */
1069
+ const LABELLED_STYLE_SECTIONS = new Set(['heatmaps', 'marks', 'spans', 'rays', 'flags']);
985
1070
  /** A draw-API handle kind's Style line title, the dialog's English fallback
986
1071
  * (WrunLayoutPanel localizes a handles section by its id). */
987
1072
  const HANDLE_STYLE_TITLES = {
@@ -997,12 +1082,16 @@ export function isWrunLocalizedStyleTarget(target) {
997
1082
  }
998
1083
  /** A style target as the Style page names it, the legend's rule
999
1084
  * (wrunLegendName: a declared label, else the name read as words, `oi_change`
1000
- * -> "OI change"): an output by its `label`, a heatmap or a batched section by
1001
- * its readout `label`, a band by its sides' names (`Upper / Lower`; a range
1002
- * by its own `label` when it declares one; a second band over the same pair
1003
- * numbered), a sheet drawing by its name, a handle kind by its kind's word,
1004
- * anything else (a renderer, a profile, a docked level, a box, a segment, a
1005
- * matrix, a panel) by its name. */
1085
+ * -> "OI change"): an output by its own `label` (the sheet's `style_names`
1086
+ * names an output's colours, never its line), a band by its sides' names
1087
+ * (`Upper / Lower`; a range by its own `label` when it declares one; a second
1088
+ * band over the same pair numbered), a sheet drawing by its name, a handle
1089
+ * kind by its kind's word; anything else in the one order every surface
1090
+ * titles a drawn target by (wrun-style-names.util wrunStyleTitle): the
1091
+ * sheet's `style_names` label (a batched section, a renderer; a heatmap's
1092
+ * entry gives none), else a heatmap's or a batched section's readout
1093
+ * `label`, else the name (a renderer, a profile, a docked level, a box, a
1094
+ * segment, a matrix, a panel). */
1006
1095
  function styleTargetTitle(metadata, target) {
1007
1096
  const { kind, name } = parseWrunStyleTarget(target);
1008
1097
  const outputTitle = (output) => {
@@ -1027,7 +1116,7 @@ function styleTargetTitle(metadata, target) {
1027
1116
  return wrunLegendName(name.slice(name.indexOf(':') + 1));
1028
1117
  const found = findWrunVisibilityTarget(metadata, target);
1029
1118
  const labelled = found !== undefined && LABELLED_STYLE_SECTIONS.has(found.section) ? found.entry.label : undefined;
1030
- return wrunLegendName(name, typeof labelled === 'string' ? labelled : undefined);
1119
+ return wrunStyleTitle(metadata, target, name, labelled);
1031
1120
  }
1032
1121
  // ---------------------------------------------------------------------------
1033
1122
  // The flat list (the persistence whitelist).
@@ -1111,14 +1200,38 @@ export function buildWrunScriptInputs(metadata, options) {
1111
1200
  }
1112
1201
  /** The rows as the dialog shows them on a market of size unit `sizeUnit` (wrunChartSizeUnit): a
1113
1202
  * row whose `visibleBy` leaves the unit out is hidden like a composite member, never placed, its
1114
- * value kept (the run still reads it and the dialog's Reset still resets it). The rows themselves
1115
- * when none hides. */
1116
- export function wrunRowsOnMarket(rows, sizeUnit) {
1117
- const hides = (row) => row.hidden !== true && !wrunRowVisibleHere(row.visibleBy, sizeUnit);
1203
+ * value kept (the run still reads it and the dialog's Reset still resets it). A setting key beside
1204
+ * the unit (contract C-COINS item 1) hides its row while the select it names reads none of its
1205
+ * values in `settings`, the dialog's current values (wrunRowSettingReader), so the rows follow the
1206
+ * select as the user flips it. The rows themselves when none hides. */
1207
+ export function wrunRowsOnMarket(rows, sizeUnit, settings) {
1208
+ const read = wrunRowSettingReader(rows, settings, sizeUnit);
1209
+ const hides = (row) => row.hidden !== true && !wrunRowVisibleHere(row.visibleBy, sizeUnit, read);
1118
1210
  if (!rows.some(hides))
1119
1211
  return rows;
1120
1212
  return rows.map((row) => (hides(row) ? { ...row, hidden: true } : row));
1121
1213
  }
1214
+ /**
1215
+ * The value a setting key reads in the dialog (contract C-COINS item 1), the rows' side of the run's
1216
+ * `wrunSheetSettingReader`: the select row it names reads its current value in `settings` (its default without
1217
+ * one), or its default where the select's own row is hidden on the market (its size-unit list alone: a keyed
1218
+ * select is never keyed by another setting), so a stock chart that saved Coins shows the Dollars rows. Undefined
1219
+ * for a name no row holds or a value that is no number (the key then never hides).
1220
+ */
1221
+ export function wrunRowSettingReader(rows, settings, sizeUnit) {
1222
+ const flat = settings !== null && typeof settings === 'object' ? settings : {};
1223
+ return (name) => {
1224
+ const row = rows.find((candidate) => candidate.name === name && candidate.virtual !== true);
1225
+ if (row === undefined)
1226
+ return undefined;
1227
+ const own = flat[name];
1228
+ const raw = wrunRowVisibleHere(row.visibleBy, sizeUnit) && own !== undefined && own !== null && own !== ''
1229
+ ? own
1230
+ : row.defaultValue;
1231
+ const value = Number(raw);
1232
+ return Number.isFinite(value) ? value : undefined;
1233
+ };
1234
+ }
1122
1235
  function paramInput(param, base) {
1123
1236
  if (isWrunStyleParam(param))
1124
1237
  return styleKnobInput(param, base);
@@ -1189,30 +1302,55 @@ function paramInput(param, base) {
1189
1302
  * its label and hint from that build, matched by name (a unit composite and
1190
1303
  * its value member, which share a name, each from its own kind). An older
1191
1304
  * build stamped a param's description as its label and no hint; the saved
1192
- * indicator reads the same as a fresh add without a rerun. Values, types and
1193
- * every other key stay as persisted; a style row (its label is its property
1194
- * key) and a row the sheet no longer builds keep their own; a row whose
1195
- * words already match is returned as is. `options` builds the words as the
1196
- * mount did (a port's hint rule, WrunRowBuildOptions), so a row persisted
1197
- * before the rule reads without its encoding legend.
1305
+ * indicator reads the same as a fresh add without a rerun. A style row keeps
1306
+ * its label (its property key) and takes the swatch names the sheet's
1307
+ * `style_names` table gives its colours now (`swatchNames`, or none), so a
1308
+ * row persisted before the table names its swatches as a fresh add does.
1309
+ * Values, types and every other key stay as persisted; a row the sheet no
1310
+ * longer builds keeps its own; a row whose words already match is returned
1311
+ * as is. `options` builds the words as the mount did (a port's hint rule,
1312
+ * WrunRowBuildOptions), so a row persisted before the rule reads without its
1313
+ * encoding legend.
1198
1314
  */
1199
1315
  export function wrunRowsWithSheetWords(rows, sheet, options) {
1200
- if (sheet === undefined || !Array.isArray(sheet.params) || sheet.params.length === 0)
1316
+ if (sheet === undefined)
1201
1317
  return [...rows];
1202
1318
  const keyOf = (row) => `${row.virtual === true ? 'virtual' : 'value'}:${row.name}`;
1203
1319
  const fresh = new Map();
1204
- for (const row of buildWrunScriptInputs({ params: sheet.params }, options)) {
1205
- if (row.styleOf === undefined && !fresh.has(keyOf(row)))
1206
- fresh.set(keyOf(row), row);
1320
+ if (Array.isArray(sheet.params) && sheet.params.length > 0) {
1321
+ for (const row of buildWrunScriptInputs({ params: sheet.params }, options)) {
1322
+ if (row.styleOf === undefined && !fresh.has(keyOf(row)))
1323
+ fresh.set(keyOf(row), row);
1324
+ }
1325
+ }
1326
+ // The swatch names the sheet gives its Style rows now, by row name (none to build without a table).
1327
+ const swatchNames = new Map();
1328
+ if (Array.isArray(sheet.style_names)) {
1329
+ for (const row of styleRows(sheet))
1330
+ if (row.swatchNames !== undefined)
1331
+ swatchNames.set(row.name, row.swatchNames);
1207
1332
  }
1208
1333
  return rows.map((row) => {
1209
- const built = row.styleOf === undefined ? fresh.get(keyOf(row)) : undefined;
1334
+ if (row.styleOf !== undefined) {
1335
+ const names = swatchNames.get(row.name);
1336
+ if (sameWords(row.swatchNames, names))
1337
+ return row;
1338
+ const { swatchNames: _persistedNames, ...rest } = row;
1339
+ return names === undefined ? rest : { ...rest, swatchNames: names };
1340
+ }
1341
+ const built = fresh.get(keyOf(row));
1210
1342
  if (built === undefined || (row.label === built.label && row.hint === built.hint))
1211
1343
  return row;
1212
1344
  const { hint: _persistedHint, ...rest } = row;
1213
1345
  return { ...rest, label: built.label, ...(built.hint !== undefined ? { hint: built.hint } : {}) };
1214
1346
  });
1215
1347
  }
1348
+ /** Two word lists alike (both absent, or the same words in the same order). */
1349
+ function sameWords(a, b) {
1350
+ if (a === undefined || b === undefined)
1351
+ return a === b;
1352
+ return a.length === b.length && a.every((word, at) => word === b[at]);
1353
+ }
1216
1354
  /**
1217
1355
  * The rows an overlay persisted, with every Style row its sheet offers now
1218
1356
  * that they lack appended in the builder's order: an overlay added before a
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Order flow from a session on a script overlay (web: docs/features/session-feed/README.md, "Order flow"): where a
3
+ * run reads its tape and trades rows, an overlay the host's session owns reads OpenMarket's rows before the seam and
4
+ * the session's from it. The host composes (`WrunChartHostEnv.session`, optional); this module decides where.
5
+ *
6
+ * The session never writes a lane buffer: the context's buffers, watermarks, fed marks, coverage and reconciles keep
7
+ * OpenMarket's rows exactly. Only the rows a compute reads are composed, at the read points (the full run's and the
8
+ * reseed's row build, the drain's tail build), and only when every lane the composition would feed is one it can
9
+ * value on the chart's own market: a session's prints are contracts on that market, so a contracts lane composes as
10
+ * they are, and the dollar trades lane prices each side of a bar as OpenMarket's history does (contracts x the root's
11
+ * point value x that side's (high + low + close) / 3) where the point value is known (`wrunSessionDollarPointValue`).
12
+ */
13
+ import { type WrunHostSession } from '../../host-env.js';
14
+ import type { WrunIndicatorMetadata } from '../../interfaces/wrun-runtime.interface.js';
15
+ import { type WrunChartSourceRows } from './wrun-source-rows.util.js';
16
+ /** What the lanes rule reads of a run or a live session: its sheet, the payload each lane was asked with, and the
17
+ * chart's market (the one the session's prints are on). */
18
+ export interface WrunSessionLanesView {
19
+ metadata: Pick<WrunIndicatorMetadata, 'inputs' | 'inputSources'>;
20
+ acquisition: Partial<Record<string, Readonly<Record<string, unknown>> | undefined>>;
21
+ market?: {
22
+ exchange?: string;
23
+ symbol?: string;
24
+ sessionType?: string;
25
+ };
26
+ }
27
+ /**
28
+ * The one rule for the dollar lane: the US dollars one contract of the chart's market is worth per whole point of its
29
+ * price (CME_ROOT_SPECS: NQ1! and NQZ6 read NQ, 20) on a CME Group futures market whose root is quoted in US dollars,
30
+ * so a side of a session-fed bar prices at contracts x this x (high + low + close) / 3. Undefined everywhere else (a
31
+ * root off the table, a cents-quoted grain, an option contract, a market off the CME family): a script declaring the
32
+ * dollar lane there is ineligible and reads OpenMarket's rows whole.
33
+ */
34
+ export declare function wrunSessionDollarPointValue(market: WrunSessionLanesView['market']): number | undefined;
35
+ /**
36
+ * Whether a session may compose this run's lanes: a dollar trades lane only where a print can be valued
37
+ * (`wrunSessionDollarPointValue`), no trades leg on the chart's own market (its rows would read OpenMarket's beside a
38
+ * session-fed trades lane), a tape asked by contract size (`minSize`, never a dollar or coins floor) on the chart's
39
+ * market, a trades lane in contracts on the chart's market, and a dollar trades lane asked in USD on the chart's
40
+ * market. A lane never asked has no payload and composes nothing, so it refuses nothing.
41
+ */
42
+ export declare function wrunSessionCompositionEligible(view: WrunSessionLanesView): boolean;
43
+ /** The host's session seams, or undefined: a host without them (the sandbox worker, the phone app, every spec env
44
+ * that sets none) composes nothing, and every read point reads its buffers as before. */
45
+ export declare function wrunHostSessionSeams(): WrunHostSession | undefined;
46
+ /** The token the host's session holds for the overlay now (its order-flow generation while owned), else null. */
47
+ export declare function wrunSessionCompositionToken(indicatorId: string): number | null;
48
+ /**
49
+ * Lands a reseed's owed marks against the composition it read: the token it composed under still the host's, it
50
+ * served them (true: the caller clears them); an owner change since (a hand-back, a new seam) owes a revision its
51
+ * rows never read, kept for the next drain (false), and the drain's own clearing skips it once.
52
+ */
53
+ export declare function wrunReseedServedComposition(indicatorId: string, context: object, composedToken: number | null): boolean;
54
+ /** Whether the last reseed of `context` kept an owner change's revision owed (read once: the drain clears none). */
55
+ export declare function takeWrunCompositionRevisionKept(context: object): boolean;
56
+ export interface WrunSessionComposeInput {
57
+ chartIndex: number;
58
+ indicatorId: string;
59
+ /** The interval the lanes' buckets are on (the run's clock). */
60
+ intervalMs: number;
61
+ lanes: WrunSessionLanesView;
62
+ }
63
+ export interface WrunSessionComposed {
64
+ /** The sources the compute reads: the same object when nothing composed. */
65
+ sources: WrunChartSourceRows;
66
+ /** The host's token for the overlay, read with the composition: what the drain's guard compares at landing. It is
67
+ * the host's answer whether or not anything composed (a candle-only or ineligible run of an owned overlay answers
68
+ * the owned generation), so it never reads as an owner change by itself. Null only when nothing owns the overlay. */
69
+ token: number | null;
70
+ }
71
+ /**
72
+ * The rows a compute reads, composed where the host's session owns the overlay. Cold path first: no seams, or no
73
+ * token (nothing owns the overlay), answers `sources` itself, so every read point is byte-identical to before.
74
+ */
75
+ export declare function composeWrunSessionSources(input: WrunSessionComposeInput, sources: WrunChartSourceRows): WrunSessionComposed;
76
+ /** The live context's lanes view (its sheet, its recorded acquisitions, the chart's market at its run). */
77
+ export declare function wrunSessionLanesOfContext(context: {
78
+ metadata: WrunSessionLanesView['metadata'];
79
+ acquisition: WrunSessionLanesView['acquisition'];
80
+ market?: WrunSessionLanesView['market'];
81
+ }): WrunSessionLanesView;