atom.io 0.32.2 → 0.32.3

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 (39) hide show
  1. package/README.md +17 -37
  2. package/data/dist/index.js +1 -1
  3. package/dist/{chunk-YPME5OLO.js → chunk-2XDFCXGB.js} +1 -1
  4. package/dist/{chunk-RXQWAO26.js → chunk-35NB2XZU.js} +103 -109
  5. package/dist/{chunk-XN3EO2UT.js → chunk-EF4S7H42.js} +6 -3
  6. package/dist/{chunk-QRPY4LSO.js → chunk-LTLDKXDN.js} +3 -3
  7. package/dist/{chunk-HEEVASKG.js → chunk-MENOYVPP.js} +1 -1
  8. package/dist/{chunk-KMBRCA5Q.js → chunk-RGUNRT72.js} +33 -31
  9. package/dist/{chunk-NDTM5IY3.js → chunk-TS76LQVD.js} +2 -2
  10. package/dist/index.js +1 -1
  11. package/internal/dist/index.d.ts +7 -4
  12. package/internal/dist/index.js +1 -1
  13. package/internal/src/get-state/read-or-compute-value.ts +23 -13
  14. package/internal/src/index.ts +2 -1
  15. package/internal/src/ingest-updates/ingest-creation-disposal.ts +0 -12
  16. package/internal/src/reserved-keys.ts +7 -0
  17. package/internal/src/set-state/copy-mutable-if-needed.ts +12 -11
  18. package/internal/src/set-state/set-atom-or-selector.ts +1 -1
  19. package/internal/src/set-state/set-atom.ts +43 -21
  20. package/internal/src/store/store.ts +2 -1
  21. package/internal/src/transaction/get-epoch-number.ts +15 -19
  22. package/internal/src/transaction/set-epoch-number.ts +2 -2
  23. package/introspection/dist/index.js +2 -2
  24. package/introspection/src/attach-atom-index.ts +16 -14
  25. package/introspection/src/attach-selector-index.ts +16 -14
  26. package/json/dist/index.js +1 -1
  27. package/package.json +19 -17
  28. package/react/dist/index.js +2 -2
  29. package/react-devtools/dist/index.js +78 -66
  30. package/react-devtools/src/AtomIODevtools.tsx +10 -2
  31. package/react-devtools/src/error-boundary/ReactErrorBoundary.tsx +1 -1
  32. package/realtime/dist/index.js +2 -2
  33. package/realtime-client/dist/index.js +2 -2
  34. package/realtime-client/src/continuity/register-and-attempt-confirmed-update.ts +5 -2
  35. package/realtime-react/dist/index.js +4 -4
  36. package/realtime-server/dist/index.js +3 -3
  37. package/realtime-testing/dist/index.js +6 -6
  38. package/transceivers/set-rtx/dist/index.js +1 -1
  39. package/internal/src/set-state/stow-update.ts +0 -60
@@ -40,6 +40,7 @@ export * from "./mutable"
40
40
  export * from "./not-found-error"
41
41
  export * from "./operation"
42
42
  export * from "./pretty-print"
43
+ export * from "./reserved-keys"
43
44
  export * from "./selector"
44
45
  export * from "./set-state"
45
46
  export * from "./store"
@@ -67,7 +68,7 @@ export type MutableAtom<
67
68
  > = AtomIOState &
68
69
  JsonInterface<T, J> & {
69
70
  type: `mutable_atom`
70
- default: T | (() => T)
71
+ default: () => T
71
72
  cleanup?: () => void
72
73
  }
73
74
  export type Atom<T> =
