effect-browser 0.3.0-beta.23 → 0.3.0-beta.25

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 (348) hide show
  1. package/README.md +437 -142
  2. package/dist/Action.d.mts +1 -1
  3. package/dist/Action.mjs +61 -9
  4. package/dist/Action.mjs.map +1 -1
  5. package/dist/Browser.d.mts +2 -2
  6. package/dist/Browser.mjs +2 -2
  7. package/dist/BrowserError.d.mts +2 -2
  8. package/dist/BrowserError.mjs +194 -41
  9. package/dist/BrowserError.mjs.map +1 -1
  10. package/dist/BrowserEvent.d.mts +2 -2
  11. package/dist/BrowserEvent.mjs +185 -35
  12. package/dist/BrowserEvent.mjs.map +1 -1
  13. package/dist/Cdp.d.mts +15 -0
  14. package/dist/Cdp.mjs +22 -0
  15. package/dist/Cdp.mjs.map +1 -0
  16. package/dist/Change.d.mts +2 -2
  17. package/dist/Change.mjs +40 -7
  18. package/dist/Change.mjs.map +1 -1
  19. package/dist/Frame.d.mts +2 -2
  20. package/dist/Frame.mjs +132 -14
  21. package/dist/Frame.mjs.map +1 -1
  22. package/dist/InputStyle.d.mts +153 -0
  23. package/dist/InputStyle.mjs +2 -0
  24. package/dist/Layout.d.mts +2 -0
  25. package/dist/Layout.mjs +123 -0
  26. package/dist/Layout.mjs.map +1 -0
  27. package/dist/Overlay.d.mts +2 -0
  28. package/dist/Overlay.mjs +58 -0
  29. package/dist/Overlay.mjs.map +1 -0
  30. package/dist/Page.d.mts +2 -2
  31. package/dist/Page.mjs +2 -2
  32. package/dist/PageTime.d.mts +2 -0
  33. package/dist/PageTime.mjs +17 -0
  34. package/dist/PageTime.mjs.map +1 -0
  35. package/dist/Pose.d.mts +2 -0
  36. package/dist/Pose.mjs +65 -0
  37. package/dist/Pose.mjs.map +1 -0
  38. package/dist/Site.d.mts +984 -0
  39. package/dist/Site.mjs +110 -0
  40. package/dist/Site.mjs.map +1 -0
  41. package/dist/Snapshot.d.mts +2 -2
  42. package/dist/Snapshot.mjs +87 -6
  43. package/dist/Snapshot.mjs.map +1 -1
  44. package/dist/Text.d.mts +2 -0
  45. package/dist/Text.mjs +45 -0
  46. package/dist/Text.mjs.map +1 -0
  47. package/dist/Window.d.mts +2 -2
  48. package/dist/Window.mjs +31 -6
  49. package/dist/Window.mjs.map +1 -1
  50. package/dist/ai/BrowserTools.d.mts +4987 -0
  51. package/dist/ai/BrowserTools.mjs +3 -0
  52. package/dist/ai/PageControl.d.mts +286 -0
  53. package/dist/ai/PageControl.mjs +426 -0
  54. package/dist/ai/PageControl.mjs.map +1 -0
  55. package/dist/ai/PromptCache.d.mts +16 -0
  56. package/dist/ai/PromptCache.mjs +72 -0
  57. package/dist/ai/PromptCache.mjs.map +1 -0
  58. package/dist/ai/Tabs.d.mts +2 -0
  59. package/dist/ai/Tabs.mjs +72 -0
  60. package/dist/ai/Tabs.mjs.map +1 -0
  61. package/dist/ai/ToolError.d.mts +34 -0
  62. package/dist/ai/ToolError.mjs +2 -0
  63. package/dist/ai/index.d.mts +6 -0
  64. package/dist/ai/index.mjs +6 -0
  65. package/dist/index.d.mts +7 -15
  66. package/dist/index.mjs +9 -8
  67. package/dist/{Action-24sLOubi.d.mts → internal/Action-CkanNTUw.d.mts} +64 -4
  68. package/dist/{Browser-wZhwZSlG.d.mts → internal/Browser-DD9Vm1c-.d.mts} +80 -10
  69. package/dist/{Browser-BKPAbyys.mjs → internal/Browser-vzD7i2oj.mjs} +658 -495
  70. package/dist/internal/Browser-vzD7i2oj.mjs.map +1 -0
  71. package/dist/{BrowserError-BlcmLVzn.d.mts → internal/BrowserError-CsuRYcDX.d.mts} +187 -28
  72. package/dist/{BrowserEvent-lLqJ3GJS.d.mts → internal/BrowserEvent-tGPYYf6R.d.mts} +197 -18
  73. package/dist/internal/BrowserTools-Yi3lOX4h.mjs +497 -0
  74. package/dist/internal/BrowserTools-Yi3lOX4h.mjs.map +1 -0
  75. package/dist/{Style-AO4V7Czt.mjs → internal/InputStyle-CPzxoN4g.mjs} +94 -16
  76. package/dist/internal/InputStyle-CPzxoN4g.mjs.map +1 -0
  77. package/dist/{moment/Moment.mjs → internal/Moment-CstaX1mR.mjs} +49 -16
  78. package/dist/internal/Moment-CstaX1mR.mjs.map +1 -0
  79. package/dist/{moment/Moment.d.mts → internal/Moment-DOcldBdf.d.mts} +54 -21
  80. package/dist/internal/Page-BfGxn7oN.d.mts +1553 -0
  81. package/dist/{Page-BF5izr8R.mjs → internal/Page-DqF-tuTx.mjs} +62 -72
  82. package/dist/internal/Page-DqF-tuTx.mjs.map +1 -0
  83. package/dist/internal/Release-CFONkPDP.d.mts +39 -0
  84. package/dist/internal/Stage-D5ymSXDT.mjs +298 -0
  85. package/dist/internal/Stage-D5ymSXDT.mjs.map +1 -0
  86. package/dist/internal/Stillness-DCPeAN1a.mjs +1124 -0
  87. package/dist/internal/Stillness-DCPeAN1a.mjs.map +1 -0
  88. package/dist/internal/Supervisor-BcY_QNIY.d.mts +108 -0
  89. package/dist/internal/Supervisor-BcglY23c.mjs +531 -0
  90. package/dist/internal/Supervisor-BcglY23c.mjs.map +1 -0
  91. package/dist/internal/Tabs-dXMscIUQ.d.mts +52 -0
  92. package/dist/internal/TestPage-CYiYbh63.d.mts +159 -0
  93. package/dist/internal/ToolError-DArsRS2m.mjs +117 -0
  94. package/dist/internal/ToolError-DArsRS2m.mjs.map +1 -0
  95. package/dist/{plan/index.d.mts → internal/Walk-BNXcfZ2z.d.mts} +59 -35
  96. package/dist/{plan/index.mjs → internal/Walk-C5ky7uSf.mjs} +83 -51
  97. package/dist/internal/Walk-C5ky7uSf.mjs.map +1 -0
  98. package/dist/{ActionPort.mjs → internal/action-port-B5EkeGOR.mjs} +6 -12
  99. package/dist/internal/action-port-B5EkeGOR.mjs.map +1 -0
  100. package/dist/internal/cdp/workerd.d.mts +13 -0
  101. package/dist/internal/cdp/workerd.mjs +19 -0
  102. package/dist/internal/cdp/workerd.mjs.map +1 -0
  103. package/dist/{Clock.mjs → internal/clock-BKSAEf00.mjs} +13 -13
  104. package/dist/internal/clock-BKSAEf00.mjs.map +1 -0
  105. package/dist/{connection-2KHI4_KN.d.mts → internal/connection-BaB0vp1o.d.mts} +6 -6
  106. package/dist/{connection-CK83pvqP.mjs → internal/connection-C2X4GmXM.mjs} +19 -15
  107. package/dist/internal/connection-C2X4GmXM.mjs.map +1 -0
  108. package/dist/internal/events-DzCrww-y.mjs +72 -0
  109. package/dist/internal/events-DzCrww-y.mjs.map +1 -0
  110. package/dist/internal/fold.inpage-CyVZQHZL.d.mts +49 -0
  111. package/dist/internal/fold.inpage-uhrT-dOB.mjs +49 -0
  112. package/dist/internal/fold.inpage-uhrT-dOB.mjs.map +1 -0
  113. package/dist/internal/functions-jBOs6GKv.mjs +27 -0
  114. package/dist/internal/functions-jBOs6GKv.mjs.map +1 -0
  115. package/dist/{Geometry-DJx9qrYy.d.mts → internal/geometry-Dhj_ztJs.d.mts} +3 -3
  116. package/dist/{Geometry.mjs → internal/geometry-Lxyflb9J.mjs} +3 -12
  117. package/dist/internal/geometry-Lxyflb9J.mjs.map +1 -0
  118. package/dist/{Matching.mjs → internal/matching-Cs-UeOY0.mjs} +24 -19
  119. package/dist/internal/matching-Cs-UeOY0.mjs.map +1 -0
  120. package/dist/internal/page-DFQb-YOK.mjs +436 -0
  121. package/dist/internal/page-DFQb-YOK.mjs.map +1 -0
  122. package/dist/internal/pose.inpage-CBFeWcVa.mjs +1996 -0
  123. package/dist/internal/pose.inpage-CBFeWcVa.mjs.map +1 -0
  124. package/dist/{Url.mjs → internal/url-DB0pQYk6.mjs} +3 -12
  125. package/dist/internal/url-DB0pQYk6.mjs.map +1 -0
  126. package/dist/policy/Policy.d.mts +60 -6
  127. package/dist/policy/Policy.mjs +52 -9
  128. package/dist/policy/Policy.mjs.map +1 -1
  129. package/dist/policy/index.d.mts +2 -0
  130. package/dist/policy/index.mjs +2 -0
  131. package/dist/presentation/Film.d.mts +332 -0
  132. package/dist/presentation/Film.mjs +298 -0
  133. package/dist/presentation/Film.mjs.map +1 -0
  134. package/dist/presentation/Motion.d.mts +5 -1
  135. package/dist/presentation/Motion.mjs +16 -2
  136. package/dist/presentation/Motion.mjs.map +1 -1
  137. package/dist/presentation/Presentation.d.mts +48 -6
  138. package/dist/presentation/Presentation.mjs +28 -9
  139. package/dist/presentation/Presentation.mjs.map +1 -1
  140. package/dist/presentation/Stage.d.mts +40 -6
  141. package/dist/presentation/Stage.mjs +1 -262
  142. package/dist/presentation/index.d.mts +5 -0
  143. package/dist/presentation/index.mjs +5 -0
  144. package/dist/supervisor/Release.d.mts +2 -0
  145. package/dist/supervisor/Release.mjs +40 -0
  146. package/dist/supervisor/Release.mjs.map +1 -0
  147. package/dist/supervisor/Supervisor.d.mts +2 -104
  148. package/dist/supervisor/Supervisor.mjs +2 -515
  149. package/dist/supervisor/index.d.mts +3 -0
  150. package/dist/supervisor/index.mjs +3 -0
  151. package/dist/testing/HttpCassette.d.mts +98 -0
  152. package/dist/testing/HttpCassette.mjs +146 -0
  153. package/dist/testing/HttpCassette.mjs.map +1 -0
  154. package/dist/testing/Story.d.mts +31 -0
  155. package/dist/testing/Story.mjs +76 -0
  156. package/dist/testing/Story.mjs.map +1 -0
  157. package/dist/testing/TestBrowser.d.mts +191 -0
  158. package/dist/testing/TestBrowser.mjs +105 -0
  159. package/dist/testing/TestBrowser.mjs.map +1 -0
  160. package/dist/testing/TestModel.d.mts +133 -0
  161. package/dist/testing/TestModel.mjs +209 -0
  162. package/dist/testing/TestModel.mjs.map +1 -0
  163. package/dist/testing/TestPage.d.mts +2 -0
  164. package/dist/testing/TestPage.mjs +47 -0
  165. package/dist/testing/TestPage.mjs.map +1 -0
  166. package/dist/testing/index.d.mts +6 -337
  167. package/dist/testing/index.mjs +6 -515
  168. package/dist/timeline/Moment.d.mts +3 -0
  169. package/dist/timeline/Moment.mjs +3 -0
  170. package/dist/timeline/Stillness.d.mts +34 -0
  171. package/dist/timeline/Stillness.mjs +2 -0
  172. package/dist/timeline/index.d.mts +3 -0
  173. package/dist/timeline/index.mjs +3 -0
  174. package/dist/walk/Walk.d.mts +2 -0
  175. package/dist/walk/Walk.mjs +2 -0
  176. package/dist/walk/index.d.mts +2 -0
  177. package/dist/walk/index.mjs +2 -0
  178. package/package.json +54 -133
  179. package/src/Action.ts +73 -8
  180. package/src/Browser.ts +85 -14
  181. package/src/BrowserError.ts +258 -63
  182. package/src/BrowserEvent.ts +264 -48
  183. package/src/Cdp.ts +42 -0
  184. package/src/Change.ts +75 -4
  185. package/src/Frame.ts +247 -14
  186. package/src/{Style.ts → InputStyle.ts} +130 -18
  187. package/src/Layout.ts +187 -0
  188. package/src/Overlay.ts +76 -0
  189. package/src/Page.ts +144 -275
  190. package/src/PageTime.ts +72 -0
  191. package/src/Pose.ts +81 -0
  192. package/src/Site.ts +136 -0
  193. package/src/Snapshot.ts +179 -3
  194. package/src/Text.ts +60 -0
  195. package/src/Window.ts +53 -3
  196. package/src/ai/BrowserTools.ts +778 -0
  197. package/src/ai/PageControl.ts +702 -0
  198. package/src/ai/PromptCache.ts +87 -0
  199. package/src/ai/Tabs.ts +84 -0
  200. package/src/ai/ToolError.ts +50 -0
  201. package/src/ai/index.ts +36 -0
  202. package/src/ai/internal/crops.ts +38 -0
  203. package/src/ai/internal/points.ts +57 -0
  204. package/src/ai/internal/receipts.ts +107 -0
  205. package/src/index.ts +87 -6
  206. package/src/{ActionPort.ts → internal/action-port.ts} +3 -3
  207. package/src/{providers → internal/cdp}/connection.ts +19 -12
  208. package/src/internal/cdp/workerd.ts +36 -0
  209. package/src/{Clock.ts → internal/clock.ts} +20 -0
  210. package/src/internal/input/actions.ts +1 -1
  211. package/src/internal/input/dispatch.ts +2 -2
  212. package/src/internal/input/guard.inpage.ts +1 -1
  213. package/src/internal/input/guard.ts +1 -1
  214. package/src/internal/input/perform.ts +35 -7
  215. package/src/internal/input/pointer.ts +9 -6
  216. package/src/internal/input/targets.inpage.ts +3 -3
  217. package/src/internal/input/targets.ts +1 -1
  218. package/src/{Matching.ts → internal/matching.ts} +28 -19
  219. package/src/internal/page/bridge.ts +67 -35
  220. package/src/internal/page/clock.inpage.ts +306 -0
  221. package/src/internal/page/compose.inpage.ts +101 -0
  222. package/src/internal/page/context.ts +4 -2
  223. package/src/internal/page/functions.ts +84 -0
  224. package/src/internal/page/navigation.ts +1 -1
  225. package/src/internal/page/openings.ts +2 -2
  226. package/src/internal/page/overlay.inpage.ts +96 -0
  227. package/src/internal/page/overlay.ts +89 -0
  228. package/src/internal/page/page.ts +39 -29
  229. package/src/internal/page/port.ts +14 -8
  230. package/src/internal/page/pose.inpage.ts +200 -0
  231. package/src/internal/page/pose.ts +80 -0
  232. package/src/internal/page/replies.ts +1 -1
  233. package/src/internal/page/requests.ts +1 -1
  234. package/src/internal/page/scripts.ts +1 -1
  235. package/src/internal/page/time.inpage.ts +49 -0
  236. package/src/internal/page/time.ts +122 -0
  237. package/src/internal/page/viewport.ts +3 -2
  238. package/src/internal/pictures/capture.ts +1 -4
  239. package/src/internal/pictures/dimensions.ts +1 -1
  240. package/src/internal/pictures/frame.ts +1 -1
  241. package/src/internal/pictures/pictures.ts +144 -91
  242. package/src/internal/reading/context.inpage.ts +2 -2
  243. package/src/internal/reading/expect.inpage.ts +1 -1
  244. package/src/internal/reading/layout.inpage.ts +193 -0
  245. package/src/internal/reading/layout.ts +101 -0
  246. package/src/internal/reading/names.inpage.ts +15 -0
  247. package/src/internal/reading/outline.inpage.ts +5 -21
  248. package/src/internal/reading/reading.ts +33 -21
  249. package/src/internal/reading/ready.inpage.ts +21 -26
  250. package/src/internal/reading/ready.ts +26 -5
  251. package/src/internal/reading/subjects.inpage.ts +3 -3
  252. package/src/internal/reading/text.inpage.ts +3 -16
  253. package/src/internal/reading/walk.inpage.ts +1 -1
  254. package/src/internal/timeline/changes.inpage.ts +7 -15
  255. package/src/internal/timeline/changes.ts +17 -5
  256. package/src/internal/timeline/record.inpage.ts +15 -6
  257. package/src/internal/timeline/sight.inpage.ts +2 -2
  258. package/src/internal/timeline/window.ts +3 -4
  259. package/src/policy/Policy.ts +70 -16
  260. package/src/policy/index.ts +12 -0
  261. package/src/presentation/Film.ts +451 -0
  262. package/src/presentation/Motion.ts +45 -3
  263. package/src/presentation/Presentation.ts +60 -14
  264. package/src/presentation/Stage.ts +73 -35
  265. package/src/presentation/index.ts +30 -0
  266. package/src/presentation/{feed.ts → internal/feed.ts} +1 -1
  267. package/src/supervisor/Release.ts +45 -0
  268. package/src/supervisor/Supervisor.ts +80 -5
  269. package/src/supervisor/index.ts +18 -0
  270. package/src/supervisor/{contract.ts → internal/contract.ts} +14 -10
  271. package/src/supervisor/{lifecycle.ts → internal/lifecycle.ts} +7 -7
  272. package/src/supervisor/{runtime.ts → internal/runtime.ts} +7 -7
  273. package/src/testing/HttpCassette.ts +260 -0
  274. package/src/testing/Story.ts +103 -0
  275. package/src/testing/TestBrowser.ts +14 -4
  276. package/src/testing/TestModel.ts +297 -0
  277. package/src/testing/TestPage.ts +92 -4
  278. package/src/testing/index.ts +35 -1
  279. package/src/testing/{evidence.ts → internal/evidence.ts} +19 -11
  280. package/src/testing/{model.ts → internal/model.ts} +14 -8
  281. package/src/testing/{page.ts → internal/page.ts} +55 -51
  282. package/src/{moment → timeline}/Moment.ts +79 -29
  283. package/src/{stillness → timeline}/Stillness.ts +89 -46
  284. package/src/timeline/index.ts +18 -0
  285. package/src/{stillness/Pixels.ts → timeline/internal/pixels.ts} +27 -1
  286. package/src/{moment → timeline/internal}/words.ts +2 -2
  287. package/src/walk/Walk.ts +165 -0
  288. package/src/walk/index.ts +12 -0
  289. package/src/{plan → walk/internal}/choose.ts +23 -14
  290. package/src/{plan → walk/internal}/data.ts +37 -14
  291. package/src/{plan → walk/internal}/execute.ts +79 -36
  292. package/src/{plan → walk/internal}/record.ts +6 -6
  293. package/src/{plan → walk/internal}/targets.ts +35 -25
  294. package/dist/ActionPort.d.mts +0 -15
  295. package/dist/ActionPort.mjs.map +0 -1
  296. package/dist/Browser-BKPAbyys.mjs.map +0 -1
  297. package/dist/Change-Ba7INmay.d.mts +0 -69
  298. package/dist/Clock.d.mts +0 -57
  299. package/dist/Clock.mjs.map +0 -1
  300. package/dist/Frame-UEH2hO5T.d.mts +0 -124
  301. package/dist/Geometry.d.mts +0 -2
  302. package/dist/Geometry.mjs.map +0 -1
  303. package/dist/Matching.d.mts +0 -37
  304. package/dist/Matching.mjs.map +0 -1
  305. package/dist/Page-BF5izr8R.mjs.map +0 -1
  306. package/dist/Page-CvsOEorc.d.mts +0 -566
  307. package/dist/Released-tURbFmal.d.mts +0 -15
  308. package/dist/Snapshot-CtBVOtuu.d.mts +0 -73
  309. package/dist/Stillness-CNlvayIo.mjs +0 -136
  310. package/dist/Stillness-CNlvayIo.mjs.map +0 -1
  311. package/dist/Style-AO4V7Czt.mjs.map +0 -1
  312. package/dist/Style.d.mts +0 -72
  313. package/dist/Style.mjs +0 -2
  314. package/dist/Url.d.mts +0 -26
  315. package/dist/Url.mjs.map +0 -1
  316. package/dist/Window-CMddGMt1.d.mts +0 -34
  317. package/dist/connection-CK83pvqP.mjs.map +0 -1
  318. package/dist/moment/Moment.mjs.map +0 -1
  319. package/dist/plan/index.mjs.map +0 -1
  320. package/dist/presentation/Stage.mjs.map +0 -1
  321. package/dist/presentation/feed.d.mts +0 -20
  322. package/dist/presentation/feed.mjs +0 -18
  323. package/dist/presentation/feed.mjs.map +0 -1
  324. package/dist/providers/Cdp.d.mts +0 -9
  325. package/dist/providers/Cdp.mjs +0 -15
  326. package/dist/providers/Cdp.mjs.map +0 -1
  327. package/dist/providers/Chromium.d.mts +0 -32
  328. package/dist/providers/Chromium.mjs +0 -55
  329. package/dist/providers/Chromium.mjs.map +0 -1
  330. package/dist/providers/Released.d.mts +0 -2
  331. package/dist/providers/Released.mjs +0 -12
  332. package/dist/providers/Released.mjs.map +0 -1
  333. package/dist/stillness/Stillness.d.mts +0 -12
  334. package/dist/stillness/Stillness.mjs +0 -2
  335. package/dist/supervisor/Supervisor.mjs.map +0 -1
  336. package/dist/testing/index.mjs.map +0 -1
  337. package/dist/workerd/Cdp.d.mts +0 -8
  338. package/dist/workerd/Cdp.mjs +0 -13
  339. package/dist/workerd/Cdp.mjs.map +0 -1
  340. package/src/plan/index.ts +0 -36
  341. package/src/providers/Cdp.ts +0 -16
  342. package/src/providers/Chromium.ts +0 -99
  343. package/src/providers/Released.ts +0 -13
  344. package/src/workerd/Cdp.ts +0 -11
  345. /package/dist/{rolldown-runtime-D7D4PA-g.mjs → internal/rolldown-runtime-D7D4PA-g.mjs} +0 -0
  346. /package/src/{Geometry.ts → internal/geometry.ts} +0 -0
  347. /package/src/{Url.ts → internal/url.ts} +0 -0
  348. /package/src/{stillness → timeline/internal}/utilsBundle.d.ts +0 -0
