atom.io 0.6.8 → 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.
- package/dist/index.d.mts +226 -258
- package/dist/index.d.ts +226 -258
- package/dist/index.js +28 -1917
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -1877
- package/dist/index.mjs.map +1 -1
- package/introspection/dist/index.d.mts +117 -171
- package/introspection/dist/index.d.ts +117 -171
- package/introspection/dist/index.js +6 -346
- package/introspection/dist/index.js.map +1 -1
- package/introspection/dist/index.mjs +5 -324
- package/introspection/dist/index.mjs.map +1 -1
- package/json/dist/index.d.mts +32 -1
- package/json/dist/index.d.ts +32 -1
- package/json/dist/index.js +31 -48
- package/json/dist/index.js.map +1 -1
- package/json/dist/index.mjs +6 -14
- package/json/dist/index.mjs.map +1 -1
- package/package.json +22 -14
- package/react/dist/index.js +34 -83
- package/react/dist/index.js.map +1 -1
- package/react/dist/index.mjs +7 -43
- package/react/dist/index.mjs.map +1 -1
- package/react-devtools/dist/index.css +1 -50
- package/react-devtools/dist/index.css.map +1 -1
- package/react-devtools/dist/index.d.mts +124 -188
- package/react-devtools/dist/index.d.ts +124 -188
- package/react-devtools/dist/index.js +56 -4674
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/dist/index.mjs +19 -4642
- package/react-devtools/dist/index.mjs.map +1 -1
- package/realtime/dist/index.d.mts +1 -3
- package/realtime/dist/index.d.ts +1 -3
- package/realtime/dist/index.js +26 -184
- package/realtime/dist/index.js.map +1 -1
- package/realtime/dist/index.mjs +4 -148
- package/realtime/dist/index.mjs.map +1 -1
- package/realtime-react/dist/index.d.mts +2 -4
- package/realtime-react/dist/index.d.ts +2 -4
- package/realtime-react/dist/index.js +41 -214
- package/realtime-react/dist/index.js.map +1 -1
- package/realtime-react/dist/index.mjs +9 -169
- package/realtime-react/dist/index.mjs.map +1 -1
- package/src/atom.ts +4 -3
- package/src/index.ts +12 -9
- package/src/logger.ts +5 -5
- package/src/selector.ts +3 -3
- package/src/silo.ts +36 -39
- package/src/subscribe.ts +24 -19
- package/src/timeline.ts +9 -4
- package/src/transaction.ts +3 -4
- package/src/internal/atom-internal.ts +0 -54
- package/src/internal/families-internal.ts +0 -144
- package/src/internal/get.ts +0 -129
- package/src/internal/index.ts +0 -15
- package/src/internal/is-default.ts +0 -35
- package/src/internal/operation.ts +0 -139
- package/src/internal/selector/create-read-write-selector.ts +0 -68
- package/src/internal/selector/create-readonly-selector.ts +0 -48
- package/src/internal/selector/index.ts +0 -4
- package/src/internal/selector/lookup-selector-sources.ts +0 -16
- package/src/internal/selector/register-selector.ts +0 -57
- package/src/internal/selector/trace-selector-atoms.ts +0 -43
- package/src/internal/selector/update-selector-atoms.ts +0 -33
- package/src/internal/selector-internal.ts +0 -58
- package/src/internal/set.ts +0 -99
- package/src/internal/store.ts +0 -151
- package/src/internal/subscribe-internal.ts +0 -88
- package/src/internal/time-travel-internal.ts +0 -91
- package/src/internal/timeline/add-atom-to-timeline.ts +0 -168
- package/src/internal/timeline/index.ts +0 -1
- package/src/internal/timeline-internal.ts +0 -107
- package/src/internal/transaction/abort-transaction.ts +0 -12
- package/src/internal/transaction/apply-transaction.ts +0 -57
- package/src/internal/transaction/build-transaction.ts +0 -33
- package/src/internal/transaction/index.ts +0 -25
- package/src/internal/transaction/redo-transaction.ts +0 -23
- package/src/internal/transaction/undo-transaction.ts +0 -23
- package/src/internal/transaction-internal.ts +0 -61
- package/src/introspection/attach-atom-index.ts +0 -73
- package/src/introspection/attach-introspection-states.ts +0 -42
- package/src/introspection/attach-selector-index.ts +0 -77
- package/src/introspection/attach-timeline-family.ts +0 -59
- package/src/introspection/attach-timeline-index.ts +0 -36
- package/src/introspection/attach-transaction-index.ts +0 -38
- package/src/introspection/attach-transaction-logs.ts +0 -40
- package/src/introspection/index.ts +0 -20
- package/src/json/index.ts +0 -1
- package/src/json/select-json.ts +0 -18
- package/src/react/index.ts +0 -2
- package/src/react/store-context.tsx +0 -13
- package/src/react/store-hooks.ts +0 -47
- package/src/react-devtools/AtomIODevtools.tsx +0 -107
- package/src/react-devtools/Button.tsx +0 -24
- package/src/react-devtools/StateEditor.tsx +0 -74
- package/src/react-devtools/StateIndex.tsx +0 -156
- package/src/react-devtools/TimelineIndex.tsx +0 -92
- package/src/react-devtools/TransactionIndex.tsx +0 -70
- package/src/react-devtools/Updates.tsx +0 -145
- package/src/react-devtools/devtools.scss +0 -310
- package/src/react-devtools/index.ts +0 -72
- package/src/react-explorer/AtomIOExplorer.tsx +0 -218
- package/src/react-explorer/explorer-effects.ts +0 -20
- package/src/react-explorer/explorer-states.ts +0 -217
- package/src/react-explorer/index.ts +0 -23
- package/src/react-explorer/space-states.ts +0 -72
- package/src/react-explorer/view-states.ts +0 -41
- package/src/realtime/README.md +0 -33
- package/src/realtime/hook-composition/expose-family.ts +0 -101
- package/src/realtime/hook-composition/expose-single.ts +0 -38
- package/src/realtime/hook-composition/expose-timeline.ts +0 -60
- package/src/realtime/hook-composition/index.ts +0 -12
- package/src/realtime/hook-composition/receive-state.ts +0 -29
- package/src/realtime/hook-composition/receive-transaction.ts +0 -18
- package/src/realtime/index.ts +0 -1
- package/src/realtime-react/index.ts +0 -3
- package/src/realtime-react/realtime-context.tsx +0 -30
- package/src/realtime-react/realtime-hooks.ts +0 -39
- package/src/realtime-react/realtime-state.ts +0 -10
- package/src/realtime-react/use-pull-family-member.ts +0 -26
- package/src/realtime-react/use-pull-family.ts +0 -24
- package/src/realtime-react/use-pull.ts +0 -24
- package/src/realtime-react/use-push.ts +0 -27
- package/src/realtime-react/use-server-action.ts +0 -33
- package/src/realtime-testing/index.ts +0 -1
- package/src/realtime-testing/setup-realtime-test.tsx +0 -159
- package/src/tracker/index.ts +0 -3
- package/src/tracker/tracker.ts +0 -61
- package/src/web-effects/index.ts +0 -1
- package/src/web-effects/storage.ts +0 -30
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { useO, useIO } from "atom.io/react"
|
|
2
|
-
import { LayoutGroup, motion, spring } from "framer-motion"
|
|
3
|
-
import { useRef } from "react"
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
atomIndex,
|
|
7
|
-
devtoolsAreOpenState,
|
|
8
|
-
devtoolsViewOptionsState,
|
|
9
|
-
devtoolsViewSelectionState,
|
|
10
|
-
selectorIndex,
|
|
11
|
-
} from "."
|
|
12
|
-
import { StateIndex } from "./StateIndex"
|
|
13
|
-
import { TimelineIndex } from "./TimelineIndex"
|
|
14
|
-
import { TransactionIndex } from "./TransactionIndex"
|
|
15
|
-
|
|
16
|
-
import "./devtools.scss"
|
|
17
|
-
|
|
18
|
-
export const AtomIODevtools = (): JSX.Element => {
|
|
19
|
-
const constraintsRef = useRef(null)
|
|
20
|
-
|
|
21
|
-
const [devtoolsAreOpen, setDevtoolsAreOpen] = useIO(devtoolsAreOpenState)
|
|
22
|
-
const [devtoolsView, setDevtoolsView] = useIO(devtoolsViewSelectionState)
|
|
23
|
-
const devtoolsViewOptions = useO(devtoolsViewOptionsState)
|
|
24
|
-
|
|
25
|
-
const mouseHasMoved = useRef(false)
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<>
|
|
29
|
-
<motion.span
|
|
30
|
-
ref={constraintsRef}
|
|
31
|
-
className="atom_io_devtools_zone"
|
|
32
|
-
style={{
|
|
33
|
-
position: `fixed`,
|
|
34
|
-
top: 0,
|
|
35
|
-
left: 0,
|
|
36
|
-
right: 0,
|
|
37
|
-
bottom: 0,
|
|
38
|
-
pointerEvents: `none`,
|
|
39
|
-
}}
|
|
40
|
-
/>
|
|
41
|
-
<motion.main
|
|
42
|
-
drag
|
|
43
|
-
dragConstraints={constraintsRef}
|
|
44
|
-
className="atom_io_devtools"
|
|
45
|
-
transition={spring}
|
|
46
|
-
style={
|
|
47
|
-
devtoolsAreOpen
|
|
48
|
-
? {}
|
|
49
|
-
: {
|
|
50
|
-
backgroundColor: `#0000`,
|
|
51
|
-
borderColor: `#0000`,
|
|
52
|
-
maxHeight: 28,
|
|
53
|
-
maxWidth: 33,
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
>
|
|
57
|
-
{devtoolsAreOpen ? (
|
|
58
|
-
<>
|
|
59
|
-
<motion.header>
|
|
60
|
-
<h1>atom.io</h1>
|
|
61
|
-
<nav>
|
|
62
|
-
{devtoolsViewOptions.map((viewOption) => (
|
|
63
|
-
<button
|
|
64
|
-
key={viewOption}
|
|
65
|
-
type="button"
|
|
66
|
-
className={viewOption === devtoolsView ? `active` : ``}
|
|
67
|
-
onClick={() => setDevtoolsView(viewOption)}
|
|
68
|
-
disabled={viewOption === devtoolsView}
|
|
69
|
-
>
|
|
70
|
-
{viewOption}
|
|
71
|
-
</button>
|
|
72
|
-
))}
|
|
73
|
-
</nav>
|
|
74
|
-
</motion.header>
|
|
75
|
-
<motion.main>
|
|
76
|
-
<LayoutGroup>
|
|
77
|
-
{devtoolsView === `atoms` ? (
|
|
78
|
-
<StateIndex tokenIndex={atomIndex} />
|
|
79
|
-
) : devtoolsView === `selectors` ? (
|
|
80
|
-
<StateIndex tokenIndex={selectorIndex} />
|
|
81
|
-
) : devtoolsView === `transactions` ? (
|
|
82
|
-
<TransactionIndex />
|
|
83
|
-
) : devtoolsView === `timelines` ? (
|
|
84
|
-
<TimelineIndex />
|
|
85
|
-
) : null}
|
|
86
|
-
</LayoutGroup>
|
|
87
|
-
</motion.main>
|
|
88
|
-
</>
|
|
89
|
-
) : null}
|
|
90
|
-
<footer>
|
|
91
|
-
<button
|
|
92
|
-
type="button"
|
|
93
|
-
onMouseDown={() => (mouseHasMoved.current = false)}
|
|
94
|
-
onMouseMove={() => (mouseHasMoved.current = true)}
|
|
95
|
-
onMouseUp={() => {
|
|
96
|
-
if (!mouseHasMoved.current) {
|
|
97
|
-
setDevtoolsAreOpen((open) => !open)
|
|
98
|
-
}
|
|
99
|
-
}}
|
|
100
|
-
>
|
|
101
|
-
👁🗨
|
|
102
|
-
</button>
|
|
103
|
-
</footer>
|
|
104
|
-
</motion.main>
|
|
105
|
-
</>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { FC } from "react"
|
|
2
|
-
|
|
3
|
-
import type { Modifier } from "~/packages/anvl/src/function"
|
|
4
|
-
|
|
5
|
-
export const OpenClose: FC<{
|
|
6
|
-
isOpen: boolean
|
|
7
|
-
setIsOpen: (next: Modifier<boolean> | boolean) => void
|
|
8
|
-
disabled?: boolean
|
|
9
|
-
}> = ({ isOpen, setIsOpen, disabled }) => {
|
|
10
|
-
return (
|
|
11
|
-
<button
|
|
12
|
-
type="button"
|
|
13
|
-
className={`carat ${isOpen ? `open` : `closed`}`}
|
|
14
|
-
onClick={() => setIsOpen((isOpen) => !isOpen)}
|
|
15
|
-
disabled={disabled}
|
|
16
|
-
>
|
|
17
|
-
▶
|
|
18
|
-
</button>
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const button = {
|
|
23
|
-
OpenClose,
|
|
24
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { ReadonlySelectorToken, StateToken } from "atom.io"
|
|
2
|
-
import { useO, useIO } from "atom.io/react"
|
|
3
|
-
import type { FC } from "react"
|
|
4
|
-
|
|
5
|
-
import { fallback } from "~/packages/anvl/src/function"
|
|
6
|
-
import { Join } from "~/packages/anvl/src/join"
|
|
7
|
-
import { isJson } from "~/packages/anvl/src/refinement/refine-json"
|
|
8
|
-
import { RelationEditor } from "~/packages/hamr/src/react-data-designer"
|
|
9
|
-
import { ElasticInput } from "~/packages/hamr/src/react-elastic-input"
|
|
10
|
-
import { JsonEditor } from "~/packages/hamr/src/react-json-editor"
|
|
11
|
-
|
|
12
|
-
export const StateEditor: FC<{
|
|
13
|
-
token: StateToken<unknown>
|
|
14
|
-
}> = ({ token }) => {
|
|
15
|
-
const [data, set] = useIO(token)
|
|
16
|
-
return isJson(data) ? (
|
|
17
|
-
<JsonEditor data={data} set={set} schema={true} />
|
|
18
|
-
) : data instanceof Join ? (
|
|
19
|
-
<RelationEditor data={data} set={set} />
|
|
20
|
-
) : (
|
|
21
|
-
<div className="json_editor">
|
|
22
|
-
<ElasticInput
|
|
23
|
-
value={
|
|
24
|
-
data instanceof Set
|
|
25
|
-
? `Set { ${JSON.stringify([...data]).slice(1, -1)} }`
|
|
26
|
-
: data instanceof Map
|
|
27
|
-
? `Map ` + JSON.stringify([...data])
|
|
28
|
-
: Object.getPrototypeOf(data).constructor.name +
|
|
29
|
-
` ` +
|
|
30
|
-
fallback(() => JSON.stringify(data), `?`)
|
|
31
|
-
}
|
|
32
|
-
disabled={true}
|
|
33
|
-
/>
|
|
34
|
-
</div>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const ReadonlySelectorViewer: FC<{
|
|
39
|
-
token: ReadonlySelectorToken<unknown>
|
|
40
|
-
}> = ({ token }) => {
|
|
41
|
-
const data = useO(token)
|
|
42
|
-
return isJson(data) ? (
|
|
43
|
-
<JsonEditor
|
|
44
|
-
data={data}
|
|
45
|
-
set={() => null}
|
|
46
|
-
schema={true}
|
|
47
|
-
isReadonly={() => true}
|
|
48
|
-
/>
|
|
49
|
-
) : (
|
|
50
|
-
<div className="json_editor">
|
|
51
|
-
<ElasticInput
|
|
52
|
-
value={
|
|
53
|
-
data instanceof Set
|
|
54
|
-
? `Set ` + JSON.stringify([...data])
|
|
55
|
-
: data instanceof Map
|
|
56
|
-
? `Map ` + JSON.stringify([...data])
|
|
57
|
-
: Object.getPrototypeOf(data).constructor.name +
|
|
58
|
-
` ` +
|
|
59
|
-
JSON.stringify(data)
|
|
60
|
-
}
|
|
61
|
-
disabled={true}
|
|
62
|
-
/>
|
|
63
|
-
</div>
|
|
64
|
-
)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export const StoreEditor: FC<{
|
|
68
|
-
token: ReadonlySelectorToken<unknown> | StateToken<unknown>
|
|
69
|
-
}> = ({ token }) => {
|
|
70
|
-
if (token.type === `readonly_selector`) {
|
|
71
|
-
return <ReadonlySelectorViewer token={token} />
|
|
72
|
-
}
|
|
73
|
-
return <StateEditor token={token} />
|
|
74
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import type { AtomToken, ReadonlySelectorToken, SelectorToken } from "atom.io"
|
|
2
|
-
import { getState, selectorFamily } from "atom.io"
|
|
3
|
-
import { useO, useIO } from "atom.io/react"
|
|
4
|
-
import type { FC } from "react"
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
isJson,
|
|
8
|
-
refineJsonType,
|
|
9
|
-
} from "~/packages/anvl/src/refinement/refine-json"
|
|
10
|
-
|
|
11
|
-
import { findViewIsOpenState, primitiveRefinery } from "."
|
|
12
|
-
import { button } from "./Button"
|
|
13
|
-
import { StoreEditor } from "./StateEditor"
|
|
14
|
-
import type { FamilyNode, StateTokenIndex } from "../introspection"
|
|
15
|
-
|
|
16
|
-
const findStateTypeState = selectorFamily<string, { key: string }>({
|
|
17
|
-
key: `👁🗨 State Type`,
|
|
18
|
-
get: (token) => ({ get }) => {
|
|
19
|
-
let state: unknown
|
|
20
|
-
try {
|
|
21
|
-
state = get(token as any)
|
|
22
|
-
} catch (error) {
|
|
23
|
-
return `error`
|
|
24
|
-
}
|
|
25
|
-
if (state === undefined) return `undefined`
|
|
26
|
-
if (isJson(state)) return refineJsonType(state).type
|
|
27
|
-
return Object.getPrototypeOf(state).constructor.name
|
|
28
|
-
},
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
export const StateIndexLeafNode: FC<{
|
|
32
|
-
node:
|
|
33
|
-
| AtomToken<unknown>
|
|
34
|
-
| ReadonlySelectorToken<unknown>
|
|
35
|
-
| SelectorToken<unknown>
|
|
36
|
-
isOpenState: AtomToken<boolean>
|
|
37
|
-
typeState: ReadonlySelectorToken<string>
|
|
38
|
-
}> = ({ node, isOpenState, typeState }) => {
|
|
39
|
-
const [isOpen, setIsOpen] = useIO(isOpenState)
|
|
40
|
-
const state = useO(node)
|
|
41
|
-
const stateType = useO(typeState)
|
|
42
|
-
|
|
43
|
-
const isPrimitive = Boolean(primitiveRefinery.refine(state))
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<>
|
|
47
|
-
<header>
|
|
48
|
-
<button.OpenClose
|
|
49
|
-
isOpen={isOpen && !isPrimitive}
|
|
50
|
-
setIsOpen={setIsOpen}
|
|
51
|
-
disabled={isPrimitive}
|
|
52
|
-
/>
|
|
53
|
-
<label
|
|
54
|
-
onClick={() => console.log(node, getState(node))}
|
|
55
|
-
onKeyUp={() => console.log(node, getState(node))}
|
|
56
|
-
>
|
|
57
|
-
<h2>{node.family?.subKey ?? node.key}</h2>
|
|
58
|
-
<span className="type detail">({stateType})</span>
|
|
59
|
-
</label>
|
|
60
|
-
{isPrimitive ? <StoreEditor token={node} /> : null}
|
|
61
|
-
</header>
|
|
62
|
-
{isOpen && !isPrimitive ? (
|
|
63
|
-
<main>
|
|
64
|
-
<StoreEditor token={node} />
|
|
65
|
-
</main>
|
|
66
|
-
) : null}
|
|
67
|
-
</>
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
export const StateIndexTreeNode: FC<{
|
|
71
|
-
node: FamilyNode<
|
|
72
|
-
AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>
|
|
73
|
-
>
|
|
74
|
-
isOpenState: AtomToken<boolean>
|
|
75
|
-
}> = ({ node, isOpenState }) => {
|
|
76
|
-
const [isOpen, setIsOpen] = useIO(isOpenState)
|
|
77
|
-
Object.entries(node.familyMembers).forEach(([key, childNode]) => {
|
|
78
|
-
findViewIsOpenState(key)
|
|
79
|
-
findStateTypeState(childNode)
|
|
80
|
-
})
|
|
81
|
-
return (
|
|
82
|
-
<>
|
|
83
|
-
<header>
|
|
84
|
-
<button.OpenClose isOpen={isOpen} setIsOpen={setIsOpen} />
|
|
85
|
-
<label>
|
|
86
|
-
<h2>{node.key}</h2>
|
|
87
|
-
<span className="type detail"> (family)</span>
|
|
88
|
-
</label>
|
|
89
|
-
</header>
|
|
90
|
-
{isOpen
|
|
91
|
-
? Object.entries(node.familyMembers).map(([key, childNode]) => (
|
|
92
|
-
<StateIndexNode
|
|
93
|
-
key={key}
|
|
94
|
-
node={childNode}
|
|
95
|
-
isOpenState={findViewIsOpenState(childNode.key)}
|
|
96
|
-
typeState={findStateTypeState(childNode)}
|
|
97
|
-
/>
|
|
98
|
-
))
|
|
99
|
-
: null}
|
|
100
|
-
</>
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export const StateIndexNode: FC<{
|
|
105
|
-
node: StateTokenIndex<
|
|
106
|
-
AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>
|
|
107
|
-
>[string]
|
|
108
|
-
isOpenState: AtomToken<boolean>
|
|
109
|
-
typeState: ReadonlySelectorToken<string>
|
|
110
|
-
}> = ({ node, isOpenState, typeState }) => {
|
|
111
|
-
if (node.key.startsWith(`👁🗨`)) {
|
|
112
|
-
return null
|
|
113
|
-
}
|
|
114
|
-
return (
|
|
115
|
-
<section className="node state">
|
|
116
|
-
{`type` in node ? (
|
|
117
|
-
<StateIndexLeafNode
|
|
118
|
-
node={node}
|
|
119
|
-
isOpenState={isOpenState}
|
|
120
|
-
typeState={typeState}
|
|
121
|
-
/>
|
|
122
|
-
) : (
|
|
123
|
-
<StateIndexTreeNode node={node} isOpenState={isOpenState} />
|
|
124
|
-
)}
|
|
125
|
-
</section>
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export const StateIndex: FC<{
|
|
130
|
-
tokenIndex: ReadonlySelectorToken<
|
|
131
|
-
StateTokenIndex<
|
|
132
|
-
| AtomToken<unknown>
|
|
133
|
-
| ReadonlySelectorToken<unknown>
|
|
134
|
-
| SelectorToken<unknown>
|
|
135
|
-
>
|
|
136
|
-
>
|
|
137
|
-
}> = ({ tokenIndex }) => {
|
|
138
|
-
const tokenIds = useO(tokenIndex)
|
|
139
|
-
return (
|
|
140
|
-
<article className="index state_index">
|
|
141
|
-
{Object.entries(tokenIds)
|
|
142
|
-
.filter(([key]) => !key.startsWith(`👁🗨`))
|
|
143
|
-
.sort()
|
|
144
|
-
.map(([key, node]) => {
|
|
145
|
-
return (
|
|
146
|
-
<StateIndexNode
|
|
147
|
-
key={key}
|
|
148
|
-
node={node}
|
|
149
|
-
isOpenState={findViewIsOpenState(node.key)}
|
|
150
|
-
typeState={findStateTypeState(node)}
|
|
151
|
-
/>
|
|
152
|
-
)
|
|
153
|
-
})}
|
|
154
|
-
</article>
|
|
155
|
-
)
|
|
156
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
undo,
|
|
3
|
-
type AtomToken,
|
|
4
|
-
type ReadonlySelectorToken,
|
|
5
|
-
type TimelineToken,
|
|
6
|
-
redo,
|
|
7
|
-
} from "atom.io"
|
|
8
|
-
import { useIO, useO } from "atom.io/react"
|
|
9
|
-
import { Fragment, type FC } from "react"
|
|
10
|
-
|
|
11
|
-
import { findTimelineState, findViewIsOpenState, timelineIndex } from "."
|
|
12
|
-
import { button } from "./Button"
|
|
13
|
-
import { article } from "./Updates"
|
|
14
|
-
import type { Timeline } from "../internal"
|
|
15
|
-
|
|
16
|
-
export const YouAreHere: FC = () => {
|
|
17
|
-
return <span className="you_are_here">you are here</span>
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const TimelineLog: FC<{
|
|
21
|
-
token: TimelineToken
|
|
22
|
-
isOpenState: AtomToken<boolean>
|
|
23
|
-
timelineState: ReadonlySelectorToken<Timeline>
|
|
24
|
-
}> = ({ token, isOpenState, timelineState }) => {
|
|
25
|
-
const timeline = useO(timelineState)
|
|
26
|
-
const [isOpen, setIsOpen] = useIO(isOpenState)
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<section className="node timeline_log">
|
|
30
|
-
<header>
|
|
31
|
-
<button.OpenClose isOpen={isOpen} setIsOpen={setIsOpen} />
|
|
32
|
-
<label>
|
|
33
|
-
<h2>{token.key}</h2>
|
|
34
|
-
<span className="detail length">
|
|
35
|
-
({timeline.at}/{timeline.history.length})
|
|
36
|
-
</span>
|
|
37
|
-
<span className="gap" />
|
|
38
|
-
<nav>
|
|
39
|
-
<button
|
|
40
|
-
type="button"
|
|
41
|
-
onClick={() => undo(token)}
|
|
42
|
-
disabled={timeline.at === 0}
|
|
43
|
-
>
|
|
44
|
-
undo
|
|
45
|
-
</button>
|
|
46
|
-
<button
|
|
47
|
-
type="button"
|
|
48
|
-
onClick={() => redo(token)}
|
|
49
|
-
disabled={timeline.at === timeline.history.length}
|
|
50
|
-
>
|
|
51
|
-
redo
|
|
52
|
-
</button>
|
|
53
|
-
</nav>
|
|
54
|
-
</label>
|
|
55
|
-
</header>
|
|
56
|
-
{isOpen ? (
|
|
57
|
-
<main>
|
|
58
|
-
{timeline.history.map((update, index) => (
|
|
59
|
-
<Fragment key={update.key + index + timeline.at}>
|
|
60
|
-
{index === timeline.at ? <YouAreHere /> : null}
|
|
61
|
-
<article.TimelineUpdate timelineUpdate={update} />
|
|
62
|
-
{index === timeline.history.length - 1 &&
|
|
63
|
-
timeline.at === timeline.history.length ? (
|
|
64
|
-
<YouAreHere />
|
|
65
|
-
) : null}
|
|
66
|
-
</Fragment>
|
|
67
|
-
))}
|
|
68
|
-
</main>
|
|
69
|
-
) : null}
|
|
70
|
-
</section>
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export const TimelineIndex: FC = () => {
|
|
75
|
-
const tokenIds = useO(timelineIndex)
|
|
76
|
-
return (
|
|
77
|
-
<article className="index timeline_index">
|
|
78
|
-
{tokenIds
|
|
79
|
-
.filter((token) => !token.key.startsWith(`👁🗨`))
|
|
80
|
-
.map((token) => {
|
|
81
|
-
return (
|
|
82
|
-
<TimelineLog
|
|
83
|
-
key={token.key}
|
|
84
|
-
token={token}
|
|
85
|
-
isOpenState={findViewIsOpenState(token.key)}
|
|
86
|
-
timelineState={findTimelineState(token.key)}
|
|
87
|
-
/>
|
|
88
|
-
)
|
|
89
|
-
})}
|
|
90
|
-
</article>
|
|
91
|
-
)
|
|
92
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AtomToken,
|
|
3
|
-
ReadonlySelectorToken,
|
|
4
|
-
TransactionToken,
|
|
5
|
-
TransactionUpdate,
|
|
6
|
-
} from "atom.io"
|
|
7
|
-
import { useIO, useO } from "atom.io/react"
|
|
8
|
-
import type { FC } from "react"
|
|
9
|
-
|
|
10
|
-
import type { ƒn } from "~/packages/anvl/src/function"
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
findTransactionLogState,
|
|
14
|
-
findViewIsOpenState,
|
|
15
|
-
transactionIndex,
|
|
16
|
-
} from "."
|
|
17
|
-
import { button } from "./Button"
|
|
18
|
-
import { article } from "./Updates"
|
|
19
|
-
|
|
20
|
-
export const TransactionLog: FC<{
|
|
21
|
-
token: TransactionToken<ƒn>
|
|
22
|
-
isOpenState: AtomToken<boolean>
|
|
23
|
-
logState: ReadonlySelectorToken<TransactionUpdate<ƒn>[]>
|
|
24
|
-
}> = ({ token, isOpenState, logState }) => {
|
|
25
|
-
const log = useO(logState)
|
|
26
|
-
const [isOpen, setIsOpen] = useIO(isOpenState)
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<section className="node transaction_log">
|
|
30
|
-
<header>
|
|
31
|
-
<button.OpenClose isOpen={isOpen} setIsOpen={setIsOpen} />
|
|
32
|
-
<label>
|
|
33
|
-
<h2>{token.key}</h2>
|
|
34
|
-
<span className="detail length">({log.length})</span>
|
|
35
|
-
</label>
|
|
36
|
-
</header>
|
|
37
|
-
{isOpen ? (
|
|
38
|
-
<main>
|
|
39
|
-
{log.map((update, index) => (
|
|
40
|
-
<article.TransactionUpdate
|
|
41
|
-
key={update.key + index}
|
|
42
|
-
serialNumber={index}
|
|
43
|
-
transactionUpdate={update}
|
|
44
|
-
/>
|
|
45
|
-
))}
|
|
46
|
-
</main>
|
|
47
|
-
) : null}
|
|
48
|
-
</section>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export const TransactionIndex: FC = () => {
|
|
53
|
-
const tokenIds = useO(transactionIndex)
|
|
54
|
-
return (
|
|
55
|
-
<article className="index transaction_index">
|
|
56
|
-
{tokenIds
|
|
57
|
-
.filter((token) => !token.key.startsWith(`👁🗨`))
|
|
58
|
-
.map((token) => {
|
|
59
|
-
return (
|
|
60
|
-
<TransactionLog
|
|
61
|
-
key={token.key}
|
|
62
|
-
token={token}
|
|
63
|
-
isOpenState={findViewIsOpenState(token.key)}
|
|
64
|
-
logState={findTransactionLogState(token.key)}
|
|
65
|
-
/>
|
|
66
|
-
)
|
|
67
|
-
})}
|
|
68
|
-
</article>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
@@ -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
|
-
}
|