@@ -93,18 +93,6 @@ export function ingestMoleculeDisposalEvent(
93
93
 
94
94
  case `oldValue`:
95
95
  {
96
- // let first = t rue
97
- // for (const ownerString of update.provenance) {
98
- // // const owner = parseJson(ownerString)
99
- // // if (first) {
100
- // // first = false
101
- // // allocateIntoStore<any, any, any>(store, owner, update.key)
102
- // // continue
103
- // // }
104
-
105
- // // claimWithinStore<any, any, any>(store, owner, update.key)
106
-
107
- // }
108
96
  const provenanceJson = update.provenance.map(parseJson)
109
97
  allocateIntoStore<any, any, any>(store, provenanceJson, update.key)
110
98
  for (const [familyKey, value] of update.values) {
@@ -0,0 +1,7 @@
1
+ export type ReservedIntrospectionKey = `🔍 ${string}`
2
+
3
+ export function isReservedIntrospectionKey(
4
+ value: string,
5
+ ): value is ReservedIntrospectionKey {
6
+ return value.startsWith(`🔍 `)
7
+ }
@@ -10,17 +10,18 @@ export function copyMutableIfNeeded<T extends Transceiver<any>>(
10
10
  const originValue = origin.valueMap.get(atom.key)
11
11
  const targetValue = target.valueMap.get(atom.key)
12
12
 
13
- if (originValue === targetValue) {
14
- if (originValue === undefined) {
15
- return typeof atom.default === `function` ? atom.default() : atom.default
16
- }
13
+ if (originValue !== targetValue) {
14
+ return targetValue
15
+ }
17
16
 
18
- origin.logger.info(`📃`, `atom`, atom.key, `copying`)
19
- const jsonValue = atom.toJson(originValue)
20
- const copiedValue = atom.fromJson(jsonValue)
21
- target.valueMap.set(atom.key, copiedValue)
22
- new Tracker(atom, origin)
23
- return copiedValue
17
+ if (originValue === undefined) {
18
+ return atom.default()
24
19
  }
25
- return targetValue
20
+
21
+ origin.logger.info(`📃`, `atom`, atom.key, `copying`)
22
+ const jsonValue = atom.toJson(originValue)
23
+ const copiedValue = atom.fromJson(jsonValue)
24
+ target.valueMap.set(atom.key, copiedValue)
25
+ new Tracker(atom, origin)
26
+ return copiedValue
26
27
  }
@@ -10,7 +10,7 @@ export const setAtomOrSelector = <T>(
10
10
  switch (state.type) {
11
11
  case `atom`:
12
12
  case `mutable_atom`:
13
- setAtom(state, value, store)
13
+ setAtom(store, state, value)
14
14
  break
15
15
  case `selector`:
16
16
  state.set(value)
@@ -1,21 +1,21 @@
1
- import type { Atom } from ".."
1
+ import type { KeyedStateUpdate } from "atom.io"
2
+
3
+ import type { Atom, Store } from ".."
2
4
  import { isAtomDefault, markAtomAsNotDefault } from "../atom"
3
5
  import { cacheValue } from "../caching"
4
6
  import { readOrComputeValue } from "../get-state/read-or-compute-value"
5
- import type { Transceiver } from "../mutable"
7
+ import { isTransceiver, type Transceiver } from "../mutable"
6
8
  import { markDone } from "../operation"
7
- import type { Store } from "../store"
8
- import { isChildStore, isRootStore } from "../transaction/is-root-store"
9
+ import { isChildStore } from "../transaction/is-root-store"
9
10
  import { become } from "./become"
10
11
  import { copyMutableIfNeeded } from "./copy-mutable-if-needed"
11
12
  import { emitUpdate } from "./emit-update"
12
13
  import { evictDownStream } from "./evict-downstream"
13
- import { stowUpdate } from "./stow-update"
14
14
 
15
15
  export const setAtom = <T>(
16
+ target: Store,
16
17
  atom: Atom<T>,
17
18
  next: T | ((oldValue: T) => T),
18
- target: Store,
19
19
  ): void => {
20
20
  const oldValue = readOrComputeValue(target, atom)
21
21
  let newValue = oldValue
@@ -33,22 +33,44 @@ export const setAtom = <T>(
33
33
  markDone(target, atom.key)
34
34
  evictDownStream(target, atom)
35
35
  const update = { oldValue, newValue }
36
- if (isRootStore(target)) {
36
+ if (!isChildStore(target)) {
37
37
  emitUpdate(target, atom, update)
38
- } else if (target.parent) {
39
- if (target.on.transactionApplying.state === null) {
40
- stowUpdate(target, atom, update)
41
- } else if (atom.key.startsWith(`*`)) {
42
- const mutableKey = atom.key.slice(1)
43
- const mutableAtom = target.atoms.get(mutableKey) as Atom<any>
44
- let transceiver: Transceiver<any> = target.valueMap.get(mutableKey)
45
- if (mutableAtom.type === `mutable_atom` && isChildStore(target)) {
46
- const { parent } = target
47
- const copiedValue = copyMutableIfNeeded(target, mutableAtom, parent)
48
- transceiver = copiedValue
49
- }
50
- const accepted = transceiver.do(update.newValue) === null
51
- if (accepted) evictDownStream(target, mutableAtom)
38
+ return
39
+ }
40
+ if (target.on.transactionApplying.state === null) {
41
+ const { key } = atom
42
+ if (isTransceiver(update.newValue)) {
43
+ return
44
+ }
45
+ const atomUpdate: KeyedStateUpdate<T> = {
46
+ type: `atom_update`,
47
+ key,
48
+ ...update,
49
+ }
50
+ if (atom.family) {
51
+ atomUpdate.family = atom.family
52
+ }
53
+ target.transactionMeta.update.updates.push(atomUpdate)
54
+ target.logger.info(
55
+ `📁`,
56
+ `atom`,
57
+ key,
58
+ `stowed (`,
59
+ update.oldValue,
60
+ `->`,
61
+ update.newValue,
62
+ `)`,
63
+ )
64
+ } else if (atom.key.startsWith(`*`)) {
65
+ const mutableKey = atom.key.slice(1)
66
+ const mutableAtom = target.atoms.get(mutableKey) as Atom<any>
67
+ let transceiver: Transceiver<any> = target.valueMap.get(mutableKey)
68
+ if (mutableAtom.type === `mutable_atom` && isChildStore(target)) {
69
+ const { parent } = target
70
+ const copiedValue = copyMutableIfNeeded(target, mutableAtom, parent)
71
+ transceiver = copiedValue
52
72
  }
73
+ const accepted = transceiver.do(update.newValue) === null
74
+ if (accepted) evictDownStream(target, mutableAtom)
53
75
  }
54
76
  }
@@ -20,6 +20,7 @@ import type {
20
20
  WritableSelector,
21
21
  WritableSelectorFamily,
22
22
  } from ".."
23
+ import { isReservedIntrospectionKey } from ".."
23
24
  import type { Join } from "../join"
24
25
  import { Junction } from "../junction"
25
26
  import type { Lineage } from "../lineage"
@@ -177,7 +178,7 @@ export class Store implements Lineage {
177
178
  }
178
179
 
179
180
  public loggers: AtomIOLogger[] = [
180
- new AtomIOLogger(`warn`, (_, __, key) => !key.includes(`🔍`)),
181
+ new AtomIOLogger(`warn`, (_, __, key) => !isReservedIntrospectionKey(key)),
181
182
  ]
182
183
  public logger: Logger = {
183
184
  error: (...messages) => {
@@ -1,26 +1,22 @@
1
1
  import type { Store } from "../store"
2
+ import type { RootStore } from "./is-root-store"
2
3
  import { isRootStore } from "./is-root-store"
3
4
 
4
5
  export function getContinuityKey(
5
- store: Store,
6
+ store: RootStore,
6
7
  transactionKey: string,
7
8
  ): string | undefined {
8
- const isRoot = isRootStore(store)
9
- const continuity = isRoot
10
- ? store.transactionMeta.actionContinuities.getRelatedKey(transactionKey)
11
- : undefined
9
+ const continuity =
10
+ store.transactionMeta.actionContinuities.getRelatedKey(transactionKey)
11
+
12
12
  return continuity
13
13
  }
14
14
 
15
15
  export function getEpochNumberOfContinuity(
16
- store: Store,
16
+ store: RootStore,
17
17
  continuityKey: string,
18
18
  ): number | undefined {
19
- const isRoot = isRootStore(store)
20
- const epoch =
21
- isRoot && continuityKey
22
- ? store.transactionMeta.epoch.get(continuityKey)
23
- : undefined
19
+ const epoch = store.transactionMeta.epoch.get(continuityKey)
24
20
  return epoch
25
21
  }
26
22
 
@@ -29,12 +25,12 @@ export function getEpochNumberOfAction(
29
25
  transactionKey: string,
30
26
  ): number | undefined {
31
27
  const isRoot = isRootStore(store)
32
- const continuity = isRoot
33
- ? store.transactionMeta.actionContinuities.getRelatedKey(transactionKey)
34
- : undefined
35
- const epoch =
36
- isRoot && continuity !== undefined
37
- ? store.transactionMeta.epoch.get(continuity)
38
- : undefined
39
- return epoch
28
+ if (!isRoot) {
29
+ return undefined
30
+ }
31
+ const continuityKey = getContinuityKey(store, transactionKey)
32
+ if (continuityKey === undefined) {
33
+ return undefined
34
+ }
35
+ return getEpochNumberOfContinuity(store, continuityKey)
40
36
  }
@@ -1,4 +1,5 @@
1
1
  import type { Store } from "../store"
2
+ import { getContinuityKey } from "./get-epoch-number"
2
3
  import { isRootStore } from "./is-root-store"
3
4
 
4
5
  export function setEpochNumberOfContinuity(
@@ -21,8 +22,7 @@ export function setEpochNumberOfAction(
21
22
  if (!isRoot) {
22
23
  return
23
24
  }
24
- const continuityKey =
25
- store.transactionMeta.actionContinuities.getRelatedKey(transactionKey)
25
+ const continuityKey = getContinuityKey(store, transactionKey)
26
26
 
27
27
  if (continuityKey !== undefined) {
28
28
  store.transactionMeta.epoch.set(continuityKey, newEpoch)
@@ -1,3 +1,3 @@
1
- export { Auditor, Differ, Refinery, attachIntrospectionStates, diffArray, diffBoolean, diffNumber, diffObject, diffString, discoverType, isPlainObject, jsonRefinery, jsonTreeRefinery, prettyJson, primitiveRefinery, sprawl } from '../../dist/chunk-KMBRCA5Q.js';
2
- import '../../dist/chunk-RXQWAO26.js';
1
+ export { Auditor, Differ, Refinery, attachIntrospectionStates, diffArray, diffBoolean, diffNumber, diffObject, diffString, discoverType, isPlainObject, jsonRefinery, jsonTreeRefinery, prettyJson, primitiveRefinery, sprawl } from '../../dist/chunk-RGUNRT72.js';
2
+ import '../../dist/chunk-35NB2XZU.js';
3
3
  import '../../dist/chunk-XWL6SNVU.js';
@@ -4,6 +4,7 @@ import {
4
4
  createRegularAtom,
5
5
  createStandaloneSelector,
6
6
  deposit,
7
+ isReservedIntrospectionKey,
7
8
  } from "atom.io/internal"
8
9
 
9
10
  import type { WritableTokenIndex } from "."
@@ -20,21 +21,22 @@ export const attachAtomIndex = (
20
21
  default: () => {
21
22
  const base: AtomTokenIndex = new Map()
22
23
  for (const [key, val] of store.atoms) {
23
- if (!key.includes(`🔍`)) {
24
- const token = deposit(val)
25
- if (val.family) {
26
- let familyNode = base.get(val.family.key)
27
- if (!familyNode || !(`familyMembers` in familyNode)) {
28
- familyNode = {
29
- key: val.family.key,
30
- familyMembers: new Map(),
31
- }
32
- base.set(val.family.key, familyNode)
24
+ if (isReservedIntrospectionKey(key)) {
25
+ continue
26
+ }
27
+ const token = deposit(val)
28
+ if (val.family) {
29
+ let familyNode = base.get(val.family.key)
30
+ if (!familyNode || !(`familyMembers` in familyNode)) {
31
+ familyNode = {
32
+ key: val.family.key,
33
+ familyMembers: new Map(),
33
34
  }
34
- familyNode.familyMembers.set(val.family.subKey, token)
35
- } else {
36
- base.set(key, token)
35
+ base.set(val.family.key, familyNode)
37
36
  }
37
+ familyNode.familyMembers.set(val.family.subKey, token)
38
+ } else {
39
+ base.set(key, token)
38
40
  }
39
41
  }
40
42
  return base
@@ -42,7 +44,7 @@ export const attachAtomIndex = (
42
44
  effects: [
43
45
  ({ setSelf }) => {
44
46
  store.on.atomCreation.subscribe(`introspection`, (atomToken) => {
45
- if (atomToken.key.includes(`🔍`)) {
47
+ if (isReservedIntrospectionKey(atomToken.key)) {
46
48
  return
47
49
  }
48
50
 
@@ -4,6 +4,7 @@ import {
4
4
  createRegularAtom,
5
5
  createStandaloneSelector,
6
6
  deposit,
7
+ isReservedIntrospectionKey,
7
8
  } from "atom.io/internal"
8
9
 
9
10
  import type { WritableTokenIndex } from "."
@@ -23,21 +24,22 @@ export const attachSelectorIndex = (
23
24
  const base: SelectorTokenIndex = new Map()
24
25
  for (const map of [store.readonlySelectors, store.selectors]) {
25
26
  for (const [key, val] of map) {
26
- if (!key.includes(`🔍`)) {
27
- const token = deposit(val)
28
- if (val.family) {
29
- let familyNode = base.get(val.family.key)
30
- if (!familyNode || !(`familyMembers` in familyNode)) {
31
- familyNode = {
32
- key: val.family.key,
33
- familyMembers: new Map(),
34
- }
35
- base.set(val.family.key, familyNode)
27
+ if (isReservedIntrospectionKey(key)) {
28
+ continue
29
+ }
30
+ const token = deposit(val)
31
+ if (val.family) {
32
+ let familyNode = base.get(val.family.key)
33
+ if (!familyNode || !(`familyMembers` in familyNode)) {
34
+ familyNode = {
35
+ key: val.family.key,
36
+ familyMembers: new Map(),
36
37
  }
37
- familyNode.familyMembers.set(val.family.subKey, token)
38
- } else {
39
- base.set(key, token)
38
+ base.set(val.family.key, familyNode)
40
39
  }
40
+ familyNode.familyMembers.set(val.family.subKey, token)
41
+ } else {
42
+ base.set(key, token)
41
43
  }
42
44
  }
43
45
  }
@@ -48,7 +50,7 @@ export const attachSelectorIndex = (
48
50
  store.on.selectorCreation.subscribe(
49
51
  `introspection`,
50
52
  (selectorToken) => {
51
- if (selectorToken.key.includes(`🔍`)) {
53
+ if (isReservedIntrospectionKey(selectorToken.key)) {
52
54
  return
53
55
  }
54
56
 
@@ -1,2 +1,2 @@
1
- export { JSON_DEFAULTS, JSON_TYPE_NAMES, fromEntries, isJson, parseJson, selectJson, selectJsonFamily, stringifyJson, toEntries } from '../../dist/chunk-RXQWAO26.js';
1
+ export { JSON_DEFAULTS, JSON_TYPE_NAMES, fromEntries, isJson, parseJson, selectJson, selectJsonFamily, stringifyJson, toEntries } from '../../dist/chunk-35NB2XZU.js';
2
2
  import '../../dist/chunk-XWL6SNVU.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atom.io",
3
- "version": "0.32.2",
3
+ "version": "0.32.3",
4
4
  "description": "Composable and testable reactive data library.",
5
5
  "homepage": "https://atom.io.fyi",
6
6
  "sideEffects": false,
@@ -59,38 +59,38 @@
59
59
  "@types/npmlog": "7.0.0",
60
60
  "@types/react": "19.0.10",
61
61
  "@types/tmp": "0.2.6",
62
- "@typescript-eslint/parser": "8.25.0",
63
- "@typescript-eslint/rule-tester": "8.25.0",
64
- "@typescript-eslint/utils": "8.25.0",
65
- "@vitest/coverage-v8": "3.0.7",
66
- "@vitest/ui": "3.0.7",
67
- "bun-types": "1.2.4",
62
+ "@typescript-eslint/parser": "8.26.1",
63
+ "@typescript-eslint/rule-tester": "8.26.1",
64
+ "@typescript-eslint/utils": "8.26.1",
65
+ "@vitest/coverage-v8": "3.0.8",
66
+ "@vitest/ui": "3.0.8",
67
+ "bun-types": "1.2.5",
68
68
  "concurrently": "9.1.2",
69
69
  "drizzle-kit": "0.30.5",
70
70
  "drizzle-orm": "0.40.0",
71
- "eslint": "9.21.0",
72
- "happy-dom": "17.1.8",
71
+ "eslint": "9.22.0",
72
+ "happy-dom": "17.4.4",
73
73
  "http-proxy": "1.18.1",
74
- "motion": "12.4.7",
74
+ "motion": "12.5.0",
75
75
  "npmlog": "7.0.1",
76
76
  "nyc": "17.1.0",
77
77
  "postgres": "3.4.5",
78
- "preact": "10.26.3",
78
+ "preact": "10.26.4",
79
79
  "react": "19.0.0",
80
80
  "react-dom": "19.0.0",
81
- "react-router-dom": "7.2.0",
81
+ "react-router-dom": "7.3.0",
82
82
  "socket.io": "4.8.1",
83
83
  "socket.io-client": "4.8.1",
84
84
  "tmp": "0.2.3",
85
85
  "tsup": "8.4.0",
86
86
  "tsx": "4.19.3",
87
87
  "typescript": "5.8.2",
88
- "vite": "6.2.0",
88
+ "vite": "6.2.2",
89
89
  "vite-tsconfig-paths": "5.1.4",
90
- "vitest": "3.0.7",
90
+ "vitest": "3.0.8",
91
91
  "zod": "3.24.2",
92
- "recoverage": "0.0.7",
93
- "break-check": "0.6.6"
92
+ "break-check": "0.6.7",
93
+ "recoverage": "0.1.3"
94
94
  },
95
95
  "main": "dist/index.js",
96
96
  "types": "dist/index.d.ts",
@@ -243,7 +243,9 @@
243
243
  "watch:types": "tsc --watch --noEmit",
244
244
  "lint": "concurrently \"bun:lint:*\"",
245
245
  "test": "vitest",
246
- "test:coverage": "vitest run --coverage && recoverage",
246
+ "test:coverage": "pnpm test:coverage:once && pnpm test:coverage:increased",
247
+ "test:coverage:once": "vitest run --coverage",
248
+ "test:coverage:increased": "recoverage",
247
249
  "test:build": "bun run test:manifest && cross-env IMPORT=dist vitest run",
248
250
  "test:once": "echo tested built code",
249
251
  "test:once:public": "cross-env IMPORT=dist vitest run public",
@@ -1,3 +1,3 @@
1
- export { StoreContext, StoreProvider, useI, useJSON, useO, useTL } from '../../dist/chunk-HEEVASKG.js';
2
- import '../../dist/chunk-RXQWAO26.js';
1
+ export { StoreContext, StoreProvider, useI, useJSON, useO, useTL } from '../../dist/chunk-MENOYVPP.js';
2
+ import '../../dist/chunk-35NB2XZU.js';
3
3
  import '../../dist/chunk-XWL6SNVU.js';
@@ -1,7 +1,7 @@
1
1
  import { persistSync } from '../../dist/chunk-4LWKCEW3.js';
2
- import { attachIntrospectionStates, jsonRefinery, primitiveRefinery, discoverType, prettyJson } from '../../dist/chunk-KMBRCA5Q.js';
3
- import { StoreContext, useI, useO } from '../../dist/chunk-HEEVASKG.js';
4
- import { IMPLICIT, createStandaloneAtom, createAtomFamily, fromEntries, become, isJson, toEntries, JSON_DEFAULTS, findInStore, undo, redo, getState, stringifyJson } from '../../dist/chunk-RXQWAO26.js';
2
+ import { attachIntrospectionStates, jsonRefinery, primitiveRefinery, discoverType, prettyJson } from '../../dist/chunk-RGUNRT72.js';
3
+ import { StoreContext, useI, useO } from '../../dist/chunk-MENOYVPP.js';
4
+ import { IMPLICIT, createStandaloneAtom, createAtomFamily, fromEntries, become, isJson, toEntries, JSON_DEFAULTS, findInStore, undo, redo, getState, stringifyJson } from '../../dist/chunk-35NB2XZU.js';
5
5
  import '../../dist/chunk-XWL6SNVU.js';
6
6
  import { motion, spring, LayoutGroup } from 'motion/react';
7
7
  import { forwardRef, useRef, useState, useImperativeHandle, useLayoutEffect, createContext, useId, Component, useContext, Fragment as Fragment$1 } from 'react';
@@ -1396,74 +1396,86 @@ var AtomIODevtoolsInternal = () => {
1396
1396
  const devtoolsView = useO(devtoolsViewSelectionState);
1397
1397
  const devtoolsViewOptions = useO(devtoolsViewOptionsState);
1398
1398
  const mouseHasMoved = useRef(false);
1399
- return /* @__PURE__ */ jsxs(Fragment, { children: [
1400
- /* @__PURE__ */ jsx(
1401
- motion.span,
1402
- {
1403
- ref: constraintsRef,
1404
- "data-css": "atom_io_devtools_zone",
1405
- style: {
1406
- position: `fixed`,
1407
- top: 0,
1408
- left: 0,
1409
- right: 0,
1410
- bottom: 0,
1411
- pointerEvents: `none`
1412
- }
1413
- }
1414
- ),
1415
- /* @__PURE__ */ jsxs(
1416
- motion.main,
1417
- {
1418
- drag: true,
1419
- dragConstraints: constraintsRef,
1420
- "data-css": "atom_io_devtools",
1421
- transition: spring,
1422
- style: devtoolsAreOpen ? {} : {
1423
- backgroundColor: `#0000`,
1424
- borderColor: `#0000`,
1425
- maxHeight: 28,
1426
- maxWidth: 33
1427
- },
1428
- children: [
1429
- devtoolsAreOpen ? /* @__PURE__ */ jsxs(Fragment, { children: [
1430
- /* @__PURE__ */ jsxs(motion.header, { children: [
1431
- /* @__PURE__ */ jsx("h1", { children: "atom.io" }),
1432
- /* @__PURE__ */ jsx("nav", { children: devtoolsViewOptions.map((viewOption) => /* @__PURE__ */ jsx(
1399
+ return /* @__PURE__ */ jsxs(
1400
+ "span",
1401
+ {
1402
+ style: {
1403
+ position: `fixed`,
1404
+ top: 0,
1405
+ left: 0,
1406
+ right: 0,
1407
+ bottom: 0
1408
+ },
1409
+ children: [
1410
+ /* @__PURE__ */ jsx(
1411
+ motion.span,
1412
+ {
1413
+ ref: constraintsRef,
1414
+ "data-css": "atom_io_devtools_zone",
1415
+ style: {
1416
+ position: `fixed`,
1417
+ top: 0,
1418
+ left: 0,
1419
+ right: 0,
1420
+ bottom: 0,
1421
+ pointerEvents: `none`
1422
+ }
1423
+ }
1424
+ ),
1425
+ /* @__PURE__ */ jsxs(
1426
+ motion.main,
1427
+ {
1428
+ drag: true,
1429
+ dragConstraints: constraintsRef,
1430
+ "data-css": "atom_io_devtools",
1431
+ transition: spring,
1432
+ style: devtoolsAreOpen ? {} : {
1433
+ backgroundColor: `#0000`,
1434
+ borderColor: `#0000`,
1435
+ maxHeight: 28,
1436
+ maxWidth: 33
1437
+ },
1438
+ children: [
1439
+ devtoolsAreOpen ? /* @__PURE__ */ jsxs(Fragment, { children: [
1440
+ /* @__PURE__ */ jsxs(motion.header, { children: [
1441
+ /* @__PURE__ */ jsx("h1", { children: "atom.io" }),
1442
+ /* @__PURE__ */ jsx("nav", { children: devtoolsViewOptions.map((viewOption) => /* @__PURE__ */ jsx(
1443
+ "button",
1444
+ {
1445
+ type: "button",
1446
+ "data-testid": `view-${viewOption}`,
1447
+ className: viewOption === devtoolsView ? `active` : ``,
1448
+ onClick: () => {
1449
+ setDevtoolsView(viewOption);
1450
+ },
1451
+ disabled: viewOption === devtoolsView,
1452
+ children: viewOption
1453
+ },
1454
+ viewOption
1455
+ )) })
1456
+ ] }),
1457
+ /* @__PURE__ */ jsx(motion.main, { children: /* @__PURE__ */ jsx(LayoutGroup, { children: devtoolsView === `atoms` ? /* @__PURE__ */ jsx(StateIndex, { tokenIndex: atomIndex }) : devtoolsView === `selectors` ? /* @__PURE__ */ jsx(StateIndex, { tokenIndex: selectorIndex }) : devtoolsView === `transactions` ? /* @__PURE__ */ jsx(TransactionIndex, {}) : /* @__PURE__ */ jsx(TimelineIndex, {}) }) })
1458
+ ] }) : null,
1459
+ /* @__PURE__ */ jsx("footer", { children: /* @__PURE__ */ jsx(
1433
1460
  "button",
1434
1461
  {
1435
1462
  type: "button",
1436
- "data-testid": `view-${viewOption}`,
1437
- className: viewOption === devtoolsView ? `active` : ``,
1438
- onClick: () => {
1439
- setDevtoolsView(viewOption);
1463
+ onMouseDown: () => mouseHasMoved.current = false,
1464
+ onMouseMove: () => mouseHasMoved.current = true,
1465
+ onMouseUp: () => {
1466
+ if (!mouseHasMoved.current) {
1467
+ setDevtoolsAreOpen((open) => !open);
1468
+ }
1440
1469
  },
1441
- disabled: viewOption === devtoolsView,
1442
- children: viewOption
1443
- },
1444
- viewOption
1445
- )) })
1446
- ] }),
1447
- /* @__PURE__ */ jsx(motion.main, { children: /* @__PURE__ */ jsx(LayoutGroup, { children: devtoolsView === `atoms` ? /* @__PURE__ */ jsx(StateIndex, { tokenIndex: atomIndex }) : devtoolsView === `selectors` ? /* @__PURE__ */ jsx(StateIndex, { tokenIndex: selectorIndex }) : devtoolsView === `transactions` ? /* @__PURE__ */ jsx(TransactionIndex, {}) : /* @__PURE__ */ jsx(TimelineIndex, {}) }) })
1448
- ] }) : null,
1449
- /* @__PURE__ */ jsx("footer", { children: /* @__PURE__ */ jsx(
1450
- "button",
1451
- {
1452
- type: "button",
1453
- onMouseDown: () => mouseHasMoved.current = false,
1454
- onMouseMove: () => mouseHasMoved.current = true,
1455
- onMouseUp: () => {
1456
- if (!mouseHasMoved.current) {
1457
- setDevtoolsAreOpen((open) => !open);
1470
+ children: "\u{1F50D}"
1458
1471
  }
1459
- },
1460
- children: "\u{1F50D}"
1461
- }
1462
- ) })
1463
- ]
1464
- }
1465
- )
1466
- ] });
1472
+ ) })
1473
+ ]
1474
+ }
1475
+ )
1476
+ ]
1477
+ }
1478
+ );
1467
1479
  };
1468
1480
 
1469
1481
  export { AtomIODevtools, DEFAULT_JSON_EDITOR_COMPONENTS, DEFAULT_NUMBER_CONSTRAINTS, DefaultFallback, ElasticInput, ErrorBoundary, JsonEditor, NumberInput, SubEditors, TextInput, VALID_NON_NUMBERS, VALID_NON_NUMBER_INTERPRETATIONS, castToJson, clampInto, isDecimalInProgress, isValidNonNumber };
@@ -38,7 +38,15 @@ const AtomIODevtoolsInternal = (): React.ReactNode => {
38
38
  const mouseHasMoved = useRef(false)
39
39
 
40
40
  return (
41
- <>
41
+ <span
42
+ style={{
43
+ position: `fixed`,
44
+ top: 0,
45
+ left: 0,
46
+ right: 0,
47
+ bottom: 0,
48
+ }}
49
+ >
42
50
  <motion.span
43
51
  ref={constraintsRef}
44
52
  data-css="atom_io_devtools_zone"
@@ -118,6 +126,6 @@ const AtomIODevtoolsInternal = (): React.ReactNode => {
118
126
  </button>
119
127
  </footer>
120
128
  </motion.main>
121
- </>
129
+ </span>
122
130
  )
123
131
  }