@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
@@ -0,0 +1,391 @@
1
+ /**
2
+ * Window geometry: how the owner's panes share a window cell (window-cell.util).
3
+ *
4
+ * A leaf with no app import: window-geometry.util re-exports every name here and adds the one entry that reads the
5
+ * cell's owner (`reconcileWindowGeometry`, through the cell readers, whose draft windows are reactive). The child
6
+ * mount (wrun-panel-mount.util) reads the plan, the saved split and the owner reconcile, and it moves into the wrun
7
+ * chart-host package, which titan's constants may not reach: the engine minimum comes from the titan constants pin
8
+ * (titan-constants.pin, which a spec compares with the installed engine's). The reader's hold and the reversal stay
9
+ * beside the owner reconcile: the three share the one map of held windows.
10
+ *
11
+ * A window is a chart cell whose candle pane the window host hid
12
+ * (useWrunWindowCell, through the pane-only main helper) so the owner's
13
+ * child panes (`::panel:*`, `::series:*`) and, for a lower-only package, the
14
+ * owner's own offchart pane fill the whole cell. The engine carves a pane's
15
+ * height at addOverlay only and, with main hidden, splits the visible panes
16
+ * evenly; neither knows a table from a time series. This module is the ONE
17
+ * place that decides the window's weights (planWindowWeights) and the ONE
18
+ * writer that applies them to already-mounted panes (reconcileWindowOwnerGeometry, the cell entry's step)
19
+ * through the same height path the offchart restore uses (meta.gridHeight +
20
+ * settings.gridHeight + updateSettings + resizeCanvasOnce).
21
+ *
22
+ * Rule (plan section 2.2): tables at their content height (panelGridHeight)
23
+ * but all tables together at most WINDOW_TABLES_MAX_TOTAL of the cell;
24
+ * chart-shaped panels ('chart') and time panes ('time': the lower series pane
25
+ * or an offchart owner) split the remainder equally; everything normalized to
26
+ * sum 1; no pane under the engine minimum (MIN_GRID_HEIGHT_ALLOWED): when the
27
+ * base rule leaves panes under it they are pinned at the minimum and the
28
+ * largest pane absorbs the difference (cascading to the next largest when the
29
+ * largest cannot). More panes than the minimum allows (n x min > 1, eight
30
+ * panes and up) can satisfy no engine carve: the plan is the even split then,
31
+ * which is what the engine falls back to on its own.
32
+ *
33
+ * Main is never written here: the host owns hide and restore, and the
34
+ * reconcile writes only while main is hidden, so a visible candle pane is
35
+ * never squeezed by sum-1 weights. A cell without a flagged owner never gets
36
+ * a write (isWindowCell gates the entry).
37
+ *
38
+ * The reader's own split outranks the plan. The reconcile runs at the end of
39
+ * EVERY run of the owner (the child mount calls it on each live tick), so a
40
+ * plan that re-asserts itself there undoes a splitter drag within one tick.
41
+ * A drag in a window (the engine's `resize-grids`, which nothing else emits)
42
+ * is a hold (holdWindowPaneHeights): the dragged heights become the panes'
43
+ * requests and the reconcile writes no weight while the same panes are
44
+ * mounted. A pane joining or leaving, a re-mounted pane, the reversal and a
45
+ * rebuilt engine all end the hold, and the plan applies again.
46
+ *
47
+ * The hold is memory; the split outlives it in the document. The hold hands
48
+ * back the dragged weights keyed relative to the owner (`self`, `panel:<name>`,
49
+ * `series:<name>`), the host writes them to the OWNER row as
50
+ * `settings.wrunWindowSplit` (window-cell.util; the children have no rows),
51
+ * and savedWindowSplit reads them back only while they name exactly the
52
+ * mounted panes: the child mount asks for them (no flash of the plan after a
53
+ * reload) and the reconcile, when nothing is held, takes them as the plan. So
54
+ * a re-mount over the same pane ids keeps the reader's split (their intent
55
+ * outranks the plan), a pane joining or leaving makes the split stop matching
56
+ * and the plan applies, and Show chart deletes it with the flag.
57
+ */
58
+ import { PANEL_CHART_GRID_HEIGHT, panelGridHeight } from './om-panel.util.js';
59
+ import { MIN_GRID_HEIGHT_ALLOWED } from './titan-constants.pin.js';
60
+ import { WRUN_WINDOW_SPLIT_SETTING } from './window-owner.leaf.js';
61
+ import { wrunChildOverlayParentId } from '../wrun/wrun-child-overlay-id.util.js';
62
+ /** The split key of a window pane: `self` for the owner, a child's id past `<owner>::`. */
63
+ export function windowSplitKeyOf(paneId) {
64
+ const parent = wrunChildOverlayParentId(paneId);
65
+ return parent === null ? 'self' : paneId.slice(parent.length + 2);
66
+ }
67
+ /** A record of at least one finite positive weight: the only shape the split reader and writer accept. */
68
+ export function isWindowSplit(value) {
69
+ if (value === null || typeof value !== 'object' || Array.isArray(value))
70
+ return false;
71
+ const weights = Object.values(value);
72
+ return (weights.length > 0 && weights.every((weight) => typeof weight === 'number' && Number.isFinite(weight) && weight > 0));
73
+ }
74
+ /** The engine's pane minimum: a carve under it is refused. */
75
+ export const WINDOW_PANE_MIN_GRID_HEIGHT = MIN_GRID_HEIGHT_ALLOWED;
76
+ /** All tables of a window together take at most half the cell. */
77
+ export const WINDOW_TABLES_MAX_TOTAL = 0.5;
78
+ /** Heights closer than this are the same height: the in-place refresh rule's
79
+ * tolerance (samePanelPane) and the reconcile's write threshold. */
80
+ export const WINDOW_GRID_HEIGHT_TOLERANCE = 0.005;
81
+ /** panelGridHeight reads the panel's kind only. */
82
+ const TABLE_PANEL = { kind: 'table' };
83
+ const WEIGHT_DECIMALS = 4;
84
+ function roundWeight(value) {
85
+ const scale = 10 ** WEIGHT_DECIMALS;
86
+ return Math.round(value * scale) / scale;
87
+ }
88
+ /** Round every weight to 4 decimals; the rounding remainder rides the largest pane so the set sums to 1. */
89
+ function roundWeightsToOne(weights) {
90
+ const rounded = weights.map(roundWeight);
91
+ const sum = rounded.reduce((total, weight) => total + weight, 0);
92
+ const largest = rounded.reduce((best, weight, at) => (weight > rounded[best] ? at : best), 0);
93
+ rounded[largest] = roundWeight(rounded[largest] + (1 - sum));
94
+ return rounded;
95
+ }
96
+ /** Pin every pane under the minimum at the minimum; the largest absorbs the
97
+ * deficit, the next largest what the largest cannot give without dropping
98
+ * under the minimum itself. Only called when n x min <= 1: the panes above
99
+ * the minimum then always hold enough slack, so one pass settles. */
100
+ function applyFloor(weights) {
101
+ const out = [...weights];
102
+ const min = WINDOW_PANE_MIN_GRID_HEIGHT;
103
+ const epsilon = 1e-9;
104
+ let deficit = 0;
105
+ const pinned = new Set();
106
+ out.forEach((weight, at) => {
107
+ if (weight < min - epsilon) {
108
+ deficit += min - weight;
109
+ out[at] = min;
110
+ pinned.add(at);
111
+ }
112
+ });
113
+ if (deficit <= epsilon)
114
+ return out;
115
+ const donors = out
116
+ .map((weight, at) => ({ weight, at }))
117
+ .filter(({ at }) => !pinned.has(at))
118
+ .sort((a, b) => b.weight - a.weight);
119
+ for (const donor of donors) {
120
+ if (deficit <= epsilon)
121
+ break;
122
+ const give = Math.min(deficit, out[donor.at] - min);
123
+ if (give <= 0)
124
+ continue;
125
+ out[donor.at] -= give;
126
+ deficit -= give;
127
+ }
128
+ return out;
129
+ }
130
+ /**
131
+ * The window's weights for a pane set, in the given order. Pure: the same
132
+ * panes and canvas height always plan the same weights (the reconcile's
133
+ * idempotence and the first mount's no-flash both rest on that).
134
+ */
135
+ export function planWindowWeights(panes, canvasHeightPx) {
136
+ const count = panes.length;
137
+ if (count === 0)
138
+ return [];
139
+ let weights;
140
+ if (count * WINDOW_PANE_MIN_GRID_HEIGHT > 1 + 1e-9) {
141
+ // No plan satisfies the engine minimum: the even split, the engine's own fallback.
142
+ weights = panes.map(() => 1 / count);
143
+ }
144
+ else {
145
+ const tableAt = panes.map((pane) => pane.kind === 'table');
146
+ const tableRaw = panes.map((pane) => pane.kind === 'table' ? panelGridHeight(TABLE_PANEL, Math.max(0, pane.rows ?? 0), canvasHeightPx) : 0);
147
+ const tableTotal = tableRaw.reduce((sum, weight) => sum + weight, 0);
148
+ const others = tableAt.filter((isTable) => !isTable).length;
149
+ if (others === 0) {
150
+ // Tables only: they are the whole cell.
151
+ weights = tableRaw.map((weight) => weight / tableTotal);
152
+ }
153
+ else {
154
+ const tablesShare = Math.min(tableTotal, WINDOW_TABLES_MAX_TOTAL);
155
+ const otherShare = (1 - tablesShare) / others;
156
+ weights = panes.map((pane, at) => pane.kind === 'table' ? (tableRaw[at] * tablesShare) / tableTotal : otherShare);
157
+ }
158
+ weights = applyFloor(weights);
159
+ }
160
+ const rounded = roundWeightsToOne(weights);
161
+ return panes.map((pane, at) => ({ id: pane.id, gridHeight: rounded[at] }));
162
+ }
163
+ /** The body rows of a table pane (a mounted meta or an addOverlay config):
164
+ * its one decorator row's grid minus the header; undefined when unreadable. */
165
+ export function tableRowCountOf(pane) {
166
+ const rows = (pane.rawData ?? pane.data);
167
+ if (!Array.isArray(rows))
168
+ return undefined;
169
+ const payload = rows[0]?.[1];
170
+ const grid = payload?.data;
171
+ return Array.isArray(grid) ? Math.max(0, grid.length - 1) : undefined;
172
+ }
173
+ /** Whether a mounted meta occupies its own band in the window: an offchart
174
+ * pane of the owner (the owner itself or one of its children), not pane
175
+ * hidden, not hosted inside another pane. */
176
+ function isWindowPaneMeta(meta, ownerId) {
177
+ if (meta.type !== 'offchart' || meta.isPaneHidden === true || meta.hostPaneId)
178
+ return false;
179
+ return meta.id === ownerId || wrunChildOverlayParentId(meta.id) === ownerId;
180
+ }
181
+ /** The owner's mounted window pane metas, in stack order. */
182
+ function windowPaneMetas(metadata, ownerId) {
183
+ return metadata.filter((meta) => isWindowPaneMeta(meta, ownerId));
184
+ }
185
+ /** A window pane meta as the planner reads it. */
186
+ function windowPaneOf(meta, ownerId) {
187
+ if (meta.id === ownerId || meta.id.includes('::series:'))
188
+ return { id: meta.id, kind: 'time' };
189
+ if (meta.plot === 'table')
190
+ return { id: meta.id, kind: 'table', rows: tableRowCountOf(meta) };
191
+ return { id: meta.id, kind: 'chart' };
192
+ }
193
+ /** The owner's mounted window panes, in stack order, classified for the planner. */
194
+ export function mountedWindowPanes(metadata, ownerId) {
195
+ return windowPaneMetas(metadata, ownerId).map((meta) => windowPaneOf(meta, ownerId));
196
+ }
197
+ /** Whether the candle pane is hidden on this engine: the window layout is in force. */
198
+ export function isMainPaneHidden(metadata) {
199
+ const main = metadata.find((meta) => meta.id === 'main') ?? metadata[0];
200
+ return main?.isPaneHidden === true;
201
+ }
202
+ /** Engine to its held window. Weak: a rebuilt engine starts on the plan. */
203
+ const windowHolds = new WeakMap();
204
+ /** Whether the reader's split still stands: a hold for this owner over exactly
205
+ * the pane metas mounted now. Anything else (a pane joined, left or was
206
+ * re-mounted) ends the hold. */
207
+ function isWindowHeld(tc, ownerId, metas) {
208
+ const hold = windowHolds.get(tc);
209
+ if (!hold)
210
+ return false;
211
+ if (hold.ownerId === ownerId && hold.panes.size === metas.length && metas.every((meta) => hold.panes.has(meta))) {
212
+ return true;
213
+ }
214
+ windowHolds.delete(tc);
215
+ return false;
216
+ }
217
+ /**
218
+ * The reader dragged a splitter in a window (the engine's `resize-grids`):
219
+ * the heights on the engine are theirs now. They become the panes' requests
220
+ * (under a hidden main the engine re-splits the stack from
221
+ * `settings.gridHeight` on every pane add, removal, collapse and focus exit,
222
+ * so a request left at the plan would undo the drag there), and the plan
223
+ * stands down: reconcileWindowOwnerGeometry writes no weight until the pane
224
+ * set changes. No engine call: the drag already laid the panes out, and this
225
+ * runs on every drag move. Silent on a normal chart (main visible) and for an
226
+ * owner without a pane. Returns the held weights as the window's split
227
+ * (WindowSplit: keyed relative to the owner, normalized to 1, rounded), the
228
+ * value the host writes to the owner row; undefined when nothing is held, or
229
+ * when a held pane has no usable height yet (nothing worth saving).
230
+ */
231
+ export function holdWindowPaneHeights(tc, ownerId) {
232
+ if (!tc || tc.isDestroyed)
233
+ return undefined;
234
+ if (!isMainPaneHidden(tc.metadata))
235
+ return undefined;
236
+ const metas = windowPaneMetas(tc.metadata, ownerId);
237
+ if (metas.length === 0)
238
+ return undefined;
239
+ const heights = [];
240
+ for (const meta of metas) {
241
+ const height = meta.gridHeight;
242
+ if (typeof height !== 'number' || !Number.isFinite(height) || height <= 0)
243
+ continue;
244
+ const settings = (meta.settings ??= {});
245
+ if (settings.gridHeight !== height)
246
+ settings.gridHeight = height;
247
+ heights.push(height);
248
+ }
249
+ windowHolds.set(tc, { ownerId, panes: new Set(metas) });
250
+ if (heights.length !== metas.length)
251
+ return undefined;
252
+ const total = heights.reduce((sum, height) => sum + height, 0);
253
+ const weights = roundWeightsToOne(heights.map((height) => height / total));
254
+ return Object.fromEntries(metas.map((meta, at) => [windowSplitKeyOf(meta.id), weights[at]]));
255
+ }
256
+ /**
257
+ * The reader's saved split for the panes mounted now: the owner's
258
+ * `settings.wrunWindowSplit` read back as weights in the panes' order, only
259
+ * when its key set equals the mounted pane set exactly (renormalized to 1,
260
+ * the engine minimum applied, rounded like the plan). Anything else is
261
+ * undefined and the plan applies: a split saved over other panes (one joined
262
+ * or left since), a malformed value, or more panes than the minimum allows
263
+ * (no split satisfies the engine then; the plan is the even split). Pure.
264
+ */
265
+ export function savedWindowSplit(ownerSettings, panes) {
266
+ const saved = ownerSettings?.[WRUN_WINDOW_SPLIT_SETTING];
267
+ if (!isWindowSplit(saved) || panes.length === 0)
268
+ return undefined;
269
+ if (panes.length * WINDOW_PANE_MIN_GRID_HEIGHT > 1 + 1e-9)
270
+ return undefined;
271
+ const keys = panes.map((pane) => windowSplitKeyOf(pane.id));
272
+ if (new Set(keys).size !== keys.length || Object.keys(saved).length !== keys.length)
273
+ return undefined;
274
+ if (!keys.every((key) => Object.prototype.hasOwnProperty.call(saved, key)))
275
+ return undefined;
276
+ const raw = keys.map((key) => saved[key]);
277
+ const total = raw.reduce((sum, weight) => sum + weight, 0);
278
+ const weights = roundWeightsToOne(applyFloor(raw.map((weight) => weight / total)));
279
+ return panes.map((pane, at) => ({ id: pane.id, gridHeight: weights[at] }));
280
+ }
281
+ /**
282
+ * Apply the window plan to the OWNER's already-mounted panes: every pane whose
283
+ * engine height is off the plan by WINDOW_GRID_HEIGHT_TOLERANCE or more takes
284
+ * the planned height through the offchart height path, then one resize.
285
+ * Writes nothing while the candle pane is visible (the host hides it first;
286
+ * sum-1 weights beside a visible main would squeeze the candles), and no
287
+ * weight while the reader's own split holds (holdWindowPaneHeights). With
288
+ * nothing held, the reader's saved split (savedWindowSplit over the owner's
289
+ * engine copy, patched in step with the row) is the plan while it names
290
+ * exactly the mounted panes; else the planner's. Main itself is never
291
+ * written. Returns whether anything was written.
292
+ */
293
+ export function reconcileWindowOwnerGeometry(tc, ownerId, canvasHeightPx) {
294
+ if (!tc || tc.isDestroyed || typeof tc.updateSettings !== 'function')
295
+ return false;
296
+ if (!isMainPaneHidden(tc.metadata)) {
297
+ // The window layout is not in force: no hold outlives it.
298
+ windowHolds.delete(tc);
299
+ return false;
300
+ }
301
+ const metas = windowPaneMetas(tc.metadata, ownerId);
302
+ const height = canvasHeightPx ?? tc.canvasChartController?.canvasElement?.clientHeight;
303
+ let plan = [];
304
+ if (metas.length > 0 && !isWindowHeld(tc, ownerId, metas)) {
305
+ const panes = metas.map((meta) => windowPaneOf(meta, ownerId));
306
+ const owner = tc.metadata.find((candidate) => candidate.id === ownerId);
307
+ plan = savedWindowSplit(owner?.settings, panes) ?? planWindowWeights(panes, height);
308
+ }
309
+ let written = false;
310
+ for (const { id, gridHeight } of plan) {
311
+ const meta = tc.metadata.find((candidate) => candidate.id === id);
312
+ if (!meta)
313
+ continue;
314
+ const current = meta.gridHeight;
315
+ if (typeof current === 'number' && Math.abs(current - gridHeight) < WINDOW_GRID_HEIGHT_TOLERANCE)
316
+ continue;
317
+ meta.gridHeight = gridHeight;
318
+ meta.settings = { ...(meta.settings ?? {}), gridHeight };
319
+ void tc.updateSettings(id, { gridHeight });
320
+ written = true;
321
+ }
322
+ // The pinned engine floors a hidden main back to its minimum when the panes
323
+ // sum to 1 (overflow correction), and onchart furniture (volume, the owner's
324
+ // price plots, high/low marks) then paints in that ghost band. Pin it at 0:
325
+ // the layout reads the meta height, the section stays display:none.
326
+ const main = tc.metadata.find((candidate) => candidate.id === 'main') ?? tc.metadata[0];
327
+ if (main && main.isPaneHidden === true && main.gridHeight !== 0) {
328
+ main.gridHeight = 0;
329
+ main.settings = { ...(main.settings ?? {}), gridHeight: 0 };
330
+ written = true;
331
+ }
332
+ if (written)
333
+ tc.resizeCanvasOnce?.();
334
+ return written;
335
+ }
336
+ /**
337
+ * The reversal (Show chart): every pane the owner mounted goes back to the
338
+ * height a normal chart mounts it at (plan section 2.2): chart-shaped panels
339
+ * and time panes at PANEL_CHART_GRID_HEIGHT, a table at its content height.
340
+ * Writes only once the candle pane is visible again (the host releases main
341
+ * first), so the engine carves the panes out of main the way a fresh mount
342
+ * would. Keyed by the owner id because the flag is already off by then.
343
+ * Returns whether anything was written.
344
+ */
345
+ export function restoreNormalOwnerGeometry(tc, ownerId, canvasHeightPx) {
346
+ if (!tc || tc.isDestroyed || typeof tc.updateSettings !== 'function')
347
+ return false;
348
+ if (isMainPaneHidden(tc.metadata))
349
+ return false;
350
+ // Back to a chart: the reader's window split ends with the window.
351
+ windowHolds.delete(tc);
352
+ const panes = mountedWindowPanes(tc.metadata, ownerId);
353
+ if (panes.length === 0)
354
+ return false;
355
+ const height = canvasHeightPx ?? tc.canvasChartController?.canvasElement?.clientHeight;
356
+ let written = false;
357
+ for (const pane of panes) {
358
+ const meta = tc.metadata.find((candidate) => candidate.id === pane.id);
359
+ if (!meta)
360
+ continue;
361
+ const gridHeight = pane.kind === 'table'
362
+ ? panelGridHeight(TABLE_PANEL, Math.max(0, pane.rows ?? 0), height)
363
+ : PANEL_CHART_GRID_HEIGHT;
364
+ const current = meta.gridHeight;
365
+ if (typeof current === 'number' && Math.abs(current - gridHeight) < WINDOW_GRID_HEIGHT_TOLERANCE)
366
+ continue;
367
+ meta.gridHeight = gridHeight;
368
+ meta.settings = { ...(meta.settings ?? {}), gridHeight };
369
+ void tc.updateSettings(pane.id, { gridHeight });
370
+ written = true;
371
+ }
372
+ // The engine's togglePane('main', true) redistributed evenly (main two
373
+ // shares); the children just went back to their fixed heights, so main
374
+ // takes the rest of the cell, never under the engine minimum and never a
375
+ // sum above 1 that would clip the stack.
376
+ const main = tc.metadata.find((candidate) => candidate.id === 'main') ?? tc.metadata[0];
377
+ if (main && main.isPaneHidden !== true) {
378
+ const offchart = tc.metadata
379
+ .filter((meta) => meta !== main && meta.type === 'offchart' && meta.isPaneHidden !== true && !meta.hostPaneId)
380
+ .reduce((total, meta) => total + (typeof meta.gridHeight === 'number' ? meta.gridHeight : 0), 0);
381
+ const share = Math.max(WINDOW_PANE_MIN_GRID_HEIGHT, Math.round((1 - offchart) * 10000) / 10000);
382
+ if (typeof main.gridHeight !== 'number' || Math.abs(main.gridHeight - share) >= WINDOW_GRID_HEIGHT_TOLERANCE) {
383
+ main.gridHeight = share;
384
+ main.settings = { ...(main.settings ?? {}), gridHeight: share };
385
+ written = true;
386
+ }
387
+ }
388
+ if (written)
389
+ tc.resizeCanvasOnce?.();
390
+ return written;
391
+ }
@@ -0,0 +1,19 @@
1
+ /** The owner flag's settings key (persisted: `settingsToSave`, indicator.constants). */
2
+ export declare const WRUN_WINDOW_SETTING = "wrunWindow";
3
+ /**
4
+ * The saved split's settings key (persisted beside the flag): the reader's
5
+ * splitter drag in a window as pane weights keyed relative to the owner
6
+ * (`self`, `panel:<name>`, `series:<name>`), rounded to 4 decimals, summing
7
+ * to 1. Written by the window host through the store's setWrunWindowSplit,
8
+ * read by window-geometry.util (savedWindowSplit) only while it names exactly
9
+ * the mounted panes, deleted with the flag (Show chart), stripped wherever
10
+ * the flag is.
11
+ */
12
+ export declare const WRUN_WINDOW_SPLIT_SETTING = "wrunWindowSplit";
13
+ /** An overlay as the window rules read it: its id and its settings bag. */
14
+ export type WindowOwnerOverlay = {
15
+ id?: unknown;
16
+ settings?: Record<string, unknown> | null;
17
+ } | null | undefined;
18
+ /** A wrun Indicator overlay (registry, draft or hosted lane) that carries the owner flag. */
19
+ export declare function isWrunWindowOwner(overlay: WindowOwnerOverlay): boolean;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The window owner rule of window-cell.util.ts (which re-exports every name here and reads them for the rest of the
3
+ * window contract) as a leaf with no app import: the owner flag's settings key, the saved split's settings key and
4
+ * the owner test. The child mount (wrun-panel-mount.util) and the window geometry leaf read them, and they move into
5
+ * the wrun chart-host package, which the cell readers' reactive draft windows (draft-window.util) may not reach.
6
+ */
7
+ import { isWrunPackageOverlaySettings } from '../wrun/wrun-overlay-identity.util.js';
8
+ /** The owner flag's settings key (persisted: `settingsToSave`, indicator.constants). */
9
+ export const WRUN_WINDOW_SETTING = 'wrunWindow';
10
+ /**
11
+ * The saved split's settings key (persisted beside the flag): the reader's
12
+ * splitter drag in a window as pane weights keyed relative to the owner
13
+ * (`self`, `panel:<name>`, `series:<name>`), rounded to 4 decimals, summing
14
+ * to 1. Written by the window host through the store's setWrunWindowSplit,
15
+ * read by window-geometry.util (savedWindowSplit) only while it names exactly
16
+ * the mounted panes, deleted with the flag (Show chart), stripped wherever
17
+ * the flag is.
18
+ */
19
+ export const WRUN_WINDOW_SPLIT_SETTING = 'wrunWindowSplit';
20
+ /** A wrun Indicator overlay (registry, draft or hosted lane) that carries the owner flag. */
21
+ export function isWrunWindowOwner(overlay) {
22
+ const settings = overlay?.settings;
23
+ return !!settings && settings[WRUN_WINDOW_SETTING] === true && isWrunPackageOverlaySettings(settings);
24
+ }
@@ -0,0 +1,100 @@
1
+ /**
2
+ * The market facts a wrun indicator reads per bar (WRUN-SESSIONS contract
3
+ * C3): `time.trade_date` and `time.session`. Both are facts of the bar's
4
+ * market (exchange, symbol), its interval and its open time ONLY, never of
5
+ * the chart's RTH / extended mode, and every hour comes from the chart's own
6
+ * session definitions, the RTH window from the kScript engine's table (see
7
+ * NYMEX below).
8
+ *
9
+ * Calendar bars (an interval of one day or longer: 1D, 3D, 1W, 1M) read the
10
+ * UTC date of their open stamp and 1 on every market: the chart stamps them
11
+ * at 00:00 UTC of their trade date, an instant the intraday rules below would
12
+ * read as the previous New York evening (amendment 10-01). Intraday bars:
13
+ *
14
+ * - trade date, epoch SECONDS at 00:00 UTC of the bar's exchange trade date:
15
+ * - CME family (`isCmeGoverned`: CME, CBOT, NYMEX, COMEX and the GLOBEX
16
+ * alias): the chart's CME trade date, `cmeSessionBucketMs(t, 1d)`, so the
17
+ * 17:00 Chicago open belongs to the NEXT date;
18
+ * - US equities (`getMarketKind` 'tradfi'): the New York calendar date;
19
+ * - everything else (crypto, forex, HIP-3, Polymarket, ...): the UTC date.
20
+ * - session, 1 regular, 2 pre-market, 3 after-hours, 0 closed:
21
+ * - US equities: `resolveUsEquitySessionPhase`;
22
+ * - CME family: 0 while the weekly schedule says closed
23
+ * (`getGovernedFuturesScheduleStatusForSymbol`, which carries the 24/7
24
+ * roots); else 1 inside the engine's RTH window
25
+ * (`engineRthWindowForSymbol`, 09:30 to 16:15 New York on every mapped
26
+ * root; a root without a window is regular all session), 2 before its
27
+ * trade date's RTH window and 3 after it;
28
+ * - everything else: 1.
29
+ *
30
+ * The golden vectors every other host (kscript-alerts, kscript-backend, om)
31
+ * tests against are generated from this module:
32
+ * src/fixtures/wrun-session-facts/golden.json.
33
+ *
34
+ * NYMEX: the chart judges RTH there on the energy pit session, 09:00 to 14:30
35
+ * New York (rth-session.util `rthWindowForExchange`, the gateway's REGULAR
36
+ * window), but wrun and kScript session facts on NYMEX follow the kScript
37
+ * engine's table, 09:30 to 16:15, until a coordinated change moves the
38
+ * engine, the golden and the cloud lanes together. Moving this browser lane
39
+ * alone would split the browser and cloud runs of the same indicator.
40
+ *
41
+ * Cost: the definitions run at microseconds a call (the equities phase reads
42
+ * dayjs timezone parts, about 30 us), so a 50k-bar run cannot afford one per
43
+ * bar. Each is memoized on the grain it is constant on, always evaluated at
44
+ * the START of that grain so a result never depends on call order:
45
+ * - the venue-zone calendar day (Intl parts, host-independent: the dayjs
46
+ * drift caveat in rth-session.util never applies), once per local day;
47
+ * - the CME schedule per Chicago (weekday, hour): its boundaries are whole
48
+ * Chicago hours (16:00 and 17:00, the Saturday 02:00 to 04:00 window);
49
+ * - the equities phase per New York (weekday, half hour): its boundaries are
50
+ * 04:00, 09:30, 16:00 and 20:00;
51
+ * - the CME RTH window per (window, trade date).
52
+ * Both zones sit a whole number of hours off UTC, so a reader also keeps its
53
+ * last answer per UTC hour (CME: the trade date and the schedule bit) or half
54
+ * hour (equities), and a sorted walk pays the lookups once per grain, not per
55
+ * bar. The spec walks every minute of both 2026 DST weeks against the
56
+ * definitions themselves, so a boundary moved off those grains fails there,
57
+ * not in the field, and measures 50k one-minute bars from a cold module.
58
+ *
59
+ * Worker-safe: imports only the chart's session utils (no Vue, store, i18n).
60
+ */
61
+ /** The `time.session` codes (contract C3). */
62
+ export declare const WRUN_BAR_SESSION: Readonly<{
63
+ readonly closed: 0;
64
+ readonly regular: 1;
65
+ readonly premarket: 2;
66
+ readonly afterHours: 3;
67
+ }>;
68
+ export type WrunBarSession = (typeof WRUN_BAR_SESSION)[keyof typeof WRUN_BAR_SESSION];
69
+ export interface WrunBarSessionFacts {
70
+ /** Epoch seconds at 00:00 UTC of the bar's exchange trade date (NaN for a non-finite bar time). */
71
+ tradeDateSec: number;
72
+ /** A `WRUN_BAR_SESSION` code (NaN for a non-finite bar time). */
73
+ session: number;
74
+ }
75
+ /** The series the facts are read for: the chart's own main series, its market and its bar interval. */
76
+ export interface WrunBarVenue {
77
+ exchange: string;
78
+ symbol: string;
79
+ /** The series' bar interval (ms); one day or longer reads the calendar-bar rule. */
80
+ intervalMs: number;
81
+ }
82
+ /** Which C3 rule a market follows. */
83
+ export type WrunBarFactsMarket = 'cme' | 'us_equities' | 'utc';
84
+ export declare function wrunBarFactsMarketOf(exchange: string): WrunBarFactsMarket;
85
+ /**
86
+ * The venue of chart metadata (or a live context's market) at the series'
87
+ * bar interval: undefined unless exchange and symbol are non-empty strings and
88
+ * the interval is a positive number.
89
+ */
90
+ export declare function wrunBarVenueOf(market: unknown, intervalMs: number): WrunBarVenue | undefined;
91
+ /**
92
+ * The facts reader for one series: its rule is decided once (a calendar bar
93
+ * reads its stamp's UTC date on every market, an intraday bar its market's
94
+ * rule), then every call reads one bar open time (UTC ms). The row builders
95
+ * bind one per build and call it per row. The answer objects are shared and
96
+ * frozen.
97
+ */
98
+ export declare function wrunBarSessionFactsResolver(venue: WrunBarVenue): (barOpenMs: number) => WrunBarSessionFacts;
99
+ /** One bar's facts (a one-off read; hot loops bind `wrunBarSessionFactsResolver` once). */
100
+ export declare function wrunBarSessionFacts(venue: WrunBarVenue, barOpenMs: number): WrunBarSessionFacts;