deictic 0.8.1 → 0.10.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.
Files changed (128) hide show
  1. package/API.md +81 -17
  2. package/README.md +1 -1
  3. package/dist/annotations/client.js +1 -1
  4. package/dist/bun.d.ts.map +1 -1
  5. package/dist/bun.js +26 -8
  6. package/dist/bun.js.map +1 -1
  7. package/dist/cli.js +1 -1
  8. package/dist/cli.js.map +1 -1
  9. package/dist/client/index.d.ts +13 -13
  10. package/dist/client/index.d.ts.map +1 -1
  11. package/dist/client/index.js +19 -7
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/next.d.ts.map +1 -1
  14. package/dist/next.js +45 -25
  15. package/dist/next.js.map +1 -1
  16. package/dist/react/client.d.ts +19 -0
  17. package/dist/react/client.d.ts.map +1 -0
  18. package/dist/react/client.js +504 -0
  19. package/dist/react/client.js.map +1 -0
  20. package/dist/react/index.d.ts +2 -0
  21. package/dist/react/index.js +1 -0
  22. package/dist/recommended/index.d.ts +15 -7
  23. package/dist/recommended/index.d.ts.map +1 -1
  24. package/dist/recommended/index.js +1 -1
  25. package/dist/recordings/client.d.ts.map +1 -1
  26. package/dist/recordings/client.js +48 -5
  27. package/dist/recordings/client.js.map +1 -1
  28. package/dist/screenshots/client.d.ts +9 -1
  29. package/dist/screenshots/client.d.ts.map +1 -1
  30. package/dist/screenshots/rrweb.d.ts +0 -6
  31. package/dist/screenshots/rrweb.d.ts.map +1 -1
  32. package/dist/screenshots/rrweb.js +46 -12
  33. package/dist/screenshots/rrweb.js.map +1 -1
  34. package/dist/shared/board.js +1 -1
  35. package/dist/shared/client.js +44 -2
  36. package/dist/shared/client.js.map +1 -1
  37. package/dist/shared/dom.js +7 -1
  38. package/dist/shared/dom.js.map +1 -1
  39. package/dist/shared/drawer.js +1 -1
  40. package/dist/shared/endpoints.js +15 -4
  41. package/dist/shared/endpoints.js.map +1 -1
  42. package/dist/shared/index.d.ts +11 -0
  43. package/dist/shared/index.d.ts.map +1 -1
  44. package/dist/shared/index10.d.ts +70 -0
  45. package/dist/shared/index10.d.ts.map +1 -0
  46. package/dist/shared/index3.d.ts +11 -0
  47. package/dist/shared/index3.d.ts.map +1 -1
  48. package/dist/shared/index7.d.ts +92 -312
  49. package/dist/shared/index7.d.ts.map +1 -1
  50. package/dist/shared/index8.d.ts +324 -47
  51. package/dist/shared/index8.d.ts.map +1 -1
  52. package/dist/shared/index9.d.ts +45 -63
  53. package/dist/shared/index9.d.ts.map +1 -1
  54. package/dist/shared/init.js +15 -11
  55. package/dist/shared/init.js.map +1 -1
  56. package/dist/shared/integration.d.ts +6 -0
  57. package/dist/shared/integration.d.ts.map +1 -1
  58. package/dist/shared/integration.js +28 -1
  59. package/dist/shared/integration.js.map +1 -1
  60. package/dist/shared/marks.js +7 -1
  61. package/dist/shared/marks.js.map +1 -1
  62. package/dist/shared/package.js +3 -1
  63. package/dist/shared/packages.js +1 -1
  64. package/dist/shared/playwright.js +39 -1
  65. package/dist/shared/playwright.js.map +1 -1
  66. package/dist/shared/react.js +25 -0
  67. package/dist/shared/react.js.map +1 -0
  68. package/dist/shared/recommended.js +6 -3
  69. package/dist/shared/recommended.js.map +1 -1
  70. package/dist/shared/recording.js +80 -3
  71. package/dist/shared/recording.js.map +1 -1
  72. package/dist/shared/recordings.js +30 -2
  73. package/dist/shared/recordings.js.map +1 -1
  74. package/dist/shared/screenshots.js.map +1 -1
  75. package/dist/shared/src.js.map +1 -1
  76. package/dist/shared/task.js +1 -0
  77. package/dist/shared/task.js.map +1 -1
  78. package/dist/shared/tasks.js +11 -0
  79. package/dist/shared/tasks.js.map +1 -1
  80. package/dist/shared/vite.d.ts +1 -1
  81. package/dist/shared/vite.d.ts.map +1 -1
  82. package/dist/shared/vite.js +28 -10
  83. package/dist/shared/vite.js.map +1 -1
  84. package/dist/tailwind/client.d.ts +1 -1
  85. package/dist/tailwind/index.d.ts +1 -1
  86. package/dist/tasks/client.d.ts +1 -1
  87. package/dist/tasks/client.js +45 -19
  88. package/dist/tasks/client.js.map +1 -1
  89. package/dist/tasks/index.d.ts +1 -1
  90. package/dist/voice/client.d.ts +1 -1
  91. package/dist/voice/client.js +1 -1
  92. package/dist/voice/index.d.ts +1 -1
  93. package/dist/webpack.d.ts +4 -0
  94. package/dist/webpack.d.ts.map +1 -1
  95. package/dist/webpack.js +37 -15
  96. package/dist/webpack.js.map +1 -1
  97. package/package.json +25 -1
  98. package/src/bun.ts +32 -8
  99. package/src/cli/bun.ts +2 -2
  100. package/src/cli/init.ts +14 -9
  101. package/src/cli/recording.ts +90 -4
  102. package/src/cli/task.ts +4 -0
  103. package/src/cli.ts +13 -6
  104. package/src/client/dom.ts +14 -0
  105. package/src/client/index.ts +25 -14
  106. package/src/index.ts +11 -0
  107. package/src/next.ts +34 -15
  108. package/src/plugins/react/client.ts +162 -0
  109. package/src/plugins/react/index.ts +130 -0
  110. package/src/plugins/react/renders.ts +219 -0
  111. package/src/plugins/react/serialize.ts +139 -0
  112. package/src/plugins/react/timeline.ts +143 -0
  113. package/src/plugins/recommended/index.ts +17 -5
  114. package/src/plugins/recordings/client.ts +64 -4
  115. package/src/plugins/recordings/marks.ts +7 -0
  116. package/src/plugins/recordings/replay.ts +30 -2
  117. package/src/plugins/screenshots/client.ts +42 -2
  118. package/src/plugins/screenshots/index.ts +11 -0
  119. package/src/plugins/screenshots/playwright.ts +65 -1
  120. package/src/plugins/screenshots/rrweb.ts +55 -28
  121. package/src/plugins/screenshots/states.ts +26 -0
  122. package/src/plugins/tasks/client.ts +41 -6
  123. package/src/plugins/tasks/composer.ts +24 -7
  124. package/src/plugins/tasks/index.ts +16 -2
  125. package/src/tools/integration.ts +33 -0
  126. package/src/tools/source.ts +14 -2
  127. package/src/vite.ts +31 -10
  128. package/src/webpack.ts +48 -16
