@powerhousedao/academy 5.0.0-staging.1 → 5.0.0-staging.11

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.
Files changed (104) hide show
  1. package/.vscode/settings.json +1 -1
  2. package/CHANGELOG.md +64 -0
  3. package/README.md +3 -3
  4. package/babel.config.js +1 -1
  5. package/blog/BeyondCommunication-ABlueprintForDevelopment.md +25 -24
  6. package/blog/TheChallengeOfChange.md +21 -21
  7. package/docs/academy/01-GetStarted/00-ExploreDemoPackage.mdx +61 -24
  8. package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +21 -12
  9. package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +24 -19
  10. package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +44 -41
  11. package/docs/academy/01-GetStarted/04-BuildToDoListEditor.md +10 -10
  12. package/docs/academy/01-GetStarted/05-SpecDrivenAI.md +143 -0
  13. package/docs/academy/01-GetStarted/home.mdx +185 -90
  14. package/docs/academy/01-GetStarted/styles.module.css +5 -5
  15. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/01-Prerequisites.md +46 -18
  16. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-StandardDocumentModelWorkflow.md +118 -68
  17. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +75 -33
  18. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/_category_.json +6 -6
  19. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/01-WhatIsADocumentModel.md +30 -21
  20. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/02-SpecifyTheStateSchema.md +41 -37
  21. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md +29 -25
  22. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md +36 -37
  23. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md +128 -109
  24. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +95 -86
  25. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md +7 -9
  26. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/_category_.json +6 -6
  27. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md +65 -47
  28. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/02-ConfiguringDrives.md +77 -62
  29. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/03-BuildingADriveExplorer.md +360 -349
  30. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/00-DocumentToolbar.mdx +16 -10
  31. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/01-OperationHistory.md +10 -7
  32. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/02-RevisionHistoryTimeline.md +26 -11
  33. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/_category_.json +6 -6
  34. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/01-RenownAuthenticationFlow.md +14 -7
  35. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/02-Authorization.md +0 -1
  36. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/_category_.json +5 -5
  37. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/_category_.json +1 -1
  38. package/docs/academy/02-MasteryTrack/04-WorkWithData/01-GraphQLAtPowerhouse.md +45 -33
  39. package/docs/academy/02-MasteryTrack/04-WorkWithData/02-UsingTheAPI.mdx +61 -18
  40. package/docs/academy/02-MasteryTrack/04-WorkWithData/03-UsingSubgraphs.md +50 -54
  41. package/docs/academy/02-MasteryTrack/04-WorkWithData/04-analytics-processor.md +126 -110
  42. package/docs/academy/02-MasteryTrack/04-WorkWithData/05-RelationalDbProcessor.md +75 -45
  43. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/GraphQL References/QueryingADocumentWithGraphQL.md +23 -21
  44. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/best-practices.md +9 -9
  45. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/index.md +11 -23
  46. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/integration.md +25 -9
  47. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/intro.md +10 -10
  48. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/benchmarks.md +1 -1
  49. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/index.md +16 -11
  50. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/memory.md +6 -5
  51. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/schema.md +2 -2
  52. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/utilities.md +7 -5
  53. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/maker.md +32 -58
  54. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/processors.md +1 -1
  55. package/docs/academy/02-MasteryTrack/04-WorkWithData/07-drive-analytics.md +105 -71
  56. package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_01-SetupBuilderEnvironment.md +22 -0
  57. package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_02-CreateNewPowerhouseProject.md +9 -8
  58. package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_03-GenerateAnAnalyticsProcessor.md +28 -32
  59. package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_04-UpdateAnalyticsProcessor.md +25 -26
  60. package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_category_.json +1 -1
  61. package/docs/academy/02-MasteryTrack/04-WorkWithData/_category_.json +7 -7
  62. package/docs/academy/02-MasteryTrack/05-Launch/01-IntroductionToPackages.md +3 -4
  63. package/docs/academy/02-MasteryTrack/05-Launch/02-PublishYourProject.md +69 -45
  64. package/docs/academy/02-MasteryTrack/05-Launch/03-SetupEnvironment.md +70 -40
  65. package/docs/academy/02-MasteryTrack/05-Launch/04-ConfigureEnvironment.md +1 -0
  66. package/docs/academy/02-MasteryTrack/05-Launch/_category_.json +7 -7
  67. package/docs/academy/02-MasteryTrack/_category_.json +6 -6
  68. package/docs/academy/03-ExampleUsecases/Chatroom/02-CreateNewPowerhouseProject.md +5 -3
  69. package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +38 -37
  70. package/docs/academy/03-ExampleUsecases/Chatroom/04-ImplementOperationReducers.md +45 -41
  71. package/docs/academy/03-ExampleUsecases/Chatroom/05-ImplementChatroomEditor.md +14 -14
  72. package/docs/academy/03-ExampleUsecases/Chatroom/06-LaunchALocalReactor.md +6 -6
  73. package/docs/academy/03-ExampleUsecases/Chatroom/_category_.json +1 -1
  74. package/docs/academy/04-APIReferences/00-PowerhouseCLI.md +9 -7
  75. package/docs/academy/04-APIReferences/01-ReactHooks.md +177 -129
  76. package/docs/academy/04-APIReferences/04-RelationalDatabase.md +121 -113
  77. package/docs/academy/04-APIReferences/05-PHDocumentMigrationGuide.md +48 -41
  78. package/docs/academy/04-APIReferences/_category_.json +6 -6
  79. package/docs/academy/05-Architecture/00-PowerhouseArchitecture.md +1 -2
  80. package/docs/academy/05-Architecture/01-WorkingWithTheReactor.md +11 -8
  81. package/docs/academy/05-Architecture/05-DocumentModelTheory/_category_.json +1 -1
  82. package/docs/academy/05-Architecture/_category_.json +6 -6
  83. package/docs/academy/06-ComponentLibrary/00-DocumentEngineering.md +25 -23
  84. package/docs/academy/06-ComponentLibrary/02-CreateCustomScalars.md +105 -93
  85. package/docs/academy/06-ComponentLibrary/03-IntegrateIntoAReactComponent.md +1 -0
  86. package/docs/academy/06-ComponentLibrary/_category_.json +7 -7
  87. package/docs/academy/07-Cookbook.md +267 -34
  88. package/docs/academy/08-Glossary.md +7 -1
  89. package/docs/bookofpowerhouse/01-Overview.md +2 -2
  90. package/docs/bookofpowerhouse/02-GeneralFrameworkAndPhilosophy.md +1 -7
  91. package/docs/bookofpowerhouse/03-PowerhouseSoftwareArchitecture.md +10 -7
  92. package/docs/bookofpowerhouse/04-DevelopmentApproaches.md +10 -4
  93. package/docs/bookofpowerhouse/05-SNOsandANewModelForOSSandPublicGoods.md +23 -30
  94. package/docs/bookofpowerhouse/06-SNOsInActionAndPlatformEconomies.md +0 -7
  95. package/docusaurus.config.ts +64 -66
  96. package/package.json +1 -1
  97. package/scripts/generate-combined-cli-docs.ts +43 -13
  98. package/sidebars.ts +1 -0
  99. package/src/components/HomepageFeatures/index.tsx +171 -78
  100. package/src/components/HomepageFeatures/styles.module.css +1 -2
  101. package/src/css/custom.css +89 -89
  102. package/src/pages/_archive-homepage.tsx +17 -16
  103. package/src/theme/DocCardList/index.tsx +9 -8
  104. package/static.json +6 -6
