@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,792 @@
1
+ /**
2
+ * Indicator handles (ABI wrun-3, contract OM-WRUN3-DRAWINGS-CONTRACT.md
3
+ * sections 2, 6 and 7; WRUN-STYLE group 4 and Appendix C): the sheet's
4
+ * `handles` section, the runtime handle ledger the sandbox worker drives
5
+ * from the draw channel (`wrun_draw_*`), and the ledger's wire records,
6
+ * which are the kScript engine's own `DrawingObject` records so
7
+ * `kscript-drawings.util.ts` and titan's `updateDrawings` need no change.
8
+ *
9
+ * A handle is a drawing the module keys by an `i32` id and creates, mutates
10
+ * or deletes across bars. Every draw call during a row's `finalize()` is one
11
+ * op against the ledger (`Map<id, {kind, props, createdBar, mutatedBar,
12
+ * seq}>`): a geometry call on an unknown id creates (style from the sheet
13
+ * defaults, `createdBar = mutatedBar = row`, `seq` = creation index), on a
14
+ * known id of the same kind mutates (`mutatedBar = row`), on another kind
15
+ * skips; a style or color call on a known id mutates, on an unknown id
16
+ * skips; delete removes without a stamp and frees the id for a later row.
17
+ * The ledger is a pure function of the rows, so a full run from row 0
18
+ * rebuilds it; a live session keeps it bit-identical to a full run through
19
+ * the journal (the ops since the last snapshot, undone on restore) and the
20
+ * worker's close-confirm re-evaluation.
21
+ *
22
+ * Skipped calls (om docs/WRUN3_ABI.md "Skipped calls", 2026-10-15): a call
23
+ * one bar's values cannot carry (a non-finite coordinate, a style value out
24
+ * of range, a missing handle, an unwritten label slot, an empty polyline, a
25
+ * kind mismatch: WRUN3_DRAW_SKIP_CODES) is skipped and recorded, and the run
26
+ * goes on; a limit or a mistake the code makes on every bar
27
+ * (WRUN3_DRAW_FATAL_CODES) still refuses the evaluation by name. Every fatal
28
+ * check of a call runs before its skip checks, so a skip never bypasses a
29
+ * refusal. The om reference worker, the kit host and kscript-backend split
30
+ * the codes the same way; the handle-ledger corpus pins it.
31
+ *
32
+ * WRUN-STYLE (2026-10-03, Appendix C, wrun-3 additive): style props 10..30
33
+ * (word, slot and numeric looks), colour props 2..6, the pre-round props
34
+ * widened to more kinds, `wrun_draw_label` slot -1 (a label with no text, a
35
+ * mark), slot props read through the host's slot reader, and theme tokens
36
+ * riding the wire as `theme.<t>` / `theme.<t>/aa` (the foundation's
37
+ * `wrunDrawColorWire`). The sheet side (g4 section 2.1) adds the look keys
38
+ * to every `handles.<kind>` entry and to the geometry drawings; ONE mapper,
39
+ * `wrunDrawingStyleWire`, turns those sheet keys into wire props for the
40
+ * declared-drawing adapter, and `wrunHandleInitialProps` reuses it for a new
41
+ * handle's initial props.
42
+ *
43
+ * Environment-agnostic on purpose: the worker and the Node specs run this
44
+ * same code, and nothing here touches the DOM or a store. Theme tokens are
45
+ * never resolved here: they ride the wire as words and resolve at the mount
46
+ * doors (wrun-style-words.util.ts, TH-theme-tokens).
47
+ *
48
+ * The wrun-3 vocabulary below (import names, prop enums, caps, refusal
49
+ * names, sheet defaults) mirrors `@openmarket/sdk` `wrun-wasm-abi.ts` and
50
+ * `wrun-metadata-schema.ts` verbatim. The indicator kit
51
+ * (the `@orangecharts/indicator-kit` package, since scaffold 9) exports the same names, but
52
+ * this module runs inside the sandbox worker and the Node specs, where
53
+ * pulling the 1 MB kit bundle in for a few constants is not worth it. The
54
+ * existing values must never drift from the kit's: `wrun-handles.kit-mirror.spec.ts`
55
+ * pins them to the kit exports and separately pins the additive Appendix C
56
+ * contract until the kit is re-vendored. A changed cap, range or default
57
+ * fails there by name.
58
+ */
59
+ import type { WrunDrawSkipCode, WrunDrawSkips, WrunHandleStyleByKind, WrunIndicatorMetadata, WrunOutputRow, WrunRenderer } from '../../interfaces/wrun-runtime.interface.js';
60
+ import type { WrunVisualPanel } from './wrun-box-segment.util.js';
61
+ import { type WrunFontFamily, type WrunFontWeight } from './wrun-style-words.util.js';
62
+ export declare const WRUN3_HANDLE_KINDS: readonly ["line", "box", "label", "polyline"];
63
+ export type WrunHandleKind = (typeof WRUN3_HANDLE_KINDS)[number];
64
+ /** Style prop 7 uses 1-based indexes; 0 restores chart coordinates. */
65
+ export declare const WRUN_DRAWING_ANCHORS: readonly ["top_left", "top_center", "top_right", "middle_left", "middle_center", "middle_right", "bottom_left", "bottom_center", "bottom_right", "top", "bottom", "left", "right"];
66
+ export type WrunDrawingAnchor = (typeof WRUN_DRAWING_ANCHORS)[number];
67
+ /** Label text alignment words (which edge of the text sits on x); absent is
68
+ * centred. Style prop 8 uses 1-based indexes; 0 clears the word. Labels and
69
+ * (box text, DW31) boxes. */
70
+ export declare const WRUN_LABEL_ALIGNS: readonly ["left", "center", "right"];
71
+ export type WrunLabelAlign = (typeof WRUN_LABEL_ALIGNS)[number];
72
+ /** `wrun_draw_style(id, prop, value)`: the prop enum. `fill_to` (lines only)
73
+ * shades from the line to another line: the value is the other line's
74
+ * handle id, -1 clears; the fill colour is the line's `fill` colour prop
75
+ * (its alpha the fill opacity). Props 10..30 (WRUN-STYLE, Appendix C) are
76
+ * wrun-3 additive like `fill_to`: no new import, refusal name or ABI
77
+ * version. */
78
+ export declare const WRUN3_STYLE_PROPS: {
79
+ readonly width: 0;
80
+ readonly line_style: 1;
81
+ readonly opacity: 2;
82
+ readonly size: 3;
83
+ readonly extend: 4;
84
+ readonly border_width: 5;
85
+ readonly zorder: 6;
86
+ readonly anchor: 7;
87
+ readonly align: 8;
88
+ readonly fill_to: 9;
89
+ readonly font_weight: 10;
90
+ readonly font_family: 11;
91
+ readonly valign: 12;
92
+ readonly padding: 13;
93
+ readonly max_width: 14;
94
+ readonly corner_radius: 15;
95
+ readonly glow: 16;
96
+ readonly label_style: 17;
97
+ readonly emblem_shape: 18;
98
+ readonly sticky_right: 19;
99
+ readonly axis_label: 20;
100
+ readonly tooltip_slot: 21;
101
+ readonly text_slot: 22;
102
+ readonly group: 23;
103
+ readonly fit_group: 24;
104
+ readonly box_shape: 25;
105
+ readonly gradient_direction: 26;
106
+ readonly arrow: 27;
107
+ readonly closed: 28;
108
+ readonly smooth: 29;
109
+ readonly angle: 30;
110
+ };
111
+ export type WrunDrawStyleProp = keyof typeof WRUN3_STYLE_PROPS;
112
+ /** `line_style` values by enum index. */
113
+ export declare const WRUN3_LINE_STYLES: readonly ["solid", "dashed", "dotted"];
114
+ export type WrunHandleLineStyle = (typeof WRUN3_LINE_STYLES)[number];
115
+ /** `extend` values by enum index. */
116
+ export declare const WRUN3_EXTENDS: readonly ["none", "left", "right", "both"];
117
+ export type WrunHandleExtend = (typeof WRUN3_EXTENDS)[number];
118
+ /** `label_style` (17): 1 box, 2 plain, 3 knockout, 4 emblem, 5 pill, 6 badge, 7 callout. */
119
+ export declare const WRUN3_LABEL_STYLES: readonly ["box", "plain", "knockout", "emblem", "pill", "badge", "callout"];
120
+ export type WrunHandleLabelStyle = (typeof WRUN3_LABEL_STYLES)[number];
121
+ /** `emblem_shape` (18): 1 dot, 2 square, 3 diamond, 4 triangle_up, 5 triangle_down. */
122
+ export declare const WRUN3_EMBLEM_SHAPES: readonly ["dot", "square", "diamond", "triangle_up", "triangle_down"];
123
+ export type WrunHandleEmblemShape = (typeof WRUN3_EMBLEM_SHAPES)[number];
124
+ /** `axis_label` (20): 1 price, 2 text (a line stops at 1: it has no text). */
125
+ export declare const WRUN3_AXIS_LABELS: readonly ["price", "text"];
126
+ export type WrunHandleAxisLabel = (typeof WRUN3_AXIS_LABELS)[number];
127
+ /** `arrow` (27): 1 start, 2 end, 3 both. */
128
+ export declare const WRUN3_ARROWS: readonly ["start", "end", "both"];
129
+ export type WrunHandleArrow = (typeof WRUN3_ARROWS)[number];
130
+ /** `box_shape` (25): 1 rect, 2 ellipse; only "ellipse" rides the wire (rect
131
+ * is the default and deletes the key like 0). */
132
+ export declare const WRUN3_BOX_SHAPES: readonly ["rect", "ellipse"];
133
+ export type WrunHandleBoxShape = (typeof WRUN3_BOX_SHAPES)[number];
134
+ /** `valign` (12) words and the sheet's `valign` key (freeze 2.1, WRUN_VALIGNS). */
135
+ export declare const WRUN_VALIGNS: readonly ["top", "middle", "bottom"];
136
+ export type WrunHandleValign = (typeof WRUN_VALIGNS)[number];
137
+ /** `gradient_direction` (26) words and the sheet key (freeze 2.1). */
138
+ export declare const WRUN_GRADIENT_DIRECTIONS: readonly ["vertical", "horizontal"];
139
+ export type WrunHandleGradientDirection = (typeof WRUN_GRADIENT_DIRECTIONS)[number];
140
+ /** `font_weight` (10) words (`WRUN_FONT_WEIGHTS`: 1 normal, 2 medium, 3 bold)
141
+ * reach the wire as the CSS weights the engine reads. */
142
+ export declare const WRUN3_FONT_WEIGHT_CSS: Readonly<Record<WrunFontWeight, 400 | 500 | 700>>;
143
+ /** The sheet's own word lists for the g4 keys (the ABI vocabularies above
144
+ * plus their "none" / default entry, which the ABI's 0 stands for). */
145
+ export declare const WRUN_LABEL_LOOKS: readonly ["box", "plain", "knockout", "emblem", "pill", "badge", "callout"];
146
+ export declare const WRUN_EMBLEM_SHAPES: readonly ["dot", "square", "diamond", "triangle_up", "triangle_down"];
147
+ export declare const WRUN_AXIS_LABELS: readonly ["none", "price", "text"];
148
+ export declare const WRUN_ARROWS: readonly ["none", "start", "end", "both"];
149
+ export declare const WRUN_BOX_SHAPES: readonly ["rect", "ellipse"];
150
+ /** The numeric ranges of the look props, the contract's (px unless named).
151
+ * Validation ranges only, the kit's: a value past one refuses by name. The
152
+ * mount caps of the LABELS contract (label and box text at 256 characters,
153
+ * ellipsized; zorder clamped to -100..100; 16 widgets per overlay per pane)
154
+ * are applied at the drawing door instead (kscript-drawing-caps.util.ts) and
155
+ * never refuse a sheet or an op that validates here. */
156
+ export declare const WRUN_CORNER_RADIUS_MAX = 32;
157
+ export declare const WRUN3_MAX_PADDING_PX = 64;
158
+ export declare const WRUN3_MAX_LABEL_WIDTH_PX = 2000;
159
+ /** Glow's validation range (the kit's), and the ceiling every wrun glow
160
+ * lands at: the run-result adapter holds a handle's glow to it like an
161
+ * output's (PLOTS-2, `landWrunGlowPx` in wrun-output-style.util). */
162
+ export declare const WRUN3_MAX_GLOW_PX = 32;
163
+ export declare const WRUN3_MAX_LABEL_ANGLE_DEG = 90;
164
+ /** `group` (23) and `fit_group` (24): an integer 1..65535 names a group, 0 leaves it. */
165
+ export declare const WRUN3_MAX_GROUP_ID = 65535;
166
+ /** `wrun_draw_label(id, x, y, slot)` with this slot draws a label with no
167
+ * text (text "", no slot is read): a mark. Any other negative slot keeps
168
+ * refusing `wrun_draw_label_slot_undeclared`. The same value clears a slot
169
+ * prop (tooltip_slot, text_slot). */
170
+ export declare const NO_TEXT_SLOT = -1;
171
+ export interface WrunDrawStylePropSpec {
172
+ readonly prop: number;
173
+ readonly name: WrunDrawStyleProp;
174
+ /** The kinds the prop is legal on; any other kind refuses by name. */
175
+ readonly kinds: ReadonlyArray<WrunHandleKind>;
176
+ readonly min?: number;
177
+ readonly max?: number;
178
+ readonly integer?: true;
179
+ /** Enumerated props: the value is an index into this vocabulary. */
180
+ readonly values?: ReadonlyArray<string>;
181
+ /** Word props: the value is a 1-based index into this vocabulary and 0
182
+ * clears the prop (its wire key is deleted). An index past the last
183
+ * word, a negative, a fraction or a non-finite value skips
184
+ * `wrun_draw_style_out_of_range`. */
185
+ readonly words?: ReadonlyArray<string>;
186
+ /** Slot props (tooltip_slot, text_slot): the value names a declared
187
+ * string slot whose bytes, as written on THIS row at the call, become
188
+ * the wire text; -1 clears the key. An undeclared slot (any other
189
+ * negative, or past the declared slots) refuses
190
+ * `wrun_draw_label_slot_undeclared` (a code mistake), an unwritten one
191
+ * skips `wrun_draw_label_slot_absent`; a fraction or a non-finite value
192
+ * skips `wrun_draw_style_out_of_range`. */
193
+ readonly slot?: true;
194
+ /** A tighter upper bound per kind (axis_label: a line has no text, so
195
+ * "text" skips `wrun_draw_style_out_of_range` on it). */
196
+ readonly maxByKind?: Partial<Record<WrunHandleKind, number>>;
197
+ /** Target props (fill_to): the value is the id of ANOTHER live handle of
198
+ * this kind, or -1 to clear. The handle's own id skips
199
+ * `wrun_draw_style_out_of_range` (like a non-finite or fractional value),
200
+ * an id no live handle holds `wrun_draw_handle_missing`, a live handle of
201
+ * another kind `wrun_draw_kind_mismatch`. Liveness is checked at the call
202
+ * only: deleting the target later is not a skip. */
203
+ readonly target?: WrunHandleKind;
204
+ }
205
+ /** Per-prop legality and range, the engine's setter table (Appendix C: the
206
+ * pre-round props widen, `line_style` to box as `borderStyle`, `opacity`
207
+ * and `zorder` to polyline, `size` to box as `textSize`, `extend` and
208
+ * `align` to box, `border_width` to label; props 10..30 join). */
209
+ export declare const WRUN3_STYLE_PROP_SPECS: ReadonlyArray<WrunDrawStylePropSpec>;
210
+ /** The props whose 0 (or -1) clears rather than sets: anchor, align, the
211
+ * target prop and every word and slot prop. A non-finite value on one of
212
+ * these skips by the range name (`wrun_draw_style_out_of_range`), as a
213
+ * value outside the table does; on a plain numeric prop it skips
214
+ * `wrun_draw_non_finite` (the om reference ledger's rule). */
215
+ export declare function wrunDrawStylePropClears(spec: WrunDrawStylePropSpec): boolean;
216
+ /** `wrun_draw_color(id, prop, rgba)`: the prop enum. `rgba` is `0xRRGGBBAA`
217
+ * as an i32 bit pattern; a theme token sentinel (alpha byte 0x00, red byte
218
+ * 0x7e, green byte 1..7, the token's alpha in the blue byte; see the
219
+ * foundation's `wrunThemeTokenOfI32`) rides the wire as `theme.<t>` /
220
+ * `theme.<t>/aa` through `wrunDrawColorWire`, every other value as
221
+ * `rgba(r,g,b,a)`. `stroke` is a line's, polyline's or label's `color` and
222
+ * a box's `borderColor`; `fill` is a box's `backgroundColor` (and
223
+ * `fillColor`), a label's `backgroundColor`, a polyline's `fillColor` (its
224
+ * polygon fill) and a line's fill toward its `fill_to` line (`fillColor`,
225
+ * on the wire only while a target is set; alpha is the fill's opacity);
226
+ * `border` is a label's `border`; `glow` is every kind's `glowColor`;
227
+ * `emblem` a label's `emblemColor`; `gradient_end` a box's `gradient:
228
+ * [backgroundColor at the call, end]` (and `gradientDirection: "vertical"`
229
+ * when unset); `text` a box's `textColor`. */
230
+ export declare const WRUN3_COLOR_PROPS: {
231
+ readonly stroke: 0;
232
+ readonly fill: 1;
233
+ readonly border: 2;
234
+ readonly glow: 3;
235
+ readonly emblem: 4;
236
+ readonly gradient_end: 5;
237
+ readonly text: 6;
238
+ };
239
+ export type WrunDrawColorProp = keyof typeof WRUN3_COLOR_PROPS;
240
+ export interface WrunDrawColorPropSpec {
241
+ readonly prop: number;
242
+ readonly name: WrunDrawColorProp;
243
+ readonly kinds: ReadonlyArray<WrunHandleKind>;
244
+ }
245
+ /** Per-prop legality for the colour channel. */
246
+ export declare const WRUN3_COLOR_PROP_SPECS: ReadonlyArray<WrunDrawColorPropSpec>;
247
+ /** Caps: a breach refuses the evaluation by name, never drops or truncates.
248
+ * One kind holds up to 1000 live handles, the most the drawing door draws of
249
+ * one kind (KSCRIPT_DRAWING_CAP_PER_KIND): the engine's MAX_DRAWINGS_PER_KIND
250
+ * is 500, but a kScript level drawn with plotRange is a plot row no drawing
251
+ * cap bounds, and its port draws the same level as a handle. Every kind
252
+ * together stays at 1500, so the largest ledger a run holds does not grow. */
253
+ export declare const WRUN3_MAX_LIVE_HANDLES_PER_KIND = 1000;
254
+ export declare const WRUN3_MAX_LIVE_HANDLES_TOTAL = 1500;
255
+ /** The points one polyline call may carry: the engine's collection ceiling
256
+ * (`MAX_COLLECTION_SIZE`, 100,000), the only bound kScript puts on a
257
+ * polyline's points. */
258
+ export declare const WRUN3_MAX_POLYLINE_POINTS = 100000;
259
+ /** The live polyline points one run may hold across every polyline handle:
260
+ * what the 8 MiB render result carries at 16 bytes a point
261
+ * (8 * 1024 * 1024 / 16). Checked on every polyline call: a re-emitted id
262
+ * gives its old points back and a deleted polyline frees its own. */
263
+ export declare const WRUN3_MAX_POLYLINE_POINTS_PER_RUN = 524288;
264
+ export declare const WRUN3_MAX_DRAW_CALLS_PER_ROW = 4096;
265
+ /** Ledger bytes count against the same cap the expanded render result is
266
+ * held to: 16 per handle, 8 per number (a polyline point is two), the UTF-8
267
+ * bytes of every carried string. */
268
+ export declare const WRUN_HANDLE_LEDGER_LIMIT_BYTES: number;
269
+ /** Every draw-channel refusal, by name, so each host refuses alike. */
270
+ export declare const WRUN3_DRAW_REFUSALS: {
271
+ readonly kind_limit: "wrun_draw_kind_limit";
272
+ readonly total_limit: "wrun_draw_total_limit";
273
+ readonly polyline_too_large: "wrun_draw_polyline_too_large";
274
+ readonly calls_per_row: "wrun_draw_calls_per_row";
275
+ readonly render_result_too_large: "wrun_render_result_too_large";
276
+ readonly kind_mismatch: "wrun_draw_kind_mismatch";
277
+ readonly handle_missing: "wrun_draw_handle_missing";
278
+ readonly label_slot_absent: "wrun_draw_label_slot_absent";
279
+ readonly non_finite: "wrun_draw_non_finite";
280
+ readonly phase: "wrun_draw_phase";
281
+ readonly id_negative: "wrun_draw_id_negative";
282
+ readonly kind_undeclared: "wrun_draw_kind_undeclared";
283
+ readonly prop_unknown: "wrun_draw_prop_unknown";
284
+ readonly prop_unsupported: "wrun_draw_prop_unsupported";
285
+ readonly style_out_of_range: "wrun_draw_style_out_of_range";
286
+ readonly polyline_empty: "wrun_draw_polyline_empty";
287
+ readonly polyline_out_of_bounds: "wrun_draw_polyline_out_of_bounds";
288
+ readonly label_slot_undeclared: "wrun_draw_label_slot_undeclared";
289
+ /** A polyline call would bring the run's live polyline points over
290
+ * WRUN3_MAX_POLYLINE_POINTS_PER_RUN. */
291
+ readonly polyline_budget: "wrun_draw_polyline_budget";
292
+ };
293
+ export type WrunDrawRefusal = (typeof WRUN3_DRAW_REFUSALS)[keyof typeof WRUN3_DRAW_REFUSALS];
294
+ /** The draw codes a value on one bar can trip (om `WRUN3_DRAW_SKIP_CODES`, docs/WRUN3_ABI.md "Skipped calls"):
295
+ * the call is skipped (nothing of it applies), recorded (`WrunDrawSkip`), and the run goes on. A host-side rule,
296
+ * so a published package is fixed without a republish. */
297
+ export declare const WRUN3_DRAW_SKIP_CODES: readonly ["wrun_draw_non_finite", "wrun_draw_style_out_of_range", "wrun_draw_handle_missing", "wrun_draw_label_slot_absent", "wrun_draw_polyline_empty", "wrun_draw_kind_mismatch"];
298
+ /** The draw codes that refuse the whole evaluation (om `WRUN3_DRAW_FATAL_CODES`): the limits, and the mistakes a
299
+ * module makes on every bar (a phase, an id, a kind, a prop, a slot or a pointer the code itself names). With
300
+ * WRUN3_DRAW_SKIP_CODES they partition WRUN3_DRAW_REFUSALS (wrun-handles.kit-mirror.spec.ts), and
301
+ * `WrunDrawRefusalError` takes these alone: a skip code thrown as a refusal does not typecheck. */
302
+ export declare const WRUN3_DRAW_FATAL_CODES: readonly ["wrun_draw_kind_limit", "wrun_draw_total_limit", "wrun_draw_polyline_too_large", "wrun_draw_calls_per_row", "wrun_render_result_too_large", "wrun_draw_polyline_budget", "wrun_draw_phase", "wrun_draw_id_negative", "wrun_draw_kind_undeclared", "wrun_draw_prop_unknown", "wrun_draw_prop_unsupported", "wrun_draw_label_slot_undeclared", "wrun_draw_polyline_out_of_bounds"];
303
+ export type WrunDrawFatalCode = (typeof WRUN3_DRAW_FATAL_CODES)[number];
304
+ /** The skipped calls a run records in full (om `WRUN3_MAX_DRAW_SKIPS`); past it a run only counts them
305
+ * (`skippedCount`), so a package that skips on every bar answers a bounded list. */
306
+ export declare const WRUN3_MAX_DRAW_SKIPS = 64;
307
+ /** Whether a draw code skips its call (true) or refuses the evaluation (false). */
308
+ export declare function isWrunDrawSkipCode(code: string): code is WrunDrawSkipCode;
309
+ /** Wire ids: `wrun_h_<kind>_<id>`, e.g. `wrun_h_line_7`. */
310
+ export declare const WRUN3_HANDLE_ID_PREFIX = "wrun_h_";
311
+ export declare function wrunHandleWireId(kind: WrunHandleKind, id: number): string;
312
+ /** The nine chart-corner anchors a `label` renderer may pin to (the engine's
313
+ * plotLabel `position` vocabulary). */
314
+ export declare const WRUN_LABEL_POSITIONS: readonly ["top_left", "top_center", "top_right", "middle_left", "middle_center", "middle_right", "bottom_left", "bottom_center", "bottom_right"];
315
+ export type WrunLabelPosition = (typeof WRUN_LABEL_POSITIONS)[number];
316
+ /** The `text` renderer's presentation styles: `price_label` draws the row's
317
+ * text as a price tag at y (the engine's plotPriceLabel); `box`, `knockout`
318
+ * and `emblem` (DW26) are the same tag in the label looks of DW07. Mirrors
319
+ * the kit export of the same name (wrun-handles.kit-mirror.spec pins it),
320
+ * so the FE-only presentation words live in their own list below. */
321
+ export declare const WRUN_TEXT_STYLES: readonly ["price_label", "box", "knockout", "emblem"];
322
+ /** The presentation style words the browser lane also accepts on a `text`
323
+ * renderer, a `label` renderer and a label drawing (WRUN-INPUTS-PLAN 1.4):
324
+ * `plain` is the bare text (the default, the same as no style), and
325
+ * `callout`, `pill` and `badge` ride the price-label rendering path with
326
+ * the look `wrunTextStyleLook` normalizes them into. */
327
+ export declare const WRUN_PRESENTATION_TEXT_STYLES: readonly ["plain", "callout", "pill", "badge"];
328
+ /** Every accepted style word, the kit's first (the refusal lists them in
329
+ * this order). */
330
+ export declare const WRUN_ACCEPTED_TEXT_STYLES: ReadonlyArray<string>;
331
+ export type WrunTextStyle = (typeof WRUN_TEXT_STYLES)[number] | (typeof WRUN_PRESENTATION_TEXT_STYLES)[number];
332
+ /** The price-label payload keys a text style sets: the engine's label box
333
+ * `shape` (a pill rounds to half its height, a badge is a pill with a
334
+ * leading dot; `box` is the rounded box, `knockout` the box filled with the
335
+ * theme background, `emblem` no box and a leading mark, DW07 / DW26) and
336
+ * `border` (a stroke in the label colour). */
337
+ export interface WrunPriceLabelLook {
338
+ type: 'callout' | 'simple';
339
+ shape?: 'pill' | 'badge' | 'box' | 'knockout' | 'emblem';
340
+ border?: boolean;
341
+ }
342
+ export declare function wrunTextStyleLook(style: WrunTextStyle | undefined): WrunPriceLabelLook | undefined;
343
+ /** true when a style draws through the price-label path (a tag at y). */
344
+ export declare function wrunTextStyleIsPriceLabel(style: WrunTextStyle | undefined): boolean;
345
+ export interface WrunHandleLineBase {
346
+ anchor?: WrunDrawingAnchor;
347
+ panel: WrunVisualPanel;
348
+ color: string;
349
+ width: number;
350
+ line_style: WrunHandleLineStyle;
351
+ extend: WrunHandleExtend;
352
+ }
353
+ export interface WrunHandleBoxBase {
354
+ anchor?: WrunDrawingAnchor;
355
+ panel: WrunVisualPanel;
356
+ /** The fill (it takes `opacity`, so the fill color grammar applies). */
357
+ color: string;
358
+ border_color: string;
359
+ opacity: number;
360
+ border_width: number;
361
+ }
362
+ export interface WrunHandleLabelBase {
363
+ anchor?: WrunDrawingAnchor;
364
+ /** Which edge of the text sits on x; absent is centred. */
365
+ align?: WrunLabelAlign;
366
+ panel: WrunVisualPanel;
367
+ color: string;
368
+ size: number;
369
+ }
370
+ export interface WrunHandlePolylineBase {
371
+ anchor?: WrunDrawingAnchor;
372
+ panel: WrunVisualPanel;
373
+ color: string;
374
+ width: number;
375
+ line_style: WrunHandleLineStyle;
376
+ }
377
+ /** The sheet's `handles.<kind>` entry with its pre-round fields filled and
378
+ * the g4 look keys (freeze 2.1) as declared: a look key absent here puts no
379
+ * key on a new handle's wire record (the engine default). */
380
+ export type WrunHandleLineDefaults = WrunHandleLineBase & WrunHandleStyleByKind['line'];
381
+ export type WrunHandleBoxDefaults = WrunHandleBoxBase & WrunHandleStyleByKind['box'];
382
+ export type WrunHandleLabelDefaults = WrunHandleLabelBase & WrunHandleStyleByKind['label'];
383
+ export type WrunHandlePolylineDefaults = WrunHandlePolylineBase & WrunHandleStyleByKind['polyline'];
384
+ /** The declared kinds with every field filled: a kind absent here is not
385
+ * enabled, so a draw call of that kind refuses by name. */
386
+ export interface WrunHandleDefaultsByKind {
387
+ line?: WrunHandleLineDefaults;
388
+ box?: WrunHandleBoxDefaults;
389
+ label?: WrunHandleLabelDefaults;
390
+ polyline?: WrunHandlePolylineDefaults;
391
+ }
392
+ /** The host-side fallbacks for a `handles` entry's omitted pre-round fields
393
+ * (the contract's sheet example): every host initializes a new handle from
394
+ * the sheet's entry over these. The look keys have no fallback: absent is
395
+ * the engine default. */
396
+ export declare const WRUN_HANDLE_DEFAULTS: {
397
+ line: WrunHandleLineBase;
398
+ box: WrunHandleBoxBase;
399
+ label: WrunHandleLabelBase;
400
+ polyline: WrunHandlePolylineBase;
401
+ };
402
+ /** The freeze's 2.1 message for a "theme." word that is not one of the seven. */
403
+ export declare const WRUN_THEME_TOKEN_MESSAGE: string;
404
+ /** The messages g4 names (DW07, DW16, DW34). */
405
+ export declare const WRUN_DRAWING_PRICE_LABEL_MESSAGE = "price_label is a plot look; a drawing label takes box";
406
+ export declare const WRUN_LINE_AXIS_TEXT_MESSAGE = "a line has no text; use price";
407
+ export declare const WRUN_GRADIENT_DIRECTION_MESSAGE = "gradient_direction needs gradient";
408
+ /** The box fill grammar: the alpha-rewritable forms or a theme token. */
409
+ export declare function isWrunBoxFillColor(value: unknown): value is string;
410
+ /** The sheet's `handles` section, defaults applied per declared kind,
411
+ * refused by name on a bad declaration (contract section 7 validator rules
412
+ * 1 and 3, g4 section 2.1): `handles` needs abi_version wrun-3 even when
413
+ * empty, a kind key is one of the four handle kinds, every field sits in
414
+ * its range, every colour takes the token-aware grammar. A label handle no
415
+ * longer needs a string slot (DW29: a mark is a label with no text).
416
+ * Absent = no kind enabled. */
417
+ export declare function readWrunHandleDefaults(metadata: WrunIndicatorMetadata): WrunHandleDefaultsByKind;
418
+ /** The wrun-3 renderer fields, read off a renderer as parsed JSON (the
419
+ * interface types them, the sheet on disk may carry anything). */
420
+ export declare function readWrunLabelPosition(sheetId: string, renderer: WrunRenderer): WrunLabelPosition | undefined;
421
+ export declare function readWrunTextStyle(sheetId: string, renderer: WrunRenderer): WrunTextStyle | undefined;
422
+ /** The presentation `style` word of a text renderer, a label renderer or a
423
+ * label drawing (read as parsed JSON): one of WRUN_ACCEPTED_TEXT_STYLES,
424
+ * refused by name otherwise; `plain` reads as no style (the bare text). On
425
+ * a label DRAWING (`kind` 'label drawing') `price_label` is an alias of
426
+ * `box` (DW07: a plot look on an already-published drawing); its `plain`
427
+ * rides `wrunDrawingStyleWire` as the engine's text-only look. */
428
+ export declare function readWrunPresentationStyle(sheetId: string, kind: string, name: string, value: unknown): WrunTextStyle | undefined;
429
+ /** The `tooltip` template of a text renderer, a label renderer or a
430
+ * geometry drawing (DW32; read as parsed JSON): a string, refused by name
431
+ * otherwise; empty reads as none. */
432
+ export declare function readWrunPresentationTooltip(sheetId: string, kind: string, name: string, value: unknown): string | undefined;
433
+ /** Contract section 7 validator rules for the sheet additions, the same
434
+ * refusals the registry gate and the om validator make: `handles` (even
435
+ * empty), a label renderer's corner `position`, and a text renderer's
436
+ * `style` each need abi_version wrun-3 (rule 1); a label sits at an (x, y)
437
+ * point or in a corner, and a lone x or y locates nothing (rule 3). Runs
438
+ * before every run, beside the string-slot checks. */
439
+ export declare function assertWrunSheetAbiCoupling(metadata: WrunIndicatorMetadata): void;
440
+ export type WrunHandlePane = 'onchart' | 'offchart';
441
+ /** The look props a record may carry beside its geometry (Appendix C, the
442
+ * wire column), by kind. */
443
+ export interface WrunHandleLineLookProps {
444
+ arrow?: WrunHandleArrow;
445
+ glow?: number;
446
+ glowColor?: string;
447
+ stickyRight?: true;
448
+ axisLabel?: 'price';
449
+ tooltip?: string;
450
+ /** The sheet's `safe_area` (DW06) for the adapter's `safeArea`. */
451
+ safe_area?: boolean;
452
+ }
453
+ export interface WrunHandleBoxLookProps {
454
+ radius?: number;
455
+ extend?: WrunHandleExtend;
456
+ shape?: 'ellipse';
457
+ gradient?: string[];
458
+ gradientDirection?: WrunHandleGradientDirection;
459
+ glow?: number;
460
+ glowColor?: string;
461
+ text?: string;
462
+ textColor?: string;
463
+ textSize?: number;
464
+ fontWeight?: 400 | 500 | 700;
465
+ fontFamily?: WrunFontFamily;
466
+ align?: WrunLabelAlign;
467
+ valign?: WrunHandleValign;
468
+ padding?: number;
469
+ fitGroup?: number;
470
+ tooltip?: string;
471
+ safe_area?: boolean;
472
+ }
473
+ export interface WrunHandleLabelLookProps {
474
+ style?: WrunHandleLabelStyle;
475
+ border?: string;
476
+ borderWidth?: number;
477
+ radius?: number;
478
+ fontWeight?: 400 | 500 | 700;
479
+ fontFamily?: WrunFontFamily;
480
+ valign?: WrunHandleValign;
481
+ padding?: number;
482
+ maxWidth?: number;
483
+ angle?: number;
484
+ glow?: number;
485
+ glowColor?: string;
486
+ emblemShape?: WrunHandleEmblemShape;
487
+ emblemColor?: string;
488
+ stickyRight?: true;
489
+ axisLabel?: WrunHandleAxisLabel;
490
+ group?: number;
491
+ tooltip?: string;
492
+ safe_area?: boolean;
493
+ }
494
+ export interface WrunHandlePolylineLookProps {
495
+ opacity?: number;
496
+ zOrder?: number;
497
+ fillColor?: string;
498
+ closed?: true;
499
+ smooth?: true;
500
+ arrow?: WrunHandleArrow;
501
+ glow?: number;
502
+ glowColor?: string;
503
+ tooltip?: string;
504
+ safe_area?: boolean;
505
+ }
506
+ export interface WrunHandleLineProps extends WrunHandleLineLookProps {
507
+ anchor?: WrunDrawingAnchor;
508
+ x1: number;
509
+ y1: number;
510
+ x2: number;
511
+ y2: number;
512
+ color: string;
513
+ width: number;
514
+ lineStyle: WrunHandleLineStyle;
515
+ extend: WrunHandleExtend;
516
+ opacity?: number;
517
+ zOrder?: number;
518
+ /** The other line this one shades to (`wrun_h_line_<id>`) and the shade's
519
+ * colour (alpha = opacity): both present exactly while a `fill` colour is
520
+ * set AND `fill_to` names a line, neither otherwise. The target was a live
521
+ * line at the `fill_to` call; a later delete leaves the key (the adapter
522
+ * draws a fill only when the target is live in the same result). */
523
+ fillTo?: string;
524
+ fillColor?: string;
525
+ }
526
+ export interface WrunHandleBoxProps extends WrunHandleBoxLookProps {
527
+ anchor?: WrunDrawingAnchor;
528
+ left: number;
529
+ top: number;
530
+ right: number;
531
+ bottom: number;
532
+ borderColor: string;
533
+ borderWidth: number;
534
+ borderStyle: WrunHandleLineStyle;
535
+ fillColor: string;
536
+ backgroundColor: string;
537
+ fillOpacity: number;
538
+ zOrder?: number;
539
+ }
540
+ export interface WrunHandleLabelProps extends WrunHandleLabelLookProps {
541
+ anchor?: WrunDrawingAnchor;
542
+ /** Which edge of the text sits on x; absent is centred. */
543
+ align?: WrunLabelAlign;
544
+ x: number;
545
+ y: number;
546
+ text: string;
547
+ color: string;
548
+ size: number;
549
+ backgroundColor?: string;
550
+ opacity?: number;
551
+ zOrder?: number;
552
+ }
553
+ export interface WrunHandlePoint {
554
+ x: number;
555
+ y: number;
556
+ }
557
+ export interface WrunHandlePolylineProps extends WrunHandlePolylineLookProps {
558
+ anchor?: WrunDrawingAnchor;
559
+ points: WrunHandlePoint[];
560
+ color: string;
561
+ width: number;
562
+ lineStyle: WrunHandleLineStyle;
563
+ }
564
+ export interface WrunHandlePropsByKind {
565
+ line: WrunHandleLineProps;
566
+ box: WrunHandleBoxProps;
567
+ label: WrunHandleLabelProps;
568
+ polyline: WrunHandlePolylineProps;
569
+ }
570
+ /** One run-result `drawings[]` record for a live handle, in ledger creation
571
+ * order. `createdBar` / `mutatedBar` are row indexes of the run window (a
572
+ * delete never stamps `mutatedBar`). */
573
+ export type WrunHandleRecord<K extends WrunHandleKind = WrunHandleKind> = K extends WrunHandleKind ? {
574
+ id: string;
575
+ kind: K;
576
+ pane: WrunHandlePane;
577
+ createdBar: number;
578
+ mutatedBar: number;
579
+ props: WrunHandlePropsByKind[K];
580
+ } : never;
581
+ /** `wrun_draw_color`'s `0xRRGGBBAA` i32 bit pattern as a plain CSS color
582
+ * (no token decode; the ledger's colour channel reads the token sentinel
583
+ * through the foundation's `wrunDrawColorWire`). */
584
+ export declare function wrunRgbaFromI32(rgba: number): string;
585
+ /** A sheet color on the wire: hex forms become `rgba(r,g,b,a)` (the
586
+ * contract's wire example spells `#38bdf8` as `rgba(56,189,248,1)`); every
587
+ * other form (rgb(), hsl(), a named color, a theme token such as
588
+ * `theme.up`) rides verbatim: tokens resolve at paint time on the chart,
589
+ * never here (TH-theme-tokens). */
590
+ export declare function wrunSheetColorToWire(color: string): string;
591
+ /** A colour with its alpha REPLACED by `opacity` (the kScript opacity()
592
+ * convention; the engine's box painter reads translucency off the fill
593
+ * colour itself): a theme token keeps its word and takes the alpha
594
+ * (`theme.up` at 0.2 is `theme.up/33`, resolved at paint time); 3/4/6/8
595
+ * digit hex, rgb()/rgba() and hsl()/hsla() are rewritten; any other string
596
+ * passes unchanged, as does an opacity of 1 or out of range. The same
597
+ * text the run-result adapter's withOpacity prints. */
598
+ export declare function wrunColorWithOpacity(color: string, opacity: number | undefined): string;
599
+ /** A colour's own alpha in the forms wrunColorWithOpacity rewrites (3/4/6/8
600
+ * digit hex, rgb()/rgba(), hsl()/hsla(), a number or a percentage) and in a
601
+ * theme token (`theme.<t>/aa`): 1 when the form carries none, undefined for
602
+ * any other string (a named colour). */
603
+ export declare function wrunColorOwnAlpha(color: string): number | undefined;
604
+ /**
605
+ * The opacity a box paints its fill at (the box fill rule, PINE-TV-PARITY 2026-10-05). An opacity
606
+ * the module set (a `.opacity()` call, a declared `opacity`) is the fill's alpha, replacing the
607
+ * colour's own. Without one, a fill colour that carries its own alpha below 1 keeps it: a Pine
608
+ * `color.new(c, transp)` fade ported as `.fill(rgba(...))` paints at that alpha, row by row. Only an
609
+ * opaque fill takes the default opacity (the sheet's `opacity`, else 0.2), as before. A packed
610
+ * colour always carries an alpha byte, so an opaque fill reads as "no alpha given".
611
+ */
612
+ export declare function wrunBoxFillOpacity(fill: string, opacity: number | undefined, opacitySet: boolean): number | undefined;
613
+ /** The wire props a declared geometry drawing's g4 look keys map to (the
614
+ * freeze's 3.5.3 seam; the adapter assigns them over the record's base
615
+ * props). Every key is read off the declaration by name and refused by
616
+ * name when out of its range or grammar. The box rules of DW19 live here:
617
+ * `color` (the alpha-rewritable grammar or a token, default "#38bdf8") is
618
+ * the fill at `opacity` (default 0.2 on an opaque colour; a colour with
619
+ * its own alpha keeps it unless `opacity` is declared, wrunBoxFillOpacity)
620
+ * on `backgroundColor` and `fillColor`,
621
+ * and the border when `border_color` is absent; `border_width` defaults to
622
+ * 1; `border_style` (else the legacy `line_style`) is the dash; the
623
+ * declaration's bare `color` must not reach titan as the border (the
624
+ * adapter drops it). A label's `price_label` is an alias of `box` (a plot
625
+ * look on an already-published drawing); `plain` is the text-only look. */
626
+ export declare function wrunDrawingStyleWire(kind: 'line' | 'box' | 'polyline' | 'label', declaration: Record<string, unknown>, sheetId: string): Record<string, unknown>;
627
+ /** A new handle's initial wire props: the pre-round base keys (the sheet
628
+ * colours expanded to rgba, the contract's wire example) plus the look
629
+ * keys through the same mapper as a declared drawing's. A box keeps its
630
+ * fill opacity as `fillOpacity` beside the raw fill colours (the adapter
631
+ * folds it at the titan boundary, after every later `fill` colour and
632
+ * `opacity` style call alike). The sheet's `safe_area` rides as written
633
+ * for the adapter's `safeArea` (DW06). */
634
+ export declare function wrunHandleInitialProps(kind: WrunHandleKind, defaults: NonNullable<WrunHandleDefaultsByKind[WrunHandleKind]>): Record<string, unknown>;
635
+ /** The element a fatal draw refusal names: the handle id the call took, the row the call was made on and that
636
+ * row's time (epoch ms, the chart's row unit), the import, and the argument the verdict is about with its value
637
+ * (`<name>=<value>`), when one is. */
638
+ export interface WrunDrawElement {
639
+ id?: number;
640
+ row?: number;
641
+ ts?: number;
642
+ call?: string;
643
+ arg?: string;
644
+ }
645
+ /** A fatal draw-channel refusal: the evaluation fails by name (`refusal` is one of WRUN3_DRAW_FATAL_CODES and
646
+ * leads the message), exactly like a string channel refusal fails a run. A skip code never reaches here: the
647
+ * ledger records it and the run goes on. The element rides as fields and in the words. */
648
+ export declare class WrunDrawRefusalError extends Error {
649
+ readonly refusal: WrunDrawFatalCode;
650
+ readonly id?: number;
651
+ readonly row?: number;
652
+ readonly ts?: number;
653
+ readonly call?: string;
654
+ readonly arg?: string;
655
+ constructor(refusal: WrunDrawFatalCode, detail: string, element?: WrunDrawElement);
656
+ }
657
+ /** The string slots a label or a slot prop reads, as the host holds them on the row being evaluated: `count`
658
+ * declared slots, and `text(slot)` the slot's text as written on THIS row at the call (null: not written yet this
659
+ * row; a present empty write is ""). The ledger judges them in the contract's order: an undeclared slot refuses
660
+ * `wrun_draw_label_slot_undeclared` (a code mistake), an unwritten one skips `wrun_draw_label_slot_absent`. */
661
+ export interface WrunSlotTexts {
662
+ readonly count: number;
663
+ text(slot: number): string | null;
664
+ }
665
+ /** What a label call's text comes from: the host's slot (`slot`, read through `slots` in the contract's order), or
666
+ * the text itself when the caller already holds it (a slot written on the row, or "" for NO_TEXT_SLOT). */
667
+ export type WrunLabelText = string | {
668
+ readonly slot: number;
669
+ readonly slots: WrunSlotTexts;
670
+ };
671
+ /** What a polyline call carries: `count` points, read on demand as `[x0, y0, x1, y1, ...]` in ABI units (the host
672
+ * proves the module's memory and the pointer bounds in `read`, refusing `wrun_draw_polyline_out_of_bounds`), or
673
+ * the flat points themselves when the caller already holds them. */
674
+ export type WrunPolylinePoints = ArrayLike<number> | {
675
+ readonly count: number;
676
+ read(): ArrayLike<number>;
677
+ };
678
+ /**
679
+ * The per-instance handle ledger: create, mutate and delete by id with the engine's stamping rules, the caps, the
680
+ * byte accounting, the skipped calls, and the journal that makes a live restore exact. Rows are the run window's
681
+ * row indexes.
682
+ *
683
+ * Every call runs its fatal checks first (the per-row count, the id, the kind, the prop, the slot, then the limits a
684
+ * call that would apply must pass: a skipped call still counts toward them), then its skip checks; a fatal check
685
+ * throws `WrunDrawRefusalError`, a skip check records the call (`drawSkips`) and drops it, both BEFORE the ledger
686
+ * changes, so nothing is ever half applied. A geometry call skipped on an id that holds no handle of its kind (a
687
+ * skipped create, or a kind mismatch) absorbs that id's style and colour calls for the rest of the row: the
688
+ * generated draw code re-sends a handle's setters after its geometry call, so one bad element is one record. The
689
+ * phase guard is the host's (it runs before the ledger is reached).
690
+ */
691
+ export declare class WrunHandleLedger {
692
+ private readonly limitBytes;
693
+ private readonly entries;
694
+ private readonly defaults;
695
+ /** The sheet declares a `handles` section: without one every draw call but the last-bar signal refuses
696
+ * `wrun_draw_kind_undeclared` (style, colour and delete included, the om hosts' rule). */
697
+ private readonly declared;
698
+ private nextSeq;
699
+ private bytes;
700
+ private rowCalls;
701
+ /** The time of the row being evaluated (the skipped calls' `ts`). */
702
+ private rowTs;
703
+ private journal;
704
+ private seqAtSnapshot;
705
+ /** The points every live polyline holds (WRUN3_MAX_POLYLINE_POINTS_PER_RUN). */
706
+ private polylinePoints;
707
+ /** The run's skipped calls: the first WRUN3_MAX_DRAW_SKIPS in call order, then a count, each with its mark at the
708
+ * live snapshot (a restore truncates back to the marks). */
709
+ private skips;
710
+ private skipRest;
711
+ private skipsAtSnapshot;
712
+ private skipRestAtSnapshot;
713
+ /** The ids a skipped geometry call left absorbing this row, with the kind that call named. */
714
+ private readonly absorbing;
715
+ /** `defaults` undefined: the sheet declares no `handles` section (every draw call refuses by name). */
716
+ constructor(defaults: WrunHandleDefaultsByKind | undefined, limitBytes?: number);
717
+ /** Live handles. */
718
+ get size(): number;
719
+ /** Accounted bytes of the live set. */
720
+ get accountedBytes(): number;
721
+ /** Start a row: the draw-calls-per-row cap counts from here, nothing absorbs, and a skip records `ts` (the row's
722
+ * time in the host's row unit). */
723
+ beginRow(ts?: number): void;
724
+ line(bar: number, id: number, x1: number, y1: number, x2: number, y2: number): void;
725
+ /** Corners normalize on the wire: ascending x and descending y. */
726
+ box(bar: number, id: number, left: number, top: number, right: number, bottom: number): void;
727
+ /** `text`: the host's slot and reader (judged here: an undeclared slot refuses, an unwritten one skips), or the
728
+ * text itself. A slot of NO_TEXT_SLOT draws a label with no text and reads nothing (DW29). */
729
+ label(bar: number, id: number, x: number, y: number, text: WrunLabelText): void;
730
+ /** `points`: `count` points read on demand (the host's memory read, bounds proven there), or the flat points. */
731
+ polyline(bar: number, id: number, points: WrunPolylinePoints): void;
732
+ /**
733
+ * A style call, in the om reference order. Fatal: the id, `handles` declared, the prop known, the prop legal on a
734
+ * kind the call reaches (the kind an absorbing id's skipped geometry call named, the live handle's), a slot prop
735
+ * naming an undeclared slot. Then an absorbing id does nothing and records nothing, an id no handle holds skips
736
+ * `wrun_draw_handle_missing`, and the value skips when it is non-finite (by the range name on a clearing prop,
737
+ * `wrun_draw_non_finite` on a plain numeric one), a fraction where an integer is required, outside its range or
738
+ * vocabulary, a slot prop's slot unwritten this row, or a `fill_to` naming the line itself, no live handle or a
739
+ * live handle of another kind. The patch follows Appendix C's wire column with the set-or-delete rule (0 clears a
740
+ * word, -1 a slot, 0 a "0 deletes" number).
741
+ */
742
+ style(bar: number, id: number, prop: number, value: number, slots?: WrunSlotTexts): void;
743
+ /** A colour call: the style call's fatal checks (the id, `handles` declared, the prop known, the prop legal on a
744
+ * reachable kind), then an absorbing id does nothing and an id no handle holds skips `wrun_draw_handle_missing`. */
745
+ color(bar: number, id: number, prop: number, rgba: number): void;
746
+ /** Delete never stamps `mutatedBar`; an unknown id is a no-op (the
747
+ * engine's rule, never a skip), and the id may be reused on a later row (new `seq`). */
748
+ delete(id: number, bar?: number): void;
749
+ /** Mark the restore baseline (taken beside the worker's memory snapshot):
750
+ * the journal starts here, and so do the skipped calls a restore drops. */
751
+ snapshot(): void;
752
+ /** Undo every op since the baseline, in reverse, and hand back the
753
+ * creation counter, so a re-created handle takes the seq a full run would. The skips made since go with them and
754
+ * nothing absorbs: a restore lands on a row boundary, and the row run again records its own. */
755
+ restore(): void;
756
+ /** The live set as wire records, in creation (`seq`) order. */
757
+ records(): WrunHandleRecord[];
758
+ /** The run's skipped calls as an answer carries them: nothing when no call was skipped (a clean run's answer keeps
759
+ * its shape byte for byte), else the first WRUN3_MAX_DRAW_SKIPS records (copies) and the count past them. */
760
+ drawSkips(): WrunDrawSkips;
761
+ /** Record a skipped call: in full up to WRUN3_MAX_DRAW_SKIPS a run, counted past it. */
762
+ private skip;
763
+ /** A skipped geometry call: recorded, and unless the id holds a handle of the call's kind (a skipped update keeps
764
+ * its handle, and its setters that row apply), the id absorbs its style and colour calls for the row. */
765
+ private skipGeometry;
766
+ /** A line or box call: the fatal checks, then the first non-finite coordinate, then the kind of a live id. */
767
+ private corners;
768
+ private countCall;
769
+ /** The id is an integer >= 0 and the sheet declares `handles` (the om hosts' `requireId`). */
770
+ private requireId;
771
+ /** The id, then the call's kind declared in the sheet's `handles` section. */
772
+ private requireKind;
773
+ /** The live-handle caps a create must pass, checked whether or not the call is then skipped. */
774
+ private requireRoom;
775
+ /** A style or colour prop must apply to a kind the call reaches (the kind an absorbing id's skipped geometry call
776
+ * named, then the live handle's): a prop none of them takes is a code mistake whatever the row skipped. An id
777
+ * with neither reaches no kind, and its call skips as a missing handle instead. */
778
+ private requireReachableKind;
779
+ /** Apply a geometry call every check passed: create on an unknown id (style from the sheet defaults,
780
+ * `createdBar = mutatedBar = row`, the next seq), update the id's handle of the same kind. An id that applies
781
+ * absorbs nothing more this row. The byte account is the call's last rule (the chart's own: 16 bytes a point). */
782
+ private apply;
783
+ private commit;
784
+ private requireBudget;
785
+ }
786
+ export declare function attachWrunHandles(rows: ReadonlyArray<WrunOutputRow>, handles: ReadonlyArray<WrunHandleRecord>): void;
787
+ export declare function wrunHandlesOf(rows: ReadonlyArray<WrunOutputRow>): ReadonlyArray<WrunHandleRecord> | undefined;
788
+ export declare function attachWrunDrawSkips(rows: ReadonlyArray<WrunOutputRow>, skips: WrunDrawSkips): void;
789
+ export declare function wrunDrawSkipsOf(rows: ReadonlyArray<WrunOutputRow>): WrunDrawSkips | undefined;
790
+ /** The skipped calls an answer read off a wire carries (the cloud's frame: `skipped`, `skippedCount`), kept to the
791
+ * records that read as records and at most WRUN3_MAX_DRAW_SKIPS of them; nothing when none does. */
792
+ export declare function wrunDrawSkipsFromWire(skipped: unknown, skippedCount: unknown): WrunDrawSkips;