You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add custom data table to Dexie store for user-managed state persistence (#1035)
* Initial plan
* Add custom data table to Dexie store with comprehensive documentation
Co-authored-by: mikebarkmin <[email protected]>
* Update versions and add changeset for custom data store feature
- Bump @hyperbook/markdown to 0.40.0
- Bump hyperbook to 0.66.0
- Bump hyperbook-studio to 0.42.0
- Add changeset file for custom data store feature
- Update CHANGELOG.md files for all affected packages
- Update website changelog with v0.66.0 entry
Co-authored-by: mikebarkmin <[email protected]>
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: mikebarkmin <[email protected]>
Copy file name to clipboardExpand all lines: packages/hyperbook/CHANGELOG.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,25 @@
1
1
# hyperbook
2
2
3
+
## 0.66.0
4
+
5
+
### Minor Changes
6
+
7
+
- Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Add custom data table to Dexie store for user-managed state persistence
8
+
9
+
This adds a new `custom` table to the Hyperbook Dexie store, enabling users to persist arbitrary JSON data in the browser's IndexedDB.
10
+
11
+
Features:
12
+
13
+
- New `custom` table with schema `id, payload` for storing user-defined data
14
+
- Comprehensive documentation in the advanced section showing how to use the API
15
+
- Automatic inclusion in existing export/import functionality
16
+
- Full support for storing and retrieving JSON data using `store.custom.put()` and `store.custom.get()`
Copy file name to clipboardExpand all lines: packages/markdown/CHANGELOG.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,20 @@
1
1
# @hyperbook/markdown
2
2
3
+
## 0.40.0
4
+
5
+
### Minor Changes
6
+
7
+
- Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Add custom data table to Dexie store for user-managed state persistence
8
+
9
+
This adds a new `custom` table to the Hyperbook Dexie store, enabling users to persist arbitrary JSON data in the browser's IndexedDB.
10
+
11
+
Features:
12
+
13
+
- New `custom` table with schema `id, payload` for storing user-defined data
14
+
- Comprehensive documentation in the advanced section showing how to use the API
15
+
- Automatic inclusion in existing export/import functionality
16
+
- Full support for storing and retrieving JSON data using `store.custom.put()` and `store.custom.get()`
Copy file name to clipboardExpand all lines: platforms/vscode/CHANGELOG.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,25 @@
1
1
# @hyperbook/vscode-extension
2
2
3
+
## 0.42.0
4
+
5
+
### Minor Changes
6
+
7
+
- Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Add custom data table to Dexie store for user-managed state persistence
8
+
9
+
This adds a new `custom` table to the Hyperbook Dexie store, enabling users to persist arbitrary JSON data in the browser's IndexedDB.
10
+
11
+
Features:
12
+
13
+
- New `custom` table with schema `id, payload` for storing user-defined data
14
+
- Comprehensive documentation in the advanced section showing how to use the API
15
+
- Automatic inclusion in existing export/import functionality
16
+
- Full support for storing and retrieving JSON data using `store.custom.put()` and `store.custom.get()`
Copy file name to clipboardExpand all lines: website/de/book/advanced/custom-scripts.md
+104Lines changed: 104 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,3 +28,107 @@ for (let el of els) {
28
28
```
29
29
30
30
<divclass="random-color">Am I a Chameleon?</div>
31
+
32
+
## Verwendung der Hyperbook Store API
33
+
34
+
Hyperbook stellt eine integrierte Dexie-Datenbank zur Verfügung, mit der du benutzerdefinierte Daten in der IndexedDB des Browsers speichern und abrufen kannst. Dies ist nützlich zum Speichern von Benutzereinstellungen, Fortschrittsverfolgung oder anderen benutzerdefinierten Daten, die nach dem Neuladen der Seite erhalten bleiben sollen.
35
+
36
+
### Custom Data Tabelle
37
+
38
+
Der Hyperbook-Store enthält eine `custom`-Tabelle, die speziell für deine benutzerdefinierten Datenanforderungen entwickelt wurde. Das Tabellenschema ist:
39
+
40
+
-`id` - Eine eindeutige Kennung für deinen Dateneintrag (String)
41
+
-`payload` - Deine benutzerdefinierten Daten, typischerweise als JSON gespeichert
42
+
43
+
### Daten speichern
44
+
45
+
Du kannst benutzerdefinierte JSON-Daten mit der Methode `store.custom.put()` speichern:
46
+
47
+
```js
48
+
// Benutzereinstellungen speichern
49
+
awaitstore.custom.put({
50
+
id:"user-preferences",
51
+
payload:JSON.stringify({
52
+
theme:"dark",
53
+
fontSize:16,
54
+
language:"de"
55
+
})
56
+
});
57
+
58
+
// Benutzerfortschritt speichern
59
+
awaitstore.custom.put({
60
+
id:"chapter-progress",
61
+
payload:JSON.stringify({
62
+
currentChapter:5,
63
+
completedExercises: [1, 2, 3],
64
+
lastVisited:newDate().toISOString()
65
+
})
66
+
});
67
+
```
68
+
69
+
### Daten abrufen
70
+
71
+
Du kannst deine Daten mit der Methode `store.custom.get()` abrufen:
Deine benutzerdefinierten Daten werden automatisch eingeschlossen, wenn Benutzer ihre Hyperbook-Daten mit der Funktion `hyperbookExport()` exportieren. Ebenso werden sie wiederhergestellt, wenn sie `hyperbookImport()` verwenden. Dadurch wird sichergestellt, dass deine benutzerdefinierten Daten über Browser-Sitzungen hinweg erhalten bleiben und zwischen Geräten übertragen werden können.
Copy file name to clipboardExpand all lines: website/en/book/advanced/custom-scripts.md
+104Lines changed: 104 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,3 +27,107 @@ for (let el of els) {
27
27
```
28
28
29
29
<divclass="random-color">Am I a Chameleon?</div>
30
+
31
+
## Using the Hyperbook Store API
32
+
33
+
Hyperbook provides a built-in Dexie database that allows you to store and retrieve custom data in the browser's IndexedDB. This is useful for persisting user preferences, progress tracking, or any other custom data that should survive page reloads.
34
+
35
+
### Custom Data Table
36
+
37
+
The hyperbook store includes a `custom` table specifically designed for your custom data needs. The table schema is:
38
+
39
+
-`id` - A unique identifier for your data entry (string)
40
+
-`payload` - Your custom data, typically stored as JSON
41
+
42
+
### Saving Data
43
+
44
+
You can save custom JSON data using the `store.custom.put()` method:
45
+
46
+
```js
47
+
// Save user preferences
48
+
awaitstore.custom.put({
49
+
id:"user-preferences",
50
+
payload:JSON.stringify({
51
+
theme:"dark",
52
+
fontSize:16,
53
+
language:"en"
54
+
})
55
+
});
56
+
57
+
// Save user progress
58
+
awaitstore.custom.put({
59
+
id:"chapter-progress",
60
+
payload:JSON.stringify({
61
+
currentChapter:5,
62
+
completedExercises: [1, 2, 3],
63
+
lastVisited:newDate().toISOString()
64
+
})
65
+
});
66
+
```
67
+
68
+
### Retrieving Data
69
+
70
+
You can retrieve your data using the `store.custom.get()` method:
Your custom data is automatically included when users export their hyperbook data using the `hyperbookExport()` function. Similarly, it will be restored when they use `hyperbookImport()`. This ensures your custom data is preserved across browser sessions and can be transferred between devices.
0 commit comments