@supersolutions/super-chart-core 0.0.0 → 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/LICENSE +674 -0
- package/README.md +9 -1
- package/dist/chunk-5EZU3YKZ.js +6112 -0
- package/dist/chunk-B2X7UKEZ.js +1192 -0
- package/dist/index.d.ts +2299 -0
- package/dist/index.js +222 -0
- package/dist/indicators.d.ts +126 -0
- package/dist/indicators.js +511 -0
- package/dist/native.d.ts +2320 -0
- package/dist/native.js +308 -0
- package/package.json +48 -6
package/dist/native.js
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DATA_DRIVEN_DRAWING_LIMITS,
|
|
3
|
+
DATA_DRIVEN_DRAWING_TYPES,
|
|
4
|
+
DEFAULT_BARS,
|
|
5
|
+
DRAWING_IMAGE_LIMITS,
|
|
6
|
+
DRAWING_TYPES,
|
|
7
|
+
DataLoader,
|
|
8
|
+
DrawingStore,
|
|
9
|
+
ENGINE_CHART_TYPES,
|
|
10
|
+
EngineIndicators,
|
|
11
|
+
HistoryCache,
|
|
12
|
+
MARKET_ZONE_SCAN_LIMIT,
|
|
13
|
+
MAX_FREEHAND_POINTS,
|
|
14
|
+
MIN_BARS,
|
|
15
|
+
MIN_REPLAY_BARS,
|
|
16
|
+
REPLAY_BASE_STEP_MS,
|
|
17
|
+
RealtimeSeries,
|
|
18
|
+
RealtimeView,
|
|
19
|
+
TickCoalescer,
|
|
20
|
+
UNIT_MS,
|
|
21
|
+
WORKSPACE_DOCUMENT_LIMITS,
|
|
22
|
+
WorkspaceEventBus,
|
|
23
|
+
WorkspaceLoadQueue,
|
|
24
|
+
addPeriods,
|
|
25
|
+
applyRealtimeViewport,
|
|
26
|
+
barRemaining,
|
|
27
|
+
buildEngineFrame,
|
|
28
|
+
buildFinancialChartModel,
|
|
29
|
+
chartKeys,
|
|
30
|
+
clampContinuousViewport,
|
|
31
|
+
clampViewport,
|
|
32
|
+
copyWorkspaceMarket,
|
|
33
|
+
createBarCountdown,
|
|
34
|
+
createPriceScale,
|
|
35
|
+
createRealtimeChartFrame,
|
|
36
|
+
createRuntimeEnvironment,
|
|
37
|
+
createTimedReplay,
|
|
38
|
+
decideUnit,
|
|
39
|
+
defaultViewport,
|
|
40
|
+
derivePrecision,
|
|
41
|
+
detectFairValueGaps,
|
|
42
|
+
detectOrderBlocks,
|
|
43
|
+
dimensions,
|
|
44
|
+
drawingAnchorCount,
|
|
45
|
+
drawingUsesText,
|
|
46
|
+
fail,
|
|
47
|
+
financialGeometry,
|
|
48
|
+
formatBarDate,
|
|
49
|
+
formatCountdown,
|
|
50
|
+
fullViewport,
|
|
51
|
+
getBarCountdown,
|
|
52
|
+
hasHoles,
|
|
53
|
+
hasIssues,
|
|
54
|
+
header,
|
|
55
|
+
historyKey,
|
|
56
|
+
hitTestDrawingGeometry,
|
|
57
|
+
indexAtOrBefore,
|
|
58
|
+
indicatorSeries,
|
|
59
|
+
isHeikinAshiUp,
|
|
60
|
+
mergeBar,
|
|
61
|
+
mergeKind,
|
|
62
|
+
nearestBarIndex,
|
|
63
|
+
nearestChartIndex,
|
|
64
|
+
nextBarClose,
|
|
65
|
+
normalizeBar,
|
|
66
|
+
normalizeBars,
|
|
67
|
+
olderThan,
|
|
68
|
+
openingBars,
|
|
69
|
+
panViewport,
|
|
70
|
+
parsePeriod,
|
|
71
|
+
parseWorkspaceDocument,
|
|
72
|
+
periodKey,
|
|
73
|
+
prependReplay,
|
|
74
|
+
priceSeries,
|
|
75
|
+
projectAdditionalDrawing,
|
|
76
|
+
projectDataDrivenDrawing,
|
|
77
|
+
projectDrawing,
|
|
78
|
+
projectFreehandDrawing,
|
|
79
|
+
projectMarketOverlays,
|
|
80
|
+
pxToBars,
|
|
81
|
+
railSegment,
|
|
82
|
+
raster,
|
|
83
|
+
replayApply,
|
|
84
|
+
replayAtEnd,
|
|
85
|
+
replayBars,
|
|
86
|
+
requestRange,
|
|
87
|
+
resolvePeriod,
|
|
88
|
+
resolvePricePrecision,
|
|
89
|
+
resolveViewportLimits,
|
|
90
|
+
resolveXType,
|
|
91
|
+
samePeriod,
|
|
92
|
+
sameSymbol,
|
|
93
|
+
startReplay,
|
|
94
|
+
stepReplay,
|
|
95
|
+
symbolKey,
|
|
96
|
+
ta,
|
|
97
|
+
tickReplay,
|
|
98
|
+
toHeikinAshi,
|
|
99
|
+
validateDrawingImage,
|
|
100
|
+
validateEngineLayout,
|
|
101
|
+
validatePriceScale,
|
|
102
|
+
valueAtChartIndex,
|
|
103
|
+
viewportLimitsForWidth,
|
|
104
|
+
viewportSpan,
|
|
105
|
+
volumeProfile,
|
|
106
|
+
workspaceMarketKey,
|
|
107
|
+
zoomContinuousViewport,
|
|
108
|
+
zoomViewport
|
|
109
|
+
} from "./chunk-5EZU3YKZ.js";
|
|
110
|
+
import {
|
|
111
|
+
previousRangeHighLow
|
|
112
|
+
} from "./chunk-B2X7UKEZ.js";
|
|
113
|
+
|
|
114
|
+
// packages/core/src/platform/native.ts
|
|
115
|
+
function appVisibility(appState) {
|
|
116
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
117
|
+
let subscription = null;
|
|
118
|
+
let hidden = appState.currentState !== "active";
|
|
119
|
+
return {
|
|
120
|
+
get hidden() {
|
|
121
|
+
return listeners.size === 0 ? appState.currentState !== "active" : hidden;
|
|
122
|
+
},
|
|
123
|
+
addEventListener(type, listener) {
|
|
124
|
+
if (type !== "visibilitychange" || listeners.has(listener))
|
|
125
|
+
return;
|
|
126
|
+
listeners.add(listener);
|
|
127
|
+
if (subscription === null) {
|
|
128
|
+
hidden = appState.currentState !== "active";
|
|
129
|
+
subscription = appState.addEventListener("change", (state) => {
|
|
130
|
+
const next = state !== "active";
|
|
131
|
+
if (next === hidden)
|
|
132
|
+
return;
|
|
133
|
+
hidden = next;
|
|
134
|
+
for (const notify of [...listeners])
|
|
135
|
+
notify();
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (hidden)
|
|
139
|
+
listener();
|
|
140
|
+
},
|
|
141
|
+
removeEventListener(type, listener) {
|
|
142
|
+
if (type !== "visibilitychange")
|
|
143
|
+
return;
|
|
144
|
+
listeners.delete(listener);
|
|
145
|
+
if (listeners.size === 0 && subscription !== null) {
|
|
146
|
+
const previous = subscription;
|
|
147
|
+
subscription = null;
|
|
148
|
+
previous.remove();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function reconnectEvents(subscribe) {
|
|
154
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
155
|
+
let unsubscribe = null;
|
|
156
|
+
return {
|
|
157
|
+
addEventListener(type, listener) {
|
|
158
|
+
if (type !== "online" || listeners.has(listener))
|
|
159
|
+
return;
|
|
160
|
+
listeners.add(listener);
|
|
161
|
+
if (unsubscribe === null) {
|
|
162
|
+
unsubscribe = subscribe(() => {
|
|
163
|
+
for (const notify of [...listeners])
|
|
164
|
+
notify();
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
removeEventListener(type, listener) {
|
|
169
|
+
if (type !== "online")
|
|
170
|
+
return;
|
|
171
|
+
listeners.delete(listener);
|
|
172
|
+
if (listeners.size === 0 && unsubscribe !== null) {
|
|
173
|
+
const previous = unsubscribe;
|
|
174
|
+
unsubscribe = null;
|
|
175
|
+
previous();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function createNativeEnvironment(options = {}) {
|
|
181
|
+
const runtime = globalThis;
|
|
182
|
+
const visibility = options.appState === void 0 ? options.env?.visibility : appVisibility(options.appState);
|
|
183
|
+
const connectivity = options.subscribeReconnect === void 0 ? options.env?.connectivity : reconnectEvents(options.subscribeReconnect);
|
|
184
|
+
return createRuntimeEnvironment({
|
|
185
|
+
requestFrame: runtime.requestAnimationFrame?.bind(runtime),
|
|
186
|
+
cancelFrame: runtime.cancelAnimationFrame?.bind(runtime),
|
|
187
|
+
...options.env,
|
|
188
|
+
visibility,
|
|
189
|
+
connectivity,
|
|
190
|
+
hidden: options.env?.hidden ?? (() => visibility?.hidden === true)
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
function createNativeDataLoader(options) {
|
|
194
|
+
const { appState, subscribeReconnect, ...loader } = options;
|
|
195
|
+
return new DataLoader({ ...loader, env: createNativeEnvironment({ appState, subscribeReconnect, env: loader.env }) });
|
|
196
|
+
}
|
|
197
|
+
export {
|
|
198
|
+
DATA_DRIVEN_DRAWING_LIMITS,
|
|
199
|
+
DATA_DRIVEN_DRAWING_TYPES,
|
|
200
|
+
DEFAULT_BARS,
|
|
201
|
+
DRAWING_IMAGE_LIMITS,
|
|
202
|
+
DRAWING_TYPES,
|
|
203
|
+
DataLoader,
|
|
204
|
+
DrawingStore,
|
|
205
|
+
ENGINE_CHART_TYPES,
|
|
206
|
+
EngineIndicators,
|
|
207
|
+
HistoryCache,
|
|
208
|
+
MARKET_ZONE_SCAN_LIMIT,
|
|
209
|
+
MAX_FREEHAND_POINTS,
|
|
210
|
+
MIN_BARS,
|
|
211
|
+
MIN_REPLAY_BARS,
|
|
212
|
+
REPLAY_BASE_STEP_MS,
|
|
213
|
+
RealtimeSeries,
|
|
214
|
+
RealtimeView,
|
|
215
|
+
TickCoalescer,
|
|
216
|
+
UNIT_MS,
|
|
217
|
+
WORKSPACE_DOCUMENT_LIMITS,
|
|
218
|
+
WorkspaceEventBus,
|
|
219
|
+
WorkspaceLoadQueue,
|
|
220
|
+
addPeriods,
|
|
221
|
+
applyRealtimeViewport,
|
|
222
|
+
barRemaining,
|
|
223
|
+
buildEngineFrame,
|
|
224
|
+
buildFinancialChartModel,
|
|
225
|
+
chartKeys,
|
|
226
|
+
clampContinuousViewport,
|
|
227
|
+
clampViewport,
|
|
228
|
+
copyWorkspaceMarket,
|
|
229
|
+
createBarCountdown,
|
|
230
|
+
createNativeDataLoader,
|
|
231
|
+
createNativeEnvironment,
|
|
232
|
+
createPriceScale,
|
|
233
|
+
createRealtimeChartFrame,
|
|
234
|
+
createRuntimeEnvironment,
|
|
235
|
+
createTimedReplay,
|
|
236
|
+
decideUnit,
|
|
237
|
+
defaultViewport,
|
|
238
|
+
derivePrecision,
|
|
239
|
+
detectFairValueGaps,
|
|
240
|
+
detectOrderBlocks,
|
|
241
|
+
dimensions,
|
|
242
|
+
drawingAnchorCount,
|
|
243
|
+
drawingUsesText,
|
|
244
|
+
fail,
|
|
245
|
+
financialGeometry,
|
|
246
|
+
formatBarDate,
|
|
247
|
+
formatCountdown,
|
|
248
|
+
fullViewport,
|
|
249
|
+
getBarCountdown,
|
|
250
|
+
hasHoles,
|
|
251
|
+
hasIssues,
|
|
252
|
+
header,
|
|
253
|
+
historyKey,
|
|
254
|
+
hitTestDrawingGeometry,
|
|
255
|
+
indexAtOrBefore,
|
|
256
|
+
isHeikinAshiUp,
|
|
257
|
+
mergeBar,
|
|
258
|
+
mergeKind,
|
|
259
|
+
indicatorSeries as nativeIndicatorSeries,
|
|
260
|
+
nearestBarIndex,
|
|
261
|
+
nearestChartIndex,
|
|
262
|
+
nextBarClose,
|
|
263
|
+
normalizeBar,
|
|
264
|
+
normalizeBars,
|
|
265
|
+
olderThan,
|
|
266
|
+
openingBars,
|
|
267
|
+
panViewport,
|
|
268
|
+
parsePeriod,
|
|
269
|
+
parseWorkspaceDocument,
|
|
270
|
+
periodKey,
|
|
271
|
+
prependReplay,
|
|
272
|
+
previousRangeHighLow,
|
|
273
|
+
priceSeries,
|
|
274
|
+
projectAdditionalDrawing,
|
|
275
|
+
projectDataDrivenDrawing,
|
|
276
|
+
projectDrawing,
|
|
277
|
+
projectFreehandDrawing,
|
|
278
|
+
projectMarketOverlays,
|
|
279
|
+
pxToBars,
|
|
280
|
+
railSegment,
|
|
281
|
+
raster,
|
|
282
|
+
replayApply,
|
|
283
|
+
replayAtEnd,
|
|
284
|
+
replayBars,
|
|
285
|
+
requestRange,
|
|
286
|
+
resolvePeriod,
|
|
287
|
+
resolvePricePrecision,
|
|
288
|
+
resolveViewportLimits,
|
|
289
|
+
resolveXType,
|
|
290
|
+
samePeriod,
|
|
291
|
+
sameSymbol,
|
|
292
|
+
startReplay,
|
|
293
|
+
stepReplay,
|
|
294
|
+
symbolKey,
|
|
295
|
+
ta,
|
|
296
|
+
tickReplay,
|
|
297
|
+
toHeikinAshi,
|
|
298
|
+
validateDrawingImage,
|
|
299
|
+
validateEngineLayout,
|
|
300
|
+
validatePriceScale,
|
|
301
|
+
valueAtChartIndex,
|
|
302
|
+
viewportLimitsForWidth,
|
|
303
|
+
viewportSpan,
|
|
304
|
+
volumeProfile,
|
|
305
|
+
workspaceMarketKey,
|
|
306
|
+
zoomContinuousViewport,
|
|
307
|
+
zoomViewport
|
|
308
|
+
};
|
package/package.json
CHANGED
|
@@ -1,16 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supersolutions/super-chart-core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Renderer-free chart core: market data, loader, indicators, drawings, frame and workspace models. No DOM.",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22"
|
|
9
|
+
},
|
|
6
10
|
"repository": {
|
|
7
11
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/Super-Solution/super-chart.git"
|
|
12
|
+
"url": "git+https://github.com/Super-Solution/super-chart.git",
|
|
13
|
+
"directory": "packages/core"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/Super-Solution/super-chart#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/Super-Solution/super-chart/issues"
|
|
9
18
|
},
|
|
19
|
+
"sideEffects": false,
|
|
10
20
|
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"LICENSE",
|
|
11
23
|
"README.md"
|
|
12
24
|
],
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"import": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./native": {
|
|
31
|
+
"types": "./dist/native.d.ts",
|
|
32
|
+
"react-native": "./dist/native.js",
|
|
33
|
+
"import": "./dist/native.js"
|
|
34
|
+
},
|
|
35
|
+
"./indicators": {
|
|
36
|
+
"types": "./dist/indicators.d.ts",
|
|
37
|
+
"import": "./dist/indicators.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"typesVersions": {
|
|
41
|
+
"*": {
|
|
42
|
+
"native": [
|
|
43
|
+
"./dist/native.d.ts"
|
|
44
|
+
],
|
|
45
|
+
"indicators": [
|
|
46
|
+
"./dist/indicators.d.ts"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"main": "./dist/index.js",
|
|
51
|
+
"types": "./dist/index.d.ts",
|
|
13
52
|
"publishConfig": {
|
|
14
|
-
"access": "public"
|
|
15
|
-
|
|
16
|
-
|
|
53
|
+
"access": "public",
|
|
54
|
+
"registry": "https://registry.npmjs.org/",
|
|
55
|
+
"tag": "latest"
|
|
56
|
+
},
|
|
57
|
+
"author": "SUPER SOLUTION LABS INC"
|
|
58
|
+
}
|