@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
|
@@ -695,6 +695,72 @@ export const INDICATOR_COMMON_FIELDS = [
|
|
|
695
695
|
// The volumetric size window is a volume in those same units.
|
|
696
696
|
['sizeCeil', META_MARKET_BOUND],
|
|
697
697
|
['venueChoice', META_VENUE_CHOICE],
|
|
698
|
+
// Sierra parity (2026-10-21): every key absent = today's look. Appended as one block so the row-keys golden names
|
|
699
|
+
// them as one later addition (LATER_SHARED_ROW_KEYS in its spec).
|
|
700
|
+
// TPO look, structure and period keys the settings dialog and the period menu write.
|
|
701
|
+
['fontFamily', PREFERENCE],
|
|
702
|
+
['fontWeight', PREFERENCE],
|
|
703
|
+
['deltaColors', PREFERENCE],
|
|
704
|
+
['tpoColorEachSession', PREFERENCE],
|
|
705
|
+
['tpoSessionColors', PREFERENCE],
|
|
706
|
+
['valueAreaMethod', PREFERENCE],
|
|
707
|
+
['vaFromVolume', PREFERENCE],
|
|
708
|
+
['levelLineExtend', PREFERENCE],
|
|
709
|
+
['priorLevelsEverySession', PREFERENCE],
|
|
710
|
+
// Peaks and valleys (HVN/LVN): TPO and the volume profiles share these keys.
|
|
711
|
+
['peaksValleys', PREFERENCE],
|
|
712
|
+
['peaksValleysSensitivity', PREFERENCE],
|
|
713
|
+
['hvnColor', PREFERENCE],
|
|
714
|
+
['lvnColor', PREFERENCE],
|
|
715
|
+
['showIBLines', PREFERENCE],
|
|
716
|
+
['ibExtensionPercents', PREFERENCE],
|
|
717
|
+
['ibLineColor', PREFERENCE],
|
|
718
|
+
['ibExtensionColor', PREFERENCE],
|
|
719
|
+
['openingRangeMinutes', PREFERENCE],
|
|
720
|
+
['closingRangeMinutes', PREFERENCE],
|
|
721
|
+
['showMidpoint', PREFERENCE],
|
|
722
|
+
['midpointColor', PREFERENCE],
|
|
723
|
+
['statsItems', PREFERENCE],
|
|
724
|
+
['statsLastProfileOnly', PREFERENCE],
|
|
725
|
+
['statsOnHover', PREFERENCE],
|
|
726
|
+
['splitPeriodsMap', PREFERENCE],
|
|
727
|
+
['periodLength', PREFERENCE],
|
|
728
|
+
['ownColumnBesideStandard', PREFERENCE],
|
|
729
|
+
['hideEveningExceptLatest', PREFERENCE],
|
|
730
|
+
// VRVP / Agg VRVP Last bars and Last days scopes: the bar and trading-day counts (stamped only on rows that use them).
|
|
731
|
+
['compositeBars', PREFERENCE],
|
|
732
|
+
['compositeDays', PREFERENCE],
|
|
733
|
+
// SVP / Agg SVP Custom session: the block length ({ count, unit }); `session` carries the derived ms.
|
|
734
|
+
['customSessionLength', PREFERENCE],
|
|
735
|
+
// Volume profiles: the printed profile stats (profileStatsLabels is derived on every mount and never declared).
|
|
736
|
+
['profileStats', PREFERENCE],
|
|
737
|
+
['profileStatsPosition', PREFERENCE],
|
|
738
|
+
// Volume profile level extras (titan profileLevels.ts), the level-line look and the row number format.
|
|
739
|
+
['showVWAP', PREFERENCE],
|
|
740
|
+
['vwapColor', PREFERENCE],
|
|
741
|
+
['showVWAPLabel', PREFERENCE],
|
|
742
|
+
['levelLineWidth', PREFERENCE],
|
|
743
|
+
['levelLineStyle', PREFERENCE],
|
|
744
|
+
['rowText', PREFERENCE],
|
|
745
|
+
// Footprint live animation (the Animate Live Updates switch writes both); absent = titan's on.
|
|
746
|
+
['liveFlash', PREFERENCE],
|
|
747
|
+
['liveGrowth', PREFERENCE],
|
|
748
|
+
// Stepped shading: footprint cells and volume-profile bars (heat by % of the POC) share these keys.
|
|
749
|
+
['cellShading', PREFERENCE],
|
|
750
|
+
['shadingSteps', PREFERENCE],
|
|
751
|
+
['shadingThresholds', PREFERENCE],
|
|
752
|
+
['shadingStepColors', PREFERENCE],
|
|
753
|
+
// Footprint Sierra look and columns layout.
|
|
754
|
+
['highlightExtremes', PREFERENCE],
|
|
755
|
+
['highlightMaxColor', PREFERENCE],
|
|
756
|
+
['highlightMinColor', PREFERENCE],
|
|
757
|
+
['imbalanceMethod', PREFERENCE],
|
|
758
|
+
['imbalanceMinVolume', PREFERENCE],
|
|
759
|
+
['cellFontSize', PREFERENCE],
|
|
760
|
+
['fullNumbers', PREFERENCE],
|
|
761
|
+
['showValueAreaBand', PREFERENCE],
|
|
762
|
+
['candleMarker', PREFERENCE],
|
|
763
|
+
['footprintColumns', PREFERENCE],
|
|
698
764
|
];
|
|
699
765
|
/**
|
|
700
766
|
* FEED (live series, docs/features/indicators/feeds.md): the rest of the C4 record beside `address`, `scope` and
|
|
@@ -733,6 +799,11 @@ const METRIC_PROFILE_FIELDS = [
|
|
|
733
799
|
* generic, and declared for every overlay it would start persisting other natives' engine keys.
|
|
734
800
|
*/
|
|
735
801
|
const SYMBOL_COMPARISON_FIELDS = [['label', INSTANCE]];
|
|
802
|
+
/** The VRVP own-window scope rows (see INDICATOR_TYPE_FIELDS below). */
|
|
803
|
+
const VISIBLE_RANGE_PROFILE_FIELDS = [
|
|
804
|
+
['profileWindow', PREFERENCE],
|
|
805
|
+
['periodMarkers', PREFERENCE],
|
|
806
|
+
];
|
|
736
807
|
/**
|
|
737
808
|
* The fields one indicator type declares beyond INDICATOR_COMMON_FIELDS: a row here adds a key, or replaces the shared
|
|
738
809
|
* row of the same owner and key.
|
|
@@ -747,6 +818,13 @@ export const INDICATOR_TYPE_FIELDS = {
|
|
|
747
818
|
* rows.
|
|
748
819
|
*/
|
|
749
820
|
DELTA_PROFILE: [['profileWindow', PREFERENCE]],
|
|
821
|
+
/**
|
|
822
|
+
* VRVP and Agg VRVP own-window scopes (Recent, Last bars, Last days, Prior period): the window kind and the period
|
|
823
|
+
* markers the scope writes beside `scope`. Scoped like DELTA_PROFILE, because the Developing Session Profile stamps
|
|
824
|
+
* `profileWindow: 'data'` on every mount.
|
|
825
|
+
*/
|
|
826
|
+
VISIBLE_RANGE_VOLUME_PROFILE: VISIBLE_RANGE_PROFILE_FIELDS,
|
|
827
|
+
AGGREGATED_VISIBLE_RANGE_VOLUME_PROFILE: VISIBLE_RANGE_PROFILE_FIELDS,
|
|
750
828
|
OPEN_INTEREST_PROFILE: METRIC_PROFILE_FIELDS,
|
|
751
829
|
LIQUIDATION_PROFILE: METRIC_PROFILE_FIELDS,
|
|
752
830
|
SYMBOL_COMPARISON_SCALE: SYMBOL_COMPARISON_FIELDS,
|
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
* on its own, so it imports nothing) and writes tool-tables.generated.ts from it and chart-schema TOOLS:
|
|
5
5
|
*
|
|
6
6
|
* - TOOL_DEFAULT_STYLE[type]: the registry defaultStyle, then the held extras below with their declared defaults;
|
|
7
|
-
* - TOOL_TEMPLATE_KEYS[type]: those keys, then
|
|
8
|
-
* instance key or a cached compute key
|
|
7
|
+
* - TOOL_TEMPLATE_KEYS[type]: those keys, then the text of a type whose text is a label (the text rule, textRoleOf),
|
|
8
|
+
* then `visibleIntervalsMs` unless the type is interval-bound, never an instance key or a cached compute key
|
|
9
|
+
* (`settingsKeysToStrip`).
|
|
10
|
+
*
|
|
11
|
+
* The text rule is the hosts' too: a host's text box reads it through toolTextRole (settings-templates/index.ts), so
|
|
12
|
+
* the box and the template tables give every type one answer.
|
|
9
13
|
*
|
|
10
14
|
* A rule changes here, then the generator runs (the package build does), and both commit together:
|
|
11
15
|
* tests/packages/wrun-chart-host/settings-templates/tool-tables.generated.spec.ts regenerates the tables and fails
|
|
@@ -15,18 +19,32 @@ export declare const TOOL_TEMPLATE_RULES: {
|
|
|
15
19
|
/**
|
|
16
20
|
* Per-drawing state a template never carries and never writes: lock, hide, layer and name are the drawing's own
|
|
17
21
|
* (the rule Save as default already followed), and `text` is the drawing's content (TEMPLATES-PLAN decision 6), but
|
|
18
|
-
*
|
|
22
|
+
* a type whose text is a label (the text rule, `text`) carries it in its template.
|
|
19
23
|
*/
|
|
20
24
|
readonly instanceKeys: readonly ["isLocked", "isHidden", "zPriority", "name", "text"];
|
|
21
25
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
+
* The text rule: which drawing types hold a free text (`key`), and what that text is. It is the one rule for every
|
|
27
|
+
* surface: the template tables (the generator) and the settings panel's text box (web
|
|
28
|
+
* src/components/objects/tool-prop-sections.ts supportsLabelText, through toolTextRole) both read it through
|
|
29
|
+
* textRoleOf. Until 2026-10-21 each read a rule of its own (the tables a label position, `textVerticalPosition`; the
|
|
30
|
+
* panel a font size), so a Price Note's or a Signpost's template kept the colour and dropped the text.
|
|
31
|
+
*
|
|
32
|
+
* A type holds a text when its style holds `heldBy` (its engine draws the text at that size) or a list below names
|
|
33
|
+
* it:
|
|
34
|
+
* - `content`: the text IS the drawing (a text tool's words, a note's or a comment's body): the panel shows the box,
|
|
35
|
+
* and a template never carries it (TEMPLATES-PLAN decision 6).
|
|
36
|
+
* - `ignored`: the engine never draws the text (a Price Label paints only its anchored price,
|
|
37
|
+
* PriceLabelTool.renderLabel): no box and no template.
|
|
38
|
+
* - Every other type's text is its label (the line family, the Rectangle, the Price Note, the Signpost): the panel
|
|
39
|
+
* shows the box and a template carries it, as TradingView's do: a "CALL WALL" template draws its label (decision 6
|
|
40
|
+
* revised 2026-10-21, ticket #248). A label is never style: no seed and no Save as default keeps it, and a template
|
|
41
|
+
* that holds no label leaves the drawing's own.
|
|
26
42
|
*/
|
|
27
|
-
readonly
|
|
43
|
+
readonly text: {
|
|
28
44
|
readonly key: "text";
|
|
29
|
-
readonly
|
|
45
|
+
readonly heldBy: "fontSize";
|
|
46
|
+
readonly content: readonly ["Text", "AnchoredText", "Note", "AnchoredNote", "Callout", "Comment"];
|
|
47
|
+
readonly ignored: readonly ["PriceLabel"];
|
|
30
48
|
};
|
|
31
49
|
/**
|
|
32
50
|
* Drawings whose legs or captured bars read wrong on another interval (a GhostFeed's legs, a Bar Pattern's bars, a
|
|
@@ -67,3 +85,11 @@ export declare const TOOL_TEMPLATE_RULES: {
|
|
|
67
85
|
*/
|
|
68
86
|
readonly defaultExcludedTypes: readonly ["Image"];
|
|
69
87
|
};
|
|
88
|
+
/** What a drawing type's free text is, by the text rule: its label, its content, or a text its engine never draws. */
|
|
89
|
+
export type ToolTextRole = 'label' | 'content' | 'ignored';
|
|
90
|
+
/**
|
|
91
|
+
* The text rule over one drawing type: what its free text is, or undefined when the type holds none. `style` is the
|
|
92
|
+
* type's style as the tables hold it (TOOL_DEFAULT_STYLE[type]: the registry style and the held extras); the generator
|
|
93
|
+
* passes the same style, and a host reads toolTextRole (settings-templates/index.ts), which passes the shipped table.
|
|
94
|
+
*/
|
|
95
|
+
export declare function textRoleOf(type: string, style: Readonly<Record<string, unknown>> | undefined): ToolTextRole | undefined;
|
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
* on its own, so it imports nothing) and writes tool-tables.generated.ts from it and chart-schema TOOLS:
|
|
5
5
|
*
|
|
6
6
|
* - TOOL_DEFAULT_STYLE[type]: the registry defaultStyle, then the held extras below with their declared defaults;
|
|
7
|
-
* - TOOL_TEMPLATE_KEYS[type]: those keys, then
|
|
8
|
-
* instance key or a cached compute key
|
|
7
|
+
* - TOOL_TEMPLATE_KEYS[type]: those keys, then the text of a type whose text is a label (the text rule, textRoleOf),
|
|
8
|
+
* then `visibleIntervalsMs` unless the type is interval-bound, never an instance key or a cached compute key
|
|
9
|
+
* (`settingsKeysToStrip`).
|
|
10
|
+
*
|
|
11
|
+
* The text rule is the hosts' too: a host's text box reads it through toolTextRole (settings-templates/index.ts), so
|
|
12
|
+
* the box and the template tables give every type one answer.
|
|
9
13
|
*
|
|
10
14
|
* A rule changes here, then the generator runs (the package build does), and both commit together:
|
|
11
15
|
* tests/packages/wrun-chart-host/settings-templates/tool-tables.generated.spec.ts regenerates the tables and fails
|
|
@@ -15,16 +19,33 @@ export const TOOL_TEMPLATE_RULES = {
|
|
|
15
19
|
/**
|
|
16
20
|
* Per-drawing state a template never carries and never writes: lock, hide, layer and name are the drawing's own
|
|
17
21
|
* (the rule Save as default already followed), and `text` is the drawing's content (TEMPLATES-PLAN decision 6), but
|
|
18
|
-
*
|
|
22
|
+
* a type whose text is a label (the text rule, `text`) carries it in its template.
|
|
19
23
|
*/
|
|
20
24
|
instanceKeys: ['isLocked', 'isHidden', 'zPriority', 'name', 'text'],
|
|
21
25
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
+
* The text rule: which drawing types hold a free text (`key`), and what that text is. It is the one rule for every
|
|
27
|
+
* surface: the template tables (the generator) and the settings panel's text box (web
|
|
28
|
+
* src/components/objects/tool-prop-sections.ts supportsLabelText, through toolTextRole) both read it through
|
|
29
|
+
* textRoleOf. Until 2026-10-21 each read a rule of its own (the tables a label position, `textVerticalPosition`; the
|
|
30
|
+
* panel a font size), so a Price Note's or a Signpost's template kept the colour and dropped the text.
|
|
31
|
+
*
|
|
32
|
+
* A type holds a text when its style holds `heldBy` (its engine draws the text at that size) or a list below names
|
|
33
|
+
* it:
|
|
34
|
+
* - `content`: the text IS the drawing (a text tool's words, a note's or a comment's body): the panel shows the box,
|
|
35
|
+
* and a template never carries it (TEMPLATES-PLAN decision 6).
|
|
36
|
+
* - `ignored`: the engine never draws the text (a Price Label paints only its anchored price,
|
|
37
|
+
* PriceLabelTool.renderLabel): no box and no template.
|
|
38
|
+
* - Every other type's text is its label (the line family, the Rectangle, the Price Note, the Signpost): the panel
|
|
39
|
+
* shows the box and a template carries it, as TradingView's do: a "CALL WALL" template draws its label (decision 6
|
|
40
|
+
* revised 2026-10-21, ticket #248). A label is never style: no seed and no Save as default keeps it, and a template
|
|
41
|
+
* that holds no label leaves the drawing's own.
|
|
26
42
|
*/
|
|
27
|
-
|
|
43
|
+
text: {
|
|
44
|
+
key: 'text',
|
|
45
|
+
heldBy: 'fontSize',
|
|
46
|
+
content: ['Text', 'AnchoredText', 'Note', 'AnchoredNote', 'Callout', 'Comment'],
|
|
47
|
+
ignored: ['PriceLabel'],
|
|
48
|
+
},
|
|
28
49
|
/**
|
|
29
50
|
* Drawings whose legs or captured bars read wrong on another interval (a GhostFeed's legs, a Bar Pattern's bars, a
|
|
30
51
|
* fixed Gann Square's per-bar price): each keeps the "Show on" intervals it was drawn with, so a template neither
|
|
@@ -54,3 +75,16 @@ export const TOOL_TEMPLATE_RULES = {
|
|
|
54
75
|
*/
|
|
55
76
|
defaultExcludedTypes: ['Image'],
|
|
56
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* The text rule over one drawing type: what its free text is, or undefined when the type holds none. `style` is the
|
|
80
|
+
* type's style as the tables hold it (TOOL_DEFAULT_STYLE[type]: the registry style and the held extras); the generator
|
|
81
|
+
* passes the same style, and a host reads toolTextRole (settings-templates/index.ts), which passes the shipped table.
|
|
82
|
+
*/
|
|
83
|
+
export function textRoleOf(type, style) {
|
|
84
|
+
const rule = TOOL_TEMPLATE_RULES.text;
|
|
85
|
+
if (rule.ignored.includes(type))
|
|
86
|
+
return 'ignored';
|
|
87
|
+
if (rule.content.includes(type))
|
|
88
|
+
return 'content';
|
|
89
|
+
return style && Object.hasOwn(style, rule.heldBy) ? 'label' : undefined;
|
|
90
|
+
}
|
|
@@ -1264,6 +1264,17 @@ export const TOOL_TEMPLATE_KEYS = {
|
|
|
1264
1264
|
'showVAL',
|
|
1265
1265
|
'valColor',
|
|
1266
1266
|
'showVALLabel',
|
|
1267
|
+
'showPOCNaked',
|
|
1268
|
+
'showVAHNaked',
|
|
1269
|
+
'showVALNaked',
|
|
1270
|
+
'cellShading',
|
|
1271
|
+
'shadingSteps',
|
|
1272
|
+
'shadingThresholds',
|
|
1273
|
+
'shadingStepColors',
|
|
1274
|
+
'profileStats',
|
|
1275
|
+
'profileStatsPosition',
|
|
1276
|
+
'levelLineWidth',
|
|
1277
|
+
'levelLineStyle',
|
|
1267
1278
|
],
|
|
1268
1279
|
FlagMark: ['color', 'visibleIntervalsMs'],
|
|
1269
1280
|
FlatTopBottom: ['color', 'lineWidth', 'lineStyle', 'fillBackground', 'backgroundOpacity', 'visibleIntervalsMs'],
|
|
@@ -1482,7 +1493,7 @@ export const TOOL_TEMPLATE_KEYS = {
|
|
|
1482
1493
|
],
|
|
1483
1494
|
PositionForecast: ['color', 'lineWidth', 'lineStyle', 'profitColor', 'stopColor', 'visibleIntervalsMs'],
|
|
1484
1495
|
PriceLabel: ['color', 'fontColor', 'fontSize', 'visibleIntervalsMs'],
|
|
1485
|
-
PriceNote: ['color', 'fontColor', 'fontSize', 'visibleIntervalsMs'],
|
|
1496
|
+
PriceNote: ['color', 'fontColor', 'fontSize', 'text', 'visibleIntervalsMs'],
|
|
1486
1497
|
PriceRange: ['bullishColor', 'bearishColor', 'visibleIntervalsMs'],
|
|
1487
1498
|
Ray: [
|
|
1488
1499
|
'color',
|
|
@@ -1572,7 +1583,7 @@ export const TOOL_TEMPLATE_KEYS = {
|
|
|
1572
1583
|
'lineStyle',
|
|
1573
1584
|
'visibleIntervalsMs',
|
|
1574
1585
|
],
|
|
1575
|
-
Signpost: ['color', 'fontColor', 'fontSize', 'visibleIntervalsMs'],
|
|
1586
|
+
Signpost: ['color', 'fontColor', 'fontSize', 'text', 'visibleIntervalsMs'],
|
|
1576
1587
|
SineLine: ['color', 'lineWidth', 'lineStyle', 'visibleIntervalsMs'],
|
|
1577
1588
|
Subtle: ['color', 'highlight', 'lineWidth', 'visibleIntervalsMs'],
|
|
1578
1589
|
Text: [
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type SidedCandleUnitProfile = {
|
|
2
|
+
serve: true;
|
|
3
|
+
inverse: false;
|
|
4
|
+
multiplier: 1;
|
|
5
|
+
} | {
|
|
6
|
+
serve: false;
|
|
7
|
+
reason: 'venue' | 'inverse';
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The unit profile of the TRANSPORT venue: a UI identity can alias another
|
|
11
|
+
* venue (`BINANCE_FUTURES|BTCUSD_PERP` rides BINANCE_DELIVERY), so the label
|
|
12
|
+
* on the token is resolved the way the request itself is.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveSidedCandleUnitProfile(exchange: string | null | undefined, symbol: string | null | undefined): SidedCandleUnitProfile;
|
|
15
|
+
/** Whether a market's candle volume is base coins (`resolveSidedCandleUnitProfile` serves it). */
|
|
16
|
+
export declare function candleVolumeIsBaseCoins(exchange: string | null | undefined, symbol: string | null | undefined): boolean;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which venues' candle volume is base coins: the ONE list, split out of the sided candle lane
|
|
3
|
+
* (src/utility/chart/sided-candles.util.ts re-exports it) so the package reads it too. The sided split converts
|
|
4
|
+
* exactly only on these venues, and the market-scaled size defaults (wrun-market-size-defaults.leaf) read a market's
|
|
5
|
+
* daily base volume off its candles only on them: on any other venue a candle's volume is contracts, and a share of
|
|
6
|
+
* it would be no size in coins.
|
|
7
|
+
*/
|
|
8
|
+
import { getExchangeFromSymbol } from '../../helpers/data.helpers.js';
|
|
9
|
+
/**
|
|
10
|
+
* Venues whose raw TRADE_SIDE_AGNOSTIC_AGG `volume` is base coins with an
|
|
11
|
+
* implicit contract multiplier of 1 and linear (non-inverse) settlement, so
|
|
12
|
+
* the returned split is in the same unit the CVD coins lane requests
|
|
13
|
+
* (`coins_value(amount, 1, price, false) = amount`). Contract-denominated
|
|
14
|
+
* venues (OKEX_SWAP, DERIBIT, BITMEX, GATE_IO_FUTURES, the governed CME
|
|
15
|
+
* plane) and inverse settlement (BINANCE_DELIVERY, Bybit inverse symbols)
|
|
16
|
+
* stay on the wire: their conversion needs per-instrument registry fields
|
|
17
|
+
* the frontend does not carry.
|
|
18
|
+
*/
|
|
19
|
+
const SIDED_CANDLE_LINEAR_BASE_VENUES = new Set([
|
|
20
|
+
'BINANCE',
|
|
21
|
+
'BINANCE_FUTURES',
|
|
22
|
+
'BINANCE_US',
|
|
23
|
+
'BYBIT',
|
|
24
|
+
'BYBIT_SPOT',
|
|
25
|
+
'COINBASE',
|
|
26
|
+
'COINBASE_INTERNATIONAL',
|
|
27
|
+
'COINBASE_PRO',
|
|
28
|
+
'KRAKEN',
|
|
29
|
+
'HYPERLIQUID',
|
|
30
|
+
'HYPERLIQUID_FUTURES',
|
|
31
|
+
'OKEX',
|
|
32
|
+
'GATE_IO',
|
|
33
|
+
]);
|
|
34
|
+
/** Inverse-settled venues: their split is in contracts, converted per instrument by the gateway. */
|
|
35
|
+
const SIDED_CANDLE_INVERSE_VENUES = new Set(['BINANCE_DELIVERY']);
|
|
36
|
+
/** Bybit lists inverse contracts beside linear ones under one venue: only the stable-quoted symbols are linear. */
|
|
37
|
+
function isBybitLinearSymbol(symbol) {
|
|
38
|
+
const upper = symbol.toUpperCase();
|
|
39
|
+
return upper.endsWith('USDT') || upper.endsWith('USDC') || upper.endsWith('PERP');
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The unit profile of the TRANSPORT venue: a UI identity can alias another
|
|
43
|
+
* venue (`BINANCE_FUTURES|BTCUSD_PERP` rides BINANCE_DELIVERY), so the label
|
|
44
|
+
* on the token is resolved the way the request itself is.
|
|
45
|
+
*/
|
|
46
|
+
export function resolveSidedCandleUnitProfile(exchange, symbol) {
|
|
47
|
+
const label = String(exchange ?? '').toUpperCase();
|
|
48
|
+
const sym = String(symbol ?? '');
|
|
49
|
+
const venue = getExchangeFromSymbol(label, sym).toUpperCase();
|
|
50
|
+
if (SIDED_CANDLE_INVERSE_VENUES.has(venue))
|
|
51
|
+
return { serve: false, reason: 'inverse' };
|
|
52
|
+
if (!SIDED_CANDLE_LINEAR_BASE_VENUES.has(venue))
|
|
53
|
+
return { serve: false, reason: 'venue' };
|
|
54
|
+
if (venue === 'BYBIT' && !isBybitLinearSymbol(sym))
|
|
55
|
+
return { serve: false, reason: 'inverse' };
|
|
56
|
+
return { serve: true, inverse: false, multiplier: 1 };
|
|
57
|
+
}
|
|
58
|
+
/** Whether a market's candle volume is base coins (`resolveSidedCandleUnitProfile` serves it). */
|
|
59
|
+
export function candleVolumeIsBaseCoins(exchange, symbol) {
|
|
60
|
+
return resolveSidedCandleUnitProfile(exchange, symbol).serve;
|
|
61
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The footprint columns layout (titan P2, `displayMode: 'columns'`): Sierra Chart's Numbers Bars columns, BackQuant's
|
|
3
|
+
* "your own columns". Every bar's cell span splits into 2 to 4 equal columns, drawn left to right in
|
|
4
|
+
* `footprintColumns` order, one kind each:
|
|
5
|
+
*
|
|
6
|
+
* | kind | the column shows |
|
|
7
|
+
* | ------------------ | ---------------------------------------------------------------- |
|
|
8
|
+
* | 'bidAsk' | bid and ask in its two halves, on the cluster cell metric's heat |
|
|
9
|
+
* | 'delta' | delta on a cell in the sign's colour |
|
|
10
|
+
* | 'deltaColored' | delta in the up / down colour, no cell |
|
|
11
|
+
* | 'diagonalDelta' | the ask minus the bid one row below, on a cell |
|
|
12
|
+
* | 'deltaPct' | delta as a share of the row's volume, on a cell |
|
|
13
|
+
* | 'volume' | volume on a cell in the volume colour |
|
|
14
|
+
* | 'buy' / 'sell' | one side's volume on a cell in its colour |
|
|
15
|
+
* | 'volumeBar' | a volume bar and its number |
|
|
16
|
+
* | 'deltaBar' | a delta bar and its number |
|
|
17
|
+
* | 'volumeBarLeading' | a volume bar in the leading side's colour, no number |
|
|
18
|
+
* | 'splitBar' | the sell bar left of the column's centre, the buy bar right |
|
|
19
|
+
*
|
|
20
|
+
* Titan reads the list as written: invalid entries drop, the first four valid ones draw, and fewer than two valid
|
|
21
|
+
* ones draw its default (bid x ask, then delta). Outside the columns display mode titan ignores the list, so a
|
|
22
|
+
* footprint switched to another mode keeps its columns for the next switch back.
|
|
23
|
+
*
|
|
24
|
+
* Moved from web (src/utility/chart/footprint-columns.util.ts, now its shim), content unchanged: web's dialogs and the
|
|
25
|
+
* phone's settings form read the kinds, the presets and the writes from here (settings-templates/footprint-rows.ts).
|
|
26
|
+
*/
|
|
27
|
+
export declare const FOOTPRINT_COLUMN_KINDS: readonly ["bidAsk", "delta", "deltaColored", "diagonalDelta", "deltaPct", "volume", "buy", "sell", "volumeBar", "deltaBar", "volumeBarLeading", "splitBar"];
|
|
28
|
+
export type FootprintColumnKind = (typeof FOOTPRINT_COLUMN_KINDS)[number];
|
|
29
|
+
/** A column's pick in the dialog: a kind, or 'off' (columns 3 and 4 only). */
|
|
30
|
+
export type FootprintColumnPick = FootprintColumnKind | 'off';
|
|
31
|
+
/** The display mode that draws the columns. */
|
|
32
|
+
export declare const FOOTPRINT_COLUMNS_DISPLAY_MODE = "columns";
|
|
33
|
+
export declare const FOOTPRINT_COLUMNS_MIN = 2;
|
|
34
|
+
export declare const FOOTPRINT_COLUMNS_MAX = 4;
|
|
35
|
+
/** One-click layouts: a preset writes `footprintColumns` and nothing else, so every column stays editable. */
|
|
36
|
+
export declare const FOOTPRINT_COLUMN_PRESETS: readonly [{
|
|
37
|
+
readonly id: "bidAskDelta";
|
|
38
|
+
readonly columns: readonly ["bidAsk", "delta"];
|
|
39
|
+
}, {
|
|
40
|
+
readonly id: "deltaVolumeBar";
|
|
41
|
+
readonly columns: readonly ["deltaColored", "volume", "volumeBar"];
|
|
42
|
+
}, {
|
|
43
|
+
readonly id: "volumeDeltaBars";
|
|
44
|
+
readonly columns: readonly ["volumeBar", "deltaBar"];
|
|
45
|
+
}, {
|
|
46
|
+
readonly id: "profileBars";
|
|
47
|
+
readonly columns: readonly ["splitBar", "volume"];
|
|
48
|
+
}];
|
|
49
|
+
export type FootprintColumnPresetId = (typeof FOOTPRINT_COLUMN_PRESETS)[number]['id'];
|
|
50
|
+
type ColumnsModel = {
|
|
51
|
+
displayMode?: unknown;
|
|
52
|
+
footprintColumns?: unknown;
|
|
53
|
+
};
|
|
54
|
+
/** Whether the footprint draws the columns layout. */
|
|
55
|
+
export declare function isFootprintColumnsMode(model: unknown): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* A saved `footprintColumns` as titan reads it: its valid kinds in order, the first four. Undefined when fewer than
|
|
58
|
+
* two are valid (titan then draws its default), so only a list titan draws as written is carried and saved.
|
|
59
|
+
*/
|
|
60
|
+
export declare function footprintColumnsOf(value: unknown): FootprintColumnKind[] | undefined;
|
|
61
|
+
/** The columns the footprint draws in the columns layout: its own list, else titan's default. */
|
|
62
|
+
export declare function footprintColumnsShown(model: ColumnsModel): FootprintColumnKind[];
|
|
63
|
+
/**
|
|
64
|
+
* The model with column `index` (0 = the left one) set to `pick`. A kind replaces that column, or adds one when the
|
|
65
|
+
* index is past the last column; 'off' removes it and the columns after it move left. A pick that names no kind, or
|
|
66
|
+
* that would leave fewer than two columns, returns the model unchanged: the dialog never saves a list titan would
|
|
67
|
+
* not draw as written.
|
|
68
|
+
*/
|
|
69
|
+
export declare function withFootprintColumn<T extends ColumnsModel>(model: T, index: number, pick: FootprintColumnPick): T;
|
|
70
|
+
/** The model with a preset's columns. */
|
|
71
|
+
export declare function withFootprintColumnsPreset<T extends ColumnsModel>(model: T, id: FootprintColumnPresetId): T;
|
|
72
|
+
/** The preset the footprint's columns are (no list of its own reads as titan's default), or null for its own. */
|
|
73
|
+
export declare function footprintColumnsPresetOf(model: ColumnsModel): FootprintColumnPresetId | null;
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The footprint columns layout (titan P2, `displayMode: 'columns'`): Sierra Chart's Numbers Bars columns, BackQuant's
|
|
3
|
+
* "your own columns". Every bar's cell span splits into 2 to 4 equal columns, drawn left to right in
|
|
4
|
+
* `footprintColumns` order, one kind each:
|
|
5
|
+
*
|
|
6
|
+
* | kind | the column shows |
|
|
7
|
+
* | ------------------ | ---------------------------------------------------------------- |
|
|
8
|
+
* | 'bidAsk' | bid and ask in its two halves, on the cluster cell metric's heat |
|
|
9
|
+
* | 'delta' | delta on a cell in the sign's colour |
|
|
10
|
+
* | 'deltaColored' | delta in the up / down colour, no cell |
|
|
11
|
+
* | 'diagonalDelta' | the ask minus the bid one row below, on a cell |
|
|
12
|
+
* | 'deltaPct' | delta as a share of the row's volume, on a cell |
|
|
13
|
+
* | 'volume' | volume on a cell in the volume colour |
|
|
14
|
+
* | 'buy' / 'sell' | one side's volume on a cell in its colour |
|
|
15
|
+
* | 'volumeBar' | a volume bar and its number |
|
|
16
|
+
* | 'deltaBar' | a delta bar and its number |
|
|
17
|
+
* | 'volumeBarLeading' | a volume bar in the leading side's colour, no number |
|
|
18
|
+
* | 'splitBar' | the sell bar left of the column's centre, the buy bar right |
|
|
19
|
+
*
|
|
20
|
+
* Titan reads the list as written: invalid entries drop, the first four valid ones draw, and fewer than two valid
|
|
21
|
+
* ones draw its default (bid x ask, then delta). Outside the columns display mode titan ignores the list, so a
|
|
22
|
+
* footprint switched to another mode keeps its columns for the next switch back.
|
|
23
|
+
*
|
|
24
|
+
* Moved from web (src/utility/chart/footprint-columns.util.ts, now its shim), content unchanged: web's dialogs and the
|
|
25
|
+
* phone's settings form read the kinds, the presets and the writes from here (settings-templates/footprint-rows.ts).
|
|
26
|
+
*/
|
|
27
|
+
export const FOOTPRINT_COLUMN_KINDS = [
|
|
28
|
+
'bidAsk',
|
|
29
|
+
'delta',
|
|
30
|
+
'deltaColored',
|
|
31
|
+
'diagonalDelta',
|
|
32
|
+
'deltaPct',
|
|
33
|
+
'volume',
|
|
34
|
+
'buy',
|
|
35
|
+
'sell',
|
|
36
|
+
'volumeBar',
|
|
37
|
+
'deltaBar',
|
|
38
|
+
'volumeBarLeading',
|
|
39
|
+
'splitBar',
|
|
40
|
+
];
|
|
41
|
+
/** The display mode that draws the columns. */
|
|
42
|
+
export const FOOTPRINT_COLUMNS_DISPLAY_MODE = 'columns';
|
|
43
|
+
export const FOOTPRINT_COLUMNS_MIN = 2;
|
|
44
|
+
export const FOOTPRINT_COLUMNS_MAX = 4;
|
|
45
|
+
/** What titan draws in the columns layout without a valid list (the Bid x Ask + Delta preset). */
|
|
46
|
+
const FOOTPRINT_COLUMNS_DEFAULT = ['bidAsk', 'delta'];
|
|
47
|
+
/** One-click layouts: a preset writes `footprintColumns` and nothing else, so every column stays editable. */
|
|
48
|
+
export const FOOTPRINT_COLUMN_PRESETS = [
|
|
49
|
+
{ id: 'bidAskDelta', columns: ['bidAsk', 'delta'] },
|
|
50
|
+
{ id: 'deltaVolumeBar', columns: ['deltaColored', 'volume', 'volumeBar'] },
|
|
51
|
+
{ id: 'volumeDeltaBars', columns: ['volumeBar', 'deltaBar'] },
|
|
52
|
+
{ id: 'profileBars', columns: ['splitBar', 'volume'] },
|
|
53
|
+
];
|
|
54
|
+
const isColumnKind = (value) => FOOTPRINT_COLUMN_KINDS.includes(value);
|
|
55
|
+
/** Whether the footprint draws the columns layout. */
|
|
56
|
+
export function isFootprintColumnsMode(model) {
|
|
57
|
+
return model?.displayMode === FOOTPRINT_COLUMNS_DISPLAY_MODE;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A saved `footprintColumns` as titan reads it: its valid kinds in order, the first four. Undefined when fewer than
|
|
61
|
+
* two are valid (titan then draws its default), so only a list titan draws as written is carried and saved.
|
|
62
|
+
*/
|
|
63
|
+
export function footprintColumnsOf(value) {
|
|
64
|
+
if (!Array.isArray(value))
|
|
65
|
+
return undefined;
|
|
66
|
+
const columns = value.filter(isColumnKind).slice(0, FOOTPRINT_COLUMNS_MAX);
|
|
67
|
+
return columns.length >= FOOTPRINT_COLUMNS_MIN ? columns : undefined;
|
|
68
|
+
}
|
|
69
|
+
/** The columns the footprint draws in the columns layout: its own list, else titan's default. */
|
|
70
|
+
export function footprintColumnsShown(model) {
|
|
71
|
+
return footprintColumnsOf(model.footprintColumns) ?? FOOTPRINT_COLUMNS_DEFAULT.slice();
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The model with column `index` (0 = the left one) set to `pick`. A kind replaces that column, or adds one when the
|
|
75
|
+
* index is past the last column; 'off' removes it and the columns after it move left. A pick that names no kind, or
|
|
76
|
+
* that would leave fewer than two columns, returns the model unchanged: the dialog never saves a list titan would
|
|
77
|
+
* not draw as written.
|
|
78
|
+
*/
|
|
79
|
+
export function withFootprintColumn(model, index, pick) {
|
|
80
|
+
if (!Number.isInteger(index) || index < 0 || index >= FOOTPRINT_COLUMNS_MAX)
|
|
81
|
+
return model;
|
|
82
|
+
const columns = footprintColumnsShown(model);
|
|
83
|
+
if (pick === 'off') {
|
|
84
|
+
if (index >= columns.length)
|
|
85
|
+
return model;
|
|
86
|
+
columns.splice(index, 1);
|
|
87
|
+
}
|
|
88
|
+
else if (isColumnKind(pick)) {
|
|
89
|
+
columns[Math.min(index, columns.length)] = pick;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
return model;
|
|
93
|
+
}
|
|
94
|
+
return columns.length >= FOOTPRINT_COLUMNS_MIN ? { ...model, footprintColumns: columns } : model;
|
|
95
|
+
}
|
|
96
|
+
/** The model with a preset's columns. */
|
|
97
|
+
export function withFootprintColumnsPreset(model, id) {
|
|
98
|
+
const preset = FOOTPRINT_COLUMN_PRESETS.find((entry) => entry.id === id);
|
|
99
|
+
return preset ? { ...model, footprintColumns: [...preset.columns] } : model;
|
|
100
|
+
}
|
|
101
|
+
/** The preset the footprint's columns are (no list of its own reads as titan's default), or null for its own. */
|
|
102
|
+
export function footprintColumnsPresetOf(model) {
|
|
103
|
+
const shown = footprintColumnsShown(model);
|
|
104
|
+
const preset = FOOTPRINT_COLUMN_PRESETS.find(({ columns }) => columns.length === shown.length && columns.every((kind, index) => kind === shown[index]));
|
|
105
|
+
return preset?.id ?? null;
|
|
106
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The footprint display mode rules a settings form writes by: titan's cell-grid family, the bar width each mode draws
|
|
3
|
+
* at, the modes a form offers, the mode it shows, and the model a display mode pick writes. Both web footprint dialogs
|
|
4
|
+
* write by them, the Classic Presets patch reads the bar width (./footprint-sierra-look.util), and a host's settings
|
|
5
|
+
* form reads all of them through settings-templates/footprint-rows.ts.
|
|
6
|
+
*
|
|
7
|
+
* Web still holds its own copies: the family and the bar width in src/indicators/controls/footprint-display-mode.util.ts,
|
|
8
|
+
* the offered modes in footprintSettingsTabs.ts createFootprintDisplayModeOptions, the pick as its
|
|
9
|
+
* withFootprintDisplayMode, and the shown mode as VolumeFootprintSettings.vue's currentDisplayMode. Until web reads them
|
|
10
|
+
* from here, tests/packages/wrun-chart-host/utility/chart/footprint-display-mode.util.spec.ts holds every copy it can
|
|
11
|
+
* import equal to this module.
|
|
12
|
+
*/
|
|
13
|
+
export type FootprintClusterGridDisplayMode = 'cluster' | 'imbalance-only' | 'ladder';
|
|
14
|
+
/** Whether a display mode draws titan's cell grid (cluster, imbalance-only, ladder). */
|
|
15
|
+
export declare function isClusterGridProfileDisplayMode(displayMode: unknown): displayMode is FootprintClusterGridDisplayMode;
|
|
16
|
+
/** The bar width a display mode draws at: the stacked bars 0.7, the split bar and the cell grid 1, else `fallback`. */
|
|
17
|
+
export declare function getFootprintDisplayModeBarWidth(displayMode: string, fallback?: number): number;
|
|
18
|
+
/** The display modes a footprint settings form offers, in the order both web dialogs list them. */
|
|
19
|
+
export declare const FOOTPRINT_DISPLAY_MODES: readonly ["split-bar", "stacked-bar-delta", "stacked-bar", "cluster", "imbalance-only", "ladder", "columns"];
|
|
20
|
+
export type FootprintDisplayMode = (typeof FOOTPRINT_DISPLAY_MODES)[number];
|
|
21
|
+
type DisplayModeModel = {
|
|
22
|
+
displayMode?: unknown;
|
|
23
|
+
showDelta?: unknown;
|
|
24
|
+
barWidth?: unknown;
|
|
25
|
+
stickToLeft?: unknown;
|
|
26
|
+
clusterCellMetric?: unknown;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The display mode a form shows for a model, as the Volume Footprint dialog reads it: a cell-grid mode as it is, and the
|
|
30
|
+
* legacy delta flag (`showDelta`, from before the stacked delta mode had its own name) as the stacked delta mode on
|
|
31
|
+
* any other bar. No mode reads as the split bar. A read only: nothing is written until a pick.
|
|
32
|
+
*/
|
|
33
|
+
export declare function footprintDisplayModeShown(model: DisplayModeModel): string;
|
|
34
|
+
/**
|
|
35
|
+
* The model on `displayMode`, as both footprint dialogs write a display mode pick: the legacy delta flag only for the
|
|
36
|
+
* stacked delta mode, the bar width of the mode's family, the cells anchored left, and on a cell grid the cluster cell
|
|
37
|
+
* metric's default (the columns layout is one of titan's cluster-grid family: its bid x ask column reads the metric).
|
|
38
|
+
*/
|
|
39
|
+
export declare function withFootprintDisplayMode<T extends DisplayModeModel>(model: T, displayMode: string): T;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { FOOTPRINT_COLUMNS_DISPLAY_MODE } from './footprint-columns.util.js';
|
|
2
|
+
const FOOTPRINT_CLUSTER_GRID_DISPLAY_MODES = ['cluster', 'imbalance-only', 'ladder'];
|
|
3
|
+
/** Whether a display mode draws titan's cell grid (cluster, imbalance-only, ladder). */
|
|
4
|
+
export function isClusterGridProfileDisplayMode(displayMode) {
|
|
5
|
+
return (typeof displayMode === 'string' &&
|
|
6
|
+
FOOTPRINT_CLUSTER_GRID_DISPLAY_MODES.includes(displayMode));
|
|
7
|
+
}
|
|
8
|
+
/** The bar width a display mode draws at: the stacked bars 0.7, the split bar and the cell grid 1, else `fallback`. */
|
|
9
|
+
export function getFootprintDisplayModeBarWidth(displayMode, fallback = 0.7) {
|
|
10
|
+
if (displayMode === 'stacked-bar' || displayMode === 'stacked-bar-delta')
|
|
11
|
+
return 0.7;
|
|
12
|
+
if (displayMode === 'split-bar' || isClusterGridProfileDisplayMode(displayMode))
|
|
13
|
+
return 1.0;
|
|
14
|
+
return fallback;
|
|
15
|
+
}
|
|
16
|
+
/** The display modes a footprint settings form offers, in the order both web dialogs list them. */
|
|
17
|
+
export const FOOTPRINT_DISPLAY_MODES = [
|
|
18
|
+
'split-bar',
|
|
19
|
+
'stacked-bar-delta',
|
|
20
|
+
'stacked-bar',
|
|
21
|
+
'cluster',
|
|
22
|
+
'imbalance-only',
|
|
23
|
+
'ladder',
|
|
24
|
+
FOOTPRINT_COLUMNS_DISPLAY_MODE,
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* The display mode a form shows for a model, as the Volume Footprint dialog reads it: a cell-grid mode as it is, and the
|
|
28
|
+
* legacy delta flag (`showDelta`, from before the stacked delta mode had its own name) as the stacked delta mode on
|
|
29
|
+
* any other bar. No mode reads as the split bar. A read only: nothing is written until a pick.
|
|
30
|
+
*/
|
|
31
|
+
export function footprintDisplayModeShown(model) {
|
|
32
|
+
const displayMode = (model.displayMode ?? 'split-bar');
|
|
33
|
+
const showDelta = model.showDelta ?? false;
|
|
34
|
+
if (isClusterGridProfileDisplayMode(displayMode))
|
|
35
|
+
return displayMode;
|
|
36
|
+
if (displayMode === 'split-bar' && !showDelta)
|
|
37
|
+
return 'split-bar';
|
|
38
|
+
if (displayMode === 'stacked-bar' && !showDelta)
|
|
39
|
+
return 'stacked-bar';
|
|
40
|
+
if (showDelta || displayMode === 'stacked-bar-delta')
|
|
41
|
+
return 'stacked-bar-delta';
|
|
42
|
+
return displayMode;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The model on `displayMode`, as both footprint dialogs write a display mode pick: the legacy delta flag only for the
|
|
46
|
+
* stacked delta mode, the bar width of the mode's family, the cells anchored left, and on a cell grid the cluster cell
|
|
47
|
+
* metric's default (the columns layout is one of titan's cluster-grid family: its bid x ask column reads the metric).
|
|
48
|
+
*/
|
|
49
|
+
export function withFootprintDisplayMode(model, displayMode) {
|
|
50
|
+
const cellGrid = isClusterGridProfileDisplayMode(displayMode) || displayMode === FOOTPRINT_COLUMNS_DISPLAY_MODE;
|
|
51
|
+
const next = {
|
|
52
|
+
...model,
|
|
53
|
+
displayMode,
|
|
54
|
+
showDelta: displayMode === 'stacked-bar-delta',
|
|
55
|
+
// Web passes the stored width through as it is (`model.barWidth ?? 0.7`); only a mode no rule names returns it.
|
|
56
|
+
barWidth: getFootprintDisplayModeBarWidth(cellGrid ? 'cluster' : displayMode, (model.barWidth ?? 0.7)),
|
|
57
|
+
stickToLeft: true,
|
|
58
|
+
};
|
|
59
|
+
if (cellGrid && !next.clusterCellMetric)
|
|
60
|
+
next.clusterCellMetric = 'delta';
|
|
61
|
+
return next;
|
|
62
|
+
}
|