@@ -1,5 +1,5 @@
1
1
  import { a as tell, i as ownerOf, n as fiberOf, r as named, t as componentOf } from "../shared/component.js";
2
- import { c as sameAs, i as div, l as targetOf, o as place, s as reduced, t as ATTRIBUTE, u as toolButton } from "../shared/dom.js";
2
+ import { c as place, d as targetOf, f as toolButton, l as reduced, o as div, t as ATTRIBUTE, u as sameAs } from "../shared/dom.js";
3
3
  import { n as defineClientPlugin } from "../shared/src.js";
4
4
  import { n as liveWaveform } from "../shared/waveform.js";
5
5
  // src/plugins/tasks/composer.ts
@@ -197,7 +197,12 @@ function composerIn(context, options) {
197
197
  rows: 1
198
198
  });
199
199
  const chipsEl = element("div", { className: "chips" });
200
- const camera = toolButton(CAMERA, `Attach a screenshot, taken as it's sent`, void 0, () => {
200
+ /** A shot of `of`: as the press froze it, where it's the popup's own element still first, else as the page is now. */
201
+ const shotOf = (s, of) => {
202
+ const frozen = about[0]?.own === true && onPage(about[0]) === of ? options.frozen : void 0;
203
+ return frozen === void 0 ? s.capture(of) : frozen.catch(() => s.capture(of));
204
+ };
205
+ const camera = toolButton(CAMERA, options.frozen === void 0 ? `Attach a screenshot, taken as it's sent` : "Attach a screenshot of the page as it was when you pressed", void 0, () => {
201
206
  wanted = !shooting();
202
207
  showChips();
203
208
  });
@@ -449,7 +454,7 @@ function composerIn(context, options) {
449
454
  problem.textContent = "";
450
455
  try {
451
456
  if (old === void 0) doing.textContent = "Capturing…";
452
- const shot = old?.drawn?.shot ?? await shots.capture(onPage(about[0]) ?? document.documentElement);
457
+ const shot = old?.drawn?.shot ?? await shotOf(shots, onPage(about[0]) ?? document.documentElement);
453
458
  doing.textContent = "";
454
459
  const picture = {
455
460
  url: shot.url,
@@ -603,7 +608,7 @@ function composerIn(context, options) {
603
608
  doing.textContent = "Capturing…";
604
609
  const first = onPage(about[0]);
605
610
  const of = first ?? document.documentElement;
606
- const now = await shots.capture(of);
611
+ const now = await shotOf(shots, of);
607
612
  const where = first === void 0 ? {} : { box: now.box };
608
613
  const live = of.getBoundingClientRect();
609
614
  const boxes = about.flatMap((a) => {
@@ -1837,6 +1842,7 @@ var client_default = defineClientPlugin({
1837
1842
  const over = panel.getRootNode() === context.root;
1838
1843
  const unpin = over ? pinsIn(context).glance() : void 0;
1839
1844
  const shots = context.use("screenshots");
1845
+ const frozen = shots?.frozen(context.element);
1840
1846
  const recorder = context.use("recordings");
1841
1847
  const back = context.resumed;
1842
1848
  const sendsHtml = context.options?.html !== false;
@@ -1845,6 +1851,18 @@ var client_default = defineClientPlugin({
1845
1851
  own: true,
1846
1852
  el: context.element
1847
1853
  }];
1854
+ const inspector = context.use("react");
1855
+ /**
1856
+ * What React's DevTools would show of an element, where the react plugin is loaded: read now, while the page has
1857
+ * it, or as the panel left it. A read that fails leaves it out, not the task.
1858
+ */
1859
+ const reactOf = async (a) => {
1860
+ const el = onPage(a);
1861
+ if (el === void 0) return a.seen?.react;
1862
+ return inspector?.snapshot(el).catch((e) => {
1863
+ console.warn("deictic: the task goes without react.json", e);
1864
+ });
1865
+ };
1848
1866
  /**
1849
1867
  * What the page says of an element: read now, while the page has it, and as the panel left it where the page
1850
1868
  * has moved on without it (a recording that went on to another), which is the page the task is about.
@@ -1899,18 +1917,19 @@ var client_default = defineClientPlugin({
1899
1917
  ...shot === void 0 ? {} : { shot },
1900
1918
  html,
1901
1919
  ...wherever(about),
1902
- about: about.flatMap(({ target, own: mine, ...a }) => {
1903
- const seen = seenOf({
1904
- target,
1905
- own: mine,
1906
- ...a
1907
- });
1908
- return seen === void 0 ? [] : [{
1909
- target,
1910
- own: mine,
1911
- seen
1920
+ about: (await Promise.all(about.map(async (a) => {
1921
+ const seen = seenOf(a);
1922
+ if (seen === void 0) return [];
1923
+ const react = sendsHtml && html ? await reactOf(a) : void 0;
1924
+ return [{
1925
+ target: a.target,
1926
+ own: a.own,
1927
+ seen: {
1928
+ ...seen,
1929
+ ...react === void 0 ? {} : { react }
1930
+ }
1912
1931
  }];
1913
- })
1932
+ }))).flat()
1914
1933
  };
1915
1934
  context.away(kept, () => recorder.record());
1916
1935
  };
@@ -1921,6 +1940,7 @@ var client_default = defineClientPlugin({
1921
1940
  html: sendsHtml,
1922
1941
  ...context.at === void 0 ? {} : { at: context.at },
1923
1942
  shoot: true,
1943
+ ...frozen === void 0 ? {} : { frozen },
1924
1944
  here: context.element.isConnected,
1925
1945
  over,
1926
1946
  record: () => void leave(),
@@ -1928,22 +1948,28 @@ var client_default = defineClientPlugin({
1928
1948
  submit: async (gathered) => {
1929
1949
  const { text, about, html: withHtml, screenshots } = gathered;
1930
1950
  const [first, ...rest] = about;
1931
- const { html, ...said } = (first === void 0 ? void 0 : seenOf(first)) ?? {
1951
+ const { html, react: _, ...said } = (first === void 0 ? void 0 : seenOf(first)) ?? {
1932
1952
  html: void 0,
1933
1953
  count: 0
1934
1954
  };
1935
1955
  const htmlOf = (of) => sendsHtml && withHtml && of !== void 0 ? { html: of } : {};
1956
+ const reactWith = async (a) => {
1957
+ const react = sendsHtml && withHtml ? await reactOf(a) : void 0;
1958
+ return react === void 0 ? {} : { react };
1959
+ };
1936
1960
  const op = {
1937
1961
  text,
1938
1962
  ...wherever(about),
1939
1963
  ...said,
1940
1964
  ...first === void 0 ? { detached: true } : {},
1941
1965
  ...htmlOf(html),
1942
- ...rest.length === 0 ? {} : { also: rest.map((a) => ({
1966
+ ...first === void 0 ? {} : await reactWith(first),
1967
+ ...rest.length === 0 ? {} : { also: await Promise.all(rest.map(async (a) => ({
1943
1968
  at: atOf(a.target),
1944
1969
  tag: a.target.tag,
1945
- ...htmlOf(seenOf(a)?.html)
1946
- })) },
1970
+ ...htmlOf(seenOf(a)?.html),
1971
+ ...await reactWith(a)
1972
+ }))) },
1947
1973
  ...attachedOf(gathered)
1948
1974
  };
1949
1975
  const on = first?.target ?? context.target;