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
|
@@ -8,10 +8,17 @@ import { Duration, Effect, Option, Result, Schedule, Schema, type Scope } from "
|
|
|
8
8
|
import { Base64 } from "effect/encoding";
|
|
9
9
|
|
|
10
10
|
import { BrowserError, Failed, InvalidRequest } from "../../BrowserError.ts";
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
import {
|
|
12
|
+
Frame,
|
|
13
|
+
type FrameOptions,
|
|
14
|
+
Image,
|
|
15
|
+
type Paint,
|
|
16
|
+
Region,
|
|
17
|
+
Screenshot,
|
|
18
|
+
Zoom,
|
|
19
|
+
} from "../../Frame.ts";
|
|
20
|
+
import * as BrowserClock from "../clock.ts";
|
|
21
|
+
import type { Point } from "../geometry.ts";
|
|
15
22
|
import { type Bridge, scriptCall } from "../page/bridge.ts";
|
|
16
23
|
import {
|
|
17
24
|
decodeWith,
|
|
@@ -61,7 +68,7 @@ export const pngSize = (bytes: Uint8Array): Size | undefined => {
|
|
|
61
68
|
export type Format = "jpeg" | "png";
|
|
62
69
|
|
|
63
70
|
// A picture's pixels: CSS pixels, or the screen's own.
|
|
64
|
-
type Scale = NonNullable<
|
|
71
|
+
type Scale = NonNullable<FrameOptions["scale"]>;
|
|
65
72
|
|
|
66
73
|
// The part of `Page.getLayoutMetrics` a clip needs: the visual viewport's place in the document and
|
|
67
74
|
// its pinch scale, and the content's size in device and CSS pixels, whose ratio is the device's.
|
|
@@ -382,25 +389,23 @@ const camera = (
|
|
|
382
389
|
}).pipe(capture.excluding, within(operation));
|
|
383
390
|
};
|
|
384
391
|
|
|
385
|
-
// A duration in milliseconds, or NaN for an input that is no duration.
|
|
386
|
-
const millisOf = (input: Duration.Input) =>
|
|
387
|
-
Option.match(Duration.fromInput(input), { onNone: () => Number.NaN, onSome: Duration.toMillis });
|
|
388
|
-
|
|
389
392
|
// The newest screencast frame, if it shows the page as the caller asked: painted at most `maxAge`
|
|
390
393
|
// ago at the earliest its timing allows, after the current document began, and with
|
|
391
394
|
// `after: "input"` after the page's latest input, which a read asks in its turn, once the action
|
|
392
395
|
// in flight has ended. It must have the viewport's size, as a new picture would. A screencast sends
|
|
393
396
|
// only changes and can miss a final paint, so a frame is only ever as current as its age, and a
|
|
394
397
|
// page that keeps painting while the next document loads leaves its own frames newest when the
|
|
395
|
-
// navigation returns.
|
|
398
|
+
// navigation returns. A screencast frame is a JPEG of the viewport's CSS size, so a PNG or a
|
|
399
|
+
// picture in device pixels is always new.
|
|
396
400
|
const reuse =
|
|
397
401
|
(page: PageContext, bridge: Bridge, viewport: Viewport, capture: Capture.Controller) =>
|
|
398
|
-
(
|
|
402
|
+
(options: FrameOptions) =>
|
|
399
403
|
Effect.gen(function* () {
|
|
400
|
-
const maxAge = millisOf(options.maxAge ?? defaultMaxAge);
|
|
404
|
+
const maxAge = BrowserClock.millisOf(options.maxAge ?? defaultMaxAge);
|
|
401
405
|
|
|
402
406
|
if (!(maxAge >= 0))
|
|
403
|
-
return yield* refuse(
|
|
407
|
+
return yield* refuse("frame", "maxAge must be a duration of zero or more");
|
|
408
|
+
if (options.format === "png" || options.scale === "device") return Option.none<Frame>();
|
|
404
409
|
const latest = yield* capture.latest;
|
|
405
410
|
const known = viewport.knownViewport();
|
|
406
411
|
const { activity } = page;
|
|
@@ -476,57 +481,31 @@ export const make = Effect.fnUntraced(function* (
|
|
|
476
481
|
const picture = camera(page, viewport, capture, emulated);
|
|
477
482
|
const reusable = reuse(page, bridge, viewport, capture);
|
|
478
483
|
// Pictures in flight are shared, never kept: their callers say how old one may be.
|
|
479
|
-
const screenshots = lane.shared<Image>("screenshot", false);
|
|
480
484
|
const frames = lane.shared<Frame>("frame", false);
|
|
481
485
|
|
|
482
|
-
// A caller that acts and then looks must see what its action did, so a screenshot waits for the
|
|
483
|
-
// action in flight and reuses only a frame painted after the page's latest input.
|
|
484
|
-
const screenshot = (options: ScreenshotOptions = {}) =>
|
|
485
|
-
screenshots(
|
|
486
|
-
JSON.stringify([
|
|
487
|
-
millisOf(options.maxAge ?? defaultMaxAge),
|
|
488
|
-
options.clip,
|
|
489
|
-
options.quality,
|
|
490
|
-
options.format,
|
|
491
|
-
options.scale,
|
|
492
|
-
]),
|
|
493
|
-
Effect.gen(function* () {
|
|
494
|
-
// A reused frame is a JPEG of the viewport's CSS size, so a PNG or a device picture is new.
|
|
495
|
-
const reused =
|
|
496
|
-
options.clip === undefined && options.format !== "png" && options.scale !== "device"
|
|
497
|
-
? yield* reusable("screenshot", { maxAge: options.maxAge, after: "input" })
|
|
498
|
-
: Option.none<Frame>();
|
|
499
|
-
|
|
500
|
-
const image = Option.isSome(reused)
|
|
501
|
-
? reused.value.image
|
|
502
|
-
: yield* picture(
|
|
503
|
-
"screenshot",
|
|
504
|
-
options.quality ?? 80,
|
|
505
|
-
options.clip,
|
|
506
|
-
options.format,
|
|
507
|
-
options.scale,
|
|
508
|
-
);
|
|
509
|
-
|
|
510
|
-
yield* Effect.annotateCurrentSpan({ source: sourceOf(reused), bytes: image.data.length });
|
|
511
|
-
|
|
512
|
-
return image;
|
|
513
|
-
}),
|
|
514
|
-
).pipe(span("Page.screenshot"), owned);
|
|
515
|
-
|
|
516
486
|
// A new screenshot has no paint time, only the host interval in which it was taken.
|
|
517
487
|
const taken = (options: FrameOptions) =>
|
|
518
488
|
Effect.gen(function* () {
|
|
519
|
-
const reused = yield* reusable(
|
|
489
|
+
const reused = yield* reusable(options);
|
|
520
490
|
|
|
521
491
|
yield* Effect.annotateCurrentSpan("source", sourceOf(reused));
|
|
522
492
|
if (Option.isSome(reused)) return reused.value;
|
|
523
493
|
const startedAt = now();
|
|
524
|
-
|
|
494
|
+
|
|
495
|
+
const image = yield* picture(
|
|
496
|
+
"frame",
|
|
497
|
+
options.quality ?? 80,
|
|
498
|
+
undefined,
|
|
499
|
+
options.format,
|
|
500
|
+
options.scale,
|
|
501
|
+
);
|
|
502
|
+
|
|
525
503
|
const finishedAt = now();
|
|
526
504
|
|
|
527
505
|
return new Frame({
|
|
528
506
|
page: id,
|
|
529
507
|
data: image.data,
|
|
508
|
+
mediaType: image.mediaType,
|
|
530
509
|
timing: new Screenshot({
|
|
531
510
|
hostTime: startedAt + (finishedAt - startedAt) / 2,
|
|
532
511
|
uncertaintyMillis: (finishedAt - startedAt) / 2,
|
|
@@ -541,25 +520,31 @@ export const make = Effect.fnUntraced(function* (
|
|
|
541
520
|
// A frame of a stated age that the screencast has costs nothing and waits for no action; one
|
|
542
521
|
// that must follow the latest input, or a new screenshot, waits for the action in flight.
|
|
543
522
|
const frame = (options: FrameOptions = {}) =>
|
|
544
|
-
(options.after === "input"
|
|
545
|
-
? Effect.succeed(Option.none<Frame>())
|
|
546
|
-
: reusable("frame", options)
|
|
547
|
-
).pipe(
|
|
523
|
+
(options.after === "input" ? Effect.succeed(Option.none<Frame>()) : reusable(options)).pipe(
|
|
548
524
|
Effect.flatMap(
|
|
549
525
|
Option.match({
|
|
550
526
|
onSome: (reused) => Effect.as(Effect.annotateCurrentSpan("source", "frame"), reused),
|
|
551
527
|
onNone: () =>
|
|
552
528
|
frames(
|
|
553
|
-
JSON.stringify([
|
|
529
|
+
JSON.stringify([
|
|
530
|
+
BrowserClock.millisOf(options.maxAge ?? defaultMaxAge),
|
|
531
|
+
options.after,
|
|
532
|
+
options.quality,
|
|
533
|
+
options.format,
|
|
534
|
+
options.scale,
|
|
535
|
+
]),
|
|
554
536
|
taken(options),
|
|
555
537
|
),
|
|
556
538
|
}),
|
|
557
539
|
),
|
|
558
|
-
span("
|
|
540
|
+
span("Frame.read"),
|
|
559
541
|
owned,
|
|
560
542
|
);
|
|
561
543
|
|
|
562
|
-
const zoom = (
|
|
544
|
+
const zoom = (
|
|
545
|
+
requested: Region,
|
|
546
|
+
options: Pick<FrameOptions, "quality" | "format" | "scale"> = {},
|
|
547
|
+
) =>
|
|
563
548
|
lane
|
|
564
549
|
.read("zoom")(
|
|
565
550
|
Effect.gen(function* () {
|
|
@@ -574,16 +559,23 @@ export const make = Effect.fnUntraced(function* (
|
|
|
574
559
|
|
|
575
560
|
if (region.x + region.width > size.width || region.y + region.height > size.height)
|
|
576
561
|
return yield* refuse("zoom", "the crop must fit entirely within the viewport");
|
|
577
|
-
|
|
562
|
+
|
|
563
|
+
const image = yield* picture(
|
|
564
|
+
"zoom",
|
|
565
|
+
options.quality ?? 80,
|
|
566
|
+
region,
|
|
567
|
+
options.format,
|
|
568
|
+
options.scale,
|
|
569
|
+
);
|
|
578
570
|
|
|
579
571
|
return new Zoom({ page: id, region, image });
|
|
580
572
|
}).pipe(within("zoom")),
|
|
581
573
|
)
|
|
582
|
-
.pipe(span("
|
|
574
|
+
.pipe(span("Frame.zoom"), owned);
|
|
583
575
|
|
|
584
576
|
const captureStats = (options: { readonly window?: Duration.Input | undefined } = {}) => {
|
|
585
577
|
if (options.window === undefined) return capture.stats();
|
|
586
|
-
const millis = millisOf(options.window);
|
|
578
|
+
const millis = BrowserClock.millisOf(options.window);
|
|
587
579
|
|
|
588
580
|
return millis > 0 && millis <= Duration.toMillis(countsKept)
|
|
589
581
|
? capture.stats(millis)
|
|
@@ -594,5 +586,5 @@ export const make = Effect.fnUntraced(function* (
|
|
|
594
586
|
// change record's times need it.
|
|
595
587
|
const estimate = mapping.current(calibrateClock);
|
|
596
588
|
|
|
597
|
-
return { capture,
|
|
589
|
+
return { capture, frame, zoom, captureStats, estimate, paint: emulated.paint };
|
|
598
590
|
});
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { SubjectContext } from "../../BrowserEvent.ts";
|
|
13
13
|
import type { Names } from "./names.inpage.ts";
|
|
14
|
-
import type {
|
|
14
|
+
import type { Walked } from "./walk.inpage.ts";
|
|
15
15
|
|
|
16
16
|
/** What one read has learnt of the page: each table's header row and each tree's headings. */
|
|
17
17
|
export interface Known {
|
|
@@ -19,7 +19,7 @@ export interface Known {
|
|
|
19
19
|
readonly headings: Map<Node, ReadonlyArray<Element>>;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export const context = (names: Names, walked:
|
|
22
|
+
export const context = (names: Names, walked: Walked) => {
|
|
23
23
|
const { clean, isButton, isDocument, isHtml, isInput, isRoot } = names;
|
|
24
24
|
const { isSelect, isTextArea, roleOf, textOf } = names;
|
|
25
25
|
const { visible } = walked;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* In the page: the wait an expectation takes on what `find` matches, and the mark that stands for
|
|
3
3
|
* what the matches show. See `names.inpage.ts` for what a page-side part may use.
|
|
4
4
|
*/
|
|
5
|
-
import type { FindRequest, Match } from "
|
|
5
|
+
import type { FindRequest, Match } from "../matching.ts";
|
|
6
6
|
import type { Names } from "./names.inpage.ts";
|
|
7
7
|
import type { Subjects } from "./subjects.inpage.ts";
|
|
8
8
|
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* call, so the boxes and the scroll describe one moment. See `names.inpage.ts` for what a
|
|
7
7
|
* page-side part may use.
|
|
8
8
|
*/
|
|
9
|
-
import type { FindRequest, Match, Wanted } from "
|
|
9
|
+
import type { FindRequest, Match, Wanted } from "../matching.ts";
|
|
10
10
|
import type { ContextReader } from "./context.inpage.ts";
|
|
11
11
|
import type { Names } from "./names.inpage.ts";
|
|
12
12
|
import type { Subjects } from "./subjects.inpage.ts";
|
|
13
|
-
import type {
|
|
13
|
+
import type { Walked } from "./walk.inpage.ts";
|
|
14
14
|
|
|
15
15
|
export interface PickRequest extends FindRequest {
|
|
16
16
|
readonly id: string;
|
|
@@ -20,7 +20,7 @@ export interface PickRequest extends FindRequest {
|
|
|
20
20
|
|
|
21
21
|
export const layout = (
|
|
22
22
|
names: Names,
|
|
23
|
-
walked:
|
|
23
|
+
walked: Walked,
|
|
24
24
|
subjected: Subjects,
|
|
25
25
|
matching: Match,
|
|
26
26
|
placing: ContextReader,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Reading where things are: `
|
|
2
|
+
* Reading where things are: `Layout.measure`, in one call to the page that takes its turn as other
|
|
3
3
|
* reads do and shares its work with identical ones. The page gives each place's viewport box; the
|
|
4
4
|
* document box is that box moved by the scroll read with it.
|
|
5
5
|
*/
|
|
@@ -7,12 +7,12 @@ import { Effect, Schema } from "effect";
|
|
|
7
7
|
|
|
8
8
|
import { NotActionable } from "../../BrowserError.ts";
|
|
9
9
|
import { Box, Subject } from "../../BrowserEvent.ts";
|
|
10
|
-
import { Point } from "../../Geometry.ts";
|
|
11
10
|
import { Layout, type Picks, Place, Word } from "../../Layout.ts";
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
11
|
+
import { Point } from "../geometry.ts";
|
|
12
|
+
import { pickRequests } from "../matching.ts";
|
|
14
13
|
import { type Bridge, scriptCall } from "../page/bridge.ts";
|
|
15
14
|
import { contextGone, decodeWith, failWith, type PageContext, refuse } from "../page/context.ts";
|
|
15
|
+
import * as Url from "../url.ts";
|
|
16
16
|
|
|
17
17
|
// What `layout` reads back, before its document boxes are added.
|
|
18
18
|
const LayoutResult = Schema.Union([
|
|
@@ -94,7 +94,7 @@ export const make = (page: PageContext, bridge: Bridge) => {
|
|
|
94
94
|
}),
|
|
95
95
|
within("layout"),
|
|
96
96
|
),
|
|
97
|
-
).pipe(span("
|
|
97
|
+
).pipe(span("Layout.measure", { picks: asked.length }), owned);
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
return layout;
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { Control } from "../../Snapshot.ts";
|
|
7
|
-
import type { addresses } from "
|
|
7
|
+
import type { addresses } from "../url.ts";
|
|
8
8
|
import type { Controls } from "./controls.inpage.ts";
|
|
9
9
|
import type { Names } from "./names.inpage.ts";
|
|
10
10
|
import type { SnapshotResult } from "./reading.ts";
|
|
11
11
|
import type { Subjects } from "./subjects.inpage.ts";
|
|
12
12
|
import type { Texts } from "./text.inpage.ts";
|
|
13
|
-
import type {
|
|
13
|
+
import type { Walked } from "./walk.inpage.ts";
|
|
14
14
|
|
|
15
15
|
export interface SnapshotRequest {
|
|
16
16
|
readonly full: boolean;
|
|
@@ -27,7 +27,7 @@ type Url = ReturnType<typeof addresses>;
|
|
|
27
27
|
|
|
28
28
|
export const outline = (
|
|
29
29
|
names: Names,
|
|
30
|
-
walked:
|
|
30
|
+
walked: Walked,
|
|
31
31
|
subjects: Subjects,
|
|
32
32
|
texts: Texts,
|
|
33
33
|
controlling: Controls,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Reading a page: its outline with refs, the elements a query finds and the text it shows. Each
|
|
3
3
|
* read takes its turn on the page and shares its work with identical reads, as `lane.ts`
|
|
4
|
-
* describes.
|
|
4
|
+
* describes.
|
|
5
5
|
*/
|
|
6
6
|
import { Duration, Effect, Schedule, Schema } from "effect";
|
|
7
7
|
|
|
8
8
|
import { StaleRef } from "../../BrowserError.ts";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import * as Url from "../../Url.ts";
|
|
9
|
+
import { type FindQuery, Found, Snapshot, type SnapshotOptions } from "../../Snapshot.ts";
|
|
10
|
+
import { Text, type TextOptions } from "../../Text.ts";
|
|
11
|
+
import { request as askedOf, type FindRequest } from "../matching.ts";
|
|
13
12
|
import { type Bridge, scriptCall } from "../page/bridge.ts";
|
|
14
13
|
import { contextGone, decodeWith, failWith, type PageContext, refuse } from "../page/context.ts";
|
|
14
|
+
import * as Url from "../url.ts";
|
|
15
15
|
import type { Want } from "./expect.inpage.ts";
|
|
16
16
|
import type { SnapshotRequest } from "./outline.inpage.ts";
|
|
17
17
|
import type { TextRequest } from "./text.inpage.ts";
|
|
@@ -54,7 +54,6 @@ export const make = (page: PageContext, bridge: Bridge) =>
|
|
|
54
54
|
const snapshots = lane.shared<Snapshot>("snapshot", true);
|
|
55
55
|
const finds = lane.shared<ReadonlyArray<Found>>("find", true);
|
|
56
56
|
const texts = lane.shared<Text>("text", true);
|
|
57
|
-
let viewed: Text | undefined;
|
|
58
57
|
|
|
59
58
|
const snapshot = (snapshotOptions: SnapshotOptions = {}) => {
|
|
60
59
|
const asked = {
|
|
@@ -81,7 +80,7 @@ export const make = (page: PageContext, bridge: Bridge) =>
|
|
|
81
80
|
|
|
82
81
|
return new Snapshot({ ...result.snapshot, url: Url.redact(url) });
|
|
83
82
|
}).pipe(within("snapshot")),
|
|
84
|
-
).pipe(span("
|
|
83
|
+
).pipe(span("Snapshot.read", { full: asked.full }), owned);
|
|
85
84
|
};
|
|
86
85
|
|
|
87
86
|
const find = (query: FindQuery = {}) => {
|
|
@@ -104,7 +103,7 @@ export const make = (page: PageContext, bridge: Bridge) =>
|
|
|
104
103
|
}).pipe(within("find")),
|
|
105
104
|
).pipe(
|
|
106
105
|
// The query's words are the caller's, and may be anything; only its shape is traced.
|
|
107
|
-
span("
|
|
106
|
+
span("Snapshot.find", { scope: asked.scope, role: asked.role ?? "" }),
|
|
108
107
|
owned,
|
|
109
108
|
);
|
|
110
109
|
};
|
|
@@ -133,14 +132,11 @@ export const make = (page: PageContext, bridge: Bridge) =>
|
|
|
133
132
|
chars: result.text.length,
|
|
134
133
|
truncated: result.truncated,
|
|
135
134
|
});
|
|
136
|
-
const shown = new Text({ ...result, url: Url.redact(result.url), at: now() });
|
|
137
135
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return shown;
|
|
136
|
+
return new Text({ ...result, url: Url.redact(result.url), at: now() });
|
|
141
137
|
}).pipe(within("text")),
|
|
142
138
|
)
|
|
143
|
-
).pipe(span("
|
|
139
|
+
).pipe(span("Text.read", { scope: scope === "viewport" ? "viewport" : "ref" }), owned);
|
|
144
140
|
};
|
|
145
141
|
|
|
146
142
|
// One call, which the page answers once `want` holds of what `query` matches, the whole document
|
|
@@ -181,16 +177,12 @@ export const make = (page: PageContext, bridge: Bridge) =>
|
|
|
181
177
|
.pipe(
|
|
182
178
|
Effect.andThen(look),
|
|
183
179
|
within("expect", Duration.sum(Duration.millis(millis), page.settings.actionTimeout)),
|
|
184
|
-
span("
|
|
180
|
+
span("Snapshot.until", { want: typeof want === "string" ? want : "other" }),
|
|
185
181
|
owned,
|
|
186
182
|
);
|
|
187
183
|
};
|
|
188
184
|
|
|
189
|
-
|
|
190
|
-
const viewedSince = (since: number) =>
|
|
191
|
-
viewed !== undefined && viewed.at > since ? viewed : undefined;
|
|
192
|
-
|
|
193
|
-
return { snapshot, find, text, until, viewedSince };
|
|
185
|
+
return { snapshot, find, text, until };
|
|
194
186
|
});
|
|
195
187
|
|
|
196
188
|
export type Reading = Effect.Success<ReturnType<typeof make>>;
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
import type { History } from "../timeline/history.inpage.ts";
|
|
14
14
|
import type { Readiness } from "./ready.ts";
|
|
15
15
|
import type { Texts } from "./text.inpage.ts";
|
|
16
|
-
import type {
|
|
16
|
+
import type { Walked } from "./walk.inpage.ts";
|
|
17
17
|
|
|
18
|
-
export const ready = (walked:
|
|
18
|
+
export const ready = (walked: Walked, texts: Texts, kept: History) => {
|
|
19
19
|
const { inView, visible } = walked;
|
|
20
20
|
// A canvas is read through a small copy: reading it directly would give it a context of ours.
|
|
21
21
|
let copy: OffscreenCanvasRenderingContext2D | null | undefined;
|
|
@@ -3,6 +3,7 @@ import { Duration, Effect, Schedule, Schema } from "effect";
|
|
|
3
3
|
|
|
4
4
|
import { Timeout, failWith, refuse } from "../../BrowserError.ts";
|
|
5
5
|
import type { ReadyOptions } from "../../Page.ts";
|
|
6
|
+
import { millisOf } from "../clock.ts";
|
|
6
7
|
import { type Bridge, scriptCall } from "../page/bridge.ts";
|
|
7
8
|
import { contextGone, decodeWith, type PageContext } from "../page/context.ts";
|
|
8
9
|
|
|
@@ -25,10 +26,10 @@ export type Readiness = typeof ReadinessSchema.Type;
|
|
|
25
26
|
export const make =
|
|
26
27
|
(page: PageContext, bridge: Bridge) =>
|
|
27
28
|
(options: ReadyOptions = {}) => {
|
|
28
|
-
const quietMillis = options.
|
|
29
|
+
const quietMillis = millisOf(options.quiet ?? 0);
|
|
29
30
|
|
|
30
31
|
if (!Number.isFinite(quietMillis) || quietMillis < 0)
|
|
31
|
-
return refuse("ready", "
|
|
32
|
+
return refuse("ready", "quiet must be a finite nonnegative duration");
|
|
32
33
|
const timeout = options.timeout ?? Duration.seconds(15);
|
|
33
34
|
|
|
34
35
|
// The page's own evidence, checked in the page until nothing is left or `until` has come.
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* beside it. See `names.inpage.ts` for what a page-side part may use.
|
|
5
5
|
*/
|
|
6
6
|
import type { SubjectContext } from "../../BrowserEvent.ts";
|
|
7
|
-
import type { FindRequest, Match } from "
|
|
7
|
+
import type { FindRequest, Match } from "../matching.ts";
|
|
8
8
|
import type { ContextReader } from "./context.inpage.ts";
|
|
9
9
|
import type { Names } from "./names.inpage.ts";
|
|
10
|
-
import type {
|
|
10
|
+
import type { Walked } from "./walk.inpage.ts";
|
|
11
11
|
|
|
12
12
|
export const states = (names: Names) => (element: Element, role: string | null) => {
|
|
13
13
|
const { isDisabled, isInput } = names;
|
|
@@ -44,7 +44,7 @@ export const states = (names: Names) => (element: Element, role: string | null)
|
|
|
44
44
|
|
|
45
45
|
export const subjects = (
|
|
46
46
|
names: Names,
|
|
47
|
-
walked:
|
|
47
|
+
walked: Walked,
|
|
48
48
|
matching: Match,
|
|
49
49
|
placing: ContextReader,
|
|
50
50
|
stateOf: ReturnType<typeof states>,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { Names } from "./names.inpage.ts";
|
|
8
8
|
import type { TextResult } from "./reading.ts";
|
|
9
|
-
import type {
|
|
9
|
+
import type { Walked } from "./walk.inpage.ts";
|
|
10
10
|
|
|
11
11
|
export interface TextRequest {
|
|
12
12
|
/** An element to read whole, or null for what the viewport shows. */
|
|
@@ -15,7 +15,7 @@ export interface TextRequest {
|
|
|
15
15
|
readonly unmask: boolean;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export const text = (names: Names, walked:
|
|
18
|
+
export const text = (names: Names, walked: Walked) => {
|
|
19
19
|
const { isHtml, isInput, isSecret, isSelect, isTextArea, lookup } = names;
|
|
20
20
|
|
|
21
21
|
// Input types whose value is a label or a choice rather than something entered.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import type { Change } from "../../Change.ts";
|
|
13
13
|
import type { Known, ContextReader } from "../reading/context.inpage.ts";
|
|
14
14
|
import type { Names } from "../reading/names.inpage.ts";
|
|
15
|
-
import type {
|
|
15
|
+
import type { Walked } from "../reading/walk.inpage.ts";
|
|
16
16
|
import type { ChangesResult } from "./changes.ts";
|
|
17
17
|
import type { Folded } from "./fold.inpage.ts";
|
|
18
18
|
import type { History } from "./history.inpage.ts";
|
|
@@ -29,7 +29,7 @@ export interface ChangesRequest {
|
|
|
29
29
|
|
|
30
30
|
export const changes = (
|
|
31
31
|
names: Names,
|
|
32
|
-
walked:
|
|
32
|
+
walked: Walked,
|
|
33
33
|
placing: ContextReader,
|
|
34
34
|
kept: History,
|
|
35
35
|
seeing: Sight,
|
|
@@ -11,10 +11,9 @@
|
|
|
11
11
|
import { Clock, Duration, Effect, type Fiber, Schema, Semaphore } from "effect";
|
|
12
12
|
|
|
13
13
|
import type { BrowserError } from "../../BrowserError.ts";
|
|
14
|
-
import { Change, Changes } from "../../Change.ts";
|
|
15
|
-
import * as BrowserClock from "../../Clock.ts";
|
|
14
|
+
import { Change, Changes, type ChangesOptions } from "../../Change.ts";
|
|
16
15
|
import type { Frame } from "../../Frame.ts";
|
|
17
|
-
import
|
|
16
|
+
import * as BrowserClock from "../clock.ts";
|
|
18
17
|
import { type Bridge, scriptCall } from "../page/bridge.ts";
|
|
19
18
|
import { decodeWith, type PageContext } from "../page/context.ts";
|
|
20
19
|
import type { ChangesRequest } from "./changes.inpage.ts";
|
|
@@ -158,5 +157,5 @@ export const make = (
|
|
|
158
157
|
),
|
|
159
158
|
});
|
|
160
159
|
}).pipe(page.within("changes")),
|
|
161
|
-
).pipe(page.span("
|
|
160
|
+
).pipe(page.span("Change.read"), page.owned);
|
|
162
161
|
};
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { Names } from "../reading/names.inpage.ts";
|
|
12
12
|
import type { Texts } from "../reading/text.inpage.ts";
|
|
13
|
-
import type {
|
|
13
|
+
import type { Walked } from "../reading/walk.inpage.ts";
|
|
14
14
|
import type { Sample, Shown } from "./fold.inpage.ts";
|
|
15
15
|
import type { History } from "./history.inpage.ts";
|
|
16
16
|
|
|
17
|
-
export const sight = (names: Names, walked:
|
|
17
|
+
export const sight = (names: Names, walked: Walked, texts: Texts, kept: History) => {
|
|
18
18
|
const { clean } = names;
|
|
19
19
|
const { visible } = walked;
|
|
20
20
|
// Whether each watched element was in view as the page last rendered it, and whether the style
|
|
@@ -7,10 +7,9 @@ import { Duration, Effect, Option, Result, Schema } from "effect";
|
|
|
7
7
|
|
|
8
8
|
import type { BrowserError } from "../../BrowserError.ts";
|
|
9
9
|
import { type BrowserEvent, TrackEvent } from "../../BrowserEvent.ts";
|
|
10
|
-
import type { Changes } from "../../Change.ts";
|
|
10
|
+
import type { Changes, ChangesOptions } from "../../Change.ts";
|
|
11
11
|
import { Frame } from "../../Frame.ts";
|
|
12
|
-
import
|
|
13
|
-
import { Window } from "../../Window.ts";
|
|
12
|
+
import { Window, type WindowOptions } from "../../Window.ts";
|
|
14
13
|
import { type PageContext, refuse } from "../page/context.ts";
|
|
15
14
|
|
|
16
15
|
const isWindow = Schema.is(Window);
|
|
@@ -89,4 +88,4 @@ export const make =
|
|
|
89
88
|
changes: Result.getOrUndefined(changes),
|
|
90
89
|
missing: Option.toArray(Result.getFailure(changes)),
|
|
91
90
|
});
|
|
92
|
-
}).pipe(page.span("
|
|
91
|
+
}).pipe(page.span("Window.read"), page.owned);
|