@affectively/aeon-pages-react 0.2.0
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/Link.d.ts +37 -0
- package/dist/components/InstallPrompt.d.ts +59 -0
- package/dist/components/OfflineDiagnostics.d.ts +78 -0
- package/dist/components/PushNotifications.d.ts +70 -0
- package/dist/hooks/useAeonNavigation.d.ts +73 -0
- package/dist/hooks/useConflicts.d.ts +67 -0
- package/dist/hooks/useNetworkState.d.ts +36 -0
- package/dist/hooks/usePilotNavigation.d.ts +86 -0
- package/dist/hooks/useServiceWorker.d.ts +60 -0
- package/dist/hooks.d.ts +87 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +14837 -0
- package/dist/provider.d.ts +91 -0
- package/package.json +39 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AeonPageProvider - Context provider for Aeon Pages
|
|
3
|
+
*
|
|
4
|
+
* Provides:
|
|
5
|
+
* - Real-time sync via Aeon SyncCoordinator
|
|
6
|
+
* - Presence tracking via AgentPresenceManager
|
|
7
|
+
* - Offline support via OfflineOperationQueue
|
|
8
|
+
* - Schema versioning via SchemaVersionManager
|
|
9
|
+
*/
|
|
10
|
+
import { type ReactNode } from 'react';
|
|
11
|
+
export interface PresenceUser {
|
|
12
|
+
userId: string;
|
|
13
|
+
role: 'user' | 'assistant' | 'monitor' | 'admin';
|
|
14
|
+
cursor?: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
};
|
|
18
|
+
editing?: string;
|
|
19
|
+
status: 'online' | 'away' | 'offline';
|
|
20
|
+
lastActivity: string;
|
|
21
|
+
}
|
|
22
|
+
export interface SyncState {
|
|
23
|
+
isOnline: boolean;
|
|
24
|
+
isSyncing: boolean;
|
|
25
|
+
lastSyncAt?: string;
|
|
26
|
+
pendingOperations: number;
|
|
27
|
+
}
|
|
28
|
+
export interface VersionInfo {
|
|
29
|
+
current: string;
|
|
30
|
+
latest: string;
|
|
31
|
+
needsMigration: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface AeonPageContextValue {
|
|
34
|
+
route: string;
|
|
35
|
+
sessionId: string;
|
|
36
|
+
presence: PresenceUser[];
|
|
37
|
+
localUser: PresenceUser | null;
|
|
38
|
+
updateCursor: (position: {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
}) => void;
|
|
42
|
+
updateEditing: (elementPath: string | null) => void;
|
|
43
|
+
sync: SyncState;
|
|
44
|
+
forcSync: () => Promise<void>;
|
|
45
|
+
version: VersionInfo;
|
|
46
|
+
migrate: (toVersion: string) => Promise<void>;
|
|
47
|
+
data: Record<string, unknown>;
|
|
48
|
+
setData: (key: string, value: unknown) => void;
|
|
49
|
+
tree: unknown;
|
|
50
|
+
updateTree: (path: string, value: unknown) => void;
|
|
51
|
+
}
|
|
52
|
+
export interface AeonPageProviderProps {
|
|
53
|
+
route: string;
|
|
54
|
+
children: ReactNode;
|
|
55
|
+
initialData?: Record<string, unknown>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* AeonPageProvider - Wraps a page with Aeon collaborative features
|
|
59
|
+
*/
|
|
60
|
+
export declare function AeonPageProvider({ route, children, initialData }: AeonPageProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
/**
|
|
62
|
+
* useAeonPage - Access Aeon page context
|
|
63
|
+
*/
|
|
64
|
+
export declare function useAeonPage(): AeonPageContextValue;
|
|
65
|
+
/**
|
|
66
|
+
* usePresence - Just the presence data
|
|
67
|
+
*/
|
|
68
|
+
export declare function usePresence(): {
|
|
69
|
+
presence: PresenceUser[];
|
|
70
|
+
localUser: PresenceUser | null;
|
|
71
|
+
updateCursor: (position: {
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
}) => void;
|
|
75
|
+
updateEditing: (elementPath: string | null) => void;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* useAeonSync - Just the sync state
|
|
79
|
+
*/
|
|
80
|
+
export declare function useAeonSync(): {
|
|
81
|
+
forceSync: () => Promise<void>;
|
|
82
|
+
isOnline: boolean;
|
|
83
|
+
isSyncing: boolean;
|
|
84
|
+
lastSyncAt?: string;
|
|
85
|
+
pendingOperations: number;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* useAeonData - Just the data store
|
|
89
|
+
*/
|
|
90
|
+
export declare function useAeonData<T = unknown>(key: string): [T | undefined, (value: T) => void];
|
|
91
|
+
export default AeonPageProvider;
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@affectively/aeon-pages-react",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "React bindings for @affectively/aeon-pages",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "bun build ./src/index.ts --outdir ./dist --target browser && tsc --declaration --emitDeclarationOnly",
|
|
16
|
+
"dev": "bun --watch ./src/index.ts",
|
|
17
|
+
"test": "bun test",
|
|
18
|
+
"prepublishOnly": "bun run build"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@affectively/aeon-pages-runtime": "^0.3.0"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"react": ">=18.0.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"typescript": "^5.7.0",
|
|
32
|
+
"@types/react": "^18.0.0"
|
|
33
|
+
},
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/affectively/aeon-pages"
|
|
38
|
+
}
|
|
39
|
+
}
|