@xnetjs/react 0.0.2
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/LICENSE +21 -0
- package/README.md +327 -0
- package/dist/chunk-CWHCGYDW.js +2238 -0
- package/dist/index.d.ts +2782 -0
- package/dist/index.js +4798 -0
- package/dist/instrumentation-Cn94kn8-.d.ts +42 -0
- package/dist/internal.d.ts +31 -0
- package/dist/internal.js +10 -0
- package/package.json +61 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as Y from 'yjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Query tracker interface (implemented by @xnetjs/devtools QueryTracker)
|
|
6
|
+
*/
|
|
7
|
+
interface QueryTrackerLike {
|
|
8
|
+
register(id: string, meta: {
|
|
9
|
+
type: 'useQuery' | 'useMutate' | 'useNode';
|
|
10
|
+
schemaId: string;
|
|
11
|
+
mode: 'list' | 'single' | 'filtered' | 'document';
|
|
12
|
+
filter?: Record<string, unknown>;
|
|
13
|
+
nodeId?: string;
|
|
14
|
+
callerInfo?: string;
|
|
15
|
+
}): void;
|
|
16
|
+
recordUpdate(id: string, resultCount: number, renderTime: number): void;
|
|
17
|
+
recordError(id: string, error: string): void;
|
|
18
|
+
unregister(id: string): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Y.Doc registry interface (implemented by XNetDevToolsProvider)
|
|
22
|
+
*/
|
|
23
|
+
interface YDocRegistryLike {
|
|
24
|
+
register(docId: string, doc: Y.Doc): void;
|
|
25
|
+
unregister(docId: string): void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Instrumentation context value
|
|
29
|
+
*/
|
|
30
|
+
interface InstrumentationContextValue {
|
|
31
|
+
/** Register/unregister Y.Docs for inspection */
|
|
32
|
+
yDocRegistry: YDocRegistryLike;
|
|
33
|
+
/** Track query lifecycle (subscribe, result, unsubscribe) */
|
|
34
|
+
queryTracker: QueryTrackerLike;
|
|
35
|
+
}
|
|
36
|
+
declare const InstrumentationContext: react.Context<InstrumentationContextValue | null>;
|
|
37
|
+
/**
|
|
38
|
+
* Hook to access instrumentation context (null if no devtools provider)
|
|
39
|
+
*/
|
|
40
|
+
declare function useInstrumentation(): InstrumentationContextValue | null;
|
|
41
|
+
|
|
42
|
+
export { InstrumentationContext as I, type QueryTrackerLike as Q, type YDocRegistryLike as Y, type InstrumentationContextValue as a, useInstrumentation as u };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { NodeStore } from '@xnetjs/data';
|
|
2
|
+
export { I as InstrumentationContext, a as InstrumentationContextValue, Q as QueryTrackerLike, Y as YDocRegistryLike, u as useInstrumentation } from './instrumentation-Cn94kn8-.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'yjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* useNodeStore hook - internal access to the NodeStore from XNetProvider context.
|
|
8
|
+
*
|
|
9
|
+
* This is NOT part of the public API. Use useQuery/useMutate/useNode instead.
|
|
10
|
+
* Only @xnetjs/devtools uses this via the @xnetjs/react/internal subpath.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* NodeStore context value
|
|
15
|
+
*/
|
|
16
|
+
interface NodeStoreContextValue {
|
|
17
|
+
/** The NodeStore instance */
|
|
18
|
+
store: NodeStore | null;
|
|
19
|
+
/** Whether the store is initialized and ready */
|
|
20
|
+
isReady: boolean;
|
|
21
|
+
/** Any initialization error */
|
|
22
|
+
error: Error | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Hook to access the NodeStore from XNetProvider context.
|
|
26
|
+
*
|
|
27
|
+
* @internal Not part of the public API.
|
|
28
|
+
*/
|
|
29
|
+
declare function useNodeStore(): NodeStoreContextValue;
|
|
30
|
+
|
|
31
|
+
export { type NodeStoreContextValue, useNodeStore };
|
package/dist/internal.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xnetjs/react",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/crs48/xNet"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./internal": {
|
|
18
|
+
"import": "./dist/internal.js",
|
|
19
|
+
"types": "./dist/internal.d.ts"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public",
|
|
29
|
+
"provenance": true
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"y-protocols": "^1.0.6",
|
|
33
|
+
"yjs": "^13.6.24",
|
|
34
|
+
"@xnetjs/core": "0.0.2",
|
|
35
|
+
"@xnetjs/crypto": "0.0.2",
|
|
36
|
+
"@xnetjs/data": "0.0.2",
|
|
37
|
+
"@xnetjs/data-bridge": "0.0.2",
|
|
38
|
+
"@xnetjs/history": "0.0.2",
|
|
39
|
+
"@xnetjs/identity": "0.0.2",
|
|
40
|
+
"@xnetjs/plugins": "0.0.2"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@testing-library/react": "^16.2.0",
|
|
47
|
+
"@types/react": "^18.2.0",
|
|
48
|
+
"jsdom": "^26.0.0",
|
|
49
|
+
"react": "^18.3.1",
|
|
50
|
+
"react-dom": "^18.3.1",
|
|
51
|
+
"tsup": "^8.0.0",
|
|
52
|
+
"typescript": "^5.4.0",
|
|
53
|
+
"vitest": "^4.0.0"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsup src/index.ts src/internal.ts --format esm --dts --external react",
|
|
57
|
+
"test": "vitest run",
|
|
58
|
+
"typecheck": "tsc --noEmit",
|
|
59
|
+
"clean": "rm -rf dist"
|
|
60
|
+
}
|
|
61
|
+
}
|