@powerhousedao/academy 3.2.0-dev.2 → 3.2.0-dev.4

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 (67) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/docs/academy/01-GetStarted/00-ExploreDemoPackage.mdx +188 -0
  3. package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +10 -12
  4. package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +8 -8
  5. package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +11 -11
  6. package/docs/academy/01-GetStarted/04-BuildToDoListEditor.md +13 -13
  7. package/docs/academy/01-GetStarted/_04-BuildToDoListEditor +12 -12
  8. package/docs/academy/01-GetStarted/home.mdx +50 -51
  9. package/docs/academy/01-GetStarted/images/Connect.png +0 -0
  10. package/docs/academy/01-GetStarted/images/Packagemanager.png +0 -0
  11. package/docs/academy/01-GetStarted/images/TodoDriveApp.png +0 -0
  12. package/docs/academy/01-GetStarted/styles.module.css +7 -14
  13. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-StandardDocumentModelWorkflow.md +25 -24
  14. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +17 -17
  15. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/_category_.json +1 -1
  16. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/01-WhatIsADocumentModel.md +15 -15
  17. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/02-SpecifyTheStateSchema.md +11 -9
  18. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md +15 -15
  19. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md +9 -9
  20. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md +15 -15
  21. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +14 -14
  22. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md +6 -6
  23. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md +31 -32
  24. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/02-ConfiguringDrives.md +7 -9
  25. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/03-BuildingADriveExplorer.md +485 -92
  26. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/{00-DocumentToolbar.md → 00-DocumentToolbar.mdx} +7 -2
  27. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/01-OperationHistory.md +12 -12
  28. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/02-RevisionHistoryTimeline.md +18 -7
  29. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/images/DocumentToolbar.png +0 -0
  30. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/images/revision-history-timeline.png +0 -0
  31. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/08-Authorization/01-RenownAuthenticationFlow.md +22 -11
  32. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/08-Authorization/02-Authorization.md +8 -8
  33. package/docs/academy/02-MasteryTrack/04-WorkWithData/01-ReadingAndWritingThroughTheAPI.mdx +13 -19
  34. package/docs/academy/02-MasteryTrack/04-WorkWithData/02-GraphQLAtPowerhouse.md +3 -3
  35. package/docs/academy/02-MasteryTrack/04-WorkWithData/03-WorkingWithSubgraphs/02-GraphQLAndSubgraphs.mdx +8 -8
  36. package/docs/academy/02-MasteryTrack/04-WorkWithData/03-WorkingWithSubgraphs/03-WorkingWithSubgraphs.md +28 -28
  37. package/docs/academy/02-MasteryTrack/04-WorkWithData/04-analytics-processor.md +4 -4
  38. package/docs/academy/02-MasteryTrack/04-WorkWithData/05-AnalyticsProcessorTutorial/01-SetupBuilderEnvironment.md +14 -14
  39. package/docs/academy/02-MasteryTrack/04-WorkWithData/05-AnalyticsProcessorTutorial/02-CreateNewPowerhouseProject.md +2 -2
  40. package/docs/academy/02-MasteryTrack/04-WorkWithData/05-AnalyticsProcessorTutorial/03-GenerateAnAnalyticsProcessor.md +6 -6
  41. package/docs/academy/02-MasteryTrack/04-WorkWithData/05-AnalyticsProcessorTutorial/04-UpdateAnalyticsProcessor.md +1 -1
  42. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/GraphQL References/QueryingADocumentWithGraphQL.md +2 -2
  43. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/best-practices.md +4 -4
  44. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/index.md +7 -7
  45. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/integration.md +1 -1
  46. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/intro.md +6 -6
  47. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/browser.md +1 -1
  48. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/index.md +5 -5
  49. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/memory.md +1 -1
  50. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/pg.md +2 -2
  51. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/schema.md +1 -1
  52. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/utilities.md +1 -1
  53. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/index.md +1 -1
  54. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/maker.md +12 -12
  55. package/docs/academy/02-MasteryTrack/05-Launch/01-IntroductionToPackages.md +9 -9
  56. package/docs/academy/02-MasteryTrack/05-Launch/02-PublishYourProject.md +8 -8
  57. package/docs/academy/02-MasteryTrack/05-Launch/03-SetupEnvironment.md +35 -35
  58. package/docs/academy/02-MasteryTrack/05-Launch/04-ConfigureEnvironment.md +8 -8
  59. package/docs/academy/02-MasteryTrack/_category_.json +1 -1
  60. package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +5 -5
  61. package/docs/academy/04-APIReferences/01-ReactHooks.md +209 -0
  62. package/docs/academy/07-Cookbook.md +105 -105
  63. package/package.json +1 -1
  64. package/sidebars.ts +9 -10
  65. package/src/css/custom.css +18 -0
  66. package/docs/academy/01-GetStarted/00-ExploreDemoPackage.md +0 -88
  67. package/docs/academy/04-APIReferences/01-ReactHooks +0 -98