@@ -1,6 +1,6 @@
1
1
  # React Hooks
2
2
 
3
- On this page we're providing an overview of the available hooks you can make use of as a builder.
3
+ On this page we're providing an overview of the available hooks you can make use of as a builder.
4
4
 
5
5
  <details>
6
6
  <summary>Need a refresher on React Hooks?</summary>
@@ -9,11 +9,13 @@ React Hooks allow you to use various React features directly within your functio
9
9
 
10
10
  **What are Custom Hooks?**
11
11
  A custom hook is a JavaScript function whose name starts with "use" and that calls other Hooks. They are used to:
12
+
12
13
  - Reuse stateful logic between components.
13
14
  - Abstract complex logic into a simpler interface.
14
15
  - Isolate side effects, particularly those managed by `useEffect`.
15
16
 
16
17
  **Key Built-in Hooks Examples:**
18
+
17
19
  - `useState`: Lets a component "remember" information (state).
18
20
  - `useEffect`: Lets a component perform side effects (e.g., data fetching, subscriptions, manually changing the DOM).
19
21
  - `useContext`: Lets a component receive information from distant parent components without explicitly passing props through every level of the component tree.
@@ -22,6 +24,7 @@ A custom hook is a JavaScript function whose name starts with "use" and that cal
22
24
  Hook names must always start with `use` followed by a capital letter (e.g., `useState`, `useOnlineStatus`).
23
25
 
24
26
  **Rules of Hooks:**
27
+
25
28
  1. **Only Call Hooks at the Top Level**: Don't call Hooks inside loops, conditions, or nested functions.
26
29
  2. **Only Call Hooks from React Functions**: Call Hooks from React functional components or from custom Hooks.
27
30
 
