@rainlanguage/ui-components 0.0.1-alpha.21 → 0.0.1-alpha.210
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/__fixtures__/settings.yaml +125 -0
- package/dist/__mocks__/CodeMirrorRainlang.svelte +4 -0
- package/dist/__mocks__/CodeMirrorRainlang.svelte.d.ts +18 -0
- package/dist/__mocks__/MockComponent.svelte +4 -0
- package/dist/__mocks__/MockComponent.svelte.d.ts +3 -1
- package/dist/__mocks__/stores.d.ts +47 -33
- package/dist/__mocks__/stores.js +61 -38
- package/dist/components/ButtonLoading.svelte +1 -1
- package/dist/components/ButtonVaultLink.svelte +11 -11
- package/dist/components/ButtonVaultLink.svelte.d.ts +4 -3
- package/dist/components/CheckboxInactiveOrdersVault.svelte +20 -0
- package/dist/components/CheckboxInactiveOrdersVault.svelte.d.ts +19 -0
- package/dist/components/CheckboxMyItemsOnly.svelte +3 -2
- package/dist/components/CheckboxMyItemsOnly.svelte.d.ts +2 -3
- package/dist/components/CheckboxZeroBalanceVault.svelte.d.ts +2 -2
- package/dist/components/CodeMirrorDotrain.svelte +4 -0
- package/dist/components/CodeMirrorDotrain.svelte.d.ts +1 -0
- package/dist/components/CodeMirrorRainlang.svelte +3 -12
- package/dist/components/CodeMirrorRainlang.svelte.d.ts +2 -2
- package/dist/components/EditableSpan.svelte +3 -14
- package/dist/components/EditableSpan.svelte.d.ts +0 -1
- package/dist/components/Hash.svelte +3 -3
- package/dist/components/License.svelte +5 -4
- package/dist/components/ListViewOrderbookFilters.svelte +45 -23
- package/dist/components/ListViewOrderbookFilters.svelte.d.ts +27 -22
- package/dist/components/LocalDbStatusBadge.svelte +27 -0
- package/dist/components/LocalDbStatusBadge.svelte.d.ts +19 -0
- package/dist/components/LocalDbStatusCard.svelte +40 -0
- package/dist/components/LocalDbStatusCard.svelte.d.ts +20 -0
- package/dist/components/LocalDbStatusModal.svelte +103 -0
- package/dist/components/LocalDbStatusModal.svelte.d.ts +21 -0
- package/dist/components/OrderOrVaultHash.svelte +12 -12
- package/dist/components/OrderOrVaultHash.svelte.d.ts +4 -4
- package/dist/components/PageHeader.svelte +1 -1
- package/dist/components/TanstackAppTable.svelte +179 -28
- package/dist/components/TanstackAppTable.svelte.d.ts +14 -8
- package/dist/components/ToastDetail.svelte +42 -0
- package/dist/components/ToastDetail.svelte.d.ts +20 -0
- package/dist/components/Tooltip.svelte +8 -0
- package/dist/components/Tooltip.svelte.d.ts +21 -0
- package/dist/components/VaultBalanceChangeTypeFilter.svelte +23 -0
- package/dist/components/VaultBalanceChangeTypeFilter.svelte.d.ts +19 -0
- package/dist/components/VaultCard.svelte +18 -0
- package/dist/components/VaultCard.svelte.d.ts +19 -0
- package/dist/components/charts/LightweightChart.svelte +1 -1
- package/dist/components/charts/LightweightChart.svelte.d.ts +5 -5
- package/dist/components/charts/OrderTradesChart.svelte +300 -28
- package/dist/components/charts/OrderTradesChart.svelte.d.ts +4 -4
- package/dist/components/charts/TanstackLightweightChartLine.svelte +5 -9
- package/dist/components/charts/VaultBalanceChart.svelte +8 -26
- package/dist/components/charts/VaultBalanceChart.svelte.d.ts +1 -7
- package/dist/components/charts/transformAndSortData.d.ts +24 -0
- package/dist/components/charts/transformAndSortData.js +111 -0
- package/dist/components/checkbox/CheckboxActiveOrders.svelte +11 -0
- package/dist/components/checkbox/CheckboxActiveOrders.svelte.d.ts +19 -0
- package/dist/components/deployment/ButtonSelectOption.svelte +2 -0
- package/dist/components/deployment/ButtonSelectOption.svelte.d.ts +1 -0
- package/dist/components/deployment/ComposedRainlangModal.svelte +2 -1
- package/dist/components/deployment/ComposedRainlangModal.svelte.d.ts +1 -4
- package/dist/components/deployment/DeploymentSectionHeader.svelte +7 -4
- package/dist/components/deployment/DeploymentSteps.svelte +209 -216
- package/dist/components/deployment/DeploymentSteps.svelte.d.ts +6 -12
- package/dist/components/deployment/DeploymentTile.svelte +2 -2
- package/dist/components/deployment/DeploymentTile.svelte.d.ts +1 -1
- package/dist/components/deployment/DeploymentsSection.svelte +15 -22
- package/dist/components/deployment/DeploymentsSection.svelte.d.ts +3 -2
- package/dist/components/deployment/DepositInput.svelte +8 -10
- package/dist/components/deployment/DepositInput.svelte.d.ts +1 -2
- package/dist/components/deployment/DisclaimerModal.svelte +6 -7
- package/dist/components/deployment/FieldDefinitionInput.svelte +7 -11
- package/dist/components/deployment/FieldDefinitionInput.svelte.d.ts +1 -2
- package/dist/components/deployment/InvalidOrdersSection.svelte +17 -0
- package/dist/components/deployment/InvalidOrdersSection.svelte.d.ts +19 -0
- package/dist/components/deployment/{StrategyPage.svelte → OrderPage.svelte} +15 -24
- package/dist/components/deployment/OrderPage.svelte.d.ts +21 -0
- package/dist/components/deployment/SelectToken.svelte +125 -48
- package/dist/components/deployment/SelectToken.svelte.d.ts +4 -3
- package/dist/components/deployment/TokenBalance.svelte +19 -0
- package/dist/components/deployment/TokenBalance.svelte.d.ts +19 -0
- package/dist/components/deployment/TokenIOInput.svelte +25 -15
- package/dist/components/deployment/TokenIOInput.svelte.d.ts +3 -3
- package/dist/components/deployment/TokenSelectionModal.svelte +148 -0
- package/dist/components/deployment/TokenSelectionModal.svelte.d.ts +20 -0
- package/dist/components/deployment/{ValidStrategiesSection.svelte → ValidOrdersSection.svelte} +7 -7
- package/dist/components/deployment/ValidOrdersSection.svelte.d.ts +19 -0
- package/dist/components/deployment/VaultIdInformation.svelte +17 -0
- package/dist/components/deployment/VaultIdInformation.svelte.d.ts +21 -0
- package/dist/components/detail/OrderDetail.svelte +184 -80
- package/dist/components/detail/OrderDetail.svelte.d.ts +21 -15
- package/dist/components/detail/TanstackOrderQuote.svelte +92 -46
- package/dist/components/detail/TanstackOrderQuote.svelte.d.ts +14 -16
- package/dist/components/detail/VaultDetail.svelte +78 -77
- package/dist/components/detail/VaultDetail.svelte.d.ts +12 -18
- package/dist/components/dropdown/DropdownActiveNetworks.svelte +44 -0
- package/dist/components/dropdown/DropdownActiveNetworks.svelte.d.ts +19 -0
- package/dist/components/dropdown/DropdownCheckbox.svelte +4 -4
- package/dist/components/dropdown/DropdownOrderListAccounts.svelte +5 -2
- package/dist/components/dropdown/DropdownOrderListAccounts.svelte.d.ts +2 -3
- package/dist/components/dropdown/DropdownOrderbooksFilter.svelte +172 -0
- package/dist/components/dropdown/DropdownOrderbooksFilter.svelte.d.ts +25 -0
- package/dist/components/dropdown/DropdownTokensFilter.svelte +152 -0
- package/dist/components/dropdown/DropdownTokensFilter.svelte.d.ts +28 -0
- package/dist/components/icon/Refresh.svelte +2 -1
- package/dist/components/icon/Refresh.svelte.d.ts +1 -0
- package/dist/components/input/InputOrderHash.svelte +1 -1
- package/dist/components/input/InputOrderHash.svelte.d.ts +3 -3
- package/dist/components/input/InputRegistryUrl.svelte +36 -14
- package/dist/components/input/InputToken.svelte +2 -2
- package/dist/components/input/InputTokenAmount.svelte +16 -21
- package/dist/components/input/InputTokenAmount.svelte.d.ts +3 -3
- package/dist/components/tables/OrderAPY.svelte +6 -33
- package/dist/components/tables/OrderAPY.svelte.d.ts +1 -4
- package/dist/components/tables/OrderTradesListTable.svelte +84 -81
- package/dist/components/tables/OrderTradesListTable.svelte.d.ts +4 -4
- package/dist/components/tables/OrderVaultsVolTable.svelte +17 -22
- package/dist/components/tables/OrderVaultsVolTable.svelte.d.ts +2 -2
- package/dist/components/tables/OrdersListTable.svelte +200 -108
- package/dist/components/tables/OrdersListTable.svelte.d.ts +17 -21
- package/dist/components/tables/VaultBalanceChangesTable.svelte +83 -43
- package/dist/components/tables/VaultBalanceChangesTable.svelte.d.ts +13 -11
- package/dist/components/tables/VaultsListTable.svelte +268 -145
- package/dist/components/tables/VaultsListTable.svelte.d.ts +24 -32
- package/dist/components/transactions/FixedBottomTransaction.svelte +63 -0
- package/dist/components/transactions/FixedBottomTransaction.svelte.d.ts +16 -0
- package/dist/components/transactions/TransactionDetail.svelte +31 -0
- package/dist/components/transactions/TransactionDetail.svelte.d.ts +20 -0
- package/dist/components/transactions/TransactionList.svelte +17 -0
- package/dist/components/transactions/TransactionList.svelte.d.ts +16 -0
- package/dist/components/transactions/getStatusEmoji.d.ts +2 -0
- package/dist/components/transactions/getStatusEmoji.js +20 -0
- package/dist/components/wallet/WalletConnect.svelte +5 -4
- package/dist/components/wallet/WalletConnect.svelte.d.ts +0 -1
- package/dist/consts.d.ts +1 -0
- package/dist/consts.js +1 -0
- package/dist/errors/DeploymentStepsError.d.ts +8 -2
- package/dist/errors/DeploymentStepsError.js +7 -1
- package/dist/hooks/useGui.d.ts +1 -1
- package/dist/hooks/useGui.js +1 -1
- package/dist/hooks/useLocalDb.d.ts +3 -0
- package/dist/hooks/useLocalDb.js +10 -0
- package/dist/hooks/useRaindexClient.d.ts +3 -0
- package/dist/hooks/useRaindexClient.js +11 -0
- package/dist/index.d.ts +42 -19
- package/dist/index.js +41 -16
- package/dist/models/Transaction.d.ts +75 -0
- package/dist/models/Transaction.js +100 -0
- package/dist/providers/GuiProvider.svelte +1 -1
- package/dist/providers/GuiProvider.svelte.d.ts +1 -1
- package/dist/providers/LocalDbProvider.svelte +8 -0
- package/dist/providers/LocalDbProvider.svelte.d.ts +21 -0
- package/dist/providers/RaindexClientProvider.svelte +8 -0
- package/dist/providers/RaindexClientProvider.svelte.d.ts +21 -0
- package/dist/providers/dotrainRegistry/DotrainRegistryProvider.svelte +8 -0
- package/dist/providers/dotrainRegistry/DotrainRegistryProvider.svelte.d.ts +24 -0
- package/dist/providers/dotrainRegistry/context.d.ts +9 -0
- package/dist/providers/dotrainRegistry/context.js +40 -0
- package/dist/providers/dotrainRegistry/useDotrainRegistry.d.ts +5 -0
- package/dist/providers/dotrainRegistry/useDotrainRegistry.js +35 -0
- package/dist/providers/registry/RegistryManager.d.ts +65 -0
- package/dist/providers/registry/RegistryManager.js +133 -0
- package/dist/providers/registry/RegistryProvider.svelte +6 -0
- package/dist/providers/registry/RegistryProvider.svelte.d.ts +21 -0
- package/dist/providers/registry/context.d.ts +10 -0
- package/dist/providers/registry/context.js +46 -0
- package/dist/providers/registry/useRegistry.d.ts +7 -0
- package/dist/providers/registry/useRegistry.js +29 -0
- package/dist/providers/toasts/ToastProvider.svelte +17 -0
- package/dist/providers/toasts/ToastProvider.svelte.d.ts +18 -0
- package/dist/providers/toasts/context.d.ts +14 -0
- package/dist/providers/toasts/context.js +22 -0
- package/dist/providers/toasts/useToasts.d.ts +16 -0
- package/dist/providers/toasts/useToasts.js +63 -0
- package/dist/providers/transactions/TransactionManager.d.ts +235 -0
- package/dist/providers/transactions/TransactionManager.js +509 -0
- package/dist/providers/transactions/TransactionProvider.svelte +11 -0
- package/dist/providers/transactions/TransactionProvider.svelte.d.ts +24 -0
- package/dist/providers/transactions/context.d.ts +19 -0
- package/dist/providers/transactions/context.js +28 -0
- package/dist/providers/transactions/useTransactions.d.ts +13 -0
- package/dist/providers/transactions/useTransactions.js +18 -0
- package/dist/providers/wallet/WalletProvider.svelte +7 -0
- package/dist/providers/wallet/WalletProvider.svelte.d.ts +21 -0
- package/dist/providers/wallet/context.d.ts +10 -0
- package/dist/providers/wallet/context.js +47 -0
- package/dist/providers/wallet/useAccount.d.ts +8 -0
- package/dist/providers/wallet/useAccount.js +148 -0
- package/dist/queries/keys.d.ts +1 -0
- package/dist/queries/keys.js +1 -0
- package/dist/queries/queryClient.d.ts +1 -1
- package/dist/queries/queryClient.js +11 -6
- package/dist/services/awaitTransactionIndexing.d.ts +107 -0
- package/dist/services/awaitTransactionIndexing.js +58 -0
- package/dist/services/getExplorerLink.d.ts +1 -1
- package/dist/services/getExplorerLink.js +2 -4
- package/dist/services/handleShareChoices.d.ts +2 -2
- package/dist/services/handleShareChoices.js +7 -2
- package/dist/services/historicalOrderCharts.d.ts +2 -2
- package/dist/services/historicalOrderCharts.js +267 -333
- package/dist/services/index.d.ts +2 -1
- package/dist/services/index.js +2 -1
- package/dist/services/loadRegistryUrl.d.ts +2 -0
- package/dist/services/loadRegistryUrl.js +22 -0
- package/dist/services/pairTradesChartData.d.ts +47 -0
- package/dist/services/pairTradesChartData.js +190 -0
- package/dist/services/registry.d.ts +5 -5
- package/dist/services/registry.js +8 -208
- package/dist/services/time.d.ts +12 -0
- package/dist/services/time.js +88 -6
- package/dist/storesGeneric/cachedWritableStore.d.ts +57 -0
- package/dist/storesGeneric/cachedWritableStore.js +93 -0
- package/dist/types/account.d.ts +3 -0
- package/dist/types/appStores.d.ts +9 -14
- package/dist/types/modal.d.ts +26 -14
- package/dist/types/{strategy.d.ts → order.d.ts} +3 -3
- package/dist/types/order.js +1 -0
- package/dist/types/toast.d.ts +11 -0
- package/dist/types/toast.js +1 -0
- package/dist/types/tokenBalance.d.ts +6 -0
- package/dist/types/tokenBalance.js +1 -0
- package/dist/types/transaction.d.ts +66 -21
- package/dist/types/transaction.js +31 -1
- package/dist/utils/configHelpers.d.ts +4 -0
- package/dist/utils/configHelpers.js +21 -0
- package/dist/utils/constructHashLink.d.ts +24 -0
- package/dist/utils/constructHashLink.js +115 -0
- package/dist/utils/getNetworkName.d.ts +1 -0
- package/dist/utils/getNetworkName.js +13 -0
- package/dist/utils/number.d.ts +0 -7
- package/dist/utils/number.js +0 -27
- package/dist/utils/tokens.d.ts +2 -0
- package/dist/utils/tokens.js +3 -0
- package/dist/utils/vaultBalanceChangeLabels.d.ts +4 -0
- package/dist/utils/vaultBalanceChangeLabels.js +18 -0
- package/package.json +39 -34
- package/dist/__fixtures__/orderDetail.d.ts +0 -99
- package/dist/__fixtures__/orderDetail.js +0 -204
- package/dist/__fixtures__/settings-12-11-24.json +0 -160
- package/dist/__mocks__/mockTransactionStore.d.ts +0 -22
- package/dist/__mocks__/mockTransactionStore.js +0 -56
- package/dist/__mocks__/settings.d.ts +0 -3
- package/dist/__mocks__/settings.js +0 -37
- package/dist/components/deployment/InvalidStrategiesSection.svelte +0 -19
- package/dist/components/deployment/InvalidStrategiesSection.svelte.d.ts +0 -19
- package/dist/components/deployment/StrategyPage.svelte.d.ts +0 -19
- package/dist/components/deployment/ValidStrategiesSection.svelte.d.ts +0 -19
- package/dist/components/deployment/getDeploymentTransactionArgs.d.ts +0 -17
- package/dist/components/deployment/getDeploymentTransactionArgs.js +0 -28
- package/dist/components/detail/DepositOrWithdrawButtons.svelte +0 -44
- package/dist/components/detail/DepositOrWithdrawButtons.svelte.d.ts +0 -26
- package/dist/components/dropdown/DropdownActiveSubgraphs.svelte +0 -38
- package/dist/components/dropdown/DropdownActiveSubgraphs.svelte.d.ts +0 -21
- package/dist/components/dropdown/DropdownOrderStatus.svelte +0 -31
- package/dist/components/dropdown/DropdownOrderStatus.svelte.d.ts +0 -19
- package/dist/stores/transactionStore.d.ts +0 -98
- package/dist/stores/transactionStore.js +0 -303
- package/dist/utils/time.d.ts +0 -12
- package/dist/utils/time.js +0 -27
- package/dist/utils/vault.d.ts +0 -2
- package/dist/utils/vault.js +0 -29
- /package/dist/types/{strategy.js → account.js} +0 -0
|
@@ -1,14 +1,138 @@
|
|
|
1
|
-
<script generics="
|
|
1
|
+
<script generics="DataItem, InputData = DataItem[]">import { invalidateTanstackQueries } from "../queries/queryClient";
|
|
2
2
|
import Refresh from "./icon/Refresh.svelte";
|
|
3
3
|
import { Button, Table, TableBody, TableBodyRow, TableHead } from "flowbite-svelte";
|
|
4
|
-
import { createEventDispatcher } from "svelte";
|
|
4
|
+
import { afterUpdate, createEventDispatcher, onDestroy, onMount } from "svelte";
|
|
5
5
|
import { useQueryClient } from "@tanstack/svelte-query";
|
|
6
|
+
import { createWindowVirtualizer } from "@tanstack/svelte-virtual";
|
|
6
7
|
const queryClient = useQueryClient();
|
|
7
8
|
const dispatch = createEventDispatcher();
|
|
8
9
|
export let queryKey;
|
|
9
10
|
export let query;
|
|
10
11
|
export let emptyMessage = "None found";
|
|
11
12
|
export let rowHoverable = true;
|
|
13
|
+
export let dataSelector = (pageData) => Array.isArray(pageData) ? pageData : [];
|
|
14
|
+
export let virtualization = {};
|
|
15
|
+
$: enableVirtualization = virtualization.enabled ?? true;
|
|
16
|
+
$: estimatedRowHeight = virtualization.estimatedRowHeight ?? 56;
|
|
17
|
+
$: virtualizationOverscan = virtualization.overscan ?? 8;
|
|
18
|
+
let measuredRowHeight = null;
|
|
19
|
+
$: rowHeight = measuredRowHeight ?? estimatedRowHeight;
|
|
20
|
+
let transformedPages = [];
|
|
21
|
+
let lastPagesRef;
|
|
22
|
+
let lastSelector = dataSelector;
|
|
23
|
+
$: {
|
|
24
|
+
const currentData = $query.data;
|
|
25
|
+
const currentPages = currentData?.pages;
|
|
26
|
+
const selectorChanged = lastSelector !== dataSelector;
|
|
27
|
+
if (!currentPages) {
|
|
28
|
+
transformedPages = [];
|
|
29
|
+
lastPagesRef = void 0;
|
|
30
|
+
lastSelector = dataSelector;
|
|
31
|
+
} else if (currentPages !== lastPagesRef || selectorChanged) {
|
|
32
|
+
transformedPages = currentPages.map((page) => dataSelector(page));
|
|
33
|
+
lastPagesRef = currentPages;
|
|
34
|
+
lastSelector = dataSelector;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
$: flattenedRows = transformedPages.flat();
|
|
38
|
+
$: totalRows = flattenedRows.length;
|
|
39
|
+
$: hasData = totalRows > 0;
|
|
40
|
+
const hasWindow = typeof window !== "undefined";
|
|
41
|
+
let tableContainerElement = null;
|
|
42
|
+
let tableOffsetTop = 0;
|
|
43
|
+
let virtualizerStore = null;
|
|
44
|
+
let virtualizer = null;
|
|
45
|
+
let unsubscribeVirtualizer = null;
|
|
46
|
+
let virtualizationActive = false;
|
|
47
|
+
function updateTableOffset() {
|
|
48
|
+
if (!enableVirtualization || !hasWindow || !tableContainerElement) {
|
|
49
|
+
tableOffsetTop = 0;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const rect = tableContainerElement.getBoundingClientRect();
|
|
53
|
+
tableOffsetTop = rect.top + window.scrollY;
|
|
54
|
+
}
|
|
55
|
+
onMount(() => {
|
|
56
|
+
if (!hasWindow) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
virtualizerStore = createWindowVirtualizer({
|
|
60
|
+
count: totalRows,
|
|
61
|
+
estimateSize: () => rowHeight,
|
|
62
|
+
overscan: virtualizationOverscan,
|
|
63
|
+
scrollMargin: tableOffsetTop,
|
|
64
|
+
getItemKey: (index) => index,
|
|
65
|
+
enabled: enableVirtualization && totalRows > 0
|
|
66
|
+
});
|
|
67
|
+
unsubscribeVirtualizer = virtualizerStore.subscribe((instance) => {
|
|
68
|
+
virtualizer = instance;
|
|
69
|
+
});
|
|
70
|
+
updateTableOffset();
|
|
71
|
+
return () => {
|
|
72
|
+
unsubscribeVirtualizer?.();
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
afterUpdate(() => {
|
|
76
|
+
if (enableVirtualization) {
|
|
77
|
+
updateTableOffset();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
$: if (virtualizer) {
|
|
81
|
+
virtualizer.setOptions({
|
|
82
|
+
count: totalRows,
|
|
83
|
+
estimateSize: () => rowHeight,
|
|
84
|
+
overscan: virtualizationOverscan,
|
|
85
|
+
scrollMargin: tableOffsetTop,
|
|
86
|
+
getItemKey: (index) => index,
|
|
87
|
+
enabled: enableVirtualization && totalRows > 0
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
$: virtualizationActive = enableVirtualization && Boolean(virtualizer);
|
|
91
|
+
let virtualItems = [];
|
|
92
|
+
let totalSize = 0;
|
|
93
|
+
let topPadding = 0;
|
|
94
|
+
let bottomPadding = 0;
|
|
95
|
+
let scrollMargin = 0;
|
|
96
|
+
$: {
|
|
97
|
+
const hasRows = totalRows > 0;
|
|
98
|
+
scrollMargin = virtualizationActive ? tableOffsetTop : 0;
|
|
99
|
+
if (virtualizationActive && virtualizer && hasRows) {
|
|
100
|
+
virtualItems = virtualizer.getVirtualItems();
|
|
101
|
+
totalSize = virtualizer.getTotalSize();
|
|
102
|
+
const firstItem = virtualItems[0];
|
|
103
|
+
const lastItem = virtualItems[virtualItems.length - 1];
|
|
104
|
+
topPadding = firstItem ? Math.max(0, firstItem.start - scrollMargin) : 0;
|
|
105
|
+
bottomPadding = lastItem ? Math.max(0, totalSize - (lastItem.end - scrollMargin)) : Math.max(0, totalSize);
|
|
106
|
+
} else {
|
|
107
|
+
virtualItems = [];
|
|
108
|
+
totalSize = 0;
|
|
109
|
+
topPadding = 0;
|
|
110
|
+
bottomPadding = 0;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
onDestroy(() => {
|
|
114
|
+
unsubscribeVirtualizer?.();
|
|
115
|
+
});
|
|
116
|
+
afterUpdate(() => {
|
|
117
|
+
if (!virtualizationActive || !virtualizer || !tableContainerElement) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const rows = Array.from(
|
|
121
|
+
tableContainerElement.querySelectorAll('tbody tr[data-virtual-row="true"]')
|
|
122
|
+
);
|
|
123
|
+
if (!rows.length) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
for (const row of rows) {
|
|
127
|
+
virtualizer.measureElement(row);
|
|
128
|
+
}
|
|
129
|
+
if (measuredRowHeight === null) {
|
|
130
|
+
const sampleHeight = rows[0].getBoundingClientRect().height;
|
|
131
|
+
if (sampleHeight > 0) {
|
|
132
|
+
measuredRowHeight = sampleHeight;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
12
136
|
</script>
|
|
13
137
|
|
|
14
138
|
<div data-testid="title" class="flex h-16 w-full items-center justify-end">
|
|
@@ -21,40 +145,67 @@ export let rowHoverable = true;
|
|
|
21
145
|
spin={$query.isLoading || $query.isFetching}
|
|
22
146
|
on:click={async () => {
|
|
23
147
|
if (queryKey) {
|
|
24
|
-
|
|
148
|
+
invalidateTanstackQueries(queryClient, [queryKey]);
|
|
25
149
|
}
|
|
26
|
-
$query.refetch();
|
|
27
150
|
}}
|
|
28
151
|
/>
|
|
29
152
|
</div>
|
|
30
|
-
{#if
|
|
153
|
+
{#if totalRows === 0}
|
|
31
154
|
<div data-testid="emptyMessage" class="text-center text-gray-900 dark:text-white">
|
|
32
155
|
{emptyMessage}
|
|
33
156
|
</div>
|
|
34
|
-
{:else if
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
157
|
+
{:else if hasData}
|
|
158
|
+
<div
|
|
159
|
+
class="cursor-pointer overflow-x-auto rounded-lg border dark:border-none"
|
|
160
|
+
data-testid="tanstackTableContainer"
|
|
161
|
+
bind:this={tableContainerElement}
|
|
38
162
|
>
|
|
39
|
-
<
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
{#
|
|
45
|
-
<
|
|
46
|
-
class="
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
163
|
+
<Table divClass="min-w-full" class="w-full table-fixed" hoverable={rowHoverable}>
|
|
164
|
+
<TableHead data-testid="head">
|
|
165
|
+
<slot name="head" />
|
|
166
|
+
</TableHead>
|
|
167
|
+
<TableBody>
|
|
168
|
+
{#if virtualizationActive && topPadding > 0}
|
|
169
|
+
<tr aria-hidden="true">
|
|
170
|
+
<td colspan="1000" class="border-0 p-0" style={`height:${topPadding}px;`} />
|
|
171
|
+
</tr>
|
|
172
|
+
{/if}
|
|
173
|
+
{#if virtualizationActive}
|
|
174
|
+
{#each virtualItems as virtualItem (virtualItem.key)}
|
|
175
|
+
<TableBodyRow
|
|
176
|
+
class="whitespace-nowrap"
|
|
177
|
+
data-testid="bodyRow"
|
|
178
|
+
data-virtual-row="true"
|
|
179
|
+
on:click={() => {
|
|
180
|
+
dispatch('clickRow', { item: flattenedRows[virtualItem.index] });
|
|
181
|
+
}}
|
|
182
|
+
>
|
|
183
|
+
<slot name="bodyRow" item={flattenedRows[virtualItem.index]} />
|
|
184
|
+
</TableBodyRow>
|
|
185
|
+
{/each}
|
|
186
|
+
{:else}
|
|
187
|
+
{#each transformedPages as page}
|
|
188
|
+
{#each page as item}
|
|
189
|
+
<TableBodyRow
|
|
190
|
+
class="whitespace-nowrap"
|
|
191
|
+
data-testid="bodyRow"
|
|
192
|
+
on:click={() => {
|
|
193
|
+
dispatch('clickRow', { item });
|
|
194
|
+
}}
|
|
195
|
+
>
|
|
196
|
+
<slot name="bodyRow" {item} />
|
|
197
|
+
</TableBodyRow>
|
|
198
|
+
{/each}
|
|
199
|
+
{/each}
|
|
200
|
+
{/if}
|
|
201
|
+
{#if virtualizationActive && bottomPadding > 0}
|
|
202
|
+
<tr aria-hidden="true">
|
|
203
|
+
<td colspan="1000" class="border-0 p-0" style={`height:${bottomPadding}px;`} />
|
|
204
|
+
</tr>
|
|
205
|
+
{/if}
|
|
206
|
+
</TableBody>
|
|
207
|
+
</Table>
|
|
208
|
+
</div>
|
|
58
209
|
<div class="mt-2 flex justify-center">
|
|
59
210
|
<Button
|
|
60
211
|
data-testid="loadMoreButton"
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { CreateInfiniteQueryResult, InfiniteData } from '@tanstack/svelte-query';
|
|
3
|
-
declare class __sveltets_Render<
|
|
3
|
+
declare class __sveltets_Render<DataItem, InputData = DataItem[]> {
|
|
4
4
|
props(): {
|
|
5
|
-
queryKey: string
|
|
6
|
-
query: CreateInfiniteQueryResult<InfiniteData<
|
|
5
|
+
queryKey: string;
|
|
6
|
+
query: CreateInfiniteQueryResult<InfiniteData<InputData, unknown>, Error>;
|
|
7
7
|
emptyMessage?: string;
|
|
8
8
|
rowHoverable?: boolean;
|
|
9
|
+
dataSelector?: ((pageData: InputData) => DataItem[]) | undefined;
|
|
10
|
+
virtualization?: {
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
estimatedRowHeight?: number;
|
|
13
|
+
overscan?: number;
|
|
14
|
+
} | undefined;
|
|
9
15
|
};
|
|
10
16
|
events(): {
|
|
11
17
|
clickRow: CustomEvent<any>;
|
|
@@ -18,13 +24,13 @@ declare class __sveltets_Render<T> {
|
|
|
18
24
|
title: {};
|
|
19
25
|
head: {};
|
|
20
26
|
bodyRow: {
|
|
21
|
-
item:
|
|
27
|
+
item: DataItem;
|
|
22
28
|
};
|
|
23
29
|
};
|
|
24
30
|
}
|
|
25
|
-
export type TanstackAppTableProps<
|
|
26
|
-
export type TanstackAppTableEvents<
|
|
27
|
-
export type TanstackAppTableSlots<
|
|
28
|
-
export default class TanstackAppTable<
|
|
31
|
+
export type TanstackAppTableProps<DataItem, InputData = DataItem[]> = ReturnType<__sveltets_Render<DataItem, InputData>['props']>;
|
|
32
|
+
export type TanstackAppTableEvents<DataItem, InputData = DataItem[]> = ReturnType<__sveltets_Render<DataItem, InputData>['events']>;
|
|
33
|
+
export type TanstackAppTableSlots<DataItem, InputData = DataItem[]> = ReturnType<__sveltets_Render<DataItem, InputData>['slots']>;
|
|
34
|
+
export default class TanstackAppTable<DataItem, InputData = DataItem[]> extends SvelteComponent<TanstackAppTableProps<DataItem, InputData>, TanstackAppTableEvents<DataItem, InputData>, TanstackAppTableSlots<DataItem, InputData>> {
|
|
29
35
|
}
|
|
30
36
|
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script>import { Toast } from "flowbite-svelte";
|
|
2
|
+
import { slide } from "svelte/transition";
|
|
3
|
+
import { CheckCircleSolid, CloseCircleSolid } from "flowbite-svelte-icons";
|
|
4
|
+
import { useToasts } from "../providers/toasts/useToasts";
|
|
5
|
+
export let toast;
|
|
6
|
+
export let i;
|
|
7
|
+
const { removeToast } = useToasts();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<Toast
|
|
11
|
+
on:close={() => removeToast(i)}
|
|
12
|
+
dismissable={true}
|
|
13
|
+
transition={slide}
|
|
14
|
+
color={toast.color}
|
|
15
|
+
class="mb-2"
|
|
16
|
+
>
|
|
17
|
+
<svelte:fragment slot="icon">
|
|
18
|
+
{#if toast.type === 'success'}
|
|
19
|
+
<CheckCircleSolid class="h-5 w-5" data-testid="success-icon" />
|
|
20
|
+
{:else if toast.type === 'error'}
|
|
21
|
+
<CloseCircleSolid class="h-5 w-5" data-testid="error-icon" />
|
|
22
|
+
{/if}
|
|
23
|
+
</svelte:fragment>
|
|
24
|
+
<p class="font-semibold">{toast.message}</p>
|
|
25
|
+
{#if toast.detail}
|
|
26
|
+
<p>{toast.detail}</p>
|
|
27
|
+
{/if}
|
|
28
|
+
{#if toast.links}
|
|
29
|
+
<div class="flex flex-col">
|
|
30
|
+
{#each toast.links as { link, label }}
|
|
31
|
+
<a
|
|
32
|
+
href={link}
|
|
33
|
+
target="_blank"
|
|
34
|
+
rel="noopener noreferrer"
|
|
35
|
+
class="text-blue-500 hover:underline"
|
|
36
|
+
>
|
|
37
|
+
{label}
|
|
38
|
+
</a>
|
|
39
|
+
{/each}
|
|
40
|
+
</div>
|
|
41
|
+
{/if}
|
|
42
|
+
</Toast>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ToastProps } from '../types/toast';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
toast: ToastProps;
|
|
6
|
+
i: number;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
exports?: {} | undefined;
|
|
13
|
+
bindings?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type ToastDetailProps = typeof __propDef.props;
|
|
16
|
+
export type ToastDetailEvents = typeof __propDef.events;
|
|
17
|
+
export type ToastDetailSlots = typeof __propDef.slots;
|
|
18
|
+
export default class ToastDetail extends SvelteComponent<ToastDetailProps, ToastDetailEvents, ToastDetailSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
triggeredBy?: string;
|
|
5
|
+
customClass?: string;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {
|
|
11
|
+
default: {};
|
|
12
|
+
};
|
|
13
|
+
exports?: {} | undefined;
|
|
14
|
+
bindings?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
export type TooltipProps = typeof __propDef.props;
|
|
17
|
+
export type TooltipEvents = typeof __propDef.events;
|
|
18
|
+
export type TooltipSlots = typeof __propDef.slots;
|
|
19
|
+
export default class Tooltip extends SvelteComponent<TooltipProps, TooltipEvents, TooltipSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script>import {} from "@rainlanguage/orderbook";
|
|
2
|
+
import DropdownCheckbox from "./dropdown/DropdownCheckbox.svelte";
|
|
3
|
+
import { VAULT_BALANCE_CHANGE_FILTER_LABELS } from "../utils/vaultBalanceChangeLabels";
|
|
4
|
+
export let value = void 0;
|
|
5
|
+
const filterOptions = VAULT_BALANCE_CHANGE_FILTER_LABELS;
|
|
6
|
+
let typeFilter = {};
|
|
7
|
+
$: {
|
|
8
|
+
const keys = Object.keys(typeFilter);
|
|
9
|
+
if (keys.length > 0 && keys.length < Object.keys(filterOptions).length) {
|
|
10
|
+
value = keys.sort();
|
|
11
|
+
} else {
|
|
12
|
+
value = void 0;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<DropdownCheckbox
|
|
18
|
+
options={filterOptions}
|
|
19
|
+
bind:value={typeFilter}
|
|
20
|
+
label="Change Type"
|
|
21
|
+
allLabel="All types"
|
|
22
|
+
onlyTitle={true}
|
|
23
|
+
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type VaultBalanceChangeFilter } from '@rainlanguage/orderbook';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
value?: VaultBalanceChangeFilter[] | undefined;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type VaultBalanceChangeTypeFilterProps = typeof __propDef.props;
|
|
15
|
+
export type VaultBalanceChangeTypeFilterEvents = typeof __propDef.events;
|
|
16
|
+
export type VaultBalanceChangeTypeFilterSlots = typeof __propDef.slots;
|
|
17
|
+
export default class VaultBalanceChangeTypeFilter extends SvelteComponent<VaultBalanceChangeTypeFilterProps, VaultBalanceChangeTypeFilterEvents, VaultBalanceChangeTypeFilterSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script>import { goto } from "$app/navigation";
|
|
2
|
+
export let vault;
|
|
3
|
+
const handleClick = (event) => {
|
|
4
|
+
event.stopPropagation();
|
|
5
|
+
event.preventDefault();
|
|
6
|
+
goto(`/vaults/${vault.chainId}-${vault.orderbook}-${vault.id}`);
|
|
7
|
+
};
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<button
|
|
11
|
+
type="button"
|
|
12
|
+
class="flex flex-col rounded-xl border border-gray-200 bg-gray-50 px-4 py-3 text-left shadow-sm transition-colors hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-700 dark:hover:bg-gray-600"
|
|
13
|
+
on:click={handleClick}
|
|
14
|
+
data-testid="vault-card"
|
|
15
|
+
>
|
|
16
|
+
<span class="font-semibold text-gray-800 dark:text-gray-200">{vault.token.symbol}</span>
|
|
17
|
+
<span class="truncate text-xs text-gray-500 dark:text-gray-400">{vault.formattedBalance}</span>
|
|
18
|
+
</button>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { RaindexVault } from '@rainlanguage/orderbook';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
vault: RaindexVault;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type VaultCardProps = typeof __propDef.props;
|
|
15
|
+
export type VaultCardEvents = typeof __propDef.events;
|
|
16
|
+
export type VaultCardSlots = typeof __propDef.slots;
|
|
17
|
+
export default class VaultCard extends SvelteComponent<VaultCardProps, VaultCardEvents, VaultCardSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { Readable } from 'svelte/store';
|
|
3
3
|
import { type IChartApi, type UTCTimestamp, type ISeriesApi, type WhitespaceData, type Time, type DeepPartial, type SeriesOptionsCommon, type SeriesOptionsMap } from 'lightweight-charts';
|
|
4
|
-
declare class __sveltets_Render<T extends keyof SeriesOptionsMap,
|
|
4
|
+
declare class __sveltets_Render<T extends keyof SeriesOptionsMap, O> {
|
|
5
5
|
props(): {
|
|
6
6
|
[x: string]: any;
|
|
7
7
|
data?: {
|
|
@@ -21,9 +21,9 @@ declare class __sveltets_Render<T extends keyof SeriesOptionsMap, D, O> {
|
|
|
21
21
|
};
|
|
22
22
|
slots(): {};
|
|
23
23
|
}
|
|
24
|
-
export type LightweightChartProps<T extends keyof SeriesOptionsMap,
|
|
25
|
-
export type LightweightChartEvents<T extends keyof SeriesOptionsMap,
|
|
26
|
-
export type LightweightChartSlots<T extends keyof SeriesOptionsMap,
|
|
27
|
-
export default class LightweightChart<T extends keyof SeriesOptionsMap,
|
|
24
|
+
export type LightweightChartProps<T extends keyof SeriesOptionsMap, O> = ReturnType<__sveltets_Render<T, O>['props']>;
|
|
25
|
+
export type LightweightChartEvents<T extends keyof SeriesOptionsMap, O> = ReturnType<__sveltets_Render<T, O>['events']>;
|
|
26
|
+
export type LightweightChartSlots<T extends keyof SeriesOptionsMap, O> = ReturnType<__sveltets_Render<T, O>['slots']>;
|
|
27
|
+
export default class LightweightChart<T extends keyof SeriesOptionsMap, O> extends SvelteComponent<LightweightChartProps<T, O>, LightweightChartEvents<T, O>, LightweightChartSlots<T, O>> {
|
|
28
28
|
}
|
|
29
29
|
export {};
|