@buoy-gg/jotai 7.0.30 → 7.0.31
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/index.js +7 -0
- package/lib/commonjs/jotai/components/JotaiAtomBrowser.js +30 -119
- package/lib/commonjs/jotai/components/JotaiAtomChangeItem.js +19 -7
- package/lib/commonjs/jotai/components/JotaiAtomDetailContent.js +41 -5
- package/lib/commonjs/jotai/components/JotaiAtomValueDetailContent.js +444 -0
- package/lib/commonjs/jotai/components/JotaiEventFilterView.js +15 -0
- package/lib/commonjs/jotai/components/JotaiModal.js +158 -23
- package/lib/commonjs/jotai/utils/jotaiStateStore.js +9 -4
- package/lib/commonjs/jotai/utils/testIDs.js +90 -0
- package/lib/commonjs/jotai/utils/watchAtoms.js +8 -2
- package/lib/commonjs/jotai/utils/writeSemantics.js +47 -0
- package/lib/module/index.js +1 -0
- package/lib/module/jotai/components/JotaiAtomBrowser.js +33 -122
- package/lib/module/jotai/components/JotaiAtomChangeItem.js +19 -7
- package/lib/module/jotai/components/JotaiAtomDetailContent.js +41 -5
- package/lib/module/jotai/components/JotaiAtomValueDetailContent.js +442 -0
- package/lib/module/jotai/components/JotaiEventFilterView.js +15 -0
- package/lib/module/jotai/components/JotaiModal.js +158 -23
- package/lib/module/jotai/utils/jotaiStateStore.js +9 -4
- package/lib/module/jotai/utils/testIDs.js +82 -0
- package/lib/module/jotai/utils/watchAtoms.js +8 -2
- package/lib/module/jotai/utils/writeSemantics.js +43 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/jotai/components/JotaiAtomBrowser.d.ts +6 -5
- package/lib/typescript/jotai/components/JotaiAtomBrowser.d.ts.map +1 -1
- package/lib/typescript/jotai/components/JotaiAtomChangeItem.d.ts +5 -0
- 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/JotaiAtomValueDetailContent.d.ts +40 -0
- package/lib/typescript/jotai/components/JotaiAtomValueDetailContent.d.ts.map +1 -0
- 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/sync/jotaiSyncAdapter.d.ts +1 -0
- package/lib/typescript/jotai/sync/jotaiSyncAdapter.d.ts.map +1 -1
- package/lib/typescript/jotai/types/index.d.ts +12 -0
- package/lib/typescript/jotai/types/index.d.ts.map +1 -1
- package/lib/typescript/jotai/utils/jotaiStateStore.d.ts +1 -1
- package/lib/typescript/jotai/utils/jotaiStateStore.d.ts.map +1 -1
- package/lib/typescript/jotai/utils/testIDs.d.ts +62 -0
- package/lib/typescript/jotai/utils/testIDs.d.ts.map +1 -0
- package/lib/typescript/jotai/utils/watchAtoms.d.ts +8 -2
- package/lib/typescript/jotai/utils/watchAtoms.d.ts.map +1 -1
- package/lib/typescript/jotai/utils/writeSemantics.d.ts +25 -0
- package/lib/typescript/jotai/utils/writeSemantics.d.ts.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One atom, on a screen of its own — the React Query detail-screen shape
|
|
3
|
+
* pointed at a live jotai atom. The jotai counterpart of zustand's
|
|
4
|
+
* `ZustandStoreDetailContent`; tapping an atom card opens this instead of
|
|
5
|
+
* expanding in place.
|
|
6
|
+
*
|
|
7
|
+
* 1. VALUE EDITOR — the shared LiveExplorer. No draft, no Save: an edit
|
|
8
|
+
* writes into the atom as you make it and the app reacts immediately.
|
|
9
|
+
* Typing commits on a short debounce (~300ms, flushed on blur) so a word
|
|
10
|
+
* is one recorded change, not one per keystroke — atom writes land in
|
|
11
|
+
* the change log and count against the free tier's cap.
|
|
12
|
+
* 2. ATOM DETAILS — what the expanded card used to say: type, write
|
|
13
|
+
* semantics, change count (with the road to history).
|
|
14
|
+
* 3. VALUE EXPLORER — the read-only tree of the same value.
|
|
15
|
+
*
|
|
16
|
+
* THE WRITE RULE — whole-value replace, jotai's own semantics. An atom is one
|
|
17
|
+
* value; there is no merge. However deep the edit, the writer rebuilds the
|
|
18
|
+
* whole value (`updateNestedDataByPath`) and hands it to `store.set(atom, …)`
|
|
19
|
+
* — so nested deletes are fine and only the ROOT itself can't be removed.
|
|
20
|
+
*
|
|
21
|
+
* Write-kind honesty (classified from jotai's own `defaultWrite`, see
|
|
22
|
+
* writeSemantics.ts):
|
|
23
|
+
* - "value" — primitive atom: `store.set` stores the edited value. Clean.
|
|
24
|
+
* - "action" — custom write (`atomWithStorage`, `atomWithReducer`, …): the
|
|
25
|
+
* edited value is passed to that write as its argument. For most
|
|
26
|
+
* (`atomWithStorage`) that IS a set; for a reducer it's an action. Still
|
|
27
|
+
* editable — the MCP's `setAtom` and Time Machine restore already write
|
|
28
|
+
* these — but the editor says what the write really does.
|
|
29
|
+
* - read-only derived — no setter exists; the editor section explains and
|
|
30
|
+
* the info/explorer sections still render.
|
|
31
|
+
*/
|
|
32
|
+
import type { JotaiAtomInfo } from "../types";
|
|
33
|
+
interface JotaiAtomValueDetailContentProps {
|
|
34
|
+
atom: JotaiAtomInfo;
|
|
35
|
+
/** Open this atom's change history (the modal owns that view). */
|
|
36
|
+
onViewHistory: (atomLabel: string) => void;
|
|
37
|
+
}
|
|
38
|
+
export declare function JotaiAtomValueDetailContent({ atom, onViewHistory, }: JotaiAtomValueDetailContentProps): import("react").JSX.Element;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=JotaiAtomValueDetailContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JotaiAtomValueDetailContent.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiAtomValueDetailContent.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AA0BH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAoE9C,UAAU,gCAAgC;IACxC,IAAI,EAAE,aAAa,CAAC;IACpB,kEAAkE;IAClE,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,wBAAgB,2BAA2B,CAAC,EAC1C,IAAI,EACJ,aAAa,GACd,EAAE,gCAAgC,+BA6OlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JotaiEventFilterView.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiEventFilterView.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"JotaiEventFilterView.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiEventFilterView.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAI9C,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;AAYD,wBAAgB,oBAAoB,CAAC,EACnC,eAAe,EACf,eAAe,EACf,YAAY,EACZ,KAAK,GACN,EAAE,yBAAyB,+BA8K3B"}
|
|
@@ -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;AA0CH,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,UAAU,CAAC;AAkCjE,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,sCA8qBjB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,KAAK,GAAE,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAM,+BAGpE"}
|
|
@@ -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;AAGhD;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;EAG1B,CAAC;AA0CH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB
|
|
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;AAGhD;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;EAG1B,CAAC;AA0CH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;0BASL,MAAM,IAAI;;;QAY9B;;;;WAIG;mCACwB,OAAO;;;;;;;;;;;;;QAkBlC;;;WAGG;gCACqB,OAAO;;;;;;;;;;;QAgC/B;;;;;WAKG;6BACkB,OAAO;;;;;;;;;;;QA6B5B,6EAA6E;2BAC1D,OAAO;;CAM7B,CAAC"}
|
|
@@ -32,6 +32,16 @@ export interface JotaiAtomInfo {
|
|
|
32
32
|
getValue: () => unknown;
|
|
33
33
|
/** Writes a value to the atom (only present for writable atoms). */
|
|
34
34
|
setValue?: (value: unknown) => void;
|
|
35
|
+
/**
|
|
36
|
+
* What `store.set(atom, x)` does with x — classified at registration from
|
|
37
|
+
* the atom's `write` function (see `writeSemantics.ts`). "value": a
|
|
38
|
+
* primitive atom whose default write stores x as the new value. "action": a
|
|
39
|
+
* custom write (`atomWithReducer`, `atomWithStorage`, …) that receives x as
|
|
40
|
+
* its argument — a raw value may or may not mean "set to this". Absent on
|
|
41
|
+
* read-only (derived) atoms and on mirror-rebuilt entries from older
|
|
42
|
+
* devices.
|
|
43
|
+
*/
|
|
44
|
+
writeKind?: "value" | "action";
|
|
35
45
|
}
|
|
36
46
|
/**
|
|
37
47
|
* Serializable snapshot of a tracked atom — registry metadata plus current
|
|
@@ -43,6 +53,8 @@ export interface JotaiAtomSnapshot {
|
|
|
43
53
|
changeCount: number;
|
|
44
54
|
color: string;
|
|
45
55
|
currentValue: unknown;
|
|
56
|
+
/** See JotaiAtomInfo.writeKind. Absent = read-only or an older device. */
|
|
57
|
+
writeKind?: "value" | "action";
|
|
46
58
|
}
|
|
47
59
|
/**
|
|
48
60
|
* Filter options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/jotai/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,OAAO,GACP,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IAGxB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB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
|
|
59
59
|
* device via the adapter's `getAtomValue`. Remote-mirror (desktop) only.
|
|
60
60
|
*/
|
|
61
61
|
hydrateAtomValue(label: string, currentValue: unknown): void;
|
|
62
|
-
registerAtom(label: string, getValue: () => unknown, setValue?: (value: unknown) => void): void;
|
|
62
|
+
registerAtom(label: string, getValue: () => unknown, setValue?: (value: unknown) => void, writeKind?: "value" | "action"): void;
|
|
63
63
|
/**
|
|
64
64
|
* Write a value to a registered atom (remote write from the dashboard/MCP).
|
|
65
65
|
* Throws if the atom is unknown or read-only (derived atoms have no setter).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jotaiStateStore.d.ts","sourceRoot":"","sources":["../../../../src/jotai/utils/jotaiStateStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAiJlB,cAAM,eAAe;IACnB,OAAO,CAAC,WAAW,CAAyB;IAC5C,OAAO,CAAC,KAAK,CAAyC;IACtD,OAAO,CAAC,SAAS,CAAwD;IACzE,OAAO,CAAC,aAAa,CAAoD;IACzE,OAAO,CAAC,cAAc,CAA8B;IACpD,OAAO,CAAC,UAAU,CAAO;IACzB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,iBAAiB,CAAS;IAIlC,aAAa,CAAC,MAAM,EAAE;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,OAAO,CAAC;QACnB,SAAS,EAAE,OAAO,CAAC;QACnB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;KAC/B,GAAG,IAAI;IAsCR,cAAc,IAAI,eAAe,EAAE;IAInC,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAI1D,gBAAgB,IAAI,IAAI;IAgBxB;;;OAGG;IACH,OAAO,CAAC,QAAQ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,eAAe,iBAAwB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jotai tool test handles.
|
|
3
|
+
*
|
|
4
|
+
* Every tappable and every value the e2e suite reads back is addressed
|
|
5
|
+
* `buoy-jotai-<thing>`. Two rules need explaining, and the second is the one
|
|
6
|
+
* this tool does not share with any other.
|
|
7
|
+
*
|
|
8
|
+
* **A change row's handle carries an ORDINAL, and it counts per ATOM.** Same
|
|
9
|
+
* reason as the Zustand tool: an atom a screen writes to fifty times produces
|
|
10
|
+
* fifty separate, equally real rows, and addressing them by label alone would
|
|
11
|
+
* give fifty views one handle — Detox fails a *matcher* that hits more than
|
|
12
|
+
* one element, so the suite would break on `toExist()` before any assertion,
|
|
13
|
+
* with an error that says nothing about duplicate changes. The handle is
|
|
14
|
+
* `buoy-jotai-row-<slug(atomLabel)>-<n>`, n counting back from the newest row
|
|
15
|
+
* for that atom (1 = newest). Deliberately relative: an atom change has no
|
|
16
|
+
* identity a host could know in advance, and what a test CAN know is "the
|
|
17
|
+
* write I just fired is the newest change to that atom". Read and tap in one
|
|
18
|
+
* beat — a row's ordinal moves the instant another change lands.
|
|
19
|
+
*
|
|
20
|
+
* **The ordinal is per ATOM, and one write can move several atoms.** This is
|
|
21
|
+
* where jotai differs from every store-shaped tool. Atoms form a dependency
|
|
22
|
+
* graph, and this tool watches NODES: a single `set` on a primitive atom
|
|
23
|
+
* notifies every mounted derived atom whose value actually moved, so one
|
|
24
|
+
* press can add a row under three different labels — and add nothing at all
|
|
25
|
+
* under a fourth whose recomputed value happened to be unchanged. Counting
|
|
26
|
+
* ordinals across the whole list would make a row's handle depend on how many
|
|
27
|
+
* *other* atoms the write happened to touch, which is exactly the thing a
|
|
28
|
+
* test of a graph must not assume.
|
|
29
|
+
*
|
|
30
|
+
* **An atom row's handle does NOT carry an ordinal.** An atom is registered
|
|
31
|
+
* once under a label that is unique by construction
|
|
32
|
+
* (`jotaiStateStore.registerAtom` returns early on a label it already holds,
|
|
33
|
+
* and `watchAtoms` marks the atom with a per-label symbol), so
|
|
34
|
+
* `buoy-jotai-atom-<slug(label)>` is as stable as the registration itself —
|
|
35
|
+
* and unlike a change, it is a thing the host knows the name of before the
|
|
36
|
+
* app has booted.
|
|
37
|
+
*
|
|
38
|
+
* The suite mirrors these rules in CommonJS (`example-dev-build/utils/
|
|
39
|
+
* jotaiBench.js`) and asserts the two agree — Detox runs in Node on the host
|
|
40
|
+
* and cannot import TypeScript.
|
|
41
|
+
*/
|
|
42
|
+
import type { JotaiAtomChange } from "../types";
|
|
43
|
+
/** Prefix every handle in this tool shares. */
|
|
44
|
+
export declare const JOTAI_TEST_ID = "buoy-jotai";
|
|
45
|
+
/** `jbenchCount` → `jbenchcount`. Shared with every Buoy tool. */
|
|
46
|
+
export declare function slugForTestID(value: unknown): string;
|
|
47
|
+
/**
|
|
48
|
+
* Handle for one change row: `buoy-jotai-row-jbenchcount-1`.
|
|
49
|
+
*
|
|
50
|
+
* `ordinal` is 1-based and counts back from the newest row for this atom.
|
|
51
|
+
*/
|
|
52
|
+
export declare function changeRowTestID(atomLabel: string, ordinal: number): string;
|
|
53
|
+
/** Handle for one atom row in the browser: `buoy-jotai-atom-jbenchcount`. */
|
|
54
|
+
export declare function atomRowTestID(atomLabel: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* Row handle per change id for one rendered list, newest-first.
|
|
57
|
+
*
|
|
58
|
+
* Built once for the whole list rather than per row, because an ordinal is a
|
|
59
|
+
* fact about the list and a row cannot compute its own.
|
|
60
|
+
*/
|
|
61
|
+
export declare function buildChangeRowTestIDs(changes: JotaiAtomChange[]): Map<string, string>;
|
|
62
|
+
//# sourceMappingURL=testIDs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testIDs.d.ts","sourceRoot":"","sources":["../../../../src/jotai/utils/testIDs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,+CAA+C;AAC/C,eAAO,MAAM,aAAa,eAAe,CAAC;AAE1C,kEAAkE;AAClE,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAOpD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,eAAe,EAAE,GACzB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CASrB"}
|
|
@@ -14,8 +14,14 @@ type AnyAtom = Atom<unknown>;
|
|
|
14
14
|
interface JotaiStoreAPI {
|
|
15
15
|
get: <Value>(atom: Atom<Value>) => Value;
|
|
16
16
|
sub: (atom: AnyAtom, listener: () => void) => () => void;
|
|
17
|
-
/**
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Write to a writable atom. Present on real Jotai stores; used for remote set.
|
|
19
|
+
* Method syntax on purpose: methods are checked bivariantly, so a real store's
|
|
20
|
+
* `set` (which requires a WritableAtom, narrower than AnyAtom) stays
|
|
21
|
+
* assignable under strictFunctionTypes — as a property arrow it is not, and
|
|
22
|
+
* `watchAtoms(getDefaultStore(), …)` fails to typecheck for every user.
|
|
23
|
+
*/
|
|
24
|
+
set?(atom: AnyAtom, ...args: unknown[]): unknown;
|
|
19
25
|
}
|
|
20
26
|
/**
|
|
21
27
|
* Watch a set of Jotai atoms for value changes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchAtoms.d.ts","sourceRoot":"","sources":["../../../../src/jotai/utils/watchAtoms.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"watchAtoms.d.ts","sourceRoot":"","sources":["../../../../src/jotai/utils/watchAtoms.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,+DAA+D;AAC/D,KAAK,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;AAE7B,mFAAmF;AACnF,UAAU,aAAa;IACrB,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC;IACzC,GAAG,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;IACzD;;;;;;OAMG;IACH,GAAG,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;CAClD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,MAAM,IAAI,CAiFZ;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,MAAM,IAAI,CA2BZ;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,YAAY,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What does `store.set(atom, x)` DO with x?
|
|
3
|
+
*
|
|
4
|
+
* jotai's `atom(initialValue)` gives every primitive atom the SAME shared
|
|
5
|
+
* `defaultWrite` function (see jotai/src/vanilla/atom.ts): it stores x as the
|
|
6
|
+
* atom's new value (or calls it with the previous value when x is a
|
|
7
|
+
* function). Any other `write` is app code — `atomWithReducer` receives
|
|
8
|
+
* ACTIONS, `atomWithStorage` persists as a side effect, a custom write can do
|
|
9
|
+
* anything — so a raw value handed to `store.set` may not mean "set to this".
|
|
10
|
+
*
|
|
11
|
+
* The tool's editor needs that distinction to be honest: a "value" atom edits
|
|
12
|
+
* like plain data; an "action" atom is still writable (the MCP `setAtom` and
|
|
13
|
+
* Time Machine restore already write to them) but the editor says what the
|
|
14
|
+
* write actually does.
|
|
15
|
+
*
|
|
16
|
+
* Detection: a probe primitive atom exposes this jotai instance's
|
|
17
|
+
* `defaultWrite`; identity match is exact. The `toString` fallback covers an
|
|
18
|
+
* app that somehow bundles a second jotai copy (its atoms carry a different —
|
|
19
|
+
* but textually identical — defaultWrite instance). An unrecognized write
|
|
20
|
+
* classifies as "action", which only makes the editor more cautious.
|
|
21
|
+
*/
|
|
22
|
+
export type AtomWriteKind = "value" | "action";
|
|
23
|
+
/** Classify a writable atom's write. Call only when `atom.write` exists. */
|
|
24
|
+
export declare function classifyAtomWrite(candidate: unknown): AtomWriteKind;
|
|
25
|
+
//# sourceMappingURL=writeSemantics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeSemantics.d.ts","sourceRoot":"","sources":["../../../../src/jotai/utils/writeSemantics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,CAAC;AAO/C,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,OAAO,GAAG,aAAa,CAiBnE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/jotai",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.31",
|
|
4
4
|
"description": "Jotai devtools inside your React Native app — every atom write shows prev → next, with per-atom history & live values. Part of Buoy devtools.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"**/snapshotProvider.ts"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@buoy-gg/
|
|
33
|
-
"@buoy-gg/
|
|
32
|
+
"@buoy-gg/license": "^7.0.31",
|
|
33
|
+
"@buoy-gg/shared-ui": "^7.0.31"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"jotai": ">=2.0.0",
|