atom.io 0.6.7 → 0.6.9

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 (129) hide show
  1. package/dist/index.d.mts +241 -263
  2. package/dist/index.d.ts +241 -263
  3. package/dist/index.js +28 -1911
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +5 -1871
  6. package/dist/index.mjs.map +1 -1
  7. package/introspection/dist/index.d.mts +121 -176
  8. package/introspection/dist/index.d.ts +121 -176
  9. package/introspection/dist/index.js +6 -346
  10. package/introspection/dist/index.js.map +1 -1
  11. package/introspection/dist/index.mjs +5 -324
  12. package/introspection/dist/index.mjs.map +1 -1
  13. package/json/dist/index.d.mts +37 -8
  14. package/json/dist/index.d.ts +37 -8
  15. package/json/dist/index.js +31 -48
  16. package/json/dist/index.js.map +1 -1
  17. package/json/dist/index.mjs +6 -14
  18. package/json/dist/index.mjs.map +1 -1
  19. package/package.json +30 -14
  20. package/react/dist/index.js +34 -83
  21. package/react/dist/index.js.map +1 -1
  22. package/react/dist/index.mjs +7 -43
  23. package/react/dist/index.mjs.map +1 -1
  24. package/react-devtools/dist/index.css +1 -42
  25. package/react-devtools/dist/index.css.map +1 -1
  26. package/react-devtools/dist/index.d.mts +128 -193
  27. package/react-devtools/dist/index.d.ts +128 -193
  28. package/react-devtools/dist/index.js +56 -4154
  29. package/react-devtools/dist/index.js.map +1 -1
  30. package/react-devtools/dist/index.mjs +19 -4117
  31. package/react-devtools/dist/index.mjs.map +1 -1
  32. package/realtime/dist/index.d.mts +7 -11
  33. package/realtime/dist/index.d.ts +7 -11
  34. package/realtime/dist/index.js +26 -185
  35. package/realtime/dist/index.js.map +1 -1
  36. package/realtime/dist/index.mjs +4 -149
  37. package/realtime/dist/index.mjs.map +1 -1
  38. package/realtime-react/dist/index.d.mts +12 -16
  39. package/realtime-react/dist/index.d.ts +12 -16
  40. package/realtime-react/dist/index.js +41 -214
  41. package/realtime-react/dist/index.js.map +1 -1
  42. package/realtime-react/dist/index.mjs +9 -169
  43. package/realtime-react/dist/index.mjs.map +1 -1
  44. package/src/atom.ts +7 -6
  45. package/src/index.ts +12 -9
  46. package/src/logger.ts +5 -5
  47. package/src/selector.ts +16 -14
  48. package/src/silo.ts +36 -39
  49. package/src/subscribe.ts +25 -20
  50. package/src/timeline.ts +9 -4
  51. package/src/transaction.ts +3 -4
  52. package/src/internal/atom-internal.ts +0 -54
  53. package/src/internal/families-internal.ts +0 -141
  54. package/src/internal/get.ts +0 -129
  55. package/src/internal/index.ts +0 -15
  56. package/src/internal/is-default.ts +0 -35
  57. package/src/internal/operation.ts +0 -139
  58. package/src/internal/selector/create-read-write-selector.ts +0 -66
  59. package/src/internal/selector/create-readonly-selector.ts +0 -46
  60. package/src/internal/selector/index.ts +0 -4
  61. package/src/internal/selector/lookup-selector-sources.ts +0 -16
  62. package/src/internal/selector/register-selector.ts +0 -57
  63. package/src/internal/selector/trace-selector-atoms.ts +0 -43
  64. package/src/internal/selector/update-selector-atoms.ts +0 -33
  65. package/src/internal/selector-internal.ts +0 -58
  66. package/src/internal/set.ts +0 -99
  67. package/src/internal/store.ts +0 -151
  68. package/src/internal/subject.ts +0 -24
  69. package/src/internal/subscribe-internal.ts +0 -88
  70. package/src/internal/time-travel-internal.ts +0 -91
  71. package/src/internal/timeline/add-atom-to-timeline.ts +0 -168
  72. package/src/internal/timeline/index.ts +0 -1
  73. package/src/internal/timeline-internal.ts +0 -107
  74. package/src/internal/transaction/abort-transaction.ts +0 -12
  75. package/src/internal/transaction/apply-transaction.ts +0 -57
  76. package/src/internal/transaction/build-transaction.ts +0 -33
  77. package/src/internal/transaction/index.ts +0 -25
  78. package/src/internal/transaction/redo-transaction.ts +0 -23
  79. package/src/internal/transaction/undo-transaction.ts +0 -23
  80. package/src/internal/transaction-internal.ts +0 -61
  81. package/src/introspection/attach-atom-index.ts +0 -73
  82. package/src/introspection/attach-introspection-states.ts +0 -42
  83. package/src/introspection/attach-selector-index.ts +0 -77
  84. package/src/introspection/attach-timeline-family.ts +0 -59
  85. package/src/introspection/attach-timeline-index.ts +0 -36
  86. package/src/introspection/attach-transaction-index.ts +0 -38
  87. package/src/introspection/attach-transaction-logs.ts +0 -40
  88. package/src/introspection/index.ts +0 -20
  89. package/src/json/index.ts +0 -1
  90. package/src/json/select-json.ts +0 -18
  91. package/src/react/index.ts +0 -2
  92. package/src/react/store-context.tsx +0 -13
  93. package/src/react/store-hooks.ts +0 -47
  94. package/src/react-devtools/AtomIODevtools.tsx +0 -107
  95. package/src/react-devtools/Button.tsx +0 -24
  96. package/src/react-devtools/StateEditor.tsx +0 -70
  97. package/src/react-devtools/StateIndex.tsx +0 -153
  98. package/src/react-devtools/TimelineIndex.tsx +0 -92
  99. package/src/react-devtools/TransactionIndex.tsx +0 -70
  100. package/src/react-devtools/Updates.tsx +0 -145
  101. package/src/react-devtools/devtools.scss +0 -311
  102. package/src/react-devtools/index.ts +0 -72
  103. package/src/react-explorer/AtomIOExplorer.tsx +0 -218
  104. package/src/react-explorer/explorer-effects.ts +0 -20
  105. package/src/react-explorer/explorer-states.ts +0 -217
  106. package/src/react-explorer/index.ts +0 -23
  107. package/src/react-explorer/space-states.ts +0 -72
  108. package/src/react-explorer/view-states.ts +0 -41
  109. package/src/realtime/README.md +0 -33
  110. package/src/realtime/hook-composition/expose-family.ts +0 -101
  111. package/src/realtime/hook-composition/expose-single.ts +0 -38
  112. package/src/realtime/hook-composition/expose-timeline.ts +0 -60
  113. package/src/realtime/hook-composition/index.ts +0 -12
  114. package/src/realtime/hook-composition/receive-state.ts +0 -29
  115. package/src/realtime/hook-composition/receive-transaction.ts +0 -18
  116. package/src/realtime/index.ts +0 -1
  117. package/src/realtime-react/index.ts +0 -3
  118. package/src/realtime-react/realtime-context.tsx +0 -30
  119. package/src/realtime-react/realtime-hooks.ts +0 -39
  120. package/src/realtime-react/realtime-state.ts +0 -10
  121. package/src/realtime-react/use-pull-family-member.ts +0 -26
  122. package/src/realtime-react/use-pull-family.ts +0 -24
  123. package/src/realtime-react/use-pull.ts +0 -22
  124. package/src/realtime-react/use-push.ts +0 -25
  125. package/src/realtime-react/use-server-action.ts +0 -33
  126. package/src/realtime-testing/index.ts +0 -1
  127. package/src/realtime-testing/setup-realtime-test.tsx +0 -159
  128. package/src/web-effects/index.ts +0 -1
  129. package/src/web-effects/storage.ts +0 -30