@@ -0,0 +1,451 @@
1
+ /**
2
+ * Filming a page as a function of time: a new screenshot at each time a caller asks for, of the
3
+ * page as it is at that film time, with what the caller draws over it then. Film time comes from
4
+ * a held page (`PageTime.hold`), which steps to each frame however long the last one took, so a
5
+ * frame costs one call to step the page and one screenshot; from a page that seeks itself; or
6
+ * from real time. The frames are pictures; encoding them is the caller's.
7
+ *
8
+ * Loading takes real time, so a film holds its time while the page loads a new document: the
9
+ * first frame that finds one waits for it to be ready, measures its layout, and says so as a
10
+ * `Passage`, which `at` sees from then on. On real time the film's start moves on by the wait.
11
+ *
12
+ * @stability experimental
13
+ * @since 0.3.0
14
+ */
15
+ import { Clock, Duration, Effect, Function, Schema, Stream } from "effect";
16
+
17
+ import { Action } from "../Action.ts";
18
+ import { type BrowserError, refuse } from "../BrowserError.ts";
19
+ import * as Frame from "../Frame.ts";
20
+ import { monotonicMillis } from "../internal/clock.ts";
21
+ import { Point } from "../internal/geometry.ts";
22
+ import * as Layout from "../Layout.ts";
23
+ import type { Content, Overlay } from "../Overlay.ts";
24
+ import { type Page, ResolvedTarget } from "../Page.ts";
25
+ import type { Held, Step } from "../PageTime.ts";
26
+
27
+ /**
28
+ * What a frame shows over the page, and, on held time, where the page is scrolled to then and how
29
+ * its elements are posed, with the page's poses open.
30
+ *
31
+ * @stability experimental
32
+ * @category models
33
+ * @since 0.3.0
34
+ */
35
+ export type At = Step;
36
+
37
+ /**
38
+ * Frames at `fps` from `from` (0 by default) until before `to`, or at these times, in ms.
39
+ *
40
+ * @stability experimental
41
+ * @category models
42
+ * @since 0.3.0
43
+ */
44
+ export type Times =
45
+ | { readonly fps: number; readonly from?: number | undefined; readonly to: number }
46
+ | ReadonlyArray<number>;
47
+
48
+ /**
49
+ * Where film time comes from: a held page, stepped to each frame; a page's own seek, given each
50
+ * frame's time; or real time from the film's start, each frame taken when its time comes.
51
+ *
52
+ * @stability experimental
53
+ * @category models
54
+ * @since 0.3.0
55
+ */
56
+ export type Time =
57
+ | Held
58
+ | { readonly seek: (t: number) => Effect.Effect<void, BrowserError> }
59
+ | "real";
60
+
61
+ /**
62
+ * @stability experimental
63
+ * @category options
64
+ * @since 0.3.0
65
+ */
66
+ export interface Options<E = never> {
67
+ readonly times: Times;
68
+ readonly time: Time;
69
+ /** What the page shows at a film time, each frame's and each input's, from the passages so far. */
70
+ readonly at?:
71
+ | ((t: number, film: { readonly passages: ReadonlyArray<Passage> }) => Effect.Effect<At, E>)
72
+ | undefined;
73
+ /** What to measure in each new document the film arrives in. */
74
+ readonly picks?: Layout.Picks | undefined;
75
+ /**
76
+ * Inputs sent at their film times, in time order, each before the first frame at or after it:
77
+ * the page is moved to its time, and on held time it answers as its time is stepped on. One that
78
+ * fails fails the film.
79
+ */
80
+ readonly inputs?: ReadonlyArray<Contact> | undefined;
81
+ /** The page's overlay, open, that `at`'s drawings go to. */
82
+ readonly overlay?: Overlay | undefined;
83
+ /**
84
+ * How each frame is taken. For frames with more pixels than the layout, paint the page first
85
+ * (`Frame.paint`) and take them at `scale: "device"`.
86
+ */
87
+ readonly image?: Pick<Frame.FrameOptions, "format" | "quality" | "scale"> | undefined;
88
+ /** How many times a frame's screenshot is taken again after it times out. Defaults to 2. */
89
+ readonly retries?: number | undefined;
90
+ }
91
+
92
+ const Count = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
93
+ const Millis = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));
94
+
95
+ /**
96
+ * An input to send at film time `t`, in ms, with the caller's name for it.
97
+ *
98
+ * @stability experimental
99
+ * @category schemas
100
+ * @since 0.3.0
101
+ */
102
+ export const Contact = Schema.Struct({
103
+ t: Millis,
104
+ action: Action,
105
+ label: Schema.optional(Schema.String),
106
+ });
107
+
108
+ /**
109
+ * @stability experimental
110
+ * @category models
111
+ * @since 0.3.0
112
+ */
113
+ export type Contact = typeof Contact.Type;
114
+
115
+ /**
116
+ * An input as it was sent, at its film time.
117
+ *
118
+ * @stability experimental
119
+ * @category schemas
120
+ * @since 0.3.0
121
+ */
122
+ export class Sent extends Schema.Class<Sent>("effect-browser/presentation/Film/Sent")({
123
+ t: Millis,
124
+ label: Schema.optional(Schema.String),
125
+ action: Action,
126
+ /** What a click resolved its target to, before its input. */
127
+ target: Schema.optional(ResolvedTarget),
128
+ /** The page's document after it. */
129
+ document: Count,
130
+ }) {}
131
+
132
+ /**
133
+ * The page's move to a new document, at the film time of the first frame that found it.
134
+ *
135
+ * @stability experimental
136
+ * @category schemas
137
+ * @since 0.3.0
138
+ */
139
+ export class Passage extends Schema.Class<Passage>("effect-browser/presentation/Film/Passage")({
140
+ t: Millis,
141
+ /** The address of the document it left. */
142
+ left: Schema.String,
143
+ document: Count,
144
+ url: Schema.String,
145
+ /** Real milliseconds from the film's last step on the page before to the document's being ready. */
146
+ loadedAfter: Millis,
147
+ /** The new document's layout, ready, with the film's `picks`. */
148
+ layout: Layout.Layout,
149
+ }) {}
150
+
151
+ /**
152
+ * One frame: its picture at film time `t`, in ms, and what taking it cost in real time.
153
+ *
154
+ * @stability experimental
155
+ * @category schemas
156
+ * @since 0.3.0
157
+ */
158
+ export class Shot extends Schema.Class<Shot>("effect-browser/presentation/Film/Shot")({
159
+ index: Count,
160
+ t: Millis,
161
+ image: Frame.Image,
162
+ /** The page's document and address after the picture, as `Page.state` gives them. */
163
+ document: Count,
164
+ url: Schema.String,
165
+ /** Where the document was scrolled to, in CSS pixels, on held time. */
166
+ scroll: Schema.optional(Point),
167
+ /** The inputs sent since the frame before. */
168
+ sent: Schema.Array(Sent),
169
+ /** The new document this frame was the first to find. */
170
+ passage: Schema.optional(Passage),
171
+ /** Screenshots that timed out before this one. */
172
+ retries: Count,
173
+ /** Real milliseconds from the frame's start to its picture. */
174
+ took: Millis,
175
+ /**
176
+ * When its picture was taken, in host monotonic milliseconds on the browser's clock, as a
177
+ * `Change`'s times are. On held time, the first shot at or after a change's `at` is the first
178
+ * that shows it; on real time, the page may change while it is pictured.
179
+ */
180
+ at: Schema.Finite,
181
+ }) {}
182
+
183
+ /**
184
+ * What a film cost, from its shots.
185
+ *
186
+ * @stability experimental
187
+ * @category schemas
188
+ * @since 0.3.0
189
+ */
190
+ export class Summary extends Schema.Class<Summary>("effect-browser/presentation/Film/Summary")({
191
+ frames: Count,
192
+ retries: Count,
193
+ /** Real milliseconds, all frames' and the slowest one's. */
194
+ took: Millis,
195
+ slowest: Millis,
196
+ /** Every input sent, and every passage, in order. */
197
+ sent: Schema.Array(Sent),
198
+ passages: Schema.Array(Passage),
199
+ }) {}
200
+
201
+ const operation = "Film.frames";
202
+
203
+ function* rated(fps: number, from: number, to: number) {
204
+ const count = Math.round(((to - from) * fps) / 1000);
205
+
206
+ for (let index = 0; index < count; index++) yield from + (index * 1000) / fps;
207
+ }
208
+
209
+ const timesOf = (times: Times): Effect.Effect<Iterable<number>, BrowserError> => {
210
+ if ("fps" in times) {
211
+ const { fps, from = 0, to } = times;
212
+
213
+ return [fps, from, to].every(Number.isFinite) && fps > 0 && from >= 0 && to >= from
214
+ ? Effect.succeed(rated(fps, from, to))
215
+ : refuse(
216
+ operation,
217
+ "a film's rate is positive and runs from a nonnegative time to a later one",
218
+ );
219
+ }
220
+
221
+ return times.every(
222
+ (t, index) => Number.isFinite(t) && t >= 0 && (index === 0 || t >= (times[index - 1] ?? t)),
223
+ )
224
+ ? Effect.succeed(times)
225
+ : refuse(operation, "a film's times are finite, nonnegative and in order");
226
+ };
227
+
228
+ // `move` takes the page to film time `t`, showing `at` there; `drawn` says whether to draw its
229
+ // overlay. On held time, it says where the document is scrolled to. `skip` leaves real time that
230
+ // film time does not count.
231
+ interface Mover {
232
+ readonly move: (
233
+ t: number,
234
+ at: At,
235
+ drawn: boolean,
236
+ ) => Effect.Effect<Point | undefined, BrowserError>;
237
+ readonly skip: (millis: number) => void;
238
+ }
239
+
240
+ const mover = (page: Page, time: Time, overlay: Overlay | undefined): Mover => {
241
+ if (typeof time === "object" && "advance" in time) {
242
+ let now = 0;
243
+
244
+ const move: Mover["move"] = (t, { scroll, poses, overlay: content }, drawn) =>
245
+ time
246
+ .advance(Duration.millis(t - now), {
247
+ scroll,
248
+ poses,
249
+ overlay: drawn ? content : undefined,
250
+ })
251
+ .pipe(
252
+ Effect.tap(() =>
253
+ Effect.sync(() => {
254
+ now = t;
255
+ }),
256
+ ),
257
+ );
258
+
259
+ return { move, skip: () => undefined };
260
+ }
261
+ let start: number | undefined;
262
+
263
+ const arrive =
264
+ time === "real"
265
+ ? (t: number) =>
266
+ Effect.suspend(() => {
267
+ const now = monotonicMillis(page.hostClock);
268
+
269
+ start ??= now;
270
+
271
+ return Effect.sleep(Duration.millis(Math.max(0, start + t - now))).pipe(
272
+ Effect.provideService(Clock.Clock, page.hostClock),
273
+ );
274
+ })
275
+ : time.seek;
276
+
277
+ const move: Mover["move"] = (t, at, drawn) =>
278
+ at.scroll === undefined && at.poses === undefined
279
+ ? arrive(t).pipe(
280
+ Effect.andThen(
281
+ drawn && at.overlay !== undefined && overlay !== undefined
282
+ ? overlay.draw(at.overlay)
283
+ : Effect.void,
284
+ ),
285
+ Effect.as(undefined),
286
+ )
287
+ : refuse(operation, "a film scrolls and poses the page only on held time");
288
+
289
+ return {
290
+ move,
291
+ skip: (millis) => {
292
+ if (start !== undefined) start += millis;
293
+ },
294
+ };
295
+ };
296
+
297
+ // A new screenshot, taken again after one that times out, with how many did.
298
+ const picture = (page: Page, image: Options["image"], retries: number) =>
299
+ Effect.gen(function* () {
300
+ let timedOut = 0;
301
+
302
+ const taken = yield* Frame.read(page, { ...image, maxAge: 0 }).pipe(
303
+ Effect.tapError((error) =>
304
+ Effect.sync(() => (timedOut += error.reason._tag === "Timeout" ? 1 : 0)),
305
+ ),
306
+ Effect.retry({ times: retries, while: (error) => error.reason._tag === "Timeout" }),
307
+ );
308
+
309
+ return { image: taken.image, retries: timedOut };
310
+ });
311
+
312
+ const keyOf = (content: Content | undefined) =>
313
+ content === undefined ? undefined : content._tag === "Svg" ? `svg:${content.markup}` : "empty";
314
+
315
+ const film = <E = never>(page: Page, options: Options<E>): Stream.Stream<Shot, BrowserError | E> =>
316
+ Stream.unwrap(
317
+ Effect.gen(function* () {
318
+ const times = yield* timesOf(options.times);
319
+ const retries = options.retries ?? 2;
320
+
321
+ if (!Number.isSafeInteger(retries) || retries < 0)
322
+ return yield* refuse(operation, "retries must be a nonnegative safe integer");
323
+ const inputs = (options.inputs ?? []).toSorted((one, other) => one.t - other.t);
324
+
325
+ if (!inputs.every(({ t }) => Number.isFinite(t) && t >= 0))
326
+ return yield* refuse(operation, "an input's time is finite and nonnegative");
327
+ let next = 0;
328
+ const { move, skip } = mover(page, options.time, options.overlay);
329
+ const now = () => monotonicMillis(page.hostClock);
330
+ const passages: Array<Passage> = [];
331
+
332
+ const at = (t: number) =>
333
+ options.at === undefined ? Effect.succeed<At>({}) : options.at(t, { passages });
334
+
335
+ let shown: string | undefined;
336
+ let { document: seen, url: was } = yield* page.state;
337
+ let stepped = now();
338
+
339
+ // Take the page to film time `t`, and note when, as a passage's wait counts from it.
340
+ const step = (t: number, showing: At, drawn: boolean) =>
341
+ Effect.tap(move(t, showing, drawn), () => Effect.sync(() => (stepped = now())));
342
+
343
+ // A document the page moved to since the last frame, once it is ready.
344
+ const arrival = (t: number) =>
345
+ Effect.gen(function* () {
346
+ const { document, url } = yield* page.state;
347
+
348
+ if (document === seen) return undefined;
349
+ yield* page.ready();
350
+ const layout = yield* Layout.measure(page, options.picks ?? {});
351
+ const loadedAfter = now() - stepped;
352
+
353
+ skip(loadedAfter);
354
+ const passage = new Passage({ t, left: was, document, url, loadedAfter, layout });
355
+
356
+ [seen, was] = [document, url];
357
+ passages.push(passage);
358
+
359
+ return passage;
360
+ });
361
+
362
+ const send = ({ t, action, label }: Contact) =>
363
+ Effect.gen(function* () {
364
+ yield* step(t, yield* at(t), false);
365
+ const done = yield* page.perform(action);
366
+ const { document } = yield* page.state;
367
+ const target = Schema.is(ResolvedTarget)(done) ? done : undefined;
368
+
369
+ return new Sent({ t, label, action, target, document });
370
+ });
371
+
372
+ const shoot = (t: number, index: number) =>
373
+ Effect.gen(function* () {
374
+ const started = now();
375
+ const sent: Array<Sent> = [];
376
+
377
+ for (
378
+ let input = inputs[next];
379
+ input !== undefined && input.t <= t;
380
+ input = inputs[++next]
381
+ )
382
+ sent.push(yield* send(input));
383
+ const passage = yield* arrival(t);
384
+ const showing = yield* at(t);
385
+ const key = keyOf(showing.overlay);
386
+
387
+ if (key !== undefined && options.overlay === undefined)
388
+ return yield* refuse(operation, "drawing needs the page's overlay, open, in `overlay`");
389
+ const scroll = yield* step(t, showing, key !== undefined && key !== shown);
390
+
391
+ shown = key ?? shown;
392
+ const taken = yield* picture(page, options.image, retries);
393
+ const pictured = now();
394
+ const { document, url } = yield* page.state;
395
+
396
+ return new Shot({
397
+ index,
398
+ t,
399
+ image: taken.image,
400
+ document,
401
+ url,
402
+ scroll,
403
+ sent,
404
+ passage,
405
+ retries: taken.retries,
406
+ took: pictured - started,
407
+ at: pictured,
408
+ });
409
+ });
410
+
411
+ return Stream.fromIterable(times).pipe(
412
+ Stream.zipWithIndex,
413
+ Stream.mapEffect(([t, index]) => shoot(t, index)),
414
+ );
415
+ }),
416
+ );
417
+
418
+ /**
419
+ * Frames of `page` at `times`, one at a time: each moves the page to its film time, draws what
420
+ * `at` gives there when it changed, and takes a new screenshot, again after one that times out.
421
+ *
422
+ * @stability experimental
423
+ * @category constructors
424
+ * @since 0.3.0
425
+ */
426
+ export const frames: {
427
+ <E = never>(options: Options<E>): (page: Page) => Stream.Stream<Shot, BrowserError | E>;
428
+ <E = never>(page: Page, options: Options<E>): Stream.Stream<Shot, BrowserError | E>;
429
+ } = Function.dual(2, film);
430
+
431
+ /**
432
+ * Run a film's shots, which a caller has usually written out on the way, to what they cost.
433
+ *
434
+ * @stability experimental
435
+ * @category combinators
436
+ * @since 0.3.0
437
+ */
438
+ export const summary = <E, R>(shots: Stream.Stream<Shot, E, R>): Effect.Effect<Summary, E, R> =>
439
+ Stream.runFold(
440
+ shots,
441
+ () => new Summary({ frames: 0, retries: 0, took: 0, slowest: 0, sent: [], passages: [] }),
442
+ (sum, shot) =>
443
+ new Summary({
444
+ frames: sum.frames + 1,
445
+ retries: sum.retries + shot.retries,
446
+ took: sum.took + shot.took,
447
+ slowest: Math.max(sum.slowest, shot.took),
448
+ sent: [...sum.sent, ...shot.sent],
449
+ passages: shot.passage === undefined ? sum.passages : [...sum.passages, shot.passage],
450
+ }),
451
+ );
@@ -2,6 +2,7 @@
2
2
  * Pointer motion as a complete, bounded schedule, independent of browser input and transport. A
