effect-browser 0.3.0-beta.23 → 0.3.0-beta.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +437 -142
- 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 +2 -2
- package/dist/BrowserEvent.mjs +185 -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 +40 -7
- 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/InputStyle.d.mts +153 -0
- package/dist/InputStyle.mjs +2 -0
- package/dist/Layout.d.mts +2 -0
- package/dist/Layout.mjs +123 -0
- package/dist/Layout.mjs.map +1 -0
- package/dist/Overlay.d.mts +2 -0
- package/dist/Overlay.mjs +58 -0
- package/dist/Overlay.mjs.map +1 -0
- package/dist/Page.d.mts +2 -2
- package/dist/Page.mjs +2 -2
- package/dist/PageTime.d.mts +2 -0
- package/dist/PageTime.mjs +17 -0
- package/dist/PageTime.mjs.map +1 -0
- package/dist/Pose.d.mts +2 -0
- package/dist/Pose.mjs +65 -0
- package/dist/Pose.mjs.map +1 -0
- package/dist/Site.d.mts +984 -0
- package/dist/Site.mjs +110 -0
- package/dist/Site.mjs.map +1 -0
- 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 -15
- package/dist/index.mjs +9 -8
- package/dist/{Action-24sLOubi.d.mts → internal/Action-CkanNTUw.d.mts} +64 -4
- package/dist/{Browser-wZhwZSlG.d.mts → internal/Browser-DD9Vm1c-.d.mts} +80 -10
- package/dist/{Browser-BKPAbyys.mjs → internal/Browser-vzD7i2oj.mjs} +658 -495
- 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-lLqJ3GJS.d.mts → internal/BrowserEvent-tGPYYf6R.d.mts} +197 -18
- package/dist/internal/BrowserTools-Yi3lOX4h.mjs +497 -0
- package/dist/internal/BrowserTools-Yi3lOX4h.mjs.map +1 -0
- package/dist/{Style-AO4V7Czt.mjs → internal/InputStyle-CPzxoN4g.mjs} +94 -16
- 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} +54 -21
- package/dist/internal/Page-BfGxn7oN.d.mts +1553 -0
- package/dist/{Page-BF5izr8R.mjs → internal/Page-DqF-tuTx.mjs} +62 -72
- 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-2KHI4_KN.d.mts → internal/connection-BaB0vp1o.d.mts} +6 -6
- package/dist/{connection-CK83pvqP.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-CyVZQHZL.d.mts +49 -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} +24 -19
- 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/internal/pose.inpage-CBFeWcVa.mjs +1996 -0
- 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/presentation/Film.d.mts +332 -0
- package/dist/presentation/Film.mjs +298 -0
- 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 +48 -6
- package/dist/presentation/Presentation.mjs +28 -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 -337
- package/dist/testing/index.mjs +6 -515
- 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 -133
- package/src/Action.ts +73 -8
- package/src/Browser.ts +85 -14
- package/src/BrowserError.ts +258 -63
- package/src/BrowserEvent.ts +264 -48
- package/src/Cdp.ts +42 -0
- package/src/Change.ts +75 -4
- package/src/Frame.ts +247 -14
- package/src/{Style.ts → InputStyle.ts} +130 -18
- package/src/Layout.ts +187 -0
- package/src/Overlay.ts +76 -0
- package/src/Page.ts +144 -275
- package/src/PageTime.ts +72 -0
- package/src/Pose.ts +81 -0
- package/src/Site.ts +136 -0
- 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 +87 -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 +35 -7
- package/src/internal/input/pointer.ts +9 -6
- package/src/internal/input/targets.inpage.ts +3 -3
- package/src/internal/input/targets.ts +1 -1
- package/src/{Matching.ts → internal/matching.ts} +28 -19
- package/src/internal/page/bridge.ts +67 -35
- package/src/internal/page/clock.inpage.ts +306 -0
- package/src/internal/page/compose.inpage.ts +101 -0
- package/src/internal/page/context.ts +4 -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/overlay.inpage.ts +96 -0
- package/src/internal/page/overlay.ts +89 -0
- package/src/internal/page/page.ts +39 -29
- package/src/internal/page/port.ts +14 -8
- package/src/internal/page/pose.inpage.ts +200 -0
- package/src/internal/page/pose.ts +80 -0
- 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.inpage.ts +49 -0
- package/src/internal/page/time.ts +122 -0
- package/src/internal/page/viewport.ts +3 -2
- 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 +144 -91
- 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 +193 -0
- package/src/internal/reading/layout.ts +101 -0
- package/src/internal/reading/names.inpage.ts +15 -0
- package/src/internal/reading/outline.inpage.ts +5 -21
- package/src/internal/reading/reading.ts +33 -21
- package/src/internal/reading/ready.inpage.ts +21 -26
- package/src/internal/reading/ready.ts +26 -5
- package/src/internal/reading/subjects.inpage.ts +3 -3
- package/src/internal/reading/text.inpage.ts +3 -16
- package/src/internal/reading/walk.inpage.ts +1 -1
- package/src/internal/timeline/changes.inpage.ts +7 -15
- package/src/internal/timeline/changes.ts +17 -5
- package/src/internal/timeline/record.inpage.ts +15 -6
- 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/presentation/Film.ts +451 -0
- package/src/presentation/Motion.ts +45 -3
- package/src/presentation/Presentation.ts +60 -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 -51
- package/src/{moment → timeline}/Moment.ts +79 -29
- package/src/{stillness → timeline}/Stillness.ts +89 -46
- package/src/timeline/index.ts +18 -0
- package/src/{stillness/Pixels.ts → timeline/internal/pixels.ts} +27 -1
- 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-BKPAbyys.mjs.map +0 -1
- package/dist/Change-Ba7INmay.d.mts +0 -69
- package/dist/Clock.d.mts +0 -57
- 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.d.mts +0 -37
- package/dist/Matching.mjs.map +0 -1
- package/dist/Page-BF5izr8R.mjs.map +0 -1
- package/dist/Page-CvsOEorc.d.mts +0 -566
- package/dist/Released-tURbFmal.d.mts +0 -15
- package/dist/Snapshot-CtBVOtuu.d.mts +0 -73
- package/dist/Stillness-CNlvayIo.mjs +0 -136
- package/dist/Stillness-CNlvayIo.mjs.map +0 -1
- package/dist/Style-AO4V7Czt.mjs.map +0 -1
- package/dist/Style.d.mts +0 -72
- package/dist/Style.mjs +0 -2
- package/dist/Url.d.mts +0 -26
- package/dist/Url.mjs.map +0 -1
- package/dist/Window-CMddGMt1.d.mts +0 -34
- package/dist/connection-CK83pvqP.mjs.map +0 -1
- package/dist/moment/Moment.mjs.map +0 -1
- package/dist/plan/index.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/{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/BrowserEvent.ts
CHANGED
|
@@ -8,15 +8,24 @@
|
|
|
8
8
|
* A page is named by its CDP target id, which stays the same across reconnects, and every URL is
|
|
9
9
|
* reported without its userinfo or known secret parameters.
|
|
10
10
|
*
|
|
11
|
+
* @stability stable
|
|
11
12
|
* @since 0.3.0
|
|
12
13
|
*/
|
|
13
14
|
import { Schema } from "effect";
|
|
14
15
|
|
|
15
16
|
import { Action as ActionValue, Name } from "./Action.ts";
|
|
16
|
-
import * as Motion from "./
|
|
17
|
+
import * as Motion from "./internal/geometry.ts";
|
|
17
18
|
|
|
18
|
-
/**
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* A page opened, and the page that opened it, as a link or `window.open` does, if one did.
|
|
21
|
+
*
|
|
22
|
+
* @stability stable
|
|
23
|
+
* @category schemas
|
|
24
|
+
* @since 0.3.0
|
|
25
|
+
*/
|
|
26
|
+
export class PageOpened extends Schema.TaggedClass<PageOpened>(
|
|
27
|
+
"effect-browser/BrowserEvent/PageOpened",
|
|
28
|
+
)("PageOpened", {
|
|
20
29
|
at: Schema.Finite,
|
|
21
30
|
page: Schema.String,
|
|
22
31
|
url: Schema.String,
|
|
@@ -26,8 +35,14 @@ export class PageOpened extends Schema.TaggedClass<PageOpened>()("PageOpened", {
|
|
|
26
35
|
/**
|
|
27
36
|
* The page closed (`page`), or crashed and was closed (`crashed`). A page lost with its browser
|
|
28
37
|
* has no event of its own: `Disconnected` stands for all of them.
|
|
38
|
+
*
|
|
39
|
+
* @stability stable
|
|
40
|
+
* @category schemas
|
|
41
|
+
* @since 0.3.0
|
|
29
42
|
*/
|
|
30
|
-
export class PageClosed extends Schema.TaggedClass<PageClosed>(
|
|
43
|
+
export class PageClosed extends Schema.TaggedClass<PageClosed>(
|
|
44
|
+
"effect-browser/BrowserEvent/PageClosed",
|
|
45
|
+
)("PageClosed", {
|
|
31
46
|
at: Schema.Finite,
|
|
32
47
|
page: Schema.String,
|
|
33
48
|
cause: Schema.Literals(["page", "crashed"]),
|
|
@@ -36,8 +51,14 @@ export class PageClosed extends Schema.TaggedClass<PageClosed>()("PageClosed", {
|
|
|
36
51
|
/**
|
|
37
52
|
* A tab the site opened that the library could not track, as its registration failed with
|
|
38
53
|
* `detail`. A tab that closed as it opened has no event.
|
|
54
|
+
*
|
|
55
|
+
* @stability stable
|
|
56
|
+
* @category schemas
|
|
57
|
+
* @since 0.3.0
|
|
39
58
|
*/
|
|
40
|
-
export class PageUntracked extends Schema.TaggedClass<PageUntracked>(
|
|
59
|
+
export class PageUntracked extends Schema.TaggedClass<PageUntracked>(
|
|
60
|
+
"effect-browser/BrowserEvent/PageUntracked",
|
|
61
|
+
)("PageUntracked", {
|
|
41
62
|
at: Schema.Finite,
|
|
42
63
|
url: Schema.String,
|
|
43
64
|
detail: Schema.String,
|
|
@@ -46,8 +67,14 @@ export class PageUntracked extends Schema.TaggedClass<PageUntracked>()("PageUntr
|
|
|
46
67
|
/**
|
|
47
68
|
* The page's main frame moved to `url`: into a new document, or within the current one
|
|
48
69
|
* (`sameDocument`), as `pushState` and fragment links do. Frames carry the document they followed.
|
|
70
|
+
*
|
|
71
|
+
* @stability stable
|
|
72
|
+
* @category schemas
|
|
73
|
+
* @since 0.3.0
|
|
49
74
|
*/
|
|
50
|
-
export class Navigated extends Schema.TaggedClass<Navigated>(
|
|
75
|
+
export class Navigated extends Schema.TaggedClass<Navigated>(
|
|
76
|
+
"effect-browser/BrowserEvent/Navigated",
|
|
77
|
+
)("Navigated", {
|
|
51
78
|
at: Schema.Finite,
|
|
52
79
|
page: Schema.String,
|
|
53
80
|
url: Schema.String,
|
|
@@ -60,8 +87,16 @@ export class Navigated extends Schema.TaggedClass<Navigated>()("Navigated", {
|
|
|
60
87
|
sameDocument: Schema.Boolean,
|
|
61
88
|
}) {}
|
|
62
89
|
|
|
63
|
-
/**
|
|
64
|
-
|
|
90
|
+
/**
|
|
91
|
+
* The page's document finished parsing (`domcontentloaded`) or loading (`load`).
|
|
92
|
+
*
|
|
93
|
+
* @stability stable
|
|
94
|
+
* @category schemas
|
|
95
|
+
* @since 0.3.0
|
|
96
|
+
*/
|
|
97
|
+
export class PageLoaded extends Schema.TaggedClass<PageLoaded>(
|
|
98
|
+
"effect-browser/BrowserEvent/PageLoaded",
|
|
99
|
+
)("PageLoaded", {
|
|
65
100
|
at: Schema.Finite,
|
|
66
101
|
page: Schema.String,
|
|
67
102
|
state: Schema.Literals(["domcontentloaded", "load"]),
|
|
@@ -70,19 +105,44 @@ export class PageLoaded extends Schema.TaggedClass<PageLoaded>()("PageLoaded", {
|
|
|
70
105
|
/**
|
|
71
106
|
* Why a browser was lost to its owner: its connection dropped (`connection`), its provider ended
|
|
72
107
|
* its session, at or after the session's `expiresAt` (`session`), or its owner released it.
|
|
108
|
+
*
|
|
109
|
+
* @stability stable
|
|
110
|
+
* @category schemas
|
|
111
|
+
* @since 0.3.0
|
|
73
112
|
*/
|
|
74
113
|
export const DisconnectCause = Schema.Literals(["connection", "session", "released"]);
|
|
75
114
|
|
|
115
|
+
/**
|
|
116
|
+
* @stability stable
|
|
117
|
+
* @category models
|
|
118
|
+
* @since 0.3.0
|
|
119
|
+
*/
|
|
76
120
|
export type DisconnectCause = typeof DisconnectCause.Type;
|
|
77
121
|
|
|
78
|
-
/**
|
|
79
|
-
|
|
122
|
+
/**
|
|
123
|
+
* The browser was lost to its owner, with every page in it. It happens once.
|
|
124
|
+
*
|
|
125
|
+
* @stability stable
|
|
126
|
+
* @category schemas
|
|
127
|
+
* @since 0.3.0
|
|
128
|
+
*/
|
|
129
|
+
export class Disconnected extends Schema.TaggedClass<Disconnected>(
|
|
130
|
+
"effect-browser/BrowserEvent/Disconnected",
|
|
131
|
+
)("Disconnected", {
|
|
80
132
|
at: Schema.Finite,
|
|
81
133
|
cause: DisconnectCause,
|
|
82
134
|
}) {}
|
|
83
135
|
|
|
84
|
-
/**
|
|
85
|
-
|
|
136
|
+
/**
|
|
137
|
+
* The provider ends this browser's session at `expiresAt`, a wall-clock instant.
|
|
138
|
+
*
|
|
139
|
+
* @stability stable
|
|
140
|
+
* @category schemas
|
|
141
|
+
* @since 0.3.0
|
|
142
|
+
*/
|
|
143
|
+
export class SessionEnding extends Schema.TaggedClass<SessionEnding>(
|
|
144
|
+
"effect-browser/BrowserEvent/SessionEnding",
|
|
145
|
+
)("SessionEnding", {
|
|
86
146
|
at: Schema.Finite,
|
|
87
147
|
expiresAt: Schema.DateTimeUtc,
|
|
88
148
|
}) {}
|
|
@@ -93,6 +153,10 @@ export class SessionEnding extends Schema.TaggedClass<SessionEnding>()("SessionE
|
|
|
93
153
|
* `column` the header over it; elsewhere, `label` is the words just before it in its row, item,
|
|
94
154
|
* group or block, at most 40 characters. `heading` is the nearest heading above it, left out for
|
|
95
155
|
* what is pinned to the viewport. Row, column and heading are at most 60 characters.
|
|
156
|
+
*
|
|
157
|
+
* @stability stable
|
|
158
|
+
* @category schemas
|
|
159
|
+
* @since 0.3.0
|
|
96
160
|
*/
|
|
97
161
|
export const SubjectContext = Schema.Struct({
|
|
98
162
|
row: Schema.optional(Schema.String),
|
|
@@ -101,15 +165,24 @@ export const SubjectContext = Schema.Struct({
|
|
|
101
165
|
heading: Schema.optional(Schema.String),
|
|
102
166
|
});
|
|
103
167
|
|
|
168
|
+
/**
|
|
169
|
+
* @stability stable
|
|
170
|
+
* @category models
|
|
171
|
+
* @since 0.3.0
|
|
172
|
+
*/
|
|
104
173
|
export type SubjectContext = typeof SubjectContext.Type;
|
|
105
174
|
|
|
106
175
|
/**
|
|
107
|
-
* What an input acted on, or what `
|
|
176
|
+
* What an input acted on, or what `Snapshot.find` found, as the page named it then: its role (null
|
|
108
177
|
* when it has none), its accessible name (empty when it has none), its lowercase tag and its
|
|
109
178
|
* context. For a point, it is the control under the point, or else the element painted there.
|
|
110
179
|
* Unlike a ref, it keeps its meaning after the page changes.
|
|
180
|
+
*
|
|
181
|
+
* @stability stable
|
|
182
|
+
* @category schemas
|
|
183
|
+
* @since 0.3.0
|
|
111
184
|
*/
|
|
112
|
-
export class Subject extends Schema.Class<Subject>("effect-browser/Subject")({
|
|
185
|
+
export class Subject extends Schema.Class<Subject>("effect-browser/BrowserEvent/Subject")({
|
|
113
186
|
role: Schema.NullOr(Schema.String),
|
|
114
187
|
name: Schema.String,
|
|
115
188
|
tag: Schema.String,
|
|
@@ -118,13 +191,24 @@ export class Subject extends Schema.Class<Subject>("effect-browser/Subject")({
|
|
|
118
191
|
|
|
119
192
|
const Button = Schema.Literals(["left", "right", "middle"]);
|
|
120
193
|
|
|
121
|
-
/**
|
|
194
|
+
/**
|
|
195
|
+
* An element's box in viewport CSS pixels; it may lie partly or wholly outside the viewport.
|
|
196
|
+
*
|
|
197
|
+
* @stability stable
|
|
198
|
+
* @category schemas
|
|
199
|
+
* @since 0.3.0
|
|
200
|
+
*/
|
|
122
201
|
export const Box = Schema.Struct({
|
|
123
202
|
...Motion.Point.fields,
|
|
124
203
|
width: Schema.Finite,
|
|
125
204
|
height: Schema.Finite,
|
|
126
205
|
});
|
|
127
206
|
|
|
207
|
+
/**
|
|
208
|
+
* @stability stable
|
|
209
|
+
* @category models
|
|
210
|
+
* @since 0.3.0
|
|
211
|
+
*/
|
|
128
212
|
export type Box = typeof Box.Type;
|
|
129
213
|
|
|
130
214
|
/**
|
|
@@ -134,34 +218,73 @@ export type Box = typeof Box.Type;
|
|
|
134
218
|
* action that failed before finding its target has neither. Point actions carry the viewport
|
|
135
219
|
* point they used. `correlation` is the id its caller gave it with `Page.correlate`, such as a
|
|
136
220
|
* model's tool call id.
|
|
221
|
+
*
|
|
222
|
+
* @stability stable
|
|
223
|
+
* @category schemas
|
|
224
|
+
* @since 0.3.0
|
|
225
|
+
*/
|
|
226
|
+
export class Action extends Schema.TaggedClass<Action>("effect-browser/BrowserEvent/Action")(
|
|
227
|
+
"Action",
|
|
228
|
+
{
|
|
229
|
+
at: Schema.Finite,
|
|
230
|
+
startedAt: Schema.Finite,
|
|
231
|
+
page: Schema.String,
|
|
232
|
+
name: Name,
|
|
233
|
+
/** The decoded call, with secrets removed before publication. */
|
|
234
|
+
value: ActionValue,
|
|
235
|
+
/** The address when the action ended; absent in events recorded by older releases. */
|
|
236
|
+
url: Schema.optional(Schema.String),
|
|
237
|
+
correlation: Schema.optional(Schema.String),
|
|
238
|
+
target: Schema.optional(Schema.String),
|
|
239
|
+
subject: Schema.optional(Subject),
|
|
240
|
+
to: Schema.optional(Subject),
|
|
241
|
+
/** For an action at a point, the box of what it found there. */
|
|
242
|
+
box: Schema.optional(Box),
|
|
243
|
+
text: Schema.optional(Schema.String),
|
|
244
|
+
x: Schema.optional(Motion.Point.fields.x),
|
|
245
|
+
y: Schema.optional(Motion.Point.fields.y),
|
|
246
|
+
ok: Schema.Boolean,
|
|
247
|
+
dispatched: Schema.Boolean,
|
|
248
|
+
error: Schema.optional(Schema.String),
|
|
249
|
+
},
|
|
250
|
+
) {}
|
|
251
|
+
|
|
252
|
+
const Sequence = Schema.Int.check(Schema.isGreaterThan(0));
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* An action found its target and is about to send input there: published once, before its pointer
|
|
256
|
+
* travels to the target, with what its `Action` will record of it. A glide that only scrolls the
|
|
257
|
+
* target into view comes before. `x` and `y` are where the pointer goes, in viewport CSS pixels; for
|
|
258
|
+
* a drag, its start. Input with no pointer travel, such as keys or typing into the focused field,
|
|
259
|
+
* announces nothing.
|
|
260
|
+
*
|
|
261
|
+
* @stability stable
|
|
262
|
+
* @category schemas
|
|
263
|
+
* @since 0.3.0
|
|
137
264
|
*/
|
|
138
|
-
export class
|
|
265
|
+
export class ActionAnnounced extends Schema.TaggedClass<ActionAnnounced>(
|
|
266
|
+
"effect-browser/BrowserEvent/ActionAnnounced",
|
|
267
|
+
)("ActionAnnounced", {
|
|
139
268
|
at: Schema.Finite,
|
|
140
|
-
startedAt: Schema.Finite,
|
|
141
269
|
page: Schema.String,
|
|
142
270
|
name: Name,
|
|
143
|
-
/** The decoded call, with secrets removed before publication. */
|
|
144
|
-
value: ActionValue,
|
|
145
|
-
/** The address when the action ended; absent in events recorded by older releases. */
|
|
146
|
-
url: Schema.optional(Schema.String),
|
|
147
271
|
correlation: Schema.optional(Schema.String),
|
|
148
|
-
target: Schema.optional(Schema.String),
|
|
149
272
|
subject: Schema.optional(Subject),
|
|
150
273
|
to: Schema.optional(Subject),
|
|
151
|
-
/** For an action at a point, the box of what it found there. */
|
|
152
274
|
box: Schema.optional(Box),
|
|
153
|
-
|
|
154
|
-
x: Schema.optional(Motion.Point.fields.x),
|
|
155
|
-
y: Schema.optional(Motion.Point.fields.y),
|
|
156
|
-
ok: Schema.Boolean,
|
|
157
|
-
dispatched: Schema.Boolean,
|
|
158
|
-
error: Schema.optional(Schema.String),
|
|
275
|
+
...Motion.Point.fields,
|
|
159
276
|
}) {}
|
|
160
277
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
278
|
+
/**
|
|
279
|
+
* One whole glide, published before its first input. Offsets use the host monotonic clock.
|
|
280
|
+
*
|
|
281
|
+
* @stability stable
|
|
282
|
+
* @category schemas
|
|
283
|
+
* @since 0.3.0
|
|
284
|
+
*/
|
|
285
|
+
export class TrackPlanned extends Schema.TaggedClass<TrackPlanned>(
|
|
286
|
+
"effect-browser/BrowserEvent/TrackPlanned",
|
|
287
|
+
)("TrackPlanned", {
|
|
165
288
|
at: Schema.Finite,
|
|
166
289
|
page: Schema.String,
|
|
167
290
|
from: Motion.Point,
|
|
@@ -172,8 +295,14 @@ export class TrackPlanned extends Schema.TaggedClass<TrackPlanned>()("TrackPlann
|
|
|
172
295
|
* The submitted prefix of a glide. `plan` is its TrackPlanned envelope sequence; `dispatched`
|
|
173
296
|
* counts samples. `complete` means every sample was submitted, not acknowledged by the browser.
|
|
174
297
|
* The terminal point clips a canceled plan so a compositor never draws its unrealized future.
|
|
298
|
+
*
|
|
299
|
+
* @stability stable
|
|
300
|
+
* @category schemas
|
|
301
|
+
* @since 0.3.0
|
|
175
302
|
*/
|
|
176
|
-
export class TrackPerformed extends Schema.TaggedClass<TrackPerformed>(
|
|
303
|
+
export class TrackPerformed extends Schema.TaggedClass<TrackPerformed>(
|
|
304
|
+
"effect-browser/BrowserEvent/TrackPerformed",
|
|
305
|
+
)("TrackPerformed", {
|
|
177
306
|
at: Schema.Finite,
|
|
178
307
|
page: Schema.String,
|
|
179
308
|
plan: Sequence,
|
|
@@ -182,7 +311,14 @@ export class TrackPerformed extends Schema.TaggedClass<TrackPerformed>()("TrackP
|
|
|
182
311
|
complete: Schema.Boolean,
|
|
183
312
|
}) {}
|
|
184
313
|
|
|
185
|
-
|
|
314
|
+
/**
|
|
315
|
+
* @stability stable
|
|
316
|
+
* @category schemas
|
|
317
|
+
* @since 0.3.0
|
|
318
|
+
*/
|
|
319
|
+
export class PointerPressed extends Schema.TaggedClass<PointerPressed>(
|
|
320
|
+
"effect-browser/BrowserEvent/PointerPressed",
|
|
321
|
+
)("PointerPressed", {
|
|
186
322
|
at: Schema.Finite,
|
|
187
323
|
page: Schema.String,
|
|
188
324
|
...Motion.Point.fields,
|
|
@@ -190,7 +326,14 @@ export class PointerPressed extends Schema.TaggedClass<PointerPressed>()("Pointe
|
|
|
190
326
|
clickCount: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
191
327
|
}) {}
|
|
192
328
|
|
|
193
|
-
|
|
329
|
+
/**
|
|
330
|
+
* @stability stable
|
|
331
|
+
* @category schemas
|
|
332
|
+
* @since 0.3.0
|
|
333
|
+
*/
|
|
334
|
+
export class PointerReleased extends Schema.TaggedClass<PointerReleased>(
|
|
335
|
+
"effect-browser/BrowserEvent/PointerReleased",
|
|
336
|
+
)("PointerReleased", {
|
|
194
337
|
at: Schema.Finite,
|
|
195
338
|
page: Schema.String,
|
|
196
339
|
...Motion.Point.fields,
|
|
@@ -198,7 +341,14 @@ export class PointerReleased extends Schema.TaggedClass<PointerReleased>()("Poin
|
|
|
198
341
|
clickCount: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
199
342
|
}) {}
|
|
200
343
|
|
|
201
|
-
|
|
344
|
+
/**
|
|
345
|
+
* @stability stable
|
|
346
|
+
* @category schemas
|
|
347
|
+
* @since 0.3.0
|
|
348
|
+
*/
|
|
349
|
+
export class WheelScrolled extends Schema.TaggedClass<WheelScrolled>(
|
|
350
|
+
"effect-browser/BrowserEvent/WheelScrolled",
|
|
351
|
+
)("WheelScrolled", {
|
|
202
352
|
at: Schema.Finite,
|
|
203
353
|
page: Schema.String,
|
|
204
354
|
...Motion.Point.fields,
|
|
@@ -206,28 +356,57 @@ export class WheelScrolled extends Schema.TaggedClass<WheelScrolled>()("WheelScr
|
|
|
206
356
|
dy: Schema.Finite,
|
|
207
357
|
}) {}
|
|
208
358
|
|
|
209
|
-
|
|
359
|
+
/**
|
|
360
|
+
* @stability stable
|
|
361
|
+
* @category schemas
|
|
362
|
+
* @since 0.3.0
|
|
363
|
+
*/
|
|
364
|
+
export class KeyChanged extends Schema.TaggedClass<KeyChanged>(
|
|
365
|
+
"effect-browser/BrowserEvent/KeyChanged",
|
|
366
|
+
)("KeyChanged", {
|
|
210
367
|
at: Schema.Finite,
|
|
211
368
|
page: Schema.String,
|
|
212
369
|
key: Schema.String,
|
|
213
370
|
phase: Schema.Literals(["down", "up"]),
|
|
214
371
|
}) {}
|
|
215
372
|
|
|
216
|
-
/**
|
|
217
|
-
|
|
373
|
+
/**
|
|
374
|
+
* Literal text insertion has no corresponding key events, including Unicode and newlines.
|
|
375
|
+
*
|
|
376
|
+
* @stability stable
|
|
377
|
+
* @category schemas
|
|
378
|
+
* @since 0.3.0
|
|
379
|
+
*/
|
|
380
|
+
export class TextInserted extends Schema.TaggedClass<TextInserted>(
|
|
381
|
+
"effect-browser/BrowserEvent/TextInserted",
|
|
382
|
+
)("TextInserted", {
|
|
218
383
|
at: Schema.Finite,
|
|
219
384
|
page: Schema.String,
|
|
220
385
|
text: Schema.String,
|
|
221
386
|
}) {}
|
|
222
387
|
|
|
223
|
-
/**
|
|
224
|
-
|
|
388
|
+
/**
|
|
389
|
+
* The target's CSS cursor, obtained during target resolution without another browser call.
|
|
390
|
+
*
|
|
391
|
+
* @stability stable
|
|
392
|
+
* @category schemas
|
|
393
|
+
* @since 0.3.0
|
|
394
|
+
*/
|
|
395
|
+
export class CursorChanged extends Schema.TaggedClass<CursorChanged>(
|
|
396
|
+
"effect-browser/BrowserEvent/CursorChanged",
|
|
397
|
+
)("CursorChanged", {
|
|
225
398
|
at: Schema.Finite,
|
|
226
399
|
page: Schema.String,
|
|
227
400
|
cursor: Schema.String,
|
|
228
401
|
}) {}
|
|
229
402
|
|
|
403
|
+
/**
|
|
404
|
+
* @stability stable
|
|
405
|
+
* @category schemas
|
|
406
|
+
* @since 0.3.0
|
|
407
|
+
*/
|
|
230
408
|
export const TrackEvent = Schema.Union([
|
|
409
|
+
ActionAnnounced,
|
|
231
410
|
TrackPlanned,
|
|
232
411
|
TrackPerformed,
|
|
233
412
|
PointerPressed,
|
|
@@ -238,13 +417,24 @@ export const TrackEvent = Schema.Union([
|
|
|
238
417
|
CursorChanged,
|
|
239
418
|
]);
|
|
240
419
|
|
|
420
|
+
/**
|
|
421
|
+
* @stability stable
|
|
422
|
+
* @category models
|
|
423
|
+
* @since 0.3.0
|
|
424
|
+
*/
|
|
241
425
|
export type TrackEvent = typeof TrackEvent.Type;
|
|
242
426
|
|
|
243
427
|
/**
|
|
244
428
|
* A JavaScript dialog appeared; its completed answer, or a failed response: an alert or a leave-page prompt accepted, a
|
|
245
429
|
* confirm or a prompt dismissed, as if its Cancel were pressed.
|
|
430
|
+
*
|
|
431
|
+
* @stability stable
|
|
432
|
+
* @category schemas
|
|
433
|
+
* @since 0.3.0
|
|
246
434
|
*/
|
|
247
|
-
export class DialogShown extends Schema.TaggedClass<DialogShown>(
|
|
435
|
+
export class DialogShown extends Schema.TaggedClass<DialogShown>(
|
|
436
|
+
"effect-browser/BrowserEvent/DialogShown",
|
|
437
|
+
)("DialogShown", {
|
|
248
438
|
at: Schema.Finite,
|
|
249
439
|
page: Schema.String,
|
|
250
440
|
kind: Schema.String,
|
|
@@ -252,9 +442,17 @@ export class DialogShown extends Schema.TaggedClass<DialogShown>()("DialogShown"
|
|
|
252
442
|
answer: Schema.Literals(["accepted", "dismissed", "failed"]),
|
|
253
443
|
}) {}
|
|
254
444
|
|
|
255
|
-
/**
|
|
256
|
-
*
|
|
257
|
-
|
|
445
|
+
/**
|
|
446
|
+
* A context policy refused traffic; page is present only when its containing page was established.
|
|
447
|
+
* Worker and out-of-process iframe requests may omit it while retaining proven context ownership.
|
|
448
|
+
*
|
|
449
|
+
* @stability stable
|
|
450
|
+
* @category schemas
|
|
451
|
+
* @since 0.3.0
|
|
452
|
+
*/
|
|
453
|
+
export class RequestRefused extends Schema.TaggedClass<RequestRefused>(
|
|
454
|
+
"effect-browser/BrowserEvent/RequestRefused",
|
|
455
|
+
)("RequestRefused", {
|
|
258
456
|
at: Schema.Finite,
|
|
259
457
|
page: Schema.optional(Schema.String),
|
|
260
458
|
method: Schema.String,
|
|
@@ -269,6 +467,11 @@ export class RequestRefused extends Schema.TaggedClass<RequestRefused>()("Reques
|
|
|
269
467
|
),
|
|
270
468
|
}) {}
|
|
271
469
|
|
|
470
|
+
/**
|
|
471
|
+
* @stability stable
|
|
472
|
+
* @category schemas
|
|
473
|
+
* @since 0.3.0
|
|
474
|
+
*/
|
|
272
475
|
export const BrowserEvent = Schema.Union([
|
|
273
476
|
RequestRefused,
|
|
274
477
|
PageOpened,
|
|
@@ -283,10 +486,23 @@ export const BrowserEvent = Schema.Union([
|
|
|
283
486
|
SessionEnding,
|
|
284
487
|
]);
|
|
285
488
|
|
|
489
|
+
/**
|
|
490
|
+
* @stability stable
|
|
491
|
+
* @category models
|
|
492
|
+
* @since 0.3.0
|
|
493
|
+
*/
|
|
286
494
|
export type BrowserEvent = typeof BrowserEvent.Type;
|
|
287
495
|
|
|
288
|
-
/**
|
|
289
|
-
|
|
496
|
+
/**
|
|
497
|
+
* A position in the browser's one replayable event history. Sequences begin at one.
|
|
498
|
+
*
|
|
499
|
+
* @stability stable
|
|
500
|
+
* @category schemas
|
|
501
|
+
* @since 0.3.0
|
|
502
|
+
*/
|
|
503
|
+
export class RecordedEvent extends Schema.Class<RecordedEvent>(
|
|
504
|
+
"effect-browser/BrowserEvent/RecordedEvent",
|
|
505
|
+
)({
|
|
290
506
|
sequence: Sequence,
|
|
291
507
|
event: BrowserEvent,
|
|
292
508
|
}) {}
|
package/src/Cdp.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A browser reached over Chrome DevTools Protocol. Node defaults to Playwright's transport;
|
|
3
|
+
* `connect` supplies another runtime's real Playwright browser. Closing the scope disconnects.
|
|
4
|
+
*
|
|
5
|
+
* @stability stable
|
|
6
|
+
* @since 0.3.0
|
|
7
|
+
*/
|
|
8
|
+
import { chromium } from "playwright-core";
|
|
9
|
+
|
|
10
|
+
import { forRuntime } from "./internal/cdp/connection.ts";
|
|
11
|
+
|
|
12
|
+
export type {
|
|
13
|
+
/**
|
|
14
|
+
* @stability stable
|
|
15
|
+
* @category models
|
|
16
|
+
* @since 0.3.0
|
|
17
|
+
*/
|
|
18
|
+
Connector,
|
|
19
|
+
/**
|
|
20
|
+
* @stability stable
|
|
21
|
+
* @category options
|
|
22
|
+
* @since 0.3.0
|
|
23
|
+
*/
|
|
24
|
+
ConnectOptions,
|
|
25
|
+
/**
|
|
26
|
+
* @stability stable
|
|
27
|
+
* @category options
|
|
28
|
+
* @since 0.3.0
|
|
29
|
+
*/
|
|
30
|
+
Options,
|
|
31
|
+
} from "./internal/cdp/connection.ts";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Connect and open a `Browser` over the endpoint's first context, as an effect or a layer.
|
|
35
|
+
*
|
|
36
|
+
* @stability stable
|
|
37
|
+
* @category constructors
|
|
38
|
+
* @since 0.3.0
|
|
39
|
+
*/
|
|
40
|
+
export const { make, layer, layerConfig } = forRuntime((endpoint, options) =>
|
|
41
|
+
chromium.connectOverCDP(endpoint, options),
|
|
42
|
+
);
|
package/src/Change.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* shown at the window's start and at its end, how often it changed between, where it is on the
|
|
5
5
|
* page, and the input it followed, where it was that input's doing.
|
|
6
6
|
*
|
|
7
|
-
* `
|
|
7
|
+
* `read` reads it. A page records once something reads its changes: from then, and from the
|
|
8
8
|
* start of each later document once it is parsed, until nobody has read it for two minutes. A page
|
|
9
9
|
* nobody reads records nothing. The record keeps 256 elements, each with its last 32 changes, for a
|
|
10
10
|
* minute; an element that keeps changing gives way before news, and what gives way is counted in
|
|
@@ -14,20 +14,39 @@
|
|
|
14
14
|
* shadow roots and SVG; a value a script sets; and a class that reveals an element the record has
|
|
15
15
|
* not seen before, such as a toast already on the page, though its later changes are seen.
|
|
16
16
|
*
|
|
17
|
+
* @stability stable
|
|
17
18
|
* @since 0.3.0
|
|
18
19
|
*/
|
|
19
|
-
import { Schema } from "effect";
|
|
20
|
+
import { type Effect, Function, Schema } from "effect";
|
|
20
21
|
|
|
21
|
-
import {
|
|
22
|
+
import type { BrowserError } from "./BrowserError.ts";
|
|
23
|
+
import { Box, Subject } from "./BrowserEvent.ts";
|
|
24
|
+
import type { Frame } from "./Frame.ts";
|
|
25
|
+
import { functionsOf, isPage } from "./internal/page/functions.ts";
|
|
26
|
+
import type { Page } from "./Page.ts";
|
|
22
27
|
|
|
23
28
|
/**
|
|
24
29
|
* `text` changed; `appeared` and `disappeared`, whether added or removed or shown or hidden;
|
|
25
30
|
* `brief`, appeared and gone again by the window's end; `value`, a field's; `title`, the document's.
|
|
31
|
+
*
|
|
32
|
+
* @stability stable
|
|
33
|
+
* @category schemas
|
|
34
|
+
* @since 0.3.0
|
|
26
35
|
*/
|
|
27
36
|
export const Kind = Schema.Literals(["text", "appeared", "disappeared", "brief", "value", "title"]);
|
|
28
37
|
|
|
38
|
+
/**
|
|
39
|
+
* @stability stable
|
|
40
|
+
* @category models
|
|
41
|
+
* @since 0.3.0
|
|
42
|
+
*/
|
|
29
43
|
export type Kind = typeof Kind.Type;
|
|
30
44
|
|
|
45
|
+
/**
|
|
46
|
+
* @stability stable
|
|
47
|
+
* @category schemas
|
|
48
|
+
* @since 0.3.0
|
|
49
|
+
*/
|
|
31
50
|
export class Change extends Schema.Class<Change>("effect-browser/Change")({
|
|
32
51
|
kind: Kind,
|
|
33
52
|
/**
|
|
@@ -35,6 +54,12 @@ export class Change extends Schema.Class<Change>("effect-browser/Change")({
|
|
|
35
54
|
* changed, so its name is empty unless something else names it, as a field's label does.
|
|
36
55
|
*/
|
|
37
56
|
subject: Subject,
|
|
57
|
+
/**
|
|
58
|
+
* Where it is as the changes are read, in viewport CSS pixels, unrounded; for what went, where
|
|
59
|
+
* what it sat in is. A caller can frame what an input did beside the input. Absent for the title
|
|
60
|
+
* and for what is drawn nowhere, as what was hidden is.
|
|
61
|
+
*/
|
|
62
|
+
box: Schema.optional(Box),
|
|
38
63
|
/** When it first changed in the window, in host monotonic milliseconds on the browser's clock. */
|
|
39
64
|
startedAt: Schema.Finite,
|
|
40
65
|
/** When it last changed in the window. */
|
|
@@ -65,7 +90,12 @@ export class Change extends Schema.Class<Change>("effect-browser/Change")({
|
|
|
65
90
|
cause: Schema.optional(Schema.Finite),
|
|
66
91
|
}) {}
|
|
67
92
|
|
|
68
|
-
|
|
93
|
+
/**
|
|
94
|
+
* @stability stable
|
|
95
|
+
* @category schemas
|
|
96
|
+
* @since 0.3.0
|
|
97
|
+
*/
|
|
98
|
+
export class Changes extends Schema.Class<Changes>("effect-browser/Change/Changes")({
|
|
69
99
|
/** The page's document these changes belong to, as `Navigated` counts them. */
|
|
70
100
|
document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
71
101
|
/** Where the record is whole: before it, changes may be missing. */
|
|
@@ -83,4 +113,45 @@ export class Changes extends Schema.Class<Changes>("effect-browser/Changes")({
|
|
|
83
113
|
changes: Schema.Array(Change),
|
|
84
114
|
}) {}
|
|
85
115
|
|
|
116
|
+
/**
|
|
117
|
+
* The window `read` reads, and whether to show what fields hold.
|
|
118
|
+
*
|
|
119
|
+
* @stability stable
|
|
120
|
+
* @category options
|
|
121
|
+
* @since 0.3.0
|
|
122
|
+
*/
|
|
123
|
+
export interface ChangesOptions {
|
|
124
|
+
/**
|
|
125
|
+
* Where the window starts: the changes a previous read returned, to continue exactly where they
|
|
126
|
+
* ended; a frame, at its paint; or host monotonic milliseconds, which mapped to the page's clock
|
|
127
|
+
* may miss or repeat changes near the start if the browser's clock mapping changed since. Defaults
|
|
128
|
+
* to the start of the record.
|
|
129
|
+
*/
|
|
130
|
+
readonly since?: Changes | Frame | number | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Where it ends: a frame, at its paint, so a delayed frame's window holds nothing it does not
|
|
133
|
+
* show; or host monotonic milliseconds. Defaults to now, and is never later.
|
|
134
|
+
*/
|
|
135
|
+
readonly until?: Frame | number | undefined;
|
|
136
|
+
/** Show what fields hold; a secret field still reads `••••`. Defaults to false. */
|
|
137
|
+
readonly unmask?: boolean | undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* What visibly changed over a window, in one call to the page. The first read starts the page's
|
|
142
|
+
* record, so it finds none; from then the page records, and from the start of each later
|
|
143
|
+
* document, until nobody has read it for two minutes.
|
|
144
|
+
*
|
|
145
|
+
* @stability stable
|
|
146
|
+
* @category constructors
|
|
147
|
+
* @since 0.3.0
|
|
148
|
+
*/
|
|
149
|
+
export const read: {
|
|
150
|
+
(options?: ChangesOptions): (page: Page) => Effect.Effect<Changes, BrowserError>;
|
|
151
|
+
(page: Page, options?: ChangesOptions): Effect.Effect<Changes, BrowserError>;
|
|
152
|
+
} = Function.dual(
|
|
153
|
+
(args) => isPage(args[0]),
|
|
154
|
+
(page: Page, options?: ChangesOptions) => functionsOf(page).changes(options),
|
|
155
|
+
);
|
|
156
|
+
|
|
86
157
|
/** A change in words for a model, such as `"$61,240" became "$62,010" (row "Bitcoin", column "Price")`. */
|