atom.io 0.6.4 → 0.6.6
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/README.md +32 -78
- package/dist/index.d.mts +4 -35
- package/dist/index.d.ts +4 -35
- package/dist/index.js +17 -129
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -129
- package/dist/index.mjs.map +1 -1
- package/introspection/dist/index.js +312 -0
- package/introspection/dist/index.js.map +1 -0
- package/introspection/dist/index.mjs +289 -0
- package/introspection/dist/index.mjs.map +1 -0
- package/introspection/package.json +15 -0
- package/package.json +17 -8
- package/react-devtools/dist/index.css +22 -5
- package/react-devtools/dist/index.css.map +1 -1
- package/react-devtools/dist/index.d.mts +347 -8
- package/react-devtools/dist/index.d.ts +347 -8
- package/react-devtools/dist/index.js +2722 -674
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/dist/index.mjs +2669 -630
- package/react-devtools/dist/index.mjs.map +1 -1
- package/src/internal/index.ts +0 -1
- package/src/internal/operation.ts +1 -0
- package/src/internal/store.ts +3 -2
- package/src/internal/time-travel-internal.ts +2 -0
- package/src/internal/timeline/add-atom-to-timeline.ts +11 -12
- package/src/internal/timeline-internal.ts +5 -1
- package/src/introspection/attach-atom-index.ts +73 -0
- package/src/introspection/attach-introspection-states.ts +42 -0
- package/src/introspection/attach-selector-index.ts +77 -0
- package/src/introspection/attach-timeline-family.ts +49 -0
- package/src/introspection/attach-timeline-index.ts +36 -0
- package/src/introspection/attach-transaction-index.ts +38 -0
- package/src/introspection/attach-transaction-logs.ts +40 -0
- package/src/introspection/index.ts +20 -0
- package/src/react-devtools/AtomIODevtools.tsx +97 -96
- package/src/react-devtools/Button.tsx +24 -0
- package/src/react-devtools/StateEditor.tsx +14 -16
- package/src/react-devtools/StateIndex.tsx +153 -0
- package/src/react-devtools/TimelineIndex.tsx +92 -0
- package/src/react-devtools/TransactionIndex.tsx +70 -0
- package/src/react-devtools/Updates.tsx +145 -0
- package/src/react-devtools/devtools.scss +196 -15
- package/src/react-devtools/index.ts +71 -0
- package/src/react-explorer/AtomIOExplorer.tsx +0 -1
- package/src/react-explorer/explorer-effects.ts +3 -3
- package/src/react-explorer/explorer-states.ts +1 -1
- package/src/react-explorer/space-states.ts +6 -4
- package/src/react-explorer/view-states.ts +0 -2
- package/realtime-testing/dist/index.d.mts +0 -49
- package/realtime-testing/dist/index.d.ts +0 -49
- package/realtime-testing/dist/index.js +0 -165
- package/realtime-testing/dist/index.js.map +0 -1
- package/realtime-testing/dist/index.mjs +0 -129
- package/realtime-testing/dist/index.mjs.map +0 -1
- package/src/internal/meta/attach-meta.ts +0 -17
- package/src/internal/meta/index.ts +0 -4
- package/src/internal/meta/meta-state.ts +0 -135
- package/src/internal/meta/meta-timelines.ts +0 -1
- package/src/internal/meta/meta-transactions.ts +0 -1
- package/src/react-devtools/TokenList.tsx +0 -61
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "atom.io-introspection",
|
|
3
|
+
"private": true,
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"browser": "./dist/index.mjs",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atom.io",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"description": "Reactive state graph for React, Preact, and vanilla",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
|
+
"introspection/dist",
|
|
11
|
+
"introspection/package.json",
|
|
10
12
|
"json/dist",
|
|
11
13
|
"json/package.json",
|
|
12
14
|
"react/dist",
|
|
@@ -29,6 +31,13 @@
|
|
|
29
31
|
"import": "./dist/index.mjs",
|
|
30
32
|
"require": "./dist/index.js"
|
|
31
33
|
},
|
|
34
|
+
"./introspection/package.json": "./json/package.json",
|
|
35
|
+
"./introspection": {
|
|
36
|
+
"types": "./json/dist/index.d.ts",
|
|
37
|
+
"browser": "./json/dist/index.mjs",
|
|
38
|
+
"import": "./json/dist/index.mjs",
|
|
39
|
+
"require": "./json/dist/index.js"
|
|
40
|
+
},
|
|
32
41
|
"./json/package.json": "./json/package.json",
|
|
33
42
|
"./json": {
|
|
34
43
|
"types": "./json/dist/index.d.ts",
|
|
@@ -93,27 +102,27 @@
|
|
|
93
102
|
}
|
|
94
103
|
},
|
|
95
104
|
"dependencies": {
|
|
96
|
-
"fp-ts": "2.16.
|
|
105
|
+
"fp-ts": "2.16.1",
|
|
97
106
|
"hamt_plus": "1.0.2"
|
|
98
107
|
},
|
|
99
108
|
"devDependencies": {
|
|
100
109
|
"@emotion/react": "11.11.1",
|
|
101
110
|
"@testing-library/react": "14.0.0",
|
|
102
111
|
"@types/mock-fs": "4.13.1",
|
|
103
|
-
"@types/react": "18.2.
|
|
112
|
+
"@types/react": "18.2.17",
|
|
104
113
|
"@types/tmp": "0.2.3",
|
|
105
114
|
"eslint": "8.45.0",
|
|
106
|
-
"framer-motion": "10.
|
|
107
|
-
"happy-dom": "10.5.
|
|
115
|
+
"framer-motion": "10.14.0",
|
|
116
|
+
"happy-dom": "10.5.2",
|
|
108
117
|
"react": "18.2.0",
|
|
109
118
|
"react-dom": "18.2.0",
|
|
110
|
-
"react-router-dom": "6.14.
|
|
119
|
+
"react-router-dom": "6.14.2",
|
|
111
120
|
"socket.io": "4.7.1",
|
|
112
121
|
"socket.io-client": "4.7.1",
|
|
113
122
|
"tmp": "0.2.1",
|
|
114
123
|
"tsup": "7.1.0",
|
|
115
124
|
"typescript": "5.1.6",
|
|
116
|
-
"vite": "4.4.
|
|
125
|
+
"vite": "4.4.7",
|
|
117
126
|
"vite-tsconfig-paths": "4.2.0",
|
|
118
127
|
"vitest": "0.33.0"
|
|
119
128
|
},
|
|
@@ -128,7 +137,7 @@
|
|
|
128
137
|
"access": "public"
|
|
129
138
|
},
|
|
130
139
|
"scripts": {
|
|
131
|
-
"build": "
|
|
140
|
+
"build": "./build.sh",
|
|
132
141
|
"lint:rome": "rome check .",
|
|
133
142
|
"lint:eslint": "eslint .",
|
|
134
143
|
"lint": "npm run lint:rome && npm run lint:eslint",
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
main.atom_io_devtools {
|
|
3
3
|
--fg-color: #eee;
|
|
4
4
|
--bg-color: #111;
|
|
5
|
+
--bg-tint1: #222;
|
|
6
|
+
--fg-border: 1px solid var(--fg-color);
|
|
5
7
|
@media (prefers-color-scheme: light) {
|
|
6
|
-
--fg-color: #
|
|
7
|
-
--bg-color: #
|
|
8
|
+
--fg-color: #444;
|
|
9
|
+
--bg-color: #ddd;
|
|
10
|
+
--bg-tint1: #e3e3e3;
|
|
8
11
|
}
|
|
9
12
|
box-sizing: border-box;
|
|
10
13
|
color: var(--fg-color);
|
|
@@ -18,9 +21,23 @@ main.atom_io_devtools {
|
|
|
18
21
|
flex-flow: column;
|
|
19
22
|
max-height: 800px;
|
|
20
23
|
width: 100%;
|
|
21
|
-
max-width:
|
|
24
|
+
max-width: 500px;
|
|
22
25
|
overflow-y: scroll;
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
* {
|
|
27
|
+
font-size: 16px;
|
|
28
|
+
font-family: theia, monospace;
|
|
29
|
+
}
|
|
30
|
+
> header {
|
|
31
|
+
padding: 5px;
|
|
32
|
+
padding-left: 10px;
|
|
33
|
+
padding-bottom: 0;
|
|
34
|
+
display: flex;
|
|
35
|
+
justify-content: space-between;
|
|
36
|
+
h1 { font-size: inherit; margin: 0; font-size: 24px; font-family: charter; } nav { display: flex; flex-flow: row nowrap; button { cursor: pointer; background: none; border: none; padding: none; margin-bottom: -2px; z-index: 1000; &:disabled { cursor: default; background-color: var(--bg-tint1); color: var(--fg-color); border: var(--fg-border); border-bottom: none; } } };
|
|
37
|
+
}
|
|
38
|
+
> main {
|
|
39
|
+
background: var(--bg-tint1);
|
|
40
|
+
}
|
|
41
|
+
main { overflow-y: scroll; flex-grow: 1; display: flex; flex-flow: column; gap: 0; article.index { .node .node { border-right: var(--fg-border); padding-right: 0; background: #fff3; } .node > .node { margin: 5px 0; margin-left: 12px; border-left: var(--fg-border); } .node { border-top: var(--fg-border); overflow-x: scroll; padding: 5px; &:last-of-type { border-bottom: var(--fg-border); } &.transaction_update { padding: 0; } header { display: flex; flex-flow: row; gap: 5px; position: sticky; z-index: 999; top: 0; button.carat { cursor: pointer; background: none; border: none; width: 20px; &.open { transform: rotate(90deg); } &:disabled { cursor: default; } } label { display: flex; flex-flow: row; gap: 5px; cursor: help; h2 { display: inline-block; margin: 0; } .detail { color: #777; @media (prefers-color-scheme: light) { color: #999; } } } } main { margin-left: 15px; } } section.transaction_log { margin-top: 0; header: { padding: 5px; } main { display: flex; flex-flow: row wrap; gap: 5px; .transaction_update { width: 100%; display: flex; flex-flow: row; align-items: flex-start; justify-content: flex-start; justify-items: flex-start; align-content: flex-start; border-left: var(--fg-border); border-top: var(--fg-border); header { padding: 5px; h4 { margin: 0; padding: 0; font-size: inherit; } } main { margin-left: 0; display: flex; flex-flow: column; gap: 0px; border-left: 1px solid #333; section ~ section { border-top: 1px solid #333; } section { padding: 5px; &.transaction_output { border-right: none; } &.transaction_impact { padding: 5px; } margin: 0; article { border-left: var(--fg-border); border-right: var(--fg-border); .summary { white-space: nowrap; } } } } } } } section.timeline_log { header { display: flex; label { display: flex; width: 100%; flex-grow: 1; .gap { flex-grow: 1; } nav { display: flex; flex-flow: row nowrap; gap: 5px; } } } .timeline_update { padding: 5px; border-left: var(--fg-border); h4 { margin: 0; padding: 0; font-size: inherit; } main { margin: 0; .node.atom_update { border-left: var(--fg-border); } } } .you_are_here { background: var(--fg-color); color: var(--bg-color); text-align: center; } } } } footer { display: flex; justify-content: flex-end; button { cursor: pointer; background: none; border: none; padding: none; position: absolute; right: 0; bottom: 0; } } .json_editor { input { // font-size: 20px; font-family: theia; border: none; border-bottom: 1px solid; background: none; &:disabled { border: none; } } button { background: none; margin-left: auto; color: #777; border: none; font-family: theia; font-size: 14px; margin: none; padding: 4px; padding-bottom: 6px; cursor: pointer; &:hover { color: #333; background-color: #aaa; } } select { font-family: theia; font-size: 14px; background: none; border: none; color: #777; @media (prefers-color-scheme: light) { color: #999; } } .json_editor_unofficial { background-color: #777; button { color: #333; } } .json_editor_missing { background-color: #f055; } .json_editor_key { padding-right: 10px; input { color: #999; @media (prefers-color-scheme: light) { color: #777; } } } .json_editor_object { border-left: 2px solid #333; padding-left: 20px; @media (prefers-color-scheme: light) { border-color: #ccc; } .json_editor_properties { > * { border-bottom: var(--fg-border); margin-bottom: 2px; } } } };
|
|
25
42
|
}
|
|
26
43
|
/*# sourceMappingURL=index.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/react-devtools/devtools.scss"],"sourcesContent":["main.atom_io_devtools {\n --fg-color: #eee;\n --bg-color: #111;\n @media (prefers-color-scheme: light) {\n --fg-color: #222;\n --bg-color: #ccc;\n }\n box-sizing: border-box;\n color: var(--fg-color);\n background-color: var(--bg-color);\n border: 2px solid var(--fg-color);\n position: fixed;\n right: 0;\n bottom: 0;\n height: 100%;\n display: flex;\n flex-flow: column;\n max-height: 800px;\n width: 100%;\n max-width: 460px;\n overflow-y: scroll;\n padding: 5px;\n header {\n display: flex;\n justify-content: space-between;\n h1 {\n font-size: inherit;\n margin: 0;\n }\n }\n main {\n overflow-y: scroll;\n flex-grow: 1;\n section {\n margin-top: 30px;\n h2 {\n font-size: inherit;\n margin: 0;\n }\n .node {\n border: 1px solid var(--fg-color);\n padding: 5px;\n margin: 5px;\n overflow-x: scroll;\n }\n }\n }\n footer {\n display: flex;\n justify-content: flex-end;\n button {\n cursor: pointer;\n background: none;\n border: none;\n padding: none;\n position: absolute;\n right: 0;\n bottom: 0;\n }\n }\n\n .json_editor {\n input {\n font-size: 20px;\n font-family: theia;\n border: none;\n border-bottom: 1px solid;\n background: none;\n &:disabled {\n border: none;\n }\n }\n button {\n background: none;\n margin-left: auto;\n color: #777;\n border: none;\n font-family: theia;\n font-size: 14px;\n margin: none;\n padding: 4px;\n padding-bottom: 6px;\n cursor: pointer;\n &:hover {\n color: #333;\n background-color: #aaa;\n }\n }\n select {\n font-family: theia;\n font-size: 14px;\n background: none;\n border: none;\n color: #777;\n @media (prefers-color-scheme: light) {\n color: #999;\n }\n }\n .json_editor_unofficial {\n background-color: #777;\n button {\n color: #333;\n }\n }\n .json_editor_missing {\n background-color: #f055;\n }\n .json_editor_key {\n input {\n color: #999;\n @media (prefers-color-scheme: light) {\n color: #777;\n }\n }\n }\n .json_editor_object {\n border-left: 2px solid #333;\n padding-left: 20px;\n @media (prefers-color-scheme: light) {\n border-color: #ccc;\n }\n .json_editor_properties {\n > * {\n border-bottom: 2px solid #333;\n margin-bottom: 2px;\n }\n }\n }\n }\n}\n"],"mappings":";AAAA;AACE;AACA;AACA;AACE;AACA;AAAA;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/react-devtools/devtools.scss"],"sourcesContent":["main.atom_io_devtools {\n --fg-color: #eee;\n --bg-color: #111;\n --bg-tint1: #222;\n --fg-border: 1px solid var(--fg-color);\n @media (prefers-color-scheme: light) {\n --fg-color: #444;\n --bg-color: #ddd;\n --bg-tint1: #e3e3e3;\n }\n box-sizing: border-box;\n color: var(--fg-color);\n background-color: var(--bg-color);\n border: 2px solid var(--fg-color);\n position: fixed;\n right: 0;\n bottom: 0;\n height: 100%;\n display: flex;\n flex-flow: column;\n max-height: 800px;\n width: 100%;\n max-width: 500px;\n overflow-y: scroll;\n * {\n font-size: 16px;\n font-family: theia, monospace;\n }\n > header {\n padding: 5px;\n padding-left: 10px;\n padding-bottom: 0;\n display: flex;\n justify-content: space-between;\n h1 {\n font-size: inherit;\n margin: 0;\n font-size: 24px;\n font-family: charter;\n }\n nav {\n display: flex;\n flex-flow: row nowrap;\n button {\n cursor: pointer;\n background: none;\n border: none;\n padding: none;\n margin-bottom: -2px;\n z-index: 1000;\n &:disabled {\n cursor: default;\n background-color: var(--bg-tint1);\n color: var(--fg-color);\n border: var(--fg-border);\n border-bottom: none;\n }\n }\n }\n }\n > main {\n background: var(--bg-tint1);\n }\n main {\n overflow-y: scroll;\n flex-grow: 1;\n display: flex;\n flex-flow: column;\n gap: 0;\n article.index {\n .node .node {\n border-right: var(--fg-border);\n padding-right: 0;\n background: #fff3;\n }\n .node > .node {\n margin: 5px 0;\n margin-left: 12px;\n border-left: var(--fg-border);\n }\n .node {\n border-top: var(--fg-border);\n overflow-x: scroll;\n padding: 5px;\n &:last-of-type {\n border-bottom: var(--fg-border);\n }\n &.transaction_update {\n padding: 0;\n }\n header {\n display: flex;\n flex-flow: row;\n gap: 5px;\n position: sticky;\n z-index: 999;\n top: 0;\n button.carat {\n cursor: pointer;\n background: none;\n border: none;\n width: 20px;\n &.open {\n transform: rotate(90deg);\n }\n &:disabled {\n cursor: default;\n }\n }\n label {\n display: flex;\n flex-flow: row;\n gap: 5px;\n cursor: help;\n h2 {\n display: inline-block;\n margin: 0;\n }\n .detail {\n color: #777;\n @media (prefers-color-scheme: light) {\n color: #999;\n }\n }\n }\n }\n main {\n margin-left: 15px;\n }\n }\n section.transaction_log {\n margin-top: 0;\n header: {\n padding: 5px;\n }\n main {\n display: flex;\n flex-flow: row wrap;\n gap: 5px;\n .transaction_update {\n width: 100%;\n display: flex;\n flex-flow: row;\n align-items: flex-start;\n justify-content: flex-start;\n justify-items: flex-start;\n align-content: flex-start;\n border-left: var(--fg-border);\n border-top: var(--fg-border);\n header {\n padding: 5px;\n h4 {\n margin: 0;\n padding: 0;\n font-size: inherit;\n }\n }\n main {\n margin-left: 0;\n display: flex;\n flex-flow: column;\n gap: 0px;\n border-left: 1px solid #333;\n section ~ section {\n border-top: 1px solid #333;\n }\n section {\n padding: 5px;\n &.transaction_output {\n border-right: none;\n }\n &.transaction_impact {\n padding: 5px;\n }\n margin: 0;\n article {\n border-left: var(--fg-border);\n border-right: var(--fg-border);\n .summary {\n white-space: nowrap;\n }\n }\n }\n }\n }\n }\n }\n section.timeline_log {\n header {\n display: flex;\n label {\n display: flex;\n width: 100%;\n flex-grow: 1;\n .gap {\n flex-grow: 1;\n }\n nav {\n display: flex;\n flex-flow: row nowrap;\n gap: 5px;\n }\n }\n }\n .timeline_update {\n padding: 5px;\n border-left: var(--fg-border);\n h4 {\n margin: 0;\n padding: 0;\n font-size: inherit;\n }\n main {\n margin: 0;\n .node.atom_update {\n border-left: var(--fg-border);\n }\n }\n }\n .you_are_here {\n background: var(--fg-color);\n color: var(--bg-color);\n text-align: center;\n }\n }\n }\n }\n footer {\n display: flex;\n justify-content: flex-end;\n button {\n cursor: pointer;\n background: none;\n border: none;\n padding: none;\n position: absolute;\n right: 0;\n bottom: 0;\n }\n }\n\n .json_editor {\n input {\n // font-size: 20px;\n font-family: theia;\n border: none;\n border-bottom: 1px solid;\n background: none;\n &:disabled {\n border: none;\n }\n }\n button {\n background: none;\n margin-left: auto;\n color: #777;\n border: none;\n font-family: theia;\n font-size: 14px;\n margin: none;\n padding: 4px;\n padding-bottom: 6px;\n cursor: pointer;\n &:hover {\n color: #333;\n background-color: #aaa;\n }\n }\n select {\n font-family: theia;\n font-size: 14px;\n background: none;\n border: none;\n color: #777;\n @media (prefers-color-scheme: light) {\n color: #999;\n }\n }\n .json_editor_unofficial {\n background-color: #777;\n button {\n color: #333;\n }\n }\n .json_editor_missing {\n background-color: #f055;\n }\n .json_editor_key {\n padding-right: 10px;\n input {\n color: #999;\n @media (prefers-color-scheme: light) {\n color: #777;\n }\n }\n }\n .json_editor_object {\n border-left: 2px solid #333;\n padding-left: 20px;\n @media (prefers-color-scheme: light) {\n border-color: #ccc;\n }\n .json_editor_properties {\n > * {\n border-bottom: var(--fg-border);\n margin-bottom: 2px;\n }\n }\n }\n }\n}\n"],"mappings":";AAAA,IAAI,CAAC;AACH,cAAY;AACZ,cAAY;AACZ,cAAY;AACZ,eAAa,IAAI,MAAM,IAAI;AAC3B,SAAO,CAAC,oBAAoB,EAAE;AAC5B,gBAAY;AACZ,gBAAY;AACZ,gBAAY;AACd;AACA,cAAY;AACZ,SAAO,IAAI;AACX,oBAAkB,IAAI;AACtB,UAAQ,IAAI,MAAM,IAAI;AACtB,YAAU;AACV,SAAO;AACP,UAAQ;AACR,UAAQ;AACR,WAAS;AACT,aAAW;AACX,cAAY;AACZ,SAAO;AACP,aAAW;AACX,cAAY;AACZ;AACE,eAAW;AACX,iBAAa,KAAK,EAAE;AACtB;AACA,IAAE;AACA,aAAS;AACT,kBAAc;AACd,oBAAgB;AAChB,aAAS;AACT,qBAAiB;AACjB,OAAG,EACD,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,CAAC,EACT,SAAS,EAAE,IAAI,EACf,WAAW,EAAE,OAAO,IAEtB,IAAI,EACF,OAAO,EAAE,IAAI,EACb,SAAS,EAAE,IAAI,MAAM,EACrB,OAAO,EACL,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,IAAI,EAChB,MAAM,EAAE,IAAI,EACZ,OAAO,EAAE,IAAI,EACb,aAAa,EAAE,IAAI,EACnB,OAAO,EAAE,IAAI,EACb,CAAC,CAAC,SAAS,EACT,MAAM,EAAE,OAAO,EACf,gBAAgB,EAAE,IAAI,WAAW,EACjC,KAAK,EAAE,IAAI,WAAW,EACtB,MAAM,EAAE,IAAI,YAAY,EACxB,aAAa,EAAE,IAAI;AAI3B;AACA,IAAE;AACA,gBAAY,IAAI;AAClB;AACA,OAAK,EACH,UAAU,EAAE,MAA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,EAAE,IAAI,EACf,UAAU,EAAE,IAAI,EAChB,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,IAAI,EACX,OAAO,CAAC,oBAAoB,EAAE,OAAO,EACnC,KAAK,EAAE,IAAI,MAGf,CAAC,uBAAuB,EACtB,gBAAgB,EAAE,IAAI,EACtB,OAAO,EACL,KAAK,EAAE,IAAI,MAGf,CAAC,oBAAoB,EACnB,gBAAgB,EAAE,KAAK,IAEzB,CAAC,gBAAgB,EACf,aAAa,EAAE,IAAI,EACnB,MAAM,EACJ,KAAK,EAAE,IAAI,EACX,OAAO,CAAC,oBAAoB,EAAE,OAAO,EACnC,KAAK,EAAE,IAAI,QAIjB,CAAC,mBAAmB,EAClB,WAAW,EAAE,IAAI,MAAM,IAAI,EAC3B,YAAY,EAAE,IAAI,EAClB,OAAO,CAAC,oBAAoB,EAAE,OAAO,EACnC,YAAY,EAAE,IAAI,IAEpB,CAAC,uBAAuB,EACtB,EAAE,EAAE,EACF,aAAa,EAAE,IAAI,YAAY,EAC/B,aAAa,EAAE,GAAG;AAK5B;","names":[]}
|
|
@@ -1,15 +1,354 @@
|
|
|
1
|
+
import { Hamt } from 'hamt_plus';
|
|
2
|
+
import { Refinement } from 'fp-ts/Refinement';
|
|
3
|
+
import { AtomToken as AtomToken$1, ReadonlySelectorToken as ReadonlySelectorToken$1, SelectorToken as SelectorToken$1 } from 'atom.io';
|
|
1
4
|
import { FC } from 'react';
|
|
2
|
-
import * as AtomIO from 'atom.io';
|
|
3
5
|
|
|
4
|
-
type
|
|
6
|
+
type PlainObject = Record<keyof any, unknown>;
|
|
5
7
|
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
type ƒn = (...parameters: any[]) => any;
|
|
9
|
+
|
|
10
|
+
type JsonInterface<T, J extends Json = Json> = {
|
|
11
|
+
toJson: (t: T) => J;
|
|
12
|
+
fromJson: (json: J) => T;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type Primitive = boolean | number | string | null;
|
|
16
|
+
type Serializable = Primitive | Readonly<{
|
|
17
|
+
[key: string]: Serializable;
|
|
18
|
+
}> | ReadonlyArray<Serializable>;
|
|
19
|
+
type JsonObj<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
20
|
+
type JsonArr<Element extends Serializable = Serializable> = ReadonlyArray<Element>;
|
|
21
|
+
type Json = JsonArr | JsonObj | Primitive;
|
|
22
|
+
|
|
23
|
+
type Identified = {
|
|
24
|
+
id: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
declare const RELATION_TYPES: readonly ["1:1", "1:n", "n:n"];
|
|
28
|
+
type RelationType = typeof RELATION_TYPES[number];
|
|
29
|
+
type RelationData<CONTENT extends JsonObj | null = null, A extends string = `from`, B extends string = `to`> = {
|
|
30
|
+
contents: JsonObj<string, CONTENT>;
|
|
31
|
+
relations: JsonObj<string, string[]>;
|
|
32
|
+
relationType: RelationType;
|
|
33
|
+
a: A;
|
|
34
|
+
b: B;
|
|
35
|
+
};
|
|
36
|
+
type IsRelationDataOptions<CONTENT extends JsonObj | null = null, A extends string = `from`, B extends string = `to`> = {
|
|
37
|
+
from?: A;
|
|
38
|
+
to?: B;
|
|
39
|
+
isContent?: (json: Json) => json is CONTENT;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
type NullSafeUnion<Base, Extension> = Extension extends null ? Base : Base & Extension;
|
|
43
|
+
type NullSafeRest<MaybeArg> = MaybeArg extends null ? [] | [undefined] : [MaybeArg];
|
|
44
|
+
|
|
45
|
+
declare class Join<CONTENT extends JsonObj | null = null, A extends string = `from`, B extends string = `to`> implements RelationData<CONTENT, A, B> {
|
|
46
|
+
readonly relationType: `1:1` | `1:n` | `n:n`;
|
|
47
|
+
readonly a: A;
|
|
48
|
+
readonly b: B;
|
|
49
|
+
readonly relations: Record<string, string[]>;
|
|
50
|
+
readonly contents: Record<string, CONTENT>;
|
|
51
|
+
constructor(json?: Partial<RelationData<CONTENT, A, B>>);
|
|
52
|
+
toJSON(): RelationData<CONTENT, A, B>;
|
|
53
|
+
static fromJSON<CONTENT extends JsonObj | null, A extends string, B extends string>(json: Json, options?: IsRelationDataOptions<CONTENT, A, B>): Join<CONTENT, A, B>;
|
|
54
|
+
from<AA extends string>(newA: AA): Join<CONTENT, AA, B>;
|
|
55
|
+
to<BB extends string>(newB: BB): Join<CONTENT, A, BB>;
|
|
56
|
+
makeJsonInterface: (...params: CONTENT extends null ? [
|
|
57
|
+
] : [Refinement<unknown, CONTENT>]) => JsonInterface<Join<CONTENT, A, B>, RelationData<CONTENT, A, B>>;
|
|
58
|
+
getRelatedId(id: string): string | undefined;
|
|
59
|
+
getRelatedIds(id: string): string[];
|
|
60
|
+
getContent(idA: string, idB: string): CONTENT | undefined;
|
|
61
|
+
getRelationEntries(id: string): [string, CONTENT][];
|
|
62
|
+
getRelationRecord(id: string): Record<string, CONTENT>;
|
|
63
|
+
getRelation(id: string): NullSafeUnion<Identified, CONTENT> | undefined;
|
|
64
|
+
getRelations(id: string): NullSafeUnion<Identified, CONTENT>[];
|
|
65
|
+
setRelations(subject: {
|
|
66
|
+
[from in A]: string;
|
|
67
|
+
} | {
|
|
68
|
+
[to in B]: string;
|
|
69
|
+
}, relations: NullSafeUnion<Identified, CONTENT>[]): Join<CONTENT, A, B>;
|
|
70
|
+
set(relation: {
|
|
71
|
+
[key in A | B]: string;
|
|
72
|
+
}, ...rest: NullSafeRest<CONTENT>): Join<CONTENT, A, B>;
|
|
73
|
+
remove(relation: Partial<Record<A | B, string>>): Join<CONTENT, A, B>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
type AtomFamily<T, K extends Serializable = Serializable> = ((key: K) => AtomToken<T>) & {
|
|
77
|
+
key: string;
|
|
78
|
+
type: `atom_family`;
|
|
79
|
+
subject: Subject<AtomToken<T>>;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
type Logger = Pick<Console, `error` | `info` | `warn`>;
|
|
83
|
+
|
|
84
|
+
type TransactionToken<_> = {
|
|
85
|
+
key: string;
|
|
86
|
+
type: `transaction`;
|
|
87
|
+
__brand?: _;
|
|
10
88
|
};
|
|
89
|
+
type TransactionUpdate<ƒ extends ƒn> = {
|
|
90
|
+
key: string;
|
|
91
|
+
atomUpdates: KeyedStateUpdate<unknown>[];
|
|
92
|
+
params: Parameters<ƒ>;
|
|
93
|
+
output: ReturnType<ƒ>;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
type ReadonlySelectorFamily<T, K extends Serializable = Serializable> = ((key: K) => ReadonlySelectorToken<T>) & {
|
|
97
|
+
key: string;
|
|
98
|
+
type: `readonly_selector_family`;
|
|
99
|
+
subject: Subject<ReadonlySelectorToken<T>>;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
type StateUpdate<T> = {
|
|
103
|
+
newValue: T;
|
|
104
|
+
oldValue: T;
|
|
105
|
+
};
|
|
106
|
+
type KeyedStateUpdate<T> = StateUpdate<T> & {
|
|
107
|
+
key: string;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
type TimelineToken = {
|
|
111
|
+
key: string;
|
|
112
|
+
type: `timeline`;
|
|
113
|
+
};
|
|
114
|
+
type TimelineUpdate = TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate;
|
|
115
|
+
|
|
116
|
+
type AtomToken<_> = {
|
|
117
|
+
key: string;
|
|
118
|
+
type: `atom`;
|
|
119
|
+
family?: FamilyMetadata;
|
|
120
|
+
__brand?: _;
|
|
121
|
+
};
|
|
122
|
+
type SelectorToken<_> = {
|
|
123
|
+
key: string;
|
|
124
|
+
type: `selector`;
|
|
125
|
+
family?: FamilyMetadata;
|
|
126
|
+
__brand?: _;
|
|
127
|
+
};
|
|
128
|
+
type StateToken<T> = AtomToken<T> | SelectorToken<T>;
|
|
129
|
+
type ReadonlySelectorToken<_> = {
|
|
130
|
+
key: string;
|
|
131
|
+
type: `readonly_selector`;
|
|
132
|
+
family?: FamilyMetadata;
|
|
133
|
+
__brand?: _;
|
|
134
|
+
};
|
|
135
|
+
type FamilyMetadata = {
|
|
136
|
+
key: string;
|
|
137
|
+
subKey: string;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
type StoreCore = Pick<Store, `atoms` | `atomsThatAreDefault` | `operation` | `readonlySelectors` | `selectorAtoms` | `selectorGraph` | `selectors` | `timelineAtoms` | `timelines` | `transactions` | `valueMap`>;
|
|
141
|
+
interface Store {
|
|
142
|
+
atoms: Hamt<Atom<any>, string>;
|
|
143
|
+
atomsThatAreDefault: Set<string>;
|
|
144
|
+
readonlySelectors: Hamt<ReadonlySelector<any>, string>;
|
|
145
|
+
selectorAtoms: Join<null, `selectorKey`, `atomKey`>;
|
|
146
|
+
selectorGraph: Join<{
|
|
147
|
+
source: string;
|
|
148
|
+
}>;
|
|
149
|
+
selectors: Hamt<Selector<any>, string>;
|
|
150
|
+
timelineAtoms: Join<null, `timelineKey`, `atomKey`>;
|
|
151
|
+
timelines: Hamt<Timeline, string>;
|
|
152
|
+
transactions: Hamt<Transaction<any>, string>;
|
|
153
|
+
valueMap: Hamt<any, string>;
|
|
154
|
+
subject: {
|
|
155
|
+
atomCreation: Subject<AtomToken<unknown>>;
|
|
156
|
+
selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
157
|
+
transactionCreation: Subject<TransactionToken<ƒn>>;
|
|
158
|
+
timelineCreation: Subject<TimelineToken>;
|
|
159
|
+
operationStatus: Subject<OperationProgress>;
|
|
160
|
+
};
|
|
161
|
+
operation: OperationProgress;
|
|
162
|
+
transactionStatus: TransactionStatus<ƒn>;
|
|
163
|
+
config: {
|
|
164
|
+
name: string;
|
|
165
|
+
logger: Logger | null;
|
|
166
|
+
logger__INTERNAL: Logger;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
type Atom<T> = {
|
|
171
|
+
key: string;
|
|
172
|
+
type: `atom`;
|
|
173
|
+
family?: FamilyMetadata;
|
|
174
|
+
subject: Subject<{
|
|
175
|
+
newValue: T;
|
|
176
|
+
oldValue: T;
|
|
177
|
+
}>;
|
|
178
|
+
default: T;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
type OperationProgress = {
|
|
182
|
+
open: false;
|
|
183
|
+
} | {
|
|
184
|
+
open: true;
|
|
185
|
+
done: Set<string>;
|
|
186
|
+
prev: Hamt<any, string>;
|
|
187
|
+
time: number;
|
|
188
|
+
token: StateToken<any>;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
type Selector<T> = {
|
|
192
|
+
key: string;
|
|
193
|
+
type: `selector`;
|
|
194
|
+
family?: FamilyMetadata;
|
|
195
|
+
install: (store: Store) => void;
|
|
196
|
+
subject: Subject<{
|
|
197
|
+
newValue: T;
|
|
198
|
+
oldValue: T;
|
|
199
|
+
}>;
|
|
200
|
+
get: () => T;
|
|
201
|
+
set: (newValue: T | ((oldValue: T) => T)) => void;
|
|
202
|
+
};
|
|
203
|
+
type ReadonlySelector<T> = {
|
|
204
|
+
key: string;
|
|
205
|
+
type: `readonly_selector`;
|
|
206
|
+
family?: FamilyMetadata;
|
|
207
|
+
install: (store: Store) => void;
|
|
208
|
+
subject: Subject<{
|
|
209
|
+
newValue: T;
|
|
210
|
+
oldValue: T;
|
|
211
|
+
}>;
|
|
212
|
+
get: () => T;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
type Subscriber<T> = (value: T) => void;
|
|
216
|
+
declare class Subject<T> {
|
|
217
|
+
subscribers: Subscriber<T>[];
|
|
218
|
+
subscribe(subscriber: Subscriber<T>): {
|
|
219
|
+
unsubscribe: () => void;
|
|
220
|
+
};
|
|
221
|
+
private unsubscribe;
|
|
222
|
+
next(value: T): void;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
type TimelineAtomUpdate = StateUpdate<unknown> & {
|
|
226
|
+
key: string;
|
|
227
|
+
type: `atom_update`;
|
|
228
|
+
timestamp: number;
|
|
229
|
+
};
|
|
230
|
+
type TimelineSelectorUpdate = {
|
|
231
|
+
key: string;
|
|
232
|
+
type: `selector_update`;
|
|
233
|
+
timestamp: number;
|
|
234
|
+
atomUpdates: Omit<TimelineAtomUpdate, `timestamp`>[];
|
|
235
|
+
};
|
|
236
|
+
type TimelineTransactionUpdate = TransactionUpdate<ƒn> & {
|
|
237
|
+
key: string;
|
|
238
|
+
type: `transaction_update`;
|
|
239
|
+
timestamp: number;
|
|
240
|
+
};
|
|
241
|
+
type Timeline = {
|
|
242
|
+
key: string;
|
|
243
|
+
at: number;
|
|
244
|
+
timeTraveling: boolean;
|
|
245
|
+
history: TimelineUpdate[];
|
|
246
|
+
selectorTime: number | null;
|
|
247
|
+
transactionKey: string | null;
|
|
248
|
+
install: (store: Store) => void;
|
|
249
|
+
subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate | `redo` | `undo`>;
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
type Transaction<ƒ extends ƒn> = {
|
|
253
|
+
key: string;
|
|
254
|
+
type: `transaction`;
|
|
255
|
+
install: (store: Store) => void;
|
|
256
|
+
subject: Subject<TransactionUpdate<ƒ>>;
|
|
257
|
+
run: (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
type TransactionUpdateInProgress<ƒ extends ƒn> = TransactionUpdate<ƒ> & {
|
|
261
|
+
phase: `applying` | `building`;
|
|
262
|
+
time: number;
|
|
263
|
+
core: StoreCore;
|
|
264
|
+
};
|
|
265
|
+
type TransactionIdle = {
|
|
266
|
+
phase: `idle`;
|
|
267
|
+
};
|
|
268
|
+
type TransactionStatus<ƒ extends ƒn> = TransactionIdle | TransactionUpdateInProgress<ƒ>;
|
|
269
|
+
|
|
270
|
+
type AtomTokenIndex = StateTokenIndex<AtomToken$1<unknown>>;
|
|
271
|
+
|
|
272
|
+
type FamilyNode<Token extends AtomToken$1<unknown> | ReadonlySelectorToken$1<unknown> | SelectorToken$1<unknown>> = {
|
|
273
|
+
key: string;
|
|
274
|
+
familyMembers: Record<string, Token>;
|
|
275
|
+
};
|
|
276
|
+
type StateTokenIndex<Token extends AtomToken$1<unknown> | ReadonlySelectorToken$1<unknown> | SelectorToken$1<unknown>> = Record<string, FamilyNode<Token> | Token>;
|
|
277
|
+
|
|
278
|
+
type SelectorTokenIndex = StateTokenIndex<ReadonlySelectorToken$1<unknown> | SelectorToken$1<unknown>>;
|
|
279
|
+
|
|
280
|
+
type ClassSignature = abstract new (...args: any) => any;
|
|
281
|
+
|
|
282
|
+
type RefinementStrategy = ClassSignature | Refinement<unknown, any>;
|
|
283
|
+
type Supported<Refine extends RefinementStrategy> = Refine extends Refinement<unknown, infer T> ? T : Refine extends ClassSignature ? InstanceType<Refine> : never;
|
|
284
|
+
type RefinementSupport = Record<string, RefinementStrategy>;
|
|
285
|
+
declare class Refinery<SupportedTypes extends RefinementSupport> {
|
|
286
|
+
supported: SupportedTypes;
|
|
287
|
+
constructor(supported: SupportedTypes);
|
|
288
|
+
refine(input: unknown): {
|
|
289
|
+
[K in keyof SupportedTypes]: {
|
|
290
|
+
type: K;
|
|
291
|
+
data: Supported<SupportedTypes[K]>;
|
|
292
|
+
};
|
|
293
|
+
}[keyof SupportedTypes] | null;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
type Delta = {
|
|
297
|
+
summary: string;
|
|
298
|
+
added?: [path: string, addedStringifiedValue: string][];
|
|
299
|
+
removed?: [path: string, removedStringifiedValue: string][];
|
|
300
|
+
changed?: [path: string, delta: Delta][];
|
|
301
|
+
};
|
|
302
|
+
type Diff<T> = (a: T, b: T) => Delta;
|
|
303
|
+
type DiffTree<T> = (a: T, b: T, recurse: Differ<any, any>[`diff`]) => Delta;
|
|
304
|
+
declare class Differ<Leaf extends Record<string, any>, Tree extends Record<string, any>> {
|
|
305
|
+
leafRefinery: Refinery<Leaf>;
|
|
306
|
+
treeRefinery: Refinery<Tree>;
|
|
307
|
+
leafDiffers: {
|
|
308
|
+
[K in keyof Leaf]: Diff<Supported<Leaf[K]>>;
|
|
309
|
+
};
|
|
310
|
+
treeDiffers: {
|
|
311
|
+
[K in keyof Tree]: DiffTree<Supported<Tree[K]>>;
|
|
312
|
+
};
|
|
313
|
+
constructor(leafRefinery: Refinery<Leaf>, treeRefinery: Refinery<Tree>, diffFunctions: {
|
|
314
|
+
[K in keyof Tree]: DiffTree<Supported<Tree[K]>>;
|
|
315
|
+
} & {
|
|
316
|
+
[K in keyof Leaf]: Diff<Supported<Leaf[K]>>;
|
|
317
|
+
});
|
|
318
|
+
diff(a: unknown, b: unknown): Delta;
|
|
319
|
+
}
|
|
11
320
|
|
|
12
|
-
declare const composeDevtools: (storeHooks: StoreHooks) => FC;
|
|
13
321
|
declare const AtomIODevtools: FC;
|
|
14
322
|
|
|
15
|
-
|
|
323
|
+
declare const atomIndex: ReadonlySelectorToken<AtomTokenIndex>;
|
|
324
|
+
declare const selectorIndex: ReadonlySelectorToken<SelectorTokenIndex>;
|
|
325
|
+
declare const transactionIndex: ReadonlySelectorToken<TransactionToken<ƒn>[]>;
|
|
326
|
+
declare const findTransactionLogState: ReadonlySelectorFamily<TransactionUpdate<ƒn>[]>;
|
|
327
|
+
declare const timelineIndex: ReadonlySelectorToken<TimelineToken[]>;
|
|
328
|
+
declare const findTimelineState: ReadonlySelectorFamily<Timeline>;
|
|
329
|
+
declare const devtoolsAreOpenState: AtomToken<boolean>;
|
|
330
|
+
type DevtoolsView = `atoms` | `selectors` | `timelines` | `transactions`;
|
|
331
|
+
declare const devtoolsViewSelectionState: AtomToken<DevtoolsView>;
|
|
332
|
+
declare const devtoolsViewOptionsState: AtomToken<DevtoolsView[]>;
|
|
333
|
+
declare const findViewIsOpenState: AtomFamily<boolean, string>;
|
|
334
|
+
declare const primitiveRefinery: Refinery<{
|
|
335
|
+
number: (input: unknown) => input is number;
|
|
336
|
+
string: (input: unknown) => input is string;
|
|
337
|
+
boolean: (input: unknown) => input is boolean;
|
|
338
|
+
null: (input: unknown) => input is null;
|
|
339
|
+
}>;
|
|
340
|
+
declare const jsonTreeRefinery: Refinery<{
|
|
341
|
+
object: (input: unknown) => input is PlainObject;
|
|
342
|
+
array: (input: unknown) => input is unknown[];
|
|
343
|
+
}>;
|
|
344
|
+
declare const prettyJson: Differ<{
|
|
345
|
+
number: (input: unknown) => input is number;
|
|
346
|
+
string: (input: unknown) => input is string;
|
|
347
|
+
boolean: (input: unknown) => input is boolean;
|
|
348
|
+
null: (input: unknown) => input is null;
|
|
349
|
+
}, {
|
|
350
|
+
object: (input: unknown) => input is PlainObject;
|
|
351
|
+
array: (input: unknown) => input is unknown[];
|
|
352
|
+
}>;
|
|
353
|
+
|
|
354
|
+
export { AtomIODevtools, atomIndex, devtoolsAreOpenState, devtoolsViewOptionsState, devtoolsViewSelectionState, findTimelineState, findTransactionLogState, findViewIsOpenState, jsonTreeRefinery, prettyJson, primitiveRefinery, selectorIndex, timelineIndex, transactionIndex };
|