@rainlanguage/ui-components 0.0.1-alpha.13 → 0.0.1-alpha.14

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.
@@ -7,7 +7,6 @@ import FieldDefinitionsSection from "./FieldDefinitionsSection.svelte";
7
7
  import {} from "@rainlanguage/orderbook/js_api";
8
8
  import WalletConnect from "../wallet/WalletConnect.svelte";
9
9
  import {
10
- DotrainOrderGui
11
10
  } from "@rainlanguage/orderbook/js_api";
12
11
  import { fade } from "svelte/transition";
13
12
  import { Button, Toggle, Spinner } from "flowbite-svelte";
@@ -18,11 +17,11 @@ import { handleShareChoices } from "../../services/handleShareChoices";
18
17
  import { getDeploymentTransactionArgs } from "./getDeploymentTransactionArgs";
19
18
  import { DeploymentStepsError, DeploymentStepsErrorCode } from "../../errors";
20
19
  import { onMount } from "svelte";
20
+ import { useGui } from "../../hooks/useGui";
21
21
  export let settings;
22
22
  export let dotrain;
23
23
  export let deployment;
24
24
  export let strategyDetail;
25
- export let gui;
26
25
  export let handleDeployModal;
27
26
  export let handleDisclaimerModal;
28
27
  let allDepositFields = [];
@@ -33,6 +32,7 @@ let allTokensSelected = false;
33
32
  let showAdvancedOptions = false;
34
33
  let checkingDeployment = false;
35
34
  let allTokenInfos = [];
35
+ const gui = useGui();
36
36
  const selectTokens = gui.getSelectTokens();
37
37
  const networkKey = gui.getNetworkKey();
38
38
  const subgraphUrl = $settings?.subgraphs?.[networkKey] ?? "";
@@ -1,6 +1,6 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  import { type ConfigSource } from '@rainlanguage/orderbook/js_api';
3
- import { DotrainOrderGui, type NameAndDescriptionCfg } from '@rainlanguage/orderbook/js_api';
3
+ import { type NameAndDescriptionCfg } from '@rainlanguage/orderbook/js_api';
4
4
  import { type Config } from '@wagmi/core';
5
5
  import { type Writable } from 'svelte/store';
6
6
  import type { AppKit } from '@reown/appkit';
@@ -15,7 +15,6 @@ declare const __propDef: {
15
15
  description: string;
16
16
  };
17
17
  strategyDetail: NameAndDescriptionCfg;
18
- gui: DotrainOrderGui;
19
18
  handleDeployModal: (args: DeployModalProps) => void;
20
19
  handleDisclaimerModal: (args: DisclaimerModalProps) => void;
21
20
  wagmiConfig: Writable<Config | undefined>;
