effect-browser 0.3.0-beta.24 → 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.
- package/README.md +333 -157
- package/dist/Action.d.mts +1 -1
- package/dist/Action.mjs +61 -9
- package/dist/Action.mjs.map +1 -1
- package/dist/Browser.d.mts +2 -2
- package/dist/Browser.mjs +2 -2
- package/dist/BrowserError.d.mts +2 -2
- package/dist/BrowserError.mjs +194 -41
- package/dist/BrowserError.mjs.map +1 -1
- package/dist/BrowserEvent.d.mts +1 -1
- package/dist/BrowserEvent.mjs +166 -35
- package/dist/BrowserEvent.mjs.map +1 -1
- package/dist/Cdp.d.mts +15 -0
- package/dist/Cdp.mjs +22 -0
- package/dist/Cdp.mjs.map +1 -0
- package/dist/Change.d.mts +2 -2
- package/dist/Change.mjs +33 -6
- package/dist/Change.mjs.map +1 -1
- package/dist/Frame.d.mts +2 -2
- package/dist/Frame.mjs +132 -14
- package/dist/Frame.mjs.map +1 -1
- package/dist/{Style.d.mts → InputStyle.d.mts} +93 -25
- package/dist/{Style.mjs → InputStyle.mjs} +1 -1
- package/dist/Layout.d.mts +2 -2
- package/dist/Layout.mjs +58 -16
- package/dist/Layout.mjs.map +1 -1
- package/dist/Overlay.d.mts +2 -2
- package/dist/Overlay.mjs +33 -5
- package/dist/Overlay.mjs.map +1 -1
- package/dist/Page.d.mts +2 -2
- package/dist/Page.mjs +2 -2
- package/dist/PageTime.d.mts +2 -2
- package/dist/PageTime.mjs +13 -3
- package/dist/PageTime.mjs.map +1 -1
- package/dist/Pose.d.mts +2 -2
- package/dist/Pose.mjs +30 -9
- package/dist/Pose.mjs.map +1 -1
- package/dist/Site.d.mts +288 -18
- package/dist/Site.mjs +11 -3
- package/dist/Site.mjs.map +1 -1
- package/dist/Snapshot.d.mts +2 -2
- package/dist/Snapshot.mjs +87 -6
- package/dist/Snapshot.mjs.map +1 -1
- package/dist/Text.d.mts +2 -0
- package/dist/Text.mjs +45 -0
- package/dist/Text.mjs.map +1 -0
- package/dist/Window.d.mts +2 -2
- package/dist/Window.mjs +31 -6
- package/dist/Window.mjs.map +1 -1
- package/dist/ai/BrowserTools.d.mts +4987 -0
- package/dist/ai/BrowserTools.mjs +3 -0
- package/dist/ai/PageControl.d.mts +286 -0
- package/dist/ai/PageControl.mjs +426 -0
- package/dist/ai/PageControl.mjs.map +1 -0
- package/dist/ai/PromptCache.d.mts +16 -0
- package/dist/ai/PromptCache.mjs +72 -0
- package/dist/ai/PromptCache.mjs.map +1 -0
- package/dist/ai/Tabs.d.mts +2 -0
- package/dist/ai/Tabs.mjs +72 -0
- package/dist/ai/Tabs.mjs.map +1 -0
- package/dist/ai/ToolError.d.mts +34 -0
- package/dist/ai/ToolError.mjs +2 -0
- package/dist/ai/index.d.mts +6 -0
- package/dist/ai/index.mjs +6 -0
- package/dist/index.d.mts +7 -18
- package/dist/index.mjs +6 -9
- package/dist/{Action-24sLOubi.d.mts → internal/Action-CkanNTUw.d.mts} +64 -4
- package/dist/{Browser-DGR6ZEYo.d.mts → internal/Browser-DD9Vm1c-.d.mts} +75 -11
- package/dist/{Browser-CAQFhTkM.mjs → internal/Browser-vzD7i2oj.mjs} +174 -237
- package/dist/internal/Browser-vzD7i2oj.mjs.map +1 -0
- package/dist/{BrowserError-BlcmLVzn.d.mts → internal/BrowserError-CsuRYcDX.d.mts} +187 -28
- package/dist/{BrowserEvent-C2p-NwuU.d.mts → internal/BrowserEvent-tGPYYf6R.d.mts} +168 -13
- package/dist/internal/BrowserTools-Yi3lOX4h.mjs +497 -0
- package/dist/internal/BrowserTools-Yi3lOX4h.mjs.map +1 -0
- package/dist/{Style-T3ezDYLI.mjs → internal/InputStyle-CPzxoN4g.mjs} +75 -20
- package/dist/internal/InputStyle-CPzxoN4g.mjs.map +1 -0
- package/dist/{moment/Moment.mjs → internal/Moment-CstaX1mR.mjs} +49 -16
- package/dist/internal/Moment-CstaX1mR.mjs.map +1 -0
- package/dist/{moment/Moment.d.mts → internal/Moment-DOcldBdf.d.mts} +53 -20
- package/dist/internal/Page-BfGxn7oN.d.mts +1553 -0
- package/dist/{Page-BaAOshxo.mjs → internal/Page-DqF-tuTx.mjs} +62 -74
- package/dist/internal/Page-DqF-tuTx.mjs.map +1 -0
- package/dist/internal/Release-CFONkPDP.d.mts +39 -0
- package/dist/internal/Stage-D5ymSXDT.mjs +298 -0
- package/dist/internal/Stage-D5ymSXDT.mjs.map +1 -0
- package/dist/internal/Stillness-DCPeAN1a.mjs +1124 -0
- package/dist/internal/Stillness-DCPeAN1a.mjs.map +1 -0
- package/dist/internal/Supervisor-BcY_QNIY.d.mts +108 -0
- package/dist/internal/Supervisor-BcglY23c.mjs +531 -0
- package/dist/internal/Supervisor-BcglY23c.mjs.map +1 -0
- package/dist/internal/Tabs-dXMscIUQ.d.mts +52 -0
- package/dist/internal/TestPage-CYiYbh63.d.mts +159 -0
- package/dist/internal/ToolError-DArsRS2m.mjs +117 -0
- package/dist/internal/ToolError-DArsRS2m.mjs.map +1 -0
- package/dist/{plan/index.d.mts → internal/Walk-BNXcfZ2z.d.mts} +59 -35
- package/dist/{plan/index.mjs → internal/Walk-C5ky7uSf.mjs} +83 -51
- package/dist/internal/Walk-C5ky7uSf.mjs.map +1 -0
- package/dist/{ActionPort.mjs → internal/action-port-B5EkeGOR.mjs} +6 -12
- package/dist/internal/action-port-B5EkeGOR.mjs.map +1 -0
- package/dist/internal/cdp/workerd.d.mts +13 -0
- package/dist/internal/cdp/workerd.mjs +19 -0
- package/dist/internal/cdp/workerd.mjs.map +1 -0
- package/dist/{Clock.mjs → internal/clock-BKSAEf00.mjs} +13 -13
- package/dist/internal/clock-BKSAEf00.mjs.map +1 -0
- package/dist/{connection-Db-YtlbE.d.mts → internal/connection-BaB0vp1o.d.mts} +6 -6
- package/dist/{connection-C_jWYIwe.mjs → internal/connection-C2X4GmXM.mjs} +19 -15
- package/dist/internal/connection-C2X4GmXM.mjs.map +1 -0
- package/dist/internal/events-DzCrww-y.mjs +72 -0
- package/dist/internal/events-DzCrww-y.mjs.map +1 -0
- package/dist/internal/fold.inpage-uhrT-dOB.mjs +49 -0
- package/dist/internal/fold.inpage-uhrT-dOB.mjs.map +1 -0
- package/dist/internal/functions-jBOs6GKv.mjs +27 -0
- package/dist/internal/functions-jBOs6GKv.mjs.map +1 -0
- package/dist/{Geometry-DJx9qrYy.d.mts → internal/geometry-Dhj_ztJs.d.mts} +3 -3
- package/dist/{Geometry.mjs → internal/geometry-Lxyflb9J.mjs} +3 -12
- package/dist/internal/geometry-Lxyflb9J.mjs.map +1 -0
- package/dist/{Matching.mjs → internal/matching-Cs-UeOY0.mjs} +3 -3
- package/dist/internal/matching-Cs-UeOY0.mjs.map +1 -0
- package/dist/internal/page-DFQb-YOK.mjs +436 -0
- package/dist/internal/page-DFQb-YOK.mjs.map +1 -0
- package/dist/{pose.inpage-CLq7Mfdr.mjs → internal/pose.inpage-CBFeWcVa.mjs} +2 -48
- package/dist/internal/pose.inpage-CBFeWcVa.mjs.map +1 -0
- package/dist/{Url.mjs → internal/url-DB0pQYk6.mjs} +3 -12
- package/dist/internal/url-DB0pQYk6.mjs.map +1 -0
- package/dist/policy/Policy.d.mts +60 -6
- package/dist/policy/Policy.mjs +52 -9
- package/dist/policy/Policy.mjs.map +1 -1
- package/dist/policy/index.d.mts +2 -0
- package/dist/policy/index.mjs +2 -0
- package/dist/{film → presentation}/Film.d.mts +83 -16
- package/dist/{film → presentation}/Film.mjs +82 -30
- package/dist/presentation/Film.mjs.map +1 -0
- package/dist/presentation/Motion.d.mts +5 -1
- package/dist/presentation/Motion.mjs +16 -2
- package/dist/presentation/Motion.mjs.map +1 -1
- package/dist/presentation/Presentation.d.mts +42 -7
- package/dist/presentation/Presentation.mjs +26 -9
- package/dist/presentation/Presentation.mjs.map +1 -1
- package/dist/presentation/Stage.d.mts +40 -6
- package/dist/presentation/Stage.mjs +1 -262
- package/dist/presentation/index.d.mts +5 -0
- package/dist/presentation/index.mjs +5 -0
- package/dist/supervisor/Release.d.mts +2 -0
- package/dist/supervisor/Release.mjs +40 -0
- package/dist/supervisor/Release.mjs.map +1 -0
- package/dist/supervisor/Supervisor.d.mts +2 -104
- package/dist/supervisor/Supervisor.mjs +2 -515
- package/dist/supervisor/index.d.mts +3 -0
- package/dist/supervisor/index.mjs +3 -0
- package/dist/testing/HttpCassette.d.mts +98 -0
- package/dist/testing/HttpCassette.mjs +146 -0
- package/dist/testing/HttpCassette.mjs.map +1 -0
- package/dist/testing/Story.d.mts +31 -0
- package/dist/testing/Story.mjs +76 -0
- package/dist/testing/Story.mjs.map +1 -0
- package/dist/testing/TestBrowser.d.mts +191 -0
- package/dist/testing/TestBrowser.mjs +105 -0
- package/dist/testing/TestBrowser.mjs.map +1 -0
- package/dist/testing/TestModel.d.mts +133 -0
- package/dist/testing/TestModel.mjs +209 -0
- package/dist/testing/TestModel.mjs.map +1 -0
- package/dist/testing/TestPage.d.mts +2 -0
- package/dist/testing/TestPage.mjs +47 -0
- package/dist/testing/TestPage.mjs.map +1 -0
- package/dist/testing/index.d.mts +6 -311
- package/dist/testing/index.mjs +6 -521
- package/dist/timeline/Moment.d.mts +3 -0
- package/dist/timeline/Moment.mjs +3 -0
- package/dist/timeline/Stillness.d.mts +34 -0
- package/dist/timeline/Stillness.mjs +2 -0
- package/dist/timeline/index.d.mts +3 -0
- package/dist/timeline/index.mjs +3 -0
- package/dist/walk/Walk.d.mts +2 -0
- package/dist/walk/Walk.mjs +2 -0
- package/dist/walk/index.d.mts +2 -0
- package/dist/walk/index.mjs +2 -0
- package/package.json +54 -163
- package/src/Action.ts +73 -8
- package/src/Browser.ts +75 -9
- package/src/BrowserError.ts +258 -63
- package/src/BrowserEvent.ts +252 -55
- package/src/Cdp.ts +42 -0
- package/src/Change.ts +68 -3
- package/src/Frame.ts +247 -14
- package/src/{Style.ts → InputStyle.ts} +98 -22
- package/src/Layout.ts +95 -24
- package/src/Overlay.ts +42 -3
- package/src/Page.ts +144 -320
- package/src/PageTime.ts +29 -4
- package/src/Pose.ts +38 -7
- package/src/Site.ts +15 -3
- package/src/Snapshot.ts +179 -3
- package/src/Text.ts +60 -0
- package/src/Window.ts +53 -3
- package/src/ai/BrowserTools.ts +778 -0
- package/src/ai/PageControl.ts +702 -0
- package/src/ai/PromptCache.ts +87 -0
- package/src/ai/Tabs.ts +84 -0
- package/src/ai/ToolError.ts +50 -0
- package/src/ai/index.ts +36 -0
- package/src/ai/internal/crops.ts +38 -0
- package/src/ai/internal/points.ts +57 -0
- package/src/ai/internal/receipts.ts +107 -0
- package/src/index.ts +83 -6
- package/src/{ActionPort.ts → internal/action-port.ts} +3 -3
- package/src/{providers → internal/cdp}/connection.ts +19 -12
- package/src/internal/cdp/workerd.ts +36 -0
- package/src/{Clock.ts → internal/clock.ts} +20 -0
- package/src/internal/input/actions.ts +1 -1
- package/src/internal/input/dispatch.ts +2 -2
- package/src/internal/input/guard.inpage.ts +1 -1
- package/src/internal/input/guard.ts +1 -1
- package/src/internal/input/perform.ts +5 -5
- package/src/internal/input/pointer.ts +2 -2
- package/src/internal/input/targets.inpage.ts +3 -3
- package/src/{Matching.ts → internal/matching.ts} +6 -6
- package/src/internal/page/bridge.ts +2 -2
- package/src/internal/page/clock.inpage.ts +1 -1
- package/src/internal/page/compose.inpage.ts +2 -2
- package/src/internal/page/context.ts +2 -2
- package/src/internal/page/functions.ts +84 -0
- package/src/internal/page/navigation.ts +1 -1
- package/src/internal/page/openings.ts +2 -2
- package/src/internal/page/page.ts +33 -35
- package/src/internal/page/port.ts +14 -8
- package/src/internal/page/replies.ts +1 -1
- package/src/internal/page/requests.ts +1 -1
- package/src/internal/page/scripts.ts +1 -1
- package/src/internal/page/time.ts +1 -1
- package/src/internal/pictures/capture.ts +1 -4
- package/src/internal/pictures/dimensions.ts +1 -1
- package/src/internal/pictures/frame.ts +1 -1
- package/src/internal/pictures/pictures.ts +53 -61
- package/src/internal/reading/context.inpage.ts +2 -2
- package/src/internal/reading/expect.inpage.ts +1 -1
- package/src/internal/reading/layout.inpage.ts +3 -3
- package/src/internal/reading/layout.ts +5 -5
- package/src/internal/reading/outline.inpage.ts +3 -3
- package/src/internal/reading/reading.ts +11 -19
- package/src/internal/reading/ready.inpage.ts +2 -2
- package/src/internal/reading/ready.ts +3 -2
- package/src/internal/reading/subjects.inpage.ts +3 -3
- package/src/internal/reading/text.inpage.ts +2 -2
- package/src/internal/reading/walk.inpage.ts +1 -1
- package/src/internal/timeline/changes.inpage.ts +2 -2
- package/src/internal/timeline/changes.ts +3 -4
- package/src/internal/timeline/sight.inpage.ts +2 -2
- package/src/internal/timeline/window.ts +3 -4
- package/src/policy/Policy.ts +70 -16
- package/src/policy/index.ts +12 -0
- package/src/{film → presentation}/Film.ts +104 -37
- package/src/presentation/Motion.ts +45 -3
- package/src/presentation/Presentation.ts +47 -14
- package/src/presentation/Stage.ts +73 -35
- package/src/presentation/index.ts +30 -0
- package/src/presentation/{feed.ts → internal/feed.ts} +1 -1
- package/src/supervisor/Release.ts +45 -0
- package/src/supervisor/Supervisor.ts +80 -5
- package/src/supervisor/index.ts +18 -0
- package/src/supervisor/{contract.ts → internal/contract.ts} +14 -10
- package/src/supervisor/{lifecycle.ts → internal/lifecycle.ts} +7 -7
- package/src/supervisor/{runtime.ts → internal/runtime.ts} +7 -7
- package/src/testing/HttpCassette.ts +260 -0
- package/src/testing/Story.ts +103 -0
- package/src/testing/TestBrowser.ts +14 -4
- package/src/testing/TestModel.ts +297 -0
- package/src/testing/TestPage.ts +92 -4
- package/src/testing/index.ts +35 -1
- package/src/testing/{evidence.ts → internal/evidence.ts} +19 -11
- package/src/testing/{model.ts → internal/model.ts} +14 -8
- package/src/testing/{page.ts → internal/page.ts} +55 -56
- package/src/{moment → timeline}/Moment.ts +79 -29
- package/src/{stillness → timeline}/Stillness.ts +61 -43
- package/src/timeline/index.ts +18 -0
- package/src/{stillness/Pixels.ts → timeline/internal/pixels.ts} +2 -2
- package/src/{moment → timeline/internal}/words.ts +2 -2
- package/src/walk/Walk.ts +165 -0
- package/src/walk/index.ts +12 -0
- package/src/{plan → walk/internal}/choose.ts +23 -14
- package/src/{plan → walk/internal}/data.ts +37 -14
- package/src/{plan → walk/internal}/execute.ts +79 -36
- package/src/{plan → walk/internal}/record.ts +6 -6
- package/src/{plan → walk/internal}/targets.ts +35 -25
- package/dist/ActionPort.d.mts +0 -15
- package/dist/ActionPort.mjs.map +0 -1
- package/dist/Browser-CAQFhTkM.mjs.map +0 -1
- package/dist/Change-CxT1mp2e.d.mts +0 -80
- package/dist/Clock-Du5nP-nK.d.mts +0 -57
- package/dist/Clock.d.mts +0 -2
- package/dist/Clock.mjs.map +0 -1
- package/dist/Frame-UEH2hO5T.d.mts +0 -124
- package/dist/Geometry.d.mts +0 -2
- package/dist/Geometry.mjs.map +0 -1
- package/dist/Matching-MtcWZ_hA.d.mts +0 -266
- package/dist/Matching.d.mts +0 -2
- package/dist/Matching.mjs.map +0 -1
- package/dist/Overlay-CoGw5tL_.d.mts +0 -27
- package/dist/Page-BaAOshxo.mjs.map +0 -1
- package/dist/Page-CLzh5E9w.d.mts +0 -718
- package/dist/PageTime-68UPUZpZ.d.mts +0 -29
- package/dist/Pose-2qqGzPvb.d.mts +0 -32
- package/dist/Released-tURbFmal.d.mts +0 -15
- package/dist/Snapshot-CtBVOtuu.d.mts +0 -73
- package/dist/Stillness-BwP0RdI4.mjs +0 -157
- package/dist/Stillness-BwP0RdI4.mjs.map +0 -1
- package/dist/Style-T3ezDYLI.mjs.map +0 -1
- package/dist/Url-B7P-TWwL.d.mts +0 -26
- package/dist/Url.d.mts +0 -2
- package/dist/Url.mjs.map +0 -1
- package/dist/Window-BDa8MtNP.d.mts +0 -34
- package/dist/connection-C_jWYIwe.mjs.map +0 -1
- package/dist/film/Film.mjs.map +0 -1
- package/dist/moment/Moment.mjs.map +0 -1
- package/dist/plan/index.mjs.map +0 -1
- package/dist/pose.inpage-CLq7Mfdr.mjs.map +0 -1
- package/dist/presentation/Stage.mjs.map +0 -1
- package/dist/presentation/feed.d.mts +0 -20
- package/dist/presentation/feed.mjs +0 -18
- package/dist/presentation/feed.mjs.map +0 -1
- package/dist/providers/Cdp.d.mts +0 -9
- package/dist/providers/Cdp.mjs +0 -15
- package/dist/providers/Cdp.mjs.map +0 -1
- package/dist/providers/Chromium.d.mts +0 -32
- package/dist/providers/Chromium.mjs +0 -55
- package/dist/providers/Chromium.mjs.map +0 -1
- package/dist/providers/Released.d.mts +0 -2
- package/dist/providers/Released.mjs +0 -12
- package/dist/providers/Released.mjs.map +0 -1
- package/dist/stillness/Stillness.d.mts +0 -12
- package/dist/stillness/Stillness.mjs +0 -2
- package/dist/supervisor/Supervisor.mjs.map +0 -1
- package/dist/testing/index.mjs.map +0 -1
- package/dist/workerd/Cdp.d.mts +0 -8
- package/dist/workerd/Cdp.mjs +0 -13
- package/dist/workerd/Cdp.mjs.map +0 -1
- package/src/plan/index.ts +0 -36
- package/src/providers/Cdp.ts +0 -16
- package/src/providers/Chromium.ts +0 -99
- package/src/providers/Released.ts +0 -13
- package/src/workerd/Cdp.ts +0 -11
- /package/dist/{fold.inpage-CyVZQHZL.d.mts → internal/fold.inpage-CyVZQHZL.d.mts} +0 -0
- /package/dist/{rolldown-runtime-D7D4PA-g.mjs → internal/rolldown-runtime-D7D4PA-g.mjs} +0 -0
- /package/src/{Geometry.ts → internal/geometry.ts} +0 -0
- /package/src/{Url.ts → internal/url.ts} +0 -0
- /package/src/{stillness → timeline/internal}/utilsBundle.d.ts +0 -0
package/src/Page.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* One browser tab: navigation
|
|
2
|
+
* One browser tab: navigation and input.
|
|
3
|
+
*
|
|
4
|
+
* `Page` gains a member only for identity, order, time or input. Everything else a page does is a
|
|
5
|
+
* function in the module of what it returns, taking the page first, such as `Snapshot.read(page)`,
|
|
6
|
+
* `Text.read(page)` or `Change.read(page)`.
|
|
3
7
|
*
|
|
4
8
|
* A page waits only for itself: its operations take turns in one lane of its own. An action, which
|
|
5
9
|
* sends input or navigates, has the page to itself, in the order admitted after policy approval; reads share
|
|
@@ -13,9 +17,10 @@
|
|
|
13
17
|
* screenshot's pixels. Mouse and keyboard input share a bounded pipeline, so pacing does not wait
|
|
14
18
|
* for each protocol reply. Target lookup happens before the input is sent.
|
|
15
19
|
*
|
|
20
|
+
* @stability stable
|
|
16
21
|
* @since 0.3.0
|
|
17
22
|
*/
|
|
18
|
-
import { type Clock, type Duration, Effect,
|
|
23
|
+
import { type Clock, type Duration, Effect, Function, Schema } from "effect";
|
|
19
24
|
|
|
20
25
|
import {
|
|
21
26
|
Action,
|
|
@@ -26,42 +31,43 @@ import {
|
|
|
26
31
|
} from "./Action.ts";
|
|
27
32
|
import { type BrowserError, type PolicyDenied } from "./BrowserError.ts";
|
|
28
33
|
import { Box, type BrowserEvent, PageLoaded, Subject } from "./BrowserEvent.ts";
|
|
29
|
-
import
|
|
30
|
-
import { type CaptureStats, Frame, Image, type ScreencastOptions } from "./Frame.ts";
|
|
31
|
-
import * as Motion from "./Geometry.ts";
|
|
34
|
+
import * as Motion from "./internal/geometry.ts";
|
|
32
35
|
import { FormFieldSchema } from "./internal/input/evidence.inpage.ts";
|
|
33
36
|
import * as Guard from "./internal/input/guard.inpage.ts";
|
|
37
|
+
import {
|
|
38
|
+
type Implementation,
|
|
39
|
+
isPage as isLibraryPage,
|
|
40
|
+
type key,
|
|
41
|
+
} from "./internal/page/functions.ts";
|
|
34
42
|
import { Correlation, FailFast } from "./internal/page/lane.ts";
|
|
35
|
-
import
|
|
36
|
-
import type { Overlay } from "./Overlay.ts";
|
|
37
|
-
import type { Held } from "./PageTime.ts";
|
|
38
|
-
import type { Poses } from "./Pose.ts";
|
|
39
|
-
import { type Snapshot, type SnapshotOptions } from "./Snapshot.ts";
|
|
40
|
-
import * as Url from "./Url.ts";
|
|
41
|
-
import type { Window } from "./Window.ts";
|
|
43
|
+
import * as Url from "./internal/url.ts";
|
|
42
44
|
|
|
45
|
+
/**
|
|
46
|
+
* @stability stable
|
|
47
|
+
* @category models
|
|
48
|
+
* @since 0.3.0
|
|
49
|
+
*/
|
|
43
50
|
export type Point = Motion.Point;
|
|
44
51
|
|
|
45
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* A ref from a snapshot, such as `"e12"`, or a viewport point.
|
|
54
|
+
*
|
|
55
|
+
* @stability stable
|
|
56
|
+
* @category models
|
|
57
|
+
* @since 0.3.0
|
|
58
|
+
*/
|
|
46
59
|
export type Target = string | Point;
|
|
47
60
|
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
page: Schema.String,
|
|
59
|
-
region: Region,
|
|
60
|
-
image: Image,
|
|
61
|
-
}) {}
|
|
62
|
-
|
|
63
|
-
/** The target as it read before input. Point coordinates are never snapped to another position. */
|
|
64
|
-
export class ResolvedTarget extends Schema.Class<ResolvedTarget>("effect-browser/ResolvedTarget")({
|
|
61
|
+
/**
|
|
62
|
+
* The target as it read before input. Point coordinates are never snapped to another position.
|
|
63
|
+
*
|
|
64
|
+
* @stability stable
|
|
65
|
+
* @category schemas
|
|
66
|
+
* @since 0.3.0
|
|
67
|
+
*/
|
|
68
|
+
export class ResolvedTarget extends Schema.Class<ResolvedTarget>(
|
|
69
|
+
"effect-browser/Page/ResolvedTarget",
|
|
70
|
+
)({
|
|
65
71
|
point: Motion.Point,
|
|
66
72
|
...Subject.fields,
|
|
67
73
|
element: Schema.String,
|
|
@@ -71,178 +77,56 @@ export class ResolvedTarget extends Schema.Class<ResolvedTarget>("effect-browser
|
|
|
71
77
|
href: Schema.optional(Schema.String),
|
|
72
78
|
}) {}
|
|
73
79
|
|
|
74
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* Action options share the execution codec.
|
|
82
|
+
*
|
|
83
|
+
* @stability stable
|
|
84
|
+
* @category options
|
|
85
|
+
* @since 0.3.0
|
|
86
|
+
*/
|
|
75
87
|
export type ClickOptions = typeof ClickOptionsSchema.Type;
|
|
76
|
-
export type TypeOptions = typeof TypeOptionsSchema.Type;
|
|
77
|
-
export type PressOptions = typeof PressOptionsSchema.Type;
|
|
78
|
-
export type ScrollOptions = typeof ScrollOptionsSchema.Type;
|
|
79
88
|
|
|
80
89
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
90
|
+
* @stability stable
|
|
91
|
+
* @category options
|
|
92
|
+
* @since 0.3.0
|
|
83
93
|
*/
|
|
84
|
-
export
|
|
85
|
-
/**
|
|
86
|
-
* The oldest a reused frame may be, from its paint, at the earliest its timing allows, to now.
|
|
87
|
-
* Defaults to 250 milliseconds; 0 always takes a new screenshot.
|
|
88
|
-
*/
|
|
89
|
-
readonly maxAge?: Duration.Input | undefined;
|
|
90
|
-
/**
|
|
91
|
-
* `"input"`: reuse only a frame painted after this page's latest input, including input of an
|
|
92
|
-
* interrupted action, and never while an action is changing the page. For a caller that has
|
|
93
|
-
* just acted on the page.
|
|
94
|
-
*/
|
|
95
|
-
readonly after?: "input" | undefined;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/** A screenshot reuses only a frame painted after the page's latest input, as `after: "input"`. */
|
|
99
|
-
export interface ScreenshotOptions {
|
|
100
|
-
/** The oldest a reused frame may be, as for `frame`. Defaults to 250 milliseconds. */
|
|
101
|
-
readonly maxAge?: Duration.Input | undefined;
|
|
102
|
-
/** A region of the viewport, captured in CSS pixels at the viewport's own scale; always new. */
|
|
103
|
-
readonly clip?: Box | undefined;
|
|
104
|
-
/** JPEG quality, 0 to 100. Defaults to 80. */
|
|
105
|
-
readonly quality?: number | undefined;
|
|
106
|
-
/** `"jpeg"`, the default, or `"png"`, which is always a new picture. */
|
|
107
|
-
readonly format?: "jpeg" | "png" | undefined;
|
|
108
|
-
/**
|
|
109
|
-
* `"css"`, the default, a picture pixel per CSS pixel; `"device"`, the screen's own pixels, as
|
|
110
|
-
* many to a CSS pixel as its device scale factor, which is always a new picture.
|
|
111
|
-
*/
|
|
112
|
-
readonly scale?: "css" | "device" | undefined;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/** How a page paints for a scope; see `Page.paint`. */
|
|
116
|
-
export interface Paint {
|
|
117
|
-
/** Device pixels to each CSS pixel, more than 0 and at most 4. The layout keeps its size. */
|
|
118
|
-
readonly scale?: number | undefined;
|
|
119
|
-
/** False hides the page's scrollbars from its next document on, and its layout takes their room. */
|
|
120
|
-
readonly scrollbars?: boolean | undefined;
|
|
121
|
-
}
|
|
94
|
+
export type TypeOptions = typeof TypeOptionsSchema.Type;
|
|
122
95
|
|
|
123
96
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
97
|
+
* @stability stable
|
|
98
|
+
* @category options
|
|
99
|
+
* @since 0.3.0
|
|
126
100
|
*/
|
|
127
|
-
export
|
|
128
|
-
/** Narrow matching to this CSS selector. Invalid CSS fails InvalidRequest. */
|
|
129
|
-
readonly selector?: string | undefined;
|
|
130
|
-
/** Require a visible match, optionally enabled. */
|
|
131
|
-
readonly state?: "visible" | "enabled" | undefined;
|
|
132
|
-
/** An ARIA role, such as `"button"` or `"heading"`, ignoring case. */
|
|
133
|
-
readonly role?: string | undefined;
|
|
134
|
-
/**
|
|
135
|
-
* The accessible name: a string that reads the same once spaces are collapsed and case folded,
|
|
136
|
-
* or a pattern found in it.
|
|
137
|
-
*/
|
|
138
|
-
readonly name?: string | RegExp | undefined;
|
|
139
|
-
/**
|
|
140
|
-
* Text it shows, ignoring case and spacing, or a pattern. Text inside a control or a heading is
|
|
141
|
-
* that control's or heading's, and only the smallest element showing it matches, not every
|
|
142
|
-
* element around it.
|
|
143
|
-
*/
|
|
144
|
-
readonly text?: string | RegExp | undefined;
|
|
145
|
-
/** Whole words in its context (row, column, label or heading), ignoring case and spacing. */
|
|
146
|
-
readonly near?: string | undefined;
|
|
147
|
-
/** Only what a point action at this viewport point would reach: the control there, or else what is painted there. */
|
|
148
|
-
readonly at?: Point | undefined;
|
|
149
|
-
/** The viewport (the default), or the whole document. */
|
|
150
|
-
readonly scope?: "viewport" | "document" | undefined;
|
|
151
|
-
}
|
|
101
|
+
export type PressOptions = typeof PressOptionsSchema.Type;
|
|
152
102
|
|
|
153
103
|
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
104
|
+
* @stability stable
|
|
105
|
+
* @category options
|
|
106
|
+
* @since 0.3.0
|
|
156
107
|
*/
|
|
157
|
-
export
|
|
158
|
-
disabled: Schema.Boolean,
|
|
159
|
-
focused: Schema.Boolean,
|
|
160
|
-
checked: Schema.optional(Schema.Boolean),
|
|
161
|
-
expanded: Schema.optional(Schema.Boolean),
|
|
162
|
-
selected: Schema.optional(Schema.Boolean),
|
|
163
|
-
pressed: Schema.optional(Schema.Boolean),
|
|
164
|
-
level: Schema.optional(Schema.Int),
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
export type ElementState = typeof ElementState.Type;
|
|
168
|
-
|
|
169
|
-
/** An element `find` found: a ref for the actions, what it is, where it is and its state. */
|
|
170
|
-
export class Found extends Schema.Class<Found>("effect-browser/Found")({
|
|
171
|
-
ref: Schema.String,
|
|
172
|
-
subject: Subject,
|
|
173
|
-
/** Its box, rounded. Reading the document, it may be out of view. */
|
|
174
|
-
box: Box,
|
|
175
|
-
inViewport: Schema.Boolean,
|
|
176
|
-
state: ElementState,
|
|
177
|
-
}) {}
|
|
178
|
-
|
|
179
|
-
export interface TextOptions {
|
|
180
|
-
/** `"viewport"` (the default) reads what the viewport shows; a ref reads that element whole. */
|
|
181
|
-
readonly scope?: string | undefined;
|
|
182
|
-
/** Bound on the text's length, cut at a line. Defaults to 12,000 characters. */
|
|
183
|
-
readonly maxChars?: number | undefined;
|
|
184
|
-
/** Show what fields hold; a secret field still reads `••••`. Defaults to false. */
|
|
185
|
-
readonly unmask?: boolean | undefined;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/** What a page showed as text: a line per block, with table cells apart by tabs. */
|
|
189
|
-
export class Text extends Schema.Class<Text>("effect-browser/Text")({
|
|
190
|
-
url: Schema.String,
|
|
191
|
-
title: Schema.String,
|
|
192
|
-
text: Schema.String,
|
|
193
|
-
/** True when `text` was cut at `maxChars`. */
|
|
194
|
-
truncated: Schema.Boolean,
|
|
195
|
-
/** Host monotonic milliseconds from the browser's captured Effect Clock. */
|
|
196
|
-
at: Schema.Finite,
|
|
197
|
-
}) {}
|
|
108
|
+
export type ScrollOptions = typeof ScrollOptionsSchema.Type;
|
|
198
109
|
|
|
110
|
+
/**
|
|
111
|
+
* @stability stable
|
|
112
|
+
* @category options
|
|
113
|
+
* @since 0.3.0
|
|
114
|
+
*/
|
|
199
115
|
export interface ReadyOptions {
|
|
200
116
|
/** How long recorded content must stay unchanged. Screen stillness is a separate feature. */
|
|
201
|
-
readonly
|
|
117
|
+
readonly quiet?: Duration.Input | undefined;
|
|
202
118
|
readonly timeout?: Duration.Input | undefined;
|
|
203
119
|
}
|
|
204
120
|
|
|
205
|
-
/** The window `changes` reads, and whether to show what fields hold. */
|
|
206
|
-
export interface ChangesOptions {
|
|
207
|
-
/**
|
|
208
|
-
* Where the window starts: the changes a previous read returned, to continue exactly where they
|
|
209
|
-
* ended; a frame, at its paint; or host monotonic milliseconds, which mapped to the page's clock
|
|
210
|
-
* may miss or repeat changes near the start if the browser's clock mapping changed since. Defaults
|
|
211
|
-
* to the start of the record.
|
|
212
|
-
*/
|
|
213
|
-
readonly since?: Changes | Frame | number | undefined;
|
|
214
|
-
/**
|
|
215
|
-
* Where it ends: a frame, at its paint, so a delayed frame's window holds nothing it does not
|
|
216
|
-
* show; or host monotonic milliseconds. Defaults to now, and is never later.
|
|
217
|
-
*/
|
|
218
|
-
readonly until?: Frame | number | undefined;
|
|
219
|
-
/** Show what fields hold; a secret field still reads `••••`. Defaults to false. */
|
|
220
|
-
readonly unmask?: boolean | undefined;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/** The window `window` reads, and whether to show what fields hold. */
|
|
224
|
-
export interface WindowOptions {
|
|
225
|
-
/**
|
|
226
|
-
* Where the window starts: a previous window, to continue exactly where it ended; a frame, at its
|
|
227
|
-
* paint; host monotonic milliseconds; or a `Duration` back from `until`. A start after `until`
|
|
228
|
-
* leaves the window empty there.
|
|
229
|
-
*/
|
|
230
|
-
readonly since: Window | Frame | Duration.Duration | number;
|
|
231
|
-
/**
|
|
232
|
-
* Where it ends: a frame, at its paint, such as one a delayed consumer airs now; or host
|
|
233
|
-
* monotonic milliseconds. Defaults to now, and is never later.
|
|
234
|
-
*/
|
|
235
|
-
readonly until?: Frame | number | undefined;
|
|
236
|
-
/** Show what fields hold in its changes; a secret field still reads `••••`. Defaults to false. */
|
|
237
|
-
readonly unmask?: boolean | undefined;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
121
|
/**
|
|
241
122
|
* What the library knows of a page now, without asking it, each part with when it learned it, in
|
|
242
|
-
* host monotonic milliseconds: a part's age is `at` less its time.
|
|
243
|
-
*
|
|
123
|
+
* host monotonic milliseconds: a part's age is `at` less its time.
|
|
124
|
+
*
|
|
125
|
+
* @stability stable
|
|
126
|
+
* @category schemas
|
|
127
|
+
* @since 0.3.0
|
|
244
128
|
*/
|
|
245
|
-
export class State extends Schema.Class<State>("effect-browser/
|
|
129
|
+
export class State extends Schema.Class<State>("effect-browser/Page/State")({
|
|
246
130
|
page: Schema.String,
|
|
247
131
|
/** The tracking connection that owns this document counter. */
|
|
248
132
|
connection: Schema.String,
|
|
@@ -256,12 +140,6 @@ export class State extends Schema.Class<State>("effect-browser/PageState")({
|
|
|
256
140
|
committedAt: Schema.optional(Schema.Finite),
|
|
257
141
|
/** How far that document has loaded, as the page's own session heard; absent until parsed. */
|
|
258
142
|
load: Schema.optional(PageLoaded),
|
|
259
|
-
/** The newest screencast frame, of whichever document it names. */
|
|
260
|
-
frame: Schema.optional(Frame),
|
|
261
|
-
/** Where the overlay's drawing was last drawn, in viewport CSS pixels; absent with none shown. */
|
|
262
|
-
overlay: Schema.optional(Schema.Array(Box)),
|
|
263
|
-
/** The viewport's text as it was last read, with the page's title then. */
|
|
264
|
-
text: Schema.optional(Text),
|
|
265
143
|
}) {}
|
|
266
144
|
|
|
267
145
|
/**
|
|
@@ -280,9 +158,18 @@ export class State extends Schema.Class<State>("effect-browser/PageState")({
|
|
|
280
158
|
*
|
|
281
159
|
* Facts never come from what an element's text says. What an input means, such as a payment
|
|
282
160
|
* or a deletion, takes a judge that reads the evidence in the {@link InputRequest}.
|
|
161
|
+
*
|
|
162
|
+
* @stability stable
|
|
163
|
+
* @category schemas
|
|
164
|
+
* @since 0.3.0
|
|
283
165
|
*/
|
|
284
166
|
export const Fact = Guard.Fact;
|
|
285
167
|
|
|
168
|
+
/**
|
|
169
|
+
* @stability stable
|
|
170
|
+
* @category schemas
|
|
171
|
+
* @since 0.3.0
|
|
172
|
+
*/
|
|
286
173
|
export type Fact = typeof Fact.Type;
|
|
287
174
|
|
|
288
175
|
/**
|
|
@@ -294,8 +181,12 @@ export type Fact = typeof Fact.Type;
|
|
|
294
181
|
* field is replaced with {@link redacted}, here and in the recorded `Action`, and its key events
|
|
295
182
|
* record `Unidentified` keys; `press` records the keys it is given. Validation before dispatch
|
|
296
183
|
* binds the facts and the target, not the text around it, which live pages change freely.
|
|
184
|
+
*
|
|
185
|
+
* @stability stable
|
|
186
|
+
* @category schemas
|
|
187
|
+
* @since 0.3.0
|
|
297
188
|
*/
|
|
298
|
-
export class InputRequest extends Schema.Class<InputRequest>("effect-browser/InputRequest")({
|
|
189
|
+
export class InputRequest extends Schema.Class<InputRequest>("effect-browser/Page/InputRequest")({
|
|
299
190
|
page: Schema.String,
|
|
300
191
|
/**
|
|
301
192
|
* The page's URL, without a fragment that only names a place on the page. This and the other
|
|
@@ -340,12 +231,30 @@ export class InputRequest extends Schema.Class<InputRequest>("effect-browser/Inp
|
|
|
340
231
|
/**
|
|
341
232
|
* What replaces text typed into a `secret` field, in requests and in the recorded `Action`, and a
|
|
342
233
|
* credential's value in every address the library reports.
|
|
234
|
+
*
|
|
235
|
+
* @stability stable
|
|
236
|
+
* @category constants
|
|
237
|
+
* @since 0.3.0
|
|
343
238
|
*/
|
|
344
239
|
export const redacted = Url.withheld;
|
|
345
240
|
|
|
241
|
+
/**
|
|
242
|
+
* Whether a value is a page the library made: what a function over a page, callable with the page
|
|
243
|
+
* first or last, tells it from its other arguments by.
|
|
244
|
+
*
|
|
245
|
+
* @stability stable
|
|
246
|
+
* @category guards
|
|
247
|
+
* @since 0.3.0
|
|
248
|
+
*/
|
|
249
|
+
export const isPage: (u: unknown) => u is Page = isLibraryPage;
|
|
250
|
+
|
|
346
251
|
/**
|
|
347
252
|
* Run page operations without waiting their turn: on a page busy with other operations, each fails
|
|
348
253
|
* `Busy` at once, and `Browser.newPage` on a browser with `maxPages` open fails `Limit` at once.
|
|
254
|
+
*
|
|
255
|
+
* @stability stable
|
|
256
|
+
* @category combinators
|
|
257
|
+
* @since 0.3.0
|
|
349
258
|
*/
|
|
350
259
|
export const failFast = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>
|
|
351
260
|
Effect.provideService(effect, FailFast, true);
|
|
@@ -353,48 +262,60 @@ export const failFast = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect
|
|
|
353
262
|
/**
|
|
354
263
|
* Give every action `effect` performs a caller's id, such as a model's tool call id, which its
|
|
355
264
|
* recorded `Action` carries as `correlation`.
|
|
265
|
+
*
|
|
266
|
+
* @stability stable
|
|
267
|
+
* @category combinators
|
|
268
|
+
* @since 0.3.0
|
|
356
269
|
*/
|
|
357
|
-
export const correlate
|
|
358
|
-
(id: string) =>
|
|
359
|
-
<A, E, R>(effect: Effect.Effect<A, E, R
|
|
360
|
-
|
|
270
|
+
export const correlate: {
|
|
271
|
+
(id: string): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
272
|
+
<A, E, R>(effect: Effect.Effect<A, E, R>, id: string): Effect.Effect<A, E, R>;
|
|
273
|
+
} = Function.dual(
|
|
274
|
+
2,
|
|
275
|
+
<A, E, R>(effect: Effect.Effect<A, E, R>, id: string): Effect.Effect<A, E, R> =>
|
|
276
|
+
Effect.provideService(effect, Correlation, id),
|
|
277
|
+
);
|
|
361
278
|
|
|
362
|
-
/**
|
|
279
|
+
/**
|
|
280
|
+
* Succeed to allow, fail to deny, or await an external signal to hold the input.
|
|
281
|
+
*
|
|
282
|
+
* @stability stable
|
|
283
|
+
* @category models
|
|
284
|
+
* @since 0.3.0
|
|
285
|
+
*/
|
|
363
286
|
export type InputGuard = (request: InputRequest) => Effect.Effect<void, PolicyDenied>;
|
|
364
287
|
|
|
365
|
-
/**
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
/** Scoped access to one page's shared capture and its current-document evidence. */
|
|
374
|
-
export interface Capture {
|
|
375
|
-
readonly stream: Stream.Stream<Frame, BrowserError>;
|
|
376
|
-
readonly current: Frame | undefined;
|
|
377
|
-
readonly isCurrent: (frame: Frame) => boolean;
|
|
378
|
-
readonly confirm: (frame: Frame) => Effect.Effect<boolean, BrowserError>;
|
|
379
|
-
readonly sync: Effect.Effect<void, BrowserError>;
|
|
380
|
-
readonly stats: (options?: {
|
|
381
|
-
readonly window?: Duration.Input | undefined;
|
|
382
|
-
}) => Effect.Effect<CaptureStats, BrowserError>;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/** Script values cross the page boundary through the caller's Schema. A bundler may rewrite functions. */
|
|
288
|
+
/**
|
|
289
|
+
* Script values cross the page boundary through the caller's Schema. A bundler may rewrite functions.
|
|
290
|
+
*
|
|
291
|
+
* @stability stable
|
|
292
|
+
* @category options
|
|
293
|
+
* @since 0.3.0
|
|
294
|
+
*/
|
|
386
295
|
export interface ScriptOptions<A, Arg> {
|
|
387
296
|
readonly arg: Arg;
|
|
388
297
|
readonly result: Schema.Codec<A, unknown>;
|
|
389
298
|
}
|
|
390
299
|
|
|
300
|
+
/**
|
|
301
|
+
* @stability stable
|
|
302
|
+
* @category options
|
|
303
|
+
* @since 0.3.0
|
|
304
|
+
*/
|
|
391
305
|
export interface ActOptions<A, Arg> extends ScriptOptions<A, Arg> {
|
|
392
306
|
readonly document: number;
|
|
393
307
|
/** Supplying the read's connection also refuses a document counter from another connection. */
|
|
394
308
|
readonly connection?: string | undefined;
|
|
395
309
|
}
|
|
396
310
|
|
|
311
|
+
/**
|
|
312
|
+
* @stability stable
|
|
313
|
+
* @category models
|
|
314
|
+
* @since 0.3.0
|
|
315
|
+
*/
|
|
397
316
|
export interface Page {
|
|
317
|
+
/** What the page does behind its types' modules' functions, such as `Snapshot.read`. */
|
|
318
|
+
readonly [key]: Implementation;
|
|
398
319
|
/** Decode and perform a data action through the same policy and lane as the named methods. */
|
|
399
320
|
readonly perform: (action: Action) => Effect.Effect<ResolvedTarget | string | void, BrowserError>;
|
|
400
321
|
/** Read declared side-effect-free code in the main world, retrying one replaced document. */
|
|
@@ -414,22 +335,15 @@ export interface Page {
|
|
|
414
335
|
script: (arg: Arg) => unknown,
|
|
415
336
|
options: ActOptions<A, Arg>,
|
|
416
337
|
) => Effect.Effect<A, BrowserError>;
|
|
417
|
-
/**
|
|
418
|
-
|
|
338
|
+
/**
|
|
339
|
+
* The owning browser's host clock, which stamps the page's events and frames and times its
|
|
340
|
+
* deadlines. It is not the page's own time, which `PageTime` holds.
|
|
341
|
+
*/
|
|
342
|
+
readonly hostClock: Clock.Clock;
|
|
419
343
|
/** Wait for admitted input and retain a bounded read turn through effect. */
|
|
420
344
|
readonly afterInput: <A, E, R>(
|
|
421
345
|
effect: Effect.Effect<A, E, R>,
|
|
422
346
|
) => Effect.Effect<A, E | BrowserError, R>;
|
|
423
|
-
/** A scoped lease starts capture immediately, independently of its first frame. */
|
|
424
|
-
readonly capture: (
|
|
425
|
-
options?: ScreencastOptions,
|
|
426
|
-
) => Effect.Effect<Capture, BrowserError, Scope.Scope>;
|
|
427
|
-
/** One page-side wait; replaced documents share one deadline. Unmet is met:false; an empty mark means no stable document could be sampled. */
|
|
428
|
-
readonly until: (
|
|
429
|
-
query: FindQuery,
|
|
430
|
-
want: UntilWant,
|
|
431
|
-
millis: number,
|
|
432
|
-
) => Effect.Effect<UntilResult, BrowserError>;
|
|
433
347
|
/** The page's CDP target id: the same page has it again after a reconnect to its browser. */
|
|
434
348
|
readonly id: string;
|
|
435
349
|
/** The page's address, without its userinfo or known secret parameters. */
|
|
@@ -449,25 +363,6 @@ export interface Page {
|
|
|
449
363
|
/** Close the tab, succeeding once it has closed, or at once when it already had. */
|
|
450
364
|
readonly close: Effect.Effect<void, BrowserError>;
|
|
451
365
|
|
|
452
|
-
readonly snapshot: (options?: SnapshotOptions) => Effect.Effect<Snapshot, BrowserError>;
|
|
453
|
-
/**
|
|
454
|
-
* A picture of the viewport, in CSS pixels: a screencast frame painted since the page's latest
|
|
455
|
-
* input, if one qualifies, or a new one. A caller that has just acted sees what its action did.
|
|
456
|
-
*/
|
|
457
|
-
readonly screenshot: (options?: ScreenshotOptions) => Effect.Effect<Image, BrowserError>;
|
|
458
|
-
/**
|
|
459
|
-
* The viewport with its timing: the newest screencast frame if it qualifies, else a new
|
|
460
|
-
* screenshot timed by the host interval in which it was taken.
|
|
461
|
-
*/
|
|
462
|
-
readonly frame: (options?: FrameOptions) => Effect.Effect<Frame, BrowserError>;
|
|
463
|
-
/**
|
|
464
|
-
* A crop in CSS pixels, unmagnified, with the origin that keeps later input in viewport pixels.
|
|
465
|
-
* With `scale: "device"` its picture has the screen's own pixels, as a screenshot's would.
|
|
466
|
-
*/
|
|
467
|
-
readonly zoom: (
|
|
468
|
-
region: Region,
|
|
469
|
-
options?: Pick<ScreenshotOptions, "scale">,
|
|
470
|
-
) => Effect.Effect<Zoom, BrowserError>;
|
|
471
366
|
/**
|
|
472
367
|
* The viewport's size in CSS pixels, the space of points, crops and page scrolls. Over CDP the
|
|
473
368
|
* page reports it, within the action timeout.
|
|
@@ -476,67 +371,11 @@ export interface Page {
|
|
|
476
371
|
{ readonly width: number; readonly height: number },
|
|
477
372
|
BrowserError
|
|
478
373
|
>;
|
|
479
|
-
/**
|
|
480
|
-
* The elements that match a query, in tree order, with refs the actions take, in one call to the
|
|
481
|
-
* page. All that match are returned, so a caller tells them apart by their context; none is an
|
|
482
|
-
* empty result, not a failure.
|
|
483
|
-
*/
|
|
484
|
-
readonly find: (query?: FindQuery) => Effect.Effect<ReadonlyArray<Found>, BrowserError>;
|
|
485
|
-
/**
|
|
486
|
-
* Where each pick is, in one call to the page: its box unrounded, in the viewport and in the
|
|
487
|
-
* document, the boxes of words in it, and the viewport, scroll and scale they were read at. A
|
|
488
|
-
* pick that finds nothing is listed as missing, not a failure. See `Layout`.
|
|
489
|
-
*/
|
|
490
|
-
readonly layout: (picks: Picks) => Effect.Effect<Layout, BrowserError>;
|
|
491
|
-
/**
|
|
492
|
-
* A layer over the page to draw into, for the scope, that the library's readers never read.
|
|
493
|
-
* One at a time: a second while one is open fails `InvalidRequest`. See `Overlay`.
|
|
494
|
-
*/
|
|
495
|
-
readonly overlay: Effect.Effect<Overlay, BrowserError, Scope.Scope>;
|
|
496
|
-
/**
|
|
497
|
-
* Pose the page's own elements for the scope, moved, turned and scaled as a caller says, and put
|
|
498
|
-
* back when the scope closes. One lease at a time: a second while one is open fails
|
|
499
|
-
* `InvalidRequest`. See `Pose`.
|
|
500
|
-
*/
|
|
501
|
-
readonly poses: Effect.Effect<Poses, BrowserError, Scope.Scope>;
|
|
502
|
-
/**
|
|
503
|
-
* Hold the page's own time for the scope, to step it on with `advance`; real time resumes when
|
|
504
|
-
* the scope closes. Needs the browser's `pageTime` option; one hold at a time. See `PageTime`.
|
|
505
|
-
*/
|
|
506
|
-
readonly hold: Effect.Effect<Held, BrowserError, Scope.Scope>;
|
|
507
|
-
/**
|
|
508
|
-
* The text the viewport shows, or one element whole, in one call to the page. Field values read
|
|
509
|
-
* `••••` unless `unmask`, and a secret field's always do, as does one that was secret when the
|
|
510
|
-
* library saw it.
|
|
511
|
-
*/
|
|
512
|
-
readonly text: (options?: TextOptions) => Effect.Effect<Text, BrowserError>;
|
|
513
|
-
/**
|
|
514
|
-
* What visibly changed over a window, in one call to the page. The first read starts the page's
|
|
515
|
-
* record, so it finds none; from then the page records, and from the start of each later
|
|
516
|
-
* document, until nobody has read it for two minutes. See `Change`.
|
|
517
|
-
*/
|
|
518
|
-
readonly changes: (options?: ChangesOptions) => Effect.Effect<Changes, BrowserError>;
|
|
519
|
-
/**
|
|
520
|
-
* The page's events, changes and frames over a window: the frames and events it keeps, at no
|
|
521
|
-
* call, and its changes, in one call, the first starting its record as `changes` does. A part
|
|
522
|
-
* that cannot be read is missing, with why; the window fails only for bounds that are not finite.
|
|
523
|
-
*/
|
|
524
|
-
readonly window: (options: WindowOptions) => Effect.Effect<Window, BrowserError>;
|
|
525
374
|
/**
|
|
526
375
|
* What the library knows of the page now, at no call and with no wait for its turn: where it is,
|
|
527
|
-
* its document and how far it has loaded
|
|
376
|
+
* its document and how far it has loaded.
|
|
528
377
|
*/
|
|
529
378
|
readonly state: Effect.Effect<State>;
|
|
530
|
-
/**
|
|
531
|
-
* Paint the page at `scale` device pixels to each CSS pixel, or without its scrollbars, for a
|
|
532
|
-
* scope: a screenshot with `scale: "device"` then has that many more pixels, while the layout,
|
|
533
|
-
* its boxes and input keep their CSS pixels. Scrollbars go from the next document on, and come
|
|
534
|
-
* back from the next after the scope, so paint, then load the page, then measure it. One at a
|
|
535
|
-
* time. A browser this library launched paints at the scale of its launch (Chromium's
|
|
536
|
-
* `deviceScaleFactor`), and refuses another.
|
|
537
|
-
*/
|
|
538
|
-
readonly paint: (options: Paint) => Effect.Effect<void, BrowserError, Scope.Scope>;
|
|
539
|
-
|
|
540
379
|
readonly click: (
|
|
541
380
|
target: Target,
|
|
542
381
|
options?: ClickOptions,
|
|
@@ -559,26 +398,11 @@ export interface Page {
|
|
|
559
398
|
|
|
560
399
|
/**
|
|
561
400
|
* Wait for document evidence, polling every 50 ms: parsed, painted, visible, fonts and visible
|
|
562
|
-
* images loaded, and finite animations finished. Optional
|
|
401
|
+
* images loaded, and finite animations finished. Optional `quiet` requires recorded content
|
|
563
402
|
* to stay unchanged. Screen or foreground stillness belongs to the Stillness feature.
|
|
564
403
|
* Fails Timeout after timeout, 15 seconds by default.
|
|
565
404
|
*/
|
|
566
405
|
readonly ready: (options?: ReadyOptions) => Effect.Effect<void, BrowserError>;
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
* Screencast frames for as long as the stream runs. Concurrent streams share one screencast and
|
|
570
|
-
* its settings; explicit options that differ from a running screencast's fail with InvalidRequest.
|
|
571
|
-
*/
|
|
572
|
-
readonly screencast: (options?: ScreencastOptions) => Stream.Stream<Frame, BrowserError>;
|
|
573
|
-
/**
|
|
574
|
-
* What this page's captures received, delivered and dropped, over its life or the latest
|
|
575
|
-
* `window`, which reaches back at most a minute; a longer one is an `InvalidRequest`.
|
|
576
|
-
*/
|
|
577
|
-
readonly captureStats: (options?: {
|
|
578
|
-
readonly window?: Duration.Input | undefined;
|
|
579
|
-
}) => Effect.Effect<CaptureStats, BrowserError>;
|
|
580
|
-
/** Screencast frames painted within `frameHistory` of the newest, oldest first. */
|
|
581
|
-
readonly recentFrames: Effect.Effect<ReadonlyArray<Frame>>;
|
|
582
406
|
/** This page's events among the browser's latest `eventHistory`, oldest first. */
|
|
583
407
|
readonly recentEvents: Effect.Effect<ReadonlyArray<BrowserEvent>>;
|
|
584
408
|
}
|
package/src/PageTime.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* in one step, a recording's page moves one frame's worth per frame however long each takes.
|
|
5
5
|
*
|
|
6
6
|
* A browser opened with `pageTime` runs a page clock in each top document's main world, before
|
|
7
|
-
* the page's own scripts. Until `
|
|
7
|
+
* the page's own scripts. Until `hold`, it keeps real time. Held, the page's timers and
|
|
8
8
|
* intervals, its animation frames, `performance.now`, `Date.now`, `new Date()` and `Date()`, and
|
|
9
9
|
* its CSS transitions, CSS animations and Web Animations stand still, and each `advance` runs what
|
|
10
10
|
* falls due in time order, each timer at its own time, and then one animation frame at its end.
|
|
@@ -17,16 +17,25 @@
|
|
|
17
17
|
* never back, and what was left of each timer and frame runs in real time. `ready` and stillness
|
|
18
18
|
* count an animation held part way as still running.
|
|
19
19
|
*
|
|
20
|
+
* @stability stable
|
|
20
21
|
* @since 0.3.0
|
|
21
22
|
*/
|
|
22
|
-
import type { Duration, Effect } from "effect";
|
|
23
|
+
import type { Duration, Effect, Scope } from "effect";
|
|
23
24
|
|
|
24
25
|
import type { BrowserError } from "./BrowserError.ts";
|
|
25
|
-
import type { Point } from "./
|
|
26
|
+
import type { Point } from "./internal/geometry.ts";
|
|
27
|
+
import { functionsOf } from "./internal/page/functions.ts";
|
|
26
28
|
import type { Content } from "./Overlay.ts";
|
|
29
|
+
import type { Page } from "./Page.ts";
|
|
27
30
|
import type { Pose } from "./Pose.ts";
|
|
28
31
|
|
|
29
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* What else changes with page time in the same call to the page.
|
|
34
|
+
*
|
|
35
|
+
* @stability stable
|
|
36
|
+
* @category models
|
|
37
|
+
* @since 0.3.0
|
|
38
|
+
*/
|
|
30
39
|
export interface Step {
|
|
31
40
|
/** Scroll the document to this many CSS pixels down it first, at once. */
|
|
32
41
|
readonly scroll?: number | undefined;
|
|
@@ -36,6 +45,11 @@ export interface Step {
|
|
|
36
45
|
readonly overlay?: Content | undefined;
|
|
37
46
|
}
|
|
38
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @stability stable
|
|
50
|
+
* @category models
|
|
51
|
+
* @since 0.3.0
|
|
52
|
+
*/
|
|
39
53
|
export interface Held {
|
|
40
54
|
/**
|
|
41
55
|
* Move page time on by `by`, in one call to the page, after the actions asked before it. Says
|
|
@@ -45,3 +59,14 @@ export interface Held {
|
|
|
45
59
|
/** How far this hold has moved page time, across the documents it held. */
|
|
46
60
|
readonly elapsed: Effect.Effect<Duration.Duration>;
|
|
47
61
|
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Hold the page's own time for the scope, to step it on with `advance`; real time resumes when
|
|
65
|
+
* the scope closes. Needs the browser's `pageTime` option; one hold at a time.
|
|
66
|
+
*
|
|
67
|
+
* @stability stable
|
|
68
|
+
* @category combinators
|
|
69
|
+
* @since 0.3.0
|
|
70
|
+
*/
|
|
71
|
+
export const hold = (page: Page): Effect.Effect<Held, BrowserError, Scope.Scope> =>
|
|
72
|
+
functionsOf(page).hold;
|