@orangecharts/wrun-chart-host 0.15.0 → 0.17.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 +2 -0
- package/dist/constants/economic.constants.d.ts +2 -0
- package/dist/constants/economic.constants.js +2 -0
- package/dist/constants/feature-flags.constants.d.ts +13 -5
- package/dist/constants/feature-flags.constants.js +76 -35
- package/dist/constants/feature-limits.constants.d.ts +72 -4
- package/dist/constants/feature-limits.constants.js +104 -24
- package/dist/constants/interval.constants.js +5 -0
- package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +12 -0
- package/dist/constants/kscript-data-interval-restrictions.constants.js +14 -0
- package/dist/constants/marketCapabilities.constants.d.ts +9 -0
- package/dist/constants/marketCapabilities.constants.js +39 -11
- package/dist/constants/typed-indicator-source.leaf.d.ts +7 -0
- package/dist/constants/typed-indicator-source.leaf.js +47 -0
- package/dist/constants/typed-session-history-venue.leaf.d.ts +7 -0
- package/dist/constants/typed-session-history-venue.leaf.js +9 -0
- package/dist/constants/typed-width-fold.leaf.d.ts +52 -0
- package/dist/constants/typed-width-fold.leaf.js +101 -0
- package/dist/constants/typed-width-source.leaf.d.ts +24 -0
- package/dist/constants/typed-width-source.leaf.js +126 -0
- package/dist/constants/typed-width.leaf.d.ts +57 -0
- package/dist/constants/typed-width.leaf.js +78 -0
- package/dist/host-env.d.ts +10 -0
- package/dist/host-env.js +7 -0
- package/dist/host-ports.types.d.ts +23 -17
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +35 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +66 -3
- package/dist/interfaces/wrun-runtime.interface.js +11 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +13 -0
- package/dist/kscript-data/controls/live-trades-merge.util.js +16 -1
- package/dist/market-data/billing.interface.d.ts +12 -45
- package/dist/market-data/billing.interface.js +2 -2
- package/dist/replay/replayLadder.js +7 -4
- package/dist/settings-templates/footprint-rows.d.ts +6 -0
- package/dist/settings-templates/footprint-rows.js +6 -0
- package/dist/settings-templates/frvp-fields.js +14 -0
- package/dist/settings-templates/indicator-fields.js +36 -0
- package/dist/settings-templates/tool-tables.generated.js +19 -1
- package/dist/utility/chart/__fixtures__/live-bucket-regular-golden.json +1706 -0
- package/dist/utility/chart/cache-alignment.util.d.ts +42 -0
- package/dist/utility/chart/cache-alignment.util.js +88 -18
- package/dist/utility/chart/calendar-interval.util.d.ts +83 -1
- package/dist/utility/chart/calendar-interval.util.js +152 -4
- package/dist/utility/chart/candle-bar-end.util.d.ts +11 -4
- package/dist/utility/chart/candle-bar-end.util.js +17 -6
- package/dist/utility/chart/chart-time-domain.util.d.ts +3 -0
- package/dist/utility/chart/chart-time-domain.util.js +13 -4
- package/dist/utility/chart/feed-interval.util.d.ts +4 -2
- package/dist/utility/chart/feed-interval.util.js +5 -2
- package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +3 -1
- package/dist/utility/chart/fetch-dedupe-policy.util.js +19 -1
- package/dist/utility/chart/footprint-display-mode.util.d.ts +2 -0
- package/dist/utility/chart/footprint-display-mode.util.js +5 -0
- package/dist/utility/chart/governed-lanes-gate.util.d.ts +46 -0
- package/dist/utility/chart/governed-lanes-gate.util.js +71 -0
- package/dist/utility/chart/governed-lanes-reader-seat.d.ts +14 -0
- package/dist/utility/chart/governed-lanes-reader-seat.js +14 -0
- package/dist/utility/chart/history-wall.util.d.ts +13 -2
- package/dist/utility/chart/history-wall.util.js +11 -4
- package/dist/utility/chart/index-mode-admission.util.js +9 -1
- package/dist/utility/chart/index-mode.util.d.ts +2 -2
- package/dist/utility/chart/index-mode.util.js +12 -6
- package/dist/utility/chart/index-otc.leaf.d.ts +37 -0
- package/dist/utility/chart/index-otc.leaf.js +68 -0
- package/dist/utility/chart/interval-ladder.util.d.ts +5 -2
- package/dist/utility/chart/interval-ladder.util.js +44 -4
- package/dist/utility/chart/interval-registry.util.d.ts +22 -1
- package/dist/utility/chart/interval-registry.util.js +50 -2
- package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +32 -4
- package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +22 -5
- package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +10 -0
- package/dist/utility/chart/kscript-drawing-safe-area.util.js +30 -3
- package/dist/utility/chart/kscript-legend-entries.util.d.ts +21 -4
- package/dist/utility/chart/kscript-legend-entries.util.js +27 -5
- package/dist/utility/chart/kscript-main-grid-stages.util.js +74 -24
- package/dist/utility/chart/kscript-provenance-keys.util.js +6 -0
- package/dist/utility/chart/kscript-row-name.leaf.d.ts +13 -0
- package/dist/utility/chart/kscript-row-name.leaf.js +18 -0
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +61 -26
- package/dist/utility/chart/kscript-venue-policy.util.js +138 -37
- package/dist/utility/chart/live-bucket.util.d.ts +29 -4
- package/dist/utility/chart/live-bucket.util.js +45 -12
- package/dist/utility/chart/market-session-schedule.util.d.ts +19 -0
- package/dist/utility/chart/market-session-schedule.util.js +2 -1
- package/dist/utility/chart/market-session.util.d.ts +62 -10
- package/dist/utility/chart/market-session.util.js +93 -13
- package/dist/utility/chart/marketKind.util.d.ts +11 -12
- package/dist/utility/chart/marketKind.util.js +45 -13
- package/dist/utility/chart/mixed-mode.util.d.ts +18 -0
- package/dist/utility/chart/om-target.util.js +6 -4
- package/dist/utility/chart/price-precision.util.d.ts +20 -6
- package/dist/utility/chart/price-precision.util.js +34 -7
- package/dist/utility/chart/profile-frame-window.util.d.ts +15 -0
- package/dist/utility/chart/profile-frame-window.util.js +12 -0
- package/dist/utility/chart/rth-session.util.d.ts +3 -1
- package/dist/utility/chart/rth-session.util.js +3 -1
- package/dist/utility/chart/script-source-session.util.d.ts +43 -0
- package/dist/utility/chart/script-source-session.util.js +61 -0
- package/dist/utility/chart/typed-width-grid.util.d.ts +23 -0
- package/dist/utility/chart/typed-width-grid.util.js +203 -0
- package/dist/utility/common/transformations.util.d.ts +6 -0
- package/dist/utility/common/transformations.util.js +28 -4
- package/dist/utility/market-events/market-events.util.js +3 -0
- package/dist/utility/number-format.util.d.ts +14 -1
- package/dist/utility/number-format.util.js +22 -4
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +24 -1
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +115 -0
- package/dist/utility/v2/v2-enums.leaf.js +5 -0
- package/dist/utility/wrun/sources/row-lanes/dark_pool.d.ts +2 -1
- package/dist/utility/wrun/sources/row-lanes/dark_pool.js +4 -3
- package/dist/utility/wrun/wrun-batched-marks.util.d.ts +13 -3
- package/dist/utility/wrun/wrun-batched-marks.util.js +96 -17
- package/dist/utility/wrun/wrun-canvases.util.d.ts +4 -2
- package/dist/utility/wrun/wrun-canvases.util.js +7 -12
- package/dist/utility/wrun/wrun-cap-notice.util.d.ts +5 -0
- package/dist/utility/wrun/wrun-cap-notice.util.js +23 -0
- package/dist/utility/wrun/wrun-card-style.util.d.ts +1 -1
- package/dist/utility/wrun/wrun-card-style.util.js +2 -2
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +23 -8
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +24 -9
- package/dist/utility/wrun/wrun-child-overlay-id.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-child-overlay-id.util.js +24 -0
- package/dist/utility/wrun/wrun-cloud-cme-stamp.util.d.ts +72 -0
- package/dist/utility/wrun/wrun-cloud-cme-stamp.util.js +151 -0
- package/dist/utility/wrun/wrun-cme-root-specs.util.d.ts +10 -6
- package/dist/utility/wrun/wrun-cme-root-specs.util.js +19 -13
- package/dist/utility/wrun/wrun-color-facts.util.d.ts +3 -3
- package/dist/utility/wrun/wrun-color-facts.util.js +8 -5
- package/dist/utility/wrun/wrun-colour-tone.lazy.d.ts +20 -0
- package/dist/utility/wrun/wrun-colour-tone.lazy.js +23 -0
- package/dist/utility/wrun/wrun-colour-tone.util.d.ts +14 -0
- package/dist/utility/wrun/wrun-colour-tone.util.js +119 -0
- package/dist/utility/wrun/wrun-dark-pool.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-dark-pool.util.js +5 -4
- package/dist/utility/wrun/wrun-frames.d.ts +1 -1
- package/dist/utility/wrun/wrun-frames.js +2 -2
- package/dist/utility/wrun/wrun-handles.util.d.ts +1 -1
- package/dist/utility/wrun/wrun-handles.util.js +1 -1
- package/dist/utility/wrun/wrun-host.service.d.ts +32 -2
- package/dist/utility/wrun/wrun-host.service.js +44 -2
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +20 -0
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +85 -2
- package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +37 -0
- package/dist/utility/wrun/wrun-hosted-wire.util.js +54 -0
- package/dist/utility/wrun/wrun-hud-looks.util.d.ts +1 -0
- package/dist/utility/wrun/wrun-hud-looks.util.js +6 -11
- package/dist/utility/wrun/wrun-integration-route.util.d.ts +24 -0
- package/dist/utility/wrun/wrun-integration-route.util.js +19 -0
- package/dist/utility/wrun/wrun-live-intake.util.js +17 -1
- package/dist/utility/wrun/wrun-live-patch.util.d.ts +6 -1
- package/dist/utility/wrun/wrun-live-patch.util.js +10 -4
- package/dist/utility/wrun/wrun-live-tick.util.js +64 -5
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +40 -6
- package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +2 -2
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +10 -8
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +3 -0
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +17 -0
- package/dist/utility/wrun/wrun-overlay-run.util.js +318 -55
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +1 -1
- package/dist/utility/wrun/wrun-panel-mount.util.js +42 -13
- package/dist/utility/wrun/wrun-pin-venues.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-pin-venues.util.js +11 -4
- package/dist/utility/wrun/wrun-refusal.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-refusal.util.js +102 -13
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +5 -3
- package/dist/utility/wrun/wrun-registry-errors.util.js +5 -3
- package/dist/utility/wrun/wrun-row-source-factory.js +17 -1
- package/dist/utility/wrun/wrun-row-source.d.ts +8 -1
- package/dist/utility/wrun/wrun-run-health.util.js +1 -1
- package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +1 -1
- package/dist/utility/wrun/wrun-sandbox-row-source.js +9 -0
- package/dist/utility/wrun/wrun-session-composition.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-session-composition.util.js +3 -2
- package/dist/utility/wrun/wrun-setting-words.util.d.ts +12 -5
- package/dist/utility/wrun/wrun-setting-words.util.js +25 -8
- package/dist/utility/wrun/wrun-socket-row-source.d.ts +26 -1
- package/dist/utility/wrun/wrun-socket-row-source.js +125 -12
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +3 -3
- package/dist/utility/wrun/wrun-source-rows.util.js +8 -7
- package/dist/utility/wrun/wrun-style-words.util.d.ts +31 -9
- package/dist/utility/wrun/wrun-style-words.util.js +46 -15
- package/dist/utility/wrun/wrun-trades-lane.util.js +2 -1
- package/dist/utility/wrun/wrun-trap-replay.util.d.ts +42 -0
- package/dist/utility/wrun/wrun-trap-replay.util.js +63 -0
- package/dist/utility/wrun/wrun-volume-profile.util.js +6 -5
- package/dist/utility/wrun-display-name.util.d.ts +10 -0
- package/dist/utility/wrun-display-name.util.js +21 -0
- package/dist/utils/replay/replay-buffer-math.d.ts +2 -0
- package/dist/utils/replay/replay-buffer-math.js +2 -0
- package/dist/workers/constants/socket-slots.d.ts +1 -1
- package/dist/workers/utils/time.worker.util.js +2 -2
- package/dist/workers/utils/volume-profile.worker.util.d.ts +9 -0
- package/dist/workers/utils/volume-profile.worker.util.js +20 -0
- package/dist/workers/wrun/wrun-abi-host.d.ts +3 -0
- package/dist/workers/wrun/wrun-abi-host.js +82 -5
- package/dist/workers/wrun/wrun-engine-handler.js +53 -4
- package/dist/workers/wrun/wrun-trap-frames.leaf.d.ts +28 -0
- package/dist/workers/wrun/wrun-trap-frames.leaf.js +108 -0
- package/package.json +11 -11
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* normalizer every lane reads a diagnostics array through. A leaf with no app edge, so the wrun chart-host package's
|
|
6
6
|
* socket source and row builder read it (docs/features/kscript/wrun/wrun-chart-host.md, "Leaves").
|
|
7
7
|
*/
|
|
8
|
-
import type { RuntimeDiagnostic } from '../../interfaces/kscript-diagnostics.interface.js';
|
|
8
|
+
import type { RuntimeDiagnostic, WrunTrapReason } from '../../interfaces/kscript-diagnostics.interface.js';
|
|
9
|
+
import type { WrunTrapContext } from '../../interfaces/wrun-runtime.interface.js';
|
|
9
10
|
import type { WrunRefusal } from '../wrun/wrun-refusal.util.js';
|
|
10
11
|
/**
|
|
11
12
|
* A browser-run Indicator's AssemblyScript trap (`env.abort`: a throw, a std-lib bounds
|
|
@@ -82,6 +83,28 @@ export type WrunAnchorExport = 'init' | 'state' | 'finalize' | 'reset';
|
|
|
82
83
|
export declare function wrunRunFailureRuntimeDiagnostic(message: string, context?: {
|
|
83
84
|
outputNames?: readonly string[];
|
|
84
85
|
}): RuntimeDiagnostic | null;
|
|
86
|
+
/** What failed, in plain words: a std-lib check by name, the engine's `unreachable`, else the guest's own abort words,
|
|
87
|
+
* else that it called abort(); empty for a record no words name (another engine trap, a host refusal). */
|
|
88
|
+
export declare function wrunTrapWhat(trap: WrunTrapContext, translate: WrunTrapTranslate): string;
|
|
89
|
+
export declare const WRUN_TRAP_LOCALE_PREFIX = "scriptEditor.shellConsole.trap";
|
|
90
|
+
/** A translator (`i18n.global.t` compatible); the leaf has no app edge, so the caller passes it. */
|
|
91
|
+
export type WrunTrapTranslate = (key: string, params?: Record<string, unknown>) => string;
|
|
92
|
+
/** What failed, decided from the record alone (never from a message text). */
|
|
93
|
+
export declare function wrunTrapReasonOf(trap: WrunTrapContext): WrunTrapReason;
|
|
94
|
+
/** Where the trap happened: the bar (1-based, as the row's `barIndex`) and its time, or before the first bar. */
|
|
95
|
+
export declare function wrunTrapWhere(trap: WrunTrapContext, translate: WrunTrapTranslate): string;
|
|
96
|
+
/**
|
|
97
|
+
* The trap row built from the ABI host's record (`WrunTrapContext`, captured at the guest-call boundary): `code`,
|
|
98
|
+
* `stage` and `reason` are decided from the record first, then the words. An abort says what failed in plain words
|
|
99
|
+
* (a std-lib check by name, else the guest's own words, else that it called abort()) and on which bar, without the
|
|
100
|
+
* library path; the row keeps the line and column only when the abort names src/indicator.ts. An `unreachable` keeps
|
|
101
|
+
* today's memory sentence plus the bar. A host failure keeps today's row and words. Every row carries `barIndex`
|
|
102
|
+
* (1-based), `details.hostMessage` (the sandbox's words, untouched) and `details.trap`. Null for a record no row
|
|
103
|
+
* speaks for (another engine trap, a host refusal outside the run failure rows): today's surface.
|
|
104
|
+
*/
|
|
105
|
+
export declare function wrunTrapRuntimeDiagnostic(trap: WrunTrapContext, hostMessage: string, translate: WrunTrapTranslate, context?: {
|
|
106
|
+
outputNames?: readonly string[];
|
|
107
|
+
}): RuntimeDiagnostic | null;
|
|
85
108
|
export interface NormalizeRuntimeDiagnosticsOptions {
|
|
86
109
|
/**
|
|
87
110
|
* kScript currently emits RENDER_NO_PLOT when a script only produces drawings.
|
|
@@ -207,6 +207,119 @@ export function wrunRunFailureRuntimeDiagnostic(message, context = {}) {
|
|
|
207
207
|
}
|
|
208
208
|
return null;
|
|
209
209
|
}
|
|
210
|
+
/** The std-lib abort messages the row names in plain words (AssemblyScript's `~lib/util/error.ts`), read only from an
|
|
211
|
+
* abort whose path is the std lib: the author's own abort("Index out of range") stays the author's words. */
|
|
212
|
+
const WRUN_STD_LIB_ABORT_REASONS = {
|
|
213
|
+
'Index out of range': 'index-out-of-range',
|
|
214
|
+
'Key does not exist': 'key-not-found',
|
|
215
|
+
'Array is empty': 'array-empty',
|
|
216
|
+
};
|
|
217
|
+
/** The locale key of each reason the row names in plain words (`scriptEditor.shellConsole.trap.what.*`). */
|
|
218
|
+
const WRUN_TRAP_WHAT_KEYS = {
|
|
219
|
+
'index-out-of-range': 'indexOutOfRange',
|
|
220
|
+
'key-not-found': 'keyNotFound',
|
|
221
|
+
'array-empty': 'arrayEmpty',
|
|
222
|
+
unreachable: 'unreachable',
|
|
223
|
+
};
|
|
224
|
+
/** What failed, in plain words: a std-lib check by name, the engine's `unreachable`, else the guest's own abort words,
|
|
225
|
+
* else that it called abort(); empty for a record no words name (another engine trap, a host refusal). */
|
|
226
|
+
export function wrunTrapWhat(trap, translate) {
|
|
227
|
+
const reason = wrunTrapReasonOf(trap);
|
|
228
|
+
const whatKey = WRUN_TRAP_WHAT_KEYS[reason];
|
|
229
|
+
if (whatKey !== undefined)
|
|
230
|
+
return translate(`${WRUN_TRAP_LOCALE_PREFIX}.what.${whatKey}`);
|
|
231
|
+
if (trap.kind !== 'abort')
|
|
232
|
+
return '';
|
|
233
|
+
const words = trap.abort?.message?.trim().replace(/\.+$/, '') ?? '';
|
|
234
|
+
return words !== '' ? words : translate(`${WRUN_TRAP_LOCALE_PREFIX}.what.abort`);
|
|
235
|
+
}
|
|
236
|
+
export const WRUN_TRAP_LOCALE_PREFIX = 'scriptEditor.shellConsole.trap';
|
|
237
|
+
/** What failed, decided from the record alone (never from a message text). */
|
|
238
|
+
export function wrunTrapReasonOf(trap) {
|
|
239
|
+
if (trap.kind === 'abort') {
|
|
240
|
+
const path = trap.abort?.path ?? '';
|
|
241
|
+
const message = trap.abort?.message?.trim() ?? '';
|
|
242
|
+
return (path.startsWith('~lib/') ? WRUN_STD_LIB_ABORT_REASONS[message] : undefined) ?? 'abort';
|
|
243
|
+
}
|
|
244
|
+
if (trap.kind === 'native')
|
|
245
|
+
return WRUN_UNREACHABLE_TRAP_RE.test(trap.native?.message.trim() ?? '') ? 'unreachable' : 'native';
|
|
246
|
+
return 'host';
|
|
247
|
+
}
|
|
248
|
+
/** `2026-11-14 10:00` for an epoch-ms time (UTC: the sentence says so), the number itself for a time that is none. */
|
|
249
|
+
function wrunTrapBarTime(ts) {
|
|
250
|
+
if (!Number.isFinite(ts))
|
|
251
|
+
return String(ts);
|
|
252
|
+
const date = new Date(ts);
|
|
253
|
+
return Number.isNaN(date.getTime()) ? String(ts) : date.toISOString().slice(0, 16).replace('T', ' ');
|
|
254
|
+
}
|
|
255
|
+
/** Where the trap happened: the bar (1-based, as the row's `barIndex`) and its time, or before the first bar. */
|
|
256
|
+
export function wrunTrapWhere(trap, translate) {
|
|
257
|
+
return trap.bar
|
|
258
|
+
? translate(`${WRUN_TRAP_LOCALE_PREFIX}.onBar`, { bar: trap.bar.index + 1, time: wrunTrapBarTime(trap.bar.ts) })
|
|
259
|
+
: translate(`${WRUN_TRAP_LOCALE_PREFIX}.beforeBars`);
|
|
260
|
+
}
|
|
261
|
+
/** The fields every trap row carries: the 1-based bar (the normalizer drops a 0), the host's words and the record. */
|
|
262
|
+
function wrunTrapRowFields(trap, reason, hostMessage, libSite) {
|
|
263
|
+
const details = {
|
|
264
|
+
kind: trap.kind,
|
|
265
|
+
phase: trap.phase,
|
|
266
|
+
reason,
|
|
267
|
+
...(trap.bar ? { barTs: trap.bar.ts } : {}),
|
|
268
|
+
...(libSite !== undefined ? { libSite } : {}),
|
|
269
|
+
};
|
|
270
|
+
return {
|
|
271
|
+
...(trap.bar ? { barIndex: trap.bar.index + 1 } : {}),
|
|
272
|
+
details: { hostMessage: hostMessage.trim(), trap: details },
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* The trap row built from the ABI host's record (`WrunTrapContext`, captured at the guest-call boundary): `code`,
|
|
277
|
+
* `stage` and `reason` are decided from the record first, then the words. An abort says what failed in plain words
|
|
278
|
+
* (a std-lib check by name, else the guest's own words, else that it called abort()) and on which bar, without the
|
|
279
|
+
* library path; the row keeps the line and column only when the abort names src/indicator.ts. An `unreachable` keeps
|
|
280
|
+
* today's memory sentence plus the bar. A host failure keeps today's row and words. Every row carries `barIndex`
|
|
281
|
+
* (1-based), `details.hostMessage` (the sandbox's words, untouched) and `details.trap`. Null for a record no row
|
|
282
|
+
* speaks for (another engine trap, a host refusal outside the run failure rows): today's surface.
|
|
283
|
+
*/
|
|
284
|
+
export function wrunTrapRuntimeDiagnostic(trap, hostMessage, translate, context = {}) {
|
|
285
|
+
const reason = wrunTrapReasonOf(trap);
|
|
286
|
+
if (trap.kind === 'abort') {
|
|
287
|
+
const abort = trap.abort ?? { message: null, path: null, line: 0, column: 0 };
|
|
288
|
+
const anchored = abort.path === WRUN_ABORT_ENTRY_FILE && abort.line > 0;
|
|
289
|
+
const words = abort.message?.trim().replace(/\.+$/, '') ?? '';
|
|
290
|
+
const kitClass = anchored ? undefined : WRUN_KIT_ABORT_CLASS.exec(words)?.groups?.name;
|
|
291
|
+
const libSite = abort.path !== null && abort.path !== WRUN_ABORT_ENTRY_FILE
|
|
292
|
+
? abort.line > 0
|
|
293
|
+
? `${abort.path}:${abort.line}:${abort.column}`
|
|
294
|
+
: abort.path
|
|
295
|
+
: undefined;
|
|
296
|
+
const what = wrunTrapWhat(trap, translate);
|
|
297
|
+
const fields = wrunTrapRowFields(trap, reason, hostMessage, libSite);
|
|
298
|
+
return {
|
|
299
|
+
stage: 'compute',
|
|
300
|
+
severity: 'error',
|
|
301
|
+
code: WRUN_ABORT_DIAGNOSTIC_CODE,
|
|
302
|
+
message: translate(`${WRUN_TRAP_LOCALE_PREFIX}.plain`, { what, where: wrunTrapWhere(trap, translate) }),
|
|
303
|
+
type: 'execution',
|
|
304
|
+
...(anchored ? { line: abort.line, ...(abort.column > 0 ? { column: abort.column } : {}) } : {}),
|
|
305
|
+
...(fields.barIndex !== undefined ? { barIndex: fields.barIndex } : {}),
|
|
306
|
+
details: { ...(kitClass !== undefined ? { anchorClass: kitClass } : {}), ...fields.details },
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
// Another engine trap keeps today's surface (no row).
|
|
310
|
+
if (reason === 'native')
|
|
311
|
+
return null;
|
|
312
|
+
const row = wrunRunFailureRuntimeDiagnostic(hostMessage, context);
|
|
313
|
+
if (row === null)
|
|
314
|
+
return null;
|
|
315
|
+
const fields = wrunTrapRowFields(trap, reason, hostMessage, undefined);
|
|
316
|
+
return {
|
|
317
|
+
...row,
|
|
318
|
+
...(reason === 'unreachable' ? { message: `${row.message} ${wrunTrapWhere(trap, translate)}` } : {}),
|
|
319
|
+
...(fields.barIndex !== undefined ? { barIndex: fields.barIndex } : {}),
|
|
320
|
+
details: { ...row.details, ...fields.details },
|
|
321
|
+
};
|
|
322
|
+
}
|
|
210
323
|
function isObject(value) {
|
|
211
324
|
return typeof value === 'object' && value !== null;
|
|
212
325
|
}
|
|
@@ -274,6 +387,8 @@ export function normalizeRuntimeDiagnostics(value, options = {}) {
|
|
|
274
387
|
...(raw.opra === true ? { opra: true } : {}),
|
|
275
388
|
// The CME mark (computed over CME data) the same way.
|
|
276
389
|
...(raw.cme === true ? { cme: true } : {}),
|
|
390
|
+
// The index and yield venue's mark (computed over its display-only data) the same way.
|
|
391
|
+
...(raw.indexOtc === true ? { indexOtc: true } : {}),
|
|
277
392
|
},
|
|
278
393
|
];
|
|
279
394
|
});
|
|
@@ -35,6 +35,7 @@ export const AggregationInterval = numericEnum({
|
|
|
35
35
|
FIFTEEN_SECONDS: 23,
|
|
36
36
|
THIRTY_SECONDS: 24,
|
|
37
37
|
HALF_YEAR: 25,
|
|
38
|
+
CUSTOM: 26,
|
|
38
39
|
});
|
|
39
40
|
export const AssetClass = numericEnum({
|
|
40
41
|
UNKNOWN_ASSET_CLASS: 0,
|
|
@@ -46,6 +47,7 @@ export const AssetClass = numericEnum({
|
|
|
46
47
|
ASSET_CLASS_INDEX: 7,
|
|
47
48
|
ASSET_CLASS_PREDICTION: 8,
|
|
48
49
|
ASSET_CLASS_ECONOMIC: 9,
|
|
50
|
+
ASSET_CLASS_FIXED_INCOME: 10,
|
|
49
51
|
});
|
|
50
52
|
export const Category = numericEnum({
|
|
51
53
|
UNKNOWN_CATEGORY: 0,
|
|
@@ -207,6 +209,9 @@ export const Exchange = numericEnum({
|
|
|
207
209
|
LIGHTER: 177,
|
|
208
210
|
VARIATIONAL: 178,
|
|
209
211
|
VARIATIONAL_SWAP: 179,
|
|
212
|
+
FRED: 180,
|
|
213
|
+
CFTC: 181,
|
|
214
|
+
INDICES_OTC: 182,
|
|
210
215
|
});
|
|
211
216
|
export const Representation = numericEnum({
|
|
212
217
|
UNKNOWN_REPRESENTATION: 0,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { WrunRowLaneDescriptor } from '../wrun-row-lane.types.js';
|
|
2
2
|
/** f64s per print: `[offset_ms, price, size, usd, side, present]`. */
|
|
3
3
|
export declare const WRUN_DARK_POOL_WIDTH = 6;
|
|
4
|
-
/** How far back the source holds prints (the
|
|
4
|
+
/** How far back the source holds prints (the 90 day large table's reach less a one-day margin, 89 days, equal to
|
|
5
|
+
* `DARK_POOL_LARGE_REACH_MS`): the lane's one horizon. */
|
|
5
6
|
export declare const WRUN_DARK_POOL_HORIZON_MS: number;
|
|
6
7
|
/** The overflow words, the default first. */
|
|
7
8
|
export declare const WRUN_DARK_POOL_OVERFLOW: readonly string[];
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* - `governed: 'stocks'`: the identity and the own fetch read the chart port (wrun-dark-pool.util, loaded inside them):
|
|
6
6
|
* refused by name off a US stock tape market, on a tape the venue policy closes to the run, and on Price only, before
|
|
7
7
|
* any fetch.
|
|
8
|
-
* - Horizon: `WRUN_DARK_POOL_HORIZON_MS` (the
|
|
8
|
+
* - Horizon: `WRUN_DARK_POOL_HORIZON_MS` (the large table's 89 days); older bars and a capped day's bars are served in part.
|
|
9
9
|
* - Knobs: `max_cells` and `overflow` ("refuse" | "largest": the most dollars). No floor knob. Live: the poll reconcile.
|
|
10
10
|
* docs/features/data/us-stocks-tape.md, "Dark pool prints on the chart". LIGHT at module load.
|
|
11
11
|
*/
|
|
@@ -16,8 +16,9 @@ export const WRUN_DARK_POOL_WIDTH = 6;
|
|
|
16
16
|
const OFFSET = 0;
|
|
17
17
|
const USD = 3;
|
|
18
18
|
const PRESENT = 5;
|
|
19
|
-
/** How far back the source holds prints (the
|
|
20
|
-
|
|
19
|
+
/** How far back the source holds prints (the 90 day large table's reach less a one-day margin, 89 days, equal to
|
|
20
|
+
* `DARK_POOL_LARGE_REACH_MS`): the lane's one horizon. */
|
|
21
|
+
export const WRUN_DARK_POOL_HORIZON_MS = 89 * 86_400_000;
|
|
21
22
|
/** The overflow words, the default first. */
|
|
22
23
|
export const WRUN_DARK_POOL_OVERFLOW = Object.freeze(['refuse', 'largest']);
|
|
23
24
|
const isTuple = (cell) => Array.isArray(cell) && cell.length === WRUN_DARK_POOL_WIDTH && cell.every((value) => Number.isFinite(value));
|
|
@@ -66,6 +66,7 @@ import type { DisplayOffset } from '../chart/display-offset.leaf.js';
|
|
|
66
66
|
import { type WrunCellsCapSummary } from './wrun-cap-notice.util.js';
|
|
67
67
|
import { type WrunCanvasReadout } from './wrun-canvas-readout.util.js';
|
|
68
68
|
import { wrunCanvasMergeLive } from './wrun-canvases.util.js';
|
|
69
|
+
import './wrun-colour-tone.util.js';
|
|
69
70
|
import { type WrunColorTheme } from './wrun-style-words.util.js';
|
|
70
71
|
export { decodeWrunFlagMeta, decodeWrunMarkMeta, decodeWrunSpanMeta, formatWrunBatchedNumber, isWrunBatchedNumberFormat, WRUN_BATCHED_NUMBER_FORMATS, wrunBatchedReadoutText, wrunMarkQtyInUnits, WRUN_MARK_META_MAX_OFFSET_MS, type WrunBatchedNumberFormat, type WrunFlagMeta, type WrunMarkMeta, type WrunSpanMeta, } from './wrun-batched-readout.util.js';
|
|
71
72
|
export type { WrunBatchedHoverRecord } from './wrun-canvas-readout.util.js';
|
|
@@ -247,15 +248,24 @@ export declare function wrunBatchedMarksChildren(sheet: WrunBatchedSheet, output
|
|
|
247
248
|
* number decoded (a packed theme token through its word, the existing packed-colour decode for the
|
|
248
249
|
* rest); undefined when it is neither. */
|
|
249
250
|
export declare function resolveWrunBatchedColor(value: unknown, theme: WrunColorTheme): string | undefined;
|
|
251
|
+
/** The batched marks level a chart's engine draws (`tc.packHooks.batchedMarksLevel`, set by its batchedMarks pack):
|
|
252
|
+
* 0 when the chart carries none (an engine before the Big Trades looks round). */
|
|
253
|
+
export declare function wrunBatchedMarksLevelOf(tc: unknown): number;
|
|
250
254
|
/**
|
|
251
255
|
* Why the chart's engine cannot draw a batched child its kind's renderer draws, null when it can: the mount asks it
|
|
252
256
|
* once the engine gate passed the kind (the pack settled and registered, `hasPlotRenderer` the engine's own answer).
|
|
253
257
|
* A marks child whose look needs the dark pool round's engine (look 4, the `log` law, a `min_px` or `max_px` bound)
|
|
254
258
|
* on an engine without that release's `flags` renderer is refused by name ("Needs a newer chart"), as an unknown
|
|
255
|
-
* look is by the layout gate, never drawn as another look.
|
|
256
|
-
*
|
|
259
|
+
* look is by the layout gate, never drawn as another look. So is one that needs the Big Trades looks round's engine
|
|
260
|
+
* (look 5 Glass, look 6 Solid, or the size beside the mark, `text.place` 1) on an engine whose marks pack reads below
|
|
261
|
+
* level 2 (`marksLevel`, `wrunBatchedMarksLevelOf`; 0 when the caller passes none), and one whose size is written
|
|
262
|
+
* inside the mark where it fits (`text.place` 2, `fit`, the size inside round) on one below level 3, and one whose
|
|
263
|
+
* size may be written rounded inside the mark (`text.place` 3 `fit_short` or 4 `fit_only`, the four size positions
|
|
264
|
+
* round) on one below level 4: that engine would draw it as the old inside text with no warning. The newest need is
|
|
265
|
+
* named first. A flags child is never judged here: the gate already asked the engine for its kind. The reason is
|
|
266
|
+
* diagnostic text, never copy.
|
|
257
267
|
*/
|
|
258
|
-
export declare function wrunBatchedEngineVerdict(child: Pick<WrunBatchedChildOverlay, 'kind' | 'settings'>, hasPlotRenderer: (type: string) => boolean): string | null;
|
|
268
|
+
export declare function wrunBatchedEngineVerdict(child: Pick<WrunBatchedChildOverlay, 'kind' | 'settings'>, hasPlotRenderer: (type: string) => boolean, marksLevel?: number): string | null;
|
|
259
269
|
export interface WrunBatchedChildConfig {
|
|
260
270
|
id: string;
|
|
261
271
|
plot: WrunBatchedMarksKind;
|
|
@@ -6,6 +6,8 @@ import { forgetWrunCanvasReadout, rememberWrunCanvasReadout } from './wrun-canva
|
|
|
6
6
|
import { wrunCanvasMergeLive } from './wrun-canvases.util.js';
|
|
7
7
|
import { decodeWrunPackedColor, isWrunStyleTargetHidden, wrunPaintedDeclarationOf } from './wrun-color-settings.util.js';
|
|
8
8
|
import { WRUN_HEATMAP_TRIM_WATERMARK, wrunHeatmapCellShares, wrunHeatmapTrimTarget, } from './wrun-heatmap-cell-budget.util.js';
|
|
9
|
+
// The mark colours (`theme.up_mark`, `theme.down_mark`) a marks child resolves: bound here, off the boot path.
|
|
10
|
+
import './wrun-colour-tone.util.js';
|
|
9
11
|
import { resolveWrunColorWord, wrunThemeTokenOfPacked, wrunThemeTokenWord, } from './wrun-style-words.util.js';
|
|
10
12
|
import { decodeWrunMarkMeta, decodeWrunSpanMeta, isWrunBatchedNumberFormat, WRUN_BATCHED_NUMBER_FORMATS, wrunBatchedReadoutText, wrunMarkUnitValue, } from './wrun-batched-readout.util.js';
|
|
11
13
|
export { decodeWrunFlagMeta, decodeWrunMarkMeta, decodeWrunSpanMeta, formatWrunBatchedNumber, isWrunBatchedNumberFormat, WRUN_BATCHED_NUMBER_FORMATS, wrunBatchedReadoutText, wrunMarkQtyInUnits, WRUN_MARK_META_MAX_OFFSET_MS, } from './wrun-batched-readout.util.js';
|
|
@@ -91,7 +93,7 @@ const LOOK_DEFAULTS = {
|
|
|
91
93
|
size: { law: 'sqrt', unit: 1, scale: 5 },
|
|
92
94
|
opacity_pct: 30,
|
|
93
95
|
look: 0,
|
|
94
|
-
text: { mode: 1, field: 'qty', format: 'compact', min_px: 22 },
|
|
96
|
+
text: { mode: 1, field: 'qty', format: 'compact', min_px: 22, place: 0 },
|
|
95
97
|
x: 0,
|
|
96
98
|
colors: ['theme.down', 'theme.up'],
|
|
97
99
|
tooltip: null,
|
|
@@ -349,20 +351,38 @@ function wholeIn(value, min, max, fallback) {
|
|
|
349
351
|
function clampTo(value, min, max, fallback) {
|
|
350
352
|
return finite(value) ? Math.min(max, Math.max(min, value)) : fallback;
|
|
351
353
|
}
|
|
352
|
-
/** A word among `words` (its index), a whole number among the indexes, else
|
|
353
|
-
|
|
354
|
+
/** A word among `words` (its index) or among `aliases` (the index it names), a whole number among the indexes, else
|
|
355
|
+
* `fallback`. */
|
|
356
|
+
function wordIndex(value, words, fallback, aliases = {}) {
|
|
354
357
|
if (typeof value === 'string') {
|
|
355
358
|
const at = words.indexOf(value);
|
|
356
|
-
return at
|
|
359
|
+
return at !== -1 ? at : Object.hasOwn(aliases, value) ? aliases[value] : fallback;
|
|
357
360
|
}
|
|
358
361
|
return wholeIn(value, 0, words.length - 1, fallback);
|
|
359
362
|
}
|
|
360
|
-
/** The marks look words (round-2 fold 1), the numbers canonical; the first contract's words read too,
|
|
361
|
-
* word `diamond` (the dark pool round). */
|
|
362
|
-
const MARK_LOOKS = ['circle', 'dot', 'ring', 'square', 'diamond'];
|
|
363
|
+
/** The marks look words (round-2 fold 1), the numbers canonical; the first contract's words read too, look 4's
|
|
364
|
+
* word `diamond` (the dark pool round), and looks 5 and 6, `glass` and `solid` (the Big Trades looks round). */
|
|
365
|
+
const MARK_LOOKS = ['circle', 'dot', 'ring', 'square', 'diamond', 'glass', 'solid'];
|
|
366
|
+
/** The kit's own words for looks 0 and 1 (`WRUN_MARK_LOOKS`): a select bound to `look` through `style_values`
|
|
367
|
+
* paints these words, so they read as the looks they name. */
|
|
368
|
+
const MARK_LOOK_KIT_WORDS = { bubble: 0, soft_dot: 1 };
|
|
363
369
|
/** The diamond's index: a look an engine before the dark pool round's draws as another (`wrunBatchedEngineVerdict`). */
|
|
364
370
|
const DIAMOND_LOOK = MARK_LOOKS.indexOf('diamond');
|
|
371
|
+
/** Glass and Solid: looks an engine before the Big Trades looks round draws as another (`wrunBatchedEngineVerdict`). */
|
|
372
|
+
const GLASS_LOOK = MARK_LOOKS.indexOf('glass');
|
|
373
|
+
const SOLID_LOOK = MARK_LOOKS.indexOf('solid');
|
|
365
374
|
const MARK_TEXT_MODES = ['off', 'largest', 'all'];
|
|
375
|
+
/** Where a mark's size is written (`text.place`): 0 inside the mark (today's drawing), 1 beside it (the Big Trades
|
|
376
|
+
* looks round), 2 `fit`, inside the mark where the full number fits, else beside it (the Big Trades size inside
|
|
377
|
+
* round), 3 `fit_short`, as `fit` but rounded inside when only the rounded number fits ("$21M" for "$20.5M"), and
|
|
378
|
+
* 4 `fit_only`, as `fit_short` but never beside: a mark too small even for the rounded number shows none (the Big
|
|
379
|
+
* Trades four size positions round). */
|
|
380
|
+
const MARK_TEXT_PLACES = ['inside', 'beside', 'fit', 'fit_short', 'fit_only'];
|
|
381
|
+
/** Places an older engine does not draw as declared, so the mount refuses them by name (`wrunBatchedEngineVerdict`). */
|
|
382
|
+
const BESIDE_PLACE = MARK_TEXT_PLACES.indexOf('beside');
|
|
383
|
+
const FIT_PLACE = MARK_TEXT_PLACES.indexOf('fit');
|
|
384
|
+
const FIT_SHORT_PLACE = MARK_TEXT_PLACES.indexOf('fit_short');
|
|
385
|
+
const FIT_ONLY_PLACE = MARK_TEXT_PLACES.indexOf('fit_only');
|
|
366
386
|
const MARK_X_WORDS = ['bar', 'offset'];
|
|
367
387
|
/** The size laws: sqrt and linear, and log (the dark pool round's, with the `min_px` / `max_px` bounds). */
|
|
368
388
|
const MARK_SIZE_LAWS = ['sqrt', 'linear', 'log'];
|
|
@@ -391,9 +411,13 @@ const KNOWN_STRIDES = {
|
|
|
391
411
|
/** An option's values: its indexes, then its words (what the look readers take). */
|
|
392
412
|
const optionValues = (words) => [...words.keys(), ...words];
|
|
393
413
|
/** The marks options by index, or by the first contract's words (what the look readers take). */
|
|
394
|
-
const MARK_LOOK_VALUES =
|
|
414
|
+
const MARK_LOOK_VALUES = [
|
|
415
|
+
...optionValues(MARK_LOOKS),
|
|
416
|
+
...Object.keys(MARK_LOOK_KIT_WORDS),
|
|
417
|
+
];
|
|
395
418
|
const MARK_X_VALUES = optionValues(MARK_X_WORDS);
|
|
396
419
|
const MARK_TEXT_MODE_VALUES = optionValues(MARK_TEXT_MODES);
|
|
420
|
+
const MARK_TEXT_PLACE_VALUES = optionValues(MARK_TEXT_PLACES);
|
|
397
421
|
/** The size keys marks and flags read (`min_px` and `max_px` the dark pool round's). */
|
|
398
422
|
const MARK_SIZE_VOCABULARY = {
|
|
399
423
|
law: MARK_SIZE_LAWS,
|
|
@@ -420,7 +444,13 @@ const SECTION_VOCABULARY = {
|
|
|
420
444
|
size: MARK_SIZE_VOCABULARY,
|
|
421
445
|
opacity_pct: ANY,
|
|
422
446
|
look: MARK_LOOK_VALUES,
|
|
423
|
-
text: {
|
|
447
|
+
text: {
|
|
448
|
+
mode: MARK_TEXT_MODE_VALUES,
|
|
449
|
+
field: ['qty'],
|
|
450
|
+
format: WRUN_BATCHED_NUMBER_FORMATS,
|
|
451
|
+
min_px: ANY,
|
|
452
|
+
place: MARK_TEXT_PLACE_VALUES,
|
|
453
|
+
},
|
|
424
454
|
x: MARK_X_VALUES,
|
|
425
455
|
colors: ANY,
|
|
426
456
|
tooltip: ANY,
|
|
@@ -599,13 +629,16 @@ function markCaptionFloorPx(declaredPx, scale) {
|
|
|
599
629
|
const scaled = Math.round((declaredPx * markSizeK(scale)) / markSizeK(LOOK_DEFAULTS.marks.size.scale));
|
|
600
630
|
return Math.min(scaled, markMaxDiameterPx(scale));
|
|
601
631
|
}
|
|
602
|
-
/** The marks look the engine draws (r6 parity): `look` 0..
|
|
632
|
+
/** The marks look the engine draws (r6 parity): `look` 0..6 (Bubble, Soft dot, Ring, Square, Diamond, Glass,
|
|
633
|
+
* Solid; by number, by word, or by the kit's words `bubble` and `soft_dot`), the
|
|
603
634
|
* size law over the quantity (`unit` the Min size, `scale` the Bubble size 1..10; `log` and the `min_px` /
|
|
604
635
|
* `max_px` bounds when declared, `markSizeOf`), `x` 0..1
|
|
605
636
|
* (Candle center, Trade time), `opacity_pct` 10..80, the caption (`text.mode` 0 Off, 1 Big
|
|
606
|
-
* bubbles, 2 All; its format, a word of the one list,
|
|
607
|
-
* at the default Bubble size, handed scaled to this one
|
|
608
|
-
*
|
|
637
|
+
* bubbles, 2 All; its format, a word of the one list, the smallest bubble that holds one: declared
|
|
638
|
+
* at the default Bubble size, handed scaled to this one; and `place`, 0 inside the mark, 1 beside it, 2 `fit`,
|
|
639
|
+
* inside where it fits, else beside, 3 `fit_short`, as `fit` with the rounded number inside when only it fits, or
|
|
640
|
+
* 4 `fit_only`, as `fit_short` but never beside). A key
|
|
641
|
+
* left out, or an option that is none of its values (look, x, law, the caption's mode, format and place),
|
|
609
642
|
* takes the kit's default (LOOK_DEFAULTS.marks); a number past its range is clamped. The market's
|
|
610
643
|
* dollar unit (`valuePerUnit`, proven: finite and above zero) rides at the top for the `units`
|
|
611
644
|
* caption; without one, `units` is handed to the engine as `usd`. */
|
|
@@ -620,7 +653,7 @@ function marksSettings(section, valuePerUnit) {
|
|
|
620
653
|
const format = written === 'units' && valuePerUnit === undefined ? 'usd' : written;
|
|
621
654
|
const scale = size.scale;
|
|
622
655
|
return {
|
|
623
|
-
look: wordIndex(section.look ?? legacyShape, MARK_LOOKS, defaults.look),
|
|
656
|
+
look: wordIndex(section.look ?? legacyShape, MARK_LOOKS, defaults.look, MARK_LOOK_KIT_WORDS),
|
|
624
657
|
size,
|
|
625
658
|
x: wordIndex(section.x, MARK_X_WORDS, defaults.x),
|
|
626
659
|
colors: [...(section.colors ?? defaults.colors)],
|
|
@@ -630,6 +663,7 @@ function marksSettings(section, valuePerUnit) {
|
|
|
630
663
|
field: defaults.text.field,
|
|
631
664
|
format,
|
|
632
665
|
min_px: markCaptionFloorPx(clampTo(text.min_px, 0, 64, defaults.text.min_px), scale),
|
|
666
|
+
place: wordIndex(text.place, MARK_TEXT_PLACES, defaults.text.place),
|
|
633
667
|
},
|
|
634
668
|
...(valuePerUnit !== undefined ? { valuePerUnit } : {}),
|
|
635
669
|
};
|
|
@@ -871,17 +905,62 @@ function fallbackColor(kind, at, theme) {
|
|
|
871
905
|
* contract). An engine before it has no `flags` renderer, clamps the look to 0..3 and reads only the sqrt and
|
|
872
906
|
* linear laws, so it would draw another look or size than the declared one, silently. */
|
|
873
907
|
const DIAMOND_ENGINE_PLOT = 'flags';
|
|
908
|
+
/** The marks pack level that draws Glass (look 5), Solid (look 6) and the size beside the mark (`text.place` 1):
|
|
909
|
+
* the engine's batchedMarks pack sets `packHooks.batchedMarksLevel` to it; an older engine leaves it absent. */
|
|
910
|
+
const BIG_TRADES_LOOKS_LEVEL = 2;
|
|
911
|
+
/** The marks pack level that also draws the size inside the mark where it fits, else beside it (`text.place` 2,
|
|
912
|
+
* `fit`): the Big Trades size inside round's engine sets `packHooks.batchedMarksLevel` to 3. */
|
|
913
|
+
const SIZE_FIT_LEVEL = 3;
|
|
914
|
+
/** The marks pack level that also draws the rounded size inside the mark when only the rounded number fits
|
|
915
|
+
* (`text.place` 3, `fit_short`, else beside) and the size inside or not at all (`text.place` 4, `fit_only`): the Big
|
|
916
|
+
* Trades four size positions round's engine sets `packHooks.batchedMarksLevel` to 4. */
|
|
917
|
+
const SIZE_SHORT_LEVEL = 4;
|
|
918
|
+
/** The batched marks level a chart's engine draws (`tc.packHooks.batchedMarksLevel`, set by its batchedMarks pack):
|
|
919
|
+
* 0 when the chart carries none (an engine before the Big Trades looks round). */
|
|
920
|
+
export function wrunBatchedMarksLevelOf(tc) {
|
|
921
|
+
const hooks = isRecord(tc) ? tc.packHooks : undefined;
|
|
922
|
+
const level = isRecord(hooks) ? hooks.batchedMarksLevel : undefined;
|
|
923
|
+
return finite(level) ? level : 0;
|
|
924
|
+
}
|
|
874
925
|
/**
|
|
875
926
|
* Why the chart's engine cannot draw a batched child its kind's renderer draws, null when it can: the mount asks it
|
|
876
927
|
* once the engine gate passed the kind (the pack settled and registered, `hasPlotRenderer` the engine's own answer).
|
|
877
928
|
* A marks child whose look needs the dark pool round's engine (look 4, the `log` law, a `min_px` or `max_px` bound)
|
|
878
929
|
* on an engine without that release's `flags` renderer is refused by name ("Needs a newer chart"), as an unknown
|
|
879
|
-
* look is by the layout gate, never drawn as another look.
|
|
880
|
-
*
|
|
930
|
+
* look is by the layout gate, never drawn as another look. So is one that needs the Big Trades looks round's engine
|
|
931
|
+
* (look 5 Glass, look 6 Solid, or the size beside the mark, `text.place` 1) on an engine whose marks pack reads below
|
|
932
|
+
* level 2 (`marksLevel`, `wrunBatchedMarksLevelOf`; 0 when the caller passes none), and one whose size is written
|
|
933
|
+
* inside the mark where it fits (`text.place` 2, `fit`, the size inside round) on one below level 3, and one whose
|
|
934
|
+
* size may be written rounded inside the mark (`text.place` 3 `fit_short` or 4 `fit_only`, the four size positions
|
|
935
|
+
* round) on one below level 4: that engine would draw it as the old inside text with no warning. The newest need is
|
|
936
|
+
* named first. A flags child is never judged here: the gate already asked the engine for its kind. The reason is
|
|
937
|
+
* diagnostic text, never copy.
|
|
881
938
|
*/
|
|
882
|
-
export function wrunBatchedEngineVerdict(child, hasPlotRenderer) {
|
|
939
|
+
export function wrunBatchedEngineVerdict(child, hasPlotRenderer, marksLevel = 0) {
|
|
883
940
|
if (child.kind !== 'marks')
|
|
884
941
|
return null;
|
|
942
|
+
const text = isRecord(child.settings.text) ? child.settings.text : {};
|
|
943
|
+
const shortNeed = text.place === FIT_SHORT_PLACE
|
|
944
|
+
? 'text.place 3 (fit_short)'
|
|
945
|
+
: text.place === FIT_ONLY_PLACE
|
|
946
|
+
? 'text.place 4 (fit_only)'
|
|
947
|
+
: null;
|
|
948
|
+
if (shortNeed !== null && marksLevel < SIZE_SHORT_LEVEL) {
|
|
949
|
+
return `${shortNeed} needs the chart engine whose marks pack draws level ${SIZE_SHORT_LEVEL}`;
|
|
950
|
+
}
|
|
951
|
+
if (text.place === FIT_PLACE && marksLevel < SIZE_FIT_LEVEL) {
|
|
952
|
+
return `text.place 2 (fit) needs the chart engine whose marks pack draws level ${SIZE_FIT_LEVEL}`;
|
|
953
|
+
}
|
|
954
|
+
const looksNeed = child.settings.look === GLASS_LOOK
|
|
955
|
+
? 'look 5 (glass)'
|
|
956
|
+
: child.settings.look === SOLID_LOOK
|
|
957
|
+
? 'look 6 (solid)'
|
|
958
|
+
: text.place === BESIDE_PLACE
|
|
959
|
+
? 'text.place 1 (beside)'
|
|
960
|
+
: null;
|
|
961
|
+
if (looksNeed !== null && marksLevel < BIG_TRADES_LOOKS_LEVEL) {
|
|
962
|
+
return `${looksNeed} needs the chart engine whose marks pack draws level ${BIG_TRADES_LOOKS_LEVEL}`;
|
|
963
|
+
}
|
|
885
964
|
const size = isRecord(child.settings.size) ? child.settings.size : {};
|
|
886
965
|
const needs = child.settings.look === DIAMOND_LOOK
|
|
887
966
|
? 'look 4 (diamond)'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RuntimeDiagnostic } from '../../interfaces/kscript-diagnostics.interface.js';
|
|
2
2
|
import type { WrunHeatmap, WrunIndicatorMetadata, WrunMatrix, WrunOutputRow, WrunPanel } from '../../interfaces/wrun-runtime.interface.js';
|
|
3
|
+
import './wrun-colour-tone.util.js';
|
|
3
4
|
import { type WrunColorTheme, type WrunNumberFormatSpec } from './wrun-style-words.util.js';
|
|
4
5
|
import { type WrunMatrixFrame } from './wrun-frames.js';
|
|
5
6
|
import { type WrunCanvasReadout } from './wrun-canvas-readout.util.js';
|
|
@@ -104,8 +105,9 @@ export interface WrunCanvasChildConfig {
|
|
|
104
105
|
* (wins over the child's own rows). */
|
|
105
106
|
data?: unknown[];
|
|
106
107
|
}
|
|
107
|
-
/** The default dark palette (wrun-style-words.util 2.3
|
|
108
|
-
*
|
|
108
|
+
/** The default dark palette (wrun-style-words.util 2.3, the palette a chart
|
|
109
|
+
* without a theme answers): what a child's own rows resolve against before
|
|
110
|
+
* the mount hands the chart's theme over. */
|
|
109
111
|
export declare const WRUN_CANVAS_FALLBACK_THEME: Readonly<WrunColorTheme>;
|
|
110
112
|
/** The colour-scale defaults (PT-heatmap): the sequential ramp, the
|
|
111
113
|
* diverging ramp around a centre, the quantile of the auto bounds. */
|
|
@@ -40,7 +40,9 @@ import { isWrunStyleTargetHidden } from './wrun-color-settings.util.js';
|
|
|
40
40
|
import { isWrunBandedBookSource } from './wrun-book-bands.leaf.js';
|
|
41
41
|
import { WRUN_MAX_ROWS_PER_PERIOD, WRUN_ROW_CAP_MAX_DOUBLINGS, wrunAutoRowUnit } from './wrun-auto-row.util.js';
|
|
42
42
|
import { WRUN_FOOTPRINT_CELL_METRIC_DEFAULT, WRUN_FOOTPRINT_MODE_DEFAULT } from './wrun-footprint-modes.util.js';
|
|
43
|
-
|
|
43
|
+
// Bound before the fallback palette below reads the mark colours (off the boot path).
|
|
44
|
+
import './wrun-colour-tone.util.js';
|
|
45
|
+
import { formatWrunNumber, resolveWrunColorWord, wrunColorThemeOf, wrunFontFamilyCss, } from './wrun-style-words.util.js';
|
|
44
46
|
import { buildWrunTpoRows, WRUN_TPO_MAX_ROWS_PER_BAR, } from './wrun-tpo-rows.util.js';
|
|
45
47
|
import { wrunVolumeProfileChild } from './wrun-volume-profile.util.js';
|
|
46
48
|
import { invalidWrunFrame, parseWrunMatrixFrame } from './wrun-frames.js';
|
|
@@ -51,17 +53,10 @@ const CHILD_PLOT = {
|
|
|
51
53
|
profile: 'profile',
|
|
52
54
|
matrix: 'priceMatrix',
|
|
53
55
|
};
|
|
54
|
-
/** The default dark palette (wrun-style-words.util 2.3
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
down: '#ef5350',
|
|
59
|
-
text: '#d1d4dc',
|
|
60
|
-
muted: 'rgba(209, 212, 220, 0.55)',
|
|
61
|
-
bg: '#131722',
|
|
62
|
-
grid: '#2a2e39',
|
|
63
|
-
accent: '#ff4608',
|
|
64
|
-
});
|
|
56
|
+
/** The default dark palette (wrun-style-words.util 2.3, the palette a chart
|
|
57
|
+
* without a theme answers): what a child's own rows resolve against before
|
|
58
|
+
* the mount hands the chart's theme over. */
|
|
59
|
+
export const WRUN_CANVAS_FALLBACK_THEME = Object.freeze(wrunColorThemeOf(undefined));
|
|
65
60
|
/** The colour-scale defaults (PT-heatmap): the sequential ramp, the
|
|
66
61
|
* diverging ramp around a centre, the quantile of the auto bounds. */
|
|
67
62
|
export const WRUN_HEATMAP_DEFAULT_PALETTE = Object.freeze([
|
|
@@ -12,6 +12,11 @@ export interface WrunDrawingsBudget {
|
|
|
12
12
|
/** Increases with every budgeted result: the door never lets an older revision overwrite a newer row. */
|
|
13
13
|
revision: number;
|
|
14
14
|
}
|
|
15
|
+
/** Notes `next`'s drawings token: `previous`'s when the caller proved the two sets equal (pass `undefined` when it
|
|
16
|
+
* did not), else a new one. Returns the token, undefined when `next` is no array. */
|
|
17
|
+
export declare function noteWrunDrawingsSameAs(next: unknown, previous: unknown): number | undefined;
|
|
18
|
+
/** The token the live tick noted on a drawings array (undefined when none was noted: the door then runs in full). */
|
|
19
|
+
export declare function wrunDrawingsToken(drawings: unknown): number | undefined;
|
|
15
20
|
/** The context a result's drawings carry: the result's own field, else the one keyed by its
|
|
16
21
|
* drawings array (a live batch rebuilt around the array). */
|
|
17
22
|
export declare function wrunDrawingsBudgetOf(output: unknown): WrunDrawingsBudget | undefined;
|
|
@@ -29,6 +29,29 @@ import { wrunChartHostEnv, } from '../../host-env.js';
|
|
|
29
29
|
const UNTRIMMED_DRAWING_KINDS = new Set(['table', 'card', 'feed', 'meter', 'ladder']);
|
|
30
30
|
const budgetsByDrawings = new WeakMap();
|
|
31
31
|
let revisions = 0;
|
|
32
|
+
/**
|
|
33
|
+
* The live tick's drawings verdict, as a number per drawings array: a live result whose drawings equal the ones the
|
|
34
|
+
* tick last applied (and whose budget counts match) inherits that array's token, any other result gets a new one.
|
|
35
|
+
* The drawing door holds the token of its last full pass, so an equal token on the next live call means the same
|
|
36
|
+
* records reach it again and the pass can be skipped. A number, never a reference to the previous array: a chain of
|
|
37
|
+
* arrays would keep every old drawings set reachable for as long as the newest lives.
|
|
38
|
+
*/
|
|
39
|
+
const drawingsTokens = new WeakMap();
|
|
40
|
+
let drawingsTokenSeq = 0;
|
|
41
|
+
/** Notes `next`'s drawings token: `previous`'s when the caller proved the two sets equal (pass `undefined` when it
|
|
42
|
+
* did not), else a new one. Returns the token, undefined when `next` is no array. */
|
|
43
|
+
export function noteWrunDrawingsSameAs(next, previous) {
|
|
44
|
+
if (!Array.isArray(next))
|
|
45
|
+
return undefined;
|
|
46
|
+
const inherited = Array.isArray(previous) ? drawingsTokens.get(previous) : undefined;
|
|
47
|
+
const token = inherited ?? (drawingsTokenSeq += 1);
|
|
48
|
+
drawingsTokens.set(next, token);
|
|
49
|
+
return token;
|
|
50
|
+
}
|
|
51
|
+
/** The token the live tick noted on a drawings array (undefined when none was noted: the door then runs in full). */
|
|
52
|
+
export function wrunDrawingsToken(drawings) {
|
|
53
|
+
return Array.isArray(drawings) ? drawingsTokens.get(drawings) : undefined;
|
|
54
|
+
}
|
|
32
55
|
function isRecord(value) {
|
|
33
56
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
34
57
|
}
|
|
@@ -62,7 +62,7 @@ export type WrunWidgetEngineControls = Exclude<WrunWidgetControls, 'none'>;
|
|
|
62
62
|
*/
|
|
63
63
|
export declare function wrunWidgetEngineControls(word: WrunWidgetControls | undefined): WrunWidgetEngineControls | undefined;
|
|
64
64
|
/** The frozen colour-word message (the foundation's, 2.1). */
|
|
65
|
-
export declare const WRUN_COLOR_WORD_MESSAGE
|
|
65
|
+
export declare const WRUN_COLOR_WORD_MESSAGE: string;
|
|
66
66
|
/**
|
|
67
67
|
* DW04: what `chrome: "plain"` stands for, in the sheet's words: no state
|
|
68
68
|
* text, no stripe, no border, a muted title, glyphs on hover. A word declared
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* `controls: "none"` reaches the engine as `hover` (wrunWidgetEngineControls),
|
|
31
31
|
* so a widget never loses the viewer's hide control.
|
|
32
32
|
*/
|
|
33
|
-
import { formatWrunNumber, isWrunColorWord, WRUN_FONT_FAMILIES, WRUN_FONT_WEIGHTS, WRUN_MAX_VALUE_DECIMALS, WRUN_MAX_VALUE_UNIT_CHARS, WRUN_VALUE_FORMATS, wrunFontFamilyCss, } from './wrun-style-words.util.js';
|
|
33
|
+
import { formatWrunNumber, isWrunColorWord, WRUN_FONT_FAMILIES, WRUN_FONT_WEIGHTS, WRUN_MAX_VALUE_DECIMALS, WRUN_MAX_VALUE_UNIT_CHARS, WRUN_THEME_TOKEN_WORDS_TEXT, WRUN_VALUE_FORMATS, wrunFontFamilyCss, } from './wrun-style-words.util.js';
|
|
34
34
|
// Bounds (the kit's, restated per X22; D1 for the corner radius).
|
|
35
35
|
export const WRUN_WIDGET_CORNER_RADIUS_MAX_PX = 32;
|
|
36
36
|
export const WRUN_WIDGET_PADDING_MAX_PX = 24;
|
|
@@ -71,7 +71,7 @@ const WRUN_TEXT_ALIGNS = ['left', 'center', 'right'];
|
|
|
71
71
|
const WRUN_FEED_TIME_FORMATS = ['HH:mm:ss', 'HH:mm', 'MM-dd HH:mm', 'none'];
|
|
72
72
|
const WRUN_CARD_VALUE_FORMAT_WORDS = [...WRUN_VALUE_FORMATS, 'pct'];
|
|
73
73
|
/** The frozen colour-word message (the foundation's, 2.1). */
|
|
74
|
-
export const WRUN_COLOR_WORD_MESSAGE =
|
|
74
|
+
export const WRUN_COLOR_WORD_MESSAGE = `a colour must be #rrggbb, #rrggbbaa or one of ${WRUN_THEME_TOKEN_WORDS_TEXT}`;
|
|
75
75
|
/**
|
|
76
76
|
* DW04: what `chrome: "plain"` stands for, in the sheet's words: no state
|
|
77
77
|
* text, no stripe, no border, a muted title, glyphs on hover. A word declared
|