@@ -42,46 +45,25 @@ Learn more about the [Drive Editors](/academy/MasteryTrack/BuildingUserExperienc
42
45
 
43
46
  All of the data used by these hooks is ultimately derived from the `Reactor`, which manages the asynchronous eventually consistent state of drives and documents. Learn more about the [Reactor](/academy/Architecture/WorkingWithTheReactor)
44
47
 
45
-
46
- ### Selected drives, folders and documents
47
- In the application, there are certain items that can be set as "selected".
48
-
49
- - selected drive
50
- - selected folder
51
- - selected document
52
-
53
- We provide hooks for getting the selected item for each:
54
-
55
- `useSelectedDrive`
56
- `useSelectedFolder`
57
- `useSelectedDocument`
58
-
59
- Folders and documents are part of a given drive, so they will both be undefined if the selected drive is undefined.
60
-
61
- _Either_ a folder or a document can be selected but not both, so if one is defined then the other will be undefined.
62
-
63
- To set the selected drive, we provide a function `setSelectedDrive` which takes either a `DocumentDriveDocument` or a `DocumentDriveDocument['header']['slug']`.
64
-
65
- To set the selected document/folder, we provide a function `setSelectedNode` which returns a setter function which can be used for _both_ documents and folders. This function takes either a `Node` or a slug which can be the url slug or the node's id.
66
-
67
- ## Hooks
68
-
69
48
  <details>
70
- <summary>Reactor</summary>
49
+ <summary>useReactor</summary>
50
+
71
51
  ```ts
72
- function useReactor(): Reactor | undefined
52
+ function useReactor(): Reactor | undefined;
73
53
  ```
74
54
 
75
- Returns the reactor instance.
55
+ Returns the reactor instance.
76
56
 
77
57
  Usage
58
+
78
59
  ```jsx
79
- import { useReactor } from '@powerhousedao/state`
60
+ import { useReactor } from "@powerhousedao/state";
80
61
 
81
62
  function MyEditorComponent() {
82
63
  const reactor = useReactor();
83
64
  }
84
65
  ```
66
+
85
67
  </details>
86
68
 
87
69
  ### Drives
@@ -90,26 +72,30 @@ function MyEditorComponent() {
90
72
  <summary>useDrives</summary>
91
73
 
92
74
  ```ts
93
- function useDrives(): DocumentDriveDocument[] | undefined
75
+ function useDrives(): DocumentDriveDocument[] | undefined;
94
76
  ```
77
+
95
78
  Returns the drives for a reactor.
96
79
 
97
80
  Usage
98
81
 
99
82
  ```jsx
100
- import { useDrives } from '@powerhousedao/state';
83
+ import { useDrives } from "@powerhousedao/state";
101
84
 
102
85
  function MyEditorComponent() {
103
86
  const drives = useDrives();
104
87
  }
105
88
  ```
89
+
106
90
  </details>
107
91
 
108
92
  <details>
109
93
  <summary>useDriveById</summary>
110
94
 
111
95
  ```ts
112
- function useDriveById(id: string | null | undefined): DocumentDriveDocument | undefined
96
+ function useDriveById(
97
+ id: string | null | undefined,
98
+ ): DocumentDriveDocument | undefined;
113
99
  ```
114
100
 
115
101
  Returns a drive by id.
@@ -117,72 +103,80 @@ Returns a drive by id.
117
103
  Usage
118
104
 
119
105
  ```jsx
120
- import { useDriveById } from '@powerhousedao/state';
106
+ import { useDriveById } from "@powerhousedao/state";
121
107
 
122
108
  function MyEditorComponent() {
123
- const driveById = useDriveById();
109
+ const driveById = useDriveById("some-id");
124
110
  }
125
111
  ```
112
+
126
113
  </details>
127
114
 
128
115
  <details>
129
116
  <summary>useSelectedDrive</summary>
130
117
 
131
118
  ```ts
132
- function useSelectedDrive(): DocumentDriveDocument | undefined
119
+ function useSelectedDrive(): DocumentDriveDocument | undefined;
133
120
  ```
134
121
 
135
- Returns the selected drive. You can use the selected drive with `setSelectedDrive`.
122
+ Returns the selected drive. You can set the selected drive with `setSelectedDrive`.
136
123
 
137
124
  Usage
138
125
 
139
126
  ```jsx
140
- import { useSelectedDrive } from '@powerhousedao/state';
127
+ import { useSelectedDrive } from "@powerhousedao/state";
141
128
 
142
129
  function MyEditorComponent() {
143
130
  const selectedDrive = useSelectedDrive();
144
131
  }
145
132
  ```
133
+
146
134
  </details>
147
135
 
148
136
  <details>
149
- <summary>drive properties convenience hooks</summary>
137
+ <summary>Drive Properties Convenience Hooks</summary>
150
138
 
151
139
  We provide hooks for accessing various properties on the drive object for your convenience. These use the above hooks to get a drive and then return properties in the object.
152
140
 
153
141
  ```ts
154
142
  /** Returns the remote URL for a drive. */
155
- function useDriveRemoteUrl(driveId: string | null | undefined): string | undefined
143
+ function useDriveRemoteUrl(
144
+ driveId: string | null | undefined,
145
+ ): string | undefined;
156
146
 
157
147
  /** Returns the pull responder trigger for a drive. */
158
148
  function useDrivePullResponderTrigger(
159
149
  driveId: string | null | undefined,
160
- ): Trigger | undefined
150
+ ): Trigger | undefined;
161
151
 
