atom.io 0.15.6 → 0.16.0

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 (134) hide show
  1. package/data/dist/index.cjs +20 -22
  2. package/data/dist/index.cjs.map +1 -1
  3. package/data/dist/index.d.ts +6 -6
  4. package/data/dist/index.js +21 -23
  5. package/data/dist/index.js.map +1 -1
  6. package/data/src/dict.ts +6 -7
  7. package/data/src/join.ts +23 -23
  8. package/data/src/struct-family.ts +2 -2
  9. package/data/src/struct.ts +4 -5
  10. package/dist/index.cjs +12 -5
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.ts +67 -60
  13. package/dist/index.js +13 -6
  14. package/dist/index.js.map +1 -1
  15. package/internal/dist/index.cjs +910 -887
  16. package/internal/dist/index.cjs.map +1 -1
  17. package/internal/dist/index.d.ts +157 -162
  18. package/internal/dist/index.js +482 -458
  19. package/internal/dist/index.js.map +1 -1
  20. package/internal/src/atom/create-regular-atom.ts +9 -12
  21. package/internal/src/atom/create-standalone-atom.ts +33 -0
  22. package/internal/src/atom/delete-atom.ts +5 -2
  23. package/internal/src/atom/index.ts +1 -16
  24. package/internal/src/atom/is-default.ts +0 -1
  25. package/internal/src/caching.ts +6 -3
  26. package/internal/src/families/create-atom-family.ts +11 -7
  27. package/internal/src/families/create-readonly-selector-family.ts +4 -3
  28. package/internal/src/families/create-regular-atom-family.ts +12 -27
  29. package/internal/src/families/create-selector-family.ts +13 -49
  30. package/internal/src/families/create-writable-selector-family.ts +51 -0
  31. package/internal/src/index.ts +44 -3
  32. package/internal/src/lineage.ts +0 -7
  33. package/internal/src/mutable/create-mutable-atom-family.ts +61 -15
  34. package/internal/src/mutable/create-mutable-atom.ts +70 -25
  35. package/internal/src/mutable/get-json-family.ts +4 -5
  36. package/internal/src/mutable/get-json-token.ts +6 -3
  37. package/internal/src/mutable/get-update-token.ts +3 -3
  38. package/internal/src/mutable/index.ts +1 -7
  39. package/internal/src/mutable/is-mutable.ts +6 -7
  40. package/internal/src/mutable/tracker-family.ts +4 -4
  41. package/internal/src/mutable/tracker.ts +6 -6
  42. package/internal/src/read-or-compute-value.ts +6 -3
  43. package/internal/src/selector/create-readonly-selector.ts +2 -3
  44. package/internal/src/selector/create-standalone-selector.ts +32 -0
  45. package/internal/src/selector/{create-read-write-selector.ts → create-writable-selector.ts} +12 -9
  46. package/internal/src/selector/delete-selector.ts +2 -2
  47. package/internal/src/selector/index.ts +3 -1
  48. package/internal/src/selector/trace-selector-atoms.ts +3 -2
  49. package/internal/src/selector/update-selector-atoms.ts +1 -1
  50. package/internal/src/set-state/copy-mutable-if-needed.ts +5 -6
  51. package/internal/src/set-state/copy-mutable-in-transaction.ts +4 -36
  52. package/internal/src/set-state/emit-update.ts +2 -3
  53. package/internal/src/set-state/evict-downstream.ts +1 -1
  54. package/internal/src/set-state/set-atom-or-selector.ts +3 -3
  55. package/internal/src/set-state/set-atom.ts +1 -2
  56. package/internal/src/set-state/stow-update.ts +1 -1
  57. package/internal/src/store/deposit.ts +25 -13
  58. package/internal/src/store/store.ts +21 -21
  59. package/internal/src/store/withdraw-new-family-member.ts +16 -9
  60. package/internal/src/store/withdraw.ts +43 -19
  61. package/internal/src/subscribe/recall-state.ts +2 -6
  62. package/internal/src/subscribe/subscribe-to-root-atoms.ts +39 -41
  63. package/internal/src/subscribe/subscribe-to-state.ts +3 -1
  64. package/internal/src/timeline/add-atom-to-timeline.ts +5 -5
  65. package/internal/src/timeline/create-timeline.ts +19 -22
  66. package/introspection/dist/index.cjs +4 -8
  67. package/introspection/dist/index.cjs.map +1 -1
  68. package/introspection/dist/index.d.ts +5 -5
  69. package/introspection/dist/index.js +5 -9
  70. package/introspection/dist/index.js.map +1 -1
  71. package/introspection/src/attach-atom-index.ts +4 -5
  72. package/introspection/src/attach-selector-index.ts +4 -5
  73. package/introspection/src/attach-timeline-index.ts +6 -3
  74. package/introspection/src/attach-transaction-index.ts +6 -3
  75. package/introspection/src/index.ts +9 -5
  76. package/json/dist/index.cjs +3 -4
  77. package/json/dist/index.cjs.map +1 -1
  78. package/json/dist/index.d.ts +4 -3
  79. package/json/dist/index.js +4 -5
  80. package/json/dist/index.js.map +1 -1
  81. package/json/src/select-json-family.ts +24 -4
  82. package/json/src/select-json.ts +3 -4
  83. package/package.json +2 -2
  84. package/react-devtools/dist/index.cjs.map +1 -1
  85. package/react-devtools/dist/index.d.ts +9 -9
  86. package/react-devtools/dist/index.js.map +1 -1
  87. package/react-devtools/src/StateIndex.tsx +18 -10
  88. package/react-devtools/src/TimelineIndex.tsx +6 -2
  89. package/react-devtools/src/TransactionIndex.tsx +2 -2
  90. package/realtime-client/dist/index.cjs +27 -13
  91. package/realtime-client/dist/index.cjs.map +1 -1
  92. package/realtime-client/dist/index.d.ts +6 -4
  93. package/realtime-client/dist/index.js +20 -7
  94. package/realtime-client/dist/index.js.map +1 -1
  95. package/realtime-client/src/index.ts +4 -3
  96. package/realtime-client/src/server-action.ts +2 -55
  97. package/realtime-client/src/sync-server-action.ts +75 -0
  98. package/realtime-react/dist/index.cjs +22 -13
  99. package/realtime-react/dist/index.cjs.map +1 -1
  100. package/realtime-react/dist/index.d.ts +3 -1
  101. package/realtime-react/dist/index.js +20 -12
  102. package/realtime-react/dist/index.js.map +1 -1
  103. package/realtime-react/src/index.ts +1 -0
  104. package/realtime-react/src/use-server-action.ts +2 -4
  105. package/realtime-react/src/use-sync-server-action.ts +19 -0
  106. package/realtime-server/dist/index.cjs +83 -81
  107. package/realtime-server/dist/index.cjs.map +1 -1
  108. package/realtime-server/dist/index.d.ts +8 -8
  109. package/realtime-server/dist/index.js +58 -56
  110. package/realtime-server/dist/index.js.map +1 -1
  111. package/realtime-server/src/index.ts +15 -1
  112. package/realtime-server/src/{hook-composition/receive-transaction.ts → realtime-action-receiver.ts} +6 -2
  113. package/realtime-server/src/{hook-composition/sync-transaction.ts → realtime-action-synchronizer.ts} +10 -43
  114. package/realtime-server/src/{hook-composition/expose-family.ts → realtime-family-provider.ts} +9 -23
  115. package/realtime-server/src/{hook-composition/expose-mutable-family.ts → realtime-mutable-family-provider.ts} +4 -4
  116. package/realtime-server/src/{hook-composition/expose-mutable.ts → realtime-mutable-provider.ts} +4 -5
  117. package/realtime-server/src/realtime-server-store.ts +39 -0
  118. package/realtime-server/src/{hook-composition/expose-single.ts → realtime-state-provider.ts} +7 -8
  119. package/realtime-server/src/{hook-composition/receive-state.ts → realtime-state-receiver.ts} +7 -4
  120. package/src/atom.ts +39 -24
  121. package/src/find-state.ts +20 -19
  122. package/src/index.ts +41 -28
  123. package/src/logger.ts +1 -0
  124. package/src/selector.ts +31 -16
  125. package/src/silo.ts +45 -6
  126. package/src/subscribe.ts +1 -0
  127. package/src/validators.ts +35 -25
  128. package/internal/src/atom/create-atom.ts +0 -21
  129. package/internal/src/mutable/get-update-family.ts +0 -23
  130. package/internal/src/selector/create-selector.ts +0 -65
  131. package/realtime-server/src/hook-composition/index.ts +0 -15
  132. /package/realtime-client/src/{pull.ts → pull-state.ts} +0 -0
  133. /package/realtime-client/src/{push.ts → push-state.ts} +0 -0
  134. /package/realtime-client/src/{realtime-state.ts → realtime-client-store.ts} +0 -0
