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/Layout.mjs
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { t as __exportAll } from "./internal/rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { n as Point } from "./internal/geometry-Lxyflb9J.mjs";
|
|
3
|
+
import { Box, Subject } from "./BrowserEvent.mjs";
|
|
4
|
+
import { n as functionsOf } from "./internal/functions-jBOs6GKv.mjs";
|
|
5
|
+
import { Effect, Exit, Function, Schema } from "effect";
|
|
6
|
+
//#region src/Layout.ts
|
|
7
|
+
/**
|
|
8
|
+
* Where things are on a page, as data: a box for each thing a caller picks, in the viewport and in
|
|
9
|
+
* the document, unrounded, with the boxes of words inside it, and the viewport, scroll and scale
|
|
10
|
+
* read with them in one call. A rehearsal measures things that exist only after an interaction,
|
|
11
|
+
* and puts the page back.
|
|
12
|
+
*
|
|
13
|
+
* @stability stable
|
|
14
|
+
* @since 0.3.0
|
|
15
|
+
*/
|
|
16
|
+
var Layout_exports = /* @__PURE__ */ __exportAll({
|
|
17
|
+
Layout: () => Layout,
|
|
18
|
+
Place: () => Place,
|
|
19
|
+
Word: () => Word,
|
|
20
|
+
measure: () => measure,
|
|
21
|
+
place: () => place,
|
|
22
|
+
rehearse: () => rehearse
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* A match of a pick's `words`, by its box in the viewport and in the document.
|
|
26
|
+
*
|
|
27
|
+
* @stability stable
|
|
28
|
+
* @category schemas
|
|
29
|
+
* @since 0.3.0
|
|
30
|
+
*/
|
|
31
|
+
var Word = class extends Schema.Class("effect-browser/Layout/Word")({
|
|
32
|
+
text: Schema.String,
|
|
33
|
+
box: Box,
|
|
34
|
+
page: Box
|
|
35
|
+
}) {};
|
|
36
|
+
/**
|
|
37
|
+
* What one pick found.
|
|
38
|
+
*
|
|
39
|
+
* @stability stable
|
|
40
|
+
* @category schemas
|
|
41
|
+
* @since 0.3.0
|
|
42
|
+
*/
|
|
43
|
+
var Place = class extends Schema.Class("effect-browser/Layout/Place")({
|
|
44
|
+
/** The pick's own name. */
|
|
45
|
+
id: Schema.String,
|
|
46
|
+
ref: Schema.String,
|
|
47
|
+
subject: Subject,
|
|
48
|
+
/** Its box in viewport CSS pixels, unrounded, as an `at` point or a frame's pixels place it. */
|
|
49
|
+
box: Box,
|
|
50
|
+
/** The same box in document CSS pixels: `box` moved by the scroll it was read at. */
|
|
51
|
+
page: Box,
|
|
52
|
+
/** It keeps its place in the viewport as the page scrolls, so `page` holds only at this scroll. */
|
|
53
|
+
fixed: Schema.Boolean,
|
|
54
|
+
/** The matches of the pick's `words`, when it gave them, in text order. */
|
|
55
|
+
words: Schema.optional(Schema.Array(Word))
|
|
56
|
+
}) {};
|
|
57
|
+
/**
|
|
58
|
+
* A page's picked places, and the viewport, scroll and scale they were read at.
|
|
59
|
+
*
|
|
60
|
+
* @stability stable
|
|
61
|
+
* @category schemas
|
|
62
|
+
* @since 0.3.0
|
|
63
|
+
*/
|
|
64
|
+
var Layout = class extends Schema.Class("effect-browser/Layout")({
|
|
65
|
+
page: Schema.String,
|
|
66
|
+
/** The tracking connection that owns the document counter. */
|
|
67
|
+
connection: Schema.String,
|
|
68
|
+
/** The document it read, as `Navigated` counts them. */
|
|
69
|
+
document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
70
|
+
url: Schema.String,
|
|
71
|
+
/** Host monotonic milliseconds, when it was read. */
|
|
72
|
+
at: Schema.Finite,
|
|
73
|
+
/** The viewport's size in CSS pixels. */
|
|
74
|
+
viewport: Schema.Struct({
|
|
75
|
+
width: Schema.Finite,
|
|
76
|
+
height: Schema.Finite
|
|
77
|
+
}),
|
|
78
|
+
/** How far the document was scrolled, in CSS pixels. */
|
|
79
|
+
scroll: Point,
|
|
80
|
+
/** Device pixels to a CSS pixel: a `scale: "device"` picture's pixels per CSS pixel. */
|
|
81
|
+
scale: Schema.Finite,
|
|
82
|
+
/** One for each pick that found something, in the order the picks were given. */
|
|
83
|
+
places: Schema.Array(Place),
|
|
84
|
+
/** The picks that found nothing. */
|
|
85
|
+
missing: Schema.Array(Schema.String)
|
|
86
|
+
}) {};
|
|
87
|
+
/**
|
|
88
|
+
* Where each pick is, in one call to the page: its box unrounded, in the viewport and in the
|
|
89
|
+
* document, the boxes of words in it, and the viewport, scroll and scale they were read at. A
|
|
90
|
+
* pick that finds nothing is listed as missing, not a failure.
|
|
91
|
+
*
|
|
92
|
+
* @stability stable
|
|
93
|
+
* @category constructors
|
|
94
|
+
* @since 0.3.0
|
|
95
|
+
*/
|
|
96
|
+
const measure = Function.dual(2, (page, picks) => functionsOf(page).layout(picks));
|
|
97
|
+
/**
|
|
98
|
+
* The place a pick named, if it found one.
|
|
99
|
+
*
|
|
100
|
+
* @stability stable
|
|
101
|
+
* @category combinators
|
|
102
|
+
* @since 0.3.0
|
|
103
|
+
*/
|
|
104
|
+
const place = Function.dual(2, (layout, id) => layout.places.find((each) => each.id === id));
|
|
105
|
+
const rehearseOn = (page, rehearsal) => Effect.uninterruptibleMask((restore) => Effect.gen(function* () {
|
|
106
|
+
const measured = yield* Effect.exit(restore(Effect.forEach(rehearsal.act, page.perform, { discard: true }).pipe(Effect.andThen(page.ready()), Effect.andThen(measure(page, rehearsal.picks)))));
|
|
107
|
+
const undone = yield* Effect.exit(Effect.forEach(rehearsal.undo, page.perform, { discard: true }));
|
|
108
|
+
return yield* Exit.isFailure(measured) || Exit.isSuccess(undone) ? measured : Exit.failCause(undone.cause);
|
|
109
|
+
}));
|
|
110
|
+
/**
|
|
111
|
+
* Measure what exists only after an interaction: perform `act`, wait for the page to be ready,
|
|
112
|
+
* read the layout, then perform `undo`, which runs whether or not acting and reading succeeded,
|
|
113
|
+
* and is not interrupted. A failure to act or read is the rehearsal's; otherwise one to undo is.
|
|
114
|
+
*
|
|
115
|
+
* @stability stable
|
|
116
|
+
* @category constructors
|
|
117
|
+
* @since 0.3.0
|
|
118
|
+
*/
|
|
119
|
+
const rehearse = Function.dual(2, rehearseOn);
|
|
120
|
+
//#endregion
|
|
121
|
+
export { Layout, Place, Word, measure, place, rehearse, Layout_exports as t };
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=Layout.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Layout.mjs","names":[],"sources":["../src/Layout.ts"],"sourcesContent":["/**\n * Where things are on a page, as data: a box for each thing a caller picks, in the viewport and in\n * the document, unrounded, with the boxes of words inside it, and the viewport, scroll and scale\n * read with them in one call. A rehearsal measures things that exist only after an interaction,\n * and puts the page back.\n *\n * @stability stable\n * @since 0.3.0\n */\nimport { Effect, Exit, Function, Schema } from \"effect\";\n\nimport type { Action } from \"./Action.ts\";\nimport type { BrowserError } from \"./BrowserError.ts\";\nimport { Box, Subject } from \"./BrowserEvent.ts\";\nimport { Point } from \"./internal/geometry.ts\";\nimport { functionsOf } from \"./internal/page/functions.ts\";\nimport type { Page } from \"./Page.ts\";\nimport type { FindQuery } from \"./Snapshot.ts\";\n\n/**\n * A match of a pick's `words`, by its box in the viewport and in the document.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class Word extends Schema.Class<Word>(\"effect-browser/Layout/Word\")({\n text: Schema.String,\n box: Box,\n page: Box,\n}) {}\n\n/**\n * What one pick found.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class Place extends Schema.Class<Place>(\"effect-browser/Layout/Place\")({\n /** The pick's own name. */\n id: Schema.String,\n ref: Schema.String,\n subject: Subject,\n /** Its box in viewport CSS pixels, unrounded, as an `at` point or a frame's pixels place it. */\n box: Box,\n /** The same box in document CSS pixels: `box` moved by the scroll it was read at. */\n page: Box,\n /** It keeps its place in the viewport as the page scrolls, so `page` holds only at this scroll. */\n fixed: Schema.Boolean,\n /** The matches of the pick's `words`, when it gave them, in text order. */\n words: Schema.optional(Schema.Array(Word)),\n}) {}\n\n/**\n * A page's picked places, and the viewport, scroll and scale they were read at.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class Layout extends Schema.Class<Layout>(\"effect-browser/Layout\")({\n page: Schema.String,\n /** The tracking connection that owns the document counter. */\n connection: Schema.String,\n /** The document it read, as `Navigated` counts them. */\n document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n url: Schema.String,\n /** Host monotonic milliseconds, when it was read. */\n at: Schema.Finite,\n /** The viewport's size in CSS pixels. */\n viewport: Schema.Struct({ width: Schema.Finite, height: Schema.Finite }),\n /** How far the document was scrolled, in CSS pixels. */\n scroll: Point,\n /** Device pixels to a CSS pixel: a `scale: \"device\"` picture's pixels per CSS pixel. */\n scale: Schema.Finite,\n /** One for each pick that found something, in the order the picks were given. */\n places: Schema.Array(Place),\n /** The picks that found nothing. */\n missing: Schema.Array(Schema.String),\n}) {}\n\n/**\n * A `Snapshot.find` query that names one thing. Its scope defaults to the whole document. Every\n * element it finds is a candidate, and `choose` takes one: the first in tree order (the default),\n * the last, or the smallest or largest by area. With a selector, the candidates are what it\n * selects that shows and meets the other rules, a drawing's elements among them, which\n * `Snapshot.find` leaves out.\n *\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport interface Pick extends FindQuery {\n readonly choose?: \"first\" | \"last\" | \"smallest\" | \"largest\" | undefined;\n /**\n * Words to box inside it: text, found ignoring case, or a pattern; each match gets its own box,\n * across the elements the text is split into. At most 200 for a pick.\n */\n readonly words?: string | RegExp | undefined;\n}\n\n/**\n * Picks by the names their places will carry.\n *\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport type Picks = Readonly<Record<string, Pick>>;\n\n/**\n * Where each pick is, in one call to the page: its box unrounded, in the viewport and in the\n * document, the boxes of words in it, and the viewport, scroll and scale they were read at. A\n * pick that finds nothing is listed as missing, not a failure.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const measure: {\n (picks: Picks): (page: Page) => Effect.Effect<Layout, BrowserError>;\n (page: Page, picks: Picks): Effect.Effect<Layout, BrowserError>;\n} = Function.dual(2, (page: Page, picks: Picks) => functionsOf(page).layout(picks));\n\n/**\n * The place a pick named, if it found one.\n *\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\nexport const place: {\n (id: string): (layout: Layout) => Place | undefined;\n (layout: Layout, id: string): Place | undefined;\n} = Function.dual(2, (layout: Layout, id: string): Place | undefined =>\n layout.places.find((each) => each.id === id),\n);\n\n/**\n * What a rehearsal does, measures, and does to put the page back.\n *\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport interface Rehearsal {\n readonly act: ReadonlyArray<Action>;\n readonly picks: Picks;\n readonly undo: ReadonlyArray<Action>;\n}\n\nconst rehearseOn = (page: Page, rehearsal: Rehearsal): Effect.Effect<Layout, BrowserError> =>\n Effect.uninterruptibleMask((restore) =>\n Effect.gen(function* () {\n const measured = yield* Effect.exit(\n restore(\n Effect.forEach(rehearsal.act, page.perform, { discard: true }).pipe(\n Effect.andThen(page.ready()),\n Effect.andThen(measure(page, rehearsal.picks)),\n ),\n ),\n );\n\n const undone = yield* Effect.exit(\n Effect.forEach(rehearsal.undo, page.perform, { discard: true }),\n );\n\n return yield* Exit.isFailure(measured) || Exit.isSuccess(undone)\n ? measured\n : Exit.failCause(undone.cause);\n }),\n );\n\n/**\n * Measure what exists only after an interaction: perform `act`, wait for the page to be ready,\n * read the layout, then perform `undo`, which runs whether or not acting and reading succeeded,\n * and is not interrupted. A failure to act or read is the rehearsal's; otherwise one to undo is.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const rehearse: {\n (rehearsal: Rehearsal): (page: Page) => Effect.Effect<Layout, BrowserError>;\n (page: Page, rehearsal: Rehearsal): Effect.Effect<Layout, BrowserError>;\n} = Function.dual(2, rehearseOn);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAa,OAAb,cAA0B,OAAO,MAAY,4BAA4B,CAAC,CAAC;CACzE,MAAM,OAAO;CACb,KAAK;CACL,MAAM;AACR,CAAC,CAAC,CAAC,CAAC;;;;;;;;AASJ,IAAa,QAAb,cAA2B,OAAO,MAAa,6BAA6B,CAAC,CAAC;;CAE5E,IAAI,OAAO;CACX,KAAK,OAAO;CACZ,SAAS;;CAET,KAAK;;CAEL,MAAM;;CAEN,OAAO,OAAO;;CAEd,OAAO,OAAO,SAAS,OAAO,MAAM,IAAI,CAAC;AAC3C,CAAC,CAAC,CAAC,CAAC;;;;;;;;AASJ,IAAa,SAAb,cAA4B,OAAO,MAAc,uBAAuB,CAAC,CAAC;CACxE,MAAM,OAAO;;CAEb,YAAY,OAAO;;CAEnB,UAAU,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;CAC3D,KAAK,OAAO;;CAEZ,IAAI,OAAO;;CAEX,UAAU,OAAO,OAAO;EAAE,OAAO,OAAO;EAAQ,QAAQ,OAAO;CAAO,CAAC;;CAEvE,QAAQ;;CAER,OAAO,OAAO;;CAEd,QAAQ,OAAO,MAAM,KAAK;;CAE1B,SAAS,OAAO,MAAM,OAAO,MAAM;AACrC,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;AAwCJ,MAAa,UAGT,SAAS,KAAK,IAAI,MAAY,UAAiB,YAAY,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC;;;;;;;;AASlF,MAAa,QAGT,SAAS,KAAK,IAAI,QAAgB,OACpC,OAAO,OAAO,MAAM,SAAS,KAAK,OAAO,EAAE,CAC7C;AAeA,MAAM,cAAc,MAAY,cAC9B,OAAO,qBAAqB,YAC1B,OAAO,IAAI,aAAa;CACtB,MAAM,WAAW,OAAO,OAAO,KAC7B,QACE,OAAO,QAAQ,UAAU,KAAK,KAAK,SAAS,EAAE,SAAS,KAAK,CAAC,CAAC,CAAC,KAC7D,OAAO,QAAQ,KAAK,MAAM,CAAC,GAC3B,OAAO,QAAQ,QAAQ,MAAM,UAAU,KAAK,CAAC,CAC/C,CACF,CACF;CAEA,MAAM,SAAS,OAAO,OAAO,KAC3B,OAAO,QAAQ,UAAU,MAAM,KAAK,SAAS,EAAE,SAAS,KAAK,CAAC,CAChE;CAEA,OAAO,OAAO,KAAK,UAAU,QAAQ,KAAK,KAAK,UAAU,MAAM,IAC3D,WACA,KAAK,UAAU,OAAO,KAAK;AACjC,CAAC,CACH;;;;;;;;;;AAWF,MAAa,WAGT,SAAS,KAAK,GAAG,UAAU"}
|
package/dist/Overlay.mjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { t as __exportAll } from "./internal/rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { n as functionsOf } from "./internal/functions-jBOs6GKv.mjs";
|
|
3
|
+
import { Schema } from "effect";
|
|
4
|
+
//#region src/Overlay.ts
|
|
5
|
+
/**
|
|
6
|
+
* A layer over a page that the library draws a caller's content into, without knowing what it
|
|
7
|
+
* shows: a pointer, a ring round what an agent is about to press, a caption, a character. It shows
|
|
8
|
+
* in screenshots, screencasts and a live view alike. The library's own readers never read it:
|
|
9
|
+
* `Snapshot`, `Layout`, `Text`, `Change`, `ready` and stillness see the page as if it were not
|
|
10
|
+
* there, and input passes through it to the page.
|
|
11
|
+
*
|
|
12
|
+
* A page has one overlay at a time, for a scope. It sits above the page's own layers but beneath
|
|
13
|
+
* its top layer (a modal dialog, a popover), in viewport CSS pixels, and undoes a zoom the page
|
|
14
|
+
* sets on its root. Each new document starts without it, and it is drawn again there, with what
|
|
15
|
+
* it last showed, once the document has loaded. It is gone when its scope closes.
|
|
16
|
+
*
|
|
17
|
+
* @stability stable
|
|
18
|
+
* @since 0.3.0
|
|
19
|
+
*/
|
|
20
|
+
var Overlay_exports = /* @__PURE__ */ __exportAll({
|
|
21
|
+
Content: () => Content,
|
|
22
|
+
drawn: () => drawn,
|
|
23
|
+
make: () => make
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* What the overlay shows. `Svg` is an SVG document sized to the viewport, whose own `viewBox` maps
|
|
27
|
+
* any design space onto it; its scripts and event handlers are dropped. `Empty` shows nothing.
|
|
28
|
+
*
|
|
29
|
+
* @stability stable
|
|
30
|
+
* @category schemas
|
|
31
|
+
* @since 0.3.0
|
|
32
|
+
*/
|
|
33
|
+
const Content = Schema.TaggedUnion({
|
|
34
|
+
Svg: { markup: Schema.String },
|
|
35
|
+
Empty: {}
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* A layer over the page to draw into, for the scope, that the library's readers never read.
|
|
39
|
+
* One at a time: a second while one is open fails `InvalidRequest`.
|
|
40
|
+
*
|
|
41
|
+
* @stability stable
|
|
42
|
+
* @category constructors
|
|
43
|
+
* @since 0.3.0
|
|
44
|
+
*/
|
|
45
|
+
const make = (page) => functionsOf(page).overlay;
|
|
46
|
+
/**
|
|
47
|
+
* Where the overlay's drawing was last drawn, in viewport CSS pixels, at no call to the page;
|
|
48
|
+
* none with nothing shown.
|
|
49
|
+
*
|
|
50
|
+
* @stability stable
|
|
51
|
+
* @category combinators
|
|
52
|
+
* @since 0.3.0
|
|
53
|
+
*/
|
|
54
|
+
const drawn = (page) => functionsOf(page).drawn;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { Content, drawn, make, Overlay_exports as t };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=Overlay.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Overlay.mjs","names":[],"sources":["../src/Overlay.ts"],"sourcesContent":["/**\n * A layer over a page that the library draws a caller's content into, without knowing what it\n * shows: a pointer, a ring round what an agent is about to press, a caption, a character. It shows\n * in screenshots, screencasts and a live view alike. The library's own readers never read it:\n * `Snapshot`, `Layout`, `Text`, `Change`, `ready` and stillness see the page as if it were not\n * there, and input passes through it to the page.\n *\n * A page has one overlay at a time, for a scope. It sits above the page's own layers but beneath\n * its top layer (a modal dialog, a popover), in viewport CSS pixels, and undoes a zoom the page\n * sets on its root. Each new document starts without it, and it is drawn again there, with what\n * it last showed, once the document has loaded. It is gone when its scope closes.\n *\n * @stability stable\n * @since 0.3.0\n */\nimport { type Effect, type Option, Schema, type Scope } from \"effect\";\n\nimport type { BrowserError } from \"./BrowserError.ts\";\nimport type { Box } from \"./BrowserEvent.ts\";\nimport { functionsOf } from \"./internal/page/functions.ts\";\nimport type { Page } from \"./Page.ts\";\n\n/**\n * What the overlay shows. `Svg` is an SVG document sized to the viewport, whose own `viewBox` maps\n * any design space onto it; its scripts and event handlers are dropped. `Empty` shows nothing.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport const Content = Schema.TaggedUnion({\n Svg: { markup: Schema.String },\n Empty: {},\n});\n\n/**\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport type Content = typeof Content.Type;\n\n/**\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport interface Overlay {\n /**\n * Show `content` in place of what was shown, in one call to the page, after the actions asked\n * before it. Says where the drawing's top-level parts are, in viewport CSS pixels.\n */\n readonly draw: (content: Content) => Effect.Effect<ReadonlyArray<Box>, BrowserError>;\n}\n\n/**\n * A layer over the page to draw into, for the scope, that the library's readers never read.\n * One at a time: a second while one is open fails `InvalidRequest`.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const make = (page: Page): Effect.Effect<Overlay, BrowserError, Scope.Scope> =>\n functionsOf(page).overlay;\n\n/**\n * Where the overlay's drawing was last drawn, in viewport CSS pixels, at no call to the page;\n * none with nothing shown.\n *\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\nexport const drawn = (page: Page): Effect.Effect<Option.Option<ReadonlyArray<Box>>> =>\n functionsOf(page).drawn;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,UAAU,OAAO,YAAY;CACxC,KAAK,EAAE,QAAQ,OAAO,OAAO;CAC7B,OAAO,CAAC;AACV,CAAC;;;;;;;;;AA8BD,MAAa,QAAQ,SACnB,YAAY,IAAI,CAAC,CAAC;;;;;;;;;AAUpB,MAAa,SAAS,SACpB,YAAY,IAAI,CAAC,CAAC"}
|
package/dist/Page.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { ActOptions,
|
|
1
|
+
import { _ as correlate, a as InputRequest, b as redacted, c as Point, d as ResolvedTarget, f as ScriptOptions, g as TypeOptions, h as Target, i as InputGuard, l as PressOptions, m as State, n as ClickOptions, o as Page, p as ScrollOptions, r as Fact, t as ActOptions, u as ReadyOptions, v as failFast, y as isPage } from "./internal/Page-BfGxn7oN.mjs";
|
|
2
|
+
export { ActOptions, ClickOptions, Fact, InputGuard, InputRequest, Page, Point, PressOptions, ReadyOptions, ResolvedTarget, ScriptOptions, ScrollOptions, State, Target, TypeOptions, correlate, failFast, isPage, redacted };
|
package/dist/Page.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a as State, c as isPage, i as ResolvedTarget, l as redacted, n as InputRequest, o as correlate, s as failFast, t as Fact } from "./internal/Page-DqF-tuTx.mjs";
|
|
2
|
+
export { Fact, InputRequest, ResolvedTarget, State, correlate, failFast, isPage, redacted };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { t as __exportAll } from "./internal/rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { n as functionsOf } from "./internal/functions-jBOs6GKv.mjs";
|
|
3
|
+
//#region src/PageTime.ts
|
|
4
|
+
var PageTime_exports = /* @__PURE__ */ __exportAll({ hold: () => hold });
|
|
5
|
+
/**
|
|
6
|
+
* Hold the page's own time for the scope, to step it on with `advance`; real time resumes when
|
|
7
|
+
* the scope closes. Needs the browser's `pageTime` option; one hold at a time.
|
|
8
|
+
*
|
|
9
|
+
* @stability stable
|
|
10
|
+
* @category combinators
|
|
11
|
+
* @since 0.3.0
|
|
12
|
+
*/
|
|
13
|
+
const hold = (page) => functionsOf(page).hold;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { hold, PageTime_exports as t };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=PageTime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageTime.mjs","names":[],"sources":["../src/PageTime.ts"],"sourcesContent":["/**\n * A page's own time, held and stepped, so what the page does by itself happens at times a caller\n * chooses: a visual test takes a transition at exactly 120 ms, a test skips a 30 second countdown\n * in one step, a recording's page moves one frame's worth per frame however long each takes.\n *\n * A browser opened with `pageTime` runs a page clock in each top document's main world, before\n * the page's own scripts. Until `hold`, it keeps real time. Held, the page's timers and\n * intervals, its animation frames, `performance.now`, `Date.now`, `new Date()` and `Date()`, and\n * its CSS transitions, CSS animations and Web Animations stand still, and each `advance` runs what\n * falls due in time order, each timer at its own time, and then one animation frame at its end.\n * An animation the page starts while held starts at the page time it is held at. Workers, media,\n * `requestIdleCallback`, `MessageChannel`, events' `timeStamp` and frames' own documents keep real\n * time. A clock that has been held is a page script's to notice: it replaces those globals.\n *\n * Loading takes real time: a document that replaces a held one starts on real time, and is held\n * from the next `advance`. When the hold's scope closes, page time carries on from where it was,\n * never back, and what was left of each timer and frame runs in real time. `ready` and stillness\n * count an animation held part way as still running.\n *\n * @stability stable\n * @since 0.3.0\n */\nimport type { Duration, Effect, Scope } from \"effect\";\n\nimport type { BrowserError } from \"./BrowserError.ts\";\nimport type { Point } from \"./internal/geometry.ts\";\nimport { functionsOf } from \"./internal/page/functions.ts\";\nimport type { Content } from \"./Overlay.ts\";\nimport type { Page } from \"./Page.ts\";\nimport type { Pose } from \"./Pose.ts\";\n\n/**\n * What else changes with page time in the same call to the page.\n *\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport interface Step {\n /** Scroll the document to this many CSS pixels down it first, at once. */\n readonly scroll?: number | undefined;\n /** Then pose these elements and take the pose off any other, as `Poses.set` does; the page's poses must be open. */\n readonly poses?: ReadonlyArray<Pose> | undefined;\n /** Then show this in the page's overlay, which must be open. */\n readonly overlay?: Content | undefined;\n}\n\n/**\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport interface Held {\n /**\n * Move page time on by `by`, in one call to the page, after the actions asked before it. Says\n * where the document is scrolled to after it.\n */\n readonly advance: (by: Duration.Input, step?: Step) => Effect.Effect<Point, BrowserError>;\n /** How far this hold has moved page time, across the documents it held. */\n readonly elapsed: Effect.Effect<Duration.Duration>;\n}\n\n/**\n * Hold the page's own time for the scope, to step it on with `advance`; real time resumes when\n * the scope closes. Needs the browser's `pageTime` option; one hold at a time.\n *\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\nexport const hold = (page: Page): Effect.Effect<Held, BrowserError, Scope.Scope> =>\n functionsOf(page).hold;\n"],"mappings":";;;;;;;;;;;;AAsEA,MAAa,QAAQ,SACnB,YAAY,IAAI,CAAC,CAAC"}
|
package/dist/Pose.d.mts
ADDED
package/dist/Pose.mjs
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { t as __exportAll } from "./internal/rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { n as Point } from "./internal/geometry-Lxyflb9J.mjs";
|
|
3
|
+
import { n as functionsOf } from "./internal/functions-jBOs6GKv.mjs";
|
|
4
|
+
import { Schema } from "effect";
|
|
5
|
+
//#region src/Pose.ts
|
|
6
|
+
/**
|
|
7
|
+
* Element poses: one of the page's own elements moved, turned and scaled about a point, as a caller
|
|
8
|
+
* says, frame by frame on held time or live, so that the page answers what touches it. A tab
|
|
9
|
+
* squashes under a stomp, a box dips as something lands on it, a button tilts as it is pulled, a
|
|
10
|
+
* field wiggles to ask for input. The library chooses no motion: each pose is a caller's.
|
|
11
|
+
*
|
|
12
|
+
* A pose is plain data, in viewport CSS pixels: moved by `dx` and `dy`, scaled by `sx` and `sy`,
|
|
13
|
+
* and turned `rotate` degrees clockwise, each about `origin`, by default the middle of where the
|
|
14
|
+
* page draws the element. As CSS writes it: `transform-origin: origin; transform: translate(dx, dy)
|
|
15
|
+
* rotate(rotate) scale(sx, sy)`, applied around the element's own transform. Its own `translate`,
|
|
16
|
+
* `rotate` and `scale` properties, which pages seldom set, give way while it is posed.
|
|
17
|
+
*
|
|
18
|
+
* A page's poses are one lease, for a scope; each `set` poses the elements it names and takes the
|
|
19
|
+
* pose off every other, and the scope's end takes them all off. A pose sets no attribute and starts
|
|
20
|
+
* none of the page's transitions, and the library's change record does not report it. Readers
|
|
21
|
+
* report what is drawn: `Layout.measure`, `Snapshot.find` and the input's targets give a posed
|
|
22
|
+
* element's box as posed, and a click lands where it is drawn. Only HTML elements take a pose, and
|
|
23
|
+
* one inside another posed element is posed about its point as if the outer one were not. A new
|
|
24
|
+
* document starts with none.
|
|
25
|
+
*
|
|
26
|
+
* @stability stable
|
|
27
|
+
* @since 0.3.0
|
|
28
|
+
*/
|
|
29
|
+
var Pose_exports = /* @__PURE__ */ __exportAll({
|
|
30
|
+
Pose: () => Pose,
|
|
31
|
+
make: () => make
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* How an element is posed. A part left out changes nothing: no move, a scale of 1, no turn.
|
|
35
|
+
*
|
|
36
|
+
* @stability stable
|
|
37
|
+
* @category schemas
|
|
38
|
+
* @since 0.3.0
|
|
39
|
+
*/
|
|
40
|
+
const Pose = Schema.Struct({
|
|
41
|
+
/** The element, by a ref from the page's current document, such as a `Layout` place's. */
|
|
42
|
+
ref: Schema.String,
|
|
43
|
+
dx: Schema.optional(Schema.Finite),
|
|
44
|
+
dy: Schema.optional(Schema.Finite),
|
|
45
|
+
sx: Schema.optional(Schema.Finite),
|
|
46
|
+
sy: Schema.optional(Schema.Finite),
|
|
47
|
+
/** Degrees, clockwise. */
|
|
48
|
+
rotate: Schema.optional(Schema.Finite),
|
|
49
|
+
/** The point it turns and scales about, in the viewport. */
|
|
50
|
+
origin: Schema.optional(Point)
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Pose the page's own elements for the scope, moved, turned and scaled as a caller says, and put
|
|
54
|
+
* back when the scope closes. One lease at a time: a second while one is open fails
|
|
55
|
+
* `InvalidRequest`.
|
|
56
|
+
*
|
|
57
|
+
* @stability stable
|
|
58
|
+
* @category constructors
|
|
59
|
+
* @since 0.3.0
|
|
60
|
+
*/
|
|
61
|
+
const make = (page) => functionsOf(page).poses;
|
|
62
|
+
//#endregion
|
|
63
|
+
export { Pose, make, Pose_exports as t };
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=Pose.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pose.mjs","names":[],"sources":["../src/Pose.ts"],"sourcesContent":["/**\n * Element poses: one of the page's own elements moved, turned and scaled about a point, as a caller\n * says, frame by frame on held time or live, so that the page answers what touches it. A tab\n * squashes under a stomp, a box dips as something lands on it, a button tilts as it is pulled, a\n * field wiggles to ask for input. The library chooses no motion: each pose is a caller's.\n *\n * A pose is plain data, in viewport CSS pixels: moved by `dx` and `dy`, scaled by `sx` and `sy`,\n * and turned `rotate` degrees clockwise, each about `origin`, by default the middle of where the\n * page draws the element. As CSS writes it: `transform-origin: origin; transform: translate(dx, dy)\n * rotate(rotate) scale(sx, sy)`, applied around the element's own transform. Its own `translate`,\n * `rotate` and `scale` properties, which pages seldom set, give way while it is posed.\n *\n * A page's poses are one lease, for a scope; each `set` poses the elements it names and takes the\n * pose off every other, and the scope's end takes them all off. A pose sets no attribute and starts\n * none of the page's transitions, and the library's change record does not report it. Readers\n * report what is drawn: `Layout.measure`, `Snapshot.find` and the input's targets give a posed\n * element's box as posed, and a click lands where it is drawn. Only HTML elements take a pose, and\n * one inside another posed element is posed about its point as if the outer one were not. A new\n * document starts with none.\n *\n * @stability stable\n * @since 0.3.0\n */\nimport { type Effect, Schema, type Scope } from \"effect\";\n\nimport type { BrowserError } from \"./BrowserError.ts\";\nimport { Point } from \"./internal/geometry.ts\";\nimport { functionsOf } from \"./internal/page/functions.ts\";\nimport type { Page } from \"./Page.ts\";\n\n/**\n * How an element is posed. A part left out changes nothing: no move, a scale of 1, no turn.\n *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport const Pose = Schema.Struct({\n /** The element, by a ref from the page's current document, such as a `Layout` place's. */\n ref: Schema.String,\n dx: Schema.optional(Schema.Finite),\n dy: Schema.optional(Schema.Finite),\n sx: Schema.optional(Schema.Finite),\n sy: Schema.optional(Schema.Finite),\n /** Degrees, clockwise. */\n rotate: Schema.optional(Schema.Finite),\n /** The point it turns and scales about, in the viewport. */\n origin: Schema.optional(Point),\n});\n\n/**\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport type Pose = typeof Pose.Type;\n\n/**\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport interface Poses {\n /**\n * Pose these elements, in one call to the page, and take the pose off every other. A ref the\n * document no longer has fails with `StaleRef`, and posing nothing.\n */\n readonly set: (poses: ReadonlyArray<Pose>) => Effect.Effect<void, BrowserError>;\n}\n\n/**\n * Pose the page's own elements for the scope, moved, turned and scaled as a caller says, and put\n * back when the scope closes. One lease at a time: a second while one is open fails\n * `InvalidRequest`.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const make = (page: Page): Effect.Effect<Poses, BrowserError, Scope.Scope> =>\n functionsOf(page).poses;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAa,OAAO,OAAO,OAAO;;CAEhC,KAAK,OAAO;CACZ,IAAI,OAAO,SAAS,OAAO,MAAM;CACjC,IAAI,OAAO,SAAS,OAAO,MAAM;CACjC,IAAI,OAAO,SAAS,OAAO,MAAM;CACjC,IAAI,OAAO,SAAS,OAAO,MAAM;;CAEjC,QAAQ,OAAO,SAAS,OAAO,MAAM;;CAErC,QAAQ,OAAO,SAAS,KAAK;AAC/B,CAAC;;;;;;;;;;AA+BD,MAAa,QAAQ,SACnB,YAAY,IAAI,CAAC,CAAC"}
|