@@ -1,145 +0,0 @@
1
- import type { ƒn } from "~/packages/anvl/src/function"
2
- import { discoverType } from "~/packages/anvl/src/refinement/refinery"
3
-
4
- import { prettyJson } from "."
5
- import type { KeyedStateUpdate } from "../subscribe"
6
- import type { TimelineUpdate } from "../timeline"
7
- import type { TransactionUpdate } from "../transaction"
8
-
9
- const AtomUpdateFC: React.FC<{
10
- serialNumber: number
11
- atomUpdate: KeyedStateUpdate<unknown>
12
- }> = ({ atomUpdate }) => {
13
- return (
14
- <article
15
- key={atomUpdate.key}
16
- className="node atom_update"
17
- onClick={() => console.log(atomUpdate)}
18
- onKeyUp={() => console.log(atomUpdate)}
19
- >
20
- <span className="detail">{atomUpdate.key}: </span>
21
- <span>
22
- <span className="summary">
23
- {prettyJson.diff(atomUpdate.oldValue, atomUpdate.newValue).summary}
24
- </span>
25
- </span>
26
- </article>
27
- )
28
- }
29
-
30
- const TransactionUpdateFC: React.FC<{
31
- serialNumber: number
32
- transactionUpdate: TransactionUpdate<ƒn>
33
- }> = ({ serialNumber, transactionUpdate }) => {
34
- return (
35
- <article className="node transaction_update">
36
- <header>
37
- <h4>{serialNumber}</h4>
38
- </header>
39
- <main>
40
- <section className="transaction_params">
41
- <span className="detail">params: </span>
42
- {transactionUpdate.params.map((param, index) => {
43
- return (
44
- <article
45
- key={`param` + index}
46
- className="node transaction_param"
47
- onClick={() => console.log(transactionUpdate)}
48
- onKeyUp={() => console.log(transactionUpdate)}
49
- >
50
- <span className="detail">{discoverType(param)}: </span>
51
- <span className="summary">
52
- {typeof param === `object` &&
53
- `type` in param &&
54
- `target` in param ? (
55
- <>{JSON.stringify(param.type)}</>
56
- ) : (
57
- <>{JSON.stringify(param)}</>
58
- )}
59
- </span>
60
- </article>
61
- )
62
- })}
63
- </section>
64
- <section className="node transaction_output">
65
- <span className="detail">output: </span>
66
- <span className="detail">
67
- {discoverType(transactionUpdate.output)}
68
- </span>
69
- {transactionUpdate.output ? (
70
- <span className="summary">
71
- : {JSON.stringify(transactionUpdate.output)}
72
- </span>
73
- ) : null}
74
- </section>
75
- <section className="transaction_impact">
76
- <span className="detail">impact: </span>
77
- {transactionUpdate.atomUpdates
78
- .filter((token) => !token.key.startsWith(`👁‍🗨`))
79
- .map((atomUpdate, index) => {
80
- return (
81
- <article.AtomUpdate
82
- key={`${transactionUpdate.key}:${index}:${atomUpdate.key}`}
83
- serialNumber={index}
84
- atomUpdate={atomUpdate}
85
- />
86
- )
87
- })}
88
- </section>
89
- </main>
90
- </article>
91
- )
92
- }
93
-
94
- export const TimelineUpdateFC: React.FC<{
95
- timelineUpdate: TimelineUpdate
96
- }> = ({ timelineUpdate }) => {
97
- return (
98
- <article className="node timeline_update">
99
- <header>
100
- <h4>
101
- {timelineUpdate.timestamp}: {timelineUpdate.type} ({timelineUpdate.key}
102
- )
103
- </h4>
104
- </header>
105
- <main>
106
- {timelineUpdate.type === `transaction_update` ? (
107
- timelineUpdate.atomUpdates
108
- .filter((token) => !token.key.startsWith(`👁‍🗨`))
109
- .map((atomUpdate, index) => {
110
- return (
111
- <article.AtomUpdate
112
- key={`${timelineUpdate.key}:${index}:${atomUpdate.key}`}
113
- serialNumber={index}
114
- atomUpdate={atomUpdate}
115
- />
116
- )
117
- })
118
- ) : timelineUpdate.type === `selector_update` ? (
119
- timelineUpdate.atomUpdates
120
- .filter((token) => !token.key.startsWith(`👁‍🗨`))
121
- .map((atomUpdate, index) => {
122
- return (
123
- <article.AtomUpdate
124
- key={`${timelineUpdate.key}:${index}:${atomUpdate.key}`}
125
- serialNumber={index}
126
- atomUpdate={atomUpdate}
127
- />
128
- )
129
- })
130
- ) : timelineUpdate.type === `atom_update` ? (
131
- <article.AtomUpdate
132
- serialNumber={timelineUpdate.timestamp}
133
- atomUpdate={timelineUpdate}
134
- />
135
- ) : null}
136
- </main>
137
- </article>
138
- )
139
- }
140
-
141
- export const article = {
142
- AtomUpdate: AtomUpdateFC,
143
- TransactionUpdate: TransactionUpdateFC,
144
- TimelineUpdate: TimelineUpdateFC,
145
- }
@@ -1,311 +0,0 @@
1
- main.atom_io_devtools {
2
- --fg-color: #eee;
3
- --bg-color: #111;
4
- --bg-tint1: #222;
5
- --fg-border: 1px solid var(--fg-color);
6
- @media (prefers-color-scheme: light) {
7
- --fg-color: #444;
8
- --bg-color: #ddd;
9
- --bg-tint1: #e3e3e3;
10
- }
11
- box-sizing: border-box;
12
- color: var(--fg-color);
13
- background-color: var(--bg-color);
14
- border: 2px solid var(--fg-color);
15
- position: fixed;
16
- right: 0;
17
- bottom: 0;
18
- height: 100%;
19
- display: flex;
20
- flex-flow: column;
21
- max-height: 800px;
22
- width: 100%;
23
- max-width: 500px;
24
- overflow-y: scroll;
25
- * {
26
- font-size: 16px;
27
- font-family: theia, monospace;
28
- }
29
- > header {
30
- padding: 5px;
31
- padding-left: 10px;
32
- padding-bottom: 0;
33
- display: flex;
34
- justify-content: space-between;
35
- h1 {
36
- font-size: inherit;
37
- margin: 0;
38
- font-size: 24px;
39
- font-family: charter;
40
- }
41
- nav {
42
- display: flex;
43
- flex-flow: row nowrap;
44
- button {
45
- cursor: pointer;
46
- background: none;
47
- border: none;
48
- padding: none;
49
- margin-bottom: -2px;
50
- z-index: 1000;
51
- &:disabled {
52
- cursor: default;
53
- background-color: var(--bg-tint1);
54
- color: var(--fg-color);
55
- border: var(--fg-border);
56
- border-bottom: none;
57
- }
58
- }
59
- }
60
- }
61
- > main {
62
- background: var(--bg-tint1);
63
- }
64
- main {
65
- overflow-y: scroll;
66
- flex-grow: 1;
67
- display: flex;
68
- flex-flow: column;
69
- gap: 0;
70
- article.index {
71
- .node .node {
72
- border-right: var(--fg-border);
73
- padding-right: 0;
74
- background: #fff3;
75
- }
76
- .node > .node {
77
- margin: 5px 0;
78
- margin-left: 12px;
79
- border-left: var(--fg-border);
80
- }
81
- .node {
82
- border-top: var(--fg-border);
83
- overflow-x: scroll;
84
- padding: 5px;
85
- &:last-of-type {
86
- border-bottom: var(--fg-border);
87
- }
88
- &.transaction_update {
89
- padding: 0;
90
- }
91
- header {
92
- display: flex;
93
- flex-flow: row;
94
- gap: 5px;
95
- position: sticky;
96
- z-index: 999;
97
- top: 0;
98
- button.carat {
99
- cursor: pointer;
100
- background: none;
101
- border: none;
102
- width: 20px;
103
- &.open {
104
- transform: rotate(90deg);
105
- }
106
- &:disabled {
107
- cursor: default;
108
- }
109
- }
110
- label {
111
- display: flex;
112
- flex-flow: row;
113
- gap: 5px;
114
- cursor: help;
115
- h2 {
116
- display: inline-block;
117
- margin: 0;
118
- }
119
- .detail {
120
- color: #777;
121
- @media (prefers-color-scheme: light) {
122
- color: #999;
123
- }
124
- }
125
- }
126
- }
127
- main {
128
- margin-left: 15px;
129
- }
130
- }
131
- section.transaction_log {
132
- margin-top: 0;
133
- header: {
134
- padding: 5px;
135
- }
136
- main {
137
- display: flex;
138
- flex-flow: row wrap;
139
- gap: 5px;
140
- .transaction_update {
141
- width: 100%;
142
- display: flex;
143
- flex-flow: row;
144
- align-items: flex-start;
145
- justify-content: flex-start;
146
- justify-items: flex-start;
147
- align-content: flex-start;
148
- border-left: var(--fg-border);
149
- border-top: var(--fg-border);
150
- header {
151
- padding: 5px;
152
- h4 {
153
- margin: 0;
154
- padding: 0;
155
- font-size: inherit;
156
- }
157
- }
158
- main {
159
- margin-left: 0;
160
- display: flex;
161
- flex-flow: column;
162
- gap: 0px;
163
- border-left: 1px solid #333;
164
- section ~ section {
165
- border-top: 1px solid #333;
166
- }
167
- section {
168
- padding: 5px;
169
- &.transaction_output {
170
- border-right: none;
171
- }
172
- &.transaction_impact {
173
- padding: 5px;
174
- }
175
- margin: 0;
176
- article {
177
- border-left: var(--fg-border);
178
- border-right: var(--fg-border);
179
- .summary {
180
- white-space: nowrap;
181
- }
182
- }
183
- }
184
- }
185
- }
186
- }
187
- }
188
- section.timeline_log {
189
- header {
190
- display: flex;
191
- label {
192
- display: flex;
193
- width: 100%;
194
- flex-grow: 1;
195
- .gap {
196
- flex-grow: 1;
197
- }
198
- nav {
199
- display: flex;
200
- flex-flow: row nowrap;
201
- gap: 5px;
202
- }
203
- }
204
- }
205
- .timeline_update {
206
- padding: 5px;
207
- border-left: var(--fg-border);
208
- h4 {
209
- margin: 0;
210
- padding: 0;
211
- font-size: inherit;
212
- }
213
- main {
214
- margin: 0;
215
- .node.atom_update {
216
- border-left: var(--fg-border);
217
- }
218
- }
219
- }
220
- .you_are_here {
221
- background: var(--fg-color);
222
- color: var(--bg-color);
223
- text-align: center;
224
- }
225
- }
226
- }
227
- }
228
- footer {
229
- display: flex;
230
- justify-content: flex-end;
231
- button {
232
- cursor: pointer;
233
- background: none;
234
- border: none;
235
- padding: none;
236
- position: absolute;
237
- right: 0;
238
- bottom: 0;
239
- }
240
- }
241
-
242
- .json_editor {
243
- input {
244
- // font-size: 20px;
245
- font-family: theia;
246
- border: none;
247
- border-bottom: 1px solid;
248
- background: none;
249
- &:disabled {
250
- border: none;
251
- }
252
- }
253
- button {
254
- background: none;
255
- margin-left: auto;
256
- color: #777;
257
- border: none;
258
- font-family: theia;
259
- font-size: 14px;
260
- margin: none;
261
- padding: 4px;
262
- padding-bottom: 6px;
263
- cursor: pointer;
264
- &:hover {
265
- color: #333;
266
- background-color: #aaa;
267
- }
268
- }
269
- select {
270
- font-family: theia;
271
- font-size: 14px;
272
- background: none;
273
- border: none;
274
- color: #777;
275
- @media (prefers-color-scheme: light) {
276
- color: #999;
277
- }
278
- }
279
- .json_editor_unofficial {
280
- background-color: #777;
281
- button {
282
- color: #333;
283
- }
284
- }
285
- .json_editor_missing {
286
- background-color: #f055;
287
- }
288
- .json_editor_key {
289
- padding-right: 10px;
290
- input {
291
- color: #999;
292
- @media (prefers-color-scheme: light) {
293
- color: #777;
294
- }
295
- }
296
- }
297
- .json_editor_object {
298
- border-left: 2px solid #333;
299
- padding-left: 20px;
300
- @media (prefers-color-scheme: light) {
301
- border-color: #ccc;
302
- }
303
- .json_editor_properties {
304
- > * {
305
- border-bottom: var(--fg-border);
306
- margin-bottom: 2px;
307
- }
308
- }
309
- }
310
- }
311
- }
@@ -1,72 +0,0 @@
1
- import { isPlainObject } from "~/packages/anvl/src/object"
2
- import { Refinery } from "~/packages/anvl/src/refinement/refinery"
3
- import {
4
- diffArray,
5
- diffBoolean,
6
- diffNumber,
7
- diffObject,
8
- diffString,
9
- Differ,
10
- } from "~/packages/anvl/src/tree/differ"
11
-
12
- import { atom, atomFamily } from ".."
13
- import { attachIntrospectionStates } from "../introspection"
14
- import { lazyLocalStorageEffect } from "../web-effects"
15
-
16
- export * from "./AtomIODevtools"
17
-
18
- export const {
19
- atomIndex,
20
- selectorIndex,
21
- transactionIndex,
22
- findTransactionLogState,
23
- timelineIndex,
24
- findTimelineState,
25
- } = attachIntrospectionStates()
26
-
27
- export const devtoolsAreOpenState = atom<boolean>({
28
- key: `👁‍🗨 Devtools Are Open`,
29
- default: true,
30
- effects: [lazyLocalStorageEffect(`👁‍🗨 Devtools Are Open`)],
31
- })
32
-
33
- type DevtoolsView = `atoms` | `selectors` | `timelines` | `transactions`
34
-
35
- export const devtoolsViewSelectionState = atom<DevtoolsView>({
36
- key: `👁‍🗨 Devtools View Selection`,
37
- default: `atoms`,
38
- effects: [lazyLocalStorageEffect(`👁‍🗨 Devtools View`)],
39
- })
40
-
41
- export const devtoolsViewOptionsState = atom<DevtoolsView[]>({
42
- key: `👁‍🗨 Devtools View Options`,
43
- default: [`atoms`, `selectors`, `transactions`, `timelines`],
44
- effects: [lazyLocalStorageEffect(`👁‍🗨 Devtools View Options`)],
45
- })
46
-
47
- export const findViewIsOpenState = atomFamily<boolean, string>({
48
- key: `👁‍🗨 Devtools View Is Open`,
49
- default: false,
50
- effects: (key) => [lazyLocalStorageEffect(key + `:view-is-open`)],
51
- })
52
-
53
- export const primitiveRefinery = new Refinery({
54
- number: (input: unknown): input is number => typeof input === `number`,
55
- string: (input: unknown): input is string => typeof input === `string`,
56
- boolean: (input: unknown): input is boolean => typeof input === `boolean`,
57
- null: (input: unknown): input is null => input === null,
58
- })
59
-
60
- export const jsonTreeRefinery = new Refinery({
61
- object: isPlainObject,
62
- array: (input: unknown): input is unknown[] => Array.isArray(input),
63
- })
64
-
65
- export const prettyJson = new Differ(primitiveRefinery, jsonTreeRefinery, {
66
- number: diffNumber,
67
- string: diffString,
68
- boolean: diffBoolean,
69
- null: () => ({ summary: `No Change` }),
70
- object: diffObject,
71
- array: diffArray,
72
- })