@xframes/node 0.0.12 → 0.0.13

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.
Files changed (46) hide show
  1. package/dist/App.d.ts +1 -0
  2. package/dist/App.js +10 -0
  3. package/dist/components/TradingGuiDemo/CryptoAssetPanels/CryptoAssetPanels.d.ts +3 -0
  4. package/dist/components/TradingGuiDemo/CryptoAssetPanels/CryptoAssetPanels.js +49 -0
  5. package/dist/components/TradingGuiDemo/CryptoAssetsList/CryptoAssetsList.d.ts +3 -0
  6. package/dist/components/TradingGuiDemo/CryptoAssetsList/CryptoAssetsList.js +62 -0
  7. package/dist/components/TradingGuiDemo/CryptoPlots/CryptoCandlestickPlot.d.ts +5 -0
  8. package/dist/components/TradingGuiDemo/CryptoPlots/CryptoCandlestickPlot.js +39 -0
  9. package/dist/components/TradingGuiDemo/CryptoPlots/CryptoCandlestickPlots.d.ts +3 -0
  10. package/dist/components/TradingGuiDemo/CryptoPlots/CryptoCandlestickPlots.js +17 -0
  11. package/dist/components/TradingGuiDemo/CryptoPlots/CryptoLinePlot.d.ts +5 -0
  12. package/dist/components/TradingGuiDemo/CryptoPlots/CryptoLinePlot.js +33 -0
  13. package/dist/components/TradingGuiDemo/CryptoPlots/CryptoLinePlots.d.ts +3 -0
  14. package/dist/components/TradingGuiDemo/CryptoPlots/CryptoLinePlots.js +17 -0
  15. package/dist/components/TradingGuiDemo/CryptoQuotePrice/CryptoQuotePrice.d.ts +5 -0
  16. package/dist/components/TradingGuiDemo/CryptoQuotePrice/CryptoQuotePrice.js +76 -0
  17. package/dist/components/TradingGuiDemo/CryptoSymbolBlock/CryptoSymbolBlock.d.ts +5 -0
  18. package/dist/components/TradingGuiDemo/CryptoSymbolBlock/CryptoSymbolBlock.js +56 -0
  19. package/dist/components/TradingGuiDemo/CryptoSymbolPairs/CryptoSymbolPair.d.ts +5 -0
  20. package/dist/components/TradingGuiDemo/CryptoSymbolPairs/CryptoSymbolPair.js +25 -0
  21. package/dist/components/TradingGuiDemo/Sidebar/Sidebar.d.ts +1 -0
  22. package/dist/components/TradingGuiDemo/Sidebar/Sidebar.js +52 -0
  23. package/dist/components/TradingGuiDemo/Tabs/Tabs.d.ts +7 -0
  24. package/dist/components/TradingGuiDemo/Tabs/Tabs.js +95 -0
  25. package/dist/components/TradingGuiDemo/TradingGuiDemo.d.ts +1 -0
  26. package/dist/components/TradingGuiDemo/TradingGuiDemo.js +299 -0
  27. package/dist/components/TradingGuiDemo/cryptoSymbols.d.ts +1 -0
  28. package/dist/components/TradingGuiDemo/cryptoSymbols.js +64 -0
  29. package/dist/components/TradingGuiDemo/dataService.d.ts +22 -0
  30. package/dist/components/TradingGuiDemo/dataService.js +33 -0
  31. package/dist/components/TradingGuiDemo/dataServiceContext.d.ts +3 -0
  32. package/dist/components/TradingGuiDemo/dataServiceContext.js +13 -0
  33. package/dist/components/TradingGuiDemo/store.d.ts +17 -0
  34. package/dist/components/TradingGuiDemo/store.js +35 -0
  35. package/dist/index.d.ts +1 -401
  36. package/dist/index.js +17 -1543
  37. package/dist/lib/XFrames.d.ts +228 -0
  38. package/dist/lib/XFrames.js +9 -0
  39. package/dist/lib/index.d.ts +3 -0
  40. package/dist/lib/index.js +7 -0
  41. package/dist/lib/render.d.ts +21 -0
  42. package/dist/lib/render.js +84 -0
  43. package/dist/themes.d.ts +26 -0
  44. package/dist/themes.js +145 -0
  45. package/dist/xframes.node +0 -0
  46. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,1543 +1,17 @@