@@ -1,23 +0,0 @@
1
- import type { AtomFamily, MutableAtomFamily } from "atom.io"
2
- import type { Json } from "atom.io/json"
3
-
4
- import { newest } from "../lineage"
5
- import type { Store } from "../store"
6
- import type { Signal, Transceiver } from "./transceiver"
7
-
8
- export const getUpdateFamily = <
9
- Core extends Transceiver<Json.Serializable>,
10
- SerializableCore extends Json.Serializable,
11
- Key extends string,
12
- >(
13
- mutableAtomFamily: MutableAtomFamily<Core, SerializableCore, Key>,
14
- store: Store,
15
- ): AtomFamily<Signal<Core> | null, Key> => {
16
- const target = newest(store)
17
- const key = `*${mutableAtomFamily.key}`
18
- const updateFamily = target.families.get(key) as AtomFamily<
19
- Signal<Core> | null,
20
- Key
21
- >
22
- return updateFamily
23
- }
@@ -1,65 +0,0 @@
1
- import type {
2
- FamilyMetadata,
3
- ReadonlySelectorOptions,
4
- ReadonlySelectorToken,
5
- SelectorOptions,
6
- SelectorToken,
7
- } from "atom.io"
8
-
9
- import { newest } from "../lineage"
10
- import type { Store } from "../store"
11
- import type { Subject } from "../subject"
12
- import { createReadWriteSelector } from "./create-read-write-selector"
13
- import { createReadonlySelector } from "./create-readonly-selector"
14
-
15
- export type Selector<T> = {
16
- key: string
17
- type: `selector`
18
- family?: FamilyMetadata
19
- install: (store: Store) => void
20
- subject: Subject<{ newValue: T; oldValue: T }>
21
- get: () => T
22
- set: (newValue: T | ((oldValue: T) => T)) => void
23
- }
24
- export type ReadonlySelector<T> = {
25
- key: string
26
- type: `readonly_selector`
27
- family?: FamilyMetadata
28
- install: (store: Store) => void
29
- subject: Subject<{ newValue: T; oldValue: T }>
30
- get: () => T
31
- }
32
-
33
- export function createSelector<T>(
34
- options: SelectorOptions<T>,
35
- family: FamilyMetadata | undefined,
36
- store: Store,
37
- ): SelectorToken<T>
38
- export function createSelector<T>(
39
- options: ReadonlySelectorOptions<T>,
40
- family: FamilyMetadata | undefined,
41
- store: Store,
42
- ): ReadonlySelectorToken<T>
43
- export function createSelector<T>(
44
- options: ReadonlySelectorOptions<T> | SelectorOptions<T>,
45
- family: FamilyMetadata | undefined,
46
- store: Store,
47
- ): ReadonlySelectorToken<T> | SelectorToken<T> {
48
- const target = newest(store)
49
- const existingWritable = target.selectors.get(options.key)
50
- const existingReadonly = target.readonlySelectors.get(options.key)
51
-
52
- if (existingWritable || existingReadonly) {
53
- store.logger.error(
54
- `❌`,
55
- existingReadonly ? `readonly_selector` : `selector`,
56
- options.key,
57
- `Tried to create selector, but it already exists in the store.`,
58
- )
59
- }
60
-
61
- if (`set` in options) {
62
- return createReadWriteSelector(options, family, store)
63
- }
64
- return createReadonlySelector(options, family, store)
65
- }
@@ -1,15 +0,0 @@
1
- import type { Store } from "atom.io/internal"
2
- import type * as SocketIO from "socket.io"
3
-
4
- export * from "./expose-single"
5
- export * from "./expose-family"
6
- export * from "./expose-mutable"
7
- export * from "./expose-mutable-family"
8
- export * from "./receive-state"
9
- export * from "./receive-transaction"
10
- export * from "./sync-transaction"
11
-
12
- export type ServerConfig = {
13
- socket: SocketIO.Socket
14
- store?: Store
15
- }
File without changes
File without changes