@vehicle-sil/gui-client 0.2.0-rc.1 → 0.2.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.ja.md +37 -9
- package/README.md +37 -9
- package/dist/index.js +1172 -199
- package/package.json +1 -1
- package/timeline/vehicle-sil-timeline.js +244 -58
- package/timeline/vehicle-sil-timeline.mjs +244 -58
- package/types/client.d.ts +6 -2
- package/types/connection.d.ts +4 -0
- package/types/front-actions.d.ts +16 -7
- package/types/front-types.d.ts +15 -6
- package/types/index.d.ts +6 -2
- package/types/protocol/launcher.d.ts +3 -0
- package/types/protocol/server.d.ts +28 -4
- package/types/run.d.ts +21 -6
- package/types/session-state.d.ts +25 -1
- package/types/session.d.ts +35 -1
- package/types/time.d.ts +4 -2
- package/types/values.d.ts +2 -0
- package/types/variable-binding.d.ts +1 -0
- package/types/variable-editor.d.ts +25 -0
- package/types/variables.d.ts +15 -3
- package/types/waveforms.d.ts +14 -0
|
@@ -217,6 +217,11 @@
|
|
|
217
217
|
'step.title': ({ index, kind, line, status }) =>
|
|
218
218
|
`Step ${index} (${kind}, line ${line}): ${status}`,
|
|
219
219
|
'step.times': ({ start, decided, end }) => `start ${start}, decided ${decided}, end ${end}`,
|
|
220
|
+
'step.details': 'Step details',
|
|
221
|
+
'step.matchOnce': ({ from, to }) =>
|
|
222
|
+
`All conditions must match together at least once between ${from} and ${to}`,
|
|
223
|
+
'step.matchAt': ({ from }) => `Must match at ${from}`,
|
|
224
|
+
'step.matchThroughout': ({ from, to }) => `Must match throughout ${from} to ${to}`,
|
|
220
225
|
'lane.range': ({ min, max }) => `${min} to ${max}`,
|
|
221
226
|
'lane.ecuStep': ({ ms }) => `step ${ms}`,
|
|
222
227
|
'lane.label': ({ name }) => `${name}: values over virtual time`,
|
|
@@ -520,6 +525,11 @@
|
|
|
520
525
|
`手順 ${index}(${kind}、${line} 行): ${status}`,
|
|
521
526
|
'step.times': ({ start, decided, end }) =>
|
|
522
527
|
`始まり ${start}、決まった ${decided}、終わり ${end}`,
|
|
528
|
+
'step.details': '手順の詳細',
|
|
529
|
+
'step.matchOnce': ({ from, to }) =>
|
|
530
|
+
`${from} から ${to} までにすべての条件が同時に成立すれば成功`,
|
|
531
|
+
'step.matchAt': ({ from }) => `${from} に成立すること`,
|
|
532
|
+
'step.matchThroughout': ({ from, to }) => `${from} から ${to} まで成立し続けること`,
|
|
523
533
|
'lane.range': ({ min, max }) => `${min} から ${max}`,
|
|
524
534
|
'lane.ecuStep': ({ ms }) => `刻み ${ms}`,
|
|
525
535
|
'lane.label': ({ name }) => `${name}: 仮想時刻での値`,
|
|
@@ -704,15 +714,18 @@
|
|
|
704
714
|
:host([hide~='toolbar']) #toolbar,
|
|
705
715
|
:host([hide~='help']) #help,
|
|
706
716
|
:host([hide~='tables']) #tables,
|
|
707
|
-
:host([hide~='steps']) .lane.steps,
|
|
708
|
-
:host([hide~='readout']) .readout,
|
|
717
|
+
:host([hide~='steps']) :is(.lane.steps, #step-details),
|
|
718
|
+
:host([hide~='readout']) :is(.readout, .hover-readout),
|
|
709
719
|
:host([hide~='legend']) .legend .key {
|
|
710
720
|
display: none !important;
|
|
711
721
|
}
|
|
712
|
-
:host([compact]) .lane {
|
|
713
|
-
|
|
722
|
+
:host([compact]) :is(.lane, .cursor-line) {
|
|
723
|
+
--lane-head-width: 120px;
|
|
714
724
|
}
|
|
715
725
|
@container (max-width: 479px) {
|
|
726
|
+
:host([compact]) .cursor-line {
|
|
727
|
+
--lane-head-width: 0px;
|
|
728
|
+
}
|
|
716
729
|
:host([compact]) .lane {
|
|
717
730
|
grid-template-columns: 1fr;
|
|
718
731
|
}
|
|
@@ -926,13 +939,18 @@ summary {
|
|
|
926
939
|
}
|
|
927
940
|
#chart {
|
|
928
941
|
container-type: inline-size;
|
|
942
|
+
position: relative;
|
|
929
943
|
border: 1px solid var(--_border);
|
|
930
944
|
border-radius: 6px;
|
|
931
945
|
background: var(--_panel);
|
|
932
946
|
}
|
|
947
|
+
.lane,
|
|
948
|
+
.cursor-line {
|
|
949
|
+
--lane-head-width: 200px;
|
|
950
|
+
}
|
|
933
951
|
.lane {
|
|
934
952
|
display: grid;
|
|
935
|
-
grid-template-columns:
|
|
953
|
+
grid-template-columns: var(--lane-head-width) 1fr;
|
|
936
954
|
border-bottom: 1px solid var(--_grid);
|
|
937
955
|
}
|
|
938
956
|
.lane-head {
|
|
@@ -945,8 +963,11 @@ summary {
|
|
|
945
963
|
box-shadow: inset 4px 0 0 var(--_bad);
|
|
946
964
|
}
|
|
947
965
|
.lane-plot {
|
|
966
|
+
position: relative;
|
|
948
967
|
min-width: 0;
|
|
949
968
|
overflow: hidden;
|
|
969
|
+
touch-action: none;
|
|
970
|
+
cursor: crosshair;
|
|
950
971
|
}
|
|
951
972
|
.lane.axis {
|
|
952
973
|
position: sticky;
|
|
@@ -963,6 +984,9 @@ summary {
|
|
|
963
984
|
border-bottom: 1px solid var(--_grid);
|
|
964
985
|
}
|
|
965
986
|
@container (max-width: 719px) {
|
|
987
|
+
:host(:not([compact])) .cursor-line {
|
|
988
|
+
--lane-head-width: 0px;
|
|
989
|
+
}
|
|
966
990
|
:host(:not([compact])) .lane {
|
|
967
991
|
grid-template-columns: 1fr;
|
|
968
992
|
}
|
|
@@ -970,6 +994,24 @@ summary {
|
|
|
970
994
|
border-right: none;
|
|
971
995
|
}
|
|
972
996
|
}
|
|
997
|
+
#step-details {
|
|
998
|
+
height: 6.25em;
|
|
999
|
+
margin-bottom: 8px;
|
|
1000
|
+
padding: 2px 8px;
|
|
1001
|
+
border: 1px solid var(--_border);
|
|
1002
|
+
border-radius: 6px;
|
|
1003
|
+
background: var(--_panel);
|
|
1004
|
+
overflow: auto;
|
|
1005
|
+
overflow-wrap: anywhere;
|
|
1006
|
+
scrollbar-gutter: stable;
|
|
1007
|
+
}
|
|
1008
|
+
.detail-heading > span {
|
|
1009
|
+
margin-inline-start: 10px;
|
|
1010
|
+
}
|
|
1011
|
+
#step-details ul {
|
|
1012
|
+
margin: 0;
|
|
1013
|
+
padding-inline-start: 1.4em;
|
|
1014
|
+
}
|
|
973
1015
|
.var-name {
|
|
974
1016
|
font-weight: 600;
|
|
975
1017
|
}
|
|
@@ -1012,6 +1054,45 @@ summary {
|
|
|
1012
1054
|
min-height: 1.45em;
|
|
1013
1055
|
overflow-wrap: anywhere;
|
|
1014
1056
|
}
|
|
1057
|
+
#cursor-time,
|
|
1058
|
+
#chart[data-hover] .lane-head .readout {
|
|
1059
|
+
display: block;
|
|
1060
|
+
overflow: hidden;
|
|
1061
|
+
text-overflow: ellipsis;
|
|
1062
|
+
white-space: nowrap;
|
|
1063
|
+
}
|
|
1064
|
+
#cursor-time {
|
|
1065
|
+
font-variant-numeric: tabular-nums;
|
|
1066
|
+
}
|
|
1067
|
+
.hover-readout {
|
|
1068
|
+
position: absolute;
|
|
1069
|
+
bottom: 4px;
|
|
1070
|
+
display: none;
|
|
1071
|
+
width: max-content;
|
|
1072
|
+
max-width: var(--cursor-room);
|
|
1073
|
+
padding: 1px 6px;
|
|
1074
|
+
border: 1px solid var(--_border);
|
|
1075
|
+
border-radius: 4px;
|
|
1076
|
+
background: var(--_panel);
|
|
1077
|
+
font-variant-numeric: tabular-nums;
|
|
1078
|
+
overflow: hidden;
|
|
1079
|
+
text-overflow: ellipsis;
|
|
1080
|
+
white-space: nowrap;
|
|
1081
|
+
pointer-events: none;
|
|
1082
|
+
}
|
|
1083
|
+
.hover-readout strong {
|
|
1084
|
+
margin-right: 6px;
|
|
1085
|
+
}
|
|
1086
|
+
#chart[data-hover] .hover-readout {
|
|
1087
|
+
display: block;
|
|
1088
|
+
}
|
|
1089
|
+
#chart[data-cursor-side='right'] .hover-readout {
|
|
1090
|
+
left: calc(var(--cursor-x) + 8px);
|
|
1091
|
+
}
|
|
1092
|
+
#chart[data-cursor-side='left'] .hover-readout {
|
|
1093
|
+
left: calc(var(--cursor-x) - 8px);
|
|
1094
|
+
transform: translateX(-100%);
|
|
1095
|
+
}
|
|
1015
1096
|
.note {
|
|
1016
1097
|
color: var(--_warn);
|
|
1017
1098
|
}
|
|
@@ -1027,8 +1108,6 @@ summary {
|
|
|
1027
1108
|
/* the chart */
|
|
1028
1109
|
svg.plot {
|
|
1029
1110
|
display: block;
|
|
1030
|
-
touch-action: none;
|
|
1031
|
-
cursor: crosshair;
|
|
1032
1111
|
user-select: none;
|
|
1033
1112
|
}
|
|
1034
1113
|
svg text {
|
|
@@ -1061,11 +1140,20 @@ svg text {
|
|
|
1061
1140
|
stroke: var(--_warn);
|
|
1062
1141
|
stroke-dasharray: 3 3;
|
|
1063
1142
|
}
|
|
1064
|
-
.cursor {
|
|
1065
|
-
|
|
1066
|
-
|
|
1143
|
+
.cursor-line {
|
|
1144
|
+
display: none;
|
|
1145
|
+
position: absolute;
|
|
1146
|
+
top: 0;
|
|
1147
|
+
bottom: 0;
|
|
1148
|
+
left: calc(var(--lane-head-width) + var(--cursor-x));
|
|
1149
|
+
z-index: 2;
|
|
1150
|
+
width: 1px;
|
|
1151
|
+
background: var(--_cursor);
|
|
1067
1152
|
pointer-events: none;
|
|
1068
1153
|
}
|
|
1154
|
+
#chart[data-cursor-side] > .cursor-line {
|
|
1155
|
+
display: block;
|
|
1156
|
+
}
|
|
1069
1157
|
.selection {
|
|
1070
1158
|
fill: var(--_selection);
|
|
1071
1159
|
}
|
|
@@ -2365,7 +2453,7 @@ tr.selected td {
|
|
|
2365
2453
|
cursor: null,
|
|
2366
2454
|
/** The index of the chosen step, or null. */
|
|
2367
2455
|
step: null,
|
|
2368
|
-
|
|
2456
|
+
readouts: [],
|
|
2369
2457
|
width: 0,
|
|
2370
2458
|
/** The name of the file shown (null for data without a name, or none). */
|
|
2371
2459
|
file: null,
|
|
@@ -2423,7 +2511,7 @@ tr.selected td {
|
|
|
2423
2511
|
box.hidden = false;
|
|
2424
2512
|
state.model = null;
|
|
2425
2513
|
state.file = null;
|
|
2426
|
-
state.
|
|
2514
|
+
state.readouts = [];
|
|
2427
2515
|
$('view').hidden = true;
|
|
2428
2516
|
$('title').textContent = t('page.title');
|
|
2429
2517
|
$('facts').replaceChildren();
|
|
@@ -2951,8 +3039,9 @@ tr.selected td {
|
|
|
2951
3039
|
const width = plotWidth();
|
|
2952
3040
|
state.width = width;
|
|
2953
3041
|
const scale = makeScale(state.view[0], state.view[1], width);
|
|
2954
|
-
state.
|
|
3042
|
+
state.readouts = [];
|
|
2955
3043
|
const chart = $('chart');
|
|
3044
|
+
chart.removeAttribute('data-hover');
|
|
2956
3045
|
const children = [axisLane(scale), stepLane(m, scale)];
|
|
2957
3046
|
const { inputs, others, groups, missing } = lanesToDraw(m);
|
|
2958
3047
|
// A name of the variables property that matches nothing is said, not dropped in silence.
|
|
@@ -2973,7 +3062,8 @@ tr.selected td {
|
|
|
2973
3062
|
if (groups) children.push(h('div', { class: 'group', text: t('chart.others') }));
|
|
2974
3063
|
children.push(...others.map((v) => variableLane(m, v, scale)));
|
|
2975
3064
|
}
|
|
2976
|
-
chart.replaceChildren(...children);
|
|
3065
|
+
chart.replaceChildren(...children, h('div', { class: 'cursor-line', 'aria-hidden': 'true' }));
|
|
3066
|
+
delete $('step-details').dataset.step;
|
|
2977
3067
|
$('range').textContent = t('chart.showing', {
|
|
2978
3068
|
from: fmtMs(scale.t0),
|
|
2979
3069
|
to: fmtMs(scale.t1),
|
|
@@ -2998,10 +3088,8 @@ tr.selected td {
|
|
|
2998
3088
|
h('div', { class: 'lane-head' }, head),
|
|
2999
3089
|
h('div', { class: 'lane-plot' }, svg),
|
|
3000
3090
|
);
|
|
3001
|
-
const cursor = s('line', { class: 'cursor', x1: -10, x2: -10, y1: 0, y2: height }, null);
|
|
3002
|
-
state.lanes.push({ svg, cursor, height, readout: null });
|
|
3003
3091
|
attachPointer(svg, scale, height);
|
|
3004
|
-
return { lane, svg
|
|
3092
|
+
return { lane, svg };
|
|
3005
3093
|
}
|
|
3006
3094
|
|
|
3007
3095
|
/** The marks every lane has: the part after the record, the failure time. Drawn before the data. */
|
|
@@ -3014,17 +3102,16 @@ tr.selected td {
|
|
|
3014
3102
|
s('rect', { class: 'unrecorded', x: 0, y: 0, width: scale.width, height }, svg);
|
|
3015
3103
|
}
|
|
3016
3104
|
|
|
3017
|
-
function commonFront(svg, m, scale, height
|
|
3105
|
+
function commonFront(svg, m, scale, height) {
|
|
3018
3106
|
if (m.failure && isNum(m.failure.at) && m.failure.at >= scale.t0 && m.failure.at <= scale.t1) {
|
|
3019
3107
|
const x = scale.x(m.failure.at);
|
|
3020
3108
|
s('line', { class: 'fail-line', x1: x, x2: x, y1: 0, y2: height }, svg);
|
|
3021
3109
|
}
|
|
3022
|
-
svg.append(cursor);
|
|
3023
3110
|
}
|
|
3024
3111
|
|
|
3025
3112
|
function axisLane(scale) {
|
|
3026
3113
|
const height = 22;
|
|
3027
|
-
const { lane, svg
|
|
3114
|
+
const { lane, svg } = laneShell(
|
|
3028
3115
|
h('span', {
|
|
3029
3116
|
class: 'muted small',
|
|
3030
3117
|
id: 'cursor-time',
|
|
@@ -3042,7 +3129,6 @@ tr.selected td {
|
|
|
3042
3129
|
s('line', { class: 'tick', x1: x, x2: x, y1: height - 6, y2: height }, svg);
|
|
3043
3130
|
s('text', { class: 'tick-label', x: x + 3, y: height - 8, text: fmtMs(t) }, svg);
|
|
3044
3131
|
}
|
|
3045
|
-
svg.append(cursor);
|
|
3046
3132
|
return lane;
|
|
3047
3133
|
}
|
|
3048
3134
|
|
|
@@ -3080,7 +3166,7 @@ tr.selected td {
|
|
|
3080
3166
|
h('strong', { text: t('chart.steps') }),
|
|
3081
3167
|
h('div', { class: 'readout small', id: 'cursor-steps' }),
|
|
3082
3168
|
);
|
|
3083
|
-
const { lane, svg
|
|
3169
|
+
const { lane, svg } = laneShell(head, height, scale, 'steps');
|
|
3084
3170
|
commonBack(svg, m, scale, height);
|
|
3085
3171
|
items.forEach((it, i) => {
|
|
3086
3172
|
const y = rows[i] * STEP_ROW + 4;
|
|
@@ -3157,7 +3243,7 @@ tr.selected td {
|
|
|
3157
3243
|
lines.push(t('step.expectSkipped', { why: it.st.expect_skipped }));
|
|
3158
3244
|
tooltip(g, lines.join('\n'));
|
|
3159
3245
|
});
|
|
3160
|
-
commonFront(svg, m, scale, height
|
|
3246
|
+
commonFront(svg, m, scale, height);
|
|
3161
3247
|
return lane;
|
|
3162
3248
|
}
|
|
3163
3249
|
|
|
@@ -3251,8 +3337,16 @@ tr.selected td {
|
|
|
3251
3337
|
readout,
|
|
3252
3338
|
...v.notes.map((n) => h('div', { class: 'note small', text: t('lane.note', { text: n }) })),
|
|
3253
3339
|
);
|
|
3254
|
-
const { lane, svg
|
|
3255
|
-
|
|
3340
|
+
const { lane, svg } = laneShell(head, height, scale, v.failing ? 'failing' : '');
|
|
3341
|
+
const hoverValue = h('span');
|
|
3342
|
+
const hover = h(
|
|
3343
|
+
'div',
|
|
3344
|
+
{ class: 'hover-readout small', 'aria-hidden': 'true' },
|
|
3345
|
+
h('strong', { text: label ?? v.name }),
|
|
3346
|
+
hoverValue,
|
|
3347
|
+
);
|
|
3348
|
+
svg.parentElement.append(hover);
|
|
3349
|
+
state.readouts.push({ el: readout, hoverValue, v });
|
|
3256
3350
|
svg.setAttribute('aria-label', t('lane.label', { name: label ?? v.name }));
|
|
3257
3351
|
commonBack(svg, m, scale, height);
|
|
3258
3352
|
if (strip) drawLines(svg, m, v, scale);
|
|
@@ -3334,7 +3428,7 @@ tr.selected td {
|
|
|
3334
3428
|
if (!v.written && !v.sampled && !v.notes.length) {
|
|
3335
3429
|
s('text', { class: 'empty-label', x: 6, y: height / 2 + 4, text: t('lane.noValues') }, svg);
|
|
3336
3430
|
}
|
|
3337
|
-
commonFront(svg, m, scale, height
|
|
3431
|
+
commonFront(svg, m, scale, height);
|
|
3338
3432
|
return lane;
|
|
3339
3433
|
}
|
|
3340
3434
|
|
|
@@ -3682,14 +3776,15 @@ tr.selected td {
|
|
|
3682
3776
|
}
|
|
3683
3777
|
|
|
3684
3778
|
/** Moves the cursor as the user does, and says so. */
|
|
3685
|
-
function moveCursor(at) {
|
|
3686
|
-
|
|
3779
|
+
function moveCursor(at, hoveredStep) {
|
|
3780
|
+
const changed = at !== state.cursor;
|
|
3687
3781
|
state.cursor = at;
|
|
3688
|
-
updateCursor();
|
|
3689
|
-
emit('cursorchange', { cursor: at });
|
|
3782
|
+
updateCursor(hoveredStep);
|
|
3783
|
+
if (changed) emit('cursorchange', { cursor: at });
|
|
3690
3784
|
}
|
|
3691
3785
|
|
|
3692
3786
|
function attachPointer(svg, scale, height) {
|
|
3787
|
+
const plot = svg.parentElement;
|
|
3693
3788
|
let down = null;
|
|
3694
3789
|
let downStep = null;
|
|
3695
3790
|
let sel = null;
|
|
@@ -3697,24 +3792,30 @@ tr.selected td {
|
|
|
3697
3792
|
const r = svg.getBoundingClientRect();
|
|
3698
3793
|
return Math.min(scale.width, Math.max(0, e.clientX - r.left));
|
|
3699
3794
|
};
|
|
3700
|
-
listen(
|
|
3795
|
+
listen(plot, 'pointerdown', (e) => {
|
|
3701
3796
|
if (e.button !== 0) return;
|
|
3797
|
+
$('chart').removeAttribute('data-hover');
|
|
3702
3798
|
down = xOf(e);
|
|
3703
3799
|
// A click on a step chooses it (the pointer is captured, so the click itself goes to the lane).
|
|
3704
3800
|
const step = e.target.closest ? e.target.closest('[data-step]') : null;
|
|
3705
3801
|
downStep = step ? stepOf(Number(step.dataset.step)) : null;
|
|
3706
|
-
|
|
3802
|
+
plot.setPointerCapture(e.pointerId);
|
|
3707
3803
|
});
|
|
3708
|
-
listen(
|
|
3804
|
+
listen(plot, 'pointermove', (e) => {
|
|
3709
3805
|
const x = xOf(e);
|
|
3710
|
-
|
|
3806
|
+
if (e.pointerType === 'mouse' && down === null) {
|
|
3807
|
+
$('chart').setAttribute('data-hover', '');
|
|
3808
|
+
}
|
|
3809
|
+
const step = e.target.closest('[data-step]');
|
|
3810
|
+
moveCursor(scale.t(x), step ? stepOf(Number(step.dataset.step)) : null);
|
|
3711
3811
|
if (down !== null && Math.abs(x - down) > 4) {
|
|
3712
3812
|
if (!sel) sel = s('rect', { class: 'selection', y: 0, height }, svg);
|
|
3713
3813
|
sel.setAttribute('x', Math.min(x, down));
|
|
3714
3814
|
sel.setAttribute('width', Math.abs(x - down));
|
|
3715
3815
|
}
|
|
3716
3816
|
});
|
|
3717
|
-
listen(
|
|
3817
|
+
listen(plot, 'pointerleave', () => $('chart').removeAttribute('data-hover'));
|
|
3818
|
+
listen(plot, 'pointerup', (e) => {
|
|
3718
3819
|
const x = xOf(e);
|
|
3719
3820
|
const dragged = down !== null && Math.abs(x - down) > 4;
|
|
3720
3821
|
if (dragged) setView([scale.t(Math.min(x, down)), scale.t(Math.max(x, down))]);
|
|
@@ -3724,50 +3825,127 @@ tr.selected td {
|
|
|
3724
3825
|
if (sel) sel.remove();
|
|
3725
3826
|
sel = null;
|
|
3726
3827
|
});
|
|
3727
|
-
listen(
|
|
3828
|
+
listen(plot, 'pointercancel', () => {
|
|
3829
|
+
down = null;
|
|
3830
|
+
downStep = null;
|
|
3831
|
+
if (sel) sel.remove();
|
|
3832
|
+
sel = null;
|
|
3833
|
+
});
|
|
3834
|
+
listen(plot, 'dblclick', () => setView(state.model.domain));
|
|
3728
3835
|
}
|
|
3729
3836
|
|
|
3730
|
-
|
|
3837
|
+
/** A readable description of the step, kept outside the plot so it never covers the waveforms. */
|
|
3838
|
+
function updateStepDetails(preferred) {
|
|
3839
|
+
const m = state.model;
|
|
3840
|
+
const panel = $('step-details');
|
|
3841
|
+
const step =
|
|
3842
|
+
preferred ??
|
|
3843
|
+
stepOf(state.step) ??
|
|
3844
|
+
m?.failure?.step ??
|
|
3845
|
+
m?.steps.find((st) => Array.isArray(st.watch?.conditions) && st.watch.conditions.length) ??
|
|
3846
|
+
m?.steps[0];
|
|
3847
|
+
panel.hidden = !step;
|
|
3848
|
+
if (!step || panel.dataset.step === String(step.index)) return;
|
|
3849
|
+
panel.dataset.step = String(step.index);
|
|
3850
|
+
const title = t('step.title', {
|
|
3851
|
+
index: step.index,
|
|
3852
|
+
kind: step.kind,
|
|
3853
|
+
line: step.line,
|
|
3854
|
+
status: statusWord(step.status),
|
|
3855
|
+
});
|
|
3856
|
+
const timings = t('step.times', {
|
|
3857
|
+
start: fmtMs(step.start_ms),
|
|
3858
|
+
decided: fmtMs(step.at_ms),
|
|
3859
|
+
end: fmtMs(step.end_ms),
|
|
3860
|
+
});
|
|
3861
|
+
const watch = step.watch;
|
|
3862
|
+
const conditions = Array.isArray(watch?.conditions)
|
|
3863
|
+
? watch.conditions.filter((c) => isObject(c) && typeof c.variable === 'string')
|
|
3864
|
+
: [];
|
|
3865
|
+
const modes = {
|
|
3866
|
+
once: 'step.matchOnce',
|
|
3867
|
+
at: 'step.matchAt',
|
|
3868
|
+
always: 'step.matchThroughout',
|
|
3869
|
+
during: 'step.matchThroughout',
|
|
3870
|
+
};
|
|
3871
|
+
const mode = Object.hasOwn(modes, watch?.mode) ? modes[watch.mode] : null;
|
|
3872
|
+
panel.replaceChildren(
|
|
3873
|
+
h(
|
|
3874
|
+
'div',
|
|
3875
|
+
{ class: 'detail-heading' },
|
|
3876
|
+
h('strong', { text: title }),
|
|
3877
|
+
h('span', { class: 'muted', text: timings }),
|
|
3878
|
+
),
|
|
3879
|
+
conditions.length
|
|
3880
|
+
? h(
|
|
3881
|
+
'div',
|
|
3882
|
+
{},
|
|
3883
|
+
mode
|
|
3884
|
+
? h('div', { text: t(mode, { from: fmtMs(watch.from_ms), to: fmtMs(watch.to_ms) }) })
|
|
3885
|
+
: null,
|
|
3886
|
+
h(
|
|
3887
|
+
'ul',
|
|
3888
|
+
{},
|
|
3889
|
+
conditions.map((c) =>
|
|
3890
|
+
h(
|
|
3891
|
+
'li',
|
|
3892
|
+
{},
|
|
3893
|
+
h('code', { text: c.variable }),
|
|
3894
|
+
` ${compareText(c.compare, m.byName.get(c.variable)?.info)}`,
|
|
3895
|
+
),
|
|
3896
|
+
),
|
|
3897
|
+
),
|
|
3898
|
+
)
|
|
3899
|
+
: h('div', { text: step.text ?? '' }),
|
|
3900
|
+
);
|
|
3901
|
+
panel.scrollTop = 0;
|
|
3902
|
+
}
|
|
3903
|
+
|
|
3904
|
+
function updateCursor(hoveredStep) {
|
|
3731
3905
|
const m = state.model;
|
|
3732
3906
|
const at = state.cursor;
|
|
3907
|
+
const chart = $('chart');
|
|
3733
3908
|
if (!m || at === null || at < state.view[0] || at > state.view[1]) {
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
if (lane.readout) lane.readout.el.textContent = '';
|
|
3738
|
-
}
|
|
3909
|
+
chart.removeAttribute('data-hover');
|
|
3910
|
+
chart.removeAttribute('data-cursor-side');
|
|
3911
|
+
for (const { el } of state.readouts) el.title = el.textContent = '';
|
|
3739
3912
|
const time = $('cursor-time');
|
|
3740
|
-
if (time) time.textContent = t('chart.virtualTime');
|
|
3913
|
+
if (time) time.title = time.textContent = t('chart.virtualTime');
|
|
3741
3914
|
const steps = $('cursor-steps');
|
|
3742
|
-
if (steps) steps.textContent = '';
|
|
3915
|
+
if (steps) steps.title = steps.textContent = '';
|
|
3916
|
+
updateStepDetails();
|
|
3743
3917
|
return;
|
|
3744
3918
|
}
|
|
3745
3919
|
const scale = makeScale(state.view[0], state.view[1], state.width);
|
|
3746
3920
|
const x = scale.x(at);
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3921
|
+
const right = x < scale.width / 2;
|
|
3922
|
+
chart.setAttribute('data-cursor-side', right ? 'right' : 'left');
|
|
3923
|
+
chart.style.setProperty('--cursor-x', `${x}px`);
|
|
3924
|
+
chart.style.setProperty('--cursor-room', `${(right ? scale.width - x : x) - 8}px`);
|
|
3925
|
+
for (const { el, hoverValue, v } of state.readouts) {
|
|
3752
3926
|
const parts = [];
|
|
3753
3927
|
const end = m.recordedTo;
|
|
3754
3928
|
const w = valueAt(v.written, at, end, v.gaps.written);
|
|
3755
3929
|
const sv = valueAt(v.sampled, at, end, v.gaps.sampled);
|
|
3756
3930
|
if (w) parts.push(readoutText('sent', w, v.info));
|
|
3757
3931
|
if (sv) parts.push(readoutText('seen', sv, v.info));
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3932
|
+
const values = parts.join(' · ');
|
|
3933
|
+
el.title = el.textContent = values;
|
|
3934
|
+
hoverValue.textContent = values || '—';
|
|
3761
3935
|
}
|
|
3762
|
-
|
|
3936
|
+
const time = $('cursor-time');
|
|
3937
|
+
time.title = time.textContent = t('chart.cursor', { at: fmtMs(Number(at.toPrecision(6))) });
|
|
3763
3938
|
const active = m.steps.filter((st) => {
|
|
3764
3939
|
if (!isNum(st.start_ms)) return false;
|
|
3765
3940
|
const e = [st.end_ms, st.at_ms].filter(isNum).reduce((a, b) => Math.max(a, b), st.start_ms);
|
|
3766
3941
|
return at >= st.start_ms && (at <= e || st.status === 'unfinished');
|
|
3767
3942
|
});
|
|
3768
|
-
$('cursor-steps')
|
|
3769
|
-
|
|
3770
|
-
|
|
3943
|
+
const steps = $('cursor-steps');
|
|
3944
|
+
steps.title = steps.textContent = active
|
|
3945
|
+
.map((st) => `#${st.index} ${st.kind} (${statusWord(st.status)})`)
|
|
3946
|
+
.join(', ');
|
|
3947
|
+
const inspected = hoveredStep ?? (hoveredStep === undefined ? stepOf(state.step) : null);
|
|
3948
|
+
updateStepDetails(inspected ?? active.find((st) => isObject(st.watch)) ?? active[0]);
|
|
3771
3949
|
}
|
|
3772
3950
|
|
|
3773
3951
|
// --- loading
|
|
@@ -3858,7 +4036,7 @@ tr.selected td {
|
|
|
3858
4036
|
if (!fresh()) return;
|
|
3859
4037
|
element.input = text;
|
|
3860
4038
|
element.srcName = name;
|
|
3861
|
-
element.inputName =
|
|
4039
|
+
element.inputName = element.host.fileName || name;
|
|
3862
4040
|
load(text, element.inputName);
|
|
3863
4041
|
}),
|
|
3864
4042
|
bound((e) => {
|
|
@@ -3913,7 +4091,7 @@ tr.selected td {
|
|
|
3913
4091
|
current.inputName = null;
|
|
3914
4092
|
state.model = null;
|
|
3915
4093
|
state.file = null;
|
|
3916
|
-
state.
|
|
4094
|
+
state.readouts = [];
|
|
3917
4095
|
clearError();
|
|
3918
4096
|
$('view').hidden = true;
|
|
3919
4097
|
$('title').textContent = t('page.title');
|
|
@@ -3952,6 +4130,13 @@ tr.selected td {
|
|
|
3952
4130
|
),
|
|
3953
4131
|
h('p', { id: 'help', class: 'muted small', 'data-text': 'page.help' }),
|
|
3954
4132
|
h('p', { id: 'chart-note', class: 'note small', role: 'status', hidden: true }),
|
|
4133
|
+
h('section', {
|
|
4134
|
+
id: 'step-details',
|
|
4135
|
+
class: 'small',
|
|
4136
|
+
'data-label': 'step.details',
|
|
4137
|
+
tabindex: '0',
|
|
4138
|
+
hidden: true,
|
|
4139
|
+
}),
|
|
3955
4140
|
h('div', { id: 'chart', tabindex: '0', 'data-label': 'page.chartLabel' }),
|
|
3956
4141
|
h('div', { id: 'tables' }),
|
|
3957
4142
|
),
|
|
@@ -3988,6 +4173,7 @@ tr.selected td {
|
|
|
3988
4173
|
}
|
|
3989
4174
|
if (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight') return;
|
|
3990
4175
|
e.preventDefault();
|
|
4176
|
+
chart.removeAttribute('data-hover');
|
|
3991
4177
|
const stepT =
|
|
3992
4178
|
(state.model.timeStep ?? (state.view[1] - state.view[0]) / 100) * (e.shiftKey ? 10 : 1);
|
|
3993
4179
|
const t = state.cursor ?? state.view[0];
|
package/types/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClientConnection, SocketFactory } from './connection.js';
|
|
2
2
|
import { HttpTransport } from './http.js';
|
|
3
3
|
import { AppInfo, CheckRequest, CheckTextRequest, ConfigText, DescribeRequest, CheckResult, ConfigList, Connections, ConnectionsRequest, DashboardResponse, Recording, SaveConfigRequest, SavedConfig, ScenarioList, SessionSummary } from './protocol.js';
|
|
4
|
-
import { ClientRun } from './run.js';
|
|
4
|
+
import { ClientRun, RunControl } from './run.js';
|
|
5
5
|
import { ClientSession } from './session.js';
|
|
6
6
|
import { ClientTime } from './time.js';
|
|
7
7
|
import { ClientVariables } from './variables.js';
|
|
@@ -54,7 +54,8 @@ export interface ClientOptions {
|
|
|
54
54
|
* Lifetime: connect() connects (calling it again while connected does nothing). close() disconnects, stops pending
|
|
55
55
|
* timers, stops waiting for answers to time commands and fails writes still waiting for their result (variable
|
|
56
56
|
* watches stay and resume on reconnect). connect() after close() connects again (the session copy is kept and
|
|
57
|
-
* resumes from what it already has). HTTP requests
|
|
57
|
+
* resumes from what it already has). HTTP requests work without a WebSocket. Before sending a run or check over
|
|
58
|
+
* HTTP alone, call loadApp() to verify the server protocol. After the server
|
|
58
59
|
* refused the token (session.rejected) or the versions differ (session.incompatible), connect() does nothing (create a
|
|
59
60
|
* new client).
|
|
60
61
|
*/
|
|
@@ -143,6 +144,9 @@ export interface ClientParts {
|
|
|
143
144
|
client: GuiClient;
|
|
144
145
|
http: HttpTransport;
|
|
145
146
|
onError: ErrorSink;
|
|
147
|
+
runControl: RunControl;
|
|
146
148
|
}
|
|
149
|
+
/** Use the client's error sink for readables built on top of it. */
|
|
150
|
+
export declare function clientErrorSink(client: GuiClient): ErrorSink | undefined;
|
|
147
151
|
/** createClient, and the parts the front door is built from. */
|
|
148
152
|
export declare function buildClient(options: ClientOptions): ClientParts;
|
package/types/connection.d.ts
CHANGED
|
@@ -112,6 +112,8 @@ export declare class Connection implements ClientConnection {
|
|
|
112
112
|
private readonly batchListeners;
|
|
113
113
|
private readonly unreadableListeners;
|
|
114
114
|
private socket;
|
|
115
|
+
private connectionEpoch;
|
|
116
|
+
private attemptRevision;
|
|
115
117
|
private wanted;
|
|
116
118
|
/** Consecutive drops without a readable notification. */
|
|
117
119
|
private attempts;
|
|
@@ -150,6 +152,8 @@ export declare class Connection implements ClientConnection {
|
|
|
150
152
|
flush(): void;
|
|
151
153
|
private dropPending;
|
|
152
154
|
private open;
|
|
155
|
+
/** Identifies the connection that produced a batch; restarting alone does not create the next one. */
|
|
156
|
+
batchEpoch(): number;
|
|
153
157
|
private openSocket;
|
|
154
158
|
private scheduleRetry;
|
|
155
159
|
}
|
package/types/front-actions.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { HttpTransport } from './http.js';
|
|
|
3
3
|
import type { FrontControls, Intent, OperationName, RunState } from './front-types.js';
|
|
4
4
|
import { ActionError } from './front-types.js';
|
|
5
5
|
import type { Snapshot } from './front-compose.js';
|
|
6
|
+
import type { StopCapture } from './run.js';
|
|
7
|
+
import { type RunTarget } from './session.js';
|
|
6
8
|
import type { CheckResult, ConfigText, SavedConfig } from './protocol.js';
|
|
7
9
|
import { ErrorSink, Readable } from './values.js';
|
|
8
10
|
/** A failed action, kept for `status.problem`. */
|
|
@@ -17,6 +19,7 @@ export interface Failure {
|
|
|
17
19
|
export interface ActionSources {
|
|
18
20
|
low: GuiClient;
|
|
19
21
|
http: HttpTransport;
|
|
22
|
+
captureStop(): StopCapture;
|
|
20
23
|
snapshot(): Snapshot;
|
|
21
24
|
controls(): FrontControls;
|
|
22
25
|
run(): RunState;
|
|
@@ -93,15 +96,21 @@ export declare class FrontActions {
|
|
|
93
96
|
/** What the client refuses before it sends a start: the connection, and a start of this page still on its way. */
|
|
94
97
|
private refusalOfStart;
|
|
95
98
|
stop(): Promise<void>;
|
|
96
|
-
forceStop(
|
|
97
|
-
|
|
99
|
+
forceStop(target?: {
|
|
100
|
+
session: number;
|
|
101
|
+
instance: string;
|
|
102
|
+
}): Promise<void>;
|
|
103
|
+
/** Pending stop only affects controls of the run it was sent for. */
|
|
104
|
+
busyForCurrent(): ReadonlySet<OperationName>;
|
|
105
|
+
private stopKey;
|
|
106
|
+
/** Repeated requests for the same run share one operation. */
|
|
98
107
|
private once;
|
|
99
108
|
private guarded;
|
|
100
|
-
pause(): Promise<void>;
|
|
101
|
-
resume(): Promise<void>;
|
|
102
|
-
step(ms: number): Promise<void>;
|
|
103
|
-
setSpeed(value: number | 'max'): Promise<void>;
|
|
104
|
-
runUntil(ms: number): Promise<void>;
|
|
109
|
+
pause(target?: RunTarget | null): Promise<void>;
|
|
110
|
+
resume(target?: RunTarget | null): Promise<void>;
|
|
111
|
+
step(ms: number, target?: RunTarget | null): Promise<void>;
|
|
112
|
+
setSpeed(value: number | 'max', target?: RunTarget | null): Promise<void>;
|
|
113
|
+
runUntil(ms: number, target?: RunTarget | null): Promise<void>;
|
|
105
114
|
private time;
|
|
106
115
|
/** Ends a waiting command: with an error, or (null) as done. A command ended twice is ended once. */
|
|
107
116
|
private settle;
|