@@ -0,0 +1,209 @@
1
+ # React Hooks
2
+
3
+ On this page we're providing an overview of the available hooks you can make use of as a builder.
4
+
5
+ <details>
6
+ <summary>Need a refresher on React Hooks?</summary>
7
+
8
+ React Hooks allow you to use various React features directly within your functional components. You can use built-in Hooks or combine them to create your own custom Hooks.
9
+
10
+ **What are Custom Hooks?**
11
+ A custom hook is a JavaScript function whose name starts with "use" and that calls other Hooks. They are used to:
12
+ - Reuse stateful logic between components.
13
+ - Abstract complex logic into a simpler interface.
14
+ - Isolate side effects, particularly those managed by `useEffect`.
15
+
16
+ **Key Built-in Hooks Examples:**
17
+ - `useState`: Lets a component "remember" information (state).
18
+ - `useEffect`: Lets a component perform side effects (e.g., data fetching, subscriptions, manually changing the DOM).
19
+ - `useContext`: Lets a component receive information from distant parent components without explicitly passing props through every level of the component tree.
20
+
21
+ **Naming Convention:**
22
+ Hook names must always start with `use` followed by a capital letter (e.g., `useState`, `useOnlineStatus`).
23
+
24
+ **Rules of Hooks:**
25
+ 1. **Only Call Hooks at the Top Level**: Don't call Hooks inside loops, conditions, or nested functions.
26
+ 2. **Only Call Hooks from React Functions**: Call Hooks from React functional components or from custom Hooks.
27
+
28
+ It's important to note that a function should only be named and treated as a hook if it actually utilizes one or more built-in React hooks. If a function (even if named `useSomething`) doesn't call any built-in hooks, it behaves like a regular JavaScript function, and making it a "hook" offers no specific React advantages.
29
+
30
+ For more details, see the official documentation and API references of React:
31
+ - [Reusing Logic with Custom Hooks (react.dev)](https://react.dev/learn/reusing-logic-with-custom-hooks)
32
+ - [Rules of Hooks (react.dev)](https://react.dev/reference/rules/rules-of-hooks)
33
+ - [Powerhouse React Hooks API Reference](docs/academy/APIReferences/ReactHooks)
34
+
35
+ </details>
36
+
37
+ The idea is to make the usage of our hooks feel as simple and familiar as using `useState`.
38
+ The Powerhouse team is currently working on a happy path for builders that look like this:
39
+
40
+ ```js
41
+ // in a component that only needs to read a value, you can use
42
+ const invoiceName = useReadDocumentField('myInvoiceDocumentId', 'name') // returns a string which is the `name`
43
+ // and for documents that need to update data as well, you would have
44
+ const updateInvoiceName = useUpdateDocumentField('myInvoiceDocumentId', 'name') // returns a function that takes a new string for the new name and dispatches the update
45
+ // finally, we can combine these into a single hook which works like react's useState hook returning both the value and updater function
46
+ const [invoiceName, updateInvoiceName] = useDocumentField('myInvoiceDocumentId', 'name')
47
+
48
+
49
+ // Read-only value
50
+ const invoiceName = useReadDocumentField('docId', 'name')
51
+
52
+ // Write-only updater
53
+ const updateInvoiceName = useUpdateDocumentField('docId', 'name')
54
+
55
+ // Combined read + write (like useState)
56
+ const [invoiceName, updateInvoiceName] = useDocumentField('docId', 'name')
57
+ ```
58
+
59
+
60
+ ## An overview of currently available hooks
61
+
62
+ ### 1. Getting or changing data
63
+ These are tools you can use in your app to get or change data:
64
+
65
+ <details>
66
+ <summary>`useDrives`, `useDriveById(id)`: Lets you access folders (called "drives").</summary>
67
+
68
+ ### Hook Name and Signature
69
+ The name of the hook and its TypeScript (or JavaScript) signature.
70
+ ### Description
71
+ A brief explanation of what the hook does and when to use it.
72
+ ### Usage Example
73
+ A code snippet showing how to use the hook in a real-world scenario.
74
+ ### Parameters
75
+ A table or list describing each parameter, its type, and its purpose.
76
+ ### Return Value
77
+ A description (and sometimes a table) of what the hook returns.
78
+ ### Notes / Caveats
79
+ Any important details, gotchas, or best practices.
80
+ ### Related Hooks
81
+ Links to other relevant hooks or documentation.
82
+ </details>
83
+
84
+ <details>
85
+ <summary>`useDocuments`, `useDocumentById(id)`: Lets you access files (called "documents").</summary>
86
+
87
+ ### Hook Name and Signature
88
+ The name of the hook and its TypeScript (or JavaScript) signature.
89
+ ### Description
90
+ A brief explanation of what the hook does and when to use it.
91
+ ### Usage Example
92
+ A code snippet showing how to use the hook in a real-world scenario.
93
+ ### Parameters
94
+ A table or list describing each parameter, its type, and its purpose.
95
+ ### Return Value
96
+ A description (and sometimes a table) of what the hook returns.
97
+ ### Notes / Caveats
98
+ Any important details, gotchas, or best practices.
99
+ ### Related Hooks
100
+ Links to other relevant hooks or documentation.
101
+ </details>
102
+
103
+ <details>
104
+ <summary>`useEditorModules`, `useEditor(documentType)`: Loads the relevant editor UI/tools for a document.</summary>
105
+
106
+ ### Hook Name and Signature
107
+ The name of the hook and its TypeScript (or JavaScript) signature.
108
+ ### Description
109
+ A brief explanation of what the hook does and when to use it.
110
+ ### Usage Example
111
+ A code snippet showing how to use the hook in a real-world scenario.
112
+ ### Parameters
113
+ A table or list describing each parameter, its type, and its purpose.
114
+ ### Return Value
115
+ A description (and sometimes a table) of what the hook returns.
116
+ ### Notes / Caveats
117
+ Any important details, gotchas, or best practices.
118
+ ### Related Hooks
119
+ Links to other relevant hooks or documentation.
120
+ </details>
121
+
122
+ <details>
123
+ <summary>`useDocumentModule`, `useDocumentModel(documentType)`: Gets the technical model behind a document type—like its schema and operations.</summary>
124
+
125
+ ### Hook Name and Signature
126
+ The name of the hook and its TypeScript (or JavaScript) signature.
127
+ ### Description
128
+ A brief explanation of what the hook does and when to use it.
129
+ ### Usage Example
130
+ A code snippet showing how to use the hook in a real-world scenario.
131
+ ### Parameters
132
+ A table or list describing each parameter, its type, and its purpose.
133
+ ### Return Value
134
+ A description (and sometimes a table) of what the hook returns.
135
+ ### Notes / Caveats
136
+ Any important details, gotchas, or best practices.
137
+ ### Related Hooks
138
+ Links to other relevant hooks or documentation.
139
+ </details>
140
+
141
+ ### 2. Managing selection state
142
+ You can now use the following to manage and track what's currently selected:
143
+
144
+ <details>
145
+ <summary>`useSelectedDrive` and `useSetSelectedDrive(driveId)`: Get/set the selected folder.</summary>
146
+
147
+ ### Hook Name and Signature
148
+ The name of the hook and its TypeScript (or JavaScript) signature.
149
+ ### Description
150
+ A brief explanation of what the hook does and when to use it.
151
+ ### Usage Example
152
+ A code snippet showing how to use the hook in a real-world scenario.
153
+ ### Parameters
154
+ A table or list describing each parameter, its type, and its purpose.
155
+ ### Return Value
156
+ A description (and sometimes a table) of what the hook returns.
157
+ ### Notes / Caveats
158
+ Any important details, gotchas, or best practices.
159
+ ### Related Hooks
160
+ Links to other relevant hooks or documentation.
161
+ </details>
162
+
163
+ <details>
164
+ <summary>`useSelectedDocument` and `useSetSelectedDocument(documentId)`: Get/set the selected file.</summary>
165
+
166
+ ### Hook Name and Signature
167
+ The name of the hook and its TypeScript (or JavaScript) signature.
168
+ ### Description
169
+ A brief explanation of what the hook does and when to use it.
170
+ ### Usage Example
171
+ A code snippet showing how to use the hook in a real-world scenario.
172
+ ### Parameters
173
+ A table or list describing each parameter, its type, and its purpose.
174
+ ### Return Value
175
+ A description (and sometimes a table) of what the hook returns.
176
+ ### Notes / Caveats
177
+ Any important details, gotchas, or best practices.
178
+ ### Related Hooks
179
+ Links to other relevant hooks or documentation.
180
+ </details>
181
+
182
+ ## More documentation coming soon!
183
+
184
+ Global access to drive state: A top-level, possibly context-based, way to introspect and interact with any document and its state tree without manually passing things around.
185
+
186
+ 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.
187
+
188
+ ### Core Hooks & Patterns
189
+ - useDocumentField
190
+ - useReadDocumentField
191
+ - useUpdateDocumentField
192
+ - useDocumentDispatch(docId): updateX, delete, ...
193
+
194
+ ### Global Drive Access
195
+ - How to access and manipulate the global document tree
196
+ - How to inspect children from parent context
197
+ - Tree traversal utilities (if any)
198
+
199
+ ### Convenience APIs
200
+ - Utility functions like getDispatchFunctions(docId)
201
+ - "Quick Start" to manipulate any document like a pro
202
+
203
+ ### Working with Context
204
+ - DriveContext: what lives there, how to use it
205
+ - Example: using context to get current doc, sibling docs
206
+
207
+ ### Best Practices & Patterns
208
+ - When to use useDocumentField vs getDispatch
209
+ - Composing document fields into custom logic