@orangecharts/wrun-chart-host 0.11.0 → 0.14.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 (311) hide show
  1. package/README.md +1 -0
  2. package/dist/constants/feature-flags.constants.d.ts +3 -4
  3. package/dist/constants/feature-flags.constants.js +34 -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 +55 -3
  13. package/dist/host-env.js +6 -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 +78 -15
  18. package/dist/indicators/controls/tpo-session.util.js +320 -242
  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 +97 -19
  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 +4 -4
  35. package/dist/market-data/venues/stocks.contract.copy.json +4 -4
  36. package/dist/market-data/venues/stocks.d.ts +4 -4
  37. package/dist/market-data/venues/stocks.js +15 -13
  38. package/dist/settings-templates/frvp-fields.d.ts +12 -1
  39. package/dist/settings-templates/frvp-fields.js +15 -4
  40. package/dist/settings-templates/index.js +12 -5
  41. package/dist/settings-templates/indicator-fields.js +28 -2
  42. package/dist/settings-templates/tool-rules.d.ts +17 -8
  43. package/dist/settings-templates/tool-rules.js +15 -8
  44. package/dist/settings-templates/tool-tables.generated.js +4 -2
  45. package/dist/utility/auth/server-clock.util.d.ts +3 -1
  46. package/dist/utility/auth/server-clock.util.js +3 -1
  47. package/dist/utility/chart/book-live-bucket.util.js +2 -2
  48. package/dist/utility/chart/cache-alignment.util.d.ts +15 -7
  49. package/dist/utility/chart/cache-alignment.util.js +14 -7
  50. package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +2 -0
  51. package/dist/utility/chart/chart-data-fetch-generation.util.js +16 -0
  52. package/dist/utility/chart/cme-session-bucket.util.d.ts +18 -75
  53. package/dist/utility/chart/cme-session-bucket.util.js +25 -332
  54. package/dist/utility/chart/continuous-contracts.util.js +6 -5
  55. package/dist/utility/chart/display-offset.leaf.d.ts +24 -0
  56. package/dist/utility/chart/display-offset.leaf.js +41 -0
  57. package/dist/utility/chart/effective-chart-session.util.d.ts +2 -1
  58. package/dist/utility/chart/effective-chart-session.util.js +13 -5
  59. package/dist/utility/chart/feed-interval.util.d.ts +6 -20
  60. package/dist/utility/chart/feed-interval.util.js +13 -22
  61. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +27 -7
  62. package/dist/utility/chart/fetch-dedupe-policy.util.js +86 -11
  63. package/dist/utility/chart/host-bar-placement.util.d.ts +7 -4
  64. package/dist/utility/chart/host-bar-placement.util.js +8 -2
  65. package/dist/utility/chart/indicator-inflight-registry.util.d.ts +32 -0
  66. package/dist/utility/chart/indicator-inflight-registry.util.js +52 -0
  67. package/dist/utility/chart/indicator-run-interval.util.d.ts +10 -4
  68. package/dist/utility/chart/indicator-run-interval.util.js +21 -12
  69. package/dist/utility/chart/interval-registry.util.d.ts +1 -1
  70. package/dist/utility/chart/interval-registry.util.js +1 -1
  71. package/dist/utility/chart/kscript-legend-entries.util.d.ts +12 -0
  72. package/dist/utility/chart/kscript-legend-entries.util.js +16 -0
  73. package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +1 -1
  74. package/dist/utility/chart/kscript-run-interval-projection.util.js +4 -2
  75. package/dist/utility/chart/kscript-venue-policy.util.d.ts +53 -62
  76. package/dist/utility/chart/kscript-venue-policy.util.js +85 -94
  77. package/dist/utility/chart/live-bucket.util.d.ts +39 -17
  78. package/dist/utility/chart/live-bucket.util.js +103 -57
  79. package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +58 -20
  80. package/dist/utility/chart/local-kscript-source-revalidation.util.js +98 -23
  81. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +35 -11
  82. package/dist/utility/chart/local-kscript-warmup-depth.util.js +24 -3
  83. package/dist/utility/chart/market-session-schedule.util.d.ts +8 -0
  84. package/dist/utility/chart/market-session-schedule.util.js +39 -1
  85. package/dist/utility/chart/market-session.util.d.ts +136 -0
  86. package/dist/utility/chart/market-session.util.js +341 -0
  87. package/dist/utility/chart/market-sessions.util.d.ts +83 -0
  88. package/dist/utility/chart/market-sessions.util.js +220 -0
  89. package/dist/utility/chart/om-panel.util.d.ts +5 -3
  90. package/dist/utility/chart/om-panel.util.js +42 -7
  91. package/dist/utility/chart/om-target.util.d.ts +14 -1
  92. package/dist/utility/chart/om-target.util.js +22 -5
  93. package/dist/utility/chart/opra-read-access.leaf.d.ts +16 -1
  94. package/dist/utility/chart/opra-read-access.leaf.js +22 -0
  95. package/dist/utility/chart/profile-row-height.util.d.ts +49 -16
  96. package/dist/utility/chart/profile-row-height.util.js +74 -37
  97. package/dist/utility/chart/rth-session.util.d.ts +55 -20
  98. package/dist/utility/chart/rth-session.util.js +94 -46
  99. package/dist/utility/chart/session-interval.util.d.ts +2 -1
  100. package/dist/utility/chart/session-interval.util.js +1 -3
  101. package/dist/utility/chart/session-lattice.util.d.ts +150 -0
  102. package/dist/utility/chart/session-lattice.util.js +488 -0
  103. package/dist/utility/chart/trading-day.util.d.ts +40 -2
  104. package/dist/utility/chart/trading-day.util.js +84 -7
  105. package/dist/utility/chart/us-equities-session.util.d.ts +32 -11
  106. package/dist/utility/chart/us-equities-session.util.js +44 -15
  107. package/dist/utility/chart/window-geometry.leaf.d.ts +28 -7
  108. package/dist/utility/chart/window-geometry.leaf.js +57 -8
  109. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +21 -14
  110. package/dist/utility/chart/wrun-bar-session-facts.util.js +32 -38
  111. package/dist/utility/chart/wrun-run-result.util.d.ts +29 -12
  112. package/dist/utility/chart/wrun-run-result.util.js +89 -25
  113. package/dist/utility/common/time.util.js +5 -4
  114. package/dist/utility/market-events/earnings-scope.util.d.ts +10 -5
  115. package/dist/utility/market-events/earnings-scope.util.js +17 -9
  116. package/dist/utility/market-events/market-events.util.d.ts +14 -7
  117. package/dist/utility/market-events/market-events.util.js +30 -17
  118. package/dist/utility/number-format.util.d.ts +14 -21
  119. package/dist/utility/number-format.util.js +38 -24
  120. package/dist/utility/options/option-venue-disclosure.util.d.ts +40 -6
  121. package/dist/utility/options/option-venue-disclosure.util.js +71 -11
  122. package/dist/utility/options/option-venue.util.d.ts +1 -1
  123. package/dist/utility/options/option-venue.util.js +1 -1
  124. package/dist/utility/pool-symbol.leaf.d.ts +7 -0
  125. package/dist/utility/pool-symbol.leaf.js +50 -5
  126. package/dist/utility/stocks/stock-display.util.d.ts +15 -0
  127. package/dist/utility/stocks/stock-display.util.js +37 -0
  128. package/dist/utility/symbol-selection/contract-expiry.util.js +5 -4
  129. package/dist/utility/v2/gate-plane.util.d.ts +6 -0
  130. package/dist/utility/v2/gate-plane.util.js +11 -1
  131. package/dist/utility/v2/gate-session-latch.util.d.ts +1 -1
  132. package/dist/utility/v2/gate-session-latch.util.js +3 -3
  133. package/dist/utility/v2/governed-tier.leaf.d.ts +17 -16
  134. package/dist/utility/v2/governed-tier.leaf.js +17 -16
  135. package/dist/utility/v2/stocks-governed.util.d.ts +5 -0
  136. package/dist/utility/v2/stocks-governed.util.js +14 -0
  137. package/dist/utility/v2/v2-enums.leaf.d.ts +13 -0
  138. package/dist/utility/v2/v2-enums.leaf.js +458 -0
  139. package/dist/utility/wrun/derived-roots.leaf.d.ts +21 -1
  140. package/dist/utility/wrun/derived-roots.leaf.js +27 -1
  141. package/dist/utility/wrun/derived-roots.util.d.ts +44 -32
  142. package/dist/utility/wrun/derived-roots.util.js +97 -56
  143. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -3
  144. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -3
  145. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +2 -1
  146. package/dist/utility/wrun/sources/lanes/option_daily.js +2 -1
  147. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +3 -0
  148. package/dist/utility/wrun/sources/lanes/options_flow.js +23 -5
  149. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -4
  150. package/dist/utility/wrun/sources/row-lane-registry.js +9 -4
  151. package/dist/utility/wrun/sources/row-lanes/dark_pool.d.ts +19 -0
  152. package/dist/utility/wrun/sources/row-lanes/dark_pool.js +104 -0
  153. package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
  154. package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.d.ts +20 -0
  155. package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.js +103 -0
  156. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -2
  157. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +15 -13
  158. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +49 -23
  159. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +14 -9
  160. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +75 -27
  161. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +139 -82
  162. package/dist/utility/wrun/wrun-app-layer.leaf.d.ts +78 -0
  163. package/dist/utility/wrun/wrun-app-layer.leaf.js +89 -0
  164. package/dist/utility/wrun/wrun-bar-count.util.d.ts +11 -7
  165. package/dist/utility/wrun/wrun-bar-count.util.js +12 -8
  166. package/dist/utility/wrun/wrun-batched-kinds.leaf.d.ts +13 -0
  167. package/dist/utility/wrun/wrun-batched-kinds.leaf.js +18 -0
  168. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +41 -22
  169. package/dist/utility/wrun/wrun-batched-marks.util.js +255 -59
  170. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +26 -19
  171. package/dist/utility/wrun/wrun-batched-readout.util.js +81 -27
  172. package/dist/utility/wrun/wrun-book-bands.leaf.d.ts +8 -0
  173. package/dist/utility/wrun/wrun-book-bands.leaf.js +7 -0
  174. package/dist/utility/wrun/wrun-candle-equal.leaf.d.ts +19 -0
  175. package/dist/utility/wrun/wrun-candle-equal.leaf.js +40 -0
  176. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -2
  177. package/dist/utility/wrun/wrun-canvases.util.js +7 -3
  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-inert-legend.util.d.ts +13 -0
  209. package/dist/utility/wrun/wrun-inert-legend.util.js +31 -3
  210. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +7 -5
  211. package/dist/utility/wrun/wrun-input-requirements.leaf.js +16 -6
  212. package/dist/utility/wrun/wrun-install-pacer.util.d.ts +26 -0
  213. package/dist/utility/wrun/wrun-install-pacer.util.js +145 -0
  214. package/dist/utility/wrun/wrun-kit-refusal-stages.types.d.ts +22 -0
  215. package/dist/utility/wrun/wrun-kit-refusal-stages.types.js +1 -0
  216. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +12 -5
  217. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +23 -5
  218. package/dist/utility/wrun/wrun-lane-warmup.util.js +22 -4
  219. package/dist/utility/wrun/wrun-leg-close.util.d.ts +6 -5
  220. package/dist/utility/wrun/wrun-leg-close.util.js +11 -9
  221. package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +3 -1
  222. package/dist/utility/wrun/wrun-leg-fetch.util.js +9 -2
  223. package/dist/utility/wrun/wrun-levels-child.util.d.ts +2 -0
  224. package/dist/utility/wrun/wrun-levels-child.util.js +6 -0
  225. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -0
  226. package/dist/utility/wrun/wrun-live-intake.util.d.ts +15 -6
  227. package/dist/utility/wrun/wrun-live-intake.util.js +167 -47
  228. package/dist/utility/wrun/wrun-live-tick.util.d.ts +52 -8
  229. package/dist/utility/wrun/wrun-live-tick.util.js +648 -97
  230. package/dist/utility/wrun/wrun-market-facts.util.d.ts +16 -2
  231. package/dist/utility/wrun/wrun-market-facts.util.js +32 -3
  232. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +27 -27
  233. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +28 -16
  234. package/dist/utility/wrun/wrun-market-size-defaults.util.js +34 -5
  235. package/dist/utility/wrun/wrun-oi-lane.util.d.ts +10 -7
  236. package/dist/utility/wrun/wrun-oi-lane.util.js +16 -10
  237. package/dist/utility/wrun/wrun-option-strike-flow.util.js +1 -1
  238. package/dist/utility/wrun/wrun-option-views.util.d.ts +2 -2
  239. package/dist/utility/wrun/wrun-option-views.util.js +5 -2
  240. package/dist/utility/wrun/wrun-options-flow-underlying.leaf.d.ts +5 -0
  241. package/dist/utility/wrun/wrun-options-flow-underlying.leaf.js +16 -0
  242. package/dist/utility/wrun/wrun-options-stop.util.d.ts +3 -2
  243. package/dist/utility/wrun/wrun-options-stop.util.js +6 -4
  244. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +75 -11
  245. package/dist/utility/wrun/wrun-overlay-drivers.util.js +176 -43
  246. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +20 -10
  247. package/dist/utility/wrun/wrun-overlay-park.util.d.ts +84 -0
  248. package/dist/utility/wrun/wrun-overlay-park.util.js +135 -0
  249. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +37 -4
  250. package/dist/utility/wrun/wrun-overlay-recovery.util.js +26 -14
  251. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +239 -24
  252. package/dist/utility/wrun/wrun-overlay-run.util.js +2204 -405
  253. package/dist/utility/wrun/wrun-pack.util.d.ts +8 -5
  254. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +2 -1
  255. package/dist/utility/wrun/wrun-panel-mount.util.js +20 -14
  256. package/dist/utility/wrun/wrun-panel-style.util.d.ts +4 -2
  257. package/dist/utility/wrun/wrun-panel-style.util.js +3 -2
  258. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +7 -0
  259. package/dist/utility/wrun/wrun-pin-spelling.util.js +18 -4
  260. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +26 -17
  261. package/dist/utility/wrun/wrun-pin-venues.util.js +43 -36
  262. package/dist/utility/wrun/wrun-pinned-lanes.util.d.ts +58 -0
  263. package/dist/utility/wrun/wrun-pinned-lanes.util.js +72 -0
  264. package/dist/utility/wrun/wrun-prefix-cohort.util.js +2 -1
  265. package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +22 -9
  266. package/dist/utility/wrun/wrun-prefix-lanes.util.js +145 -26
  267. package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +29 -0
  268. package/dist/utility/wrun/wrun-prefix-proof.util.js +23 -5
  269. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +9 -1
  270. package/dist/utility/wrun/wrun-refusal-surface.util.js +15 -1
  271. package/dist/utility/wrun/wrun-refusal.util.d.ts +19 -1
  272. package/dist/utility/wrun/wrun-refusal.util.js +103 -16
  273. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +20 -6
  274. package/dist/utility/wrun/wrun-registry-errors.util.js +20 -6
  275. package/dist/utility/wrun/wrun-replay-rows.util.js +6 -10
  276. package/dist/utility/wrun/wrun-run-health.util.d.ts +89 -2
  277. package/dist/utility/wrun/wrun-run-health.util.js +204 -1
  278. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +2 -2
  279. package/dist/utility/wrun/wrun-run-interval-session.util.js +2 -2
  280. package/dist/utility/wrun/wrun-run-interval.util.d.ts +9 -8
  281. package/dist/utility/wrun/wrun-run-interval.util.js +13 -11
  282. package/dist/utility/wrun/wrun-sandbox-row-source.js +5 -2
  283. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +13 -3
  284. package/dist/utility/wrun/wrun-script-inputs.util.js +51 -13
  285. package/dist/utility/wrun/wrun-session-composition.util.d.ts +81 -0
  286. package/dist/utility/wrun/wrun-session-composition.util.js +169 -0
  287. package/dist/utility/wrun/wrun-setting-words.util.d.ts +10 -7
  288. package/dist/utility/wrun/wrun-setting-words.util.js +25 -7
  289. package/dist/utility/wrun/wrun-source-rows.util.d.ts +94 -28
  290. package/dist/utility/wrun/wrun-source-rows.util.js +738 -93
  291. package/dist/utility/wrun/wrun-stream-clock.util.d.ts +45 -0
  292. package/dist/utility/wrun/wrun-stream-clock.util.js +108 -0
  293. package/dist/utility/wrun/wrun-tape-coins.util.d.ts +116 -0
  294. package/dist/utility/wrun/wrun-tape-coins.util.js +110 -0
  295. package/dist/utility/wrun/wrun-tape-source.util.d.ts +62 -32
  296. package/dist/utility/wrun/wrun-tape-source.util.js +72 -34
  297. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +13 -5
  298. package/dist/utility/wrun/wrun-tier-grid.util.js +23 -13
  299. package/dist/utility/wrun/wrun-tpo-rows.util.js +2 -1
  300. package/dist/utility/wrun/wrun-trades-lane.util.d.ts +73 -0
  301. package/dist/utility/wrun/wrun-trades-lane.util.js +82 -0
  302. package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +5 -0
  303. package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +9 -2
  304. package/dist/utility/wrun/wrun-visibility-table.d.ts +13 -0
  305. package/dist/utility/wrun/wrun-visibility-table.js +9 -0
  306. package/dist/utility/wrun/wrun-volume-profile.util.js +44 -32
  307. package/dist/utils/replay/replay-buffer-math.d.ts +16 -6
  308. package/dist/utils/replay/replay-buffer-math.js +60 -30
  309. package/dist/workers/constants/socket-slots.d.ts +11 -7
  310. package/dist/workers/constants/socket-slots.js +6 -5
  311. package/package.json +11 -11
