@orangecharts/wrun-chart-host 0.8.0 → 0.10.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.
- package/README.md +3 -1
- package/dist/constants/feature-flags.constants.d.ts +9 -0
- package/dist/constants/feature-flags.constants.js +86 -16
- package/dist/constants/marketCapabilities.constants.d.ts +14 -9
- package/dist/constants/marketCapabilities.constants.js +36 -13
- package/dist/constants/opra-compliance.constants.d.ts +15 -0
- package/dist/constants/opra-compliance.constants.js +15 -0
- package/dist/constants/option-venues.constants.d.ts +11 -6
- package/dist/constants/option-venues.constants.js +5 -2
- package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +26 -0
- package/dist/constants/scriptEditor/builtin-script-snippets.js +6 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +15 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +17 -0
- package/dist/constants/venue-presets.constants.d.ts +20 -20
- package/dist/constants/venue-presets.constants.js +24 -26
- package/dist/host-env.d.ts +39 -9
- package/dist/host-env.js +6 -0
- package/dist/host-ports.types.d.ts +108 -18
- package/dist/index.d.ts +14 -0
- package/dist/index.js +14 -0
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +6 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
- package/dist/interfaces/opra-realtime.interface.js +10 -10
- package/dist/interfaces/replay.interface.d.ts +8 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +52 -15
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +94 -14
- package/dist/kscript-data/controls/live-trades-merge.util.js +132 -22
- package/dist/kscript-data/controls/live-trades-order-gate.util.d.ts +56 -0
- package/dist/kscript-data/controls/live-trades-order-gate.util.js +107 -0
- package/dist/market-data/billing.interface.d.ts +227 -42
- package/dist/market-data/billing.interface.js +60 -12
- package/dist/market-data/venue.d.ts +88 -6
- package/dist/market-data/venues/cme.contract.copy.json +66 -0
- package/dist/market-data/venues/cme.d.ts +126 -0
- package/dist/market-data/venues/cme.js +133 -0
- package/dist/market-data/venues/index.d.ts +165 -8
- package/dist/market-data/venues/index.js +48 -6
- package/dist/market-data/venues/opra.contract.copy.json +5 -3
- package/dist/market-data/venues/opra.d.ts +3 -3
- package/dist/market-data/venues/opra.js +5 -4
- package/dist/replay/replayLadder.js +3 -1
- package/dist/settings-templates/index.js +7 -3
- package/dist/settings-templates/indicator-fields.d.ts +5 -4
- package/dist/settings-templates/indicator-fields.js +45 -6
- package/dist/settings-templates/tool-rules.d.ts +27 -17
- package/dist/settings-templates/tool-rules.js +27 -11
- package/dist/settings-templates/tool-tables.generated.js +91 -31
- package/dist/utility/chart/book-live-bucket.util.d.ts +15 -0
- package/dist/utility/chart/book-live-bucket.util.js +47 -0
- package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
- package/dist/utility/chart/crypto-index.leaf.js +2 -2
- package/dist/utility/chart/index-mode-admission.util.js +24 -3
- package/dist/utility/chart/index-mode.util.d.ts +5 -2
- package/dist/utility/chart/index-mode.util.js +23 -13
- package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +35 -11
- package/dist/utility/chart/kscript-drawing-safe-area.util.js +145 -35
- package/dist/utility/chart/kscript-live-coalesce.util.d.ts +7 -2
- package/dist/utility/chart/kscript-live-coalesce.util.js +9 -3
- package/dist/utility/chart/kscript-provenance-keys.util.js +6 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +3 -1
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +32 -2
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +45 -0
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +53 -27
- package/dist/utility/chart/kscript-venue-policy.util.js +74 -32
- package/dist/utility/chart/market-session-schedule.util.d.ts +10 -0
- package/dist/utility/chart/market-session-schedule.util.js +16 -0
- package/dist/utility/chart/marketKind.util.d.ts +12 -10
- package/dist/utility/chart/marketKind.util.js +17 -7
- package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
- package/dist/utility/chart/om-panel-push-style.util.js +17 -15
- package/dist/utility/chart/om-panel.util.js +6 -6
- package/dist/utility/chart/opra-read-access.leaf.d.ts +5 -3
- package/dist/utility/chart/opra-read-access.leaf.js +5 -3
- package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
- package/dist/utility/chart/profile-block-size.util.js +7 -0
- package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
- package/dist/utility/chart/quote-perp.leaf.js +20 -0
- package/dist/utility/chart/rth-session.util.d.ts +3 -2
- package/dist/utility/chart/rth-session.util.js +2 -1
- package/dist/utility/chart/window-geometry.leaf.d.ts +8 -0
- package/dist/utility/chart/window-geometry.leaf.js +22 -6
- package/dist/utility/chart/wrun-run-result.util.d.ts +17 -0
- package/dist/utility/chart/wrun-run-result.util.js +145 -7
- package/dist/utility/common/transformations.util.d.ts +7 -0
- package/dist/utility/common/transformations.util.js +11 -0
- package/dist/utility/options/option-bar-anchor.util.d.ts +145 -0
- package/dist/utility/options/option-bar-anchor.util.js +340 -0
- package/dist/utility/options/option-venue.util.d.ts +21 -3
- package/dist/utility/options/option-venue.util.js +30 -3
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +2 -0
- package/dist/utility/wrun/derived-roots.util.d.ts +213 -0
- package/dist/utility/wrun/derived-roots.util.js +471 -0
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +41 -6
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +89 -19
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +9 -4
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +47 -6
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +5 -3
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +6 -4
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
- package/dist/utility/wrun/sources/lanes/option_daily.js +5 -2
- package/dist/utility/wrun/sources/lanes/options_flow.js +5 -2
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +64 -19
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +105 -35
- package/dist/utility/wrun/sources/row-lane-registry.js +3 -2
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +2 -1
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +15 -6
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +14 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +82 -13
- package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +17 -4
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +55 -8
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +95 -14
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +5 -2
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +7 -3
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +35 -14
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +70 -20
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +64 -0
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +89 -0
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +45 -1
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +114 -6
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +56 -5
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +224 -26
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +822 -58
- package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
- package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
- package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
- package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
- package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-builtin-twin.util.js +21 -0
- package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
- package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +192 -13
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +437 -55
- package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
- package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +15 -4
- package/dist/utility/wrun/wrun-color-settings.util.js +31 -12
- package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
- package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
- package/dist/utility/wrun/wrun-download-meter.util.d.ts +107 -0
- package/dist/utility/wrun/wrun-download-meter.util.js +134 -0
- package/dist/utility/wrun/wrun-download-plan.util.d.ts +99 -0
- package/dist/utility/wrun/wrun-download-plan.util.js +118 -0
- package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +11 -3
- package/dist/utility/wrun/wrun-draft-legend-note.util.js +26 -4
- package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +6 -1
- package/dist/utility/wrun/wrun-draft-overlay.util.js +23 -3
- package/dist/utility/wrun/wrun-frames.d.ts +27 -6
- package/dist/utility/wrun/wrun-frames.js +78 -15
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +7 -0
- package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +7 -1
- package/dist/utility/wrun/wrun-hosted-wire.util.js +12 -2
- package/dist/utility/wrun/wrun-hud-looks.util.d.ts +51 -21
- package/dist/utility/wrun/wrun-hud-looks.util.js +74 -28
- package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
- package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +19 -9
- package/dist/utility/wrun/wrun-live-intake.util.js +213 -45
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-live-tick.util.js +246 -49
- package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
- package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +205 -48
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +277 -34
- package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +51 -7
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +340 -56
- package/dist/utility/wrun/wrun-opra-lane.util.d.ts +17 -4
- package/dist/utility/wrun/wrun-opra-lane.util.js +6 -4
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +41 -2
- package/dist/utility/wrun/wrun-option-prints.util.js +80 -13
- package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.d.ts +31 -0
- package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.js +119 -0
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +26 -6
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +50 -11
- package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +109 -19
- package/dist/utility/wrun/wrun-option-strike-flow.util.js +222 -61
- package/dist/utility/wrun/wrun-option-views.util.d.ts +96 -18
- package/dist/utility/wrun/wrun-option-views.util.js +246 -51
- package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
- package/dist/utility/wrun/wrun-output-style.util.d.ts +6 -2
- package/dist/utility/wrun/wrun-output-style.util.js +20 -2
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +20 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +10 -1
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +52 -4
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +7 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +25 -1
- package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
- package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +134 -37
- package/dist/utility/wrun/wrun-overlay-run.util.js +1118 -254
- package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +4 -4
- package/dist/utility/wrun/wrun-pack-widths.leaf.js +4 -4
- package/dist/utility/wrun/wrun-pack.util.d.ts +7 -3
- package/dist/utility/wrun/wrun-pack.util.js +20 -9
- package/dist/utility/wrun/wrun-pane-format.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-pane-format.util.js +7 -3
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-panel-mount.util.js +63 -13
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +37 -24
- package/dist/utility/wrun/wrun-panel-style.util.js +100 -29
- package/dist/utility/wrun/wrun-param-map.util.d.ts +15 -11
- package/dist/utility/wrun/wrun-param-map.util.js +13 -5
- package/dist/utility/wrun/wrun-param-values.util.d.ts +21 -3
- package/dist/utility/wrun/wrun-param-values.util.js +6 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +12 -11
- package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +50 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.js +68 -0
- package/dist/utility/wrun/wrun-refusal.util.js +10 -1
- package/dist/utility/wrun/wrun-refused-latest.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
- package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +4 -2
- package/dist/utility/wrun/wrun-run-interval.util.js +9 -6
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +52 -1
- package/dist/utility/wrun/wrun-script-inputs.util.js +112 -4
- package/dist/utility/wrun/wrun-setting-words.util.d.ts +7 -3
- package/dist/utility/wrun/wrun-setting-words.util.js +13 -5
- package/dist/utility/wrun/wrun-socket-row-source.d.ts +27 -2
- package/dist/utility/wrun/wrun-socket-row-source.js +113 -8
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +9 -1
- package/dist/utility/wrun/wrun-source-rows.util.js +108 -43
- package/dist/utility/wrun/wrun-style-words.util.js +6 -4
- package/dist/utility/wrun/wrun-table-chrome.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-table-chrome.util.js +19 -11
- package/dist/utility/wrun/wrun-tape-per-order.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-tape-per-order.util.js +26 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +126 -50
- package/dist/utility/wrun/wrun-tape-source.util.js +193 -68
- package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
- package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
- package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
- package/dist/utils/replay/replay-buffer-math.js +227 -20
- package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
- package/dist/workers/utils/volume-profile.worker.util.js +5 -2
- package/dist/workers/wrun/wrun-abi-host.js +3 -2
- package/package.json +5 -5
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WrunLatestSnapshot } from './wrun-latest-snapshot.js';
|
|
2
|
+
/**
|
|
3
|
+
* The HUD's refused snapshot reaches the host through `chart.publishLatestValues`, a run port
|
|
4
|
+
* (web-ports/run.ts): this module is loaded beside `chart.loadRunPorts()` by the refusal surface
|
|
5
|
+
* (wrun-refusal-surface.util `publishWrunRefusedLatestValues`), the carried-import form
|
|
6
|
+
* web-ports.cold-entries.spec.ts proves, so a refusal projected from a web module that never
|
|
7
|
+
* loaded the run plane still writes to a bound port. Nothing else belongs here: the surface
|
|
8
|
+
* itself must stay free of run members (every toast path reaches it).
|
|
9
|
+
*/
|
|
10
|
+
export declare function publishWrunRefusedLatest(chartIndex: number, indicatorId: string, snapshot: WrunLatestSnapshot): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { wrunChartHostEnv } from '../../host-env.js';
|
|
2
|
+
/**
|
|
3
|
+
* The HUD's refused snapshot reaches the host through `chart.publishLatestValues`, a run port
|
|
4
|
+
* (web-ports/run.ts): this module is loaded beside `chart.loadRunPorts()` by the refusal surface
|
|
5
|
+
* (wrun-refusal-surface.util `publishWrunRefusedLatestValues`), the carried-import form
|
|
6
|
+
* web-ports.cold-entries.spec.ts proves, so a refusal projected from a web module that never
|
|
7
|
+
* loaded the run plane still writes to a bound port. Nothing else belongs here: the surface
|
|
8
|
+
* itself must stay free of run members (every toast path reaches it).
|
|
9
|
+
*/
|
|
10
|
+
export function publishWrunRefusedLatest(chartIndex, indicatorId, snapshot) {
|
|
11
|
+
wrunChartHostEnv().chart.publishLatestValues(chartIndex, indicatorId, snapshot);
|
|
12
|
+
}
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* (`wrunRowBatchDeliveredSheet`, the one rule the pass reads every batch by).
|
|
23
23
|
*/
|
|
24
24
|
import type { WrunHostedGrid, WrunHostedRefusal, WrunHostedWire } from './wrun-hosted-wire.util.js';
|
|
25
|
+
import type { WrunOpraServedReceipt } from './wrun-opra-lane.util.js';
|
|
25
26
|
import type { RuntimeDiagnostic } from '../../interfaces/kscript-diagnostics.interface.js';
|
|
26
27
|
import type { WrunIndicatorMetadata } from '../../interfaces/wrun-runtime.interface.js';
|
|
27
28
|
/** The window a batch covers (ms, inclusive of the bar at `fromMs`, exclusive past `toMs`). */
|
|
@@ -83,6 +84,16 @@ export interface WrunRowBatch {
|
|
|
83
84
|
* writer's own refusal); absent from a source that does not speak it (the browser lanes stamp their own runs). A
|
|
84
85
|
* live frame carries only true: a frame never clears the stamp. */
|
|
85
86
|
opra?: boolean;
|
|
87
|
+
/** The receipt of the OPRA rows the cloud computed these rows from (contract opra-server-lanes C4, the reply's
|
|
88
|
+
* `wrunOpraTier` and `wrunOpraDelaySeconds` beside the mark): the tier the legend's served word names. On a result
|
|
89
|
+
* batch the session's newest receipt (absent once a result names no OPRA read, or no tier); on a live frame, the
|
|
90
|
+
* frame's own, present only when it carried the mark and a tier. Absent: no tier word, never the account's tier. */
|
|
91
|
+
opraServed?: WrunOpraServedReceipt;
|
|
92
|
+
/** On a live frame only, with no rows: the cloud served the session's OPRA rows at another tier than the rows the
|
|
93
|
+
* session held (a downgrade or an upgrade of the owner's tier, the receipt's transition). The source dropped
|
|
94
|
+
* every row it held, its coverage and its run-level keys; the overlay takes its rows off the chart, ends its live
|
|
95
|
+
* session and reruns on a fresh one (the live tick's reseed). */
|
|
96
|
+
servedTierMoved?: true;
|
|
86
97
|
}
|
|
87
98
|
/** A live frame: the same batch shape for the bars that moved since the last frame. */
|
|
88
99
|
export type WrunRowFrame = WrunRowBatch;
|
|
@@ -59,8 +59,10 @@ export declare function wrunTimeframeLabel(settings: unknown): string | undefine
|
|
|
59
59
|
* chart path too, its Timeframe forced to the chart option in the init args
|
|
60
60
|
* (wrunSettingsForRunInterval): its selected-timeframe branch shows each bar one closed bar late at
|
|
61
61
|
* the chart's interval and refuses (or draws nothing) below it. Read the built-in's way: every
|
|
62
|
-
*
|
|
63
|
-
*
|
|
62
|
+
* port of a built-in (`builtinPortOf`: the proven twin's stamp or the package itself, so the store's
|
|
63
|
+
* copy of a port reads as the Indicators list's), listed in WRUN_RUN_INTERVAL_TWINS or not, on
|
|
64
|
+
* replay, index mode and the unsupported markets alike; an authored Indicator's own `timeframe`
|
|
65
|
+
* param is its author's.
|
|
64
66
|
*/
|
|
65
67
|
export declare function wrunTimeframeIsChartOrFiner(settings: unknown, chartInterval: unknown): boolean;
|
|
66
68
|
/** Whether a twin waits for the selected bar to close (the param defaults on). */
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Run interval for the wrun Indicators that stand in for the built-ins (WRUN-HTF-NATIVE-PLAN.md):
|
|
3
3
|
* TradingView's Timeframe model, at the host.
|
|
4
4
|
*
|
|
5
|
-
* A
|
|
5
|
+
* A built-in's port (`builtinPortOf`, wrun-builtin-twin.util: the proven twin's stamp or the
|
|
6
|
+
* package itself, whichever door mounted it) carries the built-in's `timeframe`
|
|
6
7
|
* select (option values "0".."7", labels chart, 5m, 15m, 30m, 1h, 4h, 1D, 1W) and, inside the
|
|
7
8
|
* package, rebuilt the selected timeframe from the chart's loaded bars (./sdk/resample), so smoothed
|
|
8
9
|
* values never settled and long windows stayed blank until the user zoomed out. When the selected
|
|
@@ -32,7 +33,7 @@ import { isCmeSessionLatticeExchange } from '../chart/cme-session-bucket.util.js
|
|
|
32
33
|
import { checkIsIndexMode } from '../chart/index-mode.util.js';
|
|
33
34
|
import { isRunIntervalUnservableMarket } from '../chart/run-interval-unservable.leaf.js';
|
|
34
35
|
import { runIntervalWarmupBars } from '../chart/run-interval-warmup.leaf.js';
|
|
35
|
-
import {
|
|
36
|
+
import { builtinPortOf } from './wrun-builtin-twin.util.js';
|
|
36
37
|
/** The param a twin selects its timeframe with, and the one that says whether to wait for closes. */
|
|
37
38
|
export const WRUN_TIMEFRAME_PARAM = 'timeframe';
|
|
38
39
|
export const WRUN_WAIT_FOR_CLOSE_PARAM = 'wait_for_close';
|
|
@@ -107,7 +108,7 @@ export const WRUN_RUN_INTERVAL_TWINS = {
|
|
|
107
108
|
* own bars hands it to the warm-up ask as the declared lookback (local-kscript-warmup-backfill-ask.util).
|
|
108
109
|
*/
|
|
109
110
|
export function wrunTwinLookbackBars(settings) {
|
|
110
|
-
const twin =
|
|
111
|
+
const twin = builtinPortOf(settings);
|
|
111
112
|
const lookback = twin ? WRUN_RUN_INTERVAL_TWINS[twin] : undefined;
|
|
112
113
|
return lookback ? lookback(settings) : null;
|
|
113
114
|
}
|
|
@@ -139,11 +140,13 @@ export function wrunTimeframeLabel(settings) {
|
|
|
139
140
|
* chart path too, its Timeframe forced to the chart option in the init args
|
|
140
141
|
* (wrunSettingsForRunInterval): its selected-timeframe branch shows each bar one closed bar late at
|
|
141
142
|
* the chart's interval and refuses (or draws nothing) below it. Read the built-in's way: every
|
|
142
|
-
*
|
|
143
|
-
*
|
|
143
|
+
* port of a built-in (`builtinPortOf`: the proven twin's stamp or the package itself, so the store's
|
|
144
|
+
* copy of a port reads as the Indicators list's), listed in WRUN_RUN_INTERVAL_TWINS or not, on
|
|
145
|
+
* replay, index mode and the unsupported markets alike; an authored Indicator's own `timeframe`
|
|
146
|
+
* param is its author's.
|
|
144
147
|
*/
|
|
145
148
|
export function wrunTimeframeIsChartOrFiner(settings, chartInterval) {
|
|
146
|
-
return
|
|
149
|
+
return builtinPortOf(settings) !== undefined && timeframeIsChartOrFiner(wrunTimeframeLabel(settings), chartInterval);
|
|
147
150
|
}
|
|
148
151
|
/** Whether a twin waits for the selected bar to close (the param defaults on). */
|
|
149
152
|
export function wrunWaitsForClose(settings) {
|
|
@@ -37,7 +37,9 @@
|
|
|
37
37
|
* - `option_labels`: a select's labels, parallel to `options` (the schema's
|
|
38
38
|
* numeric option values) or, without `options`, to the integers min..max.
|
|
39
39
|
* - Typed-inputs keys (WRUN-INPUTS-PLAN 1.1): `hint`, `row`, `when`,
|
|
40
|
-
* `hide`, `slider` and `host` ride the row verbatim
|
|
40
|
+
* `hide`, `slider` and `host` ride the row verbatim (a `when` is one clause
|
|
41
|
+
* over another row's value, parseWrunWhen: `name`, `!name`, `name=v`,
|
|
42
|
+
* `name!=v`, `name in v1,v2`, read by wrunWhenActive); `hidden` and
|
|
41
43
|
* `host_fill` rows are never rendered; `range` / `list` / `session`
|
|
42
44
|
* members and a `unit` pair each collapse into ONE virtual composite row
|
|
43
45
|
* named by the composite (`virtual: true`, `members` in the frozen
|
|
@@ -158,6 +160,8 @@ export interface WrunScriptInputDeclaration {
|
|
|
158
160
|
order?: number;
|
|
159
161
|
hint?: string;
|
|
160
162
|
row?: string;
|
|
163
|
+
/** The gate the row dims (or, with `hide`, leaves the page) behind: one clause over another row's value, verbatim
|
|
164
|
+
* from the sheet (parseWrunWhen reads it, wrunWhenActive decides). */
|
|
161
165
|
when?: string;
|
|
162
166
|
hide?: boolean;
|
|
163
167
|
slider?: boolean;
|
|
@@ -178,6 +182,10 @@ export interface WrunScriptInputDeclaration {
|
|
|
178
182
|
* createScript's socket worker) rebuilds one colour param per member
|
|
179
183
|
* (wrunSheetParamsFromDeclarations) and packs element i as member i. */
|
|
180
184
|
members?: string[];
|
|
185
|
+
/** A colour-array (`color[]`) row: the gate of each member that declares one, by member name, verbatim from the
|
|
186
|
+
* sheet (the `when` grammar). The row's own presentation keys, `when` among them, are its first member's; a
|
|
187
|
+
* member's own gate dims that member's swatch alone (WrunLayoutPanel), and the colour list stays as stored. */
|
|
188
|
+
memberWhen?: Record<string, string>;
|
|
181
189
|
/** A host-applied param (the sheet's `host`): the browser host rewrites
|
|
182
190
|
* the bound inputs' field, interval or market from it, and the cloud
|
|
183
191
|
* applies the same picks from the hosted map (C1). Carried on the row so
|
|
@@ -207,6 +215,13 @@ export interface WrunScriptInputDeclaration {
|
|
|
207
215
|
* row so the dialog and the hosted lanes know them without the sheet. */
|
|
208
216
|
maxBytes?: number;
|
|
209
217
|
multiline?: boolean;
|
|
218
|
+
/** A market-scaled param's value carried from an older version's setting (C-DOLLAR: a Big Trades 0.5.0 Min size the
|
|
219
|
+
* user changed, priced once into Min value; wrun-market-size-defaults.util `wrunDollarCarryPatch`). While the row
|
|
220
|
+
* holds it, the value is one the user chose, whatever the row's default reads: the market defaults never move it
|
|
221
|
+
* (`wrunMarketScaledRowChanged`), on this market or any after it. An edit or a reset to another value ends that.
|
|
222
|
+
* The mark itself stays (a reset writes values, never the rows), and while it does the carry is done: a raw value
|
|
223
|
+
* kept under its old name (a market that counts contracts) is never priced again (`wrunPendingDollarCarries`). */
|
|
224
|
+
carriedValue?: number;
|
|
210
225
|
}
|
|
211
226
|
export interface WrunScriptSection {
|
|
212
227
|
/** A section the builder names (the Style page's shared colours,
|
|
@@ -217,6 +232,7 @@ export interface WrunScriptSection {
|
|
|
217
232
|
/** The toggle param the section header draws (its own row is never placed). */
|
|
218
233
|
toggle?: string;
|
|
219
234
|
collapsed?: boolean;
|
|
235
|
+
/** The section's gate, the rows' `when` grammar: the section dims while it is closed. */
|
|
220
236
|
when?: string;
|
|
221
237
|
/** Flat declarations (and layout-only divider / note rows) with `page`,
|
|
222
238
|
* `section` and `order` set. */
|
|
@@ -401,6 +417,41 @@ export declare function coerceWrunRowValue(row: WrunScriptInputDeclaration, raw:
|
|
|
401
417
|
* The run head's market-scaled defaults (wrun-market-size-defaults.util) read
|
|
402
418
|
* a row through it too, so "unchanged" there is the reset icon's own test. */
|
|
403
419
|
export declare function wrunRowValue(settings: Readonly<Record<string, unknown>>, row: WrunScriptInputDeclaration): unknown;
|
|
420
|
+
/**
|
|
421
|
+
* A `when` gate read apart (a param's or a layout section's, the typed-inputs key; the clause forms joined the
|
|
422
|
+
* bare name on 2026-10-25 with the om SDK, settings no-op audit SC4): `"<param>"` holds while the param's value is
|
|
423
|
+
* truthy (the original form: a toggle on, an option or a number other than 0), `"!<param>"` while it is falsy,
|
|
424
|
+
* `"<param>=<v>"` while it equals v, `"<param>!=<v>"` while it does not, `"<param> in <v1>,<v2>"` while it is one of
|
|
425
|
+
* the list. Every v is a number (wrunWhenGateNumber says what it is compared with). Whitespace around the operators
|
|
426
|
+
* and the list reads; anything else is no clause.
|
|
427
|
+
*/
|
|
428
|
+
export type WrunWhenClause = {
|
|
429
|
+
readonly param: string;
|
|
430
|
+
readonly op: 'truthy';
|
|
431
|
+
} | {
|
|
432
|
+
readonly param: string;
|
|
433
|
+
readonly op: 'falsy';
|
|
434
|
+
} | {
|
|
435
|
+
readonly param: string;
|
|
436
|
+
readonly op: 'eq' | 'ne' | 'in';
|
|
437
|
+
readonly values: readonly number[];
|
|
438
|
+
};
|
|
439
|
+
/** A `when` gate's clause (WrunWhenClause), undefined for anything that is no clause: no string, an empty one, an
|
|
440
|
+
* operator without its param or value, a value that is no number, a list with an empty slot, two clauses. */
|
|
441
|
+
export declare function parseWrunWhen(when: unknown): WrunWhenClause | undefined;
|
|
442
|
+
/**
|
|
443
|
+
* The number a `when` comparison reads off a gate's value: a toggle 1 / 0, a choice its option's index in the
|
|
444
|
+
* gating row's options (a select, a line style), any other value the number it reads as (a number, a numeric
|
|
445
|
+
* text, a multi's mask). Undefined for a value that reads as no number (a colour, a word).
|
|
446
|
+
*/
|
|
447
|
+
export declare function wrunWhenGateNumber(gate: WrunScriptInputDeclaration | undefined, value: unknown): number | undefined;
|
|
448
|
+
/**
|
|
449
|
+
* Whether a row (or a layout section) gated by `when` is live under `settings`: its clause (parseWrunWhen) over the
|
|
450
|
+
* gating row's value (`gateOf` finds the row a name declares). No gate is live. A gate the panel cannot read never
|
|
451
|
+
* closes: no clause, a param nobody declares or holds, a comparison over a value that is no number. A dim the
|
|
452
|
+
* panel cannot explain hides a live control, which is the class this grammar exists to end.
|
|
453
|
+
*/
|
|
454
|
+
export declare function wrunWhenActive(settings: Readonly<Record<string, unknown>>, when: unknown, gateOf: (name: string) => WrunScriptInputDeclaration | undefined): boolean;
|
|
404
455
|
/** Equality the way the run reads values back: a toggle as 1/0, a select's
|
|
405
456
|
* numeric string as its number, a colour array element by element. */
|
|
406
457
|
export declare function wrunValuesEqual(a: unknown, b: unknown): boolean;
|
|
@@ -37,7 +37,9 @@
|
|
|
37
37
|
* - `option_labels`: a select's labels, parallel to `options` (the schema's
|
|
38
38
|
* numeric option values) or, without `options`, to the integers min..max.
|
|
39
39
|
* - Typed-inputs keys (WRUN-INPUTS-PLAN 1.1): `hint`, `row`, `when`,
|
|
40
|
-
* `hide`, `slider` and `host` ride the row verbatim
|
|
40
|
+
* `hide`, `slider` and `host` ride the row verbatim (a `when` is one clause
|
|
41
|
+
* over another row's value, parseWrunWhen: `name`, `!name`, `name=v`,
|
|
42
|
+
* `name!=v`, `name in v1,v2`, read by wrunWhenActive); `hidden` and
|
|
41
43
|
* `host_fill` rows are never rendered; `range` / `list` / `session`
|
|
42
44
|
* members and a `unit` pair each collapse into ONE virtual composite row
|
|
43
45
|
* named by the composite (`virtual: true`, `members` in the frozen
|
|
@@ -105,7 +107,7 @@ import { footprintPaintsVolumeColor } from './wrun-footprint-modes.util.js';
|
|
|
105
107
|
import { isWrunColorWord, wrunThemeTokenOfPacked, wrunThemeTokenWord } from './wrun-style-words.util.js';
|
|
106
108
|
import { isWrunColorParam, isWrunStyleParam, wrunColorArrayKey, wrunColorPalette, wrunColorParamDefault, wrunColorSettingString, wrunLineStyles, wrunParamChoices, wrunSelectOptionValue, wrunStyleBinding, parseWrunStyleTarget, wrunVisibilityOwnedOutputs, wrunVisibilityOwners, } from './wrun-color-settings.util.js';
|
|
107
109
|
import { findWrunVisibilityTarget, WRUN_HANDLE_KIND_RULES, WRUN_VISIBILITY_RULES, wrunVisibilityEntryTarget, wrunVisibilityTargetAt, } from './wrun-visibility-table.js';
|
|
108
|
-
import { wrunCodedWords } from './wrun-setting-words.util.js';
|
|
110
|
+
import { isTruthySetting, wrunCodedWords } from './wrun-setting-words.util.js';
|
|
109
111
|
import { wrunRowVisibleHere } from './wrun-market-facts.util.js';
|
|
110
112
|
import { bitmaskValue, finiteNumber, nonEmptyString, numericValue, toggleValue, wrunMultiLabels, wrunTimeValue, } from './wrun-param-values.util.js';
|
|
111
113
|
import { wrunLegendLiteral, wrunTextParamCap, wrunTextParamDefault, wrunTextValueWithinCap, } from './wrun-text-params.util.js';
|
|
@@ -1056,10 +1058,16 @@ export function buildWrunScriptInputs(metadata, options) {
|
|
|
1056
1058
|
if (arrayKey !== undefined) {
|
|
1057
1059
|
if (isReservedKScriptProvenanceKey(arrayKey))
|
|
1058
1060
|
continue;
|
|
1061
|
+
// Each member's own gate rides the row by its name (memberWhen): the row keeps its first member's keys only,
|
|
1062
|
+
// so a later member's `when` (RSI's extremes colours) would otherwise never reach its swatch.
|
|
1063
|
+
const when = nonEmptyString(param.when);
|
|
1064
|
+
const memberWhen = when === undefined ? undefined : { [param.name]: when };
|
|
1059
1065
|
const row = colorArrays.get(arrayKey);
|
|
1060
1066
|
if (row) {
|
|
1061
1067
|
row.defaultValue.push(wrunColorParamDefault(param));
|
|
1062
1068
|
row.members.push(param.name);
|
|
1069
|
+
if (memberWhen !== undefined)
|
|
1070
|
+
row.memberWhen = { ...row.memberWhen, ...memberWhen };
|
|
1063
1071
|
}
|
|
1064
1072
|
else {
|
|
1065
1073
|
// The row stands for the kScript `color[]` input named by the key:
|
|
@@ -1078,6 +1086,7 @@ export function buildWrunScriptInputs(metadata, options) {
|
|
|
1078
1086
|
type: 'color[]',
|
|
1079
1087
|
defaultValue: [wrunColorParamDefault(param)],
|
|
1080
1088
|
members: [param.name],
|
|
1089
|
+
...(memberWhen !== undefined ? { memberWhen } : {}),
|
|
1081
1090
|
};
|
|
1082
1091
|
colorArrays.set(arrayKey, created);
|
|
1083
1092
|
rows.push(created);
|
|
@@ -1843,6 +1852,104 @@ export function wrunRowValue(settings, row) {
|
|
|
1843
1852
|
const fit = stored === undefined || stored === null ? undefined : coerceWrunRowValue(row, stored);
|
|
1844
1853
|
return fit ?? row.defaultValue;
|
|
1845
1854
|
}
|
|
1855
|
+
/** A param name inside a clause: no whitespace, no operator character (a sheet name never holds one). */
|
|
1856
|
+
const WHEN_PARAM = '[^\\s!=,]+';
|
|
1857
|
+
const WHEN_FALSY_RE = new RegExp(`^!\\s*(${WHEN_PARAM})$`);
|
|
1858
|
+
const WHEN_IN_RE = new RegExp(`^(${WHEN_PARAM})\\s+in\\s+(.+)$`);
|
|
1859
|
+
const WHEN_NE_RE = new RegExp(`^(${WHEN_PARAM})\\s*!=\\s*(.+)$`);
|
|
1860
|
+
const WHEN_EQ_RE = new RegExp(`^(${WHEN_PARAM})\\s*=\\s*(.+)$`);
|
|
1861
|
+
const WHEN_PARAM_RE = new RegExp(`^(${WHEN_PARAM})$`);
|
|
1862
|
+
/** A clause's value: a finite number, nothing else (a word, an empty slot). */
|
|
1863
|
+
function whenValue(text) {
|
|
1864
|
+
const trimmed = text.trim();
|
|
1865
|
+
if (trimmed === '')
|
|
1866
|
+
return undefined;
|
|
1867
|
+
const value = Number(trimmed);
|
|
1868
|
+
return Number.isFinite(value) ? value : undefined;
|
|
1869
|
+
}
|
|
1870
|
+
/** A `when` gate's clause (WrunWhenClause), undefined for anything that is no clause: no string, an empty one, an
|
|
1871
|
+
* operator without its param or value, a value that is no number, a list with an empty slot, two clauses. */
|
|
1872
|
+
export function parseWrunWhen(when) {
|
|
1873
|
+
if (typeof when !== 'string')
|
|
1874
|
+
return undefined;
|
|
1875
|
+
const text = when.trim();
|
|
1876
|
+
const falsy = WHEN_FALSY_RE.exec(text);
|
|
1877
|
+
if (falsy)
|
|
1878
|
+
return { param: falsy[1], op: 'falsy' };
|
|
1879
|
+
const list = WHEN_IN_RE.exec(text);
|
|
1880
|
+
if (list) {
|
|
1881
|
+
const values = list[2].split(',').map(whenValue);
|
|
1882
|
+
return values.every((value) => value !== undefined)
|
|
1883
|
+
? { param: list[1], op: 'in', values }
|
|
1884
|
+
: undefined;
|
|
1885
|
+
}
|
|
1886
|
+
for (const [re, op] of [
|
|
1887
|
+
[WHEN_NE_RE, 'ne'],
|
|
1888
|
+
[WHEN_EQ_RE, 'eq'],
|
|
1889
|
+
]) {
|
|
1890
|
+
const match = re.exec(text);
|
|
1891
|
+
if (!match)
|
|
1892
|
+
continue;
|
|
1893
|
+
const value = whenValue(match[2]);
|
|
1894
|
+
return value === undefined ? undefined : { param: match[1], op, values: [value] };
|
|
1895
|
+
}
|
|
1896
|
+
const bare = WHEN_PARAM_RE.exec(text);
|
|
1897
|
+
return bare ? { param: bare[1], op: 'truthy' } : undefined;
|
|
1898
|
+
}
|
|
1899
|
+
/** The value a gate reads: the gating row's (wrunRowValue, the panel's lenient read, so the gate and the row it
|
|
1900
|
+
* reads always agree), else the raw setting of a name no row declares; undefined when nothing holds one. */
|
|
1901
|
+
function whenGateValue(settings, param, gate) {
|
|
1902
|
+
const value = gate !== undefined ? wrunRowValue(settings, gate) : settings[param];
|
|
1903
|
+
return value === null ? undefined : value;
|
|
1904
|
+
}
|
|
1905
|
+
/**
|
|
1906
|
+
* The number a `when` comparison reads off a gate's value: a toggle 1 / 0, a choice its option's index in the
|
|
1907
|
+
* gating row's options (a select, a line style), any other value the number it reads as (a number, a numeric
|
|
1908
|
+
* text, a multi's mask). Undefined for a value that reads as no number (a colour, a word).
|
|
1909
|
+
*/
|
|
1910
|
+
export function wrunWhenGateNumber(gate, value) {
|
|
1911
|
+
if (typeof value === 'boolean')
|
|
1912
|
+
return value ? 1 : 0;
|
|
1913
|
+
if (typeof value === 'string' && gate?.options !== undefined) {
|
|
1914
|
+
const at = gate.options.indexOf(value);
|
|
1915
|
+
if (at >= 0)
|
|
1916
|
+
return at;
|
|
1917
|
+
}
|
|
1918
|
+
return numericValue(value);
|
|
1919
|
+
}
|
|
1920
|
+
/**
|
|
1921
|
+
* Whether a row (or a layout section) gated by `when` is live under `settings`: its clause (parseWrunWhen) over the
|
|
1922
|
+
* gating row's value (`gateOf` finds the row a name declares). No gate is live. A gate the panel cannot read never
|
|
1923
|
+
* closes: no clause, a param nobody declares or holds, a comparison over a value that is no number. A dim the
|
|
1924
|
+
* panel cannot explain hides a live control, which is the class this grammar exists to end.
|
|
1925
|
+
*/
|
|
1926
|
+
export function wrunWhenActive(settings, when, gateOf) {
|
|
1927
|
+
if (when === undefined || when === null || when === '')
|
|
1928
|
+
return true;
|
|
1929
|
+
const clause = parseWrunWhen(when);
|
|
1930
|
+
if (clause === undefined)
|
|
1931
|
+
return true;
|
|
1932
|
+
const gate = gateOf(clause.param);
|
|
1933
|
+
const value = whenGateValue(settings, clause.param, gate);
|
|
1934
|
+
if (value === undefined)
|
|
1935
|
+
return true;
|
|
1936
|
+
const number = wrunWhenGateNumber(gate, value);
|
|
1937
|
+
if (clause.op === 'truthy' || clause.op === 'falsy') {
|
|
1938
|
+
// The on / off forms read the gate the way the compare forms and the om SDK do: a choice by its option's index
|
|
1939
|
+
// (its first option is the off value, whatever word or number that option holds), a toggle as 1 / 0, a number or
|
|
1940
|
+
// a mask as its number; a kind that reads as no number (a colour, a word) by its truthiness, as the bare form
|
|
1941
|
+
// always did.
|
|
1942
|
+
const on = number === undefined ? isTruthySetting(value) : number !== 0;
|
|
1943
|
+
return clause.op === 'truthy' ? on : !on;
|
|
1944
|
+
}
|
|
1945
|
+
if (number === undefined)
|
|
1946
|
+
return true;
|
|
1947
|
+
if (clause.op === 'eq')
|
|
1948
|
+
return clause.values[0] === number;
|
|
1949
|
+
if (clause.op === 'ne')
|
|
1950
|
+
return clause.values[0] !== number;
|
|
1951
|
+
return clause.values.includes(number);
|
|
1952
|
+
}
|
|
1846
1953
|
function normalizeRowScalar(value) {
|
|
1847
1954
|
if (typeof value === 'boolean')
|
|
1848
1955
|
return value ? 1 : 0;
|
|
@@ -1965,11 +2072,12 @@ function renderWrunParamTitleWords(param, value, text) {
|
|
|
1965
2072
|
if (isWrunStyleParam(param))
|
|
1966
2073
|
return undefined;
|
|
1967
2074
|
// A coded value (a choice, a multi, a time, a session clock) prints as its words, never its
|
|
1968
|
-
// code; an empty multi and an unset time (0) keep the literal token,
|
|
2075
|
+
// code; an empty multi and an unset time (0, no date in the decode) keep the literal token,
|
|
2076
|
+
// the falsy rule below.
|
|
1969
2077
|
const shape = wrunParamWordsShape(param);
|
|
1970
2078
|
const coded = wrunCodedWords(shape, value);
|
|
1971
2079
|
if (coded !== undefined)
|
|
1972
|
-
return coded === ''
|
|
2080
|
+
return coded === '' ? undefined : coded;
|
|
1973
2081
|
switch (shape.type) {
|
|
1974
2082
|
case 'color':
|
|
1975
2083
|
return wrunColorSettingString(value);
|
|
@@ -32,7 +32,7 @@ export interface WrunWordsShape {
|
|
|
32
32
|
export interface WrunSettingWords {
|
|
33
33
|
on?: string;
|
|
34
34
|
off?: string;
|
|
35
|
-
/** An empty multi. */
|
|
35
|
+
/** An empty multi, an unset time (no date: epochToLocalInput). */
|
|
36
36
|
none?: string;
|
|
37
37
|
/** The timeframe word list's "follow the chart" choice. */
|
|
38
38
|
chart?: string;
|
|
@@ -73,7 +73,11 @@ export declare function minutesToClock(minutes: number): string;
|
|
|
73
73
|
export declare function clockToMinutes(text: string): number | undefined;
|
|
74
74
|
/** Epoch seconds as the "YYYY-MM-DDTHH:MM" wall time a datetime-local field
|
|
75
75
|
* holds, in the zone `offsetMs` east of UTC (read with UTC getters, never
|
|
76
|
-
* the browser's zone).
|
|
76
|
+
* the browser's zone); '' (an empty field) for an unset time. A sheet
|
|
77
|
+
* declares a time that may be off with `default: 0` (no date picked: the
|
|
78
|
+
* script's own fallback, such as the first expiry), so 0, a negative and a
|
|
79
|
+
* non-finite value are no instant, never the epoch's date (31/12/1969 west
|
|
80
|
+
* of UTC). Every time text reads through here, the field and the words. */
|
|
77
81
|
export declare function epochToLocalInput(seconds: number, offsetMs?: number): string;
|
|
78
|
-
/** A time value as people read it: its date and clock in the zone `offsetMs` east of UTC. */
|
|
82
|
+
/** A time value as people read it: its date and clock in the zone `offsetMs` east of UTC, '' when unset. */
|
|
79
83
|
export declare function describeTime(value: unknown, offsetMs?: number): string;
|
|
@@ -28,8 +28,12 @@ export function wrunCodedWords(shape, value, words) {
|
|
|
28
28
|
return choiceWords(shape, value, words);
|
|
29
29
|
case 'multi':
|
|
30
30
|
return multiWords(shape, value, words);
|
|
31
|
-
case 'time':
|
|
32
|
-
|
|
31
|
+
case 'time': {
|
|
32
|
+
// An unset time has no date to print: nothing, or the viewer's "none" where the surface
|
|
33
|
+
// passes its words, the way an empty multi reads.
|
|
34
|
+
const text = describeTime(value, words?.zoneOffsetMs);
|
|
35
|
+
return text === '' ? (words?.none ?? '') : text;
|
|
36
|
+
}
|
|
33
37
|
default:
|
|
34
38
|
return undefined;
|
|
35
39
|
}
|
|
@@ -159,9 +163,13 @@ export function clockToMinutes(text) {
|
|
|
159
163
|
}
|
|
160
164
|
/** Epoch seconds as the "YYYY-MM-DDTHH:MM" wall time a datetime-local field
|
|
161
165
|
* holds, in the zone `offsetMs` east of UTC (read with UTC getters, never
|
|
162
|
-
* the browser's zone).
|
|
166
|
+
* the browser's zone); '' (an empty field) for an unset time. A sheet
|
|
167
|
+
* declares a time that may be off with `default: 0` (no date picked: the
|
|
168
|
+
* script's own fallback, such as the first expiry), so 0, a negative and a
|
|
169
|
+
* non-finite value are no instant, never the epoch's date (31/12/1969 west
|
|
170
|
+
* of UTC). Every time text reads through here, the field and the words. */
|
|
163
171
|
export function epochToLocalInput(seconds, offsetMs = 0) {
|
|
164
|
-
if (!Number.isFinite(seconds))
|
|
172
|
+
if (!Number.isFinite(seconds) || seconds <= 0)
|
|
165
173
|
return '';
|
|
166
174
|
const wall = new Date(seconds * 1000 + offsetMs);
|
|
167
175
|
if (Number.isNaN(wall.getTime()))
|
|
@@ -169,7 +177,7 @@ export function epochToLocalInput(seconds, offsetMs = 0) {
|
|
|
169
177
|
const pad = (n) => String(n).padStart(2, '0');
|
|
170
178
|
return `${wall.getUTCFullYear()}-${pad(wall.getUTCMonth() + 1)}-${pad(wall.getUTCDate())}T${pad(wall.getUTCHours())}:${pad(wall.getUTCMinutes())}`;
|
|
171
179
|
}
|
|
172
|
-
/** A time value as people read it: its date and clock in the zone `offsetMs` east of UTC. */
|
|
180
|
+
/** A time value as people read it: its date and clock in the zone `offsetMs` east of UTC, '' when unset. */
|
|
173
181
|
export function describeTime(value, offsetMs = 0) {
|
|
174
182
|
return epochToLocalInput(Number(value), offsetMs).replace('T', ' ');
|
|
175
183
|
}
|
|
@@ -236,12 +236,18 @@ export declare class SocketWrunRowSource implements WrunRowSource {
|
|
|
236
236
|
private merges;
|
|
237
237
|
/** The cells memo: the last cell rows answered and each celled entry's lane rows (`cellRows`). */
|
|
238
238
|
private cells;
|
|
239
|
+
/** The served tier of the OPRA rows the session holds (contract opra-server-lanes C4: the newest receipt that named a
|
|
240
|
+
* tier since the session opened), the one every merge is held to (`servedTierMoved`). */
|
|
241
|
+
private retainedTier;
|
|
242
|
+
/** A served-tier move no listener took yet (`dropSessionAtServedTier`): the next subscriber is told first. */
|
|
243
|
+
private servedTierMoveOwed;
|
|
239
244
|
constructor(deps?: WrunSocketRowSourceDeps);
|
|
240
245
|
/** The store's merged session (undefined before the first answer and after a teardown). */
|
|
241
246
|
get session(): WrunHostedSession | undefined;
|
|
242
247
|
/** The session's run-level keys as a batch carries them (copies): the newest strategy output and diagnostics a
|
|
243
|
-
* result or a live frame carried, whichever merged last, the served legs' warning rows after the diagnostics
|
|
244
|
-
|
|
248
|
+
* result or a live frame carried, whichever merged last, the served legs' warning rows after the diagnostics, the
|
|
249
|
+
* newest result's OPRA word and the receipt of the newest OPRA rows (a result's or a marked live frame's). */
|
|
250
|
+
get sessionRunLevel(): Pick<WrunRowBatch, 'strategy' | 'diagnostics' | 'opra' | 'opraServed'>;
|
|
245
251
|
/** The session's cell rows in the shapes the price canvases read (the store's conversion), with the
|
|
246
252
|
* chart's own candles. The cells memo keeps each entry's lane rows between reads: a read after a merge
|
|
247
253
|
* converts only the rows the merge replaced (`extendWrunCellLane`), and a read with nothing merged since,
|
|
@@ -287,6 +293,25 @@ export declare class SocketWrunRowSource implements WrunRowSource {
|
|
|
287
293
|
* one the store refused as `WrunSocketReplyUnreadable`.
|
|
288
294
|
*/
|
|
289
295
|
private mergeResult;
|
|
296
|
+
/** A merge's tier joins the session's: the tier the receipt of a marked answer named, when it named one. */
|
|
297
|
+
private retainTier;
|
|
298
|
+
/**
|
|
299
|
+
* Whether an answer moves the session's served tier: it carries the OPRA mark and names a tier, and the rows the
|
|
300
|
+
* session holds were served at the other one (contract opra-server-lanes C4: the gate re-resolved the owner's tier,
|
|
301
|
+
* a downgrade or an upgrade). An answer that names no tier moves nothing (its rows read no OPRA yet), nor does a
|
|
302
|
+
* session whose rows never named one.
|
|
303
|
+
*/
|
|
304
|
+
private servedTierMoved;
|
|
305
|
+
/**
|
|
306
|
+
* The served tier moved under the session: nothing it holds may stand beside rows served at the new tier (a
|
|
307
|
+
* real-time prefix under a delayed receipt, or the reverse). Its rows, coverage, owed window, cells and run-level
|
|
308
|
+
* keys go, the generation moves (an ask on its way settles superseded, a frame merged behind this one is dropped), and
|
|
309
|
+
* the overlay is told (`WrunRowBatch.servedTierMoved`): it takes what it drew off the chart, ends its live session
|
|
310
|
+
* and reruns, which creates a fresh session at the tier the cloud serves now. The source never extends a session
|
|
311
|
+
* across the move.
|
|
312
|
+
*/
|
|
313
|
+
private dropSessionAtServedTier;
|
|
314
|
+
private deliver;
|
|
290
315
|
/**
|
|
291
316
|
* Page a window until the planner's coverage says done: each round runs the pages still missing,
|
|
292
317
|
* newest first and planned again after each one, through the in-flight registry (or around it, for a
|