@orangecharts/wrun-chart-host 0.9.0 → 0.11.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 (252) hide show
  1. package/README.md +2 -0
  2. package/dist/constants/feature-flags.constants.d.ts +15 -1
  3. package/dist/constants/feature-flags.constants.js +130 -24
  4. package/dist/constants/governed-exchanges.constants.d.ts +12 -0
  5. package/dist/constants/governed-exchanges.constants.js +16 -0
  6. package/dist/constants/opra-compliance.constants.d.ts +3 -2
  7. package/dist/constants/opra-compliance.constants.js +3 -2
  8. package/dist/constants/option-venues.constants.d.ts +2 -2
  9. package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +26 -0
  10. package/dist/constants/scriptEditor/builtin-script-snippets.js +6 -0
  11. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +15 -0
  12. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +17 -0
  13. package/dist/constants/venue-presets.constants.d.ts +20 -20
  14. package/dist/constants/venue-presets.constants.js +24 -26
  15. package/dist/host-env.d.ts +21 -5
  16. package/dist/host-env.js +6 -0
  17. package/dist/host-ports.types.d.ts +102 -19
  18. package/dist/index.d.ts +18 -0
  19. package/dist/index.js +18 -0
  20. package/dist/interfaces/cancel-reason.interface.d.ts +1 -1
  21. package/dist/interfaces/cme-realtime.interface.d.ts +16 -9
  22. package/dist/interfaces/cme-realtime.interface.js +6 -3
  23. package/dist/interfaces/kscript-diagnostics.interface.d.ts +12 -0
  24. package/dist/interfaces/opra-realtime.interface.d.ts +1 -5
  25. package/dist/interfaces/prediction-market.interface.d.ts +7 -0
  26. package/dist/interfaces/replay.interface.d.ts +8 -0
  27. package/dist/interfaces/stocks-realtime.interface.d.ts +57 -0
  28. package/dist/interfaces/stocks-realtime.interface.js +32 -0
  29. package/dist/interfaces/wrun-runtime.interface.d.ts +18 -2
  30. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +62 -94
  31. package/dist/kscript-data/controls/live-trades-merge.util.js +106 -171
  32. package/dist/market-data/billing.interface.d.ts +174 -36
  33. package/dist/market-data/billing.interface.js +58 -8
  34. package/dist/market-data/venue.d.ts +152 -7
  35. package/dist/market-data/venues/cme.contract.copy.json +66 -0
  36. package/dist/market-data/venues/cme.d.ts +126 -0
  37. package/dist/market-data/venues/cme.js +133 -0
  38. package/dist/market-data/venues/index.d.ts +294 -7
  39. package/dist/market-data/venues/index.js +49 -6
  40. package/dist/market-data/venues/opra.contract.copy.json +3 -2
  41. package/dist/market-data/venues/opra.d.ts +2 -2
  42. package/dist/market-data/venues/opra.js +5 -2
  43. package/dist/market-data/venues/stocks.contract.copy.json +64 -0
  44. package/dist/market-data/venues/stocks.d.ts +130 -0
  45. package/dist/market-data/venues/stocks.js +117 -0
  46. package/dist/settings-templates/footprint-rows.js +35 -2
  47. package/dist/settings-templates/form-rows.d.ts +2 -1
  48. package/dist/settings-templates/index.js +7 -3
  49. package/dist/settings-templates/indicator-fields.d.ts +5 -4
  50. package/dist/settings-templates/indicator-fields.js +79 -10
  51. package/dist/settings-templates/tool-rules.d.ts +32 -15
  52. package/dist/settings-templates/tool-rules.js +33 -11
  53. package/dist/settings-templates/tool-tables.generated.js +95 -31
  54. package/dist/utility/chart/book-live-bucket.util.d.ts +15 -0
  55. package/dist/utility/chart/book-live-bucket.util.js +47 -0
  56. package/dist/utility/chart/cme-cache-context.util.d.ts +5 -3
  57. package/dist/utility/chart/cme-cache-context.util.js +10 -6
  58. package/dist/utility/chart/cme-realtime.util.js +10 -0
  59. package/dist/utility/chart/cme-user-scripts-gate.util.d.ts +83 -0
  60. package/dist/utility/chart/cme-user-scripts-gate.util.js +142 -0
  61. package/dist/utility/chart/effective-chart-session.util.d.ts +14 -0
  62. package/dist/utility/chart/effective-chart-session.util.js +39 -0
  63. package/dist/utility/chart/host-bar-placement.util.d.ts +28 -0
  64. package/dist/utility/chart/host-bar-placement.util.js +170 -30
  65. package/dist/utility/chart/index-host-tier.util.d.ts +3 -1
  66. package/dist/utility/chart/index-host-tier.util.js +7 -2
  67. package/dist/utility/chart/index-mode-admission.util.js +30 -3
  68. package/dist/utility/chart/kscript-apply-fingerprint.util.js +1 -1
  69. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +35 -11
  70. package/dist/utility/chart/kscript-drawing-safe-area.util.js +145 -35
  71. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +9 -7
  72. package/dist/utility/chart/kscript-live-coalesce.util.js +13 -8
  73. package/dist/utility/chart/kscript-live-source-identity.util.d.ts +9 -0
  74. package/dist/utility/chart/kscript-live-source-identity.util.js +10 -1
  75. package/dist/utility/chart/kscript-provenance-keys.util.js +13 -0
  76. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +5 -1
  77. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +32 -2
  78. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +45 -0
  79. package/dist/utility/chart/kscript-venue-policy.util.d.ts +156 -43
  80. package/dist/utility/chart/kscript-venue-policy.util.js +249 -59
  81. package/dist/utility/chart/live-bucket.util.d.ts +24 -8
  82. package/dist/utility/chart/live-bucket.util.js +85 -27
  83. package/dist/utility/chart/market-session-schedule.util.d.ts +10 -0
  84. package/dist/utility/chart/market-session-schedule.util.js +16 -0
  85. package/dist/utility/chart/marketKind.util.js +5 -0
  86. package/dist/utility/chart/mixed-mode.util.d.ts +7 -0
  87. package/dist/utility/chart/mixed-mode.util.js +14 -0
  88. package/dist/utility/chart/opra-read-access.leaf.d.ts +5 -3
  89. package/dist/utility/chart/opra-read-access.leaf.js +5 -3
  90. package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +11 -16
  91. package/dist/utility/chart/opra-user-scripts-gate.util.js +12 -28
  92. package/dist/utility/chart/rth-session.util.d.ts +12 -10
  93. package/dist/utility/chart/rth-session.util.js +25 -21
  94. package/dist/utility/chart/trading-day.util.d.ts +17 -0
  95. package/dist/utility/chart/trading-day.util.js +59 -0
  96. package/dist/utility/chart/window-geometry.leaf.d.ts +8 -0
  97. package/dist/utility/chart/window-geometry.leaf.js +22 -6
  98. package/dist/utility/chart/window-owner.leaf.d.ts +23 -2
  99. package/dist/utility/chart/window-owner.leaf.js +45 -3
  100. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +33 -15
  101. package/dist/utility/chart/wrun-bar-session-facts.util.js +70 -20
  102. package/dist/utility/chart/wrun-run-result.util.d.ts +12 -0
  103. package/dist/utility/chart/wrun-run-result.util.js +141 -6
  104. package/dist/utility/intl-locale.util.js +5 -0
  105. package/dist/utility/options/option-bar-anchor.util.d.ts +145 -0
  106. package/dist/utility/options/option-bar-anchor.util.js +340 -0
  107. package/dist/utility/options/option-venue.util.d.ts +18 -0
  108. package/dist/utility/options/option-venue.util.js +27 -0
  109. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +4 -0
  110. package/dist/utility/v2/gate-plane.util.d.ts +12 -3
  111. package/dist/utility/v2/gate-plane.util.js +30 -4
  112. package/dist/utility/v2/gate-session-latch.util.js +1 -1
  113. package/dist/utility/v2/stocks-governed.util.d.ts +16 -0
  114. package/dist/utility/v2/stocks-governed.util.js +34 -0
  115. package/dist/utility/wrun/derived-roots.leaf.d.ts +13 -0
  116. package/dist/utility/wrun/derived-roots.leaf.js +27 -0
  117. package/dist/utility/wrun/derived-roots.util.d.ts +205 -0
  118. package/dist/utility/wrun/derived-roots.util.js +451 -0
  119. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +43 -7
  120. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +89 -19
  121. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +9 -4
  122. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +47 -6
  123. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -2
  124. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -2
  125. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.d.ts +24 -3
  126. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +46 -10
  127. package/dist/utility/wrun/sources/lanes/option_daily.js +5 -2
  128. package/dist/utility/wrun/sources/lanes/options_flow.js +5 -2
  129. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +64 -19
  130. package/dist/utility/wrun/sources/opra-option-lanes.util.js +105 -35
  131. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +2 -1
  132. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +2 -1
  133. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +3 -0
  134. package/dist/utility/wrun/sources/row-lanes/option_prints.js +19 -4
  135. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +17 -4
  136. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +52 -13
  137. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +88 -19
  138. package/dist/utility/wrun/sources/row-lanes/option_surface.js +2 -1
  139. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -0
  140. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +24 -9
  141. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +41 -10
  142. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +111 -0
  143. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +133 -0
  144. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +15 -3
  145. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +22 -3
  146. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +31 -0
  147. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +197 -13
  148. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +761 -27
  149. package/dist/utility/wrun/wrun-browser-sources.leaf.js +1 -2
  150. package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +12 -0
  151. package/dist/utility/wrun/wrun-builtin-twin.util.js +21 -0
  152. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +60 -16
  153. package/dist/utility/wrun/wrun-chart-market-facts.util.js +113 -61
  154. package/dist/utility/wrun/wrun-color-settings.util.d.ts +9 -0
  155. package/dist/utility/wrun/wrun-color-settings.util.js +33 -0
  156. package/dist/utility/wrun/wrun-download-meter.util.d.ts +15 -0
  157. package/dist/utility/wrun/wrun-download-meter.util.js +14 -2
  158. package/dist/utility/wrun/wrun-download-plan.util.d.ts +99 -0
  159. package/dist/utility/wrun/wrun-download-plan.util.js +118 -0
  160. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +11 -3
  161. package/dist/utility/wrun/wrun-draft-legend-note.util.js +26 -4
  162. package/dist/utility/wrun/wrun-frames.d.ts +27 -6
  163. package/dist/utility/wrun/wrun-frames.js +73 -10
  164. package/dist/utility/wrun/wrun-handles.util.d.ts +7 -3
  165. package/dist/utility/wrun/wrun-handles.util.js +9 -8
  166. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +7 -1
  167. package/dist/utility/wrun/wrun-hosted-wire.util.js +12 -2
  168. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +18 -4
  169. package/dist/utility/wrun/wrun-hud-looks.util.js +45 -13
  170. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +68 -0
  171. package/dist/utility/wrun/wrun-input-requirements.leaf.js +163 -7
  172. package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
  173. package/dist/utility/wrun/wrun-leg-close.util.d.ts +59 -23
  174. package/dist/utility/wrun/wrun-leg-close.util.js +186 -28
  175. package/dist/utility/wrun/wrun-live-intake.util.d.ts +35 -15
  176. package/dist/utility/wrun/wrun-live-intake.util.js +243 -126
  177. package/dist/utility/wrun/wrun-live-tick.util.d.ts +13 -5
  178. package/dist/utility/wrun/wrun-live-tick.util.js +279 -99
  179. package/dist/utility/wrun/wrun-market-facts.util.d.ts +13 -3
  180. package/dist/utility/wrun/wrun-market-facts.util.js +13 -3
  181. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +60 -11
  182. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +70 -5
  183. package/dist/utility/wrun/wrun-market-size-defaults.util.js +31 -5
  184. package/dist/utility/wrun/wrun-opra-lane.util.d.ts +17 -4
  185. package/dist/utility/wrun/wrun-opra-lane.util.js +6 -4
  186. package/dist/utility/wrun/wrun-option-book-rows.util.d.ts +56 -0
  187. package/dist/utility/wrun/wrun-option-book-rows.util.js +96 -0
  188. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.d.ts +31 -0
  189. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.js +119 -0
  190. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +23 -6
  191. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +47 -11
  192. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +86 -19
  193. package/dist/utility/wrun/wrun-option-strike-flow.util.js +168 -62
  194. package/dist/utility/wrun/wrun-option-views.util.d.ts +323 -28
  195. package/dist/utility/wrun/wrun-option-views.util.js +484 -71
  196. package/dist/utility/wrun/wrun-options-chain.util.d.ts +3 -3
  197. package/dist/utility/wrun/wrun-options-chain.util.js +2 -0
  198. package/dist/utility/wrun/wrun-output-style.util.d.ts +6 -2
  199. package/dist/utility/wrun/wrun-output-style.util.js +20 -2
  200. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +32 -2
  201. package/dist/utility/wrun/wrun-overlay-drivers.util.js +13 -3
  202. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +10 -1
  203. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +52 -4
  204. package/dist/utility/wrun/wrun-overlay-recovery.util.js +3 -1
  205. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +160 -42
  206. package/dist/utility/wrun/wrun-overlay-run.util.js +1244 -209
  207. package/dist/utility/wrun/wrun-pane-format.util.d.ts +2 -1
  208. package/dist/utility/wrun/wrun-pane-format.util.js +7 -3
  209. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +9 -0
  210. package/dist/utility/wrun/wrun-panel-mount.util.js +114 -19
  211. package/dist/utility/wrun/wrun-panel-style.util.d.ts +10 -9
  212. package/dist/utility/wrun/wrun-panel-style.util.js +58 -9
  213. package/dist/utility/wrun/wrun-param-map.util.d.ts +14 -11
  214. package/dist/utility/wrun/wrun-param-map.util.js +10 -5
  215. package/dist/utility/wrun/wrun-param-values.util.d.ts +14 -4
  216. package/dist/utility/wrun/wrun-param-values.util.js +4 -0
  217. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +15 -2
  218. package/dist/utility/wrun/wrun-pin-spelling.util.js +39 -14
  219. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +50 -0
  220. package/dist/utility/wrun/wrun-refusal-surface.util.js +68 -0
  221. package/dist/utility/wrun/wrun-refusal.util.d.ts +3 -2
  222. package/dist/utility/wrun/wrun-refusal.util.js +22 -0
  223. package/dist/utility/wrun/wrun-refused-latest.util.d.ts +10 -0
  224. package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
  225. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +26 -0
  226. package/dist/utility/wrun/wrun-registry-errors.util.js +34 -0
  227. package/dist/utility/wrun/wrun-replay-lane.util.js +3 -2
  228. package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
  229. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +20 -6
  230. package/dist/utility/wrun/wrun-run-interval-session.util.js +22 -7
  231. package/dist/utility/wrun/wrun-run-interval.util.d.ts +43 -9
  232. package/dist/utility/wrun/wrun-run-interval.util.js +58 -15
  233. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +45 -1
  234. package/dist/utility/wrun/wrun-script-inputs.util.js +112 -4
  235. package/dist/utility/wrun/wrun-setting-words.util.d.ts +7 -3
  236. package/dist/utility/wrun/wrun-setting-words.util.js +13 -5
  237. package/dist/utility/wrun/wrun-socket-row-source.d.ts +27 -2
  238. package/dist/utility/wrun/wrun-socket-row-source.js +118 -8
  239. package/dist/utility/wrun/wrun-source-rows.util.d.ts +29 -18
  240. package/dist/utility/wrun/wrun-source-rows.util.js +61 -27
  241. package/dist/utility/wrun/wrun-style-words.util.js +6 -4
  242. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +3 -2
  243. package/dist/utility/wrun/wrun-table-chrome.util.js +19 -11
  244. package/dist/utility/wrun/wrun-tape-per-order.util.d.ts +2 -0
  245. package/dist/utility/wrun/wrun-tape-per-order.util.js +7 -0
  246. package/dist/utility/wrun/wrun-tape-source.util.d.ts +17 -9
  247. package/dist/utility/wrun/wrun-tape-source.util.js +20 -12
  248. package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
  249. package/dist/utils/replay/replay-buffer-math.js +227 -20
  250. package/dist/workers/constants/socket-slots.d.ts +91 -6
  251. package/dist/workers/constants/socket-slots.js +85 -6
  252. package/package.json +5 -5
