atom.io 0.33.7 → 0.33.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 (36) hide show
  1. package/dist/data/index.js.map +1 -1
  2. package/dist/eslint-plugin/index.d.ts.map +1 -1
  3. package/dist/eslint-plugin/index.js.map +1 -1
  4. package/dist/internal/index.d.ts +0 -7
  5. package/dist/internal/index.d.ts.map +1 -1
  6. package/dist/internal/index.js.map +1 -1
  7. package/dist/introspection/index.d.ts +2 -3
  8. package/dist/introspection/index.d.ts.map +1 -1
  9. package/dist/introspection/index.js +2 -1
  10. package/dist/introspection/index.js.map +1 -1
  11. package/dist/json/index.js.map +1 -1
  12. package/dist/main/index.d.ts +0 -2
  13. package/dist/main/index.d.ts.map +1 -1
  14. package/dist/main/index.js.map +1 -1
  15. package/dist/react/index.js.map +1 -1
  16. package/dist/react-devtools/index.css +58 -21
  17. package/dist/react-devtools/index.css.map +1 -1
  18. package/dist/react-devtools/index.js +8 -3
  19. package/dist/react-devtools/index.js.map +1 -1
  20. package/dist/realtime/index.d.ts +0 -1
  21. package/dist/realtime/index.d.ts.map +1 -1
  22. package/dist/realtime/index.js.map +1 -1
  23. package/dist/realtime-client/index.d.ts +0 -3
  24. package/dist/realtime-client/index.d.ts.map +1 -1
  25. package/dist/realtime-client/index.js.map +1 -1
  26. package/dist/realtime-react/index.js.map +1 -1
  27. package/dist/realtime-server/index.d.ts +0 -25
  28. package/dist/realtime-server/index.d.ts.map +1 -1
  29. package/dist/realtime-server/index.js.map +1 -1
  30. package/dist/realtime-testing/index.js.map +1 -1
  31. package/dist/transceivers/set-rtx/index.js.map +1 -1
  32. package/package.json +16 -30
  33. package/src/introspection/attach-introspection-states.ts +2 -1
  34. package/src/introspection/attach-type-selectors.ts +10 -4
  35. package/src/react-devtools/StateIndex.tsx +22 -17
  36. package/src/react-devtools/devtools.css +58 -21
@@ -1,4 +1,4 @@
1
- import type { ReadonlyPureSelectorFamilyToken } from "atom.io"
1
+ import type { Loadable, ReadonlyPureSelectorFamilyToken } from "atom.io"
2
2
  import type { Store } from "atom.io/internal"
3
3
  import { createReadonlyPureSelectorFamily } from "atom.io/internal"
4
4
 
@@ -6,12 +6,15 @@ import { discoverType } from "./refinery"
6
6
 
