@orangecharts/wrun-chart-host 0.3.0 → 0.5.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 (362) hide show
  1. package/README.md +23 -6
  2. package/dist/constants/exchange-names.leaf.d.ts +8 -0
  3. package/dist/constants/exchange-names.leaf.js +101 -0
  4. package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +15 -0
  5. package/dist/constants/kscript-data-interval-restrictions.constants.js +40 -0
  6. package/dist/constants/opra-compliance.constants.d.ts +19 -0
  7. package/dist/constants/opra-compliance.constants.js +19 -0
  8. package/dist/constants/replay-ladder.leaf.d.ts +30 -0
  9. package/dist/constants/replay-ladder.leaf.js +99 -0
  10. package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +133 -0
  11. package/dist/constants/scriptEditor/builtin-script-snippets.js +451 -0
  12. package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +168 -0
  13. package/dist/constants/scriptEditor/cme-official-scripts.constants.js +398 -0
  14. package/dist/constants/scriptEditor/converted-script-id.leaf.d.ts +8 -0
  15. package/dist/constants/scriptEditor/converted-script-id.leaf.js +10 -0
  16. package/dist/constants/scriptEditor/execution.constants.d.ts +4 -0
  17. package/dist/constants/scriptEditor/execution.constants.js +14 -0
  18. package/dist/constants/wrun-prefix-safe.constants.d.ts +23 -0
  19. package/dist/constants/wrun-prefix-safe.constants.js +26 -0
  20. package/dist/host-env.d.ts +321 -24
  21. package/dist/host-env.js +15 -0
  22. package/dist/host-ports.types.d.ts +857 -35
  23. package/dist/index.d.ts +149 -2
  24. package/dist/index.js +149 -2
  25. package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +31 -0
  26. package/dist/instances/script-engine-worker-ohlcv-transfer.js +164 -0
  27. package/dist/interfaces/market-event.interface.d.ts +231 -0
  28. package/dist/interfaces/market-event.interface.js +15 -0
  29. package/dist/interfaces/opra-realtime.interface.d.ts +70 -134
  30. package/dist/interfaces/opra-realtime.interface.js +34 -59
  31. package/dist/interfaces/replay.interface.d.ts +285 -0
  32. package/dist/interfaces/replay.interface.js +1 -0
  33. package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +1 -0
  34. package/dist/kscript-data/controls/live-ohlcv-merge.util.js +93 -0
  35. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +5 -1
  36. package/dist/kscript-data/controls/live-trades-merge.util.js +2 -2
  37. package/dist/market-data/billing.interface.d.ts +219 -0
  38. package/dist/market-data/billing.interface.js +58 -0
  39. package/dist/market-data/venue-governed.util.d.ts +2 -0
  40. package/dist/market-data/venue-governed.util.js +10 -0
  41. package/dist/market-data/venue.d.ts +122 -0
  42. package/dist/market-data/venue.js +1 -0
  43. package/dist/market-data/venues/index.d.ts +97 -0
  44. package/dist/market-data/venues/index.js +33 -0
  45. package/dist/market-data/venues/opra.contract.copy.json +35 -0
  46. package/dist/market-data/venues/opra.d.ts +70 -0
  47. package/dist/market-data/venues/opra.js +74 -0
  48. package/dist/replay/replayIndicatorRows.d.ts +31 -0
  49. package/dist/replay/replayIndicatorRows.js +117 -0
  50. package/dist/replay/replayLadder.d.ts +85 -0
  51. package/dist/replay/replayLadder.js +388 -0
  52. package/dist/utility/auth/server-clock.util.d.ts +81 -0
  53. package/dist/utility/auth/server-clock.util.js +238 -0
  54. package/dist/utility/chart/builtin-identity.util.d.ts +18 -0
  55. package/dist/utility/chart/builtin-identity.util.js +51 -0
  56. package/dist/utility/chart/cache-alignment.util.d.ts +454 -0
  57. package/dist/utility/chart/cache-alignment.util.js +926 -0
  58. package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +15 -0
  59. package/dist/utility/chart/chart-data-fetch-generation.util.js +22 -0
  60. package/dist/utility/chart/chart-mount-epoch.util.d.ts +5 -0
  61. package/dist/utility/chart/chart-mount-epoch.util.js +29 -0
  62. package/dist/utility/chart/chart-time-domain.util.d.ts +12 -0
  63. package/dist/utility/chart/chart-time-domain.util.js +23 -0
  64. package/dist/utility/chart/color-customization.leaf.d.ts +10 -0
  65. package/dist/utility/chart/color-customization.leaf.js +16 -0
  66. package/dist/utility/chart/date-labelled-interval.leaf.d.ts +15 -0
  67. package/dist/utility/chart/date-labelled-interval.leaf.js +19 -0
  68. package/dist/utility/chart/footprint-tick-grid.util.d.ts +106 -0
  69. package/dist/utility/chart/footprint-tick-grid.util.js +167 -0
  70. package/dist/utility/chart/gesture-timing.leaf.d.ts +29 -0
  71. package/dist/utility/chart/gesture-timing.leaf.js +29 -0
  72. package/dist/utility/chart/governed-contract-coin.util.d.ts +22 -0
  73. package/dist/utility/chart/governed-contract-coin.util.js +39 -0
  74. package/dist/utility/chart/host-bar-placement.util.d.ts +107 -0
  75. package/dist/utility/chart/host-bar-placement.util.js +447 -0
  76. package/dist/utility/chart/index-host-tier.util.d.ts +31 -0
  77. package/dist/utility/chart/index-host-tier.util.js +118 -0
  78. package/dist/utility/chart/index-mode-admission.util.d.ts +34 -0
  79. package/dist/utility/chart/index-mode-admission.util.js +67 -0
  80. package/dist/utility/chart/indicator-error-message.util.d.ts +35 -0
  81. package/dist/utility/chart/indicator-error-message.util.js +44 -0
  82. package/dist/utility/chart/indicator-run-interval.util.d.ts +130 -0
  83. package/dist/utility/chart/indicator-run-interval.util.js +268 -0
  84. package/dist/utility/chart/kscript-apply-fingerprint.util.d.ts +65 -0
  85. package/dist/utility/chart/kscript-apply-fingerprint.util.js +357 -0
  86. package/dist/utility/chart/kscript-chart-flush.leaf.d.ts +22 -0
  87. package/dist/utility/chart/kscript-chart-flush.leaf.js +13 -0
  88. package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +6 -0
  89. package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +27 -0
  90. package/dist/utility/chart/kscript-integration-decision.leaf.d.ts +89 -0
  91. package/dist/utility/chart/kscript-integration-decision.leaf.js +80 -0
  92. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +76 -0
  93. package/dist/utility/chart/kscript-live-coalesce.util.js +156 -0
  94. package/dist/utility/chart/kscript-live-rest-pace.util.d.ts +34 -0
  95. package/dist/utility/chart/kscript-live-rest-pace.util.js +134 -0
  96. package/dist/utility/chart/kscript-live-source-identity.util.d.ts +98 -0
  97. package/dist/utility/chart/kscript-live-source-identity.util.js +121 -0
  98. package/dist/utility/chart/kscript-mounted-plot-set.leaf.d.ts +48 -0
  99. package/dist/utility/chart/kscript-mounted-plot-set.leaf.js +145 -0
  100. package/dist/utility/chart/kscript-perf-tracker.util.d.ts +243 -0
  101. package/dist/utility/chart/kscript-perf-tracker.util.js +522 -0
  102. package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +43 -0
  103. package/dist/utility/chart/kscript-run-interval-projection.util.js +471 -0
  104. package/dist/utility/chart/kscript-run-result-equality.util.d.ts +38 -0
  105. package/dist/utility/chart/kscript-run-result-equality.util.js +89 -0
  106. package/dist/utility/chart/kscript-settings-revision.leaf.d.ts +2 -0
  107. package/dist/utility/chart/kscript-settings-revision.leaf.js +12 -0
  108. package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +63 -0
  109. package/dist/utility/chart/kscript-source-degrade.leaf.js +68 -0
  110. package/dist/utility/chart/kscript-source-retention.util.d.ts +134 -0
  111. package/dist/utility/chart/kscript-source-retention.util.js +218 -0
  112. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +57 -0
  113. package/dist/utility/chart/kscript-standin-identity.leaf.js +61 -0
  114. package/dist/utility/chart/kscript-titancharts-preparation.util.d.ts +15 -0
  115. package/dist/utility/chart/kscript-titancharts-preparation.util.js +376 -0
  116. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +9 -0
  117. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +130 -0
  118. package/dist/utility/chart/kscript-venue-policy.util.d.ts +217 -0
  119. package/dist/utility/chart/kscript-venue-policy.util.js +324 -0
  120. package/dist/utility/chart/live-cadence.util.d.ts +38 -0
  121. package/dist/utility/chart/live-cadence.util.js +37 -0
  122. package/dist/utility/chart/live-feed-series-match.leaf.d.ts +13 -0
  123. package/dist/utility/chart/live-feed-series-match.leaf.js +21 -0
  124. package/dist/utility/chart/local-engine-self-heal-backoff.util.d.ts +46 -0
  125. package/dist/utility/chart/local-engine-self-heal-backoff.util.js +46 -0
  126. package/dist/utility/chart/local-engine-uninit.leaf.d.ts +21 -0
  127. package/dist/utility/chart/local-engine-uninit.leaf.js +22 -0
  128. package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +62 -0
  129. package/dist/utility/chart/local-kscript-source-revalidation.util.js +123 -0
  130. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +214 -0
  131. package/dist/utility/chart/local-kscript-warmup-depth.util.js +376 -0
  132. package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.d.ts +85 -0
  133. package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.js +197 -0
  134. package/dist/utility/chart/local-technical-script-range.leaf.d.ts +72 -0
  135. package/dist/utility/chart/local-technical-script-range.leaf.js +126 -0
  136. package/dist/utility/chart/mixed-mode.util.d.ts +167 -0
  137. package/dist/utility/chart/mixed-mode.util.js +139 -0
  138. package/dist/utility/chart/ohlcv-row-readiness.util.d.ts +36 -0
  139. package/dist/utility/chart/ohlcv-row-readiness.util.js +90 -0
  140. package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +19 -0
  141. package/dist/utility/chart/opra-user-scripts-gate.util.js +32 -0
  142. package/dist/utility/chart/overlay-execution-guard-key.leaf.d.ts +8 -0
  143. package/dist/utility/chart/overlay-execution-guard-key.leaf.js +10 -0
  144. package/dist/utility/chart/price-precision.util.d.ts +40 -0
  145. package/dist/utility/chart/price-precision.util.js +70 -0
  146. package/dist/utility/chart/profile-block-size.util.d.ts +64 -0
  147. package/dist/utility/chart/profile-block-size.util.js +141 -0
  148. package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.d.ts +11 -0
  149. package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.js +29 -0
  150. package/dist/utility/chart/protected-kscript-empty-output.util.d.ts +28 -0
  151. package/dist/utility/chart/protected-kscript-empty-output.util.js +84 -0
  152. package/dist/utility/chart/run-interval-unservable.leaf.d.ts +9 -0
  153. package/dist/utility/chart/run-interval-unservable.leaf.js +20 -0
  154. package/dist/utility/chart/run-interval-warmup.leaf.d.ts +19 -0
  155. package/dist/utility/chart/run-interval-warmup.leaf.js +35 -0
  156. package/dist/utility/chart/titan-constants.pin.d.ts +9 -5
  157. package/dist/utility/chart/titan-constants.pin.js +18 -5
  158. package/dist/utility/chart/warmup-backfill-retry.leaf.d.ts +9 -0
  159. package/dist/utility/chart/warmup-backfill-retry.leaf.js +9 -0
  160. package/dist/utility/chart/window-geometry.leaf.d.ts +119 -0
  161. package/dist/utility/chart/window-geometry.leaf.js +391 -0
  162. package/dist/utility/chart/window-owner.leaf.d.ts +19 -0
  163. package/dist/utility/chart/window-owner.leaf.js +24 -0
  164. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +11 -2
  165. package/dist/utility/chart/wrun-bar-session-facts.util.js +10 -3
  166. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -1
  167. package/dist/utility/chart/wrun-run-result.util.js +20 -14
  168. package/dist/utility/common/data-processing.util.d.ts +138 -0
  169. package/dist/utility/common/data-processing.util.js +346 -0
  170. package/dist/utility/common/visible-timeout.util.d.ts +13 -4
  171. package/dist/utility/common/visible-timeout.util.js +23 -8
  172. package/dist/utility/exchange-format.leaf.d.ts +1 -0
  173. package/dist/utility/exchange-format.leaf.js +47 -0
  174. package/dist/utility/html-escape.leaf.d.ts +11 -0
  175. package/dist/utility/html-escape.leaf.js +20 -0
  176. package/dist/utility/market-events/earnings-scope.util.d.ts +60 -0
  177. package/dist/utility/market-events/earnings-scope.util.js +92 -0
  178. package/dist/utility/market-events/market-events.util.d.ts +147 -0
  179. package/dist/utility/market-events/market-events.util.js +392 -0
  180. package/dist/utility/market-events/zoned-clock.util.d.ts +1 -0
  181. package/dist/utility/market-events/zoned-clock.util.js +11 -0
  182. package/dist/utility/options/option-venue-disclosure.util.d.ts +43 -0
  183. package/dist/utility/options/option-venue-disclosure.util.js +56 -0
  184. package/dist/utility/scriptEditor/package-semver.util.d.ts +51 -0
  185. package/dist/utility/scriptEditor/package-semver.util.js +120 -0
  186. package/dist/utility/scriptEditor/temp-script-id.util.d.ts +18 -0
  187. package/dist/utility/scriptEditor/temp-script-id.util.js +25 -0
  188. package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.d.ts +20 -0
  189. package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.js +81 -0
  190. package/dist/utility/v2/governed-tier.leaf.d.ts +103 -0
  191. package/dist/utility/v2/governed-tier.leaf.js +113 -0
  192. package/dist/utility/watchlist/import/import-request.leaf.d.ts +10 -0
  193. package/dist/utility/watchlist/import/import-request.leaf.js +10 -0
  194. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +43 -15
  195. package/dist/utility/wrun/sources/lanes/option_daily.js +78 -20
  196. package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +14 -10
  197. package/dist/utility/wrun/sources/lanes/option_stats_10m.js +5 -4
  198. package/dist/utility/wrun/sources/lanes/series.js +2 -2
  199. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +22 -3
  200. package/dist/utility/wrun/sources/opra-option-lanes.util.js +38 -7
  201. package/dist/utility/wrun/sources/registry.js +31 -1
  202. package/dist/utility/wrun/sources/row-lane-registry.js +5 -5
  203. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +49 -0
  204. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +75 -20
  205. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +49 -0
  206. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +57 -47
  207. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +36 -4
  208. package/dist/utility/wrun/sources/row-lanes/option_surface.js +6 -12
  209. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +37 -3
  210. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +128 -2
  211. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +233 -51
  212. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +0 -8
  213. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +26 -24
  214. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +85 -104
  215. package/dist/utility/wrun/wrun-alert-outputs.registry.d.ts +166 -0
  216. package/dist/utility/wrun/wrun-alert-outputs.registry.js +219 -0
  217. package/dist/utility/wrun/wrun-bar-count.util.d.ts +83 -0
  218. package/dist/utility/wrun/wrun-bar-count.util.js +259 -0
  219. package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +84 -0
  220. package/dist/utility/wrun/wrun-chart-context-names.util.js +186 -0
  221. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +253 -0
  222. package/dist/utility/wrun/wrun-chart-market-facts.util.js +731 -0
  223. package/dist/utility/wrun/wrun-cloud-opra-stamp.util.d.ts +28 -0
  224. package/dist/utility/wrun/wrun-cloud-opra-stamp.util.js +45 -0
  225. package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +18 -0
  226. package/dist/utility/wrun/wrun-coin-lane-live.util.js +47 -0
  227. package/dist/utility/wrun/wrun-deadline.util.js +2 -1
  228. package/dist/utility/wrun/wrun-debug-output.util.d.ts +39 -0
  229. package/dist/utility/wrun/wrun-debug-output.util.js +63 -0
  230. package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +113 -0
  231. package/dist/utility/wrun/wrun-declared-warmup.util.js +181 -0
  232. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +43 -0
  233. package/dist/utility/wrun/wrun-draft-legend-note.util.js +158 -0
  234. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +181 -0
  235. package/dist/utility/wrun/wrun-draft-overlay.util.js +357 -0
  236. package/dist/utility/wrun/wrun-draw-skipped.leaf.d.ts +16 -0
  237. package/dist/utility/wrun/wrun-draw-skipped.leaf.js +16 -0
  238. package/dist/utility/wrun/wrun-earnings-facts.util.d.ts +42 -0
  239. package/dist/utility/wrun/wrun-earnings-facts.util.js +131 -0
  240. package/dist/utility/wrun/wrun-first-run-depth.util.d.ts +32 -0
  241. package/dist/utility/wrun/wrun-first-run-depth.util.js +118 -0
  242. package/dist/utility/wrun/wrun-gate-plane-readers.util.d.ts +24 -0
  243. package/dist/utility/wrun/wrun-gate-plane-readers.util.js +31 -0
  244. package/dist/utility/wrun/wrun-held-lanes.util.d.ts +32 -0
  245. package/dist/utility/wrun/wrun-held-lanes.util.js +94 -0
  246. package/dist/utility/wrun/wrun-host-visible-clock.util.d.ts +2 -0
  247. package/dist/utility/wrun/wrun-host-visible-clock.util.js +17 -0
  248. package/dist/utility/wrun/wrun-host.service.d.ts +266 -0
  249. package/dist/utility/wrun/wrun-host.service.js +655 -0
  250. package/dist/utility/wrun/wrun-inert-legend.util.d.ts +33 -0
  251. package/dist/utility/wrun/wrun-inert-legend.util.js +125 -0
  252. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +155 -0
  253. package/dist/utility/wrun/wrun-input-requirements.leaf.js +450 -0
  254. package/dist/utility/wrun/wrun-integration-route.util.d.ts +51 -0
  255. package/dist/utility/wrun/wrun-integration-route.util.js +59 -0
  256. package/dist/utility/wrun/wrun-latest-history.leaf.d.ts +8 -0
  257. package/dist/utility/wrun/wrun-latest-history.leaf.js +8 -0
  258. package/dist/utility/wrun/wrun-legend-hover.lazy.d.ts +12 -0
  259. package/dist/utility/wrun/wrun-legend-hover.lazy.js +96 -0
  260. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +21 -0
  261. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +21 -0
  262. package/dist/utility/wrun/wrun-live-hidden-hold.util.d.ts +23 -0
  263. package/dist/utility/wrun/wrun-live-hidden-hold.util.js +13 -0
  264. package/dist/utility/wrun/wrun-live-intake.util.d.ts +374 -0
  265. package/dist/utility/wrun/wrun-live-intake.util.js +2027 -0
  266. package/dist/utility/wrun/wrun-live-patch.util.d.ts +116 -0
  267. package/dist/utility/wrun/wrun-live-patch.util.js +523 -0
  268. package/dist/utility/wrun/wrun-live-tick.util.d.ts +619 -0
  269. package/dist/utility/wrun/wrun-live-tick.util.js +4974 -0
  270. package/dist/utility/wrun/wrun-loading-owner.util.d.ts +58 -0
  271. package/dist/utility/wrun/wrun-loading-owner.util.js +89 -0
  272. package/dist/utility/wrun/wrun-official-scope.leaf.d.ts +29 -0
  273. package/dist/utility/wrun/wrun-official-scope.leaf.js +36 -0
  274. package/dist/utility/wrun/wrun-oi-lane.util.d.ts +27 -0
  275. package/dist/utility/wrun/wrun-oi-lane.util.js +42 -0
  276. package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +29 -10
  277. package/dist/utility/wrun/wrun-opra-stats.leaf.js +29 -10
  278. package/dist/utility/wrun/wrun-options-stop.util.d.ts +52 -0
  279. package/dist/utility/wrun/wrun-options-stop.util.js +123 -0
  280. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +719 -0
  281. package/dist/utility/wrun/wrun-overlay-drivers.util.js +1180 -0
  282. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +50 -0
  283. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +131 -0
  284. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +118 -0
  285. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +466 -0
  286. package/dist/utility/wrun/wrun-overlay-metadata.util.d.ts +45 -0
  287. package/dist/utility/wrun/wrun-overlay-metadata.util.js +112 -0
  288. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +114 -0
  289. package/dist/utility/wrun/wrun-overlay-recovery.util.js +971 -0
  290. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +858 -0
  291. package/dist/utility/wrun/wrun-overlay-run.util.js +11013 -0
  292. package/dist/utility/wrun/wrun-panel-mount.lazy.d.ts +10 -0
  293. package/dist/utility/wrun/wrun-panel-mount.lazy.js +68 -0
  294. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +392 -0
  295. package/dist/utility/wrun/wrun-panel-mount.util.js +2346 -0
  296. package/dist/utility/wrun/wrun-param-map.util.d.ts +19 -4
  297. package/dist/utility/wrun/wrun-param-map.util.js +40 -47
  298. package/dist/utility/wrun/wrun-param-values.util.d.ts +9 -3
  299. package/dist/utility/wrun/wrun-param-values.util.js +5 -5
  300. package/dist/utility/wrun/wrun-pause-dim.util.d.ts +52 -0
  301. package/dist/utility/wrun/wrun-pause-dim.util.js +153 -0
  302. package/dist/utility/wrun/wrun-plot-gate.types.d.ts +23 -0
  303. package/dist/utility/wrun/wrun-plot-gate.types.js +7 -0
  304. package/dist/utility/wrun/wrun-prefix-cohort.util.d.ts +93 -0
  305. package/dist/utility/wrun/wrun-prefix-cohort.util.js +484 -0
  306. package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +114 -0
  307. package/dist/utility/wrun/wrun-prefix-lanes.util.js +486 -0
  308. package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +317 -0
  309. package/dist/utility/wrun/wrun-prefix-proof.util.js +630 -0
  310. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +73 -0
  311. package/dist/utility/wrun/wrun-refusal-surface.util.js +380 -0
  312. package/dist/utility/wrun/wrun-refusal-text.util.d.ts +15 -0
  313. package/dist/utility/wrun/wrun-refusal-text.util.js +40 -0
  314. package/dist/utility/wrun/wrun-replay-lane.util.d.ts +139 -0
  315. package/dist/utility/wrun/wrun-replay-lane.util.js +520 -0
  316. package/dist/utility/wrun/wrun-replay-rows.util.d.ts +21 -0
  317. package/dist/utility/wrun/wrun-replay-rows.util.js +172 -0
  318. package/dist/utility/wrun/wrun-row-source-factory.d.ts +53 -0
  319. package/dist/utility/wrun/wrun-row-source-factory.js +435 -0
  320. package/dist/utility/wrun/wrun-run-cells.util.d.ts +36 -0
  321. package/dist/utility/wrun/wrun-run-cells.util.js +46 -0
  322. package/dist/utility/wrun/wrun-run-interval-projection.types.d.ts +14 -0
  323. package/dist/utility/wrun/wrun-run-interval-projection.types.js +1 -0
  324. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +133 -0
  325. package/dist/utility/wrun/wrun-run-interval-session.util.js +121 -0
  326. package/dist/utility/wrun/wrun-run-interval.util.d.ts +98 -0
  327. package/dist/utility/wrun/wrun-run-interval.util.js +207 -0
  328. package/dist/utility/wrun/wrun-run-retained.util.d.ts +122 -0
  329. package/dist/utility/wrun/wrun-run-retained.util.js +255 -0
  330. package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +184 -0
  331. package/dist/utility/wrun/wrun-sandbox-row-source.js +444 -0
  332. package/dist/utility/wrun/wrun-script-inputs.util.js +4 -4
  333. package/dist/utility/wrun/wrun-series-stream.util.d.ts +86 -0
  334. package/dist/utility/wrun/wrun-series-stream.util.js +537 -0
  335. package/dist/utility/wrun/wrun-sheet-remembered.util.d.ts +21 -0
  336. package/dist/utility/wrun/wrun-sheet-remembered.util.js +36 -0
  337. package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.d.ts +7 -0
  338. package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.js +12 -0
  339. package/dist/utility/wrun/wrun-socket-row-source.js +4 -2
  340. package/dist/utility/wrun/wrun-source-rows.util.d.ts +175 -3
  341. package/dist/utility/wrun/wrun-source-rows.util.js +294 -8
  342. package/dist/utility/wrun/wrun-stats-strip.util.d.ts +46 -0
  343. package/dist/utility/wrun/wrun-stats-strip.util.js +87 -0
  344. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +163 -0
  345. package/dist/utility/wrun/wrun-table-chrome.util.js +557 -0
  346. package/dist/utility/wrun/wrun-text-params.util.d.ts +11 -6
  347. package/dist/utility/wrun/wrun-text-params.util.js +19 -30
  348. package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +64 -0
  349. package/dist/utility/wrun/wrun-transient-rerun.util.js +317 -0
  350. package/dist/utility/wrun/wrun-twin-lookback.util.d.ts +10 -0
  351. package/dist/utility/wrun/wrun-twin-lookback.util.js +43 -0
  352. package/dist/utility/wrun/wrun-warmup-head-store.util.d.ts +41 -0
  353. package/dist/utility/wrun/wrun-warmup-head-store.util.js +120 -0
  354. package/dist/utility/wrun-alert-params.leaf.d.ts +24 -0
  355. package/dist/utility/wrun-alert-params.leaf.js +24 -0
  356. package/dist/utils/replay/replay-buffer-math.d.ts +148 -0
  357. package/dist/utils/replay/replay-buffer-math.js +684 -0
  358. package/dist/workers/wrun/wrun-abi-host.d.ts +190 -0
  359. package/dist/workers/wrun/wrun-abi-host.js +1201 -0
  360. package/dist/workers/wrun/wrun-engine-handler.d.ts +37 -0
  361. package/dist/workers/wrun/wrun-engine-handler.js +211 -0
  362. package/package.json +3 -3
