@pipelex/mthds-ui 0.40.0 → 0.42.0
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 +5 -5
- package/dist/{chunk-RU3CIXFC.js → chunk-6S5TQPTO.js} +121 -23
- package/dist/chunk-6S5TQPTO.js.map +1 -0
- package/dist/graph/react/index.js.map +1 -1
- package/dist/standalone/graph-standalone.html +127 -115
- package/dist/standalone/graph-viewer.css +1 -1
- package/dist/standalone/graph-viewer.js +126 -114
- package/dist/static-graph/index.js +7 -3
- package/dist/static-graph/index.js.map +1 -1
- package/dist/timeline/index.d.ts +105 -7
- package/dist/timeline/index.js +7 -1
- package/dist/timeline/react/RunTimeline.css +93 -0
- package/dist/timeline/react/index.d.ts +12 -3
- package/dist/timeline/react/index.js +178 -38
- package/dist/timeline/react/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-RU3CIXFC.js.map +0 -1
|
@@ -6,11 +6,13 @@ import {
|
|
|
6
6
|
import "../../chunk-N2F62MW7.js";
|
|
7
7
|
import {
|
|
8
8
|
INVOCATION_STATUS,
|
|
9
|
+
KEPT_VISIBLE_REASON,
|
|
9
10
|
PROGRESS_MODE,
|
|
10
11
|
RUN_PROGRESS_STATUS,
|
|
11
12
|
SIMPLE_LINE_KIND,
|
|
12
13
|
SIMPLE_LINE_STATE,
|
|
13
14
|
SIMPLE_RUN_NOTE_REASON,
|
|
15
|
+
TIMELINE_ENTRY_KIND,
|
|
14
16
|
TIMELINE_STYLE,
|
|
15
17
|
TIMELINE_STYLES,
|
|
16
18
|
barFollowsClock,
|
|
@@ -31,7 +33,7 @@ import {
|
|
|
31
33
|
timelineTicks,
|
|
32
34
|
timelineWindowAt,
|
|
33
35
|
timestampMs
|
|
34
|
-
} from "../../chunk-
|
|
36
|
+
} from "../../chunk-6S5TQPTO.js";
|
|
35
37
|
import {
|
|
36
38
|
outcomeLabel
|
|
37
39
|
} from "../../chunk-P6IGZVWE.js";
|
|
@@ -97,23 +99,29 @@ function useReadingClock(held, stream, { now, live, followsClock: followsClock2,
|
|
|
97
99
|
return { nowMs: ticking ? shown.ms : base, ticking };
|
|
98
100
|
}
|
|
99
101
|
|
|
100
|
-
// src/timeline/react/
|
|
102
|
+
// src/timeline/react/streamRecord.ts
|
|
101
103
|
import * as React2 from "react";
|
|
102
|
-
var
|
|
103
|
-
function
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
var EMPTY_RECORD = Object.freeze({});
|
|
105
|
+
function emptyRecord() {
|
|
106
|
+
return EMPTY_RECORD;
|
|
107
|
+
}
|
|
108
|
+
function useStreamRecord(stream) {
|
|
109
|
+
const [state, setState] = React2.useState({ stream, values: emptyRecord() });
|
|
110
|
+
if (state.stream !== stream) {
|
|
111
|
+
setState({ stream, values: emptyRecord() });
|
|
112
|
+
}
|
|
113
|
+
const set = React2.useCallback(
|
|
114
|
+
(key, value) => {
|
|
107
115
|
setState((previous) => ({
|
|
108
116
|
stream,
|
|
109
|
-
|
|
110
|
-
[key]:
|
|
117
|
+
values: __spreadProps(__spreadValues({}, previous.stream === stream ? previous.values : emptyRecord()), {
|
|
118
|
+
[key]: value
|
|
111
119
|
})
|
|
112
120
|
}));
|
|
113
121
|
},
|
|
114
122
|
[stream]
|
|
115
123
|
);
|
|
116
|
-
return {
|
|
124
|
+
return { values: state.stream === stream ? state.values : emptyRecord(), set };
|
|
117
125
|
}
|
|
118
126
|
|
|
119
127
|
// src/timeline/react/styles/simple/SimpleProgressView.tsx
|
|
@@ -641,7 +649,7 @@ function TimelineStyleMenu({ value, options, onChange, slotRef }) {
|
|
|
641
649
|
}
|
|
642
650
|
|
|
643
651
|
// src/timeline/react/RunTimeline.tsx
|
|
644
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
652
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
645
653
|
var CLOCK_TICK_MS = {
|
|
646
654
|
[TIMELINE_STYLE.DETAILED]: 250,
|
|
647
655
|
[TIMELINE_STYLE.SIMPLE]: 1e3
|
|
@@ -846,13 +854,121 @@ var TimelineRowView = React4.memo(function TimelineRowView2({
|
|
|
846
854
|
retrying ? `attempt ${invocation.attempts}` : `${invocation.attempts} attempts`
|
|
847
855
|
] }),
|
|
848
856
|
invocation.degradation && /* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-badge mthds-run-timeline-badge--stuck", children: "stuck" }),
|
|
849
|
-
batch &&
|
|
857
|
+
batch && batch.hiddenItemCount > 0 && /* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-sr", children: `, ${batch.hiddenItemCount} items hidden` }),
|
|
850
858
|
/* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-detail", children: rowDetailText(row, bar) })
|
|
851
859
|
] })
|
|
852
860
|
]
|
|
853
861
|
}
|
|
854
862
|
);
|
|
855
863
|
});
|
|
864
|
+
var PAGER_KEY_PREFIX = "pager:";
|
|
865
|
+
var TROUBLE_WORD = {
|
|
866
|
+
[KEPT_VISIBLE_REASON.FAILED]: "failed",
|
|
867
|
+
[KEPT_VISIBLE_REASON.DEGRADED]: "stuck"
|
|
868
|
+
};
|
|
869
|
+
function troubleNotShownText(batch) {
|
|
870
|
+
return [KEPT_VISIBLE_REASON.FAILED, KEPT_VISIBLE_REASON.DEGRADED].filter((reason) => batch.troubleNotShown[reason] > 0).map((reason) => `${batch.troubleNotShown[reason]} more ${TROUBLE_WORD[reason]}`).join(" \xB7 ");
|
|
871
|
+
}
|
|
872
|
+
var ItemPagerView = React4.memo(function ItemPagerView2({
|
|
873
|
+
pager,
|
|
874
|
+
onToggleBatch,
|
|
875
|
+
onTurnPage
|
|
876
|
+
}) {
|
|
877
|
+
const { batch, batchPath, pipeCode, depth } = pager;
|
|
878
|
+
const navRef = React4.useRef(null);
|
|
879
|
+
const refocusRef = React4.useRef(false);
|
|
880
|
+
React4.useEffect(() => {
|
|
881
|
+
var _a;
|
|
882
|
+
if (!refocusRef.current) return;
|
|
883
|
+
refocusRef.current = false;
|
|
884
|
+
const nav = navRef.current;
|
|
885
|
+
if (nav && !nav.contains(document.activeElement)) (_a = nav.querySelector("button")) == null ? void 0 : _a.focus();
|
|
886
|
+
});
|
|
887
|
+
const turn = (page2, expand) => {
|
|
888
|
+
refocusRef.current = true;
|
|
889
|
+
onTurnPage(batchPath, page2);
|
|
890
|
+
if (expand) onToggleBatch(batchPath, true);
|
|
891
|
+
};
|
|
892
|
+
const page = batch.page;
|
|
893
|
+
const jump = batch.nextTrouble;
|
|
894
|
+
let content;
|
|
895
|
+
if (batch.expanded && page) {
|
|
896
|
+
const atFirst = page.index === 0;
|
|
897
|
+
const atLast = page.index === page.count - 1;
|
|
898
|
+
content = /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
899
|
+
/* @__PURE__ */ jsxs3(
|
|
900
|
+
"button",
|
|
901
|
+
{
|
|
902
|
+
type: "button",
|
|
903
|
+
className: "mthds-run-timeline-pager-btn",
|
|
904
|
+
"aria-disabled": atFirst,
|
|
905
|
+
onClick: () => !atFirst && turn(page.index - 1, false),
|
|
906
|
+
children: [
|
|
907
|
+
/* @__PURE__ */ jsx3("span", { "aria-hidden": "true", children: "\u2039" }),
|
|
908
|
+
"Previous"
|
|
909
|
+
]
|
|
910
|
+
},
|
|
911
|
+
"previous"
|
|
912
|
+
),
|
|
913
|
+
/* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-pager-range", "aria-live": "polite", children: `Items ${page.firstItem}\u2013${page.lastItem} of ${page.itemCount}` }, "range"),
|
|
914
|
+
/* @__PURE__ */ jsxs3(
|
|
915
|
+
"button",
|
|
916
|
+
{
|
|
917
|
+
type: "button",
|
|
918
|
+
className: "mthds-run-timeline-pager-btn",
|
|
919
|
+
"aria-disabled": atLast,
|
|
920
|
+
onClick: () => !atLast && turn(page.index + 1, false),
|
|
921
|
+
children: [
|
|
922
|
+
"Next",
|
|
923
|
+
/* @__PURE__ */ jsx3("span", { "aria-hidden": "true", children: "\u203A" })
|
|
924
|
+
]
|
|
925
|
+
},
|
|
926
|
+
"next"
|
|
927
|
+
),
|
|
928
|
+
jump && /* @__PURE__ */ jsx3(
|
|
929
|
+
"button",
|
|
930
|
+
{
|
|
931
|
+
type: "button",
|
|
932
|
+
className: `mthds-run-timeline-pager-btn mthds-run-timeline-pager-jump mthds-run-timeline-pager-jump--${jump.reason}`,
|
|
933
|
+
onClick: () => turn(jump.page, false),
|
|
934
|
+
children: `Next ${TROUBLE_WORD[jump.reason]} \xB7 item ${jump.item}`
|
|
935
|
+
},
|
|
936
|
+
"jump"
|
|
937
|
+
)
|
|
938
|
+
] });
|
|
939
|
+
} else {
|
|
940
|
+
content = /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
941
|
+
/* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-pager-more", children: troubleNotShownText(batch) }, "more"),
|
|
942
|
+
jump && /* @__PURE__ */ jsx3(
|
|
943
|
+
"button",
|
|
944
|
+
{
|
|
945
|
+
type: "button",
|
|
946
|
+
className: `mthds-run-timeline-pager-btn mthds-run-timeline-pager-jump mthds-run-timeline-pager-jump--${jump.reason}`,
|
|
947
|
+
onClick: () => turn(jump.page, true),
|
|
948
|
+
children: `Expand at item ${jump.item}`
|
|
949
|
+
},
|
|
950
|
+
"expand"
|
|
951
|
+
)
|
|
952
|
+
] });
|
|
953
|
+
}
|
|
954
|
+
return /* @__PURE__ */ jsx3(
|
|
955
|
+
"li",
|
|
956
|
+
{
|
|
957
|
+
className: "mthds-run-timeline-pager",
|
|
958
|
+
"data-pager-for": batchPath,
|
|
959
|
+
style: { paddingLeft: `calc(${depth} * var(--mthds-run-timeline-indent))` },
|
|
960
|
+
children: /* @__PURE__ */ jsx3(
|
|
961
|
+
"nav",
|
|
962
|
+
{
|
|
963
|
+
ref: navRef,
|
|
964
|
+
className: "mthds-run-timeline-pager-nav",
|
|
965
|
+
"aria-label": `Items of ${pipeCode}`,
|
|
966
|
+
children: content
|
|
967
|
+
}
|
|
968
|
+
)
|
|
969
|
+
}
|
|
970
|
+
);
|
|
971
|
+
});
|
|
856
972
|
function RunTimeline({
|
|
857
973
|
snapshot,
|
|
858
974
|
theme = GRAPH_THEME_MODE.SYSTEM,
|
|
@@ -866,6 +982,7 @@ function RunTimeline({
|
|
|
866
982
|
pipeRegistry,
|
|
867
983
|
entryPipeRef,
|
|
868
984
|
wideBatchThreshold,
|
|
985
|
+
batchPageSize,
|
|
869
986
|
wideParallelThreshold,
|
|
870
987
|
className
|
|
871
988
|
}) {
|
|
@@ -936,8 +1053,9 @@ function RunTimeline({
|
|
|
936
1053
|
followsClock: followsClock2,
|
|
937
1054
|
tickMs: CLOCK_TICK_MS[activeStyle]
|
|
938
1055
|
});
|
|
939
|
-
const detailedExpansion =
|
|
940
|
-
const
|
|
1056
|
+
const detailedExpansion = useStreamRecord(streamKey);
|
|
1057
|
+
const detailedPages = useStreamRecord(streamKey);
|
|
1058
|
+
const simpleExpansion = useStreamRecord(streamKey);
|
|
941
1059
|
const views = {
|
|
942
1060
|
[TIMELINE_STYLE.SIMPLE]: () => /* @__PURE__ */ jsx3(
|
|
943
1061
|
SimpleProgressView,
|
|
@@ -947,8 +1065,8 @@ function RunTimeline({
|
|
|
947
1065
|
times,
|
|
948
1066
|
nowMs: clock.nowMs,
|
|
949
1067
|
ticking: clock.ticking,
|
|
950
|
-
expanded: simpleExpansion.
|
|
951
|
-
onToggle: simpleExpansion.
|
|
1068
|
+
expanded: simpleExpansion.values,
|
|
1069
|
+
onToggle: simpleExpansion.set,
|
|
952
1070
|
pipeRegistry,
|
|
953
1071
|
entryPipeRef,
|
|
954
1072
|
wideParallelThreshold,
|
|
@@ -964,9 +1082,12 @@ function RunTimeline({
|
|
|
964
1082
|
times,
|
|
965
1083
|
nowMs: clock.nowMs,
|
|
966
1084
|
ticking: clock.ticking,
|
|
967
|
-
expandedBatches: detailedExpansion.
|
|
968
|
-
onToggleBatch: detailedExpansion.
|
|
1085
|
+
expandedBatches: detailedExpansion.values,
|
|
1086
|
+
onToggleBatch: detailedExpansion.set,
|
|
1087
|
+
batchPages: detailedPages.values,
|
|
1088
|
+
onTurnPage: detailedPages.set,
|
|
969
1089
|
wideBatchThreshold,
|
|
1090
|
+
batchPageSize,
|
|
970
1091
|
containerClassName,
|
|
971
1092
|
containerStyle: paletteStyle,
|
|
972
1093
|
headerEnd
|
|
@@ -982,22 +1103,31 @@ function DetailedTimeline({
|
|
|
982
1103
|
ticking,
|
|
983
1104
|
expandedBatches,
|
|
984
1105
|
onToggleBatch: toggleBatch,
|
|
1106
|
+
batchPages,
|
|
1107
|
+
onTurnPage: turnPage,
|
|
985
1108
|
wideBatchThreshold,
|
|
1109
|
+
batchPageSize,
|
|
986
1110
|
containerClassName,
|
|
987
1111
|
containerStyle,
|
|
988
1112
|
headerEnd
|
|
989
1113
|
}) {
|
|
990
|
-
const
|
|
991
|
-
() => buildTimelineRows(held, { expandedBatches, wideBatchThreshold }),
|
|
992
|
-
[held, expandedBatches, wideBatchThreshold]
|
|
1114
|
+
const entries = React4.useMemo(
|
|
1115
|
+
() => buildTimelineRows(held, { expandedBatches, wideBatchThreshold, batchPages, batchPageSize }),
|
|
1116
|
+
[held, expandedBatches, wideBatchThreshold, batchPages, batchPageSize]
|
|
993
1117
|
);
|
|
994
|
-
const
|
|
995
|
-
() =>
|
|
1118
|
+
const drawnEntries = React4.useMemo(
|
|
1119
|
+
() => entries.map((entry) => {
|
|
996
1120
|
var _a;
|
|
997
|
-
|
|
998
|
-
|
|
1121
|
+
if (entry.kind === TIMELINE_ENTRY_KIND.PAGER) return entry;
|
|
1122
|
+
const rowTimes = (_a = times.invocations.get(entry.path)) != null ? _a : invocationTimes(entry.invocation);
|
|
1123
|
+
return {
|
|
1124
|
+
kind: entry.kind,
|
|
1125
|
+
row: entry,
|
|
1126
|
+
times: rowTimes,
|
|
1127
|
+
followsClock: barFollowsClock(entry.invocation, rowTimes)
|
|
1128
|
+
};
|
|
999
1129
|
}),
|
|
1000
|
-
[
|
|
1130
|
+
[entries, times]
|
|
1001
1131
|
);
|
|
1002
1132
|
const axis = timelineWindowAt(times, nowMs);
|
|
1003
1133
|
const [axisTrackRef, tickBudget] = useTickBudget();
|
|
@@ -1027,7 +1157,7 @@ function DetailedTimeline({
|
|
|
1027
1157
|
headerEnd
|
|
1028
1158
|
] }),
|
|
1029
1159
|
held.degradation && /* @__PURE__ */ jsx3("p", { className: "mthds-run-timeline-degradation", role: "status", children: held.degradation.message }),
|
|
1030
|
-
|
|
1160
|
+
entries.length === 0 ? (
|
|
1031
1161
|
// A run that ended with nothing to draw, failed or canceled before its
|
|
1032
1162
|
// first invocation started, is waiting for nothing.
|
|
1033
1163
|
/* @__PURE__ */ jsx3("p", { className: "mthds-run-timeline-empty", children: isRunEnded(held.status) ? "No progress was recorded." : "Nothing has started yet." })
|
|
@@ -1049,17 +1179,27 @@ function DetailedTimeline({
|
|
|
1049
1179
|
)) }),
|
|
1050
1180
|
/* @__PURE__ */ jsx3("span", { className: "mthds-run-timeline-axis-spacer" })
|
|
1051
1181
|
] }),
|
|
1052
|
-
/* @__PURE__ */ jsx3("ol", { className: "mthds-run-timeline-rows", children:
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1182
|
+
/* @__PURE__ */ jsx3("ol", { className: "mthds-run-timeline-rows", children: drawnEntries.map(
|
|
1183
|
+
(drawn) => drawn.kind === TIMELINE_ENTRY_KIND.PAGER ? /* @__PURE__ */ jsx3(
|
|
1184
|
+
ItemPagerView,
|
|
1185
|
+
{
|
|
1186
|
+
pager: drawn,
|
|
1187
|
+
onToggleBatch: toggleBatch,
|
|
1188
|
+
onTurnPage: turnPage
|
|
1189
|
+
},
|
|
1190
|
+
`${PAGER_KEY_PREFIX}${drawn.batchPath}`
|
|
1191
|
+
) : /* @__PURE__ */ jsx3(
|
|
1192
|
+
TimelineRowView,
|
|
1193
|
+
{
|
|
1194
|
+
row: drawn.row,
|
|
1195
|
+
times: drawn.times,
|
|
1196
|
+
axis: drawn.followsClock ? axis : times.recorded,
|
|
1197
|
+
nowMs: drawn.followsClock ? nowMs : null,
|
|
1198
|
+
onToggleBatch: toggleBatch
|
|
1199
|
+
},
|
|
1200
|
+
drawn.row.path
|
|
1201
|
+
)
|
|
1202
|
+
) })
|
|
1063
1203
|
] })
|
|
1064
1204
|
]
|
|
1065
1205
|
}
|