atom.io 0.18.0 → 0.18.2
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/dist/chunk-3J2EGSBE.js +31 -0
- package/dist/chunk-3J2EGSBE.js.map +1 -0
- package/dist/chunk-A4ZCNKWQ.js +18 -0
- package/dist/chunk-A4ZCNKWQ.js.map +1 -0
- package/dist/{chunk-OEVFAUPE.js → chunk-IZHOMSXA.js} +53 -11
- package/dist/chunk-IZHOMSXA.js.map +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js.map +1 -1
- package/internal/dist/index.cjs +110 -134
- package/internal/dist/index.cjs.map +1 -1
- package/internal/dist/index.d.ts +24 -24
- package/internal/dist/index.js +110 -134
- package/internal/dist/index.js.map +1 -1
- package/internal/src/atom/delete-atom.ts +7 -6
- package/internal/src/caching.ts +6 -6
- package/internal/src/families/create-regular-atom-family.ts +4 -4
- package/internal/src/get-state/get-from-store.ts +2 -5
- package/internal/src/ingest-updates/ingest-atom-update.ts +6 -2
- package/internal/src/mutable/create-mutable-atom-family.ts +4 -4
- package/internal/src/selector/register-selector.ts +3 -14
- package/internal/src/set-state/copy-mutable-if-needed.ts +5 -0
- package/internal/src/set-state/emit-update.ts +25 -11
- package/internal/src/set-state/set-atom.ts +4 -3
- package/internal/src/set-state/set-into-store.ts +2 -5
- package/internal/src/store/withdraw-new-family-member.ts +38 -28
- package/internal/src/store/withdraw.ts +20 -23
- package/internal/src/subscribe/subscribe-to-state.ts +2 -3
- package/internal/src/subscribe/subscribe-to-timeline.ts +0 -5
- package/internal/src/subscribe/subscribe-to-transaction.ts +0 -5
- package/internal/src/timeline/add-atom-to-timeline.ts +6 -15
- package/internal/src/timeline/create-timeline.ts +0 -27
- package/internal/src/transaction/apply-transaction.ts +0 -1
- package/internal/src/transaction/set-epoch-number.ts +0 -1
- package/json/src/index.ts +3 -3
- package/package.json +242 -241
- package/react/dist/index.cjs +2 -3
- package/react/dist/index.cjs.map +1 -1
- package/react/dist/index.js +2 -3
- package/react/dist/index.js.map +1 -1
- package/react/src/use-tl.ts +2 -2
- package/react-devtools/dist/index.cjs +1 -1
- package/react-devtools/dist/index.cjs.map +1 -1
- package/react-devtools/dist/index.js +1 -15
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/src/StateEditor.tsx +6 -6
- package/react-devtools/src/StateIndex.tsx +2 -2
- package/react-devtools/src/Updates.tsx +1 -1
- package/react-devtools/src/index.ts +3 -3
- package/realtime/dist/index.cjs +50 -2
- package/realtime/dist/index.cjs.map +1 -1
- package/realtime/dist/index.d.ts +110 -3
- package/realtime/dist/index.js +47 -4
- package/realtime/dist/index.js.map +1 -1
- package/realtime/src/index.ts +1 -0
- package/realtime/src/realtime-continuity.ts +14 -4
- package/realtime/src/shared-room-store.ts +48 -0
- package/realtime-client/dist/index.cjs +113 -200
- package/realtime-client/dist/index.cjs.map +1 -1
- package/realtime-client/dist/index.d.ts +2 -5
- package/realtime-client/dist/index.js +22 -190
- package/realtime-client/dist/index.js.map +1 -1
- package/realtime-client/src/index.ts +0 -2
- package/realtime-client/src/pull-mutable-atom-family-member.ts +5 -5
- package/realtime-client/src/realtime-client-stores/client-main-store.ts +10 -0
- package/realtime-client/src/sync-continuity.ts +56 -9
- package/realtime-react/dist/index.cjs +51 -26
- package/realtime-react/dist/index.cjs.map +1 -1
- package/realtime-react/dist/index.d.ts +2 -6
- package/realtime-react/dist/index.js +2 -17
- package/realtime-react/dist/index.js.map +1 -1
- package/realtime-react/src/index.ts +0 -2
- package/realtime-server/dist/index.cjs +399 -327
- package/realtime-server/dist/index.cjs.map +1 -1
- package/realtime-server/dist/index.d.ts +55 -60
- package/realtime-server/dist/index.js +394 -319
- package/realtime-server/dist/index.js.map +1 -1
- package/realtime-server/src/index.ts +2 -4
- package/realtime-server/src/ipc-sockets/child-socket.ts +135 -0
- package/realtime-server/src/ipc-sockets/custom-socket.ts +90 -0
- package/realtime-server/src/ipc-sockets/index.ts +3 -0
- package/realtime-server/src/ipc-sockets/parent-socket.ts +186 -0
- package/realtime-server/src/realtime-continuity-synchronizer.ts +225 -96
- package/realtime-server/src/realtime-server-stores/index.ts +2 -1
- package/realtime-server/src/realtime-server-stores/realtime-continuity-store.ts +50 -31
- package/realtime-server/src/realtime-server-stores/server-room-external-actions.ts +64 -0
- package/realtime-server/src/realtime-server-stores/server-room-external-store.ts +42 -0
- package/realtime-server/src/realtime-server-stores/server-sync-store.ts +49 -26
- package/realtime-testing/dist/index.cjs +51 -11
- package/realtime-testing/dist/index.cjs.map +1 -1
- package/realtime-testing/dist/index.d.ts +1 -0
- package/realtime-testing/dist/index.js +11 -11
- package/realtime-testing/dist/index.js.map +1 -1
- package/realtime-testing/src/setup-realtime-test.tsx +11 -11
- package/src/logger.ts +5 -1
- package/dist/chunk-OEVFAUPE.js.map +0 -1
- package/realtime-client/src/sync-server-action.ts +0 -168
- package/realtime-client/src/sync-state.ts +0 -19
- package/realtime-react/src/use-sync-server-action.ts +0 -17
- package/realtime-react/src/use-sync.ts +0 -17
- package/realtime-server/src/ipc-socket.ts +0 -230
- package/realtime-server/src/realtime-action-synchronizer.ts +0 -164
- package/realtime-server/src/realtime-server-stores/server-room-store.ts +0 -97
package/package.json
CHANGED
|
@@ -1,242 +1,243 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
2
|
+
"name": "atom.io",
|
|
3
|
+
"version": "0.18.2",
|
|
4
|
+
"description": "Composable and testable reactive data library.",
|
|
5
|
+
"homepage": "https://atom.io.fyi",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"type": "module",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"author": "Jeremy Banka",
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/jeremybanka/wayforge.git",
|
|
16
|
+
"directory": "packages/atom.io"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"manifest": "tsx __scripts__/manifest-build.node",
|
|
20
|
+
"clean:build": "find . -type d -name 'dist' -not -path '*/node_modules/*' | xargs rm -rf",
|
|
21
|
+
"build": "bun run clean:build && concurrently \"npm:build:*\"",
|
|
22
|
+
"build:main": "tsup",
|
|
23
|
+
"build:types": "tsup --dts",
|
|
24
|
+
"build:data": "cd data && tsup",
|
|
25
|
+
"build:internal": "cd internal && tsup",
|
|
26
|
+
"build:introspection": "cd introspection && tsup",
|
|
27
|
+
"build:json": "cd json && tsup",
|
|
28
|
+
"build:react": "cd react && tsup",
|
|
29
|
+
"build:react-devtools": "cd react-devtools && tsup",
|
|
30
|
+
"build:realtime": "cd realtime && tsup",
|
|
31
|
+
"build:realtime-client": "cd realtime-client && tsup",
|
|
32
|
+
"build:realtime-react": "cd realtime-react && tsup",
|
|
33
|
+
"build:realtime-server": "cd realtime-server && tsup",
|
|
34
|
+
"build:realtime-testing": "cd realtime-testing && tsup",
|
|
35
|
+
"build:transceivers:set-rtx": "cd transceivers/set-rtx && tsup",
|
|
36
|
+
"lint:biome": "biome check --diagnostic-level=warn -- .",
|
|
37
|
+
"lint:eslint": "eslint .",
|
|
38
|
+
"lint": "bun run lint:biome && bun run lint:eslint",
|
|
39
|
+
"test": "vitest",
|
|
40
|
+
"test:coverage": "vitest run --coverage",
|
|
41
|
+
"test:once": "bun run test:manifest && cross-env IMPORT=dist vitest run",
|
|
42
|
+
"test:once:public": "cross-env IMPORT=dist vitest run public",
|
|
43
|
+
"test:manifest": "tsx __scripts__/manifest-test.node"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@floating-ui/react": ">=0.25.0",
|
|
47
|
+
"@floating-ui/react-dom": ">=2.0.0",
|
|
48
|
+
"@testing-library/react": ">=14.0.0",
|
|
49
|
+
"framer-motion": ">=10.0.0",
|
|
50
|
+
"react": ">=18.0.0",
|
|
51
|
+
"socket.io": ">=4.0.0",
|
|
52
|
+
"socket.io-client": ">=4.0.0"
|
|
53
|
+
},
|
|
54
|
+
"peerDependenciesMeta": {
|
|
55
|
+
"@testing-library/react": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"react": {
|
|
59
|
+
"optional": true
|
|
60
|
+
},
|
|
61
|
+
"@floating-ui/react": {
|
|
62
|
+
"optional": true
|
|
63
|
+
},
|
|
64
|
+
"@floating-ui/react-dom": {
|
|
65
|
+
"optional": true
|
|
66
|
+
},
|
|
67
|
+
"framer-motion": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"socket.io": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"socket.io-client": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@testing-library/react": "14.2.1",
|
|
79
|
+
"@types/http-proxy": "1.17.14",
|
|
80
|
+
"@types/npmlog": "7.0.0",
|
|
81
|
+
"@types/react": "18.2.61",
|
|
82
|
+
"@types/tmp": "0.2.6",
|
|
83
|
+
"@vitest/coverage-v8": "1.3.1",
|
|
84
|
+
"@vitest/ui": "1.3.1",
|
|
85
|
+
"concurrently": "8.2.2",
|
|
86
|
+
"drizzle-kit": "0.20.14",
|
|
87
|
+
"drizzle-orm": "0.29.4",
|
|
88
|
+
"eslint": "8.57.0",
|
|
89
|
+
"framer-motion": "11.0.8",
|
|
90
|
+
"happy-dom": "13.6.2",
|
|
91
|
+
"http-proxy": "1.18.1",
|
|
92
|
+
"npmlog": "7.0.1",
|
|
93
|
+
"postgres": "3.4.3",
|
|
94
|
+
"preact": "10.19.6",
|
|
95
|
+
"react": "18.2.0",
|
|
96
|
+
"react-dom": "18.2.0",
|
|
97
|
+
"react-router-dom": "6.22.2",
|
|
98
|
+
"socket.io": "4.7.4",
|
|
99
|
+
"socket.io-client": "4.7.4",
|
|
100
|
+
"tmp": "0.2.3",
|
|
101
|
+
"tsup": "8.0.2",
|
|
102
|
+
"typescript": "5.3.3",
|
|
103
|
+
"vite": "5.1.4",
|
|
104
|
+
"vite-tsconfig-paths": "4.3.1",
|
|
105
|
+
"vitest": "1.3.1"
|
|
106
|
+
},
|
|
107
|
+
"main": "dist/index.js",
|
|
108
|
+
"types": "dist/index.d.ts",
|
|
109
|
+
"module": "dist/index.mjs",
|
|
110
|
+
"files": [
|
|
111
|
+
"dist",
|
|
112
|
+
"src",
|
|
113
|
+
"data/dist",
|
|
114
|
+
"data/package.json",
|
|
115
|
+
"data/src",
|
|
116
|
+
"internal/dist",
|
|
117
|
+
"internal/package.json",
|
|
118
|
+
"internal/src",
|
|
119
|
+
"introspection/dist",
|
|
120
|
+
"introspection/package.json",
|
|
121
|
+
"introspection/src",
|
|
122
|
+
"json/dist",
|
|
123
|
+
"json/package.json",
|
|
124
|
+
"json/src",
|
|
125
|
+
"react/dist",
|
|
126
|
+
"react/package.json",
|
|
127
|
+
"react/src",
|
|
128
|
+
"react-devtools/dist",
|
|
129
|
+
"react-devtools/package.json",
|
|
130
|
+
"react-devtools/src",
|
|
131
|
+
"realtime/dist",
|
|
132
|
+
"realtime/package.json",
|
|
133
|
+
"realtime/src",
|
|
134
|
+
"realtime-client/dist",
|
|
135
|
+
"realtime-client/package.json",
|
|
136
|
+
"realtime-client/src",
|
|
137
|
+
"realtime-react/dist",
|
|
138
|
+
"realtime-react/package.json",
|
|
139
|
+
"realtime-react/src",
|
|
140
|
+
"realtime-server/dist",
|
|
141
|
+
"realtime-server/package.json",
|
|
142
|
+
"realtime-server/src",
|
|
143
|
+
"realtime-testing/dist",
|
|
144
|
+
"realtime-testing/package.json",
|
|
145
|
+
"realtime-testing/src",
|
|
146
|
+
"transceivers/set-rtx/dist",
|
|
147
|
+
"transceivers/set-rtx/package.json",
|
|
148
|
+
"transceivers/set-rtx/src"
|
|
149
|
+
],
|
|
150
|
+
"exports": {
|
|
151
|
+
"./package.json": "./package.json",
|
|
152
|
+
".": {
|
|
153
|
+
"types": "./dist/index.d.ts",
|
|
154
|
+
"browser": "./dist/index.js",
|
|
155
|
+
"import": "./dist/index.js",
|
|
156
|
+
"require": "./dist/index.cjs"
|
|
157
|
+
},
|
|
158
|
+
"./data/package.json": "./data/package.json",
|
|
159
|
+
"./data": {
|
|
160
|
+
"types": "./data/dist/index.d.ts",
|
|
161
|
+
"browser": "./data/dist/index.js",
|
|
162
|
+
"import": "./data/dist/index.js",
|
|
163
|
+
"require": "./data/dist/index.cjs"
|
|
164
|
+
},
|
|
165
|
+
"./internal/package.json": "./internal/package.json",
|
|
166
|
+
"./internal": {
|
|
167
|
+
"types": "./internal/dist/index.d.ts",
|
|
168
|
+
"browser": "./internal/dist/index.js",
|
|
169
|
+
"import": "./internal/dist/index.js",
|
|
170
|
+
"require": "./internal/dist/index.cjs"
|
|
171
|
+
},
|
|
172
|
+
"./introspection/package.json": "./introspection/package.json",
|
|
173
|
+
"./introspection": {
|
|
174
|
+
"types": "./introspection/dist/index.d.ts",
|
|
175
|
+
"browser": "./introspection/dist/index.js",
|
|
176
|
+
"import": "./introspection/dist/index.js",
|
|
177
|
+
"require": "./introspection/dist/index.cjs"
|
|
178
|
+
},
|
|
179
|
+
"./json/package.json": "./json/package.json",
|
|
180
|
+
"./json": {
|
|
181
|
+
"types": "./json/dist/index.d.ts",
|
|
182
|
+
"browser": "./json/dist/index.js",
|
|
183
|
+
"import": "./json/dist/index.js",
|
|
184
|
+
"require": "./json/dist/index.cjs"
|
|
185
|
+
},
|
|
186
|
+
"./react/package.json": "./react/package.json",
|
|
187
|
+
"./react": {
|
|
188
|
+
"types": "./react/dist/index.d.ts",
|
|
189
|
+
"browser": "./react/dist/index.js",
|
|
190
|
+
"import": "./react/dist/index.js",
|
|
191
|
+
"require": "./react/dist/index.cjs"
|
|
192
|
+
},
|
|
193
|
+
"./react-devtools/package.json": "./react-devtools/package.json",
|
|
194
|
+
"./react-devtools": {
|
|
195
|
+
"types": "./react-devtools/dist/index.d.ts",
|
|
196
|
+
"browser": "./react-devtools/dist/index.js",
|
|
197
|
+
"import": "./react-devtools/dist/index.js",
|
|
198
|
+
"require": "./react-devtools/dist/index.cjs"
|
|
199
|
+
},
|
|
200
|
+
"./realtime/package.json": "./realtime/package.json",
|
|
201
|
+
"./realtime": {
|
|
202
|
+
"types": "./realtime/dist/index.d.ts",
|
|
203
|
+
"browser": "./realtime/dist/index.js",
|
|
204
|
+
"import": "./realtime/dist/index.js",
|
|
205
|
+
"require": "./realtime/dist/index.cjs"
|
|
206
|
+
},
|
|
207
|
+
"./realtime-client/package.json": "./realtime-client/package.json",
|
|
208
|
+
"./realtime-client": {
|
|
209
|
+
"types": "./realtime-client/dist/index.d.ts",
|
|
210
|
+
"browser": "./realtime-client/dist/index.js",
|
|
211
|
+
"import": "./realtime-client/dist/index.js",
|
|
212
|
+
"require": "./realtime-client/dist/index.cjs"
|
|
213
|
+
},
|
|
214
|
+
"./realtime-react/package.json": "./realtime-react/package.json",
|
|
215
|
+
"./realtime-react": {
|
|
216
|
+
"types": "./realtime-react/dist/index.d.ts",
|
|
217
|
+
"browser": "./realtime-react/dist/index.js",
|
|
218
|
+
"import": "./realtime-react/dist/index.js",
|
|
219
|
+
"require": "./realtime-react/dist/index.cjs"
|
|
220
|
+
},
|
|
221
|
+
"./realtime-server/package.json": "./realtime-server/package.json",
|
|
222
|
+
"./realtime-server": {
|
|
223
|
+
"types": "./realtime-server/dist/index.d.ts",
|
|
224
|
+
"browser": "./realtime-server/dist/index.js",
|
|
225
|
+
"import": "./realtime-server/dist/index.js",
|
|
226
|
+
"require": "./realtime-server/dist/index.cjs"
|
|
227
|
+
},
|
|
228
|
+
"./realtime-testing/package.json": "./realtime-testing/package.json",
|
|
229
|
+
"./realtime-testing": {
|
|
230
|
+
"types": "./realtime-testing/dist/index.d.ts",
|
|
231
|
+
"browser": "./realtime-testing/dist/index.js",
|
|
232
|
+
"import": "./realtime-testing/dist/index.js",
|
|
233
|
+
"require": "./realtime-testing/dist/index.cjs"
|
|
234
|
+
},
|
|
235
|
+
"./transceivers/set-rtx/package.json": "./transceivers/set-rtx/package.json",
|
|
236
|
+
"./transceivers/set-rtx": {
|
|
237
|
+
"types": "./transceivers/set-rtx/dist/index.d.ts",
|
|
238
|
+
"browser": "./transceivers/set-rtx/dist/index.js",
|
|
239
|
+
"import": "./transceivers/set-rtx/dist/index.js",
|
|
240
|
+
"require": "./transceivers/set-rtx/dist/index.cjs"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
package/react/dist/index.cjs
CHANGED
|
@@ -61,10 +61,9 @@ function useTL(token) {
|
|
|
61
61
|
const timeline = internal.withdraw(token, store);
|
|
62
62
|
const tokenRef = React5__namespace.useRef(token);
|
|
63
63
|
const rebuildMeta = () => {
|
|
64
|
-
var _a, _b;
|
|
65
64
|
return {
|
|
66
|
-
at:
|
|
67
|
-
length:
|
|
65
|
+
at: timeline.at,
|
|
66
|
+
length: timeline.history.length,
|
|
68
67
|
undo: () => atom_io.undo(token),
|
|
69
68
|
redo: () => atom_io.redo(token)
|
|
70
69
|
};
|
package/react/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/store-context.tsx","../src/use-i.ts","../src/use-json.ts","../src/use-o.ts","../src/use-tl.ts"],"names":["React","findIn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KAAK,SAAS;AACtB;;;AErCA,SAAS,MAAM,YAAY;AAE3B,SAAS,qBAAqB,gBAAgB;AAC9C,YAAYD,YAAW;AAWhB,SAAS,MAAM,OAAyC;AAC9D,QAAM,QAAc,kBAAW,YAAY;AAC3C,QAAM,KAAW,aAAM;AACvB,QAAM,WAAW,SAAS,OAAO,KAAK;AACtC,QAAM,WAAiB,cAAO,KAAK;AACnC,QAAM,cAAc,MAAM;
|
|
1
|
+
{"version":3,"sources":["../src/store-context.tsx","../src/use-i.ts","../src/use-json.ts","../src/use-o.ts","../src/use-tl.ts"],"names":["React","findInStore"],"mappings":";AACA,SAAS,gBAAgB;AACzB,YAAY,WAAW;AAQtB;AANM,IAAM,eAAqB,oBAAqB,SAAS,KAAK;AAE9D,IAAM,gBAGR,CAAC,EAAE,UAAU,QAAQ,SAAS,MAAM,MACxC,oBAAC,aAAa,UAAb,EAAsB,OAAO,OAAQ,UAAS;;;ACThD,SAAS,aAAa,oBAAoB;AAE1C,YAAYA,YAAW;AAahB,SAAS,KACf,OACA,KACyD;AACzD,QAAM,QAAc,kBAAW,YAAY;AAC3C,QAAM,aACL,MAAM,SAAS,iBACf,MAAM,SAAS,yBACf,MAAM,SAAS,oBACZ,YAAY,OAAO,KAAU,KAAK,IAClC;AACJ,QAAM,SAEI,cAAO,IAAI;AACrB,MAAI,OAAO,YAAY,MAAM;AAC5B,WAAO,UAAU,CAAC,SAAS,aAAa,YAAY,MAAM,KAAK;AAAA,EAChE;AACA,SAAO,OAAO;AACf;;;AC7BA,SAAS,eAAAC,cAAa,oBAAoB;AAE1C,YAAYD,YAAW;;;ACNvB,SAAS,eAAAC,cAAa,cAAc,wBAAwB;AAE5D,YAAYD,YAAW;AAWhB,SAAS,KACf,OACA,KACI;AACJ,QAAM,QAAc,kBAAW,YAAY;AAC3C,QAAM,aACL,MAAM,SAAS,iBACf,MAAM,SAAS,yBACf,MAAM,SAAS,qBACf,MAAM,SAAS,6BACZC,aAAY,OAAO,KAAU,KAAK,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* as React from \"react\"\n\nexport const StoreContext = React.createContext<Store>(IMPLICIT.STORE)\n\nexport const StoreProvider: React.FC<{\n\tchildren: React.ReactNode\n\tstore?: Store\n}> = ({ children, store = IMPLICIT.STORE }) => (\n\t<StoreContext.Provider value={store}>{children}</StoreContext.Provider>\n)\n","import type { ReadableToken, WritableFamilyToken, WritableToken } from \"atom.io\"\nimport { findInStore, setIntoStore } from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\nimport * as React from \"react\"\n\nimport { StoreContext } from \"./store-context\"\n\nexport function useI<T>(\n\ttoken: WritableToken<T>,\n): <New extends T>(next: New | ((old: T) => New)) => void\n\nexport function useI<T, K extends Json.Serializable>(\n\ttoken: WritableFamilyToken<T, K>,\n\tkey: K,\n): <New extends T>(next: New | ((old: T) => New)) => void\n\nexport function useI<T, K extends Json.Serializable>(\n\ttoken: WritableFamilyToken<T, K> | WritableToken<T>,\n\tkey?: K,\n): <New extends T>(next: New | ((old: T) => New)) => void {\n\tconst store = React.useContext(StoreContext)\n\tconst stateToken: ReadableToken<any> =\n\t\ttoken.type === `atom_family` ||\n\t\ttoken.type === `mutable_atom_family` ||\n\t\ttoken.type === `selector_family`\n\t\t\t? findInStore(token, key as K, store)\n\t\t\t: token\n\tconst setter: React.MutableRefObject<\n\t\t(<New extends T>(next: New | ((old: T) => New)) => void) | null\n\t> = React.useRef(null)\n\tif (setter.current === null) {\n\t\tsetter.current = (next) => setIntoStore(stateToken, next, store)\n\t}\n\treturn setter.current\n}\n","import type {\n\tMutableAtomFamilyToken,\n\tMutableAtomToken,\n\tReadableToken,\n} from \"atom.io\"\nimport { findInStore, getJsonToken } from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\nimport * as React from \"react\"\n\nimport { StoreContext } from \"./store-context\"\nimport { useO } from \"./use-o\"\n\nexport function useJSON<Serializable extends Json.Serializable>(\n\ttoken: MutableAtomToken<any, Serializable>,\n): Serializable\n\nexport function useJSON<\n\tSerializable extends Json.Serializable,\n\tKey extends Json.Serializable,\n>(token: MutableAtomFamilyToken<any, Serializable, Key>, key: Key): Serializable\n\nexport function useJSON<\n\tSerializable extends Json.Serializable,\n\tKey extends Serializable,\n>(\n\ttoken:\n\t\t| MutableAtomFamilyToken<any, Serializable, Key>\n\t\t| MutableAtomToken<any, Serializable>,\n\tkey?: Key,\n): Serializable {\n\tconst store = React.useContext(StoreContext)\n\tconst stateToken: ReadableToken<any> =\n\t\ttoken.type === `mutable_atom_family`\n\t\t\t? findInStore(token, key as Key, store)\n\t\t\t: token\n\tconst jsonToken = getJsonToken(stateToken)\n\treturn useO(jsonToken)\n}\n","import type { ReadableFamilyToken, ReadableToken } from \"atom.io\"\nimport { findInStore, getFromStore, subscribeToState } from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\nimport * as React from \"react\"\n\nimport { StoreContext } from \"./store-context\"\n\nexport function useO<T>(token: ReadableToken<T>): T\n\nexport function useO<T, K extends Json.Serializable>(\n\ttoken: ReadableFamilyToken<T, K>,\n\tkey: K,\n): T\n\nexport function useO<T, K extends Json.Serializable>(\n\ttoken: ReadableFamilyToken<T, K> | ReadableToken<T>,\n\tkey?: K,\n): T {\n\tconst store = React.useContext(StoreContext)\n\tconst stateToken: ReadableToken<any> =\n\t\ttoken.type === `atom_family` ||\n\t\ttoken.type === `mutable_atom_family` ||\n\t\ttoken.type === `selector_family` ||\n\t\ttoken.type === `readonly_selector_family`\n\t\t\t? findInStore(token, key as K, store)\n\t\t\t: token\n\tconst id = React.useId()\n\treturn React.useSyncExternalStore<T>(\n\t\t(dispatch) => subscribeToState(stateToken, dispatch, `use-o:${id}`, store),\n\t\t() => getFromStore(stateToken, store),\n\t\t() => getFromStore(stateToken, store),\n\t)\n}\n","import { redo, undo } from \"atom.io\"\nimport type { TimelineToken } from \"atom.io\"\nimport { subscribeToTimeline, withdraw } from \"atom.io/internal\"\nimport * as React from \"react\"\n\nimport { StoreContext } from \"./store-context\"\n\nexport type TimelineMeta = {\n\tat: number\n\tlength: number\n\tundo: () => void\n\tredo: () => void\n}\n\nexport function useTL(token: TimelineToken<any>): TimelineMeta {\n\tconst store = React.useContext(StoreContext)\n\tconst id = React.useId()\n\tconst timeline = withdraw(token, store)\n\tconst tokenRef = React.useRef(token)\n\tconst rebuildMeta = () => {\n\t\treturn {\n\t\t\tat: timeline.at,\n\t\t\tlength: timeline.history.length,\n\t\t\tundo: () => undo(token),\n\t\t\tredo: () => redo(token),\n\t\t}\n\t}\n\tconst meta = React.useRef<TimelineMeta>(rebuildMeta())\n\tconst retrieve = () => {\n\t\tif (\n\t\t\tmeta.current.at !== timeline?.at ||\n\t\t\tmeta.current.length !== timeline?.history.length ||\n\t\t\ttokenRef.current !== token\n\t\t) {\n\t\t\ttokenRef.current = token\n\t\t\tmeta.current = rebuildMeta()\n\t\t}\n\t\treturn meta.current\n\t}\n\treturn React.useSyncExternalStore<TimelineMeta>(\n\t\t(dispatch) => subscribeToTimeline(token, dispatch, `use-tl:${id}`, store),\n\t\tretrieve,\n\t\tretrieve,\n\t)\n}\n"]}
|
package/react/dist/index.js
CHANGED
|
@@ -39,10 +39,9 @@ function useTL(token) {
|
|
|
39
39
|
const timeline = withdraw(token, store);
|
|
40
40
|
const tokenRef = React5.useRef(token);
|
|
41
41
|
const rebuildMeta = () => {
|
|
42
|
-
var _a, _b;
|
|
43
42
|
return {
|
|
44
|
-
at:
|
|
45
|
-
length:
|
|
43
|
+
at: timeline.at,
|
|
44
|
+
length: timeline.history.length,
|
|
46
45
|
undo: () => undo(token),
|
|
47
46
|
redo: () => redo(token)
|
|
48
47
|
};
|
package/react/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/store-context.tsx","../src/use-i.ts","../src/use-json.ts","../src/use-o.ts","../src/use-tl.ts"],"names":["React","findInStore"],"mappings":";;;AACA,SAAS,gBAAgB;AACzB,YAAY,WAAW;AAQtB;AANM,IAAM,eAAqB,oBAAqB,SAAS,KAAK;AAE9D,IAAM,gBAG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,OAAyC;AAC9D,QAAM,QAAc,kBAAW,YAAY;AAC3C,QAAM,KAAW,aAAM;AACvB,QAAM,WAAW,SAAS,OAAO,KAAK;AACtC,QAAM,WAAiB,cAAO,KAAK;AACnC,QAAM,cAAc,MAAM;
|
|
1
|
+
{"version":3,"sources":["../src/store-context.tsx","../src/use-i.ts","../src/use-json.ts","../src/use-o.ts","../src/use-tl.ts"],"names":["React","findInStore"],"mappings":";;;AACA,SAAS,gBAAgB;AACzB,YAAY,WAAW;AAQtB;AANM,IAAM,eAAqB,oBAAqB,SAAS,KAAK;AAE9D,IAAM,gBAGR,CAAC,EAAE,UAAU,QAAQ,SAAS,MAAM,MACxC,oBAAC,aAAa,UAAb,EAAsB,OAAO,OAAQ,UAAS;;;ACThD,SAAS,aAAa,oBAAoB;AAE1C,YAAYA,YAAW;AAahB,SAAS,KACf,OACA,KACyD;AACzD,QAAM,QAAc,kBAAW,YAAY;AAC3C,QAAM,aACL,MAAM,SAAS,iBACf,MAAM,SAAS,yBACf,MAAM,SAAS,oBACZ,YAAY,OAAO,KAAU,KAAK,IAClC;AACJ,QAAM,SAEI,cAAO,IAAI;AACrB,MAAI,OAAO,YAAY,MAAM;AAC5B,WAAO,UAAU,CAAC,SAAS,aAAa,YAAY,MAAM,KAAK;AAAA,EAChE;AACA,SAAO,OAAO;AACf;;;AC7BA,SAAS,eAAAC,cAAa,oBAAoB;AAE1C,YAAYD,YAAW;;;ACNvB,SAAS,eAAAC,cAAa,cAAc,wBAAwB;AAE5D,YAAYD,YAAW;AAWhB,SAAS,KACf,OACA,KACI;AACJ,QAAM,QAAc,kBAAW,YAAY;AAC3C,QAAM,aACL,MAAM,SAAS,iBACf,MAAM,SAAS,yBACf,MAAM,SAAS,qBACf,MAAM,SAAS,6BACZC,aAAY,OAAO,KAAU,KAAK,IAClC;AACJ,QAAM,KAAW,aAAM;AACvB,SAAa;AAAA,IACZ,CAAC,aAAa,iBAAiB,YAAY,UAAU,SAAS,EAAE,IAAI,KAAK;AAAA,IACzE,MAAM,aAAa,YAAY,KAAK;AAAA,IACpC,MAAM,aAAa,YAAY,KAAK;AAAA,EACrC;AACD;;;ADXO,SAAS,QAIf,OAGA,KACe;AACf,QAAM,QAAc,kBAAW,YAAY;AAC3C,QAAM,aACL,MAAM,SAAS,wBACZA,aAAY,OAAO,KAAY,KAAK,IACpC;AACJ,QAAM,YAAY,aAAa,UAAU;AACzC,SAAO,KAAK,SAAS;AACtB;;;AErCA,SAAS,MAAM,YAAY;AAE3B,SAAS,qBAAqB,gBAAgB;AAC9C,YAAYD,YAAW;AAWhB,SAAS,MAAM,OAAyC;AAC9D,QAAM,QAAc,kBAAW,YAAY;AAC3C,QAAM,KAAW,aAAM;AACvB,QAAM,WAAW,SAAS,OAAO,KAAK;AACtC,QAAM,WAAiB,cAAO,KAAK;AACnC,QAAM,cAAc,MAAM;AACzB,WAAO;AAAA,MACN,IAAI,SAAS;AAAA,MACb,QAAQ,SAAS,QAAQ;AAAA,MACzB,MAAM,MAAM,KAAK,KAAK;AAAA,MACtB,MAAM,MAAM,KAAK,KAAK;AAAA,IACvB;AAAA,EACD;AACA,QAAM,OAAa,cAAqB,YAAY,CAAC;AACrD,QAAM,WAAW,MAAM;AACtB,QACC,KAAK,QAAQ,QAAO,qCAAU,OAC9B,KAAK,QAAQ,YAAW,qCAAU,QAAQ,WAC1C,SAAS,YAAY,OACpB;AACD,eAAS,UAAU;AACnB,WAAK,UAAU,YAAY;AAAA,IAC5B;AACA,WAAO,KAAK;AAAA,EACb;AACA,SAAa;AAAA,IACZ,CAAC,aAAa,oBAAoB,OAAO,UAAU,UAAU,EAAE,IAAI,KAAK;AAAA,IACxE;AAAA,IACA;AAAA,EACD;AACD","sourcesContent":["import type { Store } from \"atom.io/internal\"\nimport { IMPLICIT } from \"atom.io/internal\"\nimport * as React from \"react\"\n\nexport const StoreContext = React.createContext<Store>(IMPLICIT.STORE)\n\nexport const StoreProvider: React.FC<{\n\tchildren: React.ReactNode\n\tstore?: Store\n}> = ({ children, store = IMPLICIT.STORE }) => (\n\t<StoreContext.Provider value={store}>{children}</StoreContext.Provider>\n)\n","import type { ReadableToken, WritableFamilyToken, WritableToken } from \"atom.io\"\nimport { findInStore, setIntoStore } from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\nimport * as React from \"react\"\n\nimport { StoreContext } from \"./store-context\"\n\nexport function useI<T>(\n\ttoken: WritableToken<T>,\n): <New extends T>(next: New | ((old: T) => New)) => void\n\nexport function useI<T, K extends Json.Serializable>(\n\ttoken: WritableFamilyToken<T, K>,\n\tkey: K,\n): <New extends T>(next: New | ((old: T) => New)) => void\n\nexport function useI<T, K extends Json.Serializable>(\n\ttoken: WritableFamilyToken<T, K> | WritableToken<T>,\n\tkey?: K,\n): <New extends T>(next: New | ((old: T) => New)) => void {\n\tconst store = React.useContext(StoreContext)\n\tconst stateToken: ReadableToken<any> =\n\t\ttoken.type === `atom_family` ||\n\t\ttoken.type === `mutable_atom_family` ||\n\t\ttoken.type === `selector_family`\n\t\t\t? findInStore(token, key as K, store)\n\t\t\t: token\n\tconst setter: React.MutableRefObject<\n\t\t(<New extends T>(next: New | ((old: T) => New)) => void) | null\n\t> = React.useRef(null)\n\tif (setter.current === null) {\n\t\tsetter.current = (next) => setIntoStore(stateToken, next, store)\n\t}\n\treturn setter.current\n}\n","import type {\n\tMutableAtomFamilyToken,\n\tMutableAtomToken,\n\tReadableToken,\n} from \"atom.io\"\nimport { findInStore, getJsonToken } from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\nimport * as React from \"react\"\n\nimport { StoreContext } from \"./store-context\"\nimport { useO } from \"./use-o\"\n\nexport function useJSON<Serializable extends Json.Serializable>(\n\ttoken: MutableAtomToken<any, Serializable>,\n): Serializable\n\nexport function useJSON<\n\tSerializable extends Json.Serializable,\n\tKey extends Json.Serializable,\n>(token: MutableAtomFamilyToken<any, Serializable, Key>, key: Key): Serializable\n\nexport function useJSON<\n\tSerializable extends Json.Serializable,\n\tKey extends Serializable,\n>(\n\ttoken:\n\t\t| MutableAtomFamilyToken<any, Serializable, Key>\n\t\t| MutableAtomToken<any, Serializable>,\n\tkey?: Key,\n): Serializable {\n\tconst store = React.useContext(StoreContext)\n\tconst stateToken: ReadableToken<any> =\n\t\ttoken.type === `mutable_atom_family`\n\t\t\t? findInStore(token, key as Key, store)\n\t\t\t: token\n\tconst jsonToken = getJsonToken(stateToken)\n\treturn useO(jsonToken)\n}\n","import type { ReadableFamilyToken, ReadableToken } from \"atom.io\"\nimport { findInStore, getFromStore, subscribeToState } from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\nimport * as React from \"react\"\n\nimport { StoreContext } from \"./store-context\"\n\nexport function useO<T>(token: ReadableToken<T>): T\n\nexport function useO<T, K extends Json.Serializable>(\n\ttoken: ReadableFamilyToken<T, K>,\n\tkey: K,\n): T\n\nexport function useO<T, K extends Json.Serializable>(\n\ttoken: ReadableFamilyToken<T, K> | ReadableToken<T>,\n\tkey?: K,\n): T {\n\tconst store = React.useContext(StoreContext)\n\tconst stateToken: ReadableToken<any> =\n\t\ttoken.type === `atom_family` ||\n\t\ttoken.type === `mutable_atom_family` ||\n\t\ttoken.type === `selector_family` ||\n\t\ttoken.type === `readonly_selector_family`\n\t\t\t? findInStore(token, key as K, store)\n\t\t\t: token\n\tconst id = React.useId()\n\treturn React.useSyncExternalStore<T>(\n\t\t(dispatch) => subscribeToState(stateToken, dispatch, `use-o:${id}`, store),\n\t\t() => getFromStore(stateToken, store),\n\t\t() => getFromStore(stateToken, store),\n\t)\n}\n","import { redo, undo } from \"atom.io\"\nimport type { TimelineToken } from \"atom.io\"\nimport { subscribeToTimeline, withdraw } from \"atom.io/internal\"\nimport * as React from \"react\"\n\nimport { StoreContext } from \"./store-context\"\n\nexport type TimelineMeta = {\n\tat: number\n\tlength: number\n\tundo: () => void\n\tredo: () => void\n}\n\nexport function useTL(token: TimelineToken<any>): TimelineMeta {\n\tconst store = React.useContext(StoreContext)\n\tconst id = React.useId()\n\tconst timeline = withdraw(token, store)\n\tconst tokenRef = React.useRef(token)\n\tconst rebuildMeta = () => {\n\t\treturn {\n\t\t\tat: timeline.at,\n\t\t\tlength: timeline.history.length,\n\t\t\tundo: () => undo(token),\n\t\t\tredo: () => redo(token),\n\t\t}\n\t}\n\tconst meta = React.useRef<TimelineMeta>(rebuildMeta())\n\tconst retrieve = () => {\n\t\tif (\n\t\t\tmeta.current.at !== timeline?.at ||\n\t\t\tmeta.current.length !== timeline?.history.length ||\n\t\t\ttokenRef.current !== token\n\t\t) {\n\t\t\ttokenRef.current = token\n\t\t\tmeta.current = rebuildMeta()\n\t\t}\n\t\treturn meta.current\n\t}\n\treturn React.useSyncExternalStore<TimelineMeta>(\n\t\t(dispatch) => subscribeToTimeline(token, dispatch, `use-tl:${id}`, store),\n\t\tretrieve,\n\t\tretrieve,\n\t)\n}\n"]}
|