@orangecharts/wrun-chart-host 0.7.1 → 0.9.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 (210) hide show
  1. package/README.md +27 -4
  2. package/dist/constants/feature-flags.constants.d.ts +5 -0
  3. package/dist/constants/feature-flags.constants.js +32 -0
  4. package/dist/constants/marketCapabilities.constants.d.ts +14 -9
  5. package/dist/constants/marketCapabilities.constants.js +36 -13
  6. package/dist/constants/opra-compliance.constants.d.ts +14 -0
  7. package/dist/constants/opra-compliance.constants.js +14 -0
  8. package/dist/constants/option-venues.constants.d.ts +29 -6
  9. package/dist/constants/option-venues.constants.js +19 -2
  10. package/dist/constants/venue-presets.constants.d.ts +17 -3
  11. package/dist/constants/venue-presets.constants.js +17 -3
  12. package/dist/host-env.d.ts +34 -4
  13. package/dist/host-env.js +21 -0
  14. package/dist/host-ports.types.d.ts +51 -3
  15. package/dist/index.d.ts +17 -0
  16. package/dist/index.js +17 -0
  17. package/dist/indicators/controls/tpo-session.util.d.ts +40 -11
  18. package/dist/indicators/controls/tpo-session.util.js +138 -14
  19. package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
  20. package/dist/interfaces/opra-realtime.interface.js +10 -10
  21. package/dist/interfaces/option-instrument.interface.d.ts +6 -0
  22. package/dist/interfaces/wrun-runtime.interface.d.ts +34 -13
  23. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +57 -10
  24. package/dist/kscript-data/controls/live-trades-merge.util.js +85 -16
  25. package/dist/market-data/billing.interface.d.ts +138 -17
  26. package/dist/market-data/billing.interface.js +25 -8
  27. package/dist/market-data/venues/index.d.ts +3 -3
  28. package/dist/market-data/venues/opra.contract.copy.json +5 -3
  29. package/dist/market-data/venues/opra.d.ts +3 -3
  30. package/dist/market-data/venues/opra.js +5 -4
  31. package/dist/replay/replayLadder.js +3 -1
  32. package/dist/settings-templates/footprint-rows.d.ts +25 -0
  33. package/dist/settings-templates/footprint-rows.js +127 -0
  34. package/dist/settings-templates/form-rows.d.ts +56 -0
  35. package/dist/settings-templates/form-rows.js +19 -0
  36. package/dist/settings-templates/frvp-fields.js +14 -0
  37. package/dist/settings-templates/index.d.ts +10 -1
  38. package/dist/settings-templates/index.js +11 -2
  39. package/dist/settings-templates/indicator-fields.js +78 -0
  40. package/dist/settings-templates/tool-rules.d.ts +35 -9
  41. package/dist/settings-templates/tool-rules.js +42 -8
  42. package/dist/settings-templates/tool-tables.generated.js +13 -2
  43. package/dist/utility/chart/candle-volume-unit.leaf.d.ts +16 -0
  44. package/dist/utility/chart/candle-volume-unit.leaf.js +61 -0
  45. package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
  46. package/dist/utility/chart/crypto-index.leaf.js +2 -2
  47. package/dist/utility/chart/footprint-columns.util.d.ts +74 -0
  48. package/dist/utility/chart/footprint-columns.util.js +106 -0
  49. package/dist/utility/chart/footprint-display-mode.util.d.ts +40 -0
  50. package/dist/utility/chart/footprint-display-mode.util.js +62 -0
  51. package/dist/utility/chart/footprint-sierra-look.util.d.ts +2 -0
  52. package/dist/utility/chart/footprint-sierra-look.util.js +37 -0
  53. package/dist/utility/chart/index-mode-admission.util.js +9 -1
  54. package/dist/utility/chart/index-mode.util.d.ts +5 -2
  55. package/dist/utility/chart/index-mode.util.js +23 -13
  56. package/dist/utility/chart/kscript-venue-policy.util.d.ts +28 -21
  57. package/dist/utility/chart/kscript-venue-policy.util.js +34 -26
  58. package/dist/utility/chart/marketKind.util.d.ts +12 -10
  59. package/dist/utility/chart/marketKind.util.js +17 -7
  60. package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
  61. package/dist/utility/chart/om-panel-push-style.util.js +17 -15
  62. package/dist/utility/chart/om-panel.util.d.ts +11 -0
  63. package/dist/utility/chart/om-panel.util.js +65 -6
  64. package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
  65. package/dist/utility/chart/profile-block-size.util.js +7 -0
  66. package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
  67. package/dist/utility/chart/quote-perp.leaf.js +20 -0
  68. package/dist/utility/chart/window-geometry.leaf.d.ts +23 -1
  69. package/dist/utility/chart/window-geometry.leaf.js +78 -6
  70. package/dist/utility/chart/window-owner.leaf.d.ts +13 -0
  71. package/dist/utility/chart/window-owner.leaf.js +5 -0
  72. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -0
  73. package/dist/utility/chart/wrun-run-result.util.js +4 -1
  74. package/dist/utility/common/transformations.util.d.ts +7 -0
  75. package/dist/utility/common/transformations.util.js +11 -0
  76. package/dist/utility/options/cme-options-root.util.d.ts +25 -0
  77. package/dist/utility/options/cme-options-root.util.js +40 -0
  78. package/dist/utility/options/option-book.util.d.ts +27 -0
  79. package/dist/utility/options/option-book.util.js +76 -0
  80. package/dist/utility/options/option-trade-date.util.d.ts +50 -0
  81. package/dist/utility/options/option-trade-date.util.js +120 -0
  82. package/dist/utility/options/option-venue.util.d.ts +3 -3
  83. package/dist/utility/options/option-venue.util.js +3 -3
  84. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +1 -1
  85. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +2 -2
  86. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
  87. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
  88. package/dist/utility/wrun/sources/host-grid-landing.d.ts +4 -2
  89. package/dist/utility/wrun/sources/host-grid-landing.js +8 -0
  90. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +40 -4
  91. package/dist/utility/wrun/sources/lanes/options_flow.js +115 -18
  92. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +12 -9
  93. package/dist/utility/wrun/sources/opra-option-lanes.util.js +10 -7
  94. package/dist/utility/wrun/sources/row-lane-registry.js +10 -5
  95. package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
  96. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +3 -2
  97. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +30 -5
  98. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
  99. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +13 -5
  100. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +25 -1
  101. package/dist/utility/wrun/sources/row-lanes/option_prints.js +161 -30
  102. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.d.ts +4 -0
  103. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +65 -0
  104. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +55 -1
  105. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +83 -2
  106. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +17 -1
  107. package/dist/utility/wrun/sources/row-lanes/option_surface.js +33 -2
  108. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +7 -1
  109. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +51 -5
  110. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +136 -3
  111. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +42 -0
  112. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +146 -0
  113. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +25 -5
  114. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +111 -20
  115. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +291 -48
  116. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
  117. package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
  118. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
  119. package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
  120. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
  121. package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
  122. package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
  123. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +147 -9
  124. package/dist/utility/wrun/wrun-chart-market-facts.util.js +345 -11
  125. package/dist/utility/wrun/wrun-cloud-record.leaf.d.ts +27 -0
  126. package/dist/utility/wrun/wrun-cloud-record.leaf.js +71 -0
  127. package/dist/utility/wrun/wrun-cloud-record.util.d.ts +4 -21
  128. package/dist/utility/wrun/wrun-cloud-record.util.js +5 -65
  129. package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
  130. package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
  131. package/dist/utility/wrun/wrun-color-settings.util.d.ts +22 -9
  132. package/dist/utility/wrun/wrun-color-settings.util.js +57 -23
  133. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
  134. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
  135. package/dist/utility/wrun/wrun-download-meter.util.d.ts +92 -0
  136. package/dist/utility/wrun/wrun-download-meter.util.js +122 -0
  137. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +10 -3
  138. package/dist/utility/wrun/wrun-draft-overlay.util.js +63 -6
  139. package/dist/utility/wrun/wrun-frames.js +5 -5
  140. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  141. package/dist/utility/wrun/wrun-hosted-wire-caps.js +11 -0
  142. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +33 -17
  143. package/dist/utility/wrun/wrun-hud-looks.util.js +30 -16
  144. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +29 -3
  145. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +33 -3
  146. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
  147. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
  148. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
  149. package/dist/utility/wrun/wrun-live-intake.util.d.ts +6 -2
  150. package/dist/utility/wrun/wrun-live-intake.util.js +136 -21
  151. package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -1
  152. package/dist/utility/wrun/wrun-live-tick.util.js +130 -44
  153. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
  154. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
  155. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +224 -0
  156. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +342 -0
  157. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +88 -0
  158. package/dist/utility/wrun/wrun-market-size-defaults.util.js +471 -0
  159. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +43 -8
  160. package/dist/utility/wrun/wrun-opra-flow.leaf.js +37 -6
  161. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +51 -10
  162. package/dist/utility/wrun/wrun-option-contract-flow.util.js +85 -33
  163. package/dist/utility/wrun/wrun-option-prints.util.d.ts +172 -3
  164. package/dist/utility/wrun/wrun-option-prints.util.js +394 -17
  165. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +99 -0
  166. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +218 -0
  167. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +365 -0
  168. package/dist/utility/wrun/wrun-option-strike-flow.util.js +797 -0
  169. package/dist/utility/wrun/wrun-option-views.util.d.ts +231 -7
  170. package/dist/utility/wrun/wrun-option-views.util.js +643 -23
  171. package/dist/utility/wrun/wrun-options-chain.util.d.ts +6 -4
  172. package/dist/utility/wrun/wrun-options-chain.util.js +8 -5
  173. package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
  174. package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
  175. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
  176. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
  177. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
  178. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +9 -1
  179. package/dist/utility/wrun/wrun-overlay-recovery.util.js +32 -3
  180. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
  181. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  182. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +34 -6
  183. package/dist/utility/wrun/wrun-overlay-run.util.js +527 -180
  184. package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +15 -0
  185. package/dist/utility/wrun/wrun-pack-widths.leaf.js +22 -0
  186. package/dist/utility/wrun/wrun-pack.util.d.ts +13 -8
  187. package/dist/utility/wrun/wrun-pack.util.js +38 -21
  188. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +4 -0
  189. package/dist/utility/wrun/wrun-panel-mount.util.js +62 -22
  190. package/dist/utility/wrun/wrun-panel-style.util.d.ts +41 -14
  191. package/dist/utility/wrun/wrun-panel-style.util.js +86 -26
  192. package/dist/utility/wrun/wrun-param-map.util.d.ts +7 -6
  193. package/dist/utility/wrun/wrun-param-map.util.js +8 -5
  194. package/dist/utility/wrun/wrun-param-values.util.d.ts +10 -2
  195. package/dist/utility/wrun/wrun-param-values.util.js +2 -0
  196. package/dist/utility/wrun/wrun-pin-spelling.util.js +19 -10
  197. package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
  198. package/dist/utility/wrun/wrun-refusal.util.js +17 -2
  199. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +20 -0
  200. package/dist/utility/wrun/wrun-script-inputs.util.js +43 -0
  201. package/dist/utility/wrun/wrun-source-rows.util.d.ts +4 -0
  202. package/dist/utility/wrun/wrun-source-rows.util.js +92 -40
  203. package/dist/utility/wrun/wrun-tape-source.util.d.ts +133 -48
  204. package/dist/utility/wrun/wrun-tape-source.util.js +205 -62
  205. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
  206. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
  207. package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
  208. package/dist/workers/utils/volume-profile.worker.util.js +5 -2
  209. package/dist/workers/wrun/wrun-abi-host.js +3 -2
  210. package/package.json +11 -11
