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/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,29 +218,36 @@ 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
|
|
137
225
|
*/
|
|
138
|
-
export class Action extends Schema.TaggedClass<Action>(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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
|
+
) {}
|
|
160
251
|
|
|
161
252
|
const Sequence = Schema.Int.check(Schema.isGreaterThan(0));
|
|
162
253
|
|
|
@@ -166,8 +257,14 @@ const Sequence = Schema.Int.check(Schema.isGreaterThan(0));
|
|
|
166
257
|
* target into view comes before. `x` and `y` are where the pointer goes, in viewport CSS pixels; for
|
|
167
258
|
* a drag, its start. Input with no pointer travel, such as keys or typing into the focused field,
|
|
168
259
|
* announces nothing.
|
|
260
|
+
*
|
|
261
|
+
* @stability stable
|
|
262
|
+
* @category schemas
|
|
263
|
+
* @since 0.3.0
|
|
169
264
|
*/
|
|
170
|
-
export class ActionAnnounced extends Schema.TaggedClass<ActionAnnounced>(
|
|
265
|
+
export class ActionAnnounced extends Schema.TaggedClass<ActionAnnounced>(
|
|
266
|
+
"effect-browser/BrowserEvent/ActionAnnounced",
|
|
267
|
+
)("ActionAnnounced", {
|
|
171
268
|
at: Schema.Finite,
|
|
172
269
|
page: Schema.String,
|
|
173
270
|
name: Name,
|
|
@@ -178,8 +275,16 @@ export class ActionAnnounced extends Schema.TaggedClass<ActionAnnounced>()("Acti
|
|
|
178
275
|
...Motion.Point.fields,
|
|
179
276
|
}) {}
|
|
180
277
|
|
|
181
|
-
/**
|
|
182
|
-
|
|
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", {
|
|
183
288
|
at: Schema.Finite,
|
|
184
289
|
page: Schema.String,
|
|
185
290
|
from: Motion.Point,
|
|
@@ -190,8 +295,14 @@ export class TrackPlanned extends Schema.TaggedClass<TrackPlanned>()("TrackPlann
|
|
|
190
295
|
* The submitted prefix of a glide. `plan` is its TrackPlanned envelope sequence; `dispatched`
|
|
191
296
|
* counts samples. `complete` means every sample was submitted, not acknowledged by the browser.
|
|
192
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
|
|
193
302
|
*/
|
|
194
|
-
export class TrackPerformed extends Schema.TaggedClass<TrackPerformed>(
|
|
303
|
+
export class TrackPerformed extends Schema.TaggedClass<TrackPerformed>(
|
|
304
|
+
"effect-browser/BrowserEvent/TrackPerformed",
|
|
305
|
+
)("TrackPerformed", {
|
|
195
306
|
at: Schema.Finite,
|
|
196
307
|
page: Schema.String,
|
|
197
308
|
plan: Sequence,
|
|
@@ -200,7 +311,14 @@ export class TrackPerformed extends Schema.TaggedClass<TrackPerformed>()("TrackP
|
|
|
200
311
|
complete: Schema.Boolean,
|
|
201
312
|
}) {}
|
|
202
313
|
|
|
203
|
-
|
|
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", {
|
|
204
322
|
at: Schema.Finite,
|
|
205
323
|
page: Schema.String,
|
|
206
324
|
...Motion.Point.fields,
|
|
@@ -208,7 +326,14 @@ export class PointerPressed extends Schema.TaggedClass<PointerPressed>()("Pointe
|
|
|
208
326
|
clickCount: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
209
327
|
}) {}
|
|
210
328
|
|
|
211
|
-
|
|
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", {
|
|
212
337
|
at: Schema.Finite,
|
|
213
338
|
page: Schema.String,
|
|
214
339
|
...Motion.Point.fields,
|
|
@@ -216,7 +341,14 @@ export class PointerReleased extends Schema.TaggedClass<PointerReleased>()("Poin
|
|
|
216
341
|
clickCount: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
217
342
|
}) {}
|
|
218
343
|
|
|
219
|
-
|
|
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", {
|
|
220
352
|
at: Schema.Finite,
|
|
221
353
|
page: Schema.String,
|
|
222
354
|
...Motion.Point.fields,
|
|
@@ -224,27 +356,55 @@ export class WheelScrolled extends Schema.TaggedClass<WheelScrolled>()("WheelScr
|
|
|
224
356
|
dy: Schema.Finite,
|
|
225
357
|
}) {}
|
|
226
358
|
|
|
227
|
-
|
|
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", {
|
|
228
367
|
at: Schema.Finite,
|
|
229
368
|
page: Schema.String,
|
|
230
369
|
key: Schema.String,
|
|
231
370
|
phase: Schema.Literals(["down", "up"]),
|
|
232
371
|
}) {}
|
|
233
372
|
|
|
234
|
-
/**
|
|
235
|
-
|
|
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", {
|
|
236
383
|
at: Schema.Finite,
|
|
237
384
|
page: Schema.String,
|
|
238
385
|
text: Schema.String,
|
|
239
386
|
}) {}
|
|
240
387
|
|
|
241
|
-
/**
|
|
242
|
-
|
|
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", {
|
|
243
398
|
at: Schema.Finite,
|
|
244
399
|
page: Schema.String,
|
|
245
400
|
cursor: Schema.String,
|
|
246
401
|
}) {}
|
|
247
402
|
|
|
403
|
+
/**
|
|
404
|
+
* @stability stable
|
|
405
|
+
* @category schemas
|
|
406
|
+
* @since 0.3.0
|
|
407
|
+
*/
|
|
248
408
|
export const TrackEvent = Schema.Union([
|
|
249
409
|
ActionAnnounced,
|
|
250
410
|
TrackPlanned,
|
|
@@ -257,13 +417,24 @@ export const TrackEvent = Schema.Union([
|
|
|
257
417
|
CursorChanged,
|
|
258
418
|
]);
|
|
259
419
|
|
|
420
|
+
/**
|
|
421
|
+
* @stability stable
|
|
422
|
+
* @category models
|
|
423
|
+
* @since 0.3.0
|
|
424
|
+
*/
|
|
260
425
|
export type TrackEvent = typeof TrackEvent.Type;
|
|
261
426
|
|
|
262
427
|
/**
|
|
263
428
|
* A JavaScript dialog appeared; its completed answer, or a failed response: an alert or a leave-page prompt accepted, a
|
|
264
429
|
* confirm or a prompt dismissed, as if its Cancel were pressed.
|
|
430
|
+
*
|
|
431
|
+
* @stability stable
|
|
432
|
+
* @category schemas
|
|
433
|
+
* @since 0.3.0
|
|
265
434
|
*/
|
|
266
|
-
export class DialogShown extends Schema.TaggedClass<DialogShown>(
|
|
435
|
+
export class DialogShown extends Schema.TaggedClass<DialogShown>(
|
|
436
|
+
"effect-browser/BrowserEvent/DialogShown",
|
|
437
|
+
)("DialogShown", {
|
|
267
438
|
at: Schema.Finite,
|
|
268
439
|
page: Schema.String,
|
|
269
440
|
kind: Schema.String,
|
|
@@ -271,9 +442,17 @@ export class DialogShown extends Schema.TaggedClass<DialogShown>()("DialogShown"
|
|
|
271
442
|
answer: Schema.Literals(["accepted", "dismissed", "failed"]),
|
|
272
443
|
}) {}
|
|
273
444
|
|
|
274
|
-
/**
|
|
275
|
-
*
|
|
276
|
-
|
|
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", {
|
|
277
456
|
at: Schema.Finite,
|
|
278
457
|
page: Schema.optional(Schema.String),
|
|
279
458
|
method: Schema.String,
|
|
@@ -288,6 +467,11 @@ export class RequestRefused extends Schema.TaggedClass<RequestRefused>()("Reques
|
|
|
288
467
|
),
|
|
289
468
|
}) {}
|
|
290
469
|
|
|
470
|
+
/**
|
|
471
|
+
* @stability stable
|
|
472
|
+
* @category schemas
|
|
473
|
+
* @since 0.3.0
|
|
474
|
+
*/
|
|
291
475
|
export const BrowserEvent = Schema.Union([
|
|
292
476
|
RequestRefused,
|
|
293
477
|
PageOpened,
|
|
@@ -302,10 +486,23 @@ export const BrowserEvent = Schema.Union([
|
|
|
302
486
|
SessionEnding,
|
|
303
487
|
]);
|
|
304
488
|
|
|
489
|
+
/**
|
|
490
|
+
* @stability stable
|
|
491
|
+
* @category models
|
|
492
|
+
* @since 0.3.0
|
|
493
|
+
*/
|
|
305
494
|
export type BrowserEvent = typeof BrowserEvent.Type;
|
|
306
495
|
|
|
307
|
-
/**
|
|
308
|
-
|
|
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
|
+
)({
|
|
309
506
|
sequence: Sequence,
|
|
310
507
|
event: BrowserEvent,
|
|
311
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
|
|
|
22
|
+
import type { BrowserError } from "./BrowserError.ts";
|
|
21
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
|
/**
|
|
@@ -71,7 +90,12 @@ export class Change extends Schema.Class<Change>("effect-browser/Change")({
|
|
|
71
90
|
cause: Schema.optional(Schema.Finite),
|
|
72
91
|
}) {}
|
|
73
92
|
|
|
74
|
-
|
|
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")({
|
|
75
99
|
/** The page's document these changes belong to, as `Navigated` counts them. */
|
|
76
100
|
document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
77
101
|
/** Where the record is whole: before it, changes may be missing. */
|
|
@@ -89,4 +113,45 @@ export class Changes extends Schema.Class<Changes>("effect-browser/Changes")({
|
|
|
89
113
|
changes: Schema.Array(Change),
|
|
90
114
|
}) {}
|
|
91
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
|
+
|
|
92
157
|
/** A change in words for a model, such as `"$61,240" became "$62,010" (row "Bitcoin", column "Price")`. */
|