demoman 0.8.1 → 0.8.2
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/THIRD_PARTY_NOTICES +1 -1
- package/dist/demoman.mjs +7541 -4386
- package/dist/page/executor-entry.js +102 -17
- package/dist/page/mux-entry.js +184 -59
- package/dist/page/render-entry.js +764 -613
- package/dist/recipe.md +200 -236
- package/dist/skills/record-demo/SKILL.md +5 -4
- package/dist/studio/assets/confirm-dialog-BGEp6bKH.css +1 -0
- package/dist/studio/assets/confirm-dialog-F4BR4FU0.js +72 -0
- package/dist/studio/assets/editor-63atCcDn.js +4 -0
- package/dist/studio/assets/{editor-inline-7e387eed.css → editor-inline-d74caea2.css} +10 -0
- package/dist/studio/assets/library-L3IU8F5q.js +1 -0
- package/dist/studio/assets/library-inline-3627d15c.css +1426 -0
- package/dist/studio/assets/settings-g3t2C3Eo.js +1 -0
- package/dist/studio/assets/{settings-inline-7bb8bf61.css → settings-inline-2f59fbb0.css} +4 -0
- package/dist/studio/assets/state-eyG4SxVq.js +1 -0
- package/dist/studio/assets/topbar-CgsXzkpk.js +1 -0
- package/dist/studio/assets/view-DzaxHB2c.js +1 -0
- package/dist/studio/editor.html +11 -10
- package/dist/studio/library.html +9 -8
- package/dist/studio/settings.html +8 -7
- package/dist/studio/studio-build.json +3 -3
- package/package.json +1 -1
- package/dist/studio/assets/confirm-dialog-B20ZVWlP.css +0 -1
- package/dist/studio/assets/confirm-dialog-DgJ946Hc.js +0 -72
- package/dist/studio/assets/editor-BC4sLdWT.js +0 -4
- package/dist/studio/assets/library-DVubUJtn.js +0 -1
- package/dist/studio/assets/library-inline-ff1b0c15.css +0 -635
- package/dist/studio/assets/settings-DLH9VoT0.js +0 -1
- package/dist/studio/assets/state-DyL2jOOv.js +0 -1
- package/dist/studio/assets/topbar-sSUyITjl.js +0 -1
- package/dist/studio/assets/view-Df6XUnyO.js +0 -1
|
@@ -1601,6 +1601,15 @@
|
|
|
1601
1601
|
}
|
|
1602
1602
|
}
|
|
1603
1603
|
|
|
1604
|
+
// ../../packages/replay-engine/dist/visibility.js
|
|
1605
|
+
function seenNow(el) {
|
|
1606
|
+
if (!el.checkVisibility({ opacityProperty: true, visibilityProperty: true })) {
|
|
1607
|
+
return false;
|
|
1608
|
+
}
|
|
1609
|
+
const r = el.getBoundingClientRect();
|
|
1610
|
+
return r.width > 2 && r.height > 2;
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1604
1613
|
// ../../packages/run-core/dist/secrets.js
|
|
1605
1614
|
var SPECIFIC_SHAPES = [
|
|
1606
1615
|
/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]+/g,
|
|
@@ -1722,7 +1731,7 @@
|
|
|
1722
1731
|
var HINT_ATTRS = ["name", "id", "placeholder", "aria-label"];
|
|
1723
1732
|
function isCredentialField(el) {
|
|
1724
1733
|
const tag = el.tagName.toLowerCase();
|
|
1725
|
-
const editable = tag === "input" || tag === "textarea" || el.hasAttribute("contenteditable");
|
|
1734
|
+
const editable = tag === "input" || tag === "textarea" || tag === "select" || el.hasAttribute("contenteditable");
|
|
1726
1735
|
if (!editable)
|
|
1727
1736
|
return false;
|
|
1728
1737
|
if ((el.getAttribute("type") ?? "").toLowerCase() === "password")
|
|
@@ -1754,12 +1763,89 @@
|
|
|
1754
1763
|
|
|
1755
1764
|
// ../../packages/run-core/dist/snapshot-walk.js
|
|
1756
1765
|
var SNAPSHOT_TEXT_MAX = 80;
|
|
1766
|
+
function isInteractive(el) {
|
|
1767
|
+
if (el.hasAttribute("tabindex") || el.hasAttribute("onclick"))
|
|
1768
|
+
return true;
|
|
1769
|
+
if (el.onclick !== null && "onclick" in el)
|
|
1770
|
+
return true;
|
|
1771
|
+
const view = el.ownerDocument.defaultView;
|
|
1772
|
+
if (view === null || view.getComputedStyle(el).cursor !== "pointer")
|
|
1773
|
+
return false;
|
|
1774
|
+
const parent = el.parentElement;
|
|
1775
|
+
return parent === null || view.getComputedStyle(parent).cursor !== "pointer";
|
|
1776
|
+
}
|
|
1777
|
+
function fieldValue(el) {
|
|
1778
|
+
const tag = el.tagName;
|
|
1779
|
+
const field = tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || el.hasAttribute("contenteditable");
|
|
1780
|
+
if (!field || isCredentialField(el))
|
|
1781
|
+
return null;
|
|
1782
|
+
if (NOT_FIELDS.has((el.getAttribute("type") ?? "").toLowerCase()))
|
|
1783
|
+
return null;
|
|
1784
|
+
const value = el.value;
|
|
1785
|
+
return clip(typeof value === "string" ? value : normalizeText(el.textContent));
|
|
1786
|
+
}
|
|
1757
1787
|
var SKIP = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEMPLATE"]);
|
|
1758
1788
|
function clip(text) {
|
|
1759
1789
|
if (text === null || text.length <= SNAPSHOT_TEXT_MAX)
|
|
1760
1790
|
return text;
|
|
1761
1791
|
return `${text.slice(0, SNAPSHOT_TEXT_MAX - 1)}\u2026`;
|
|
1762
1792
|
}
|
|
1793
|
+
async function nameTarget(el, i, scan) {
|
|
1794
|
+
const { anchor } = await captureAnchor(
|
|
1795
|
+
el,
|
|
1796
|
+
// Only `fingerprint` and `resolution.strategy` are read: nothing here
|
|
1797
|
+
// is stored, so no url, action index or entry state is claimed.
|
|
1798
|
+
{ anchorId: `snapshot-${i}`, url: "", actionIndex: 0, entryState: false },
|
|
1799
|
+
scan
|
|
1800
|
+
);
|
|
1801
|
+
const named = targetFromFingerprint(anchor.resolution.strategy, anchor.fingerprint);
|
|
1802
|
+
const namedBack = named === null ? null : await resolveAnchor({ id: anchor.id, fingerprint: fingerprintFromTarget(named) }, scan);
|
|
1803
|
+
if (named !== null && namedBack?.element === el && namedBack.candidates === 1) {
|
|
1804
|
+
return { target: named, positional: false, anchor };
|
|
1805
|
+
}
|
|
1806
|
+
const treePath = anchor.fingerprint.treePath;
|
|
1807
|
+
const byPath = treePath === null ? null : await resolveAnchor({ id: anchor.id, fingerprint: fingerprintFromTarget({ treePath }) }, scan);
|
|
1808
|
+
if (treePath === null || byPath?.element !== el || byPath.candidates !== 1) {
|
|
1809
|
+
return null;
|
|
1810
|
+
}
|
|
1811
|
+
return { target: { treePath }, positional: true, anchor };
|
|
1812
|
+
}
|
|
1813
|
+
async function byStableId(el, i, scan) {
|
|
1814
|
+
const stableId = readStableId(el);
|
|
1815
|
+
if (stableId === null)
|
|
1816
|
+
return null;
|
|
1817
|
+
const target = { stableId };
|
|
1818
|
+
const back = await resolveAnchor({ id: `end-page-${i}`, fingerprint: fingerprintFromTarget(target) }, scan);
|
|
1819
|
+
return back.element === el && back.candidates === 1 ? target : null;
|
|
1820
|
+
}
|
|
1821
|
+
var END_PAGE_TEXT_MAX = 2e3;
|
|
1822
|
+
var END_PAGE_MAX_FIELDS = 30;
|
|
1823
|
+
var NOT_FIELDS = /* @__PURE__ */ new Set(["hidden", "submit", "button", "reset", "image"]);
|
|
1824
|
+
async function readEndPage(env2) {
|
|
1825
|
+
const doc = env2.root;
|
|
1826
|
+
const scan = { ...env2, patch: NO_PATCH };
|
|
1827
|
+
const all = (doc.body?.innerText ?? "").trim();
|
|
1828
|
+
const text = all.length <= END_PAGE_TEXT_MAX ? all : `${all.slice(0, END_PAGE_TEXT_MAX - 1)}\u2026`;
|
|
1829
|
+
const fields = [];
|
|
1830
|
+
const candidates = Array.from(doc.body?.querySelectorAll("input, textarea, select, [contenteditable]") ?? []).filter((el) => !NOT_FIELDS.has((el.getAttribute("type") ?? "").toLowerCase()) && !isCredentialField(el));
|
|
1831
|
+
for (const [i, el] of candidates.slice(0, END_PAGE_MAX_FIELDS).entries()) {
|
|
1832
|
+
const kind = (el.getAttribute("type") ?? "").toLowerCase();
|
|
1833
|
+
const value = kind === "checkbox" || kind === "radio" ? el.checked ? "checked" : "not checked" : fieldValue(el);
|
|
1834
|
+
if (value === null)
|
|
1835
|
+
continue;
|
|
1836
|
+
const target = await byStableId(el, i, scan) ?? (await nameTarget(el, i, scan))?.target;
|
|
1837
|
+
if (target === void 0)
|
|
1838
|
+
continue;
|
|
1839
|
+
fields.push({ target, value });
|
|
1840
|
+
}
|
|
1841
|
+
const notListed = candidates.length - END_PAGE_MAX_FIELDS;
|
|
1842
|
+
return {
|
|
1843
|
+
url: doc.location?.href ?? "",
|
|
1844
|
+
text,
|
|
1845
|
+
fields,
|
|
1846
|
+
...notListed > 0 ? { fieldsNotListed: notListed } : {}
|
|
1847
|
+
};
|
|
1848
|
+
}
|
|
1763
1849
|
async function snapshotTargets(env2, request, now) {
|
|
1764
1850
|
const started = now();
|
|
1765
1851
|
const doc = env2.root;
|
|
@@ -1770,8 +1856,14 @@
|
|
|
1770
1856
|
const height = view?.innerHeight ?? 0;
|
|
1771
1857
|
const scan = { ...env2, patch: NO_PATCH };
|
|
1772
1858
|
const wanted = request.contains?.toLowerCase() ?? null;
|
|
1773
|
-
const candidates = Array.from(doc.body?.querySelectorAll("*") ?? []).filter((el) => !SKIP.has(el.tagName) && el.closest("script,style,noscript,template") === null && (computeRole(el) !== null || isTextLeaf(el) && normalizeText(el.textContent) !== null));
|
|
1774
|
-
const passes = (el, text) => wanted === null ||
|
|
1859
|
+
const candidates = Array.from(doc.body?.querySelectorAll("*") ?? []).filter((el) => !SKIP.has(el.tagName) && el.closest("script,style,noscript,template") === null && (computeRole(el) !== null || isTextLeaf(el) && normalizeText(el.textContent) !== null || readStableId(el) !== null || isInteractive(el)));
|
|
1860
|
+
const passes = (el, text) => wanted === null || [
|
|
1861
|
+
computeName(el),
|
|
1862
|
+
text,
|
|
1863
|
+
readStableId(el),
|
|
1864
|
+
computeRole(el) ?? (isTextLeaf(el) && text !== null ? "text" : "element"),
|
|
1865
|
+
fieldValue(el)
|
|
1866
|
+
].join(" ").toLowerCase().includes(wanted);
|
|
1775
1867
|
const targets = [];
|
|
1776
1868
|
let unresolvable = 0;
|
|
1777
1869
|
let notExamined = 0;
|
|
@@ -1783,23 +1875,12 @@
|
|
|
1783
1875
|
const text = normalizeText(el.textContent);
|
|
1784
1876
|
if (!passes(el, text))
|
|
1785
1877
|
continue;
|
|
1786
|
-
const
|
|
1787
|
-
|
|
1788
|
-
// Only `fingerprint` and `resolution.strategy` are read: nothing here
|
|
1789
|
-
// is stored, so no url, action index or entry state is claimed.
|
|
1790
|
-
{ anchorId: `snapshot-${i}`, url: "", actionIndex: 0, entryState: false },
|
|
1791
|
-
scan
|
|
1792
|
-
);
|
|
1793
|
-
const target = targetFromFingerprint(anchor.resolution.strategy, anchor.fingerprint);
|
|
1794
|
-
if (target === null) {
|
|
1795
|
-
unresolvable += 1;
|
|
1796
|
-
continue;
|
|
1797
|
-
}
|
|
1798
|
-
const back = await resolveAnchor({ id: anchor.id, fingerprint: fingerprintFromTarget(target) }, scan);
|
|
1799
|
-
if (back.element !== el || back.candidates !== 1) {
|
|
1878
|
+
const named = await nameTarget(el, i, scan);
|
|
1879
|
+
if (named === null) {
|
|
1800
1880
|
unresolvable += 1;
|
|
1801
1881
|
continue;
|
|
1802
1882
|
}
|
|
1883
|
+
const { target, positional, anchor } = named;
|
|
1803
1884
|
const box = el.checkVisibility() ? anchor.fingerprint.boundingRect : null;
|
|
1804
1885
|
const rect = box === null ? null : {
|
|
1805
1886
|
x: box.x + scrollX,
|
|
@@ -1811,7 +1892,10 @@
|
|
|
1811
1892
|
target,
|
|
1812
1893
|
kind: computeRole(el) ?? (anchor.fingerprint.textContent !== null ? "text" : "element"),
|
|
1813
1894
|
text: clip(text),
|
|
1895
|
+
value: fieldValue(el),
|
|
1896
|
+
...positional ? { positional: true } : {},
|
|
1814
1897
|
rect,
|
|
1898
|
+
shown: seenNow(el),
|
|
1815
1899
|
inFirstViewport: rect !== null && rect.x < width && rect.x + rect.width > 0 && rect.y < height && rect.y + rect.height > 0
|
|
1816
1900
|
});
|
|
1817
1901
|
}
|
|
@@ -1834,6 +1918,7 @@
|
|
|
1834
1918
|
patch: createCanvasMatcher()
|
|
1835
1919
|
});
|
|
1836
1920
|
var entry = {
|
|
1921
|
+
endPageHere: () => readEndPage(env()),
|
|
1837
1922
|
snapshotHere: (request) => snapshotTargets(env(), request, () => performance.now()),
|
|
1838
1923
|
// The field the action will type into, not only the element it resolved
|
|
1839
1924
|
// to: a script reaches a password input through its label (launch C).
|
package/dist/page/mux-entry.js
CHANGED
|
@@ -15363,7 +15363,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15363
15363
|
moveTo: { cursorTravels: true, approach: "nearest" },
|
|
15364
15364
|
scrollTo: { cursorTravels: false, approach: "landing" },
|
|
15365
15365
|
waitFor: { cursorTravels: false, approach: "none" },
|
|
15366
|
-
drag: { cursorTravels: true, approach: "nearest" }
|
|
15366
|
+
drag: { cursorTravels: true, approach: "nearest" },
|
|
15367
|
+
press: { cursorTravels: false, approach: "none" }
|
|
15367
15368
|
};
|
|
15368
15369
|
|
|
15369
15370
|
// ../../packages/compositor/dist/bundle.js
|
|
@@ -15815,7 +15816,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15815
15816
|
var DEFAULT_WALLPAPER_ID = "muted-1";
|
|
15816
15817
|
|
|
15817
15818
|
// ../../packages/scene-schema/dist/document.js
|
|
15818
|
-
var CURRENT_SCHEMA_VERSION =
|
|
15819
|
+
var CURRENT_SCHEMA_VERSION = 15;
|
|
15819
15820
|
var Rect = external_exports.object({
|
|
15820
15821
|
x: external_exports.number(),
|
|
15821
15822
|
y: external_exports.number(),
|
|
@@ -15908,9 +15909,27 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15908
15909
|
signal: external_exports.enum(["mutation", "style"]).optional()
|
|
15909
15910
|
});
|
|
15910
15911
|
var TEXT_LINES_MAX = 200;
|
|
15912
|
+
var PRESS_KEYS = [
|
|
15913
|
+
"Enter",
|
|
15914
|
+
"Tab",
|
|
15915
|
+
"Escape",
|
|
15916
|
+
"Backspace",
|
|
15917
|
+
"Delete",
|
|
15918
|
+
"ArrowUp",
|
|
15919
|
+
"ArrowDown",
|
|
15920
|
+
"ArrowLeft",
|
|
15921
|
+
"ArrowRight",
|
|
15922
|
+
"Space"
|
|
15923
|
+
];
|
|
15924
|
+
var Spot = external_exports.object({
|
|
15925
|
+
x: external_exports.number().min(0).max(1),
|
|
15926
|
+
y: external_exports.number().min(0).max(1)
|
|
15927
|
+
});
|
|
15911
15928
|
var Click = external_exports.object({
|
|
15912
15929
|
...actionBase,
|
|
15913
15930
|
kind: external_exports.literal("click"),
|
|
15931
|
+
/** Where in the target's box the click lands, as fractions of it (v14); absent: its centre. */
|
|
15932
|
+
at: Spot.optional(),
|
|
15914
15933
|
button: external_exports.enum(["left", "middle", "right"]).optional(),
|
|
15915
15934
|
/**
|
|
15916
15935
|
* The lines of text on screen when the click was measured, in the space
|
|
@@ -15986,9 +16005,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15986
16005
|
kind: external_exports.literal("waitFor"),
|
|
15987
16006
|
condition: external_exports.enum(["visible", "hidden", "loaded"]).optional()
|
|
15988
16007
|
});
|
|
15989
|
-
var
|
|
15990
|
-
|
|
15991
|
-
|
|
16008
|
+
var Press = external_exports.object({
|
|
16009
|
+
...actionBase,
|
|
16010
|
+
anchorId: external_exports.null(),
|
|
16011
|
+
kind: external_exports.literal("press"),
|
|
16012
|
+
key: external_exports.enum(PRESS_KEYS)
|
|
15992
16013
|
});
|
|
15993
16014
|
var Drag = external_exports.object({
|
|
15994
16015
|
...actionBase,
|
|
@@ -16013,7 +16034,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16013
16034
|
TypeAction,
|
|
16014
16035
|
ScrollTo,
|
|
16015
16036
|
WaitFor,
|
|
16016
|
-
Drag
|
|
16037
|
+
Drag,
|
|
16038
|
+
Press
|
|
16017
16039
|
]);
|
|
16018
16040
|
var MarkerSchema2 = external_exports.object({
|
|
16019
16041
|
actionId: external_exports.string().min(1),
|
|
@@ -16038,14 +16060,35 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16038
16060
|
scale: external_exports.number().positive().optional(),
|
|
16039
16061
|
/** Why the aim is not what the click asked for (`aimFallback`), or
|
|
16040
16062
|
* anything else the editor owes the author about this zoom. */
|
|
16041
|
-
note: external_exports.string().optional()
|
|
16063
|
+
note: external_exports.string().optional(),
|
|
16064
|
+
/**
|
|
16065
|
+
* Where this zoom came from: `click` was generated for a click, `author`
|
|
16066
|
+
* was written by the author (the Studio's addZoom, or a click zoom the
|
|
16067
|
+
* author moved; a script's `zoom` stays `click` with `scaleSetBy: "script"`). The record that
|
|
16068
|
+
* write-back reads; never inferred from the event's shape. Absent on every
|
|
16069
|
+
* take saved before v15 — those are not guessed.
|
|
16070
|
+
*/
|
|
16071
|
+
source: external_exports.enum(["click", "author"]).optional(),
|
|
16072
|
+
/**
|
|
16073
|
+
* Who chose `scale`: `script` set it explicitly, `author` is the studio's
|
|
16074
|
+
* own edit. The record that write-back reads, never inferred from the
|
|
16075
|
+
* scale's value. Absent when the scale was the default.
|
|
16076
|
+
*/
|
|
16077
|
+
scaleSetBy: external_exports.enum(["script", "author"]).optional()
|
|
16042
16078
|
});
|
|
16043
16079
|
var ZoomSkipped = external_exports.union([
|
|
16044
16080
|
external_exports.object({
|
|
16045
16081
|
actionId: external_exports.string().min(1),
|
|
16046
16082
|
reason: external_exports.enum(["tooClose", "sameTarget"]),
|
|
16047
16083
|
afterActionId: external_exports.string().min(1),
|
|
16048
|
-
gapMs: external_exports.number()
|
|
16084
|
+
gapMs: external_exports.number(),
|
|
16085
|
+
/** The scale the script asked for on this click, which the gap refused.
|
|
16086
|
+
* The record that write-back reads, never inferred. */
|
|
16087
|
+
askedScale: external_exports.number().optional()
|
|
16088
|
+
}),
|
|
16089
|
+
external_exports.object({
|
|
16090
|
+
actionId: external_exports.string().min(1),
|
|
16091
|
+
reason: external_exports.literal("off")
|
|
16049
16092
|
}),
|
|
16050
16093
|
external_exports.object({
|
|
16051
16094
|
actionId: external_exports.string().min(1),
|
|
@@ -16527,6 +16570,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16527
16570
|
var SCRIPT_VERSION_DEVICE = 4;
|
|
16528
16571
|
var SCRIPT_VERSION_ACCOUNT = 5;
|
|
16529
16572
|
var SCRIPT_VERSION_DRAG = 6;
|
|
16573
|
+
var SCRIPT_VERSION_PRESS = 7;
|
|
16574
|
+
var SCRIPT_VERSION_EDITS = 8;
|
|
16575
|
+
var ZOOM_MAX_SCALE = 2.5;
|
|
16530
16576
|
var ACCOUNT_NAME = /^[a-z0-9][a-z0-9_-]{0,63}$/;
|
|
16531
16577
|
var ACCOUNT_NAME_RULE = 'lower-case letters, digits, "-" and "_", starting with a letter or digit, at most 64 characters';
|
|
16532
16578
|
var ScriptTargetSchema = external_exports.union([
|
|
@@ -16544,10 +16590,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16544
16590
|
by: external_exports.object({ x: external_exports.number().finite(), y: external_exports.number().finite() }).strict()
|
|
16545
16591
|
}).strict()
|
|
16546
16592
|
]);
|
|
16593
|
+
var ZoomIntentSchema = external_exports.union([
|
|
16594
|
+
external_exports.literal(false),
|
|
16595
|
+
external_exports.object({
|
|
16596
|
+
scale: external_exports.number().gt(1, {
|
|
16597
|
+
message: "a zoom scale is over 1; use `zoom: false` for none"
|
|
16598
|
+
}).max(ZOOM_MAX_SCALE, {
|
|
16599
|
+
message: `a zoom scale is at most ${ZOOM_MAX_SCALE}, the camera's limit`
|
|
16600
|
+
})
|
|
16601
|
+
}).strict()
|
|
16602
|
+
]);
|
|
16547
16603
|
var ScriptStepSchema = external_exports.discriminatedUnion("do", [
|
|
16548
16604
|
external_exports.object({
|
|
16549
16605
|
do: external_exports.literal("click"),
|
|
16550
16606
|
on: ScriptTargetSchema,
|
|
16607
|
+
/** Where in the target's box to click (its centre if absent). */
|
|
16608
|
+
at: DragSpotSchema.optional(),
|
|
16609
|
+
zoom: ZoomIntentSchema.optional(),
|
|
16551
16610
|
/**
|
|
16552
16611
|
* The recorded action this step was derived from (`scriptFromTake` writes
|
|
16553
16612
|
* it). How the recording layer pairs a run's step with the author's —
|
|
@@ -16598,6 +16657,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16598
16657
|
do: external_exports.literal("drag"),
|
|
16599
16658
|
from: DragFromSchema,
|
|
16600
16659
|
to: DragToSchema,
|
|
16660
|
+
zoom: ZoomIntentSchema.optional(),
|
|
16661
|
+
recorded: RecordedSchema
|
|
16662
|
+
}).strict(),
|
|
16663
|
+
external_exports.object({
|
|
16664
|
+
do: external_exports.literal("press"),
|
|
16665
|
+
key: external_exports.enum(PRESS_KEYS),
|
|
16601
16666
|
recorded: RecordedSchema
|
|
16602
16667
|
}).strict(),
|
|
16603
16668
|
external_exports.object({ do: external_exports.literal("waitForLoad"), recorded: RecordedSchema }).strict(),
|
|
@@ -16610,21 +16675,56 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16610
16675
|
scrollTo: true,
|
|
16611
16676
|
waitFor: true,
|
|
16612
16677
|
drag: true,
|
|
16678
|
+
press: true,
|
|
16613
16679
|
waitForLoad: true,
|
|
16614
16680
|
pause: false
|
|
16615
16681
|
};
|
|
16682
|
+
var SHOWN_STEP = {
|
|
16683
|
+
click: true,
|
|
16684
|
+
type: true,
|
|
16685
|
+
hover: true,
|
|
16686
|
+
scrollTo: true,
|
|
16687
|
+
waitFor: false,
|
|
16688
|
+
drag: true,
|
|
16689
|
+
press: true,
|
|
16690
|
+
waitForLoad: false,
|
|
16691
|
+
pause: false
|
|
16692
|
+
};
|
|
16693
|
+
function trimStepIndex(script, side) {
|
|
16694
|
+
const step = script.trim?.[side]?.step;
|
|
16695
|
+
if (step !== void 0)
|
|
16696
|
+
return step - 1;
|
|
16697
|
+
const shown = script.steps.flatMap((s, i) => SHOWN_STEP[s.do] ? [i] : []);
|
|
16698
|
+
return (side === "start" ? shown[0] : shown.at(-1)) ?? null;
|
|
16699
|
+
}
|
|
16700
|
+
var ScriptTrimSchema = external_exports.object({
|
|
16701
|
+
start: external_exports.object({
|
|
16702
|
+
ms: external_exports.number().finite().nonnegative(),
|
|
16703
|
+
step: external_exports.number().int().positive().optional()
|
|
16704
|
+
}).strict().optional(),
|
|
16705
|
+
end: external_exports.object({
|
|
16706
|
+
ms: external_exports.number().finite().nonnegative(),
|
|
16707
|
+
step: external_exports.number().int().positive().optional(),
|
|
16708
|
+
after: external_exports.enum(["zoomOut", "action"]).optional()
|
|
16709
|
+
}).strict().optional()
|
|
16710
|
+
}).strict();
|
|
16616
16711
|
var ScriptBrandingSchema = BrandingSchema.extend({
|
|
16617
16712
|
padding: BrandingSchema.shape.padding.default(BRANDING_DEFAULTS.padding)
|
|
16618
16713
|
});
|
|
16714
|
+
var ScriptVersionSchema = external_exports.literal([
|
|
16715
|
+
SCRIPT_VERSION,
|
|
16716
|
+
SCRIPT_VERSION_KIT,
|
|
16717
|
+
SCRIPT_VERSION_MOTION,
|
|
16718
|
+
SCRIPT_VERSION_DEVICE,
|
|
16719
|
+
SCRIPT_VERSION_ACCOUNT,
|
|
16720
|
+
SCRIPT_VERSION_DRAG,
|
|
16721
|
+
SCRIPT_VERSION_PRESS,
|
|
16722
|
+
SCRIPT_VERSION_EDITS
|
|
16723
|
+
]);
|
|
16724
|
+
var laterVersion = (a, b) => b > a ? b : a;
|
|
16619
16725
|
var DemoScriptShape = external_exports.object({
|
|
16620
|
-
|
|
16621
|
-
|
|
16622
|
-
SCRIPT_VERSION_KIT,
|
|
16623
|
-
SCRIPT_VERSION_MOTION,
|
|
16624
|
-
SCRIPT_VERSION_DEVICE,
|
|
16625
|
-
SCRIPT_VERSION_ACCOUNT,
|
|
16626
|
-
SCRIPT_VERSION_DRAG
|
|
16627
|
-
]),
|
|
16726
|
+
/** Optional: Demoman sets it (see `minimumScriptVersion`); a lower one is raised. */
|
|
16727
|
+
scriptVersion: ScriptVersionSchema.optional(),
|
|
16628
16728
|
name: external_exports.string().min(1),
|
|
16629
16729
|
target: external_exports.url(),
|
|
16630
16730
|
/** Absent means the run's own window size, recorded into the document. */
|
|
@@ -16641,6 +16741,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16641
16741
|
message: `an account name is ${ACCOUNT_NAME_RULE}`
|
|
16642
16742
|
}).optional(),
|
|
16643
16743
|
steps: external_exports.array(ScriptStepSchema).min(1),
|
|
16744
|
+
/** Cut the film's start and end (`ScriptTrimSchema`). Absent: the whole take. */
|
|
16745
|
+
trim: ScriptTrimSchema.optional(),
|
|
16644
16746
|
/**
|
|
16645
16747
|
* The take that steps' `recorded` ids refer to (`scriptFromTake` writes it).
|
|
16646
16748
|
* Absent on a script nobody derived from a recording.
|
|
@@ -16675,13 +16777,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16675
16777
|
}).optional()
|
|
16676
16778
|
});
|
|
16677
16779
|
var DemoScriptSchema = DemoScriptShape.superRefine((script, ctx) => {
|
|
16678
|
-
if (script.look?.kit !== void 0 && script.scriptVersion < SCRIPT_VERSION_KIT) {
|
|
16679
|
-
ctx.addIssue({
|
|
16680
|
-
code: "custom",
|
|
16681
|
-
message: `a script that names look.kit declares scriptVersion ${SCRIPT_VERSION_KIT}: a build from before brand kits would drop the kit and record the default look`,
|
|
16682
|
-
path: ["scriptVersion"]
|
|
16683
|
-
});
|
|
16684
|
-
}
|
|
16685
16780
|
const bg = script.look?.branding?.background;
|
|
16686
16781
|
if (bg?.kind === "wallpaper" && !WALLPAPERS.some((w) => w.id === bg.id)) {
|
|
16687
16782
|
ctx.addIssue({
|
|
@@ -16690,44 +16785,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16690
16785
|
path: ["look", "branding", "background", "id"]
|
|
16691
16786
|
});
|
|
16692
16787
|
}
|
|
16693
|
-
if (script.look?.motion !== void 0 && script.scriptVersion < SCRIPT_VERSION_MOTION) {
|
|
16694
|
-
ctx.addIssue({
|
|
16695
|
-
code: "custom",
|
|
16696
|
-
message: `a script that names look.motion declares scriptVersion ${SCRIPT_VERSION_MOTION}: a build from before camera motion settings would drop them and record the default camera`,
|
|
16697
|
-
path: ["scriptVersion"]
|
|
16698
|
-
});
|
|
16699
|
-
}
|
|
16700
|
-
if (cursorPolishNamed(script.look?.cursor) && script.scriptVersion < SCRIPT_VERSION_MOTION) {
|
|
16701
|
-
ctx.addIssue({
|
|
16702
|
-
code: "custom",
|
|
16703
|
-
message: `a script that names look.cursor.tilt or look.cursor.clickBounce declares scriptVersion ${SCRIPT_VERSION_MOTION}: a build from before them would drop them and draw the default lean and press`,
|
|
16704
|
-
path: ["scriptVersion"]
|
|
16705
|
-
});
|
|
16706
|
-
}
|
|
16707
|
-
if (script.device !== void 0 && script.scriptVersion < SCRIPT_VERSION_DEVICE) {
|
|
16708
|
-
ctx.addIssue({
|
|
16709
|
-
code: "custom",
|
|
16710
|
-
message: `a script that names device declares scriptVersion ${SCRIPT_VERSION_DEVICE}: a build from before devices would drop it and record the desktop`,
|
|
16711
|
-
path: ["scriptVersion"]
|
|
16712
|
-
});
|
|
16713
|
-
}
|
|
16714
|
-
if (script.account !== void 0 && script.scriptVersion < SCRIPT_VERSION_ACCOUNT) {
|
|
16715
|
-
ctx.addIssue({
|
|
16716
|
-
code: "custom",
|
|
16717
|
-
message: `a script that names account declares scriptVersion ${SCRIPT_VERSION_ACCOUNT}: a build from before accounts would drop it and record as whoever is signed in`,
|
|
16718
|
-
path: ["scriptVersion"]
|
|
16719
|
-
});
|
|
16720
|
-
}
|
|
16721
16788
|
script.steps.forEach((step, index) => {
|
|
16722
16789
|
if (step.do !== "drag")
|
|
16723
16790
|
return;
|
|
16724
|
-
if (script.scriptVersion < SCRIPT_VERSION_DRAG) {
|
|
16725
|
-
ctx.addIssue({
|
|
16726
|
-
code: "custom",
|
|
16727
|
-
message: `a script that uses drag declares scriptVersion ${SCRIPT_VERSION_DRAG}: a build from before drag would refuse the step`,
|
|
16728
|
-
path: ["scriptVersion"]
|
|
16729
|
-
});
|
|
16730
|
-
}
|
|
16731
16791
|
const nowhere = "by" in step.to ? step.to.by.x === 0 && step.to.by.y === 0 : JSON.stringify(step.to.on) === JSON.stringify(step.from.on) && (step.to.at?.x ?? 0.5) === (step.from.at?.x ?? 0.5) && (step.to.at?.y ?? 0.5) === (step.from.at?.y ?? 0.5);
|
|
16732
16792
|
if (nowhere) {
|
|
16733
16793
|
ctx.addIssue({
|
|
@@ -16764,6 +16824,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16764
16824
|
});
|
|
16765
16825
|
});
|
|
16766
16826
|
}
|
|
16827
|
+
if (script.trim)
|
|
16828
|
+
trimIssues(script, ctx);
|
|
16767
16829
|
if (script.steps.some((step) => ACTS_ON_THE_PAGE[step.do]))
|
|
16768
16830
|
return;
|
|
16769
16831
|
ctx.addIssue({
|
|
@@ -16771,7 +16833,56 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16771
16833
|
message: "a script needs at least one step that acts on the page; every step here is a pause, which is a duration and performs nothing, so this script can never produce a take",
|
|
16772
16834
|
path: ["steps"]
|
|
16773
16835
|
});
|
|
16774
|
-
})
|
|
16836
|
+
}).transform((script) => ({
|
|
16837
|
+
...script,
|
|
16838
|
+
scriptVersion: laterVersion(script.scriptVersion ?? SCRIPT_VERSION, minimumScriptVersion(script))
|
|
16839
|
+
}));
|
|
16840
|
+
function trimIssues(script, ctx) {
|
|
16841
|
+
const { steps, trim = {} } = script;
|
|
16842
|
+
let bad = false;
|
|
16843
|
+
for (const edge of ["start", "end"]) {
|
|
16844
|
+
const step = trim[edge]?.step;
|
|
16845
|
+
if (step === void 0)
|
|
16846
|
+
continue;
|
|
16847
|
+
const why = step > steps.length ? `trim.${edge}.step is ${step}, but the script has ${steps.length} steps` : steps[step - 1]?.do === "pause" ? `trim.${edge}.step is ${step}, a pause: name a step that does something` : void 0;
|
|
16848
|
+
if (!why)
|
|
16849
|
+
continue;
|
|
16850
|
+
bad = true;
|
|
16851
|
+
ctx.addIssue({
|
|
16852
|
+
code: "custom",
|
|
16853
|
+
message: why,
|
|
16854
|
+
path: ["trim", edge, "step"]
|
|
16855
|
+
});
|
|
16856
|
+
}
|
|
16857
|
+
const start = trimStepIndex(script, "start");
|
|
16858
|
+
const end = trimStepIndex(script, "end");
|
|
16859
|
+
if (!bad && start !== null && end !== null && start > end) {
|
|
16860
|
+
ctx.addIssue({
|
|
16861
|
+
code: "custom",
|
|
16862
|
+
message: `trim starts at step ${start + 1}, after the step it ends at (${end + 1}): the film would be empty`,
|
|
16863
|
+
path: ["trim", "start", "step"]
|
|
16864
|
+
});
|
|
16865
|
+
}
|
|
16866
|
+
}
|
|
16867
|
+
function minimumScriptVersion(script) {
|
|
16868
|
+
const rules = [
|
|
16869
|
+
[script.look?.kit !== void 0, SCRIPT_VERSION_KIT],
|
|
16870
|
+
[script.look?.motion !== void 0, SCRIPT_VERSION_MOTION],
|
|
16871
|
+
[cursorPolishNamed(script.look?.cursor), SCRIPT_VERSION_MOTION],
|
|
16872
|
+
[script.device !== void 0, SCRIPT_VERSION_DEVICE],
|
|
16873
|
+
[script.account !== void 0, SCRIPT_VERSION_ACCOUNT],
|
|
16874
|
+
[script.steps.some((step) => step.do === "drag"), SCRIPT_VERSION_DRAG],
|
|
16875
|
+
[
|
|
16876
|
+
script.trim !== void 0 || script.steps.some((step) => (step.do === "click" || step.do === "drag") && step.zoom !== void 0),
|
|
16877
|
+
SCRIPT_VERSION_EDITS
|
|
16878
|
+
],
|
|
16879
|
+
[
|
|
16880
|
+
script.steps.some((step) => step.do === "press" || step.do === "click" && step.at),
|
|
16881
|
+
SCRIPT_VERSION_PRESS
|
|
16882
|
+
]
|
|
16883
|
+
];
|
|
16884
|
+
return rules.filter(([on]) => on).map(([, v]) => v).reduce(laterVersion, SCRIPT_VERSION);
|
|
16885
|
+
}
|
|
16775
16886
|
function cursorPolishNamed(cursor) {
|
|
16776
16887
|
return cursor?.tilt !== void 0 || cursor?.clickBounce !== void 0;
|
|
16777
16888
|
}
|
|
@@ -26631,6 +26742,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
26631
26742
|
|
|
26632
26743
|
// ../../packages/compositor/dist/ports/sink-mp4.js
|
|
26633
26744
|
var ENCODER_USED_GLOBAL = "__demomanMp4Encoder";
|
|
26745
|
+
var SINK_TIMES_GLOBAL = "__demomanMp4SinkTimes";
|
|
26746
|
+
var sinkTimes = () => globalThis[SINK_TIMES_GLOBAL];
|
|
26634
26747
|
function createMp4Sink(target) {
|
|
26635
26748
|
const output2 = new Output({
|
|
26636
26749
|
format: new Mp4OutputFormat(),
|
|
@@ -26668,13 +26781,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
26668
26781
|
throw new Error("sink already finish()ed; cannot accept more frames");
|
|
26669
26782
|
started ??= output2.start();
|
|
26670
26783
|
await started;
|
|
26784
|
+
const times = sinkTimes();
|
|
26785
|
+
const t0 = performance.now();
|
|
26671
26786
|
const sample = new VideoSample(canvas, {
|
|
26672
26787
|
timestamp: timestampSec,
|
|
26673
26788
|
duration: durationSec
|
|
26674
26789
|
});
|
|
26790
|
+
const t1 = performance.now();
|
|
26675
26791
|
await source.add(sample);
|
|
26676
26792
|
sample.close();
|
|
26677
26793
|
frames += 1;
|
|
26794
|
+
if (times !== void 0) {
|
|
26795
|
+
times.copyMs += t1 - t0;
|
|
26796
|
+
times.encodeMs += performance.now() - t1;
|
|
26797
|
+
times.frames += 1;
|
|
26798
|
+
}
|
|
26678
26799
|
},
|
|
26679
26800
|
// Bytes or a reason, never an empty array: a 0-byte file stored as a
|
|
26680
26801
|
// successful output is a Download button that does nothing, and the
|
|
@@ -26687,7 +26808,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
26687
26808
|
}
|
|
26688
26809
|
started ??= output2.start();
|
|
26689
26810
|
await started;
|
|
26811
|
+
const t = performance.now();
|
|
26690
26812
|
await output2.finalize();
|
|
26813
|
+
const times = sinkTimes();
|
|
26814
|
+
if (times !== void 0)
|
|
26815
|
+
times.finishMs += performance.now() - t;
|
|
26691
26816
|
const buffer = output2.target.buffer;
|
|
26692
26817
|
if (!buffer) {
|
|
26693
26818
|
throw new Error(`mp4 muxer produced no bytes after ${frames} frame${frames === 1 ? "" : "s"}`);
|