@@ -1,5 +1,6 @@
1
1
  export declare enum DeploymentStepsErrorCode {
2
- NO_GUI = "Error loading GUI",
2
+ NO_GUI_PROVIDER = "No GUI provider found.",
3
+ NO_GUI = "Error loading GUI.",
3
4
  NO_STRATEGY = "No valid strategy exists at this URL",
4
5
  NO_SELECT_TOKENS = "Error loading tokens",
5
6
  NO_TOKEN_INFO = "Error loading token information",
@@ -1,7 +1,8 @@
1
1
  import { writable } from 'svelte/store';
2
2
  export var DeploymentStepsErrorCode;
3
3
  (function (DeploymentStepsErrorCode) {
4
- DeploymentStepsErrorCode["NO_GUI"] = "Error loading GUI";
4
+ DeploymentStepsErrorCode["NO_GUI_PROVIDER"] = "No GUI provider found.";
5
+ DeploymentStepsErrorCode["NO_GUI"] = "Error loading GUI.";
5
6
  DeploymentStepsErrorCode["NO_STRATEGY"] = "No valid strategy exists at this URL";
6
7
  DeploymentStepsErrorCode["NO_SELECT_TOKENS"] = "Error loading tokens";
7
8
  DeploymentStepsErrorCode["NO_TOKEN_INFO"] = "Error loading token information";
@@ -0,0 +1,3 @@
1
+ import { DotrainOrderGui } from '@rainlanguage/orderbook/js_api';
2
+ export declare const GUI_CONTEXT_KEY = "gui-context";
3
+ export declare function useGui(): DotrainOrderGui;
@@ -0,0 +1,11 @@
1
+ import { getContext } from 'svelte';
2
+ import { DotrainOrderGui } from '@rainlanguage/orderbook/js_api';
3
+ import { DeploymentStepsError, DeploymentStepsErrorCode } from '../errors/DeploymentStepsError';
4
+ export const GUI_CONTEXT_KEY = 'gui-context';
5
+ export function useGui() {
6
+ const gui = getContext(GUI_CONTEXT_KEY);
7
+ if (!gui) {
8
+ DeploymentStepsError.catch(null, DeploymentStepsErrorCode.NO_GUI_PROVIDER);
9
+ }
10
+ return gui;
11
+ }
package/dist/index.d.ts CHANGED
@@ -87,3 +87,5 @@ export { default as transactionStore } from './stores/transactionStore';
87
87
  export { mockTransactionStore } from './__mocks__/mockTransactionStore';
88
88
  export { default as logoLight } from './assets/logo-light.svg';
89
89
  export { default as logoDark } from './assets/logo-dark.svg';
90
+ export { useGui } from './hooks/useGui';
91
+ export { default as GuiProvider } from './providers/GuiProvider.svelte';
package/dist/index.js CHANGED
@@ -87,3 +87,7 @@ export { mockTransactionStore } from './__mocks__/mockTransactionStore';
87
87
  // Assets
88
88
  export { default as logoLight } from './assets/logo-light.svg';
89
89
  export { default as logoDark } from './assets/logo-dark.svg';
90
+ // Hooks
91
+ export { useGui } from './hooks/useGui';
92
+ // Providers
93
+ export { default as GuiProvider } from './providers/GuiProvider.svelte';
@@ -0,0 +1,8 @@
1
+ <script>import { setContext } from "svelte";
2
+ import { DotrainOrderGui } from "@rainlanguage/orderbook/js_api";
3
+ import { GUI_CONTEXT_KEY } from "../hooks/useGui";
4
+ export let gui;
5
+ setContext(GUI_CONTEXT_KEY, gui);
6
+ </script>
7
+
8
+ <slot />
@@ -0,0 +1,21 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import { DotrainOrderGui } from '@rainlanguage/orderbook/js_api';
3
+ declare const __propDef: {
4
+ props: {
5
+ gui: DotrainOrderGui;
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 GuiProviderProps = typeof __propDef.props;
17
+ export type GuiProviderEvents = typeof __propDef.events;
18
+ export type GuiProviderSlots = typeof __propDef.slots;
19
+ export default class GuiProvider extends SvelteComponent<GuiProviderProps, GuiProviderEvents, GuiProviderSlots> {
20
+ }
21
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rainlanguage/ui-components",
3
- "version": "0.0.1-alpha.13",
3
+ "version": "0.0.1-alpha.14",
4
4
  "description": "A component library for building Svelte applications to be used with Raindex.",
5
5
  "license": "LicenseRef-DCL-1.0",
6
6
  "author": "Rain Open Source Software Ltd",
@@ -53,7 +53,7 @@
53
53
  "@fontsource/dm-sans": "^5.0.18",
54
54
  "@imask/svelte": "^7.3.0",
55
55
  "@observablehq/plot": "^0.6.13",
56
- "@rainlanguage/orderbook": "0.0.1-alpha.13",
56
+ "@rainlanguage/orderbook": "0.0.1-alpha.14",
57
57
  "@reown/appkit": "^1.6.4",
58
58
  "@reown/appkit-adapter-wagmi": "^1.6.4",
59
59
  "@sentry/sveltekit": "^7.107.0",