@orangecharts/wrun-chart-host 0.1.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 (198) hide show
  1. package/README.md +72 -0
  2. package/dist/constants/governed-exchanges.constants.d.ts +11 -0
  3. package/dist/constants/governed-exchanges.constants.js +11 -0
  4. package/dist/constants/indicator-sets.constants.d.ts +8 -0
  5. package/dist/constants/indicator-sets.constants.js +8 -0
  6. package/dist/constants/interval.constants.d.ts +34 -0
  7. package/dist/constants/interval.constants.js +121 -0
  8. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +28 -0
  9. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +65 -0
  10. package/dist/constants/tpo-color-schemes.constants.d.ts +30 -0
  11. package/dist/constants/tpo-color-schemes.constants.js +32 -0
  12. package/dist/host-env.d.ts +102 -0
  13. package/dist/host-env.js +26 -0
  14. package/dist/index.d.ts +93 -0
  15. package/dist/index.js +96 -0
  16. package/dist/indicators/controls/tpo-letter.util.d.ts +2 -0
  17. package/dist/indicators/controls/tpo-letter.util.js +13 -0
  18. package/dist/indicators/controls/tpo-session.util.d.ts +99 -0
  19. package/dist/indicators/controls/tpo-session.util.js +389 -0
  20. package/dist/interfaces/kscript-diagnostics.interface.d.ts +64 -0
  21. package/dist/interfaces/kscript-diagnostics.interface.js +1 -0
  22. package/dist/interfaces/om-panel-data.interface.d.ts +103 -0
  23. package/dist/interfaces/om-panel-data.interface.js +7 -0
  24. package/dist/interfaces/wrun-runtime.interface.d.ts +2659 -0
  25. package/dist/interfaces/wrun-runtime.interface.js +55 -0
  26. package/dist/utility/chart/calendar-interval.util.d.ts +24 -0
  27. package/dist/utility/chart/calendar-interval.util.js +81 -0
  28. package/dist/utility/chart/candle-bar-end.util.d.ts +15 -0
  29. package/dist/utility/chart/candle-bar-end.util.js +23 -0
  30. package/dist/utility/chart/cme-realtime.util.d.ts +24 -0
  31. package/dist/utility/chart/cme-realtime.util.js +53 -0
  32. package/dist/utility/chart/interval-ladder.util.d.ts +27 -0
  33. package/dist/utility/chart/interval-ladder.util.js +92 -0
  34. package/dist/utility/chart/kscript-drawing-prep.util.d.ts +40 -0
  35. package/dist/utility/chart/kscript-drawing-prep.util.js +184 -0
  36. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +95 -0
  37. package/dist/utility/chart/kscript-drawing-safe-area.util.js +805 -0
  38. package/dist/utility/chart/kscript-legend-entries.util.d.ts +166 -0
  39. package/dist/utility/chart/kscript-legend-entries.util.js +538 -0
  40. package/dist/utility/chart/kscript-output-role.util.d.ts +32 -0
  41. package/dist/utility/chart/kscript-output-role.util.js +215 -0
  42. package/dist/utility/chart/kscript-provenance-keys.util.d.ts +22 -0
  43. package/dist/utility/chart/kscript-provenance-keys.util.js +56 -0
  44. package/dist/utility/chart/kscript-run-result-normalize.util.d.ts +53 -0
  45. package/dist/utility/chart/kscript-run-result-normalize.util.js +476 -0
  46. package/dist/utility/chart/kscript-run-result-shape.util.d.ts +14 -0
  47. package/dist/utility/chart/kscript-run-result-shape.util.js +66 -0
  48. package/dist/utility/chart/kscript-titancharts-container.util.d.ts +29 -0
  49. package/dist/utility/chart/kscript-titancharts-container.util.js +151 -0
  50. package/dist/utility/chart/kscript-viewport-overlays.util.d.ts +83 -0
  51. package/dist/utility/chart/kscript-viewport-overlays.util.js +443 -0
  52. package/dist/utility/chart/om-panel-push-style.util.d.ts +78 -0
  53. package/dist/utility/chart/om-panel-push-style.util.js +301 -0
  54. package/dist/utility/chart/om-panel.util.d.ts +166 -0
  55. package/dist/utility/chart/om-panel.util.js +815 -0
  56. package/dist/utility/chart/om-series.util.d.ts +42 -0
  57. package/dist/utility/chart/om-series.util.js +330 -0
  58. package/dist/utility/chart/om-target.util.d.ts +11 -0
  59. package/dist/utility/chart/om-target.util.js +24 -0
  60. package/dist/utility/chart/om-widget.util.d.ts +148 -0
  61. package/dist/utility/chart/om-widget.util.js +413 -0
  62. package/dist/utility/chart/overlay-output-budget.util.d.ts +16 -0
  63. package/dist/utility/chart/overlay-output-budget.util.js +109 -0
  64. package/dist/utility/chart/overlay-paint-flags.util.d.ts +24 -0
  65. package/dist/utility/chart/overlay-paint-flags.util.js +55 -0
  66. package/dist/utility/chart/profile-row-height.util.d.ts +21 -0
  67. package/dist/utility/chart/profile-row-height.util.js +110 -0
  68. package/dist/utility/chart/session-interval.util.d.ts +1 -0
  69. package/dist/utility/chart/session-interval.util.js +35 -0
  70. package/dist/utility/chart/technical-script-legend-value.util.d.ts +18 -0
  71. package/dist/utility/chart/technical-script-legend-value.util.js +53 -0
  72. package/dist/utility/chart/trading-day.util.d.ts +70 -0
  73. package/dist/utility/chart/trading-day.util.js +238 -0
  74. package/dist/utility/chart/wrun-legend-name.util.d.ts +25 -0
  75. package/dist/utility/chart/wrun-legend-name.util.js +87 -0
  76. package/dist/utility/chart/wrun-run-result.util.d.ts +977 -0
  77. package/dist/utility/chart/wrun-run-result.util.js +5179 -0
  78. package/dist/utility/chart/wrun-visibility-chart.util.d.ts +25 -0
  79. package/dist/utility/chart/wrun-visibility-chart.util.js +22 -0
  80. package/dist/utility/indicators/heatmap-sensitivity.util.d.ts +62 -0
  81. package/dist/utility/indicators/heatmap-sensitivity.util.js +82 -0
  82. package/dist/utility/number-format.util.d.ts +68 -0
  83. package/dist/utility/number-format.util.js +188 -0
  84. package/dist/utility/v2/opra-governed.util.d.ts +1 -0
  85. package/dist/utility/v2/opra-governed.util.js +13 -0
  86. package/dist/utility/wrun/wrun-auto-row.util.d.ts +54 -0
  87. package/dist/utility/wrun/wrun-auto-row.util.js +96 -0
  88. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +341 -0
  89. package/dist/utility/wrun/wrun-batched-marks.util.js +938 -0
  90. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +75 -0
  91. package/dist/utility/wrun/wrun-batched-readout.util.js +171 -0
  92. package/dist/utility/wrun/wrun-box-segment.util.d.ts +185 -0
  93. package/dist/utility/wrun/wrun-box-segment.util.js +570 -0
  94. package/dist/utility/wrun/wrun-build-memo.util.d.ts +133 -0
  95. package/dist/utility/wrun/wrun-build-memo.util.js +301 -0
  96. package/dist/utility/wrun/wrun-builtin-twin-ports.util.d.ts +25 -0
  97. package/dist/utility/wrun/wrun-builtin-twin-ports.util.js +75 -0
  98. package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +9 -0
  99. package/dist/utility/wrun/wrun-builtin-twin.util.js +40 -0
  100. package/dist/utility/wrun/wrun-canvas-cache.util.d.ts +28 -0
  101. package/dist/utility/wrun/wrun-canvas-cache.util.js +56 -0
  102. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +69 -0
  103. package/dist/utility/wrun/wrun-canvas-readout.util.js +53 -0
  104. package/dist/utility/wrun/wrun-canvases.util.d.ts +295 -0
  105. package/dist/utility/wrun/wrun-canvases.util.js +1432 -0
  106. package/dist/utility/wrun/wrun-cap-notice.util.d.ts +77 -0
  107. package/dist/utility/wrun/wrun-cap-notice.util.js +296 -0
  108. package/dist/utility/wrun/wrun-card-style.util.d.ts +154 -0
  109. package/dist/utility/wrun/wrun-card-style.util.js +539 -0
  110. package/dist/utility/wrun/wrun-chart-context.util.d.ts +89 -0
  111. package/dist/utility/wrun/wrun-chart-context.util.js +213 -0
  112. package/dist/utility/wrun/wrun-chart-names.util.d.ts +23 -0
  113. package/dist/utility/wrun/wrun-chart-names.util.js +33 -0
  114. package/dist/utility/wrun/wrun-chart-time.util.d.ts +12 -0
  115. package/dist/utility/wrun/wrun-chart-time.util.js +23 -0
  116. package/dist/utility/wrun/wrun-child-overlay-id.util.d.ts +13 -0
  117. package/dist/utility/wrun/wrun-child-overlay-id.util.js +44 -0
  118. package/dist/utility/wrun/wrun-color-facts.util.d.ts +40 -0
  119. package/dist/utility/wrun/wrun-color-facts.util.js +88 -0
  120. package/dist/utility/wrun/wrun-color-settings.lazy.d.ts +26 -0
  121. package/dist/utility/wrun/wrun-color-settings.lazy.js +9 -0
  122. package/dist/utility/wrun/wrun-color-settings.util.d.ts +351 -0
  123. package/dist/utility/wrun/wrun-color-settings.util.js +1363 -0
  124. package/dist/utility/wrun/wrun-footprint-modes.util.d.ts +23 -0
  125. package/dist/utility/wrun/wrun-footprint-modes.util.js +24 -0
  126. package/dist/utility/wrun/wrun-frames.d.ts +217 -0
  127. package/dist/utility/wrun/wrun-frames.js +1021 -0
  128. package/dist/utility/wrun/wrun-handles.util.d.ts +792 -0
  129. package/dist/utility/wrun/wrun-handles.util.js +2050 -0
  130. package/dist/utility/wrun/wrun-heatmap-cell-budget.util.d.ts +156 -0
  131. package/dist/utility/wrun/wrun-heatmap-cell-budget.util.js +342 -0
  132. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +218 -0
  133. package/dist/utility/wrun/wrun-hosted-wire-caps.js +667 -0
  134. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +40 -0
  135. package/dist/utility/wrun/wrun-hosted-wire.util.js +27 -0
  136. package/dist/utility/wrun/wrun-hover.util.d.ts +182 -0
  137. package/dist/utility/wrun/wrun-hover.util.js +534 -0
  138. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +246 -0
  139. package/dist/utility/wrun/wrun-hud-looks.util.js +587 -0
  140. package/dist/utility/wrun/wrun-integration-budget.util.d.ts +47 -0
  141. package/dist/utility/wrun/wrun-integration-budget.util.js +122 -0
  142. package/dist/utility/wrun/wrun-latest-snapshot.d.ts +19 -0
  143. package/dist/utility/wrun/wrun-latest-snapshot.js +7 -0
  144. package/dist/utility/wrun/wrun-levels-child.util.d.ts +131 -0
  145. package/dist/utility/wrun/wrun-levels-child.util.js +514 -0
  146. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +75 -0
  147. package/dist/utility/wrun/wrun-lifecycle.contract.js +9 -0
  148. package/dist/utility/wrun/wrun-market-facts.util.d.ts +116 -0
  149. package/dist/utility/wrun/wrun-market-facts.util.js +238 -0
  150. package/dist/utility/wrun/wrun-output-style.util.d.ts +344 -0
  151. package/dist/utility/wrun/wrun-output-style.util.js +1239 -0
  152. package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +84 -0
  153. package/dist/utility/wrun/wrun-overlay-identity.util.js +142 -0
  154. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +120 -0
  155. package/dist/utility/wrun/wrun-overlay-result.util.js +219 -0
  156. package/dist/utility/wrun/wrun-pack.util.d.ts +70 -0
  157. package/dist/utility/wrun/wrun-pack.util.js +301 -0
  158. package/dist/utility/wrun/wrun-pane-format.util.d.ts +180 -0
  159. package/dist/utility/wrun/wrun-pane-format.util.js +299 -0
  160. package/dist/utility/wrun/wrun-panel-style.lazy.d.ts +25 -0
  161. package/dist/utility/wrun/wrun-panel-style.lazy.js +15 -0
  162. package/dist/utility/wrun/wrun-panel-style.util.d.ts +174 -0
  163. package/dist/utility/wrun/wrun-panel-style.util.js +726 -0
  164. package/dist/utility/wrun/wrun-param-values.util.d.ts +69 -0
  165. package/dist/utility/wrun/wrun-param-values.util.js +230 -0
  166. package/dist/utility/wrun/wrun-refusal.util.d.ts +263 -0
  167. package/dist/utility/wrun/wrun-refusal.util.js +1259 -0
  168. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +199 -0
  169. package/dist/utility/wrun/wrun-registry-errors.util.js +257 -0
  170. package/dist/utility/wrun/wrun-render-select.util.d.ts +336 -0
  171. package/dist/utility/wrun/wrun-render-select.util.js +1157 -0
  172. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +434 -0
  173. package/dist/utility/wrun/wrun-script-inputs.util.js +1971 -0
  174. package/dist/utility/wrun/wrun-setting-words.lazy.d.ts +20 -0
  175. package/dist/utility/wrun/wrun-setting-words.lazy.js +9 -0
  176. package/dist/utility/wrun/wrun-setting-words.util.d.ts +79 -0
  177. package/dist/utility/wrun/wrun-setting-words.util.js +176 -0
  178. package/dist/utility/wrun/wrun-socket-row-store.d.ts +98 -0
  179. package/dist/utility/wrun/wrun-socket-row-store.js +417 -0
  180. package/dist/utility/wrun/wrun-style-flags.util.d.ts +18 -0
  181. package/dist/utility/wrun/wrun-style-flags.util.js +21 -0
  182. package/dist/utility/wrun/wrun-style-words.util.d.ts +148 -0
  183. package/dist/utility/wrun/wrun-style-words.util.js +439 -0
  184. package/dist/utility/wrun/wrun-table-look.util.d.ts +125 -0
  185. package/dist/utility/wrun/wrun-table-look.util.js +225 -0
  186. package/dist/utility/wrun/wrun-text-look.util.d.ts +51 -0
  187. package/dist/utility/wrun/wrun-text-look.util.js +227 -0
  188. package/dist/utility/wrun/wrun-text-params.util.d.ts +106 -0
  189. package/dist/utility/wrun/wrun-text-params.util.js +171 -0
  190. package/dist/utility/wrun/wrun-tpo-rows.util.d.ts +71 -0
  191. package/dist/utility/wrun/wrun-tpo-rows.util.js +438 -0
  192. package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +14 -0
  193. package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +58 -0
  194. package/dist/utility/wrun/wrun-visibility-table.d.ts +437 -0
  195. package/dist/utility/wrun/wrun-visibility-table.js +237 -0
  196. package/dist/utility/wrun/wrun-volume-profile.util.d.ts +37 -0
  197. package/dist/utility/wrun/wrun-volume-profile.util.js +278 -0
  198. package/package.json +38 -0