@@ -555,8 +555,10 @@ import { assertWrunCandleMemberLook, isWrunGlowClampDisabled, landWrunGlowPx, la
555
555
  import { wrunAbiVersion, wrunFramesOf } from '../wrun/wrun-pack.util.js';
556
556
  import { formatWrunValue, isWrunValueFormat, WRUN_VALUE_FORMATS } from '../wrun/wrun-pane-format.util.js';
557
557
  import { createWrunRenderBudget, selectWrunRenderables, wrunRenderValueBytes, wrunSelectionBytes, } from '../wrun/wrun-render-select.util.js';
558
- import { parseWrunThemeToken, wrunThemeTokenOfPacked, wrunThemeTokenScaleAlpha, wrunThemeTokenWithAlpha, wrunThemeTokenWord, } from '../wrun/wrun-style-words.util.js';
558
+ import { formatWrunNumber, parseWrunThemeToken, wrunThemeTokenOfPacked, wrunThemeTokenScaleAlpha, wrunThemeTokenWithAlpha, wrunThemeTokenWord, } from '../wrun/wrun-style-words.util.js';
559
+ import { substituteWrunChartNames } from '../wrun/wrun-chart-names.util.js';
559
560
  import { wrunCornerLabelLook, wrunTextLookPayload } from '../wrun/wrun-text-look.util.js';
561
+ import { wrunPanelFrameNotices, } from '../wrun/wrun-frames.js';
560
562
  import { resolveWrunCustomTitle, wrunParamChoices, wrunParamWordsShape, wrunRunOverlayPalette, wrunVisibilityTargets, } from '../wrun/wrun-script-inputs.util.js';
561
563
  import { wrunCodedWords } from '../wrun/wrun-setting-words.util.js';
562
564
  import { decodeWrunPackedColor, isWrunStyleTargetHidden, wrunColorSettingString, wrunVisibilityOwnedOutputs, } from '../wrun/wrun-color-settings.util.js';
@@ -744,7 +746,13 @@ export function buildWrunRunResult(options) {
744
746
  // A strategy output exists only after a run, which loaded the shared host first.
745
747
  if (strategy !== undefined)
746
748
  budget.spend(wrunChartHostEnv().sharedHost().wrunStrategyWireBytes(strategy));
747
- return buildWrunRunResultWithSelection({ ...options, selection, handles, strategy }, memo);
749
+ const result = buildWrunRunResultWithSelection({ ...options, selection, handles, strategy }, memo);
750
+ // The HUD headline rides the result (the object as built: nothing keys it by identity yet), so a pane whose frame
751
+ // carries no rows can say why with the run's own words.
752
+ const headline = wrunHudHeadlineOf(options);
753
+ if (headline !== undefined)
754
+ result.headline = headline;
755
+ return result;
748
756
  }
749
757
  catch (error) {
750
758
  if (!(error instanceof Error) || !error.message.startsWith('wrun_frame_invalid:'))
@@ -769,6 +777,55 @@ export function buildWrunRunResult(options) {
769
777
  };
770
778
  }
771
779
  }
