@orangecharts/wrun-chart-host 0.2.0 → 0.4.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 (342) hide show
  1. package/README.md +22 -8
  2. package/dist/constants/common.constants.d.ts +15 -0
  3. package/dist/constants/common.constants.js +23 -0
  4. package/dist/constants/data-source.constants.d.ts +1 -0
  5. package/dist/constants/data-source.constants.js +1 -0
  6. package/dist/constants/economic.constants.d.ts +39 -0
  7. package/dist/constants/economic.constants.js +77 -0
  8. package/dist/constants/etf-covered-coins.constants.d.ts +1 -0
  9. package/dist/constants/etf-covered-coins.constants.js +9 -0
  10. package/dist/constants/feature-flags.constants.d.ts +60 -0
  11. package/dist/constants/feature-flags.constants.js +308 -0
  12. package/dist/constants/feature-limits.constants.d.ts +134 -0
  13. package/dist/constants/feature-limits.constants.js +155 -0
  14. package/dist/constants/marketCapabilities.constants.d.ts +87 -0
  15. package/dist/constants/marketCapabilities.constants.js +213 -0
  16. package/dist/constants/option-venues.constants.d.ts +100 -0
  17. package/dist/constants/option-venues.constants.js +167 -0
  18. package/dist/constants/overlay-data.constants.d.ts +53 -0
  19. package/dist/constants/overlay-data.constants.js +80 -0
  20. package/dist/constants/pane-grid.constants.d.ts +15 -0
  21. package/dist/constants/pane-grid.constants.js +17 -0
  22. package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +133 -0
  23. package/dist/constants/scriptEditor/builtin-script-snippets.js +451 -0
  24. package/dist/constants/venue-presets.constants.d.ts +10 -0
  25. package/dist/constants/venue-presets.constants.js +22 -0
  26. package/dist/enums/chart.enum.d.ts +68 -0
  27. package/dist/enums/chart.enum.js +70 -0
  28. package/dist/helpers/data.helpers.d.ts +2 -0
  29. package/dist/helpers/data.helpers.js +14 -0
  30. package/dist/host-env.d.ts +163 -5
  31. package/dist/host-ports.types.d.ts +431 -0
  32. package/dist/host-ports.types.js +1 -0
  33. package/dist/index.d.ts +138 -0
  34. package/dist/index.js +138 -0
  35. package/dist/indicators/controls/technical-script/technical-script-input-rendering.d.ts +86 -0
  36. package/dist/indicators/controls/technical-script/technical-script-input-rendering.js +179 -0
  37. package/dist/interfaces/asset-venue.interface.d.ts +91 -0
  38. package/dist/interfaces/asset-venue.interface.js +1 -0
  39. package/dist/interfaces/cancel-reason.interface.d.ts +24 -0
  40. package/dist/interfaces/cancel-reason.interface.js +2 -0
  41. package/dist/interfaces/catalog-display.interface.d.ts +3 -0
  42. package/dist/interfaces/catalog-display.interface.js +1 -0
  43. package/dist/interfaces/cme-realtime.interface.d.ts +251 -0
  44. package/dist/interfaces/cme-realtime.interface.js +46 -0
  45. package/dist/interfaces/feed.interface.d.ts +80 -0
  46. package/dist/interfaces/feed.interface.js +7 -0
  47. package/dist/interfaces/market-kind.interface.d.ts +8 -0
  48. package/dist/interfaces/market-kind.interface.js +1 -0
  49. package/dist/interfaces/opra-realtime.interface.d.ts +224 -0
  50. package/dist/interfaces/opra-realtime.interface.js +105 -0
  51. package/dist/interfaces/option-instrument.interface.d.ts +32 -0
  52. package/dist/interfaces/option-instrument.interface.js +1 -0
  53. package/dist/interfaces/options-chain-scope.interface.d.ts +29 -0
  54. package/dist/interfaces/options-chain-scope.interface.js +7 -0
  55. package/dist/interfaces/prediction-market.interface.d.ts +88 -0
  56. package/dist/interfaces/prediction-market.interface.js +8 -0
  57. package/dist/interfaces/wrun-runtime.interface.d.ts +5 -0
  58. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +185 -0
  59. package/dist/kscript-data/controls/live-trades-merge.util.js +357 -0
  60. package/dist/settings-templates/frvp-fields.d.ts +27 -0
  61. package/dist/settings-templates/frvp-fields.js +108 -0
  62. package/dist/settings-templates/index.d.ts +119 -0
  63. package/dist/settings-templates/index.js +442 -0
  64. package/dist/settings-templates/indicator-fields.d.ts +56 -0
  65. package/dist/settings-templates/indicator-fields.js +793 -0
  66. package/dist/settings-templates/tool-rules.d.ts +59 -0
  67. package/dist/settings-templates/tool-rules.js +49 -0
  68. package/dist/settings-templates/tool-tables.generated.d.ts +2 -0
  69. package/dist/settings-templates/tool-tables.generated.js +1668 -0
  70. package/dist/utility/blk-market.util.d.ts +5 -0
  71. package/dist/utility/blk-market.util.js +12 -0
  72. package/dist/utility/chart/chart-load-phase.util.d.ts +32 -0
  73. package/dist/utility/chart/chart-load-phase.util.js +78 -0
  74. package/dist/utility/chart/cme-cache-context.util.d.ts +108 -0
  75. package/dist/utility/chart/cme-cache-context.util.js +166 -0
  76. package/dist/utility/chart/cme-session-bucket.util.d.ts +82 -0
  77. package/dist/utility/chart/cme-session-bucket.util.js +343 -0
  78. package/dist/utility/chart/cme-trade-calendar.util.d.ts +26 -0
  79. package/dist/utility/chart/cme-trade-calendar.util.js +147 -0
  80. package/dist/utility/chart/continuous-contracts.util.d.ts +138 -0
  81. package/dist/utility/chart/continuous-contracts.util.js +374 -0
  82. package/dist/utility/chart/date-labelled-interval.leaf.d.ts +15 -0
  83. package/dist/utility/chart/date-labelled-interval.leaf.js +19 -0
  84. package/dist/utility/chart/feed-interval.util.d.ts +119 -0
  85. package/dist/utility/chart/feed-interval.util.js +321 -0
  86. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +110 -0
  87. package/dist/utility/chart/fetch-dedupe-policy.util.js +407 -0
  88. package/dist/utility/chart/footprint-band.util.d.ts +76 -0
  89. package/dist/utility/chart/footprint-band.util.js +205 -0
  90. package/dist/utility/chart/footprint-cell-identity.util.d.ts +82 -0
  91. package/dist/utility/chart/footprint-cell-identity.util.js +346 -0
  92. package/dist/utility/chart/formula-calendar.util.d.ts +27 -0
  93. package/dist/utility/chart/formula-calendar.util.js +59 -0
  94. package/dist/utility/chart/history-wall.util.d.ts +67 -0
  95. package/dist/utility/chart/history-wall.util.js +87 -0
  96. package/dist/utility/chart/index-mode.util.d.ts +66 -0
  97. package/dist/utility/chart/index-mode.util.js +360 -0
  98. package/dist/utility/chart/indicator-coverage-planner.util.d.ts +217 -0
  99. package/dist/utility/chart/indicator-coverage-planner.util.js +443 -0
  100. package/dist/utility/chart/indicator-coverage-state.util.d.ts +33 -0
  101. package/dist/utility/chart/indicator-coverage-state.util.js +110 -0
  102. package/dist/utility/chart/indicator-gap-detector.util.d.ts +127 -0
  103. package/dist/utility/chart/indicator-gap-detector.util.js +260 -0
  104. package/dist/utility/chart/indicator-gap-repair.util.d.ts +88 -0
  105. package/dist/utility/chart/indicator-gap-repair.util.js +177 -0
  106. package/dist/utility/chart/indicator-inflight-registry.util.d.ts +26 -0
  107. package/dist/utility/chart/indicator-inflight-registry.util.js +254 -0
  108. package/dist/utility/chart/indicator-run-interval.util.d.ts +130 -0
  109. package/dist/utility/chart/indicator-run-interval.util.js +268 -0
  110. package/dist/utility/chart/interval-registry.util.d.ts +23 -0
  111. package/dist/utility/chart/interval-registry.util.js +83 -0
  112. package/dist/utility/chart/kscript-main-grid-stages.util.d.ts +21 -0
  113. package/dist/utility/chart/kscript-main-grid-stages.util.js +332 -0
  114. package/dist/utility/chart/legacy-exchange.leaf.d.ts +11 -0
  115. package/dist/utility/chart/legacy-exchange.leaf.js +43 -0
  116. package/dist/utility/chart/live-bucket.util.d.ts +66 -0
  117. package/dist/utility/chart/live-bucket.util.js +165 -0
  118. package/dist/utility/chart/market-session-schedule.util.d.ts +91 -0
  119. package/dist/utility/chart/market-session-schedule.util.js +337 -0
  120. package/dist/utility/chart/marketKind.util.d.ts +181 -0
  121. package/dist/utility/chart/marketKind.util.js +371 -0
  122. package/dist/utility/chart/opra-read-access.leaf.d.ts +26 -0
  123. package/dist/utility/chart/opra-read-access.leaf.js +25 -0
  124. package/dist/utility/chart/prediction-identity.util.d.ts +159 -0
  125. package/dist/utility/chart/prediction-identity.util.js +236 -0
  126. package/dist/utility/chart/rth-session.util.d.ts +352 -0
  127. package/dist/utility/chart/rth-session.util.js +926 -0
  128. package/dist/utility/chart/titan-constants.pin.d.ts +43 -0
  129. package/dist/utility/chart/titan-constants.pin.js +50 -0
  130. package/dist/utility/chart/us-equities-session.util.d.ts +127 -0
  131. package/dist/utility/chart/us-equities-session.util.js +251 -0
  132. package/dist/utility/chart/window-geometry.leaf.d.ts +119 -0
  133. package/dist/utility/chart/window-geometry.leaf.js +391 -0
  134. package/dist/utility/chart/window-owner.leaf.d.ts +19 -0
  135. package/dist/utility/chart/window-owner.leaf.js +24 -0
  136. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +100 -0
  137. package/dist/utility/chart/wrun-bar-session-facts.util.js +354 -0
  138. package/dist/utility/chart/wrun-wire-ref.util.d.ts +23 -0
  139. package/dist/utility/chart/wrun-wire-ref.util.js +16 -0
  140. package/dist/utility/common/safe-math-eval.d.ts +18 -0
  141. package/dist/utility/common/safe-math-eval.js +160 -0
  142. package/dist/utility/common/time.util.d.ts +134 -0
  143. package/dist/utility/common/time.util.js +428 -0
  144. package/dist/utility/common/transformations.util.d.ts +126 -0
  145. package/dist/utility/common/transformations.util.js +711 -0
  146. package/dist/utility/common/visible-timeout.util.d.ts +17 -0
  147. package/dist/utility/common/visible-timeout.util.js +75 -0
  148. package/dist/utility/exchange-normalization.util.d.ts +8 -0
  149. package/dist/utility/exchange-normalization.util.js +32 -0
  150. package/dist/utility/html-escape.leaf.d.ts +11 -0
  151. package/dist/utility/html-escape.leaf.js +20 -0
  152. package/dist/utility/intl-locale.util.d.ts +2 -0
  153. package/dist/utility/intl-locale.util.js +28 -0
  154. package/dist/utility/number-format.util.d.ts +14 -1
  155. package/dist/utility/number-format.util.js +50 -19
  156. package/dist/utility/options/option-symbol.util.d.ts +28 -0
  157. package/dist/utility/options/option-symbol.util.js +176 -0
  158. package/dist/utility/options/option-trade-units.util.d.ts +190 -0
  159. package/dist/utility/options/option-trade-units.util.js +283 -0
  160. package/dist/utility/options/option-venue.util.d.ts +75 -0
  161. package/dist/utility/options/option-venue.util.js +85 -0
  162. package/dist/utility/pool-symbol.leaf.d.ts +34 -0
  163. package/dist/utility/pool-symbol.leaf.js +95 -0
  164. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +109 -0
  165. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +302 -0
  166. package/dist/utility/symbol-selection/contract-expiry.util.d.ts +39 -0
  167. package/dist/utility/symbol-selection/contract-expiry.util.js +111 -0
  168. package/dist/utility/v2/gate-plane.util.d.ts +58 -0
  169. package/dist/utility/v2/gate-plane.util.js +99 -0
  170. package/dist/utility/v2/gate-session-latch.util.d.ts +22 -0
  171. package/dist/utility/v2/gate-session-latch.util.js +34 -0
  172. package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +76 -0
  173. package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +221 -0
  174. package/dist/utility/wrun/sources/host-grid-landing.d.ts +15 -0
  175. package/dist/utility/wrun/sources/host-grid-landing.js +26 -0
  176. package/dist/utility/wrun/sources/lanes/bitfinex_funding.d.ts +27 -0
  177. package/dist/utility/wrun/sources/lanes/bitfinex_funding.js +85 -0
  178. package/dist/utility/wrun/sources/lanes/economic.d.ts +27 -0
  179. package/dist/utility/wrun/sources/lanes/economic.js +79 -0
  180. package/dist/utility/wrun/sources/lanes/etf_holdings.d.ts +35 -0
  181. package/dist/utility/wrun/sources/lanes/etf_holdings.js +165 -0
  182. package/dist/utility/wrun/sources/lanes/etf_premium.d.ts +19 -0
  183. package/dist/utility/wrun/sources/lanes/etf_premium.js +114 -0
  184. package/dist/utility/wrun/sources/lanes/ethena_positions.d.ts +30 -0
  185. package/dist/utility/wrun/sources/lanes/ethena_positions.js +51 -0
  186. package/dist/utility/wrun/sources/lanes/index.d.ts +2 -0
  187. package/dist/utility/wrun/sources/lanes/index.js +32 -0
  188. package/dist/utility/wrun/sources/lanes/long_short_ratio.d.ts +17 -0
  189. package/dist/utility/wrun/sources/lanes/long_short_ratio.js +47 -0
  190. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +58 -0
  191. package/dist/utility/wrun/sources/lanes/option_daily.js +111 -0
  192. package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +27 -0
  193. package/dist/utility/wrun/sources/lanes/option_stats_10m.js +21 -0
  194. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +50 -0
  195. package/dist/utility/wrun/sources/lanes/options_flow.js +155 -0
  196. package/dist/utility/wrun/sources/lanes/options_oi.d.ts +29 -0
  197. package/dist/utility/wrun/sources/lanes/options_oi.js +59 -0
  198. package/dist/utility/wrun/sources/lanes/options_volume.d.ts +38 -0
  199. package/dist/utility/wrun/sources/lanes/options_volume.js +63 -0
  200. package/dist/utility/wrun/sources/lanes/series.d.ts +67 -0
  201. package/dist/utility/wrun/sources/lanes/series.js +321 -0
  202. package/dist/utility/wrun/sources/lanes/token_supply.d.ts +30 -0
  203. package/dist/utility/wrun/sources/lanes/token_supply.js +145 -0
  204. package/dist/utility/wrun/sources/lanes/treasury_balance.d.ts +25 -0
  205. package/dist/utility/wrun/sources/lanes/treasury_balance.js +47 -0
  206. package/dist/utility/wrun/sources/lanes/volatility_index.d.ts +21 -0
  207. package/dist/utility/wrun/sources/lanes/volatility_index.js +11 -0
  208. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +215 -0
  209. package/dist/utility/wrun/sources/opra-option-lanes.util.js +477 -0
  210. package/dist/utility/wrun/sources/registry.d.ts +21 -0
  211. package/dist/utility/wrun/sources/registry.js +237 -0
  212. package/dist/utility/wrun/sources/row-lane-registry.d.ts +28 -0
  213. package/dist/utility/wrun/sources/row-lane-registry.js +230 -0
  214. package/dist/utility/wrun/sources/row-lanes/index.d.ts +2 -0
  215. package/dist/utility/wrun/sources/row-lanes/index.js +12 -0
  216. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +2 -0
  217. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +38 -0
  218. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +55 -0
  219. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +126 -0
  220. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +4 -0
  221. package/dist/utility/wrun/sources/row-lanes/option_prints.js +191 -0
  222. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +62 -0
  223. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +147 -0
  224. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +70 -0
  225. package/dist/utility/wrun/sources/row-lanes/option_surface.js +144 -0
  226. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +309 -0
  227. package/dist/utility/wrun/sources/wrun-poll-lane.types.js +26 -0
  228. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +350 -0
  229. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +576 -0
  230. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +275 -0
  231. package/dist/utility/wrun/sources/wrun-row-lane.types.js +16 -0
  232. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +207 -0
  233. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +450 -0
  234. package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +28 -0
  235. package/dist/utility/wrun/wrun-browser-sources.leaf.js +66 -0
  236. package/dist/utility/wrun/wrun-cloud-record.util.d.ts +65 -0
  237. package/dist/utility/wrun/wrun-cloud-record.util.js +121 -0
  238. package/dist/utility/wrun/wrun-daily-lane.util.d.ts +95 -0
  239. package/dist/utility/wrun/wrun-daily-lane.util.js +297 -0
  240. package/dist/utility/wrun/wrun-deadline.util.d.ts +52 -0
  241. package/dist/utility/wrun/wrun-deadline.util.js +82 -0
  242. package/dist/utility/wrun/wrun-etf-flow-lane.util.d.ts +94 -0
  243. package/dist/utility/wrun/wrun-etf-flow-lane.util.js +224 -0
  244. package/dist/utility/wrun/wrun-etf-funds.util.d.ts +82 -0
  245. package/dist/utility/wrun/wrun-etf-funds.util.js +242 -0
  246. package/dist/utility/wrun/wrun-frames.d.ts +20 -1
  247. package/dist/utility/wrun/wrun-frames.js +103 -49
  248. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  249. package/dist/utility/wrun/wrun-hosted-wire-caps.js +27 -0
  250. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +22 -0
  251. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +32 -0
  252. package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +18 -0
  253. package/dist/utility/wrun/wrun-lane-warmup.util.js +112 -0
  254. package/dist/utility/wrun/wrun-leg-close.util.d.ts +57 -0
  255. package/dist/utility/wrun/wrun-leg-close.util.js +187 -0
  256. package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +144 -0
  257. package/dist/utility/wrun/wrun-leg-fetch.util.js +212 -0
  258. package/dist/utility/wrun/wrun-leg-stream-classes.d.ts +73 -0
  259. package/dist/utility/wrun/wrun-leg-stream-classes.js +86 -0
  260. package/dist/utility/wrun/wrun-levels-child.util.d.ts +101 -6
  261. package/dist/utility/wrun/wrun-levels-child.util.js +335 -157
  262. package/dist/utility/wrun/wrun-memory-clamp.util.d.ts +33 -0
  263. package/dist/utility/wrun/wrun-memory-clamp.util.js +146 -0
  264. package/dist/utility/wrun/wrun-odds-template-market.util.d.ts +51 -0
  265. package/dist/utility/wrun/wrun-odds-template-market.util.js +251 -0
  266. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +65 -0
  267. package/dist/utility/wrun/wrun-opra-flow.leaf.js +94 -0
  268. package/dist/utility/wrun/wrun-opra-lane.util.d.ts +47 -0
  269. package/dist/utility/wrun/wrun-opra-lane.util.js +58 -0
  270. package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +49 -0
  271. package/dist/utility/wrun/wrun-opra-stats.leaf.js +115 -0
  272. package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +12 -0
  273. package/dist/utility/wrun/wrun-opra-underlying.util.js +1 -0
  274. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +142 -0
  275. package/dist/utility/wrun/wrun-option-contract-flow.util.js +451 -0
  276. package/dist/utility/wrun/wrun-option-knobs.util.d.ts +43 -0
  277. package/dist/utility/wrun/wrun-option-knobs.util.js +81 -0
  278. package/dist/utility/wrun/wrun-option-prints.util.d.ts +144 -0
  279. package/dist/utility/wrun/wrun-option-prints.util.js +356 -0
  280. package/dist/utility/wrun/wrun-option-summary-lane.util.d.ts +102 -0
  281. package/dist/utility/wrun/wrun-option-summary-lane.util.js +143 -0
  282. package/dist/utility/wrun/wrun-options-chain.util.d.ts +308 -0
  283. package/dist/utility/wrun/wrun-options-chain.util.js +502 -0
  284. package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +9 -4
  285. package/dist/utility/wrun/wrun-overlay-identity.util.js +16 -6
  286. package/dist/utility/wrun/wrun-panel-mount.lazy.d.ts +10 -0
  287. package/dist/utility/wrun/wrun-panel-mount.lazy.js +68 -0
  288. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +377 -0
  289. package/dist/utility/wrun/wrun-panel-mount.util.js +2251 -0
  290. package/dist/utility/wrun/wrun-param-map.util.d.ts +298 -0
  291. package/dist/utility/wrun/wrun-param-map.util.js +581 -0
  292. package/dist/utility/wrun/wrun-pause-dim.util.d.ts +52 -0
  293. package/dist/utility/wrun/wrun-pause-dim.util.js +153 -0
  294. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +149 -0
  295. package/dist/utility/wrun/wrun-pin-spelling.util.js +523 -0
  296. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +116 -0
  297. package/dist/utility/wrun/wrun-pin-venues.util.js +320 -0
  298. package/dist/utility/wrun/wrun-pinned-interval.util.d.ts +20 -0
  299. package/dist/utility/wrun/wrun-pinned-interval.util.js +47 -0
  300. package/dist/utility/wrun/wrun-plot-gate.types.d.ts +23 -0
  301. package/dist/utility/wrun/wrun-plot-gate.types.js +7 -0
  302. package/dist/utility/wrun/wrun-present-bits.util.d.ts +37 -0
  303. package/dist/utility/wrun/wrun-present-bits.util.js +73 -0
  304. package/dist/utility/wrun/wrun-protocol-pending.util.d.ts +33 -0
  305. package/dist/utility/wrun/wrun-protocol-pending.util.js +57 -0
  306. package/dist/utility/wrun/wrun-refusal.util.d.ts +41 -1
  307. package/dist/utility/wrun/wrun-refusal.util.js +69 -2
  308. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +1 -14
  309. package/dist/utility/wrun/wrun-registry-errors.util.js +0 -16
  310. package/dist/utility/wrun/wrun-row-source.d.ts +158 -0
  311. package/dist/utility/wrun/wrun-row-source.js +75 -0
  312. package/dist/utility/wrun/wrun-run-health.util.d.ts +155 -0
  313. package/dist/utility/wrun/wrun-run-health.util.js +273 -0
  314. package/dist/utility/wrun/wrun-run-interval-projection.types.d.ts +14 -0
  315. package/dist/utility/wrun/wrun-run-interval-projection.types.js +1 -0
  316. package/dist/utility/wrun/wrun-socket-row-source.d.ts +439 -0
  317. package/dist/utility/wrun/wrun-socket-row-source.js +1689 -0
  318. package/dist/utility/wrun/wrun-socket-session-losses.util.d.ts +18 -0
  319. package/dist/utility/wrun/wrun-socket-session-losses.util.js +25 -0
  320. package/dist/utility/wrun/wrun-source-rows.util.d.ts +911 -0
  321. package/dist/utility/wrun/wrun-source-rows.util.js +2597 -0
  322. package/dist/utility/wrun/wrun-tape-source.util.d.ts +82 -0
  323. package/dist/utility/wrun/wrun-tape-source.util.js +151 -0
  324. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +137 -0
  325. package/dist/utility/wrun/wrun-tier-grid.util.js +279 -0
  326. package/dist/utility/wrun/wrun-trades-lane.util.d.ts +52 -0
  327. package/dist/utility/wrun/wrun-trades-lane.util.js +58 -0
  328. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +41 -0
  329. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +66 -0
  330. package/dist/utility/wrun-display-name.util.d.ts +33 -0
  331. package/dist/utility/wrun-display-name.util.js +64 -0
  332. package/dist/workers/constants/kscript-transport-codes.d.ts +15 -0
  333. package/dist/workers/constants/kscript-transport-codes.js +15 -0
  334. package/dist/workers/constants/socket-slots.d.ts +574 -0
  335. package/dist/workers/constants/socket-slots.js +539 -0
  336. package/dist/workers/utils/number.worker.util.d.ts +5 -0
  337. package/dist/workers/utils/number.worker.util.js +10 -0
  338. package/dist/workers/utils/time.worker.util.d.ts +12 -0
  339. package/dist/workers/utils/time.worker.util.js +24 -0
  340. package/dist/workers/utils/volume-profile.worker.util.d.ts +200 -0
  341. package/dist/workers/utils/volume-profile.worker.util.js +631 -0
  342. package/package.json +10 -4
