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/Frame.ts
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Pictures of a page:
|
|
2
|
+
* Pictures of a page: its viewport as a frame of a stated age, crops of it, its screencast with
|
|
3
|
+
* frames stamped by the browser's clock, and how it paints. Each function takes the page first.
|
|
3
4
|
*
|
|
5
|
+
* @stability stable
|
|
4
6
|
* @since 0.3.0
|
|
5
7
|
*/
|
|
6
|
-
import { Schema } from "effect";
|
|
8
|
+
import { type Duration, type Effect, Function, type Scope, Schema, type Stream } from "effect";
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
import type { BrowserError } from "./BrowserError.ts";
|
|
11
|
+
import { functionsOf, isPage } from "./internal/page/functions.ts";
|
|
12
|
+
import type { Page } from "./Page.ts";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* An encoded picture with its pixel dimensions. Crops also need their viewport origin.
|
|
16
|
+
*
|
|
17
|
+
* @stability stable
|
|
18
|
+
* @category schemas
|
|
19
|
+
* @since 0.3.0
|
|
20
|
+
*/
|
|
21
|
+
export class Image extends Schema.Class<Image>("effect-browser/Frame/Image")({
|
|
10
22
|
data: Schema.Uint8Array,
|
|
11
23
|
mediaType: Schema.Literals(["image/jpeg", "image/png"]),
|
|
12
24
|
width: Schema.Finite,
|
|
@@ -16,23 +28,44 @@ export class Image extends Schema.Class<Image>("effect-browser/Image")({
|
|
|
16
28
|
const Nonnegative = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));
|
|
17
29
|
const Count = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
|
|
18
30
|
|
|
19
|
-
/**
|
|
20
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Native CDP paint time mapped to the owning host clock, with transport uncertainty retained.
|
|
33
|
+
*
|
|
34
|
+
* @stability stable
|
|
35
|
+
* @category schemas
|
|
36
|
+
* @since 0.3.0
|
|
37
|
+
*/
|
|
38
|
+
export class BrowserPaint extends Schema.TaggedClass<BrowserPaint>(
|
|
39
|
+
"effect-browser/Frame/BrowserPaint",
|
|
40
|
+
)("BrowserPaint", {
|
|
21
41
|
timestamp: Schema.Finite,
|
|
22
42
|
hostTime: Schema.Finite,
|
|
23
43
|
uncertaintyMillis: Nonnegative,
|
|
24
44
|
}) {}
|
|
25
45
|
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
46
|
+
/**
|
|
47
|
+
* A screenshot's host capture interval; it has no native browser paint timestamp.
|
|
48
|
+
*
|
|
49
|
+
* @stability stable
|
|
50
|
+
* @category schemas
|
|
51
|
+
* @since 0.3.0
|
|
52
|
+
*/
|
|
53
|
+
export class Screenshot extends Schema.TaggedClass<Screenshot>("effect-browser/Frame/Screenshot")(
|
|
54
|
+
"Screenshot",
|
|
55
|
+
{
|
|
56
|
+
hostTime: Schema.Finite,
|
|
57
|
+
uncertaintyMillis: Nonnegative,
|
|
58
|
+
},
|
|
59
|
+
) {}
|
|
31
60
|
|
|
32
61
|
/**
|
|
33
62
|
* An image and its timing evidence. Paint time and screenshot capture time cannot be confused in
|
|
34
63
|
* serialized data. `receivedAt` records delivery on the owning host's monotonic clock; it does
|
|
35
64
|
* not make an old paint current.
|
|
65
|
+
*
|
|
66
|
+
* @stability stable
|
|
67
|
+
* @category schemas
|
|
68
|
+
* @since 0.3.0
|
|
36
69
|
*/
|
|
37
70
|
export class Frame extends Schema.Class<Frame>("effect-browser/Frame")({
|
|
38
71
|
page: Schema.String,
|
|
@@ -43,6 +76,8 @@ export class Frame extends Schema.Class<Frame>("effect-browser/Frame")({
|
|
|
43
76
|
/** Native capture identity. Screenshots have no capture generation or sequence. */
|
|
44
77
|
capture: Schema.optionalKey(Schema.Struct({ generation: Count, sequence: Count })),
|
|
45
78
|
data: Schema.Uint8Array,
|
|
79
|
+
/** The picture's type, when a new picture gave it; one without is a JPEG, as screencast frames are. */
|
|
80
|
+
mediaType: Schema.optionalKey(Schema.Literals(["image/jpeg", "image/png"])),
|
|
46
81
|
timing: Schema.Union([BrowserPaint, Screenshot]),
|
|
47
82
|
receivedAt: Schema.Finite,
|
|
48
83
|
width: Schema.Finite,
|
|
@@ -67,14 +102,20 @@ export class Frame extends Schema.Class<Frame>("effect-browser/Frame")({
|
|
|
67
102
|
get image(): Image {
|
|
68
103
|
return new Image({
|
|
69
104
|
data: this.data,
|
|
70
|
-
mediaType: "image/jpeg",
|
|
105
|
+
mediaType: this.mediaType ?? "image/jpeg",
|
|
71
106
|
width: this.width,
|
|
72
107
|
height: this.height,
|
|
73
108
|
});
|
|
74
109
|
}
|
|
75
110
|
}
|
|
76
111
|
|
|
77
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Equal capture lineage survives an image copy; untagged pictures retain object identity only.
|
|
114
|
+
*
|
|
115
|
+
* @stability stable
|
|
116
|
+
* @category predicates
|
|
117
|
+
* @since 0.3.0
|
|
118
|
+
*/
|
|
78
119
|
export const sameCapture = (frame: Frame, other: Frame | undefined): boolean =>
|
|
79
120
|
other !== undefined &&
|
|
80
121
|
(frame === other ||
|
|
@@ -90,8 +131,12 @@ export const sameCapture = (frame: Frame, other: Frame | undefined): boolean =>
|
|
|
90
131
|
* A page's capture counts, over its life or a window of the latest minute: what Chromium sent,
|
|
91
132
|
* what readers got, and why the rest went no further. Frames that came late are counted apart from
|
|
92
133
|
* those a reader lost.
|
|
134
|
+
*
|
|
135
|
+
* @stability stable
|
|
136
|
+
* @category schemas
|
|
137
|
+
* @since 0.3.0
|
|
93
138
|
*/
|
|
94
|
-
export class CaptureStats extends Schema.Class<CaptureStats>("effect-browser/CaptureStats")({
|
|
139
|
+
export class CaptureStats extends Schema.Class<CaptureStats>("effect-browser/Frame/CaptureStats")({
|
|
95
140
|
received: Count,
|
|
96
141
|
accepted: Count,
|
|
97
142
|
/**
|
|
@@ -135,6 +180,10 @@ export class CaptureStats extends Schema.Class<CaptureStats>("effect-browser/Cap
|
|
|
135
180
|
* Settings for a page's one native capture. Readers that join a running capture share its
|
|
136
181
|
* settings: one without options accepts them, and one whose explicit options differ fails with
|
|
137
182
|
* `InvalidRequest`.
|
|
183
|
+
*
|
|
184
|
+
* @stability stable
|
|
185
|
+
* @category options
|
|
186
|
+
* @since 0.3.0
|
|
138
187
|
*/
|
|
139
188
|
export interface ScreencastOptions {
|
|
140
189
|
/** JPEG quality, 0 to 100. Defaults to 80. */
|
|
@@ -142,3 +191,187 @@ export interface ScreencastOptions {
|
|
|
142
191
|
/** Frames are scaled down to fit this box. Defaults to the viewport in CSS pixels. */
|
|
143
192
|
readonly size?: { readonly width: number; readonly height: number } | undefined;
|
|
144
193
|
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* An integer rectangle in viewport CSS pixels.
|
|
197
|
+
*
|
|
198
|
+
* @stability stable
|
|
199
|
+
* @category schemas
|
|
200
|
+
* @since 0.3.0
|
|
201
|
+
*/
|
|
202
|
+
export class Region extends Schema.Class<Region>("effect-browser/Frame/Region")({
|
|
203
|
+
x: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
204
|
+
y: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
205
|
+
width: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
206
|
+
height: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
207
|
+
}) {}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* A crop and its viewport origin: add that origin to a point read from the crop.
|
|
211
|
+
*
|
|
212
|
+
* @stability stable
|
|
213
|
+
* @category schemas
|
|
214
|
+
* @since 0.3.0
|
|
215
|
+
*/
|
|
216
|
+
export class Zoom extends Schema.Class<Zoom>("effect-browser/Frame/Zoom")({
|
|
217
|
+
page: Schema.String,
|
|
218
|
+
region: Region,
|
|
219
|
+
image: Image,
|
|
220
|
+
}) {}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* How current a picture must be, and how a new one is taken. The newest screencast frame serves
|
|
224
|
+
* when it qualifies, at no cost; otherwise a new screenshot is taken.
|
|
225
|
+
*
|
|
226
|
+
* @stability stable
|
|
227
|
+
* @category options
|
|
228
|
+
* @since 0.3.0
|
|
229
|
+
*/
|
|
230
|
+
export interface FrameOptions {
|
|
231
|
+
/**
|
|
232
|
+
* The oldest a reused frame may be, from its paint, at the earliest its timing allows, to now.
|
|
233
|
+
* Defaults to 250 milliseconds; 0 always takes a new screenshot.
|
|
234
|
+
*/
|
|
235
|
+
readonly maxAge?: Duration.Input | undefined;
|
|
236
|
+
/**
|
|
237
|
+
* `"input"`: reuse only a frame painted after this page's latest input, including input of an
|
|
238
|
+
* interrupted action, and never while an action is changing the page. For a caller that has
|
|
239
|
+
* just acted on the page, so that it sees what its action did.
|
|
240
|
+
*/
|
|
241
|
+
readonly after?: "input" | undefined;
|
|
242
|
+
/** JPEG quality of a new picture, 0 to 100. Defaults to 80. */
|
|
243
|
+
readonly quality?: number | undefined;
|
|
244
|
+
/** `"jpeg"`, the default, or `"png"`, which is always a new picture. */
|
|
245
|
+
readonly format?: "jpeg" | "png" | undefined;
|
|
246
|
+
/**
|
|
247
|
+
* `"css"`, the default, a picture pixel per CSS pixel; `"device"`, the screen's own pixels, as
|
|
248
|
+
* many to a CSS pixel as its device scale factor, which is always a new picture.
|
|
249
|
+
*/
|
|
250
|
+
readonly scale?: "css" | "device" | undefined;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* How a page paints for a scope; see `paint`.
|
|
255
|
+
*
|
|
256
|
+
* @stability stable
|
|
257
|
+
* @category models
|
|
258
|
+
* @since 0.3.0
|
|
259
|
+
*/
|
|
260
|
+
export interface Paint {
|
|
261
|
+
/** Device pixels to each CSS pixel, more than 0 and at most 4. The layout keeps its size. */
|
|
262
|
+
readonly scale?: number | undefined;
|
|
263
|
+
/** False hides the page's scrollbars from its next document on, and its layout takes their room. */
|
|
264
|
+
readonly scrollbars?: boolean | undefined;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Scoped access to one page's shared capture and its current-document evidence.
|
|
269
|
+
*
|
|
270
|
+
* @stability stable
|
|
271
|
+
* @category models
|
|
272
|
+
* @since 0.3.0
|
|
273
|
+
*/
|
|
274
|
+
export interface Capture {
|
|
275
|
+
/**
|
|
276
|
+
* Screencast frames for as long as the stream runs. Concurrent streams share one screencast and
|
|
277
|
+
* its settings; explicit options that differ from a running screencast's fail with
|
|
278
|
+
* InvalidRequest.
|
|
279
|
+
*/
|
|
280
|
+
readonly stream: Stream.Stream<Frame, BrowserError>;
|
|
281
|
+
readonly current: Frame | undefined;
|
|
282
|
+
readonly isCurrent: (frame: Frame) => boolean;
|
|
283
|
+
readonly confirm: (frame: Frame) => Effect.Effect<boolean, BrowserError>;
|
|
284
|
+
readonly sync: Effect.Effect<void, BrowserError>;
|
|
285
|
+
/**
|
|
286
|
+
* What this page's captures received, delivered and dropped, over its life or the latest
|
|
287
|
+
* `window`, which reaches back at most a minute; a longer one is an `InvalidRequest`. It reads
|
|
288
|
+
* the page's counts, so it serves after the lease's scope has closed.
|
|
289
|
+
*/
|
|
290
|
+
readonly stats: (options?: {
|
|
291
|
+
readonly window?: Duration.Input | undefined;
|
|
292
|
+
}) => Effect.Effect<CaptureStats, BrowserError>;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* The viewport with its timing: the newest screencast frame if it qualifies, else a new
|
|
297
|
+
* screenshot timed by the host interval in which it was taken. A frame of a stated age that the
|
|
298
|
+
* screencast has costs nothing and waits for no action; one that must follow the latest input, or
|
|
299
|
+
* a new screenshot, waits for the action in flight.
|
|
300
|
+
*
|
|
301
|
+
* @stability stable
|
|
302
|
+
* @category constructors
|
|
303
|
+
* @since 0.3.0
|
|
304
|
+
*/
|
|
305
|
+
export const read: {
|
|
306
|
+
(options?: FrameOptions): (page: Page) => Effect.Effect<Frame, BrowserError>;
|
|
307
|
+
(page: Page, options?: FrameOptions): Effect.Effect<Frame, BrowserError>;
|
|
308
|
+
} = Function.dual(
|
|
309
|
+
(args) => isPage(args[0]),
|
|
310
|
+
(page: Page, options?: FrameOptions) => functionsOf(page).frame(options),
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* A crop in CSS pixels, unmagnified, with the origin that keeps later input in viewport pixels.
|
|
315
|
+
* A crop is always a new picture; with `scale: "device"` it has the screen's own pixels.
|
|
316
|
+
*
|
|
317
|
+
* @stability stable
|
|
318
|
+
* @category constructors
|
|
319
|
+
* @since 0.3.0
|
|
320
|
+
*/
|
|
321
|
+
export const zoom: {
|
|
322
|
+
(
|
|
323
|
+
region: Region,
|
|
324
|
+
options?: Pick<FrameOptions, "quality" | "format" | "scale">,
|
|
325
|
+
): (page: Page) => Effect.Effect<Zoom, BrowserError>;
|
|
326
|
+
(
|
|
327
|
+
page: Page,
|
|
328
|
+
region: Region,
|
|
329
|
+
options?: Pick<FrameOptions, "quality" | "format" | "scale">,
|
|
330
|
+
): Effect.Effect<Zoom, BrowserError>;
|
|
331
|
+
} = Function.dual(
|
|
332
|
+
(args) => isPage(args[0]),
|
|
333
|
+
(page: Page, region: Region, options?: Pick<FrameOptions, "quality" | "format" | "scale">) =>
|
|
334
|
+
functionsOf(page).zoom(region, options),
|
|
335
|
+
);
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* A scoped lease on the page's capture, which starts at once, independently of its first frame.
|
|
339
|
+
*
|
|
340
|
+
* @stability stable
|
|
341
|
+
* @category constructors
|
|
342
|
+
* @since 0.3.0
|
|
343
|
+
*/
|
|
344
|
+
export const capture: {
|
|
345
|
+
(options?: ScreencastOptions): (page: Page) => Effect.Effect<Capture, BrowserError, Scope.Scope>;
|
|
346
|
+
(page: Page, options?: ScreencastOptions): Effect.Effect<Capture, BrowserError, Scope.Scope>;
|
|
347
|
+
} = Function.dual(
|
|
348
|
+
(args) => isPage(args[0]),
|
|
349
|
+
(page: Page, options?: ScreencastOptions) => functionsOf(page).capture(options),
|
|
350
|
+
);
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* The page's screencast frames painted within the browser's `frameHistory` of the newest, oldest first.
|
|
354
|
+
*
|
|
355
|
+
* @stability stable
|
|
356
|
+
* @category combinators
|
|
357
|
+
* @since 0.3.0
|
|
358
|
+
*/
|
|
359
|
+
export const recent = (page: Page): Effect.Effect<ReadonlyArray<Frame>> =>
|
|
360
|
+
functionsOf(page).recentFrames;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Paint the page at `scale` device pixels to each CSS pixel, or without its scrollbars, for a
|
|
364
|
+
* scope: a frame with `scale: "device"` then has that many more pixels, while the layout, its
|
|
365
|
+
* boxes and input keep their CSS pixels. Scrollbars go from the next document on, and come back
|
|
366
|
+
* from the next after the scope, so paint, then load the page, then measure it. One at a time. A
|
|
367
|
+
* browser this library launched paints at the scale of its launch (Chromium's
|
|
368
|
+
* `deviceScaleFactor`), and refuses another.
|
|
369
|
+
*
|
|
370
|
+
* @stability stable
|
|
371
|
+
* @category combinators
|
|
372
|
+
* @since 0.3.0
|
|
373
|
+
*/
|
|
374
|
+
export const paint: {
|
|
375
|
+
(options: Paint): (page: Page) => Effect.Effect<void, BrowserError, Scope.Scope>;
|
|
376
|
+
(page: Page, options: Paint): Effect.Effect<void, BrowserError, Scope.Scope>;
|
|
377
|
+
} = Function.dual(2, (page: Page, options: Paint) => functionsOf(page).paint(options));
|
|
@@ -3,11 +3,15 @@
|
|
|
3
3
|
* pointer that glides, keys typed at a person's pace, held buttons and wheels in bursts. A page's
|
|
4
4
|
* actions take one, and the input reaches the same controls either way; only its timing, and
|
|
5
5
|
* what viewers see of it, differ. A presenter builds the performed one.
|
|
6
|
+
*
|
|
7
|
+
* @stability stable
|
|
8
|
+
* @since 0.3.0
|
|
6
9
|
*/
|
|
7
10
|
import {
|
|
8
11
|
Context,
|
|
9
12
|
type Duration,
|
|
10
13
|
Effect,
|
|
14
|
+
Function,
|
|
11
15
|
type MutableRef,
|
|
12
16
|
type Option,
|
|
13
17
|
Random,
|
|
@@ -16,11 +20,17 @@ import {
|
|
|
16
20
|
|
|
17
21
|
import { undispatched, type BrowserError, InvalidRequest, refuse } from "./BrowserError.ts";
|
|
18
22
|
import type { ActionAnnounced } from "./BrowserEvent.ts";
|
|
19
|
-
import
|
|
20
|
-
import
|
|
23
|
+
import { millisOf } from "./internal/clock.ts";
|
|
24
|
+
import type * as Motion from "./internal/geometry.ts";
|
|
25
|
+
import { normal } from "./internal/geometry.ts";
|
|
21
26
|
import * as Keys from "./internal/input/keys.ts";
|
|
22
27
|
import type { Point } from "./Page.ts";
|
|
23
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @stability stable
|
|
31
|
+
* @category models
|
|
32
|
+
* @since 0.3.0
|
|
33
|
+
*/
|
|
24
34
|
export interface TypingEvent {
|
|
25
35
|
/** From the start of the typing. */
|
|
26
36
|
readonly afterMillis: number;
|
|
@@ -28,6 +38,11 @@ export interface TypingEvent {
|
|
|
28
38
|
readonly key: string;
|
|
29
39
|
}
|
|
30
40
|
|
|
41
|
+
/**
|
|
42
|
+
* @stability stable
|
|
43
|
+
* @category models
|
|
44
|
+
* @since 0.3.0
|
|
45
|
+
*/
|
|
31
46
|
export interface WheelStep {
|
|
32
47
|
readonly dx: number;
|
|
33
48
|
readonly dy: number;
|
|
@@ -35,7 +50,12 @@ export interface WheelStep {
|
|
|
35
50
|
readonly afterMillis: number;
|
|
36
51
|
}
|
|
37
52
|
|
|
38
|
-
|
|
53
|
+
/**
|
|
54
|
+
* @stability stable
|
|
55
|
+
* @category models
|
|
56
|
+
* @since 0.3.0
|
|
57
|
+
*/
|
|
58
|
+
export interface InputStyle {
|
|
39
59
|
/** Own presentation only after policy allows input; wait options belong to the page. */
|
|
40
60
|
readonly withInput?:
|
|
41
61
|
| ((options: {
|
|
@@ -76,8 +96,14 @@ export interface Style {
|
|
|
76
96
|
readonly wheel: (dx: number, dy: number) => Effect.Effect<ReadonlyArray<WheelStep>, BrowserError>;
|
|
77
97
|
}
|
|
78
98
|
|
|
79
|
-
/**
|
|
80
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Each key as it comes, with no pause; a drag moves in eight short steps so its target sees it.
|
|
101
|
+
*
|
|
102
|
+
* @stability stable
|
|
103
|
+
* @category constants
|
|
104
|
+
* @since 0.3.0
|
|
105
|
+
*/
|
|
106
|
+
export const plain: InputStyle = {
|
|
81
107
|
shown: false,
|
|
82
108
|
pointer: undefined,
|
|
83
109
|
glide: (from, to, dragging) =>
|
|
@@ -119,7 +145,13 @@ const lognormal = Effect.fnUntraced(function* (
|
|
|
119
145
|
return Math.max(minimum, Math.min(maximum, median * Math.exp(sigma * (yield* normal))));
|
|
120
146
|
});
|
|
121
147
|
|
|
122
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* A pause around `median`, as the research measured reactions: at most four times it.
|
|
150
|
+
*
|
|
151
|
+
* @stability stable
|
|
152
|
+
* @category constructors
|
|
153
|
+
* @since 0.3.0
|
|
154
|
+
*/
|
|
123
155
|
export const pause = (median: number, sigma: number) =>
|
|
124
156
|
median <= 0 ? Effect.succeed(0) : lognormal(median, sigma, 0, median * 4);
|
|
125
157
|
|
|
@@ -134,6 +166,10 @@ const eventOrder = { up: 0, insert: 1, down: 2 };
|
|
|
134
166
|
* physical key is never held twice, as with A and a, or ! and 1. The first key waits for the hand
|
|
135
167
|
* to reach the keys, each later one follows the last by a gap drawn around `gap`, and a word's
|
|
136
168
|
* first key comes 60 ms later.
|
|
169
|
+
*
|
|
170
|
+
* @stability stable
|
|
171
|
+
* @category constants
|
|
172
|
+
* @since 0.3.0
|
|
137
173
|
*/
|
|
138
174
|
export const maximumDurationMillis = 10_000;
|
|
139
175
|
|
|
@@ -187,8 +223,14 @@ const decode =
|
|
|
187
223
|
),
|
|
188
224
|
);
|
|
189
225
|
|
|
190
|
-
/**
|
|
191
|
-
|
|
226
|
+
/**
|
|
227
|
+
* Copy and validate custom schedules before their first input; planning uses the action bound.
|
|
228
|
+
*
|
|
229
|
+
* @stability stable
|
|
230
|
+
* @category combinators
|
|
231
|
+
* @since 0.3.0
|
|
232
|
+
*/
|
|
233
|
+
export const validated = (style: InputStyle): InputStyle => ({
|
|
192
234
|
...style,
|
|
193
235
|
hold: style.hold.pipe(Effect.flatMap(decode(Delay, "click"))),
|
|
194
236
|
keyGap: style.keyGap.pipe(Effect.flatMap(decode(Delay, "press"))),
|
|
@@ -244,7 +286,13 @@ const typing = Effect.fnUntraced(function* (
|
|
|
244
286
|
);
|
|
245
287
|
});
|
|
246
288
|
|
|
247
|
-
/**
|
|
289
|
+
/**
|
|
290
|
+
* A word is five characters; the gap leaves room for each word's later start.
|
|
291
|
+
*
|
|
292
|
+
* @stability stable
|
|
293
|
+
* @category constructors
|
|
294
|
+
* @since 0.3.0
|
|
295
|
+
*/
|
|
248
296
|
export const keyGap = (wordsPerMinute: number) => 12_000 / wordsPerMinute - 10;
|
|
249
297
|
|
|
250
298
|
/**
|
|
@@ -270,13 +318,19 @@ const bursts = Effect.fnUntraced(function* (dx: number, dy: number) {
|
|
|
270
318
|
});
|
|
271
319
|
|
|
272
320
|
/**
|
|
273
|
-
* A wheel that eases over `
|
|
274
|
-
*
|
|
275
|
-
*
|
|
321
|
+
* A wheel that eases over `duration`: a step each frame, sixty a second, slow at first and last,
|
|
322
|
+
* so a scroll that viewers watch glides to where it goes. A style takes it as its `wheel`; a film
|
|
323
|
+
* scrolls on its own time instead.
|
|
324
|
+
*
|
|
325
|
+
* @stability stable
|
|
326
|
+
* @category constructors
|
|
327
|
+
* @since 0.3.0
|
|
276
328
|
*/
|
|
277
329
|
export const eased =
|
|
278
|
-
(
|
|
330
|
+
(duration: Duration.Input): InputStyle["wheel"] =>
|
|
279
331
|
(dx, dy) => {
|
|
332
|
+
const durationMillis = millisOf(duration);
|
|
333
|
+
|
|
280
334
|
if (!Number.isFinite(durationMillis) || durationMillis < 0)
|
|
281
335
|
return refuse("scroll", "an eased scroll lasts a finite, nonnegative time");
|
|
282
336
|
if (durationMillis > maximumDurationMillis) return Effect.fail(overBudget("scroll"));
|
|
@@ -298,12 +352,18 @@ export const eased =
|
|
|
298
352
|
);
|
|
299
353
|
};
|
|
300
354
|
|
|
301
|
-
/**
|
|
355
|
+
/**
|
|
356
|
+
* Input performed for viewers, with this pointer and pace.
|
|
357
|
+
*
|
|
358
|
+
* @stability stable
|
|
359
|
+
* @category constructors
|
|
360
|
+
* @since 0.3.0
|
|
361
|
+
*/
|
|
302
362
|
export const performed = (options: {
|
|
303
363
|
readonly pointer: MutableRef.MutableRef<Option.Option<Point>>;
|
|
304
364
|
readonly motion: Motion.Planner;
|
|
305
365
|
readonly wordsPerMinute: number;
|
|
306
|
-
}):
|
|
366
|
+
}): InputStyle => {
|
|
307
367
|
const gap = keyGap(options.wordsPerMinute);
|
|
308
368
|
|
|
309
369
|
return {
|
|
@@ -317,13 +377,29 @@ export const performed = (options: {
|
|
|
317
377
|
};
|
|
318
378
|
};
|
|
319
379
|
|
|
320
|
-
/**
|
|
321
|
-
|
|
380
|
+
/**
|
|
381
|
+
* Input style in this fiber; plain input is the default.
|
|
382
|
+
*
|
|
383
|
+
* @stability stable
|
|
384
|
+
* @category services
|
|
385
|
+
* @since 0.3.0
|
|
386
|
+
*/
|
|
387
|
+
export const Current = Context.Reference<InputStyle>("effect-browser/InputStyle", {
|
|
322
388
|
defaultValue: () => plain,
|
|
323
389
|
});
|
|
324
390
|
|
|
325
|
-
/**
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
391
|
+
/**
|
|
392
|
+
* Apply a style through page input, including pages selected later by a browser adapter.
|
|
393
|
+
*
|
|
394
|
+
* @stability stable
|
|
395
|
+
* @category combinators
|
|
396
|
+
* @since 0.3.0
|
|
397
|
+
*/
|
|
398
|
+
export const provide: {
|
|
399
|
+
(style: InputStyle): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
400
|
+
<A, E, R>(effect: Effect.Effect<A, E, R>, style: InputStyle): Effect.Effect<A, E, R>;
|
|
401
|
+
} = Function.dual(
|
|
402
|
+
2,
|
|
403
|
+
<A, E, R>(effect: Effect.Effect<A, E, R>, style: InputStyle): Effect.Effect<A, E, R> =>
|
|
404
|
+
Effect.provideService(effect, Current, style),
|
|
405
|
+
);
|