162
152
  /** Returns the pull responder URL for a drive. */
163
- function useDrivePullResponderUrl(driveId: string | null | undefined): string | undefined
153
+ function useDrivePullResponderUrl(
154
+ driveId: string | null | undefined,
155
+ ): string | undefined;
164
156
 
165
157
  /** Returns whether a drive is remote. */
166
- function useDriveIsRemote(driveId: string | null | undefined): boolean
158
+ function useDriveIsRemote(driveId: string | null | undefined): boolean;
167
159
 
168
160
  /** Returns the sharing type for a drive. */
169
- function useDriveSharingType(driveId: string | null | undefined): SharingType | undefined
161
+ function useDriveSharingType(
162
+ driveId: string | null | undefined,
163
+ ): SharingType | undefined;
170
164
 
171
- /** Returns whether a drive is available offline. */
172
- function useDriveAvailableOffline(driveId: string | null | undefined): boolean
165
+ /** Returns whether a drive is available offline. */
166
+ function useDriveAvailableOffline(driveId: string | null | undefined): boolean;
173
167
  ```
174
168
 
175
169
  Usage
176
170
 
177
171
  ```jsx
178
- import {
172
+ import {
179
173
  useDriveRemoteUrl,
180
174
  useDrivePullResponderTrigger,
181
175
  useDrivePullResponderUrl,
182
176
  useDriveIsRemote,
183
177
  useDriveSharingType,
184
178
  useDriveAvailableOffline,
185
- } from '@powerhousedao/state';
179
+ } from "@powerhousedao/state";
186
180
 
187
181
  function MyEditorComponent() {
188
182
  const myDriveId = "some-drive-id";
@@ -200,9 +194,10 @@ function MyEditorComponent() {
200
194
  driveIsRemote,
201
195
  driveSharingType,
202
196
  driveAvailableOffline,
203
- })
197
+ });
204
198
  }
205
199
  ```
200
+
206
201
  </details>
207
202
 
208
203
  ### Documents
@@ -211,64 +206,74 @@ function MyEditorComponent() {
211
206
  <summary>useAllDocuments/useSelectedDriveDocuments</summary>
212
207
 
213
208
  ```ts
214
- function useAllDocuments(): PHDocument[] | undefined
209
+ function useAllDocuments(): PHDocument[] | undefined;
215
210
  ```
211
+
216
212
  Returns all of the documents in the reactor.
217
213
 
218
214
  ```ts
219
- function useSelectedDriveDocuments(): PHDocument[] | undefined
215
+ function useSelectedDriveDocuments(): PHDocument[] | undefined;
220
216
  ```
217
+
221
218
  Returns the documents in the reactor for the selected drive.
222
219
 
223
220
  Usage
224
221
 
225
222
  ```jsx
226
- import { useAllDocuments, useSelectedDriveDocuments } from '@powerhousedao/state';
223
+ import {
224
+ useAllDocuments,
225
+ useSelectedDriveDocuments,
226
+ } from "@powerhousedao/state";
227
227
 
228
228
  function MyEditorComponent() {
229
229
  const allDocuments = useAllDocuments();
230
230
  const selectedDriveDocuments = useSelectedDriveDocuments();
231
231
  }
232
232
  ```
233
+
233
234
  </details>
234
235
 
235
236
  <details>
236
237
  <summary>useSelectedDocument</summary>
237
238
 
238
239
  ```ts
239
- function useSelectedDocument(): PHDocument | undefined
240
+ function useSelectedDocument(): PHDocument | undefined;
240
241
  ```
242
+
241
243
  Returns the selected document. You can set the selected document with `setSelectedNode`.
242
244
 
243
245
  Usage
244
246
 
245
247
  ```jsx
246
- import { useSelectedDocument } from '@powerhousedao/state';
248
+ import { useSelectedDocument } from "@powerhousedao/state";
247
249
 
248
250
  function MyEditorComponent() {
249
251
  const selectedDocument = useSelectedDocument();
250
252
  }
251
253
  ```
254
+
252
255
  </details>
253
256
 
254
257
  <details>
255
258
  <summary>useDocumentById</summary>
256
259
 
257
260
  ```ts
258
- function useDocumentById(id: string | null | undefined): PHDocument | undefined
261
+ function useDocumentById(id: string | null | undefined): PHDocument | undefined;
259
262
  ```
263
+
260
264
  Returns a document by id.
261
265
 
262
266
  Usage
263
267
 
264
268
  ```jsx
265
- import { useDocumentById } from '@powerhousedao/state';
269
+ import { useDocumentById } from "@powerhousedao/state";
266
270
 
267
271
  function MyEditorComponent() {
268
- const myDocumentId = 'some-document-id';
272
+ const myDocumentId = "some-document-id";
269
273
  const documentById = useDocumentById(myDocumentId);
270
274
  }
