@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.
- package/dist/App.d.ts +1 -0
- package/dist/App.js +10 -0
- package/dist/components/TradingGuiDemo/CryptoAssetPanels/CryptoAssetPanels.d.ts +3 -0
- package/dist/components/TradingGuiDemo/CryptoAssetPanels/CryptoAssetPanels.js +49 -0
- package/dist/components/TradingGuiDemo/CryptoAssetsList/CryptoAssetsList.d.ts +3 -0
- package/dist/components/TradingGuiDemo/CryptoAssetsList/CryptoAssetsList.js +62 -0
- package/dist/components/TradingGuiDemo/CryptoPlots/CryptoCandlestickPlot.d.ts +5 -0
- package/dist/components/TradingGuiDemo/CryptoPlots/CryptoCandlestickPlot.js +39 -0
- package/dist/components/TradingGuiDemo/CryptoPlots/CryptoCandlestickPlots.d.ts +3 -0
- package/dist/components/TradingGuiDemo/CryptoPlots/CryptoCandlestickPlots.js +17 -0
- package/dist/components/TradingGuiDemo/CryptoPlots/CryptoLinePlot.d.ts +5 -0
- package/dist/components/TradingGuiDemo/CryptoPlots/CryptoLinePlot.js +33 -0
- package/dist/components/TradingGuiDemo/CryptoPlots/CryptoLinePlots.d.ts +3 -0
- package/dist/components/TradingGuiDemo/CryptoPlots/CryptoLinePlots.js +17 -0
- package/dist/components/TradingGuiDemo/CryptoQuotePrice/CryptoQuotePrice.d.ts +5 -0
- package/dist/components/TradingGuiDemo/CryptoQuotePrice/CryptoQuotePrice.js +76 -0
- package/dist/components/TradingGuiDemo/CryptoSymbolBlock/CryptoSymbolBlock.d.ts +5 -0
- package/dist/components/TradingGuiDemo/CryptoSymbolBlock/CryptoSymbolBlock.js +56 -0
- package/dist/components/TradingGuiDemo/CryptoSymbolPairs/CryptoSymbolPair.d.ts +5 -0
- package/dist/components/TradingGuiDemo/CryptoSymbolPairs/CryptoSymbolPair.js +25 -0
- package/dist/components/TradingGuiDemo/Sidebar/Sidebar.d.ts +1 -0
- package/dist/components/TradingGuiDemo/Sidebar/Sidebar.js +52 -0
- package/dist/components/TradingGuiDemo/Tabs/Tabs.d.ts +7 -0
- package/dist/components/TradingGuiDemo/Tabs/Tabs.js +95 -0
- package/dist/components/TradingGuiDemo/TradingGuiDemo.d.ts +1 -0
- package/dist/components/TradingGuiDemo/TradingGuiDemo.js +299 -0
- package/dist/components/TradingGuiDemo/cryptoSymbols.d.ts +1 -0
- package/dist/components/TradingGuiDemo/cryptoSymbols.js +64 -0
- package/dist/components/TradingGuiDemo/dataService.d.ts +22 -0
- package/dist/components/TradingGuiDemo/dataService.js +33 -0
- package/dist/components/TradingGuiDemo/dataServiceContext.d.ts +3 -0
- package/dist/components/TradingGuiDemo/dataServiceContext.js +13 -0
- package/dist/components/TradingGuiDemo/store.d.ts +17 -0
- package/dist/components/TradingGuiDemo/store.js +35 -0
- package/dist/index.d.ts +1 -401
- package/dist/index.js +17 -1543
- package/dist/lib/XFrames.d.ts +228 -0
- package/dist/lib/XFrames.js +9 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.js +7 -0
- package/dist/lib/render.d.ts +21 -0
- package/dist/lib/render.js +84 -0
- package/dist/themes.d.ts +26 -0
- package/dist/themes.js +145 -0
- package/dist/xframes.node +0 -0
- package/package.json +1 -1
package/dist/App.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const App: () => import("react/jsx-runtime").JSX.Element;
|
package/dist/App.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.App = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const XFrames_1 = require("./lib/XFrames");
|
|
6
|
+
const TradingGuiDemo_1 = require("./components/TradingGuiDemo/TradingGuiDemo");
|
|
7
|
+
const App = () => {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Node, { root: true, style: { width: "100%", height: "100%" }, children: (0, jsx_runtime_1.jsx)(TradingGuiDemo_1.TradingGuiDemo, {}) }));
|
|
9
|
+
};
|
|
10
|
+
exports.App = App;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CryptoAssetPanels = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const store_1 = require("../store");
|
|
7
|
+
const CryptoQuotePrice_1 = require("../CryptoQuotePrice/CryptoQuotePrice");
|
|
8
|
+
const common_1 = require("@xframes/common");
|
|
9
|
+
const XFrames_1 = require("src/lib/XFrames");
|
|
10
|
+
const CryptoAssetPanels = ({}) => {
|
|
11
|
+
const cryptoAssets = (0, store_1.useStore)((state) => state.cryptoAssets.sort((a, b) => {
|
|
12
|
+
if (a.symbol < b.symbol) {
|
|
13
|
+
return -1;
|
|
14
|
+
}
|
|
15
|
+
else if (a.symbol > b.symbol) {
|
|
16
|
+
return 1;
|
|
17
|
+
}
|
|
18
|
+
return 0;
|
|
19
|
+
}));
|
|
20
|
+
const styleSheet = (0, react_1.useMemo)(() => common_1.RWStyleSheet.create({
|
|
21
|
+
mainWrapperNode: {
|
|
22
|
+
width: "100%",
|
|
23
|
+
height: "auto",
|
|
24
|
+
flexDirection: "row",
|
|
25
|
+
flexWrap: "wrap",
|
|
26
|
+
gap: { row: 5, column: 5 },
|
|
27
|
+
},
|
|
28
|
+
asset: {
|
|
29
|
+
minWidth: 200,
|
|
30
|
+
maxWidth: 240,
|
|
31
|
+
flex: 1,
|
|
32
|
+
height: "auto",
|
|
33
|
+
border: {
|
|
34
|
+
color: "#000",
|
|
35
|
+
thickness: 1,
|
|
36
|
+
},
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
padding: { vertical: 5 },
|
|
39
|
+
gap: { row: 5 },
|
|
40
|
+
},
|
|
41
|
+
symbol: {
|
|
42
|
+
font: { name: "roboto-regular", size: 24 },
|
|
43
|
+
},
|
|
44
|
+
}), []);
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Node, { style: styleSheet.mainWrapperNode, children: cryptoAssets.map((asset) => {
|
|
46
|
+
return ((0, jsx_runtime_1.jsxs)(XFrames_1.XFrames.Node, { style: styleSheet.asset, children: [(0, jsx_runtime_1.jsx)(XFrames_1.XFrames.UnformattedText, { style: styleSheet.symbol, text: asset.symbol }), (0, jsx_runtime_1.jsx)(CryptoQuotePrice_1.CryptoQuotePrice, { symbol: asset.symbol })] }, asset.id));
|
|
47
|
+
}) }));
|
|
48
|
+
};
|
|
49
|
+
exports.CryptoAssetPanels = CryptoAssetPanels;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CryptoAssetsList = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const dataServiceContext_1 = require("../dataServiceContext");
|
|
7
|
+
const XFrames_1 = require("src/lib/XFrames");
|
|
8
|
+
const CryptoAssetsList = ({}) => {
|
|
9
|
+
const dataService = (0, dataServiceContext_1.useDataService)();
|
|
10
|
+
const tableRef = (0, react_1.useRef)(null);
|
|
11
|
+
const tableColumns = (0, react_1.useMemo)(() => [
|
|
12
|
+
{
|
|
13
|
+
heading: "Symbol",
|
|
14
|
+
fieldId: "symbol",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
heading: "ASK",
|
|
18
|
+
fieldId: "askPrice",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
heading: "Change",
|
|
22
|
+
fieldId: "askChange",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
heading: "BID",
|
|
26
|
+
fieldId: "bidPrice",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
heading: "Change",
|
|
30
|
+
fieldId: "bidChange",
|
|
31
|
+
},
|
|
32
|
+
], []);
|
|
33
|
+
(0, react_1.useEffect)(() => {
|
|
34
|
+
const subscription = dataService
|
|
35
|
+
.getCryptoSnapshots()
|
|
36
|
+
.subscribe((snapshots) => {
|
|
37
|
+
const data = Object.entries(snapshots).map(([symbol, snapshot]) => ({
|
|
38
|
+
symbol,
|
|
39
|
+
askPrice: snapshot.LatestQuote.AskPrice.toFixed(6),
|
|
40
|
+
bidPrice: snapshot.LatestQuote.BidPrice.toFixed(6),
|
|
41
|
+
// todo: totally unsure here
|
|
42
|
+
askChange: (snapshot.LatestQuote.AskPrice - snapshot.DailyBar.Open).toFixed(6),
|
|
43
|
+
bidChange: (snapshot.LatestQuote.BidPrice - snapshot.DailyBar.Open).toFixed(6),
|
|
44
|
+
}));
|
|
45
|
+
data.sort((a, b) => {
|
|
46
|
+
if (a.symbol < b.symbol) {
|
|
47
|
+
return -1;
|
|
48
|
+
}
|
|
49
|
+
else if (a.symbol > b.symbol) {
|
|
50
|
+
return 1;
|
|
51
|
+
}
|
|
52
|
+
return 0;
|
|
53
|
+
});
|
|
54
|
+
tableRef.current?.setTableData(data);
|
|
55
|
+
});
|
|
56
|
+
return () => {
|
|
57
|
+
subscription.unsubscribe();
|
|
58
|
+
};
|
|
59
|
+
}, [dataService]);
|
|
60
|
+
return (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Table, { ref: tableRef, columns: tableColumns });
|
|
61
|
+
};
|
|
62
|
+
exports.CryptoAssetsList = CryptoAssetsList;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CryptoCandlestickPlot = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const rxjs_1 = require("rxjs");
|
|
7
|
+
const dataServiceContext_1 = require("../dataServiceContext");
|
|
8
|
+
const XFrames_1 = require("src/lib/XFrames");
|
|
9
|
+
const CryptoCandlestickPlot = ({ symbol }) => {
|
|
10
|
+
const dataService = (0, dataServiceContext_1.useDataService)();
|
|
11
|
+
const plotRef = (0, react_1.useRef)(null);
|
|
12
|
+
// const [axisAutoFit, setAxisAutoFit] = useState(true);
|
|
13
|
+
(0, react_1.useEffect)(() => {
|
|
14
|
+
const subscription = dataService
|
|
15
|
+
.getCryptoBarDatasets()
|
|
16
|
+
.pipe((0, rxjs_1.map)((cryptoBars) => cryptoBars[symbol]))
|
|
17
|
+
.subscribe((cryptoBarsForSymbol) => {
|
|
18
|
+
if (plotRef.current) {
|
|
19
|
+
const data = cryptoBarsForSymbol.map((cryptoBar) => ({
|
|
20
|
+
date: Number(new Date(cryptoBar.Timestamp)) / 1000,
|
|
21
|
+
open: cryptoBar.Open,
|
|
22
|
+
close: cryptoBar.Close,
|
|
23
|
+
high: cryptoBar.High,
|
|
24
|
+
low: cryptoBar.Low,
|
|
25
|
+
}));
|
|
26
|
+
// console.log(data);
|
|
27
|
+
plotRef.current.setData(data);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return () => {
|
|
31
|
+
subscription.unsubscribe();
|
|
32
|
+
};
|
|
33
|
+
}, [dataService]);
|
|
34
|
+
// const toggleAxisAutoFit = useCallback(() => {
|
|
35
|
+
// setAxisAutoFit((val) => !val);
|
|
36
|
+
// }, []);
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(XFrames_1.XFrames.PlotCandlestick, { ref: plotRef, style: { width: "100%", height: 400 } }));
|
|
38
|
+
};
|
|
39
|
+
exports.CryptoCandlestickPlot = CryptoCandlestickPlot;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CryptoCandlestickPlots = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const store_1 = require("../store");
|
|
6
|
+
const CryptoCandlestickPlot_1 = require("./CryptoCandlestickPlot");
|
|
7
|
+
const XFrames_1 = require("src/lib/XFrames");
|
|
8
|
+
const CryptoCandlestickPlots = ({}) => {
|
|
9
|
+
const symbols = (0, store_1.useStore)((state) => state.symbols);
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Node, { style: {
|
|
11
|
+
width: "100%",
|
|
12
|
+
height: "100%",
|
|
13
|
+
flexDirection: "column",
|
|
14
|
+
gap: { row: 5 },
|
|
15
|
+
}, children: symbols.map((sym) => ((0, jsx_runtime_1.jsx)(CryptoCandlestickPlot_1.CryptoCandlestickPlot, { symbol: sym }, sym))) }));
|
|
16
|
+
};
|
|
17
|
+
exports.CryptoCandlestickPlots = CryptoCandlestickPlots;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CryptoLinePlot = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const dataServiceContext_1 = require("../dataServiceContext");
|
|
7
|
+
const common_1 = require("@xframes/common");
|
|
8
|
+
const rxjs_1 = require("rxjs");
|
|
9
|
+
const XFrames_1 = require("src/lib/XFrames");
|
|
10
|
+
const CryptoLinePlot = ({ symbol }) => {
|
|
11
|
+
const dataService = (0, dataServiceContext_1.useDataService)();
|
|
12
|
+
const plotRef = (0, react_1.useRef)(null);
|
|
13
|
+
// const [axisAutoFit, setAxisAutoFit] = useState(true);
|
|
14
|
+
(0, react_1.useEffect)(() => {
|
|
15
|
+
const subscription = dataService
|
|
16
|
+
.getCryptoQuotes()
|
|
17
|
+
.pipe((0, rxjs_1.filter)((cryptoQuote) => cryptoQuote.S === symbol))
|
|
18
|
+
.subscribe((quote) => {
|
|
19
|
+
if (plotRef.current) {
|
|
20
|
+
const date = new Date(quote.Timestamp);
|
|
21
|
+
plotRef.current.appendData(Number(date) / 1000, quote.BidPrice);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return () => {
|
|
25
|
+
subscription.unsubscribe();
|
|
26
|
+
};
|
|
27
|
+
}, [dataService]);
|
|
28
|
+
// const toggleAxisAutoFit = useCallback(() => {
|
|
29
|
+
// setAxisAutoFit((val) => !val);
|
|
30
|
+
// }, []);
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(XFrames_1.XFrames.PlotLine, { xAxisScale: common_1.ImPlotScale.Time, ref: plotRef, style: { width: "100%", height: 400 } }));
|
|
32
|
+
};
|
|
33
|
+
exports.CryptoLinePlot = CryptoLinePlot;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CryptoLinePlots = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const store_1 = require("../store");
|
|
6
|
+
const CryptoLinePlot_1 = require("./CryptoLinePlot");
|
|
7
|
+
const XFrames_1 = require("src/lib/XFrames");
|
|
8
|
+
const CryptoLinePlots = ({}) => {
|
|
9
|
+
const symbols = (0, store_1.useStore)((state) => state.symbols);
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Node, { style: {
|
|
11
|
+
width: "100%",
|
|
12
|
+
height: "100%",
|
|
13
|
+
flexDirection: "column",
|
|
14
|
+
gap: { row: 5 },
|
|
15
|
+
}, children: symbols.map((sym) => ((0, jsx_runtime_1.jsx)(CryptoLinePlot_1.CryptoLinePlot, { symbol: sym }, sym))) }));
|
|
16
|
+
};
|
|
17
|
+
exports.CryptoLinePlots = CryptoLinePlots;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CryptoQuotePrice = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const rxjs_1 = require("rxjs");
|
|
7
|
+
const common_1 = require("@xframes/common");
|
|
8
|
+
const dataServiceContext_1 = require("../dataServiceContext");
|
|
9
|
+
const XFrames_1 = require("src/lib/XFrames");
|
|
10
|
+
const themes_1 = require("src/themes");
|
|
11
|
+
const CryptoQuotePrice = ({ symbol }) => {
|
|
12
|
+
const [data, setData] = (0, react_1.useState)({
|
|
13
|
+
lastUpdated: "n/a",
|
|
14
|
+
});
|
|
15
|
+
// const [lastUpdated, setLastUpdated] = useState<string>("n/a");
|
|
16
|
+
const dataService = (0, dataServiceContext_1.useDataService)();
|
|
17
|
+
(0, react_1.useEffect)(() => {
|
|
18
|
+
const subscription = dataService
|
|
19
|
+
.getCryptoQuotes()
|
|
20
|
+
.pipe((0, rxjs_1.filter)((cryptoQuote) => cryptoQuote.S === symbol))
|
|
21
|
+
.subscribe((quote) => {
|
|
22
|
+
const newData = {
|
|
23
|
+
quote,
|
|
24
|
+
lastUpdated: "n/a",
|
|
25
|
+
};
|
|
26
|
+
setData((oldData) => {
|
|
27
|
+
// if (oldData.quote) {
|
|
28
|
+
// const quoteDate = new Date(quote.Timestamp);
|
|
29
|
+
// const previousDate = new Date(oldData.quote.Timestamp);
|
|
30
|
+
// const msDiff = differenceInMilliseconds(quoteDate, previousDate);
|
|
31
|
+
// if (msDiff >= 1000) {
|
|
32
|
+
// newData.lastUpdated = formatDuration(
|
|
33
|
+
// intervalToDuration(interval(quoteDate, previousDate)),
|
|
34
|
+
// );
|
|
35
|
+
// } else {
|
|
36
|
+
// newData.lastUpdated = `${msDiff}ms ago`;
|
|
37
|
+
// }
|
|
38
|
+
// }
|
|
39
|
+
return newData;
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
return () => {
|
|
43
|
+
subscription.unsubscribe();
|
|
44
|
+
};
|
|
45
|
+
}, [dataService]);
|
|
46
|
+
const styleSheet = (0, react_1.useMemo)(() => common_1.RWStyleSheet.create({
|
|
47
|
+
pricesWrapper: {
|
|
48
|
+
alignSelf: "center",
|
|
49
|
+
flexDirection: "row",
|
|
50
|
+
gap: { column: 5 },
|
|
51
|
+
},
|
|
52
|
+
price: {
|
|
53
|
+
width: 100,
|
|
54
|
+
height: "auto",
|
|
55
|
+
// borderColor: "#000",
|
|
56
|
+
// borderThickness: 1,
|
|
57
|
+
alignItems: "center",
|
|
58
|
+
},
|
|
59
|
+
ask: {
|
|
60
|
+
colors: {
|
|
61
|
+
[common_1.ImGuiCol.Text]: themes_1.theme2Colors.red,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
bid: {
|
|
65
|
+
colors: {
|
|
66
|
+
[common_1.ImGuiCol.Text]: themes_1.theme2Colors.green,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
}), []);
|
|
70
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(XFrames_1.XFrames.Node, { style: styleSheet.pricesWrapper, children: [(0, jsx_runtime_1.jsxs)(XFrames_1.XFrames.Node, { style: styleSheet.price, children: [(0, jsx_runtime_1.jsx)(XFrames_1.XFrames.UnformattedText, { text: "ASK", style: styleSheet.ask }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.UnformattedText, { text: typeof data?.quote?.AskPrice === "number"
|
|
71
|
+
? data?.quote?.AskPrice.toFixed(6)
|
|
72
|
+
: "n/a", style: styleSheet.ask })] }), (0, jsx_runtime_1.jsxs)(XFrames_1.XFrames.Node, { style: styleSheet.price, children: [(0, jsx_runtime_1.jsx)(XFrames_1.XFrames.UnformattedText, { text: "BID", style: styleSheet.bid }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.UnformattedText, { text: typeof data?.quote?.BidPrice === "number"
|
|
73
|
+
? data?.quote?.BidPrice.toFixed(6)
|
|
74
|
+
: "n/a", style: styleSheet.bid })] })] }) }));
|
|
75
|
+
};
|
|
76
|
+
exports.CryptoQuotePrice = CryptoQuotePrice;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CryptoSymbolBlock = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const common_1 = require("@xframes/common");
|
|
7
|
+
const CryptoSymbolPair_1 = require("../CryptoSymbolPairs/CryptoSymbolPair");
|
|
8
|
+
const XFrames_1 = require("src/lib/XFrames");
|
|
9
|
+
const CryptoSymbolBlock = ({ symbol }) => {
|
|
10
|
+
const price = "40,730.00";
|
|
11
|
+
const currency = "USD";
|
|
12
|
+
const trend = "(+2.50%)";
|
|
13
|
+
const styleSheet = (0, react_1.useMemo)(() => common_1.RWStyleSheet.create({
|
|
14
|
+
block: {
|
|
15
|
+
flexDirection: "row",
|
|
16
|
+
padding: {
|
|
17
|
+
// horizontal: 2,
|
|
18
|
+
vertical: 8,
|
|
19
|
+
},
|
|
20
|
+
gap: { column: 5 },
|
|
21
|
+
// borderColor: "#fff",
|
|
22
|
+
// borderThickness: 1,
|
|
23
|
+
},
|
|
24
|
+
symbolLogos: {
|
|
25
|
+
width: 60,
|
|
26
|
+
height: 40,
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
justifyContent: "center",
|
|
29
|
+
},
|
|
30
|
+
info: {
|
|
31
|
+
gap: { row: 5 },
|
|
32
|
+
},
|
|
33
|
+
priceRow: {
|
|
34
|
+
flexDirection: "row",
|
|
35
|
+
gap: { column: 2 },
|
|
36
|
+
},
|
|
37
|
+
symbol: {
|
|
38
|
+
font: { name: "roboto-bold", size: 16 },
|
|
39
|
+
colors: { [common_1.ImGuiCol.Text]: "#A9B5C0" },
|
|
40
|
+
},
|
|
41
|
+
price: {
|
|
42
|
+
font: { name: "roboto-bold", size: 20 },
|
|
43
|
+
colors: { [common_1.ImGuiCol.Text]: "#D9D9D9" },
|
|
44
|
+
},
|
|
45
|
+
currency: {
|
|
46
|
+
font: { name: "roboto-bold", size: 20 },
|
|
47
|
+
colors: { [common_1.ImGuiCol.Text]: "#A9B5C0" },
|
|
48
|
+
},
|
|
49
|
+
trend: {
|
|
50
|
+
font: { name: "roboto-bold", size: 20 },
|
|
51
|
+
colors: { [common_1.ImGuiCol.Text]: "#239465" },
|
|
52
|
+
},
|
|
53
|
+
}), []);
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)(XFrames_1.XFrames.Node, { style: styleSheet.block, children: [(0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Node, { style: styleSheet.symbolLogos, children: (0, jsx_runtime_1.jsx)(CryptoSymbolPair_1.CryptoSymbolPair, { symbol: symbol }) }), (0, jsx_runtime_1.jsxs)(XFrames_1.XFrames.Node, { style: styleSheet.info, children: [(0, jsx_runtime_1.jsx)(XFrames_1.XFrames.UnformattedText, { style: styleSheet.symbol, text: symbol }), (0, jsx_runtime_1.jsxs)(XFrames_1.XFrames.Node, { style: styleSheet.priceRow, children: [(0, jsx_runtime_1.jsx)(XFrames_1.XFrames.UnformattedText, { style: styleSheet.price, text: price }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.UnformattedText, { style: styleSheet.currency, text: currency }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.UnformattedText, { style: styleSheet.trend, text: trend })] })] })] }));
|
|
55
|
+
};
|
|
56
|
+
exports.CryptoSymbolBlock = CryptoSymbolBlock;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CryptoSymbolPair = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const common_1 = require("@xframes/common");
|
|
7
|
+
const XFrames_1 = require("src/lib/XFrames");
|
|
8
|
+
const CryptoSymbolPair = ({ symbol }) => {
|
|
9
|
+
const styleSheet = (0, react_1.useMemo)(() => common_1.RWStyleSheet.create({
|
|
10
|
+
symbolLogoPair: {
|
|
11
|
+
flexDirection: "row",
|
|
12
|
+
},
|
|
13
|
+
symbolLogoLeft: {
|
|
14
|
+
width: 24,
|
|
15
|
+
height: 24,
|
|
16
|
+
},
|
|
17
|
+
symbolLogoRight: {
|
|
18
|
+
width: 24,
|
|
19
|
+
height: 24,
|
|
20
|
+
position: { left: -5 }, // todo: doesn't this need absolute positioning?
|
|
21
|
+
},
|
|
22
|
+
}), []);
|
|
23
|
+
return ((0, jsx_runtime_1.jsxs)(XFrames_1.XFrames.Node, { style: styleSheet.symbolLogoPair, children: [(0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Image, { url: "bitcoin-btc-logo_gqud0f.png", style: styleSheet.symbolLogoLeft }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Image, { url: "77-771550_dollar-currency-money-finance-usd-us-dollar-dollar_apzzg2.png", style: styleSheet.symbolLogoRight })] }));
|
|
24
|
+
};
|
|
25
|
+
exports.CryptoSymbolPair = CryptoSymbolPair;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Sidebar: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Sidebar = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const common_1 = require("@xframes/common");
|
|
7
|
+
const XFrames_1 = require("src/lib/XFrames");
|
|
8
|
+
const Sidebar = () => {
|
|
9
|
+
const styleSheet = (0, react_1.useMemo)(() => common_1.RWStyleSheet.create({
|
|
10
|
+
sidebarNode: {
|
|
11
|
+
flexBasis: 60,
|
|
12
|
+
height: "100%",
|
|
13
|
+
border: {
|
|
14
|
+
color: "#1B1D20",
|
|
15
|
+
thickness: 1,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
sideBarItem: {
|
|
19
|
+
width: 58,
|
|
20
|
+
height: 58,
|
|
21
|
+
justifyContent: "center",
|
|
22
|
+
alignItems: "center",
|
|
23
|
+
},
|
|
24
|
+
logo: {
|
|
25
|
+
font: { name: "roboto-regular", size: 36 },
|
|
26
|
+
},
|
|
27
|
+
icon: {
|
|
28
|
+
width: 48,
|
|
29
|
+
height: 48,
|
|
30
|
+
font: { name: "roboto-regular", size: 36 },
|
|
31
|
+
colors: {
|
|
32
|
+
[common_1.ImGuiCol.ButtonHovered]: "#001033",
|
|
33
|
+
[common_1.ImGuiCol.ButtonActive]: "#001033",
|
|
34
|
+
},
|
|
35
|
+
vars: { [common_1.ImGuiStyleVar.FrameRounding]: 24 },
|
|
36
|
+
},
|
|
37
|
+
iconActive: {
|
|
38
|
+
width: 48,
|
|
39
|
+
height: 48,
|
|
40
|
+
font: { name: "roboto-regular", size: 36 },
|
|
41
|
+
vars: { [common_1.ImGuiStyleVar.FrameRounding]: 24 },
|
|
42
|
+
colors: {
|
|
43
|
+
[common_1.ImGuiCol.Text]: "#588AF5",
|
|
44
|
+
[common_1.ImGuiCol.Button]: "#001033",
|
|
45
|
+
[common_1.ImGuiCol.ButtonHovered]: "#001033",
|
|
46
|
+
[common_1.ImGuiCol.ButtonActive]: "#001033",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
}), []);
|
|
50
|
+
return ((0, jsx_runtime_1.jsxs)(XFrames_1.XFrames.Node, { style: styleSheet.sidebarNode, children: [(0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Node, { style: styleSheet.sideBarItem, children: (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.UnformattedText, { text: common_1.faIconMap.otter, style: styleSheet.logo }) }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Node, { style: styleSheet.sideBarItem, children: (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Button, { label: common_1.faIconMap["arrow-trend-up"], style: styleSheet.iconActive, hoverStyle: styleSheet.iconActive }) }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Node, { style: styleSheet.sideBarItem, children: (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Button, { label: common_1.faIconMap["wallet"], style: styleSheet.icon, hoverStyle: styleSheet.iconActive }) }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Node, { style: styleSheet.sideBarItem, children: (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Button, { label: common_1.faIconMap["chart-pie"], style: styleSheet.icon, hoverStyle: styleSheet.iconActive }) })] }));
|
|
51
|
+
};
|
|
52
|
+
exports.Sidebar = Sidebar;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Tabs = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const common_1 = require("@xframes/common");
|
|
7
|
+
const XFrames_1 = require("src/lib/XFrames");
|
|
8
|
+
const themes_1 = require("src/themes");
|
|
9
|
+
// todo: fix 1px vertical shift on hover
|
|
10
|
+
const Tabs = ({ tabs, selectedTabIndex, onSelectedTabChange, }) => {
|
|
11
|
+
// const [selectedItemIds, setSelectedItemIds] = useState("cryptoAssetPanels");
|
|
12
|
+
const styleSheet = (0, react_1.useMemo)(() => common_1.RWStyleSheet.create({
|
|
13
|
+
tabs: {
|
|
14
|
+
flexDirection: "row",
|
|
15
|
+
borderLeft: {
|
|
16
|
+
color: "#1C1E22",
|
|
17
|
+
thickness: 1,
|
|
18
|
+
},
|
|
19
|
+
borderBottom: {
|
|
20
|
+
color: "#1C1E22",
|
|
21
|
+
thickness: 1,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
tab: {
|
|
25
|
+
padding: { vertical: 10, horizontal: 20 },
|
|
26
|
+
borderTop: {
|
|
27
|
+
color: "#1C1E22",
|
|
28
|
+
thickness: 1,
|
|
29
|
+
},
|
|
30
|
+
borderRight: {
|
|
31
|
+
color: "#1C1E22",
|
|
32
|
+
thickness: 1,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
hoveredTab: {
|
|
36
|
+
padding: { vertical: 10, horizontal: 20 },
|
|
37
|
+
borderTop: {
|
|
38
|
+
// todo: not currently working for hover/active/disabled states
|
|
39
|
+
color: "#fff",
|
|
40
|
+
thickness: 1,
|
|
41
|
+
},
|
|
42
|
+
borderRight: {
|
|
43
|
+
color: "#1C1E22",
|
|
44
|
+
thickness: 1,
|
|
45
|
+
},
|
|
46
|
+
position: {
|
|
47
|
+
top: 1, // todo: hack
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
activeTab: {
|
|
51
|
+
padding: { vertical: 10, horizontal: 20 },
|
|
52
|
+
borderTop: {
|
|
53
|
+
// todo: not currently working for hover/active/disabled states
|
|
54
|
+
color: "#fff",
|
|
55
|
+
thickness: 1,
|
|
56
|
+
},
|
|
57
|
+
borderRight: {
|
|
58
|
+
color: "#1C1E22",
|
|
59
|
+
thickness: 1,
|
|
60
|
+
},
|
|
61
|
+
position: {
|
|
62
|
+
top: 1, // todo: hack
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
selectedTab: {
|
|
66
|
+
padding: { vertical: 10, horizontal: 20 },
|
|
67
|
+
borderTop: {
|
|
68
|
+
color: "#fff",
|
|
69
|
+
thickness: 1,
|
|
70
|
+
},
|
|
71
|
+
borderBottom: {
|
|
72
|
+
color: themes_1.theme2Colors.black,
|
|
73
|
+
thickness: 1,
|
|
74
|
+
},
|
|
75
|
+
borderRight: {
|
|
76
|
+
color: "#1C1E22",
|
|
77
|
+
thickness: 1,
|
|
78
|
+
},
|
|
79
|
+
position: {
|
|
80
|
+
top: 1, // todo: hack
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
tabText: {
|
|
84
|
+
font: { name: "roboto-bold", size: 18 },
|
|
85
|
+
},
|
|
86
|
+
}), []);
|
|
87
|
+
return ((0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Node, { style: styleSheet.tabs, children: tabs.map((tab, index) => {
|
|
88
|
+
const isSelected = selectedTabIndex === index;
|
|
89
|
+
return ((0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Node, { style: isSelected ? styleSheet.selectedTab : styleSheet.tab, hoverStyle: isSelected ? styleSheet.selectedTab : styleSheet.hoveredTab, activeStyle: isSelected ? styleSheet.selectedTab : styleSheet.activeTab, onClick: () => {
|
|
90
|
+
// console.log("clicked");
|
|
91
|
+
onSelectedTabChange(index);
|
|
92
|
+
}, trackMouseClickEvents: true, children: (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.UnformattedText, { text: tab, style: styleSheet.tabText }) }, tab));
|
|
93
|
+
}) }));
|
|
94
|
+
};
|
|
95
|
+
exports.Tabs = Tabs;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TradingGuiDemo: () => import("react/jsx-runtime").JSX.Element;
|