atom.io 0.13.0 → 0.14.1
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/data/dist/index.cjs +1473 -52
- package/data/dist/index.cjs.map +1 -1
- package/data/dist/index.d.cts +315 -16
- package/data/dist/index.js +10 -267
- package/data/dist/index.js.map +1 -1
- package/data/package.json +5 -5
- package/data/src/join.ts +3 -3
- package/dist/chunk-5VJ77LZE.js +176 -0
- package/dist/chunk-5VJ77LZE.js.map +1 -0
- package/dist/chunk-CK7GNCU5.js +309 -0
- package/dist/chunk-CK7GNCU5.js.map +1 -0
- package/dist/chunk-KW7RA7IM.js +67 -0
- package/dist/chunk-KW7RA7IM.js.map +1 -0
- package/dist/chunk-LFXB7Y6M.js +68 -0
- package/dist/chunk-LFXB7Y6M.js.map +1 -0
- package/dist/chunk-NYCVSXQB.js +181 -0
- package/dist/chunk-NYCVSXQB.js.map +1 -0
- package/dist/chunk-TE3ZSTQ6.js +2516 -0
- package/dist/chunk-TE3ZSTQ6.js.map +1 -0
- package/dist/index.cjs +2250 -126
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +272 -25
- package/dist/index.js +1 -215
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/internal/dist/index.cjs +885 -684
- package/internal/dist/index.cjs.map +1 -1
- package/internal/dist/index.d.cts +230 -24
- package/internal/dist/index.js +1 -2171
- package/internal/dist/index.js.map +1 -1
- package/internal/package.json +5 -5
- package/internal/src/atom/create-atom.ts +3 -2
- package/internal/src/mutable/create-mutable-atom.ts +3 -2
- package/internal/src/mutable/tracker.ts +6 -4
- package/internal/src/selector/register-selector.ts +1 -1
- package/internal/src/selector/update-selector-atoms.ts +3 -3
- package/internal/src/subscribe/index.ts +3 -0
- package/internal/src/subscribe/recall-state.ts +0 -6
- package/internal/src/subscribe/subscribe-to-state.ts +47 -0
- package/internal/src/subscribe/subscribe-to-timeline.ts +28 -0
- package/internal/src/subscribe/subscribe-to-transaction.ts +33 -0
- package/introspection/dist/index.cjs +1618 -46
- package/introspection/dist/index.cjs.map +1 -1
- package/introspection/dist/index.d.cts +374 -4
- package/introspection/dist/index.js +2 -316
- package/introspection/dist/index.js.map +1 -1
- package/introspection/package.json +5 -5
- package/json/dist/index.cjs +1560 -8
- package/json/dist/index.cjs.map +1 -1
- package/json/dist/index.d.cts +371 -7
- package/json/dist/index.js +1 -76
- package/json/dist/index.js.map +1 -1
- package/json/package.json +5 -5
- package/package.json +10 -9
- package/react/dist/index.cjs +1638 -10
- package/react/dist/index.cjs.map +1 -1
- package/react/dist/index.d.cts +383 -5
- package/react/dist/index.js +2 -31
- package/react/dist/index.js.map +1 -1
- package/react/package.json +5 -5
- package/react/src/store-hooks.ts +52 -3
- package/react-devtools/dist/index.cjs +2268 -198
- package/react-devtools/dist/index.cjs.map +1 -1
- package/react-devtools/dist/index.css +2 -2
- package/react-devtools/dist/index.d.cts +148 -24
- package/react-devtools/dist/index.js +57 -297
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/package.json +5 -5
- package/realtime-client/dist/index.cjs +1585 -34
- package/realtime-client/dist/index.cjs.map +1 -1
- package/realtime-client/dist/index.d.cts +382 -11
- package/realtime-client/dist/index.js +2 -164
- package/realtime-client/dist/index.js.map +1 -1
- package/realtime-client/package.json +5 -5
- package/realtime-client/src/use-push.ts +4 -4
- package/realtime-client/src/use-server-action.ts +4 -4
- package/realtime-react/dist/index.cjs +1782 -35
- package/realtime-react/dist/index.cjs.map +1 -1
- package/realtime-react/dist/index.d.cts +49 -9
- package/realtime-react/dist/index.js +4 -66
- package/realtime-react/dist/index.js.map +1 -1
- package/realtime-react/package.json +5 -5
- package/realtime-server/dist/index.cjs +1627 -60
- package/realtime-server/dist/index.cjs.map +1 -1
- package/realtime-server/dist/index.d.cts +391 -11
- package/realtime-server/dist/index.js +59 -32
- package/realtime-server/dist/index.js.map +1 -1
- package/realtime-server/package.json +6 -6
- package/realtime-server/src/hook-composition/expose-family.ts +7 -3
- package/realtime-server/src/hook-composition/expose-mutable-family.ts +13 -5
- package/realtime-server/src/hook-composition/expose-mutable.ts +11 -3
- package/realtime-server/src/hook-composition/expose-single.ts +6 -2
- package/realtime-server/src/hook-composition/receive-transaction.ts +14 -5
- package/realtime-testing/dist/index.cjs +2352 -16
- package/realtime-testing/dist/index.cjs.map +1 -1
- package/realtime-testing/dist/index.d.cts +486 -3
- package/realtime-testing/dist/index.js +10 -31
- package/realtime-testing/dist/index.js.map +1 -1
- package/realtime-testing/package.json +5 -5
- package/src/subscribe.ts +37 -91
- package/transceivers/set-rtx/dist/index.cjs +31 -10
- package/transceivers/set-rtx/dist/index.cjs.map +1 -1
- package/transceivers/set-rtx/dist/index.d.cts +29 -3
- package/transceivers/set-rtx/dist/index.js +2 -3
- package/transceivers/set-rtx/dist/index.js.map +1 -1
- package/transceivers/set-rtx/package.json +6 -6
- package/data/dist/index.d.ts +0 -158
- package/data/dist/metafile-cjs.json +0 -1
- package/data/dist/metafile-esm.json +0 -1
- package/dist/index.d.ts +0 -243
- package/dist/metafile-esm.json +0 -1
- package/internal/dist/index.d.ts +0 -414
- package/internal/dist/metafile-cjs.json +0 -1
- package/internal/dist/metafile-esm.json +0 -1
- package/introspection/dist/index.d.ts +0 -24
- package/introspection/dist/metafile-cjs.json +0 -1
- package/introspection/dist/metafile-esm.json +0 -1
- package/json/dist/index.d.ts +0 -51
- package/json/dist/metafile-cjs.json +0 -1
- package/json/dist/metafile-esm.json +0 -1
- package/react/dist/index.d.ts +0 -16
- package/react/dist/metafile-cjs.json +0 -1
- package/react/dist/metafile-esm.json +0 -1
- package/react-devtools/dist/index.d.ts +0 -341
- package/react-devtools/dist/metafile-cjs.json +0 -1
- package/react-devtools/dist/metafile-esm.json +0 -1
- package/realtime-client/dist/index.d.ts +0 -21
- package/realtime-client/dist/metafile-cjs.json +0 -1
- package/realtime-client/dist/metafile-esm.json +0 -1
- package/realtime-react/dist/index.d.ts +0 -27
- package/realtime-react/dist/metafile-cjs.json +0 -1
- package/realtime-react/dist/metafile-esm.json +0 -1
- package/realtime-server/dist/index.d.ts +0 -25
- package/realtime-server/dist/metafile-cjs.json +0 -1
- package/realtime-server/dist/metafile-esm.json +0 -1
- package/realtime-testing/dist/index.d.ts +0 -49
- package/realtime-testing/dist/metafile-cjs.json +0 -1
- package/realtime-testing/dist/metafile-esm.json +0 -1
- package/transceivers/set-rtx/dist/index.d.ts +0 -40
- package/transceivers/set-rtx/dist/metafile-cjs.json +0 -1
- package/transceivers/set-rtx/dist/metafile-esm.json +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TimelineToken, TimelineUpdate } from "atom.io"
|
|
2
|
+
import type { Store } from "atom.io/internal"
|
|
3
|
+
import { withdraw } from "atom.io/internal"
|
|
4
|
+
|
|
5
|
+
export const subscribeToTimeline = (
|
|
6
|
+
token: TimelineToken,
|
|
7
|
+
handleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void,
|
|
8
|
+
key: string,
|
|
9
|
+
store: Store,
|
|
10
|
+
): (() => void) => {
|
|
11
|
+
const tl = withdraw(token, store)
|
|
12
|
+
if (tl === undefined) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
`Cannot subscribe to timeline "${token.key}": timeline not found in store "${store.config.name}".`,
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
store.logger.info(`👀`, `timeline`, token.key, `Adding subscription "${key}"`)
|
|
18
|
+
const unsubscribe = tl.subject.subscribe(key, handleUpdate)
|
|
19
|
+
return () => {
|
|
20
|
+
store.logger.info(
|
|
21
|
+
`🙈`,
|
|
22
|
+
`timeline`,
|
|
23
|
+
token.key,
|
|
24
|
+
`Removing subscription "${key}" from timeline`,
|
|
25
|
+
)
|
|
26
|
+
unsubscribe()
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { TransactionToken, TransactionUpdateHandler, ƒn } from "atom.io"
|
|
2
|
+
import type { Store } from "atom.io/internal"
|
|
3
|
+
import { withdraw } from "atom.io/internal"
|
|
4
|
+
|
|
5
|
+
export const subscribeToTransaction = <ƒ extends ƒn>(
|
|
6
|
+
token: TransactionToken<ƒ>,
|
|
7
|
+
handleUpdate: TransactionUpdateHandler<ƒ>,
|
|
8
|
+
key: string,
|
|
9
|
+
store: Store,
|
|
10
|
+
): (() => void) => {
|
|
11
|
+
const tx = withdraw(token, store)
|
|
12
|
+
if (tx === undefined) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
`Cannot subscribe to transaction "${token.key}": transaction not found in store "${store.config.name}".`,
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
store.logger.info(
|
|
18
|
+
`👀`,
|
|
19
|
+
`transaction`,
|
|
20
|
+
token.key,
|
|
21
|
+
`Adding subscription "${key}"`,
|
|
22
|
+
)
|
|
23
|
+
const unsubscribe = tx.subject.subscribe(key, handleUpdate)
|
|
24
|
+
return () => {
|
|
25
|
+
store.logger.info(
|
|
26
|
+
`🙈`,
|
|
27
|
+
`transaction`,
|
|
28
|
+
token.key,
|
|
29
|
+
`Removing subscription "${key}"`,
|
|
30
|
+
)
|
|
31
|
+
unsubscribe()
|
|
32
|
+
}
|
|
33
|
+
}
|