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
package/dist/Change.mjs CHANGED
@@ -1,6 +1,7 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { Subject } from "./BrowserEvent.mjs";
3
- import { Schema } from "effect";
1
+ import { t as __exportAll } from "./internal/rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Box, Subject } from "./BrowserEvent.mjs";
3
+ import { n as functionsOf, r as isPage } from "./internal/functions-jBOs6GKv.mjs";
4
+ import { Function, Schema } from "effect";
4
5
  //#region src/Change.ts
5
6
  /**
6
7
  * What visibly changed on a page over a window, element by element: text that changed, appeared,
@@ -8,7 +9,7 @@ import { Schema } from "effect";
8
9
  * shown at the window's start and at its end, how often it changed between, where it is on the
9
10
  * page, and the input it followed, where it was that input's doing.
10
11
  *
11
- * `Page.changes` reads it. A page records once something reads its changes: from then, and from the
12
+ * `read` reads it. A page records once something reads its changes: from then, and from the
12
13
  * start of each later document once it is parsed, until nobody has read it for two minutes. A page
13
14
  * nobody reads records nothing. The record keeps 256 elements, each with its last 32 changes, for a
14
15
  * minute; an element that keeps changing gives way before news, and what gives way is counted in
@@ -18,16 +19,22 @@ import { Schema } from "effect";
18
19
  * shadow roots and SVG; a value a script sets; and a class that reveals an element the record has
19
20
  * not seen before, such as a toast already on the page, though its later changes are seen.
20
21
  *
22
+ * @stability stable
21
23
  * @since 0.3.0
22
24
  */
23
25
  var Change_exports = /* @__PURE__ */ __exportAll({
24
26
  Change: () => Change,
25
27
  Changes: () => Changes,
26
- Kind: () => Kind
28
+ Kind: () => Kind,
29
+ read: () => read
27
30
  });
28
31
  /**
29
32
  * `text` changed; `appeared` and `disappeared`, whether added or removed or shown or hidden;
30
33
  * `brief`, appeared and gone again by the window's end; `value`, a field's; `title`, the document's.
34
+ *
35
+ * @stability stable
36
+ * @category schemas
37
+ * @since 0.3.0
31
38
  */