780
+ /**
781
+ * The run's HUD headline (WrunRunResult.headline): the first tile of `presentation.hud` declared `headline: true`
782
+ * (LK05, one per card; the first card that has one), read on the last ready row the way the latest-values snapshot
783
+ * reads it (wrun-overlay-run.util wrunLatestSnapshotOf): a `slot` tile's string slot text (the chart's names put in),
784
+ * else an `output` tile's value formatted like the card's (formatWrunNumber over the tile's `format`, the chart's
785
+ * price digits). Volatility Character's card names its character word this way ("Mean-reverting"). Undefined when no
786
+ * tile is a headline, no row is ready, or the row holds no text, a blank text or a non-finite value for it.
787
+ */
788
+ function wrunHudHeadlineOf(options) {
789
+ const cards = options.metadata.presentation?.hud;
790
+ if (!Array.isArray(cards))
791
+ return undefined;
792
+ let tile;
793
+ for (const card of cards) {
794
+ tile = (Array.isArray(card?.tiles) ? card.tiles : []).find((candidate) => candidate?.headline === true);
795
+ if (tile !== undefined)
796
+ break;
797
+ }
798
+ if (tile === undefined)
799
+ return undefined;
800
+ let last;
801
+ for (let at = options.rows.length - 1; at >= 0 && last === undefined; at -= 1) {
802
+ const row = options.rows[at];
803
+ if (row?.outputs !== null && row?.outputs !== undefined && Number.isFinite(row.ts))
804
+ last = row;
805
+ }
806
+ if (last === undefined)
807
+ return undefined;
808
+ let text;
809
+ if (typeof tile.slot === 'string') {
810
+ const slot = (options.metadata.string_slots ?? []).find((candidate) => candidate.name === tile.slot);
811
+ const raw = slot === undefined ? undefined : last.strings?.[slot.index];
812
+ if (typeof raw === 'string')
813
+ text = substituteWrunChartNames(raw, options.selectContext?.chartNames);
814
+ }
815
+ else if (typeof tile.output === 'string') {
816
+ const output = options.metadata.outputs.find((candidate) => candidate.name === tile.output);
817
+ const value = output === undefined ? undefined : last.outputs?.[output.index];
818
+ if (typeof value === 'number' && Number.isFinite(value)) {
819
+ const priceDigits = options.selectContext?.priceDigits;
820
+ text = formatWrunNumber(value, {
821
+ ...(typeof tile.format === 'string' ? { format: tile.format } : {}),
822
+ ...(priceDigits !== undefined ? { priceDigits } : {}),
823
+ });
824
+ }
825
+ }
826
+ const trimmed = text?.trim();
827
+ return trimmed ? trimmed : undefined;
828
+ }
772
829
  /** A run result's author-facing notices (every canvas child's, in child
773
830
  * order; a fresh array, empty when there are none). A run seam publishes
774
831
  * them as warning rows (wrun-canvases.util `wrunCanvasNoticeDiagnostics`). */
