Add docs for solid-react

main
Jackson Morgan 5 months ago
parent c1fa37da98
commit 108a096c94
  1. 4
      packages/connected-nextgraph/test/integration.test.ts
  2. 4
      packages/react/src/util/TrackingSetProxy.ts
  3. 3
      packages/solid-react/src/SolidAuthContext.ts
  4. 3
      packages/solid-react/src/UnauthenticatedSolidLdoProvider.tsx
  5. 5
      packages/solid-react/src/createBrowserSolidReactMethods.tsx
  6. 3
      packages/solid-react/src/defaultIntance.ts
  7. 8
      packages/solid-react/src/useRootContainerFor.ts

@ -14,9 +14,11 @@ describe("NextGraph Plugin", () => {
const [walletBinary, mnemonic] = await ng.gen_wallet_for_test(
"lL2mo9Jtgz8yWN5PSaEMMftDGXyKJNbv9atQOygmeTcA",
);
console.log("read wallet file");
const wallet = await ng.wallet_read_file(walletBinary);
console.log("open wallet");
const openedWallet = await ng.wallet_open_with_mnemonic_words(
walletBinary,
wallet,
mnemonic,
[1, 2, 1, 2],
);

@ -5,8 +5,8 @@ import type { QuadMatch } from "@ldo/rdf-utils";
/**
* @internal
*
* Creates a tracking proxy, a proxy that tracks the fields that have been
* accessed.
* Creates a tracking proxy for a set, a proxy that tracks the fields that have
* been accessed.
*/
export function createTrackingSetProxy(
proxyContext: TrackingProxyContext,

@ -7,6 +7,9 @@ import { createContext, useContext } from "react";
export type SessionInfo = ISessionInfo;
export type LoginOptions = ILoginInputOptions;
/**
* Functions for authenticating with Solid
*/
export interface SolidAuthFunctions {
login: (issuer: string, loginOptions?: LoginOptions) => Promise<void>;
logout: () => Promise<void>;

@ -13,6 +13,9 @@ const DUMMY_SESSION: SessionInfo = {
expirationDate: undefined,
};
/**
* A provider for interacting with Solid Pods without authenticating
*/
export const UnauthenticatedSolidLdoProvider: FunctionComponent<
PropsWithChildren
> = ({ children }) => {

@ -16,6 +16,11 @@ import { createUseResource } from "@ldo/react";
const PRE_REDIRECT_URI = "PRE_REDIRECT_URI";
/**
* Creates special react methods specific to the Solid
* @param dataset the connectedLdoDataset with a SolidConnectedPlugin
* @returns { BrowserSolidLdoProvider, useSolidAuth, useRootContainerFor }
*/
export function createBrowserSolidReactMethods(
dataset: ConnectedLdoDataset<(SolidConnectedPlugin | ConnectedPlugin)[]>,
) {

@ -2,6 +2,9 @@ import { solidConnectedPlugin } from "@ldo/connected-solid";
import { createLdoReactMethods } from "@ldo/react";
import { createBrowserSolidReactMethods } from "./createBrowserSolidReactMethods";
/**
* Default exports for just Solid methods
*/
export const {
dataset,
useLdo,

@ -8,10 +8,18 @@ import type {
} from "@ldo/connected-solid";
import type { UseResourceOptions, createUseResource } from "@ldo/react";
/**
* @internal
*
* Creates a useRootContainerFor function
*/
export function createUseRootContainerFor(
dataset: ConnectedLdoDataset<SolidConnectedPlugin[]>,
useResource: ReturnType<typeof createUseResource<ConnectedPlugin[]>>,
) {
/**
* Gets the root container for a specific URI
*/
return function useRootContainerFor(
uri?: SolidContainerUri | SolidLeafUri,
options?: UseResourceOptions<"solid">,

Loading…
Cancel
Save