@@ -10,7 +10,11 @@
10
10
  * unresolved (a theme token rides to the mount door) and every font word
11
11
  * resolved to its CSS stack (X14: the engine never sees a font word). The
12
12
  * run-result translator calls them per level, after `wrunSharedLevelsScale`
13
- * once per run (DL-scale "shared").
13
+ * once per run (DL-scale "shared"). Both are one builder over a layout,
14
+ * the pane frame or the spans (WRUN-OI-PROFILE D6): a word reaches both
15
+ * children unless `WRUN_LEVELS_WORD_REACH` says it is a pane word, and
16
+ * each span's own value area, POC price and tag ride in titan's
17
+ * `span_levels`, keyed by the span's bounds.
14
18
  * - `checkWrunLevelsFrame` restates the kit's `validateWrunLevelsFrame`
15
19
  * cross-checks (X22) for the render selection, refused as
16
20
  * `wrun_frame_invalid`.
@@ -45,6 +49,73 @@ export function wrunLevelsLowerPaneId(overlayId) {
45
49
  export function isWrunLevelsSpansFrame(frame) {
46
50
  return frame !== null && typeof frame === 'object' && Array.isArray(frame.spans);
47
51
  }
52
+ /**
53
+ * Every `plot.levels` word (the sheet's `levels[]` keys) and where it
54
+ * reaches (D6). The pane child and the spans child are one builder
55
+ * (`levelsChildOf`), so a word reaches both unless this table says `pane`:
56
+ * the words that place, size or band a dock on the pane edge. `offset`
57
+ * (`offset_px`) and `beside` place it, `width_px` sizes it (a span takes
58
+ * `width_frac` of its own width) and `step` bands its rows (cells 4 and 5 of
59
+ * a span row hold the span's bounds). `scale` reaches both, but "shared"
60
+ * compares docks on the pane across the run, so a span keeps its own
61
+ * maximum ("fixed" reaches both). The typecheck refuses a word the
62
+ * declaration type gains until it has a row here, and
63
+ * tests/utility/wrun/wrun-levels-child.reach.spec.ts builds both children
64
+ * with every word and pins what each one sends.
65
+ */
66
+ export const WRUN_LEVELS_WORD_REACH = {
67
+ name: 'both',
68
+ frame: 'both',
69
+ dock: 'both',
70
+ width_frac: 'both',
71
+ poc: 'both',
72
+ labels: 'both',
73
+ color: 'both',
74
+ panel: 'both',
75
+ behind_candles: 'both',
76
+ opacity: 'both',
77
+ baseline: 'both',
78
+ series: 'both',
79
+ step: 'pane',
80
+ thickness_px: 'both',
81
+ width_px: 'pane',
82
+ scale: 'both',
83
+ scale_max: 'both',
84
+ offset: 'pane',
85
+ beside: 'pane',
86
+ format: 'both',
87
+ decimals: 'both',
88
+ signed: 'both',
89
+ unit: 'both',
90
+ text_color: 'both',
91
+ font_size: 'both',
92
+ font_weight: 'both',
93
+ font_family: 'both',
94
+ label_place: 'both',
95
+ hover: 'both',
96
+ poc_color: 'both',
97
+ poc_width: 'both',
98
+ poc_line_style: 'both',
99
+ poc_extend: 'both',
100
+ poc_label: 'both',
101
+ outside_opacity: 'both',
102
+ value_area_color: 'both',
103
+ value_area_width: 'both',
104
+ value_area_line_style: 'both',
105
+ value_area_labels: 'both',
106
+ tag_place: 'both',
107
+ gradient: 'both',
108
+ gradient_direction: 'both',
109
+ border_color: 'both',
110
+ border_width: 'both',
111
+ border_style: 'both',
112
+ shape: 'both',
113
+ span: 'both',
114
+ };
115
+ /** True when the word reaches the child being built (`time`: a span "time" child). */
116
+ function reaches(word, time) {
117
+ return !time || WRUN_LEVELS_WORD_REACH[word] === 'both';
118
+ }
48
119
  // ---------------------------------------------------------------------------
49
120
  // Row cells
50
121
  // ---------------------------------------------------------------------------
@@ -89,17 +160,17 @@ function valueTextOf(level, value, priceDigits) {
89
160
  priceDigits,
90
161
  });