3
3
  * presenter takes a planner as a value: `lognormal` here, or another, such as recorded strokes.
4
4
  *
5
+ * @stability stable
5
6
  * @since 0.3.0
6
7
  */
7
8
  import { Effect, Random } from "effect";
@@ -12,10 +13,47 @@ import {
12
13
  type Point,
13
14
  type Sample,
14
15
  maximumDurationMillis,
15
- } from "../Geometry.ts";
16
+ } from "../internal/geometry.ts";
17
+
18
+ export {
19
+ /**
20
+ * @stability stable
21
+ * @category schemas
22
+ * @since 0.3.0
23
+ */
24
+ Point,
25
+ /**
26
+ * @stability stable
27
+ * @category schemas
28
+ * @since 0.3.0
29
+ */
30
+ Sample,
31
+ /**
32
+ * @stability stable
33
+ * @category schemas
34
+ * @since 0.3.0
35
+ */
36
+ Plan,
37
+ /**
38
+ * @stability stable
39
+ * @category constants
40
+ * @since 0.3.0
41
+ */
42
+ maximumSamples,
43
+ /**
44
+ * @stability stable
45
+ * @category constants
46
+ * @since 0.3.0
47
+ */
48
+ maximumDurationMillis,
49
+ } from "../internal/geometry.ts";
16
50
 
