@buoy-gg/jotai 7.0.32 → 7.0.34
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/lib/commonjs/jotai/components/JotaiAtomBrowser.js +20 -41
- package/lib/commonjs/jotai/components/JotaiAtomChangeItem.js +7 -52
- package/lib/commonjs/jotai/components/JotaiAtomDetailContent.js +8 -87
- package/lib/commonjs/jotai/components/JotaiEventFilterView.js +21 -299
- package/lib/commonjs/jotai/components/JotaiModal.js +82 -124
- package/lib/commonjs/jotai/hooks/useJotaiAtomChanges.js +33 -49
- package/lib/commonjs/jotai/sync/jotaiSyncAdapter.js +19 -66
- package/lib/commonjs/jotai/utils/jotaiStateStore.js +23 -188
- package/lib/commonjs/jotai/utils/snapshotProvider.js +7 -25
- package/lib/commonjs/preset.js +14 -22
- package/lib/module/jotai/components/JotaiAtomBrowser.js +21 -42
- package/lib/module/jotai/components/JotaiAtomChangeItem.js +9 -54
- package/lib/module/jotai/components/JotaiAtomDetailContent.js +9 -88
- package/lib/module/jotai/components/JotaiEventFilterView.js +24 -302
- package/lib/module/jotai/components/JotaiModal.js +84 -126
- package/lib/module/jotai/hooks/useJotaiAtomChanges.js +34 -50
- package/lib/module/jotai/sync/jotaiSyncAdapter.js +20 -67
- package/lib/module/jotai/utils/jotaiStateStore.js +23 -188
- package/lib/module/jotai/utils/snapshotProvider.js +8 -26
- package/lib/module/preset.js +13 -20
- package/lib/typescript/jotai/components/JotaiAtomBrowser.d.ts.map +1 -1
- package/lib/typescript/jotai/components/JotaiAtomChangeItem.d.ts.map +1 -1
- package/lib/typescript/jotai/components/JotaiAtomDetailContent.d.ts.map +1 -1
- package/lib/typescript/jotai/components/JotaiEventFilterView.d.ts +2 -2
- package/lib/typescript/jotai/components/JotaiEventFilterView.d.ts.map +1 -1
- package/lib/typescript/jotai/components/JotaiModal.d.ts.map +1 -1
- package/lib/typescript/jotai/hooks/useJotaiAtomChanges.d.ts +2 -1
- package/lib/typescript/jotai/hooks/useJotaiAtomChanges.d.ts.map +1 -1
- package/lib/typescript/jotai/sync/jotaiSyncAdapter.d.ts +54 -68
- package/lib/typescript/jotai/sync/jotaiSyncAdapter.d.ts.map +1 -1
- package/lib/typescript/jotai/utils/jotaiStateStore.d.ts +2 -25
- package/lib/typescript/jotai/utils/jotaiStateStore.d.ts.map +1 -1
- package/lib/typescript/preset.d.ts +2 -8
- package/lib/typescript/preset.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* Mirrors the architecture of zustandStateStore.ts from @buoy-gg/zustand
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { ChangeLog, entityColor, formatValuePreview as sharedFormatValuePreview, shallowDiffSummary } from "@buoy-gg/shared-ui";
|
|
9
10
|
// ============================================
|
|
10
11
|
// Atom Color Palette
|
|
11
12
|
// ============================================
|
|
@@ -36,44 +37,7 @@ const ATOM_COLORS = {
|
|
|
36
37
|
filter: "#84CC16" // lime
|
|
37
38
|
};
|
|
38
39
|
function getAtomColor(label) {
|
|
39
|
-
|
|
40
|
-
if (ATOM_COLORS[lower]) return ATOM_COLORS[lower];
|
|
41
|
-
for (const [key, color] of Object.entries(ATOM_COLORS)) {
|
|
42
|
-
if (lower.includes(key)) return color;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Generate consistent hex from name hash
|
|
46
|
-
const hash = label.split("").reduce((acc, char) => acc + char.charCodeAt(0), 0);
|
|
47
|
-
const hue = hash * 137 % 360;
|
|
48
|
-
const s = 0.7;
|
|
49
|
-
const l = 0.6;
|
|
50
|
-
const c = (1 - Math.abs(2 * l - 1)) * s;
|
|
51
|
-
const x = c * (1 - Math.abs(hue / 60 % 2 - 1));
|
|
52
|
-
const m = l - c / 2;
|
|
53
|
-
let r = 0,
|
|
54
|
-
g = 0,
|
|
55
|
-
b = 0;
|
|
56
|
-
if (hue < 60) {
|
|
57
|
-
r = c;
|
|
58
|
-
g = x;
|
|
59
|
-
} else if (hue < 120) {
|
|
60
|
-
r = x;
|
|
61
|
-
g = c;
|
|
62
|
-
} else if (hue < 180) {
|
|
63
|
-
g = c;
|
|
64
|
-
b = x;
|
|
65
|
-
} else if (hue < 240) {
|
|
66
|
-
g = x;
|
|
67
|
-
b = c;
|
|
68
|
-
} else if (hue < 300) {
|
|
69
|
-
r = x;
|
|
70
|
-
b = c;
|
|
71
|
-
} else {
|
|
72
|
-
r = c;
|
|
73
|
-
b = x;
|
|
74
|
-
}
|
|
75
|
-
const toHex = v => Math.round((v + m) * 255).toString(16).padStart(2, "0");
|
|
76
|
-
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
40
|
+
return entityColor(label, ATOM_COLORS);
|
|
77
41
|
}
|
|
78
42
|
|
|
79
43
|
// ============================================
|
|
@@ -81,97 +45,25 @@ function getAtomColor(label) {
|
|
|
81
45
|
// ============================================
|
|
82
46
|
|
|
83
47
|
function formatValuePreview(value, maxLength = 40) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (typeof value === "string") {
|
|
89
|
-
return value.length > maxLength ? `"${value.slice(0, maxLength - 3)}..."` : `"${value}"`;
|
|
90
|
-
}
|
|
91
|
-
if (typeof value === "number" || typeof value === "boolean") {
|
|
92
|
-
return String(value);
|
|
93
|
-
}
|
|
94
|
-
if (Array.isArray(value)) {
|
|
95
|
-
if (value.length === 0) return "[]";
|
|
96
|
-
const preview = JSON.stringify(value);
|
|
97
|
-
return preview.length > maxLength ? `[${value.length} items]` : preview;
|
|
98
|
-
}
|
|
99
|
-
if (typeof value === "object") {
|
|
100
|
-
const keys = Object.keys(value);
|
|
101
|
-
if (keys.length === 0) return "{}";
|
|
102
|
-
const preview = JSON.stringify(value);
|
|
103
|
-
if (preview.length <= maxLength) return preview;
|
|
104
|
-
return `{ ${keys.length} keys }`;
|
|
105
|
-
}
|
|
106
|
-
return String(value).slice(0, maxLength);
|
|
107
|
-
} catch {
|
|
108
|
-
return "[complex]";
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
function getValueDiffSummary(prevValue, nextValue) {
|
|
112
|
-
if (prevValue === nextValue) {
|
|
113
|
-
return {
|
|
114
|
-
summary: "no change",
|
|
115
|
-
changedKeys: [],
|
|
116
|
-
changedCount: 0
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
if (typeof prevValue !== "object" || typeof nextValue !== "object" || prevValue === null || nextValue === null) {
|
|
120
|
-
return {
|
|
121
|
-
summary: "changed",
|
|
122
|
-
changedKeys: [],
|
|
123
|
-
changedCount: 0
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
const prevKeys = Object.keys(prevValue);
|
|
127
|
-
const nextKeys = Object.keys(nextValue);
|
|
128
|
-
const added = nextKeys.filter(k => !prevKeys.includes(k));
|
|
129
|
-
const removed = prevKeys.filter(k => !nextKeys.includes(k));
|
|
130
|
-
const changed = [];
|
|
131
|
-
for (const key of prevKeys) {
|
|
132
|
-
if (nextKeys.includes(key) && prevValue[key] !== nextValue[key]) {
|
|
133
|
-
changed.push(key);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
const allChangedKeys = [...added, ...removed, ...changed];
|
|
137
|
-
const parts = [];
|
|
138
|
-
if (added.length > 0) parts.push(`+${added.length}`);
|
|
139
|
-
if (removed.length > 0) parts.push(`-${removed.length}`);
|
|
140
|
-
if (changed.length > 0) parts.push(`~${changed.length}`);
|
|
141
|
-
const total = allChangedKeys.length;
|
|
142
|
-
if (parts.length === 0) {
|
|
143
|
-
return {
|
|
144
|
-
summary: "nested change",
|
|
145
|
-
changedKeys: [],
|
|
146
|
-
changedCount: 0
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
return {
|
|
150
|
-
summary: `${parts.join(" ")} ${total === 1 ? "key" : "keys"}`,
|
|
151
|
-
changedKeys: allChangedKeys,
|
|
152
|
-
changedCount: total
|
|
153
|
-
};
|
|
48
|
+
return sharedFormatValuePreview(value, {
|
|
49
|
+
maxLength,
|
|
50
|
+
functionLabel: "(fn)"
|
|
51
|
+
});
|
|
154
52
|
}
|
|
53
|
+
const getValueDiffSummary = shallowDiffSummary;
|
|
155
54
|
|
|
156
55
|
// ============================================
|
|
157
56
|
// Jotai State Store
|
|
158
57
|
// ============================================
|
|
159
58
|
|
|
160
|
-
class JotaiStateStore {
|
|
161
|
-
atomChanges = [];
|
|
59
|
+
class JotaiStateStore extends ChangeLog {
|
|
162
60
|
atoms = new Map();
|
|
163
|
-
listeners = new Set();
|
|
164
61
|
atomListeners = new Set();
|
|
165
|
-
clearListeners = new Set();
|
|
166
|
-
maxChanges = 200;
|
|
167
|
-
idCounter = 0;
|
|
168
|
-
isEnabled = true;
|
|
169
|
-
captureSuppressed = false;
|
|
170
62
|
|
|
171
63
|
// ---- Change Tracking ----
|
|
172
64
|
|
|
173
65
|
addAtomChange(params) {
|
|
174
|
-
if (!this.
|
|
66
|
+
if (!this.canRecord()) return;
|
|
175
67
|
const {
|
|
176
68
|
atomLabel,
|
|
177
69
|
prevValue,
|
|
@@ -186,7 +78,7 @@ class JotaiStateStore {
|
|
|
186
78
|
} = getValueDiffSummary(prevValue, nextValue);
|
|
187
79
|
const valuePreview = formatValuePreview(nextValue);
|
|
188
80
|
const change = {
|
|
189
|
-
id:
|
|
81
|
+
id: this.nextId(),
|
|
190
82
|
atomLabel,
|
|
191
83
|
timestamp: Date.now(),
|
|
192
84
|
prevValue,
|
|
@@ -199,7 +91,7 @@ class JotaiStateStore {
|
|
|
199
91
|
valuePreview,
|
|
200
92
|
isSlowUpdate: false
|
|
201
93
|
};
|
|
202
|
-
this.
|
|
94
|
+
this.push(change);
|
|
203
95
|
const atomInfo = this.atoms.get(atomLabel);
|
|
204
96
|
if (atomInfo) {
|
|
205
97
|
atomInfo.changeCount++;
|
|
@@ -208,54 +100,21 @@ class JotaiStateStore {
|
|
|
208
100
|
this.notifyAtomListeners();
|
|
209
101
|
}
|
|
210
102
|
getAtomChanges() {
|
|
211
|
-
return
|
|
103
|
+
return this.getAll();
|
|
212
104
|
}
|
|
213
105
|
getAtomChangeById(id) {
|
|
214
|
-
return this.
|
|
106
|
+
return this.getById(id);
|
|
215
107
|
}
|
|
216
108
|
clearAtomChanges() {
|
|
217
|
-
this.atomChanges = [];
|
|
218
109
|
for (const atom of this.atoms.values()) {
|
|
219
110
|
atom.changeCount = 0;
|
|
220
111
|
}
|
|
221
|
-
this.
|
|
112
|
+
this.clear();
|
|
222
113
|
this.notifyAtomListeners();
|
|
223
|
-
this.clearListeners.forEach(listener => {
|
|
224
|
-
try {
|
|
225
|
-
listener();
|
|
226
|
-
} catch {
|
|
227
|
-
// Ignore listener errors
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Listen for clearAtomChanges() calls. Used in remote mirror mode to
|
|
234
|
-
* forward a clear performed in the dashboard UI to the synced device.
|
|
235
|
-
*/
|
|
236
|
-
onClear(listener) {
|
|
237
|
-
this.clearListeners.add(listener);
|
|
238
|
-
return () => {
|
|
239
|
-
this.clearListeners.delete(listener);
|
|
240
|
-
};
|
|
241
114
|
}
|
|
242
115
|
|
|
243
116
|
// ---- Remote Mirror Mode ----
|
|
244
117
|
|
|
245
|
-
/**
|
|
246
|
-
* Permanently suppress local capture. Use when this store acts as a mirror
|
|
247
|
-
* of a remote device's atom changes (e.g. the desktop dashboard): data
|
|
248
|
-
* arrives via replaceFromSnapshot() and local watchers must never record.
|
|
249
|
-
*/
|
|
250
|
-
disableCapture() {
|
|
251
|
-
this.captureSuppressed = true;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/** Whether the store is in remote mirror mode (capture suppressed). */
|
|
255
|
-
isCaptureSuppressed() {
|
|
256
|
-
return this.captureSuppressed;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
118
|
/**
|
|
260
119
|
* Serializable snapshot of the tracked atoms (registry metadata plus each
|
|
261
120
|
* atom's current value). Used by the sync adapter on the device side —
|
|
@@ -286,18 +145,18 @@ class JotaiStateStore {
|
|
|
286
145
|
* freezes the mirror.
|
|
287
146
|
*/
|
|
288
147
|
replaceFromSnapshot(changes, atomSnapshots) {
|
|
289
|
-
if (!this.
|
|
148
|
+
if (!this.getEnabled()) return;
|
|
290
149
|
|
|
291
150
|
// Preserve values a remote mirror already hydrated — wire-form snapshots
|
|
292
151
|
// always carry markers, and a later snapshot must not blank the detail pane.
|
|
293
152
|
const hydrated = new Map();
|
|
294
|
-
for (const existing of this.
|
|
153
|
+
for (const existing of this.items) {
|
|
295
154
|
const prev = existing.prevValue;
|
|
296
155
|
if (!prev || prev.__buoyValueOnDevice !== true) {
|
|
297
156
|
hydrated.set(existing.id, existing);
|
|
298
157
|
}
|
|
299
158
|
}
|
|
300
|
-
|
|
159
|
+
const merged = changes.slice(0, this.max).map(change => {
|
|
301
160
|
const kept = hydrated.get(change.id);
|
|
302
161
|
const incoming = change.prevValue;
|
|
303
162
|
return kept && incoming?.__buoyValueOnDevice === true ? {
|
|
@@ -335,7 +194,7 @@ class JotaiStateStore {
|
|
|
335
194
|
writeKind: snapshot.writeKind
|
|
336
195
|
}];
|
|
337
196
|
}));
|
|
338
|
-
this.
|
|
197
|
+
this.setItems(merged);
|
|
339
198
|
this.notifyAtomListeners();
|
|
340
199
|
}
|
|
341
200
|
|
|
@@ -344,13 +203,7 @@ class JotaiStateStore {
|
|
|
344
203
|
* device via the adapter's `getChangeDetail`. Remote-mirror (desktop) only.
|
|
345
204
|
*/
|
|
346
205
|
hydrateChange(id, patch) {
|
|
347
|
-
|
|
348
|
-
if (index === -1) return;
|
|
349
|
-
this.atomChanges = [...this.atomChanges.slice(0, index), {
|
|
350
|
-
...this.atomChanges[index],
|
|
351
|
-
...patch
|
|
352
|
-
}, ...this.atomChanges.slice(index + 1)];
|
|
353
|
-
this.notifyListeners();
|
|
206
|
+
this.hydrateById(id, patch);
|
|
354
207
|
}
|
|
355
208
|
|
|
356
209
|
/**
|
|
@@ -414,7 +267,7 @@ class JotaiStateStore {
|
|
|
414
267
|
// ---- Filtering ----
|
|
415
268
|
|
|
416
269
|
filterAtomChanges(filter) {
|
|
417
|
-
let filtered =
|
|
270
|
+
let filtered = this.getAll();
|
|
418
271
|
if (filter.searchText) {
|
|
419
272
|
const search = filter.searchText.toLowerCase();
|
|
420
273
|
filtered = filtered.filter(c => c.atomLabel.toLowerCase().includes(search) || c.valuePreview.toLowerCase().includes(search) || c.changedKeys.some(k => k.toLowerCase().includes(search)));
|
|
@@ -431,8 +284,8 @@ class JotaiStateStore {
|
|
|
431
284
|
// ---- Stats ----
|
|
432
285
|
|
|
433
286
|
getStats() {
|
|
434
|
-
const total = this.
|
|
435
|
-
const withChanges = this.
|
|
287
|
+
const total = this.items.length;
|
|
288
|
+
const withChanges = this.items.filter(c => c.hasValueChange).length;
|
|
436
289
|
return {
|
|
437
290
|
totalChanges: total,
|
|
438
291
|
changesWithValueChange: withChanges,
|
|
@@ -446,34 +299,16 @@ class JotaiStateStore {
|
|
|
446
299
|
|
|
447
300
|
// ---- Enable / Disable ----
|
|
448
301
|
|
|
449
|
-
setEnabled(enabled) {
|
|
450
|
-
this.isEnabled = enabled;
|
|
451
|
-
}
|
|
452
|
-
getEnabled() {
|
|
453
|
-
return this.isEnabled;
|
|
454
|
-
}
|
|
455
302
|
setMaxChanges(max) {
|
|
456
|
-
this.
|
|
457
|
-
if (this.atomChanges.length > max) {
|
|
458
|
-
this.atomChanges = this.atomChanges.slice(0, max);
|
|
459
|
-
this.notifyListeners();
|
|
460
|
-
}
|
|
303
|
+
this.setMax(max);
|
|
461
304
|
}
|
|
462
305
|
|
|
463
306
|
// ---- Subscriptions ----
|
|
464
307
|
|
|
465
|
-
subscribe(listener) {
|
|
466
|
-
this.listeners.add(listener);
|
|
467
|
-
return () => this.listeners.delete(listener);
|
|
468
|
-
}
|
|
469
308
|
subscribeToAtoms(listener) {
|
|
470
309
|
this.atomListeners.add(listener);
|
|
471
310
|
return () => this.atomListeners.delete(listener);
|
|
472
311
|
}
|
|
473
|
-
notifyListeners() {
|
|
474
|
-
const changes = this.getAtomChanges();
|
|
475
|
-
this.listeners.forEach(listener => listener(changes));
|
|
476
|
-
}
|
|
477
312
|
notifyAtomListeners() {
|
|
478
313
|
const atoms = this.getAtoms();
|
|
479
314
|
this.atomListeners.forEach(listener => listener(atoms));
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* receive ACTIONS through `store.set`, so restoring a raw value can misbehave;
|
|
14
14
|
* nothing in the registry distinguishes them from plain atoms.
|
|
15
15
|
*/
|
|
16
|
-
import { registerStateSnapshotProvider } from "@buoy-gg/shared-ui";
|
|
16
|
+
import { createRestoreScope, emptyRestoreResult, failedRestore, registerStateSnapshotProvider, unionKeys } from "@buoy-gg/shared-ui";
|
|
17
17
|
import { boundedDeepEqual } from "@buoy-gg/shared-ui/dataViewer";
|
|
18
18
|
import { jotaiStateStore } from "./jotaiStateStore";
|
|
19
19
|
function status() {
|
|
@@ -64,30 +64,14 @@ async function capture() {
|
|
|
64
64
|
}
|
|
65
65
|
async function restore(data, options) {
|
|
66
66
|
const snapshot = data;
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
const touch = key => !excludedSet.has(key) && (!includedSet || includedSet.has(key));
|
|
70
|
-
let excludedHits = 0;
|
|
71
|
-
const result = {
|
|
72
|
-
ok: true,
|
|
73
|
-
applied: 0,
|
|
74
|
-
skipped: [],
|
|
75
|
-
warnings: []
|
|
76
|
-
};
|
|
67
|
+
const scope = createRestoreScope(options);
|
|
68
|
+
const result = emptyRestoreResult();
|
|
77
69
|
if (!snapshot?.atoms) {
|
|
78
|
-
return
|
|
79
|
-
ok: false,
|
|
80
|
-
applied: 0,
|
|
81
|
-
skipped: [],
|
|
82
|
-
warnings: ["empty jotai snapshot"]
|
|
83
|
-
};
|
|
70
|
+
return failedRestore("empty jotai snapshot");
|
|
84
71
|
}
|
|
85
72
|
let derived = 0;
|
|
86
73
|
for (const [label, entry] of Object.entries(snapshot.atoms)) {
|
|
87
|
-
if (!
|
|
88
|
-
excludedHits += 1;
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
74
|
+
if (!scope.allows(label)) continue;
|
|
91
75
|
if (!entry.writable) {
|
|
92
76
|
derived += 1;
|
|
93
77
|
continue;
|
|
@@ -121,9 +105,8 @@ async function restore(data, options) {
|
|
|
121
105
|
if (derived > 0) {
|
|
122
106
|
result.warnings.push(`${derived} derived atom(s) left to recompute`);
|
|
123
107
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
108
|
+
const excludedWarning = scope.excludedWarning("atom(s)");
|
|
109
|
+
if (excludedWarning) result.warnings.push(excludedWarning);
|
|
127
110
|
return result;
|
|
128
111
|
}
|
|
129
112
|
|
|
@@ -148,8 +131,7 @@ async function previewItems(target, base) {
|
|
|
148
131
|
}
|
|
149
132
|
const items = [];
|
|
150
133
|
const notes = [];
|
|
151
|
-
const
|
|
152
|
-
for (const label of labels) {
|
|
134
|
+
for (const label of unionKeys(baseAtoms, targetAtoms)) {
|
|
153
135
|
const inTarget = label in targetAtoms;
|
|
154
136
|
if (!inTarget) {
|
|
155
137
|
if (liveMode) notes.push(`atom "${label}" not in snapshot — untouched`);else items.push({
|
package/lib/module/preset.js
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
import { JotaiModal } from "./jotai/components/JotaiModal";
|
|
35
35
|
import { JotaiIcon } from "./jotai/components/JotaiIcon";
|
|
36
|
+
import { createToolFactory, defineToolPreset } from "@buoy-gg/shared-ui";
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* Pre-configured Jotai DevTools preset for FloatingDevTools.
|
|
@@ -44,7 +45,7 @@ import { JotaiIcon } from "./jotai/components/JotaiIcon";
|
|
|
44
45
|
* - Changed keys tracking for object atoms
|
|
45
46
|
*/
|
|
46
47
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
47
|
-
export const jotaiToolPreset = {
|
|
48
|
+
export const jotaiToolPreset = defineToolPreset({
|
|
48
49
|
id: "jotai",
|
|
49
50
|
name: "JOTAI",
|
|
50
51
|
description: "Jotai atom & state inspector",
|
|
@@ -58,7 +59,7 @@ export const jotaiToolPreset = {
|
|
|
58
59
|
props: {
|
|
59
60
|
enableSharedModalDimensions: false
|
|
60
61
|
}
|
|
61
|
-
};
|
|
62
|
+
});
|
|
62
63
|
|
|
63
64
|
/**
|
|
64
65
|
* Create a custom Jotai DevTools configuration.
|
|
@@ -74,21 +75,13 @@ export const jotaiToolPreset = {
|
|
|
74
75
|
* });
|
|
75
76
|
* ```
|
|
76
77
|
*/
|
|
77
|
-
export
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
color: options?.iconColor
|
|
88
|
-
}),
|
|
89
|
-
component: JotaiModal,
|
|
90
|
-
props: {
|
|
91
|
-
enableSharedModalDimensions: options?.enableSharedModalDimensions !== undefined ? options.enableSharedModalDimensions : false
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
}
|
|
78
|
+
export const createJotaiTool = createToolFactory(jotaiToolPreset, options => ({
|
|
79
|
+
enableSharedModalDimensions: options.enableSharedModalDimensions ?? false
|
|
80
|
+
}), options => ({
|
|
81
|
+
icon: ({
|
|
82
|
+
size
|
|
83
|
+
}) => /*#__PURE__*/_jsx(JotaiIcon, {
|
|
84
|
+
size: size,
|
|
85
|
+
color: options.iconColor
|
|
86
|
+
})
|
|
87
|
+
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JotaiAtomBrowser.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiAtomBrowser.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"JotaiAtomBrowser.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiAtomBrowser.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAI9C,UAAU,qBAAqB;IAC7B,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAuDD,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,WAAW,EACX,UAAU,GACX,EAAE,qBAAqB,+BA4FvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JotaiAtomChangeItem.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiAtomChangeItem.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"JotaiAtomChangeItem.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiAtomChangeItem.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAsB,MAAM,UAAU,CAAC;AAGpE,UAAU,wBAAwB;IAChC,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC3C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAsDD,eAAO,MAAM,mBAAmB,gEAwB9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JotaiAtomDetailContent.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiAtomDetailContent.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAA+C,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"JotaiAtomDetailContent.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiAtomDetailContent.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAA+C,MAAM,OAAO,CAAC;AA4BpE,OAAO,KAAK,EACV,eAAe,EAEf,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAwOlB,UAAU,2BAA2B;IACnC,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC;AAED,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,OAAO,EACP,aAAa,EACb,aAAa,EACb,qBAA6B,EAC7B,WAAsB,GACvB,EAAE,2BAA2B,qBAkL7B;AAED,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,OAAO,EACP,aAAa,EACb,aAAa,GACd,EAAE;IACD,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC,4BAcA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* JotaiEventFilterView
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The shared `EntityFilterView` with jotai's nouns: watched atoms you can
|
|
5
|
+
* tap to hide, active atom-name patterns, and how it works.
|
|
6
6
|
*/
|
|
7
7
|
import type { JotaiAtomInfo } from "../types";
|
|
8
8
|
interface JotaiEventFilterViewProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JotaiEventFilterView.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiEventFilterView.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"JotaiEventFilterView.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiEventFilterView.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,UAAU,yBAAyB;IACjC,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAQD,wBAAgB,oBAAoB,CAAC,EACnC,eAAe,EACf,eAAe,EACf,YAAY,EACZ,KAAK,GACN,EAAE,yBAAyB,+BAqB3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JotaiModal.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiModal.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"JotaiModal.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiModal.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA8CH,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,UAAU,CAAC;AAsCjE,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,OAAO,EACP,MAAM,EACN,UAAU,EACV,2BAAmC,EACnC,MAAc,EACd,UAAU,EACV,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,YAAY,GACb,EAAE,eAAe,sCAuqBjB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,KAAK,GAAE,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAM,+BAGpE"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hook for consuming Jotai atom changes from the store
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* The subscribe / filter / pause / clear plumbing is shared `useChangeLog`;
|
|
5
|
+
* this file owns the jotai-specific filter, stats and atom registry.
|
|
5
6
|
*/
|
|
6
7
|
import type { JotaiAtomChange, JotaiAtomInfo, JotaiFilter } from "../types";
|
|
7
8
|
export interface UseJotaiAtomChangesResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useJotaiAtomChanges.d.ts","sourceRoot":"","sources":["../../../../src/jotai/hooks/useJotaiAtomChanges.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"useJotaiAtomChanges.d.ts","sourceRoot":"","sources":["../../../../src/jotai/hooks/useJotaiAtomChanges.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5E,MAAM,WAAW,yBAAyB;IACxC,gCAAgC;IAChC,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,+CAA+C;IAC/C,eAAe,EAAE,eAAe,EAAE,CAAC;IACnC,8BAA8B;IAC9B,MAAM,EAAE,WAAW,CAAC;IACpB,6BAA6B;IAC7B,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;IAC7D,wCAAwC;IACxC,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAC;QACrB,sBAAsB,EAAE,MAAM,CAAC;QAC/B,yBAAyB,EAAE,MAAM,CAAC;QAClC,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,2BAA2B;IAC3B,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,iCAAiC;IACjC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,iCAAiC;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,4BAA4B;IAC5B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,6BAA6B;IAC7B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,uBAAuB;IACvB,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,eAAe,GAAG,SAAS,CAAC;CAC5D;AA8BD,wBAAgB,mBAAmB,IAAI,yBAAyB,CAsC/D"}
|
|
@@ -6,12 +6,12 @@ import type { JotaiAtomChange } from "../types";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const VALUE_ON_DEVICE: Readonly<{
|
|
8
8
|
__buoyValueOnDevice: true;
|
|
9
|
-
|
|
9
|
+
} & {
|
|
10
|
+
note: string;
|
|
10
11
|
}>;
|
|
11
12
|
/**
|
|
12
13
|
* Sync adapter for the jotai tool, consumed by @buoy-gg/external-sync's
|
|
13
|
-
* `useExternalSync
|
|
14
|
-
* this package doesn't need a dependency on it).
|
|
14
|
+
* `useExternalSync`.
|
|
15
15
|
*
|
|
16
16
|
* Atom changes are captured by watchAtoms(), independent of whether a
|
|
17
17
|
* dashboard is watching — subscribing here only streams what the store
|
|
@@ -23,73 +23,59 @@ export declare const VALUE_ON_DEVICE: Readonly<{
|
|
|
23
23
|
* Dashboards fetch values via `getChangeDetail`. Oversized / unserializable
|
|
24
24
|
* `atoms[].currentValue` uses the same marker and is fetched via `getAtomValue`.
|
|
25
25
|
*/
|
|
26
|
-
export declare const jotaiSyncAdapter: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
export declare const jotaiSyncAdapter: import("@buoy-gg/shared-ui").SyncAdapter<{
|
|
27
|
+
changes: JotaiAtomChange[];
|
|
28
|
+
atoms: {
|
|
29
|
+
currentValue: unknown;
|
|
30
|
+
label: string;
|
|
31
|
+
changeCount: number;
|
|
32
|
+
color: string;
|
|
33
|
+
writeKind?: "value" | "action";
|
|
34
|
+
}[];
|
|
35
|
+
}, {
|
|
36
|
+
clearEvents: () => void;
|
|
37
|
+
/**
|
|
38
|
+
* On-demand detail: one change's real prevValue/nextValue.
|
|
39
|
+
* The per-snapshot stream stays value-free; this is the explicit,
|
|
40
|
+
* size-guarded channel for the detail pane.
|
|
41
|
+
*/
|
|
42
|
+
getChangeDetail: (params?: unknown) => import("@buoy-gg/shared-ui").DetailResult<{
|
|
43
|
+
prevValue: unknown;
|
|
44
|
+
nextValue: unknown;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* On-demand current value for one atom. Wire-form snapshots replace
|
|
48
|
+
* oversized / unserializable `currentValue` with VALUE_ON_DEVICE.
|
|
49
|
+
*/
|
|
50
|
+
getAtomValue: (params?: unknown) => {
|
|
51
|
+
found: false;
|
|
52
|
+
reason: string;
|
|
53
|
+
label?: undefined;
|
|
54
|
+
currentValue?: undefined;
|
|
55
|
+
} | {
|
|
56
|
+
found: true;
|
|
57
|
+
label: string;
|
|
58
|
+
currentValue: unknown;
|
|
59
|
+
reason?: undefined;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Compact current-value reader for a remote driver (MCP/LLM): registered
|
|
63
|
+
* atoms with light metadata; each atom's `currentValue` stays on the device
|
|
64
|
+
* unless `includeValues` is set. `writable` tells the caller which atoms
|
|
65
|
+
* can be set via `setAtom`.
|
|
66
|
+
*/
|
|
67
|
+
listAtoms: (params?: unknown) => {
|
|
30
68
|
atoms: {
|
|
31
|
-
currentValue
|
|
69
|
+
currentValue?: unknown;
|
|
32
70
|
label: string;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
writeKind?: "value" | "action";
|
|
71
|
+
changes: number;
|
|
72
|
+
writable: boolean;
|
|
36
73
|
}[];
|
|
74
|
+
total: number;
|
|
75
|
+
returned: number;
|
|
76
|
+
includedValues: boolean;
|
|
37
77
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* On-demand detail: one change's real prevValue/nextValue.
|
|
43
|
-
* The per-snapshot stream stays value-free; this is the explicit,
|
|
44
|
-
* size-guarded channel for the detail pane.
|
|
45
|
-
*/
|
|
46
|
-
getChangeDetail: (params?: unknown) => {
|
|
47
|
-
found: false;
|
|
48
|
-
reason: string;
|
|
49
|
-
id?: undefined;
|
|
50
|
-
prevValue?: undefined;
|
|
51
|
-
nextValue?: undefined;
|
|
52
|
-
} | {
|
|
53
|
-
found: true;
|
|
54
|
-
id: string;
|
|
55
|
-
prevValue: unknown;
|
|
56
|
-
nextValue: unknown;
|
|
57
|
-
reason?: undefined;
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* On-demand current value for one atom. Wire-form snapshots replace
|
|
61
|
-
* oversized / unserializable `currentValue` with VALUE_ON_DEVICE.
|
|
62
|
-
*/
|
|
63
|
-
getAtomValue: (params?: unknown) => {
|
|
64
|
-
found: false;
|
|
65
|
-
reason: string;
|
|
66
|
-
label?: undefined;
|
|
67
|
-
currentValue?: undefined;
|
|
68
|
-
} | {
|
|
69
|
-
found: true;
|
|
70
|
-
label: string;
|
|
71
|
-
currentValue: unknown;
|
|
72
|
-
reason?: undefined;
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* Compact current-value reader for a remote driver (MCP/LLM): registered
|
|
76
|
-
* atoms with light metadata; each atom's `currentValue` stays on the device
|
|
77
|
-
* unless `includeValues` is set. `writable` tells the caller which atoms
|
|
78
|
-
* can be set via `setAtom`.
|
|
79
|
-
*/
|
|
80
|
-
listAtoms: (params?: unknown) => {
|
|
81
|
-
atoms: {
|
|
82
|
-
currentValue?: unknown;
|
|
83
|
-
label: string;
|
|
84
|
-
changes: number;
|
|
85
|
-
writable: boolean;
|
|
86
|
-
}[];
|
|
87
|
-
total: number;
|
|
88
|
-
returned: number;
|
|
89
|
-
includedValues: boolean;
|
|
90
|
-
};
|
|
91
|
-
/** Write a value to a writable atom (throws for unknown/read-only atoms). */
|
|
92
|
-
setAtom: (params?: unknown) => void;
|
|
93
|
-
};
|
|
94
|
-
};
|
|
78
|
+
/** Write a value to a writable atom (throws for unknown/read-only atoms). */
|
|
79
|
+
setAtom: (params?: unknown) => void;
|
|
80
|
+
}>;
|
|
95
81
|
//# sourceMappingURL=jotaiSyncAdapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jotaiSyncAdapter.d.ts","sourceRoot":"","sources":["../../../../src/jotai/sync/jotaiSyncAdapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"jotaiSyncAdapter.d.ts","sourceRoot":"","sources":["../../../../src/jotai/sync/jotaiSyncAdapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAahD;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;EAG3B,CAAC;AA4BF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;IAiBzB;;;;OAIG;;;;;IAQH;;;OAGG;4BACqB,OAAO;;;;;;;;;;;IA0B/B;;;;;OAKG;yBACkB,OAAO;;;;;;;;;;;IA4B5B,6EAA6E;uBAC1D,OAAO;EAMF,CAAC"}
|