@orangecharts/wrun-chart-host 0.1.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 +72 -0
- package/dist/constants/governed-exchanges.constants.d.ts +11 -0
- package/dist/constants/governed-exchanges.constants.js +11 -0
- package/dist/constants/indicator-sets.constants.d.ts +8 -0
- package/dist/constants/indicator-sets.constants.js +8 -0
- package/dist/constants/interval.constants.d.ts +34 -0
- package/dist/constants/interval.constants.js +121 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +28 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +65 -0
- package/dist/constants/tpo-color-schemes.constants.d.ts +30 -0
- package/dist/constants/tpo-color-schemes.constants.js +32 -0
- package/dist/host-env.d.ts +102 -0
- package/dist/host-env.js +26 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.js +96 -0
- package/dist/indicators/controls/tpo-letter.util.d.ts +2 -0
- package/dist/indicators/controls/tpo-letter.util.js +13 -0
- package/dist/indicators/controls/tpo-session.util.d.ts +99 -0
- package/dist/indicators/controls/tpo-session.util.js +389 -0
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +64 -0
- package/dist/interfaces/kscript-diagnostics.interface.js +1 -0
- package/dist/interfaces/om-panel-data.interface.d.ts +103 -0
- package/dist/interfaces/om-panel-data.interface.js +7 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +2659 -0
- package/dist/interfaces/wrun-runtime.interface.js +55 -0
- package/dist/utility/chart/calendar-interval.util.d.ts +24 -0
- package/dist/utility/chart/calendar-interval.util.js +81 -0
- package/dist/utility/chart/candle-bar-end.util.d.ts +15 -0
- package/dist/utility/chart/candle-bar-end.util.js +23 -0
- package/dist/utility/chart/cme-realtime.util.d.ts +24 -0
- package/dist/utility/chart/cme-realtime.util.js +53 -0
- package/dist/utility/chart/interval-ladder.util.d.ts +27 -0
- package/dist/utility/chart/interval-ladder.util.js +92 -0
- package/dist/utility/chart/kscript-drawing-prep.util.d.ts +40 -0
- package/dist/utility/chart/kscript-drawing-prep.util.js +184 -0
- package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +95 -0
- package/dist/utility/chart/kscript-drawing-safe-area.util.js +805 -0
- package/dist/utility/chart/kscript-legend-entries.util.d.ts +166 -0
- package/dist/utility/chart/kscript-legend-entries.util.js +538 -0
- package/dist/utility/chart/kscript-output-role.util.d.ts +32 -0
- package/dist/utility/chart/kscript-output-role.util.js +215 -0
- package/dist/utility/chart/kscript-provenance-keys.util.d.ts +22 -0
- package/dist/utility/chart/kscript-provenance-keys.util.js +56 -0
- package/dist/utility/chart/kscript-run-result-normalize.util.d.ts +53 -0
- package/dist/utility/chart/kscript-run-result-normalize.util.js +476 -0
- package/dist/utility/chart/kscript-run-result-shape.util.d.ts +14 -0
- package/dist/utility/chart/kscript-run-result-shape.util.js +66 -0
- package/dist/utility/chart/kscript-titancharts-container.util.d.ts +29 -0
- package/dist/utility/chart/kscript-titancharts-container.util.js +151 -0
- package/dist/utility/chart/kscript-viewport-overlays.util.d.ts +83 -0
- package/dist/utility/chart/kscript-viewport-overlays.util.js +443 -0
- package/dist/utility/chart/om-panel-push-style.util.d.ts +78 -0
- package/dist/utility/chart/om-panel-push-style.util.js +301 -0
- package/dist/utility/chart/om-panel.util.d.ts +166 -0
- package/dist/utility/chart/om-panel.util.js +815 -0
- package/dist/utility/chart/om-series.util.d.ts +42 -0
- package/dist/utility/chart/om-series.util.js +330 -0
- package/dist/utility/chart/om-target.util.d.ts +11 -0
- package/dist/utility/chart/om-target.util.js +24 -0
- package/dist/utility/chart/om-widget.util.d.ts +148 -0
- package/dist/utility/chart/om-widget.util.js +413 -0
- package/dist/utility/chart/overlay-output-budget.util.d.ts +16 -0
- package/dist/utility/chart/overlay-output-budget.util.js +109 -0
- package/dist/utility/chart/overlay-paint-flags.util.d.ts +24 -0
- package/dist/utility/chart/overlay-paint-flags.util.js +55 -0
- package/dist/utility/chart/profile-row-height.util.d.ts +21 -0
- package/dist/utility/chart/profile-row-height.util.js +110 -0
- package/dist/utility/chart/session-interval.util.d.ts +1 -0
- package/dist/utility/chart/session-interval.util.js +35 -0
- package/dist/utility/chart/technical-script-legend-value.util.d.ts +18 -0
- package/dist/utility/chart/technical-script-legend-value.util.js +53 -0
- package/dist/utility/chart/trading-day.util.d.ts +70 -0
- package/dist/utility/chart/trading-day.util.js +238 -0
- package/dist/utility/chart/wrun-legend-name.util.d.ts +25 -0
- package/dist/utility/chart/wrun-legend-name.util.js +87 -0
- package/dist/utility/chart/wrun-run-result.util.d.ts +977 -0
- package/dist/utility/chart/wrun-run-result.util.js +5179 -0
- package/dist/utility/chart/wrun-visibility-chart.util.d.ts +25 -0
- package/dist/utility/chart/wrun-visibility-chart.util.js +22 -0
- package/dist/utility/indicators/heatmap-sensitivity.util.d.ts +62 -0
- package/dist/utility/indicators/heatmap-sensitivity.util.js +82 -0
- package/dist/utility/number-format.util.d.ts +68 -0
- package/dist/utility/number-format.util.js +188 -0
- package/dist/utility/v2/opra-governed.util.d.ts +1 -0
- package/dist/utility/v2/opra-governed.util.js +13 -0
- package/dist/utility/wrun/wrun-auto-row.util.d.ts +54 -0
- package/dist/utility/wrun/wrun-auto-row.util.js +96 -0
- package/dist/utility/wrun/wrun-batched-marks.util.d.ts +341 -0
- package/dist/utility/wrun/wrun-batched-marks.util.js +938 -0
- package/dist/utility/wrun/wrun-batched-readout.util.d.ts +75 -0
- package/dist/utility/wrun/wrun-batched-readout.util.js +171 -0
- package/dist/utility/wrun/wrun-box-segment.util.d.ts +185 -0
- package/dist/utility/wrun/wrun-box-segment.util.js +570 -0
- package/dist/utility/wrun/wrun-build-memo.util.d.ts +133 -0
- package/dist/utility/wrun/wrun-build-memo.util.js +301 -0
- package/dist/utility/wrun/wrun-builtin-twin-ports.util.d.ts +25 -0
- package/dist/utility/wrun/wrun-builtin-twin-ports.util.js +75 -0
- package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-builtin-twin.util.js +40 -0
- package/dist/utility/wrun/wrun-canvas-cache.util.d.ts +28 -0
- package/dist/utility/wrun/wrun-canvas-cache.util.js +56 -0
- package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +69 -0
- package/dist/utility/wrun/wrun-canvas-readout.util.js +53 -0
- package/dist/utility/wrun/wrun-canvases.util.d.ts +295 -0
- package/dist/utility/wrun/wrun-canvases.util.js +1432 -0
- package/dist/utility/wrun/wrun-cap-notice.util.d.ts +77 -0
- package/dist/utility/wrun/wrun-cap-notice.util.js +296 -0
- package/dist/utility/wrun/wrun-card-style.util.d.ts +154 -0
- package/dist/utility/wrun/wrun-card-style.util.js +539 -0
- package/dist/utility/wrun/wrun-chart-context.util.d.ts +89 -0
- package/dist/utility/wrun/wrun-chart-context.util.js +213 -0
- package/dist/utility/wrun/wrun-chart-names.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-chart-names.util.js +33 -0
- package/dist/utility/wrun/wrun-chart-time.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-chart-time.util.js +23 -0
- package/dist/utility/wrun/wrun-child-overlay-id.util.d.ts +13 -0
- package/dist/utility/wrun/wrun-child-overlay-id.util.js +44 -0
- package/dist/utility/wrun/wrun-color-facts.util.d.ts +40 -0
- package/dist/utility/wrun/wrun-color-facts.util.js +88 -0
- package/dist/utility/wrun/wrun-color-settings.lazy.d.ts +26 -0
- package/dist/utility/wrun/wrun-color-settings.lazy.js +9 -0
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +351 -0
- package/dist/utility/wrun/wrun-color-settings.util.js +1363 -0
- package/dist/utility/wrun/wrun-footprint-modes.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-footprint-modes.util.js +24 -0
- package/dist/utility/wrun/wrun-frames.d.ts +217 -0
- package/dist/utility/wrun/wrun-frames.js +1021 -0
- package/dist/utility/wrun/wrun-handles.util.d.ts +792 -0
- package/dist/utility/wrun/wrun-handles.util.js +2050 -0
- package/dist/utility/wrun/wrun-heatmap-cell-budget.util.d.ts +156 -0
- package/dist/utility/wrun/wrun-heatmap-cell-budget.util.js +342 -0
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +218 -0
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +667 -0
- package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +40 -0
- package/dist/utility/wrun/wrun-hosted-wire.util.js +27 -0
- package/dist/utility/wrun/wrun-hover.util.d.ts +182 -0
- package/dist/utility/wrun/wrun-hover.util.js +534 -0
- package/dist/utility/wrun/wrun-hud-looks.util.d.ts +246 -0
- package/dist/utility/wrun/wrun-hud-looks.util.js +587 -0
- package/dist/utility/wrun/wrun-integration-budget.util.d.ts +47 -0
- package/dist/utility/wrun/wrun-integration-budget.util.js +122 -0
- package/dist/utility/wrun/wrun-latest-snapshot.d.ts +19 -0
- package/dist/utility/wrun/wrun-latest-snapshot.js +7 -0
- package/dist/utility/wrun/wrun-levels-child.util.d.ts +131 -0
- package/dist/utility/wrun/wrun-levels-child.util.js +514 -0
- package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +75 -0
- package/dist/utility/wrun/wrun-lifecycle.contract.js +9 -0
- package/dist/utility/wrun/wrun-market-facts.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-market-facts.util.js +238 -0
- package/dist/utility/wrun/wrun-output-style.util.d.ts +344 -0
- package/dist/utility/wrun/wrun-output-style.util.js +1239 -0
- package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +84 -0
- package/dist/utility/wrun/wrun-overlay-identity.util.js +142 -0
- package/dist/utility/wrun/wrun-overlay-result.util.d.ts +120 -0
- package/dist/utility/wrun/wrun-overlay-result.util.js +219 -0
- package/dist/utility/wrun/wrun-pack.util.d.ts +70 -0
- package/dist/utility/wrun/wrun-pack.util.js +301 -0
- package/dist/utility/wrun/wrun-pane-format.util.d.ts +180 -0
- package/dist/utility/wrun/wrun-pane-format.util.js +299 -0
- package/dist/utility/wrun/wrun-panel-style.lazy.d.ts +25 -0
- package/dist/utility/wrun/wrun-panel-style.lazy.js +15 -0
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +174 -0
- package/dist/utility/wrun/wrun-panel-style.util.js +726 -0
- package/dist/utility/wrun/wrun-param-values.util.d.ts +69 -0
- package/dist/utility/wrun/wrun-param-values.util.js +230 -0
- package/dist/utility/wrun/wrun-refusal.util.d.ts +263 -0
- package/dist/utility/wrun/wrun-refusal.util.js +1259 -0
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +199 -0
- package/dist/utility/wrun/wrun-registry-errors.util.js +257 -0
- package/dist/utility/wrun/wrun-render-select.util.d.ts +336 -0
- package/dist/utility/wrun/wrun-render-select.util.js +1157 -0
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +434 -0
- package/dist/utility/wrun/wrun-script-inputs.util.js +1971 -0
- package/dist/utility/wrun/wrun-setting-words.lazy.d.ts +20 -0
- package/dist/utility/wrun/wrun-setting-words.lazy.js +9 -0
- package/dist/utility/wrun/wrun-setting-words.util.d.ts +79 -0
- package/dist/utility/wrun/wrun-setting-words.util.js +176 -0
- package/dist/utility/wrun/wrun-socket-row-store.d.ts +98 -0
- package/dist/utility/wrun/wrun-socket-row-store.js +417 -0
- package/dist/utility/wrun/wrun-style-flags.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-style-flags.util.js +21 -0
- package/dist/utility/wrun/wrun-style-words.util.d.ts +148 -0
- package/dist/utility/wrun/wrun-style-words.util.js +439 -0
- package/dist/utility/wrun/wrun-table-look.util.d.ts +125 -0
- package/dist/utility/wrun/wrun-table-look.util.js +225 -0
- package/dist/utility/wrun/wrun-text-look.util.d.ts +51 -0
- package/dist/utility/wrun/wrun-text-look.util.js +227 -0
- package/dist/utility/wrun/wrun-text-params.util.d.ts +106 -0
- package/dist/utility/wrun/wrun-text-params.util.js +171 -0
- package/dist/utility/wrun/wrun-tpo-rows.util.d.ts +71 -0
- package/dist/utility/wrun/wrun-tpo-rows.util.js +438 -0
- package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +14 -0
- package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +58 -0
- package/dist/utility/wrun/wrun-visibility-table.d.ts +437 -0
- package/dist/utility/wrun/wrun-visibility-table.js +237 -0
- package/dist/utility/wrun/wrun-volume-profile.util.d.ts +37 -0
- package/dist/utility/wrun/wrun-volume-profile.util.js +278 -0
- package/package.json +38 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { hasOwnRecordKey, isRecord, outputHasRenderableRows } from './kscript-run-result-shape.util.js';
|
|
2
|
+
// statsRow rides the decorator path (role 'table'): mounted with rows, never
|
|
3
|
+
// a pane parent or scale anchor; titan's StatsStripRenderer draws it.
|
|
4
|
+
const KSCRIPT_DECORATOR_PLOT_TYPES = new Set([
|
|
5
|
+
'bgcolor',
|
|
6
|
+
'barcolor',
|
|
7
|
+
'label',
|
|
8
|
+
'priceLabel',
|
|
9
|
+
'statsRow',
|
|
10
|
+
'table',
|
|
11
|
+
'text',
|
|
12
|
+
]);
|
|
13
|
+
const KSCRIPT_GUIDE_PLOT_TYPES = new Set(['hline', 'verticalLine']);
|
|
14
|
+
const KSCRIPT_CONTAINER_PLOT_TYPES = new Set(['empty']);
|
|
15
|
+
const KSCRIPT_DECORATOR_OUTPUT_ROLES = new Set(['background', 'helper', 'label', 'table']);
|
|
16
|
+
const KSCRIPT_DRAWABLE_OUTPUT_ROLES = new Set(['edge', 'fill', 'main', 'range']);
|
|
17
|
+
const KSCRIPT_DECLARED_OUTPUT_ROLES = new Set([
|
|
18
|
+
...KSCRIPT_DECORATOR_OUTPUT_ROLES,
|
|
19
|
+
...KSCRIPT_DRAWABLE_OUTPUT_ROLES,
|
|
20
|
+
'guide',
|
|
21
|
+
'marker',
|
|
22
|
+
]);
|
|
23
|
+
export const KSCRIPT_OFFCHART_MARKER_PARENT_FALLBACK_PLOT_TYPES = new Set([
|
|
24
|
+
'arrowDown',
|
|
25
|
+
'arrowUp',
|
|
26
|
+
'char',
|
|
27
|
+
'circle',
|
|
28
|
+
'cross',
|
|
29
|
+
'diamond',
|
|
30
|
+
'flag',
|
|
31
|
+
'markerLine',
|
|
32
|
+
'point',
|
|
33
|
+
'square',
|
|
34
|
+
'triangle',
|
|
35
|
+
// WRUN-STYLE OT06: the apex-down marker kind a `triangle_down` shape mounts as.
|
|
36
|
+
'triangleDown',
|
|
37
|
+
]);
|
|
38
|
+
export function isKScriptDeclaredMarkerPlotType(plotType) {
|
|
39
|
+
return (typeof plotType === 'string' &&
|
|
40
|
+
(KSCRIPT_OFFCHART_MARKER_PARENT_FALLBACK_PLOT_TYPES.has(plotType) || KSCRIPT_DECORATOR_PLOT_TYPES.has(plotType)));
|
|
41
|
+
}
|
|
42
|
+
function plotTypeOf(container) {
|
|
43
|
+
const plotType = container.plotType ?? container.plot;
|
|
44
|
+
return typeof plotType === 'string' ? plotType : undefined;
|
|
45
|
+
}
|
|
46
|
+
function paletteFromOutput(output) {
|
|
47
|
+
if (!isRecord(output))
|
|
48
|
+
return [];
|
|
49
|
+
for (const candidate of [output.colors, output.color]) {
|
|
50
|
+
if (Array.isArray(candidate)) {
|
|
51
|
+
const colors = candidate.filter((color) => typeof color === 'string' && color.length > 0);
|
|
52
|
+
if (colors.length)
|
|
53
|
+
return colors;
|
|
54
|
+
}
|
|
55
|
+
if (typeof candidate === 'string' && candidate.length > 0)
|
|
56
|
+
return [candidate];
|
|
57
|
+
}
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
/** False for a colour literal that paints nothing (alpha 0, `transparent`, empty). */
|
|
61
|
+
export function colorLiteralHasVisibleAlpha(color) {
|
|
62
|
+
const normalized = color.trim().toLowerCase();
|
|
63
|
+
if (!normalized || normalized === 'transparent')
|
|
64
|
+
return false;
|
|
65
|
+
const hex = normalized.match(/^#(?:[0-9a-f]{4}|[0-9a-f]{8})$/i);
|
|
66
|
+
// 4-digit #RGBA carries a single alpha nibble; slice(-2) would read blue+alpha.
|
|
67
|
+
if (hex)
|
|
68
|
+
return normalized.length === 5 ? normalized.slice(-1) !== '0' : normalized.slice(-2) !== '00';
|
|
69
|
+
const rgba = normalized.match(/^rgba\([^,]+,[^,]+,[^,]+,\s*([^)]+)\)$/i);
|
|
70
|
+
if (!rgba)
|
|
71
|
+
return true;
|
|
72
|
+
const alpha = rgba[1].trim();
|
|
73
|
+
if (alpha.endsWith('%'))
|
|
74
|
+
return Number.parseFloat(alpha) > 0;
|
|
75
|
+
return Number.parseFloat(alpha) > 0;
|
|
76
|
+
}
|
|
77
|
+
function outputHasVisiblePalette(output) {
|
|
78
|
+
const palette = paletteFromOutput(output);
|
|
79
|
+
if (!palette.length)
|
|
80
|
+
return true;
|
|
81
|
+
return palette.some(colorLiteralHasVisibleAlpha);
|
|
82
|
+
}
|
|
83
|
+
function outputHasPaletteDeclaration(output) {
|
|
84
|
+
return hasOwnRecordKey(output, 'colors') || hasOwnRecordKey(output, 'color');
|
|
85
|
+
}
|
|
86
|
+
export function classifyKScriptOutputRole(output, options = {}) {
|
|
87
|
+
const outputRecord = isRecord(output) ? output : null;
|
|
88
|
+
const plotType = outputRecord ? plotTypeOf(outputRecord) : undefined;
|
|
89
|
+
const outputRole = outputRecord && typeof outputRecord.outputRole === 'string' ? outputRecord.outputRole.toLowerCase() : undefined;
|
|
90
|
+
const paneParentCandidate = typeof outputRecord?.paneParentCandidate === 'boolean' ? outputRecord.paneParentCandidate : undefined;
|
|
91
|
+
const forceOnChart = outputRecord?.forceOnChart === true;
|
|
92
|
+
const hasStyleColumns = outputRecord !== null && Array.isArray(outputRecord.styleProperties) && outputRecord.styleProperties.length > 0;
|
|
93
|
+
const visibilityInputs = outputRecord !== null && Array.isArray(outputRecord.visibilityInputs)
|
|
94
|
+
? outputRecord.visibilityInputs.filter((input) => typeof input === 'string' && input.length > 0)
|
|
95
|
+
: [];
|
|
96
|
+
const controlledByVisibilityInput = visibilityInputs.length > 0;
|
|
97
|
+
const hasDeclaredRole = outputRole !== undefined && KSCRIPT_DECLARED_OUTPUT_ROLES.has(outputRole);
|
|
98
|
+
const usesSelectionAppearance = options.appearance === 'selection';
|
|
99
|
+
let hasVisiblePalette = true;
|
|
100
|
+
let isDeclaredHelper = false;
|
|
101
|
+
let isContainer;
|
|
102
|
+
let isGuide;
|
|
103
|
+
let isDecorator;
|
|
104
|
+
let isFill;
|
|
105
|
+
let isDrawableChild;
|
|
106
|
+
let isScaleAnchor;
|
|
107
|
+
let invisibleAnchorCompat = false;
|
|
108
|
+
let canBePaneParent;
|
|
109
|
+
let canFallbackAsPaneParent;
|
|
110
|
+
let canBeOnchartParent;
|
|
111
|
+
let canAnchorStableContainer;
|
|
112
|
+
if (hasDeclaredRole && outputRole !== undefined) {
|
|
113
|
+
isDeclaredHelper = outputRole === 'helper';
|
|
114
|
+
isContainer = outputRecord?.kScriptContainer === true;
|
|
115
|
+
isGuide = outputRole === 'guide';
|
|
116
|
+
const isMarkerDecorator = outputRole === 'marker' && plotType !== undefined && KSCRIPT_DECORATOR_PLOT_TYPES.has(plotType);
|
|
117
|
+
isDecorator = isContainer || isGuide || isMarkerDecorator || KSCRIPT_DECORATOR_OUTPUT_ROLES.has(outputRole);
|
|
118
|
+
isFill = outputRole === 'fill';
|
|
119
|
+
const isParentRole = KSCRIPT_DRAWABLE_OUTPUT_ROLES.has(outputRole);
|
|
120
|
+
const usesLegacyParentFallback = paneParentCandidate === undefined && isParentRole;
|
|
121
|
+
const canProbeInvisibleAnchorCompat = outputRecord !== null &&
|
|
122
|
+
isParentRole &&
|
|
123
|
+
paneParentCandidate === true &&
|
|
124
|
+
!forceOnChart &&
|
|
125
|
+
outputHasPaletteDeclaration(outputRecord);
|
|
126
|
+
const canProbeLegacyParentFallback = outputRecord !== null && usesLegacyParentFallback && outputHasPaletteDeclaration(outputRecord);
|
|
127
|
+
hasVisiblePalette =
|
|
128
|
+
!usesSelectionAppearance || canProbeInvisibleAnchorCompat || canProbeLegacyParentFallback
|
|
129
|
+
? outputHasVisiblePalette(outputRecord)
|
|
130
|
+
: true;
|
|
131
|
+
const isMarker = outputRole === 'marker';
|
|
132
|
+
isDrawableChild = !isContainer && !isDecorator && (isParentRole || isMarker);
|
|
133
|
+
// Engines 3.0.45-3.0.47 declared transparent scale anchors as main +
|
|
134
|
+
// paneParentCandidate; helper-capable engines declare helper.
|
|
135
|
+
invisibleAnchorCompat = isParentRole && paneParentCandidate === true && !forceOnChart && !hasVisiblePalette;
|
|
136
|
+
isScaleAnchor =
|
|
137
|
+
invisibleAnchorCompat ||
|
|
138
|
+
(isParentRole && !forceOnChart && (paneParentCandidate === undefined || paneParentCandidate === true));
|
|
139
|
+
const legacyParentFallback = usesLegacyParentFallback && isScaleAnchor && hasVisiblePalette && outputRecord !== null
|
|
140
|
+
? outputHasRenderableRows(outputRecord)
|
|
141
|
+
: false;
|
|
142
|
+
canBePaneParent = invisibleAnchorCompat
|
|
143
|
+
? false
|
|
144
|
+
: usesLegacyParentFallback
|
|
145
|
+
? legacyParentFallback
|
|
146
|
+
: paneParentCandidate === true && isScaleAnchor;
|
|
147
|
+
canFallbackAsPaneParent = canBePaneParent;
|
|
148
|
+
canBeOnchartParent = canBePaneParent;
|
|
149
|
+
canAnchorStableContainer =
|
|
150
|
+
isScaleAnchor ||
|
|
151
|
+
(isMarker &&
|
|
152
|
+
!forceOnChart &&
|
|
153
|
+
plotType !== undefined &&
|
|
154
|
+
KSCRIPT_OFFCHART_MARKER_PARENT_FALLBACK_PLOT_TYPES.has(plotType));
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
isContainer =
|
|
158
|
+
outputRecord?.kScriptContainer === true ||
|
|
159
|
+
outputRole === 'container' ||
|
|
160
|
+
(plotType !== undefined && KSCRIPT_CONTAINER_PLOT_TYPES.has(plotType));
|
|
161
|
+
isGuide = outputRole === 'guide' || (plotType !== undefined && KSCRIPT_GUIDE_PLOT_TYPES.has(plotType));
|
|
162
|
+
isDecorator =
|
|
163
|
+
isContainer ||
|
|
164
|
+
isGuide ||
|
|
165
|
+
(plotType !== undefined && KSCRIPT_DECORATOR_PLOT_TYPES.has(plotType)) ||
|
|
166
|
+
(outputRole !== undefined && KSCRIPT_DECORATOR_OUTPUT_ROLES.has(outputRole));
|
|
167
|
+
isFill =
|
|
168
|
+
outputRole === 'fill' ||
|
|
169
|
+
Boolean(outputRecord &&
|
|
170
|
+
((outputRecord.fill === true && (plotType === 'spline' || plotType === 'line')) || plotType === 'fillBetween'));
|
|
171
|
+
hasVisiblePalette = outputHasVisiblePalette(outputRecord);
|
|
172
|
+
isDrawableChild =
|
|
173
|
+
!isContainer &&
|
|
174
|
+
!isDecorator &&
|
|
175
|
+
(isFill ||
|
|
176
|
+
Boolean(plotType && !KSCRIPT_DECORATOR_PLOT_TYPES.has(plotType)) ||
|
|
177
|
+
Boolean(outputRole && KSCRIPT_DRAWABLE_OUTPUT_ROLES.has(outputRole)));
|
|
178
|
+
isScaleAnchor = isDrawableChild && !forceOnChart;
|
|
179
|
+
canFallbackAsPaneParent =
|
|
180
|
+
isScaleAnchor && hasVisiblePalette && outputRecord !== null && outputHasRenderableRows(outputRecord);
|
|
181
|
+
canBePaneParent =
|
|
182
|
+
paneParentCandidate === true
|
|
183
|
+
? canFallbackAsPaneParent
|
|
184
|
+
: paneParentCandidate === false || outputRole === 'marker'
|
|
185
|
+
? false
|
|
186
|
+
: canFallbackAsPaneParent;
|
|
187
|
+
canBeOnchartParent =
|
|
188
|
+
isScaleAnchor && hasVisiblePalette && outputRecord !== null && outputHasRenderableRows(outputRecord);
|
|
189
|
+
canAnchorStableContainer = isScaleAnchor;
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
plotType,
|
|
193
|
+
outputRole,
|
|
194
|
+
roleSource: hasDeclaredRole ? 'declared' : 'inferred',
|
|
195
|
+
paneParentCandidate,
|
|
196
|
+
isDeclaredHelper,
|
|
197
|
+
isContainer,
|
|
198
|
+
isDecorator,
|
|
199
|
+
isGuide,
|
|
200
|
+
isFill,
|
|
201
|
+
isDrawableChild,
|
|
202
|
+
isScaleAnchor,
|
|
203
|
+
invisibleAnchorCompat,
|
|
204
|
+
canBePaneParent,
|
|
205
|
+
canFallbackAsPaneParent,
|
|
206
|
+
canBeOnchartParent,
|
|
207
|
+
canAnchorStableContainer,
|
|
208
|
+
emitsPriceDisplay: outputRecord?.showPriceDisplay === true || plotType === 'priceLabel',
|
|
209
|
+
hasStyleColumns,
|
|
210
|
+
hasVisiblePalette,
|
|
211
|
+
visibilityInputs,
|
|
212
|
+
controlledByVisibilityInput,
|
|
213
|
+
forceOnChart,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The settings keys that decide a run's provenance (a pure leaf, split out of kscript-venue-policy.util, which
|
|
3
|
+
* re-exports both names): the wrun script-input reader skips them without loading the venue policy's market
|
|
4
|
+
* tables. It rides the `@orangecharts/wrun-chart-host` package (docs/features/kscript/wrun/wrun-chart-host.md).
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Settings keys that decide a run's provenance, plus the execution flags that
|
|
8
|
+
* ride with them. Only first-party code paths (the control's settings rebuild,
|
|
9
|
+
* doc restore) may stamp them: a user script can declare an input with any
|
|
10
|
+
* name, and script-input values are spread over overlay settings, so without
|
|
11
|
+
* this guard an input literally named `subType` / `scriptSource` would
|
|
12
|
+
* overwrite the provenance discriminators and let a user run classify as
|
|
13
|
+
* first-party. The technical-script control skips these names when building
|
|
14
|
+
* the script-input spread; the input's declared default still drives the run.
|
|
15
|
+
*
|
|
16
|
+
* The same guard covers the first-party DOC STAMPS the control writes over the
|
|
17
|
+
* spread (`hasGuide` / `scriptAuthor`, the guide door): reserving the name is
|
|
18
|
+
* what keeps the stamp from silently replacing a same-named input's value on
|
|
19
|
+
* every rebuild, which ordering alone cannot do.
|
|
20
|
+
*/
|
|
21
|
+
export declare const KSCRIPT_RESERVED_PROVENANCE_KEYS: ReadonlySet<string>;
|
|
22
|
+
export declare function isReservedKScriptProvenanceKey(name: unknown): boolean;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The settings keys that decide a run's provenance (a pure leaf, split out of kscript-venue-policy.util, which
|
|
3
|
+
* re-exports both names): the wrun script-input reader skips them without loading the venue policy's market
|
|
4
|
+
* tables. It rides the `@orangecharts/wrun-chart-host` package (docs/features/kscript/wrun/wrun-chart-host.md).
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Settings keys that decide a run's provenance, plus the execution flags that
|
|
8
|
+
* ride with them. Only first-party code paths (the control's settings rebuild,
|
|
9
|
+
* doc restore) may stamp them: a user script can declare an input with any
|
|
10
|
+
* name, and script-input values are spread over overlay settings, so without
|
|
11
|
+
* this guard an input literally named `subType` / `scriptSource` would
|
|
12
|
+
* overwrite the provenance discriminators and let a user run classify as
|
|
13
|
+
* first-party. The technical-script control skips these names when building
|
|
14
|
+
* the script-input spread; the input's declared default still drives the run.
|
|
15
|
+
*
|
|
16
|
+
* The same guard covers the first-party DOC STAMPS the control writes over the
|
|
17
|
+
* spread (`hasGuide` / `scriptAuthor`, the guide door): reserving the name is
|
|
18
|
+
* what keeps the stamp from silently replacing a same-named input's value on
|
|
19
|
+
* every rebuild, which ordering alone cannot do.
|
|
20
|
+
*/
|
|
21
|
+
export const KSCRIPT_RESERVED_PROVENANCE_KEYS = new Set([
|
|
22
|
+
'customScriptId',
|
|
23
|
+
'subType',
|
|
24
|
+
'scriptSource',
|
|
25
|
+
'catalogSource',
|
|
26
|
+
'wrunRef',
|
|
27
|
+
'wrunRegistryRef',
|
|
28
|
+
'builtinTwinOf',
|
|
29
|
+
'wrunRunTarget',
|
|
30
|
+
'wrunAlertOutputs',
|
|
31
|
+
'wrunDraftRef',
|
|
32
|
+
// The window owner flag (window-cell.util): a package param of this name
|
|
33
|
+
// must never turn its own overlay into a window owner.
|
|
34
|
+
'wrunWindow',
|
|
35
|
+
// The own-cell stamp beside it: a package param of this name must never
|
|
36
|
+
// make its overlay's removal close a cell (wrun-window-close.util).
|
|
37
|
+
'wrunWindowOwnCell',
|
|
38
|
+
// The saved split beside them (window-geometry.util): a package param of
|
|
39
|
+
// this name must never size its own window's panes.
|
|
40
|
+
'wrunWindowSplit',
|
|
41
|
+
'isProtectedScript',
|
|
42
|
+
'codeVisibility',
|
|
43
|
+
'hasGuide',
|
|
44
|
+
'scriptAuthor',
|
|
45
|
+
// The doc's word that its script draws without plots (the technical-script
|
|
46
|
+
// control's contract stamp, read by the empty-run gates): a same-named
|
|
47
|
+
// input is never an input and never saves over the stamp.
|
|
48
|
+
'contractDeclaresNoPlots',
|
|
49
|
+
// The OPRA provenance stamp the fetch door and the chain lane write
|
|
50
|
+
// (options-overlay-provenance.util): the hosted chart read and the MCP
|
|
51
|
+
// withhold an overlay by it, so a same-named input must never clear it.
|
|
52
|
+
'metaExchange',
|
|
53
|
+
]);
|
|
54
|
+
export function isReservedKScriptProvenanceKey(name) {
|
|
55
|
+
return typeof name === 'string' && KSCRIPT_RESERVED_PROVENANCE_KEYS.has(name);
|
|
56
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Foreign-domain pane kinds emitted by kScript and panel hosts.
|
|
3
|
+
* Their rows live in a pane-private domain,
|
|
4
|
+
* NOT the shared time axis: slot 0 is a row/tile index or a numeric X, and
|
|
5
|
+
* null cells are legitimate series gaps. Every host-side transform that
|
|
6
|
+
* assumes time rows (timestamp validation, index-domain rewrites, row-merge,
|
|
7
|
+
* unsafe-row filtering) must treat these as opaque: the engine's ingestion
|
|
8
|
+
* door (`foreignPaneContract.ts`) owns their sanitization.
|
|
9
|
+
*/
|
|
10
|
+
export declare const KSCRIPT_FOREIGN_PANE_PLOT_TYPES: ReadonlySet<string>;
|
|
11
|
+
export declare function isKScriptForeignPanePlotType(plotType: unknown): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Maps an engine/server-contract plot name to the titan plot kind. Valid
|
|
14
|
+
* titan/frontend plot names pass through unchanged; nullish, non-string, and
|
|
15
|
+
* empty values stay nullish so callers' || fallback chains still apply.
|
|
16
|
+
*/
|
|
17
|
+
export declare function mapEnginePlotTypeToTitanPlotType(value: unknown): string | undefined;
|
|
18
|
+
export declare function rowsHaveDrawableCells(rows: unknown): boolean;
|
|
19
|
+
export declare const MAX_KSCRIPT_META_VISITS = 1000;
|
|
20
|
+
type KScriptRunResultRecord = Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* The FE-side payload boundary for packed style rows (see titan's
|
|
23
|
+
* STYLE_ROW_CONTRACT.md). Unlike titan's strict reader, this keeps the
|
|
24
|
+
* documented inference branches because the FE normalizes transitional wire
|
|
25
|
+
* shapes (flat parents seed styleDataOffset 0; multiValue arrivals can lack
|
|
26
|
+
* the field until normalization reconstructs it).
|
|
27
|
+
*/
|
|
28
|
+
export declare function kScriptPlottedValueEnd(row: unknown[], output: KScriptRunResultRecord): number;
|
|
29
|
+
/**
|
|
30
|
+
* The key a drawing row collapses by (`collapseRepeatedKScriptDrawingRows`):
|
|
31
|
+
* null for a row that is not `[ts, payload-object]`, for a payload without
|
|
32
|
+
* the key's anchor, and for every plot type that does not collapse. Exported
|
|
33
|
+
* for the live tail patch, which must know when a key crosses its window.
|
|
34
|
+
*/
|
|
35
|
+
export declare function kScriptDrawingRowCollapseKey(plotType: string | undefined, row: unknown): string | null;
|
|
36
|
+
/** Whether a plot's drawing rows collapse by key (`kScriptDrawingRowCollapseKey`). */
|
|
37
|
+
export declare function isKScriptCollapsedDrawingPlotType(plotType: string | undefined): plotType is string;
|
|
38
|
+
/**
|
|
39
|
+
* The run's bars as far as the caller knows them, for the label collapse: which bar comes right after
|
|
40
|
+
* another. The integration passes the run interval's width and, for a run at the chart's own interval,
|
|
41
|
+
* the chart's bars.
|
|
42
|
+
*/
|
|
43
|
+
export interface KScriptRunBars {
|
|
44
|
+
/** The run interval's width in ms: two stamps at most this far apart have no bar of the run between them. */
|
|
45
|
+
barMs?: number;
|
|
46
|
+
/** The run's bar stamps ascending, read on first need: a session gap or a weekend holds no bar, so the
|
|
47
|
+
* bars on either side of it are neighbours. */
|
|
48
|
+
barTimes?: () => readonly number[];
|
|
49
|
+
}
|
|
50
|
+
/** `runBars`: the run's bars as far as the caller knows them, which tell the label collapse the bar right before a
|
|
51
|
+
* label's; without them a label folds into the same label on its own bar alone. */
|
|
52
|
+
export declare function normalizeKScriptRunResultForTitanCharts<T>(runResult: T, runBars?: KScriptRunBars): T;
|
|
53
|
+
export {};
|