applesauce-react 0.0.0-next-20241207164640 → 0.0.0-next-20241210191750
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/README.md +2 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/use-event-factory.d.ts +1 -0
- package/dist/hooks/use-event-factory.js +5 -0
- package/dist/hooks/use-query-store.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/providers/factory-provider.d.ts +7 -0
- package/dist/providers/factory-provider.js +7 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.js +2 -0
- package/dist/providers/query-store-provider.d.ts +7 -0
- package/dist/providers/query-store-provider.js +7 -0
- package/package.json +12 -3
package/README.md
CHANGED
|
@@ -6,7 +6,8 @@ React hooks for applesauce
|
|
|
6
6
|
|
|
7
7
|
```jsx
|
|
8
8
|
import { EventStore, QueryStore, Queries } from "applesauce-core";
|
|
9
|
-
import { QueryStoreProvider
|
|
9
|
+
import { QueryStoreProvider } from "applesauce-react/providers";
|
|
10
|
+
import { useStoreQuery } from "applesauce-react/hooks";
|
|
10
11
|
|
|
11
12
|
const events = new EventStore();
|
|
12
13
|
const store = new QueryStore(events);
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useEventFactory(): import("applesauce-factory").EventFactory | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
|
-
import { QueryStoreContext } from "../provider.js";
|
|
2
|
+
import { QueryStoreContext } from "../providers/query-store-provider.js";
|
|
3
3
|
/**
|
|
4
4
|
* Gets the QueryStore from a parent {@link QueryStoreProvider} component
|
|
5
5
|
* If there is none it throws an error
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EventFactory } from "applesauce-factory";
|
|
2
|
+
import { PropsWithChildren } from "react";
|
|
3
|
+
export declare const FactoryContext: import("react").Context<EventFactory | undefined>;
|
|
4
|
+
/** Provides an EventFactory to the component tree */
|
|
5
|
+
export declare function FactoryProvider({ factory, children }: PropsWithChildren<{
|
|
6
|
+
factory?: EventFactory;
|
|
7
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext } from "react";
|
|
3
|
+
export const FactoryContext = createContext(undefined);
|
|
4
|
+
/** Provides an EventFactory to the component tree */
|
|
5
|
+
export function FactoryProvider({ factory, children }) {
|
|
6
|
+
return _jsx(FactoryContext.Provider, { value: factory, children: children });
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { QueryStore } from "applesauce-core";
|
|
2
|
+
import { PropsWithChildren } from "react";
|
|
3
|
+
export declare const QueryStoreContext: import("react").Context<QueryStore | null>;
|
|
4
|
+
/** Provides a QueryStore to the component tree */
|
|
5
|
+
export declare function QueryStoreProvider({ store, children }: PropsWithChildren<{
|
|
6
|
+
store: QueryStore;
|
|
7
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext } from "react";
|
|
3
|
+
export const QueryStoreContext = createContext(null);
|
|
4
|
+
/** Provides a QueryStore to the component tree */
|
|
5
|
+
export function QueryStoreProvider({ store, children }) {
|
|
6
|
+
return _jsx(QueryStoreContext.Provider, { value: store, children: children });
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "applesauce-react",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20241210191750",
|
|
4
4
|
"description": "React hooks for applesauce",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,14 +27,23 @@
|
|
|
27
27
|
"import": "./dist/hooks/*.js",
|
|
28
28
|
"types": "./dist/hooks/*.d.ts"
|
|
29
29
|
},
|
|
30
|
+
"./providers": {
|
|
31
|
+
"import": "./dist/providers/index.js",
|
|
32
|
+
"types": "./dist/providers/index.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./providers/*": {
|
|
35
|
+
"import": "./dist/providers/*.js",
|
|
36
|
+
"types": "./dist/providers/*.d.ts"
|
|
37
|
+
},
|
|
30
38
|
"./helpers": {
|
|
31
39
|
"import": "./dist/helpers/index.js",
|
|
32
40
|
"types": "./dist/helpers/index.d.ts"
|
|
33
41
|
}
|
|
34
42
|
},
|
|
35
43
|
"dependencies": {
|
|
36
|
-
"applesauce-content": "0.0.0-next-
|
|
37
|
-
"applesauce-core": "0.0.0-next-
|
|
44
|
+
"applesauce-content": "0.0.0-next-20241210191750",
|
|
45
|
+
"applesauce-core": "0.0.0-next-20241210191750",
|
|
46
|
+
"applesauce-factory": "0.0.0-next-20241210191750",
|
|
38
47
|
"nostr-tools": "^2.10.3",
|
|
39
48
|
"react": "^18.3.1",
|
|
40
49
|
"rxjs": "^7.8.1"
|