@xyo-network/os-react-runtime 4.2.0-rc.9 → 4.2.1
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/browser/index.mjs +558 -519
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/modules/Dapp/Container.d.ts.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/DappWindow.d.ts +3 -14
- package/dist/browser/modules/Dapp/modules/Window/DappWindow.d.ts.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/MetaTags.d.ts +8 -0
- package/dist/browser/modules/Dapp/modules/Window/MetaTags.d.ts.map +1 -0
- package/dist/browser/modules/Dapp/modules/Window/Rendered.d.ts +5 -0
- package/dist/browser/modules/Dapp/modules/Window/Rendered.d.ts.map +1 -0
- package/dist/browser/modules/Dapp/modules/Window/hooks/index.d.ts +1 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/index.d.ts.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/menu/useDappMenu.d.ts +2 -21
- package/dist/browser/modules/Dapp/modules/Window/hooks/menu/useDappMenu.d.ts.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.d.ts.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.d.ts +1 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.d.ts.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/useDecomposeDapp.d.ts +11 -0
- package/dist/browser/modules/Dapp/modules/Window/hooks/useDecomposeDapp.d.ts.map +1 -0
- package/dist/browser/modules/Dapp/modules/Window/index.d.ts +3 -1
- package/dist/browser/modules/Dapp/modules/Window/index.d.ts.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/types/DappMenuProperties.d.ts +9 -0
- package/dist/browser/modules/Dapp/modules/Window/types/DappMenuProperties.d.ts.map +1 -0
- package/dist/browser/modules/Dapp/modules/Window/types/DappWindowProps.d.ts +13 -0
- package/dist/browser/modules/Dapp/modules/Window/types/DappWindowProps.d.ts.map +1 -0
- package/dist/browser/modules/Dapp/modules/Window/types/index.d.ts +3 -0
- package/dist/browser/modules/Dapp/modules/Window/types/index.d.ts.map +1 -0
- package/package.json +10 -11
- package/src/DappPathSwitcher.tsx +3 -3
- package/src/modules/Dapp/Container.tsx +21 -9
- package/src/modules/Dapp/modules/Window/DappWindow.tsx +22 -131
- package/src/modules/Dapp/modules/Window/MetaTags.tsx +27 -0
- package/src/modules/Dapp/modules/Window/Rendered.tsx +101 -0
- package/src/modules/Dapp/modules/Window/hooks/index.ts +1 -1
- package/src/modules/Dapp/modules/Window/hooks/menu/useDappMenu.tsx +3 -2
- package/src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.tsx +3 -6
- package/src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.tsx +3 -1
- package/src/modules/Dapp/modules/Window/hooks/useDecomposeDapp.tsx +21 -0
- package/src/modules/Dapp/modules/Window/index.ts +3 -1
- package/src/modules/Dapp/modules/Window/types/DappMenuProperties.ts +9 -0
- package/src/modules/Dapp/modules/Window/types/DappWindowProps.ts +14 -0
- package/src/modules/Dapp/modules/Window/types/index.ts +2 -0
- package/dist/browser/modules/Dapp/modules/Window/hooks/useDecomposeDappSet.d.ts +0 -9
- package/dist/browser/modules/Dapp/modules/Window/hooks/useDecomposeDappSet.d.ts.map +0 -1
- package/src/modules/Dapp/modules/Window/hooks/useDecomposeDappSet.tsx +0 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../../src/modules/Dapp/Container.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACzE,OAAO,KAAwB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../../src/modules/Dapp/Container.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACzE,OAAO,KAAwB,MAAM,OAAO,CAAA;AAQ5C,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B,OAAO,EAAE,sBAAsB,CAAA;IAC/B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;CAC/B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA0CtD,CAAA;AAED,eAAO,MAAM,iBAAiB,gDAAsB,CAAA"}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { RegisteredReactDappSet, XyOsUiContext } from '@xyo-network/os-react-model';
|
|
3
|
-
import type { WalletInstance } from '@xyo-network/wallet-model';
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
4
2
|
import React from 'react';
|
|
5
|
-
import type {
|
|
6
|
-
export interface DappWindowProps {
|
|
7
|
-
context?: XyOsUiContext | null;
|
|
8
|
-
dappSet?: RegisteredReactDappSet;
|
|
9
|
-
dappState?: DappState;
|
|
10
|
-
dappWallet?: WalletInstance;
|
|
11
|
-
errors?: Error[];
|
|
12
|
-
intent?: DappIntent;
|
|
13
|
-
nodeCreateError?: Error;
|
|
14
|
-
}
|
|
3
|
+
import type { DappWindowProps } from './types/index.ts';
|
|
15
4
|
/** A component that can load immediately, but delays node loading and dapp mounting till corresponding launch intent arrives */
|
|
16
|
-
export declare const DappWindow: React.FC<DappWindowProps>;
|
|
5
|
+
export declare const DappWindow: React.FC<DappWindowProps & PropsWithChildren>;
|
|
17
6
|
//# sourceMappingURL=DappWindow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DappWindow.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/Dapp/modules/Window/DappWindow.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"DappWindow.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/Dapp/modules/Window/DappWindow.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEvD,gIAAgI;AAChI,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,GAAG,iBAAiB,CA4BpE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetaTags.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/Dapp/modules/Window/MetaTags.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAgBpD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Rendered.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/Dapp/modules/Window/Rendered.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEvD,6DAA6D;AAC7D,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmFlD,CAAA"}
|
|
@@ -2,7 +2,7 @@ export * from './lib/index.ts';
|
|
|
2
2
|
export * from './menu/index.ts';
|
|
3
3
|
export * from './route/index.ts';
|
|
4
4
|
export * from './useDappMenuResourceValues.tsx';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './useDecomposeDapp.tsx';
|
|
6
6
|
export * from './useSkipLoadingScreen.js';
|
|
7
7
|
export * from './useSyncOsRegisteredAccessInterfaces.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/Dapp/modules/Window/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/Dapp/modules/Window/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,0CAA0C,CAAA"}
|
|
@@ -1,26 +1,7 @@
|
|
|
1
1
|
import type { DappName, XyOsContext } from '@xyo-network/os-model';
|
|
2
|
+
import type { DappMenuProperties } from '../../types/index.ts';
|
|
2
3
|
/**
|
|
3
4
|
* Use the passed in dapp Node to resolve menu related modules and return the menu related items
|
|
4
5
|
*/
|
|
5
|
-
export declare const useDappMenu: (context?: XyOsContext | null, dappName?: DappName) =>
|
|
6
|
-
activePath: string | undefined;
|
|
7
|
-
error: Error | undefined;
|
|
8
|
-
menuConfig: import("@xyo-network/payload-model").WithSources<import("@xylabs/object").DeepRestrictToStringKeys<{
|
|
9
|
-
schema: "network.xyo.dapp.nav.menu.config";
|
|
10
|
-
defaultPath?: string | undefined;
|
|
11
|
-
hideMobileMenu?: boolean | undefined;
|
|
12
|
-
}>> | undefined;
|
|
13
|
-
menuItemsVisible: import("@xyo-network/payload-model").WithSources<import("@xylabs/object").DeepRestrictToStringKeys<{
|
|
14
|
-
schema: "network.xyo.dapp.nav.item";
|
|
15
|
-
hidden?: boolean | undefined;
|
|
16
|
-
matchType?: "startsWith" | "exact" | undefined;
|
|
17
|
-
path: string;
|
|
18
|
-
primaryText: string;
|
|
19
|
-
secondaryText?: string | undefined;
|
|
20
|
-
svgIcon?: string | undefined;
|
|
21
|
-
svgIconActive?: string | undefined;
|
|
22
|
-
weight?: number | undefined;
|
|
23
|
-
}>>[] | undefined;
|
|
24
|
-
onPathChange: (path: string) => void;
|
|
25
|
-
};
|
|
6
|
+
export declare const useDappMenu: (context?: XyOsContext | null, dappName?: DappName) => DappMenuProperties;
|
|
26
7
|
//# sourceMappingURL=useDappMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDappMenu.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/Dapp/modules/Window/hooks/menu/useDappMenu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"useDappMenu.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/Dapp/modules/Window/hooks/menu/useDappMenu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAMlE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAI9D;;GAEG;AAEH,eAAO,MAAM,WAAW,aAAc,WAAW,GAAG,IAAI,aAAa,QAAQ,KAAG,kBAwD/E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useManageDappInjectableParamsFromRoute.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"useManageDappInjectableParamsFromRoute.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAKxD,6FAA6F;AAC7F,eAAO,MAAM,sCAAsC,aAAc,WAAW,GAAG,IAAI,0BA6ClF,CAAA"}
|
package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ import type { XyOsContext } from '@xyo-network/os-model';
|
|
|
11
11
|
* 5. Navigating directly to a path from within the dApp by clicking back
|
|
12
12
|
*/
|
|
13
13
|
/** React to changes in the `path` route param */
|
|
14
|
-
export declare const useManageDappPathFromRoute: (context?: XyOsContext | null, dappName?: string) =>
|
|
14
|
+
export declare const useManageDappPathFromRoute: (context?: XyOsContext | null, dappName?: string) => Error | undefined;
|
|
15
15
|
//# sourceMappingURL=useManageDappPathFromRoute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useManageDappPathFromRoute.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAUxD;;;;;;;;;;GAUG;AAEH,iDAAiD;AACjD,eAAO,MAAM,0BAA0B,aAAc,WAAW,GAAG,IAAI,aAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"useManageDappPathFromRoute.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAUxD;;;;;;;;;;GAUG;AAEH,iDAAiD;AACjD,eAAO,MAAM,0BAA0B,aAAc,WAAW,GAAG,IAAI,aAAa,MAAM,sBAmDzF,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RegisteredReactDapp } from '@xyo-network/os-react-model';
|
|
2
|
+
export declare const useDecomposeDapp: (dapp?: RegisteredReactDapp) => {
|
|
3
|
+
DappComponent: import("react").FC<{
|
|
4
|
+
name?: string;
|
|
5
|
+
}>;
|
|
6
|
+
dapp: RegisteredReactDapp | undefined;
|
|
7
|
+
name: string | undefined;
|
|
8
|
+
scrollable: boolean;
|
|
9
|
+
version: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=useDecomposeDapp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDecomposeDapp.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/Dapp/modules/Window/hooks/useDecomposeDapp.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAKtE,eAAO,MAAM,gBAAgB,UAAW,mBAAmB;;eAEhD,MAAM;;;;;;CAahB,CAAA"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './AppBar.tsx';
|
|
2
2
|
export * from './Chrome.tsx';
|
|
3
3
|
export * from './components/index.ts';
|
|
4
|
-
export * from './DappWindow.
|
|
4
|
+
export * from './DappWindow.tsx';
|
|
5
5
|
export * from './hooks/index.ts';
|
|
6
6
|
export * from './menu/index.ts';
|
|
7
|
+
export * from './Rendered.tsx';
|
|
8
|
+
export * from './types/index.ts';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/Dapp/modules/Window/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/Dapp/modules/Window/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DappNavItem, DappNavMenuConfig } from '@xyo-network/os-model';
|
|
2
|
+
export interface DappMenuProperties {
|
|
3
|
+
activePath?: string;
|
|
4
|
+
error?: Error;
|
|
5
|
+
menuConfig?: DappNavMenuConfig;
|
|
6
|
+
menuItems?: DappNavItem[];
|
|
7
|
+
onPathChange: (path: string) => void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=DappMenuProperties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DappMenuProperties.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/Dapp/modules/Window/types/DappMenuProperties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAE3E,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,UAAU,CAAC,EAAE,iBAAiB,CAAA;IAC9B,SAAS,CAAC,EAAE,WAAW,EAAE,CAAA;IACzB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CACrC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RegisteredReactDapp, XyOsUiContext } from '@xyo-network/os-react-model';
|
|
2
|
+
import type { WalletInstance } from '@xyo-network/wallet-model';
|
|
3
|
+
import type { DappState } from '../hooks/index.ts';
|
|
4
|
+
import type { DappMenuProperties } from './DappMenuProperties.ts';
|
|
5
|
+
export interface DappWindowProps {
|
|
6
|
+
context?: XyOsUiContext | null;
|
|
7
|
+
dapp?: RegisteredReactDapp;
|
|
8
|
+
dappMenuProperties?: DappMenuProperties;
|
|
9
|
+
dappState?: DappState;
|
|
10
|
+
dappWallet?: WalletInstance;
|
|
11
|
+
errors?: (Error | undefined)[];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=DappWindowProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DappWindowProps.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/Dapp/modules/Window/types/DappWindowProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IAC9B,IAAI,CAAC,EAAE,mBAAmB,CAAA;IAC1B,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;IACvC,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,UAAU,CAAC,EAAE,cAAc,CAAA;IAC3B,MAAM,CAAC,EAAE,CAAC,KAAK,GAAG,SAAS,CAAC,EAAE,CAAA;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/Dapp/modules/Window/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/os-react-runtime",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -48,23 +48,23 @@
|
|
|
48
48
|
"@xylabs/react-shared": "^5.3.14",
|
|
49
49
|
"@xyo-network/archivist-indexeddb": "^3.6.6",
|
|
50
50
|
"@xyo-network/archivist-model": "^3.6.6",
|
|
51
|
-
"@xyo-network/bios-browser": "^4.2.
|
|
52
|
-
"@xyo-network/bios-model": "^4.2.
|
|
51
|
+
"@xyo-network/bios-browser": "^4.2.1",
|
|
52
|
+
"@xyo-network/bios-model": "^4.2.1",
|
|
53
53
|
"@xyo-network/diviner-boundwitness-indexeddb": "^3.6.6",
|
|
54
54
|
"@xyo-network/diviner-model": "^3.6.6",
|
|
55
55
|
"@xyo-network/diviner-payload-generic": "^3.6.6",
|
|
56
56
|
"@xyo-network/diviner-payload-indexeddb": "^3.6.6",
|
|
57
57
|
"@xyo-network/diviner-payload-model": "^3.6.6",
|
|
58
|
-
"@xyo-network/kernel": "^4.2.
|
|
59
|
-
"@xyo-network/kernel-model": "^4.2.
|
|
58
|
+
"@xyo-network/kernel": "^4.2.1",
|
|
59
|
+
"@xyo-network/kernel-model": "^4.2.1",
|
|
60
60
|
"@xyo-network/module-event-emitter": "^3.6.6",
|
|
61
61
|
"@xyo-network/module-events": "^3.6.6",
|
|
62
62
|
"@xyo-network/module-factory-locator": "^3.6.6",
|
|
63
63
|
"@xyo-network/node-model": "^3.6.6",
|
|
64
|
-
"@xyo-network/os-model": "^4.2.
|
|
65
|
-
"@xyo-network/os-react-debug": "^4.2.
|
|
66
|
-
"@xyo-network/os-react-model": "^4.2.
|
|
67
|
-
"@xyo-network/os-runtime": "^4.2.
|
|
64
|
+
"@xyo-network/os-model": "^4.2.1",
|
|
65
|
+
"@xyo-network/os-react-debug": "^4.2.1",
|
|
66
|
+
"@xyo-network/os-react-model": "^4.2.1",
|
|
67
|
+
"@xyo-network/os-runtime": "^4.2.1",
|
|
68
68
|
"@xyo-network/payload-model": "^3.6.6",
|
|
69
69
|
"@xyo-network/react-archivist": "^4.3.1",
|
|
70
70
|
"@xyo-network/react-card": "^4.3.1",
|
|
@@ -112,6 +112,5 @@
|
|
|
112
112
|
},
|
|
113
113
|
"publishConfig": {
|
|
114
114
|
"access": "public"
|
|
115
|
-
}
|
|
116
|
-
"stableVersion": "4.1.4"
|
|
115
|
+
}
|
|
117
116
|
}
|
package/src/DappPathSwitcher.tsx
CHANGED
|
@@ -25,7 +25,7 @@ export const DappPathSwitcher: React.FC<DappPathSwitcherProps> = ({ activePath,
|
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
27
|
<>
|
|
28
|
-
{transitions((transitionProps,
|
|
28
|
+
{transitions((transitionProps, activePathRef) => (
|
|
29
29
|
<animated.div
|
|
30
30
|
style={{
|
|
31
31
|
...transitionProps,
|
|
@@ -44,11 +44,11 @@ export const DappPathSwitcher: React.FC<DappPathSwitcherProps> = ({ activePath,
|
|
|
44
44
|
}}
|
|
45
45
|
>
|
|
46
46
|
{(() => {
|
|
47
|
-
const activeIndex = pathToComponent?.findIndex(({ path: componentPath }) =>
|
|
47
|
+
const activeIndex = pathToComponent?.findIndex(({ path: componentPath }) => activePathRef === componentPath)
|
|
48
48
|
const activeItem = pathToComponent && activeIndex !== -1 && activeIndex !== undefined ? pathToComponent[activeIndex] : undefined
|
|
49
49
|
return activeItem
|
|
50
50
|
? activeItem.component
|
|
51
|
-
: <ErrorRender error={new Error(`No component found for path: ${
|
|
51
|
+
: <ErrorRender error={new Error(`No component found for path: ${activePathRef}`)} scope="DappPathSwitcher" />
|
|
52
52
|
})()}
|
|
53
53
|
</animated.div>
|
|
54
54
|
))}
|
|
@@ -4,7 +4,9 @@ import React, { memo, useMemo } from 'react'
|
|
|
4
4
|
|
|
5
5
|
import { useDappContextCreator } from '../../hooks/index.ts'
|
|
6
6
|
import { DappIconButton } from './Button/index.ts'
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
DappRendered, DappWindow, deriveDappState, useDappMenu,
|
|
9
|
+
} from './modules/index.ts'
|
|
8
10
|
|
|
9
11
|
export interface DappContainerProps {
|
|
10
12
|
currentIntent?: DappIntent
|
|
@@ -28,6 +30,19 @@ export const DappContainer: React.FC<DappContainerProps> = ({
|
|
|
28
30
|
}
|
|
29
31
|
}, [currentIntent, dapp])
|
|
30
32
|
|
|
33
|
+
const { error: menuError, ...dappMenuProperties } = useDappMenu(context, dapp?.config.name)
|
|
34
|
+
|
|
35
|
+
const errors = useMemo(() => [nodeCreateError, menuError].filter(Boolean), [nodeCreateError])
|
|
36
|
+
|
|
37
|
+
const dappWindowProps = useMemo(() => ({
|
|
38
|
+
context,
|
|
39
|
+
dapp,
|
|
40
|
+
dappMenuProperties,
|
|
41
|
+
dappState,
|
|
42
|
+
dappWallet,
|
|
43
|
+
errors,
|
|
44
|
+
}), [context, dapp, dappMenuProperties, dappState, dappWallet, errors])
|
|
45
|
+
|
|
31
46
|
return (
|
|
32
47
|
<DappIconButton
|
|
33
48
|
dappIcon={dappIcon}
|
|
@@ -35,14 +50,11 @@ export const DappContainer: React.FC<DappContainerProps> = ({
|
|
|
35
50
|
dappName={dapp?.config.name}
|
|
36
51
|
dappState={dappState}
|
|
37
52
|
>
|
|
38
|
-
<DappWindow
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
intent={currentIntent}
|
|
44
|
-
nodeCreateError={nodeCreateError}
|
|
45
|
-
/>
|
|
53
|
+
<DappWindow {...dappWindowProps}>
|
|
54
|
+
<DappRendered
|
|
55
|
+
{...dappWindowProps}
|
|
56
|
+
/>
|
|
57
|
+
</DappWindow>
|
|
46
58
|
</DappIconButton>
|
|
47
59
|
)
|
|
48
60
|
}
|
|
@@ -1,149 +1,40 @@
|
|
|
1
|
+
import { Snackbar } from '@mui/material'
|
|
1
2
|
import { ErrorBoundary, ErrorRender } from '@xylabs/react-error'
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import type { RegisteredReactDappSet, XyOsUiContext } from '@xyo-network/os-react-model'
|
|
5
|
-
import { NameTransforms } from '@xyo-network/os-runtime'
|
|
6
|
-
import { NodeProvider } from '@xyo-network/react-node'
|
|
7
|
-
import { WalletProvider } from '@xyo-network/react-wallet'
|
|
8
|
-
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
9
|
-
import React, { useMemo } from 'react'
|
|
10
|
-
import { Helmet } from 'react-helmet'
|
|
3
|
+
import type { PropsWithChildren } from 'react'
|
|
4
|
+
import React from 'react'
|
|
11
5
|
|
|
12
|
-
import { XyOsUiContextProvider } from '../../../XyOsUi/index.ts'
|
|
13
|
-
import { DappAccessFlexbox } from '../access-interface/index.ts'
|
|
14
|
-
import { DappBar } from './AppBar.js'
|
|
15
|
-
import { DappChrome } from './Chrome.js'
|
|
16
|
-
import type { DappState } from './hooks/index.ts'
|
|
17
6
|
import {
|
|
18
|
-
|
|
7
|
+
useManageDappInjectableParamsFromRoute, useManageDappPathFromRoute, useSyncOsRegisteredAccessInterfaces,
|
|
19
8
|
} from './hooks/index.ts'
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
export interface DappWindowProps {
|
|
24
|
-
context?: XyOsUiContext | null
|
|
25
|
-
dappSet?: RegisteredReactDappSet
|
|
26
|
-
dappState?: DappState
|
|
27
|
-
dappWallet?: WalletInstance
|
|
28
|
-
errors?: Error[]
|
|
29
|
-
intent?: DappIntent
|
|
30
|
-
nodeCreateError?: Error
|
|
31
|
-
}
|
|
9
|
+
import { DappMetaTags } from './MetaTags.tsx'
|
|
10
|
+
import type { DappWindowProps } from './types/index.ts'
|
|
32
11
|
|
|
33
12
|
/** A component that can load immediately, but delays node loading and dapp mounting till corresponding launch intent arrives */
|
|
34
|
-
export const DappWindow: React.FC<DappWindowProps> = ({
|
|
35
|
-
|
|
13
|
+
export const DappWindow: React.FC<DappWindowProps & PropsWithChildren> = ({
|
|
14
|
+
children, context, dapp, dappMenuProperties, dappState,
|
|
36
15
|
}) => {
|
|
37
|
-
const {
|
|
38
|
-
DappComponent, name, scrollable = true, version,
|
|
39
|
-
} = decomposeDappSet(dappSet)
|
|
16
|
+
const { name } = dapp?.config ?? {}
|
|
40
17
|
|
|
41
|
-
const { active
|
|
42
|
-
|
|
43
|
-
const TypedDappComponent = useMemo(() => DappComponent as React.FC<{
|
|
44
|
-
name?: string
|
|
45
|
-
}>, [])
|
|
18
|
+
const { active } = dappState ?? {}
|
|
46
19
|
|
|
47
20
|
useSyncOsRegisteredAccessInterfaces(context)
|
|
48
|
-
useManageDappPathFromRoute(context, name)
|
|
49
|
-
useManageDappInjectableParamsFromRoute(context)
|
|
50
|
-
|
|
51
|
-
const {
|
|
52
|
-
activePath, error: menuError, menuConfig, menuItemsVisible, onPathChange,
|
|
53
|
-
} = useDappMenu(context, name)
|
|
21
|
+
const routingError = useManageDappPathFromRoute(context, name)
|
|
22
|
+
const injectableErrors = useManageDappInjectableParamsFromRoute(context)
|
|
54
23
|
|
|
55
|
-
const resolvedErrors = [
|
|
56
|
-
const hasErrors = resolvedErrors.length > 0
|
|
24
|
+
const resolvedErrors = [...injectableErrors, routingError]
|
|
57
25
|
|
|
58
26
|
return (
|
|
59
27
|
<>
|
|
60
|
-
{active
|
|
61
|
-
? (
|
|
62
|
-
<Helmet>
|
|
63
|
-
<title>
|
|
64
|
-
{activePath ? `${new NameTransforms(activePath).deSlug()} | ` : ''}
|
|
65
|
-
{' '}
|
|
66
|
-
{name}
|
|
67
|
-
{' '}
|
|
68
|
-
dApp
|
|
69
|
-
</title>
|
|
70
|
-
</Helmet>
|
|
71
|
-
)
|
|
72
|
-
: null}
|
|
73
28
|
<ErrorBoundary>
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
largeScreenMenu={active && (
|
|
84
|
-
<DappMenuDrawer
|
|
85
|
-
context={context}
|
|
86
|
-
name={name}
|
|
87
|
-
version={version}
|
|
88
|
-
activePath={activePath}
|
|
89
|
-
onPathChange={onPathChange}
|
|
90
|
-
menuConfig={menuConfig}
|
|
91
|
-
menuItems={menuItemsVisible}
|
|
92
|
-
/>
|
|
93
|
-
)}
|
|
94
|
-
smallScreenMenu={active && (
|
|
95
|
-
<DappBottomNavigation
|
|
96
|
-
activePath={activePath}
|
|
97
|
-
onPathChange={onPathChange}
|
|
98
|
-
menuConfig={menuConfig}
|
|
99
|
-
menuItems={menuItemsVisible}
|
|
100
|
-
sx={{ display: menuConfig ? 'flex' : 'none' }}
|
|
101
|
-
/>
|
|
102
|
-
)}
|
|
103
|
-
/* Ensure that loading goes away when error occurs */
|
|
104
|
-
splashScreen={hasErrors ? null : <DappLoadingFlexbox minimize={!!minimized} name={name} open={!!active} />}
|
|
105
|
-
>
|
|
106
|
-
{hasErrors
|
|
107
|
-
? (
|
|
108
|
-
<FlexCol padding={2}>
|
|
109
|
-
{resolvedErrors?.map(error => (
|
|
110
|
-
<ErrorRender key={error?.message} error={error} scope="DappWindow" />
|
|
111
|
-
))}
|
|
112
|
-
</FlexCol>
|
|
113
|
-
)
|
|
114
|
-
: null}
|
|
115
|
-
<WalletProvider rootWallet={dappWallet}>
|
|
116
|
-
{context === null
|
|
117
|
-
? null
|
|
118
|
-
: (
|
|
119
|
-
<XyOsUiContextProvider value={context}>
|
|
120
|
-
{/* Prevent dapps from reaching out to the os node */}
|
|
121
|
-
<NodeProvider node={context?.root}>
|
|
122
|
-
{/* Only load the dapp component when the dapp's node exists and dapp is launched */}
|
|
123
|
-
{active
|
|
124
|
-
? (
|
|
125
|
-
<>
|
|
126
|
-
<FlexCol
|
|
127
|
-
position="absolute"
|
|
128
|
-
top={0}
|
|
129
|
-
left={0}
|
|
130
|
-
right={0}
|
|
131
|
-
bottom={0}
|
|
132
|
-
alignItems="stretch"
|
|
133
|
-
justifyContent="stretch"
|
|
134
|
-
sx={{ overflowY: scrollable ? 'auto' : 'hidden' }}
|
|
135
|
-
>
|
|
136
|
-
<TypedDappComponent name={name} />
|
|
137
|
-
</FlexCol>
|
|
138
|
-
<DappAccessFlexbox context={context} />
|
|
139
|
-
</>
|
|
140
|
-
)
|
|
141
|
-
: null}
|
|
142
|
-
</NodeProvider>
|
|
143
|
-
</XyOsUiContextProvider>
|
|
144
|
-
)}
|
|
145
|
-
</WalletProvider>
|
|
146
|
-
</DappChrome>
|
|
29
|
+
<DappMetaTags active={active} activePath={dappMenuProperties?.activePath} dappName={name} />
|
|
30
|
+
{resolvedErrors.map(error => (
|
|
31
|
+
<Snackbar
|
|
32
|
+
key={error?.message}
|
|
33
|
+
open={!!error}
|
|
34
|
+
message={<ErrorRender error={error} scope="DappWindow" />}
|
|
35
|
+
/>
|
|
36
|
+
))}
|
|
37
|
+
{children}
|
|
147
38
|
</ErrorBoundary>
|
|
148
39
|
</>
|
|
149
40
|
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { NameTransforms } from '@xyo-network/os-runtime'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { Helmet } from 'react-helmet'
|
|
4
|
+
|
|
5
|
+
export interface DappMetaTagsProps {
|
|
6
|
+
active?: boolean
|
|
7
|
+
activePath?: string
|
|
8
|
+
dappName?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const DappMetaTags: React.FC<DappMetaTagsProps> = ({
|
|
12
|
+
active, activePath, dappName,
|
|
13
|
+
}) => {
|
|
14
|
+
return active
|
|
15
|
+
? (
|
|
16
|
+
<Helmet>
|
|
17
|
+
<title>
|
|
18
|
+
{activePath ? `${new NameTransforms(activePath).deSlug()} | ` : ''}
|
|
19
|
+
{' '}
|
|
20
|
+
{dappName}
|
|
21
|
+
{' '}
|
|
22
|
+
dApp
|
|
23
|
+
</title>
|
|
24
|
+
</Helmet>
|
|
25
|
+
)
|
|
26
|
+
: null
|
|
27
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ErrorRender } from '@xylabs/react-error'
|
|
2
|
+
import { FlexCol } from '@xylabs/react-flexbox'
|
|
3
|
+
import { NameTransforms } from '@xyo-network/os-runtime'
|
|
4
|
+
import { NodeProvider } from '@xyo-network/react-node'
|
|
5
|
+
import { WalletProvider } from '@xyo-network/react-wallet'
|
|
6
|
+
import React from 'react'
|
|
7
|
+
|
|
8
|
+
import { XyOsUiContextProvider } from '../../../XyOsUi/index.ts'
|
|
9
|
+
import { DappAccessFlexbox } from '../access-interface/index.ts'
|
|
10
|
+
import { DappBar } from './AppBar.tsx'
|
|
11
|
+
import { DappChrome } from './Chrome.tsx'
|
|
12
|
+
import { useDecomposeDapp } from './hooks/index.ts'
|
|
13
|
+
import { DappLoadingFlexbox } from './LoadingFlexbox.tsx'
|
|
14
|
+
import { DappBottomNavigation, DappMenuDrawer } from './menu/index.ts'
|
|
15
|
+
import type { DappWindowProps } from './types/index.ts'
|
|
16
|
+
|
|
17
|
+
/** A pure component that can render a dapp via props only */
|
|
18
|
+
export const DappRendered: React.FC<DappWindowProps> = ({
|
|
19
|
+
context, dapp, dappMenuProperties, dappState, dappWallet, errors,
|
|
20
|
+
}) => {
|
|
21
|
+
const {
|
|
22
|
+
DappComponent, name, scrollable = true, version,
|
|
23
|
+
} = useDecomposeDapp(dapp)
|
|
24
|
+
|
|
25
|
+
const { active, minimized } = dappState ?? {}
|
|
26
|
+
|
|
27
|
+
const hasErrors = errors && errors.length > 0
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<DappChrome
|
|
31
|
+
/* Keep DappBar outside of the Dapp's Node Provider so it can still see the intentArchivist for close and minimize */
|
|
32
|
+
appBar={(
|
|
33
|
+
<DappBar
|
|
34
|
+
context={context}
|
|
35
|
+
name={name}
|
|
36
|
+
version={version}
|
|
37
|
+
title={dappMenuProperties?.activePath ? new NameTransforms(dappMenuProperties.activePath).deSlug() : ''}
|
|
38
|
+
/>
|
|
39
|
+
)}
|
|
40
|
+
height="100dvh"
|
|
41
|
+
width="100dvw"
|
|
42
|
+
largeScreenMenu={active && (
|
|
43
|
+
<DappMenuDrawer
|
|
44
|
+
context={context}
|
|
45
|
+
name={name}
|
|
46
|
+
version={version}
|
|
47
|
+
{...dappMenuProperties}
|
|
48
|
+
/>
|
|
49
|
+
)}
|
|
50
|
+
smallScreenMenu={active && (
|
|
51
|
+
<DappBottomNavigation
|
|
52
|
+
{...dappMenuProperties}
|
|
53
|
+
sx={{ display: dappMenuProperties?.menuConfig ? 'flex' : 'none' }}
|
|
54
|
+
/>
|
|
55
|
+
)}
|
|
56
|
+
/* Ensure that loading goes away when error occurs */
|
|
57
|
+
splashScreen={hasErrors ? null : <DappLoadingFlexbox minimize={!!minimized} name={name} open={!!active} />}
|
|
58
|
+
>
|
|
59
|
+
{hasErrors
|
|
60
|
+
? (
|
|
61
|
+
<FlexCol padding={2}>
|
|
62
|
+
{errors?.map(error => (
|
|
63
|
+
<ErrorRender key={error?.message} error={error} scope="DappWindow" />
|
|
64
|
+
))}
|
|
65
|
+
</FlexCol>
|
|
66
|
+
)
|
|
67
|
+
: null}
|
|
68
|
+
<WalletProvider rootWallet={dappWallet}>
|
|
69
|
+
{/* Only load the dapp component when the dapp's node exists and dapp is launched */}
|
|
70
|
+
{context === null
|
|
71
|
+
? null
|
|
72
|
+
: (
|
|
73
|
+
<XyOsUiContextProvider value={context}>
|
|
74
|
+
{/* Prevent dapps from reaching out to the os node */}
|
|
75
|
+
<NodeProvider node={context?.root}>
|
|
76
|
+
{active
|
|
77
|
+
? (
|
|
78
|
+
<>
|
|
79
|
+
<FlexCol
|
|
80
|
+
position="absolute"
|
|
81
|
+
top={0}
|
|
82
|
+
left={0}
|
|
83
|
+
right={0}
|
|
84
|
+
bottom={0}
|
|
85
|
+
alignItems="stretch"
|
|
86
|
+
justifyContent="stretch"
|
|
87
|
+
sx={{ overflowY: scrollable ? 'auto' : 'hidden' }}
|
|
88
|
+
>
|
|
89
|
+
<DappComponent name={dapp?.config.name} />
|
|
90
|
+
</FlexCol>
|
|
91
|
+
<DappAccessFlexbox context={context} />
|
|
92
|
+
</>
|
|
93
|
+
)
|
|
94
|
+
: null}
|
|
95
|
+
</NodeProvider>
|
|
96
|
+
</XyOsUiContextProvider>
|
|
97
|
+
)}
|
|
98
|
+
</WalletProvider>
|
|
99
|
+
</DappChrome>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
@@ -2,6 +2,6 @@ export * from './lib/index.ts'
|
|
|
2
2
|
export * from './menu/index.ts'
|
|
3
3
|
export * from './route/index.ts'
|
|
4
4
|
export * from './useDappMenuResourceValues.tsx'
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './useDecomposeDapp.tsx'
|
|
6
6
|
export * from './useSkipLoadingScreen.js'
|
|
7
7
|
export * from './useSyncOsRegisteredAccessInterfaces.js'
|