271
275
  ```
276
+
272
277
  </details>
273
278
 
274
279
  ### Nodes
@@ -288,14 +293,14 @@ type FileNode = {
288
293
  kind: string;
289
294
  name: string;
290
295
  parentFolder: string | null | undefined;
291
- }
296
+ };
292
297
 
293
298
  type FolderNode = {
294
299
  id: string;
295
300
  kind: string;
296
301
  name: string;
297
302
  parentFolder: string | null | undefined;
298
- }
303
+ };
299
304
 
300
305
  type Node = FileNode | FolderNode;
301
306
  ```
@@ -306,194 +311,224 @@ type Node = FileNode | FolderNode;
306
311
  Ideally you should not need to handle the list of nodes directly, since we already provide documents and folders. But these hooks are provided just in case.
307
312
 
308
313
  ```ts
309
- function useNodes(): Node[] | undefined
314
+ function useNodes(): Node[] | undefined;
310
315
  ```
316
+
311
317
  Returns the nodes for a drive.
312
318
 
313
319
  Usage
314
320
 
315
321
  ```jsx
316
- import { useNodes} from '@powerhousedao/state';
322
+ import { useNodes } from "@powerhousedao/state";
317
323
 
318
324
  function MyEditorComponent() {
319
325
  const nodes = useNodes();
320
326
  }
321
327
  ```
328
+
322
329
  </details>
323
330
 
324
331
  <details>
325
332
  <summary>useNodeById</summary>
326
333
 
327
334
  ```ts
328
- function useNodeById(id: string | null | undefined): Node | undefined
335
+ function useNodeById(id: string | null | undefined): Node | undefined;
329
336
  ```
337
+
330
338
  Returns a node in the selected drive by id.
331
339
 
332
340
  Usage
333
341
 
334
342
  ```jsx
335
- import { useNodeById } from '@powerhousedao/state';
343
+ import { useNodeById } from "@powerhousedao/state";
336
344
 
337
345
  function MyEditorComponent() {
338
- const myFolderId = 'some-folder-id';
339
- const myDocumentId = 'some-document-id';
346
+ const myFolderId = "some-folder-id";
347
+ const myDocumentId = "some-document-id";
340
348
  const myFolderNode = useNodeById(myFolderId);
341
349
  const myFileNode = useNodeById(myDocumentId);
342
350
  }
343
351
  ```
352
+
344
353
  </details>
345
354
 
346
355
  <details>
347
356
  <summary>useSelectedFolder</summary>
348
357
 
349
358
  ```ts
350
- function useSelectedFolder(): FolderNode | undefined
359
+ function useSelectedFolder(): FolderNode | undefined;
351
360
  ```
361
+
352
362
  Returns the selected folder. You can set the selected folder with `setSelectedNode`
353
363
 
354
364
  Usage
355
365
 
356
366
  ```jsx
357
- import { useSelectedFolder } from '@powerhousedao/state';
367
+ import { useSelectedFolder } from "@powerhousedao/state";
358
368
 
359
369
  function MyEditorComponent() {
360
370
  const selectedFolder = useSelectedFolder();
361
371
  }
362
372
  ```
373
+
363
374
  </details>
364
375
 
365
376
  <details>
366
377
  <summary>useSelectedNodePath</summary>
367
378
 
368
379
  ```ts
369
- function useSelectedNodePath(): Node[]
380
+ function useSelectedNodePath(): Node[];
370
381
  ```
382
+
371
383
  Returns the path to the selected node. Useful for navigational components like breadcrumbs.
372
384
 
373
385
  Usage
374
386
 
375
387
  ```jsx
376
- import { useSelectedNodePath } from '@powerhousedao/state';
388
+ import { useSelectedNodePath } from "@powerhousedao/state";
377
389
 
378
390
  function MyEditorComponent() {
379
391
  const nodes = useSelectedNodePath();
380
392
 
381
- return <Breadcrumbs nodes={nodes}>
393
+ return <Breadcrumbs nodes={nodes} />;
382
394
  }
383
395
  ```
396
+
384
397
  </details>
385
398
 
386
399
  <details>
387
400
  <summary>useChildNodes/useFolderChildNodes/useFileChildNodes</summary>
388
401
 
389
402
  ```ts
390
- function useChildNodes(): Node[]
403
+ function useChildNodes(): Node[];
391
404
  ```
405
+
392
406
  Returns the child nodes for the selected drive or folder.
393
407
 
394
408
  ```ts
395
- function useFolderChildNodes(): FolderNode[]
409
+ function useFolderChildNodes(): FolderNode[];
396
410
  ```
411
+
397
412
  Returns the folder child nodes for the selected drive or folder.
398
413
 
399
414
  ```ts
400
- function useFileChildNodes(): FileNode[]
415
+ function useFileChildNodes(): FileNode[];
401
416
  ```
417
+
402
418
  Returns the file (document) child nodes for the selected drive or folder.
