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
|
@@ -5,6 +5,26 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { type Clock, Duration, Effect, Option, Semaphore } from "effect";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A duration in milliseconds: NaN for an input that is no duration, or that holds a NaN, which
|
|
10
|
+
* `Duration.fromInput` would read as zero. An infinite one stays infinite, for the caller's bounds.
|
|
11
|
+
*/
|
|
12
|
+
export const millisOf = (input: Duration.Input): number => {
|
|
13
|
+
const parts =
|
|
14
|
+
typeof input === "number"
|
|
15
|
+
? [input]
|
|
16
|
+
: typeof input === "object" && !Duration.isDuration(input)
|
|
17
|
+
? Object.values(input)
|
|
18
|
+
: [];
|
|
19
|
+
|
|
20
|
+
return parts.some((part) => typeof part === "number" && Number.isNaN(part))
|
|
21
|
+
? Number.NaN
|
|
22
|
+
: Option.match(Duration.fromInput(input), {
|
|
23
|
+
onNone: () => Number.NaN,
|
|
24
|
+
onSome: Duration.toMillis,
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
8
28
|
/** Read the captured owner's clock, including from native callbacks, without changing its origin. */
|
|
9
29
|
export const monotonicMillis = (clock: Clock.Clock): number =>
|
|
10
30
|
Number(clock.monotonicTimeNanosUnsafe()) / 1e6;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import { Duration, Effect } from "effect";
|
|
8
8
|
|
|
9
9
|
import { NotActionable, StaleRef } from "../../BrowserError.ts";
|
|
10
|
+
import { maximumDurationMillis } from "../../InputStyle.ts";
|
|
10
11
|
import type { ClickOptions, PressOptions, ScrollOptions, Target, TypeOptions } from "../../Page.ts";
|
|
11
|
-
import { maximumDurationMillis } from "../../Style.ts";
|
|
12
12
|
import { type Bridge, scriptCall } from "../page/bridge.ts";
|
|
13
13
|
import { decodeWith, failWith, type PageContext, refuse } from "../page/context.ts";
|
|
14
14
|
import type { Viewport } from "../page/viewport.ts";
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
TextInserted,
|
|
13
13
|
WheelScrolled,
|
|
14
14
|
} from "../../BrowserEvent.ts";
|
|
15
|
-
import * as BrowserClock from "
|
|
16
|
-
import type { Point } from "
|
|
15
|
+
import * as BrowserClock from "../clock.ts";
|
|
16
|
+
import type { Point } from "../geometry.ts";
|
|
17
17
|
import { type PageContext, reasonOf, undispatched } from "../page/context.ts";
|
|
18
18
|
import type * as Replies from "../page/replies.ts";
|
|
19
19
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { Schema } from "effect";
|
|
7
7
|
|
|
8
|
-
import type { Point } from "
|
|
8
|
+
import type { Point } from "../geometry.ts";
|
|
9
9
|
import type { Names } from "../reading/names.inpage.ts";
|
|
10
10
|
import { type Evidence, type EvidenceReader, EvidenceSchema } from "./evidence.inpage.ts";
|
|
11
11
|
import type { Targets } from "./targets.inpage.ts";
|
|
@@ -8,9 +8,9 @@ import { Effect } from "effect";
|
|
|
8
8
|
import { recorded, nameOf, type Action } from "../../Action.ts";
|
|
9
9
|
import { type BrowserError, InvalidRequest, NotActionable, StaleRef } from "../../BrowserError.ts";
|
|
10
10
|
import { InputRequest } from "../../Page.ts";
|
|
11
|
-
import * as Url from "../../Url.ts";
|
|
12
11
|
import { type Bridge, scriptCall } from "../page/bridge.ts";
|
|
13
12
|
import { contextGone, decodeWith, failWith, type PageContext } from "../page/context.ts";
|
|
13
|
+
import * as Url from "../url.ts";
|
|
14
14
|
import * as Script from "./guard.inpage.ts";
|
|
15
15
|
|
|
16
16
|
export interface Approval {
|
|
@@ -7,19 +7,19 @@ import { Deferred, Duration, Effect, Exit, Option, Ref } from "effect";
|
|
|
7
7
|
import { recorded, nameOf, type Action as ActionValue } from "../../Action.ts";
|
|
8
8
|
import { BrowserError, PolicyTimeout, Timeout } from "../../BrowserError.ts";
|
|
9
9
|
import { Action, ActionAnnounced, Subject } from "../../BrowserEvent.ts";
|
|
10
|
-
import type
|
|
10
|
+
import { Current, type InputStyle, validated } from "../../InputStyle.ts";
|
|
11
11
|
import { type Point, redacted, type ResolvedTarget } from "../../Page.ts";
|
|
12
|
-
import
|
|
13
|
-
import { redact } from "../../Url.ts";
|
|
12
|
+
import type * as BrowserClock from "../clock.ts";
|
|
14
13
|
import { failWith, type PageContext, undispatched } from "../page/context.ts";
|
|
15
14
|
import { Correlation, FailFast } from "../page/lane.ts";
|
|
16
15
|
import * as Replies from "../page/replies.ts";
|
|
16
|
+
import { redact } from "../url.ts";
|
|
17
17
|
import type { Dispatch } from "./dispatch.ts";
|
|
18
18
|
import type { Approval, PolicyPlan } from "./guard.ts";
|
|
19
19
|
|
|
20
20
|
export interface InputMarks {
|
|
21
21
|
/** How the action's input is sent: plainly, or performed for viewers. */
|
|
22
|
-
readonly style:
|
|
22
|
+
readonly style: InputStyle;
|
|
23
23
|
/**
|
|
24
24
|
* Time the style spends showing the input, such as a glide or typing at a person's pace, planned
|
|
25
25
|
* from now: the deadline moves back by as much, so presentation has a budget of its own.
|
|
@@ -155,7 +155,7 @@ const announcing =
|
|
|
155
155
|
(
|
|
156
156
|
page: PageContext,
|
|
157
157
|
name: Action["name"],
|
|
158
|
-
style:
|
|
158
|
+
style: InputStyle,
|
|
159
159
|
acted: Ref.Ref<Pick<Action, "subject" | "to" | "box">>,
|
|
160
160
|
) =>
|
|
161
161
|
(to: Point) =>
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
import { Duration, Effect, MutableRef, Option, Schema } from "effect";
|
|
7
7
|
|
|
8
8
|
import { CursorChanged, TrackPerformed, TrackPlanned } from "../../BrowserEvent.ts";
|
|
9
|
-
import
|
|
9
|
+
import type { WheelStep } from "../../InputStyle.ts";
|
|
10
10
|
import type { Point } from "../../Page.ts";
|
|
11
|
-
import
|
|
11
|
+
import * as Motion from "../geometry.ts";
|
|
12
12
|
import { type PageContext, refuse } from "../page/context.ts";
|
|
13
13
|
import type { Viewport } from "../page/viewport.ts";
|
|
14
14
|
import type { Dispatch } from "./dispatch.ts";
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
import { Schema } from "effect";
|
|
7
7
|
|
|
8
8
|
import { Box, Subject } from "../../BrowserEvent.ts";
|
|
9
|
-
import { Point } from "
|
|
9
|
+
import { Point } from "../geometry.ts";
|
|
10
10
|
import type { ContextReader } from "../reading/context.inpage.ts";
|
|
11
11
|
import type { Names } from "../reading/names.inpage.ts";
|
|
12
|
-
import type {
|
|
12
|
+
import type { Walked } from "../reading/walk.inpage.ts";
|
|
13
13
|
|
|
14
14
|
export type ResolvedPoint = typeof ResolvedPointSchema.Type;
|
|
15
15
|
export type PointResult = typeof PointResultSchema.Type;
|
|
16
16
|
|
|
17
|
-
export const targets = (names: Names, walked:
|
|
17
|
+
export const targets = (names: Names, walked: Walked, placing: ContextReader) => {
|
|
18
18
|
const { describe, isDisabled, lookup, nameOf, parentOf, roleOf } = names;
|
|
19
19
|
const { boxOf, controlOf, hitAt } = walked;
|
|
20
20
|
const { contextOf } = placing;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* In the page: the rules `find` matches by. It touches no DOM, so it also runs outside a page.
|
|
2
|
+
* In the page: the rules `Snapshot.find` matches by. It touches no DOM, so it also runs outside a page.
|
|
3
3
|
*
|
|
4
4
|
* - A role matches when it is the same token, ignoring case and the space around it.
|
|
5
5
|
* - A name given as a string matches when the two read the same once their spaces are collapsed,
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
* - `near` matches when its words appear, whole and in order, in any of the element's context:
|
|
10
10
|
* its row, column, label or heading. Replay chooses among candidates by the same rule.
|
|
11
11
|
*/
|
|
12
|
-
import type { SubjectContext } from "
|
|
13
|
-
import type {
|
|
14
|
-
import type {
|
|
15
|
-
import type {
|
|
16
|
-
import type {
|
|
12
|
+
import type { SubjectContext } from "../BrowserEvent.ts";
|
|
13
|
+
import type { Picks } from "../Layout.ts";
|
|
14
|
+
import type { FindQuery } from "../Snapshot.ts";
|
|
15
|
+
import type { Point } from "./geometry.ts";
|
|
16
|
+
import type { PickRequest } from "./reading/layout.inpage.ts";
|
|
17
17
|
|
|
18
18
|
/** A string, or a pattern sent to the page as its source and flags. */
|
|
19
19
|
export type Wanted = string | { readonly source: string; readonly flags: string };
|
|
@@ -12,12 +12,11 @@ import { Deferred, Effect, Schema, SynchronizedRef } from "effect";
|
|
|
12
12
|
import type { InitScript } from "../../Browser.ts";
|
|
13
13
|
import { type BrowserError, Failed } from "../../BrowserError.ts";
|
|
14
14
|
import { Navigated, PageLoaded } from "../../BrowserEvent.ts";
|
|
15
|
-
import { match } from "../../Matching.ts";
|
|
16
|
-
import * as Url from "../../Url.ts";
|
|
17
15
|
import { edit, type Edit } from "../input/edit.inpage.ts";
|
|
18
16
|
import { evidence } from "../input/evidence.inpage.ts";
|
|
19
17
|
import { guard, type Guard } from "../input/guard.inpage.ts";
|
|
20
18
|
import { targets, type Targets } from "../input/targets.inpage.ts";
|
|
19
|
+
import { match } from "../matching.ts";
|
|
21
20
|
import { context } from "../reading/context.inpage.ts";
|
|
22
21
|
import { controls } from "../reading/controls.inpage.ts";
|
|
23
22
|
import { expectations, type Expectations } from "../reading/expect.inpage.ts";
|
|
@@ -34,6 +33,7 @@ import { history } from "../timeline/history.inpage.ts";
|
|
|
34
33
|
import { marks } from "../timeline/marks.inpage.ts";
|
|
35
34
|
import { record, type Recorder } from "../timeline/record.inpage.ts";
|
|
36
35
|
import { sight } from "../timeline/sight.inpage.ts";
|
|
36
|
+
import * as Url from "../url.ts";
|
|
37
37
|
import { animations, clock, timers } from "./clock.inpage.ts";
|
|
38
38
|
import { compose } from "./compose.inpage.ts";
|
|
39
39
|
import { contextGone, decodeWith, failWith, type PageContext } from "./context.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* In the page's main world, before its own scripts: the page clock, which `
|
|
2
|
+
* In the page's main world, before its own scripts: the page clock, which `PageTime.hold` holds and
|
|
3
3
|
* steps. Until held it keeps real time. Held, the page's timers and intervals, its animation
|
|
4
4
|
* frames, `performance.now`, `Date.now`, `new Date()` and `Date()`, and its CSS transitions, CSS
|
|
5
5
|
* animations and Web Animations move only when stepped: due timers run in time order, each at its
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* input's checks and held time over it (`bridge.ts`); a site that owns its page calls it in its
|
|
5
5
|
* own bundle (`Site.ts`). See `names.inpage.ts` for what a page-side part may use.
|
|
6
6
|
*/
|
|
7
|
-
import type { match } from "
|
|
8
|
-
import type { addresses } from "../../Url.ts";
|
|
7
|
+
import type { match } from "../matching.ts";
|
|
9
8
|
import type { context } from "../reading/context.inpage.ts";
|
|
10
9
|
import type { controls } from "../reading/controls.inpage.ts";
|
|
11
10
|
import type { expectations } from "../reading/expect.inpage.ts";
|
|
@@ -22,6 +21,7 @@ import type { history } from "../timeline/history.inpage.ts";
|
|
|
22
21
|
import type { marks } from "../timeline/marks.inpage.ts";
|
|
23
22
|
import type { record } from "../timeline/record.inpage.ts";
|
|
24
23
|
import type { sight } from "../timeline/sight.inpage.ts";
|
|
24
|
+
import type { addresses } from "../url.ts";
|
|
25
25
|
import type { overlay } from "./overlay.inpage.ts";
|
|
26
26
|
import type { pose } from "./pose.inpage.ts";
|
|
27
27
|
|
|
@@ -19,8 +19,8 @@ import type { CDPSession, Page as PlaywrightPage } from "playwright-core";
|
|
|
19
19
|
import type { CaptureSource } from "../../Browser.ts";
|
|
20
20
|
import * as Errors from "../../BrowserError.ts";
|
|
21
21
|
import type { BrowserEvent } from "../../BrowserEvent.ts";
|
|
22
|
-
import * as BrowserClock from "../../Clock.ts";
|
|
23
22
|
import type { InputGuard, Point } from "../../Page.ts";
|
|
23
|
+
import * as BrowserClock from "../clock.ts";
|
|
24
24
|
import type { Gate } from "../input/gate.ts";
|
|
25
25
|
import * as Lane from "./lane.ts";
|
|
26
26
|
import type { Openings } from "./openings.ts";
|
|
@@ -35,7 +35,7 @@ export interface Settings {
|
|
|
35
35
|
readonly actionTimeout: Duration.Duration;
|
|
36
36
|
readonly policyTimeout: Duration.Duration;
|
|
37
37
|
readonly navigationTimeout: Duration.Duration;
|
|
38
|
-
/** How long screencast frames stay in `
|
|
38
|
+
/** How long screencast frames stay in `Frame.recent`, measured back from the newest. */
|
|
39
39
|
readonly frameHistory: Duration.Duration;
|
|
40
40
|
readonly guard: InputGuard | undefined;
|
|
41
41
|
/** The page clock's event name, when the browser runs one in each document. */
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a page does behind the functions of its types' modules, such as `Snapshot.read`. `Page`
|
|
3
|
+
* gains a member only for identity, order, time or input; everything else a page does is one of
|
|
4
|
+
* these, which each page carries under `key`, and the modules' functions reach it there. `Page`'s
|
|
5
|
+
* type names nothing callable there, so the functions are the only way in.
|
|
6
|
+
*/
|
|
7
|
+
import { type Effect, type Option, Predicate, type Scope } from "effect";
|
|
8
|
+
|
|
9
|
+
import type { BrowserError } from "../../BrowserError.ts";
|
|
10
|
+
import type { Box } from "../../BrowserEvent.ts";
|
|
11
|
+
import type { Changes, ChangesOptions } from "../../Change.ts";
|
|
12
|
+
import type {
|
|
13
|
+
Capture,
|
|
14
|
+
Frame,
|
|
15
|
+
FrameOptions,
|
|
16
|
+
Paint,
|
|
17
|
+
Region,
|
|
18
|
+
ScreencastOptions,
|
|
19
|
+
Zoom,
|
|
20
|
+
} from "../../Frame.ts";
|
|
21
|
+
import type { Layout, Picks } from "../../Layout.ts";
|
|
22
|
+
import type { Overlay } from "../../Overlay.ts";
|
|
23
|
+
import type { Page } from "../../Page.ts";
|
|
24
|
+
import type { Held } from "../../PageTime.ts";
|
|
25
|
+
import type { Poses } from "../../Pose.ts";
|
|
26
|
+
import type {
|
|
27
|
+
FindQuery,
|
|
28
|
+
Found,
|
|
29
|
+
Snapshot,
|
|
30
|
+
SnapshotOptions,
|
|
31
|
+
UntilResult,
|
|
32
|
+
UntilWant,
|
|
33
|
+
} from "../../Snapshot.ts";
|
|
34
|
+
import type { Text, TextOptions } from "../../Text.ts";
|
|
35
|
+
import type { Window, WindowOptions } from "../../Window.ts";
|
|
36
|
+
|
|
37
|
+
export const key = "~effect-browser/Page";
|
|
38
|
+
|
|
39
|
+
export interface Functions {
|
|
40
|
+
readonly snapshot: (options?: SnapshotOptions) => Effect.Effect<Snapshot, BrowserError>;
|
|
41
|
+
readonly find: (query?: FindQuery) => Effect.Effect<ReadonlyArray<Found>, BrowserError>;
|
|
42
|
+
readonly until: (
|
|
43
|
+
query: FindQuery,
|
|
44
|
+
want: UntilWant,
|
|
45
|
+
millis: number,
|
|
46
|
+
) => Effect.Effect<UntilResult, BrowserError>;
|
|
47
|
+
readonly text: (options?: TextOptions) => Effect.Effect<Text, BrowserError>;
|
|
48
|
+
readonly layout: (picks: Picks) => Effect.Effect<Layout, BrowserError>;
|
|
49
|
+
readonly changes: (options?: ChangesOptions) => Effect.Effect<Changes, BrowserError>;
|
|
50
|
+
readonly window: (options: WindowOptions) => Effect.Effect<Window, BrowserError>;
|
|
51
|
+
readonly overlay: Effect.Effect<Overlay, BrowserError, Scope.Scope>;
|
|
52
|
+
readonly drawn: Effect.Effect<Option.Option<ReadonlyArray<Box>>>;
|
|
53
|
+
readonly poses: Effect.Effect<Poses, BrowserError, Scope.Scope>;
|
|
54
|
+
readonly hold: Effect.Effect<Held, BrowserError, Scope.Scope>;
|
|
55
|
+
readonly frame: (options?: FrameOptions) => Effect.Effect<Frame, BrowserError>;
|
|
56
|
+
readonly zoom: (
|
|
57
|
+
region: Region,
|
|
58
|
+
options?: Pick<FrameOptions, "quality" | "format" | "scale">,
|
|
59
|
+
) => Effect.Effect<Zoom, BrowserError>;
|
|
60
|
+
readonly capture: (
|
|
61
|
+
options?: ScreencastOptions,
|
|
62
|
+
) => Effect.Effect<Capture, BrowserError, Scope.Scope>;
|
|
63
|
+
readonly recentFrames: Effect.Effect<ReadonlyArray<Frame>>;
|
|
64
|
+
readonly paint: (options: Paint) => Effect.Effect<void, BrowserError, Scope.Scope>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** What a page carries under `key`: its functions, out of reach of any type outside this class. */
|
|
68
|
+
export class Implementation {
|
|
69
|
+
readonly #functions: Functions;
|
|
70
|
+
|
|
71
|
+
constructor(functions: Functions) {
|
|
72
|
+
this.#functions = functions;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
static functionsOf(page: Page): Functions {
|
|
76
|
+
return page[key].#functions;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** What `page` does behind its types' modules' functions. */
|
|
81
|
+
export const functionsOf = (page: Page): Functions => Implementation.functionsOf(page);
|
|
82
|
+
|
|
83
|
+
/** A page, as the library made it: what `dual` tells from a function's other arguments. */
|
|
84
|
+
export const isPage = (value: unknown): value is Page => Predicate.hasProperty(value, key);
|
|
@@ -7,9 +7,9 @@ import { Deferred, Duration, Effect, Schedule } from "effect";
|
|
|
7
7
|
|
|
8
8
|
import { type Action, nameOf } from "../../Action.ts";
|
|
9
9
|
import { BrowserError, NavigationFailed, NotActionable, NotFound } from "../../BrowserError.ts";
|
|
10
|
-
import * as Url from "../../Url.ts";
|
|
11
10
|
import type { Guard } from "../input/guard.ts";
|
|
12
11
|
import type { InputMarks, Perform } from "../input/perform.ts";
|
|
12
|
+
import * as Url from "../url.ts";
|
|
13
13
|
import { failWith, type PageContext, refuse } from "./context.ts";
|
|
14
14
|
import { Current } from "./replies.ts";
|
|
15
15
|
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type BrowserError,
|
|
8
8
|
Closed,
|
|
9
9
|
Failed,
|
|
10
|
-
type
|
|
10
|
+
type BrowserErrorReason,
|
|
11
11
|
} from "../../BrowserError.ts";
|
|
12
12
|
import type * as Page from "../../Page.ts";
|
|
13
13
|
|
|
@@ -26,7 +26,7 @@ export const make = Effect.fnUntraced(function* (
|
|
|
26
26
|
registrations: Registrations,
|
|
27
27
|
closedBy: () => Closed["cause"],
|
|
28
28
|
) {
|
|
29
|
-
const failed = (reason:
|
|
29
|
+
const failed = (reason: BrowserErrorReason) => Exit.fail(undispatched("newPage", reason));
|
|
30
30
|
|
|
31
31
|
let active: Mark | undefined;
|
|
32
32
|
const gone = Deferred.makeUnsafe<never, BrowserError>();
|
|
@@ -7,10 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Effect, Option } from "effect";
|
|
9
9
|
|
|
10
|
-
import * as ActionPort from "../../ActionPort.ts";
|
|
11
10
|
import type { Frame } from "../../Frame.ts";
|
|
12
11
|
import { type Page, State } from "../../Page.ts";
|
|
13
|
-
import * as
|
|
12
|
+
import * as ActionPort from "../action-port.ts";
|
|
14
13
|
import * as Actions from "../input/actions.ts";
|
|
15
14
|
import * as Pictures from "../pictures/pictures.ts";
|
|
16
15
|
import * as Layouts from "../reading/layout.ts";
|
|
@@ -18,8 +17,10 @@ import * as Reading from "../reading/reading.ts";
|
|
|
18
17
|
import * as Ready from "../reading/ready.ts";
|
|
19
18
|
import * as Changes from "../timeline/changes.ts";
|
|
20
19
|
import * as Window from "../timeline/window.ts";
|
|
20
|
+
import * as Url from "../url.ts";
|
|
21
21
|
import * as Bridge from "./bridge.ts";
|
|
22
22
|
import * as Context from "./context.ts";
|
|
23
|
+
import { Implementation, key } from "./functions.ts";
|
|
23
24
|
import * as Navigation from "./navigation.ts";
|
|
24
25
|
import * as Overlay from "./overlay.ts";
|
|
25
26
|
import * as Poses from "./pose.ts";
|
|
@@ -44,8 +45,8 @@ export const make = Effect.fnUntraced(function* (options: Context.MakeOptions) {
|
|
|
44
45
|
const viewports = lane.shared<Effect.Success<Page["viewport"]>>("viewport", true);
|
|
45
46
|
|
|
46
47
|
// What the page's parts already know, asking it nothing: its documents as its own session saw
|
|
47
|
-
// them
|
|
48
|
-
const state = Effect.
|
|
48
|
+
// them.
|
|
49
|
+
const state = Effect.sync(() => {
|
|
49
50
|
const { document, url } = bridge.frameTag();
|
|
50
51
|
const committedAt = page.activity.documentAt;
|
|
51
52
|
|
|
@@ -57,9 +58,6 @@ export const make = Effect.fnUntraced(function* (options: Context.MakeOptions) {
|
|
|
57
58
|
document,
|
|
58
59
|
committedAt: Number.isFinite(committedAt) ? committedAt : undefined,
|
|
59
60
|
load: bridge.loaded(),
|
|
60
|
-
frame: Option.getOrUndefined(latest),
|
|
61
|
-
overlay: overlay.drawn(),
|
|
62
|
-
text: reading.viewedSince(committedAt),
|
|
63
61
|
});
|
|
64
62
|
});
|
|
65
63
|
|
|
@@ -89,50 +87,50 @@ export const make = Effect.fnUntraced(function* (options: Context.MakeOptions) {
|
|
|
89
87
|
);
|
|
90
88
|
|
|
91
89
|
const assembled: Page = {
|
|
90
|
+
[key]: new Implementation({
|
|
91
|
+
snapshot: reading.snapshot,
|
|
92
|
+
find: reading.find,
|
|
93
|
+
until: reading.until,
|
|
94
|
+
text: reading.text,
|
|
95
|
+
layout: Layouts.make(page, bridge),
|
|
96
|
+
changes,
|
|
97
|
+
window: Window.make(page, changes, capture.recent),
|
|
98
|
+
overlay: overlay.lease,
|
|
99
|
+
drawn: Effect.sync(() => Option.fromUndefinedOr(overlay.drawn())),
|
|
100
|
+
poses: poses.lease,
|
|
101
|
+
hold: Time.make(page, bridge, overlay, poses).hold,
|
|
102
|
+
frame: pictures.frame,
|
|
103
|
+
zoom: pictures.zoom,
|
|
104
|
+
capture: (options) =>
|
|
105
|
+
capture.open(options).pipe(
|
|
106
|
+
Effect.map((lease) => ({
|
|
107
|
+
...lease,
|
|
108
|
+
isCurrent: current,
|
|
109
|
+
confirm,
|
|
110
|
+
sync: capture.sync,
|
|
111
|
+
stats: pictures.captureStats,
|
|
112
|
+
})),
|
|
113
|
+
),
|
|
114
|
+
recentFrames: capture.recent,
|
|
115
|
+
paint: pictures.paint,
|
|
116
|
+
}),
|
|
92
117
|
...Scripts.make(page, bridge, input),
|
|
93
118
|
...ActionPort.methods(perform),
|
|
94
119
|
perform,
|
|
95
|
-
|
|
120
|
+
hostClock: page.clock,
|
|
96
121
|
afterInput,
|
|
97
|
-
until: reading.until,
|
|
98
|
-
capture: (options) =>
|
|
99
|
-
capture.open(options).pipe(
|
|
100
|
-
Effect.map((lease) => ({
|
|
101
|
-
...lease,
|
|
102
|
-
isCurrent: current,
|
|
103
|
-
confirm,
|
|
104
|
-
sync: capture.sync,
|
|
105
|
-
stats: pictures.captureStats,
|
|
106
|
-
})),
|
|
107
|
-
),
|
|
108
122
|
id,
|
|
109
123
|
url: Effect.sync(() => Url.redact(playwright.url())),
|
|
110
124
|
title: titles("", navigation.title.pipe(within("title"))).pipe(span("Page.title"), owned),
|
|
111
125
|
bringToFront: native("bringToFront", () => playwright.bringToFront()),
|
|
112
126
|
// Playwright answers once the page has closed, and at once for one already closed.
|
|
113
127
|
close: native("close", () => playwright.close()),
|
|
114
|
-
snapshot: reading.snapshot,
|
|
115
|
-
screenshot: pictures.screenshot,
|
|
116
|
-
frame: pictures.frame,
|
|
117
|
-
zoom: pictures.zoom,
|
|
118
|
-
paint: pictures.paint,
|
|
119
128
|
viewport: viewports("", viewport.viewportFor("viewport").pipe(within("viewport"))).pipe(
|
|
120
129
|
span("Page.viewport"),
|
|
121
130
|
owned,
|
|
122
131
|
),
|
|
123
|
-
find: reading.find,
|
|
124
|
-
layout: Layouts.make(page, bridge),
|
|
125
|
-
overlay: overlay.lease,
|
|
126
|
-
poses: poses.lease,
|
|
127
|
-
hold: Time.make(page, bridge, overlay, poses).hold,
|
|
128
|
-
text: reading.text,
|
|
129
|
-
changes,
|
|
130
|
-
window: Window.make(page, changes, capture.recent),
|
|
131
132
|
state,
|
|
132
133
|
ready: Ready.make(page, bridge),
|
|
133
|
-
screencast: capture.stream,
|
|
134
|
-
captureStats: pictures.captureStats,
|
|
135
|
-
recentFrames: capture.recent,
|
|
136
134
|
recentEvents: options.recentEvents,
|
|
137
135
|
};
|
|
138
136
|
|
|
@@ -5,13 +5,19 @@ import type { BrowserContext, CDPSession, Page as NativePage } from "playwright-
|
|
|
5
5
|
import type { CaptureSource } from "../../Browser.ts";
|
|
6
6
|
import { call } from "../../BrowserError.ts";
|
|
7
7
|
|
|
8
|
-
export const Operation = Context.Reference<string | undefined>(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
export const Operation = Context.Reference<string | undefined>(
|
|
9
|
+
"effect-browser/internal/page/ProtocolOperation",
|
|
10
|
+
{
|
|
11
|
+
defaultValue: () => undefined,
|
|
12
|
+
},
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const Script = Context.Reference<string | undefined>(
|
|
16
|
+
"effect-browser/internal/page/ProtocolScript",
|
|
17
|
+
{
|
|
18
|
+
defaultValue: () => undefined,
|
|
19
|
+
},
|
|
20
|
+
);
|
|
15
21
|
|
|
16
22
|
export interface Session {
|
|
17
23
|
readonly channel: "page" | "capture" | "browser";
|
|
@@ -50,7 +56,7 @@ export interface Hooks {
|
|
|
50
56
|
readonly opened?: ((session: Session, inject: (event: Event) => void) => () => void) | undefined;
|
|
51
57
|
}
|
|
52
58
|
|
|
53
|
-
export const Current = Context.Reference<Hooks>("effect-browser/ProtocolPort", {
|
|
59
|
+
export const Current = Context.Reference<Hooks>("effect-browser/internal/page/ProtocolPort", {
|
|
54
60
|
defaultValue: () => ({}),
|
|
55
61
|
});
|
|
56
62
|
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
undispatched,
|
|
14
14
|
} from "../../BrowserError.ts";
|
|
15
15
|
import { type BrowserEvent, RequestRefused } from "../../BrowserEvent.ts";
|
|
16
|
-
import * as Url from "
|
|
16
|
+
import * as Url from "../url.ts";
|
|
17
17
|
import * as Port from "./port.ts";
|
|
18
18
|
import * as Owner from "./request-owner.ts";
|
|
19
19
|
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
refuse,
|
|
12
12
|
} from "../../BrowserError.ts";
|
|
13
13
|
import { InputRequest, type Page } from "../../Page.ts";
|
|
14
|
-
import * as Url from "../../Url.ts";
|
|
15
14
|
import type { Input } from "../input/actions.ts";
|
|
15
|
+
import * as Url from "../url.ts";
|
|
16
16
|
import type { Bridge } from "./bridge.ts";
|
|
17
17
|
import { contextGone, type PageContext } from "./context.ts";
|
|
18
18
|
|
|
@@ -6,8 +6,8 @@ import { Duration, Effect, Option, Schema, type Scope } from "effect";
|
|
|
6
6
|
|
|
7
7
|
import { type BrowserError, NotActionable } from "../../BrowserError.ts";
|
|
8
8
|
import { Box } from "../../BrowserEvent.ts";
|
|
9
|
-
import { Point } from "../../Geometry.ts";
|
|
10
9
|
import type { Held, Step } from "../../PageTime.ts";
|
|
10
|
+
import { Point } from "../geometry.ts";
|
|
11
11
|
import { type Bridge, scriptCall } from "./bridge.ts";
|
|
12
12
|
import { decodeWith, failWith, type PageContext, refuse } from "./context.ts";
|
|
13
13
|
import type { Overlays } from "./overlay.ts";
|
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
import { Base64 } from "effect/encoding";
|
|
19
19
|
|
|
20
20
|
import { type BrowserError, InvalidRequest } from "../../BrowserError.ts";
|
|
21
|
-
import { type Estimate, monotonicMillis } from "../../Clock.ts";
|
|
22
21
|
import { CaptureStats, type Frame, type ScreencastOptions, sameCapture } from "../../Frame.ts";
|
|
22
|
+
import { type Estimate, monotonicMillis } from "../clock.ts";
|
|
23
23
|
import { undispatched } from "../page/context.ts";
|
|
24
24
|
import { tally } from "./counts.ts";
|
|
25
25
|
import { readViewport, sizeFilter, type Size } from "./dimensions.ts";
|
|
@@ -82,7 +82,6 @@ export interface Controller {
|
|
|
82
82
|
BrowserError,
|
|
83
83
|
Scope.Scope
|
|
84
84
|
>;
|
|
85
|
-
readonly stream: (options?: ScreencastOptions) => Stream.Stream<Frame, BrowserError>;
|
|
86
85
|
readonly latest: Effect.Effect<Option.Option<Frame>>;
|
|
87
86
|
readonly recent: Effect.Effect<ReadonlyArray<Frame>>;
|
|
88
87
|
/** Lifetime counts, or those of the latest `windowMillis`, at most `countsKept`. */
|
|
@@ -668,8 +667,6 @@ export const make = (options: Options) =>
|
|
|
668
667
|
|
|
669
668
|
return {
|
|
670
669
|
open,
|
|
671
|
-
stream: (options?: ScreencastOptions) =>
|
|
672
|
-
Stream.unwrap(Effect.map(open(options), ({ stream }) => stream)),
|
|
673
670
|
latest: Effect.sync(() => latest),
|
|
674
671
|
recent: Effect.sync(() => history),
|
|
675
672
|
active: Effect.sync(() => generation !== undefined && generation.state._tag !== "Stopped"),
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { Clock, Duration, Effect, Queue } from "effect";
|
|
3
3
|
|
|
4
4
|
import type { BrowserError } from "../../BrowserError.ts";
|
|
5
|
-
import { monotonicMillis } from "../../Clock.ts";
|
|
6
5
|
import type { Frame } from "../../Frame.ts";
|
|
6
|
+
import { monotonicMillis } from "../clock.ts";
|
|
7
7
|
|
|
8
8
|
export interface Size {
|
|
9
9
|
readonly width: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Native frame timing and monotonic evidence across clock recalibration. */
|
|
2
2
|
import type { Clock } from "effect";
|
|
3
3
|
|
|
4
|
-
import { type Estimate, monotonicMillis, toHostTime, uncertaintyAt } from "../../Clock.ts";
|
|
5
4
|
import { BrowserPaint, Frame } from "../../Frame.ts";
|
|
5
|
+
import { type Estimate, monotonicMillis, toHostTime, uncertaintyAt } from "../clock.ts";
|
|
6
6
|
import type { NativeFrame, Transport } from "./transport.ts";
|
|
7
7
|
|
|
8
8
|
/**
|