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