@@ -1204,6 +1261,56 @@ function wrunRowsCarryValue(rows, columns) {
1204
1261
  return typeof value === 'number' && Number.isFinite(value);
1205
1262
  }));
1206
1263
  }
1264
+ /** Each painted sheet's visibility targets, walked once: a live session builds every tick from one sheet. */
1265
+ const emptyTargetSheets = new WeakMap();
1266
+ /**
1267
+ * The Style targets a run drew nothing for (WrunRunResult.emptyTargets), in the visibility table's order. A drawn
1268
+ * output (a candle group as its first output, all four values on one row), a range (both edges on one row) or a fill
1269
+ * (both sides on one row) whose columns no ready row carries finite: the `rowsCarry` rule `omit_if_empty` mounts
1270
+ * by, so every declaration that rule left out is one, and so is a plain output an input switched off (NaN on every
1271
+ * row: it mounts and draws nothing). A `drawing` group target (a drawing, a segment, a handle kind) no delivered
1272
+ * record names. A target the market leaves out (`visible_by`) is never one: it mounts nothing whatever its values.
1273
+ * Not judged here: an inset output, a box and every `skip` target (renderers, canvases, levels, panels), whose own
1274
+ * builders hold whether they drew, and a shape's `shape_where` gate (its value column decides).
1275
+ */
1276
+ function wrunRunEmptyTargets(metadata, facts) {
1277
+ let targets = emptyTargetSheets.get(metadata);
1278
+ if (targets === undefined) {
1279
+ targets = wrunVisibilityTargets(metadata);
1280
+ emptyTargetSheets.set(metadata, targets);
1281
+ }
1282
+ const columnOf = (name) => typeof name === 'string' && !facts.hidden.has(name) ? facts.outputIndexByName.get(name) : undefined;
1283
+ const empty = [];
1284
+ for (const target of targets) {
1285
+ if (target.group === 'drawing') {
1286
+ if (!facts.drawn.has(target.target))
1287
+ empty.push(target.target);
1288
+ continue;
1289
+ }
1290
+ let columns;
1291
+ if (target.section === 'outputs' && target.group === 'nested') {
1292
+ const group = facts.candleGroupByOpen.get(target.target);
1293
+ columns =
1294
+ group === undefined || facts.hidden.has(target.target)
1295
+ ? [columnOf(target.target)]
1296
+ : group.map((member) => member.index);
1297
+ }
1298
+ else if (target.section === 'ranges') {
1299
+ columns = [columnOf(target.entry.upper), columnOf(target.entry.lower)];
1300
+ }
1301
+ else if (target.section === 'fills') {
1302
+ const between = Array.isArray(target.entry.between) ? target.entry.between : [];
1303
+ columns = between.length === 2 ? between.map(columnOf) : [undefined];
1304
+ }
1305
+ else {
1306
+ continue;
1307
+ }
1308
+ if (columns.every((column) => column !== undefined) && !facts.carries(columns)) {
1309
+ empty.push(target.target);
1310
+ }
1311
+ }
1312
+ return empty;
1313
+ }
1207
1314
  /** A payload with its declared look (WRUN-STYLE DW26) folded in: the frozen
1208
1315
  * fields keep their engine key order and their per-record values (a ladder
1209
1316
  * pick wins over the look's static word); the look adds every key the
@@ -3842,12 +3949,32 @@ function buildWrunRunResultWithSelection(options, memo) {
3842
3949
  // A parent that homes in a declared pane takes that pane's scale look and
3843
3950
  // axis format on its own define (OT18 OT19).
3844
3951
  const homeDeclaration = homePane === undefined ? undefined : paneByName.get(homePane);
3845
- // Every canvas child's author-facing notices (a coarsened TPO), in child order, then a line per
3846
- // dropped entry (WrunRunNote), so the author sees why the fill is missing.
3952
+ // Every canvas child's author-facing notices (a coarsened TPO) and every panel's (a legend text drawn
3953
+ // clipped to its cap, wrun-frames), in child order, then a line per dropped entry (WrunRunNote), so the
3954
+ // author sees why the fill is missing.
3847
3955
  const notices = [
3848
- ...childOverlays.flatMap((child) => child.kind === 'heatmap' || child.kind === 'profile' || child.kind === 'matrix' ? (child.notices ?? []) : []),
3956
+ ...childOverlays.flatMap((child) => child.kind === 'heatmap' || child.kind === 'profile' || child.kind === 'matrix'
3957
+ ? (child.notices ?? [])
3958
+ : child.kind === 'panel'
3959
+ ? wrunPanelFrameNotices(child.frame)
3960
+ : []),
3849
3961
  ...runNotes.map((note) => note.message),
3850
3962
  ];
3963
+ // The Style targets this run drew nothing for (WrunRunResult.emptyTargets), read before the commit: a live
3964
+ // build's memo answers `rowsCarry` over these rows only until then.
3965
+ const drawnTargets = new Set();
3966
+ const paneDrawings = seriesChildren.flatMap((child) => child.kind === 'series' ? (child.result.drawings ?? []) : []);
3967
+ for (const drawing of [...drawings, ...paneDrawings]) {
3968
+ if (drawing.styleTarget !== undefined)
3969
+ drawnTargets.add(drawing.styleTarget);
3970
+ }
3971
+ const emptyTargets = wrunRunEmptyTargets(metadata, {
3972
+ carries: rowsCarry,
3973
+ hidden: hiddenOutputs,
3974
+ candleGroupByOpen,
3975
+ outputIndexByName,
3976
+ drawn: drawnTargets,
3977
+ });
3851
3978
  // The build completed: the memo now holds its units.
3852
3979
  memo?.commit();
3853
3980
  // The child list rides a wrun-4 result, a result with children, and every result of a sheet that declares
@@ -3863,6 +3990,7 @@ function buildWrunRunResultWithSelection(options, memo) {
3863
3990
  ...(carriesChildren ? { childOverlays } : {}),
3864
3991
  ...(notices.length > 0 ? { notices } : {}),
3865
3992
  ...(runNotes.length > 0 ? { notes: runNotes } : {}),
3993
+ ...(emptyTargets.length > 0 ? { emptyTargets } : {}),
3866
3994
  ...(drawings.length > 0 ||
3867
3995
  handleSet !== undefined ||
3868
3996
  metadata.drawings?.some((drawing) => drawing.kind === 'card' || drawing.kind === 'ladder' || drawing.kind === 'feed' || drawing.kind === 'meter')
@@ -5170,7 +5298,13 @@ const ENGINE_LABEL_Y_ALIGN = new Map([
5170
5298
  * from the anchored edge (left and top to the right and down, right and
5171
5299
  * bottom to the left and up, a centre axis signed: the rule titan's
5172
5300
  * paneAnchorOffset places every other anchored mark by), so x flips on a
5173
- * right anchor and y on a bottom one. */
5301
+ * right anchor and y on a bottom one. A top corner (top_left, top_center,
5302
+ * top_right) also carries `safeArea: 'chrome'`: titan moves that label down
5303
+ * by the host's card safe-area insets for its pane (`topLeft` on the left,
5304
+ * `topRight` on the centre and the right), so a note never draws behind the
5305
+ * chart's top chrome (the symbol title, interval pill and info button row
5306
+ * over the canvas). A kScript plotLabel never carries the flag, and the
5307
+ * hosted lane (om `wrunCornerLabelPayload`) sets the same one. */
5174
5308
  function cornerLabelPayload(label, position, color, size, offset, look) {
5175
5309
  const horizontal = position.includes('left') ? 'left' : position.includes('right') ? 'right' : 'center';
5176
5310
  const vertical = position.includes('top') ? 'top' : position.includes('bottom') ? 'bottom' : 'middle';
@@ -5194,5 +5328,6 @@ function cornerLabelPayload(label, position, color, size, offset, look) {
5194
5328
  y: vertical === 'bottom' ? flipped(payload.y) : payload.y,
5195
5329
  xAlign: ENGINE_LABEL_X_ALIGN.get(String(payload.xAlign)) ?? payload.xAlign,
5196
5330
  yAlign: ENGINE_LABEL_Y_ALIGN.get(String(payload.yAlign)) ?? payload.yAlign,
5331
+ ...(vertical === 'top' ? { safeArea: 'chrome' } : {}),
5197
5332
  };
5198
5333
  }
