demoman 0.8.0 → 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.
Files changed (75) hide show
  1. package/THIRD_PARTY_NOTICES +1 -1
  2. package/dist/demoman.mjs +19646 -13607
  3. package/dist/page/decode-probe-entry.js +23071 -0
  4. package/dist/page/executor-entry.js +102 -17
  5. package/dist/page/mux-entry.js +351 -107
  6. package/dist/page/render-entry.js +1931 -1147
  7. package/dist/recipe.md +248 -292
  8. package/dist/skills/record-demo/SKILL.md +5 -4
  9. package/dist/studio/assets/confirm-dialog-BGEp6bKH.css +1 -0
  10. package/dist/studio/assets/confirm-dialog-F4BR4FU0.js +72 -0
  11. package/dist/studio/assets/editor-63atCcDn.js +4 -0
  12. package/dist/studio/assets/{editor-inline-7e387eed.css → editor-inline-d74caea2.css} +10 -0
  13. package/dist/studio/assets/library-L3IU8F5q.js +1 -0
  14. package/dist/studio/assets/library-inline-3627d15c.css +1426 -0
  15. package/dist/studio/assets/settings-g3t2C3Eo.js +1 -0
  16. package/dist/studio/assets/{settings-inline-ff6d2eee.css → settings-inline-2f59fbb0.css} +12 -0
  17. package/dist/studio/assets/state-eyG4SxVq.js +1 -0
  18. package/dist/studio/assets/topbar-CgsXzkpk.js +1 -0
  19. package/dist/studio/assets/view-DzaxHB2c.js +1 -0
  20. package/dist/studio/editor.html +11 -10
  21. package/dist/studio/library.html +9 -8
  22. package/dist/studio/settings.html +8 -7
  23. package/dist/studio/studio-build.json +3 -3
  24. package/dist/studio/wallpapers/dark-1-landscape.webp +0 -0
  25. package/dist/studio/wallpapers/dark-1-portrait.webp +0 -0
  26. package/dist/studio/wallpapers/dark-1-thumb.webp +0 -0
  27. package/dist/studio/wallpapers/dark-2-landscape.webp +0 -0
  28. package/dist/studio/wallpapers/dark-2-portrait.webp +0 -0
  29. package/dist/studio/wallpapers/dark-2-thumb.webp +0 -0
  30. package/dist/studio/wallpapers/light-1-landscape.webp +0 -0
  31. package/dist/studio/wallpapers/light-1-portrait.webp +0 -0
  32. package/dist/studio/wallpapers/light-1-thumb.webp +0 -0
  33. package/dist/studio/wallpapers/light-2-landscape.webp +0 -0
  34. package/dist/studio/wallpapers/light-2-portrait.webp +0 -0
  35. package/dist/studio/wallpapers/light-2-thumb.webp +0 -0
  36. package/dist/studio/wallpapers/muted-1-landscape.webp +0 -0
  37. package/dist/studio/wallpapers/muted-1-portrait.webp +0 -0
  38. package/dist/studio/wallpapers/muted-1-thumb.webp +0 -0
  39. package/dist/studio/wallpapers/muted-2-landscape.webp +0 -0
  40. package/dist/studio/wallpapers/muted-2-portrait.webp +0 -0
  41. package/dist/studio/wallpapers/muted-2-thumb.webp +0 -0
  42. package/dist/studio/wallpapers/muted-3-landscape.webp +0 -0
  43. package/dist/studio/wallpapers/muted-3-portrait.webp +0 -0
  44. package/dist/studio/wallpapers/muted-3-thumb.webp +0 -0
  45. package/dist/studio/wallpapers/muted-4-landscape.webp +0 -0
  46. package/dist/studio/wallpapers/muted-4-portrait.webp +0 -0
  47. package/dist/studio/wallpapers/muted-4-thumb.webp +0 -0
  48. package/dist/studio/wallpapers/vivid-1-landscape.webp +0 -0
  49. package/dist/studio/wallpapers/vivid-1-portrait.webp +0 -0
  50. package/dist/studio/wallpapers/vivid-1-thumb.webp +0 -0
  51. package/dist/studio/wallpapers/vivid-2-landscape.webp +0 -0
  52. package/dist/studio/wallpapers/vivid-2-portrait.webp +0 -0
  53. package/dist/studio/wallpapers/vivid-2-thumb.webp +0 -0
  54. package/dist/studio/wallpapers/vivid-3-landscape.webp +0 -0
  55. package/dist/studio/wallpapers/vivid-3-portrait.webp +0 -0
  56. package/dist/studio/wallpapers/vivid-3-thumb.webp +0 -0
  57. package/dist/studio/wallpapers/vivid-4-landscape.webp +0 -0
  58. package/dist/studio/wallpapers/vivid-4-portrait.webp +0 -0
  59. package/dist/studio/wallpapers/vivid-4-thumb.webp +0 -0
  60. package/dist/studio/wallpapers/vivid-5-landscape.webp +0 -0
  61. package/dist/studio/wallpapers/vivid-5-portrait.webp +0 -0
  62. package/dist/studio/wallpapers/vivid-5-thumb.webp +0 -0
  63. package/dist/studio/wallpapers/vivid-6-landscape.webp +0 -0
  64. package/dist/studio/wallpapers/vivid-6-portrait.webp +0 -0
  65. package/dist/studio/wallpapers/vivid-6-thumb.webp +0 -0
  66. package/package.json +1 -1
  67. package/dist/studio/assets/confirm-dialog-Bcrw3f1a.js +0 -72
  68. package/dist/studio/assets/confirm-dialog-DSKBZQdV.css +0 -1
  69. package/dist/studio/assets/editor-DUZKtJ2T.js +0 -4
  70. package/dist/studio/assets/library-BPokDo6m.js +0 -1
  71. package/dist/studio/assets/library-inline-216fd6fd.css +0 -659
  72. package/dist/studio/assets/settings-RZj4oUzT.js +0 -1
  73. package/dist/studio/assets/state-tew-ACWl.js +0 -1
  74. package/dist/studio/assets/topbar-sSUyITjl.js +0 -1
  75. package/dist/studio/assets/view-SxAupNyx.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 || `${computeName(el) ?? ""} ${text ?? ""}`.toLowerCase().includes(wanted);
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 { anchor } = await captureAnchor(
1787
- el,
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).