@@ -0,0 +1,71 @@
1
+ /**
2
+ * The cloud record's migration on read (`wrunCloudRecordOf`) and the pane side a sheet declares (`wrunSheetPositionOf`),
3
+ * moved out of wrun-cloud-record.util, which re-exports both: the kScript venue policy reads the migration
4
+ * synchronously at every run door (titan-charts' dataFetch guard among them, so on the code parsed before the first
5
+ * candle), and the util stays off that path (tests/utility/wrun/wrun-door.closure.spec.ts). A near-leaf (the identity
6
+ * leaf only); the header of wrun-cloud-record.util says what each read is for.
7
+ */
8
+ import { wrunRegistrySlugFor } from './wrun-overlay-identity.util.js';
9
+ function isRecord(value) {
10
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
11
+ }
12
+ function hasPackageName(ref) {
13
+ return isRecord(ref) && typeof ref.package === 'string' && ref.package !== '';
14
+ }
15
+ /** A sheet's chart placement, the registry loader's `packagePosition` read loosely (a record's persisted
16
+ * copy may be trimmed or malformed, a cloud batch's sheet is the cloud's): a declared `overlay` wins; a
17
+ * strategy homes on price; a plotted, non-inset output on the `overlay` panel homes on price; otherwise
18
+ * the primary output's panel decides. */
19
+ export function wrunSheetPositionOf(sheet) {
20
+ const read = sheet ?? {};
21
+ if (read.overlay === 'offchart')
22
+ return 'offchart';
23
+ if (read.overlay === 'onchart')
24
+ return 'onchart';
25
+ if (read.strategy !== undefined)
26
+ return 'onchart';
27
+ const outputs = Array.isArray(read.outputs)
28
+ ? read.outputs
29
+ : [];
30
+ if (outputs.some((output) => output?.plot !== '' && output?.plot !== 'inset' && output?.panel === 'overlay')) {
31
+ return 'onchart';
32
+ }
33
+ return outputs[0]?.panel === 'lower' ? 'offchart' : 'onchart';
34
+ }
35
+ /**
36
+ * A record persisted for the protected pipeline before lane parity wave 3, read as the cloud record
37
+ * it is (the migration on read): its wire identity becomes the registry identity (a marketplace mount
38
+ * carried none; one it carried stays, its pane side kept), the slug is the registry's, the row source
39
+ * the cloud's, and the protected flag goes. Every other key rides as persisted. The pane side is the
40
+ * one the record carried, else its persisted sheet's (wrunSheetPositionOf); a record with neither (a
41
+ * marketplace mount) leaves it undecided, so the control mounts it on the price pane and the first
42
+ * batch's delivered sheet decides it, instead of a side guessed here being persisted for good. What
43
+ * else a registry identity naming the same tuple carried (the source mode a mount with the version doc
44
+ * in hand stamped, read by wrunOverlayEditable) stays: a cloud row persisted during the rollout carries
45
+ * `wrunRef` too (wrun-cloud-row-compat.util), and one that reaches the chart past the store's entry (a
46
+ * collab add, a paste) is read here. Undefined for a record that carries no wire identity (nothing to
47
+ * read again).
48
+ */
49
+ export function wrunCloudRecordOf(settings) {
50
+ if (!isRecord(settings))
51
+ return undefined;
52
+ const { isProtectedScript: _protected, wrunRef, ...record } = settings;
53
+ if (!hasPackageName(wrunRef))
54
+ return undefined;
55
+ const packageName = wrunRef.package;
56
+ const version = typeof wrunRef.version === 'string' ? wrunRef.version : '';
57
+ const kept = isRecord(record.wrunRegistryRef) ? record.wrunRegistryRef : undefined;
58
+ const position = kept?.position === 'onchart' || kept?.position === 'offchart'
59
+ ? kept.position
60
+ : isRecord(record.wrunSheet)
61
+ ? wrunSheetPositionOf(record.wrunSheet)
62
+ : undefined;
63
+ const facts = kept?.package === packageName && kept.version === version ? { ...kept } : {};
64
+ delete facts.position;
65
+ return {
66
+ ...record,
67
+ customScriptId: wrunRegistrySlugFor(packageName, version),
68
+ wrunRegistryRef: { ...facts, package: packageName, version, ...(position ? { position } : {}) },
69
+ wrunRunTarget: 'cloud',
70
+ };
71
+ }
@@ -24,32 +24,15 @@
24
24
  * read loosely), for a sheet the loader did not download (a persisted copy, a cloud batch's).
25
25
  *
26
26
  * A near-leaf (the identity leaf only), so the loader, the factory and the catalog read one
27
- * definition.
27
+ * definition. The migration on read and the sheet's pane side live in wrun-cloud-record.leaf.ts and are
28
+ * re-exported here: the kScript venue policy reads the migration on the code parsed before the first
29
+ * candle, and this module stays off it (tests/utility/wrun/wrun-door.closure.spec.ts).
28
30
  */
31
+ export { wrunCloudRecordOf, wrunSheetPositionOf } from './wrun-cloud-record.leaf.js';
29
32
  /** `wrun-<package>-<version>` with every non-alphanumeric run collapsed to `-`,
30
33
  * byte-identical to tharamine's wrunCustomScriptSlug. Lossy on purpose (the
31
34
  * registry's publish door refuses colliding coordinates). */
32
35
  export declare function wrunCustomScriptSlug(packageId: string, version: string): string;
33
- /** A sheet's chart placement, the registry loader's `packagePosition` read loosely (a record's persisted
34
- * copy may be trimmed or malformed, a cloud batch's sheet is the cloud's): a declared `overlay` wins; a
35
- * strategy homes on price; a plotted, non-inset output on the `overlay` panel homes on price; otherwise
36
- * the primary output's panel decides. */
37
- export declare function wrunSheetPositionOf(sheet: unknown): 'onchart' | 'offchart';
38
- /**
39
- * A record persisted for the protected pipeline before lane parity wave 3, read as the cloud record
40
- * it is (the migration on read): its wire identity becomes the registry identity (a marketplace mount
41
- * carried none; one it carried stays, its pane side kept), the slug is the registry's, the row source
42
- * the cloud's, and the protected flag goes. Every other key rides as persisted. The pane side is the
43
- * one the record carried, else its persisted sheet's (wrunSheetPositionOf); a record with neither (a
44
- * marketplace mount) leaves it undecided, so the control mounts it on the price pane and the first
45
- * batch's delivered sheet decides it, instead of a side guessed here being persisted for good. What
46
- * else a registry identity naming the same tuple carried (the source mode a mount with the version doc
47
- * in hand stamped, read by wrunOverlayEditable) stays: a cloud row persisted during the rollout carries
48
- * `wrunRef` too (wrun-cloud-row-compat.util), and one that reaches the chart past the store's entry (a
49
- * collab add, a paste) is read here. Undefined for a record that carries no wire identity (nothing to
50
- * read again).
51
- */
52
- export declare function wrunCloudRecordOf(settings: unknown): Record<string, unknown> | undefined;
53
36
  /**
54
37
  * The settings the protected payload builder reads for a cloud record (the socket row source's default
55
38
  * transport builds the createScript payload through the technical-script control): the wire identity
@@ -24,78 +24,18 @@
24
24
  * read loosely), for a sheet the loader did not download (a persisted copy, a cloud batch's).
25
25
  *
26
26
  * A near-leaf (the identity leaf only), so the loader, the factory and the catalog read one
27
- * definition.
27
+ * definition. The migration on read and the sheet's pane side live in wrun-cloud-record.leaf.ts and are
28
+ * re-exported here: the kScript venue policy reads the migration on the code parsed before the first
29
+ * candle, and this module stays off it (tests/utility/wrun/wrun-door.closure.spec.ts).
28
30
  */
29
- import { wrunRegistryRefOf, wrunRegistrySlugFor } from './wrun-overlay-identity.util.js';
31
+ import { wrunRegistryRefOf } from './wrun-overlay-identity.util.js';
32
+ export { wrunCloudRecordOf, wrunSheetPositionOf } from './wrun-cloud-record.leaf.js';
30
33
  /** `wrun-<package>-<version>` with every non-alphanumeric run collapsed to `-`,
31
34
  * byte-identical to tharamine's wrunCustomScriptSlug. Lossy on purpose (the
32
35
  * registry's publish door refuses colliding coordinates). */
33
36
  export function wrunCustomScriptSlug(packageId, version) {
34
37
  return `wrun-${`${packageId}-${version}`.replace(/[^a-zA-Z0-9]+/g, '-')}`;
35
38
  }
36
- function isRecord(value) {
37
- return typeof value === 'object' && value !== null && !Array.isArray(value);
38
- }
39
- function hasPackageName(ref) {
40
- return isRecord(ref) && typeof ref.package === 'string' && ref.package !== '';
41
- }
42
- /** A sheet's chart placement, the registry loader's `packagePosition` read loosely (a record's persisted
43
- * copy may be trimmed or malformed, a cloud batch's sheet is the cloud's): a declared `overlay` wins; a
44
- * strategy homes on price; a plotted, non-inset output on the `overlay` panel homes on price; otherwise
45
- * the primary output's panel decides. */
46
- export function wrunSheetPositionOf(sheet) {
47
- const read = sheet ?? {};
48
- if (read.overlay === 'offchart')
49
- return 'offchart';
50
- if (read.overlay === 'onchart')
51
- return 'onchart';
52
- if (read.strategy !== undefined)
53
- return 'onchart';
54
- const outputs = Array.isArray(read.outputs)
55
- ? read.outputs
56
- : [];
57
- if (outputs.some((output) => output?.plot !== '' && output?.plot !== 'inset' && output?.panel === 'overlay')) {
58
- return 'onchart';
59
- }
60
- return outputs[0]?.panel === 'lower' ? 'offchart' : 'onchart';
61
- }
62
- /**
63
- * A record persisted for the protected pipeline before lane parity wave 3, read as the cloud record
64
- * it is (the migration on read): its wire identity becomes the registry identity (a marketplace mount
65
- * carried none; one it carried stays, its pane side kept), the slug is the registry's, the row source
66
- * the cloud's, and the protected flag goes. Every other key rides as persisted. The pane side is the
67
- * one the record carried, else its persisted sheet's (wrunSheetPositionOf); a record with neither (a
68
- * marketplace mount) leaves it undecided, so the control mounts it on the price pane and the first
69
- * batch's delivered sheet decides it, instead of a side guessed here being persisted for good. What
70
- * else a registry identity naming the same tuple carried (the source mode a mount with the version doc
71
- * in hand stamped, read by wrunOverlayEditable) stays: a cloud row persisted during the rollout carries
72
- * `wrunRef` too (wrun-cloud-row-compat.util), and one that reaches the chart past the store's entry (a
73
- * collab add, a paste) is read here. Undefined for a record that carries no wire identity (nothing to
74
- * read again).
75
- */
76
- export function wrunCloudRecordOf(settings) {
77
- if (!isRecord(settings))
78
- return undefined;
79
- const { isProtectedScript: _protected, wrunRef, ...record } = settings;
80
- if (!hasPackageName(wrunRef))
81
- return undefined;
82
- const packageName = wrunRef.package;
83
- const version = typeof wrunRef.version === 'string' ? wrunRef.version : '';
84
- const kept = isRecord(record.wrunRegistryRef) ? record.wrunRegistryRef : undefined;
85
- const position = kept?.position === 'onchart' || kept?.position === 'offchart'
86
- ? kept.position
87
- : isRecord(record.wrunSheet)
88
- ? wrunSheetPositionOf(record.wrunSheet)
89
- : undefined;
90
- const facts = kept?.package === packageName && kept.version === version ? { ...kept } : {};
91
- delete facts.position;
92
- return {
93
- ...record,
94
- customScriptId: wrunRegistrySlugFor(packageName, version),
95
- wrunRegistryRef: { ...facts, package: packageName, version, ...(position ? { position } : {}) },
96
- wrunRunTarget: 'cloud',
97
- };
98
- }
99
39
  /**
100
40
  * The settings the protected payload builder reads for a cloud record (the socket row source's default
101
41
  * transport builds the createScript payload through the technical-script control): the wire identity
@@ -10,24 +10,34 @@ export interface WrunRgba {
10
10
  * renderer, heatmap, profile or levels declaration (C1, parseWrunStyleTarget). */
11
11
  export declare const WRUN_STYLE_ROW_PREFIX = "__style__";
12
12
  /** True for a Style page row key (never a sheet param, never sent to a host):
13
- * an output property row or a viewer row (a HUD's Look pick or place, a
14
- * heatmap's Sensitivity). */
13
+ * an output property row or a viewer row (a HUD's rows, a heatmap's
14
+ * Sensitivity). */
15
15
  export declare function isWrunStyleRowKey(key: string): boolean;
16
- /** The Style page row key of a HUD's Look pick (g3 addendum LK09):
17
- * `hud:<name>:look`, a viewer setting stored on the overlay beside the
18
- * per-output style rows, never written into the sheet. */
16
+ /** A HUD's viewer rows, `hud:<name>:<row>`: the Look pick (g3 addendum LK09),
17
+ * the place (the card moved by its title) and the dismissable HUD's collapsed
18
+ * and shown flags (C3), stored on the overlay beside the per-output style
19
+ * rows and never written into the sheet. The one list the key builder and
20
+ * every reader derive from: a row added here persists with the workspace row,
21
+ * rides a template and a twin conversion, and saves without a rerun. */
22
+ export declare const WRUN_HUD_VIEWER_ROWS: readonly ["look", "place", "collapsed", "shown"];
23
+ export type WrunHudViewerRow = (typeof WRUN_HUD_VIEWER_ROWS)[number];
19
24
  export declare const WRUN_HUD_LOOK_ROW_PREFIX = "hud:";
20
- export declare const WRUN_HUD_LOOK_ROW_RE: RegExp;
25
+ export declare function wrunHudViewerRowKey(name: string, row: WrunHudViewerRow): string;
26
+ /** A HUD viewer row key read back: its HUD and its row; undefined for any other key. */
27
+ export declare function parseWrunHudViewerRowKey(key: string): {
28
+ name: string;
29
+ row: WrunHudViewerRow;
30
+ } | undefined;
21
31
  export declare function isWrunHudLookRowKey(key: string): boolean;
22
32
  export declare function isWrunHudPlaceRowKey(key: string): boolean;
23
- /** A HUD's viewer rows (the Look pick and the place): overlay settings that persist by key. */
33
+ /** A HUD's viewer rows (WRUN_HUD_VIEWER_ROWS): overlay settings that persist by key. */
24
34
  export declare function isWrunHudViewerRowKey(key: string): boolean;
25
35
  /** The viewer's Sensitivity for one heatmap (`heatmap:<name>:sensitivity`,
26
36
  * wrunHeatmapSensitivityRowKey), stored on the overlay beside the HUD rows. */
27
37
  export declare const WRUN_HEATMAP_SENSITIVITY_ROW_RE: RegExp;
28
38
  export declare function isWrunHeatmapSensitivityRowKey(key: string): boolean;
29
- /** Every viewer row of a browser-run Indicator (a HUD's Look pick and place, a
30
- * heatmap's Sensitivity, a child the reader hid on its own legend row):
39
+ /** Every viewer row of a browser-run Indicator (a HUD's rows, a heatmap's
40
+ * Sensitivity, a child the reader hid on its own legend row):
31
41
  * overlay settings that persist by key and are never a sheet param, an alert
32
42
  * param or a host param. */
33
43
  export declare function isWrunViewerRowKey(key: string): boolean;
@@ -13,27 +13,37 @@ import { isWrunChildHiddenRowKey } from './wrun-child-overlay-id.util.js';
13
13
  * renderer, heatmap, profile or levels declaration (C1, parseWrunStyleTarget). */
14
14
  export const WRUN_STYLE_ROW_PREFIX = '__style__';
15
15
  /** True for a Style page row key (never a sheet param, never sent to a host):
16
- * an output property row or a viewer row (a HUD's Look pick or place, a
17
- * heatmap's Sensitivity). */
16
+ * an output property row or a viewer row (a HUD's rows, a heatmap's
17
+ * Sensitivity). */
18
18
  export function isWrunStyleRowKey(key) {
19
19
  return key.startsWith(WRUN_STYLE_ROW_PREFIX) || isWrunViewerRowKey(key);
20
20
  }
21
- /** The Style page row key of a HUD's Look pick (g3 addendum LK09):
22
- * `hud:<name>:look`, a viewer setting stored on the overlay beside the
23
- * per-output style rows, never written into the sheet. */
21
+ /** A HUD's viewer rows, `hud:<name>:<row>`: the Look pick (g3 addendum LK09),
22
+ * the place (the card moved by its title) and the dismissable HUD's collapsed
23
+ * and shown flags (C3), stored on the overlay beside the per-output style
24
+ * rows and never written into the sheet. The one list the key builder and
25
+ * every reader derive from: a row added here persists with the workspace row,
26
+ * rides a template and a twin conversion, and saves without a rerun. */
27
+ export const WRUN_HUD_VIEWER_ROWS = ['look', 'place', 'collapsed', 'shown'];
24
28
  export const WRUN_HUD_LOOK_ROW_PREFIX = 'hud:';
25
- export const WRUN_HUD_LOOK_ROW_RE = /^hud:(.+):look$/;
29
+ const WRUN_HUD_VIEWER_ROW_RE = new RegExp(`^hud:(.+):(${WRUN_HUD_VIEWER_ROWS.join('|')})$`);
30
+ export function wrunHudViewerRowKey(name, row) {
31
+ return `${WRUN_HUD_LOOK_ROW_PREFIX}${name}:${row}`;
32
+ }
33
+ /** A HUD viewer row key read back: its HUD and its row; undefined for any other key. */
34
+ export function parseWrunHudViewerRowKey(key) {
35
+ const match = WRUN_HUD_VIEWER_ROW_RE.exec(key);
36
+ return match ? { name: match[1], row: match[2] } : undefined;
37
+ }
26
38
  export function isWrunHudLookRowKey(key) {
27
- return WRUN_HUD_LOOK_ROW_RE.test(key);
39
+ return parseWrunHudViewerRowKey(key)?.row === 'look';
28
40
  }
29
- /** The viewer's own place for one HUD (`hud:<name>:place`, wrunHudPlaceRowKey). */
30
- const WRUN_HUD_PLACE_ROW_RE = /^hud:(.+):place$/;
31
41
  export function isWrunHudPlaceRowKey(key) {
32
- return WRUN_HUD_PLACE_ROW_RE.test(key);
42
+ return parseWrunHudViewerRowKey(key)?.row === 'place';
33
43
  }
34
- /** A HUD's viewer rows (the Look pick and the place): overlay settings that persist by key. */
44
+ /** A HUD's viewer rows (WRUN_HUD_VIEWER_ROWS): overlay settings that persist by key. */
35
45
  export function isWrunHudViewerRowKey(key) {
36
- return isWrunHudLookRowKey(key) || isWrunHudPlaceRowKey(key);
46
+ return WRUN_HUD_VIEWER_ROW_RE.test(key);
37
47
  }
38
48
  /** The viewer's Sensitivity for one heatmap (`heatmap:<name>:sensitivity`,
39
49
  * wrunHeatmapSensitivityRowKey), stored on the overlay beside the HUD rows. */
@@ -41,8 +51,8 @@ export const WRUN_HEATMAP_SENSITIVITY_ROW_RE = /^heatmap:(.+):sensitivity$/;
41
51
  export function isWrunHeatmapSensitivityRowKey(key) {
42
52
  return WRUN_HEATMAP_SENSITIVITY_ROW_RE.test(key);
43
53
  }
44
- /** Every viewer row of a browser-run Indicator (a HUD's Look pick and place, a
45
- * heatmap's Sensitivity, a child the reader hid on its own legend row):
54
+ /** Every viewer row of a browser-run Indicator (a HUD's rows, a heatmap's
55
+ * Sensitivity, a child the reader hid on its own legend row):
46
56
  * overlay settings that persist by key and are never a sheet param, an alert
47
57
  * param or a host param. */
48
58
  export function isWrunViewerRowKey(key) {
@@ -48,12 +48,14 @@
48
48
  * change follow it, the way a timeframe or symbol param rewrites its pins.
49
49
  * A value equal to the baked `ticks_per_bar` writes nothing; the lane util
50
50
  * clamps it to 1..500 (`wrunVolumeProfileLaneExtras`).
51
- * - A chain view's params (OPTLOAD G5, wrun-option-views.util,
51
+ * - An option word's params (OPTLOAD G5, wrun-option-views.util,
52
52
  * `optionViewParamWrites`): on an `options_chain` or `option_contract_state`
53
- * input that declares views, each view param knob bound to a declared param
54
- * (`"@<param>"`, or `<knob>_param` beside a literal default) takes the
55
- * param's current value, the `ticks_per_bar` rule, so a settings change
56
- * asks the gateway with the new values.
53
+ * input that declares views, an `option_surface` input its `pick` and an
54
+ * `option_strikes` input its kit `fold` (the classes the words' own tables
55
+ * name), each param knob bound to a declared param (`"@<param>"`, or
56
+ * `<knob>_param` beside a literal default) takes the param's current value,
57
+ * the `ticks_per_bar` rule, so a settings change asks the gateway with the
58
+ * new values.
57
59
  * - The lane words (kit 0.77.0, `laneWordWrites`): `currency_param` and `when`.
58
60
  * - A Style page row (`__style__<output>__<property>`, an FE-only declared
59
61
  * input that never reaches any host) writes the output's `width`,
@@ -88,7 +90,7 @@
88
90
  import type { WrunIndicatorMetadata, WrunMetadataParam, WrunParamStyleBinding } from '../../interfaces/wrun-runtime.interface.js';
89
91
  import { type WrunVisibilityPrefix, type WrunVisibilitySheet } from './wrun-visibility-table.js';
90
92
  import { type WrunRgba } from './wrun-color-facts.util.js';
91
- export { isWrunHeatmapSensitivityRowKey, isWrunHudLookRowKey, isWrunHudPlaceRowKey, isWrunHudViewerRowKey, isWrunStyleRowKey, isWrunViewerRowKey, packWrunColor, parseWrunColor, WRUN_HUD_LOOK_ROW_PREFIX, WRUN_STYLE_ROW_PREFIX, type WrunRgba, } from './wrun-color-facts.util.js';
93
+ export { isWrunHeatmapSensitivityRowKey, isWrunHudLookRowKey, isWrunHudPlaceRowKey, isWrunHudViewerRowKey, isWrunStyleRowKey, isWrunViewerRowKey, packWrunColor, parseWrunColor, parseWrunHudViewerRowKey, WRUN_HUD_LOOK_ROW_PREFIX, WRUN_HUD_VIEWER_ROWS, WRUN_STYLE_ROW_PREFIX, wrunHudViewerRowKey, type WrunHudViewerRow, type WrunRgba, } from './wrun-color-facts.util.js';
92
94
  declare const WRUN_LINE_STYLES: readonly ["solid", "dashed", "dotted"];
93
95
  export type WrunLineStyle = (typeof WRUN_LINE_STYLES)[number];
94
96
  /** The frozen `param.source` field list (plan 1.7, the kit's
@@ -154,6 +156,7 @@ export declare function parseWrunStyleTarget(target: string): {
154
156
  * `visible: false`): it mounts nothing, the stats-row rule. Absent or true
155
157
  * draws. */
156
158
  export declare function isWrunStyleTargetHidden(declaration: unknown): boolean;
159
+ /** A HUD's Look row (`hud:<name>:look`; every HUD viewer row's key and reader in wrun-color-facts.util). */
157
160
  export declare function wrunHudLookRowKey(name: string): string;
158
161
  /** A HUD Look row key read back: the HUD it belongs to. */
159
162
  export declare function parseWrunHudLookRowKey(key: string): {
@@ -190,15 +193,25 @@ export declare function wrunHeatmapSensitivitySetting(settings: unknown, name: s
190
193
  /** True when a save moves the Sensitivity any heatmap draws with (a value set,
191
194
  * changed or cleared, read as wrunHeatmapSensitivitySetting reads it). */
192
195
  export declare function wrunHeatmapSensitivityChanged(prev: unknown, next: unknown): boolean;
193
- /** A save whose every change is a HUD's viewer row (its Look pick, its place): rows only the FE-drawn
194
- * card reads, so no run, canvas paint or legend row depends on them. `patch` is what the save
195
- * sends; its keys are compared with the overlay's current settings (`current`). */
196
+ /** A save whose every change is a HUD's viewer row (its Look pick, its place, its collapsed or shown
197
+ * flag): rows only the FE-drawn card reads, so no run, canvas paint or legend row depends on them.
198
+ * `patch` is what the save sends; its keys are compared with the overlay's current settings (`current`). */
196
199
  export declare function onlyWrunHudViewerRowsChanged(current: unknown, patch: unknown): boolean;
197
200
  /** A stored place read back; anything malformed reads as "where the script puts it". */
198
201
  export declare function parseWrunHudPlace(raw: unknown): WrunHudPlaceSetting | undefined;
199
202
  export declare function formatWrunHudPlace(place: WrunHudPlaceSetting): string;
200
203
  /** The viewer's place for one HUD under the overlay's settings, or undefined (the script's place). */
201
204
  export declare function wrunHudPlaceSetting(settings: unknown, name: string): WrunHudPlaceSetting | undefined;
205
+ /** The dismissable HUD (C3): the viewer folds one card to its chip (`hud:<name>:collapsed`, true) or hides
206
+ * it (`hud:<name>:shown`, false; the Style page's Show row brings it back), viewer rows of the one list
207
+ * (WRUN_HUD_VIEWER_ROWS). Each holds a boolean; absent, null or anything else reads as unset: an expanded
208
+ * card that is shown. */
209
+ export declare function wrunHudCollapsedRowKey(name: string): string;
210
+ export declare function wrunHudShownRowKey(name: string): string;
211
+ /** The viewer's collapsed flag for one HUD under the overlay's settings: the stored boolean, or undefined (expanded). */
212
+ export declare function wrunHudCollapsedSetting(settings: unknown, name: string): boolean | undefined;
213
+ /** The viewer's shown flag for one HUD under the overlay's settings: the stored boolean, or undefined (shown). */
214
+ export declare function wrunHudShownSetting(settings: unknown, name: string): boolean | undefined;
202
215
  /** A packed colour (the `color_packed_by` wire) as the engine's own
203
216
  * `rgba(r, g, b, a)` spelling. A non-finite, negative, fractional or
204
217
  * out-of-range value (alpha thousandths past 1000) decodes to no colour. */
@@ -48,12 +48,14 @@
48
48
  * change follow it, the way a timeframe or symbol param rewrites its pins.
49
49
  * A value equal to the baked `ticks_per_bar` writes nothing; the lane util
50
50
  * clamps it to 1..500 (`wrunVolumeProfileLaneExtras`).
51
- * - A chain view's params (OPTLOAD G5, wrun-option-views.util,
51
+ * - An option word's params (OPTLOAD G5, wrun-option-views.util,
52
52
  * `optionViewParamWrites`): on an `options_chain` or `option_contract_state`
53
- * input that declares views, each view param knob bound to a declared param
54
- * (`"@<param>"`, or `<knob>_param` beside a literal default) takes the
55
- * param's current value, the `ticks_per_bar` rule, so a settings change
56
- * asks the gateway with the new values.
53
+ * input that declares views, an `option_surface` input its `pick` and an
54
+ * `option_strikes` input its kit `fold` (the classes the words' own tables
55
+ * name), each param knob bound to a declared param (`"@<param>"`, or
56
+ * `<knob>_param` beside a literal default) takes the param's current value,
57
+ * the `ticks_per_bar` rule, so a settings change asks the gateway with the
58
+ * new values.
57
59
  * - The lane words (kit 0.77.0, `laneWordWrites`): `currency_param` and `when`.
58
60
  * - A Style page row (`__style__<output>__<property>`, an FE-only declared
59
61
  * input that never reaches any host) writes the output's `width`,
@@ -91,12 +93,12 @@ import { WRUN_SOURCE_FIELD_WORDS, wrunInputGateOn } from './wrun-market-facts.ut
91
93
  import { wrunParamValuesFromSettings } from './wrun-param-values.util.js';
92
94
  import { bindWrunColorSettings } from './wrun-color-settings.lazy.js';
93
95
  import { WRUN_LEVELS_COLOR_PICKED_KEY } from './wrun-style-flags.util.js';
94
- import { wrunOptionViewParamKnobs } from './wrun-option-views.util.js';
96
+ import { WRUN_OPTION_LANE_WORDS, WRUN_OPTION_VIEWS, wrunOptionViewParamKnobs } from './wrun-option-views.util.js';
95
97
  import { findWrunVisibilityTarget, wrunVisibilitySectionOfPrefix, wrunVisibilityTargetAt, } from './wrun-visibility-table.js';
96
- import { isWrunHudViewerRowKey, packWrunColor, parseWrunColor, WRUN_HEATMAP_SENSITIVITY_ROW_RE, WRUN_HUD_LOOK_ROW_PREFIX, WRUN_HUD_LOOK_ROW_RE, } from './wrun-color-facts.util.js';
98
+ import { isWrunHudViewerRowKey, packWrunColor, parseWrunColor, parseWrunHudViewerRowKey, WRUN_HEATMAP_SENSITIVITY_ROW_RE, wrunHudViewerRowKey, } from './wrun-color-facts.util.js';
97
99
  // The key predicates and the colour parse are thin facts boot-path readers take without this
98
100
  // module (wrun-color-facts.util); every name stays exported here for this module's readers.
99
- export { isWrunHeatmapSensitivityRowKey, isWrunHudLookRowKey, isWrunHudPlaceRowKey, isWrunHudViewerRowKey, isWrunStyleRowKey, isWrunViewerRowKey, packWrunColor, parseWrunColor, WRUN_HUD_LOOK_ROW_PREFIX, WRUN_STYLE_ROW_PREFIX, } from './wrun-color-facts.util.js';
101
+ export { isWrunHeatmapSensitivityRowKey, isWrunHudLookRowKey, isWrunHudPlaceRowKey, isWrunHudViewerRowKey, isWrunStyleRowKey, isWrunViewerRowKey, packWrunColor, parseWrunColor, parseWrunHudViewerRowKey, WRUN_HUD_LOOK_ROW_PREFIX, WRUN_HUD_VIEWER_ROWS, WRUN_STYLE_ROW_PREFIX, wrunHudViewerRowKey, } from './wrun-color-facts.util.js';
100
102
  /** The largest packed colour (rgb 0xffffff, alpha 1000 thousandths), below
101
103
  * 2^34 and so exact in f64. */
102
104
  const WRUN_PACKED_COLOR_MAX = 0xffffff * 1024 + 1000;
@@ -225,15 +227,14 @@ export function parseWrunStyleTarget(target) {
225
227
  export function isWrunStyleTargetHidden(declaration) {
226
228
  return isRecord(declaration) && declaration.visible === false;
227
229
  }
228
- /** A HUD's Look row (`hud:<name>:look`, the prefix and the reader in wrun-color-facts.util). */
229
- const WRUN_HUD_LOOK_ROW_SUFFIX = ':look';
230
+ /** A HUD's Look row (`hud:<name>:look`; every HUD viewer row's key and reader in wrun-color-facts.util). */
230
231
  export function wrunHudLookRowKey(name) {
231
- return `${WRUN_HUD_LOOK_ROW_PREFIX}${name}${WRUN_HUD_LOOK_ROW_SUFFIX}`;
232
+ return wrunHudViewerRowKey(name, 'look');
232
233
  }
233
234
  /** A HUD Look row key read back: the HUD it belongs to. */
234
235
  export function parseWrunHudLookRowKey(key) {
235
- const match = WRUN_HUD_LOOK_ROW_RE.exec(key);
236
- return match ? { name: match[1] } : undefined;
236
+ const parsed = parseWrunHudViewerRowKey(key);
237
+ return parsed?.row === 'look' ? { name: parsed.name } : undefined;
237
238
  }
238
239
  /** The viewer's Look pick for one HUD under the overlay's settings: the
239
240
  * stored word, or undefined for "As made" (absent, empty, not a string).
@@ -250,7 +251,6 @@ export function wrunHudLookSetting(settings, name) {
250
251
  * offset convention). `at` is when the move was made, so in a place shared
251
252
  * with other cards the latest move sits outermost. Absent = where the script
252
253
  * puts it. */
253
- const WRUN_HUD_PLACE_ROW_SUFFIX = ':place';
254
254
  const WRUN_HUD_PLACE_VALUE_RE = /^([a-z_]+)@(\d{1,16})(?::(-?\d{1,6}),(-?\d{1,6}))?$/;
255
255
  const WRUN_HUD_PLACE_ANCHORS = [
256
256
  'top_left',
@@ -264,7 +264,7 @@ const WRUN_HUD_PLACE_ANCHORS = [
264
264
  'bottom_right',
265
265
  ];
266
266
  export function wrunHudPlaceRowKey(name) {
267
- return `${WRUN_HUD_LOOK_ROW_PREFIX}${name}${WRUN_HUD_PLACE_ROW_SUFFIX}`;
267
+ return wrunHudViewerRowKey(name, 'place');
268
268
  }
269
269
  /** The viewer's Sensitivity for one heatmap (`heatmap:<name>:sensitivity`):
270
270
  * a 0..100 slider position on the options heatmap's Subtle..Vivid map
@@ -302,9 +302,9 @@ export function wrunHeatmapSensitivityChanged(prev, next) {
302
302
  }
303
303
  return false;
304
304
  }
305
- /** A save whose every change is a HUD's viewer row (its Look pick, its place): rows only the FE-drawn
306
- * card reads, so no run, canvas paint or legend row depends on them. `patch` is what the save
307
- * sends; its keys are compared with the overlay's current settings (`current`). */
305
+ /** A save whose every change is a HUD's viewer row (its Look pick, its place, its collapsed or shown
306
+ * flag): rows only the FE-drawn card reads, so no run, canvas paint or legend row depends on them.
307
+ * `patch` is what the save sends; its keys are compared with the overlay's current settings (`current`). */
308
308
  export function onlyWrunHudViewerRowsChanged(current, patch) {
309
309
  const before = flatSettings(current) ?? {};
310
310
  const sent = flatSettings(patch) ?? {};
@@ -341,6 +341,27 @@ export function formatWrunHudPlace(place) {
341
341
  export function wrunHudPlaceSetting(settings, name) {
342
342
  return parseWrunHudPlace(flatSettings(settings)?.[wrunHudPlaceRowKey(name)]);
343
343
  }
344
+ /** The dismissable HUD (C3): the viewer folds one card to its chip (`hud:<name>:collapsed`, true) or hides
345
+ * it (`hud:<name>:shown`, false; the Style page's Show row brings it back), viewer rows of the one list
346
+ * (WRUN_HUD_VIEWER_ROWS). Each holds a boolean; absent, null or anything else reads as unset: an expanded
347
+ * card that is shown. */
348
+ export function wrunHudCollapsedRowKey(name) {
349
+ return wrunHudViewerRowKey(name, 'collapsed');
350
+ }
351
+ export function wrunHudShownRowKey(name) {
352
+ return wrunHudViewerRowKey(name, 'shown');
353
+ }
354
+ function storedBoolean(raw) {
355
+ return typeof raw === 'boolean' ? raw : undefined;
356
+ }
357
+ /** The viewer's collapsed flag for one HUD under the overlay's settings: the stored boolean, or undefined (expanded). */
358
+ export function wrunHudCollapsedSetting(settings, name) {
359
+ return storedBoolean(flatSettings(settings)?.[wrunHudCollapsedRowKey(name)]);
360
+ }
361
+ /** The viewer's shown flag for one HUD under the overlay's settings: the stored boolean, or undefined (shown). */
362
+ export function wrunHudShownSetting(settings, name) {
363
+ return storedBoolean(flatSettings(settings)?.[wrunHudShownRowKey(name)]);
364
+ }
344
365
  function isRecord(value) {
345
366
  return typeof value === 'object' && value !== null && !Array.isArray(value);
346
367
  }
@@ -1093,11 +1114,24 @@ function viewParamBinding(source, knob) {
1093
1114
  ? reference.slice(1)
1094
1115
  : undefined;
1095
1116
  }
1117
+ let optionParamClasses;
1118
+ /** The classes whose declared words take params, off the words' own tables (OPTLOAD G5): a chain view's class
1119
+ * (`WRUN_OPTION_VIEWS`) and a per-bar word's (`WRUN_OPTION_LANE_WORDS`: the `option_surface` pick, the `option_strikes`
1120
+ * kit fold), never a list here, so a class the tables gain has its handles written the run it lands. */
1121
+ function wrunOptionParamClasses() {
1122
+ optionParamClasses ??= new Set([
1123
+ ...Object.values(WRUN_OPTION_VIEWS).map((spec) => spec.cls),
1124
+ ...Object.keys(WRUN_OPTION_LANE_WORDS),
1125
+ ]);
1126
+ return optionParamClasses;
1127
+ }
1096
1128
  /**
1097
- * The chain view param bindings (OPTLOAD G5, wrun-option-views.util): on an `options_chain` or `option_contract_state`
1098
- * input that declares views (`page_view` or `page_views`), every param knob of its views bound to a declared param
1099
- * takes that param's current value (`wrunValueParamSetting`: the setting, else the declared default), so the lane's
1100
- * ask, and a settings change's ask, carries the value the run computes with. A value equal to the knob's writes
1129
+ * The option word param bindings (OPTLOAD G5, wrun-option-views.util): on an input of a class whose words take params
1130
+ * (`wrunOptionParamClasses`: an `options_chain` or `option_contract_state` input declaring views, `page_view` or
1131
+ * `page_views`; an `option_surface` input declaring its `pick`, an `option_strikes` input its `fold`), every param knob
1132
+ * its declared words take (`wrunOptionViewParamKnobs`; a flag takes none) bound to a declared param takes that param's
1133
+ * current value (`wrunValueParamSetting`: the setting, else the declared default; a select's picked value), so the
1134
+ * lane's ask, and a settings change's ask, carries the value the run computes with. A value equal to the knob's writes
1101
1135
  * nothing; an unknown param or a value that is not a finite number writes nothing either, so the handle reaches the
1102
1136
  * lane, which refuses it by name.
1103
1137
  */
@@ -1106,7 +1140,7 @@ function optionViewParamWrites(metadata, settings) {
1106
1140
  const params = Array.isArray(metadata.params) ? metadata.params : [];
1107
1141
  const writes = [];
1108
1142
  for (const [name, source] of Object.entries(sources)) {
1109
- if (!isRecord(source) || (source.source !== 'options_chain' && source.source !== 'option_contract_state'))
1143
+ if (!isRecord(source) || !wrunOptionParamClasses().has(source.source))
1110
1144
  continue;
1111
1145
  for (const knob of wrunOptionViewParamKnobs(source)) {
1112
1146
  const bound = viewParamBinding(source, knob);
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The market facts' dollar unit reader as a port (C-DOLLAR). wrun-chart-market-facts.util binds it when it loads, so
3
+ * the live intake, which live-feed loads before the first candle, reads a market's dollar unit without the facts module
4
+ * in that closure (tests/perf/pre-candle-budget.spec.ts weighs it). A dollar tape's live session always follows its
5
+ * full run, which loads the facts module, so the reader is bound by then; unbound reads as not known yet.
6
+ */
7
+ import type { WrunFactsMarket, WrunMarketDollarUnit } from './wrun-chart-market-facts.util.js';
8
+ export interface WrunDollarUnitReader {
9
+ /** The market's dollar unit (`wrunMarketDollarUnit`), synchronous over the reads `warm` settles. */
10
+ unit(market: WrunFactsMarket): WrunMarketDollarUnit;
11
+ /** Ask the reads the unit needs again (`warmWrunMarketDollarFacts`); never rejects. */
12
+ warm(market: WrunFactsMarket): Promise<void>;
13
+ }
14
+ /** Bind the reader: the facts module, once, when it loads. */
15
+ export declare function bindWrunDollarUnitReader(reader: WrunDollarUnitReader): void;
16
+ /** The bound reader, or undefined before the facts module loaded. */
17
+ export declare function wrunDollarUnitReader(): WrunDollarUnitReader | undefined;
@@ -0,0 +1,9 @@
1
+ let bound;
2
+ /** Bind the reader: the facts module, once, when it loads. */
3
+ export function bindWrunDollarUnitReader(reader) {
4
+ bound = reader;
5
+ }
6
+ /** The bound reader, or undefined before the facts module loaded. */
7
+ export function wrunDollarUnitReader() {
8
+ return bound;
9
+ }