@@ -8,6 +8,11 @@ const INTL_LOCALES = {
8
8
  hi: 'hi-IN',
9
9
  es: 'es-ES',
10
10
  tr: 'tr-TR',
11
+ pt: 'pt-BR',
12
+ fr: 'fr-FR',
13
+ de: 'de-DE',
14
+ it: 'it-IT',
15
+ pl: 'pl-PL',
11
16
  };
12
17
  const INTL_TAGS = new Set(Object.values(INTL_LOCALES));
13
18
  /** The Intl tag for an app locale code. Idempotent: a value that already is an Intl tag passes through. */
@@ -0,0 +1,145 @@
1
+ /**
2
+ * The bars a grouped option read lays (OPTLOAD-READ-CONTRACT 3.2 to 3.4): the app's ONE mirror of tsdb-gateway's anchor
3
+ * rules, read at origin/main d83cbbf20 (pkg/tsdb/selects/option_read_shape.go `barAnchorRules`, `optionReadAnchorReads`,
4
+ * `OptionReadGridOf` and each rule's `fitTier`, `bar`, `session`, `boundary`, `barEnd` and `lays`;
5
+ * option_print_agg_group.go `optionPrintAggCMESessionScopes`; trade_agg.go `cmeRegularSessionAnchor` and
6
+ * `cmeEnergySessionAnchor`; cme.go `cmeSessionDay`, `cmeSessionOpen`, `cmeCurrentSessionLabel` and `isCMEGroupExchange`).
7
+ * Every option read that names a `barAnchor` takes the anchors, their bars, the venues they lay and the reads that take
8
+ * them from here: the strike and contract flow groupings (wrun-option-strike-flow.util), the flow scopes' bars
9
+ * (option-print-agg-scope.worker.util), the prints' per-bar cut (k-option-print.worker), the surface pick
10
+ * (k-option-surface.worker) and the delayed bound's grid (option-read-grid.util). The rules are keyed by pb-common's
11
+ * `BarAnchor`, so an anchor the protocol adds fails the type check until it has a rule here, and the class guard
12
+ * (tests/utility/options/option-bar-anchor.class.spec.ts) fails by name on any other module that names an anchor.
13
+ *
14
+ * - UTC: bars on the Unix epoch, every row counted; its session is the UTC date.
15
+ * - US_EQUITY_RTH, CME_RTH and CME_ENERGY_RTH: a regular session on the New York wall clock (09:30 to 16:00; 09:30 to
16
+ * 16:15, the CME platform session the CME candles keep; 09:00 to 14:30, the energy pit session), weekdays only, bars
17
+ * open + k * width, only rows of [open, close) counted, the last bar of a day short; no holiday is modelled, as the
18
+ * charts model none. The two CME anchors lay bars over the CME group's rows alone, built from tiers dividing 15 and 30
19
+ * minutes; daylight saving comes from the tz database on both sides.
20
+ * - CME_SESSION: the Globex trade date (17:00 Chicago opens the next; a weekday holiday's session belongs to the next
21
+ * trade date on the CME calendar, a weekend day keeps its own date), each bar stamped at the 17:00 open of its first
22
+ * session day; a 604,800 s bar is the ISO week of a trade date. The CME group's alone, taken by OPTION_PRINT_AGG's
23
+ * COIN, MARKET, STRIKE, EXPIRY, EXPIRY_STRIKE and CONTRACT scopes alone, from a tier dividing an hour. It drops no
24
+ * row: an always-on root's weekend rows land on their own dates, as the chart's lattice books them.
25
+ *
26
+ * A decider proves an anchor's bars against the chart's own: a bucket the anchor lays no bar for may fall on a chart bar
27
+ * only where the chart's product holds no trading (`optionChartClosedAt`, its schedule), never because the anchor's own
28
+ * hours leave it out (a CME regular session's weekend on an always-on root).
29
+ *
30
+ * Pure and worker-safe: the zone clock (ny-calendar.util), the CME lattice's trade calendar (cme-session-bucket.util) and
31
+ * the CME products' schedules (market-session-schedule.util).
32
+ */
33
+ import { BarAnchor } from '@orangecharts/orange-v2-pb-common';
34
+ /** pb-common `BarAnchor` by name: the values a request names (the gateway decodes JSON enums as numbers). */
35
+ export declare const OPTION_BAR_ANCHOR: Readonly<{
36
+ readonly UTC: BarAnchor.UTC;
37
+ readonly US_EQUITY_RTH: BarAnchor.US_EQUITY_RTH;
38
+ readonly CME_SESSION: BarAnchor.CME_SESSION;
39
+ readonly CME_RTH: BarAnchor.CME_RTH;
40
+ readonly CME_ENERGY_RTH: BarAnchor.CME_ENERGY_RTH;
41
+ }>;
42
+ /** A read that names `barAnchor`, as the gateway registers it: its type, and on OPTION_PRINT_AGG its scope. */
43
+ export type OptionBarAnchorRead = 'OPTION_PRINT_AGG/COIN' | 'OPTION_PRINT_AGG/MARKET' | 'OPTION_PRINT_AGG/VENUE' | 'OPTION_PRINT_AGG/PRINTS' | 'OPTION_PRINT_AGG/STRIKE' | 'OPTION_PRINT_AGG/EXPIRY' | 'OPTION_PRINT_AGG/EXPIRY_STRIKE' | 'OPTION_PRINT_AGG/CONTRACT' | 'OPTION_PRINT' | 'OPTION_SURFACE' | 'OPTION_STRIKE_AGG' | 'OPTION_STRIKE_FLOW_AGG';
44
+ /** A regular session on a wall clock: its zone, and its open and close as minutes after the zone's midnight. */
45
+ export interface OptionBarAnchorSession {
46
+ zone: string;
47
+ openMinutes: number;
48
+ closeMinutes: number;
49
+ }
50
+ /** One anchor's rule: the gateway's `barAnchorRule` and what admits it (`optionReadAnchorReads`, `lays`). */
51
+ export interface OptionBarAnchorRule {
52
+ readonly anchor: BarAnchor;
53
+ /** pb-common's name of the anchor (the read shape's words name it). */
54
+ readonly name: string;
55
+ /** The trade date its sessions key by (`sessionKeySQL`): a zone's wall clock plus hours, cut to a date. */
56
+ readonly tradeDate: Readonly<{
57
+ zone: string;
58
+ offsetHours: number;
59
+ }>;
60
+ /** The regular session it lays (the three RTH anchors); undefined for UTC and CME_SESSION. */
61
+ readonly session?: Readonly<OptionBarAnchorSession>;
62
+ /** The venues it lays bars over: every venue's rows, or the CME group's alone. */
63
+ readonly venues: 'every' | 'cme';
64
+ /** Whether it lays bars over an exchange's rows (`lays`); a read reaching any other venue is refused by name. */
65
+ lays(exchange: unknown): boolean;
66
+ /** Whether a read takes it (`optionReadAnchorReads`): every read naming `barAnchor`, but CME_SESSION's few. */
67
+ takes(read: OptionBarAnchorRead): boolean;
68
+ /** Whether a tier `tierMs` wide builds its bars `barMs` wide (0: the tier's own buckets), or sessions (`fitTier`). */
69
+ fitsTier(tierMs: number, barMs: number, session: boolean): boolean;
70
+ /** The open of the bar `barMs` wide holding `tMs` (`tMs` itself at 0), null where it lands in none (`bar`). */
71
+ barOpenMs(tMs: number, barMs: number): number | null;
72
+ /** The open of the session `tMs` trades in, null where none (`session`). */
73
+ sessionOpenMs(tMs: number): number | null;
74
+ /** Whether a window may start or end at `tMs` without splitting a bar or a session (`boundary`). */
75
+ isBoundary(tMs: number, barMs: number, session: boolean): boolean;
76
+ /** The latest instant at or before `tMs` a window may end at: a boundary. */
77
+ floorBoundaryMs(tMs: number, barMs: number, session: boolean): number;
78
+ /** The end of the bar (or session) stamped `openMs` (`barEnd`). */
79
+ barEndMs(openMs: number, barMs: number, session: boolean): number;
80
+ }
81
+ /** Every anchor's rule, by pb-common's value (`barAnchorRules`): a value without a rule fails the type check. */
82
+ export declare const OPTION_BAR_ANCHOR_RULES: Readonly<Record<BarAnchor, OptionBarAnchorRule>>;
83
+ /** The rule of an anchor value, or undefined for a value no rule lays (the gateway refuses it by name). */
84
+ export declare function optionBarAnchorRuleOf(anchor: unknown): OptionBarAnchorRule | undefined;
85
+ /**
86
+ * The anchors a read takes on a venue, in pb-common's order: every anchor the read takes that lays every venue's rows,
87
+ * and one laid over a venue group's alone only when the read names a venue of that group (`exchange`, the chain's): the
88
+ * gateway refuses a CME anchor by name on any other venue (OPRA, Deribit) and on a read that names none.
89
+ */
90
+ export declare function optionBarAnchorsTaken(read: OptionBarAnchorRead, exchange?: string): OptionBarAnchorRule[];
91
+ /**
92
+ * Where a bar proof may drop a bucket the chart lays a bar for: only at an instant the chart's own product holds no
93
+ * trading at, by its schedule (market-session-schedule.util `isGovernedFuturesSymbolOpenAt`). This is the one drop
94
+ * exemption every decider proves an anchor's bars with (the strike and contract flow groupings, the flow scopes' bars,
95
+ * the prints' per-bar cut). An anchor's own hours are not it: a CME regular session lays no bar on a weekend day, which a
96
+ * weekday product's regular-hours chart lays empty bars for, while an always-on root (crypto since 2026-05-29, 1OZ since
97
+ * 2026-07-24) trades through it. So on an always-on root's chart the session lands on no bars that hold weekend rows,
98
+ * and the decider falls back (UTC bars where they land, else today's fold). A chart off the CME group has no schedule
99
+ * here, so nothing it lays may be dropped.
100
+ */
101
+ export declare function optionChartClosedAt(grid: {
102
+ exchange?: unknown;
103
+ symbol?: unknown;
104
+ } | null | undefined): (tMs: number) => boolean;
105
+ /** A chain's trade-date clock, as option-trade-date.util decides it. */
106
+ export interface OptionBarAnchorClock {
107
+ zone: string;
108
+ rule: {
109
+ offsetHours: number;
110
+ weekendsToMonday?: true;
111
+ };
112
+ }
113
+ /**
114
+ * The anchor whose sessions are a chain's trade dates (contract 3.4), or undefined where none is: the first anchor the
115
+ * read takes on the venue whose session key (`tradeDate`) is the clock's own rule, a clock that moves its weekends to
116
+ * Monday matching none. New York's clock reads US_EQUITY_RTH's sessions, the UTC date UTC's, the Globex trade date
117
+ * (Chicago's wall clock plus 7 hours) CME_SESSION's on a CME group venue; a CME crypto root's clock (16:00 Chicago,
118
+ * weekends on Monday) is no anchor's.
119
+ */
120
+ export declare function optionSessionAnchorOf(clock: OptionBarAnchorClock, read: OptionBarAnchorRead, exchange?: string): OptionBarAnchorRule | undefined;
121
+ /** Where a grouped read's rows land (`OptionReadGrid`): bars `seconds` wide laid by `anchor`, or with `session` one
122
+ * group per trade date of the anchor. */
123
+ export interface OptionBarAnchorGrid {
124
+ anchor: BarAnchor;
125
+ seconds: number;
126
+ session: boolean;
127
+ }
128
+ /**
129
+ * The grid an `optionRead` groups on (`OptionReadGridOf`), or null when it groups nothing (no `barSeconds`, span BAR). A
130
+ * day bar is a UTC day's row on UTC and US_EQUITY_RTH, and keeps its anchor on every other (a trade date on
131
+ * CME_SESSION).
132
+ */
133
+ export declare function optionBarAnchorGridOf(shape: unknown): OptionBarAnchorGrid | null;
134
+ /** The open of the bar (or session) holding `tMs` on a grid (`OptionReadGrid.Bar`), null where it lands in none or
135
+ * where no rule lays the grid's anchor. */
136
+ export declare function optionGridBarOpenMs(grid: OptionBarAnchorGrid, tMs: number): number | null;
137
+ /** Whether a window may start or end at `tMs` on a grid (`OptionReadGrid.Boundary`); an anchor no rule lays splits
138
+ * nothing. */
139
+ export declare function optionGridIsBoundary(grid: OptionBarAnchorGrid, tMs: number): boolean;
140
+ /** The latest instant at or before `tMs` a window may end at on a grid, so a window cut there ends with its last whole
141
+ * bar. */
142
+ export declare function optionGridFloorBoundaryMs(grid: OptionBarAnchorGrid, tMs: number): number;
143
+ /** The first instant at or after `tMs` a window may start or end at on a grid (`OptionReadGrid.Ceil`): `tMs` on a
144
+ * boundary, else the end of the bar (or session) holding it, or of the bar after it, until one ends on a boundary. */
145
+ export declare function optionGridCeilBoundaryMs(grid: OptionBarAnchorGrid, tMs: number): number;