@myko/ui-svelte 4.4.0 → 4.4.3
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/{src/lib → dist}/components/ConnectionStats.svelte +8 -22
- package/dist/components/ConnectionStats.svelte.d.ts +10 -0
- package/dist/components/EntityDiffBadge.svelte +10 -0
- package/dist/components/EntityDiffBadge.svelte.d.ts +7 -0
- package/{src/lib → dist}/components/EntityDiffFields.svelte +27 -49
- package/dist/components/EntityDiffFields.svelte.d.ts +11 -0
- package/{src/lib → dist}/components/EntityDiffNode.svelte +25 -43
- package/dist/components/EntityDiffNode.svelte.d.ts +14 -0
- package/{src/lib → dist}/components/EntityDiffTree.svelte +150 -200
- package/dist/components/EntityDiffTree.svelte.d.ts +21 -0
- package/dist/components/Logs.svelte +30 -0
- package/dist/components/Logs.svelte.d.ts +7 -0
- package/dist/components/Query.svelte +21 -0
- package/dist/components/Query.svelte.d.ts +35 -0
- package/dist/components/Report.svelte +13 -0
- package/dist/components/Report.svelte.d.ts +32 -0
- package/dist/components/Search.svelte +46 -0
- package/dist/components/Search.svelte.d.ts +56 -0
- package/dist/components/ServerView.svelte +76 -0
- package/dist/components/ServerView.svelte.d.ts +8 -0
- package/dist/components/state/resolutions.d.ts +11 -0
- package/dist/components/state/resolutions.js +129 -0
- package/dist/components/state/viewstate.svelte.d.ts +60 -0
- package/dist/components/state/viewstate.svelte.js +259 -0
- package/dist/components/state/windback.svelte.d.ts +16 -0
- package/dist/components/state/windback.svelte.js +65 -0
- package/dist/components/transactions/EntityHistory.svelte +135 -0
- package/dist/components/transactions/EntityHistory.svelte.d.ts +10 -0
- package/{src/lib → dist}/components/transactions/TimeStrip.svelte +18 -25
- package/dist/components/transactions/TimeStrip.svelte.d.ts +3 -0
- package/dist/components/transactions/TransactionDetails.svelte +24 -0
- package/dist/components/transactions/TransactionDetails.svelte.d.ts +7 -0
- package/{src/lib → dist}/components/transactions/TransactionEvent.svelte +20 -32
- package/dist/components/transactions/TransactionEvent.svelte.d.ts +7 -0
- package/{src/lib → dist}/components/transactions/TransactionEventGroup.svelte +8 -13
- package/dist/components/transactions/TransactionEventGroup.svelte.d.ts +8 -0
- package/dist/components/transactions/Transactions.svelte +94 -0
- package/dist/components/transactions/Transactions.svelte.d.ts +8 -0
- package/{src/lib → dist}/components/transactions/TransactonView.svelte +3 -7
- package/dist/components/transactions/TransactonView.svelte.d.ts +7 -0
- package/{src/lib → dist}/components/windback/WindbackFrame.svelte +3 -6
- package/dist/components/windback/WindbackFrame.svelte.d.ts +7 -0
- package/dist/components/windback/index.js +1 -0
- package/dist/index.d.ts +18 -0
- package/{src/lib/index.ts → dist/index.js} +2 -15
- package/dist/services/svelte-client.svelte.d.ts +278 -0
- package/dist/services/svelte-client.svelte.js +678 -0
- package/dist/utils/entity-apply.d.ts +17 -0
- package/dist/utils/entity-apply.js +35 -0
- package/dist/utils/entity-diff.d.ts +40 -0
- package/dist/utils/entity-diff.js +57 -0
- package/dist/utils/entity-tree.d.ts +24 -0
- package/dist/utils/entity-tree.js +111 -0
- package/package.json +13 -9
- package/.prettierignore +0 -4
- package/.prettierrc +0 -15
- package/src/app.d.ts +0 -13
- package/src/app.html +0 -12
- package/src/lib/components/EntityDiffBadge.svelte +0 -18
- package/src/lib/components/Logs.svelte +0 -37
- package/src/lib/components/Query.svelte +0 -34
- package/src/lib/components/Report.svelte +0 -25
- package/src/lib/components/Search.svelte +0 -85
- package/src/lib/components/ServerView.svelte +0 -95
- package/src/lib/components/state/resolutions.ts +0 -137
- package/src/lib/components/state/viewstate.svelte.ts +0 -375
- package/src/lib/components/state/windback.svelte.ts +0 -88
- package/src/lib/components/transactions/EntityHistory.svelte +0 -173
- package/src/lib/components/transactions/TransactionDetails.svelte +0 -26
- package/src/lib/components/transactions/Transactions.svelte +0 -111
- package/src/lib/services/svelte-client.svelte.ts +0 -863
- package/src/lib/utils/entity-apply.ts +0 -47
- package/src/lib/utils/entity-diff.ts +0 -105
- package/src/lib/utils/entity-tree.ts +0 -130
- package/src/routes/+page.svelte +0 -3
- package/static/favicon.png +0 -0
- package/svelte.config.js +0 -18
- package/tsconfig.json +0 -13
- package/vite.config.ts +0 -6
- /package/{src/lib/components/windback/index.ts → dist/components/windback/index.d.ts} +0 -0
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { myko as client } from '../../services/svelte-client.svelte.js';
|
|
3
|
-
import { ChildEntitiesAllTime, EventsForEntity, type EventContainer, type ID } from '@myko/core';
|
|
4
|
-
import { startWith } from 'rxjs';
|
|
5
|
-
import { getContext } from 'svelte';
|
|
6
|
-
import {
|
|
7
|
-
fromISOMemo,
|
|
8
|
-
isoToMillisMemo,
|
|
9
|
-
TRANSACTIONS_VIEW_STATE,
|
|
10
|
-
type TransactionsViewState
|
|
11
|
-
} from '../state/viewstate.svelte.js';
|
|
12
|
-
|
|
13
|
-
import { inview } from 'svelte-inview';
|
|
14
|
-
import EntityHistory from './EntityHistory.svelte';
|
|
15
|
-
import TransactionEvent from './TransactionEvent.svelte';
|
|
16
|
-
import TransactionEventGroup from './TransactionEventGroup.svelte';
|
|
17
|
-
|
|
18
|
-
const {
|
|
19
|
-
id,
|
|
20
|
-
itemType,
|
|
21
|
-
level = 0
|
|
22
|
-
}: {
|
|
23
|
-
id: ID;
|
|
24
|
-
itemType: string;
|
|
25
|
-
level?: number;
|
|
26
|
-
} = $props();
|
|
27
|
-
|
|
28
|
-
const viewState = getContext(TRANSACTIONS_VIEW_STATE) as TransactionsViewState;
|
|
29
|
-
|
|
30
|
-
const start = $derived(viewState.leftTime.toUTC().toISO());
|
|
31
|
-
const end = $derived(viewState.rightTime.toUTC().toISO());
|
|
32
|
-
|
|
33
|
-
const isRoot = $derived(level == 0);
|
|
34
|
-
|
|
35
|
-
const history = client.watchQuery(new EventsForEntity(id)).pipe(startWith([]));
|
|
36
|
-
|
|
37
|
-
const name = $derived(
|
|
38
|
-
$history.length > 0 && $history[0].event.item && typeof $history[0].event.item === 'object' && 'name' in $history[0].event.item
|
|
39
|
-
? $history[0].event.item['name']
|
|
40
|
-
: `Unknown ${itemType}`
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
$effect(() => {
|
|
44
|
-
const firstEvent = $history && $history.length > 0 ? $history[0] : undefined;
|
|
45
|
-
if (isRoot && firstEvent) {
|
|
46
|
-
viewState.timeZero = fromISOMemo(firstEvent.event.createdAt);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
$effect(() => {
|
|
51
|
-
viewState.registerEvents($history.map((x: EventContainer) => x.event.createdAt));
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const visibleEvents = $derived(
|
|
55
|
-
$history.filter(
|
|
56
|
-
(x: EventContainer) => (start ? x.event.createdAt >= start : true) && (end ? x.event.createdAt <= end : true)
|
|
57
|
-
)
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
type EventRenderInfo = {
|
|
61
|
-
eventContainer: EventContainer;
|
|
62
|
-
leftPx: number;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const visibleEventRenders: EventRenderInfo[] = $derived(
|
|
66
|
-
visibleEvents.map((x: EventContainer) => {
|
|
67
|
-
const timeMilis = $derived(isoToMillisMemo(x.event.createdAt));
|
|
68
|
-
|
|
69
|
-
const leftTimeMilis = $derived(timeMilis - viewState.leftTimeMilis);
|
|
70
|
-
|
|
71
|
-
const leftPx = $derived(leftTimeMilis / viewState.durationMilisPerPx);
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
eventContainer: x,
|
|
75
|
-
leftPx
|
|
76
|
-
};
|
|
77
|
-
})
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
type EventRenderGroup = {
|
|
81
|
-
firstPx: number;
|
|
82
|
-
lastPx: number;
|
|
83
|
-
events: EventRenderInfo[];
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const eventGroups = $derived(
|
|
87
|
-
visibleEventRenders.reduce((acc, x) => {
|
|
88
|
-
const lastGroup = acc[acc.length - 1];
|
|
89
|
-
if (lastGroup && x.leftPx - lastGroup.lastPx < 10) {
|
|
90
|
-
lastGroup.lastPx = x.leftPx;
|
|
91
|
-
lastGroup.events.push(x);
|
|
92
|
-
} else {
|
|
93
|
-
acc.push({
|
|
94
|
-
firstPx: x.leftPx,
|
|
95
|
-
lastPx: x.leftPx,
|
|
96
|
-
events: [x]
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
return acc;
|
|
100
|
-
}, [] as EventRenderGroup[])
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
const children = $derived(
|
|
104
|
-
client
|
|
105
|
-
.watchReport(
|
|
106
|
-
new ChildEntitiesAllTime({
|
|
107
|
-
parentType: itemType,
|
|
108
|
-
parentId: id
|
|
109
|
-
})
|
|
110
|
-
)
|
|
111
|
-
.pipe(startWith([]))
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
let isInView = $state(false);
|
|
115
|
-
</script>
|
|
116
|
-
|
|
117
|
-
<div class="entity-history" style="min-height:{($children.length + 1) * 10}px;">
|
|
118
|
-
<div
|
|
119
|
-
class="self"
|
|
120
|
-
use:inview={{}}
|
|
121
|
-
oninview_enter={() => (isInView = true)}
|
|
122
|
-
oninview_leave={() => (isInView = false)}
|
|
123
|
-
>
|
|
124
|
-
<h2 style="margin-left: {level * 1}rem;">
|
|
125
|
-
{name}
|
|
126
|
-
{$children.length}
|
|
127
|
-
</h2>
|
|
128
|
-
<div class="events">
|
|
129
|
-
{#if isInView}
|
|
130
|
-
{#each eventGroups as group}
|
|
131
|
-
{#if group.events.length === 1}
|
|
132
|
-
<TransactionEvent event={group.events[0].eventContainer.event} />
|
|
133
|
-
{:else}
|
|
134
|
-
<TransactionEventGroup
|
|
135
|
-
firstPx={group.firstPx}
|
|
136
|
-
lastPx={group.lastPx}
|
|
137
|
-
numEvents={group.events.length}
|
|
138
|
-
/>
|
|
139
|
-
{/if}
|
|
140
|
-
{/each}
|
|
141
|
-
{/if}
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
|
|
145
|
-
{#each $children as child (child.id)}
|
|
146
|
-
<EntityHistory id={child.id} itemType={child.itemType} level={level + 1} />
|
|
147
|
-
{/each}
|
|
148
|
-
</div>
|
|
149
|
-
|
|
150
|
-
<style>
|
|
151
|
-
.self {
|
|
152
|
-
display: flex;
|
|
153
|
-
align-items: center;
|
|
154
|
-
position: relative;
|
|
155
|
-
margin-bottom: 0.1rem;
|
|
156
|
-
}
|
|
157
|
-
.entity-history {
|
|
158
|
-
position: relative;
|
|
159
|
-
background-color: rgba(255, 255, 255, 0.05);
|
|
160
|
-
min-height: 10px;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
h2 {
|
|
164
|
-
opacity: 0.5;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.events {
|
|
168
|
-
position: absolute;
|
|
169
|
-
display: flex;
|
|
170
|
-
align-items: center;
|
|
171
|
-
inset: 0;
|
|
172
|
-
}
|
|
173
|
-
</style>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { myko as client } from '../../services/svelte-client.svelte.js';
|
|
3
|
-
import { EventsForTransaction, type ID } from '@myko/core';
|
|
4
|
-
import { fromISOMemo, FULL_DATE_FORMAT } from '../state/viewstate.svelte.js';
|
|
5
|
-
|
|
6
|
-
const { tx }: { tx: ID } = $props();
|
|
7
|
-
const events = client.watchReport(new EventsForTransaction({ transactionId: tx }));
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
{#if $events}
|
|
11
|
-
{#each $events as event (event)}
|
|
12
|
-
<div class="div">
|
|
13
|
-
<p>{event.itemType}</p>
|
|
14
|
-
<p>{event.changeType}</p>
|
|
15
|
-
<p>{fromISOMemo(event.createdAt).diffNow().toHuman()}</p>
|
|
16
|
-
<p>{fromISOMemo(event.createdAt).toFormat(FULL_DATE_FORMAT)}</p>
|
|
17
|
-
</div>
|
|
18
|
-
{/each}
|
|
19
|
-
{/if}
|
|
20
|
-
|
|
21
|
-
<style>
|
|
22
|
-
.div {
|
|
23
|
-
display: flex;
|
|
24
|
-
gap: 1rem;
|
|
25
|
-
}
|
|
26
|
-
</style>
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { myko as client } from '../../services/svelte-client.svelte.js';
|
|
3
|
-
import { EntitySnapshotDifference, type ID } from '@myko/core';
|
|
4
|
-
import { setContext } from 'svelte';
|
|
5
|
-
import { watchResize } from 'svelte-watch-resize';
|
|
6
|
-
import { TRANSACTIONS_VIEW_STATE, TransactionsViewState } from '../state/viewstate.svelte';
|
|
7
|
-
import { windbackState } from '../state/windback.svelte.js';
|
|
8
|
-
import EntityHistory from './EntityHistory.svelte';
|
|
9
|
-
import TimeStrip from './TimeStrip.svelte';
|
|
10
|
-
|
|
11
|
-
const viewstate = new TransactionsViewState(windbackState);
|
|
12
|
-
|
|
13
|
-
setContext(TRANSACTIONS_VIEW_STATE, viewstate);
|
|
14
|
-
|
|
15
|
-
let isMouseDown = $state(false);
|
|
16
|
-
|
|
17
|
-
const {
|
|
18
|
-
entrypointId,
|
|
19
|
-
entrypointItemType
|
|
20
|
-
}: {
|
|
21
|
-
entrypointId: ID;
|
|
22
|
-
entrypointItemType: string;
|
|
23
|
-
} = $props();
|
|
24
|
-
|
|
25
|
-
const onwheel = (e: WheelEvent) => {
|
|
26
|
-
if (e.ctrlKey || e.metaKey) {
|
|
27
|
-
e.preventDefault();
|
|
28
|
-
viewstate.zoom(e.deltaY);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (e.shiftKey) {
|
|
32
|
-
e.preventDefault();
|
|
33
|
-
viewstate.pan(e.deltaY);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const onmousemove = (e: MouseEvent) => {
|
|
38
|
-
viewstate.mouseX = e.clientX;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const onkeydown = (e: KeyboardEvent) => {
|
|
42
|
-
if (e.key === 'z') {
|
|
43
|
-
viewstate.zoomAllTheWayOut();
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const onmousedown = (e: MouseEvent) => {
|
|
48
|
-
e.stopPropagation();
|
|
49
|
-
if (e.button === 0) {
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
viewstate.startDragWindback();
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const onmouseup = (e: MouseEvent) => {
|
|
56
|
-
e.stopPropagation();
|
|
57
|
-
|
|
58
|
-
viewstate.stopDragWindback();
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const diff = client.watchReport(
|
|
62
|
-
new EntitySnapshotDifference({
|
|
63
|
-
parentType: entrypointItemType,
|
|
64
|
-
parentId: entrypointId
|
|
65
|
-
})
|
|
66
|
-
);
|
|
67
|
-
</script>
|
|
68
|
-
|
|
69
|
-
<svelte:window {onkeydown} {onmousedown} {onmouseup} />
|
|
70
|
-
<div
|
|
71
|
-
class:windbackCursor={viewstate.isOverWindback}
|
|
72
|
-
class="transactions-frame extra class"
|
|
73
|
-
role="presentation"
|
|
74
|
-
use:watchResize={(e) => {
|
|
75
|
-
console.log('RESIZE', e.clientWidth);
|
|
76
|
-
viewstate.width = e.clientWidth;
|
|
77
|
-
}}
|
|
78
|
-
{onwheel}
|
|
79
|
-
{onmousemove}
|
|
80
|
-
>
|
|
81
|
-
<div class="header pad">
|
|
82
|
-
<TimeStrip></TimeStrip>
|
|
83
|
-
</div>
|
|
84
|
-
<div class="scroll pad">
|
|
85
|
-
<EntityHistory id={entrypointId} itemType={entrypointItemType} />
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
<style>
|
|
90
|
-
.transactions-frame {
|
|
91
|
-
height: 100%;
|
|
92
|
-
min-height: 100%;
|
|
93
|
-
overflow: hidden;
|
|
94
|
-
display: flex;
|
|
95
|
-
flex-direction: column;
|
|
96
|
-
justify-content: flex-start;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.scroll {
|
|
100
|
-
overflow: scroll;
|
|
101
|
-
scrollbar-width: none;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.header {
|
|
105
|
-
flex-shrink: 0;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.windbackCursor {
|
|
109
|
-
cursor: ew-resize;
|
|
110
|
-
}
|
|
111
|
-
</style>
|