91
162
  }
92
- function segmentAt(frame, series, row) {
93
- const value = frame.series?.[series]?.[row];
163
+ function segmentAt(group, series, row) {
164
+ const value = group.series?.[series]?.[row];
94
165
  return typeof value === 'number' && Number.isFinite(value) ? value : null;
95
166
  }
96
- /** Cell 3 (DL-row-text): the frame's text for the row, `""` for no label,
167
+ /** Cell 3 (DL-row-text): the group's text for the row, `""` for no label,
97
168
  * null (or no `labels_text`) for the value text (DL-value-format). */
98
- function rowLabel(level, frame, row, priceDigits) {
99
- const text = frame.labels_text?.[row];
169
+ function rowLabel(level, group, row, priceDigits) {
170
+ const text = group.labels_text?.[row];
100
171
  if (typeof text === 'string')
101
172
  return text === '' ? null : text;
102
- return valueTextOf(level, frame.values[row], priceDigits);
173
+ return valueTextOf(level, group.values[row], priceDigits);
103
174
  }
104
175
  /** Cells 4 and 5 (DL-even-grid): the frame's own band for the row, else the
105
176
  * declared `step` around the price, else no band. */
@@ -116,33 +187,93 @@ function hasRowBands(frame, step) {
116
187
  return ((frame.lows !== undefined && frame.highs !== undefined) ||
117
188
  (typeof step === 'number' && Number.isFinite(step) && step > 0));
118
189
  }
119
- /** Labels are on when declared, or when the frame carries `labels_text` and
190
+ /** Labels are on when declared, or when a group carries `labels_text` and
120
191
  * the declaration does not say `labels: false` (the om series-lane rule). */
121
- function labelsOn(level, frame) {
122
- return level.labels === true || (frame.labels_text !== undefined && level.labels !== false);
123
- }
124
- /** The rows of a pane frame on row contract v2: `[price, value, color?,
125
- * label?, band_low?, band_high?, seg_0 .. seg_(k-1)]`. Every row of one
126
- * child has the same width: today's two or three cells when nothing new is
127
- * declared, else the cells up to the last one any row of the child can
128
- * carry (absent cells are null). Cell 2 is null on a segmented record (the
129
- * segments carry their series colours). */
130
- function paneRows(level, frame, labelled, priceDigits) {
131
- const segments = level.series?.length ?? 0;
132
- const bands = hasRowBands(frame, level.step);
133
- const width = segments > 0 ? 6 + segments : bands ? 6 : labelled ? 4 : frame.colors !== undefined ? 3 : 2;
134
- return frame.prices.map((price, row) => {
135
- const cells = [price, frame.values[row] ?? null];
136
- if (width > 2)
137
- cells.push(segments > 0 ? null : (frame.colors?.[row] ?? null));
138
- if (width > 3)
139
- cells.push(labelled ? rowLabel(level, frame, row, priceDigits) : null);
140
- if (width > 4)
141
- cells.push(...rowBand(frame, row, price, level.step));
142
- for (let series = 0; series < segments; series += 1)
143
- cells.push(segmentAt(frame, series, row));
144
- return cells;
145
- });
192
+ function labelsOn(level, groups) {
193
+ return level.labels === true || (level.labels !== false && groups.some((group) => group.labels_text !== undefined));
194
+ }
195
+ /** A group's value area, when it carries both prices. */
196
+ function hasValueArea(group) {
197
+ const area = group.value_area;
198
+ return Array.isArray(area) && typeof area[0] === 'number' && typeof area[1] === 'number';
199
+ }
200
+ /** A span's bounds in ms: its rows' cells 4 and 5 and its `span_levels` key. */
201
+ function spanBoundsMs(span) {
202
+ return [span.start * 1000, span.end * 1000];
203
+ }
204
+ function laidGroups(level, layout) {
205
+ if (layout.span === 'time') {
206
+ return layout.spans.map((span) => {
207
+ const bounds = spanBoundsMs(span);
208
+ return { rows: span, cells45: () => bounds, tooltip: () => undefined };
209
+ });
210
+ }
211
+ const { frame } = layout;
212
+ return [
213
+ {
214
+ rows: frame,
215
+ cells45: (row, price) => rowBand(frame, row, price, level.step),
216
+ tooltip: (row) => (typeof frame.tooltips?.[row] === 'string' ? frame.tooltips[row] : undefined),
217
+ },
218
+ ];
219
+ }
220
+ /**
221
+ * The series a child draws as stacked segments (DL-stacked): the declared series on the pane frame (which must
222
+ * carry them), and under span "time" only when its spans carry their own `series` (every span or none:
223
+ * checkWrunLevelsFrame refuses a mixed frame, as titan segments a whole child). A span frame none of whose spans
224
+ * carry them draws plain bars in the spans' own colours, as before the per-span fields, so a published package
225
+ * whose level declares series keeps drawing.
226
+ */
227
+ function drawnSeries(level, layout) {
228
+ const declared = level.series ?? [];
229
+ if (layout.span === 'pane' || declared.length === 0)
230
+ return declared;
231
+ return layout.spans.some((span) => span.series !== undefined) ? declared : [];
232
+ }
233
+ /**
234
+ * The rows of a child on row contract v2: `[price, value, color?, label?,
235
+ * cell4?, cell5?, seg_0 .. seg_(k-1)]`, every group's rows in order. Every
236
+ * row of one child has the same width: a pane child keeps today's two or
237
+ * three cells when nothing new is declared, else the cells up to the last
238
+ * one any row of the child can carry; a span row always carries its bounds
239
+ * (titan's span "time" contract `[price, value, color, label, startMs,
240
+ * endMs, seg_0 ..]`). Absent cells are null; cell 2 is null on a segmented
241
+ * record (the segments carry their series colours). The hover inputs ride
242
+ * beside, one per row in the same order (the engine reports the row's index
243
+ * in the sender's data).
244
+ */
245
+ function levelsRows(level, layout, labelled, priceDigits) {
246
+ const segments = drawnSeries(level, layout).length;
247
+ const groups = laidGroups(level, layout);
248
+ // Cells 4 and 5 carry a span's bounds always, a pane row's band when any row has one.
249
+ const cells45 = layout.span === 'time' || hasRowBands(layout.frame, level.step);
250
+ const colored = groups.some((group) => group.rows.colors !== undefined);
251
+ const width = segments > 0 || cells45 ? 6 + segments : labelled ? 4 : colored ? 3 : 2;
252
+ const data = [];
253
+ const hover = [];
254
+ for (const group of groups) {
255
+ const { rows } = group;
256
+ rows.prices.forEach((price, row) => {
257
+ const value = rows.values[row] ?? null;
258
+ const cells = [price, value];
259
+ if (width > 2)
260
+ cells.push(segments > 0 ? null : (rows.colors?.[row] ?? null));
261
+ if (width > 3)
262
+ cells.push(labelled ? rowLabel(level, rows, row, priceDigits) : null);
263
+ if (width > 4)
264
+ cells.push(...group.cells45(row, price));
265
+ const segmentCells = [];
266
+ for (let series = 0; series < segments; series += 1)
267
+ segmentCells.push(segmentAt(rows, series, row));
268
+ cells.push(...segmentCells);
269
+ data.push(cells);
270
+ if (level.hover !== true)
271
+ return;
272
+ const tooltip = group.tooltip(row);
273
+ hover.push({ price, value, segments: segmentCells, ...(tooltip !== undefined ? { tooltip } : {}) });
274
+ });
275
+ }
276
+ return { data, hover };
146
277
  }
147
278
  /** The hover rows of a child (DL-hover): one per frame row, in frame order
148
279
  * (the engine reports the row's index in the sender's data). */
@@ -164,13 +295,14 @@ function hoverRowsOf(level, rows, priceDigits) {
164
295
  // ---------------------------------------------------------------------------
165
296
  /** The paint keys shared by the pane and the spans child, each sent only
166
297
  * when declared (every default stays the engine's): fill alpha, label ink
167
- * and font (the family as a CSS stack), POC and value-area style, gradient,
168
- * borders and the outline shape. A colour picked on the Style page paints
169
- * the bars, as it does over the frame's row colours (style-rows audit item
170
- * 5): the gradient stops, which titan lays on every row without a colour of
171
- * its own, and an outline's border colour, its only stroke and drawn in
172
- * place of the level colour, are not sent then; a bars-shape border only
173
- * frames the picked fill and stays. */
298
+ * and font (the family as a CSS stack), POC style, gradient, borders, the
299
+ * outline shape and where the VAH, VAL and POC tags sit (`tag_place`, D8).
300
+ * A colour picked on the Style page paints the bars, as it does over the
301
+ * frame's row colours (style-rows audit item 5): the gradient stops, which
302
+ * titan lays on every row without a colour of its own, and an outline's
303
+ * border colour, its only stroke and drawn in place of the level colour,
304
+ * are not sent then; a bars-shape border only frames the picked fill and
305
+ * stays. */
174
306
  function styleSettings(level) {
175
307
  const out = {};
176
308
  const picked = isWrunLevelsColorPicked(level);
@@ -215,8 +347,22 @@ function styleSettings(level) {
215
347
  out.border_style = level.border_style;
216
348
  if (level.shape !== undefined)
217
349
  out.shape = level.shape;
350
+ // D8: absent keeps the engine's "inner" (today's place).
351
+ if (level.tag_place !== undefined)
352
+ out.tag_place = level.tag_place;
218
353
  return out;
219
354
  }
355
+ /** The value-area style keys (DL-value-area), each sent only when declared;
356
+ * the children send them only beside a value area. */
357
+ function valueAreaStyle(level) {
358
+ return {
359
+ ...(level.outside_opacity !== undefined ? { outside_opacity: level.outside_opacity } : {}),
360
+ ...(level.value_area_color !== undefined ? { value_area_color: level.value_area_color } : {}),
361
+ ...(level.value_area_width !== undefined ? { value_area_width: level.value_area_width } : {}),
362
+ ...(level.value_area_line_style !== undefined ? { value_area_line_style: level.value_area_line_style } : {}),
363
+ ...(level.value_area_labels !== undefined ? { value_area_labels: level.value_area_labels } : {}),
364
+ };
365
+ }
220
366
  /** Today's six door keys in today's order, so an unstyled sheet keeps its
221
367
  * bytes: dock, width_frac, thickness_px, poc, labels, color. */
222
368
  function baseSettings(level, thickness, labels) {
@@ -229,14 +375,45 @@ function baseSettings(level, thickness, labels) {
229
375
  ...(level.color !== undefined ? { color: level.color } : {}),
230
376
  };
231
377
  }
232
- /** The scale denominator (DL-scale): "fixed" takes the frame's `scale_max`
233
- * over the declared one, "shared" the run's largest shared extent (the
234
- * level's own when the run passed none), "own" sends nothing. */
235
- function scaleMaxOf(level, frame, ctx) {
378
+ /** One group's own levels (see WrunLevelsSpanLevels). */
379
+ function groupLevels(group) {
380
+ const area = group.value_area;
381
+ return {
382
+ ...(group.poc_price !== undefined ? { poc_price: group.poc_price } : {}),
383
+ ...(group.poc_label_text !== undefined ? { poc_label_text: group.poc_label_text } : {}),
384
+ ...(area !== undefined && hasValueArea(group) ? { value_area_low: area[0], value_area_high: area[1] } : {}),
385
+ };
386
+ }
387
+ /**
388
+ * The spans' own levels as titan's `span_levels` (D6): one entry per span
389
+ * that carries a level of its own, keyed by the span's bounds in ms
390
+ * (`WrunLevelsSpanLevelsEntry`), in frame order. Two spans with one pair of
391
+ * bounds are one span to the engine, so they share one entry, the first
392
+ * field of each kind among them winning. Undefined when no span carries
393
+ * any, so a sheet without per-span fields keeps its bytes.
394
+ */
395
+ function spanLevelsOf(spans) {
396
+ const byBounds = new Map();
397
+ for (const span of spans) {
398
+ const own = groupLevels(span);
399
+ if (Object.keys(own).length === 0)
400
+ continue;
401
+ const [start, end] = spanBoundsMs(span);
402
+ const key = `${start}:${end}`;
403
+ const first = byBounds.get(key);
404
+ byBounds.set(key, first === undefined ? { start, end, ...own } : { ...own, ...first });
405
+ }
406
+ return byBounds.size > 0 ? [...byBounds.values()] : undefined;
407
+ }
408
+ /** The scale denominator (DL-scale): "fixed" takes the pane frame's
409
+ * `scale_max` over the declared one (a spans frame carries none), "shared"
410
+ * the run's largest shared extent on the pane (the level's own when the run
411
+ * passed none; a span keeps its own maximum), "own" sends nothing. */
412
+ function scaleMaxOf(level, layout, ctx) {
236
413
  if (level.scale === 'fixed')
237
- return frame.scale_max ?? level.scale_max;
238
- if (level.scale === 'shared')
239
- return ctx.sharedScaleMax ?? ownExtent(level, frame);
414
+ return layout.span === 'pane' ? (layout.frame.scale_max ?? level.scale_max) : level.scale_max;
415
+ if (level.scale === 'shared' && layout.span === 'pane')
416
+ return ctx.sharedScaleMax ?? ownExtent(level, layout.frame);
240
417
  return undefined;
241
418
  }
242
419
  /** A level's own extent: the largest value (or positive segment sum) under
@@ -272,127 +449,105 @@ function ownExtent(level, frame) {
272
449
  });
273
450
  return extent !== undefined && extent > 0 ? extent : undefined;
274
451
  }
275
- // ---------------------------------------------------------------------------
276
- // The children
277
- // ---------------------------------------------------------------------------
278
452
  /**
279
- * The docked child of one `plot.levels` declaration over its pane frame
280
- * (span "pane"): rows on row contract v2 and every door key of g2, colour
281
- * words unresolved. Null without a frame (no snapshot written yet).
453
+ * The door settings of a child: today's base keys in today's order, then
454
+ * every declared word the child takes, colour words unresolved. A pane-only
455
+ * word (`WRUN_LEVELS_WORD_REACH`) goes out on the pane child only. The pane
456
+ * frame's own value area, POC price and tag are door keys; under span "time"
457
+ * each span's ride in `span_levels`, and the value-area style keys go out
458
+ * when any span carries a value area.
282
459
  */
283
- export function wrunLevelsChild(level, frame, ctx) {
284
- if (frame === null || frame === undefined)
285
- return null;
286
- // A colour picked on the Style page paints every row: the frame's own
287
- // per-row colours apply only while the level keeps its declared colour
288
- // (wrun-style-flags.util, set by the settings seam in wrun-color-settings.util).
289
- const view = isWrunLevelsColorPicked(level) && frame.colors !== undefined ? { ...frame, colors: undefined } : frame;
290
- const labelled = labelsOn(level, view);
291
- const bands = hasRowBands(view, level.step);
292
- // DL-thickness: a declared thickness wins; a banded row needs no ladder cap
293
- // (the band is the row's own height); else today's sparse-ladder rule.
294
- const thickness = level.thickness_px ?? (bands ? undefined : ladderThicknessPx(view.prices));
295
- const segments = level.series ?? [];
296
- const scaleMax = scaleMaxOf(level, view, ctx);
297
- const valueArea = view.value_area;
298
- const hasValueArea = Array.isArray(valueArea) && typeof valueArea[0] === 'number' && typeof valueArea[1] === 'number';
299
- const pocLabel = level.poc_label === true || view.poc_label_text !== undefined;
300
- const settings = {
460
+ function levelsSettings(level, layout, labelled, thickness, ctx) {
461
+ const time = layout.span === 'time';
462
+ const groups = layout.span === 'time' ? layout.spans : [layout.frame];
463
+ const segments = drawnSeries(level, layout);
464
+ const own = layout.span === 'pane' ? groupLevels(layout.frame) : undefined;
465
+ const pocLabel = level.poc_label === true || groups.some((group) => group.poc_label_text !== undefined);
466
+ const scaleMax = scaleMaxOf(level, layout, ctx);
467
+ const spanLevels = layout.span === 'time' ? spanLevelsOf(layout.spans) : undefined;
468
+ const offsetPx = reaches('offset', time) && level.offset !== undefined && typeof level.offset[0] === 'number'
469
+ ? level.offset[0]
470
+ : undefined;
471
+ return {
301
472
  ...baseSettings(level, thickness, labelled ? true : level.labels),
473
+ ...(time ? { span: 'time' } : {}),
302
474
  ...(level.baseline === 'center' ? { baseline: 'center' } : {}),
303
475
  ...(segments.length > 0 ? { segment_colors: segments.map((entry) => entry.color) } : {}),
304
476
  ...(labelled ? { label_fallback: 'none' } : {}),
305
- ...(hasValueArea
306
- ? {
307
- value_area_low: valueArea[0],
308
- value_area_high: valueArea[1],
309
- ...(level.outside_opacity !== undefined ? { outside_opacity: level.outside_opacity } : {}),
310
- ...(level.value_area_color !== undefined ? { value_area_color: level.value_area_color } : {}),
311
- ...(level.value_area_width !== undefined ? { value_area_width: level.value_area_width } : {}),
312
- ...(level.value_area_line_style !== undefined ? { value_area_line_style: level.value_area_line_style } : {}),
313
- ...(level.value_area_labels !== undefined ? { value_area_labels: level.value_area_labels } : {}),
314
- }
477
+ ...(own?.value_area_low !== undefined
478
+ ? { value_area_low: own.value_area_low, value_area_high: own.value_area_high }
315
479
  : {}),
316
- ...(level.offset !== undefined && typeof level.offset[0] === 'number' ? { offset_px: level.offset[0] } : {}),
317
- ...(level.beside !== undefined ? { beside: level.beside } : {}),
480
+ ...(groups.some(hasValueArea) ? valueAreaStyle(level) : {}),
481
+ ...(offsetPx !== undefined ? { offset_px: offsetPx } : {}),
482
+ ...(reaches('beside', time) && level.beside !== undefined ? { beside: level.beside } : {}),
318
483
  ...(pocLabel ? { poc_label: true } : {}),
319
- ...(view.poc_price !== undefined ? { poc_price: view.poc_price } : {}),
320
- ...(view.poc_label_text !== undefined ? { poc_label_text: view.poc_label_text } : {}),
321
- ...(level.width_px !== undefined ? { width_px: level.width_px } : {}),
484
+ ...(own?.poc_price !== undefined ? { poc_price: own.poc_price } : {}),
485
+ ...(own?.poc_label_text !== undefined ? { poc_label_text: own.poc_label_text } : {}),
486
+ ...(reaches('width_px', time) && level.width_px !== undefined ? { width_px: level.width_px } : {}),
322
487
  ...(scaleMax !== undefined ? { scale_max: scaleMax } : {}),
323
488
  ...styleSettings(level),
489
+ ...(spanLevels !== undefined ? { span_levels: spanLevels } : {}),
324
490
  };
491
+ }
492
+ // ---------------------------------------------------------------------------
493
+ // The children
494
+ // ---------------------------------------------------------------------------
495
+ /** The one builder both children are (D6): rows, door settings, the
496
+ * lower-pane choice and the hover rows of a layout. */
497
+ function levelsChildOf(level, layout, ctx) {
498
+ const groups = layout.span === 'time' ? layout.spans : [layout.frame];
499
+ const labelled = labelsOn(level, groups);
500
+ const bands = layout.span === 'pane' && hasRowBands(layout.frame, level.step);
501
+ // DL-thickness: a declared thickness wins; a banded row needs no ladder cap
502
+ // (the band is the row's own height); else the sparse-ladder rule over
503
+ // every group (a span "time" level caps when any span is a ladder).
504
+ const ladder = groups.some((group) => ladderThicknessPx(group.prices) !== undefined);
505
+ const thickness = level.thickness_px ?? (bands || !ladder ? undefined : WRUN_LEVELS_LADDER_THICKNESS_PX);
506
+ const { data, hover } = levelsRows(level, layout, labelled, ctx.priceDigits);
325
507
  const child = {
326
508
  kind: 'levels',
327
509
  name: level.name,
328
- data: paneRows(level, view, labelled, ctx.priceDigits),
329
- settings,
510
+ data,
511
+ settings: levelsSettings(level, layout, labelled, thickness, ctx),
330
512
  };
331
513
  if (level.panel === 'lower')
332
514
  child.panel = 'lower';
333
- if (level.hover === true) {
334
- child.hover = hoverRowsOf(level, view.prices.map((price, row) => ({
335
- price,
336
- value: view.values[row] ?? null,
337
- segments: segments.map((_entry, series) => segmentAt(view, series, row)),
338
- ...(typeof view.tooltips?.[row] === 'string' ? { tooltip: view.tooltips[row] } : {}),
339
- })), ctx.priceDigits);
340
- }
515
+ if (level.hover === true)
516
+ child.hover = hoverRowsOf(level, hover, ctx.priceDigits);
341
517
  return child;
342
518
  }
519
+ /**
520
+ * The docked child of one `plot.levels` declaration over its pane frame
521
+ * (span "pane"): rows on row contract v2 and every door key of g2, colour
522
+ * words unresolved. Null without a frame (no snapshot written yet).
523
+ */
524
+ export function wrunLevelsChild(level, frame, ctx) {
525
+ if (frame === null || frame === undefined)
526
+ return null;
527
+ // A colour picked on the Style page paints every row: the frame's own
528
+ // per-row colours apply only while the level keeps its declared colour
529
+ // (wrun-style-flags.util, set by the settings seam in wrun-color-settings.util).
530
+ const view = isWrunLevelsColorPicked(level) && frame.colors !== undefined ? { ...frame, colors: undefined } : frame;
531
+ return levelsChildOf(level, { span: 'pane', frame: view }, ctx);
532
+ }
343
533
  /**
344
534
  * The docked child of a span "time" declaration (DL-time-anchored): every
345
- * span's rows concatenated as `[price, value, color?, label?, startMs,
346
- * endMs]`, settings `span: 'time'` beside today's levels settings and the
347
- * shared paint keys. Null without a frame.
535
+ * span's rows as `[price, value, color, label, startMs, endMs, seg_0 ..]`
536
+ * in frame order (the segments when a span carries `series`: drawnSeries),
537
+ * settings `span: 'time'` beside every word the pane child
538
+ * sends except the pane-only ones (D6, `WRUN_LEVELS_WORD_REACH`), each
539
+ * span's own value area, POC price and tag in `span_levels`, keyed by the
540
+ * span's bounds. Null without a frame.
348
541
  */
349
542
  export function wrunLevelsSpansChild(level, frame, ctx) {
350
543
  if (frame === null || frame === undefined)
351
544
  return null;
352
545
  // The pane child's rule: a colour picked on the Style page paints every
353
546
  // span's rows, the frame's own per-row colours apply at the declared colour.
354
- const view = isWrunLevelsColorPicked(level)
355
- ? { ...frame, spans: frame.spans.map((span) => ({ ...span, colors: undefined })) }
356
- : frame;
357
- const labelled = level.labels === true;
358
- const thickness = level.thickness_px ??
359
- (view.spans.some((span) => ladderThicknessPx(span.prices) !== undefined)
360
- ? WRUN_LEVELS_LADDER_THICKNESS_PX
361
- : undefined);
362
- const data = [];
363
- const hoverRows = [];
364
- for (const span of view.spans) {
365
- const startMs = span.start * 1000;
366
- const endMs = span.end * 1000;
367
- span.prices.forEach((price, row) => {
368
- const value = span.values[row] ?? null;
369
- data.push([
370
- price,
371
- value,
372
- span.colors?.[row] ?? null,
373
- labelled ? valueTextOf(level, value, ctx.priceDigits) : null,
374
- startMs,
375
- endMs,
376
- ]);
377
- hoverRows.push({ price, value, segments: [] });
378
- });
379
- }
380
- const child = {
381
- kind: 'levels',
382
- name: level.name,
383
- data,
384
- settings: {
385
- ...baseSettings(level, thickness, level.labels),
386
- span: 'time',
387
- ...(labelled ? { label_fallback: 'none' } : {}),
388
- ...styleSettings(level),
389
- },
390
- };
391
- if (level.panel === 'lower')
392
- child.panel = 'lower';
393
- if (level.hover === true)
394
- child.hover = hoverRowsOf(level, hoverRows, ctx.priceDigits);
395
- return child;
547
+ const spans = isWrunLevelsColorPicked(level)
548
+ ? frame.spans.map((span) => ({ ...span, colors: undefined }))
549
+ : frame.spans;
550
+ return levelsChildOf(level, { span: 'time', spans }, ctx);
396
551
  }
397
552
  /**
398
553
  * The run's shared scale (DL-scale): the largest own extent over the
@@ -414,12 +569,39 @@ export function wrunSharedLevelsScale(levels, frames) {
414
569
  }
415
570
  return largest;
416
571
  }
572
+ /** The DL-stacked cross-checks of one group against the declared series:
573
+ * the pane frame (its messages as today), or one span (`path`
574
+ * `spans.<k>`, the message prefixed with the key's path, as the kit host
575
+ * prints a cross-check). A span is checked only when it carries `series`
576
+ * (every span or none: checkWrunLevelsFrame); the pane frame must carry
577
+ * them when the level declares any. */
578
+ function checkLevelSeries(level, group, slot, path) {
579
+ const owner = `level '${level.name ?? '?'}'`;
580
+ const at = (key) => (path === undefined ? '' : `${path}.${key}: `);
581
+ const declared = level.series?.length ?? 0;
582
+ if (group.series !== undefined) {
583
+ if (declared === 0) {
584
+ invalidWrunFrame(slot, `${at('series')}${owner} declares no series: the frame cannot carry series`);
585
+ }
586
+ if (group.series.length !== declared) {
587
+ invalidWrunFrame(slot, `${at('series')}${owner} declares ${declared} series: the frame must carry ${declared} series arrays, not ${group.series.length}`);
588
+ }
589
+ if (group.colors !== undefined) {
590
+ invalidWrunFrame(slot, `${at('colors')}colors and series do not mix: a segmented row takes its series colours`);
591
+ }
592
+ }
593
+ else if (declared > 0 && path === undefined) {
594
+ invalidWrunFrame(slot, `${at('series')}${owner} declares ${declared} series: the frame must carry series`);
595
+ }
596
+ }
417
597
  /**
418
598
  * The declaration cross-checks of a parsed levels frame (the kit's
419
599
  * `validateWrunLevelsFrame`, restated per X22 with its messages): the shape
420
600
  * the level's `span` takes (DL-time-anchored), `series` against the declared
421
- * series and `colors` beside `series` (DL-stacked), `scale_max` needing scale
422
- * "fixed" (DL-scale). Throws `wrun_frame_invalid: slot '<slot>': <message>`.
601
+ * series and `colors` beside `series` (DL-stacked, per span on the spans
602
+ * shape, where every span carries `series` or none does), `scale_max`
603
+ * needing scale "fixed" (DL-scale). Throws
604
+ * `wrun_frame_invalid: slot '<slot>': <message>`.
423
605
  */
424
606
  export function checkWrunLevelsFrame(level, frame, slot) {
425
607
  const owner = `level '${level.name ?? '?'}'`;
@@ -428,26 +610,22 @@ export function checkWrunLevelsFrame(level, frame, slot) {
428
610
  if (span !== 'time') {
429
611
  invalidWrunFrame(slot, `${owner} has span 'pane': its frame takes prices and values, not spans`);
430
612
  }
613
+ // Every span carries `series` or none does (the kit's DL-span-levels rule): none draws every span's rows whole,
614
+ // as every frame did before spans could carry them, so a published package whose level declares series keeps
615
+ // drawing; all holds each span to the declared series. A mixed frame refuses by name at the first span that
616
+ // differs from the first: titan segments a whole child, so a span without series there would draw no bar.
617
+ const first = frame.spans[0]?.series === undefined;
618
+ const mixed = frame.spans.findIndex((entry) => (entry.series === undefined) !== first);
619
+ if (mixed >= 0)
620
+ invalidWrunFrame(slot, `spans.${mixed}.series: every span carries series or none does`);
621
+ frame.spans.forEach((entry, k) => checkLevelSeries(level, entry, slot, `spans.${k}`));
431
622
  return;
432
623
  }
433
624
  if (span === 'time') {
434
625
  invalidWrunFrame(slot, `${owner} has span 'time': its frame takes spans, not prices and values`);
435
626
  }
436
627
  const view = frame;
437
- const declared = level.series?.length ?? 0;
438
- if (view.series !== undefined) {
439
- if (declared === 0)
440
- invalidWrunFrame(slot, `${owner} declares no series: the frame cannot carry series`);
441
- if (view.series.length !== declared) {
442
- invalidWrunFrame(slot, `${owner} declares ${declared} series: the frame must carry ${declared} series arrays, not ${view.series.length}`);
443
- }
444
- if (view.colors !== undefined) {
445
- invalidWrunFrame(slot, 'colors and series do not mix: a segmented row takes its series colours');
446
- }
447
- }
448
- else if (declared > 0) {
449
- invalidWrunFrame(slot, `${owner} declares ${declared} series: the frame must carry series`);
450
- }
628
+ checkLevelSeries(level, view, slot);
451
629
  if (view.scale_max !== undefined && level.scale !== 'fixed') {
452
630
  invalidWrunFrame(slot, `scale_max needs scale 'fixed' on ${owner}`);
453
631
  }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Clamp-at-load for a wrun module's linear memory: the browser twin of the hosted lane's
3
+ * `validateAndClampWrunMemory` (kscript-backend wrun-host.ts), same rules, same splice.
4
+ *
5
+ * The worker's memory check (checkMemoryLimit in wrun-abi-host) reads the memory only AFTER a
6
+ * guest call returns, and the modules the compiler emits declare their memory with no maximum,
7
+ * so one onBar() call could grow the memory to hundreds of MB before that check ran. Bounding
8
+ * the memory in the module itself closes that hole: the engine then refuses memory.grow past
9
+ * the maximum INSIDE the call (the guest traps) and never commits the pages.
10
+ *
11
+ * - a declared memory with NO maximum is rewritten to carry maximum = the limit in pages,
12
+ * with zero toolchain or republish churn (requiring authors to declare one would refuse
13
+ * every package already published);
14
+ * - a declared maximum above the limit, a starting size above it, shared or 64-bit memory,
15
+ * a maximum below the starting size, or a memory count other than one are refused;
16
+ * - a module that declares no memory, or a maximum within the limit, comes back unchanged
17
+ * (the very same bytes object).
18
+ *
19
+ * The rewrite is a minimal LEB128 splice of the memory section; every other byte of the module
20
+ * is untouched. Callers compile the RETURNED bytes.
21
+ */
22
+ /** The memory one wrun module may hold in the browser, the one source of the 4 MiB: the worker's
23
+ * ceiling (WRUN_DEFAULT_MEMORY_LIMIT_BYTES in wrun-abi-host) reads it from here: this module
24
+ * imports nothing, while the main thread imports the worker host for its types only. */
25
+ export declare const WRUN_MEMORY_LIMIT_BYTES: number;
26
+ /** The limit as the maximum stamped on a module's memory: 64 pages. */
27
+ export declare const WRUN_MEMORY_LIMIT_PAGES: number;
28
+ /**
29
+ * Validate a wrun module's memory against the limit and clamp an absent maximum to it. Returns
30
+ * the bytes to COMPILE: the same object when nothing needed rewriting, else a copy whose memory
31
+ * section carries maximum = the limit in pages. Throws a plain-words Error on a refusal.
32
+ */
33
+ export declare function clampWrunModuleMemory(bytes: Uint8Array, limitBytes?: number): Uint8Array;