403
419
 
404
420
  Usage
405
421
 
406
422
  ```jsx
407
- import { useChildNodes, useFolderChildNodes, useFileChildNodes } from '@powerhousedao/state';
423
+ import {
424
+ useChildNodes,
425
+ useFolderChildNodes,
426
+ useFileChildNodes,
427
+ } from "@powerhousedao/state";
408
428
 
409
429
  function MyEditorComponent() {
410
430
  const nodes = useChildNodes();
411
- const fileNodes = useChildFileNodes();
412
- const folderNodes = useChildFolderNodes();
431
+ const fileNodes = useFileChildNodes();
432
+ const folderNodes = useFolderChildNodes();
413
433
 
414
434
  return (
415
435
  <div>
416
- <FilesAndFolders nodes={nodes}>
417
- <Files fileNodes={fileNodes}>
418
- <Folders folderNodes={folderNodes}>
436
+ <FilesAndFolders nodes={nodes} />
437
+ <Files fileNodes={fileNodes} />
438
+ <Folders folderNodes={folderNodes} />
419
439
  </div>
420
- )
440
+ );
421
441
  }
422
442
  ```
443
+
423
444
  </details>
424
445
 
425
446
  <details>
426
447
  <summary>useChildNodesForId/useFolderChildNodesForId/useFileChildNodesForId</summary>
427
448
 
428
449
  ```ts
429
- function useChildNodesForId(id: string | null | undefined): Node[]
450
+ function useChildNodesForId(id: string | null | undefined): Node[];
430
451
  ```
452
+
431
453
  Returns the child nodes for a drive or folder by id.
454
+
432
455
  ```ts
433
- function useFolderChildNodesForId(id: string | null | undefined): FolderNode[]
456
+ function useFolderChildNodesForId(id: string | null | undefined): FolderNode[];
434
457
  ```
458
+
435
459
  Returns the folder child nodes for a drive or folder by id.
460
+
436
461
  ```ts
437
- function useFileChildNodesForId(id: string | null | undefined): FileNode[]
462
+ function useFileChildNodesForId(id: string | null | undefined): FileNode[];
438
463
  ```
464
+
439
465
  Returns the file (document) child nodes for a drive or folder by id.
440
466
 
441
467
  Usage
442
468
 
443
469
  ```jsx
444
- import { useChildNodesForId, useFolderChildNodesForId, useFileChildNodesForId } from '@powerhousedao/state';
470
+ import {
471
+ useChildNodesForId,
472
+ useFolderChildNodesForId,
473
+ useFileChildNodesForId,
474
+ } from "@powerhousedao/state";
445
475
 
446
476
  function MyEditorComponent() {
447
- const driveOrFolderId = 'some-drive-or-folder-id';
477
+ const driveOrFolderId = "some-drive-or-folder-id";
448
478
  const nodes = useChildNodesForId(driveOrFolderId);
449
479
  const fileNodes = useFileChildNodesForId(driveOrFolderId);
450
480
  const folderNodes = useFolderChildNodesForId(driveOrFolderId);
451
481
 
452
482
  return (
453
483
  <div>
454
- <FilesAndFolders nodes={nodes}>
455
- <Files fileNodes={fileNodes}>
456
- <Folders folderNodes={folderNodes}>
484
+ <FilesAndFolders nodes={nodes} />
485
+ <Files fileNodes={fileNodes} />
486
+ <Folders folderNodes={folderNodes} />
457
487
  </div>
458
- )
488
+ );
459
489
  }
460
490
  ```
491
+
461
492
  </details>
462
493
 
463
494
  <details>
464
495
  <summary>useNodeName/useNodeKind</summary>
465
496
 
466
497
  ```ts
467
- function useNodeName(id: string | null | undefined): string | undefined
498
+ function useNodeName(id: string | null | undefined): string | undefined;
468
499
  ```
500
+
469
501
  Returns the name of a node.
502
+
470
503
  ```ts
471
- function useNodeKind(id: string | null | undefined): NodeKind | undefined
504
+ function useNodeKind(id: string | null | undefined): NodeKind | undefined;
472
505
  ```
506
+
473
507
  Returns the kind of a node.
474
508
 
475
509
  Usage
476
510
 
477
511
  ```jsx
478
- import { useNodeName, useNodeKind } from '@powerhousedao/state';
512
+ import { useNodeName, useNodeKind } from "@powerhousedao/state";
479
513
 
480
514
  function MyEditorComponent() {
481
- const nodeId = 'some-node-id';
515
+ const nodeId = "some-node-id";
482
516
  const nodeName = useNodeName(nodeId);
483
517
  const nodeKind = useNodeKind(nodeId);
484
518
 
485
- if (nodeKind === 'file') {
519
+ if (nodeKind === "file") {
486
520
  return <File name={nodeName} />;
487
521
  }
488
522
 
489
- if (nodeKind === 'folder') {
523
+ if (nodeKind === "folder") {
490
524
  return <Folder name={nodeName} />;
491
525
  }
492
526
  }
493
527
  ```