7
7
  export const attachTypeSelectors = (
8
8
  store: Store,
9
- ): ReadonlyPureSelectorFamilyToken<string, string> => {
10
- const typeSelectors = createReadonlyPureSelectorFamily<string, string>(store, {
9
+ ): ReadonlyPureSelectorFamilyToken<Loadable<string>, string> => {
10
+ const typeSelectors = createReadonlyPureSelectorFamily<
11
+ Loadable<string>,
12
+ string
13
+ >(store, {
11
14
  key: `🔍 State Type`,
12
15
  get:
13
16
  (key) =>
14
- ({ get }) => {
17
+ async ({ get }) => {
15
18
  let state: unknown
16
19
  try {
17
20
  const token =
@@ -25,6 +28,9 @@ export const attachTypeSelectors = (
25
28
  } catch (_) {
26
29
  return `error`
27
30
  }
31
+ if (state instanceof Promise) {
32
+ state = await state
33
+ }
28
34
  const typeOfState = discoverType(state)
29
35
  return typeOfState
30
36
  },
@@ -1,4 +1,5 @@
1
1
  import type {
2
+ Loadable,
2
3
  ReadableToken,
3
4
  ReadonlyPureSelectorToken,
4
5
  RegularAtomToken,
@@ -19,13 +20,15 @@ import { DevtoolsContext } from "./store"
19
20
  export const StateIndexLeafNode: FC<{
20
21
  node: ReadableToken<unknown>
21
22
  isOpenState: RegularAtomToken<boolean>
22
- typeState: ReadonlyPureSelectorToken<string>
23
+ typeState: ReadonlyPureSelectorToken<Loadable<string>>
23
24
  }> = ({ node, isOpenState, typeState }) => {
24
25
  const setIsOpen = useI(isOpenState)
25
26
  const isOpen = useO(isOpenState)
26
27
 
27
28
  const state = useO(node)
28
- const stateType = useO(typeState)
29
+ const stateTypeLoadable = useO(typeState)
30
+ const stateType =
31
+ stateTypeLoadable instanceof Promise ? `Promise` : stateTypeLoadable
29
32
 
30
33
  const isPrimitive = Boolean(primitiveRefinery.refine(state))
31
34
 
@@ -49,7 +52,11 @@ export const StateIndexLeafNode: FC<{
49
52
  <h2>{node.family?.subKey ?? node.key}</h2>
50
53
  <span className="type detail">({stateType})</span>
51
54
  </main>
52
- <StoreEditor token={node} />
55
+ {isPrimitive ? (
56
+ <StoreEditor token={node} />
57
+ ) : (
58
+ <div className="json_viewer">{JSON.stringify(state)}</div>
59
+ )}
53
60
  </header>
54
61
  {isOpen && !isPrimitive ? (
55
62
  <main>
@@ -102,7 +109,7 @@ export const StateIndexTreeNode: FC<{
102
109
  export const StateIndexNode: FC<{
103
110
  node: FamilyNode<ReadableToken<unknown>> | ReadableToken<unknown>
104
111
  isOpenState: RegularAtomToken<boolean>
105
- typeState: ReadonlyPureSelectorToken<string>
112
+ typeState: ReadonlyPureSelectorToken<Loadable<string>>
106
113
  }> = ({ node, isOpenState, typeState }) => {
107
114
  return (
108
115
  <section className="node state" data-testid={`state-${node.key}`}>
@@ -128,21 +135,19 @@ export const StateIndex: FC<{
128
135
 
129
136
  const { typeSelectors, viewIsOpenAtoms, store } = useContext(DevtoolsContext)
130
137
 
138
+ console.log(tokenIds)
131
139
  return (
132
140
  <article className="index state_index" data-testid="state-index">
133
- {[...tokenIds.entries()]
134
- .filter(([key]) => !key.startsWith(`👁‍🗨`))
135
- .sort()
136
- .map(([key, node]) => {
137
- return (
138
- <StateIndexNode
139
- key={key}
140
- node={node}
141
- isOpenState={findInStore(store, viewIsOpenAtoms, node.key)}
142
- typeState={findInStore(store, typeSelectors, node.key)}
143
- />
144
- )
145
- })}
141
+ {[...tokenIds.entries()].map(([key, node]) => {
142
+ return (
143
+ <StateIndexNode
144
+ key={key}
145
+ node={node}
146
+ isOpenState={findInStore(store, viewIsOpenAtoms, node.key)}
147
+ typeState={findInStore(store, typeSelectors, node.key)}
148
+ />
149
+ )
150
+ })}
146
151
  </article>
147
152
  )
148
153
  }
@@ -1,15 +1,21 @@
1
1
  main[data-css="atom_io_devtools"] {
2
- --fg-color: #eee;
2
+ --fg-color: #ccc;
3
+ --fg-light: #aaa;
4
+ --fg-faint: #555;
3
5
  --bg-color: #111;
6
+ --bg-accent: #00f;
4
7
  --bg-tint1: #222;
5
8
  --fg-border: 1px solid var(--fg-color);
6
9
  @media (prefers-color-scheme: light) {
7
10
  --fg-color: #444;
11
+ --fg-light: #777;
12
+ --fg-faint: #999;
8
13
  --bg-color: #ddd;
14
+ --bg-accent: #0ff;
9
15
  --bg-tint1: #e3e3e3;
10
16
  }
11
- pointer-events: all;
12
17
  & {
18
+ pointer-events: all;
13
19
  box-sizing: border-box;
14
20
  color: var(--fg-color);
15
21
  background-color: var(--bg-color);
@@ -29,10 +35,9 @@ main[data-css="atom_io_devtools"] {
29
35
  font-size: 16px;
30
36
  font-family: theia, monospace;
31
37
  line-height: 1em;
38
+ color: var(--fg-color);
32
39
  }
33
40
  > header {
34
- padding: 5px;
35
- padding-left: 10px;
36
41
  padding-bottom: 0;
37
42
  display: flex;
38
43
  justify-content: space-between;
@@ -74,17 +79,21 @@ main[data-css="atom_io_devtools"] {
74
79
  .node .node {
75
80
  border-right: var(--fg-border);
76
81
  padding-right: 0;
77
- background: #fff3;
82
+ background: #ffffff08;
83
+ @media (prefers-color-scheme: light) {
84
+ background: #00000004;
85
+ }
78
86
  }
79
87
  .node > .node {
80
- margin: 5px 0;
81
- margin-left: 12px;
88
+ margin: 0px 2px 2px 18px;
82
89
  border-left: var(--fg-border);
90
+ &:last-of-type {
91
+ margin-bottom: 6px;
92
+ }
83
93
  }
84
94
  .node {
85
95
  border-top: var(--fg-border);
86
- overflow-x: scroll;
87
- padding: 5px;
96
+ overflow: visible;
88
97
  &:last-of-type {
89
98
  border-bottom: var(--fg-border);
90
99
  }
@@ -94,44 +103,74 @@ main[data-css="atom_io_devtools"] {
94
103
  header {
95
104
  display: flex;
96
105
  flex-flow: row;
97
- gap: 5px;
98
106
  position: sticky;
99
107
  z-index: 999;
100
108
  top: 0;
109
+ height: 22px;
101
110
  button.carat {
102
111
  cursor: pointer;
103
112
  background: none;
104
113
  border: none;
105
114
  width: 20px;
115
+ color: var(--fg-light);
106
116
  &.open {
107
117
  transform: rotate(90deg);
108
118
  }
109
119
  &:disabled {
110
120
  cursor: default;
121
+ color: var(--fg-faint);
111
122
  }
112
123
  }
113
124
  > main {
114
125
  display: flex;
115
126
  flex-flow: row;
116
- gap: 5px;
117
127
  cursor: help;
118
- align-items: baseline;
119
- /* h2,
120
- span.type {
121
- display: inline-block;
128
+ align-items: center;
129
+ * {
130
+ height: 100%;
131
+ display: flex;
132
+ align-items: center;
133
+ align-content: center;
134
+ justify-content: center;
135
+ }
136
+ h2 {
122
137
  margin: 0;
123
- } */
138
+ }
124
139
  .detail {
140
+ margin-left: 5px;
125
141
  color: #777;
126
142
  @media (prefers-color-scheme: light) {
127
143
  color: #999;
128
144
  }
129
145
  }
130
146
  }
147
+ > .json_viewer {
148
+ color: var(--fg-light);
149
+ }
150
+ > .json_editor,
151
+ > .json_viewer {
152
+ display: flex;
153
+ align-items: center;
154
+ border-left: 1px solid var(--fg-light);
155
+ background-color: var(--bg-tint1);
156
+ * {
157
+ display: flex;
158
+ height: 100%;
159
+ }
160
+ > span {
161
+ padding: 0px 5px;
162
+ border-left: var(--fg-color);
163
+ z-index: 0;
164
+ &:focus-within {
165
+ outline: 4px solid var(--fg-color);
166
+ background: var(--bg-accent);
167
+ }
168
+ }
169
+ input {
170
+ outline: none;
171
+ }
172
+ }
131
173
  }
132
- /* main {
133
- margin-left: 15px;
134
- } */
135
174
  }
136
175
  section.transaction_log {
137
176
  margin-top: 0;
@@ -244,8 +283,6 @@ main[data-css="atom_io_devtools"] {
244
283
  .json_editor {
245
284
  input {
246
285
  font-family: theia, monospace;
247
- border: none;
248
- border-bottom: 1px solid;
249
286
  background: none;
250
287
  &:disabled {
251
288
  border: none;