@powerhousedao/reactor-browser 5.1.0 → 5.2.0-staging.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/README.md +282 -482
- package/dist/src/actions/dispatch.d.ts +16 -2
- package/dist/src/actions/dispatch.d.ts.map +1 -1
- package/dist/src/actions/dispatch.js +17 -2
- package/dist/src/actions/dispatch.js.map +1 -1
- package/dist/src/actions/document.d.ts +7 -4
- package/dist/src/actions/document.d.ts.map +1 -1
- package/dist/src/actions/document.js +297 -123
- package/dist/src/actions/document.js.map +1 -1
- package/dist/src/actions/drive.d.ts +2 -2
- package/dist/src/actions/drive.d.ts.map +1 -1
- package/dist/src/actions/drive.js +153 -50
- package/dist/src/actions/drive.js.map +1 -1
- package/dist/src/actions/queue.d.ts.map +1 -1
- package/dist/src/actions/queue.js +48 -24
- package/dist/src/actions/queue.js.map +1 -1
- package/dist/src/actions/sign.js +1 -1
- package/dist/src/actions/sign.js.map +1 -1
- package/dist/src/hooks/add-ph-event-handlers.d.ts.map +1 -1
- package/dist/src/hooks/add-ph-event-handlers.js +9 -2
- package/dist/src/hooks/add-ph-event-handlers.js.map +1 -1
- package/dist/src/hooks/config/connect.d.ts +2 -2
- package/dist/src/hooks/connect.d.ts +1 -1
- package/dist/src/hooks/connect.d.ts.map +1 -1
- package/dist/src/hooks/connect.js +1 -1
- package/dist/src/hooks/connect.js.map +1 -1
- package/dist/src/hooks/crypto.d.ts +7 -1
- package/dist/src/hooks/crypto.d.ts.map +1 -1
- package/dist/src/hooks/crypto.js +7 -1
- package/dist/src/hooks/crypto.js.map +1 -1
- package/dist/src/hooks/dispatch.d.ts +7 -2
- package/dist/src/hooks/dispatch.d.ts.map +1 -1
- package/dist/src/hooks/dispatch.js +13 -3
- package/dist/src/hooks/dispatch.js.map +1 -1
- package/dist/src/hooks/document-by-id.d.ts +1 -1
- package/dist/src/hooks/document-by-id.d.ts.map +1 -1
- package/dist/src/hooks/features.d.ts +5 -0
- package/dist/src/hooks/features.d.ts.map +1 -0
- package/dist/src/hooks/features.js +6 -0
- package/dist/src/hooks/features.js.map +1 -0
- package/dist/src/hooks/index.d.ts +2 -0
- package/dist/src/hooks/index.d.ts.map +1 -1
- package/dist/src/hooks/index.js +2 -0
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/reactor.d.ts +39 -6
- package/dist/src/hooks/reactor.d.ts.map +1 -1
- package/dist/src/hooks/reactor.js +41 -6
- package/dist/src/hooks/reactor.js.map +1 -1
- package/dist/src/hooks/renown.d.ts +3 -2
- package/dist/src/hooks/renown.d.ts.map +1 -1
- package/dist/src/hooks/renown.js.map +1 -1
- package/dist/src/hooks/selected-document.d.ts +1 -1
- package/dist/src/hooks/selected-document.d.ts.map +1 -1
- package/dist/src/hooks/selected-drive.d.ts.map +1 -1
- package/dist/src/hooks/selected-drive.js +3 -3
- package/dist/src/hooks/selected-drive.js.map +1 -1
- package/dist/src/hooks/selected-node.d.ts.map +1 -1
- package/dist/src/hooks/selected-node.js +3 -3
- package/dist/src/hooks/selected-node.js.map +1 -1
- package/dist/src/hooks/use-feature-flags.d.ts +44 -0
- package/dist/src/hooks/use-feature-flags.d.ts.map +1 -0
- package/dist/src/hooks/use-feature-flags.js +65 -0
- package/dist/src/hooks/use-feature-flags.js.map +1 -0
- package/dist/src/hooks/user.d.ts +7 -1
- package/dist/src/hooks/user.d.ts.map +1 -1
- package/dist/src/hooks/user.js +7 -1
- package/dist/src/hooks/user.js.map +1 -1
- package/dist/src/hooks/vetra-packages.js +1 -1
- package/dist/src/hooks/vetra-packages.js.map +1 -1
- package/dist/src/pglite/drop.d.ts +3 -0
- package/dist/src/pglite/drop.d.ts.map +1 -0
- package/dist/src/pglite/drop.js +18 -0
- package/dist/src/pglite/drop.js.map +1 -0
- package/dist/src/pglite/index.d.ts +1 -0
- package/dist/src/pglite/index.d.ts.map +1 -1
- package/dist/src/pglite/index.js +1 -0
- package/dist/src/pglite/index.js.map +1 -1
- package/dist/src/reactor.d.ts +5 -3
- package/dist/src/reactor.d.ts.map +1 -1
- package/dist/src/reactor.js +36 -5
- package/dist/src/reactor.js.map +1 -1
- package/dist/src/renown/constants.d.ts +1 -1
- package/dist/src/renown/constants.d.ts.map +1 -1
- package/dist/src/renown/constants.js +1 -1
- package/dist/src/renown/constants.js.map +1 -1
- package/dist/src/renown/utils.d.ts +2 -2
- package/dist/src/renown/utils.d.ts.map +1 -1
- package/dist/src/renown/utils.js +1 -1
- package/dist/src/renown/utils.js.map +1 -1
- package/dist/src/types/documents.d.ts +1 -1
- package/dist/src/types/documents.d.ts.map +1 -1
- package/dist/src/types/global.d.ts +13 -1
- package/dist/src/types/global.d.ts.map +1 -1
- package/dist/src/types/modals.d.ts +2 -0
- package/dist/src/types/modals.d.ts.map +1 -1
- package/dist/src/utils/drives.d.ts.map +1 -1
- package/dist/src/utils/drives.js +41 -24
- package/dist/src/utils/drives.js.map +1 -1
- package/dist/src/utils/url.d.ts +4 -0
- package/dist/src/utils/url.d.ts.map +1 -1
- package/dist/src/utils/url.js +7 -0
- package/dist/src/utils/url.js.map +1 -1
- package/dist/test/drop.test.d.ts +2 -0
- package/dist/test/drop.test.d.ts.map +1 -0
- package/dist/test/drop.test.js +88 -0
- package/dist/test/drop.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -1,692 +1,492 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Reactor Browser Hooks API Documentation
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This document contains all documentation comments for the hooks exported from `packages/reactor-browser/src/hooks/index.ts`.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Table of Contents
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- [Allowed Document Model Modules](#allowed-document-model-modules)
|
|
8
|
+
- [Child Nodes](#child-nodes)
|
|
9
|
+
- [Config: Editor](#config-editor)
|
|
10
|
+
- [Config: Set Config by Object](#config-set-config-by-object)
|
|
11
|
+
- [Config: Use Value by Key](#config-use-value-by-key)
|
|
12
|
+
- [Document by ID](#document-by-id)
|
|
13
|
+
- [Document Cache](#document-cache)
|
|
14
|
+
- [Document of Type](#document-of-type)
|
|
15
|
+
- [Document Types](#document-types)
|
|
16
|
+
- [Drives](#drives)
|
|
17
|
+
- [Items in Selected Drive](#items-in-selected-drive)
|
|
18
|
+
- [Items in Selected Folder](#items-in-selected-folder)
|
|
19
|
+
- [Modals](#modals)
|
|
20
|
+
- [Node by ID](#node-by-id)
|
|
21
|
+
- [Node Path](#node-path)
|
|
22
|
+
- [Revision History](#revision-history)
|
|
23
|
+
- [Selected Document](#selected-document)
|
|
24
|
+
- [Selected Drive](#selected-drive)
|
|
25
|
+
- [Selected Folder](#selected-folder)
|
|
26
|
+
- [Selected Node](#selected-node)
|
|
27
|
+
- [Selected Timeline Item](#selected-timeline-item)
|
|
28
|
+
- [Supported Document Types](#supported-document-types)
|
|
29
|
+
- [Timeline Revision](#timeline-revision)
|
|
30
|
+
- [Use Get Switchboard Link](#use-get-switchboard-link)
|
|
31
|
+
- [Vetra Packages](#vetra-packages)
|
|
8
32
|
|
|
9
|
-
|
|
33
|
+
---
|
|
10
34
|
|
|
11
|
-
|
|
35
|
+
## Allowed Document Model Modules
|
|
12
36
|
|
|
13
|
-
|
|
37
|
+
### `useAllowedDocumentModelModules`
|
|
14
38
|
|
|
15
|
-
|
|
16
|
-
- selected folder
|
|
17
|
-
- selected document
|
|
39
|
+
No documentation available.
|
|
18
40
|
|
|
19
|
-
|
|
41
|
+
---
|
|
20
42
|
|
|
21
|
-
|
|
22
|
-
`useSelectedFolder`
|
|
23
|
-
`useSelectedDocument`
|
|
43
|
+
## Child Nodes
|
|
24
44
|
|
|
25
|
-
|
|
45
|
+
### `useNodesInSelectedDriveOrFolder`
|
|
26
46
|
|
|
27
|
-
|
|
47
|
+
Returns the child nodes for the selected drive or folder.
|
|
28
48
|
|
|
29
|
-
|
|
49
|
+
---
|
|
30
50
|
|
|
31
|
-
|
|
51
|
+
## Document by ID
|
|
32
52
|
|
|
33
|
-
|
|
53
|
+
### `useDocumentById`
|
|
34
54
|
|
|
35
|
-
|
|
55
|
+
Returns a document by id.
|
|
36
56
|
|
|
37
|
-
|
|
38
|
-
function useReactor(): Reactor | undefined;
|
|
39
|
-
```
|
|
57
|
+
### `useDocumentsByIds`
|
|
40
58
|
|
|
41
|
-
Returns
|
|
59
|
+
Returns documents by ids.
|
|
42
60
|
|
|
43
|
-
|
|
61
|
+
---
|
|
44
62
|
|
|
45
|
-
|
|
46
|
-
import { useReactor } from '@powerhousedao/state`
|
|
63
|
+
## Document Cache
|
|
47
64
|
|
|
48
|
-
|
|
49
|
-
const reactor = useReactor();
|
|
50
|
-
}
|
|
51
|
-
```
|
|
65
|
+
### `useDocumentCache`
|
|
52
66
|
|
|
53
|
-
|
|
67
|
+
Returns all documents in the reactor.
|
|
54
68
|
|
|
55
|
-
|
|
69
|
+
### `setDocumentCache`
|
|
56
70
|
|
|
57
|
-
|
|
58
|
-
function useDrives(): DocumentDriveDocument[] | undefined;
|
|
59
|
-
```
|
|
71
|
+
Sets all of the documents in the reactor.
|
|
60
72
|
|
|
61
|
-
|
|
73
|
+
### `addDocumentCacheEventHandler`
|
|
62
74
|
|
|
63
|
-
|
|
75
|
+
Adds an event handler for all of the documents in the reactor.
|
|
64
76
|
|
|
65
|
-
|
|
66
|
-
import { useDrives } from "@powerhousedao/state";
|
|
77
|
+
### `useGetDocument`
|
|
67
78
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
```
|
|
79
|
+
Retrieves a document from the reactor and subscribes to changes using React Suspense.
|
|
80
|
+
This hook will suspend rendering while the document is loading.
|
|
72
81
|
|
|
73
|
-
|
|
82
|
+
**Parameters:**
|
|
83
|
+
- `id` - The document ID to retrieve, or null/undefined to skip retrieval
|
|
74
84
|
|
|
75
|
-
|
|
76
|
-
function useDriveById(
|
|
77
|
-
id: string | null | undefined,
|
|
78
|
-
): DocumentDriveDocument | undefined;
|
|
79
|
-
```
|
|
85
|
+
**Returns:** The document if found, or undefined if id is null/undefined
|
|
80
86
|
|
|
81
|
-
|
|
87
|
+
### `useGetDocuments`
|
|
82
88
|
|
|
83
|
-
|
|
89
|
+
Retrieves multiple documents from the reactor using React Suspense.
|
|
90
|
+
This hook will suspend rendering while any of the documents are loading.
|
|
84
91
|
|
|
85
|
-
|
|
86
|
-
|
|
92
|
+
**Parameters:**
|
|
93
|
+
- `ids` - Array of document IDs to retrieve, or null/undefined to skip retrieval
|
|
87
94
|
|
|
88
|
-
|
|
89
|
-
const driveById = useDriveById();
|
|
90
|
-
}
|
|
91
|
-
```
|
|
95
|
+
**Returns:** An array of documents if found, or undefined if ids is null/undefined
|
|
92
96
|
|
|
93
|
-
|
|
97
|
+
### `useGetDocumentAsync`
|
|
94
98
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
```
|
|
99
|
+
Retrieves a document from the reactor without suspending rendering.
|
|
100
|
+
Returns the current state of the document loading operation.
|
|
98
101
|
|
|
99
|
-
|
|
102
|
+
**Parameters:**
|
|
103
|
+
- `id` - The document ID to retrieve, or null/undefined to skip retrieval
|
|
100
104
|
|
|
101
|
-
|
|
105
|
+
**Returns:** An object containing:
|
|
106
|
+
- `status`: "initial" | "pending" | "success" | "error"
|
|
107
|
+
- `data`: The document if successfully loaded
|
|
108
|
+
- `isPending`: Boolean indicating if the document is currently loading
|
|
109
|
+
- `error`: Any error that occurred during loading
|
|
110
|
+
- `reload`: Function to force reload the document from cache
|
|
102
111
|
|
|
103
|
-
|
|
104
|
-
import { useSelectedDrive } from "@powerhousedao/state";
|
|
112
|
+
---
|
|
105
113
|
|
|
106
|
-
|
|
107
|
-
const selectedDrive = useSelectedDrive();
|
|
108
|
-
}
|
|
109
|
-
```
|
|
114
|
+
## Document of Type
|
|
110
115
|
|
|
111
|
-
|
|
116
|
+
### `useDocumentOfType`
|
|
112
117
|
|
|
113
|
-
|
|
118
|
+
Returns a document of a specific type, throws an error if the found document has a different type.
|
|
114
119
|
|
|
115
|
-
|
|
116
|
-
/** Returns the remote URL for a drive. */
|
|
117
|
-
function useDriveRemoteUrl(
|
|
118
|
-
driveId: string | null | undefined,
|
|
119
|
-
): string | undefined;
|
|
120
|
+
---
|
|
120
121
|
|
|
121
|
-
|
|
122
|
-
function useDrivePullResponderTrigger(
|
|
123
|
-
driveId: string | null | undefined,
|
|
124
|
-
): Trigger | undefined;
|
|
122
|
+
## Document Types
|
|
125
123
|
|
|
126
|
-
|
|
127
|
-
function useDrivePullResponderUrl(
|
|
128
|
-
driveId: string | null | undefined,
|
|
129
|
-
): string | undefined;
|
|
124
|
+
### `useDocumentTypes`
|
|
130
125
|
|
|
131
|
-
|
|
132
|
-
function useDriveIsRemote(driveId: string | null | undefined): boolean;
|
|
126
|
+
Returns the document types a drive editor supports.
|
|
133
127
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
driveId: string | null | undefined,
|
|
137
|
-
): SharingType | undefined;
|
|
128
|
+
If present, uses the `allowedDocumentTypes` config value.
|
|
129
|
+
Otherwise, uses the supported document types from the reactor.
|
|
138
130
|
|
|
139
|
-
|
|
140
|
-
function useDriveAvailableOffline(driveId: string | null | undefined): boolean;
|
|
141
|
-
```
|
|
131
|
+
---
|
|
142
132
|
|
|
143
|
-
|
|
133
|
+
## Drives
|
|
144
134
|
|
|
145
|
-
|
|
146
|
-
import {
|
|
147
|
-
useDriveRemoteUrl,
|
|
148
|
-
useDrivePullResponderTrigger,
|
|
149
|
-
useDrivePullResponderUrl,
|
|
150
|
-
useDriveIsRemote,
|
|
151
|
-
useDriveSharingType,
|
|
152
|
-
useDriveAvailableOffline,
|
|
153
|
-
} from "@powerhousedao/state";
|
|
135
|
+
### `useDrives`
|
|
154
136
|
|
|
155
|
-
|
|
156
|
-
const myDriveId = "some-drive-id";
|
|
157
|
-
const driveRemoteUrl = useDriveRemoteUrl(myDriveId);
|
|
158
|
-
const drivePullResponderTrigger = useDrivePullResponderTrigger(myDriveId);
|
|
159
|
-
const drivePullResponderUrl = useDrivePullResponderUrl(myDriveId);
|
|
160
|
-
const driveIsRemote = useDriveIsRemote(myDriveId);
|
|
161
|
-
const driveSharingType = useDriveSharingType(myDriveId);
|
|
162
|
-
const driveAvailableOffline = useDriveAvailableOffline(myDriveId);
|
|
137
|
+
Returns all of the drives in the reactor.
|
|
163
138
|
|
|
164
|
-
|
|
165
|
-
driveRemoteUrl,
|
|
166
|
-
drivePullResponderTrigger,
|
|
167
|
-
drivePullResponderUrl,
|
|
168
|
-
driveIsRemote,
|
|
169
|
-
driveSharingType,
|
|
170
|
-
driveAvailableOffline,
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
```
|
|
139
|
+
### `setDrives`
|
|
174
140
|
|
|
175
|
-
|
|
141
|
+
Sets the drives in the reactor.
|
|
176
142
|
|
|
177
|
-
|
|
143
|
+
### `addDrivesEventHandler`
|
|
178
144
|
|
|
179
|
-
|
|
180
|
-
function useDocumentById(id: string | null | undefined): PHDocument | undefined;
|
|
181
|
-
```
|
|
145
|
+
Adds an event handler for the drives.
|
|
182
146
|
|
|
183
|
-
|
|
147
|
+
---
|
|
184
148
|
|
|
185
|
-
|
|
149
|
+
## Items in Selected Drive
|
|
186
150
|
|
|
187
|
-
|
|
188
|
-
import { useDocumentById } from "@powerhousedao/state";
|
|
151
|
+
### `useNodesInSelectedDrive`
|
|
189
152
|
|
|
190
|
-
|
|
191
|
-
const myDocumentId = "some-document-id";
|
|
192
|
-
const [document, dispatch] = useDocumentById(myDocumentId);
|
|
193
|
-
}
|
|
194
|
-
```
|
|
153
|
+
Returns the nodes in the selected drive.
|
|
195
154
|
|
|
196
|
-
|
|
155
|
+
### `useFileNodesInSelectedDrive`
|
|
197
156
|
|
|
198
|
-
|
|
199
|
-
function useGetDocument(id: string | null | undefined): PHDocument | undefined;
|
|
200
|
-
```
|
|
157
|
+
Returns the file nodes in the selected drive.
|
|
201
158
|
|
|
202
|
-
|
|
159
|
+
### `useFolderNodesInSelectedDrive`
|
|
203
160
|
|
|
204
|
-
|
|
161
|
+
Returns the folder nodes in the selected drive.
|
|
205
162
|
|
|
206
|
-
|
|
207
|
-
import { useGetDocument } from "@powerhousedao/state";
|
|
163
|
+
### `useDocumentsInSelectedDrive`
|
|
208
164
|
|
|
209
|
-
|
|
210
|
-
const documentId = "some-document-id";
|
|
211
|
-
const document = useGetDocument(documentId);
|
|
212
|
-
}
|
|
213
|
-
```
|
|
165
|
+
Returns the documents in the selected drive.
|
|
214
166
|
|
|
215
|
-
|
|
167
|
+
### `useDocumentTypesInSelectedDrive`
|
|
216
168
|
|
|
217
|
-
|
|
218
|
-
function useGetDocuments(
|
|
219
|
-
ids: string[] | null | undefined,
|
|
220
|
-
): PHDocument[] | undefined;
|
|
221
|
-
```
|
|
169
|
+
Returns the document types supported by the selected drive, as defined by the document model documents present in the drive.
|
|
222
170
|
|
|
223
|
-
|
|
171
|
+
---
|
|
224
172
|
|
|
225
|
-
|
|
173
|
+
## Items in Selected Folder
|
|
226
174
|
|
|
227
|
-
|
|
228
|
-
import { useGetDocuments } from "@powerhousedao/state";
|
|
175
|
+
### `useNodesInSelectedFolder`
|
|
229
176
|
|
|
230
|
-
|
|
231
|
-
const documentIds = ["doc-id-1", "doc-id-2", "doc-id-3"];
|
|
232
|
-
const documents = useGetDocuments(documentIds);
|
|
233
|
-
}
|
|
234
|
-
```
|
|
177
|
+
Returns the nodes in the selected folder.
|
|
235
178
|
|
|
236
|
-
|
|
179
|
+
### `useFileNodesInSelectedFolder`
|
|
237
180
|
|
|
238
|
-
|
|
239
|
-
function useGetDocumentAsync(id: string | null | undefined): {
|
|
240
|
-
status: "initial" | "pending" | "success" | "error";
|
|
241
|
-
data: PHDocument | undefined;
|
|
242
|
-
isPending: boolean;
|
|
243
|
-
error: unknown;
|
|
244
|
-
reload: (() => void) | undefined;
|
|
245
|
-
};
|
|
246
|
-
```
|
|
181
|
+
Returns the file nodes in the selected folder.
|
|
247
182
|
|
|
248
|
-
|
|
183
|
+
### `useFolderNodesInSelectedFolder`
|
|
249
184
|
|
|
250
|
-
|
|
185
|
+
Returns the folder nodes in the selected folder.
|
|
251
186
|
|
|
252
|
-
|
|
253
|
-
import { useGetDocumentAsync } from "@powerhousedao/state";
|
|
187
|
+
### `useDocumentsInSelectedFolder`
|
|
254
188
|
|
|
255
|
-
|
|
256
|
-
const documentId = "some-document-id";
|
|
257
|
-
const { status, data, isPending, error, reload } =
|
|
258
|
-
useGetDocumentAsync(documentId);
|
|
189
|
+
Returns the documents in the selected folder.
|
|
259
190
|
|
|
260
|
-
|
|
261
|
-
return <div>Loading...</div>;
|
|
262
|
-
}
|
|
191
|
+
---
|
|
263
192
|
|
|
264
|
-
|
|
265
|
-
return <div>Error: {error.message}</div>;
|
|
266
|
-
}
|
|
193
|
+
## Modals
|
|
267
194
|
|
|
268
|
-
|
|
269
|
-
return <div>Document: {data.name}</div>;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
```
|
|
195
|
+
### `usePHModal`
|
|
273
196
|
|
|
274
|
-
|
|
197
|
+
Returns the current modal.
|
|
275
198
|
|
|
276
|
-
|
|
277
|
-
function useDocumentsInSelectedDrive(): PHDocument[] | undefined;
|
|
278
|
-
```
|
|
199
|
+
### `setPHModal`
|
|
279
200
|
|
|
280
|
-
|
|
201
|
+
Sets the current modal.
|
|
281
202
|
|
|
282
|
-
|
|
203
|
+
### `addModalEventHandler`
|
|
283
204
|
|
|
284
|
-
|
|
285
|
-
import { useDocumentsInSelectedDrive } from "@powerhousedao/state";
|
|
205
|
+
Adds an event handler for the modal.
|
|
286
206
|
|
|
287
|
-
|
|
288
|
-
const selectedDriveDocuments = useDocumentsInSelectedDrive();
|
|
289
|
-
}
|
|
290
|
-
```
|
|
207
|
+
### `showPHModal`
|
|
291
208
|
|
|
292
|
-
|
|
209
|
+
Shows a modal.
|
|
293
210
|
|
|
294
|
-
|
|
295
|
-
function useSelectedDocument(): PHDocument | undefined;
|
|
296
|
-
```
|
|
211
|
+
### `closePHModal`
|
|
297
212
|
|
|
298
|
-
|
|
213
|
+
Closes the current modal.
|
|
299
214
|
|
|
300
|
-
|
|
215
|
+
### `showCreateDocumentModal`
|
|
301
216
|
|
|
302
|
-
|
|
303
|
-
import { useSelectedDocument } from "@powerhousedao/state";
|
|
217
|
+
Shows the create document modal.
|
|
304
218
|
|
|
305
|
-
|
|
306
|
-
const selectedDocument = useSelectedDocument();
|
|
307
|
-
}
|
|
308
|
-
```
|
|
219
|
+
### `showDeleteNodeModal`
|
|
309
220
|
|
|
310
|
-
|
|
221
|
+
Shows the delete node modal.
|
|
311
222
|
|
|
312
|
-
|
|
223
|
+
---
|
|
313
224
|
|
|
314
|
-
|
|
225
|
+
## Node by ID
|
|
315
226
|
|
|
316
|
-
|
|
227
|
+
### `useNodeById`
|
|
317
228
|
|
|
318
|
-
|
|
229
|
+
Returns a node in the selected drive by id.
|
|
319
230
|
|
|
320
|
-
|
|
321
|
-
type FileNode = {
|
|
322
|
-
documentType: string;
|
|
323
|
-
id: string;
|
|
324
|
-
kind: string;
|
|
325
|
-
name: string;
|
|
326
|
-
parentFolder: string | null | undefined;
|
|
327
|
-
};
|
|
231
|
+
---
|
|
328
232
|
|
|
329
|
-
|
|
330
|
-
id: string;
|
|
331
|
-
kind: string;
|
|
332
|
-
name: string;
|
|
333
|
-
parentFolder: string | null | undefined;
|
|
334
|
-
};
|
|
233
|
+
## Node Path
|
|
335
234
|
|
|
336
|
-
|
|
337
|
-
```
|
|
235
|
+
### `useNodePathById`
|
|
338
236
|
|
|
339
|
-
|
|
237
|
+
Returns the path to a node in the selected drive.
|
|
340
238
|
|
|
341
|
-
|
|
239
|
+
### `useSelectedNodePath`
|
|
342
240
|
|
|
343
|
-
|
|
344
|
-
function useNodes(): Node[] | undefined;
|
|
345
|
-
```
|
|
241
|
+
Returns the path to the currently selected node in the selected drive.
|
|
346
242
|
|
|
347
|
-
|
|
243
|
+
---
|
|
348
244
|
|
|
349
|
-
|
|
245
|
+
## Revision History
|
|
350
246
|
|
|
351
|
-
|
|
352
|
-
import { useNodes } from "@powerhousedao/state";
|
|
247
|
+
### `useRevisionHistoryVisible`
|
|
353
248
|
|
|
354
|
-
|
|
355
|
-
const nodes = useNodes();
|
|
356
|
-
}
|
|
357
|
-
```
|
|
249
|
+
Returns whether revision history is visible.
|
|
358
250
|
|
|
359
|
-
|
|
251
|
+
### `setRevisionHistoryVisible`
|
|
360
252
|
|
|
361
|
-
|
|
362
|
-
function useNodeById(id: string | null | undefined): Node | undefined;
|
|
363
|
-
```
|
|
253
|
+
Sets revision history visibility.
|
|
364
254
|
|
|
365
|
-
|
|
255
|
+
### `addRevisionHistoryVisibleEventHandler`
|
|
366
256
|
|
|
367
|
-
|
|
257
|
+
Adds event handler for revision history visibility.
|
|
368
258
|
|
|
369
|
-
|
|
370
|
-
import { useNodeById } from "@powerhousedao/state";
|
|
259
|
+
### `showRevisionHistory`
|
|
371
260
|
|
|
372
|
-
|
|
373
|
-
const myFolderId = "some-folder-id";
|
|
374
|
-
const myDocumentId = "some-document-id";
|
|
375
|
-
const myFolderNode = useNodeById(myFolderId);
|
|
376
|
-
const myFileNode = useNodeById(myDocumentId);
|
|
377
|
-
}
|
|
378
|
-
```
|
|
261
|
+
Shows the revision history.
|
|
379
262
|
|
|
380
|
-
|
|
263
|
+
### `hideRevisionHistory`
|
|
381
264
|
|
|
382
|
-
|
|
383
|
-
function useSelectedFolder(): FolderNode | undefined;
|
|
384
|
-
```
|
|
265
|
+
Hides the revision history.
|
|
385
266
|
|
|
386
|
-
|
|
267
|
+
---
|
|
387
268
|
|
|
388
|
-
|
|
269
|
+
## Selected Document
|
|
389
270
|
|
|
390
|
-
|
|
391
|
-
import { useSelectedFolder } from "@powerhousedao/state";
|
|
271
|
+
### `useSelectedDocumentId`
|
|
392
272
|
|
|
393
|
-
|
|
394
|
-
const selectedFolder = useSelectedFolder();
|
|
395
|
-
}
|
|
396
|
-
```
|
|
273
|
+
Returns the selected document id.
|
|
397
274
|
|
|
398
|
-
|
|
275
|
+
### `useSelectedDocument`
|
|
399
276
|
|
|
400
|
-
|
|
401
|
-
function useSelectedNodePath(): Node[];
|
|
402
|
-
```
|
|
277
|
+
Returns the selected document.
|
|
403
278
|
|
|
404
|
-
|
|
279
|
+
### `useSelectedDocumentOfType`
|
|
405
280
|
|
|
406
|
-
|
|
281
|
+
Returns the selected document of a specific type, throws an error if the found document has a different type.
|
|
407
282
|
|
|
408
|
-
|
|
409
|
-
import { useSelectedNodePath } from '@powerhousedao/state';
|
|
283
|
+
---
|
|
410
284
|
|
|
411
|
-
|
|
412
|
-
const nodes = useSelectedNodePath();
|
|
285
|
+
## Selected Drive
|
|
413
286
|
|
|
414
|
-
|
|
415
|
-
}
|
|
416
|
-
```
|
|
287
|
+
### `useSelectedDriveId`
|
|
417
288
|
|
|
418
|
-
|
|
289
|
+
Returns the selected drive id.
|
|
419
290
|
|
|
420
|
-
|
|
421
|
-
function useChildNodes(): Node[];
|
|
422
|
-
```
|
|
291
|
+
### `setSelectedDriveId`
|
|
423
292
|
|
|
424
|
-
|
|
293
|
+
Sets the selected drive id.
|
|
294
|
+
|
|
295
|
+
### `addSelectedDriveIdEventHandler`
|
|
296
|
+
|
|
297
|
+
Adds an event handler for the selected drive id.
|
|
298
|
+
|
|
299
|
+
### `useSelectedDrive`
|
|
300
|
+
|
|
301
|
+
Returns the selected drive.
|
|
302
|
+
|
|
303
|
+
### `useSelectedDriveSafe`
|
|
304
|
+
|
|
305
|
+
Returns the selected drive, or undefined if no drive is selected.
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Selected Folder
|
|
310
|
+
|
|
311
|
+
### `useSelectedFolder`
|
|
312
|
+
|
|
313
|
+
Returns the selected folder.
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## Selected Node
|
|
318
|
+
|
|
319
|
+
### `useSelectedNode`
|
|
320
|
+
|
|
321
|
+
Returns the selected node.
|
|
322
|
+
|
|
323
|
+
### `setSelectedNode`
|
|
324
|
+
|
|
325
|
+
Sets the selected node (file or folder).
|
|
425
326
|
|
|
426
|
-
|
|
427
|
-
function useFolderChildNodes(): FolderNode[];
|
|
428
|
-
```
|
|
327
|
+
---
|
|
429
328
|
|
|
430
|
-
|
|
329
|
+
## Selected Timeline Item
|
|
431
330
|
|
|
432
|
-
|
|
433
|
-
function useFileChildNodes(): FileNode[];
|
|
434
|
-
```
|
|
331
|
+
### `useSelectedTimelineItem`
|
|
435
332
|
|
|
436
|
-
Returns the
|
|
333
|
+
Returns the selected timeline item.
|
|
437
334
|
|
|
438
|
-
|
|
335
|
+
### `setSelectedTimelineItem`
|
|
439
336
|
|
|
440
|
-
|
|
441
|
-
import { useChildNodes, useFolderChildNodes, useFileChildNodes } from '@powerhousedao/state';
|
|
337
|
+
Sets the selected timeline item.
|
|
442
338
|
|
|
443
|
-
|
|
444
|
-
const nodes = useChildNodes();
|
|
445
|
-
const fileNodes = useChildFileNodes();
|
|
446
|
-
const folderNodes = useChildFolderNodes();
|
|
339
|
+
### `addSelectedTimelineItemEventHandler`
|
|
447
340
|
|
|
448
|
-
|
|
449
|
-
<div>
|
|
450
|
-
<FilesAndFolders nodes={nodes}>
|
|
451
|
-
<Files fileNodes={fileNodes}>
|
|
452
|
-
<Folders folderNodes={folderNodes}>
|
|
453
|
-
</div>
|
|
454
|
-
)
|
|
455
|
-
}
|
|
456
|
-
```
|
|
341
|
+
Adds event handler for selected timeline item.
|
|
457
342
|
|
|
458
|
-
|
|
343
|
+
---
|
|
459
344
|
|
|
460
|
-
|
|
461
|
-
function useChildNodesForId(id: string | null | undefined): Node[];
|
|
462
|
-
```
|
|
345
|
+
## Supported Document Types
|
|
463
346
|
|
|
464
|
-
|
|
347
|
+
### `useSupportedDocumentTypesInReactor`
|
|
465
348
|
|
|
466
|
-
|
|
467
|
-
function useFolderChildNodesForId(id: string | null | undefined): FolderNode[];
|
|
468
|
-
```
|
|
349
|
+
Returns the supported document types for the reactor (derived from the document model modules).
|
|
469
350
|
|
|
470
|
-
|
|
351
|
+
---
|
|
471
352
|
|
|
472
|
-
|
|
473
|
-
function useFileChildNodesForId(id: string | null | undefined): FileNode[];
|
|
474
|
-
```
|
|
353
|
+
## Timeline Revision
|
|
475
354
|
|
|
476
|
-
|
|
355
|
+
### `useSelectedTimelineRevision`
|
|
477
356
|
|
|
478
|
-
|
|
357
|
+
Returns the selected timeline revision.
|
|
479
358
|
|
|
480
|
-
|
|
481
|
-
import { useChildNodesForId, useFolderChildNodesForId, useFileChildNodesForId } from '@powerhousedao/state';
|
|
359
|
+
### `setSelectedTimelineRevision`
|
|
482
360
|
|
|
483
|
-
|
|
484
|
-
const driveOrFolderId = 'some-drive-or-folder-id';
|
|
485
|
-
const nodes = useChildNodesForId(driveOrFolderId);
|
|
486
|
-
const fileNodes = useFileChildNodesForId(driveOrFolderId);
|
|
487
|
-
const folderNodes = useFolderChildNodesForId(driveOrFolderId);
|
|
361
|
+
Sets the selected timeline revision.
|
|
488
362
|
|
|
489
|
-
|
|
490
|
-
<div>
|
|
491
|
-
<FilesAndFolders nodes={nodes}>
|
|
492
|
-
<Files fileNodes={fileNodes}>
|
|
493
|
-
<Folders folderNodes={folderNodes}>
|
|
494
|
-
</div>
|
|
495
|
-
)
|
|
496
|
-
}
|
|
497
|
-
```
|
|
363
|
+
### `addSelectedTimelineRevisionEventHandler`
|
|
498
364
|
|
|
499
|
-
|
|
365
|
+
Adds an event handler for the selected timeline revision.
|
|
500
366
|
|
|
501
|
-
|
|
502
|
-
function useNodeName(id: string | null | undefined): string | undefined;
|
|
503
|
-
```
|
|
367
|
+
---
|
|
504
368
|
|
|
505
|
-
|
|
369
|
+
## Use Get Switchboard Link
|
|
506
370
|
|
|
507
|
-
|
|
508
|
-
function useNodeKind(id: string | null | undefined): NodeKind | undefined;
|
|
509
|
-
```
|
|
371
|
+
### `useGetSwitchboardLink`
|
|
510
372
|
|
|
511
|
-
|
|
373
|
+
Hook that returns a function to generate a document's switchboard URL.
|
|
374
|
+
Only returns a function for documents in remote drives.
|
|
375
|
+
Returns null for local drives or when the document/drive cannot be determined.
|
|
512
376
|
|
|
513
|
-
|
|
377
|
+
The returned function generates a fresh bearer token and builds the switchboard URL
|
|
378
|
+
with authentication when called.
|
|
514
379
|
|
|
515
|
-
|
|
516
|
-
|
|
380
|
+
**Parameters:**
|
|
381
|
+
- `document` - The document to create a switchboard URL generator for
|
|
517
382
|
|
|
518
|
-
function
|
|
519
|
-
const nodeId = "some-node-id";
|
|
520
|
-
const nodeName = useNodeName(nodeId);
|
|
521
|
-
const nodeKind = useNodeKind(nodeId);
|
|
383
|
+
**Returns:** An async function that returns the switchboard URL, or null if not applicable
|
|
522
384
|
|
|
523
|
-
|
|
524
|
-
return <File name={nodeName} />;
|
|
525
|
-
}
|
|
385
|
+
---
|
|
526
386
|
|
|
527
|
-
|
|
528
|
-
return <Folder name={nodeName} />;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
```
|
|
387
|
+
## Vetra Packages
|
|
532
388
|
|
|
533
|
-
###
|
|
389
|
+
### `useVetraPackages`
|
|
534
390
|
|
|
535
|
-
|
|
391
|
+
Returns all of the Vetra packages loaded by the Connect instance.
|
|
536
392
|
|
|
537
|
-
|
|
393
|
+
### `addVetraPackagesEventHandler`
|
|
538
394
|
|
|
539
|
-
|
|
540
|
-
- editors
|
|
541
|
-
- subgraphs
|
|
542
|
-
- import scripts
|
|
543
|
-
- processors
|
|
395
|
+
Adds the Vetra packages event handler.
|
|
544
396
|
|
|
545
|
-
|
|
397
|
+
### `setVetraPackages`
|
|
546
398
|
|
|
547
|
-
|
|
399
|
+
Sets the Vetra packages for the Connect instance.
|
|
548
400
|
|
|
549
|
-
|
|
550
|
-
function useVetraPackages(): VetraPackage[] | undefined;
|
|
551
|
-
```
|
|
401
|
+
---
|
|
552
402
|
|
|
553
|
-
Returns all of the Vetra packages in your Connect app.
|
|
554
403
|
|
|
555
|
-
|
|
404
|
+
## Config: Editor
|
|
556
405
|
|
|
557
|
-
|
|
558
|
-
import { useVetraPackages } from "@powerhousedao/state";
|
|
406
|
+
### `setIsExternalControlsEnabled`
|
|
559
407
|
|
|
560
|
-
|
|
561
|
-
const vetraPackages = useVetraPackages();
|
|
562
|
-
}
|
|
563
|
-
```
|
|
408
|
+
Sets whether external controls are enabled for a given editor.
|
|
564
409
|
|
|
565
|
-
|
|
410
|
+
### `useIsExternalControlsEnabled`
|
|
566
411
|
|
|
567
|
-
|
|
568
|
-
function useDocumentModelModules(): DocumentModelModule[] | undefined;
|
|
569
|
-
```
|
|
412
|
+
Gets whether external controls are enabled for a given editor.
|
|
570
413
|
|
|
571
|
-
|
|
414
|
+
### `addIsExternalControlsEnabledEventHandler`
|
|
572
415
|
|
|
573
|
-
|
|
416
|
+
Adds an event handler for when the external controls enabled state changes.
|
|
574
417
|
|
|
575
|
-
|
|
576
|
-
import { useDocumentModelModules } from "@powerhousedao/state";
|
|
418
|
+
### `setIsDragAndDropEnabled`
|
|
577
419
|
|
|
578
|
-
|
|
579
|
-
const documentModelModules = useDocumentModelModules();
|
|
580
|
-
}
|
|
581
|
-
```
|
|
420
|
+
Sets whether drag and drop is enabled for a given drive editor.
|
|
582
421
|
|
|
583
|
-
|
|
422
|
+
### `useIsDragAndDropEnabled`
|
|
584
423
|
|
|
585
|
-
|
|
586
|
-
function useDocumentModelModuleById(): DocumentModelModule[] | undefined;
|
|
587
|
-
```
|
|
424
|
+
Gets whether drag and drop is enabled for a given drive editor.
|
|
588
425
|
|
|
589
|
-
|
|
590
|
-
_NOTE_ What we call here an id is really the value in the "document type" field in the document model editor
|
|
591
|
-
_NOTE_ Connect assumes that these document types (ids) are unique. It is your responsibility to enforce this.
|
|
426
|
+
### `addIsDragAndDropEnabledEventHandler`
|
|
592
427
|
|
|
593
|
-
|
|
428
|
+
Adds an event handler for when the drag and drop enabled state changes.
|
|
594
429
|
|
|
595
|
-
|
|
596
|
-
import { useDocumentModelModuleById } from "@powerhousedao/state";
|
|
430
|
+
### `setAllowedDocumentTypes`
|
|
597
431
|
|
|
598
|
-
|
|
599
|
-
const documentType = "my-org/my-document";
|
|
600
|
-
const documentModelModuleById = useDocumentModelModuleById(documentType);
|
|
601
|
-
}
|
|
602
|
-
```
|
|
432
|
+
Sets the allowed document types for a given drive editor.
|
|
603
433
|
|
|
604
|
-
|
|
434
|
+
### `useAllowedDocumentTypes`
|
|
605
435
|
|
|
606
|
-
|
|
607
|
-
function useEditorModules(): EditorModule[] | undefined;
|
|
608
|
-
```
|
|
436
|
+
Defines the document types a drive supports.
|
|
609
437
|
|
|
610
|
-
|
|
438
|
+
Defaults to all of the document types registered in the reactor.
|
|
611
439
|
|
|
612
|
-
|
|
440
|
+
### `addAllowedDocumentTypesEventHandler`
|
|
613
441
|
|
|
614
|
-
|
|
615
|
-
import { useEditorModules } from "@powerhousedao/state";
|
|
442
|
+
Adds an event handler for when the allowed document types for a given drive editor changes.
|
|
616
443
|
|
|
617
|
-
|
|
618
|
-
const editorModules = useEditorModules();
|
|
619
|
-
}
|
|
620
|
-
```
|
|
444
|
+
---
|
|
621
445
|
|
|
622
|
-
|
|
446
|
+
## Config: Set Config by Object
|
|
623
447
|
|
|
624
|
-
|
|
625
|
-
function useDriveEditorModules(): DriveEditorModule[] | undefined;
|
|
626
|
-
```
|
|
448
|
+
### `setPHDriveEditorConfig`
|
|
627
449
|
|
|
628
|
-
|
|
450
|
+
Sets the global drive config.
|
|
629
451
|
|
|
630
|
-
|
|
452
|
+
Pass in a partial object of the global drive config to set.
|
|
631
453
|
|
|
632
|
-
|
|
633
|
-
import { useDriveEditorModules } from "@powerhousedao/state";
|
|
454
|
+
### `setPHDocumentEditorConfig`
|
|
634
455
|
|
|
635
|
-
|
|
636
|
-
const driveEditorModules = useDriveEditorModules();
|
|
637
|
-
}
|
|
638
|
-
```
|
|
456
|
+
Sets the global document config.
|
|
639
457
|
|
|
640
|
-
|
|
458
|
+
Pass in a partial object of the global document config to set.
|
|
641
459
|
|
|
642
|
-
|
|
643
|
-
function useProcessorModules(): ProcessorModule[] | undefined;
|
|
644
|
-
```
|
|
460
|
+
### `useSetPHDriveEditorConfig`
|
|
645
461
|
|
|
646
|
-
|
|
462
|
+
Wrapper hook for setting the global drive editor config.
|
|
647
463
|
|
|
648
|
-
|
|
464
|
+
Automatically sets the global drive editor config when the component mounts.
|
|
649
465
|
|
|
650
|
-
|
|
651
|
-
import { useProcessorModules } from "@powerhousedao/state";
|
|
466
|
+
Pass in a partial object of the global drive editor config to set.
|
|
652
467
|
|
|
653
|
-
|
|
654
|
-
const processorModules = useProcessorModules();
|
|
655
|
-
}
|
|
656
|
-
```
|
|
468
|
+
### `useSetPHDocumentEditorConfig`
|
|
657
469
|
|
|
658
|
-
|
|
470
|
+
Wrapper hook for setting the global document editor config.
|
|
659
471
|
|
|
660
|
-
|
|
661
|
-
function useSubgraphModules(): SubgraphModule[] | undefined;
|
|
662
|
-
```
|
|
472
|
+
Automatically sets the global document editor config when the component mounts.
|
|
663
473
|
|
|
664
|
-
|
|
474
|
+
Pass in a partial object of the global document editor config to set.
|
|
665
475
|
|
|
666
|
-
|
|
476
|
+
---
|
|
667
477
|
|
|
668
|
-
|
|
669
|
-
import { useSubgraphModules } from "@powerhousedao/state";
|
|
478
|
+
## Config: Use Value by Key
|
|
670
479
|
|
|
671
|
-
|
|
672
|
-
const subgraphModules = useSubgraphModules();
|
|
673
|
-
}
|
|
674
|
-
```
|
|
480
|
+
### `usePHDriveEditorConfigByKey`
|
|
675
481
|
|
|
676
|
-
|
|
482
|
+
Gets the value of an item in the global drive config for a given key.
|
|
677
483
|
|
|
678
|
-
|
|
679
|
-
function useImportScriptModules(): ImportScriptModule[] | undefined;
|
|
680
|
-
```
|
|
484
|
+
Strongly typed, inferred from type definition for the key.
|
|
681
485
|
|
|
682
|
-
|
|
486
|
+
### `usePHDocumentEditorConfigByKey`
|
|
683
487
|
|
|
684
|
-
|
|
488
|
+
Gets the value of an item in the global document config for a given key.
|
|
685
489
|
|
|
686
|
-
|
|
687
|
-
import { useImportScriptModules } from "@powerhousedao/state";
|
|
490
|
+
Strongly typed, inferred from type definition for the key.
|
|
688
491
|
|
|
689
|
-
|
|
690
|
-
const importScriptModules = useImportScriptModules();
|
|
691
|
-
}
|
|
692
|
-
```
|
|
492
|
+
---
|