@@ -0,0 +1,40 @@
1
+ /**
2
+ * The chart app's door to the hosted wire: the run-level `wrunHost` key a cloud reply carries
3
+ * for a reader that advertised `wrun-host-v1` (docs/features/kscript/wrun/wrun-browser-runtime.md, "The wire").
4
+ *
5
+ * The codec is the kit package's (`decodeWrunHostedWire` in `@orangecharts/indicator-kit/host`),
6
+ * reached through the seam `wrun-shared-host.ts`, so the cloud's encoder and this reader cannot
7
+ * drift. This module re-implements no decode rule: it only loads the seam and hands the verdict
8
+ * back as the package wrote it.
9
+ *
10
+ * The seam is loaded with `await import(...)` (through `loadWrunSharedHost`, the own run's loader,
11
+ * so the run result a hosted reply builds finds the host loaded), so `host.js` joins no boot
12
+ * graph. A caller routes
13
+ * by presence first (`hasWrunHostedWire` in the import-free leaf `wrun-hosted-wire-caps.ts`) and
14
+ * reads only a hosted reply; every other reply keeps today's path without loading the package.
15
+ * Type-only imports of the seam are free.
16
+ */
17
+ import type { WrunHostedGrid, WrunHostedWire, WrunHostedWireRead } from '@orangecharts/indicator-kit/host';
18
+ export type { WrunHostedGrid, WrunHostedWire, WrunHostedWireRead };
19
+ /** One presentation family the cloud's profile refused, as the decode returns it
20
+ * (`{ family, code? }`; the wire's `verdict: "refused"` is dropped by the decode). */
21
+ export type WrunHostedRefusal = WrunHostedWire['refusals'][number];
22
+ /** A reply's `wrunHost` read by the package: `absent` without an own key, `wire` with NaN and
23
+ * unwritten slots restored, `unreadable` with the defect in plain words. */
24
+ export declare function readWrunHostedWire(output: unknown): Promise<WrunHostedWireRead>;
25
+ /** The run-level keys a hosted reply carries beside `wrunHost` (wrun-browser-runtime.md "The wire": `strategy`,
26
+ * with its own times, and `diagnostics` ride as today; kscript-backend adds `wrunServedLegs`), as the reply holds
27
+ * them. */
28
+ export interface WrunHostedRunLevel {
29
+ /** The reply's own `strategy`, the very value it carries; absent when it has none (or null). */
30
+ strategy?: unknown;
31
+ /** The reply's own `diagnostics`, unread; absent when it has none. */
32
+ diagnostics?: unknown;
33
+ /** The reply's own `wrunServedLegs` (kscript-backend `WrunServedLeg[]`: each candles or intrabar leg the cloud
34
+ * served from the history wall, `{ fetchKey, askedStartMs, servedStartMs, note }`, on a create or range reply
35
+ * only), unread; absent when it has none. */
36
+ wrunServedLegs?: unknown;
37
+ }
38
+ /** Read a reply's run-level keys beside the wire: each own key exactly as the reply carries it, never a key
39
+ * inside `wrunHost`. A reply that is not a record carries none. */
40
+ export declare function readWrunHostedRunLevel(output: unknown): WrunHostedRunLevel;
@@ -0,0 +1,27 @@
1
+ import { wrunChartHostEnv } from '../../host-env.js';
2
+ /** A reply's `wrunHost` read by the package: `absent` without an own key, `wire` with NaN and
3
+ * unwritten slots restored, `unreadable` with the defect in plain words. */
4
+ export async function readWrunHostedWire(output) {
5
+ // Through the own-run loader: the run result a hosted reply builds reads the loaded host too.
6
+ const { decodeWrunHostedWire } = await wrunChartHostEnv().loadSharedHost();
7
+ return decodeWrunHostedWire(output);
8
+ }
9
+ /** Read a reply's run-level keys beside the wire: each own key exactly as the reply carries it, never a key
10
+ * inside `wrunHost`. A reply that is not a record carries none. */
11
+ export function readWrunHostedRunLevel(output) {
12
+ if (!isRecord(output))
13
+ return {};
14
+ const level = {};
15
+ if (Object.hasOwn(output, 'strategy') && output.strategy !== undefined && output.strategy !== null) {
16
+ level.strategy = output.strategy;
17
+ }
18
+ if (Object.hasOwn(output, 'diagnostics') && output.diagnostics !== undefined)
19
+ level.diagnostics = output.diagnostics;
20
+ if (Object.hasOwn(output, 'wrunServedLegs') && output.wrunServedLegs !== undefined) {
21
+ level.wrunServedLegs = output.wrunServedLegs;
22
+ }
23
+ return level;
24
+ }
25
+ function isRecord(value) {
26
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
27
+ }
@@ -0,0 +1,182 @@
1
+ /**
2
+ * The wrun block kit (WRUN-INPUTS-PLAN 1.4, 1.6, 1.7): one vocabulary of
3
+ * blocks (`value`, `spark`, `gauge`, `pill`, `rows`, `meter`, `chips`) with
4
+ * three homes, the HUD tiles, the legend entries and the hover card. This
5
+ * module turns a sheet block (`WrunHoverBlock`, the declaration) plus the
6
+ * overlay's latest snapshot (`WrunLatestSnapshot`, published by the run
7
+ * path) into a `WrunBlockView`: formatted strings, resolved colours and
8
+ * plain number series, nothing a renderer has to interpret. `WrunBlocks.vue`
9
+ * draws the views; the inspector and the HUD layer both render through it.
10
+ *
11
+ * Pure and node-testable: no titan, DOM, store or chart access. Every
12
+ * number goes through the one formatter (wrun-pane-format.util): with a
13
+ * `WrunValuePlacement` (the owning chart's digits, built by the caller from
14
+ * the mounted chart, wrun-legend-hover wrunValuePlacement) it is the
15
+ * legend's own rule, `formatWrunLegendValue`, so a value reads the same in
16
+ * the legend, the card and the HUD; without one, `formatWrunValue` and its
17
+ * defaults (a card built off any chart).
18
+ *
19
+ * Template placeholders (plan 1.3, the alert placeholder style): `{{name}}`
20
+ * is an output or a string slot by name, `{{name:format}}` a format word
21
+ * from the frozen list, `{{label}}` and `{{value}}` the owning output;
22
+ * `{{row}}` / `{{col}}` belong to a matrix and stay as written here. An
23
+ * unknown name stays as written too, so a typo shows instead of vanishing.
24
+ */
25
+ import type { WrunHoverBlock, WrunIndicatorMetadata, WrunMetadataOutput } from '../../interfaces/wrun-runtime.interface.js';
26
+ import type { WrunLatestSnapshot } from './wrun-latest-snapshot.js';
27
+ import { type WrunRowLeader } from './wrun-hud-looks.util.js';
28
+ import { type WrunBuiltinTwin } from './wrun-pane-format.util.js';
29
+ import { type WrunColorTheme } from './wrun-style-words.util.js';
30
+ /**
31
+ * The digits the owning chart prints a value with, the legend's rule
32
+ * (formatWrunLegendValue): an output on the price pane at the chart's price
33
+ * precision, one on a lower pane by the lower-pane legend rule (K/M/B from
34
+ * 1K, the built-in legend decimals below, whatever the pane's height), a
35
+ * declared `price` word at the price precision wherever it sits. `onPrice`
36
+ * answers per output name; an undefined name (a value that is no output's)
37
+ * reads like the package's own pane. `builtinTwin`: the package is a proven
38
+ * twin, whose values print by its built-in's legend rule, like its legend.
39
+ * `colorTheme` (DW13, TH-theme-tokens): the owning chart's palette; with it
40
+ * every colour word a block or an output declares resolves here (a theme
41
+ * token becomes the chart's colour), without it the words pass as written.
42
+ */
43
+ export interface WrunValuePlacement {
44
+ priceDigits: number;
45
+ onPrice: (name: string | undefined) => boolean;
46
+ builtinTwin?: WrunBuiltinTwin;
47
+ colorTheme?: WrunColorTheme;
48
+ }
49
+ /** The number-format companions an output declares beside `format` (OT32,
50
+ * conventions 8): the formatter's 4th argument. */
51
+ export interface WrunNumberFormatOptions {
52
+ decimals?: number;
53
+ signed?: boolean;
54
+ unit?: string;
55
+ }
56
+ /** One ring of a rings view (LK07): its share of its own range, the legend
57
+ * row's label and formatted value, and its colour (absent = the HUD accent
58
+ * at the ring's strength). */
59
+ export interface WrunRingView {
60
+ label: string;
61
+ value: string;
62
+ fraction: number;
63
+ color?: string;
64
+ }
65
+ export type WrunBlockView = {
66
+ kind: 'value' | 'spark' | 'gauge' | 'pill' | 'rows' | 'meter' | 'chips' | 'rings';
67
+ label?: string;
68
+ value?: string;
69
+ delta?: string;
70
+ tone?: 'positive' | 'negative';
71
+ color?: string;
72
+ points?: number[];
73
+ min?: number;
74
+ max?: number;
75
+ current?: number;
76
+ marks?: number[];
77
+ rows?: Array<{
78
+ label: string;
79
+ value: string;
80
+ tone?: 'positive' | 'negative';
81
+ swatch?: string;
82
+ }>;
83
+ chips?: string[];
84
+ /** LK04: the drawing a gauge, spark, meter or pill tile picked (its own
85
+ * word, else what the HUD look filled in); absent = today's drawing. */
86
+ draw?: string;
87
+ /** LK05: a headline tile (value, pill) spans the card at `fontSize` (22 when
88
+ * it declares none) with a hairline under it. */
89
+ headline?: boolean;
90
+ /** LK05: px, 6..64, on a value or pill tile. */
91
+ fontSize?: number;
92
+ /** LK05 / LK07: px, 16..120, on a spark, meter or rings tile. */
93
+ height?: number;
94
+ /** A value a spark draws a dotted guide at (the signal look's zero line) and
95
+ * spark bars grow from; absent = bars grow from zero inside the range. */
96
+ baseline?: number;
97
+ /** LK06: a dotted leader between a row's key and value. */
98
+ leader?: WrunRowLeader;
99
+ /** LK07: the rings, outermost first. */
100
+ rings?: WrunRingView[];
101
+ /** The rest of a meter's range (`max` minus the reading), formatted like
102
+ * the reading: the split meter's right-hand label (LK04). */
103
+ complement?: string;
104
+ };
105
+ export interface WrunHoverView {
106
+ subtitle?: string;
107
+ blocks: WrunBlockView[];
108
+ hint?: string;
109
+ badges: string[];
110
+ accent?: string;
111
+ }
112
+ /** The owning output a template resolves `{{label}}` / `{{value}}` against;
113
+ * `name` is what a placement places the value by (absent on a record's y). */
114
+ export interface WrunTemplateSelf {
115
+ label: string;
116
+ value: number;
117
+ format?: string;
118
+ name?: string;
119
+ }
120
+ /** The sparkline's default window when a block declares no `bars`. */
121
+ export declare const WRUN_SPARK_DEFAULT_BARS = 32;
122
+ /** An output's display label: the declared `label`, else its name read as
123
+ * words (the legend's own rule, wrunLegendName). */
124
+ export declare function wrunOutputDisplayLabel(output: Pick<WrunMetadataOutput, 'name' | 'label'>): string;
125
+ /** A sheet name as a legend surface prints it where the declaration carries
126
+ * no words of its own (a `render.legend` entry without `text`, a HUD's
127
+ * settings rows): the legend's own rule (wrunLegendName: `spot_entry` reads
128
+ * "Spot entry", `gex_flip` "GEX flip") with the first letter capitalized
129
+ * (`spot entry` reads "Spot entry", `RSI now` stays). A name is an
130
+ * identifier, never copy. */
131
+ export declare function wrunNameWords(name: string): string;
132
+ /**
133
+ * The colour a `color_by` ladder picks for a reference at the snapshot: the
134
+ * ladder output's latest value floors into `colors` (the block's, else the
135
+ * ladder output's own `colors`). A block may carry `color` beside the ladder
136
+ * (om parity): the ladder wins where it resolves, `color` is the fallback
137
+ * (no rung: NaN, no table); neither = undefined.
138
+ */
139
+ export declare function resolveWrunLadderColor(spec: {
140
+ color?: string;
141
+ color_by?: string;
142
+ colors?: string[];
143
+ }, snapshot: WrunLatestSnapshot, metadata: WrunIndicatorMetadata): string | undefined;
144
+ /** The chips a reference yields: a string slot's text split on `|`, else a
145
+ * ladder output's label at its latest rung. */
146
+ export declare function resolveWrunChips(name: string | undefined, snapshot: WrunLatestSnapshot, metadata: WrunIndicatorMetadata): string[];
147
+ /**
148
+ * One placeholder grammar for every template: each `{{name}}` /
149
+ * `{{name:format}}` goes through `lookup`, which returns the replacement
150
+ * or undefined to keep the placeholder as written. `label` and `value`
151
+ * resolve against `self` when given (`value` at the placement's digits);
152
+ * `row` / `col` always stay.
153
+ */
154
+ export declare function resolveWrunPlaceholders(template: string, lookup: (name: string, format: string | undefined) => string | undefined, self?: WrunTemplateSelf, placement?: WrunValuePlacement): string;
155
+ /** A template against the overlay's latest snapshot: an output reads as its
156
+ * formatted latest value (the placeholder's word, else its declared
157
+ * `format`, at the placement's digits), a string slot as its latest text. */
158
+ export declare function resolveWrunTemplate(template: string, snapshot: WrunLatestSnapshot, metadata: WrunIndicatorMetadata, self?: WrunTemplateSelf, placement?: WrunValuePlacement): string;
159
+ /** One block view per declared block (an unknown kind is dropped): each
160
+ * block stands alone, the way a HUD tile shows it. */
161
+ export declare function buildWrunBlockViews(blocks: WrunHoverBlock[], snapshot: WrunLatestSnapshot, metadata: WrunIndicatorMetadata, placement?: WrunValuePlacement): WrunBlockView[];
162
+ /** The card for a list of blocks: the block views composed as one card, the
163
+ * first declared block `hint`, the first resolved block colour as the
164
+ * accent; badges stay empty (an output's `badges` ladder is added by
165
+ * wrunOutputHoverView). */
166
+ export declare function buildWrunHoverView(blocks: WrunHoverBlock[], snapshot: WrunLatestSnapshot, metadata: WrunIndicatorMetadata, subtitle?: string, placement?: WrunValuePlacement): WrunHoverView;
167
+ /**
168
+ * The card an output answers a hover with (plan 1.6): its `hover` blocks,
169
+ * else its `tooltip` template as the lead text, else its formatted value.
170
+ * The header (the view's subtitle) names the output, then the caller's
171
+ * `subtitle` (the hovered bar's time), so the blocks never repeat the name.
172
+ * `value` is the reading at the hovered bar (the legend's floor row) when
173
+ * the caller has one, else the snapshot's latest, printed at the
174
+ * `placement`'s digits (the owning chart's); the output's `hint` and
175
+ * `badges` ladder, and its colour as the accent, ride every form.
176
+ */
177
+ export declare function wrunOutputHoverView(output: WrunMetadataOutput, snapshot: WrunLatestSnapshot, metadata: WrunIndicatorMetadata, options?: {
178
+ value?: number;
179
+ subtitle?: string;
180
+ accent?: string;
181
+ placement?: WrunValuePlacement;
182
+ }): WrunHoverView;