applesauce-react 0.0.0-next-20250723224513 → 0.0.0-next-20250726160247
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/package.json +6 -6
- package/dist/__tests__/exports.test.d.ts +0 -1
- package/dist/__tests__/exports.test.js +0 -22
- package/dist/helpers/__tests__/exports.test.d.ts +0 -1
- package/dist/helpers/__tests__/exports.test.js +0 -12
- package/dist/hooks/__tests__/exports.test.d.ts +0 -1
- package/dist/hooks/__tests__/exports.test.js +0 -23
- package/dist/hooks/use-query-store.d.ts +0 -5
- package/dist/hooks/use-query-store.js +0 -12
- package/dist/hooks/use-store-query.d.ts +0 -7
- package/dist/hooks/use-store-query.js +0 -19
- package/dist/providers/__tests__/exports.test.d.ts +0 -1
- package/dist/providers/__tests__/exports.test.js +0 -20
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-20250726160247",
|
|
4
4
|
"description": "React hooks for applesauce",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"applesauce-accounts": "0.0.0-next-
|
|
53
|
-
"applesauce-actions": "0.0.0-next-
|
|
54
|
-
"applesauce-content": "0.0.0-next-
|
|
55
|
-
"applesauce-core": "0.0.0-next-
|
|
56
|
-
"applesauce-factory": "0.0.0-next-
|
|
52
|
+
"applesauce-accounts": "0.0.0-next-20250726160247",
|
|
53
|
+
"applesauce-actions": "0.0.0-next-20250726160247",
|
|
54
|
+
"applesauce-content": "0.0.0-next-20250726160247",
|
|
55
|
+
"applesauce-core": "0.0.0-next-20250726160247",
|
|
56
|
+
"applesauce-factory": "0.0.0-next-20250726160247",
|
|
57
57
|
"hash-sum": "^2.0.0",
|
|
58
58
|
"nostr-tools": "^2.13",
|
|
59
59
|
"observable-hooks": "^4.2.4",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import * as exports from "../index.js";
|
|
3
|
-
describe("exports", () => {
|
|
4
|
-
it("should export the expected functions", () => {
|
|
5
|
-
expect(Object.keys(exports).sort()).toMatchInlineSnapshot(`
|
|
6
|
-
[
|
|
7
|
-
"AccountsContext",
|
|
8
|
-
"AccountsProvider",
|
|
9
|
-
"ActionsContext",
|
|
10
|
-
"ActionsProvider",
|
|
11
|
-
"EventStoreContext",
|
|
12
|
-
"EventStoreProvider",
|
|
13
|
-
"FactoryContext",
|
|
14
|
-
"FactoryProvider",
|
|
15
|
-
"Helpers",
|
|
16
|
-
"Hooks",
|
|
17
|
-
"QueryStoreContext",
|
|
18
|
-
"QueryStoreProvider",
|
|
19
|
-
]
|
|
20
|
-
`);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import * as exports from "../index.js";
|
|
3
|
-
describe("exports", () => {
|
|
4
|
-
it("should export the expected functions", () => {
|
|
5
|
-
expect(Object.keys(exports).sort()).toMatchInlineSnapshot(`
|
|
6
|
-
[
|
|
7
|
-
"buildLinkRenderer",
|
|
8
|
-
"renderNast",
|
|
9
|
-
]
|
|
10
|
-
`);
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import * as exports from "../index.js";
|
|
3
|
-
describe("exports", () => {
|
|
4
|
-
it("should export the expected functions", () => {
|
|
5
|
-
expect(Object.keys(exports).sort()).toMatchInlineSnapshot(`
|
|
6
|
-
[
|
|
7
|
-
"ComponentMap",
|
|
8
|
-
"useAccountManager",
|
|
9
|
-
"useAccounts",
|
|
10
|
-
"useAction",
|
|
11
|
-
"useActionHub",
|
|
12
|
-
"useActiveAccount",
|
|
13
|
-
"useEventFactory",
|
|
14
|
-
"useEventStore",
|
|
15
|
-
"useObservable",
|
|
16
|
-
"useQueryStore",
|
|
17
|
-
"useRenderNast",
|
|
18
|
-
"useRenderedContent",
|
|
19
|
-
"useStoreQuery",
|
|
20
|
-
]
|
|
21
|
-
`);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useContext } from "react";
|
|
2
|
-
import { QueryStoreContext } from "../providers/store-provider.js";
|
|
3
|
-
/**
|
|
4
|
-
* Gets the QueryStore from a parent {@link QueryStoreProvider} component
|
|
5
|
-
* If there is none it throws an error
|
|
6
|
-
*/
|
|
7
|
-
export function useQueryStore() {
|
|
8
|
-
const store = useContext(QueryStoreContext);
|
|
9
|
-
if (!store)
|
|
10
|
-
throw new Error("Missing QueryStoreProvider");
|
|
11
|
-
return store;
|
|
12
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { QueryConstructor } from "applesauce-core";
|
|
2
|
-
/**
|
|
3
|
-
* Runs and subscribes to a query in the query store
|
|
4
|
-
* @example
|
|
5
|
-
* const events = useStoreQuery(TimelineQuery, [{kinds: [1]}])
|
|
6
|
-
*/
|
|
7
|
-
export declare function useStoreQuery<T extends unknown, Args extends Array<any>>(queryConstructor: QueryConstructor<T, Args>, args?: Args | null): T | undefined;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
import { of } from "rxjs";
|
|
3
|
-
import { useObservableEagerState } from "observable-hooks";
|
|
4
|
-
import { useQueryStore } from "./use-query-store.js";
|
|
5
|
-
/**
|
|
6
|
-
* Runs and subscribes to a query in the query store
|
|
7
|
-
* @example
|
|
8
|
-
* const events = useStoreQuery(TimelineQuery, [{kinds: [1]}])
|
|
9
|
-
*/
|
|
10
|
-
export function useStoreQuery(queryConstructor, args) {
|
|
11
|
-
const store = useQueryStore();
|
|
12
|
-
const observable = useMemo(() => {
|
|
13
|
-
if (args)
|
|
14
|
-
return store.createQuery(queryConstructor, ...args);
|
|
15
|
-
else
|
|
16
|
-
return of(undefined);
|
|
17
|
-
}, [args, store]);
|
|
18
|
-
return useObservableEagerState(observable);
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import * as exports from "../index.js";
|
|
3
|
-
describe("exports", () => {
|
|
4
|
-
it("should export the expected functions", () => {
|
|
5
|
-
expect(Object.keys(exports).sort()).toMatchInlineSnapshot(`
|
|
6
|
-
[
|
|
7
|
-
"AccountsContext",
|
|
8
|
-
"AccountsProvider",
|
|
9
|
-
"ActionsContext",
|
|
10
|
-
"ActionsProvider",
|
|
11
|
-
"EventStoreContext",
|
|
12
|
-
"EventStoreProvider",
|
|
13
|
-
"FactoryContext",
|
|
14
|
-
"FactoryProvider",
|
|
15
|
-
"QueryStoreContext",
|
|
16
|
-
"QueryStoreProvider",
|
|
17
|
-
]
|
|
18
|
-
`);
|
|
19
|
-
});
|
|
20
|
-
});
|