@@ -1,9 +1,10 @@
1
1
  /**
2
- * Byte-for-byte copies of the three titan constants package-bound code reads (`@orangecharts/titan-charts-next/constants`
3
- * `findMonday`, `TimeIntervalConstant`, `MIN_GRID_HEIGHT_ALLOWED`), in a leaf with no import: the extraction walker
4
- * refuses every titan edge (scripts/wrun-chart-host-extract.mjs), so a module that moves into the chart-host package
5
- * reads these instead of the engine's. tests/utility/chart/titan-constants.pin.spec.ts compares them with the installed
6
- * engine's (values and 200 sampled timestamps), and src/utility/wrun/wrun-chart-host-type-pins.ts pins their types.
2
+ * Byte-for-byte copies of the four titan constants package-bound code reads (`@orangecharts/titan-charts-next/constants`
3
+ * `findMonday`, `TimeIntervalConstant`, `MIN_GRID_HEIGHT_ALLOWED`, `getDecimalPlaces`), in a leaf with no import: the
4
+ * extraction walker refuses every titan edge (scripts/wrun-chart-host-extract.mjs), so a module that moves into the
5
+ * chart-host package reads these instead of the engine's. tests/utility/chart/titan-constants.pin.spec.ts compares them
6
+ * with the installed engine's (values, 200 sampled timestamps and 200 sampled numbers), and
7
+ * src/utility/wrun/wrun-chart-host-type-pins.ts pins their types.
7
8
  */