1
- System.register("lib/XFrames", ["@xframes/common"], function (exports_1, context_1) {
2
- "use strict";
3
- var common_1, MainComponent, XFrames;
4
- var __moduleName = context_1 && context_1.id;
5
- return {
6
- setters: [
7
- function (common_1_1) {
8
- common_1 = common_1_1;
9
- }
10
- ],
11
- execute: function () {
12
- exports_1("MainComponent", MainComponent = ({ children, }) => {
13
- return null;
14
- });
15
- exports_1("XFrames", XFrames = common_1.attachSubComponents("XFrames", MainComponent, common_1.components));
16
- }
17
- };
18
- });
19
- System.register("components/TradingGuiDemo/cryptoSymbols", [], function (exports_2, context_2) {
20
- "use strict";
21
- var cryptoSymbols;
22
- var __moduleName = context_2 && context_2.id;
23
- return {
24
- setters: [],
25
- execute: function () {
26
- exports_2("cryptoSymbols", cryptoSymbols = [
27
- "SUSHI/USD",
28
- "YFI/USD",
29
- "LTC/USD",
30
- "DOGE/USD",
31
- "BCH/USDT",
32
- "BAT/USDC",
33
- "BAT/USD",
34
- "CRV/USDC",
35
- "SHIB/USDT",
36
- "BCH/USDC",
37
- "LINK/USDT",
38
- "LINK/USDC",
39
- "BCH/USD",
40
- "CRV/USD",
41
- "AVAX/USDT",
42
- "LTC/USDT",
43
- "XTZ/USDC",
44
- "BTC/USDT",
45
- "AVAX/USDC",
46
- "XTZ/USD",
47
- // "AVAX/USD",
48
- // "LTC/USDC",
49
- // "LINK/USD",
50
- // "LINK/BTC",
51
- // "SHIB/USDC",
52
- // "SOL/USDC",
53
- // "GRT/USDC",
54
- // "USDT/USDC",
55
- // "SOL/USD",
56
- // "SOL/USDT",
57
- // "SHIB/USD",
58
- // "DOGE/USDC",
59
- // "GRT/USD",
60
- // "ETH/USDT",
61
- // "USDT/USD",
62
- // "ETH/USDC",
63
- // "LTC/BTC",
64
- // "AAVE/USDT",
65
- // "ETH/USD",
66
- // "UNI/USDT",
67
- // "ETH/BTC",
68
- // "BCH/BTC",
69
- // "USDC/USD",
70
- // "YFI/USDT",
71
- // "UNI/USDC",
72
- // "DOT/USDC",
73
- // "DOT/USD",
74
- // "AAVE/USD",
75
- // "MKR/USDC",
76
- // "UNI/USD",
77
- // "AAVE/USDC",
78
- // "UNI/BTC",
79
- // "SUSHI/USDT",
80
- // "BTC/USDC",
81
- // "BTC/USD",
82
- // "SUSHI/USDC",
83
- // "YFI/USDC",
84
- // "MKR/USD",
85
- // "DOGE/USDT",
86
- ]);
87
- }
88
- };
89
- });
90
- System.register("components/TradingGuiDemo/store", ["zustand", "rxjs", "components/TradingGuiDemo/cryptoSymbols"], function (exports_3, context_3) {
91
- "use strict";
92
- var zustand_1, rxjs_1, cryptoSymbols_1, cryptoQuoteSubjectMap$, onLoadCryptoQuote, emptyCryptoQuote, useStore;
93
- var __moduleName = context_3 && context_3.id;
94
- return {
95
- setters: [
96
- function (zustand_1_1) {
97
- zustand_1 = zustand_1_1;
98
- },
99
- function (rxjs_1_1) {
100
- rxjs_1 = rxjs_1_1;
101
- },
102
- function (cryptoSymbols_1_1) {
103
- cryptoSymbols_1 = cryptoSymbols_1_1;
104
- }
105
- ],
106
- execute: function () {
107
- cryptoQuoteSubjectMap$ = new rxjs_1.BehaviorSubject(new Map());
108
- exports_3("onLoadCryptoQuote", onLoadCryptoQuote = (symbol, cryptoQuote) => {
109
- console.log(symbol, cryptoQuote);
110
- const map = cryptoQuoteSubjectMap$.getValue();
111
- if (!map.has(symbol)) {
112
- map.set(symbol, new rxjs_1.BehaviorSubject(cryptoQuote));
113
- }
114
- else {
115
- const subject$ = map.get(symbol);
116
- subject$?.next(cryptoQuote);
117
- // map.set(symbol, subject$ as CryptoQuoteSubject);
118
- }
119
- cryptoQuoteSubjectMap$.next(map);
120
- });
121
- exports_3("emptyCryptoQuote", emptyCryptoQuote = Object.freeze({
122
- Timestamp: "",
123
- BidPrice: 0,
124
- BidSize: 0,
125
- AskPrice: 0,
126
- AskSize: 0,
127
- }));
128
- exports_3("useStore", useStore = zustand_1.create((set) => ({
129
- cryptoAssets: [],
130
- symbols: cryptoSymbols_1.cryptoSymbols,
131
- selectedTabIndex: 0,
132
- setCryptoAssets: (cryptoAssets) => set(() => ({ cryptoAssets })),
133
- setSelectedTabIndex: (index) => set(() => ({ selectedTabIndex: index })),
134
- })));
135
- }
136
- };
137
- });
138
- System.register("components/TradingGuiDemo/dataService", ["rxjs"], function (exports_4, context_4) {
139
- "use strict";
140
- var rxjs_2, DataService;
141
- var __moduleName = context_4 && context_4.id;
142
- return {
143
- setters: [
144
- function (rxjs_2_1) {
145
- rxjs_2 = rxjs_2_1;
146
- }
147
- ],
148
- execute: function () {
149
- DataService = class DataService {
150
- cryptoQuotes;
151
- cryptoSnapshots;
152
- cryptoBarDatasets;
153
- constructor() {
154
- this.cryptoQuotes = new rxjs_2.ReplaySubject(100000);
155
- this.cryptoSnapshots = new rxjs_2.ReplaySubject(100000);
156
- this.cryptoBarDatasets = new rxjs_2.ReplaySubject(100000);
157
- }
158
- addCryptoQuote(cryptoQuote) {
159
- this.cryptoQuotes.next(cryptoQuote);
160
- }
161
- addCryptoSnapshots(cryptoSnapshots) {
162
- this.cryptoSnapshots.next(cryptoSnapshots);
163
- }
164
- addCryptoBars(cryptoBarDataset) {
165
- this.cryptoBarDatasets.next(cryptoBarDataset);
166
- }
167
- getCryptoQuotes() {
168
- return this.cryptoQuotes.asObservable();
169
- }
170
- getCryptoSnapshots() {
171
- return this.cryptoSnapshots.asObservable();
172
- }
173
- getCryptoBarDatasets() {
174
- return this.cryptoBarDatasets.asObservable();
175
- }
176
- };
177
- exports_4("DataService", DataService);
178
- }
179
- };
180
- });
181
- System.register("components/TradingGuiDemo/dataServiceContext", ["react"], function (exports_5, context_5) {
182
- "use strict";
183
- var react_1, DataServiceContext, useDataService;
184
- var __moduleName = context_5 && context_5.id;
185
- return {
186
- setters: [
187
- function (react_1_1) {
188
- react_1 = react_1_1;
189
- }
190
- ],
191
- execute: function () {
192
- exports_5("DataServiceContext", DataServiceContext = react_1.createContext(null));
193
- exports_5("useDataService", useDataService = () => {
194
- const context = react_1.useContext(DataServiceContext);
195
- if (context) {
196
- return context;
197
- }
198
- throw new Error("DataServiceContext initialisation failed");
199
- });
200
- }
201
- };
202
- });
203
- System.register("components/TradingGuiDemo/CryptoPlots/CryptoLinePlot", ["react/jsx-runtime", "react", "components/TradingGuiDemo/dataServiceContext", "@xframes/common", "rxjs", "lib/XFrames"], function (exports_6, context_6) {
204
- "use strict";
205
- var jsx_runtime_1, react_2, dataServiceContext_1, common_2, rxjs_3, XFrames_1, CryptoLinePlot;
206
- var __moduleName = context_6 && context_6.id;
207
- return {
208
- setters: [
209
- function (jsx_runtime_1_1) {
210
- jsx_runtime_1 = jsx_runtime_1_1;
211
- },
212
- function (react_2_1) {
213
- react_2 = react_2_1;
214
- },
215
- function (dataServiceContext_1_1) {
216
- dataServiceContext_1 = dataServiceContext_1_1;
217
- },
218
- function (common_2_1) {
219
- common_2 = common_2_1;
220
- },
221
- function (rxjs_3_1) {
222
- rxjs_3 = rxjs_3_1;
223
- },
224
- function (XFrames_1_1) {
225
- XFrames_1 = XFrames_1_1;
226
- }
227
- ],
228
- execute: function () {
229
- exports_6("CryptoLinePlot", CryptoLinePlot = ({ symbol }) => {
230
- const dataService = dataServiceContext_1.useDataService();
231
- const plotRef = react_2.useRef(null);
232
- // const [axisAutoFit, setAxisAutoFit] = useState(true);
233
- react_2.useEffect(() => {
234
- const subscription = dataService
235
- .getCryptoQuotes()
236
- .pipe(rxjs_3.filter((cryptoQuote) => cryptoQuote.S === symbol))
237
- .subscribe((quote) => {
238
- if (plotRef.current) {
239
- const date = new Date(quote.Timestamp);
240
- plotRef.current.appendData(Number(date) / 1000, quote.BidPrice);
241
- }
242
- });
243
- return () => {
244
- subscription.unsubscribe();
245
- };
246
- }, [dataService]);
247
- // const toggleAxisAutoFit = useCallback(() => {
248
- // setAxisAutoFit((val) => !val);
249
- // }, []);
250
- return (_jsx(XFrames_1.XFrames.PlotLine, { xAxisScale: common_2.ImPlotScale.Time, ref: plotRef, style: { width: "100%", height: 400 } }));
251
- });
252
- }
253
- };
254
- });
255
- System.register("components/TradingGuiDemo/CryptoPlots/CryptoLinePlots", ["react/jsx-runtime", "components/TradingGuiDemo/store", "components/TradingGuiDemo/CryptoPlots/CryptoLinePlot", "lib/XFrames"], function (exports_7, context_7) {
256
- "use strict";
257
- var jsx_runtime_2, store_1, CryptoLinePlot_1, XFrames_2, CryptoLinePlots;
258
- var __moduleName = context_7 && context_7.id;
259
- return {
260
- setters: [
261
- function (jsx_runtime_2_1) {
262
- jsx_runtime_2 = jsx_runtime_2_1;
263
- },
264
- function (store_1_1) {
265
- store_1 = store_1_1;
266
- },
267
- function (CryptoLinePlot_1_1) {
268
- CryptoLinePlot_1 = CryptoLinePlot_1_1;
269
- },
270
- function (XFrames_2_1) {
271
- XFrames_2 = XFrames_2_1;
272
- }
273
- ],
274
- execute: function () {
275
- exports_7("CryptoLinePlots", CryptoLinePlots = ({}) => {
276
- const symbols = store_1.useStore((state) => state.symbols);
277
- return (_jsx(XFrames_2.XFrames.Node, { style: {
278
- width: "100%",
279
- height: "100%",
280
- flexDirection: "column",
281
- gap: { row: 5 },
282
- }, children: symbols.map((sym) => (_jsx(CryptoLinePlot_1.CryptoLinePlot, { symbol: sym }, sym))) }));
283
- });
284
- }
285
- };
286
- });
287
- System.register("components/TradingGuiDemo/CryptoAssetsList/CryptoAssetsList", ["react/jsx-runtime", "react", "components/TradingGuiDemo/dataServiceContext", "lib/XFrames"], function (exports_8, context_8) {
288
- "use strict";
289
- var jsx_runtime_3, react_3, dataServiceContext_2, XFrames_3, CryptoAssetsList;
290
- var __moduleName = context_8 && context_8.id;
291
- return {
292
- setters: [
293
- function (jsx_runtime_3_1) {
294
- jsx_runtime_3 = jsx_runtime_3_1;
295
- },
296
- function (react_3_1) {
297
- react_3 = react_3_1;
298
- },
299
- function (dataServiceContext_2_1) {
300
- dataServiceContext_2 = dataServiceContext_2_1;
301
- },
302
- function (XFrames_3_1) {
303
- XFrames_3 = XFrames_3_1;
304
- }
305
- ],
306
- execute: function () {
307
- exports_8("CryptoAssetsList", CryptoAssetsList = ({}) => {
308
- const dataService = dataServiceContext_2.useDataService();
309
- const tableRef = react_3.useRef(null);
310
- const tableColumns = react_3.useMemo(() => [
311
- {
312
- heading: "Symbol",
313
- fieldId: "symbol",
314
- },
315
- {
316
- heading: "ASK",
317
- fieldId: "askPrice",
318
- },
319
- {
320
- heading: "Change",
321
- fieldId: "askChange",
322
- },
323
- {
324
- heading: "BID",
325
- fieldId: "bidPrice",
326
- },
327
- {
328
- heading: "Change",
329
- fieldId: "bidChange",
330
- },
331
- ], []);
332
- react_3.useEffect(() => {
333
- const subscription = dataService
334
- .getCryptoSnapshots()
335
- .subscribe((snapshots) => {
336
- const data = Object.entries(snapshots).map(([symbol, snapshot]) => ({
337
- symbol,
338
- askPrice: snapshot.LatestQuote.AskPrice.toFixed(6),
339
- bidPrice: snapshot.LatestQuote.BidPrice.toFixed(6),
340
- // todo: totally unsure here
341
- askChange: (snapshot.LatestQuote.AskPrice - snapshot.DailyBar.Open).toFixed(6),
342
- bidChange: (snapshot.LatestQuote.BidPrice - snapshot.DailyBar.Open).toFixed(6),
343
- }));
344
- data.sort((a, b) => {
345
- if (a.symbol < b.symbol) {
346
- return -1;
347
- }
348
- else if (a.symbol > b.symbol) {
349
- return 1;
350
- }
351
- return 0;
352
- });
353
- tableRef.current?.setTableData(data);
354
- });
355
- return () => {
356
- subscription.unsubscribe();
357
- };
358
- }, [dataService]);
359
- return _jsx(XFrames_3.XFrames.Table, { ref: tableRef, columns: tableColumns });
360
- });
361
- }
362
- };
363
- });
364
- System.register("themes", ["@xframes/common"], function (exports_9, context_9) {
365
- "use strict";
366
- var common_3, theme1Colors, theme1, theme2Colors, theme2;
367
- var __moduleName = context_9 && context_9.id;
368
- return {
369
- setters: [
370
- function (common_3_1) {
371
- common_3 = common_3_1;
372
- }
373
- ],
374
- execute: function () {
375
- exports_9("theme1Colors", theme1Colors = {
376
- black: "#1a1a1a",
377
- darkGrey: "#5a5a5a",
378
- grey: "#9a9a9a",
379
- lightGrey: "#bebebe",
380
- veryLightGrey: "#e5e5e5",
381
- superLightGrey: "#f7f7f7",
382
- white: "#fff",
383
- hero: "#ff6e59",
384
- hoverHero: "#ff4a30",
385
- });
386
- exports_9("theme1", theme1 = {
387
- // frameBorderSize: 1,
388
- // framePadding: [0, 0],
389
- colors: {
390
- [common_3.ImGuiCol.Text]: [theme1Colors.black, 1],
391
- [common_3.ImGuiCol.TextDisabled]: [theme1Colors.darkGrey, 1],
392
- [common_3.ImGuiCol.WindowBg]: [theme1Colors.white, 1],
393
- [common_3.ImGuiCol.ChildBg]: [theme1Colors.white, 1],
394
- [common_3.ImGuiCol.PopupBg]: [theme1Colors.white, 1],
395
- [common_3.ImGuiCol.Border]: [theme1Colors.darkGrey, 1],
396
- [common_3.ImGuiCol.BorderShadow]: [theme1Colors.black, 1],
397
- [common_3.ImGuiCol.FrameBg]: [theme1Colors.veryLightGrey, 1],
398
- [common_3.ImGuiCol.FrameBgHovered]: [theme1Colors.lightGrey, 1],
399
- [common_3.ImGuiCol.FrameBgActive]: [theme1Colors.grey, 1],
400
- [common_3.ImGuiCol.TitleBg]: [theme1Colors.lightGrey, 1],
401
- [common_3.ImGuiCol.TitleBgActive]: [theme1Colors.grey, 1],
402
- [common_3.ImGuiCol.TitleBgCollapsed]: [theme1Colors.veryLightGrey, 1],
403
- [common_3.ImGuiCol.MenuBarBg]: [theme1Colors.grey, 1],
404
- [common_3.ImGuiCol.ScrollbarBg]: [theme1Colors.veryLightGrey, 1],
405
- [common_3.ImGuiCol.ScrollbarGrab]: [theme1Colors.grey, 1],
406
- [common_3.ImGuiCol.ScrollbarGrabHovered]: [theme1Colors.darkGrey, 1],
407
- [common_3.ImGuiCol.ScrollbarGrabActive]: [theme1Colors.black, 1],
408
- [common_3.ImGuiCol.CheckMark]: [theme1Colors.black, 1],
409
- [common_3.ImGuiCol.SliderGrab]: [theme1Colors.grey, 1],
410
- [common_3.ImGuiCol.SliderGrabActive]: [theme1Colors.darkGrey, 1],
411
- [common_3.ImGuiCol.Button]: [theme1Colors.lightGrey, 1],
412
- [common_3.ImGuiCol.ButtonHovered]: [theme1Colors.grey, 1],
413
- [common_3.ImGuiCol.ButtonActive]: [theme1Colors.darkGrey, 1],
414
- [common_3.ImGuiCol.Header]: [theme1Colors.veryLightGrey, 1],
415
- [common_3.ImGuiCol.HeaderHovered]: [theme1Colors.lightGrey, 1],
416
- [common_3.ImGuiCol.HeaderActive]: [theme1Colors.grey, 1],
417
- [common_3.ImGuiCol.Separator]: [theme1Colors.black, 1],
418
- [common_3.ImGuiCol.SeparatorHovered]: [theme1Colors.veryLightGrey, 1],
419
- [common_3.ImGuiCol.SeparatorActive]: [theme1Colors.lightGrey, 1],
420
- [common_3.ImGuiCol.ResizeGrip]: [theme1Colors.veryLightGrey, 1],
421
- [common_3.ImGuiCol.ResizeGripHovered]: [theme1Colors.lightGrey, 1],
422
- [common_3.ImGuiCol.ResizeGripActive]: [theme1Colors.grey, 1],
423
- [common_3.ImGuiCol.Tab]: [theme1Colors.veryLightGrey, 1],
424
- [common_3.ImGuiCol.TabHovered]: [theme1Colors.lightGrey, 1],
425
- [common_3.ImGuiCol.TabActive]: [theme1Colors.grey, 1],
426
- [common_3.ImGuiCol.TabUnfocused]: [theme1Colors.veryLightGrey, 1],
427
- [common_3.ImGuiCol.TabUnfocusedActive]: [theme1Colors.lightGrey, 1],
428
- [common_3.ImGuiCol.PlotLines]: [theme1Colors.grey, 1],
429
- [common_3.ImGuiCol.PlotLinesHovered]: [theme1Colors.darkGrey, 1],
430
- [common_3.ImGuiCol.PlotHistogram]: [theme1Colors.grey, 1],
431
- [common_3.ImGuiCol.PlotHistogramHovered]: [theme1Colors.darkGrey, 1],
432
- [common_3.ImGuiCol.TableHeaderBg]: [theme1Colors.grey, 1],
433
- [common_3.ImGuiCol.TableBorderStrong]: [theme1Colors.darkGrey, 1],
434
- [common_3.ImGuiCol.TableBorderLight]: [theme1Colors.lightGrey, 1],
435
- [common_3.ImGuiCol.TableRowBg]: [theme1Colors.veryLightGrey, 1],
436
- [common_3.ImGuiCol.TableRowBgAlt]: [theme1Colors.white, 1],
437
- [common_3.ImGuiCol.TextSelectedBg]: [theme1Colors.grey, 1],
438
- [common_3.ImGuiCol.DragDropTarget]: [theme1Colors.grey, 1],
439
- [common_3.ImGuiCol.NavHighlight]: [theme1Colors.grey, 1],
440
- [common_3.ImGuiCol.NavWindowingHighlight]: [theme1Colors.grey, 1],
441
- [common_3.ImGuiCol.NavWindowingDimBg]: [theme1Colors.grey, 1],
442
- [common_3.ImGuiCol.ModalWindowDimBg]: [theme1Colors.grey, 1],
443
- },
444
- });
445
- exports_9("theme2Colors", theme2Colors = {
446
- darkestGrey: "#141f2c",
447
- darkerGrey: "#2a2e39",
448
- darkGrey: "#363b4a",
449
- lightGrey: "#5a5a5a",
450
- lighterGrey: "#7A818C",
451
- evenLighterGrey: "#8491a3",
452
- black: "#0A0B0D",
453
- green: "#75f986",
454
- red: "#ff0062",
455
- white: "#fff",
456
- });
457
- exports_9("theme2", theme2 = {
458
- // frameBorderSize: 1,
459
- // framePadding: [0, 0],
460
- colors: {
461
- [common_3.ImGuiCol.Text]: [theme2Colors.white, 1],
462
- [common_3.ImGuiCol.TextDisabled]: [theme2Colors.lighterGrey, 1],
463
- [common_3.ImGuiCol.WindowBg]: [theme2Colors.black, 1],
464
- [common_3.ImGuiCol.ChildBg]: [theme2Colors.black, 1],
465
- [common_3.ImGuiCol.PopupBg]: [theme2Colors.white, 1],
466
- [common_3.ImGuiCol.Border]: [theme2Colors.lightGrey, 1],
467
- [common_3.ImGuiCol.BorderShadow]: [theme2Colors.darkestGrey, 1],
468
- [common_3.ImGuiCol.FrameBg]: [theme2Colors.black, 1],
469
- [common_3.ImGuiCol.FrameBgHovered]: [theme2Colors.darkerGrey, 1], //
470
- [common_3.ImGuiCol.FrameBgActive]: [theme2Colors.lightGrey, 1],
471
- [common_3.ImGuiCol.TitleBg]: [theme2Colors.lightGrey, 1],
472
- [common_3.ImGuiCol.TitleBgActive]: [theme2Colors.darkerGrey, 1], //
473
- [common_3.ImGuiCol.TitleBgCollapsed]: [theme2Colors.lightGrey, 1],
474
- [common_3.ImGuiCol.MenuBarBg]: [theme2Colors.lightGrey, 1],
475
- [common_3.ImGuiCol.ScrollbarBg]: [theme2Colors.darkerGrey, 1], //
476
- [common_3.ImGuiCol.ScrollbarGrab]: [theme2Colors.darkerGrey, 1], //
477
- [common_3.ImGuiCol.ScrollbarGrabHovered]: [theme2Colors.lightGrey, 1],
478
- [common_3.ImGuiCol.ScrollbarGrabActive]: [theme2Colors.darkestGrey, 1],
479
- [common_3.ImGuiCol.CheckMark]: [theme2Colors.darkestGrey, 1],
480
- [common_3.ImGuiCol.SliderGrab]: [theme2Colors.darkerGrey, 1], //
481
- [common_3.ImGuiCol.SliderGrabActive]: [theme2Colors.lightGrey, 1],
482
- [common_3.ImGuiCol.Button]: [theme2Colors.black, 1],
483
- [common_3.ImGuiCol.ButtonHovered]: [theme2Colors.darkerGrey, 1], //
484
- [common_3.ImGuiCol.ButtonActive]: [theme2Colors.black, 1],
485
- [common_3.ImGuiCol.Header]: [theme2Colors.black, 1],
486
- [common_3.ImGuiCol.HeaderHovered]: [theme2Colors.black, 1],
487
- [common_3.ImGuiCol.HeaderActive]: [theme2Colors.lightGrey, 1],
488
- [common_3.ImGuiCol.Separator]: [theme2Colors.darkestGrey, 1],
489
- [common_3.ImGuiCol.SeparatorHovered]: [theme2Colors.lightGrey, 1],
490
- [common_3.ImGuiCol.SeparatorActive]: [theme2Colors.lightGrey, 1],
491
- [common_3.ImGuiCol.ResizeGrip]: [theme2Colors.black, 1],
492
- [common_3.ImGuiCol.ResizeGripHovered]: [theme2Colors.lightGrey, 1],
493
- [common_3.ImGuiCol.ResizeGripActive]: [theme2Colors.darkerGrey, 1], //
494
- [common_3.ImGuiCol.Tab]: [theme2Colors.black, 1],
495
- [common_3.ImGuiCol.TabHovered]: [theme2Colors.darkerGrey, 1], //
496
- [common_3.ImGuiCol.TabActive]: [theme2Colors.lightGrey, 1],
497
- [common_3.ImGuiCol.TabUnfocused]: [theme2Colors.black, 1],
498
- [common_3.ImGuiCol.TabUnfocusedActive]: [theme2Colors.lightGrey, 1],
499
- [common_3.ImGuiCol.PlotLines]: [theme2Colors.darkerGrey, 1], //
500
- [common_3.ImGuiCol.PlotLinesHovered]: [theme2Colors.lightGrey, 1],
501
- [common_3.ImGuiCol.PlotHistogram]: [theme2Colors.darkerGrey, 1], //
502
- [common_3.ImGuiCol.PlotHistogramHovered]: [theme2Colors.lightGrey, 1],
503
- [common_3.ImGuiCol.TableHeaderBg]: [theme2Colors.black, 1],
504
- [common_3.ImGuiCol.TableBorderStrong]: [theme2Colors.lightGrey, 1],
505
- [common_3.ImGuiCol.TableBorderLight]: [theme2Colors.darkerGrey, 1],
506
- [common_3.ImGuiCol.TableRowBg]: [theme2Colors.darkGrey, 1],
507
- [common_3.ImGuiCol.TableRowBgAlt]: [theme2Colors.darkerGrey, 1],
508
- [common_3.ImGuiCol.TextSelectedBg]: [theme2Colors.darkerGrey, 1], //
509
- [common_3.ImGuiCol.DragDropTarget]: [theme2Colors.darkerGrey, 1], //
510
- [common_3.ImGuiCol.NavHighlight]: [theme2Colors.darkerGrey, 1], //
511
- [common_3.ImGuiCol.NavWindowingHighlight]: [theme2Colors.darkerGrey, 1], //
512
- [common_3.ImGuiCol.NavWindowingDimBg]: [theme2Colors.darkerGrey, 1], //
513
- [common_3.ImGuiCol.ModalWindowDimBg]: [theme2Colors.darkerGrey, 1], //
514
- },
515
- });
516
- }
517
- };
518
- });
519
- System.register("components/TradingGuiDemo/CryptoQuotePrice/CryptoQuotePrice", ["react/jsx-runtime", "react", "rxjs", "@xframes/common", "components/TradingGuiDemo/dataServiceContext", "lib/XFrames", "themes"], function (exports_10, context_10) {
520
- "use strict";
521
- var jsx_runtime_4, react_4, rxjs_4, common_4, dataServiceContext_3, XFrames_4, themes_1, CryptoQuotePrice;
522
- var __moduleName = context_10 && context_10.id;
523
- return {
524
- setters: [
525
- function (jsx_runtime_4_1) {
526
- jsx_runtime_4 = jsx_runtime_4_1;
527
- },
528
- function (react_4_1) {
529
- react_4 = react_4_1;
530
- },
531
- function (rxjs_4_1) {
532
- rxjs_4 = rxjs_4_1;
533
- },
534
- function (common_4_1) {
535
- common_4 = common_4_1;
536
- },
537
- function (dataServiceContext_3_1) {
538
- dataServiceContext_3 = dataServiceContext_3_1;
539
- },
540
- function (XFrames_4_1) {
541
- XFrames_4 = XFrames_4_1;
542
- },
543
- function (themes_1_1) {
544
- themes_1 = themes_1_1;
545
- }
546
- ],
547
- execute: function () {
548
- exports_10("CryptoQuotePrice", CryptoQuotePrice = ({ symbol }) => {
549
- const [data, setData] = react_4.useState({
550
- lastUpdated: "n/a",
551
- });
552
- // const [lastUpdated, setLastUpdated] = useState<string>("n/a");
553
- const dataService = dataServiceContext_3.useDataService();
554
- react_4.useEffect(() => {
555
- const subscription = dataService
556
- .getCryptoQuotes()
557
- .pipe(rxjs_4.filter((cryptoQuote) => cryptoQuote.S === symbol))
558
- .subscribe((quote) => {
559
- const newData = {
560
- quote,
561
- lastUpdated: "n/a",
562
- };
563
- setData((oldData) => {
564
- // if (oldData.quote) {
565
- // const quoteDate = new Date(quote.Timestamp);
566
- // const previousDate = new Date(oldData.quote.Timestamp);
567
- // const msDiff = differenceInMilliseconds(quoteDate, previousDate);
568
- // if (msDiff >= 1000) {
569
- // newData.lastUpdated = formatDuration(
570
- // intervalToDuration(interval(quoteDate, previousDate)),
571
- // );
572
- // } else {
573
- // newData.lastUpdated = `${msDiff}ms ago`;
574
- // }
575
- // }
576
- return newData;
577
- });
578
- });
579
- return () => {
580
- subscription.unsubscribe();
581
- };
582
- }, [dataService]);
583
- const styleSheet = react_4.useMemo(() => common_4.RWStyleSheet.create({
584
- pricesWrapper: {
585
- alignSelf: "center",
586
- flexDirection: "row",
587
- gap: { column: 5 },
588
- },
589
- price: {
590
- width: 100,
591
- height: "auto",
592
- // borderColor: "#000",
593
- // borderThickness: 1,
594
- alignItems: "center",
595
- },
596
- ask: {
597
- colors: {
598
- [common_4.ImGuiCol.Text]: themes_1.theme2Colors.red,
599
- },
600
- },
601
- bid: {
602
- colors: {
603
- [common_4.ImGuiCol.Text]: themes_1.theme2Colors.green,
604
- },
605
- },
606
- }), []);
607
- return (_jsx(_Fragment, { children: _jsxs(XFrames_4.XFrames.Node, { style: styleSheet.pricesWrapper, children: [_jsxs(XFrames_4.XFrames.Node, { style: styleSheet.price, children: [_jsx(XFrames_4.XFrames.UnformattedText, { text: "ASK", style: styleSheet.ask }), _jsx(XFrames_4.XFrames.UnformattedText, { text: typeof data?.quote?.AskPrice === "number"
608
- ? data?.quote?.AskPrice.toFixed(6)
609
- : "n/a", style: styleSheet.ask })] }), _jsxs(XFrames_4.XFrames.Node, { style: styleSheet.price, children: [_jsx(XFrames_4.XFrames.UnformattedText, { text: "BID", style: styleSheet.bid }), _jsx(XFrames_4.XFrames.UnformattedText, { text: typeof data?.quote?.BidPrice === "number"
610
- ? data?.quote?.BidPrice.toFixed(6)
611
- : "n/a", style: styleSheet.bid })] })] }) }));
612
- });
613
- }
614
- };
615
- });
616
- System.register("components/TradingGuiDemo/CryptoAssetPanels/CryptoAssetPanels", ["react/jsx-runtime", "react", "components/TradingGuiDemo/store", "components/TradingGuiDemo/CryptoQuotePrice/CryptoQuotePrice", "@xframes/common", "lib/XFrames"], function (exports_11, context_11) {
617
- "use strict";
618
- var jsx_runtime_5, react_5, store_2, CryptoQuotePrice_1, common_5, XFrames_5, CryptoAssetPanels;
619
- var __moduleName = context_11 && context_11.id;
620
- return {
621
- setters: [
622
- function (jsx_runtime_5_1) {
623
- jsx_runtime_5 = jsx_runtime_5_1;
624
- },
625
- function (react_5_1) {
626
- react_5 = react_5_1;
627
- },
628
- function (store_2_1) {
629
- store_2 = store_2_1;
630
- },
631
- function (CryptoQuotePrice_1_1) {
632
- CryptoQuotePrice_1 = CryptoQuotePrice_1_1;
633
- },
634
- function (common_5_1) {
635
- common_5 = common_5_1;
636
- },
637
- function (XFrames_5_1) {
638
- XFrames_5 = XFrames_5_1;
639
- }
640
- ],
641
- execute: function () {
642
- exports_11("CryptoAssetPanels", CryptoAssetPanels = ({}) => {
643
- const cryptoAssets = store_2.useStore((state) => state.cryptoAssets.sort((a, b) => {
644
- if (a.symbol < b.symbol) {
645
- return -1;
646
- }
647
- else if (a.symbol > b.symbol) {
648
- return 1;
649
- }
650
- return 0;
651
- }));
652
- const styleSheet = react_5.useMemo(() => common_5.RWStyleSheet.create({
653
- mainWrapperNode: {
654
- width: "100%",
655
- height: "auto",
656
- flexDirection: "row",
657
- flexWrap: "wrap",
658
- gap: { row: 5, column: 5 },
659
- },
660
- asset: {
661
- minWidth: 200,
662
- maxWidth: 240,
663
- flex: 1,
664
- height: "auto",
665
- border: {
666
- color: "#000",
667
- thickness: 1,
668
- },
669
- alignItems: "center",
670
- padding: { vertical: 5 },
671
- gap: { row: 5 },
672
- },
673
- symbol: {
674
- font: { name: "roboto-regular", size: 24 },
675
- },
676
- }), []);
677
- return (_jsx(XFrames_5.XFrames.Node, { style: styleSheet.mainWrapperNode, children: cryptoAssets.map((asset) => {
678
- return (_jsxs(XFrames_5.XFrames.Node, { style: styleSheet.asset, children: [_jsx(XFrames_5.XFrames.UnformattedText, { style: styleSheet.symbol, text: asset.symbol }), _jsx(CryptoQuotePrice_1.CryptoQuotePrice, { symbol: asset.symbol })] }, asset.id));
679
- }) }));
680
- });
681
- }
682
- };
683
- });
684
- System.register("components/TradingGuiDemo/CryptoPlots/CryptoCandlestickPlot", ["react/jsx-runtime", "react", "rxjs", "components/TradingGuiDemo/dataServiceContext", "lib/XFrames"], function (exports_12, context_12) {
685
- "use strict";
686
- var jsx_runtime_6, react_6, rxjs_5, dataServiceContext_4, XFrames_6, CryptoCandlestickPlot;
687
- var __moduleName = context_12 && context_12.id;
688
- return {
689
- setters: [
690
- function (jsx_runtime_6_1) {
691
- jsx_runtime_6 = jsx_runtime_6_1;
692
- },
693
- function (react_6_1) {
694
- react_6 = react_6_1;
695
- },
696
- function (rxjs_5_1) {
697
- rxjs_5 = rxjs_5_1;
698
- },
699
- function (dataServiceContext_4_1) {
700
- dataServiceContext_4 = dataServiceContext_4_1;
701
- },
702
- function (XFrames_6_1) {
703
- XFrames_6 = XFrames_6_1;
704
- }
705
- ],
706
- execute: function () {
707
- exports_12("CryptoCandlestickPlot", CryptoCandlestickPlot = ({ symbol }) => {
708
- const dataService = dataServiceContext_4.useDataService();
709
- const plotRef = react_6.useRef(null);
710
- // const [axisAutoFit, setAxisAutoFit] = useState(true);
711
- react_6.useEffect(() => {
712
- const subscription = dataService
713
- .getCryptoBarDatasets()
714
- .pipe(rxjs_5.map((cryptoBars) => cryptoBars[symbol]))
715
- .subscribe((cryptoBarsForSymbol) => {
716
- if (plotRef.current) {
717
- const data = cryptoBarsForSymbol.map((cryptoBar) => ({
718
- date: Number(new Date(cryptoBar.Timestamp)) / 1000,
719
- open: cryptoBar.Open,
720
- close: cryptoBar.Close,
721
- high: cryptoBar.High,
722
- low: cryptoBar.Low,
723
- }));
724
- // console.log(data);
725
- plotRef.current.setData(data);
726
- }
727
- });
728
- return () => {
729
- subscription.unsubscribe();
730
- };
731
- }, [dataService]);
732
- // const toggleAxisAutoFit = useCallback(() => {
733
- // setAxisAutoFit((val) => !val);
734
- // }, []);
735
- return (_jsx(XFrames_6.XFrames.PlotCandlestick, { ref: plotRef, style: { width: "100%", height: 400 } }));
736
- });
737
- }
738
- };
739
- });
740
- System.register("components/TradingGuiDemo/CryptoPlots/CryptoCandlestickPlots", ["react/jsx-runtime", "components/TradingGuiDemo/store", "components/TradingGuiDemo/CryptoPlots/CryptoCandlestickPlot", "lib/XFrames"], function (exports_13, context_13) {
741
- "use strict";
742
- var jsx_runtime_7, store_3, CryptoCandlestickPlot_1, XFrames_7, CryptoCandlestickPlots;
743
- var __moduleName = context_13 && context_13.id;
744
- return {
745
- setters: [
746
- function (jsx_runtime_7_1) {
747
- jsx_runtime_7 = jsx_runtime_7_1;
748
- },
749
- function (store_3_1) {
750
- store_3 = store_3_1;
751
- },
752
- function (CryptoCandlestickPlot_1_1) {
753
- CryptoCandlestickPlot_1 = CryptoCandlestickPlot_1_1;
754
- },
755
- function (XFrames_7_1) {
756
- XFrames_7 = XFrames_7_1;
757
- }
758
- ],
759
- execute: function () {
760
- exports_13("CryptoCandlestickPlots", CryptoCandlestickPlots = ({}) => {
761
- const symbols = store_3.useStore((state) => state.symbols);
762
- return (_jsx(XFrames_7.XFrames.Node, { style: {
763
- width: "100%",
764
- height: "100%",
765
- flexDirection: "column",
766
- gap: { row: 5 },
767
- }, children: symbols.map((sym) => (_jsx(CryptoCandlestickPlot_1.CryptoCandlestickPlot, { symbol: sym }, sym))) }));
768
- });
769
- }
770
- };
771
- });
772
- System.register("components/TradingGuiDemo/Sidebar/Sidebar", ["react/jsx-runtime", "react", "@xframes/common", "lib/XFrames"], function (exports_14, context_14) {
773
- "use strict";
774
- var jsx_runtime_8, react_7, common_6, XFrames_8, Sidebar;
775
- var __moduleName = context_14 && context_14.id;
776
- return {
777
- setters: [
778
- function (jsx_runtime_8_1) {
779
- jsx_runtime_8 = jsx_runtime_8_1;
780
- },
781
- function (react_7_1) {
782
- react_7 = react_7_1;
783
- },
784
- function (common_6_1) {
785
- common_6 = common_6_1;
786
- },
787
- function (XFrames_8_1) {
788
- XFrames_8 = XFrames_8_1;
789
- }
790
- ],
791
- execute: function () {
792
- exports_14("Sidebar", Sidebar = () => {
793
- const styleSheet = react_7.useMemo(() => common_6.RWStyleSheet.create({
794
- sidebarNode: {
795
- flexBasis: 60,
796
- height: "100%",
797
- border: {
798
- color: "#1B1D20",
799
- thickness: 1,
800
- },
801
- },
802
- sideBarItem: {
803
- width: 58,
804
- height: 58,
805
- justifyContent: "center",
806
- alignItems: "center",
807
- },
808
- logo: {
809
- font: { name: "roboto-regular", size: 36 },
810
- },
811
- icon: {
812
- width: 48,
813
- height: 48,
814
- font: { name: "roboto-regular", size: 36 },
815
- colors: {
816
- [common_6.ImGuiCol.ButtonHovered]: "#001033",
817
- [common_6.ImGuiCol.ButtonActive]: "#001033",
818
- },
819
- vars: { [common_6.ImGuiStyleVar.FrameRounding]: 24 },
820
- },
821
- iconActive: {
822
- width: 48,
823
- height: 48,
824
- font: { name: "roboto-regular", size: 36 },
825
- vars: { [common_6.ImGuiStyleVar.FrameRounding]: 24 },
826
- colors: {
827
- [common_6.ImGuiCol.Text]: "#588AF5",
828
- [common_6.ImGuiCol.Button]: "#001033",
829
- [common_6.ImGuiCol.ButtonHovered]: "#001033",
830
- [common_6.ImGuiCol.ButtonActive]: "#001033",
831
- },
832
- },
833
- }), []);
834
- return (_jsxs(XFrames_8.XFrames.Node, { style: styleSheet.sidebarNode, children: [_jsx(XFrames_8.XFrames.Node, { style: styleSheet.sideBarItem, children: _jsx(XFrames_8.XFrames.UnformattedText, { text: common_6.faIconMap.otter, style: styleSheet.logo }) }), _jsx(XFrames_8.XFrames.Node, { style: styleSheet.sideBarItem, children: _jsx(XFrames_8.XFrames.Button, { label: common_6.faIconMap["arrow-trend-up"], style: styleSheet.iconActive, hoverStyle: styleSheet.iconActive }) }), _jsx(XFrames_8.XFrames.Node, { style: styleSheet.sideBarItem, children: _jsx(XFrames_8.XFrames.Button, { label: common_6.faIconMap["wallet"], style: styleSheet.icon, hoverStyle: styleSheet.iconActive }) }), _jsx(XFrames_8.XFrames.Node, { style: styleSheet.sideBarItem, children: _jsx(XFrames_8.XFrames.Button, { label: common_6.faIconMap["chart-pie"], style: styleSheet.icon, hoverStyle: styleSheet.iconActive }) })] }));
835
- });
836
- }
837
- };
838
- });
839
- System.register("components/TradingGuiDemo/CryptoSymbolPairs/CryptoSymbolPair", ["react/jsx-runtime", "react", "@xframes/common", "lib/XFrames"], function (exports_15, context_15) {
840
- "use strict";
841
- var jsx_runtime_9, react_8, common_7, XFrames_9, CryptoSymbolPair;
842
- var __moduleName = context_15 && context_15.id;
843
- return {
844
- setters: [
845
- function (jsx_runtime_9_1) {
846
- jsx_runtime_9 = jsx_runtime_9_1;
847
- },
848
- function (react_8_1) {
849
- react_8 = react_8_1;
850
- },
851
- function (common_7_1) {
852
- common_7 = common_7_1;
853
- },
854
- function (XFrames_9_1) {
855
- XFrames_9 = XFrames_9_1;
856
- }
857
- ],
858
- execute: function () {
859
- exports_15("CryptoSymbolPair", CryptoSymbolPair = ({ symbol }) => {
860
- const styleSheet = react_8.useMemo(() => common_7.RWStyleSheet.create({
861
- symbolLogoPair: {
862
- flexDirection: "row",
863
- },
864
- symbolLogoLeft: {
865
- width: 24,
866
- height: 24,
867
- },
868
- symbolLogoRight: {
869
- width: 24,
870
- height: 24,
871
- position: { left: -5 }, // todo: doesn't this need absolute positioning?
872
- },
873
- }), []);
874
- return (_jsxs(XFrames_9.XFrames.Node, { style: styleSheet.symbolLogoPair, children: [_jsx(XFrames_9.XFrames.Image, { url: "bitcoin-btc-logo_gqud0f.png", style: styleSheet.symbolLogoLeft }), _jsx(XFrames_9.XFrames.Image, { url: "77-771550_dollar-currency-money-finance-usd-us-dollar-dollar_apzzg2.png", style: styleSheet.symbolLogoRight })] }));
875
- });
876
- }
877
- };
878
- });
879
- System.register("components/TradingGuiDemo/CryptoSymbolBlock/CryptoSymbolBlock", ["react/jsx-runtime", "react", "@xframes/common", "components/TradingGuiDemo/CryptoSymbolPairs/CryptoSymbolPair", "lib/XFrames"], function (exports_16, context_16) {
880
- "use strict";
881
- var jsx_runtime_10, react_9, common_8, CryptoSymbolPair_1, XFrames_10, CryptoSymbolBlock;
882
- var __moduleName = context_16 && context_16.id;
883
- return {
884
- setters: [
885
- function (jsx_runtime_10_1) {
886
- jsx_runtime_10 = jsx_runtime_10_1;
887
- },
888
- function (react_9_1) {
889
- react_9 = react_9_1;
890
- },
891
- function (common_8_1) {
892
- common_8 = common_8_1;
893
- },
894
- function (CryptoSymbolPair_1_1) {
895
- CryptoSymbolPair_1 = CryptoSymbolPair_1_1;
896
- },
897
- function (XFrames_10_1) {
898
- XFrames_10 = XFrames_10_1;
899
- }
900
- ],
901
- execute: function () {
902
- exports_16("CryptoSymbolBlock", CryptoSymbolBlock = ({ symbol }) => {
903
- const price = "40,730.00";
904
- const currency = "USD";
905
- const trend = "(+2.50%)";
906
- const styleSheet = react_9.useMemo(() => common_8.RWStyleSheet.create({
907
- block: {
908
- flexDirection: "row",
909
- padding: {
910
- // horizontal: 2,
911
- vertical: 8,
912
- },
913
- gap: { column: 5 },
914
- // borderColor: "#fff",
915
- // borderThickness: 1,
916
- },
917
- symbolLogos: {
918
- width: 60,
919
- height: 40,
920
- alignItems: "center",
921
- justifyContent: "center",
922
- },
923
- info: {
924
- gap: { row: 5 },
925
- },
926
- priceRow: {
927
- flexDirection: "row",
928
- gap: { column: 2 },
929
- },
930
- symbol: {
931
- font: { name: "roboto-bold", size: 16 },
932
- colors: { [common_8.ImGuiCol.Text]: "#A9B5C0" },
933
- },
934
- price: {
935
- font: { name: "roboto-bold", size: 20 },
936
- colors: { [common_8.ImGuiCol.Text]: "#D9D9D9" },
937
- },
938
- currency: {
939
- font: { name: "roboto-bold", size: 20 },
940
- colors: { [common_8.ImGuiCol.Text]: "#A9B5C0" },
941
- },
942
- trend: {
943
- font: { name: "roboto-bold", size: 20 },
944
- colors: { [common_8.ImGuiCol.Text]: "#239465" },
945
- },
946
- }), []);
947
- return (_jsxs(XFrames_10.XFrames.Node, { style: styleSheet.block, children: [_jsx(XFrames_10.XFrames.Node, { style: styleSheet.symbolLogos, children: _jsx(CryptoSymbolPair_1.CryptoSymbolPair, { symbol: symbol }) }), _jsxs(XFrames_10.XFrames.Node, { style: styleSheet.info, children: [_jsx(XFrames_10.XFrames.UnformattedText, { style: styleSheet.symbol, text: symbol }), _jsxs(XFrames_10.XFrames.Node, { style: styleSheet.priceRow, children: [_jsx(XFrames_10.XFrames.UnformattedText, { style: styleSheet.price, text: price }), _jsx(XFrames_10.XFrames.UnformattedText, { style: styleSheet.currency, text: currency }), _jsx(XFrames_10.XFrames.UnformattedText, { style: styleSheet.trend, text: trend })] })] })] }));
948
- });
949
- }
950
- };
951
- });
952
- System.register("components/TradingGuiDemo/Tabs/Tabs", ["react/jsx-runtime", "react", "@xframes/common", "lib/XFrames", "themes"], function (exports_17, context_17) {
953
- "use strict";
954
- var jsx_runtime_11, react_10, common_9, XFrames_11, themes_2, Tabs;
955
- var __moduleName = context_17 && context_17.id;
956
- return {
957
- setters: [
958
- function (jsx_runtime_11_1) {
959
- jsx_runtime_11 = jsx_runtime_11_1;
960
- },
961
- function (react_10_1) {
962
- react_10 = react_10_1;
963
- },
964
- function (common_9_1) {
965
- common_9 = common_9_1;
966
- },
967
- function (XFrames_11_1) {
968
- XFrames_11 = XFrames_11_1;
969
- },
970
- function (themes_2_1) {
971
- themes_2 = themes_2_1;
972
- }
973
- ],
974
- execute: function () {
975
- // todo: fix 1px vertical shift on hover
976
- exports_17("Tabs", Tabs = ({ tabs, selectedTabIndex, onSelectedTabChange, }) => {
977
- // const [selectedItemIds, setSelectedItemIds] = useState("cryptoAssetPanels");
978
- const styleSheet = react_10.useMemo(() => common_9.RWStyleSheet.create({
979
- tabs: {
980
- flexDirection: "row",
981
- borderLeft: {
982
- color: "#1C1E22",
983
- thickness: 1,
984
- },
985
- borderBottom: {
986
- color: "#1C1E22",
987
- thickness: 1,
988
- },
989
- },
990
- tab: {
991
- padding: { vertical: 10, horizontal: 20 },
992
- borderTop: {
993
- color: "#1C1E22",
994
- thickness: 1,
995
- },
996
- borderRight: {
997
- color: "#1C1E22",
998
- thickness: 1,
999
- },
1000
- },
1001
- hoveredTab: {
1002
- padding: { vertical: 10, horizontal: 20 },
1003
- borderTop: {
1004
- // todo: not currently working for hover/active/disabled states
1005
- color: "#fff",
1006
- thickness: 1,
1007
- },
1008
- borderRight: {
1009
- color: "#1C1E22",
1010
- thickness: 1,
1011
- },
1012
- position: {
1013
- top: 1, // todo: hack
1014
- },
1015
- },
1016
- activeTab: {
1017
- padding: { vertical: 10, horizontal: 20 },
1018
- borderTop: {
1019
- // todo: not currently working for hover/active/disabled states
1020
- color: "#fff",
1021
- thickness: 1,
1022
- },
1023
- borderRight: {
1024
- color: "#1C1E22",
1025
- thickness: 1,
1026
- },
1027
- position: {
1028
- top: 1, // todo: hack
1029
- },
1030
- },
1031
- selectedTab: {
1032
- padding: { vertical: 10, horizontal: 20 },
1033
- borderTop: {
1034
- color: "#fff",
1035
- thickness: 1,
1036
- },
1037
- borderBottom: {
1038
- color: themes_2.theme2Colors.black,
1039
- thickness: 1,
1040
- },
1041
- borderRight: {
1042
- color: "#1C1E22",
1043
- thickness: 1,
1044
- },
1045
- position: {
1046
- top: 1, // todo: hack
1047
- },
1048
- },
1049
- tabText: {
1050
- font: { name: "roboto-bold", size: 18 },
1051
- },
1052
- }), []);
1053
- return (_jsx(XFrames_11.XFrames.Node, { style: styleSheet.tabs, children: tabs.map((tab, index) => {
1054
- const isSelected = selectedTabIndex === index;
1055
- return (_jsx(XFrames_11.XFrames.Node, { style: isSelected ? styleSheet.selectedTab : styleSheet.tab, hoverStyle: isSelected ? styleSheet.selectedTab : styleSheet.hoveredTab, activeStyle: isSelected ? styleSheet.selectedTab : styleSheet.activeTab, onClick: () => {
1056
- // console.log("clicked");
1057
- onSelectedTabChange(index);
1058
- }, trackMouseClickEvents: true, children: _jsx(XFrames_11.XFrames.UnformattedText, { text: tab, style: styleSheet.tabText }) }, tab));
1059
- }) }));
1060
- });
1061
- }
1062
- };
1063
- });
1064
- System.register("components/TradingGuiDemo/TradingGuiDemo", ["react/jsx-runtime", "react", "@xframes/common", "components/TradingGuiDemo/CryptoPlots/CryptoLinePlots", "components/TradingGuiDemo/store", "components/TradingGuiDemo/CryptoAssetsList/CryptoAssetsList", "components/TradingGuiDemo/dataService", "components/TradingGuiDemo/CryptoAssetPanels/CryptoAssetPanels", "components/TradingGuiDemo/CryptoPlots/CryptoCandlestickPlots", "components/TradingGuiDemo/Sidebar/Sidebar", "components/TradingGuiDemo/CryptoSymbolBlock/CryptoSymbolBlock", "components/TradingGuiDemo/Tabs/Tabs", "lib/XFrames", "themes"], function (exports_18, context_18) {
1065
- "use strict";
1066
- var jsx_runtime_12, react_11, common_10, CryptoLinePlots_1, store_4, CryptoAssetsList_1, dataService_1, CryptoAssetPanels_1, CryptoCandlestickPlots_1, Sidebar_1, CryptoSymbolBlock_1, Tabs_1, XFrames_12, themes_3, componentMap, dataService, TradingGuiDemo;
1067
- var __moduleName = context_18 && context_18.id;
1068
- return {
1069
- setters: [
1070
- function (jsx_runtime_12_1) {
1071
- jsx_runtime_12 = jsx_runtime_12_1;
1072
- },
1073
- function (react_11_1) {
1074
- react_11 = react_11_1;
1075
- },
1076
- function (common_10_1) {
1077
- common_10 = common_10_1;
1078
- },
1079
- function (CryptoLinePlots_1_1) {
1080
- CryptoLinePlots_1 = CryptoLinePlots_1_1;
1081
- },
1082
- function (store_4_1) {
1083
- store_4 = store_4_1;
1084
- },
1085
- function (CryptoAssetsList_1_1) {
1086
- CryptoAssetsList_1 = CryptoAssetsList_1_1;
1087
- },
1088
- function (dataService_1_1) {
1089
- dataService_1 = dataService_1_1;
1090
- },
1091
- function (CryptoAssetPanels_1_1) {
1092
- CryptoAssetPanels_1 = CryptoAssetPanels_1_1;
1093
- },
1094
- function (CryptoCandlestickPlots_1_1) {
1095
- CryptoCandlestickPlots_1 = CryptoCandlestickPlots_1_1;
1096
- },
1097
- function (Sidebar_1_1) {
1098
- Sidebar_1 = Sidebar_1_1;
1099
- },
1100
- function (CryptoSymbolBlock_1_1) {
1101
- CryptoSymbolBlock_1 = CryptoSymbolBlock_1_1;
1102
- },
1103
- function (Tabs_1_1) {
1104
- Tabs_1 = Tabs_1_1;
1105
- },
1106
- function (XFrames_12_1) {
1107
- XFrames_12 = XFrames_12_1;
1108
- },
1109
- function (themes_3_1) {
1110
- themes_3 = themes_3_1;
1111
- }
1112
- ],
1113
- execute: function () {
1114
- componentMap = {
1115
- cryptoAssetPanels: CryptoAssetPanels_1.CryptoAssetPanels,
1116
- cryptoAssetList: CryptoAssetsList_1.CryptoAssetsList,
1117
- cryptoLinePlots: CryptoLinePlots_1.CryptoLinePlots,
1118
- cryptoCandlestickPlots: CryptoCandlestickPlots_1.CryptoCandlestickPlots,
1119
- };
1120
- dataService = new dataService_1.DataService();
1121
- exports_18("TradingGuiDemo", TradingGuiDemo = () => {
1122
- const symbols = store_4.useStore((state) => state.symbols);
1123
- const selectedTabIndex = store_4.useStore((state) => state.selectedTabIndex);
1124
- const setSelectedTabIndex = store_4.useStore((state) => state.setSelectedTabIndex);
1125
- const setCryptoAssets = store_4.useStore((state) => state.setCryptoAssets);
1126
- // const socketRef = useRef<WebSocket>();
1127
- const widgetRegistratonService = common_10.useWidgetRegistrationService();
1128
- const [selectedItemIds, setSelectedItemIds] = react_11.useState([
1129
- "cryptoAssetPanels",
1130
- ]);
1131
- const styleSheet = react_11.useMemo(() => common_10.RWStyleSheet.create({
1132
- rootNode: {
1133
- height: "100%",
1134
- },
1135
- mainLayoutNode: {
1136
- flex: 1,
1137
- flexDirection: "row",
1138
- },
1139
- title: {
1140
- colors: { [common_10.ImGuiCol.Text]: themes_3.theme2Colors.green },
1141
- font: { name: "roboto-regular", size: 24 },
1142
- },
1143
- debugButton: {
1144
- positionType: "absolute",
1145
- position: { right: 15, bottom: 15 },
1146
- flexDirection: "row",
1147
- gap: { column: 10 },
1148
- },
1149
- button: {
1150
- colors: {
1151
- [common_10.ImGuiCol.Text]: themes_3.theme2Colors.green,
1152
- [common_10.ImGuiCol.Border]: themes_3.theme2Colors.green,
1153
- },
1154
- padding: { all: 8 },
1155
- vars: {
1156
- [common_10.ImGuiStyleVar.FrameBorderSize]: 1,
1157
- [common_10.ImGuiStyleVar.FrameRounding]: 5,
1158
- },
1159
- },
1160
- mainNode: {
1161
- flex: 1,
1162
- },
1163
- mainTitleNode: {
1164
- flexDirection: "row",
1165
- borderBottom: {
1166
- color: "#1B1D20", // todo: remove double border
1167
- thickness: 1,
1168
- },
1169
- borderRight: {
1170
- color: "#1B1D20", // todo: remove double border
1171
- thickness: 1,
1172
- },
1173
- padding: { all: 20 },
1174
- },
1175
- mainTitle: {
1176
- font: { name: "roboto-bold", size: 32 },
1177
- },
1178
- contentNode: {
1179
- padding: {
1180
- left: 8,
1181
- },
1182
- },
1183
- tabContent: {
1184
- height: "100%",
1185
- width: 350,
1186
- gap: { row: 10 },
1187
- padding: {
1188
- horizontal: 8,
1189
- vertical: 16,
1190
- },
1191
- borderLeft: {
1192
- color: "#1C1E22",
1193
- thickness: 1,
1194
- },
1195
- },
1196
- marketSearchInput: {
1197
- vars: {
1198
- [common_10.ImGuiStyleVar.FrameBorderSize]: 1,
1199
- [common_10.ImGuiStyleVar.FramePadding]: [10, 10],
1200
- },
1201
- colors: {
1202
- [common_10.ImGuiCol.Border]: "#1C1E22",
1203
- },
1204
- },
1205
- marketSearchInputHover: {
1206
- vars: {
1207
- [common_10.ImGuiStyleVar.FrameBorderSize]: 1,
1208
- [common_10.ImGuiStyleVar.FramePadding]: [10, 10],
1209
- },
1210
- colors: {
1211
- [common_10.ImGuiCol.Border]: "#fff",
1212
- [common_10.ImGuiCol.TextDisabled]: "#fff",
1213
- },
1214
- },
1215
- marketSearchFilterWrapper: {
1216
- flexDirection: "row",
1217
- gap: { all: 8 },
1218
- flexWrap: "wrap",
1219
- },
1220
- marketSearchFilter: {
1221
- width: 60,
1222
- colors: {
1223
- [common_10.ImGuiCol.Button]: "#1E2025",
1224
- [common_10.ImGuiCol.ButtonHovered]: "#1E2025",
1225
- [common_10.ImGuiCol.ButtonActive]: "#1E2025",
1226
- [common_10.ImGuiCol.Text]: "#777B84",
1227
- },
1228
- vars: {
1229
- [common_10.ImGuiStyleVar.FrameRounding]: 5,
1230
- },
1231
- },
1232
- marketSearchFilterActive: {
1233
- width: 60,
1234
- colors: {
1235
- [common_10.ImGuiCol.Button]: "#fff",
1236
- [common_10.ImGuiCol.ButtonHovered]: "#fff",
1237
- [common_10.ImGuiCol.ButtonActive]: "#fff",
1238
- [common_10.ImGuiCol.Text]: "#292A2C",
1239
- },
1240
- vars: {
1241
- [common_10.ImGuiStyleVar.FrameRounding]: 5,
1242
- },
1243
- },
1244
- }), []);
1245
- // todo: move to dataService.ts ?
1246
- // const connect = useCallback(() => {
1247
- // socketRef.current = new WebSocket("ws://localhost:4000");
1248
- // socketRef.current.addEventListener("error", () => {
1249
- // console.log("Connected to server");
1250
- // });
1251
- // socketRef.current.addEventListener("open", () => {
1252
- // console.log("Connected to server");
1253
- // });
1254
- // socketRef.current.addEventListener("close", (ev) => {
1255
- // try {
1256
- // const reason = JSON.parse(ev.reason);
1257
- // console.log(`Disconnected from server: ${reason.message}`);
1258
- // } catch (error) {
1259
- // console.log("Disconnected from server");
1260
- // }
1261
- // });
1262
- // socketRef.current.addEventListener("message", (event) => {
1263
- // const data = JSON.parse(event.data);
1264
- // if (data.cryptoAssets) {
1265
- // // todo: remove filtering
1266
- // setCryptoAssets(
1267
- // data.cryptoAssets.filter((asset: any) => cryptoSymbols.includes(asset.symbol)),
1268
- // );
1269
- // } else if (data.cryptoQuote) {
1270
- // dataService.addCryptoQuote(data.cryptoQuote);
1271
- // } else if (data.latestCryptoQuotes) {
1272
- // // console.log(data.latestCryptoQuotes);
1273
- // Object.entries(data.latestCryptoQuotes).forEach(([symbol, cryptoQuote]) =>
1274
- // dataService.addCryptoQuote({ ...(cryptoQuote as any), S: symbol }),
1275
- // );
1276
- // } else if (data.cryptoSnapshots) {
1277
- // dataService.addCryptoSnapshots(data.cryptoSnapshots);
1278
- // // console.log(data.cryptoSnapshots);
1279
- // } else if (data.latestCryptoBars) {
1280
- // console.log(data.latestCryptoBars);
1281
- // } else if (data.cryptoBars) {
1282
- // dataService.addCryptoBars(data.cryptoBars);
1283
- // // console.log(data.cryptoBars);
1284
- // }
1285
- // });
1286
- // }, [setCryptoAssets]);
1287
- // const sendMessage = useCallback((message: any) => {
1288
- // if (socketRef.current) {
1289
- // socketRef.current.send(JSON.stringify(message));
1290
- // }
1291
- // }, []);
1292
- // const subscribeToLiveData = useCallback(
1293
- // () =>
1294
- // sendMessage({
1295
- // passkey: "",
1296
- // action: "subscribeForCryptoQuotes",
1297
- // symbols,
1298
- // }),
1299
- // [sendMessage, symbols],
1300
- // );
1301
- // const getLatestQuotes = useCallback(() => {
1302
- // const currentDate = new Date();
1303
- // const end = currentDate.toISOString();
1304
- // const start = subMinutes(currentDate, 1);
1305
- // sendMessage({
1306
- // action: "getQuotes",
1307
- // symbols,
1308
- // options: { start, end },
1309
- // });
1310
- // }, [symbols]);
1311
- // const getCryptoQuotes = useCallback(() => {
1312
- // const currentDate = new Date();
1313
- // const end = currentDate.toISOString();
1314
- // const start = subMinutes(currentDate, 1).toISOString();
1315
- // const options: GetQuotesParams = {
1316
- // start,
1317
- // end,
1318
- // };
1319
- // sendMessage({
1320
- // action: "getCryptoQuotes",
1321
- // symbols,
1322
- // options,
1323
- // });
1324
- // }, [symbols]);
1325
- // const getCryptoBars = useCallback(() => {
1326
- // const currentDate = new Date();
1327
- // const end = currentDate.toISOString();
1328
- // const start = subDays(currentDate, 30).toISOString();
1329
- // const options: GetCryptoBarsParams = { start, end, timeframe: "1D" };
1330
- // sendMessage({
1331
- // action: "getCryptoBars",
1332
- // symbols,
1333
- // options,
1334
- // });
1335
- // }, [symbols]);
1336
- // const getCryptoSnapshots = useCallback(
1337
- // () =>
1338
- // sendMessage({
1339
- // action: "getCryptoSnapshots",
1340
- // symbols,
1341
- // }),
1342
- // [symbols],
1343
- // );
1344
- // const getLatestCryptoQuotes = useCallback(
1345
- // () =>
1346
- // sendMessage({
1347
- // action: "getLatestCryptoQuotes",
1348
- // symbols,
1349
- // }),
1350
- // [symbols],
1351
- // );
1352
- // const getLatestCryptoBars = useCallback(
1353
- // () =>
1354
- // sendMessage({
1355
- // action: "getLatestCryptoBars",
1356
- // symbols,
1357
- // }),
1358
- // [symbols],
1359
- // );
1360
- // const getCryptoAssets = useCallback(
1361
- // () =>
1362
- // sendMessage({
1363
- // action: "getCryptoAssets",
1364
- // symbols,
1365
- // }),
1366
- // [symbols],
1367
- // );
1368
- const debugModeBtnClicked = react_11.useCallback(() => {
1369
- widgetRegistratonService.setDebug(true);
1370
- }, []);
1371
- const onToggleItemSelection = react_11.useCallback((itemId, selected) => {
1372
- setSelectedItemIds((selection) => {
1373
- if (selected) {
1374
- return [itemId];
1375
- }
1376
- else {
1377
- return selection.filter((item) => item !== itemId);
1378
- }
1379
- });
1380
- }, []);
1381
- const onMarketSearchTextChange = react_11.useCallback((evt) => {
1382
- console.log(evt.nativeEvent.value);
1383
- }, []);
1384
- // useEffect(() => {
1385
- // connect();
1386
- // setTimeout(() => {
1387
- // getCryptoAssets();
1388
- // }, 1000);
1389
- // }, [connect, getCryptoAssets]);
1390
- const tabs = react_11.useMemo(() => ["Markets", "History"], []);
1391
- const Component = componentMap[selectedItemIds[0]];
1392
- return (_jsxs(XFrames_12.XFrames.Node, { root: true, style: styleSheet.rootNode, children: [_jsxs(XFrames_12.XFrames.Node, { style: styleSheet.mainLayoutNode, children: [_jsx(Sidebar_1.Sidebar, {}), _jsxs(XFrames_12.XFrames.Node, { style: styleSheet.mainNode, children: [_jsx(XFrames_12.XFrames.Node, { style: styleSheet.mainTitleNode, children: _jsx(XFrames_12.XFrames.UnformattedText, { text: "Trade", style: styleSheet.mainTitle }) }), _jsxs(XFrames_12.XFrames.Node, { style: styleSheet.contentNode, children: [_jsx(CryptoSymbolBlock_1.CryptoSymbolBlock, { symbol: "BTC/USD" }), _jsx(Tabs_1.Tabs, { tabs: tabs, selectedTabIndex: selectedTabIndex, onSelectedTabChange: setSelectedTabIndex }), _jsxs(XFrames_12.XFrames.Node, { style: styleSheet.tabContent, children: [_jsx(XFrames_12.XFrames.InputText, { onChange: onMarketSearchTextChange, hint: `${common_10.faIconMap["magnifying-glass"]} SEARCH MARKETS`, style: styleSheet.marketSearchInput, hoverStyle: styleSheet.marketSearchInputHover }), _jsxs(XFrames_12.XFrames.Node, { style: styleSheet.marketSearchFilterWrapper, children: [_jsx(XFrames_12.XFrames.Button, { label: common_10.faIconMap["star"], style: styleSheet.marketSearchFilter, hoverStyle: styleSheet.marketSearchFilterActive }), _jsx(XFrames_12.XFrames.Button, { label: "ALL", style: styleSheet.marketSearchFilterActive, hoverStyle: styleSheet.marketSearchFilterActive }), _jsx(XFrames_12.XFrames.Button, { label: "TOP", style: styleSheet.marketSearchFilter, hoverStyle: styleSheet.marketSearchFilterActive }), _jsx(XFrames_12.XFrames.Button, { label: "BTC", style: styleSheet.marketSearchFilter, hoverStyle: styleSheet.marketSearchFilterActive }), _jsx(XFrames_12.XFrames.Button, { label: "ETH", style: styleSheet.marketSearchFilter, hoverStyle: styleSheet.marketSearchFilterActive }), _jsx(XFrames_12.XFrames.Button, { label: "USD", style: styleSheet.marketSearchFilter, hoverStyle: styleSheet.marketSearchFilterActive }), _jsx(XFrames_12.XFrames.Button, { label: "USDC", style: styleSheet.marketSearchFilter, hoverStyle: styleSheet.marketSearchFilterActive }), _jsx(XFrames_12.XFrames.Button, { label: "DAI", style: styleSheet.marketSearchFilter, hoverStyle: styleSheet.marketSearchFilterActive }), _jsx(XFrames_12.XFrames.Button, { label: "MKR", style: styleSheet.marketSearchFilter, hoverStyle: styleSheet.marketSearchFilterActive })] })] })] })] })] }), _jsx(XFrames_12.XFrames.Node, { style: styleSheet.sidebarNode }), _jsx(XFrames_12.XFrames.Node, { style: styleSheet.debugButton, children: _jsx(XFrames_12.XFrames.Button, { label: common_10.faIconMap.bug, onClick: debugModeBtnClicked }) })] }));
1393
- });
1394
- }
1395
- };
1396
- });
1397
- System.register("App", ["react/jsx-runtime", "lib/XFrames", "components/TradingGuiDemo/TradingGuiDemo"], function (exports_19, context_19) {
1398
- "use strict";
1399
- var jsx_runtime_13, XFrames_13, TradingGuiDemo_1, App;
1400
- var __moduleName = context_19 && context_19.id;
1401
- return {
1402
- setters: [
1403
- function (jsx_runtime_13_1) {
1404
- jsx_runtime_13 = jsx_runtime_13_1;
1405
- },
1406
- function (XFrames_13_1) {
1407
- XFrames_13 = XFrames_13_1;
1408
- },
1409
- function (TradingGuiDemo_1_1) {
1410
- TradingGuiDemo_1 = TradingGuiDemo_1_1;
1411
- }
1412
- ],
1413
- execute: function () {
1414
- exports_19("App", App = () => {
1415
- return (_jsx(XFrames_13.XFrames.Node, { root: true, style: { width: "100%", height: "100%" }, children: _jsx(TradingGuiDemo_1.TradingGuiDemo, {}) }));
1416
- });
1417
- }
1418
- };
1419
- });
1420
- System.register("lib/render", ["react/jsx-runtime", "@xframes/common", "./xframes.node"], function (exports_20, context_20) {
1421
- "use strict";
1422
- var jsx_runtime_14, common_11, xframes, ReactFabricProd, render;
1423
- var __moduleName = context_20 && context_20.id;
1424
- return {
1425
- setters: [
1426
- function (jsx_runtime_14_1) {
1427
- jsx_runtime_14 = jsx_runtime_14_1;
1428
- },
1429
- function (common_11_1) {
1430
- common_11 = common_11_1;
1431
- },
1432
- function (xframes_1) {
1433
- xframes = xframes_1;
1434
- }
1435
- ],
1436
- execute: function () {
1437
- exports_20("ReactFabricProd", ReactFabricProd = common_11.ReactFabricProdInitialiser(common_11.ReactNativePrivateInterface));
1438
- exports_20("render", render = (EntryPointComponent, assetsBasePath, fontDefs, theme) => {
1439
- const onInit = () => {
1440
- ReactFabricProd.render(_jsx(common_11.WidgetRegistrationServiceContext.Provider, { value: widgetRegistrationService, children: _jsx(EntryPointComponent, {}) }), 0, // containerTag,
1441
- () => {
1442
- // console.log("initialised");
1443
- }, 1);
1444
- };
1445
- const onTextChange = (id, value) => {
1446
- const rootNodeID = id;
1447
- const topLevelType = "onChange";
1448
- const nativeEventParam = { value };
1449
- common_11.ReactNativePrivateInterface.nativeFabricUIManager.dispatchEvent(rootNodeID, topLevelType, nativeEventParam);
1450
- };
1451
- const onComboChange = (id, value) => {
1452
- const rootNodeID = id;
1453
- const topLevelType = "onChange";
1454
- const nativeEventParam = { value };
1455
- common_11.ReactNativePrivateInterface.nativeFabricUIManager.dispatchEvent(rootNodeID, topLevelType, nativeEventParam);
1456
- };
1457
- const onNumericValueChange = (id, value) => {
1458
- const rootNodeID = id;
1459
- const topLevelType = "onChange";
1460
- const nativeEventParam = { value };
1461
- common_11.ReactNativePrivateInterface.nativeFabricUIManager.dispatchEvent(rootNodeID, topLevelType, nativeEventParam);
1462
- };
1463
- const onMultiValueChange = (id, values) => {
1464
- const rootNodeID = id;
1465
- const topLevelType = "onChange";
1466
- const nativeEventParam = { values };
1467
- common_11.ReactNativePrivateInterface.nativeFabricUIManager.dispatchEvent(rootNodeID, topLevelType, nativeEventParam);
1468
- };
1469
- const onBooleanValueChange = (id, value) => {
1470
- const rootNodeID = id;
1471
- const topLevelType = "onChange";
1472
- const nativeEventParam = { value };
1473
- common_11.ReactNativePrivateInterface.nativeFabricUIManager.dispatchEvent(rootNodeID, topLevelType, nativeEventParam);
1474
- };
1475
- const onClick = (id) => {
1476
- const rootNodeID = id;
1477
- const topLevelType = "onClick";
1478
- common_11.ReactNativePrivateInterface.nativeFabricUIManager.dispatchEvent(rootNodeID, topLevelType, {
1479
- value: "clicked",
1480
- });
1481
- };
1482
- xframes.init(assetsBasePath, JSON.stringify(fontDefs), JSON.stringify(theme), onInit, onTextChange, onComboChange, onNumericValueChange, onBooleanValueChange, onMultiValueChange, onClick);
1483
- const widgetRegistrationService = new common_11.WidgetRegistrationService(xframes);
1484
- common_11.ReactNativePrivateInterface.nativeFabricUIManager.init(xframes, widgetRegistrationService);
1485
- let flag = true;
1486
- (function keepProcessRunning() {
1487
- setTimeout(() => flag && keepProcessRunning(), 1000);
1488
- })();
1489
- });
1490
- }
1491
- };
1492
- });
1493
- System.register("index", ["App", "themes", "lib/render"], function (exports_21, context_21) {
1494
- "use strict";
1495
- var App_1, themes_4, render_1, fontDefs, assetsBasePath;
1496
- var __moduleName = context_21 && context_21.id;
1497
- return {
1498
- setters: [
1499
- function (App_1_1) {
1500
- App_1 = App_1_1;
1501
- },
1502
- function (themes_4_1) {
1503
- themes_4 = themes_4_1;
1504
- },
1505
- function (render_1_1) {
1506
- render_1 = render_1_1;
1507
- }
1508
- ],
1509
- execute: function () {
1510
- fontDefs = {
1511
- defs: [
1512
- { name: "roboto-regular", sizes: [16, 18, 20, 24, 28, 32, 36, 48] },
1513
- { name: "roboto-bold", sizes: [16, 18, 20, 24, 28, 32, 36, 48] },
1514
- // { name: "roboto-light", sizes: [12, 14, 16, 18, 20, 24, 28, 32, 36, 48] },
1515
- { name: "roboto-mono-regular", sizes: [14, 16] },
1516
- ]
1517
- .map(({ name, sizes }) => sizes.map((size) => ({ name, size })))
1518
- .flat(),
1519
- };
1520
- assetsBasePath = "../../assets";
1521
- render_1.render(App_1.App, assetsBasePath, fontDefs, themes_4.theme2);
1522
- }
1523
- };
1524
- });
1525
- System.register("lib/index", ["lib/render", "lib/XFrames"], function (exports_22, context_22) {
1526
- "use strict";
1527
- var render_2, XFrames_14;
1528
- var __moduleName = context_22 && context_22.id;
1529
- return {
1530
- setters: [
1531
- function (render_2_1) {
1532
- render_2 = render_2_1;
1533
- },
1534
- function (XFrames_14_1) {
1535
- XFrames_14 = XFrames_14_1;
1536
- }
1537
- ],
1538
- execute: function () {
1539
- exports_22("render", render_2.render);
1540
- exports_22("XFrames", XFrames_14.XFrames);
1541
- }
1542
- };
1543
- });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const App_1 = require("./App");
4
+ const themes_1 = require("./themes");
5
+ const render_1 = require("./lib/render");
6
+ const fontDefs = {
7
+ defs: [
8
+ { name: "roboto-regular", sizes: [16, 18, 20, 24, 28, 32, 36, 48] },
9
+ { name: "roboto-bold", sizes: [16, 18, 20, 24, 28, 32, 36, 48] },
10
+ // { name: "roboto-light", sizes: [12, 14, 16, 18, 20, 24, 28, 32, 36, 48] },
11
+ { name: "roboto-mono-regular", sizes: [14, 16] },
12
+ ]
13
+ .map(({ name, sizes }) => sizes.map((size) => ({ name, size })))
14
+ .flat(),
15
+ };
16
+ const assetsBasePath = "../../assets";
17
+ (0, render_1.render)(App_1.App, assetsBasePath, fontDefs, themes_1.theme2);