17
- export { Point, Sample, Plan, maximumSamples, maximumDurationMillis } from "../Geometry.ts";
18
- export type { Planner } from "../Geometry.ts";
51
+ /**
52
+ * @stability stable
53
+ * @category models
54
+ * @since 0.3.0
55
+ */
56
+ export type { Planner } from "../internal/geometry.ts";
19
57
 
20
58
  // These are the research's tuned two-stroke parameters. Width scaling was not evaluated, so the
21
59
  // model keeps its 40px reference width rather than implying measured target-size behavior.
@@ -127,5 +165,9 @@ const plan: Planner["plan"] = Effect.fnUntraced(function* (from, to) {
127
165
  /**
128
166
  * The research's tuned two-stroke sigma-lognormal model: a fast stroke toward the target and a
129
167
  * slower one that homes in on it, with a little bend, drawn from `Random`.
168
+ *
169
+ * @stability stable
170
+ * @category constants
171
+ * @since 0.3.0
130
172
  */
131
173
  export const lognormal: Planner = { plan };
@@ -2,18 +2,26 @@
2
2
  * Input performed for viewers. A presenter owns one pointer and pace. Its public page view applies
3
3
  * a style to input after approval, so policy holds leave the hand free. Hand acquisition is bounded
4
4
  * by the page's action wait and honours failFast; reactions and input use the page owner's clock.
5
+ * @stability stable
5
6
  * @since 0.3.0
6
7
  */
7
8
  import { type Clock, Deferred, Duration, Effect, MutableRef, Option, Semaphore } from "effect";
8
9
 
9
- import { methods } from "../ActionPort.ts";
10
10
  import { Busy, refuse, undispatched } from "../BrowserError.ts";
11
- import { monotonicMillis } from "../Clock.ts";
11
+ import type { ActionAnnounced } from "../BrowserEvent.ts";
12
+ import * as InputStyle from "../InputStyle.ts";
13
+ import { methods } from "../internal/action-port.ts";
14
+ import { monotonicMillis } from "../internal/clock.ts";
12
15
  import type { Page, Point } from "../Page.ts";
13
- import * as Style from "../Style.ts";
14
16
  import * as Motion from "./Motion.ts";
15
17
 
16
- /** How long a person waits before acting, and how fast they type. */
18
+ /**
19
+ * How long a person waits before acting, and how fast they type.
20
+ *
21
+ * @stability stable
22
+ * @category models
23
+ * @since 0.3.0
24
+ */
17
25
  export interface Pacing {
18
26
  readonly expected: Duration.Input;
19
27
  readonly surprise: Duration.Input;
@@ -22,6 +30,11 @@ export interface Pacing {
22
30
  readonly wordsPerMinute: number;
23
31
  }
24
32
 
33
+ /**
34
+ * @stability stable
35
+ * @category constants
36
+ * @since 0.3.0
37
+ */
25
38
  export const human: Pacing = {
26
39
  expected: "280 millis",
27
40
  surprise: "600 millis",
@@ -29,13 +42,34 @@ export const human: Pacing = {
29
42
  wordsPerMinute: 70,
30
43
  };
31
44
 
45
+ /**
46
+ * @stability stable
47
+ * @category options
48
+ * @since 0.3.0
49
+ */
32
50
  export interface Options {
33
51
  readonly pacing?: Pacing | undefined;
34
52
  readonly motion?: Motion.Planner | undefined;
53
+ /**
54
+ * After a view's action has announced its target, and before its pointer travels there, wait
55
+ * for this: time for whatever is shown performing the input, such as a character, to arrive. It
56
+ * comes after the reaction's wait, holds the page's turn and spends the action's deadline.
57
+ */
58
+ readonly lead?: ((announced: ActionAnnounced) => Effect.Effect<void>) | undefined;
35
59
  }
36
60
 
61
+ /**
62
+ * @stability stable
63
+ * @category models
64
+ * @since 0.3.0
65
+ */
37
66
  export type View = Page;
38
67
 
68
+ /**
69
+ * @stability stable
70
+ * @category models
71
+ * @since 0.3.0
72
+ */
39
73
  export interface Presenter {
40
74
  /** The same public page view for the same page. */
41
75
  readonly view: (page: Page) => View;
@@ -43,7 +77,13 @@ export interface Presenter {
43
77
 
44
78
  const spread = { expected: 0.3, surprise: 0.4, unrelated: 0.4 };
45
79
 
46
- /** One hand for the scope; input effects keep their page's authority and failure evidence. */
80
+ /**
81
+ * One hand for the scope; input effects keep their page's authority and failure evidence.
82
+ *
83
+ * @stability stable
84
+ * @category constructors
85
+ * @since 0.3.0
86
+ */
47
87
  export const make = Effect.fn("Presentation.make")(function* (options: Options = {}) {
48
88
  const pacing = options.pacing ?? human;
49
89
  const medians = { expected: 0, surprise: 0, unrelated: 0 };
@@ -62,19 +102,21 @@ export const make = Effect.fn("Presentation.make")(function* (options: Options =
62
102
  if (
63
103
  !Number.isFinite(pacing.wordsPerMinute) ||
64
104
  pacing.wordsPerMinute <= 0 ||
65
- Style.keyGap(pacing.wordsPerMinute) < 0
105
+ InputStyle.keyGap(pacing.wordsPerMinute) < 0
66
106
  )
67
107
  return yield* refuse("presentation", "wordsPerMinute must be positive and at most 1200");
68
108
 
69
109
  const pointer = MutableRef.make(Option.none<Point>());
70
110
  const hand = yield* Semaphore.make(1);
71
111
 
72
- const planned = Style.performed({
112
+ const planned = InputStyle.performed({
73
113
  pointer,
74
114
  motion: options.motion ?? Motion.lognormal,
75
115
  wordsPerMinute: pacing.wordsPerMinute,
76
116
  });
77
117
 
118
+ const { lead } = options;
119
+
78
120
  const views = new WeakMap<Page, View>();
79
121
 
80
122
  let last:
@@ -90,10 +132,14 @@ export const make = Effect.fn("Presentation.make")(function* (options: Options =
90
132
  const known = views.get(page);
91
133
 
92
134
  if (known !== undefined) return known;
93
- const now = () => monotonicMillis(page.clock);
135
+ const now = () => monotonicMillis(page.hostClock);
94
136
 
95
- const style: Style.Style = {
137
+ const style: InputStyle.InputStyle = {
96
138
  ...planned,
139
+ lead:
140
+ lead === undefined
141
+ ? undefined
142
+ : (announced) => lead(announced).pipe(Effect.withSpan("Presentation.lead")),
97
143
  withInput:
98
144
  ({ operation, wait, failFast }) =>
99
145
  (effect) =>
@@ -112,15 +158,15 @@ export const make = Effect.fn("Presentation.make")(function* (options: Options =
112
158
  const document = (yield* page.state).document;
113
159
 
114
160
  const kind =
115
- last === undefined || last.page !== page.id || last.clock !== page.clock
161
+ last === undefined || last.page !== page.id || last.clock !== page.hostClock
116
162
  ? "unrelated"
117
163
  : last.document === document
118
164
  ? "expected"
119
165
  : "surprise";
120
166
 
121
167
  const left =
122
- (last?.clock === page.clock ? last.at : now()) +
123
- (yield* Style.pause(medians[kind], spread[kind])) -
168
+ (last?.clock === page.hostClock ? last.at : now()) +
169
+ (yield* InputStyle.pause(medians[kind], spread[kind])) -
124
170
  now();
125
171
 
126
172
  if (left > 0)
@@ -131,7 +177,7 @@ export const make = Effect.fn("Presentation.make")(function* (options: Options =
131
177
  return yield* effect.pipe(
132
178
  Effect.ensuring(
133
179
  Effect.sync(() => {
134
- last = { page: page.id, document, clock: page.clock, at: now() };
180
+ last = { page: page.id, document, clock: page.hostClock, at: now() };
135
181
  }),
136
182
  ),
137
183
  );
@@ -155,7 +201,7 @@ export const make = Effect.fn("Presentation.make")(function* (options: Options =
155
201
  }).pipe(Effect.withSpan("Presentation.hand")),
156
202
  };
157
203
 
158
- const styled = Style.provide(style);
204
+ const styled = InputStyle.provide(style);
159
205
  const perform: Page["perform"] = (action) => styled(page.perform(action));
160
206
 
161
207
  const performed: View = {