8
9
  /** The UTC midnight of the Monday that starts the week holding `unixTimeStamp` (ms). */
9
10
  export function findMonday(unixTimeStamp) {
@@ -48,3 +49,15 @@ export const TimeIntervalConstant = {
48
49
  };
49
50
  /** The smallest grid height share a pane may take (the engine's split floor). */
50
51
  export const MIN_GRID_HEIGHT_ALLOWED = 0.13;
52
+ /** The decimal places of `num`: the digits right of its decimal point, less a scientific-notation exponent (titan
53
+ * 0.0.4-alpha.1136 src/utils/price.ts). */
54
+ export function getDecimalPlaces(num) {
55
+ const match = num.toString().match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
56
+ if (!match)
57
+ return 0;
58
+ return Math.max(0,
59
+ // Number of digits right of decimal point.
60
+ (match[1] ? match[1].length : 0) -
61
+ // Adjust for scientific notation.
62
+ (match[2] ? +match[2] : 0));
63
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The warm-up backfill's gesture retry (a leaf of utility/chart/local-kscript-warmup-backfill-ask.util.ts;
3
+ * P2/inventory.md section 1.1): how often and how many times an ask is made again while the viewport reads as moving,
4
+ * the two names the wrun first-run depth reads beside the kScript lane's first run. Two numbers, no state, so it moves
5
+ * into the chart-host package with the phase 2 closure. The old module re-exports both.
6
+ */
7
+ /** The re-ask cadence while the viewport reads as moving (the boot camera settle, an add-time reset). */
8
+ export declare const WARMUP_BACKFILL_GESTURE_RETRY_MS = 400;
9
+ export declare const WARMUP_BACKFILL_GESTURE_RETRY_LIMIT = 3;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The warm-up backfill's gesture retry (a leaf of utility/chart/local-kscript-warmup-backfill-ask.util.ts;
3
+ * P2/inventory.md section 1.1): how often and how many times an ask is made again while the viewport reads as moving,
4
+ * the two names the wrun first-run depth reads beside the kScript lane's first run. Two numbers, no state, so it moves
5
+ * into the chart-host package with the phase 2 closure. The old module re-exports both.
6
+ */
7
+ /** The re-ask cadence while the viewport reads as moving (the boot camera settle, an add-time reset). */
8
+ export const WARMUP_BACKFILL_GESTURE_RETRY_MS = 400;
9
+ export const WARMUP_BACKFILL_GESTURE_RETRY_LIMIT = 3;
@@ -0,0 +1,119 @@
1
+ export type WindowPaneKind = 'table' | 'chart' | 'time';
2
+ export interface WindowPane {
3
+ id: string;
4
+ kind: WindowPaneKind;
5
+ /** A table's body row count (header excluded): its content height. */
6
+ rows?: number;
7
+ }
8
+ export interface WindowPaneWeight {
9
+ id: string;
10
+ gridHeight: number;
11
+ }
12
+ /**
13
+ * A window's saved split (`settings.wrunWindowSplit` on the owner row,
14
+ * window-cell.util): pane weights keyed relative to the owner, `self` for the
15
+ * owner's own pane, `panel:<name>` and `series:<name>` for its children,
16
+ * rounded to 4 decimals and summing to 1. Relative keys because the owner's
17
+ * overlay id is not stable across a draft swap and must not be inside its own
18
+ * settings.
19
+ */
20
+ export type WindowSplit = Record<string, number>;
21
+ /** The split key of a window pane: `self` for the owner, a child's id past `<owner>::`. */
22
+ export declare function windowSplitKeyOf(paneId: string): string;
23
+ /** A record of at least one finite positive weight: the only shape the split reader and writer accept. */
24
+ export declare function isWindowSplit(value: unknown): value is WindowSplit;
25
+ /** The engine's pane minimum: a carve under it is refused. */
26
+ export declare const WINDOW_PANE_MIN_GRID_HEIGHT: number;
27
+ /** All tables of a window together take at most half the cell. */
28
+ export declare const WINDOW_TABLES_MAX_TOTAL = 0.5;
29
+ /** Heights closer than this are the same height: the in-place refresh rule's
30
+ * tolerance (samePanelPane) and the reconcile's write threshold. */
31
+ export declare const WINDOW_GRID_HEIGHT_TOLERANCE = 0.005;
32
+ /**
33
+ * The window's weights for a pane set, in the given order. Pure: the same
34
+ * panes and canvas height always plan the same weights (the reconcile's
35
+ * idempotence and the first mount's no-flash both rest on that).
36
+ */
37
+ export declare function planWindowWeights(panes: ReadonlyArray<WindowPane>, canvasHeightPx?: number): WindowPaneWeight[];
38
+ /** The engine meta fields the geometry reads and writes. */
39
+ export interface WindowGeometryMeta {
40
+ id: string;
41
+ type?: string;
42
+ plot?: string;
43
+ gridHeight?: number;
44
+ isPaneHidden?: boolean;
45
+ hostPaneId?: string;
46
+ settings?: Record<string, unknown>;
47
+ rawData?: unknown;
48
+ data?: unknown;
49
+ }
50
+ export interface WindowGeometryChart {
51
+ metadata: ReadonlyArray<WindowGeometryMeta>;
52
+ isDestroyed?: boolean;
53
+ /** The chart canvas in CSS px sizes a table pane to its rows. */
54
+ canvasChartController?: {
55
+ canvasElement?: {
56
+ clientHeight?: number;
57
+ } | null;
58
+ } | null;
59
+ updateSettings?(id: string, payload: Record<string, unknown>): unknown;
60
+ resizeCanvasOnce?(): void;
61
+ }
62
+ /** The body rows of a table pane (a mounted meta or an addOverlay config):
63
+ * its one decorator row's grid minus the header; undefined when unreadable. */
64
+ export declare function tableRowCountOf(pane: {
65
+ rawData?: unknown;
66
+ data?: unknown;
67
+ }): number | undefined;
68
+ /** The owner's mounted window panes, in stack order, classified for the planner. */
69
+ export declare function mountedWindowPanes(metadata: ReadonlyArray<WindowGeometryMeta>, ownerId: string): WindowPane[];
70
+ /** Whether the candle pane is hidden on this engine: the window layout is in force. */
71
+ export declare function isMainPaneHidden(metadata: ReadonlyArray<WindowGeometryMeta>): boolean;
72
+ /**
73
+ * The reader dragged a splitter in a window (the engine's `resize-grids`):
74
+ * the heights on the engine are theirs now. They become the panes' requests
75
+ * (under a hidden main the engine re-splits the stack from
76
+ * `settings.gridHeight` on every pane add, removal, collapse and focus exit,
77
+ * so a request left at the plan would undo the drag there), and the plan
78
+ * stands down: reconcileWindowOwnerGeometry writes no weight until the pane
79
+ * set changes. No engine call: the drag already laid the panes out, and this
80
+ * runs on every drag move. Silent on a normal chart (main visible) and for an
81
+ * owner without a pane. Returns the held weights as the window's split
82
+ * (WindowSplit: keyed relative to the owner, normalized to 1, rounded), the
83
+ * value the host writes to the owner row; undefined when nothing is held, or
84
+ * when a held pane has no usable height yet (nothing worth saving).
85
+ */
86
+ export declare function holdWindowPaneHeights(tc: WindowGeometryChart | null | undefined, ownerId: string): WindowSplit | undefined;
87
+ /**
88
+ * The reader's saved split for the panes mounted now: the owner's
89
+ * `settings.wrunWindowSplit` read back as weights in the panes' order, only
90
+ * when its key set equals the mounted pane set exactly (renormalized to 1,
91
+ * the engine minimum applied, rounded like the plan). Anything else is
92
+ * undefined and the plan applies: a split saved over other panes (one joined
93
+ * or left since), a malformed value, or more panes than the minimum allows
94
+ * (no split satisfies the engine then; the plan is the even split). Pure.
95
+ */
96
+ export declare function savedWindowSplit(ownerSettings: Record<string, unknown> | null | undefined, panes: ReadonlyArray<Pick<WindowPane, 'id'>>): WindowPaneWeight[] | undefined;
97
+ /**
98
+ * Apply the window plan to the OWNER's already-mounted panes: every pane whose
99
+ * engine height is off the plan by WINDOW_GRID_HEIGHT_TOLERANCE or more takes
100
+ * the planned height through the offchart height path, then one resize.
101
+ * Writes nothing while the candle pane is visible (the host hides it first;
102
+ * sum-1 weights beside a visible main would squeeze the candles), and no
103
+ * weight while the reader's own split holds (holdWindowPaneHeights). With
104
+ * nothing held, the reader's saved split (savedWindowSplit over the owner's
105
+ * engine copy, patched in step with the row) is the plan while it names
106
+ * exactly the mounted panes; else the planner's. Main itself is never
107
+ * written. Returns whether anything was written.
108
+ */
109
+ export declare function reconcileWindowOwnerGeometry(tc: WindowGeometryChart | null | undefined, ownerId: string, canvasHeightPx?: number): boolean;
110
+ /**
111
+ * The reversal (Show chart): every pane the owner mounted goes back to the
112
+ * height a normal chart mounts it at (plan section 2.2): chart-shaped panels
113
+ * and time panes at PANEL_CHART_GRID_HEIGHT, a table at its content height.
114
+ * Writes only once the candle pane is visible again (the host releases main
115
+ * first), so the engine carves the panes out of main the way a fresh mount
116
+ * would. Keyed by the owner id because the flag is already off by then.
117
+ * Returns whether anything was written.
118
+ */
119
+ export declare function restoreNormalOwnerGeometry(tc: WindowGeometryChart | null | undefined, ownerId: string, canvasHeightPx?: number): boolean;
@@ -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
+ }
@@ -58,6 +58,7 @@
58
58
  *