528
+
494
529
  </details>
495
530
 
496
- ### Vetra packages and modules
531
+ ### Vetra Packages and Modules
497
532
 
498
533
  Vetra packages hold code which can plug into your Connect application. This includes common default modules like the document model document model editor and document drive document model, as well as the modules from your local project and the various packages you have installed.
499
534
 
@@ -511,7 +546,7 @@ Each Vetra package contains a `modules` field which optionally contains lists of
511
546
  <summary>useVetraPackages</summary>
512
547
 
513
548
  ```ts
514
- function useVetraPackages(): VetraPackage[] | undefined
549
+ function useVetraPackages(): VetraPackage[] | undefined;
515
550
  ```
516
551
 
517
552
  Returns all of the Vetra packages in your Connect app.
@@ -519,19 +554,20 @@ Returns all of the Vetra packages in your Connect app.
519
554
  Usage
520
555
 
521
556
  ```jsx
522
- import { useVetraPackages } from '@powerhousedao/state'
557
+ import { useVetraPackages } from "@powerhousedao/state";
523
558
 
524
559
  function MyEditorComponent() {
525
- const vetraPackages = useVetraPackages()
560
+ const vetraPackages = useVetraPackages();
526
561
  }
527
562
  ```
563
+
528
564
  </details>
529
565
 
530
566
  <details>
531
567
  <summary>useDocumentModelModules</summary>
532
568
 
533
569
  ```ts
534
- function useDocumentModelModules(): DocumentModelModule[] | undefined
570
+ function useDocumentModelModules(): DocumentModelModule[] | undefined;
535
571
  ```
536
572
 
537
573
  Returns the document model modules from your Vetra packages.
@@ -539,42 +575,44 @@ Returns the document model modules from your Vetra packages.
539
575
  Usage
540
576
 
541
577
  ```jsx
542
- import { useDocumentModelModules } from '@powerhousedao/state'
578
+ import { useDocumentModelModules } from "@powerhousedao/state";
543
579
 
544
580
  function MyEditorComponent() {
545
- const documentModelModules = useDocumentModelModules()
581
+ const documentModelModules = useDocumentModelModules();
546
582
  }
547
583
  ```
584
+
548
585
  </details>
549
586
 
550
587
  <details>
551
588
  <summary>useDocumentModelModuleById</summary>
552
589
 
553
590
  ```ts
554
- function useDocumentModelModuleById(): DocumentModelModule[] | undefined
591
+ function useDocumentModelModuleById(): DocumentModelModule[] | undefined;
555
592
  ```
556
593
 
557
594
  Returns the document model for a given id (document type).
558
- *NOTE* What we call here an id is really the value in the "document type" field in the document model editor
559
- *NOTE* Connect assumes that these document types (ids) are unique. It is your responsibility to enforce this.
595
+ _NOTE_ What we call here an id is really the value in the "document type" field in the document model editor
596
+ _NOTE_ Connect assumes that these document types (ids) are unique. It is your responsibility to enforce this.
560
597
 
561
598
  Usage
562
599
 
563
600
  ```jsx
564
- import { useDocumentModelModuleById } from '@powerhousedao/state'
601
+ import { useDocumentModelModuleById } from "@powerhousedao/state";
565
602
 
566
603
  function MyEditorComponent() {
567
- const documentType = 'my-org/my-document';
568
- const documentModelModuleById = useDocumentModelModuleById(documentType)
604
+ const documentType = "my-org/my-document";
605
+ const documentModelModuleById = useDocumentModelModuleById(documentType);
569
606
  }
570
607
  ```
608
+
571
609
  </details>
572
610
 
573
611
  <details>
574
612
  <summary>useEditorModules</summary>
575
613
 
576
614
  ```ts
577
- function useEditorModules(): EditorModule[] | undefined
615
+ function useEditorModules(): EditorModule[] | undefined;
578
616
  ```
579
617
 
580
618
  Returns the editor modules from your Vetra packages.
@@ -582,19 +620,20 @@ Returns the editor modules from your Vetra packages.
582
620
  Usage
583
621
 
584
622
  ```jsx
585
- import { useEditorModules } from '@powerhousedao/state'
623
+ import { useEditorModules } from "@powerhousedao/state";
586
624
 
587
625
  function MyEditorComponent() {
588
- const editorModules = useEditorModules()
626
+ const editorModules = useEditorModules();
589
627
  }
590
628
  ```
629
+
591
630
  </details>
592
631
 
593
632
  <details>
594
633
  <summary>useDriveEditorModules</summary>
595
634
 
596
635
  ```ts
597
- function useDriveEditorModules(): DriveEditorModule[] | undefined
636
+ function useDriveEditorModules(): DriveEditorModule[] | undefined;
598
637
  ```
599
638
 
