waygraph 0.12.31 → 0.12.32
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/cli.js +105 -93
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -274,12 +274,12 @@ async function findBlock(projectDir, ref) {
|
|
|
274
274
|
if (byRuntimeName.length === 1) return byRuntimeName[0];
|
|
275
275
|
if (byRuntimeName.length > 1) {
|
|
276
276
|
throw new Error(
|
|
277
|
-
"waygraph chain:
|
|
277
|
+
"waygraph chain: \\\"" + ref + "\\\" matches " + byRuntimeName.length + " Blocks by name - " +
|
|
278
278
|
byRuntimeName.map((b) => b.exportName + " (" + b.file + ")").join(", ") +
|
|
279
279
|
". Use the export name to disambiguate.",
|
|
280
280
|
);
|
|
281
281
|
}
|
|
282
|
-
throw new Error("waygraph chain: no Block named
|
|
282
|
+
throw new Error("waygraph chain: no Block named \\\"" + ref + "\\\" found under " + projectDir);
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
/**
|
|
@@ -316,7 +316,7 @@ function parseChainSpec(spec) {
|
|
|
316
316
|
const m = /^([A-Za-z_$][\\w-]*)\\s*(?:\\(([\\s\\S]*)\\))?$/.exec(s);
|
|
317
317
|
if (!m) {
|
|
318
318
|
throw new Error(
|
|
319
|
-
"waygraph chain: could not parse segment
|
|
319
|
+
"waygraph chain: could not parse segment \\\"" + s + "\\\" - expected \\\"blockName\\\" or \\\"blockName({...json...})\\\"",
|
|
320
320
|
);
|
|
321
321
|
}
|
|
322
322
|
const ref = m[1];
|
|
@@ -329,7 +329,7 @@ function seedMemFromRequires(mem, requires, json, label) {
|
|
|
329
329
|
if (requires.length === 0) {
|
|
330
330
|
if (json !== undefined) {
|
|
331
331
|
throw new Error(
|
|
332
|
-
"waygraph chain:
|
|
332
|
+
"waygraph chain: \\\"" + label + "\\\" takes no input (empty requires) but got a payload: " + json,
|
|
333
333
|
);
|
|
334
334
|
}
|
|
335
335
|
return;
|
|
@@ -341,7 +341,7 @@ function seedMemFromRequires(mem, requires, json, label) {
|
|
|
341
341
|
json = fromEnv;
|
|
342
342
|
} else {
|
|
343
343
|
throw new Error(
|
|
344
|
-
"waygraph chain:
|
|
344
|
+
"waygraph chain: \\\"" + label + "\\\" requires " + requires.map((k) => k.name).join(", ") +
|
|
345
345
|
" - give a JSON payload (inline blockName({...}) or --data '{...}')",
|
|
346
346
|
);
|
|
347
347
|
}
|
|
@@ -350,7 +350,7 @@ function seedMemFromRequires(mem, requires, json, label) {
|
|
|
350
350
|
try {
|
|
351
351
|
parsed = JSON.parse(json);
|
|
352
352
|
} catch (err) {
|
|
353
|
-
throw new Error("waygraph chain:
|
|
353
|
+
throw new Error("waygraph chain: \\\"" + label + "\\\" payload is not valid JSON - " + String(err));
|
|
354
354
|
}
|
|
355
355
|
// Keyed-by-name when every require name is a top-level key (preferred for
|
|
356
356
|
// --data and for {"saucedemo.credentials":{...}} even with one require).
|
|
@@ -367,13 +367,13 @@ function seedMemFromRequires(mem, requires, json, label) {
|
|
|
367
367
|
}
|
|
368
368
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
369
369
|
throw new Error(
|
|
370
|
-
"waygraph chain:
|
|
370
|
+
"waygraph chain: \\\"" + label + "\\\" requires " + requires.length + " keys (" +
|
|
371
371
|
requires.map((k) => k.name).join(", ") + ") - payload must be an object keyed by each key's name",
|
|
372
372
|
);
|
|
373
373
|
}
|
|
374
374
|
for (const k of requires) {
|
|
375
375
|
if (!(k.name in parsed)) {
|
|
376
|
-
throw new Error("waygraph chain:
|
|
376
|
+
throw new Error("waygraph chain: \\\"" + label + "\\\" payload is missing required key \\\"" + k.name + "\\\"");
|
|
377
377
|
}
|
|
378
378
|
mem.set(k, parsed[k.name]);
|
|
379
379
|
}
|
|
@@ -415,7 +415,7 @@ const RING_CSS =
|
|
|
415
415
|
"box-shadow:0 0 0 4px rgba(124,58,237,.16);" +
|
|
416
416
|
"transition:opacity .32s ease,left .28s ease,top .28s ease,width .28s ease,height .28s ease,border-color .15s,box-shadow .32s ease;}" +
|
|
417
417
|
// Unquoted [data-focus=1]: this lives inside CHAIN_RUNNER_SCRIPT's template
|
|
418
|
-
// literal - a
|
|
418
|
+
// literal - a \\" here would be eaten by the outer template and break the
|
|
419
419
|
// generated .mjs. CSS allows unquoted attr values for identifiers.
|
|
420
420
|
"#wg-ring[data-focus=1]{box-shadow:0 0 0 4px rgba(124,58,237,.2),0 0 0 9999px rgba(15,6,32,.55);}" +
|
|
421
421
|
"#wg-ring[data-tone=auto][data-focus=1]{box-shadow:0 0 0 4px rgba(156,163,175,.28),0 0 0 9999px rgba(15,6,32,.55);}" +
|
|
@@ -861,23 +861,27 @@ async function installOverlay(page, title) {
|
|
|
861
861
|
: t.done
|
|
862
862
|
? "wg-todo-done"
|
|
863
863
|
: "wg-todo-pending";
|
|
864
|
-
const mark = t.done
|
|
864
|
+
const mark = t.done
|
|
865
|
+
? String.fromCharCode(0x2713)
|
|
866
|
+
: t.current
|
|
867
|
+
? String.fromCharCode(0x2192)
|
|
868
|
+
: String.fromCharCode(0x25cb);
|
|
865
869
|
return (
|
|
866
|
-
|
|
870
|
+
'<li class="' +
|
|
867
871
|
cls +
|
|
868
|
-
"
|
|
872
|
+
'"><span class="wg-todo-mark">' +
|
|
869
873
|
mark +
|
|
870
|
-
|
|
874
|
+
'</span><span>' +
|
|
871
875
|
esc(t.text || "") +
|
|
872
|
-
|
|
876
|
+
'</span></li>'
|
|
873
877
|
);
|
|
874
878
|
})
|
|
875
879
|
.join("");
|
|
876
880
|
modal.innerHTML =
|
|
877
|
-
|
|
881
|
+
'<div class="wg-todo-head">Checklist</div><ul>' + rows + '</ul>';
|
|
878
882
|
modal.classList.add("wg-todo-on");
|
|
879
883
|
};
|
|
880
|
-
|
|
884
|
+
window.__wgResetCamera = () => {
|
|
881
885
|
window.__wgSetCamera(window.innerWidth / 2, window.innerHeight / 2, 1);
|
|
882
886
|
};
|
|
883
887
|
window.__wgClearZoom = () => {
|
|
@@ -1066,7 +1070,7 @@ async function renderBeforeStep(page, info) {
|
|
|
1066
1070
|
// active, the episode 2 tab is inactive"). Absent entirely for an ad
|
|
1067
1071
|
// hoc block chain with no named Flows.
|
|
1068
1072
|
const episodesHtml = info.allEpisodes && info.allEpisodes.length > 0
|
|
1069
|
-
? "<div id
|
|
1073
|
+
? "<div id=\\\"wg-episodes\\\">" +
|
|
1070
1074
|
info.allEpisodes
|
|
1071
1075
|
.map((e) => {
|
|
1072
1076
|
const cls = e.episodeNumber < info.episodeNumber ? "wg-ep-done"
|
|
@@ -1077,7 +1081,7 @@ async function renderBeforeStep(page, info) {
|
|
|
1077
1081
|
const enteredCls = info.justEnteredEpisode && e.episodeNumber === info.episodeNumber
|
|
1078
1082
|
? " wg-ep-entered"
|
|
1079
1083
|
: "";
|
|
1080
|
-
return "<span class
|
|
1084
|
+
return "<span class=\\\"wg-ep-tab " + cls + enteredCls + "\\\">Episode " + e.episodeNumber + ": " +
|
|
1081
1085
|
esc(e.episodeTitle || "") + "</span>";
|
|
1082
1086
|
})
|
|
1083
1087
|
.join("") +
|
|
@@ -1093,62 +1097,66 @@ async function renderBeforeStep(page, info) {
|
|
|
1093
1097
|
.map((name, idx) => {
|
|
1094
1098
|
const cls = idx < info.moduleIndex ? "wg-mod-done" : idx === info.moduleIndex ? "wg-mod-current" : "wg-mod-upcoming";
|
|
1095
1099
|
const desc = info.allDescriptions && info.allDescriptions[idx];
|
|
1096
|
-
const titleAttr = desc ? " title
|
|
1097
|
-
return "<span class
|
|
1100
|
+
const titleAttr = desc ? " title=\\\"" + esc(desc) + "\\\"" : "";
|
|
1101
|
+
return "<span class=\\\"wg-mod " + cls + "\\\"" + titleAttr + ">" + name + "</span>";
|
|
1098
1102
|
})
|
|
1099
1103
|
.join("");
|
|
1100
1104
|
const narrationHtml = info.description
|
|
1101
|
-
? "<div class
|
|
1105
|
+
? "<div class=\\\"wg-narration\\\">" + esc(info.description) + "</div>"
|
|
1102
1106
|
: "";
|
|
1103
1107
|
const paceHtml =
|
|
1104
1108
|
info.paceBadge || info.paceLabel
|
|
1105
|
-
? "<div class
|
|
1109
|
+
? "<div class=\\\"wg-pace\\\" data-pace-kind=\\\"" +
|
|
1106
1110
|
esc(info.paceKind || "normal") +
|
|
1107
|
-
"
|
|
1111
|
+
"\\\"><span class=\\\"wg-pace-badge\\\">" +
|
|
1108
1112
|
esc(info.paceBadge || "1x") +
|
|
1109
1113
|
"</span><span>" +
|
|
1110
1114
|
esc(info.paceLabel || "") +
|
|
1111
1115
|
"</span></div>"
|
|
1112
1116
|
: "";
|
|
1113
1117
|
let html =
|
|
1114
|
-
"<div id
|
|
1118
|
+
"<div id=\\\"wg-progress\\\"><div id=\\\"wg-progress-bar\\\" style=\\\"width:" + pct + "%\\\"></div></div>" +
|
|
1115
1119
|
episodesHtml +
|
|
1116
1120
|
paceHtml +
|
|
1117
|
-
"<div id
|
|
1121
|
+
"<div id=\\\"wg-modules\\\" class=\\\"" + modulesClass + "\\\">" + modulesHtml + "</div>" +
|
|
1118
1122
|
"<h3>Step " + (info.index + 1) + " / " + info.total + " - " + info.blockName + "</h3>" +
|
|
1119
1123
|
narrationHtml +
|
|
1120
1124
|
((() => {
|
|
1121
1125
|
const list = info.todos || [];
|
|
1122
1126
|
if (!list.length) return "";
|
|
1123
1127
|
return (
|
|
1124
|
-
|
|
1128
|
+
'<ul id="wg-todos">' +
|
|
1125
1129
|
list
|
|
1126
1130
|
.map((t) => {
|
|
1127
1131
|
const cls = t.current ? "wg-todo-current" : t.done ? "wg-todo-done" : "wg-todo-pending";
|
|
1128
|
-
const mark = t.done
|
|
1132
|
+
const mark = t.done
|
|
1133
|
+
? String.fromCharCode(0x2713)
|
|
1134
|
+
: t.current
|
|
1135
|
+
? String.fromCharCode(0x2192)
|
|
1136
|
+
: String.fromCharCode(0x25cb);
|
|
1129
1137
|
return (
|
|
1130
|
-
|
|
1138
|
+
'<li class="' +
|
|
1131
1139
|
cls +
|
|
1132
|
-
"
|
|
1140
|
+
'"><span class="wg-todo-mark">' +
|
|
1133
1141
|
mark +
|
|
1134
|
-
|
|
1142
|
+
'</span><span>' +
|
|
1135
1143
|
esc(t.text || "") +
|
|
1136
|
-
|
|
1144
|
+
'</span></li>'
|
|
1137
1145
|
);
|
|
1138
1146
|
})
|
|
1139
1147
|
.join("") +
|
|
1140
|
-
|
|
1148
|
+
'</ul>'
|
|
1141
1149
|
);
|
|
1142
1150
|
})());
|
|
1143
1151
|
if (info.keys.length === 0) {
|
|
1144
|
-
html += "<div class
|
|
1152
|
+
html += "<div class=\\\"wg-key\\\">(no MemKeys required)</div>";
|
|
1145
1153
|
}
|
|
1146
1154
|
for (const k of info.keys) {
|
|
1147
1155
|
html +=
|
|
1148
|
-
"<div class
|
|
1149
|
-
"<textarea data-key
|
|
1156
|
+
"<div class=\\\"wg-key\\\"><label>" + k.name + "</label>" +
|
|
1157
|
+
"<textarea data-key=\\\"" + k.name + "\\\" rows=\\\"2\\\">" +
|
|
1150
1158
|
k.value.replace(/</g, "<") + "</textarea>" +
|
|
1151
|
-
"<div class
|
|
1159
|
+
"<div class=\\\"wg-key-pretty\\\" data-pretty-for=\\\"" + esc(k.name) + "\\\"></div>" +
|
|
1152
1160
|
"</div>";
|
|
1153
1161
|
}
|
|
1154
1162
|
let autoNow = false;
|
|
@@ -1158,12 +1166,12 @@ async function renderBeforeStep(page, info) {
|
|
|
1158
1166
|
/* private mode / blocked storage - defaults to manual */
|
|
1159
1167
|
}
|
|
1160
1168
|
html +=
|
|
1161
|
-
"<div class
|
|
1169
|
+
"<div class=\\\"wg-autoplay-row\\\"><label><input type=\\\"checkbox\\\" id=\\\"wg-autoplay-cb\\\"" +
|
|
1162
1170
|
(autoNow ? " checked" : "") +
|
|
1163
1171
|
"> Auto-advance</label></div>" +
|
|
1164
|
-
"<div id
|
|
1165
|
-
"><button id
|
|
1166
|
-
"<div id
|
|
1172
|
+
"<div id=\\\"wg-gate-manual\\\"" + (autoNow ? " style=\\\"display:none\\\"" : "") +
|
|
1173
|
+
"><button id=\\\"wg-run\\\">Run this step \\u25B6</button></div>" +
|
|
1174
|
+
"<div id=\\\"wg-gate-auto\\\" class=\\\"wg-auto\\\"" + (autoNow ? "" : " style=\\\"display:none\\\"") +
|
|
1167
1175
|
">Auto-advancing...</div>";
|
|
1168
1176
|
panel.innerHTML = html;
|
|
1169
1177
|
if (isNewPanel) {
|
|
@@ -1196,7 +1204,7 @@ async function renderBeforeStep(page, info) {
|
|
|
1196
1204
|
return Object.entries(parsed)
|
|
1197
1205
|
.map(([field, value]) => {
|
|
1198
1206
|
const label = field.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/^./, (c) => c.toUpperCase());
|
|
1199
|
-
return "<div class
|
|
1207
|
+
return "<div class=\\\"wg-key-pretty-row\\\"><span class=\\\"wg-key-pretty-label\\\">" +
|
|
1200
1208
|
esc(label) + ":</span> " + esc(String(value)) + "</div>";
|
|
1201
1209
|
})
|
|
1202
1210
|
.join("");
|
|
@@ -1205,7 +1213,7 @@ async function renderBeforeStep(page, info) {
|
|
|
1205
1213
|
const prettyOn = window.__wgPretty !== false;
|
|
1206
1214
|
panel.querySelectorAll("textarea[data-key]").forEach((ta) => {
|
|
1207
1215
|
const key = ta.getAttribute("data-key");
|
|
1208
|
-
const previewEl = panel.querySelector(".wg-key-pretty[data-pretty-for
|
|
1216
|
+
const previewEl = panel.querySelector(".wg-key-pretty[data-pretty-for=\\\"" + key + "\\\"]");
|
|
1209
1217
|
if (!previewEl) return;
|
|
1210
1218
|
previewEl.style.display = prettyOn ? "" : "none";
|
|
1211
1219
|
if (prettyOn) previewEl.innerHTML = prettyMemValue(ta.value);
|
|
@@ -1570,8 +1578,8 @@ async function renderAfterStep(page, info) {
|
|
|
1570
1578
|
.map((name, idx) => {
|
|
1571
1579
|
const cls = idx <= info.moduleIndex ? "wg-mod-done" : "wg-mod-upcoming";
|
|
1572
1580
|
const desc = info.allDescriptions && info.allDescriptions[idx];
|
|
1573
|
-
const titleAttr = desc ? " title
|
|
1574
|
-
return "<span class
|
|
1581
|
+
const titleAttr = desc ? " title=\\\"" + escA(desc) + "\\\"" : "";
|
|
1582
|
+
return "<span class=\\\"wg-mod " + cls + "\\\"" + titleAttr + ">" + name + "</span>";
|
|
1575
1583
|
})
|
|
1576
1584
|
.join("");
|
|
1577
1585
|
// QA-friendly by default ("LoginSuccess" -> "Login Success") - raw
|
|
@@ -1582,13 +1590,13 @@ async function renderAfterStep(page, info) {
|
|
|
1582
1590
|
.replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2") || info.resultTag;
|
|
1583
1591
|
const pretty = window.__wgPretty !== false;
|
|
1584
1592
|
const resultHtml =
|
|
1585
|
-
"<div class
|
|
1586
|
-
"<button class
|
|
1587
|
-
"<button class
|
|
1593
|
+
"<div class=\\\"wg-toggle\\\">" +
|
|
1594
|
+
"<button class=\\\"wg-toggle-btn" + (pretty ? " wg-active" : "") + "\\\" data-mode=\\\"pretty\\\">Pretty</button>" +
|
|
1595
|
+
"<button class=\\\"wg-toggle-btn" + (pretty ? "" : " wg-active") + "\\\" data-mode=\\\"json\\\">JSON</button>" +
|
|
1588
1596
|
"</div>" +
|
|
1589
|
-
"<div class
|
|
1597
|
+
"<div class=\\\"wg-result wg-result-pretty\\\" style=\\\"display:" + (pretty ? "block" : "none") + "\\\">" +
|
|
1590
1598
|
prettyText + "</div>" +
|
|
1591
|
-
"<div class
|
|
1599
|
+
"<div class=\\\"wg-result wg-result-json\\\" style=\\\"display:" + (pretty ? "none" : "block") + "\\\">" +
|
|
1592
1600
|
info.resultTag + "</div>";
|
|
1593
1601
|
let autoNow = false;
|
|
1594
1602
|
try {
|
|
@@ -1597,21 +1605,21 @@ async function renderAfterStep(page, info) {
|
|
|
1597
1605
|
/* private mode / blocked storage - defaults to manual */
|
|
1598
1606
|
}
|
|
1599
1607
|
const gateHtml =
|
|
1600
|
-
"<div class
|
|
1608
|
+
"<div class=\\\"wg-autoplay-row\\\"><label><input type=\\\"checkbox\\\" id=\\\"wg-autoplay-cb\\\"" +
|
|
1601
1609
|
(autoNow ? " checked" : "") +
|
|
1602
1610
|
"> Auto-advance</label></div>" +
|
|
1603
|
-
"<div id
|
|
1604
|
-
"><button id
|
|
1605
|
-
"<div id
|
|
1611
|
+
"<div id=\\\"wg-gate-manual\\\"" + (autoNow ? " style=\\\"display:none\\\"" : "") +
|
|
1612
|
+
"><button id=\\\"wg-run\\\">" + buttonLabel + "</button></div>" +
|
|
1613
|
+
"<div id=\\\"wg-gate-auto\\\" class=\\\"wg-auto\\\"" + (autoNow ? "" : " style=\\\"display:none\\\"") +
|
|
1606
1614
|
">Auto-advancing...</div>";
|
|
1607
1615
|
const episodesHtml = info.allEpisodes && info.allEpisodes.length > 0
|
|
1608
|
-
? "<div id
|
|
1616
|
+
? "<div id=\\\"wg-episodes\\\">" +
|
|
1609
1617
|
info.allEpisodes
|
|
1610
1618
|
.map((e) => {
|
|
1611
1619
|
const cls = e.episodeNumber < info.episodeNumber ? "wg-ep-done"
|
|
1612
1620
|
: e.episodeNumber === info.episodeNumber ? "wg-ep-current"
|
|
1613
1621
|
: "wg-ep-upcoming";
|
|
1614
|
-
return "<span class
|
|
1622
|
+
return "<span class=\\\"wg-ep-tab " + cls + "\\\">Episode " + e.episodeNumber + ": " +
|
|
1615
1623
|
escA(e.episodeTitle || "") + "</span>";
|
|
1616
1624
|
})
|
|
1617
1625
|
.join("") +
|
|
@@ -1619,41 +1627,45 @@ async function renderAfterStep(page, info) {
|
|
|
1619
1627
|
: "";
|
|
1620
1628
|
const paceHtml =
|
|
1621
1629
|
info.paceBadge || info.paceLabel
|
|
1622
|
-
? "<div class
|
|
1630
|
+
? "<div class=\\\"wg-pace\\\" data-pace-kind=\\\"" +
|
|
1623
1631
|
escA(info.paceKind || "normal") +
|
|
1624
|
-
"
|
|
1632
|
+
"\\\"><span class=\\\"wg-pace-badge\\\">" +
|
|
1625
1633
|
escA(info.paceBadge || "1x") +
|
|
1626
1634
|
"</span><span>" +
|
|
1627
1635
|
escA(info.paceLabel || "") +
|
|
1628
1636
|
"</span></div>"
|
|
1629
1637
|
: "";
|
|
1630
1638
|
panel.innerHTML =
|
|
1631
|
-
"<div id
|
|
1639
|
+
"<div id=\\\"wg-progress\\\"><div id=\\\"wg-progress-bar\\\" style=\\\"width:" + pct + "%\\\"></div></div>" +
|
|
1632
1640
|
episodesHtml +
|
|
1633
1641
|
paceHtml +
|
|
1634
|
-
"<div id
|
|
1642
|
+
"<div id=\\\"wg-modules\\\" class=\\\"" + modulesClass + "\\\">" + modulesHtml + "</div>" +
|
|
1635
1643
|
"<h3>" + heading + "</h3>" +
|
|
1636
1644
|
((() => {
|
|
1637
1645
|
const list = info.todos || [];
|
|
1638
1646
|
if (!list.length) return "";
|
|
1639
1647
|
return (
|
|
1640
|
-
|
|
1648
|
+
'<ul id="wg-todos">' +
|
|
1641
1649
|
list
|
|
1642
1650
|
.map((t) => {
|
|
1643
1651
|
const cls = t.current ? "wg-todo-current" : t.done ? "wg-todo-done" : "wg-todo-pending";
|
|
1644
|
-
const mark = t.done
|
|
1652
|
+
const mark = t.done
|
|
1653
|
+
? String.fromCharCode(0x2713)
|
|
1654
|
+
: t.current
|
|
1655
|
+
? String.fromCharCode(0x2192)
|
|
1656
|
+
: String.fromCharCode(0x25cb);
|
|
1645
1657
|
return (
|
|
1646
|
-
|
|
1658
|
+
'<li class="' +
|
|
1647
1659
|
cls +
|
|
1648
|
-
"
|
|
1660
|
+
'"><span class="wg-todo-mark">' +
|
|
1649
1661
|
mark +
|
|
1650
|
-
|
|
1662
|
+
'</span><span>' +
|
|
1651
1663
|
escA(t.text || "") +
|
|
1652
|
-
|
|
1664
|
+
'</span></li>'
|
|
1653
1665
|
);
|
|
1654
1666
|
})
|
|
1655
1667
|
.join("") +
|
|
1656
|
-
|
|
1668
|
+
'</ul>'
|
|
1657
1669
|
);
|
|
1658
1670
|
})()) +
|
|
1659
1671
|
resultHtml +
|
|
@@ -1722,13 +1734,13 @@ async function renderStepError(page, info) {
|
|
|
1722
1734
|
if (!isNewPanel) panel.classList.add("wg-in");
|
|
1723
1735
|
const esc = (s) => String(s).replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
1724
1736
|
const episodesHtml = info.allEpisodes && info.allEpisodes.length > 0
|
|
1725
|
-
? "<div id
|
|
1737
|
+
? "<div id=\\\"wg-episodes\\\">" +
|
|
1726
1738
|
info.allEpisodes
|
|
1727
1739
|
.map((e) => {
|
|
1728
1740
|
const cls = e.episodeNumber < info.episodeNumber ? "wg-ep-done"
|
|
1729
1741
|
: e.episodeNumber === info.episodeNumber ? "wg-ep-current"
|
|
1730
1742
|
: "wg-ep-upcoming";
|
|
1731
|
-
return "<span class
|
|
1743
|
+
return "<span class=\\\"wg-ep-tab " + cls + "\\\">Episode " + e.episodeNumber + ": " +
|
|
1732
1744
|
esc(e.episodeTitle || "") + "</span>";
|
|
1733
1745
|
})
|
|
1734
1746
|
.join("") +
|
|
@@ -1739,8 +1751,8 @@ async function renderStepError(page, info) {
|
|
|
1739
1751
|
.map((name, idx) => {
|
|
1740
1752
|
const cls = idx === info.moduleIndex ? "wg-mod-current" : idx < info.moduleIndex ? "wg-mod-done" : "wg-mod-upcoming";
|
|
1741
1753
|
const desc = info.allDescriptions && info.allDescriptions[idx];
|
|
1742
|
-
const titleAttr = desc ? " title
|
|
1743
|
-
return "<span class
|
|
1754
|
+
const titleAttr = desc ? " title=\\\"" + esc(desc) + "\\\"" : "";
|
|
1755
|
+
return "<span class=\\\"wg-mod " + cls + "\\\"" + titleAttr + ">" + name + "</span>";
|
|
1744
1756
|
})
|
|
1745
1757
|
.join("");
|
|
1746
1758
|
const retryLabel = info.episodeNumber !== undefined ? "Retry Episode " + info.episodeNumber : "Retry";
|
|
@@ -1748,17 +1760,17 @@ async function renderStepError(page, info) {
|
|
|
1748
1760
|
? "Expected outcome - Step " + (info.index + 1) + " / " + info.total + " - " + info.blockName + " failed as intended"
|
|
1749
1761
|
: "Step " + (info.index + 1) + " / " + info.total + " - " + info.blockName + " threw";
|
|
1750
1762
|
const reasonHtml = isExpected
|
|
1751
|
-
? "<div class
|
|
1763
|
+
? "<div class=\\\"wg-expected-reason\\\">" + esc(info.expectedFailureReason) + "</div>"
|
|
1752
1764
|
: "";
|
|
1753
1765
|
panel.innerHTML =
|
|
1754
1766
|
episodesHtml +
|
|
1755
|
-
"<div id
|
|
1756
|
-
"<h3 class
|
|
1767
|
+
"<div id=\\\"wg-modules\\\" class=\\\"" + modulesClass + "\\\">" + modulesHtml + "</div>" +
|
|
1768
|
+
"<h3 class=\\\"" + (isExpected ? "wg-expected-heading" : "wg-error-heading") + "\\\">" + headingText + "</h3>" +
|
|
1757
1769
|
reasonHtml +
|
|
1758
|
-
"<div class
|
|
1759
|
-
"<div class
|
|
1760
|
-
"<button id
|
|
1761
|
-
"<button id
|
|
1770
|
+
"<div class=\\\"wg-error-msg\\\">" + esc(info.message) + "</div>" +
|
|
1771
|
+
"<div class=\\\"wg-error-actions\\\">" +
|
|
1772
|
+
"<button id=\\\"wg-error-retry\\\" class=\\\"wg-error-retry\\\">" + esc(retryLabel) + "</button>" +
|
|
1773
|
+
"<button id=\\\"wg-run\\\" class=\\\"wg-error-stop\\\">Stop</button>" +
|
|
1762
1774
|
"</div>";
|
|
1763
1775
|
if (isNewPanel) {
|
|
1764
1776
|
document.documentElement.appendChild(panel);
|
|
@@ -2022,25 +2034,25 @@ async function presentSlides(page, slides, _gate, opts) {
|
|
|
2022
2034
|
String(t).replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
2023
2035
|
const episodeLine =
|
|
2024
2036
|
info.episodeNumber !== undefined && info.episodeNumber !== null
|
|
2025
|
-
? "<div class
|
|
2037
|
+
? "<div class=\\\"wg-episode\\\">Episode " +
|
|
2026
2038
|
info.episodeNumber +
|
|
2027
2039
|
(info.episodeTitle ? ": " + esc(info.episodeTitle) : "") +
|
|
2028
2040
|
" · yap slides</div>"
|
|
2029
2041
|
: "";
|
|
2030
2042
|
const paceHtml =
|
|
2031
2043
|
info.paceBadge || info.paceLabel
|
|
2032
|
-
? "<div class
|
|
2044
|
+
? "<div class=\\\"wg-pace\\\" data-pace-kind=\\\"" +
|
|
2033
2045
|
esc(info.paceKind || "normal") +
|
|
2034
|
-
"
|
|
2046
|
+
"\\\"><span class=\\\"wg-pace-badge\\\">" +
|
|
2035
2047
|
esc(info.paceBadge || "1x") +
|
|
2036
2048
|
"</span><span>" +
|
|
2037
2049
|
esc(info.paceLabel || "") +
|
|
2038
2050
|
"</span></div>"
|
|
2039
2051
|
: "";
|
|
2040
2052
|
panel.innerHTML =
|
|
2041
|
-
"<div class
|
|
2042
|
-
"<button type
|
|
2043
|
-
"<div class
|
|
2053
|
+
"<div class=\\\"wg-chrome\\\"><span class=\\\"wg-chrome-title\\\">waygraph demo</span>" +
|
|
2054
|
+
"<button type=\\\"button\\\" class=\\\"wg-hide-btn\\\" data-wg-toggle=\\\"1\\\">Hide</button></div>" +
|
|
2055
|
+
"<div class=\\\"wg-body\\\">" +
|
|
2044
2056
|
episodeLine +
|
|
2045
2057
|
paceHtml +
|
|
2046
2058
|
"<h3>Slide " +
|
|
@@ -2050,35 +2062,35 @@ async function presentSlides(page, slides, _gate, opts) {
|
|
|
2050
2062
|
(info.blockName ? " · " + esc(info.blockName) : "") +
|
|
2051
2063
|
"</h3>" +
|
|
2052
2064
|
(info.tag
|
|
2053
|
-
? "<div style
|
|
2065
|
+
? "<div style=\\\"border:none;padding:0;margin:0 0 6px;font-size:11px;color:#c9a6ff\\\">" +
|
|
2054
2066
|
esc(info.tag) +
|
|
2055
2067
|
"</div>"
|
|
2056
2068
|
: "") +
|
|
2057
|
-
"<div class
|
|
2069
|
+
"<div class=\\\"wg-narration\\\">" +
|
|
2058
2070
|
esc(info.caption) +
|
|
2059
2071
|
"</div>" +
|
|
2060
2072
|
(info.detail
|
|
2061
|
-
? "<div class
|
|
2073
|
+
? "<div class=\\\"wg-result-pretty\\\" style=\\\"margin:0 0 12px;color:#f0e8ff\\\">" +
|
|
2062
2074
|
esc(info.detail) +
|
|
2063
2075
|
"</div>"
|
|
2064
2076
|
: "") +
|
|
2065
2077
|
(info.dwellMs != null
|
|
2066
|
-
? "<div class
|
|
2078
|
+
? "<div class=\\\"wg-auto\\\" id=\\\"wg-dwell-hint\\\" style=\\\"margin:0 0 8px\\\">Hold " +
|
|
2067
2079
|
(info.dwellMs / 1000).toFixed(1) +
|
|
2068
2080
|
"s before next...</div>"
|
|
2069
2081
|
: "") +
|
|
2070
|
-
"<div class
|
|
2082
|
+
"<div class=\\\"wg-autoplay-row\\\"><label><input type=\\\"checkbox\\\" id=\\\"wg-autoplay-cb\\\"" +
|
|
2071
2083
|
(info.autoNow ? " checked" : "") +
|
|
2072
2084
|
"> Auto-advance</label></div>" +
|
|
2073
|
-
"<div id
|
|
2074
|
-
(info.autoNow ? " style
|
|
2075
|
-
"><button type
|
|
2085
|
+
"<div id=\\\"wg-gate-manual\\\"" +
|
|
2086
|
+
(info.autoNow ? " style=\\\"display:none\\\"" : "") +
|
|
2087
|
+
"><button type=\\\"button\\\" id=\\\"wg-run\\\"" +
|
|
2076
2088
|
(info.dwellMs != null ? " disabled" : "") +
|
|
2077
2089
|
">" +
|
|
2078
2090
|
(info.isLast ? "Continue \\u25B6" : "Next slide \\u25B6") +
|
|
2079
2091
|
"</button></div>" +
|
|
2080
|
-
"<div id
|
|
2081
|
-
(info.autoNow ? "" : " style
|
|
2092
|
+
"<div id=\\\"wg-gate-auto\\\" class=\\\"wg-auto\\\"" +
|
|
2093
|
+
(info.autoNow ? "" : " style=\\\"display:none\\\"") +
|
|
2082
2094
|
">Auto-advancing...</div>" +
|
|
2083
2095
|
"</div>";
|
|
2084
2096
|
if (isNew) {
|