32
39
  const Kind = Schema.Literals([
33
40
  "text",
@@ -37,6 +44,11 @@ const Kind = Schema.Literals([
37
44
  "value",
38
45
  "title"
39
46
  ]);
47
+ /**
48
+ * @stability stable
49
+ * @category schemas
50
+ * @since 0.3.0
51
+ */
40
52
  var Change = class extends Schema.Class("effect-browser/Change")({
41
53
  kind: Kind,
42
54
  /**
@@ -44,6 +56,12 @@ var Change = class extends Schema.Class("effect-browser/Change")({
44
56
  * changed, so its name is empty unless something else names it, as a field's label does.
45
57
  */
46
58
  subject: Subject,
59
+ /**
60
+ * Where it is as the changes are read, in viewport CSS pixels, unrounded; for what went, where
61
+ * what it sat in is. A caller can frame what an input did beside the input. Absent for the title
62
+ * and for what is drawn nowhere, as what was hidden is.
63
+ */
64
+ box: Schema.optional(Box),
47
65
  /** When it first changed in the window, in host monotonic milliseconds on the browser's clock. */
48
66
  startedAt: Schema.Finite,
49
67
  /** When it last changed in the window. */
@@ -73,7 +91,12 @@ var Change = class extends Schema.Class("effect-browser/Change")({
73
91
  */
74
92
  cause: Schema.optional(Schema.Finite)
75
93
  }) {};
76
- var Changes = class extends Schema.Class("effect-browser/Changes")({
94
+ /**
95
+ * @stability stable
96
+ * @category schemas
97
+ * @since 0.3.0
98
+ */
99
+ var Changes = class extends Schema.Class("effect-browser/Change/Changes")({
77
100
  /** The page's document these changes belong to, as `Navigated` counts them. */
78
101
  document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
79
102
  /** Where the record is whole: before it, changes may be missing. */
@@ -90,8 +113,18 @@ var Changes = class extends Schema.Class("effect-browser/Changes")({
90
113
  /** Oldest first, by when each began to change. */
91
114
  changes: Schema.Array(Change)
92
115
  }) {};
116
+ /**
117
+ * What visibly changed over a window, in one call to the page. The first read starts the page's
118
+ * record, so it finds none; from then the page records, and from the start of each later
119
+ * document, until nobody has read it for two minutes.
120
+ *
121
+ * @stability stable
122
+ * @category constructors
123
+ * @since 0.3.0
124
+ */
125
+ const read = Function.dual((args) => isPage(args[0]), (page, options) => functionsOf(page).changes(options));
93
126
  /** A change in words for a model, such as `"$61,240" became "$62,010" (row "Bitcoin", column "Price")`. */
94
127
  //#endregion
95
- export { Change, Changes, Kind, Change_exports as t };
128
+ export { Change, Changes, Kind, read, Change_exports as t };
96
129
 
97
130
  //# sourceMappingURL=Change.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Change.mjs","names":[],"sources":["../src/Change.ts"],"sourcesContent":["/**\n * What visibly changed on a page over a window, element by element: text that changed, appeared,\n * disappeared or came and went, a field's value, and the document's title. A change says what was\n * shown at the window's start and at its end, how often it changed between, where it is on the\n * page, and the input it followed, where it was that input's doing.\n *\n * `Page.changes` reads it. A page records once something reads its changes: from then, and from the\n * start of each later document once it is parsed, until nobody has read it for two minutes. A page\n * nobody reads records nothing. The record keeps 256 elements, each with its last 32 changes, for a\n * minute; an element that keeps changing gives way before news, and what gives way is counted in\n * `dropped`, with `from` moved past it. A change is told when it was in view as the page rendered\n * it, its style showing it, so one scrolled away later is still told, and something removed or\n * hidden only if it was in view before. What the record cannot see: pictures, a canvas, frames,\n * shadow roots and SVG; a value a script sets; and a class that reveals an element the record has\n * not seen before, such as a toast already on the page, though its later changes are seen.\n *\n * @since 0.3.0\n */\nimport { Schema } from \"effect\";\n\nimport { Subject } from \"./BrowserEvent.ts\";\n\n/**\n * `text` changed; `appeared` and `disappeared`, whether added or removed or shown or hidden;\n * `brief`, appeared and gone again by the window's end; `value`, a field's; `title`, the document's.\n */\nexport const Kind = Schema.Literals([\"text\", \"appeared\", \"disappeared\", \"brief\", \"value\", \"title\"]);\n\nexport type Kind = typeof Kind.Type;\n\nexport class Change extends Schema.Class<Change>(\"effect-browser/Change\")({\n kind: Kind,\n /**\n * What changed, as the page names it now, or where it was for what went. Its own words are what\n * changed, so its name is empty unless something else names it, as a field's label does.\n */\n subject: Subject,\n /** When it first changed in the window, in host monotonic milliseconds on the browser's clock. */\n startedAt: Schema.Finite,\n /** When it last changed in the window. */\n at: Schema.Finite,\n /**\n * What it showed at the window's start; absent for what appeared and where the record let that go.\n * What disappeared says what it showed as it went. A field's value reads `••••` unless unmasked.\n */\n before: Schema.optional(Schema.String),\n /** What it showed at the window's end; absent for what disappeared. What came and went says what it showed. */\n after: Schema.optional(Schema.String),\n /** How many times what it showed changed in the window. */\n count: Schema.Int.check(Schema.isGreaterThan(0)),\n /** For a number that changed more than once, its lowest and highest, as shown. */\n lowest: Schema.optional(Schema.String),\n highest: Schema.optional(Schema.String),\n /** When it last changed before the window, as far back as the record keeps: in flux, not news. */\n earlier: Schema.optional(Schema.Finite),\n /**\n * When the trusted input it followed reached the page, where it was that input's doing. It was not\n * in flux: in the 10 s before the input it had not changed, and nothing had come into or left what\n * it sits in, so a ticker's tick or a feed's line is not. Then it changed within 3 s inside what\n * the input acted on or its row, form, dialog or controlled element; or, elsewhere, within 500 ms\n * of an input on a page where nothing had changed in the 2 s before, as a menu a portal puts at\n * the end of the page does. What holds the input's target, as a menu holds its item, does not\n * count against it. The page's `Action` that sent it holds that time.\n */\n cause: Schema.optional(Schema.Finite),\n}) {}\n\nexport class Changes extends Schema.Class<Changes>(\"effect-browser/Changes\")({\n /** The page's document these changes belong to, as `Navigated` counts them. */\n document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n /** Where the record is whole: before it, changes may be missing. */\n from: Schema.Finite,\n /** Where the window ends: its `until`, or when the page was read. */\n until: Schema.Finite,\n /**\n * Where the window ends on the page's own clock. Give these changes as the next read's `since` and\n * the two windows meet exactly, whatever the clock mapping does meanwhile.\n */\n cursor: Schema.Finite,\n /** Changes in the window the record let go, at least; 0 when it kept them all. */\n dropped: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n /** Oldest first, by when each began to change. */\n changes: Schema.Array(Change),\n}) {}\n\n/** A change in words for a model, such as `\"$61,240\" became \"$62,010\" (row \"Bitcoin\", column \"Price\")`. */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,OAAO,OAAO,SAAS;CAAC;CAAQ;CAAY;CAAe;CAAS;CAAS;AAAO,CAAC;AAIlG,IAAa,SAAb,cAA4B,OAAO,MAAc,uBAAuB,CAAC,CAAC;CACxE,MAAM;;;;;CAKN,SAAS;;CAET,WAAW,OAAO;;CAElB,IAAI,OAAO;;;;;CAKX,QAAQ,OAAO,SAAS,OAAO,MAAM;;CAErC,OAAO,OAAO,SAAS,OAAO,MAAM;;CAEpC,OAAO,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC;;CAE/C,QAAQ,OAAO,SAAS,OAAO,MAAM;CACrC,SAAS,OAAO,SAAS,OAAO,MAAM;;CAEtC,SAAS,OAAO,SAAS,OAAO,MAAM;;;;;;;;;;CAUtC,OAAO,OAAO,SAAS,OAAO,MAAM;AACtC,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,UAAb,cAA6B,OAAO,MAAe,wBAAwB,CAAC,CAAC;;CAE3E,UAAU,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;CAE3D,MAAM,OAAO;;CAEb,OAAO,OAAO;;;;;CAKd,QAAQ,OAAO;;CAEf,SAAS,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;CAE1D,SAAS,OAAO,MAAM,MAAM;AAC9B,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"Change.mjs","names":[],"sources":["../src/Change.ts"],"sourcesContent":["/**\n * What visibly changed on a page over a window, element by element: text that changed, appeared,\n * disappeared or came and went, a field's value, and the document's title. A change says what was\n * shown at the window's start and at its end, how often it changed between, where it is on the\n * page, and the input it followed, where it was that input's doing.\n *\n * `read` reads it. A page records once something reads its changes: from then, and from the\n * start of each later document once it is parsed, until nobody has read it for two minutes. A page\n * nobody reads records nothing. The record keeps 256 elements, each with its last 32 changes, for a\n * minute; an element that keeps changing gives way before news, and what gives way is counted in\n * `dropped`, with `from` moved past it. A change is told when it was in view as the page rendered\n * it, its style showing it, so one scrolled away later is still told, and something removed or\n * hidden only if it was in view before. What the record cannot see: pictures, a canvas, frames,\n * shadow roots and SVG; a value a script sets; and a class that reveals an element the record has\n * not seen before, such as a toast already on the page, though its later changes are seen.\n *\n * @stability stable\n * @since 0.3.0\n */\nimport { type Effect, Function, Schema } from \"effect\";\n\nimport type { BrowserError } from \"./BrowserError.ts\";\nimport { Box, Subject } from \"./BrowserEvent.ts\";\nimport type { Frame } from \"./Frame.ts\";\nimport { functionsOf, isPage } from \"./internal/page/functions.ts\";\nimport type { Page } from \"./Page.ts\";\n\n/**\n * `text` changed; `appeared` and `disappeared`, whether added or removed or shown or hidden;\n * `brief`, appeared and gone again by the window's end; `value`, a field's; `title`, the document's.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport const Kind = Schema.Literals([\"text\", \"appeared\", \"disappeared\", \"brief\", \"value\", \"title\"]);\n\n/**\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport type Kind = typeof Kind.Type;\n\n/**\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class Change extends Schema.Class<Change>(\"effect-browser/Change\")({\n kind: Kind,\n /**\n * What changed, as the page names it now, or where it was for what went. Its own words are what\n * changed, so its name is empty unless something else names it, as a field's label does.\n */\n subject: Subject,\n /**\n * Where it is as the changes are read, in viewport CSS pixels, unrounded; for what went, where\n * what it sat in is. A caller can frame what an input did beside the input. Absent for the title\n * and for what is drawn nowhere, as what was hidden is.\n */\n box: Schema.optional(Box),\n /** When it first changed in the window, in host monotonic milliseconds on the browser's clock. */\n startedAt: Schema.Finite,\n /** When it last changed in the window. */\n at: Schema.Finite,\n /**\n * What it showed at the window's start; absent for what appeared and where the record let that go.\n * What disappeared says what it showed as it went. A field's value reads `••••` unless unmasked.\n */\n before: Schema.optional(Schema.String),\n /** What it showed at the window's end; absent for what disappeared. What came and went says what it showed. */\n after: Schema.optional(Schema.String),\n /** How many times what it showed changed in the window. */\n count: Schema.Int.check(Schema.isGreaterThan(0)),\n /** For a number that changed more than once, its lowest and highest, as shown. */\n lowest: Schema.optional(Schema.String),\n highest: Schema.optional(Schema.String),\n /** When it last changed before the window, as far back as the record keeps: in flux, not news. */\n earlier: Schema.optional(Schema.Finite),\n /**\n * When the trusted input it followed reached the page, where it was that input's doing. It was not\n * in flux: in the 10 s before the input it had not changed, and nothing had come into or left what\n * it sits in, so a ticker's tick or a feed's line is not. Then it changed within 3 s inside what\n * the input acted on or its row, form, dialog or controlled element; or, elsewhere, within 500 ms\n * of an input on a page where nothing had changed in the 2 s before, as a menu a portal puts at\n * the end of the page does. What holds the input's target, as a menu holds its item, does not\n * count against it. The page's `Action` that sent it holds that time.\n */\n cause: Schema.optional(Schema.Finite),\n}) {}\n\n/**\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class Changes extends Schema.Class<Changes>(\"effect-browser/Change/Changes\")({\n /** The page's document these changes belong to, as `Navigated` counts them. */\n document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n /** Where the record is whole: before it, changes may be missing. */\n from: Schema.Finite,\n /** Where the window ends: its `until`, or when the page was read. */\n until: Schema.Finite,\n /**\n * Where the window ends on the page's own clock. Give these changes as the next read's `since` and\n * the two windows meet exactly, whatever the clock mapping does meanwhile.\n */\n cursor: Schema.Finite,\n /** Changes in the window the record let go, at least; 0 when it kept them all. */\n dropped: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n /** Oldest first, by when each began to change. */\n changes: Schema.Array(Change),\n}) {}\n\n/**\n * The window `read` reads, and whether to show what fields hold.\n *\n * @stability stable\n * @category options\n * @since 0.3.0\n */\nexport interface ChangesOptions {\n /**\n * Where the window starts: the changes a previous read returned, to continue exactly where they\n * ended; a frame, at its paint; or host monotonic milliseconds, which mapped to the page's clock\n * may miss or repeat changes near the start if the browser's clock mapping changed since. Defaults\n * to the start of the record.\n */\n readonly since?: Changes | Frame | number | undefined;\n /**\n * Where it ends: a frame, at its paint, so a delayed frame's window holds nothing it does not\n * show; or host monotonic milliseconds. Defaults to now, and is never later.\n */\n readonly until?: Frame | number | undefined;\n /** Show what fields hold; a secret field still reads `••••`. Defaults to false. */\n readonly unmask?: boolean | undefined;\n}\n\n/**\n * What visibly changed over a window, in one call to the page. The first read starts the page's\n * record, so it finds none; from then the page records, and from the start of each later\n * document, until nobody has read it for two minutes.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const read: {\n (options?: ChangesOptions): (page: Page) => Effect.Effect<Changes, BrowserError>;\n (page: Page, options?: ChangesOptions): Effect.Effect<Changes, BrowserError>;\n} = Function.dual(\n (args) => isPage(args[0]),\n (page: Page, options?: ChangesOptions) => functionsOf(page).changes(options),\n);\n\n/** A change in words for a model, such as `\"$61,240\" became \"$62,010\" (row \"Bitcoin\", column \"Price\")`. */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,OAAO,OAAO,SAAS;CAAC;CAAQ;CAAY;CAAe;CAAS;CAAS;AAAO,CAAC;;;;;;AAclG,IAAa,SAAb,cAA4B,OAAO,MAAc,uBAAuB,CAAC,CAAC;CACxE,MAAM;;;;;CAKN,SAAS;;;;;;CAMT,KAAK,OAAO,SAAS,GAAG;;CAExB,WAAW,OAAO;;CAElB,IAAI,OAAO;;;;;CAKX,QAAQ,OAAO,SAAS,OAAO,MAAM;;CAErC,OAAO,OAAO,SAAS,OAAO,MAAM;;CAEpC,OAAO,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC;;CAE/C,QAAQ,OAAO,SAAS,OAAO,MAAM;CACrC,SAAS,OAAO,SAAS,OAAO,MAAM;;CAEtC,SAAS,OAAO,SAAS,OAAO,MAAM;;;;;;;;;;CAUtC,OAAO,OAAO,SAAS,OAAO,MAAM;AACtC,CAAC,CAAC,CAAC,CAAC;;;;;;AAOJ,IAAa,UAAb,cAA6B,OAAO,MAAe,+BAA+B,CAAC,CAAC;;CAElF,UAAU,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;CAE3D,MAAM,OAAO;;CAEb,OAAO,OAAO;;;;;CAKd,QAAQ,OAAO;;CAEf,SAAS,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;CAE1D,SAAS,OAAO,MAAM,MAAM;AAC9B,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;AAmCJ,MAAa,OAGT,SAAS,MACV,SAAS,OAAO,KAAK,EAAE,IACvB,MAAY,YAA6B,YAAY,IAAI,CAAC,CAAC,QAAQ,OAAO,CAC7E"}
package/dist/Frame.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as Image, c as sameCapture, n as CaptureStats, o as ScreencastOptions, r as Frame, s as Screenshot, t as BrowserPaint } from "./Frame-UEH2hO5T.mjs";
2
- export { BrowserPaint, CaptureStats, Frame, Image, ScreencastOptions, Screenshot, sameCapture };
1
+ import { At as read, Ct as Paint, Dt as Zoom, Et as Screenshot, Mt as sameCapture, Nt as zoom, Ot as capture, St as Image, Tt as ScreencastOptions, _t as Capture, bt as FrameOptions, gt as BrowserPaint, jt as recent, kt as paint, vt as CaptureStats, wt as Region, yt as Frame } from "./internal/Page-BfGxn7oN.mjs";
2
+ export { BrowserPaint, Capture, CaptureStats, Frame, FrameOptions, Image, Paint, Region, ScreencastOptions, Screenshot, Zoom, capture, paint, read, recent, sameCapture, zoom };
package/dist/Frame.mjs CHANGED
@@ -1,9 +1,12 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { Schema } from "effect";
1
+ import { t as __exportAll } from "./internal/rolldown-runtime-D7D4PA-g.mjs";
2
+ import { n as functionsOf, r as isPage } from "./internal/functions-jBOs6GKv.mjs";
3
+ import { Function, Schema } from "effect";
3
4
  //#region src/Frame.ts
4
5
  /**
5
- * Pictures of a page: screenshots, and screencast frames stamped with the browser's clock.
6
+ * Pictures of a page: its viewport as a frame of a stated age, crops of it, its screencast with
7
+ * frames stamped by the browser's clock, and how it paints. Each function takes the page first.
6
8
  *
9
+ * @stability stable
7
10
  * @since 0.3.0
8
11
  */
9
12
  var Frame_exports = /* @__PURE__ */ __exportAll({
@@ -11,11 +14,24 @@ var Frame_exports = /* @__PURE__ */ __exportAll({
11
14
  CaptureStats: () => CaptureStats,
12
15
  Frame: () => Frame,
13
16
  Image: () => Image,
17
+ Region: () => Region,
14
18
  Screenshot: () => Screenshot,
15
- sameCapture: () => sameCapture
19
+ Zoom: () => Zoom,
20
+ capture: () => capture,
21
+ paint: () => paint,
22
+ read: () => read,
23
+ recent: () => recent,
24
+ sameCapture: () => sameCapture,
25
+ zoom: () => zoom
16
26
  });
17
- /** An encoded picture with its pixel dimensions. Crops also need their viewport origin. */
18
- var Image = class extends Schema.Class("effect-browser/Image")({
27
+ /**
28
+ * An encoded picture with its pixel dimensions. Crops also need their viewport origin.
29
+ *
30
+ * @stability stable
31
+ * @category schemas
32
+ * @since 0.3.0
33
+ */
34
+ var Image = class extends Schema.Class("effect-browser/Frame/Image")({
19
35
  data: Schema.Uint8Array,
20
36
  mediaType: Schema.Literals(["image/jpeg", "image/png"]),
21
37
  width: Schema.Finite,
@@ -23,14 +39,26 @@ var Image = class extends Schema.Class("effect-browser/Image")({
23
39
  }) {};
24
40
  const Nonnegative = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));
25
41
  const Count = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
26
- /** Native CDP paint time mapped to the owning host clock, with transport uncertainty retained. */
27
- var BrowserPaint = class extends Schema.TaggedClass()("BrowserPaint", {
42
+ /**
43
+ * Native CDP paint time mapped to the owning host clock, with transport uncertainty retained.
44
+ *
45
+ * @stability stable
46
+ * @category schemas
47
+ * @since 0.3.0
48
+ */
49
+ var BrowserPaint = class extends Schema.TaggedClass("effect-browser/Frame/BrowserPaint")("BrowserPaint", {
28
50
  timestamp: Schema.Finite,
29
51
  hostTime: Schema.Finite,
30
52
  uncertaintyMillis: Nonnegative
31
53
  }) {};
32
- /** A screenshot's host capture interval; it has no native browser paint timestamp. */
33
- var Screenshot = class extends Schema.TaggedClass()("Screenshot", {
54
+ /**
55
+ * A screenshot's host capture interval; it has no native browser paint timestamp.
56
+ *
57
+ * @stability stable
58
+ * @category schemas
59
+ * @since 0.3.0
60
+ */
61
+ var Screenshot = class extends Schema.TaggedClass("effect-browser/Frame/Screenshot")("Screenshot", {
34
62
  hostTime: Schema.Finite,
35
63
  uncertaintyMillis: Nonnegative
36
64
  }) {};
@@ -38,6 +66,10 @@ var Screenshot = class extends Schema.TaggedClass()("Screenshot", {
38
66
  * An image and its timing evidence. Paint time and screenshot capture time cannot be confused in
39
67
  * serialized data. `receivedAt` records delivery on the owning host's monotonic clock; it does
40
68
  * not make an old paint current.
69
+ *
70
+ * @stability stable
71
+ * @category schemas
72
+ * @since 0.3.0
41
73
  */
42
74
  var Frame = class extends Schema.Class("effect-browser/Frame")({
43
75
  page: Schema.String,
@@ -51,6 +83,8 @@ var Frame = class extends Schema.Class("effect-browser/Frame")({
51
83
  sequence: Count
52
84
  })),
53
85
  data: Schema.Uint8Array,
86
+ /** The picture's type, when a new picture gave it; one without is a JPEG, as screencast frames are. */
87
+ mediaType: Schema.optionalKey(Schema.Literals(["image/jpeg", "image/png"])),
54
88
  timing: Schema.Union([BrowserPaint, Screenshot]),
55
89
  receivedAt: Schema.Finite,
56
90
  width: Schema.Finite,
@@ -73,20 +107,30 @@ var Frame = class extends Schema.Class("effect-browser/Frame")({
73
107
  get image() {
74
108
  return new Image({
75
109
  data: this.data,
76
- mediaType: "image/jpeg",
110
+ mediaType: this.mediaType ?? "image/jpeg",
77
111
  width: this.width,
78
112
  height: this.height
79
113
  });
80
114
  }
81
115
  };
82
- /** Equal capture lineage survives an image copy; untagged pictures retain object identity only. */
116
+ /**
117
+ * Equal capture lineage survives an image copy; untagged pictures retain object identity only.
118
+ *
119
+ * @stability stable
120
+ * @category predicates
121
+ * @since 0.3.0
122
+ */
83
123
  const sameCapture = (frame, other) => other !== void 0 && (frame === other || frame.capture !== void 0 && frame.page === other.page && frame.session === other.session && frame.connection === other.connection && frame.document === other.document && frame.capture.generation === other.capture?.generation && frame.capture.sequence === other.capture?.sequence);
84
124
  /**
85
125
  * A page's capture counts, over its life or a window of the latest minute: what Chromium sent,
86
126
  * what readers got, and why the rest went no further. Frames that came late are counted apart from
87
127
  * those a reader lost.
128
+ *
129
+ * @stability stable
130
+ * @category schemas
131
+ * @since 0.3.0
88
132
  */
89
- var CaptureStats = class extends Schema.Class("effect-browser/CaptureStats")({
133
+ var CaptureStats = class extends Schema.Class("effect-browser/Frame/CaptureStats")({
90
134
  received: Count,
91
135
  accepted: Count,
92
136
  /**
@@ -125,7 +169,81 @@ var CaptureStats = class extends Schema.Class("effect-browser/CaptureStats")({
125
169
  lastMillis: Schema.NullOr(Nonnegative)
126
170
  })
127
171
  }) {};
172
+ /**
173
+ * An integer rectangle in viewport CSS pixels.
174
+ *
175
+ * @stability stable
176
+ * @category schemas
177
+ * @since 0.3.0
178
+ */
179
+ var Region = class extends Schema.Class("effect-browser/Frame/Region")({
180
+ x: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
181
+ y: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
182
+ width: Schema.Int.check(Schema.isGreaterThan(0)),
183
+ height: Schema.Int.check(Schema.isGreaterThan(0))
184
+ }) {};
185
+ /**
186
+ * A crop and its viewport origin: add that origin to a point read from the crop.
187
+ *
188
+ * @stability stable
189
+ * @category schemas
190
+ * @since 0.3.0
191
+ */
192
+ var Zoom = class extends Schema.Class("effect-browser/Frame/Zoom")({
193
+ page: Schema.String,
194
+ region: Region,
195
+ image: Image
196
+ }) {};
197
+ /**
198
+ * The viewport with its timing: the newest screencast frame if it qualifies, else a new
199
+ * screenshot timed by the host interval in which it was taken. A frame of a stated age that the
200
+ * screencast has costs nothing and waits for no action; one that must follow the latest input, or
201
+ * a new screenshot, waits for the action in flight.
202
+ *
203
+ * @stability stable
204
+ * @category constructors
205
+ * @since 0.3.0
206
+ */
207
+ const read = Function.dual((args) => isPage(args[0]), (page, options) => functionsOf(page).frame(options));
208
+ /**
209
+ * A crop in CSS pixels, unmagnified, with the origin that keeps later input in viewport pixels.
210
+ * A crop is always a new picture; with `scale: "device"` it has the screen's own pixels.
211
+ *
212
+ * @stability stable
213
+ * @category constructors
214
+ * @since 0.3.0
215
+ */
216
+ const zoom = Function.dual((args) => isPage(args[0]), (page, region, options) => functionsOf(page).zoom(region, options));
217
+ /**
218
+ * A scoped lease on the page's capture, which starts at once, independently of its first frame.
219
+ *
220
+ * @stability stable
221
+ * @category constructors
222
+ * @since 0.3.0
223
+ */
224
+ const capture = Function.dual((args) => isPage(args[0]), (page, options) => functionsOf(page).capture(options));
225
+ /**
226
+ * The page's screencast frames painted within the browser's `frameHistory` of the newest, oldest first.
227
+ *
228
+ * @stability stable
229
+ * @category combinators
230
+ * @since 0.3.0
231
+ */
232
+ const recent = (page) => functionsOf(page).recentFrames;
233
+ /**
234
+ * Paint the page at `scale` device pixels to each CSS pixel, or without its scrollbars, for a
235
+ * scope: a frame with `scale: "device"` then has that many more pixels, while the layout, its
236
+ * boxes and input keep their CSS pixels. Scrollbars go from the next document on, and come back
237
+ * from the next after the scope, so paint, then load the page, then measure it. One at a time. A
238
+ * browser this library launched paints at the scale of its launch (Chromium's
239
+ * `deviceScaleFactor`), and refuses another.
240
+ *
241
+ * @stability stable
242
+ * @category combinators
243
+ * @since 0.3.0
244
+ */
245
+ const paint = Function.dual(2, (page, options) => functionsOf(page).paint(options));
128
246
  //#endregion
129
- export { BrowserPaint, CaptureStats, Frame, Image, Screenshot, sameCapture, Frame_exports as t };
247
+ export { BrowserPaint, CaptureStats, Frame, Image, Region, Screenshot, Zoom, capture, paint, read, recent, sameCapture, Frame_exports as t, zoom };
130
248
 
131
249
  //# sourceMappingURL=Frame.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Frame.mjs","names":[],"sources":["../src/Frame.ts"],"sourcesContent":["/**\n * Pictures of a page: screenshots, and screencast frames stamped with the browser's clock.\n *\n * @since 0.3.0\n */\nimport { Schema } from \"effect\";\n\n/** An encoded picture with its pixel dimensions. Crops also need their viewport origin. */\nexport class Image extends Schema.Class<Image>(\"effect-browser/Image\")({\n data: Schema.Uint8Array,\n mediaType: Schema.Literals([\"image/jpeg\", \"image/png\"]),\n width: Schema.Finite,\n height: Schema.Finite,\n}) {}\n\nconst Nonnegative = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));\nconst Count = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));\n\n/** Native CDP paint time mapped to the owning host clock, with transport uncertainty retained. */\nexport class BrowserPaint extends Schema.TaggedClass<BrowserPaint>()(\"BrowserPaint\", {\n timestamp: Schema.Finite,\n hostTime: Schema.Finite,\n uncertaintyMillis: Nonnegative,\n}) {}\n\n/** A screenshot's host capture interval; it has no native browser paint timestamp. */\nexport class Screenshot extends Schema.TaggedClass<Screenshot>()(\"Screenshot\", {\n hostTime: Schema.Finite,\n uncertaintyMillis: Nonnegative,\n}) {}\n\n/**\n * An image and its timing evidence. Paint time and screenshot capture time cannot be confused in\n * serialized data. `receivedAt` records delivery on the owning host's monotonic clock; it does\n * not make an old paint current.\n */\nexport class Frame extends Schema.Class<Frame>(\"effect-browser/Frame\")({\n page: Schema.String,\n /** The page's browser session: its provider's session id, as `Browser.Service.id` gives it. */\n session: Schema.String,\n /** Owning Browser connection; document counters restart on adoption or reattachment. */\n connection: Schema.String.check(Schema.isNonEmpty()),\n /** Native capture identity. Screenshots have no capture generation or sequence. */\n capture: Schema.optionalKey(Schema.Struct({ generation: Count, sequence: Count })),\n data: Schema.Uint8Array,\n timing: Schema.Union([BrowserPaint, Screenshot]),\n receivedAt: Schema.Finite,\n width: Schema.Finite,\n height: Schema.Finite,\n /**\n * The page's document committed before the frame arrived, as `Navigated` counts them. Just\n * after a commit a browser can still show the old document's paint, so a frame may show the\n * document before its own, never one after it.\n */\n document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n /** The page's address when the frame arrived. */\n url: Schema.String,\n}) {\n get timestamp(): number | undefined {\n return this.timing._tag === \"BrowserPaint\" ? this.timing.timestamp : undefined;\n }\n\n get hostTime(): number {\n return this.timing.hostTime;\n }\n\n get image(): Image {\n return new Image({\n data: this.data,\n mediaType: \"image/jpeg\",\n width: this.width,\n height: this.height,\n });\n }\n}\n\n/** Equal capture lineage survives an image copy; untagged pictures retain object identity only. */\nexport const sameCapture = (frame: Frame, other: Frame | undefined): boolean =>\n other !== undefined &&\n (frame === other ||\n (frame.capture !== undefined &&\n frame.page === other.page &&\n frame.session === other.session &&\n frame.connection === other.connection &&\n frame.document === other.document &&\n frame.capture.generation === other.capture?.generation &&\n frame.capture.sequence === other.capture?.sequence));\n\n/**\n * A page's capture counts, over its life or a window of the latest minute: what Chromium sent,\n * what readers got, and why the rest went no further. Frames that came late are counted apart from\n * those a reader lost.\n */\nexport class CaptureStats extends Schema.Class<CaptureStats>(\"effect-browser/CaptureStats\")({\n received: Count,\n accepted: Count,\n /**\n * Frames Chromium finished encoding after a newer one, dropped rather than reordered. It encodes\n * several at once, so a busy machine makes more of them; none was a paint readers missed.\n */\n late: Count,\n missingTimestamp: Count,\n /**\n * Frames dropped for their size. Most are other captures' frames, which a clipped screenshot\n * draws into a screencast. The rest are the page's own frames of a new size, dropped while still\n * unconfirmed: when another size replaced it, when its capture stopped, or beyond the 16 held.\n */\n foreignSize: Count,\n /**\n * Frames discarded while native capture is paused for a library picture and its restoration.\n * A pause can produce no callbacks, so this count may remain zero even when pictures were taken.\n */\n duringPictures: Count,\n /**\n * Frames a reader missed by falling behind. Each reader counts its own, so with several readers\n * this can exceed the frames accepted.\n */\n lost: Count,\n /**\n * Acknowledgements of frames sent and not yet answered, now, whatever the window. Chromium sends\n * a frame only while few are unacknowledged, so a backlog means fewer frames.\n */\n ackBacklog: Count,\n /** Paint-time gaps between consecutive accepted frames. */\n gaps: Schema.Struct({\n count: Count,\n totalMillis: Nonnegative,\n minMillis: Schema.NullOr(Nonnegative),\n maxMillis: Schema.NullOr(Nonnegative),\n lastMillis: Schema.NullOr(Nonnegative),\n }),\n}) {}\n\n/**\n * Settings for a page's one native capture. Readers that join a running capture share its\n * settings: one without options accepts them, and one whose explicit options differ fails with\n * `InvalidRequest`.\n */\nexport interface ScreencastOptions {\n /** JPEG quality, 0 to 100. Defaults to 80. */\n readonly quality?: number | undefined;\n /** Frames are scaled down to fit this box. Defaults to the viewport in CSS pixels. */\n readonly size?: { readonly width: number; readonly height: number } | undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAQA,IAAa,QAAb,cAA2B,OAAO,MAAa,sBAAsB,CAAC,CAAC;CACrE,MAAM,OAAO;CACb,WAAW,OAAO,SAAS,CAAC,cAAc,WAAW,CAAC;CACtD,OAAO,OAAO;CACd,QAAQ,OAAO;AACjB,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAM,cAAc,OAAO,OAAO,MAAM,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,QAAQ,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;AAG/D,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAAC,gBAAgB;CACnF,WAAW,OAAO;CAClB,UAAU,OAAO;CACjB,mBAAmB;AACrB,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,aAAb,cAAgC,OAAO,YAAwB,CAAC,CAAC,cAAc;CAC7E,UAAU,OAAO;CACjB,mBAAmB;AACrB,CAAC,CAAC,CAAC,CAAC;;;;;;AAOJ,IAAa,QAAb,cAA2B,OAAO,MAAa,sBAAsB,CAAC,CAAC;CACrE,MAAM,OAAO;;CAEb,SAAS,OAAO;;CAEhB,YAAY,OAAO,OAAO,MAAM,OAAO,WAAW,CAAC;;CAEnD,SAAS,OAAO,YAAY,OAAO,OAAO;EAAE,YAAY;EAAO,UAAU;CAAM,CAAC,CAAC;CACjF,MAAM,OAAO;CACb,QAAQ,OAAO,MAAM,CAAC,cAAc,UAAU,CAAC;CAC/C,YAAY,OAAO;CACnB,OAAO,OAAO;CACd,QAAQ,OAAO;;;;;;CAMf,UAAU,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;CAE3D,KAAK,OAAO;AACd,CAAC,CAAC,CAAC;CACD,IAAI,YAAgC;EAClC,OAAO,KAAK,OAAO,SAAS,iBAAiB,KAAK,OAAO,YAAY,KAAA;CACvE;CAEA,IAAI,WAAmB;EACrB,OAAO,KAAK,OAAO;CACrB;CAEA,IAAI,QAAe;EACjB,OAAO,IAAI,MAAM;GACf,MAAM,KAAK;GACX,WAAW;GACX,OAAO,KAAK;GACZ,QAAQ,KAAK;EACf,CAAC;CACH;AACF;;AAGA,MAAa,eAAe,OAAc,UACxC,UAAU,KAAA,MACT,UAAU,SACR,MAAM,YAAY,KAAA,KACjB,MAAM,SAAS,MAAM,QACrB,MAAM,YAAY,MAAM,WACxB,MAAM,eAAe,MAAM,cAC3B,MAAM,aAAa,MAAM,YACzB,MAAM,QAAQ,eAAe,MAAM,SAAS,cAC5C,MAAM,QAAQ,aAAa,MAAM,SAAS;;;;;;AAOhD,IAAa,eAAb,cAAkC,OAAO,MAAoB,6BAA6B,CAAC,CAAC;CAC1F,UAAU;CACV,UAAU;;;;;CAKV,MAAM;CACN,kBAAkB;;;;;;CAMlB,aAAa;;;;;CAKb,gBAAgB;;;;;CAKhB,MAAM;;;;;CAKN,YAAY;;CAEZ,MAAM,OAAO,OAAO;EAClB,OAAO;EACP,aAAa;EACb,WAAW,OAAO,OAAO,WAAW;EACpC,WAAW,OAAO,OAAO,WAAW;EACpC,YAAY,OAAO,OAAO,WAAW;CACvC,CAAC;AACH,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"Frame.mjs","names":[],"sources":["../src/Frame.ts"],"sourcesContent":["/**\n * Pictures of a page: its viewport as a frame of a stated age, crops of it, its screencast with\n * frames stamped by the browser's clock, and how it paints. Each function takes the page first.\n *\n * @stability stable\n * @since 0.3.0\n */\nimport { type Duration, type Effect, Function, type Scope, Schema, type Stream } from \"effect\";\n\nimport type { BrowserError } from \"./BrowserError.ts\";\nimport { functionsOf, isPage } from \"./internal/page/functions.ts\";\nimport type { Page } from \"./Page.ts\";\n\n/**\n * An encoded picture with its pixel dimensions. Crops also need their viewport origin.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class Image extends Schema.Class<Image>(\"effect-browser/Frame/Image\")({\n data: Schema.Uint8Array,\n mediaType: Schema.Literals([\"image/jpeg\", \"image/png\"]),\n width: Schema.Finite,\n height: Schema.Finite,\n}) {}\n\nconst Nonnegative = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));\nconst Count = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));\n\n/**\n * Native CDP paint time mapped to the owning host clock, with transport uncertainty retained.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class BrowserPaint extends Schema.TaggedClass<BrowserPaint>(\n \"effect-browser/Frame/BrowserPaint\",\n)(\"BrowserPaint\", {\n timestamp: Schema.Finite,\n hostTime: Schema.Finite,\n uncertaintyMillis: Nonnegative,\n}) {}\n\n/**\n * A screenshot's host capture interval; it has no native browser paint timestamp.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class Screenshot extends Schema.TaggedClass<Screenshot>(\"effect-browser/Frame/Screenshot\")(\n \"Screenshot\",\n {\n hostTime: Schema.Finite,\n uncertaintyMillis: Nonnegative,\n },\n) {}\n\n/**\n * An image and its timing evidence. Paint time and screenshot capture time cannot be confused in\n * serialized data. `receivedAt` records delivery on the owning host's monotonic clock; it does\n * not make an old paint current.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class Frame extends Schema.Class<Frame>(\"effect-browser/Frame\")({\n page: Schema.String,\n /** The page's browser session: its provider's session id, as `Browser.Service.id` gives it. */\n session: Schema.String,\n /** Owning Browser connection; document counters restart on adoption or reattachment. */\n connection: Schema.String.check(Schema.isNonEmpty()),\n /** Native capture identity. Screenshots have no capture generation or sequence. */\n capture: Schema.optionalKey(Schema.Struct({ generation: Count, sequence: Count })),\n data: Schema.Uint8Array,\n /** The picture's type, when a new picture gave it; one without is a JPEG, as screencast frames are. */\n mediaType: Schema.optionalKey(Schema.Literals([\"image/jpeg\", \"image/png\"])),\n timing: Schema.Union([BrowserPaint, Screenshot]),\n receivedAt: Schema.Finite,\n width: Schema.Finite,\n height: Schema.Finite,\n /**\n * The page's document committed before the frame arrived, as `Navigated` counts them. Just\n * after a commit a browser can still show the old document's paint, so a frame may show the\n * document before its own, never one after it.\n */\n document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n /** The page's address when the frame arrived. */\n url: Schema.String,\n}) {\n get timestamp(): number | undefined {\n return this.timing._tag === \"BrowserPaint\" ? this.timing.timestamp : undefined;\n }\n\n get hostTime(): number {\n return this.timing.hostTime;\n }\n\n get image(): Image {\n return new Image({\n data: this.data,\n mediaType: this.mediaType ?? \"image/jpeg\",\n width: this.width,\n height: this.height,\n });\n }\n}\n\n/**\n * Equal capture lineage survives an image copy; untagged pictures retain object identity only.\n *\n * @stability stable\n * @category predicates\n * @since 0.3.0\n */\nexport const sameCapture = (frame: Frame, other: Frame | undefined): boolean =>\n other !== undefined &&\n (frame === other ||\n (frame.capture !== undefined &&\n frame.page === other.page &&\n frame.session === other.session &&\n frame.connection === other.connection &&\n frame.document === other.document &&\n frame.capture.generation === other.capture?.generation &&\n frame.capture.sequence === other.capture?.sequence));\n\n/**\n * A page's capture counts, over its life or a window of the latest minute: what Chromium sent,\n * what readers got, and why the rest went no further. Frames that came late are counted apart from\n * those a reader lost.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class CaptureStats extends Schema.Class<CaptureStats>(\"effect-browser/Frame/CaptureStats\")({\n received: Count,\n accepted: Count,\n /**\n * Frames Chromium finished encoding after a newer one, dropped rather than reordered. It encodes\n * several at once, so a busy machine makes more of them; none was a paint readers missed.\n */\n late: Count,\n missingTimestamp: Count,\n /**\n * Frames dropped for their size. Most are other captures' frames, which a clipped screenshot\n * draws into a screencast. The rest are the page's own frames of a new size, dropped while still\n * unconfirmed: when another size replaced it, when its capture stopped, or beyond the 16 held.\n */\n foreignSize: Count,\n /**\n * Frames discarded while native capture is paused for a library picture and its restoration.\n * A pause can produce no callbacks, so this count may remain zero even when pictures were taken.\n */\n duringPictures: Count,\n /**\n * Frames a reader missed by falling behind. Each reader counts its own, so with several readers\n * this can exceed the frames accepted.\n */\n lost: Count,\n /**\n * Acknowledgements of frames sent and not yet answered, now, whatever the window. Chromium sends\n * a frame only while few are unacknowledged, so a backlog means fewer frames.\n */\n ackBacklog: Count,\n /** Paint-time gaps between consecutive accepted frames. */\n gaps: Schema.Struct({\n count: Count,\n totalMillis: Nonnegative,\n minMillis: Schema.NullOr(Nonnegative),\n maxMillis: Schema.NullOr(Nonnegative),\n lastMillis: Schema.NullOr(Nonnegative),\n }),\n}) {}\n\n/**\n * Settings for a page's one native capture. Readers that join a running capture share its\n * settings: one without options accepts them, and one whose explicit options differ fails with\n * `InvalidRequest`.\n *\n * @stability stable\n * @category options\n * @since 0.3.0\n */\nexport interface ScreencastOptions {\n /** JPEG quality, 0 to 100. Defaults to 80. */\n readonly quality?: number | undefined;\n /** Frames are scaled down to fit this box. Defaults to the viewport in CSS pixels. */\n readonly size?: { readonly width: number; readonly height: number } | undefined;\n}\n\n/**\n * An integer rectangle in viewport CSS pixels.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class Region extends Schema.Class<Region>(\"effect-browser/Frame/Region\")({\n x: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n y: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n width: Schema.Int.check(Schema.isGreaterThan(0)),\n height: Schema.Int.check(Schema.isGreaterThan(0)),\n}) {}\n\n/**\n * A crop and its viewport origin: add that origin to a point read from the crop.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class Zoom extends Schema.Class<Zoom>(\"effect-browser/Frame/Zoom\")({\n page: Schema.String,\n region: Region,\n image: Image,\n}) {}\n\n/**\n * How current a picture must be, and how a new one is taken. The newest screencast frame serves\n * when it qualifies, at no cost; otherwise a new screenshot is taken.\n *\n * @stability stable\n * @category options\n * @since 0.3.0\n */\nexport interface FrameOptions {\n /**\n * The oldest a reused frame may be, from its paint, at the earliest its timing allows, to now.\n * Defaults to 250 milliseconds; 0 always takes a new screenshot.\n */\n readonly maxAge?: Duration.Input | undefined;\n /**\n * `\"input\"`: reuse only a frame painted after this page's latest input, including input of an\n * interrupted action, and never while an action is changing the page. For a caller that has\n * just acted on the page, so that it sees what its action did.\n */\n readonly after?: \"input\" | undefined;\n /** JPEG quality of a new picture, 0 to 100. Defaults to 80. */\n readonly quality?: number | undefined;\n /** `\"jpeg\"`, the default, or `\"png\"`, which is always a new picture. */\n readonly format?: \"jpeg\" | \"png\" | undefined;\n /**\n * `\"css\"`, the default, a picture pixel per CSS pixel; `\"device\"`, the screen's own pixels, as\n * many to a CSS pixel as its device scale factor, which is always a new picture.\n */\n readonly scale?: \"css\" | \"device\" | undefined;\n}\n\n/**\n * How a page paints for a scope; see `paint`.\n *\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport interface Paint {\n /** Device pixels to each CSS pixel, more than 0 and at most 4. The layout keeps its size. */\n readonly scale?: number | undefined;\n /** False hides the page's scrollbars from its next document on, and its layout takes their room. */\n readonly scrollbars?: boolean | undefined;\n}\n\n/**\n * Scoped access to one page's shared capture and its current-document evidence.\n *\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport interface Capture {\n /**\n * Screencast frames for as long as the stream runs. Concurrent streams share one screencast and\n * its settings; explicit options that differ from a running screencast's fail with\n * InvalidRequest.\n */\n readonly stream: Stream.Stream<Frame, BrowserError>;\n readonly current: Frame | undefined;\n readonly isCurrent: (frame: Frame) => boolean;\n readonly confirm: (frame: Frame) => Effect.Effect<boolean, BrowserError>;\n readonly sync: Effect.Effect<void, BrowserError>;\n /**\n * What this page's captures received, delivered and dropped, over its life or the latest\n * `window`, which reaches back at most a minute; a longer one is an `InvalidRequest`. It reads\n * the page's counts, so it serves after the lease's scope has closed.\n */\n readonly stats: (options?: {\n readonly window?: Duration.Input | undefined;\n }) => Effect.Effect<CaptureStats, BrowserError>;\n}\n\n/**\n * The viewport with its timing: the newest screencast frame if it qualifies, else a new\n * screenshot timed by the host interval in which it was taken. A frame of a stated age that the\n * screencast has costs nothing and waits for no action; one that must follow the latest input, or\n * a new screenshot, waits for the action in flight.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const read: {\n (options?: FrameOptions): (page: Page) => Effect.Effect<Frame, BrowserError>;\n (page: Page, options?: FrameOptions): Effect.Effect<Frame, BrowserError>;\n} = Function.dual(\n (args) => isPage(args[0]),\n (page: Page, options?: FrameOptions) => functionsOf(page).frame(options),\n);\n\n/**\n * A crop in CSS pixels, unmagnified, with the origin that keeps later input in viewport pixels.\n * A crop is always a new picture; with `scale: \"device\"` it has the screen's own pixels.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const zoom: {\n (\n region: Region,\n options?: Pick<FrameOptions, \"quality\" | \"format\" | \"scale\">,\n ): (page: Page) => Effect.Effect<Zoom, BrowserError>;\n (\n page: Page,\n region: Region,\n options?: Pick<FrameOptions, \"quality\" | \"format\" | \"scale\">,\n ): Effect.Effect<Zoom, BrowserError>;\n} = Function.dual(\n (args) => isPage(args[0]),\n (page: Page, region: Region, options?: Pick<FrameOptions, \"quality\" | \"format\" | \"scale\">) =>\n functionsOf(page).zoom(region, options),\n);\n\n/**\n * A scoped lease on the page's capture, which starts at once, independently of its first frame.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const capture: {\n (options?: ScreencastOptions): (page: Page) => Effect.Effect<Capture, BrowserError, Scope.Scope>;\n (page: Page, options?: ScreencastOptions): Effect.Effect<Capture, BrowserError, Scope.Scope>;\n} = Function.dual(\n (args) => isPage(args[0]),\n (page: Page, options?: ScreencastOptions) => functionsOf(page).capture(options),\n);\n\n/**\n * The page's screencast frames painted within the browser's `frameHistory` of the newest, oldest first.\n *\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\nexport const recent = (page: Page): Effect.Effect<ReadonlyArray<Frame>> =>\n functionsOf(page).recentFrames;\n\n/**\n * Paint the page at `scale` device pixels to each CSS pixel, or without its scrollbars, for a\n * scope: a frame with `scale: \"device\"` then has that many more pixels, while the layout, its\n * boxes and input keep their CSS pixels. Scrollbars go from the next document on, and come back\n * from the next after the scope, so paint, then load the page, then measure it. One at a time. A\n * browser this library launched paints at the scale of its launch (Chromium's\n * `deviceScaleFactor`), and refuses another.\n *\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\nexport const paint: {\n (options: Paint): (page: Page) => Effect.Effect<void, BrowserError, Scope.Scope>;\n (page: Page, options: Paint): Effect.Effect<void, BrowserError, Scope.Scope>;\n} = Function.dual(2, (page: Page, options: Paint) => functionsOf(page).paint(options));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,IAAa,QAAb,cAA2B,OAAO,MAAa,4BAA4B,CAAC,CAAC;CAC3E,MAAM,OAAO;CACb,WAAW,OAAO,SAAS,CAAC,cAAc,WAAW,CAAC;CACtD,OAAO,OAAO;CACd,QAAQ,OAAO;AACjB,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAM,cAAc,OAAO,OAAO,MAAM,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,QAAQ,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;;;;;;;AAS/D,IAAa,eAAb,cAAkC,OAAO,YACvC,mCACF,CAAC,CAAC,gBAAgB;CAChB,WAAW,OAAO;CAClB,UAAU,OAAO;CACjB,mBAAmB;AACrB,CAAC,CAAC,CAAC,CAAC;;;;;;;;AASJ,IAAa,aAAb,cAAgC,OAAO,YAAwB,iCAAiC,CAAC,CAC/F,cACA;CACE,UAAU,OAAO;CACjB,mBAAmB;AACrB,CACF,CAAC,CAAC,CAAC;;;;;;;;;;AAWH,IAAa,QAAb,cAA2B,OAAO,MAAa,sBAAsB,CAAC,CAAC;CACrE,MAAM,OAAO;;CAEb,SAAS,OAAO;;CAEhB,YAAY,OAAO,OAAO,MAAM,OAAO,WAAW,CAAC;;CAEnD,SAAS,OAAO,YAAY,OAAO,OAAO;EAAE,YAAY;EAAO,UAAU;CAAM,CAAC,CAAC;CACjF,MAAM,OAAO;;CAEb,WAAW,OAAO,YAAY,OAAO,SAAS,CAAC,cAAc,WAAW,CAAC,CAAC;CAC1E,QAAQ,OAAO,MAAM,CAAC,cAAc,UAAU,CAAC;CAC/C,YAAY,OAAO;CACnB,OAAO,OAAO;CACd,QAAQ,OAAO;;;;;;CAMf,UAAU,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;CAE3D,KAAK,OAAO;AACd,CAAC,CAAC,CAAC;CACD,IAAI,YAAgC;EAClC,OAAO,KAAK,OAAO,SAAS,iBAAiB,KAAK,OAAO,YAAY,KAAA;CACvE;CAEA,IAAI,WAAmB;EACrB,OAAO,KAAK,OAAO;CACrB;CAEA,IAAI,QAAe;EACjB,OAAO,IAAI,MAAM;GACf,MAAM,KAAK;GACX,WAAW,KAAK,aAAa;GAC7B,OAAO,KAAK;GACZ,QAAQ,KAAK;EACf,CAAC;CACH;AACF;;;;;;;;AASA,MAAa,eAAe,OAAc,UACxC,UAAU,KAAA,MACT,UAAU,SACR,MAAM,YAAY,KAAA,KACjB,MAAM,SAAS,MAAM,QACrB,MAAM,YAAY,MAAM,WACxB,MAAM,eAAe,MAAM,cAC3B,MAAM,aAAa,MAAM,YACzB,MAAM,QAAQ,eAAe,MAAM,SAAS,cAC5C,MAAM,QAAQ,aAAa,MAAM,SAAS;;;;;;;;;;AAWhD,IAAa,eAAb,cAAkC,OAAO,MAAoB,mCAAmC,CAAC,CAAC;CAChG,UAAU;CACV,UAAU;;;;;CAKV,MAAM;CACN,kBAAkB;;;;;;CAMlB,aAAa;;;;;CAKb,gBAAgB;;;;;CAKhB,MAAM;;;;;CAKN,YAAY;;CAEZ,MAAM,OAAO,OAAO;EAClB,OAAO;EACP,aAAa;EACb,WAAW,OAAO,OAAO,WAAW;EACpC,WAAW,OAAO,OAAO,WAAW;EACpC,YAAY,OAAO,OAAO,WAAW;CACvC,CAAC;AACH,CAAC,CAAC,CAAC,CAAC;;;;;;;;AAyBJ,IAAa,SAAb,cAA4B,OAAO,MAAc,6BAA6B,CAAC,CAAC;CAC9E,GAAG,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;CACpD,GAAG,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;CACpD,OAAO,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC;CAC/C,QAAQ,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC;AAClD,CAAC,CAAC,CAAC,CAAC;;;;;;;;AASJ,IAAa,OAAb,cAA0B,OAAO,MAAY,2BAA2B,CAAC,CAAC;CACxE,MAAM,OAAO;CACb,QAAQ;CACR,OAAO;AACT,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;AAqFJ,MAAa,OAGT,SAAS,MACV,SAAS,OAAO,KAAK,EAAE,IACvB,MAAY,YAA2B,YAAY,IAAI,CAAC,CAAC,MAAM,OAAO,CACzE;;;;;;;;;AAUA,MAAa,OAUT,SAAS,MACV,SAAS,OAAO,KAAK,EAAE,IACvB,MAAY,QAAgB,YAC3B,YAAY,IAAI,CAAC,CAAC,KAAK,QAAQ,OAAO,CAC1C;;;;;;;;AASA,MAAa,UAGT,SAAS,MACV,SAAS,OAAO,KAAK,EAAE,IACvB,MAAY,YAAgC,YAAY,IAAI,CAAC,CAAC,QAAQ,OAAO,CAChF;;;;;;;;AASA,MAAa,UAAU,SACrB,YAAY,IAAI,CAAC,CAAC;;;;;;;;;;;;;AAcpB,MAAa,QAGT,SAAS,KAAK,IAAI,MAAY,YAAmB,YAAY,IAAI,CAAC,CAAC,MAAM,OAAO,CAAC"}
@@ -0,0 +1,153 @@
1
+ import { t as BrowserError } from "./internal/BrowserError-CsuRYcDX.mjs";
2
+ import { n as ActionAnnounced } from "./internal/BrowserEvent-tGPYYf6R.mjs";
3
+ import { a as geometry_d_exports, i as Sample, n as Planner } from "./internal/geometry-Dhj_ztJs.mjs";
4
+ import { c as Point } from "./internal/Page-BfGxn7oN.mjs";
5
+ import { Context, Duration, Effect, MutableRef, Option } from "effect";
6
+ declare namespace InputStyle_d_exports {
7
+ export { Current, InputStyle, TypingEvent, WheelStep, eased, keyGap, maximumDurationMillis, pause, performed, plain, provide, validated };
8
+ }
9
+ /**
10
+ * @stability stable
11
+ * @category models
12
+ * @since 0.3.0
13
+ */
14
+ export interface TypingEvent {
15
+ /** From the start of the typing. */
16
+ readonly afterMillis: number;
17
+ readonly phase: "down" | "up" | "insert";
18
+ readonly key: string;
19
+ }
20
+ /**
21
+ * @stability stable
22
+ * @category models
23
+ * @since 0.3.0
24
+ */
25
+ export interface WheelStep {
26
+ readonly dx: number;
27
+ readonly dy: number;
28
+ /** From the first step. */
29
+ readonly afterMillis: number;
30
+ }
31
+ /**
32
+ * @stability stable
33
+ * @category models
34
+ * @since 0.3.0
35
+ */
36
+ export interface InputStyle {
37
+ /** Own presentation only after policy allows input; wait options belong to the page. */
38
+ readonly withInput?: ((options: {
39
+ readonly operation: string;
40
+ readonly wait: Duration.Duration;
41
+ readonly failFast: boolean;
42
+ }) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E | BrowserError, R>) | undefined;
43
+ /**
44
+ * Wait for this once an action has announced its target, before its pointer travels there. It
45
+ * holds the page's turn and spends the action's deadline, which bounds it; the target is not
46
+ * found again after it.
47
+ */
48
+ readonly lead?: ((announced: ActionAnnounced) => Effect.Effect<void>) | undefined;
49
+ /**
50
+ * Whether viewers watch the input: then the pointer clicks into a field before typing, finds
51
+ * what lies under it as it scrolls, and scrolls to a target out of view with the wheel.
52
+ */
53
+ readonly shown: boolean;
54
+ /** Where viewers last saw the pointer, which the next glide starts from; else the page's own. */
55
+ readonly pointer: MutableRef.MutableRef<Option.Option<Point>> | undefined;
56
+ /** The pointer's path to `to`, ending exactly there. */
57
+ readonly glide: (from: Point, to: Point, dragging: boolean) => Effect.Effect<ReadonlyArray<Sample>>;
58
+ /** How long a button stays down when a click does not say. */
59
+ readonly hold: Effect.Effect<number, BrowserError>;
60
+ /** The key events that type `text`, or one insertion of it under a guard, timed from the start. */
61
+ readonly typing: (text: string, guarded: boolean) => Effect.Effect<ReadonlyArray<TypingEvent>, BrowserError>;
62
+ /** The pause between repeated presses of the same keys. */
63
+ readonly keyGap: Effect.Effect<number, BrowserError>;
64
+ /** A wheel scroll as the wheel turns: in one step, or in notches and bursts. */
65
+ readonly wheel: (dx: number, dy: number) => Effect.Effect<ReadonlyArray<WheelStep>, BrowserError>;
66
+ }
67
+ /**
68
+ * Each key as it comes, with no pause; a drag moves in eight short steps so its target sees it.
69
+ *
70
+ * @stability stable
71
+ * @category constants
72
+ * @since 0.3.0
73
+ */
74
+ export declare const plain: InputStyle;
75
+ /**
76
+ * A pause around `median`, as the research measured reactions: at most four times it.
77
+ *
78
+ * @stability stable
79
+ * @category constructors
80
+ * @since 0.3.0
81
+ */
82
+ export declare const pause: (median: number, sigma: number) => Effect.Effect<number, never, never>;
83
+ /**
84
+ * Plan the whole text before any key goes, so holds overlap without waiting on the network. A
85
+ * physical key is never held twice, as with A and a, or ! and 1. The first key waits for the hand
86
+ * to reach the keys, each later one follows the last by a gap drawn around `gap`, and a word's
87
+ * first key comes 60 ms later.
88
+ *
89
+ * @stability stable
90
+ * @category constants
91
+ * @since 0.3.0
92
+ */
93
+ export declare const maximumDurationMillis = 10000;
94
+ /**
95
+ * Copy and validate custom schedules before their first input; planning uses the action bound.
96
+ *
97
+ * @stability stable
98
+ * @category combinators
99
+ * @since 0.3.0
100
+ */
101
+ export declare const validated: (style: InputStyle) => InputStyle;
102
+ /**
103
+ * A word is five characters; the gap leaves room for each word's later start.
104
+ *
105
+ * @stability stable
106
+ * @category constructors
107
+ * @since 0.3.0
108
+ */
109
+ export declare const keyGap: (wordsPerMinute: number) => number;
110
+ /**
111
+ * A wheel that eases over `duration`: a step each frame, sixty a second, slow at first and last,
112
+ * so a scroll that viewers watch glides to where it goes. A style takes it as its `wheel`; a film
113
+ * scrolls on its own time instead.
114
+ *
115
+ * @stability stable
116
+ * @category constructors
117
+ * @since 0.3.0
118
+ */
119
+ export declare const eased: (duration: Duration.Input) => InputStyle["wheel"];
120
+ /**
121
+ * Input performed for viewers, with this pointer and pace.
122
+ *
123
+ * @stability stable
124
+ * @category constructors
125
+ * @since 0.3.0
126
+ */
127
+ export declare const performed: (options: {
128
+ readonly pointer: MutableRef.MutableRef<Option.Option<Point>>;
129
+ readonly motion: Planner;
130
+ readonly wordsPerMinute: number;
131
+ }) => InputStyle;
132
+ /**
133
+ * Input style in this fiber; plain input is the default.
134
+ *
135
+ * @stability stable
136
+ * @category services
137
+ * @since 0.3.0
138
+ */
139
+ export declare const Current: Context.Reference<InputStyle>;
140
+ /**
141
+ * Apply a style through page input, including pages selected later by a browser adapter.
142
+ *
143
+ * @stability stable
144
+ * @category combinators
145
+ * @since 0.3.0
146
+ */
147
+ export declare const provide: {
148
+ (style: InputStyle): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
149
+ <A, E, R>(effect: Effect.Effect<A, E, R>, style: InputStyle): Effect.Effect<A, E, R>;
150
+ };
151
+ //#endregion
152
+ export { InputStyle_d_exports as t };
153
+ //# sourceMappingURL=InputStyle.d.mts.map
@@ -0,0 +1,2 @@
1
+ import { a as maximumDurationMillis, c as plain, i as keyGap, l as provide, o as pause, r as eased, s as performed, t as Current, u as validated } from "./internal/InputStyle-CPzxoN4g.mjs";
2
+ export { Current, eased, keyGap, maximumDurationMillis, pause, performed, plain, provide, validated };
@@ -0,0 +1,2 @@
1
+ import { G as Picks, H as Layout, J as Word, K as Place, W as Pick, X as place, Y as measure, Z as rehearse, q as Rehearsal } from "./internal/Page-BfGxn7oN.mjs";
2
+ export { Layout, Pick, Picks, Place, Rehearsal, Word, measure, place, rehearse };