@orangecharts/wrun-chart-host 0.7.1 → 0.8.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 +25 -3
- package/dist/constants/feature-flags.constants.d.ts +1 -0
- package/dist/constants/feature-flags.constants.js +5 -0
- package/dist/constants/option-venues.constants.d.ts +18 -0
- package/dist/constants/option-venues.constants.js +14 -0
- package/dist/constants/venue-presets.constants.d.ts +17 -3
- package/dist/constants/venue-presets.constants.js +17 -3
- package/dist/host-env.d.ts +24 -0
- package/dist/host-env.js +21 -0
- package/dist/host-ports.types.d.ts +12 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +16 -0
- package/dist/indicators/controls/tpo-session.util.d.ts +40 -11
- package/dist/indicators/controls/tpo-session.util.js +138 -14
- package/dist/interfaces/option-instrument.interface.d.ts +6 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +4 -0
- package/dist/kscript-data/controls/live-trades-merge.util.js +4 -0
- package/dist/settings-templates/footprint-rows.d.ts +25 -0
- package/dist/settings-templates/footprint-rows.js +127 -0
- package/dist/settings-templates/form-rows.d.ts +56 -0
- package/dist/settings-templates/form-rows.js +19 -0
- package/dist/settings-templates/frvp-fields.js +14 -0
- package/dist/settings-templates/index.d.ts +10 -1
- package/dist/settings-templates/index.js +11 -2
- package/dist/settings-templates/indicator-fields.js +78 -0
- package/dist/settings-templates/tool-rules.d.ts +35 -9
- package/dist/settings-templates/tool-rules.js +42 -8
- package/dist/settings-templates/tool-tables.generated.js +13 -2
- package/dist/utility/chart/candle-volume-unit.leaf.d.ts +16 -0
- package/dist/utility/chart/candle-volume-unit.leaf.js +61 -0
- package/dist/utility/chart/footprint-columns.util.d.ts +74 -0
- package/dist/utility/chart/footprint-columns.util.js +106 -0
- package/dist/utility/chart/footprint-display-mode.util.d.ts +40 -0
- package/dist/utility/chart/footprint-display-mode.util.js +62 -0
- package/dist/utility/chart/footprint-sierra-look.util.d.ts +2 -0
- package/dist/utility/chart/footprint-sierra-look.util.js +37 -0
- package/dist/utility/chart/kscript-venue-policy.util.js +4 -2
- package/dist/utility/chart/om-panel.util.d.ts +11 -0
- package/dist/utility/chart/om-panel.util.js +59 -0
- package/dist/utility/chart/window-geometry.leaf.d.ts +23 -1
- package/dist/utility/chart/window-geometry.leaf.js +78 -6
- package/dist/utility/chart/window-owner.leaf.d.ts +13 -0
- package/dist/utility/chart/window-owner.leaf.js +5 -0
- package/dist/utility/options/cme-options-root.util.d.ts +25 -0
- package/dist/utility/options/cme-options-root.util.js +40 -0
- package/dist/utility/options/option-book.util.d.ts +27 -0
- package/dist/utility/options/option-book.util.js +76 -0
- package/dist/utility/options/option-trade-date.util.d.ts +50 -0
- package/dist/utility/options/option-trade-date.util.js +120 -0
- package/dist/utility/wrun/sources/host-grid-landing.d.ts +4 -2
- package/dist/utility/wrun/sources/host-grid-landing.js +8 -0
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +40 -4
- package/dist/utility/wrun/sources/lanes/options_flow.js +115 -18
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +12 -9
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +10 -7
- package/dist/utility/wrun/sources/row-lane-registry.js +9 -5
- package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +3 -2
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +30 -5
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +14 -1
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +100 -23
- package/dist/utility/wrun/sources/row-lanes/option_strike_flow.d.ts +4 -0
- package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +65 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +47 -1
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +71 -2
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +14 -1
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +30 -2
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +7 -1
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +45 -5
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +115 -3
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +10 -0
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +57 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +60 -6
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +160 -23
- package/dist/utility/wrun/wrun-cloud-record.leaf.d.ts +27 -0
- package/dist/utility/wrun/wrun-cloud-record.leaf.js +71 -0
- package/dist/utility/wrun/wrun-cloud-record.util.d.ts +4 -21
- package/dist/utility/wrun/wrun-cloud-record.util.js +5 -65
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +7 -5
- package/dist/utility/wrun/wrun-color-settings.util.js +26 -11
- package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +4 -2
- package/dist/utility/wrun/wrun-draft-overlay.util.js +40 -3
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +1 -1
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +4 -0
- package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +29 -3
- package/dist/utility/wrun/wrun-lane-refusal.leaf.js +33 -3
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -1
- package/dist/utility/wrun/wrun-live-tick.util.js +39 -6
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +106 -0
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +159 -0
- package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +44 -0
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +213 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +43 -8
- package/dist/utility/wrun/wrun-opra-flow.leaf.js +37 -6
- package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +51 -10
- package/dist/utility/wrun/wrun-option-contract-flow.util.js +85 -33
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +133 -3
- package/dist/utility/wrun/wrun-option-prints.util.js +318 -8
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +96 -0
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +215 -0
- package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +342 -0
- package/dist/utility/wrun/wrun-option-strike-flow.util.js +742 -0
- package/dist/utility/wrun/wrun-option-views.util.d.ts +183 -3
- package/dist/utility/wrun/wrun-option-views.util.js +504 -7
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +6 -4
- package/dist/utility/wrun/wrun-options-chain.util.js +8 -5
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +7 -2
- package/dist/utility/wrun/wrun-overlay-run.util.js +120 -18
- package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +15 -0
- package/dist/utility/wrun/wrun-pack-widths.leaf.js +22 -0
- package/dist/utility/wrun/wrun-pack.util.d.ts +9 -8
- package/dist/utility/wrun/wrun-pack.util.js +21 -15
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-panel-mount.util.js +62 -22
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +17 -2
- package/dist/utility/wrun/wrun-panel-style.util.js +47 -9
- package/dist/utility/wrun/wrun-pin-spelling.util.js +19 -10
- package/dist/utility/wrun/wrun-refusal.util.js +7 -1
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +13 -0
- package/dist/utility/wrun/wrun-script-inputs.util.js +43 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-tape-source.util.js +18 -0
- package/package.json +3 -3
|
@@ -2,7 +2,7 @@ import dayjs from 'dayjs';
|
|
|
2
2
|
import isoWeek from 'dayjs/plugin/isoWeek.js';
|
|
3
3
|
import timezone from 'dayjs/plugin/timezone.js';
|
|
4
4
|
import utc from 'dayjs/plugin/utc.js';
|
|
5
|
-
import { zoneWallMsAt } from '../../utility/chart/ny-calendar.util.js';
|
|
5
|
+
import { zoneWallMsAt, zoneWallToUtcMs } from '../../utility/chart/ny-calendar.util.js';
|
|
6
6
|
import { getTradingDayAnchor, getTradingDayTpoTimeRange } from '../../utility/chart/trading-day.util.js';
|
|
7
7
|
dayjs.extend(utc);
|
|
8
8
|
dayjs.extend(isoWeek);
|
|
@@ -295,12 +295,22 @@ function parseTpoSegmentEndToMinutes(value) {
|
|
|
295
295
|
return undefined;
|
|
296
296
|
return minutes === 0 ? MINUTES_PER_DAY : minutes;
|
|
297
297
|
}
|
|
298
|
+
/** A set's clock from its stored value: New York ('ET' or the IANA name), else UTC. */
|
|
299
|
+
function tpoCustomSessionsTimezoneOf(value) {
|
|
300
|
+
return value === 'ET' || value === 'America/New_York' ? 'ET' : 'UTC';
|
|
301
|
+
}
|
|
302
|
+
function tpoSessionRoleOf(value) {
|
|
303
|
+
return value === 'day' || value === 'evening' ? value : undefined;
|
|
304
|
+
}
|
|
298
305
|
/** Validate + order user segments; null when the set is unusable (bad times,
|
|
299
306
|
* zero-length, or overlapping segments). Gaps between segments are allowed,
|
|
300
|
-
* and one segment may wrap past midnight.
|
|
301
|
-
|
|
307
|
+
* and one segment may wrap past midnight. `timezone` is the set's clock
|
|
308
|
+
* (absent: UTC); validation reads wall-clock minutes on either clock. */
|
|
309
|
+
export function normalizeTpoCustomSessionSegments(value, timezone) {
|
|
302
310
|
if (!Array.isArray(value) || value.length === 0)
|
|
303
311
|
return null;
|
|
312
|
+
const clock = tpoCustomSessionsTimezoneOf(timezone);
|
|
313
|
+
const zone = timezoneName(clock);
|
|
304
314
|
const parsed = [];
|
|
305
315
|
for (const raw of value) {
|
|
306
316
|
if (!raw || typeof raw !== 'object')
|
|
@@ -313,14 +323,18 @@ export function normalizeTpoCustomSessionSegments(value) {
|
|
|
313
323
|
if (clockEndMinute === startMinute)
|
|
314
324
|
return null;
|
|
315
325
|
const endMinute = clockEndMinute < startMinute ? clockEndMinute + MINUTES_PER_DAY : clockEndMinute;
|
|
326
|
+
const role = tpoSessionRoleOf(segment.role);
|
|
316
327
|
parsed.push({
|
|
317
328
|
label: String(segment.label ?? '').trim() || `Session ${parsed.length + 1}`,
|
|
318
329
|
start: String(segment.start),
|
|
319
330
|
end: String(segment.end),
|
|
320
331
|
color: String(segment.color ?? '').trim() || '#4f8cff',
|
|
332
|
+
...(role ? { role } : {}),
|
|
321
333
|
startMinute,
|
|
322
334
|
endMinute,
|
|
323
335
|
index: 0,
|
|
336
|
+
timezone: clock,
|
|
337
|
+
zone,
|
|
324
338
|
});
|
|
325
339
|
}
|
|
326
340
|
parsed.sort((a, b) => a.startMinute - b.startMinute);
|
|
@@ -344,29 +358,39 @@ export function resolveTpoCustomSessionsSetting(settings) {
|
|
|
344
358
|
// Segments repeat on a 24h cycle; Weekly/Monthly sessions keep the plain path.
|
|
345
359
|
if ((settings?.sessionType ?? 'Daily') !== 'Daily')
|
|
346
360
|
return null;
|
|
347
|
-
return normalizeTpoCustomSessionSegments(config.segments);
|
|
361
|
+
return normalizeTpoCustomSessionSegments(config.segments, config.timezone);
|
|
348
362
|
}
|
|
349
363
|
/**
|
|
350
364
|
* Fetch-alignment range for an active custom-session set, or undefined to keep
|
|
351
365
|
* plain UTC-day alignment. The fetch window must be cut where no session is
|
|
352
|
-
* open, or its edge returns a session fragment: that instant is
|
|
353
|
-
*
|
|
366
|
+
* open, or its edge returns a session fragment: that instant is the set's
|
|
367
|
+
* midnight (UTC: the plain-day path; New York: a New York midnight cycle)
|
|
368
|
+
* until a segment wraps past it, then it is the wrapped session's end, on the
|
|
369
|
+
* set's clock.
|
|
354
370
|
*/
|
|
355
371
|
export function resolveTpoCustomSessionsAlignmentRange(segments) {
|
|
356
372
|
const last = segments[segments.length - 1];
|
|
357
|
-
if (!last
|
|
373
|
+
if (!last)
|
|
358
374
|
return undefined;
|
|
375
|
+
const timezone = last.timezone ?? 'UTC';
|
|
359
376
|
// start === end is resolveTpoTimeRangeWindow's full-session shape: a 24h
|
|
360
|
-
// cycle anchored at that wall time.
|
|
361
|
-
|
|
377
|
+
// cycle anchored at that wall time (DST-exact on the New York clock).
|
|
378
|
+
if (last.endMinute <= MINUTES_PER_DAY) {
|
|
379
|
+
return timezone === 'ET' ? { start_time: '00:00', end_time: '00:00', timezone } : undefined;
|
|
380
|
+
}
|
|
381
|
+
return { start_time: last.end, end_time: last.end, timezone };
|
|
362
382
|
}
|
|
363
383
|
/** Data-affecting projection of the custom-session config (colors excluded):
|
|
364
|
-
* used for cache keys and refetch triggers. Empty string when inactive.
|
|
384
|
+
* used for cache keys and refetch triggers. Empty string when inactive. A
|
|
385
|
+
* UTC set without roles (every set saved before the New York clock) keys
|
|
386
|
+
* exactly as it always did, so its cached sessions stay warm; the clock and
|
|
387
|
+
* the roles join the key only where they are set (both change the rows). */
|
|
365
388
|
export function tpoCustomSessionsDataKey(settings) {
|
|
366
389
|
const segments = resolveTpoCustomSessionsSetting(settings);
|
|
367
390
|
if (!segments)
|
|
368
391
|
return '';
|
|
369
|
-
|
|
392
|
+
const key = JSON.stringify(segments.map(({ label, start, end, role }) => (role ? [label, start, end, role] : [label, start, end])));
|
|
393
|
+
return segments[0].timezone === 'ET' ? `ET:${key}` : key;
|
|
370
394
|
}
|
|
371
395
|
function toTpoCustomSessionWindow(segment, startDaySec) {
|
|
372
396
|
return {
|
|
@@ -377,9 +401,92 @@ function toTpoCustomSessionWindow(segment, startDaySec) {
|
|
|
377
401
|
color: segment.color,
|
|
378
402
|
};
|
|
379
403
|
}
|
|
380
|
-
|
|
381
|
-
|
|
404
|
+
const MS_PER_MINUTE = 60_000;
|
|
405
|
+
/** `zone`'s wall clock at `ms` as a UTC-shaped epoch; the instant itself where the zone clock serves none. */
|
|
406
|
+
function zoneWallMsOr(zone, ms) {
|
|
407
|
+
let wallMs;
|
|
408
|
+
try {
|
|
409
|
+
wallMs = zoneWallMsAt(zone, ms);
|
|
410
|
+
}
|
|
411
|
+
catch {
|
|
412
|
+
wallMs = Number.NaN;
|
|
413
|
+
}
|
|
414
|
+
return Number.isNaN(wallMs) ? ms : wallMs;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* The instant (unix seconds) `zone`'s wall clock reads `wallMs`; the wall reading itself where the clock serves none.
|
|
418
|
+
* A wall time the clock skips (the spring-forward hour) opens at the first instant reading at or after it, the change
|
|
419
|
+
* itself: the solver settles a skipped time on an instant reading earlier, and a session start read that way would
|
|
420
|
+
* open before the instant asked from (a walk over starts would stall on it).
|
|
421
|
+
*/
|
|
422
|
+
function zoneWallInstantSec(zone, wallMs) {
|
|
423
|
+
let ms;
|
|
424
|
+
try {
|
|
425
|
+
ms = zoneWallToUtcMs(zone, wallMs);
|
|
426
|
+
}
|
|
427
|
+
catch {
|
|
428
|
+
ms = Number.NaN;
|
|
429
|
+
}
|
|
430
|
+
if (Number.isNaN(ms))
|
|
431
|
+
return Math.floor(wallMs / 1000);
|
|
432
|
+
const readMs = zoneWallMsOr(zone, ms);
|
|
433
|
+
return Math.floor((readMs === wallMs ? ms : firstInstantReadingAtLeast(zone, wallMs, ms, readMs)) / 1000);
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* The first whole second whose `zone` wall reading is at least `wallMs`, for a skipped wall time: `ms` (reading
|
|
437
|
+
* `readMs`) sits on one side of the skipped span and the instant one span away on the other, so a bisection between
|
|
438
|
+
* them lands on the change. `ms` itself when the far side reads no later (no skipped span after all).
|
|
439
|
+
*/
|
|
440
|
+
function firstInstantReadingAtLeast(zone, wallMs, ms, readMs) {
|
|
441
|
+
let low = readMs < wallMs ? ms : ms - (readMs - wallMs);
|
|
442
|
+
let high = readMs < wallMs ? ms + (wallMs - readMs) : ms;
|
|
443
|
+
if (!(zoneWallMsOr(zone, high) >= wallMs) || zoneWallMsOr(zone, low) >= wallMs)
|
|
444
|
+
return ms;
|
|
445
|
+
for (let step = 0; step < 64 && high - low > 1000; step += 1) {
|
|
446
|
+
const mid = low + Math.floor((high - low) / 2000) * 1000;
|
|
447
|
+
if (zoneWallMsOr(zone, mid) >= wallMs)
|
|
448
|
+
high = mid;
|
|
449
|
+
else
|
|
450
|
+
low = mid;
|
|
451
|
+
}
|
|
452
|
+
return high;
|
|
453
|
+
}
|
|
454
|
+
function zonedTpoCustomSessionWindow(segment, dayWallMs, zone) {
|
|
455
|
+
return {
|
|
456
|
+
startSec: zoneWallInstantSec(zone, dayWallMs + segment.startMinute * MS_PER_MINUTE),
|
|
457
|
+
endSec: zoneWallInstantSec(zone, dayWallMs + segment.endMinute * MS_PER_MINUTE),
|
|
458
|
+
index: segment.index,
|
|
459
|
+
label: segment.label,
|
|
460
|
+
color: segment.color,
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
/** A New York set's day: its segments are wall-clock minutes on the New York
|
|
464
|
+
* date, each edge converted on its own date, so a session keeps its wall
|
|
465
|
+
* hours across daylight saving (the 23 and 25 hour days included). */
|
|
466
|
+
function newYorkTpoCustomSessionDay(timestamp, segments) {
|
|
467
|
+
const zone = segments[0].zone || timezoneName('ET');
|
|
468
|
+
const wallMs = zoneWallMsOr(zone, timestamp * 1000);
|
|
469
|
+
const dayWallMs = Math.floor(wallMs / DAY_MS) * DAY_MS;
|
|
470
|
+
return { zone, dayWallMs, minuteOfDay: (wallMs - dayWallMs) / MS_PER_MINUTE };
|
|
471
|
+
}
|
|
472
|
+
/** The segment window containing `timestamp` (unix seconds), or null when
|
|
473
|
+
* the timestamp falls in a gap between segments. Segments read on their
|
|
474
|
+
* set's clock: UTC days, or New York days for a New York set. */
|
|
382
475
|
export function getTpoCustomSessionWindow(timestamp, segments) {
|
|
476
|
+
if (segments[0]?.timezone === 'ET') {
|
|
477
|
+
const { zone, dayWallMs, minuteOfDay: wallMinute } = newYorkTpoCustomSessionDay(timestamp, segments);
|
|
478
|
+
const minuteOfDay = Math.floor(wallMinute);
|
|
479
|
+
const last = segments[segments.length - 1];
|
|
480
|
+
if (minuteOfDay < last.endMinute - MINUTES_PER_DAY) {
|
|
481
|
+
return zonedTpoCustomSessionWindow(last, dayWallMs - DAY_MS, zone);
|
|
482
|
+
}
|
|
483
|
+
for (const segment of segments) {
|
|
484
|
+
if (minuteOfDay >= segment.startMinute && minuteOfDay < segment.endMinute) {
|
|
485
|
+
return zonedTpoCustomSessionWindow(segment, dayWallMs, zone);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return null;
|
|
489
|
+
}
|
|
383
490
|
const dayStart = dayjs.unix(timestamp).utc().startOf('day').unix();
|
|
384
491
|
const minuteOfDay = Math.floor((timestamp - dayStart) / 60);
|
|
385
492
|
// The post-midnight tail of the wrapping segment (always the last one)
|
|
@@ -396,8 +503,25 @@ export function getTpoCustomSessionWindow(timestamp, segments) {
|
|
|
396
503
|
return null;
|
|
397
504
|
}
|
|
398
505
|
/** The next segment start strictly after `timestamp` (same day or the first
|
|
399
|
-
* segment of the next day). */
|
|
506
|
+
* segment of the next day), on the set's clock. */
|
|
400
507
|
export function getNextTpoCustomSessionStart(timestamp, segments) {
|
|
508
|
+
if (segments[0]?.timezone === 'ET') {
|
|
509
|
+
// Starts in wall order (today's later ones, then each next day's); the first instant strictly after `timestamp`
|
|
510
|
+
// wins. A start the clock repeats (the fall-back hour) opens once, on its first pass, so from the second pass it
|
|
511
|
+
// lies behind `timestamp` and is passed over: every step moves forward, and no walk over the starts stalls.
|
|
512
|
+
const { zone, dayWallMs, minuteOfDay } = newYorkTpoCustomSessionDay(timestamp, segments);
|
|
513
|
+
for (let day = 0; day <= 2; day += 1) {
|
|
514
|
+
for (const segment of segments) {
|
|
515
|
+
if (day === 0 && segment.startMinute <= minuteOfDay)
|
|
516
|
+
continue;
|
|
517
|
+
const startSec = zoneWallInstantSec(zone, dayWallMs + day * DAY_MS + segment.startMinute * MS_PER_MINUTE);
|
|
518
|
+
if (startSec > timestamp)
|
|
519
|
+
return startSec;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
// Unreachable while the zone clock serves (the next day's first start lies a day ahead); still a step forward.
|
|
523
|
+
return Math.floor(timestamp) + SECONDS_PER_DAY;
|
|
524
|
+
}
|
|
401
525
|
const dayStart = dayjs.unix(timestamp).utc().startOf('day').unix();
|
|
402
526
|
const minuteOfDay = (timestamp - dayStart) / 60;
|
|
403
527
|
for (const segment of segments) {
|
|
@@ -29,4 +29,10 @@ export interface OptionInstrumentSnapshot {
|
|
|
29
29
|
updatedAtMs: number;
|
|
30
30
|
/** Venue vega (price change per 1 IV point). Optional: older fixtures omit it. */
|
|
31
31
|
vega?: number;
|
|
32
|
+
/**
|
|
33
|
+
* The options venue the row was read from (an `OptionVenue` id: `deribit`, `okx-options`, ...), stamped by the
|
|
34
|
+
* crypto chain refresh, so the book rule (utility/options/option-book.util.ts, C0) parses the symbol at its venue
|
|
35
|
+
* and keeps each venue of a merged board apart. Absent on governed chains (one book per product) and fixtures.
|
|
36
|
+
*/
|
|
37
|
+
venue?: string;
|
|
32
38
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type OptionTradeUnits } from '../../utility/options/option-trade-units.util.js';
|
|
2
2
|
export declare const LIVE_MAX_CELLS_PER_BAR = 20000;
|
|
3
|
+
/** The most prints one history ask reads (the history worker's cap, mirroring the historical service's
|
|
4
|
+
* HIST_TRADES_MAX_CELLS): past it the ask fails loudly instead of truncating the tape, and the wrun tape's refusal
|
|
5
|
+
* names the same number. */
|
|
6
|
+
export declare const TRADES_HISTORY_MAX_CELLS = 300000;
|
|
3
7
|
/** The raw TRADE table's retention (about two days): a seeded history ask never reaches behind
|
|
4
8
|
* it (older windows answer nothing and cost the gateway a scan over cold chunks). */
|
|
5
9
|
export declare const TRADES_RETENTION_SEC: number;
|
|
@@ -22,6 +22,10 @@ import { cmeSessionBarEndMs, cmeSessionBarOpenMs, cmeSessionBucketMs, isCmeSessi
|
|
|
22
22
|
import { findMonday } from '../../workers/utils/time.worker.util.js';
|
|
23
23
|
import { liveOptionPrintPremium } from '../../utility/options/option-trade-units.util.js';
|
|
24
24
|
export const LIVE_MAX_CELLS_PER_BAR = 20_000;
|
|
25
|
+
/** The most prints one history ask reads (the history worker's cap, mirroring the historical service's
|
|
26
|
+
* HIST_TRADES_MAX_CELLS): past it the ask fails loudly instead of truncating the tape, and the wrun tape's refusal
|
|
27
|
+
* names the same number. */
|
|
28
|
+
export const TRADES_HISTORY_MAX_CELLS = 300_000;
|
|
25
29
|
/** The raw TRADE table's retention (about two days): a seeded history ask never reaches behind
|
|
26
30
|
* it (older windows answer nothing and cost the gateway a scan over cold chunks). */
|
|
27
31
|
export const TRADES_RETENTION_SEC = 2 * 24 * 3600;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { SettingsFormModel, SettingsFormRow } from './form-rows.js';
|
|
2
|
+
/**
|
|
3
|
+
* The footprint's two one-click controls as rows a host's settings form draws (the row shape: ./form-rows.ts), one
|
|
4
|
+
* group per slot of both web footprint dialogs (footprintSettingsTabs: the General tab's Display group):
|
|
5
|
+
*
|
|
6
|
+
* - `sierra-look`: Classic Presets, one action row whose Apply writes withFootprintSierraLook. The UI calls it Classic
|
|
7
|
+
* Presets and never names Sierra Chart; the code name stays. Web: FootprintSierraLookRow.vue.
|
|
8
|
+
* - `footprint-columns`: the Columns picker. The Display Mode select comes first, in every mode (Columns is one of its
|
|
9
|
+
* options, and a pick writes withFootprintDisplayMode). In the Columns mode the four presets follow as chips, then
|
|
10
|
+
* one select per drawn column, left to right, and one more reading Off while there is room: column 4 shows once
|
|
11
|
+
* column 3 is on. Columns 1 and 2 offer no Off, so the layout never drops under two columns. Web: the dialogs'
|
|
12
|
+
* display mode row and FootprintColumnsPicker.vue. A host that draws this group draws its display mode through it,
|
|
13
|
+
* never beside it.
|
|
14
|
+
*
|
|
15
|
+
* Every word is the key web's rows print, and every key a row writes is a preference in the footprint's field table
|
|
16
|
+
* (./indicator-fields.ts), which the workspace row, a template and a saved default keep.
|
|
17
|
+
*/
|
|
18
|
+
/** The groups a host draws, by the slot names of both web footprint dialogs. */
|
|
19
|
+
export declare const FOOTPRINT_FORM_SLOTS: readonly ["sierra-look", "footprint-columns"];
|
|
20
|
+
export type FootprintFormSlot = (typeof FOOTPRINT_FORM_SLOTS)[number];
|
|
21
|
+
/**
|
|
22
|
+
* The rows of one group for `model`, top to bottom: `sierra-look` is the Classic Presets row; `footprint-columns` is
|
|
23
|
+
* the Display Mode row, then, in the Columns mode, the presets and the column rows.
|
|
24
|
+
*/
|
|
25
|
+
export declare function footprintFormRows(slot: FootprintFormSlot, model: SettingsFormModel): SettingsFormRow[];
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { FOOTPRINT_COLUMN_KINDS, FOOTPRINT_COLUMN_PRESETS, FOOTPRINT_COLUMNS_MAX, FOOTPRINT_COLUMNS_MIN, footprintColumnsPresetOf, footprintColumnsShown, isFootprintColumnsMode, withFootprintColumn, withFootprintColumnsPreset, } from '../utility/chart/footprint-columns.util.js';
|
|
2
|
+
import { FOOTPRINT_DISPLAY_MODES, footprintDisplayModeShown, withFootprintDisplayMode, } from '../utility/chart/footprint-display-mode.util.js';
|
|
3
|
+
import { withFootprintSierraLook } from '../utility/chart/footprint-sierra-look.util.js';
|
|
4
|
+
/**
|
|
5
|
+
* The footprint's two one-click controls as rows a host's settings form draws (the row shape: ./form-rows.ts), one
|
|
6
|
+
* group per slot of both web footprint dialogs (footprintSettingsTabs: the General tab's Display group):
|
|
7
|
+
*
|
|
8
|
+
* - `sierra-look`: Classic Presets, one action row whose Apply writes withFootprintSierraLook. The UI calls it Classic
|
|
9
|
+
* Presets and never names Sierra Chart; the code name stays. Web: FootprintSierraLookRow.vue.
|
|
10
|
+
* - `footprint-columns`: the Columns picker. The Display Mode select comes first, in every mode (Columns is one of its
|
|
11
|
+
* options, and a pick writes withFootprintDisplayMode). In the Columns mode the four presets follow as chips, then
|
|
12
|
+
* one select per drawn column, left to right, and one more reading Off while there is room: column 4 shows once
|
|
13
|
+
* column 3 is on. Columns 1 and 2 offer no Off, so the layout never drops under two columns. Web: the dialogs'
|
|
14
|
+
* display mode row and FootprintColumnsPicker.vue. A host that draws this group draws its display mode through it,
|
|
15
|
+
* never beside it.
|
|
16
|
+
*
|
|
17
|
+
* Every word is the key web's rows print, and every key a row writes is a preference in the footprint's field table
|
|
18
|
+
* (./indicator-fields.ts), which the workspace row, a template and a saved default keep.
|
|
19
|
+
*/
|
|
20
|
+
/** The groups a host draws, by the slot names of both web footprint dialogs. */
|
|
21
|
+
export const FOOTPRINT_FORM_SLOTS = ['sierra-look', 'footprint-columns'];
|
|
22
|
+
const DISPLAY_MODE_WORDS = {
|
|
23
|
+
'split-bar': 'indicators.settings.options.split',
|
|
24
|
+
'stacked-bar-delta': 'indicators.settings.options.delta',
|
|
25
|
+
'stacked-bar': 'indicators.settings.options.total',
|
|
26
|
+
cluster: 'indicators.settings.options.cluster',
|
|
27
|
+
'imbalance-only': 'dialogs.overlayStylesSettings.displayModeImbalanceOnly',
|
|
28
|
+
ladder: 'dialogs.overlayStylesSettings.displayModeLadder',
|
|
29
|
+
columns: 'indicators.settings.footprintLook.columns.mode',
|
|
30
|
+
};
|
|
31
|
+
const PRESET_WORDS = {
|
|
32
|
+
bidAskDelta: 'indicators.settings.footprintLook.columns.presetBidAskDelta',
|
|
33
|
+
deltaVolumeBar: 'indicators.settings.footprintLook.columns.presetDeltaVolumeBar',
|
|
34
|
+
volumeDeltaBars: 'indicators.settings.footprintLook.columns.presetVolumeDeltaBars',
|
|
35
|
+
profileBars: 'indicators.settings.footprintLook.columns.presetProfileBars',
|
|
36
|
+
};
|
|
37
|
+
const KIND_WORDS = {
|
|
38
|
+
bidAsk: 'indicators.settings.footprintLook.columns.kinds.bidAsk',
|
|
39
|
+
delta: 'indicators.settings.footprintLook.columns.kinds.delta',
|
|
40
|
+
deltaColored: 'indicators.settings.footprintLook.columns.kinds.deltaColored',
|
|
41
|
+
diagonalDelta: 'indicators.settings.footprintLook.columns.kinds.diagonalDelta',
|
|
42
|
+
deltaPct: 'indicators.settings.footprintLook.columns.kinds.deltaPct',
|
|
43
|
+
volume: 'indicators.settings.footprintLook.columns.kinds.volume',
|
|
44
|
+
buy: 'indicators.settings.footprintLook.columns.kinds.buy',
|
|
45
|
+
sell: 'indicators.settings.footprintLook.columns.kinds.sell',
|
|
46
|
+
volumeBar: 'indicators.settings.footprintLook.columns.kinds.volumeBar',
|
|
47
|
+
deltaBar: 'indicators.settings.footprintLook.columns.kinds.deltaBar',
|
|
48
|
+
volumeBarLeading: 'indicators.settings.footprintLook.columns.kinds.volumeBarLeading',
|
|
49
|
+
splitBar: 'indicators.settings.footprintLook.columns.kinds.splitBar',
|
|
50
|
+
};
|
|
51
|
+
const OFF_WORDS = 'indicators.settings.options.off';
|
|
52
|
+
const words = (key, params) => params ? { key, params } : { key };
|
|
53
|
+
/**
|
|
54
|
+
* A choice row whose pick writes through `write`. Only an option is ever on (a saved value no option names, such as
|
|
55
|
+
* an unknown display mode, shows none) and only an option is ever written (a value no option names writes nothing).
|
|
56
|
+
*/
|
|
57
|
+
function choiceRow(row, write) {
|
|
58
|
+
const offered = new Set(row.options.map((option) => option.value));
|
|
59
|
+
return {
|
|
60
|
+
kind: 'choice',
|
|
61
|
+
...row,
|
|
62
|
+
value: row.value !== null && offered.has(row.value) ? row.value : null,
|
|
63
|
+
pick: (model, value) => (offered.has(value) ? write(model, value) : model),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function classicPresetsRow() {
|
|
67
|
+
return {
|
|
68
|
+
kind: 'action',
|
|
69
|
+
id: 'sierra-look',
|
|
70
|
+
label: words('indicators.settings.footprintLook.sierraLook'),
|
|
71
|
+
tooltip: words('indicators.settings.footprintLook.sierraLookTooltip'),
|
|
72
|
+
action: words('indicators.settings.footprintLook.sierraLookApply'),
|
|
73
|
+
apply: (model) => withFootprintSierraLook(model),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function displayModeRow(model) {
|
|
77
|
+
return choiceRow({
|
|
78
|
+
id: 'display-mode',
|
|
79
|
+
label: words('indicators.settings.displayMode'),
|
|
80
|
+
tooltip: words('dialogs.overlayStylesSettings.displayModeTooltip'),
|
|
81
|
+
look: 'select',
|
|
82
|
+
options: FOOTPRINT_DISPLAY_MODES.map((value) => ({ value, label: words(DISPLAY_MODE_WORDS[value]) })),
|
|
83
|
+
value: footprintDisplayModeShown(model),
|
|
84
|
+
}, (current, value) => withFootprintDisplayMode(current, value));
|
|
85
|
+
}
|
|
86
|
+
function columnsPresetsRow(model) {
|
|
87
|
+
return choiceRow({
|
|
88
|
+
id: 'columns-presets',
|
|
89
|
+
label: words('indicators.settings.footprintLook.columns.presets'),
|
|
90
|
+
tooltip: words('indicators.settings.footprintLook.columns.presetsTooltip'),
|
|
91
|
+
look: 'chips',
|
|
92
|
+
options: FOOTPRINT_COLUMN_PRESETS.map(({ id }) => ({ value: id, label: words(PRESET_WORDS[id]) })),
|
|
93
|
+
// None is lit for a layout of the user's own.
|
|
94
|
+
value: footprintColumnsPresetOf(model),
|
|
95
|
+
},
|
|
96
|
+
// A chip is a choice, not a switch: a pick of the lit one keeps it.
|
|
97
|
+
(current, value) => footprintColumnsPresetOf(current) === value
|
|
98
|
+
? current
|
|
99
|
+
: withFootprintColumnsPreset(current, value));
|
|
100
|
+
}
|
|
101
|
+
/** One select per drawn column, and one more reading Off while there is room. */
|
|
102
|
+
function columnRows(model) {
|
|
103
|
+
const columns = footprintColumnsShown(model);
|
|
104
|
+
const kindOptions = () => FOOTPRINT_COLUMN_KINDS.map((kind) => ({ value: kind, label: words(KIND_WORDS[kind]) }));
|
|
105
|
+
return Array.from({ length: Math.min(FOOTPRINT_COLUMNS_MAX, columns.length + 1) }, (_, index) => choiceRow({
|
|
106
|
+
id: `column-${index + 1}`,
|
|
107
|
+
label: words('indicators.settings.footprintLook.columns.column', { n: index + 1 }),
|
|
108
|
+
tooltip: words('indicators.settings.footprintLook.columns.columnTooltip'),
|
|
109
|
+
look: 'select',
|
|
110
|
+
options: index < FOOTPRINT_COLUMNS_MIN ? kindOptions() : [{ value: 'off', label: words(OFF_WORDS) }, ...kindOptions()],
|
|
111
|
+
value: columns[index] ?? 'off',
|
|
112
|
+
}, (current, value) => withFootprintColumn(current, index, value)));
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The rows of one group for `model`, top to bottom: `sierra-look` is the Classic Presets row; `footprint-columns` is
|
|
116
|
+
* the Display Mode row, then, in the Columns mode, the presets and the column rows.
|
|
117
|
+
*/
|
|
118
|
+
export function footprintFormRows(slot, model) {
|
|
119
|
+
if (slot === 'sierra-look')
|
|
120
|
+
return [classicPresetsRow()];
|
|
121
|
+
if (slot !== 'footprint-columns')
|
|
122
|
+
return [];
|
|
123
|
+
const rows = [displayModeRow(model)];
|
|
124
|
+
if (isFootprintColumnsMode(model))
|
|
125
|
+
rows.push(columnsPresetsRow(model), ...columnRows(model));
|
|
126
|
+
return rows;
|
|
127
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The row shape a host's settings form draws for a control the package describes (the footprint's Classic Presets and
|
|
3
|
+
* Columns: ./footprint-rows.ts). The field tables beside it (./indicator-fields.ts) name which keys each lane keeps and
|
|
4
|
+
* cannot say what a row shows or writes, so a described control rides this shape. It is renderer-agnostic and holds
|
|
5
|
+
* no words: a row names its words as locale keys, which the host translates with its own dictionary (web's i18n, the
|
|
6
|
+
* phone's word table), says what it shows for the model it was built for, and answers the model a click or a pick
|
|
7
|
+
* writes. The host's control applies that model, as a web slot row hands its dialog the model to apply and confirm.
|
|
8
|
+
*
|
|
9
|
+
* - `action`: a label and one button (`action` words). `apply(model)` answers the model the click writes.
|
|
10
|
+
* - `choice`: one value among `options`, drawn as a drop-down (`select`) or as chips (`chips`: each chip is a choice,
|
|
11
|
+
* never a switch). `value` is the option that is on for the model the row was built for, or null when none is (a
|
|
12
|
+
* layout of the user's own lights no preset). `pick(model, value)` answers the model the pick writes, and the model
|
|
13
|
+
* itself (the same object) when the pick writes nothing (a value no option names, or the lit chip): the host then
|
|
14
|
+
* applies nothing.
|
|
15
|
+
*
|
|
16
|
+
* A row is built for one model. After an apply the host builds the rows again from the model it now holds, since their
|
|
17
|
+
* values, and which rows show, follow the model. `apply` and `pick` take the host's current model, never a copy.
|
|
18
|
+
*/
|
|
19
|
+
/** Words a host prints: a locale key, and the params its text fills (`{n}`). */
|
|
20
|
+
export interface SettingsFormWords {
|
|
21
|
+
readonly key: string;
|
|
22
|
+
readonly params?: Readonly<Record<string, string | number>>;
|
|
23
|
+
}
|
|
24
|
+
/** One option of a choice row: the value a pick writes, and its words. */
|
|
25
|
+
export interface SettingsFormOption {
|
|
26
|
+
readonly value: string;
|
|
27
|
+
readonly label: SettingsFormWords;
|
|
28
|
+
}
|
|
29
|
+
/** The settings bag a row reads and writes (an overlay's settings). */
|
|
30
|
+
export type SettingsFormModel = Record<string, unknown>;
|
|
31
|
+
interface SettingsFormRowBase {
|
|
32
|
+
/** Unique among the rows of one build: the host's key, and the stem of its test id. */
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly label: SettingsFormWords;
|
|
35
|
+
readonly tooltip?: SettingsFormWords;
|
|
36
|
+
}
|
|
37
|
+
/** A label and one button. */
|
|
38
|
+
export interface SettingsFormActionRow extends SettingsFormRowBase {
|
|
39
|
+
readonly kind: 'action';
|
|
40
|
+
/** The button's words. */
|
|
41
|
+
readonly action: SettingsFormWords;
|
|
42
|
+
/** The model the click writes. */
|
|
43
|
+
apply<M extends SettingsFormModel>(model: M): M;
|
|
44
|
+
}
|
|
45
|
+
/** One value among options. */
|
|
46
|
+
export interface SettingsFormChoiceRow extends SettingsFormRowBase {
|
|
47
|
+
readonly kind: 'choice';
|
|
48
|
+
readonly look: 'select' | 'chips';
|
|
49
|
+
readonly options: readonly SettingsFormOption[];
|
|
50
|
+
/** The option on for the model the row was built for; null when none is. */
|
|
51
|
+
readonly value: string | null;
|
|
52
|
+
/** The model the pick writes; the model itself when the pick writes nothing. */
|
|
53
|
+
pick<M extends SettingsFormModel>(model: M, value: string): M;
|
|
54
|
+
}
|
|
55
|
+
export type SettingsFormRow = SettingsFormActionRow | SettingsFormChoiceRow;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The row shape a host's settings form draws for a control the package describes (the footprint's Classic Presets and
|
|
3
|
+
* Columns: ./footprint-rows.ts). The field tables beside it (./indicator-fields.ts) name which keys each lane keeps and
|
|
4
|
+
* cannot say what a row shows or writes, so a described control rides this shape. It is renderer-agnostic and holds
|
|
5
|
+
* no words: a row names its words as locale keys, which the host translates with its own dictionary (web's i18n, the
|
|
6
|
+
* phone's word table), says what it shows for the model it was built for, and answers the model a click or a pick
|
|
7
|
+
* writes. The host's control applies that model, as a web slot row hands its dialog the model to apply and confirm.
|
|
8
|
+
*
|
|
9
|
+
* - `action`: a label and one button (`action` words). `apply(model)` answers the model the click writes.
|
|
10
|
+
* - `choice`: one value among `options`, drawn as a drop-down (`select`) or as chips (`chips`: each chip is a choice,
|
|
11
|
+
* never a switch). `value` is the option that is on for the model the row was built for, or null when none is (a
|
|
12
|
+
* layout of the user's own lights no preset). `pick(model, value)` answers the model the pick writes, and the model
|
|
13
|
+
* itself (the same object) when the pick writes nothing (a value no option names, or the lit chip): the host then
|
|
14
|
+
* applies nothing.
|
|
15
|
+
*
|
|
16
|
+
* A row is built for one model. After an apply the host builds the rows again from the model it now holds, since their
|
|
17
|
+
* values, and which rows show, follow the model. `apply` and `pick` take the host's current model, never a copy.
|
|
18
|
+
*/
|
|
19
|
+
export {};
|
|
@@ -105,4 +105,18 @@ export const FRVP_FIELD_ROWS = [
|
|
|
105
105
|
['showVAL', PREFERENCE],
|
|
106
106
|
['valColor', PREFERENCE],
|
|
107
107
|
['showVALLabel', PREFERENCE],
|
|
108
|
+
// Sierra parity: naked lines, stepped shading, printed stats and the level-line look the FRVP tool now reads.
|
|
109
|
+
['showPOCNaked', PREFERENCE],
|
|
110
|
+
['showVAHNaked', PREFERENCE],
|
|
111
|
+
['showVALNaked', PREFERENCE],
|
|
112
|
+
['cellShading', PREFERENCE],
|
|
113
|
+
['shadingSteps', PREFERENCE],
|
|
114
|
+
['shadingThresholds', PREFERENCE],
|
|
115
|
+
['shadingStepColors', PREFERENCE],
|
|
116
|
+
['profileStats', PREFERENCE],
|
|
117
|
+
['profileStatsPosition', PREFERENCE],
|
|
118
|
+
['levelLineWidth', PREFERENCE],
|
|
119
|
+
['levelLineStyle', PREFERENCE],
|
|
120
|
+
// Stamped on every mount in the reader's language: mirrored so the box prints it, never saved.
|
|
121
|
+
['profileStatsLabels', { owner: 'profile', lanes: ['mirror'] }],
|
|
108
122
|
];
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { type ToolTextRole } from './tool-rules.js';
|
|
1
2
|
import { TOOL_DEFAULT_STYLE, TOOL_TEMPLATE_KEYS } from './tool-tables.generated.js';
|
|
2
3
|
export { TOOL_DEFAULT_STYLE, TOOL_TEMPLATE_KEYS };
|
|
4
|
+
export type { ToolTextRole };
|
|
3
5
|
export type TemplateKind = 'indicator' | 'tool';
|
|
4
6
|
export type FieldLane = 'row' | 'template' | 'default' | 'mirror';
|
|
5
7
|
export type FieldOwner = 'settings' | 'meta' | 'box' | 'profile';
|
|
@@ -12,7 +14,7 @@ export interface FieldSpec {
|
|
|
12
14
|
instance?: boolean;
|
|
13
15
|
/** An absolute in the market's own units: written only onto the market the template was saved on. */
|
|
14
16
|
marketBound?: boolean;
|
|
15
|
-
/** A drawing's label (the tool rules'
|
|
17
|
+
/** A drawing's label (a `label` text, by the tool rules' text rule): an empty one is neither captured nor written. */
|
|
16
18
|
label?: boolean;
|
|
17
19
|
/** The serialisable value a capture writes where the engine holds none ("all"), when the field declares one. */
|
|
18
20
|
unset?: unknown;
|
|
@@ -69,6 +71,13 @@ export declare class TemplateSchemaVersionError extends Error {
|
|
|
69
71
|
}
|
|
70
72
|
/** Whether a drawing type keeps the "Show on" intervals it was drawn with, whatever a template holds. */
|
|
71
73
|
export declare function isIntervalBoundTool(type: string): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* What a drawing type's free text is, by the tool rules' text rule over the type's style in the shipped tables
|
|
76
|
+
* (textRoleOf): its `label` (a template carries it), its `content` (a template never does), a text its engine never
|
|
77
|
+
* draws (`ignored`), or undefined when the type holds none. A host's text box reads this, the same rule the template
|
|
78
|
+
* tables were generated with, so the box never offers a label that a template drops.
|
|
79
|
+
*/
|
|
80
|
+
export declare function toolTextRole(type: string): ToolTextRole | undefined;
|
|
72
81
|
/**
|
|
73
82
|
* Every field a type declares, with what each lane keeps. For a technical script `ctx` adds its declared inputs and
|
|
74
83
|
* viewer rows (a script's filing key, `TECHNICAL_SCRIPT:<identity>`, reads as its type). The specs are frozen.
|
|
@@ -46,7 +46,7 @@ import cloneDeep from 'lodash-es/cloneDeep.js';
|
|
|
46
46
|
import { isWrunViewerRowKey } from '../utility/wrun/wrun-color-facts.util.js';
|
|
47
47
|
import { FRVP_FIELD_ROWS, FRVP_TOOL_TYPE } from './frvp-fields.js';
|
|
48
48
|
import { INDICATOR_COMMON_FIELDS, INDICATOR_TYPE_FIELDS, RESERVED_SCRIPT_INPUT_NAMES, SCRIPT_INDICATOR_TYPE, SCRIPT_INPUT_FIELD, VIEWER_ROW_FIELD, } from './indicator-fields.js';
|
|
49
|
-
import { TOOL_TEMPLATE_RULES } from './tool-rules.js';
|
|
49
|
+
import { textRoleOf, TOOL_TEMPLATE_RULES } from './tool-rules.js';
|
|
50
50
|
import { TOOL_DEFAULT_STYLE, TOOL_TEMPLATE_KEYS } from './tool-tables.generated.js';
|
|
51
51
|
export { TOOL_DEFAULT_STYLE, TOOL_TEMPLATE_KEYS };
|
|
52
52
|
/** The schema version a capture stamps on the template envelope (never inside the settings bag). */
|
|
@@ -73,7 +73,7 @@ const RESERVED_INPUT_NAMES = new Set(RESERVED_SCRIPT_INPUT_NAMES);
|
|
|
73
73
|
/** Names an object prototype reserves: never a field, whatever a script declares (a write would reach the prototype). */
|
|
74
74
|
const PROTOTYPE_NAMES = new Set(['__proto__', 'constructor', 'prototype']);
|
|
75
75
|
const TOOL_INSTANCE_KEYS = TOOL_TEMPLATE_RULES.instanceKeys;
|
|
76
|
-
const LABEL_KEY = TOOL_TEMPLATE_RULES.
|
|
76
|
+
const LABEL_KEY = TOOL_TEMPLATE_RULES.text.key;
|
|
77
77
|
const INTERVAL_BOUND_TYPES = new Set(TOOL_TEMPLATE_RULES.intervalBoundTypes);
|
|
78
78
|
const DEFAULT_EXCLUDED_KEYS = new Set(TOOL_TEMPLATE_RULES.defaultExcludedKeys);
|
|
79
79
|
const DEFAULT_EXCLUDED_TYPES = new Set(TOOL_TEMPLATE_RULES.defaultExcludedTypes);
|
|
@@ -89,6 +89,15 @@ const isFrvpOwner = (owner) => owner === 'box' || owner === 'profile';
|
|
|
89
89
|
export function isIntervalBoundTool(type) {
|
|
90
90
|
return INTERVAL_BOUND_TYPES.has(type);
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* What a drawing type's free text is, by the tool rules' text rule over the type's style in the shipped tables
|
|
94
|
+
* (textRoleOf): its `label` (a template carries it), its `content` (a template never does), a text its engine never
|
|
95
|
+
* draws (`ignored`), or undefined when the type holds none. A host's text box reads this, the same rule the template
|
|
96
|
+
* tables were generated with, so the box never offers a label that a template drops.
|
|
97
|
+
*/
|
|
98
|
+
export function toolTextRole(type) {
|
|
99
|
+
return textRoleOf(type, ownRecord(TOOL_DEFAULT_STYLE, type));
|
|
100
|
+
}
|
|
92
101
|
function specOf(key, field) {
|
|
93
102
|
const spec = { key, owner: field.owner ?? 'settings', lanes: Object.freeze([...field.lanes]) };
|
|
94
103
|
if (field.instance)
|