@@ -1,3 +1,4 @@
1
+ import { WRUN_BATCHED_MARKS_KINDS } from './wrun-batched-kinds.leaf.js';
1
2
  import { WRUN_BATCHED_MARKS_CELL_BUDGET } from '../chart/overlay-output-budget.util.js';
2
3
  import { wrunLegendName } from '../chart/wrun-legend-name.util.js';
3
4
  import { scheduleWrunCellsCapNotice } from './wrun-cap-notice.util.js';
@@ -7,22 +8,24 @@ import { decodeWrunPackedColor, isWrunStyleTargetHidden, wrunPaintedDeclarationO
7
8
  import { WRUN_HEATMAP_TRIM_WATERMARK, wrunHeatmapCellShares, wrunHeatmapTrimTarget, } from './wrun-heatmap-cell-budget.util.js';
8
9
  import { resolveWrunColorWord, wrunThemeTokenOfPacked, wrunThemeTokenWord, } from './wrun-style-words.util.js';
9
10
  import { decodeWrunMarkMeta, decodeWrunSpanMeta, isWrunBatchedNumberFormat, WRUN_BATCHED_NUMBER_FORMATS, wrunBatchedReadoutText, wrunMarkUnitValue, } from './wrun-batched-readout.util.js';
10
- export { decodeWrunMarkMeta, decodeWrunSpanMeta, formatWrunBatchedNumber, isWrunBatchedNumberFormat, WRUN_BATCHED_NUMBER_FORMATS, wrunBatchedReadoutText, wrunMarkQtyInUnits, WRUN_MARK_META_MAX_OFFSET_MS, } from './wrun-batched-readout.util.js';
11
+ export { decodeWrunFlagMeta, decodeWrunMarkMeta, decodeWrunSpanMeta, formatWrunBatchedNumber, isWrunBatchedNumberFormat, WRUN_BATCHED_NUMBER_FORMATS, wrunBatchedReadoutText, wrunMarkQtyInUnits, WRUN_MARK_META_MAX_OFFSET_MS, } from './wrun-batched-readout.util.js';
11
12
  // ── The vocabulary ──────────────────────────────────────────────────────────
12
- /** The three kinds, in mount order: each a sheet key, a child id kind and the engine plot type. */
13
- export const WRUN_BATCHED_MARKS_KINDS = Object.freeze(['marks', 'spans', 'rays']);
14
- /** The fields of one record, per kind: marks `[price, qty, meta]`, spans `[top, bottom, length,
13
+ // The four kinds, in mount order (wrun-batched-kinds.leaf, the one list the readers that never load this module read).
14
+ export { isWrunBatchedMarksKind, WRUN_BATCHED_MARKS_KINDS } from './wrun-batched-kinds.leaf.js';
15
+ /** The fields of one record, per kind: marks and flags `[price, qty, meta]`, spans `[top, bottom, length,
15
16
  * meta]`, rays `[y1, y2, length, meta]`. */
16
17
  export const WRUN_BATCHED_STRIDE = Object.freeze({
17
18
  marks: 3,
18
19
  spans: 4,
19
20
  rays: 4,
21
+ flags: 3,
20
22
  });
21
23
  /** One slot's fields in output order, per kind (the kit's WRUN_BATCHED_FIELDS). */
22
24
  export const WRUN_BATCHED_FIELDS = Object.freeze({
23
25
  marks: Object.freeze(['price', 'qty', 'meta']),
24
26
  spans: Object.freeze(['top', 'bottom', 'length', 'meta']),
25
27
  rays: Object.freeze(['y1', 'y2', 'length', 'meta']),
28
+ flags: Object.freeze(['price', 'qty', 'meta']),
26
29
  });
27
30
  /** The kinds that also take the timed layout (the kit's WRUN_BATCHED_TIMED_KINDS). */
28
31
  export const WRUN_BATCHED_TIMED_KINDS = Object.freeze(['spans', 'rays']);
@@ -37,14 +40,18 @@ export const WRUN_BATCHED_TIMED_FIELDS = Object.freeze({
37
40
  /** Where a timed slot holds its start and end (the same two places on spans and rays). */
38
41
  const TIMED_START = WRUN_BATCHED_TIMED_FIELDS.spans.indexOf('start');
39
42
  const TIMED_END = WRUN_BATCHED_TIMED_FIELDS.spans.indexOf('end');
43
+ /** A kind that takes the timed layout: spans or rays. */
44
+ function isTimedKind(kind) {
45
+ return kind === 'spans' || kind === 'rays';
46
+ }
40
47
  /** Whether a section of `kind` at `stride` takes the timed layout: spans or rays at stride 5. */
41
48
  export function isWrunBatchedTimedLayout(kind, stride) {
42
- return kind !== 'marks' && stride === WRUN_BATCHED_TIMED_STRIDE;
49
+ return isTimedKind(kind) && stride === WRUN_BATCHED_TIMED_STRIDE;
43
50
  }
44
51
  /** One slot's fields for a section of `kind` at `stride` (the kit's `wrunBatchedSectionFields`): the
45
52
  * timed fields at stride 5 on spans and rays, WRUN_BATCHED_FIELDS otherwise. */
46
53
  export function wrunBatchedSectionFields(kind, stride) {
47
- return kind !== 'marks' && isWrunBatchedTimedLayout(kind, stride)
54
+ return isTimedKind(kind) && stride === WRUN_BATCHED_TIMED_STRIDE
48
55
  ? WRUN_BATCHED_TIMED_FIELDS[kind]
49
56
  : WRUN_BATCHED_FIELDS[kind];
50
57
  }
@@ -54,21 +61,30 @@ export const WRUN_BATCHED_MAX_SLOTS = 64;
54
61
  export const WRUN_BATCHED_MAX_OUTPUTS = 256;
55
62
  /** A hover template's longest text. */
56
63
  export const WRUN_BATCHED_TOOLTIP_MAX_CHARS = 200;
57
- /** The colours each kind declares (marks: indexed by the record's side, [sell, buy, ...]). */
64
+ /** The chip templates a flags section declares at most (its meta's word is 0..3), and the longest one. */
65
+ export const WRUN_FLAGS_MAX_WORDS = 4;
66
+ export const WRUN_FLAGS_WORD_MAX_CHARS = 32;
67
+ /** A flags section's colours by part (the dark pool round): the chip's fill, its edge (the hairline too) and its
68
+ * text. A list holds at most these three; a part it leaves out takes its default (LOOK_DEFAULTS.flags). */
69
+ export const WRUN_FLAGS_COLOR_PARTS = Object.freeze(['fill', 'edge', 'text']);
70
+ /** The colours each kind declares (marks: indexed by the record's side, [sell, buy, ...]; flags: by part,
71
+ * WRUN_FLAGS_COLOR_PARTS, none to all three). */
58
72
  const COLOR_COUNTS = {
59
73
  marks: [2, 4],
60
74
  spans: [1, 8],
61
75
  rays: [1, 8],
76
+ flags: [0, WRUN_FLAGS_COLOR_PARTS.length],
62
77
  };
63
78
  /**
64
79
  * The look a host applies for a key a section leaves out (the rule settled with the kit): a published
65
80
  * sheet carries every look key (the kit's build writes these into the derived sheet) and a sheet that
66
81
  * still lacks one draws with them instead of refusing; a `null` the sheet holds stays null (a span's
67
- * border: none; a tooltip: no readout). A mirror of the kit's WRUN_MARKS_DEFAULTS, WRUN_SPANS_DEFAULTS
68
- * and WRUN_RAYS_DEFAULTS (indicator-kit `wrun-style/batched.ts`): kit 0.71.0 exports them from kit.js,
69
- * the editor-only entry, not from host.js, the runtime entry, and this module runs on the main thread,
70
- * so the copy stays and wrun-batched-marks.kit-mirror.spec.ts holds it to the installed kit.
71
- * `panel` is not read here: every batched section draws on the price pane.
82
+ * border: none; a tooltip: no readout). A mirror of the kit's WRUN_MARKS_DEFAULTS, WRUN_SPANS_DEFAULTS,
83
+ * WRUN_RAYS_DEFAULTS and WRUN_FLAGS_DEFAULTS (indicator-kit `wrun-style/batched.ts`): kit 0.71.0 exports them
84
+ * from kit.js, the editor-only entry, not from host.js, the runtime entry, and this module runs on the main thread,
85
+ * so the copy stays (its kit-mirror spec was cut on 2026-10-29, so a kit bump that changes a default changes this
86
+ * copy by hand). The flags copy writes the kit's absent `icons` as `[]`: no word leads with an icon. `panel` is not
87
+ * read here: every batched section draws on the price pane.
72
88
  */
73
89
  const LOOK_DEFAULTS = {
74
90
  marks: {
@@ -98,11 +114,18 @@ const LOOK_DEFAULTS = {
98
114
  tooltip: null,
99
115
  panel: 'overlay',
100
116
  },
117
+ flags: {
118
+ words: ['{{qty:compact}}'],
119
+ icons: [],
120
+ max_in_view: 5,
121
+ x: 1,
122
+ size: { law: 'sqrt', unit: 1, scale: 5 },
123
+ /** By part: the chip's fill, its edge and hairline, its text (WRUN_FLAGS_COLOR_PARTS). */
124
+ colors: ['theme.bg', 'theme.muted', 'theme.text'],
125
+ tooltip: null,
126
+ panel: 'overlay',
127
+ },
101
128
  };
102
- const KINDS = new Set(WRUN_BATCHED_MARKS_KINDS);
103
- export function isWrunBatchedMarksKind(kind) {
104
- return typeof kind === 'string' && KINDS.has(kind);
105
- }
106
129
  /** A batched child's id: `<overlayId>::<kind>:<name>`. */
107
130
  export function wrunBatchedChildId(overlayId, kind, name) {
108
131
  return `${overlayId}::${kind}:${name}`;
@@ -122,14 +145,32 @@ export function wrunBatchedBarCells(spec) {
122
145
  function sectionRefusal(sheetId, subject, reason) {
123
146
  return new Error(`WRUN ${sheetId}: ${subject}: ${reason}`);
124
147
  }
148
+ /** A flags section's chip templates and icons (thrown, like a colour count): `words` 1 to 4 texts of at most 32
149
+ * characters (the meta's word is 0..3), `icons` at most one a word (their values are the gate's to judge). Left out,
150
+ * the kit's defaults draw. */
151
+ function flagsSectionRefusal(sheetId, subject, entry) {
152
+ const words = entry.words;
153
+ if (words !== undefined &&
154
+ (!Array.isArray(words) ||
155
+ words.length < 1 ||
156
+ words.length > WRUN_FLAGS_MAX_WORDS ||
157
+ words.some((word) => typeof word !== 'string' || word.length > WRUN_FLAGS_WORD_MAX_CHARS))) {
158
+ throw sectionRefusal(sheetId, subject, `words must hold 1 to ${WRUN_FLAGS_MAX_WORDS} texts of at most ${WRUN_FLAGS_WORD_MAX_CHARS} characters`);
159
+ }
160
+ const icons = entry.icons;
161
+ if (Array.isArray(icons) && icons.length > WRUN_FLAGS_MAX_WORDS) {
162
+ throw sectionRefusal(sheetId, subject, `icons must hold at most ${WRUN_FLAGS_MAX_WORDS} icons, one a word`);
163
+ }
164
+ }
125
165
  /**
126
- * The sheet's batched sections in mount order (marks, spans, rays; each list in its order),
166
+ * The sheet's batched sections in mount order (marks, spans, rays, flags; each list in its order),
127
167
  * validated against the sheet's outputs BY INDEX: `slots` a whole number from 1 to 64, `stride` one
128
- * the gate admits (marks 3; spans and rays 4, or 5 for the timed layout), `first_output` a whole
168
+ * the gate admits (marks and flags 3; spans and rays 4, or 5 for the timed layout), `first_output` a whole
129
169
  * number, and outputs `first_output` through `first_output + slots * stride - 1` declared,
130
170
  * contiguous, data-only (plot ""), inside the 256 a sheet declares and owned by no other section; a
131
171
  * unique name; declared colours the kind takes (left out, the kit's default colours draw); a tooltip
132
- * of at most 200 characters. Anything else refuses the run by name (thrown). A section whose
172
+ * of at most 200 characters; a flags section's `words` 1 to 4 texts of at most 32 characters and its `icons`
173
+ * at most one a word. Anything else refuses the run by name (thrown). A section whose
133
174
  * declaration names a layout newer than this chart (`wrunBatchedLayoutVerdict`: a stride, a key or an
134
175
  * option value it does not know) refuses nothing here: it is read with its reason (`newer`), its
135
176
  * outputs unread, and its child alone is refused at the mount. A section the Style row switched off
@@ -207,7 +248,9 @@ export function readWrunBatchedSections(sheet) {
207
248
  const [fewest, most] = COLOR_COUNTS[kind];
208
249
  const colors = entry.colors;
209
250
  if (colors !== undefined && (!Array.isArray(colors) || colors.length < fewest || colors.length > most)) {
210
- throw sectionRefusal(sheetId, subject, `colors must hold ${fewest} to ${most} colours`);
251
+ throw sectionRefusal(sheetId, subject, kind === 'flags'
252
+ ? `colors must hold at most ${most} colours, by part: ${WRUN_FLAGS_COLOR_PARTS.join(', ')}`
253
+ : `colors must hold ${fewest} to ${most} colours`);
211
254
  }
212
255
  const tooltip = entry.tooltip;
213
256
  if (tooltip !== undefined &&
@@ -215,6 +258,8 @@ export function readWrunBatchedSections(sheet) {
215
258
  (typeof tooltip !== 'string' || tooltip.length > WRUN_BATCHED_TOOLTIP_MAX_CHARS)) {
216
259
  throw sectionRefusal(sheetId, subject, `tooltip must be text of at most ${WRUN_BATCHED_TOOLTIP_MAX_CHARS} characters`);
217
260
  }
261
+ if (kind === 'flags')
262
+ flagsSectionRefusal(sheetId, subject, entry);
218
263
  specs.push({
219
264
  kind,
220
265
  name,
@@ -236,9 +281,10 @@ export function wrunSheetHasBatchedMarks(sheet) {
236
281
  function secondsToMs(value) {
237
282
  return Number.isFinite(value) ? Math.round(value * 1000) : value;
238
283
  }
239
- /** Whether a filled slot's meta is one this chart's decoders read (the kit's packers' range). */
284
+ /** Whether a filled slot's meta is one this chart's decoders read (the kit's packers' range): a flags meta packs as
285
+ * a marks meta (`word + 4 * count + 262144 * offset_ms`). */
240
286
  function packedMetaKnown(kind, meta) {
241
- return kind === 'marks' ? decodeWrunMarkMeta(meta) !== null : decodeWrunSpanMeta(meta) !== null;
287
+ return kind === 'marks' || kind === 'flags' ? decodeWrunMarkMeta(meta) !== null : decodeWrunSpanMeta(meta) !== null;
242
288
  }
243
289
  /**
244
290
  * The child rows of a section from the parent's rows `fromIndex` onward, by index: `[ts, ...fields]`,
@@ -308,25 +354,51 @@ function wordIndex(value, words, fallback) {
308
354
  }
309
355
  return wholeIn(value, 0, words.length - 1, fallback);
310
356
  }
311
- /** The marks look words (round-2 fold 1), the numbers canonical; the first contract's words read too. */
312
- const MARK_LOOKS = ['circle', 'dot', 'ring', 'square'];
357
+ /** The marks look words (round-2 fold 1), the numbers canonical; the first contract's words read too, and look 4's
358
+ * word `diamond` (the dark pool round). */
359
+ const MARK_LOOKS = ['circle', 'dot', 'ring', 'square', 'diamond'];
360
+ /** The diamond's index: a look an engine before the dark pool round's draws as another (`wrunBatchedEngineVerdict`). */
361
+ const DIAMOND_LOOK = MARK_LOOKS.indexOf('diamond');
313
362
  const MARK_TEXT_MODES = ['off', 'largest', 'all'];
314
363
  const MARK_X_WORDS = ['bar', 'offset'];
364
+ /** The size laws: sqrt and linear, and log (the dark pool round's, with the `min_px` / `max_px` bounds). */
365
+ const MARK_SIZE_LAWS = ['sqrt', 'linear', 'log'];
315
366
  const LINE_STYLES = new Set(['solid', 'dashed', 'dotted']);
367
+ /** The icon a flag's chip leads with, by index or word (one a word, `icons`). */
368
+ const FLAG_ICONS = ['none', 'dot', 'diamond', 'sprout', 'flame'];
316
369
  // ── The gate: layouts newer than this chart ─────────────────────────────────
370
+ /** A list key's rule: the key holds a list, and every entry is one of `values` (a flags section's `icons`). */
371
+ class WrunBatchedListRule {
372
+ values;
373
+ constructor(values) {
374
+ this.values = values;
375
+ }
376
+ }
317
377
  /** A key's rule in the gate's vocabulary: `ANY` (the reader takes any value, clamping or defaulting
318
- * it), the values an option takes (an index or a word), or a nested object's own vocabulary. */
378
+ * it), the values an option takes (an index or a word), a list of such options, or a nested object's own
379
+ * vocabulary. */
319
380
  const ANY = 'any';
320
- /** The strides this chart reads, per kind: marks 3; spans and rays 4, and 5 (the timed layout). */
381
+ /** The strides this chart reads, per kind: marks and flags 3; spans and rays 4, and 5 (the timed layout). */
321
382
  const KNOWN_STRIDES = {
322
383
  marks: [WRUN_BATCHED_STRIDE.marks],
323
384
  spans: [WRUN_BATCHED_STRIDE.spans, WRUN_BATCHED_TIMED_STRIDE],
324
385
  rays: [WRUN_BATCHED_STRIDE.rays, WRUN_BATCHED_TIMED_STRIDE],
386
+ flags: [WRUN_BATCHED_STRIDE.flags],
325
387
  };
388
+ /** An option's values: its indexes, then its words (what the look readers take). */
389
+ const optionValues = (words) => [...words.keys(), ...words];
326
390
  /** The marks options by index, or by the first contract's words (what the look readers take). */
327
- const MARK_LOOK_VALUES = [0, 1, 2, 3, ...MARK_LOOKS];
328
- const MARK_X_VALUES = [0, 1, ...MARK_X_WORDS];
329
- const MARK_TEXT_MODE_VALUES = [0, 1, 2, ...MARK_TEXT_MODES];
391
+ const MARK_LOOK_VALUES = optionValues(MARK_LOOKS);
392
+ const MARK_X_VALUES = optionValues(MARK_X_WORDS);
393
+ const MARK_TEXT_MODE_VALUES = optionValues(MARK_TEXT_MODES);
394
+ /** The size keys marks and flags read (`min_px` and `max_px` the dark pool round's). */
395
+ const MARK_SIZE_VOCABULARY = {
396
+ law: MARK_SIZE_LAWS,
397
+ unit: ANY,
398
+ scale: ANY,
399
+ min_px: ANY,
400
+ max_px: ANY,
401
+ };
330
402
  /** Every batched section draws on the price pane: a lower-pane section needs a newer chart. */
331
403
  const PANEL_VALUES = ['overlay'];
332
404
  /**
@@ -342,7 +414,7 @@ const SECTION_VOCABULARY = {
342
414
  slots: ANY,
343
415
  first_output: ANY,
344
416
  stride: ANY,
345
- size: { law: ['sqrt', 'linear'], unit: ANY, scale: ANY },
417
+ size: MARK_SIZE_VOCABULARY,
346
418
  opacity_pct: ANY,
347
419
  look: MARK_LOOK_VALUES,
348
420
  text: { mode: MARK_TEXT_MODE_VALUES, field: ['qty'], format: WRUN_BATCHED_NUMBER_FORMATS, min_px: ANY },
@@ -383,6 +455,22 @@ const SECTION_VOCABULARY = {
383
455
  panel: PANEL_VALUES,
384
456
  visible: ANY,
385
457
  },
458
+ flags: {
459
+ name: ANY,
460
+ slots: ANY,
461
+ first_output: ANY,
462
+ stride: ANY,
463
+ words: ANY,
464
+ icons: new WrunBatchedListRule(optionValues(FLAG_ICONS)),
465
+ max_in_view: ANY,
466
+ x: MARK_X_VALUES,
467
+ size: MARK_SIZE_VOCABULARY,
468
+ colors: ANY,
469
+ tooltip: ANY,
470
+ label: ANY,
471
+ panel: PANEL_VALUES,
472
+ visible: ANY,
473
+ },
386
474
  };
387
475
  /** A value as the gate's reasons quote it. */
388
476
  function quotedValue(value) {
@@ -403,6 +491,14 @@ function vocabularyVerdict(kind, vocabulary, value, at) {
403
491
  const rule = vocabulary[key];
404
492
  if (rule === ANY || entry === undefined || entry === null)
405
493
  continue;
494
+ if (rule instanceof WrunBatchedListRule) {
495
+ if (!Array.isArray(entry))
496
+ return `${path} ${quotedValue(entry)} is no ${kind} option this chart reads`;
497
+ const at = entry.findIndex((item) => !rule.values.includes(item));
498
+ if (at !== -1)
499
+ return `${path}[${at}] ${quotedValue(entry[at])} is no ${kind} option this chart reads`;
500
+ continue;
501
+ }
406
502
  if (Array.isArray(rule)) {
407
503
  if (!rule.includes(entry)) {
408
504
  return `${path} ${quotedValue(entry)} is no ${kind} option this chart reads`;
@@ -424,6 +520,7 @@ const layoutVerdicts = {
424
520
  marks: new WeakMap(),
425
521
  spans: new WeakMap(),
426
522
  rays: new WeakMap(),
523
+ flags: new WeakMap(),
427
524
  };
428
525
  /** A section's own stride, keys and option values against the vocabulary (uncached). */
429
526
  function sectionLayoutVerdict(kind, section) {
@@ -434,9 +531,10 @@ function sectionLayoutVerdict(kind, section) {
434
531
  }
435
532
  /**
436
533
  * Why this chart cannot draw a section of `kind` (the gate, round-1 finding 17), null when it can: a
437
- * stride it does not know (marks 3; spans and rays 4, or 5 for the timed layout), a key it does not
534
+ * stride it does not know (marks and flags 3; spans and rays 4, or 5 for the timed layout), a key it does not
438
535
  * know, or an option value it does not know under a known key, nested keys included (`size`, `text`,
439
- * `border`). The section's child is refused by name ("Needs a newer chart") and the Indicator's other
536
+ * `border`) and every entry of a list key (`icons`). The section's child is refused by name ("Needs a newer
537
+ * chart") and the Indicator's other
440
538
  * children run: the next layout change is caught here as the timed one would have been. The reason is
441
539
  * diagnostic text (the notice row's details), never copy. Read once per section (cached).
442
540
  *
@@ -458,34 +556,69 @@ export function wrunBatchedLayoutVerdict(kind, section) {
458
556
  cache.set(section, verdict);
459
557
  return verdict;
460
558
  }
461
- /** A section's words, each a string (the spans and rays `{{word}}` vocabulary, 0..16). */
462
- function wordsOf(value) {
463
- return Array.isArray(value) ? value.slice(0, 16).map((word) => (typeof word === 'string' ? word : '')) : [];
559
+ /** A section's words, each a string (the spans and rays `{{word}}` vocabulary, 0..16; a flags section's chip
560
+ * templates, 1..4). */
561
+ function wordsOf(value, most = 16) {
562
+ return Array.isArray(value) ? value.slice(0, most).map((word) => (typeof word === 'string' ? word : '')) : [];
563
+ }
564
+ /** A flags section's chip templates: its declared words, else the kit's default. */
565
+ function flagWordsOf(section) {
566
+ const words = wordsOf(section.words, WRUN_FLAGS_MAX_WORDS);
567
+ return words.length > 0 ? words : [...LOOK_DEFAULTS.flags.words];
464
568
  }
465
- /** The marks look the engine draws (r6 parity): `look` 0..3 (Bubble, Soft dot, Ring, Square), the
466
- * size law over the quantity (`unit` the Min size, `scale` the Bubble size 1..10), `x` 0..1
569
+ /** The largest diameter the engine draws a mark at (css px): a size bound past it reads as it. */
570
+ const MARK_MAX_PX = 64;
571
+ /** A marks (or flags) size as the engine reads it: the law (one of the three, else the default), the unit (above
572
+ * zero, else the default) and the Bubble size clamped to 1..10; the `min_px` / `max_px` bounds (the dark pool
573
+ * round's, clamped to 1..64 css px) ride only when declared, so a section that declares none hands the engine the
574
+ * size it always did. */
575
+ function markSizeOf(value) {
576
+ const defaults = LOOK_DEFAULTS.marks.size;
577
+ const size = isRecord(value) ? value : {};
578
+ return {
579
+ law: typeof size.law === 'string' && MARK_SIZE_LAWS.includes(size.law)
580
+ ? size.law
581
+ : defaults.law,
582
+ unit: finite(size.unit) && size.unit > 0 ? size.unit : defaults.unit,
583
+ scale: clampTo(size.scale, 1, 10, defaults.scale),
584
+ ...(finite(size.min_px) ? { min_px: clampTo(size.min_px, 1, MARK_MAX_PX, 1) } : {}),
585
+ ...(finite(size.max_px) ? { max_px: clampTo(size.max_px, 1, MARK_MAX_PX, MARK_MAX_PX) } : {}),
586
+ };
587
+ }
588
+ // Titan's size factor (renderers/batchedMarks/data.ts markSizeLawOf, not exported): every diameter scales with k.
589
+ const markSizeK = (scale) => 0.5 + 0.1 * scale;
590
+ /** Titan's largest bubble at a Bubble size (markMaxDiameterCss: min(64, 50k), rounded like a diameter). */
591
+ const markMaxDiameterPx = (scale) => Math.round(Math.min(64, 50 * markSizeK(scale)));
592
+ /** The engine's caption floor: the declared px at the default Bubble size, scaled by k and rounded like a diameter,
593
+ * held to the largest bubble this size draws, so a floor a big trade reaches at one size stays reachable at every
594
+ * size (a declared floor past the default size's cap reads as that cap's bubbles). */
595
+ function markCaptionFloorPx(declaredPx, scale) {
596
+ const scaled = Math.round((declaredPx * markSizeK(scale)) / markSizeK(LOOK_DEFAULTS.marks.size.scale));
597
+ return Math.min(scaled, markMaxDiameterPx(scale));
598
+ }
599
+ /** The marks look the engine draws (r6 parity): `look` 0..4 (Bubble, Soft dot, Ring, Square, Diamond), the
600
+ * size law over the quantity (`unit` the Min size, `scale` the Bubble size 1..10; `log` and the `min_px` /
601
+ * `max_px` bounds when declared, `markSizeOf`), `x` 0..1
467
602
  * (Candle center, Trade time), `opacity_pct` 10..80, the caption (`text.mode` 0 Off, 1 Big
468
- * bubbles, 2 All; its format, a word of the one list, and the smallest bubble that holds one). A key
603
+ * bubbles, 2 All; its format, a word of the one list, and the smallest bubble that holds one: declared
604
+ * at the default Bubble size, handed scaled to this one). A key
469
605
  * left out, or an option that is none of its values (look, x, law, the caption's mode and format),
470
606
  * takes the kit's default (LOOK_DEFAULTS.marks); a number past its range is clamped. The market's
471
607
  * dollar unit (`valuePerUnit`, proven: finite and above zero) rides at the top for the `units`
472
608
  * caption; without one, `units` is handed to the engine as `usd`. */
473
609
  function marksSettings(section, valuePerUnit) {
474
610
  const defaults = LOOK_DEFAULTS.marks;
475
- const size = isRecord(section.size) ? section.size : {};
611
+ const size = markSizeOf(section.size);
476
612
  const text = isRecord(section.text) ? section.text : {};
477
613
  const legacyShape = section.shape;
478
614
  const written = isWrunBatchedNumberFormat(text.format) ? text.format : defaults.text.format;
479
615
  // `units` divides by the market's dollar unit: with none proven it would caption a wrong number, so the engine reads
480
616
  // the same amount in dollars (the hover's rule, wrun-batched-readout.util `wrunMarkQtyInUnits`).
481
617
  const format = written === 'units' && valuePerUnit === undefined ? 'usd' : written;
618
+ const scale = size.scale;
482
619
  return {
483
620
  look: wordIndex(section.look ?? legacyShape, MARK_LOOKS, defaults.look),
484
- size: {
485
- law: size.law === 'linear' || size.law === 'sqrt' ? size.law : defaults.size.law,
486
- unit: finite(size.unit) && size.unit > 0 ? size.unit : defaults.size.unit,
487
- scale: clampTo(size.scale, 1, 10, defaults.size.scale),
488
- },
621
+ size,
489
622
  x: wordIndex(section.x, MARK_X_WORDS, defaults.x),
490
623
  colors: [...(section.colors ?? defaults.colors)],
491
624
  opacity_pct: clampTo(section.opacity_pct, 10, 80, defaults.opacity_pct),
@@ -493,7 +626,7 @@ function marksSettings(section, valuePerUnit) {
493
626
  mode: wordIndex(text.mode, MARK_TEXT_MODES, defaults.text.mode),
494
627
  field: defaults.text.field,
495
628
  format,
496
- min_px: clampTo(text.min_px, 0, 64, defaults.text.min_px),
629
+ min_px: markCaptionFloorPx(clampTo(text.min_px, 0, 64, defaults.text.min_px), scale),
497
630
  },
498
631
  ...(valuePerUnit !== undefined ? { valuePerUnit } : {}),
499
632
  };
@@ -531,6 +664,37 @@ function raysSettings(section) {
531
664
  words: wordsOf(section.words),
532
665
  };
533
666
  }
667
+ /** The flags look the engine draws (the dark pool round): the chip templates (`words`, 1..4, the record's word picks
668
+ * one), each word's icon as a word (`icons`: one of the five, by word or index, `none` past the list), the chips in
669
+ * view at most (`max_in_view`, a whole 1..16), `x` 0..1 (Candle center, Trade time), the size law of the marks the
670
+ * chips point at (`markSizeOf`) and always three colours by part (the chip's fill, its edge and hairline, its text:
671
+ * a part the declared list leaves out takes its default). A key left out takes LOOK_DEFAULTS.flags. */
672
+ function flagsSettings(section) {
673
+ const defaults = LOOK_DEFAULTS.flags;
674
+ const words = flagWordsOf(section);
675
+ const icons = Array.isArray(section.icons) ? section.icons : defaults.icons;
676
+ return {
677
+ words,
678
+ icons: words.map((_word, at) => FLAG_ICONS[wordIndex(icons[at], FLAG_ICONS, 0)]),
679
+ max_in_view: Math.round(clampTo(section.max_in_view, 1, 16, defaults.max_in_view)),
680
+ x: wordIndex(section.x, MARK_X_WORDS, defaults.x),
681
+ size: markSizeOf(section.size),
682
+ colors: defaults.colors.map((fallback, at) => section.colors?.[at] ?? fallback),
683
+ };
684
+ }
685
+ /** A section's look as its kind's engine settings. */
686
+ function lookOf(spec, valuePerUnit) {
687
+ switch (spec.kind) {
688
+ case 'marks':
689
+ return marksSettings(spec.declaration, valuePerUnit);
690
+ case 'spans':
691
+ return spansSettings(spec.declaration);
692
+ case 'rays':
693
+ return raysSettings(spec.declaration);
694
+ case 'flags':
695
+ return flagsSettings(spec.declaration);
696
+ }
697
+ }
534
698
  /** The tooltip a section declares, null when it declares none (absent, null or blank). */
535
699
  function tooltipOf(section) {
536
700
  return typeof section.tooltip === 'string' && section.tooltip.trim() !== '' ? section.tooltip : null;
@@ -539,26 +703,26 @@ function tooltipOf(section) {
539
703
  * here, the child rows start at field 0), the look of its kind, and `hoverReadout` when a tooltip is
540
704
  * declared (the engine registers its drawn records for hover then). Colours stay as declared. A marks
541
705
  * child also carries the market's dollar unit (`valuePerUnit`) when the build hands a proven one; spans
542
- * and rays never do (their records hold no quantity). */
706
+ * and rays never do (their records hold no quantity), nor flags (a chip's templates print no `units`). */
543
707
  export function wrunBatchedSettingsOf(spec, context = {}) {
544
- const look = spec.kind === 'marks'
545
- ? marksSettings(spec.declaration, wrunMarkUnitValue(context.valuePerUnit))
546
- : spec.kind === 'spans'
547
- ? spansSettings(spec.declaration)
548
- : raysSettings(spec.declaration);
708
+ const look = lookOf(spec, wrunMarkUnitValue(context.valuePerUnit));
549
709
  return { slots: spec.slots, stride: spec.stride, ...look, hoverReadout: tooltipOf(spec.declaration) !== null };
550
710
  }
551
711
  /** The readout a section with a tooltip registers at its mount, with the record's text (the template
552
712
  * printed by wrun-batched-readout.util) on it: the child carries the readout it registers, so a
553
713
  * registration from the child alone (the mount's `syncCanvasReadouts` after a pass that failed part
554
- * way) keeps the hover text. A marks readout carries the market's dollar unit its `{{qty:units}}`
555
- * divides by (proven only). */
714
+ * way) keeps the hover text. A marks or flags readout carries the market's dollar unit its `{{qty:units}}`
715
+ * divides by (proven only); a flags readout carries its chip templates as its words (`{{word}}`). */
556
716
  function readoutOf(spec, valuePerUnit) {
557
717
  const tooltip = tooltipOf(spec.declaration);
558
718
  if (tooltip === null)
559
719
  return undefined;
560
720
  const label = spec.declaration.label;
561
- const words = spec.kind === 'marks' ? [] : wordsOf(spec.declaration.words);
721
+ const words = spec.kind === 'marks'
722
+ ? []
723
+ : spec.kind === 'flags'
724
+ ? flagWordsOf(spec.declaration)
725
+ : wordsOf(spec.declaration.words);
562
726
  const timed = isWrunBatchedTimedLayout(spec.kind, spec.stride);
563
727
  const readout = {
564
728
  kind: spec.kind,
@@ -568,7 +732,7 @@ function readoutOf(spec, valuePerUnit) {
568
732
  ...(words.length > 0 ? { words } : {}),
569
733
  // A timed record's `{{start}}` and `{{end}}` (their display offset is the mount door's to stamp).
570
734
  ...(timed ? { timed: true } : {}),
571
- ...(spec.kind === 'marks' && valuePerUnit !== undefined ? { valuePerUnit } : {}),
735
+ ...((spec.kind === 'marks' || spec.kind === 'flags') && valuePerUnit !== undefined ? { valuePerUnit } : {}),
572
736
  };
573
737
  readout.text = (record, formatters) => wrunBatchedReadoutText(readout, record, formatters);
574
738
  return readout;
@@ -690,20 +854,52 @@ export function resolveWrunBatchedColor(value, theme) {
690
854
  return decodeWrunPackedColor(value);
691
855
  }
692
856
  /** The colour a slot falls back to when its declared one does not resolve: a mark's side (sell the
693
- * theme's down, buy its up), else the accent. */
857
+ * theme's down, buy its up), a flag's part (the fill the background, the edge the muted grey, the text the text),
858
+ * else the accent. */
694
859
  function fallbackColor(kind, at, theme) {
695
860
  if (kind === 'marks')
696
861
  return at === 0 ? theme.down : at === 1 ? theme.up : theme.text;
862
+ if (kind === 'flags')
863
+ return at === 0 ? theme.bg : at === 1 ? theme.muted : theme.text;
697
864
  return theme.accent;
698
865
  }
866
+ // ── The engine: a look the chart reads that an older engine draws as another ─
867
+ /** The plot renderer whose TitanCharts release also draws the marks diamond (look 4), the `log` size law and the
868
+ * size's `min_px` / `max_px` bounds: the dark pool round's one release taught the engine all four (the frozen
869
+ * contract). An engine before it has no `flags` renderer, clamps the look to 0..3 and reads only the sqrt and
870
+ * linear laws, so it would draw another look or size than the declared one, silently. */
871
+ const DIAMOND_ENGINE_PLOT = 'flags';
872
+ /**
873
+ * Why the chart's engine cannot draw a batched child its kind's renderer draws, null when it can: the mount asks it
874
+ * once the engine gate passed the kind (the pack settled and registered, `hasPlotRenderer` the engine's own answer).
875
+ * A marks child whose look needs the dark pool round's engine (look 4, the `log` law, a `min_px` or `max_px` bound)
876
+ * on an engine without that release's `flags` renderer is refused by name ("Needs a newer chart"), as an unknown
877
+ * look is by the layout gate, never drawn as another look. A flags child is never judged here: the gate already
878
+ * asked the engine for its kind. The reason is diagnostic text, never copy.
879
+ */
880
+ export function wrunBatchedEngineVerdict(child, hasPlotRenderer) {
881
+ if (child.kind !== 'marks')
882
+ return null;
883
+ const size = isRecord(child.settings.size) ? child.settings.size : {};
884
+ const needs = child.settings.look === DIAMOND_LOOK
885
+ ? 'look 4 (diamond)'
886
+ : size.law === 'log'
887
+ ? 'size.law "log"'
888
+ : size.min_px !== undefined || size.max_px !== undefined
889
+ ? 'size.min_px or size.max_px'
890
+ : null;
891
+ if (needs === null || hasPlotRenderer(DIAMOND_ENGINE_PLOT))
892
+ return null;
893
+ return `${needs} needs the chart engine that draws ${DIAMOND_ENGINE_PLOT}`;
894
+ }
699
895
  /**
700
896
  * The engine config of a batched child at its mount (and every retranslate): the id, the plot (the
701
897
  * kind), the settings with every colour resolved against the chart's theme, the live merge. A child
702
898
  * with a readout registers it for the hover inspector as the child carries it (its template's text
703
899
  * as `text`); one without forgets any it had. A timed readout first takes the display offset its
704
- * `{{start}}` and `{{end}}` print in (`timeOffsetMs`: the chart's display timezone, none on daily and
705
- * longer bars), stamped on the child's own readout so every registration of it keeps it; a timezone
706
- * switch retranslates, which stamps it again.
900
+ * `{{start}}` and `{{end}}` print in (`timeOffsetMs`: the chart's display timezone, a fixed shift or the
901
+ * shift at each instant, none on daily and longer bars), stamped on the child's own readout so every
902
+ * registration of it keeps it; a timezone switch retranslates, which stamps it again.
707
903
  */
708
904
  export function wrunBatchedChildConfig(child, ctx) {
709
905
  const id = wrunBatchedChildId(ctx.overlayId, child.kind, child.name);
@@ -1,13 +1,3 @@
1
- /**
2
- * The batched records' readout (WRUN-BATCHED-MARKS): a `marks`, `spans` or `rays` record's meta
3
- * decode, the number formats a template (and a marks caption) prints with (THE one list,
4
- * WRUN_BATCHED_NUMBER_FORMATS), and the tooltip text.
5
- * The batched mount registers the text as its readout's `text` (wrun-batched-marks.util
6
- * `wrunBatchedChildConfig`), so the boot-path hover inspector prints a record through the thin
7
- * registry (wrun-canvas-readout.util) and never loads this module itself. A timed spans or rays
8
- * record (stride 5, WRUN-MARKS-CONTRACT F2) answers `{{start}}` and `{{end}}`, printed as the
9
- * chart prints a time (wrun-chart-time.util), its meta read from its fifth field.
10
- */
11
1
  import { type WrunBatchedHoverRecord, type WrunCanvasReadout } from './wrun-canvas-readout.util.js';
12
2
  /** A marks record's meta, `side + 4 * fills + 262144 * offset_ms`, read apart. */
13
3
  export interface WrunMarkMeta {
@@ -26,6 +16,17 @@ export declare const WRUN_MARK_META_MAX_OFFSET_MS: number;
26
16
  * a finite whole number, negative, or past the largest offset.
27
17
  */
28
18
  export declare function decodeWrunMarkMeta(meta: number): WrunMarkMeta | null;
19
+ /** A flags record's meta, `word + 4 * count + 262144 * offset_ms` (a marks meta's packing), read apart. */
20
+ export interface WrunFlagMeta {
21
+ /** 0..3: the chip template the record names (`words[word]`). */
22
+ word: number;
23
+ /** 0..65535. */
24
+ count: number;
25
+ /** 0..2^30: the record's time inside its bar. */
26
+ offsetMs: number;
27
+ }
28
+ /** A flags meta read apart as a marks meta is (`decodeWrunMarkMeta`); null for a value that is no packed meta. */
29
+ export declare function decodeWrunFlagMeta(meta: number): WrunFlagMeta | null;
29
30
  /** A spans or rays record's meta, `style + 8 * word + 256 * extend`, read apart. */
30
31
  export interface WrunSpanMeta {
31
32
  /** 0..7: the record's colour index. */
@@ -54,13 +55,15 @@ export declare const WRUN_BATCHED_TIMED_TOOLTIP_TOKENS: Readonly<{
54
55
  export declare function wrunTimedRecordSpan(record: Pick<WrunBatchedHoverRecord, 'ts' | 'fields'>): [number, number];
55
56
  /**
56
57
  * THE number formats a batched template and a marks caption print with, the kit's WRUN_MARK_TEXT_FORMATS (its
57
- * WRUN_BATCHED_TOOLTIP_FORMATS): `compact` (Big Trades 0.3.2's caption, "1.2M", "1.2K"), `price` (the pane's price),
58
- * `int` (rounded), `usd` ("$" before the compact amount, "$12M", "-$1.2K") and `units` (a mark's quantity in the
59
- * market's own unit, `wrunMarkQtyInUnits`, printed compact; in dollars where no unit is proven). The layout gate's
58
+ * WRUN_BATCHED_TOOLTIP_FORMATS): `compact` (Big Trades 0.3.2's caption, "1.2B", "1.2M", "1.2K"), `price` (the pane's
59
+ * price), `int` (rounded), `usd` ("$" before the compact amount, "$12M", "-$1.2K") and `units` (a mark's quantity in
60
+ * the market's own unit, `wrunMarkQtyInUnits`, printed compact; in dollars where no unit is proven). The layout gate's
60
61
  * vocabulary, the engine settings and this readout read this list, and the format type derives from it: a word added
61
62
  * in one hand copy alone refused the section ("Needs a newer chart") or printed the placeholder as written
62
63
  * (tests/utility/wrun/wrun-batched-readout.util.spec.ts holds it to its golden and finds any second spelling of it in
63
- * the package). TitanCharts keeps the engine's own copy for the caption, pinned to the same golden there.
64
+ * the package). TitanCharts keeps the engine's own copy for the caption and a flag's chip (batchedMarks formats.ts):
65
+ * the same spec runs the INSTALLED engine's copy and holds this list and every word's text to it, so a hover always
66
+ * prints a record as its bubble does.
64
67
  */
65
68
  export declare const WRUN_BATCHED_NUMBER_FORMATS: readonly ["compact", "price", "int", "usd", "units"];
66
69
  /** A number format of the one list. */
@@ -78,10 +81,11 @@ export declare function wrunMarkUnitValue(value: unknown): number | undefined;
78
81
  * caller prints dollars (`usd`) then, never a wrong number.
79
82
  */
80
83
  export declare function wrunMarkQtyInUnits(qty: number, price: number, valuePerUnit: number | undefined): number | undefined;
81
- /** A number in a batched format: `compact` is Big Trades 0.3.2's caption ("1.2M", "1.2K", a whole
82
- * number from 100, one decimal from 1, two below 1), `usd` the same after a "$" ("$12M", "-$1.2K"),
83
- * `units` compact (a mark's quantity reaches it converted, `wrunMarkQtyInUnits`), `int` the rounded
84
- * whole number, `price` the pane's price; a negative value keeps its sign. Not finite: '-'. */
84
+ /** A number in a batched format, as the engine captions it: `compact` is Big Trades 0.3.2's caption ("1.2B", "1.2M",
85
+ * "1.2K", a whole number from 100, one decimal from 1, two below 1), `usd` the same after a "$" ("$12M", "-$1.2K"),
86
+ * `units` compact (a mark's quantity reaches it converted, `wrunMarkQtyInUnits`), `int` the whole number (a half
87
+ * away from zero, never "-0"), `price` the pane's price; a negative value keeps its sign. Not finite: '-' (the
88
+ * caption draws nothing). */
85
89
  export declare function formatWrunBatchedNumber(value: number, format: WrunBatchedNumberFormat | 'amount', formatPrice: (value: number) => string): string;
86
90
  /**
87
91
  * A batched record's tooltip (WRUN-BATCHED-MARKS): `{{name}}` or `{{name:<format>}}`, a word of
@@ -92,7 +96,10 @@ export declare function formatWrunBatchedNumber(value: number, format: WrunBatch
92
96
  * price), both `{{length}}` (the length in bars, default int) and `{{word}}` (the section's word the meta
93
97
  * names, '' when none); a timed record (stride 5) `{{start}}` and `{{end}}` in place of `{{length}}`,
94
98
  * each the time as the chart prints it (`formatters.formatTime`, else wrun-chart-time.util shifted by
95
- * the display offset the mount door stamped on the readout), its meta its fifth field; `{{label}}` is
99
+ * the display offset the mount door stamped on the readout, read at that time), its meta its fifth field; flags read
100
+ * `{{qty}}` and `{{price}}` as marks do, `{{count}}` (default int) and `{{word}}` (the chip text: the
101
+ * template the meta's word names, its own `{{qty}}` (default compact, the chip's caption), `{{price}}` and
102
+ * `{{count}}` printed from the same record; '' when none); `{{label}}` is
96
103
  * the readout's title. A placeholder
97
104
  * the record does not read, or a format word outside the list, stays as written; a hole (a
98
105
  * non-finite field) prints '-'.