effect-browser 0.3.0-beta.23 → 0.3.0-beta.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +437 -142
- package/dist/Action.d.mts +1 -1
- package/dist/Action.mjs +61 -9
- package/dist/Action.mjs.map +1 -1
- package/dist/Browser.d.mts +2 -2
- package/dist/Browser.mjs +2 -2
- package/dist/BrowserError.d.mts +2 -2
- package/dist/BrowserError.mjs +194 -41
- package/dist/BrowserError.mjs.map +1 -1
- package/dist/BrowserEvent.d.mts +2 -2
- package/dist/BrowserEvent.mjs +185 -35
- package/dist/BrowserEvent.mjs.map +1 -1
- package/dist/Cdp.d.mts +15 -0
- package/dist/Cdp.mjs +22 -0
- package/dist/Cdp.mjs.map +1 -0
- package/dist/Change.d.mts +2 -2
- package/dist/Change.mjs +40 -7
- package/dist/Change.mjs.map +1 -1
- package/dist/Frame.d.mts +2 -2
- package/dist/Frame.mjs +132 -14
- package/dist/Frame.mjs.map +1 -1
- package/dist/InputStyle.d.mts +153 -0
- package/dist/InputStyle.mjs +2 -0
- package/dist/Layout.d.mts +2 -0
- package/dist/Layout.mjs +123 -0
- package/dist/Layout.mjs.map +1 -0
- package/dist/Overlay.d.mts +2 -0
- package/dist/Overlay.mjs +58 -0
- package/dist/Overlay.mjs.map +1 -0
- package/dist/Page.d.mts +2 -2
- package/dist/Page.mjs +2 -2
- package/dist/PageTime.d.mts +2 -0
- package/dist/PageTime.mjs +17 -0
- package/dist/PageTime.mjs.map +1 -0
- package/dist/Pose.d.mts +2 -0
- package/dist/Pose.mjs +65 -0
- package/dist/Pose.mjs.map +1 -0
- package/dist/Site.d.mts +984 -0
- package/dist/Site.mjs +110 -0
- package/dist/Site.mjs.map +1 -0
- package/dist/Snapshot.d.mts +2 -2
- package/dist/Snapshot.mjs +87 -6
- package/dist/Snapshot.mjs.map +1 -1
- package/dist/Text.d.mts +2 -0
- package/dist/Text.mjs +45 -0
- package/dist/Text.mjs.map +1 -0
- package/dist/Window.d.mts +2 -2
- package/dist/Window.mjs +31 -6
- package/dist/Window.mjs.map +1 -1
- package/dist/ai/BrowserTools.d.mts +4987 -0
- package/dist/ai/BrowserTools.mjs +3 -0
- package/dist/ai/PageControl.d.mts +286 -0
- package/dist/ai/PageControl.mjs +426 -0
- package/dist/ai/PageControl.mjs.map +1 -0
- package/dist/ai/PromptCache.d.mts +16 -0
- package/dist/ai/PromptCache.mjs +72 -0
- package/dist/ai/PromptCache.mjs.map +1 -0
- package/dist/ai/Tabs.d.mts +2 -0
- package/dist/ai/Tabs.mjs +72 -0
- package/dist/ai/Tabs.mjs.map +1 -0
- package/dist/ai/ToolError.d.mts +34 -0
- package/dist/ai/ToolError.mjs +2 -0
- package/dist/ai/index.d.mts +6 -0
- package/dist/ai/index.mjs +6 -0
- package/dist/index.d.mts +7 -15
- package/dist/index.mjs +9 -8
- package/dist/{Action-24sLOubi.d.mts → internal/Action-CkanNTUw.d.mts} +64 -4
- package/dist/{Browser-wZhwZSlG.d.mts → internal/Browser-DD9Vm1c-.d.mts} +80 -10
- package/dist/{Browser-BKPAbyys.mjs → internal/Browser-vzD7i2oj.mjs} +658 -495
- package/dist/internal/Browser-vzD7i2oj.mjs.map +1 -0
- package/dist/{BrowserError-BlcmLVzn.d.mts → internal/BrowserError-CsuRYcDX.d.mts} +187 -28
- package/dist/{BrowserEvent-lLqJ3GJS.d.mts → internal/BrowserEvent-tGPYYf6R.d.mts} +197 -18
- package/dist/internal/BrowserTools-Yi3lOX4h.mjs +497 -0
- package/dist/internal/BrowserTools-Yi3lOX4h.mjs.map +1 -0
- package/dist/{Style-AO4V7Czt.mjs → internal/InputStyle-CPzxoN4g.mjs} +94 -16
- package/dist/internal/InputStyle-CPzxoN4g.mjs.map +1 -0
- package/dist/{moment/Moment.mjs → internal/Moment-CstaX1mR.mjs} +49 -16
- package/dist/internal/Moment-CstaX1mR.mjs.map +1 -0
- package/dist/{moment/Moment.d.mts → internal/Moment-DOcldBdf.d.mts} +54 -21
- package/dist/internal/Page-BfGxn7oN.d.mts +1553 -0
- package/dist/{Page-BF5izr8R.mjs → internal/Page-DqF-tuTx.mjs} +62 -72
- package/dist/internal/Page-DqF-tuTx.mjs.map +1 -0
- package/dist/internal/Release-CFONkPDP.d.mts +39 -0
- package/dist/internal/Stage-D5ymSXDT.mjs +298 -0
- package/dist/internal/Stage-D5ymSXDT.mjs.map +1 -0
- package/dist/internal/Stillness-DCPeAN1a.mjs +1124 -0
- package/dist/internal/Stillness-DCPeAN1a.mjs.map +1 -0
- package/dist/internal/Supervisor-BcY_QNIY.d.mts +108 -0
- package/dist/internal/Supervisor-BcglY23c.mjs +531 -0
- package/dist/internal/Supervisor-BcglY23c.mjs.map +1 -0
- package/dist/internal/Tabs-dXMscIUQ.d.mts +52 -0
- package/dist/internal/TestPage-CYiYbh63.d.mts +159 -0
- package/dist/internal/ToolError-DArsRS2m.mjs +117 -0
- package/dist/internal/ToolError-DArsRS2m.mjs.map +1 -0
- package/dist/{plan/index.d.mts → internal/Walk-BNXcfZ2z.d.mts} +59 -35
- package/dist/{plan/index.mjs → internal/Walk-C5ky7uSf.mjs} +83 -51
- package/dist/internal/Walk-C5ky7uSf.mjs.map +1 -0
- package/dist/{ActionPort.mjs → internal/action-port-B5EkeGOR.mjs} +6 -12
- package/dist/internal/action-port-B5EkeGOR.mjs.map +1 -0
- package/dist/internal/cdp/workerd.d.mts +13 -0
- package/dist/internal/cdp/workerd.mjs +19 -0
- package/dist/internal/cdp/workerd.mjs.map +1 -0
- package/dist/{Clock.mjs → internal/clock-BKSAEf00.mjs} +13 -13
- package/dist/internal/clock-BKSAEf00.mjs.map +1 -0
- package/dist/{connection-2KHI4_KN.d.mts → internal/connection-BaB0vp1o.d.mts} +6 -6
- package/dist/{connection-CK83pvqP.mjs → internal/connection-C2X4GmXM.mjs} +19 -15
- package/dist/internal/connection-C2X4GmXM.mjs.map +1 -0
- package/dist/internal/events-DzCrww-y.mjs +72 -0
- package/dist/internal/events-DzCrww-y.mjs.map +1 -0
- package/dist/internal/fold.inpage-CyVZQHZL.d.mts +49 -0
- package/dist/internal/fold.inpage-uhrT-dOB.mjs +49 -0
- package/dist/internal/fold.inpage-uhrT-dOB.mjs.map +1 -0
- package/dist/internal/functions-jBOs6GKv.mjs +27 -0
- package/dist/internal/functions-jBOs6GKv.mjs.map +1 -0
- package/dist/{Geometry-DJx9qrYy.d.mts → internal/geometry-Dhj_ztJs.d.mts} +3 -3
- package/dist/{Geometry.mjs → internal/geometry-Lxyflb9J.mjs} +3 -12
- package/dist/internal/geometry-Lxyflb9J.mjs.map +1 -0
- package/dist/{Matching.mjs → internal/matching-Cs-UeOY0.mjs} +24 -19
- package/dist/internal/matching-Cs-UeOY0.mjs.map +1 -0
- package/dist/internal/page-DFQb-YOK.mjs +436 -0
- package/dist/internal/page-DFQb-YOK.mjs.map +1 -0
- package/dist/internal/pose.inpage-CBFeWcVa.mjs +1996 -0
- package/dist/internal/pose.inpage-CBFeWcVa.mjs.map +1 -0
- package/dist/{Url.mjs → internal/url-DB0pQYk6.mjs} +3 -12
- package/dist/internal/url-DB0pQYk6.mjs.map +1 -0
- package/dist/policy/Policy.d.mts +60 -6
- package/dist/policy/Policy.mjs +52 -9
- package/dist/policy/Policy.mjs.map +1 -1
- package/dist/policy/index.d.mts +2 -0
- package/dist/policy/index.mjs +2 -0
- package/dist/presentation/Film.d.mts +332 -0
- package/dist/presentation/Film.mjs +298 -0
- package/dist/presentation/Film.mjs.map +1 -0
- package/dist/presentation/Motion.d.mts +5 -1
- package/dist/presentation/Motion.mjs +16 -2
- package/dist/presentation/Motion.mjs.map +1 -1
- package/dist/presentation/Presentation.d.mts +48 -6
- package/dist/presentation/Presentation.mjs +28 -9
- package/dist/presentation/Presentation.mjs.map +1 -1
- package/dist/presentation/Stage.d.mts +40 -6
- package/dist/presentation/Stage.mjs +1 -262
- package/dist/presentation/index.d.mts +5 -0
- package/dist/presentation/index.mjs +5 -0
- package/dist/supervisor/Release.d.mts +2 -0
- package/dist/supervisor/Release.mjs +40 -0
- package/dist/supervisor/Release.mjs.map +1 -0
- package/dist/supervisor/Supervisor.d.mts +2 -104
- package/dist/supervisor/Supervisor.mjs +2 -515
- package/dist/supervisor/index.d.mts +3 -0
- package/dist/supervisor/index.mjs +3 -0
- package/dist/testing/HttpCassette.d.mts +98 -0
- package/dist/testing/HttpCassette.mjs +146 -0
- package/dist/testing/HttpCassette.mjs.map +1 -0
- package/dist/testing/Story.d.mts +31 -0
- package/dist/testing/Story.mjs +76 -0
- package/dist/testing/Story.mjs.map +1 -0
- package/dist/testing/TestBrowser.d.mts +191 -0
- package/dist/testing/TestBrowser.mjs +105 -0
- package/dist/testing/TestBrowser.mjs.map +1 -0
- package/dist/testing/TestModel.d.mts +133 -0
- package/dist/testing/TestModel.mjs +209 -0
- package/dist/testing/TestModel.mjs.map +1 -0
- package/dist/testing/TestPage.d.mts +2 -0
- package/dist/testing/TestPage.mjs +47 -0
- package/dist/testing/TestPage.mjs.map +1 -0
- package/dist/testing/index.d.mts +6 -337
- package/dist/testing/index.mjs +6 -515
- package/dist/timeline/Moment.d.mts +3 -0
- package/dist/timeline/Moment.mjs +3 -0
- package/dist/timeline/Stillness.d.mts +34 -0
- package/dist/timeline/Stillness.mjs +2 -0
- package/dist/timeline/index.d.mts +3 -0
- package/dist/timeline/index.mjs +3 -0
- package/dist/walk/Walk.d.mts +2 -0
- package/dist/walk/Walk.mjs +2 -0
- package/dist/walk/index.d.mts +2 -0
- package/dist/walk/index.mjs +2 -0
- package/package.json +54 -133
- package/src/Action.ts +73 -8
- package/src/Browser.ts +85 -14
- package/src/BrowserError.ts +258 -63
- package/src/BrowserEvent.ts +264 -48
- package/src/Cdp.ts +42 -0
- package/src/Change.ts +75 -4
- package/src/Frame.ts +247 -14
- package/src/{Style.ts → InputStyle.ts} +130 -18
- package/src/Layout.ts +187 -0
- package/src/Overlay.ts +76 -0
- package/src/Page.ts +144 -275
- package/src/PageTime.ts +72 -0
- package/src/Pose.ts +81 -0
- package/src/Site.ts +136 -0
- package/src/Snapshot.ts +179 -3
- package/src/Text.ts +60 -0
- package/src/Window.ts +53 -3
- package/src/ai/BrowserTools.ts +778 -0
- package/src/ai/PageControl.ts +702 -0
- package/src/ai/PromptCache.ts +87 -0
- package/src/ai/Tabs.ts +84 -0
- package/src/ai/ToolError.ts +50 -0
- package/src/ai/index.ts +36 -0
- package/src/ai/internal/crops.ts +38 -0
- package/src/ai/internal/points.ts +57 -0
- package/src/ai/internal/receipts.ts +107 -0
- package/src/index.ts +87 -6
- package/src/{ActionPort.ts → internal/action-port.ts} +3 -3
- package/src/{providers → internal/cdp}/connection.ts +19 -12
- package/src/internal/cdp/workerd.ts +36 -0
- package/src/{Clock.ts → internal/clock.ts} +20 -0
- package/src/internal/input/actions.ts +1 -1
- package/src/internal/input/dispatch.ts +2 -2
- package/src/internal/input/guard.inpage.ts +1 -1
- package/src/internal/input/guard.ts +1 -1
- package/src/internal/input/perform.ts +35 -7
- package/src/internal/input/pointer.ts +9 -6
- package/src/internal/input/targets.inpage.ts +3 -3
- package/src/internal/input/targets.ts +1 -1
- package/src/{Matching.ts → internal/matching.ts} +28 -19
- package/src/internal/page/bridge.ts +67 -35
- package/src/internal/page/clock.inpage.ts +306 -0
- package/src/internal/page/compose.inpage.ts +101 -0
- package/src/internal/page/context.ts +4 -2
- package/src/internal/page/functions.ts +84 -0
- package/src/internal/page/navigation.ts +1 -1
- package/src/internal/page/openings.ts +2 -2
- package/src/internal/page/overlay.inpage.ts +96 -0
- package/src/internal/page/overlay.ts +89 -0
- package/src/internal/page/page.ts +39 -29
- package/src/internal/page/port.ts +14 -8
- package/src/internal/page/pose.inpage.ts +200 -0
- package/src/internal/page/pose.ts +80 -0
- package/src/internal/page/replies.ts +1 -1
- package/src/internal/page/requests.ts +1 -1
- package/src/internal/page/scripts.ts +1 -1
- package/src/internal/page/time.inpage.ts +49 -0
- package/src/internal/page/time.ts +122 -0
- package/src/internal/page/viewport.ts +3 -2
- package/src/internal/pictures/capture.ts +1 -4
- package/src/internal/pictures/dimensions.ts +1 -1
- package/src/internal/pictures/frame.ts +1 -1
- package/src/internal/pictures/pictures.ts +144 -91
- package/src/internal/reading/context.inpage.ts +2 -2
- package/src/internal/reading/expect.inpage.ts +1 -1
- package/src/internal/reading/layout.inpage.ts +193 -0
- package/src/internal/reading/layout.ts +101 -0
- package/src/internal/reading/names.inpage.ts +15 -0
- package/src/internal/reading/outline.inpage.ts +5 -21
- package/src/internal/reading/reading.ts +33 -21
- package/src/internal/reading/ready.inpage.ts +21 -26
- package/src/internal/reading/ready.ts +26 -5
- package/src/internal/reading/subjects.inpage.ts +3 -3
- package/src/internal/reading/text.inpage.ts +3 -16
- package/src/internal/reading/walk.inpage.ts +1 -1
- package/src/internal/timeline/changes.inpage.ts +7 -15
- package/src/internal/timeline/changes.ts +17 -5
- package/src/internal/timeline/record.inpage.ts +15 -6
- package/src/internal/timeline/sight.inpage.ts +2 -2
- package/src/internal/timeline/window.ts +3 -4
- package/src/policy/Policy.ts +70 -16
- package/src/policy/index.ts +12 -0
- package/src/presentation/Film.ts +451 -0
- package/src/presentation/Motion.ts +45 -3
- package/src/presentation/Presentation.ts +60 -14
- package/src/presentation/Stage.ts +73 -35
- package/src/presentation/index.ts +30 -0
- package/src/presentation/{feed.ts → internal/feed.ts} +1 -1
- package/src/supervisor/Release.ts +45 -0
- package/src/supervisor/Supervisor.ts +80 -5
- package/src/supervisor/index.ts +18 -0
- package/src/supervisor/{contract.ts → internal/contract.ts} +14 -10
- package/src/supervisor/{lifecycle.ts → internal/lifecycle.ts} +7 -7
- package/src/supervisor/{runtime.ts → internal/runtime.ts} +7 -7
- package/src/testing/HttpCassette.ts +260 -0
- package/src/testing/Story.ts +103 -0
- package/src/testing/TestBrowser.ts +14 -4
- package/src/testing/TestModel.ts +297 -0
- package/src/testing/TestPage.ts +92 -4
- package/src/testing/index.ts +35 -1
- package/src/testing/{evidence.ts → internal/evidence.ts} +19 -11
- package/src/testing/{model.ts → internal/model.ts} +14 -8
- package/src/testing/{page.ts → internal/page.ts} +55 -51
- package/src/{moment → timeline}/Moment.ts +79 -29
- package/src/{stillness → timeline}/Stillness.ts +89 -46
- package/src/timeline/index.ts +18 -0
- package/src/{stillness/Pixels.ts → timeline/internal/pixels.ts} +27 -1
- package/src/{moment → timeline/internal}/words.ts +2 -2
- package/src/walk/Walk.ts +165 -0
- package/src/walk/index.ts +12 -0
- package/src/{plan → walk/internal}/choose.ts +23 -14
- package/src/{plan → walk/internal}/data.ts +37 -14
- package/src/{plan → walk/internal}/execute.ts +79 -36
- package/src/{plan → walk/internal}/record.ts +6 -6
- package/src/{plan → walk/internal}/targets.ts +35 -25
- package/dist/ActionPort.d.mts +0 -15
- package/dist/ActionPort.mjs.map +0 -1
- package/dist/Browser-BKPAbyys.mjs.map +0 -1
- package/dist/Change-Ba7INmay.d.mts +0 -69
- package/dist/Clock.d.mts +0 -57
- package/dist/Clock.mjs.map +0 -1
- package/dist/Frame-UEH2hO5T.d.mts +0 -124
- package/dist/Geometry.d.mts +0 -2
- package/dist/Geometry.mjs.map +0 -1
- package/dist/Matching.d.mts +0 -37
- package/dist/Matching.mjs.map +0 -1
- package/dist/Page-BF5izr8R.mjs.map +0 -1
- package/dist/Page-CvsOEorc.d.mts +0 -566
- package/dist/Released-tURbFmal.d.mts +0 -15
- package/dist/Snapshot-CtBVOtuu.d.mts +0 -73
- package/dist/Stillness-CNlvayIo.mjs +0 -136
- package/dist/Stillness-CNlvayIo.mjs.map +0 -1
- package/dist/Style-AO4V7Czt.mjs.map +0 -1
- package/dist/Style.d.mts +0 -72
- package/dist/Style.mjs +0 -2
- package/dist/Url.d.mts +0 -26
- package/dist/Url.mjs.map +0 -1
- package/dist/Window-CMddGMt1.d.mts +0 -34
- package/dist/connection-CK83pvqP.mjs.map +0 -1
- package/dist/moment/Moment.mjs.map +0 -1
- package/dist/plan/index.mjs.map +0 -1
- package/dist/presentation/Stage.mjs.map +0 -1
- package/dist/presentation/feed.d.mts +0 -20
- package/dist/presentation/feed.mjs +0 -18
- package/dist/presentation/feed.mjs.map +0 -1
- package/dist/providers/Cdp.d.mts +0 -9
- package/dist/providers/Cdp.mjs +0 -15
- package/dist/providers/Cdp.mjs.map +0 -1
- package/dist/providers/Chromium.d.mts +0 -32
- package/dist/providers/Chromium.mjs +0 -55
- package/dist/providers/Chromium.mjs.map +0 -1
- package/dist/providers/Released.d.mts +0 -2
- package/dist/providers/Released.mjs +0 -12
- package/dist/providers/Released.mjs.map +0 -1
- package/dist/stillness/Stillness.d.mts +0 -12
- package/dist/stillness/Stillness.mjs +0 -2
- package/dist/supervisor/Supervisor.mjs.map +0 -1
- package/dist/testing/index.mjs.map +0 -1
- package/dist/workerd/Cdp.d.mts +0 -8
- package/dist/workerd/Cdp.mjs +0 -13
- package/dist/workerd/Cdp.mjs.map +0 -1
- package/src/plan/index.ts +0 -36
- package/src/providers/Cdp.ts +0 -16
- package/src/providers/Chromium.ts +0 -99
- package/src/providers/Released.ts +0 -13
- package/src/workerd/Cdp.ts +0 -11
- /package/dist/{rolldown-runtime-D7D4PA-g.mjs → internal/rolldown-runtime-D7D4PA-g.mjs} +0 -0
- /package/src/{Geometry.ts → internal/geometry.ts} +0 -0
- /package/src/{Url.ts → internal/url.ts} +0 -0
- /package/src/{stillness → timeline/internal}/utilsBundle.d.ts +0 -0
package/dist/Site.mjs
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { t as addresses } from "./internal/url-DB0pQYk6.mjs";
|
|
2
|
+
import { n as pickRequests, r as request, t as match } from "./internal/matching-Cs-UeOY0.mjs";
|
|
3
|
+
import { _ as names, a as sight, b as controls, c as history, d as text, f as states, g as elements, h as outline, i as compose, l as changes, m as ready, n as poseRequest, o as record, p as subjects, r as overlay, s as marks, t as pose, u as walk, v as layout, x as context, y as expectations } from "./internal/pose.inpage-CBFeWcVa.mjs";
|
|
4
|
+
import { t as fold } from "./internal/fold.inpage-uhrT-dOB.mjs";
|
|
5
|
+
//#region src/Site.ts
|
|
6
|
+
/**
|
|
7
|
+
* The library's readers for a site that owns its page, called in the site's own bundle on its own
|
|
8
|
+
* document, with no protocol in it. It is the composition the library installs in a page over the
|
|
9
|
+
* protocol, so a site reads the same refs, subjects, outline, text, layout and changes as an agent
|
|
10
|
+
* does, draws in the same overlay, and poses elements the same way.
|
|
11
|
+
*
|
|
12
|
+
* What needs the protocol stays out:
|
|
13
|
+
*
|
|
14
|
+
* - trusted input and the checks that make it safe;
|
|
15
|
+
* - pictures;
|
|
16
|
+
* - held page time;
|
|
17
|
+
* - a record that starts before the page's own scripts.
|
|
18
|
+
*
|
|
19
|
+
* Instead, the site acts through its own app and `note`s each act, so the changes it brings name it
|
|
20
|
+
* as their cause. Time is real, so a pose or a drawing is set again on each animation frame. The
|
|
21
|
+
* record starts when the site calls `record`.
|
|
22
|
+
*
|
|
23
|
+
* Requests and results are the page script's own plain data. Boxes are in viewport CSS pixels, and
|
|
24
|
+
* a change's times are epoch milliseconds, as `performance.timeOrigin + performance.now()`. A
|
|
25
|
+
* request the page cannot serve answers `{ invalid }`, and a ref it no longer has `{ stale }`,
|
|
26
|
+
* rather than throwing. `Layout`, `Change` and `Snapshot` hold their schemas. The script runs in
|
|
27
|
+
* the site's own world, so it shares the globals the site's code may patch.
|
|
28
|
+
*
|
|
29
|
+
* @stability stable
|
|
30
|
+
* @since 0.3.0
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* The readers, the change record, the overlay and poses for the current document. Make one for
|
|
34
|
+
* each document the site shows, and `stopRecord` the last one's.
|
|
35
|
+
*
|
|
36
|
+
* @stability stable
|
|
37
|
+
* @category constructors
|
|
38
|
+
* @since 0.3.0
|
|
39
|
+
*/
|
|
40
|
+
const make = () => {
|
|
41
|
+
const { named, recorder, url, reads } = compose({
|
|
42
|
+
elements,
|
|
43
|
+
names,
|
|
44
|
+
walk,
|
|
45
|
+
match,
|
|
46
|
+
context,
|
|
47
|
+
subjects,
|
|
48
|
+
states,
|
|
49
|
+
expectations,
|
|
50
|
+
text,
|
|
51
|
+
layout,
|
|
52
|
+
controls,
|
|
53
|
+
fold,
|
|
54
|
+
history,
|
|
55
|
+
sight,
|
|
56
|
+
marks,
|
|
57
|
+
record,
|
|
58
|
+
changes,
|
|
59
|
+
ready,
|
|
60
|
+
outline,
|
|
61
|
+
overlay,
|
|
62
|
+
pose,
|
|
63
|
+
addresses
|
|
64
|
+
});
|
|
65
|
+
const own = overlay(named);
|
|
66
|
+
return {
|
|
67
|
+
/** What a query finds in the viewport: each element's ref, subject, box and state. */
|
|
68
|
+
find: (query) => reads.find(request(query, "viewport")),
|
|
69
|
+
/** Where each pick is, unrounded, with a box for each of the words it asks for. */
|
|
70
|
+
layout: (picks) => reads.layout(pickRequests(picks)),
|
|
71
|
+
/** Wait up to `millis` until what a query finds in the document is as wanted. */
|
|
72
|
+
until: (query, want, millis) => reads.until(request(query, "document"), want, millis),
|
|
73
|
+
/** The page as an outline of its subjects, each control with a ref. */
|
|
74
|
+
snapshot: reads.snapshot,
|
|
75
|
+
/** The text the viewport shows, or one element's. */
|
|
76
|
+
text: reads.text,
|
|
77
|
+
/** Wait up to `millis` for what the page is still loading, quiet for `quietMillis`. */
|
|
78
|
+
ready: (millis, quietMillis) => reads.ready(millis, quietMillis),
|
|
79
|
+
/** One task, then a frame; says whether the page painted. */
|
|
80
|
+
settle: reads.settle,
|
|
81
|
+
/** Record what changes from now, until `stopRecord`, or two minutes with no `changes`. */
|
|
82
|
+
record: reads.record,
|
|
83
|
+
stopRecord: reads.stopRecord,
|
|
84
|
+
/** Keep an act the site did through its app at `target` now, for changes to name as cause. */
|
|
85
|
+
note: recorder.note,
|
|
86
|
+
/** What changed in a window of the record, each change with its box. */
|
|
87
|
+
changes: reads.changes,
|
|
88
|
+
/** Draw an SVG document over the viewport, or take it away with null; says where its parts are. */
|
|
89
|
+
draw: reads.overlay,
|
|
90
|
+
/**
|
|
91
|
+
* A layer of the site's own over the viewport, which no reader reads and the record leaves
|
|
92
|
+
* out: a closed shadow root to render into. It takes no pointer, except parts that set
|
|
93
|
+
* `pointer-events: auto`.
|
|
94
|
+
*/
|
|
95
|
+
layer: own.mount,
|
|
96
|
+
/** Pose these elements and take the pose off every other. */
|
|
97
|
+
pose: (poses) => reads.pose(poses.map(poseRequest)),
|
|
98
|
+
unpose: reads.unpose,
|
|
99
|
+
/** An element's ref, which `pose` and a read's `ref` take. */
|
|
100
|
+
ref: named.refFor,
|
|
101
|
+
/** The element a ref names, while it is in the document. */
|
|
102
|
+
element: named.lookup,
|
|
103
|
+
/** An address without its userinfo or the parameters known to carry secrets. */
|
|
104
|
+
redact: url.redact
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
//#endregion
|
|
108
|
+
export { make };
|
|
109
|
+
|
|
110
|
+
//# sourceMappingURL=Site.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Site.mjs","names":[],"sources":["../src/Site.ts"],"sourcesContent":["/**\n * The library's readers for a site that owns its page, called in the site's own bundle on its own\n * document, with no protocol in it. It is the composition the library installs in a page over the\n * protocol, so a site reads the same refs, subjects, outline, text, layout and changes as an agent\n * does, draws in the same overlay, and poses elements the same way.\n *\n * What needs the protocol stays out:\n *\n * - trusted input and the checks that make it safe;\n * - pictures;\n * - held page time;\n * - a record that starts before the page's own scripts.\n *\n * Instead, the site acts through its own app and `note`s each act, so the changes it brings name it\n * as their cause. Time is real, so a pose or a drawing is set again on each animation frame. The\n * record starts when the site calls `record`.\n *\n * Requests and results are the page script's own plain data. Boxes are in viewport CSS pixels, and\n * a change's times are epoch milliseconds, as `performance.timeOrigin + performance.now()`. A\n * request the page cannot serve answers `{ invalid }`, and a ref it no longer has `{ stale }`,\n * rather than throwing. `Layout`, `Change` and `Snapshot` hold their schemas. The script runs in\n * the site's own world, so it shares the globals the site's code may patch.\n *\n * @stability stable\n * @since 0.3.0\n */\nimport { match, pickRequests, request } from \"./internal/matching.ts\";\nimport { compose } from \"./internal/page/compose.inpage.ts\";\nimport { overlay } from \"./internal/page/overlay.inpage.ts\";\nimport { pose, poseRequest } from \"./internal/page/pose.inpage.ts\";\nimport { context } from \"./internal/reading/context.inpage.ts\";\nimport { controls } from \"./internal/reading/controls.inpage.ts\";\nimport { expectations, type Want } from \"./internal/reading/expect.inpage.ts\";\nimport { layout } from \"./internal/reading/layout.inpage.ts\";\nimport { elements, names } from \"./internal/reading/names.inpage.ts\";\nimport { outline } from \"./internal/reading/outline.inpage.ts\";\nimport { ready } from \"./internal/reading/ready.inpage.ts\";\nimport { states, subjects } from \"./internal/reading/subjects.inpage.ts\";\nimport { text } from \"./internal/reading/text.inpage.ts\";\nimport { walk } from \"./internal/reading/walk.inpage.ts\";\nimport { changes } from \"./internal/timeline/changes.inpage.ts\";\nimport { fold } from \"./internal/timeline/fold.inpage.ts\";\nimport { history } from \"./internal/timeline/history.inpage.ts\";\nimport { marks } from \"./internal/timeline/marks.inpage.ts\";\nimport { record } from \"./internal/timeline/record.inpage.ts\";\nimport { sight } from \"./internal/timeline/sight.inpage.ts\";\nimport { addresses } from \"./internal/url.ts\";\nimport type { Picks } from \"./Layout.ts\";\nimport type { Pose } from \"./Pose.ts\";\nimport type { FindQuery } from \"./Snapshot.ts\";\n\n/**\n * The readers, the change record, the overlay and poses for the current document. Make one for\n * each document the site shows, and `stopRecord` the last one's.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const make = () => {\n const { named, recorder, url, reads } = compose({\n elements,\n names,\n walk,\n match,\n context,\n subjects,\n states,\n expectations,\n text,\n layout,\n controls,\n fold,\n history,\n sight,\n marks,\n record,\n changes,\n ready,\n outline,\n overlay,\n pose,\n addresses,\n });\n\n const own = overlay(named);\n\n return {\n /** What a query finds in the viewport: each element's ref, subject, box and state. */\n find: (query: FindQuery) => reads.find(request(query, \"viewport\")),\n /** Where each pick is, unrounded, with a box for each of the words it asks for. */\n layout: (picks: Picks) => reads.layout(pickRequests(picks)),\n /** Wait up to `millis` until what a query finds in the document is as wanted. */\n until: (query: FindQuery, want: Want, millis: number) =>\n reads.until(request(query, \"document\"), want, millis),\n /** The page as an outline of its subjects, each control with a ref. */\n snapshot: reads.snapshot,\n /** The text the viewport shows, or one element's. */\n text: reads.text,\n /** Wait up to `millis` for what the page is still loading, quiet for `quietMillis`. */\n ready: (millis: number, quietMillis?: number) => reads.ready(millis, quietMillis),\n /** One task, then a frame; says whether the page painted. */\n settle: reads.settle,\n /** Record what changes from now, until `stopRecord`, or two minutes with no `changes`. */\n record: reads.record,\n stopRecord: reads.stopRecord,\n /** Keep an act the site did through its app at `target` now, for changes to name as cause. */\n note: recorder.note,\n /** What changed in a window of the record, each change with its box. */\n changes: reads.changes,\n /** Draw an SVG document over the viewport, or take it away with null; says where its parts are. */\n draw: reads.overlay,\n /**\n * A layer of the site's own over the viewport, which no reader reads and the record leaves\n * out: a closed shadow root to render into. It takes no pointer, except parts that set\n * `pointer-events: auto`.\n */\n layer: own.mount,\n /** Pose these elements and take the pose off every other. */\n pose: (poses: ReadonlyArray<Pose>) => reads.pose(poses.map(poseRequest)),\n unpose: reads.unpose,\n /** An element's ref, which `pose` and a read's `ref` take. */\n ref: named.refFor,\n /** The element a ref names, while it is in the document. */\n element: named.lookup,\n /** An address without its userinfo or the parameters known to carry secrets. */\n redact: url.redact,\n };\n};\n\n/**\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport type Site = ReturnType<typeof make>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,MAAa,aAAa;CACxB,MAAM,EAAE,OAAO,UAAU,KAAK,UAAU,QAAQ;EAC9C;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,MAAM,QAAQ,KAAK;CAEzB,OAAO;;EAEL,OAAO,UAAqB,MAAM,KAAK,QAAQ,OAAO,UAAU,CAAC;;EAEjE,SAAS,UAAiB,MAAM,OAAO,aAAa,KAAK,CAAC;;EAE1D,QAAQ,OAAkB,MAAY,WACpC,MAAM,MAAM,QAAQ,OAAO,UAAU,GAAG,MAAM,MAAM;;EAEtD,UAAU,MAAM;;EAEhB,MAAM,MAAM;;EAEZ,QAAQ,QAAgB,gBAAyB,MAAM,MAAM,QAAQ,WAAW;;EAEhF,QAAQ,MAAM;;EAEd,QAAQ,MAAM;EACd,YAAY,MAAM;;EAElB,MAAM,SAAS;;EAEf,SAAS,MAAM;;EAEf,MAAM,MAAM;;;;;;EAMZ,OAAO,IAAI;;EAEX,OAAO,UAA+B,MAAM,KAAK,MAAM,IAAI,WAAW,CAAC;EACvE,QAAQ,MAAM;;EAEd,KAAK,MAAM;;EAEX,SAAS,MAAM;;EAEf,QAAQ,IAAI;CACd;AACF"}
|
package/dist/Snapshot.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { Control, Snapshot, SnapshotOptions };
|
|
1
|
+
import { $ as ElementState, Q as Control, at as UntilResult, ct as read, et as FindQuery, lt as until, nt as Snapshot, ot as UntilWant, rt as SnapshotOptions, st as find, tt as Found } from "./internal/Page-BfGxn7oN.mjs";
|
|
2
|
+
export { Control, ElementState, FindQuery, Found, Snapshot, SnapshotOptions, UntilResult, UntilWant, find, read, until };
|
package/dist/Snapshot.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./internal/rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { Box, Subject } from "./BrowserEvent.mjs";
|
|
3
|
+
import { r as millisOf } from "./internal/clock-BKSAEf00.mjs";
|
|
4
|
+
import { n as functionsOf, r as isPage } from "./internal/functions-jBOs6GKv.mjs";
|
|
5
|
+
import { Function, Schema } from "effect";
|
|
3
6
|
//#region src/Snapshot.ts
|
|
4
7
|
/**
|
|
5
8
|
* A compact, model-readable outline of what a page shows.
|
|
@@ -8,14 +11,26 @@ import { Schema } from "effect";
|
|
|
8
11
|
* refs are never reused within a page, so a ref from an old snapshot fails as stale rather than
|
|
9
12
|
* naming a different element.
|
|
10
13
|
*
|
|
14
|
+
* @stability stable
|
|
11
15
|
* @since 0.3.0
|
|
12
16
|
*/
|
|
13
17
|
var Snapshot_exports = /* @__PURE__ */ __exportAll({
|
|
14
18
|
Control: () => Control,
|
|
15
|
-
|
|
19
|
+
ElementState: () => ElementState,
|
|
20
|
+
Found: () => Found,
|
|
21
|
+
Snapshot: () => Snapshot,
|
|
22
|
+
find: () => find,
|
|
23
|
+
read: () => read,
|
|
24
|
+
until: () => until
|
|
16
25
|
});
|
|
17
|
-
/**
|
|
18
|
-
|
|
26
|
+
/**
|
|
27
|
+
* A control the outline shows, as a value: its ref, what it is and what it holds.
|
|
28
|
+
*
|
|
29
|
+
* @stability stable
|
|
30
|
+
* @category schemas
|
|
31
|
+
* @since 0.3.0
|
|
32
|
+
*/
|
|
33
|
+
var Control = class extends Schema.Class("effect-browser/Snapshot/Control")({
|
|
19
34
|
ref: Schema.String,
|
|
20
35
|
/** Its role, such as `button` or `textbox`, or `clickable` for an element without one. */
|
|
21
36
|
kind: Schema.String,
|
|
@@ -33,6 +48,11 @@ var Control = class extends Schema.Class("effect-browser/Control")({
|
|
|
33
48
|
/** True for a field that takes typed text. */
|
|
34
49
|
editable: Schema.optional(Schema.Boolean)
|
|
35
50
|
}) {};
|
|
51
|
+
/**
|
|
52
|
+
* @stability stable
|
|
53
|
+
* @category schemas
|
|
54
|
+
* @since 0.3.0
|
|
55
|
+
*/
|
|
36
56
|
var Snapshot = class extends Schema.Class("effect-browser/Snapshot")({
|
|
37
57
|
url: Schema.String,
|
|
38
58
|
title: Schema.String,
|
|
@@ -73,7 +93,68 @@ var Snapshot = class extends Schema.Class("effect-browser/Snapshot")({
|
|
|
73
93
|
].join("\n");
|
|
74
94
|
}
|
|
75
95
|
};
|
|
96
|
+
/**
|
|
97
|
+
* An element's state as its markup gives it: `checked` for what can be checked, `expanded`,
|
|
98
|
+
* `selected` and `pressed` where the page says either way, and `level` for headings.
|
|
99
|
+
*
|
|
100
|
+
* @stability stable
|
|
101
|
+
* @category schemas
|
|
102
|
+
* @since 0.3.0
|
|
103
|
+
*/
|
|
104
|
+
const ElementState = Schema.Struct({
|
|
105
|
+
disabled: Schema.Boolean,
|
|
106
|
+
focused: Schema.Boolean,
|
|
107
|
+
checked: Schema.optional(Schema.Boolean),
|
|
108
|
+
expanded: Schema.optional(Schema.Boolean),
|
|
109
|
+
selected: Schema.optional(Schema.Boolean),
|
|
110
|
+
pressed: Schema.optional(Schema.Boolean),
|
|
111
|
+
level: Schema.optional(Schema.Int)
|
|
112
|
+
});
|
|
113
|
+
/**
|
|
114
|
+
* An element `find` found: a ref for the actions, what it is, where it is and its state.
|
|
115
|
+
*
|
|
116
|
+
* @stability stable
|
|
117
|
+
* @category schemas
|
|
118
|
+
* @since 0.3.0
|
|
119
|
+
*/
|
|
120
|
+
var Found = class extends Schema.Class("effect-browser/Snapshot/Found")({
|
|
121
|
+
ref: Schema.String,
|
|
122
|
+
subject: Subject,
|
|
123
|
+
/** Its box, rounded. Reading the document, it may be out of view. */
|
|
124
|
+
box: Box,
|
|
125
|
+
inViewport: Schema.Boolean,
|
|
126
|
+
state: ElementState
|
|
127
|
+
}) {};
|
|
128
|
+
/**
|
|
129
|
+
* The page's outline: one line per control, heading or text block, with a ref for each control,
|
|
130
|
+
* in one call to the page.
|
|
131
|
+
*
|
|
132
|
+
* @stability stable
|
|
133
|
+
* @category constructors
|
|
134
|
+
* @since 0.3.0
|
|
135
|
+
*/
|
|
136
|
+
const read = Function.dual((args) => isPage(args[0]), (page, options) => functionsOf(page).snapshot(options));
|
|
137
|
+
/**
|
|
138
|
+
* The elements that match a query, in tree order, with refs the actions take, in one call to the
|
|
139
|
+
* page. All that match are returned, so a caller tells them apart by their context; none is an
|
|
140
|
+
* empty result, not a failure.
|
|
141
|
+
*
|
|
142
|
+
* @stability stable
|
|
143
|
+
* @category combinators
|
|
144
|
+
* @since 0.3.0
|
|
145
|
+
*/
|
|
146
|
+
const find = Function.dual((args) => isPage(args[0]), (page, query) => functionsOf(page).find(query));
|
|
147
|
+
/**
|
|
148
|
+
* Wait, in one call to the page, until what `query` matches is as `want` says or `timeout` passes.
|
|
149
|
+
* Replaced documents share one deadline. Unmet is `met: false`; an empty mark means no stable
|
|
150
|
+
* document could be sampled.
|
|
151
|
+
*
|
|
152
|
+
* @stability stable
|
|
153
|
+
* @category combinators
|
|
154
|
+
* @since 0.3.0
|
|
155
|
+
*/
|
|
156
|
+
const until = Function.dual(4, (page, query, want, timeout) => functionsOf(page).until(query, want, millisOf(timeout)));
|
|
76
157
|
//#endregion
|
|
77
|
-
export { Control, Snapshot, Snapshot_exports as t };
|
|
158
|
+
export { Control, ElementState, Found, Snapshot, find, read, Snapshot_exports as t, until };
|
|
78
159
|
|
|
79
160
|
//# sourceMappingURL=Snapshot.mjs.map
|
package/dist/Snapshot.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snapshot.mjs","names":[],"sources":["../src/Snapshot.ts"],"sourcesContent":["/**\n * A compact, model-readable outline of what a page shows.\n *\n * Each control gets a ref such as `e12`. A ref stays valid while its element is on the page, and\n * refs are never reused within a page, so a ref from an old snapshot fails as stale rather than\n * naming a different element.\n *\n * @since 0.3.0\n */\nimport { Schema } from \"effect\";\n\n/** A control the outline shows, as a value: its ref, what it is and what it holds. */\nexport class Control extends Schema.Class<Control>(\"effect-browser/Control\")({\n ref: Schema.String,\n /** Its role, such as `button` or `textbox`, or `clickable` for an element without one. */\n kind: Schema.String,\n /** Its accessible name. */\n name: Schema.String,\n /** What it holds: a field's text, `••••` for a secret one, or a select's chosen labels. */\n value: Schema.String,\n /** A select's option labels, at most 64. */\n options: Schema.optional(Schema.Array(Schema.String)),\n /** How many options a select has, when it has options. */\n optionCount: Schema.optional(Schema.Int),\n disabled: Schema.optional(Schema.Boolean),\n /** Whether it is checked, for what can be checked. */\n checked: Schema.optional(Schema.Boolean),\n /** True for a field that takes typed text. */\n editable: Schema.optional(Schema.Boolean),\n}) {}\n\nexport class Snapshot extends Schema.Class<Snapshot>(\"effect-browser/Snapshot\")({\n url: Schema.String,\n title: Schema.String,\n /** One line per control, heading or text block, indented by landmark. */\n text: Schema.String,\n /** True when `text` was cut at `maxChars`. */\n truncated: Schema.Boolean,\n /**\n * Parts of the page left out because they lie above or below the viewport, each an element out\n * of view with all it holds (viewport snapshots only).\n */\n above: Schema.Finite,\n below: Schema.Finite,\n viewport: Schema.Struct({ width: Schema.Finite, height: Schema.Finite }),\n scroll: Schema.Struct({ y: Schema.Finite, height: Schema.Finite }),\n /** The controls the outline shows, in its order. */\n controls: Schema.Array(Control),\n}) {\n /** The snapshot as one block of text for a model: header, outline and what was left out. */\n get rendered(): string {\n const position =\n this.scroll.height > this.viewport.height\n ? `, scrolled to ${this.scroll.y} of ${this.scroll.height - this.viewport.height}px`\n : \"\";\n\n const omitted: Array<string> = [];\n\n if (this.above > 0) omitted.push(`${this.above} parts above`);\n if (this.below > 0) omitted.push(`${this.below} parts below`);\n\n const footer = [\n ...(omitted.length > 0 ? [`(${omitted.join(\", \")} the viewport)`] : []),\n ...(this.truncated ? [\"(cut short: narrow it with query)\"] : []),\n ];\n\n return [\n `Page: ${this.title === \"\" ? \"(untitled)\" : this.title}`,\n `URL: ${this.url}`,\n `Viewport: ${this.viewport.width}x${this.viewport.height}${position}`,\n this.text === \"\" ? \"(nothing readable in view)\" : this.text,\n ...footer,\n ].join(\"\\n\");\n }\n}\n\nexport interface SnapshotOptions {\n /** Read the whole page instead of the viewport. Defaults to false. */\n readonly full?: boolean | undefined;\n /** Keep only lines containing this text (case-insensitive). */\n readonly query?: string | undefined;\n /**\n * Read only inside the elements this CSS selector matches, such as `form` or `#results`. A\n * selector that matches nothing reads nothing; one that is not CSS is an `InvalidRequest`.\n */\n readonly within?: string | undefined;\n /** Bound on the outline's length. Defaults to 12,000 characters. */\n readonly maxChars?: number | undefined;\n /**\n * Give every control's box, as `WxH at (x,y)` in viewport CSS pixels, as a canvas's or a frame's\n * always has. Defaults to false.\n */\n readonly boxes?: boolean | undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,IAAa,UAAb,cAA6B,OAAO,MAAe,wBAAwB,CAAC,CAAC;CAC3E,KAAK,OAAO;;CAEZ,MAAM,OAAO;;CAEb,MAAM,OAAO;;CAEb,OAAO,OAAO;;CAEd,SAAS,OAAO,SAAS,OAAO,MAAM,OAAO,MAAM,CAAC;;CAEpD,aAAa,OAAO,SAAS,OAAO,GAAG;CACvC,UAAU,OAAO,SAAS,OAAO,OAAO;;CAExC,SAAS,OAAO,SAAS,OAAO,OAAO;;CAEvC,UAAU,OAAO,SAAS,OAAO,OAAO;AAC1C,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,WAAb,cAA8B,OAAO,MAAgB,yBAAyB,CAAC,CAAC;CAC9E,KAAK,OAAO;CACZ,OAAO,OAAO;;CAEd,MAAM,OAAO;;CAEb,WAAW,OAAO;;;;;CAKlB,OAAO,OAAO;CACd,OAAO,OAAO;CACd,UAAU,OAAO,OAAO;EAAE,OAAO,OAAO;EAAQ,QAAQ,OAAO;CAAO,CAAC;CACvE,QAAQ,OAAO,OAAO;EAAE,GAAG,OAAO;EAAQ,QAAQ,OAAO;CAAO,CAAC;;CAEjE,UAAU,OAAO,MAAM,OAAO;AAChC,CAAC,CAAC,CAAC;;CAED,IAAI,WAAmB;EACrB,MAAM,WACJ,KAAK,OAAO,SAAS,KAAK,SAAS,SAC/B,iBAAiB,KAAK,OAAO,EAAE,MAAM,KAAK,OAAO,SAAS,KAAK,SAAS,OAAO,MAC/E;EAEN,MAAM,UAAyB,CAAC;EAEhC,IAAI,KAAK,QAAQ,GAAG,QAAQ,KAAK,GAAG,KAAK,MAAM,aAAa;EAC5D,IAAI,KAAK,QAAQ,GAAG,QAAQ,KAAK,GAAG,KAAK,MAAM,aAAa;EAE5D,MAAM,SAAS,CACb,GAAI,QAAQ,SAAS,IAAI,CAAC,IAAI,QAAQ,KAAK,IAAI,EAAE,eAAe,IAAI,CAAC,GACrE,GAAI,KAAK,YAAY,CAAC,mCAAmC,IAAI,CAAC,CAChE;EAEA,OAAO;GACL,SAAS,KAAK,UAAU,KAAK,eAAe,KAAK;GACjD,QAAQ,KAAK;GACb,aAAa,KAAK,SAAS,MAAM,GAAG,KAAK,SAAS,SAAS;GAC3D,KAAK,SAAS,KAAK,+BAA+B,KAAK;GACvD,GAAG;EACL,CAAC,CAAC,KAAK,IAAI;CACb;AACF"}
|
|
1
|
+
{"version":3,"file":"Snapshot.mjs","names":[],"sources":["../src/Snapshot.ts"],"sourcesContent":["/**\n * A compact, model-readable outline of what a page shows.\n *\n * Each control gets a ref such as `e12`. A ref stays valid while its element is on the page, and\n * refs are never reused within a page, so a ref from an old snapshot fails as stale rather than\n * naming a different element.\n *\n * @stability stable\n * @since 0.3.0\n */\nimport { type Duration, type Effect, Function, Schema } from \"effect\";\n\nimport type { BrowserError } from \"./BrowserError.ts\";\nimport { Box, Subject } from \"./BrowserEvent.ts\";\nimport { millisOf } from \"./internal/clock.ts\";\nimport type { Point } from \"./internal/geometry.ts\";\nimport { functionsOf, isPage } from \"./internal/page/functions.ts\";\nimport type { Page } from \"./Page.ts\";\n\n/**\n * A control the outline shows, as a value: its ref, what it is and what it holds.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class Control extends Schema.Class<Control>(\"effect-browser/Snapshot/Control\")({\n ref: Schema.String,\n /** Its role, such as `button` or `textbox`, or `clickable` for an element without one. */\n kind: Schema.String,\n /** Its accessible name. */\n name: Schema.String,\n /** What it holds: a field's text, `••••` for a secret one, or a select's chosen labels. */\n value: Schema.String,\n /** A select's option labels, at most 64. */\n options: Schema.optional(Schema.Array(Schema.String)),\n /** How many options a select has, when it has options. */\n optionCount: Schema.optional(Schema.Int),\n disabled: Schema.optional(Schema.Boolean),\n /** Whether it is checked, for what can be checked. */\n checked: Schema.optional(Schema.Boolean),\n /** True for a field that takes typed text. */\n editable: Schema.optional(Schema.Boolean),\n}) {}\n\n/**\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class Snapshot extends Schema.Class<Snapshot>(\"effect-browser/Snapshot\")({\n url: Schema.String,\n title: Schema.String,\n /** One line per control, heading or text block, indented by landmark. */\n text: Schema.String,\n /** True when `text` was cut at `maxChars`. */\n truncated: Schema.Boolean,\n /**\n * Parts of the page left out because they lie above or below the viewport, each an element out\n * of view with all it holds (viewport snapshots only).\n */\n above: Schema.Finite,\n below: Schema.Finite,\n viewport: Schema.Struct({ width: Schema.Finite, height: Schema.Finite }),\n scroll: Schema.Struct({ y: Schema.Finite, height: Schema.Finite }),\n /** The controls the outline shows, in its order. */\n controls: Schema.Array(Control),\n}) {\n /** The snapshot as one block of text for a model: header, outline and what was left out. */\n get rendered(): string {\n const position =\n this.scroll.height > this.viewport.height\n ? `, scrolled to ${this.scroll.y} of ${this.scroll.height - this.viewport.height}px`\n : \"\";\n\n const omitted: Array<string> = [];\n\n if (this.above > 0) omitted.push(`${this.above} parts above`);\n if (this.below > 0) omitted.push(`${this.below} parts below`);\n\n const footer = [\n ...(omitted.length > 0 ? [`(${omitted.join(\", \")} the viewport)`] : []),\n ...(this.truncated ? [\"(cut short: narrow it with query)\"] : []),\n ];\n\n return [\n `Page: ${this.title === \"\" ? \"(untitled)\" : this.title}`,\n `URL: ${this.url}`,\n `Viewport: ${this.viewport.width}x${this.viewport.height}${position}`,\n this.text === \"\" ? \"(nothing readable in view)\" : this.text,\n ...footer,\n ].join(\"\\n\");\n }\n}\n\n/**\n * @stability stable\n * @category options\n * @since 0.3.0\n */\nexport interface SnapshotOptions {\n /** Read the whole page instead of the viewport. Defaults to false. */\n readonly full?: boolean | undefined;\n /** Keep only lines containing this text (case-insensitive). */\n readonly query?: string | undefined;\n /**\n * Read only inside the elements this CSS selector matches, such as `form` or `#results`. A\n * selector that matches nothing reads nothing; one that is not CSS is an `InvalidRequest`.\n */\n readonly within?: string | undefined;\n /** Bound on the outline's length. Defaults to 12,000 characters. */\n readonly maxChars?: number | undefined;\n /**\n * Give every control's box, as `WxH at (x,y)` in viewport CSS pixels, as a canvas's or a frame's\n * always has. Defaults to false.\n */\n readonly boxes?: boolean | undefined;\n}\n\n/**\n * What `find` looks for. Every rule given must hold; with none, it finds every element in scope\n * that has a role or is a control.\n *\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport interface FindQuery {\n /** Narrow matching to this CSS selector. Invalid CSS fails InvalidRequest. */\n readonly selector?: string | undefined;\n /** Require a visible match, optionally enabled. */\n readonly state?: \"visible\" | \"enabled\" | undefined;\n /** An ARIA role, such as `\"button\"` or `\"heading\"`, ignoring case. */\n readonly role?: string | undefined;\n /**\n * The accessible name: a string that reads the same once spaces are collapsed and case folded,\n * or a pattern found in it.\n */\n readonly name?: string | RegExp | undefined;\n /**\n * Text it shows, ignoring case and spacing, or a pattern. Text inside a control or a heading is\n * that control's or heading's, and only the smallest element showing it matches, not every\n * element around it.\n */\n readonly text?: string | RegExp | undefined;\n /** Whole words in its context (row, column, label or heading), ignoring case and spacing. */\n readonly near?: string | undefined;\n /** Only what a point action at this viewport point would reach: the control there, or else what is painted there. */\n readonly at?: Point | undefined;\n /** The viewport (the default), or the whole document. */\n readonly scope?: \"viewport\" | \"document\" | undefined;\n}\n\n/**\n * An element's state as its markup gives it: `checked` for what can be checked, `expanded`,\n * `selected` and `pressed` where the page says either way, and `level` for headings.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport const ElementState = Schema.Struct({\n disabled: Schema.Boolean,\n focused: Schema.Boolean,\n checked: Schema.optional(Schema.Boolean),\n expanded: Schema.optional(Schema.Boolean),\n selected: Schema.optional(Schema.Boolean),\n pressed: Schema.optional(Schema.Boolean),\n level: Schema.optional(Schema.Int),\n});\n\n/**\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport type ElementState = typeof ElementState.Type;\n\n/**\n * An element `find` found: a ref for the actions, what it is, where it is and its state.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class Found extends Schema.Class<Found>(\"effect-browser/Snapshot/Found\")({\n ref: Schema.String,\n subject: Subject,\n /** Its box, rounded. Reading the document, it may be out of view. */\n box: Box,\n inViewport: Schema.Boolean,\n state: ElementState,\n}) {}\n\n/**\n * The page's outline: one line per control, heading or text block, with a ref for each control,\n * in one call to the page.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const read: {\n (options?: SnapshotOptions): (page: Page) => Effect.Effect<Snapshot, BrowserError>;\n (page: Page, options?: SnapshotOptions): Effect.Effect<Snapshot, BrowserError>;\n} = Function.dual(\n (args) => isPage(args[0]),\n (page: Page, options?: SnapshotOptions) => functionsOf(page).snapshot(options),\n);\n\n/**\n * The elements that match a query, in tree order, with refs the actions take, in one call to the\n * page. All that match are returned, so a caller tells them apart by their context; none is an\n * empty result, not a failure.\n *\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\nexport const find: {\n (query?: FindQuery): (page: Page) => Effect.Effect<ReadonlyArray<Found>, BrowserError>;\n (page: Page, query?: FindQuery): Effect.Effect<ReadonlyArray<Found>, BrowserError>;\n} = Function.dual(\n (args) => isPage(args[0]),\n (page: Page, query?: FindQuery) => functionsOf(page).find(query),\n);\n\n/**\n * What a wait requires of the query's matches.\n *\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport type UntilWant = \"some\" | \"none\" | { readonly other: string };\n\n/**\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport interface UntilResult {\n readonly met: boolean;\n readonly mark: string;\n}\n\n/**\n * Wait, in one call to the page, until what `query` matches is as `want` says or `timeout` passes.\n * Replaced documents share one deadline. Unmet is `met: false`; an empty mark means no stable\n * document could be sampled.\n *\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\nexport const until: {\n (\n query: FindQuery,\n want: UntilWant,\n timeout: Duration.Input,\n ): (page: Page) => Effect.Effect<UntilResult, BrowserError>;\n (\n page: Page,\n query: FindQuery,\n want: UntilWant,\n timeout: Duration.Input,\n ): Effect.Effect<UntilResult, BrowserError>;\n} = Function.dual(4, (page: Page, query: FindQuery, want: UntilWant, timeout: Duration.Input) =>\n functionsOf(page).until(query, want, millisOf(timeout)),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAa,UAAb,cAA6B,OAAO,MAAe,iCAAiC,CAAC,CAAC;CACpF,KAAK,OAAO;;CAEZ,MAAM,OAAO;;CAEb,MAAM,OAAO;;CAEb,OAAO,OAAO;;CAEd,SAAS,OAAO,SAAS,OAAO,MAAM,OAAO,MAAM,CAAC;;CAEpD,aAAa,OAAO,SAAS,OAAO,GAAG;CACvC,UAAU,OAAO,SAAS,OAAO,OAAO;;CAExC,SAAS,OAAO,SAAS,OAAO,OAAO;;CAEvC,UAAU,OAAO,SAAS,OAAO,OAAO;AAC1C,CAAC,CAAC,CAAC,CAAC;;;;;;AAOJ,IAAa,WAAb,cAA8B,OAAO,MAAgB,yBAAyB,CAAC,CAAC;CAC9E,KAAK,OAAO;CACZ,OAAO,OAAO;;CAEd,MAAM,OAAO;;CAEb,WAAW,OAAO;;;;;CAKlB,OAAO,OAAO;CACd,OAAO,OAAO;CACd,UAAU,OAAO,OAAO;EAAE,OAAO,OAAO;EAAQ,QAAQ,OAAO;CAAO,CAAC;CACvE,QAAQ,OAAO,OAAO;EAAE,GAAG,OAAO;EAAQ,QAAQ,OAAO;CAAO,CAAC;;CAEjE,UAAU,OAAO,MAAM,OAAO;AAChC,CAAC,CAAC,CAAC;;CAED,IAAI,WAAmB;EACrB,MAAM,WACJ,KAAK,OAAO,SAAS,KAAK,SAAS,SAC/B,iBAAiB,KAAK,OAAO,EAAE,MAAM,KAAK,OAAO,SAAS,KAAK,SAAS,OAAO,MAC/E;EAEN,MAAM,UAAyB,CAAC;EAEhC,IAAI,KAAK,QAAQ,GAAG,QAAQ,KAAK,GAAG,KAAK,MAAM,aAAa;EAC5D,IAAI,KAAK,QAAQ,GAAG,QAAQ,KAAK,GAAG,KAAK,MAAM,aAAa;EAE5D,MAAM,SAAS,CACb,GAAI,QAAQ,SAAS,IAAI,CAAC,IAAI,QAAQ,KAAK,IAAI,EAAE,eAAe,IAAI,CAAC,GACrE,GAAI,KAAK,YAAY,CAAC,mCAAmC,IAAI,CAAC,CAChE;EAEA,OAAO;GACL,SAAS,KAAK,UAAU,KAAK,eAAe,KAAK;GACjD,QAAQ,KAAK;GACb,aAAa,KAAK,SAAS,MAAM,GAAG,KAAK,SAAS,SAAS;GAC3D,KAAK,SAAS,KAAK,+BAA+B,KAAK;GACvD,GAAG;EACL,CAAC,CAAC,KAAK,IAAI;CACb;AACF;;;;;;;;;AAoEA,MAAa,eAAe,OAAO,OAAO;CACxC,UAAU,OAAO;CACjB,SAAS,OAAO;CAChB,SAAS,OAAO,SAAS,OAAO,OAAO;CACvC,UAAU,OAAO,SAAS,OAAO,OAAO;CACxC,UAAU,OAAO,SAAS,OAAO,OAAO;CACxC,SAAS,OAAO,SAAS,OAAO,OAAO;CACvC,OAAO,OAAO,SAAS,OAAO,GAAG;AACnC,CAAC;;;;;;;;AAgBD,IAAa,QAAb,cAA2B,OAAO,MAAa,+BAA+B,CAAC,CAAC;CAC9E,KAAK,OAAO;CACZ,SAAS;;CAET,KAAK;CACL,YAAY,OAAO;CACnB,OAAO;AACT,CAAC,CAAC,CAAC,CAAC;;;;;;;;;AAUJ,MAAa,OAGT,SAAS,MACV,SAAS,OAAO,KAAK,EAAE,IACvB,MAAY,YAA8B,YAAY,IAAI,CAAC,CAAC,SAAS,OAAO,CAC/E;;;;;;;;;;AAWA,MAAa,OAGT,SAAS,MACV,SAAS,OAAO,KAAK,EAAE,IACvB,MAAY,UAAsB,YAAY,IAAI,CAAC,CAAC,KAAK,KAAK,CACjE;;;;;;;;;;AA8BA,MAAa,QAYT,SAAS,KAAK,IAAI,MAAY,OAAkB,MAAiB,YACnE,YAAY,IAAI,CAAC,CAAC,MAAM,OAAO,MAAM,SAAS,OAAO,CAAC,CACxD"}
|
package/dist/Text.d.mts
ADDED
package/dist/Text.mjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { t as __exportAll } from "./internal/rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { n as functionsOf, r as isPage } from "./internal/functions-jBOs6GKv.mjs";
|
|
3
|
+
import { Function, Schema } from "effect";
|
|
4
|
+
//#region src/Text.ts
|
|
5
|
+
/**
|
|
6
|
+
* What a page shows as text: a line per block, with table cells apart by tabs, read from the
|
|
7
|
+
* viewport or from one element whole.
|
|
8
|
+
*
|
|
9
|
+
* @stability stable
|
|
10
|
+
* @since 0.3.0
|
|
11
|
+
*/
|
|
12
|
+
var Text_exports = /* @__PURE__ */ __exportAll({
|
|
13
|
+
Text: () => Text,
|
|
14
|
+
read: () => read
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* What a page showed as text: a line per block, with table cells apart by tabs.
|
|
18
|
+
*
|
|
19
|
+
* @stability stable
|
|
20
|
+
* @category schemas
|
|
21
|
+
* @since 0.3.0
|
|
22
|
+
*/
|
|
23
|
+
var Text = class extends Schema.Class("effect-browser/Text")({
|
|
24
|
+
url: Schema.String,
|
|
25
|
+
title: Schema.String,
|
|
26
|
+
text: Schema.String,
|
|
27
|
+
/** True when `text` was cut at `maxChars`. */
|
|
28
|
+
truncated: Schema.Boolean,
|
|
29
|
+
/** Host monotonic milliseconds from the browser's captured Effect Clock. */
|
|
30
|
+
at: Schema.Finite
|
|
31
|
+
}) {};
|
|
32
|
+
/**
|
|
33
|
+
* The text the viewport shows, or one element whole, in one call to the page. Field values read
|
|
34
|
+
* `••••` unless `unmask`, and a secret field's always do, as does one that was secret when the
|
|
35
|
+
* library saw it.
|
|
36
|
+
*
|
|
37
|
+
* @stability stable
|
|
38
|
+
* @category constructors
|
|
39
|
+
* @since 0.3.0
|
|
40
|
+
*/
|
|
41
|
+
const read = Function.dual((args) => isPage(args[0]), (page, options) => functionsOf(page).text(options));
|
|
42
|
+
//#endregion
|
|
43
|
+
export { Text, read, Text_exports as t };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=Text.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.mjs","names":[],"sources":["../src/Text.ts"],"sourcesContent":["/**\n * What a page shows as text: a line per block, with table cells apart by tabs, read from the\n * viewport or from one element whole.\n *\n * @stability stable\n * @since 0.3.0\n */\nimport { type Effect, Function, Schema } from \"effect\";\n\nimport type { BrowserError } from \"./BrowserError.ts\";\nimport { functionsOf, isPage } from \"./internal/page/functions.ts\";\nimport type { Page } from \"./Page.ts\";\n\n/**\n * @stability stable\n * @category options\n * @since 0.3.0\n */\nexport interface TextOptions {\n /** `\"viewport\"` (the default) reads what the viewport shows; a ref reads that element whole. */\n readonly scope?: string | undefined;\n /** Bound on the text's length, cut at a line. Defaults to 12,000 characters. */\n readonly maxChars?: number | undefined;\n /** Show what fields hold; a secret field still reads `••••`. Defaults to false. */\n readonly unmask?: boolean | undefined;\n}\n\n/**\n * What a page showed as text: a line per block, with table cells apart by tabs.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class Text extends Schema.Class<Text>(\"effect-browser/Text\")({\n url: Schema.String,\n title: Schema.String,\n text: Schema.String,\n /** True when `text` was cut at `maxChars`. */\n truncated: Schema.Boolean,\n /** Host monotonic milliseconds from the browser's captured Effect Clock. */\n at: Schema.Finite,\n}) {}\n\n/**\n * The text the viewport shows, or one element whole, in one call to the page. Field values read\n * `••••` unless `unmask`, and a secret field's always do, as does one that was secret when the\n * library saw it.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const read: {\n (options?: TextOptions): (page: Page) => Effect.Effect<Text, BrowserError>;\n (page: Page, options?: TextOptions): Effect.Effect<Text, BrowserError>;\n} = Function.dual(\n (args) => isPage(args[0]),\n (page: Page, options?: TextOptions) => functionsOf(page).text(options),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAa,OAAb,cAA0B,OAAO,MAAY,qBAAqB,CAAC,CAAC;CAClE,KAAK,OAAO;CACZ,OAAO,OAAO;CACd,MAAM,OAAO;;CAEb,WAAW,OAAO;;CAElB,IAAI,OAAO;AACb,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;AAWJ,MAAa,OAGT,SAAS,MACV,SAAS,OAAO,KAAK,EAAE,IACvB,MAAY,YAA0B,YAAY,IAAI,CAAC,CAAC,KAAK,OAAO,CACvE"}
|
package/dist/Window.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { Window };
|
|
1
|
+
import { S as WindowOptions, w as read, x as Window } from "./internal/Page-BfGxn7oN.mjs";
|
|
2
|
+
export { Window, WindowOptions, read };
|
package/dist/Window.mjs
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
1
|
+
import { t as __exportAll } from "./internal/rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { BrowserEvent } from "./BrowserEvent.mjs";
|
|
3
3
|
import { BrowserError } from "./BrowserError.mjs";
|
|
4
|
+
import { n as functionsOf } from "./internal/functions-jBOs6GKv.mjs";
|
|
4
5
|
import { Frame } from "./Frame.mjs";
|
|
5
6
|
import { Changes } from "./Change.mjs";
|
|
6
|
-
import { Schema } from "effect";
|
|
7
|
+
import { Function, Schema } from "effect";
|
|
7
8
|
//#region src/Window.ts
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* A bounded window of a page's events, visible changes and frames on the owning clock.
|
|
11
|
+
*
|
|
12
|
+
* @stability stable
|
|
13
|
+
* @since 0.3.0
|
|
14
|
+
*/
|
|
15
|
+
var Window_exports = /* @__PURE__ */ __exportAll({
|
|
16
|
+
Window: () => Window,
|
|
17
|
+
read: () => read
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* A page's events, changes and frames over one window of its browser's host clock.
|
|
21
|
+
*
|
|
22
|
+
* @stability stable
|
|
23
|
+
* @category schemas
|
|
24
|
+
* @since 0.3.0
|
|
25
|
+
*/
|
|
11
26
|
var Window = class extends Schema.Class("effect-browser/Window")({
|
|
12
27
|
page: Schema.String,
|
|
13
28
|
/** Where the window starts, in host monotonic milliseconds on the owning browser’s clock. */
|
|
@@ -29,7 +44,17 @@ var Window = class extends Schema.Class("effect-browser/Window")({
|
|
|
29
44
|
*/
|
|
30
45
|
missing: Schema.Array(BrowserError)
|
|
31
46
|
}) {};
|
|
47
|
+
/**
|
|
48
|
+
* The page's events, changes and frames over a window: the frames and events it keeps, at no
|
|
49
|
+
* call, and its changes, in one call, the first starting its record as `Change.read` does. A part
|
|
50
|
+
* that cannot be read is missing, with why; the window fails only for bounds that are not finite.
|
|
51
|
+
*
|
|
52
|
+
* @stability stable
|
|
53
|
+
* @category constructors
|
|
54
|
+
* @since 0.3.0
|
|
55
|
+
*/
|
|
56
|
+
const read = Function.dual(2, (page, options) => functionsOf(page).window(options));
|
|
32
57
|
//#endregion
|
|
33
|
-
export { Window, Window_exports as t };
|
|
58
|
+
export { Window, read, Window_exports as t };
|
|
34
59
|
|
|
35
60
|
//# sourceMappingURL=Window.mjs.map
|
package/dist/Window.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Window.mjs","names":[],"sources":["../src/Window.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"Window.mjs","names":[],"sources":["../src/Window.ts"],"sourcesContent":["/**\n * A bounded window of a page's events, visible changes and frames on the owning clock.\n *\n * @stability stable\n * @since 0.3.0\n */\nimport { type Duration, type Effect, Function, Schema } from \"effect\";\n\nimport { BrowserError } from \"./BrowserError.ts\";\nimport { BrowserEvent } from \"./BrowserEvent.ts\";\nimport { Changes } from \"./Change.ts\";\nimport { Frame } from \"./Frame.ts\";\nimport { functionsOf } from \"./internal/page/functions.ts\";\nimport type { Page } from \"./Page.ts\";\n\n/**\n * A page's events, changes and frames over one window of its browser's host clock.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class Window extends Schema.Class<Window>(\"effect-browser/Window\")({\n page: Schema.String,\n /** Where the window starts, in host monotonic milliseconds on the owning browser’s clock. */\n since: Schema.Finite,\n /** Where it ends, never after it was taken. */\n until: Schema.Finite,\n /** The page's events after `since`, up to `until`, oldest first, without the input presentation track. */\n events: Schema.Array(BrowserEvent),\n /**\n * What visibly changed after `since`, up to `until`; absent where `missing` says why. A page's\n * first window starts its record, so the record sees none of it.\n */\n changes: Schema.optional(Changes),\n /** Screencast frames painted from `since` to `until`, oldest first, as far back as kept. */\n frames: Schema.Array(Frame),\n /**\n * Why each part that could not be read is missing: the read of its changes, by whatever\n * operation failed there, or a moment's picture (`frame`) or outline (`snapshot`).\n */\n missing: Schema.Array(BrowserError),\n}) {}\n\n/**\n * The window `read` reads, and whether to show what fields hold.\n *\n * @stability stable\n * @category options\n * @since 0.3.0\n */\nexport interface WindowOptions {\n /**\n * Where the window starts: a previous window, to continue exactly where it ended; a frame, at its\n * paint; host monotonic milliseconds; or a `Duration` back from `until`. A start after `until`\n * leaves the window empty there.\n */\n readonly since: Window | Frame | Duration.Duration | number;\n /**\n * Where it ends: a frame, at its paint, such as one a delayed consumer airs now; or host\n * monotonic milliseconds. Defaults to now, and is never later.\n */\n readonly until?: Frame | number | undefined;\n /** Show what fields hold in its changes; a secret field still reads `••••`. Defaults to false. */\n readonly unmask?: boolean | undefined;\n}\n\n/**\n * The page's events, changes and frames over a window: the frames and events it keeps, at no\n * call, and its changes, in one call, the first starting its record as `Change.read` does. A part\n * that cannot be read is missing, with why; the window fails only for bounds that are not finite.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const read: {\n (options: WindowOptions): (page: Page) => Effect.Effect<Window, BrowserError>;\n (page: Page, options: WindowOptions): Effect.Effect<Window, BrowserError>;\n} = Function.dual(2, (page: Page, options: WindowOptions) => functionsOf(page).window(options));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,SAAb,cAA4B,OAAO,MAAc,uBAAuB,CAAC,CAAC;CACxE,MAAM,OAAO;;CAEb,OAAO,OAAO;;CAEd,OAAO,OAAO;;CAEd,QAAQ,OAAO,MAAM,YAAY;;;;;CAKjC,SAAS,OAAO,SAAS,OAAO;;CAEhC,QAAQ,OAAO,MAAM,KAAK;;;;;CAK1B,SAAS,OAAO,MAAM,YAAY;AACpC,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;AAkCJ,MAAa,OAGT,SAAS,KAAK,IAAI,MAAY,YAA2B,YAAY,IAAI,CAAC,CAAC,OAAO,OAAO,CAAC"}
|