600
639
  Returns the drive editor modules from your Vetra packages.
@@ -602,19 +641,20 @@ Returns the drive editor modules from your Vetra packages.
602
641
  Usage
603
642
 
604
643
  ```jsx
605
- import { useDriveEditorModules } from '@powerhousedao/state'
644
+ import { useDriveEditorModules } from "@powerhousedao/state";
606
645
 
607
646
  function MyDriveEditorComponent() {
608
- const driveEditorModules = useDriveEditorModules()
647
+ const driveEditorModules = useDriveEditorModules();
609
648
  }
610
649
  ```
650
+
611
651
  </details>
612
652
 
613
653
  <details>
614
654
  <summary>useProcessorModules</summary>
615
655
 
616
656
  ```ts
617
- function useProcessorModules(): ProcessorModule[] | undefined
657
+ function useProcessorModules(): ProcessorModule[] | undefined;
618
658
  ```
619
659
 
620
660
  Returns the processor modules from your Vetra packages.
@@ -622,19 +662,20 @@ Returns the processor modules from your Vetra packages.
622
662
  Usage
623
663
 
624
664
  ```jsx
625
- import { useProcessorModules } from '@powerhousedao/state'
665
+ import { useProcessorModules } from "@powerhousedao/state";
626
666
 
627
667
  function MyProcessorComponent() {
628
- const processorModules = useProcessorModules()
668
+ const processorModules = useProcessorModules();
629
669
  }
630
670
  ```
671
+
631
672
  </details>
632
673
 
633
674
  <details>
634
675
  <summary>useSubgraphModules</summary>
635
676
 
636
677
  ```ts
637
- function useSubgraphModules(): SubgraphModule[] | undefined
678
+ function useSubgraphModules(): SubgraphModule[] | undefined;
638
679
  ```
639
680
 
640
681
  Returns the subgraph modules from your Vetra packages.
@@ -642,19 +683,20 @@ Returns the subgraph modules from your Vetra packages.
642
683
  Usage
643
684
 
644
685
  ```jsx
645
- import { useSubgraphModules } from '@powerhousedao/state'
686
+ import { useSubgraphModules } from "@powerhousedao/state";
646
687
 
647
688
  function MySubgraphComponent() {
648
- const subgraphModules = useSubgraphModules()
689
+ const subgraphModules = useSubgraphModules();
649
690
  }
650
691
  ```
692
+
651
693
  </details>
652
694
 
653
695
  <details>
654
696
  <summary>useImportScriptModules</summary>
655
697
 
656
698
  ```ts
657
- function useImportScriptModules(): ImportScriptModule[] | undefined
699
+ function useImportScriptModules(): ImportScriptModule[] | undefined;
658
700
  ```
659
701
 
660
702
  Returns the import script modules from your Vetra packages.
@@ -662,12 +704,13 @@ Returns the import script modules from your Vetra packages.
662
704
  Usage
663
705
 
664
706
  ```jsx
665
- import { useImportScriptModules } from '@powerhousedao/state'
707
+ import { useImportScriptModules } from "@powerhousedao/state";
666
708
 
667
709
  function MyImportScriptComponent() {
668
- const importScriptModules = useImportScriptModules()
710
+ const importScriptModules = useImportScriptModules();
669
711
  }
670
712
  ```
713
+
671
714
  </details>
672
715
 
673
716
  ## More documentation coming soon!
@@ -676,25 +719,30 @@ Global access to drive state: A top-level, possibly context-based, way to intros
676
719
 
677
720
  Global dispatcher access: A utility or API (probably a hook or service function) where they give a document ID and get back all the relevant dispatch functions — kind of like a command palette for document ops.
678
721
 
679
- ### Core Hooks & Patterns
722
+ ### Core Hooks & Patterns
723
+
680
724
  - useDocumentField
681
725
  - useReadDocumentField
682
726
  - useUpdateDocumentField
683
- - useDocumentDispatch(docId): updateX, delete, ...
727
+ - useDocumentDispatch(docId): updateX, delete, ...
728
+
729
+ ### Global Drive Access
684
730
 
685
- ### Global Drive Access
686
731
  - How to access and manipulate the global document tree
687
732
  - How to inspect children from parent context
688
733
  - Tree traversal utilities (if any)
689
734
 
690
- ### Convenience APIs
735
+ ### Convenience APIs
736
+
691
737
  - Utility functions like getDispatchFunctions(docId)
692
738
  - "Quick Start" to manipulate any document like a pro
693
739
 
694
- ### Working with Context
740
+ ### Working with Context
741
+
695
742
  - DriveContext: what lives there, how to use it
696
743
  - Example: using context to get current doc, sibling docs
697
744
 
698
- ### Best Practices & Patterns
745
+ ### Best Practices & Patterns
746
+
699
747
  - When to use useDocumentField vs getDispatch
700
- - Composing document fields into custom logic
748
+ - Composing document fields into custom logic