59
59
  * Worker-safe: imports only the chart's session utils (no Vue, store, i18n).
60
60
  */
61
+ import { type LiveBucketVenue } from './live-bucket.util.js';
61
62
  /** The `time.session` codes (contract C3). */
62
63
  export declare const WRUN_BAR_SESSION: Readonly<{
63
64
  readonly closed: 0;
@@ -78,14 +79,22 @@ export interface WrunBarVenue {
78
79
  symbol: string;
79
80
  /** The series' bar interval (ms); one day or longer reads the calendar-bar rule. */
80
81
  intervalMs: number;
82
+ /**
83
+ * The chart's bar grid: where its own bars open and close (`liveBucketVenueOf` over the same metadata, its
84
+ * session mode and formula included). The wrun row builder lands another market's grid rows on it
85
+ * (wrun-source-rows.util). The facts never read it: they follow the market and the interval alone, never the
86
+ * chart's RTH or extended mode. Absent: the UTC floor.
87
+ */
88
+ barGrid?: LiveBucketVenue;
81
89
  }
82
90
  /** Which C3 rule a market follows. */
83
91
  export type WrunBarFactsMarket = 'cme' | 'us_equities' | 'utc';
84
92
  export declare function wrunBarFactsMarketOf(exchange: string): WrunBarFactsMarket;
85
93
  /**
86
94
  * 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.
95
+ * bar interval, with the chart's bar grid (`barGrid`): undefined unless
96
+ * exchange and symbol are non-empty strings and the interval is a positive
97
+ * number.
89
98
  */
90
99
  export declare function wrunBarVenueOf(market: unknown, intervalMs: number): WrunBarVenue | undefined;
91
100
  /**