effect-browser 0.3.0-beta.23 → 0.3.0-beta.24

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.
Files changed (134) hide show
  1. package/README.md +124 -5
  2. package/dist/ActionPort.d.mts +1 -1
  3. package/dist/ActionPort.mjs +1 -1
  4. package/dist/{Browser-BKPAbyys.mjs → Browser-CAQFhTkM.mjs} +559 -333
  5. package/dist/Browser-CAQFhTkM.mjs.map +1 -0
  6. package/dist/{Browser-wZhwZSlG.d.mts → Browser-DGR6ZEYo.d.mts} +9 -3
  7. package/dist/Browser.d.mts +1 -1
  8. package/dist/Browser.mjs +1 -1
  9. package/dist/{BrowserEvent-lLqJ3GJS.d.mts → BrowserEvent-C2p-NwuU.d.mts} +30 -6
  10. package/dist/BrowserEvent.d.mts +2 -2
  11. package/dist/BrowserEvent.mjs +20 -1
  12. package/dist/BrowserEvent.mjs.map +1 -1
  13. package/dist/{Change-Ba7INmay.d.mts → Change-CxT1mp2e.d.mts} +13 -2
  14. package/dist/Change.d.mts +1 -1
  15. package/dist/Change.mjs +7 -1
  16. package/dist/Change.mjs.map +1 -1
  17. package/dist/Clock-Du5nP-nK.d.mts +57 -0
  18. package/dist/Clock.d.mts +2 -57
  19. package/dist/Layout.d.mts +2 -0
  20. package/dist/Layout.mjs +81 -0
  21. package/dist/Layout.mjs.map +1 -0
  22. package/dist/Matching-MtcWZ_hA.d.mts +266 -0
  23. package/dist/Matching.d.mts +2 -37
  24. package/dist/Matching.mjs +22 -17
  25. package/dist/Matching.mjs.map +1 -1
  26. package/dist/Overlay-CoGw5tL_.d.mts +27 -0
  27. package/dist/Overlay.d.mts +2 -0
  28. package/dist/Overlay.mjs +30 -0
  29. package/dist/Overlay.mjs.map +1 -0
  30. package/dist/{Page-BF5izr8R.mjs → Page-BaAOshxo.mjs} +3 -1
  31. package/dist/Page-BaAOshxo.mjs.map +1 -0
  32. package/dist/{Page-CvsOEorc.d.mts → Page-CLzh5E9w.d.mts} +158 -6
  33. package/dist/Page.d.mts +2 -2
  34. package/dist/Page.mjs +1 -1
  35. package/dist/PageTime-68UPUZpZ.d.mts +29 -0
  36. package/dist/PageTime.d.mts +2 -0
  37. package/dist/PageTime.mjs +7 -0
  38. package/dist/PageTime.mjs.map +1 -0
  39. package/dist/Pose-2qqGzPvb.d.mts +32 -0
  40. package/dist/Pose.d.mts +2 -0
  41. package/dist/Pose.mjs +44 -0
  42. package/dist/Pose.mjs.map +1 -0
  43. package/dist/Site.d.mts +714 -0
  44. package/dist/Site.mjs +102 -0
  45. package/dist/Site.mjs.map +1 -0
  46. package/dist/{Stillness-CNlvayIo.mjs → Stillness-BwP0RdI4.mjs} +27 -6
  47. package/dist/Stillness-BwP0RdI4.mjs.map +1 -0
  48. package/dist/{Style-AO4V7Czt.mjs → Style-T3ezDYLI.mjs} +25 -2
  49. package/dist/{Style-AO4V7Czt.mjs.map → Style-T3ezDYLI.mjs.map} +1 -1
  50. package/dist/Style.d.mts +15 -2
  51. package/dist/Style.mjs +2 -2
  52. package/dist/Url-B7P-TWwL.d.mts +26 -0
  53. package/dist/Url.d.mts +2 -26
  54. package/dist/{Window-CMddGMt1.d.mts → Window-BDa8MtNP.d.mts} +4 -4
  55. package/dist/Window.d.mts +1 -1
  56. package/dist/{connection-CK83pvqP.mjs → connection-C_jWYIwe.mjs} +2 -2
  57. package/dist/{connection-CK83pvqP.mjs.map → connection-C_jWYIwe.mjs.map} +1 -1
  58. package/dist/{connection-2KHI4_KN.d.mts → connection-Db-YtlbE.d.mts} +2 -2
  59. package/dist/film/Film.d.mts +265 -0
  60. package/dist/film/Film.mjs +246 -0
  61. package/dist/film/Film.mjs.map +1 -0
  62. package/dist/fold.inpage-CyVZQHZL.d.mts +49 -0
  63. package/dist/index.d.mts +11 -8
  64. package/dist/index.mjs +8 -4
  65. package/dist/moment/Moment.d.mts +5 -5
  66. package/dist/plan/index.d.mts +2 -2
  67. package/dist/plan/index.mjs +2 -2
  68. package/dist/policy/Policy.d.mts +1 -1
  69. package/dist/policy/Policy.mjs +1 -1
  70. package/dist/pose.inpage-CLq7Mfdr.mjs +2042 -0
  71. package/dist/pose.inpage-CLq7Mfdr.mjs.map +1 -0
  72. package/dist/presentation/Presentation.d.mts +8 -1
  73. package/dist/presentation/Presentation.mjs +3 -1
  74. package/dist/presentation/Presentation.mjs.map +1 -1
  75. package/dist/presentation/Stage.d.mts +1 -1
  76. package/dist/providers/Cdp.d.mts +2 -2
  77. package/dist/providers/Cdp.mjs +1 -1
  78. package/dist/providers/Chromium.d.mts +1 -1
  79. package/dist/providers/Chromium.mjs +1 -1
  80. package/dist/stillness/Stillness.d.mts +1 -1
  81. package/dist/stillness/Stillness.mjs +1 -1
  82. package/dist/testing/index.d.mts +4 -30
  83. package/dist/testing/index.mjs +8 -2
  84. package/dist/testing/index.mjs.map +1 -1
  85. package/dist/workerd/Cdp.d.mts +2 -2
  86. package/dist/workerd/Cdp.mjs +1 -1
  87. package/package.json +32 -2
  88. package/src/Browser.ts +11 -6
  89. package/src/BrowserEvent.ts +19 -0
  90. package/src/Change.ts +7 -1
  91. package/src/Layout.ts +116 -0
  92. package/src/Matching.ts +24 -15
  93. package/src/Overlay.ts +37 -0
  94. package/src/Page.ts +45 -0
  95. package/src/PageTime.ts +47 -0
  96. package/src/Pose.ts +50 -0
  97. package/src/Site.ts +124 -0
  98. package/src/Style.ts +36 -0
  99. package/src/film/Film.ts +384 -0
  100. package/src/index.ts +4 -0
  101. package/src/internal/input/perform.ts +31 -3
  102. package/src/internal/input/pointer.ts +7 -4
  103. package/src/internal/input/targets.ts +1 -1
  104. package/src/internal/page/bridge.ts +65 -33
  105. package/src/internal/page/clock.inpage.ts +306 -0
  106. package/src/internal/page/compose.inpage.ts +101 -0
  107. package/src/internal/page/context.ts +2 -0
  108. package/src/internal/page/overlay.inpage.ts +96 -0
  109. package/src/internal/page/overlay.ts +89 -0
  110. package/src/internal/page/page.ts +12 -0
  111. package/src/internal/page/pose.inpage.ts +200 -0
  112. package/src/internal/page/pose.ts +80 -0
  113. package/src/internal/page/time.inpage.ts +49 -0
  114. package/src/internal/page/time.ts +122 -0
  115. package/src/internal/page/viewport.ts +3 -2
  116. package/src/internal/pictures/pictures.ts +93 -32
  117. package/src/internal/reading/layout.inpage.ts +193 -0
  118. package/src/internal/reading/layout.ts +101 -0
  119. package/src/internal/reading/names.inpage.ts +15 -0
  120. package/src/internal/reading/outline.inpage.ts +2 -18
  121. package/src/internal/reading/reading.ts +22 -2
  122. package/src/internal/reading/ready.inpage.ts +18 -23
  123. package/src/internal/reading/ready.ts +23 -3
  124. package/src/internal/reading/text.inpage.ts +1 -14
  125. package/src/internal/timeline/changes.inpage.ts +7 -15
  126. package/src/internal/timeline/changes.ts +14 -1
  127. package/src/internal/timeline/record.inpage.ts +15 -6
  128. package/src/presentation/Presentation.ts +13 -0
  129. package/src/stillness/Pixels.ts +26 -0
  130. package/src/stillness/Stillness.ts +30 -5
  131. package/src/testing/page.ts +5 -0
  132. package/dist/Browser-BKPAbyys.mjs.map +0 -1
  133. package/dist/Page-BF5izr8R.mjs.map +0 -1
  134. package/dist/Stillness-CNlvayIo.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { t as BrowserError } from "./BrowserError-BlcmLVzn.mjs";
2
- import { _ as RecordedEvent, i as BrowserEvent_d_exports, r as BrowserEvent, s as DisconnectCause } from "./BrowserEvent-lLqJ3GJS.mjs";
3
- import { f as Page, p as Page_d_exports, u as InputGuard } from "./Page-CvsOEorc.mjs";
2
+ import { a as BrowserEvent_d_exports, c as DisconnectCause, i as BrowserEvent, v as RecordedEvent } from "./BrowserEvent-C2p-NwuU.mjs";
3
+ import { f as Page, p as Page_d_exports, u as InputGuard } from "./Page-CLzh5E9w.mjs";
4
4
  import { Context, DateTime, Duration, Effect, Option, Schema, Scope, Stream } from "effect";
5
5
  import { BrowserContext } from "playwright-core";
6
6
  declare namespace Browser_d_exports {
@@ -73,6 +73,12 @@ interface Options {
73
73
  readonly policyTimeout?: Duration.Input | undefined;
74
74
  /** Scripts that new documents run before their own, each where its `match` allows. */
75
75
  readonly initScripts?: ReadonlyArray<InitScript> | undefined;
76
+ /**
77
+ * Run a page clock in each top document before its own scripts, so `Page.hold` can hold and
78
+ * step its time. It keeps real time until held, but replaces the page's timers, animation
79
+ * frames, `Date` and `performance.now`, which a page script can notice. See `PageTime`.
80
+ */
81
+ readonly pageTime?: boolean | undefined;
76
82
  /**
77
83
  * The most pages the browser keeps open, those a site opens included, which are never refused. At
78
84
  * it, `newPage` waits for one to close, within the action timeout, then fails `Limit`; under
@@ -164,4 +170,4 @@ declare const make: (context: BrowserContext, info: {
164
170
  }, options?: Options | undefined) => Effect.Effect<Service, BrowserError, Scope.Scope>;
165
171
  //#endregion
166
172
  export { InitScript as a, RequestPolicy as c, Suspension as d, make as f, EventOptions as i, Service as l, Browser_d_exports as n, Options as o, CaptureSource as r, RequestDecision as s, Browser$1 as t, SuspendOptions as u };
167
- //# sourceMappingURL=Browser-wZhwZSlG.d.mts.map
173
+ //# sourceMappingURL=Browser-DGR6ZEYo.d.mts.map
@@ -1,2 +1,2 @@
1
- import { a as InitScript, c as RequestPolicy, d as Suspension, f as make, i as EventOptions, l as Service, o as Options, r as CaptureSource, s as RequestDecision, t as Browser, u as SuspendOptions } from "./Browser-wZhwZSlG.mjs";
1
+ import { a as InitScript, c as RequestPolicy, d as Suspension, f as make, i as EventOptions, l as Service, o as Options, r as CaptureSource, s as RequestDecision, t as Browser, u as SuspendOptions } from "./Browser-DGR6ZEYo.mjs";
2
2
  export { Browser, CaptureSource, EventOptions, InitScript, Options, RequestDecision, RequestPolicy, Service, SuspendOptions, Suspension, make };
package/dist/Browser.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { i as make, r as Suspension, t as Browser } from "./Browser-BKPAbyys.mjs";
1
+ import { i as make, r as Suspension, t as Browser } from "./Browser-CAQFhTkM.mjs";
2
2
  export { Browser, Suspension, make };
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  declare namespace BrowserEvent_d_exports {
3
- export { Action, Box, BrowserEvent, CursorChanged, DialogShown, DisconnectCause, Disconnected, KeyChanged, Navigated, PageClosed, PageLoaded, PageOpened, PageUntracked, PointerPressed, PointerReleased, RecordedEvent, RequestRefused, SessionEnding, Subject, SubjectContext, TextInserted, TrackEvent, TrackPerformed, TrackPlanned, WheelScrolled };
3
+ export { Action, ActionAnnounced, Box, BrowserEvent, CursorChanged, DialogShown, DisconnectCause, Disconnected, KeyChanged, Navigated, PageClosed, PageLoaded, PageOpened, PageUntracked, PointerPressed, PointerReleased, RecordedEvent, RequestRefused, SessionEnding, Subject, SubjectContext, TextInserted, TrackEvent, TrackPerformed, TrackPlanned, WheelScrolled };
4
4
  }
5
5
  declare const PageOpened_base: Schema.Class<PageOpened, Schema.TaggedStruct<"PageOpened", {
6
6
  readonly at: Schema.Finite;
@@ -215,6 +215,30 @@ declare const Action_base: Schema.Class<Action, Schema.TaggedStruct<"Action", {
215
215
  * model's tool call id.
216
216
  */
217
217
  declare class Action extends Action_base {}
218
+ declare const ActionAnnounced_base: Schema.Class<ActionAnnounced, Schema.TaggedStruct<"ActionAnnounced", {
219
+ readonly x: Schema.Finite;
220
+ readonly y: Schema.Finite;
221
+ readonly at: Schema.Finite;
222
+ readonly page: Schema.String;
223
+ readonly name: Schema.Literals<readonly ["click", "hover", "drag", "type", "press", "scroll", "select", "navigate", "back", "reload", "act"]>;
224
+ readonly correlation: Schema.optional<Schema.String>;
225
+ readonly subject: Schema.optional<typeof Subject>;
226
+ readonly to: Schema.optional<typeof Subject>;
227
+ readonly box: Schema.optional<Schema.Struct<{
228
+ readonly x: Schema.Finite;
229
+ readonly y: Schema.Finite;
230
+ readonly width: Schema.Finite;
231
+ readonly height: Schema.Finite;
232
+ }>>;
233
+ }>, {}>;
234
+ /**
235
+ * An action found its target and is about to send input there: published once, before its pointer
236
+ * travels to the target, with what its `Action` will record of it. A glide that only scrolls the
237
+ * target into view comes before. `x` and `y` are where the pointer goes, in viewport CSS pixels; for
238
+ * a drag, its start. Input with no pointer travel, such as keys or typing into the focused field,
239
+ * announces nothing.
240
+ */
241
+ declare class ActionAnnounced extends ActionAnnounced_base {}
218
242
  declare const TrackPlanned_base: Schema.Class<TrackPlanned, Schema.TaggedStruct<"TrackPlanned", {
219
243
  readonly at: Schema.Finite;
220
244
  readonly page: Schema.String;
@@ -293,7 +317,7 @@ declare const CursorChanged_base: Schema.Class<CursorChanged, Schema.TaggedStruc
293
317
  }>, {}>;
294
318
  /** The target's CSS cursor, obtained during target resolution without another browser call. */
295
319
  declare class CursorChanged extends CursorChanged_base {}
296
- declare const TrackEvent: Schema.Union<readonly [typeof TrackPlanned, typeof TrackPerformed, typeof PointerPressed, typeof PointerReleased, typeof WheelScrolled, typeof KeyChanged, typeof TextInserted, typeof CursorChanged]>;
320
+ declare const TrackEvent: Schema.Union<readonly [typeof ActionAnnounced, typeof TrackPlanned, typeof TrackPerformed, typeof PointerPressed, typeof PointerReleased, typeof WheelScrolled, typeof KeyChanged, typeof TextInserted, typeof CursorChanged]>;
297
321
  type TrackEvent = typeof TrackEvent.Type;
298
322
  declare const DialogShown_base: Schema.Class<DialogShown, Schema.TaggedStruct<"DialogShown", {
299
323
  readonly at: Schema.Finite;
@@ -322,14 +346,14 @@ declare const RequestRefused_base: Schema.Class<RequestRefused, Schema.TaggedStr
322
346
  /** A context policy refused traffic; page is present only when its containing page was established.
323
347
  * Worker and out-of-process iframe requests may omit it while retaining proven context ownership. */
324
348
  declare class RequestRefused extends RequestRefused_base {}
325
- declare const BrowserEvent: Schema.Union<readonly [typeof RequestRefused, typeof PageOpened, typeof PageClosed, typeof PageUntracked, typeof Navigated, typeof PageLoaded, typeof Action, typeof TrackPlanned, typeof TrackPerformed, typeof PointerPressed, typeof PointerReleased, typeof WheelScrolled, typeof KeyChanged, typeof TextInserted, typeof CursorChanged, typeof DialogShown, typeof Disconnected, typeof SessionEnding]>;
349
+ declare const BrowserEvent: Schema.Union<readonly [typeof RequestRefused, typeof PageOpened, typeof PageClosed, typeof PageUntracked, typeof Navigated, typeof PageLoaded, typeof Action, typeof ActionAnnounced, typeof TrackPlanned, typeof TrackPerformed, typeof PointerPressed, typeof PointerReleased, typeof WheelScrolled, typeof KeyChanged, typeof TextInserted, typeof CursorChanged, typeof DialogShown, typeof Disconnected, typeof SessionEnding]>;
326
350
  type BrowserEvent = typeof BrowserEvent.Type;
327
351
  declare const RecordedEvent_base: Schema.Class<RecordedEvent, Schema.Struct<{
328
352
  readonly sequence: Schema.Int;
329
- readonly event: Schema.Union<readonly [typeof RequestRefused, typeof PageOpened, typeof PageClosed, typeof PageUntracked, typeof Navigated, typeof PageLoaded, typeof Action, typeof TrackPlanned, typeof TrackPerformed, typeof PointerPressed, typeof PointerReleased, typeof WheelScrolled, typeof KeyChanged, typeof TextInserted, typeof CursorChanged, typeof DialogShown, typeof Disconnected, typeof SessionEnding]>;
353
+ readonly event: Schema.Union<readonly [typeof RequestRefused, typeof PageOpened, typeof PageClosed, typeof PageUntracked, typeof Navigated, typeof PageLoaded, typeof Action, typeof ActionAnnounced, typeof TrackPlanned, typeof TrackPerformed, typeof PointerPressed, typeof PointerReleased, typeof WheelScrolled, typeof KeyChanged, typeof TextInserted, typeof CursorChanged, typeof DialogShown, typeof Disconnected, typeof SessionEnding]>;
330
354
  }>, {}>;
331
355
  /** A position in the browser's one replayable event history. Sequences begin at one. */
332
356
  declare class RecordedEvent extends RecordedEvent_base {}
333
357
  //#endregion
334
- export { TrackEvent as C, WheelScrolled as E, TextInserted as S, TrackPlanned as T, RecordedEvent as _, CursorChanged as a, Subject as b, Disconnected as c, PageClosed as d, PageLoaded as f, PointerReleased as g, PointerPressed as h, BrowserEvent_d_exports as i, KeyChanged as l, PageUntracked as m, Box as n, DialogShown as o, PageOpened as p, BrowserEvent as r, DisconnectCause as s, Action as t, Navigated as u, RequestRefused as v, TrackPerformed as w, SubjectContext as x, SessionEnding as y };
335
- //# sourceMappingURL=BrowserEvent-lLqJ3GJS.d.mts.map
358
+ export { TextInserted as C, WheelScrolled as D, TrackPlanned as E, SubjectContext as S, TrackPerformed as T, PointerReleased as _, BrowserEvent_d_exports as a, SessionEnding as b, DisconnectCause as c, Navigated as d, PageClosed as f, PointerPressed as g, PageUntracked as h, BrowserEvent as i, Disconnected as l, PageOpened as m, ActionAnnounced as n, CursorChanged as o, PageLoaded as p, Box as r, DialogShown as s, Action as t, KeyChanged as u, RecordedEvent as v, TrackEvent as w, Subject as x, RequestRefused as y };
359
+ //# sourceMappingURL=BrowserEvent-C2p-NwuU.d.mts.map
@@ -1,2 +1,2 @@
1
- import { C as TrackEvent, E as WheelScrolled, S as TextInserted, T as TrackPlanned, _ as RecordedEvent, a as CursorChanged, b as Subject, c as Disconnected, d as PageClosed, f as PageLoaded, g as PointerReleased, h as PointerPressed, l as KeyChanged, m as PageUntracked, n as Box, o as DialogShown, p as PageOpened, r as BrowserEvent, s as DisconnectCause, t as Action, u as Navigated, v as RequestRefused, w as TrackPerformed, x as SubjectContext, y as SessionEnding } from "./BrowserEvent-lLqJ3GJS.mjs";
2
- export { Action, Box, BrowserEvent, CursorChanged, DialogShown, DisconnectCause, Disconnected, KeyChanged, Navigated, PageClosed, PageLoaded, PageOpened, PageUntracked, PointerPressed, PointerReleased, RecordedEvent, RequestRefused, SessionEnding, Subject, SubjectContext, TextInserted, TrackEvent, TrackPerformed, TrackPlanned, WheelScrolled };
1
+ import { C as TextInserted, D as WheelScrolled, E as TrackPlanned, S as SubjectContext, T as TrackPerformed, _ as PointerReleased, b as SessionEnding, c as DisconnectCause, d as Navigated, f as PageClosed, g as PointerPressed, h as PageUntracked, i as BrowserEvent, l as Disconnected, m as PageOpened, n as ActionAnnounced, o as CursorChanged, p as PageLoaded, r as Box, s as DialogShown, t as Action, u as KeyChanged, v as RecordedEvent, w as TrackEvent, x as Subject, y as RequestRefused } from "./BrowserEvent-C2p-NwuU.mjs";
2
+ export { Action, ActionAnnounced, Box, BrowserEvent, CursorChanged, DialogShown, DisconnectCause, Disconnected, KeyChanged, Navigated, PageClosed, PageLoaded, PageOpened, PageUntracked, PointerPressed, PointerReleased, RecordedEvent, RequestRefused, SessionEnding, Subject, SubjectContext, TextInserted, TrackEvent, TrackPerformed, TrackPlanned, WheelScrolled };
@@ -17,6 +17,7 @@ import { Schema } from "effect";
17
17
  */
18
18
  var BrowserEvent_exports = /* @__PURE__ */ __exportAll({
19
19
  Action: () => Action,
20
+ ActionAnnounced: () => ActionAnnounced,
20
21
  Box: () => Box,
21
22
  BrowserEvent: () => BrowserEvent,
22
23
  CursorChanged: () => CursorChanged,
@@ -175,6 +176,23 @@ var Action = class extends Schema.TaggedClass()("Action", {
175
176
  error: Schema.optional(Schema.String)
176
177
  }) {};
177
178
  const Sequence = Schema.Int.check(Schema.isGreaterThan(0));
179
+ /**
180
+ * An action found its target and is about to send input there: published once, before its pointer
181
+ * travels to the target, with what its `Action` will record of it. A glide that only scrolls the
182
+ * target into view comes before. `x` and `y` are where the pointer goes, in viewport CSS pixels; for
183
+ * a drag, its start. Input with no pointer travel, such as keys or typing into the focused field,
184
+ * announces nothing.
185
+ */
186
+ var ActionAnnounced = class extends Schema.TaggedClass()("ActionAnnounced", {
187
+ at: Schema.Finite,
188
+ page: Schema.String,
189
+ name: Name,
190
+ correlation: Schema.optional(Schema.String),
191
+ subject: Schema.optional(Subject),
192
+ to: Schema.optional(Subject),
193
+ box: Schema.optional(Box),
194
+ ...Point.fields
195
+ }) {};
178
196
  /** One whole glide, published before its first input. Offsets use the host monotonic clock. */
179
197
  var TrackPlanned = class extends Schema.TaggedClass()("TrackPlanned", {
180
198
  at: Schema.Finite,
@@ -235,6 +253,7 @@ var CursorChanged = class extends Schema.TaggedClass()("CursorChanged", {
235
253
  cursor: Schema.String
236
254
  }) {};
237
255
  const TrackEvent = Schema.Union([
256
+ ActionAnnounced,
238
257
  TrackPlanned,
239
258
  TrackPerformed,
240
259
  PointerPressed,
@@ -292,6 +311,6 @@ var RecordedEvent = class extends Schema.Class("effect-browser/RecordedEvent")({
292
311
  event: BrowserEvent
293
312
  }) {};
294
313
  //#endregion
295
- export { Action, Box, BrowserEvent, CursorChanged, DialogShown, DisconnectCause, Disconnected, KeyChanged, Navigated, PageClosed, PageLoaded, PageOpened, PageUntracked, PointerPressed, PointerReleased, RecordedEvent, RequestRefused, SessionEnding, Subject, SubjectContext, TextInserted, TrackEvent, TrackPerformed, TrackPlanned, WheelScrolled, BrowserEvent_exports as t };
314
+ export { Action, ActionAnnounced, Box, BrowserEvent, CursorChanged, DialogShown, DisconnectCause, Disconnected, KeyChanged, Navigated, PageClosed, PageLoaded, PageOpened, PageUntracked, PointerPressed, PointerReleased, RecordedEvent, RequestRefused, SessionEnding, Subject, SubjectContext, TextInserted, TrackEvent, TrackPerformed, TrackPlanned, WheelScrolled, BrowserEvent_exports as t };
296
315
 
297
316
  //# sourceMappingURL=BrowserEvent.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"BrowserEvent.mjs","names":["ActionValue","Motion.Point","Motion.Plan"],"sources":["../src/BrowserEvent.ts"],"sourcesContent":["/**\n * What happened in a browser, in order: pages and their documents, actions, pointer motion, and\n * the browser's own end.\n *\n * Every event carries `at`, host monotonic milliseconds from the owning browser’s Effect `Clock`.\n * This clock also stamps screencast frames’ `receivedAt` and moments, so wall-clock corrections\n * cannot disturb their order. Compare stamps only within the same browser clock, not across hosts.\n * A page is named by its CDP target id, which stays the same across reconnects, and every URL is\n * reported without its userinfo or known secret parameters.\n *\n * @since 0.3.0\n */\nimport { Schema } from \"effect\";\n\nimport { Action as ActionValue, Name } from \"./Action.ts\";\nimport * as Motion from \"./Geometry.ts\";\n\n/** A page opened, and the page that opened it, as a link or `window.open` does, if one did. */\nexport class PageOpened extends Schema.TaggedClass<PageOpened>()(\"PageOpened\", {\n at: Schema.Finite,\n page: Schema.String,\n url: Schema.String,\n opener: Schema.optional(Schema.String),\n}) {}\n\n/**\n * The page closed (`page`), or crashed and was closed (`crashed`). A page lost with its browser\n * has no event of its own: `Disconnected` stands for all of them.\n */\nexport class PageClosed extends Schema.TaggedClass<PageClosed>()(\"PageClosed\", {\n at: Schema.Finite,\n page: Schema.String,\n cause: Schema.Literals([\"page\", \"crashed\"]),\n}) {}\n\n/**\n * A tab the site opened that the library could not track, as its registration failed with\n * `detail`. A tab that closed as it opened has no event.\n */\nexport class PageUntracked extends Schema.TaggedClass<PageUntracked>()(\"PageUntracked\", {\n at: Schema.Finite,\n url: Schema.String,\n detail: Schema.String,\n}) {}\n\n/**\n * The page's main frame moved to `url`: into a new document, or within the current one\n * (`sameDocument`), as `pushState` and fragment links do. Frames carry the document they followed.\n */\nexport class Navigated extends Schema.TaggedClass<Navigated>()(\"Navigated\", {\n at: Schema.Finite,\n page: Schema.String,\n url: Schema.String,\n /**\n * The page's documents counted from 0, the one it had when this browser began tracking it, one\n * more for each new document. The count belongs to the page within one `Browser` and starts at\n * 0 again on a new connection, so compare it only with the same page's in the same browser.\n */\n document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n sameDocument: Schema.Boolean,\n}) {}\n\n/** The page's document finished parsing (`domcontentloaded`) or loading (`load`). */\nexport class PageLoaded extends Schema.TaggedClass<PageLoaded>()(\"PageLoaded\", {\n at: Schema.Finite,\n page: Schema.String,\n state: Schema.Literals([\"domcontentloaded\", \"load\"]),\n}) {}\n\n/**\n * Why a browser was lost to its owner: its connection dropped (`connection`), its provider ended\n * its session, at or after the session's `expiresAt` (`session`), or its owner released it.\n */\nexport const DisconnectCause = Schema.Literals([\"connection\", \"session\", \"released\"]);\n\nexport type DisconnectCause = typeof DisconnectCause.Type;\n\n/** The browser was lost to its owner, with every page in it. It happens once. */\nexport class Disconnected extends Schema.TaggedClass<Disconnected>()(\"Disconnected\", {\n at: Schema.Finite,\n cause: DisconnectCause,\n}) {}\n\n/** The provider ends this browser's session at `expiresAt`, a wall-clock instant. */\nexport class SessionEnding extends Schema.TaggedClass<SessionEnding>()(\"SessionEnding\", {\n at: Schema.Finite,\n expiresAt: Schema.DateTimeUtc,\n}) {}\n\n/**\n * The words around a subject that say which one it is, each bound to it in the page rather than\n * read off nearby text later. In a table, `row` is the row's header or first cell with text and\n * `column` the header over it; elsewhere, `label` is the words just before it in its row, item,\n * group or block, at most 40 characters. `heading` is the nearest heading above it, left out for\n * what is pinned to the viewport. Row, column and heading are at most 60 characters.\n */\nexport const SubjectContext = Schema.Struct({\n row: Schema.optional(Schema.String),\n column: Schema.optional(Schema.String),\n label: Schema.optional(Schema.String),\n heading: Schema.optional(Schema.String),\n});\n\nexport type SubjectContext = typeof SubjectContext.Type;\n\n/**\n * What an input acted on, or what `Page.find` found, as the page named it then: its role (null\n * when it has none), its accessible name (empty when it has none), its lowercase tag and its\n * context. For a point, it is the control under the point, or else the element painted there.\n * Unlike a ref, it keeps its meaning after the page changes.\n */\nexport class Subject extends Schema.Class<Subject>(\"effect-browser/Subject\")({\n role: Schema.NullOr(Schema.String),\n name: Schema.String,\n tag: Schema.String,\n context: SubjectContext,\n}) {}\n\nconst Button = Schema.Literals([\"left\", \"right\", \"middle\"]);\n\n/** An element's box in viewport CSS pixels; it may lie partly or wholly outside the viewport. */\nexport const Box = Schema.Struct({\n ...Motion.Point.fields,\n width: Schema.Finite,\n height: Schema.Finite,\n});\n\nexport type Box = typeof Box.Type;\n\n/**\n * One page operation ended, including one its caller interrupted (`error: \"interrupted\"`).\n * `value` is the decoded call. `target` is its short rendering for observers.\n * `subject` is what an element or point action found there, and `to` where a drag ended; an\n * action that failed before finding its target has neither. Point actions carry the viewport\n * point they used. `correlation` is the id its caller gave it with `Page.correlate`, such as a\n * model's tool call id.\n */\nexport class Action extends Schema.TaggedClass<Action>()(\"Action\", {\n at: Schema.Finite,\n startedAt: Schema.Finite,\n page: Schema.String,\n name: Name,\n /** The decoded call, with secrets removed before publication. */\n value: ActionValue,\n /** The address when the action ended; absent in events recorded by older releases. */\n url: Schema.optional(Schema.String),\n correlation: Schema.optional(Schema.String),\n target: Schema.optional(Schema.String),\n subject: Schema.optional(Subject),\n to: Schema.optional(Subject),\n /** For an action at a point, the box of what it found there. */\n box: Schema.optional(Box),\n text: Schema.optional(Schema.String),\n x: Schema.optional(Motion.Point.fields.x),\n y: Schema.optional(Motion.Point.fields.y),\n ok: Schema.Boolean,\n dispatched: Schema.Boolean,\n error: Schema.optional(Schema.String),\n}) {}\n\nconst Sequence = Schema.Int.check(Schema.isGreaterThan(0));\n\n/** One whole glide, published before its first input. Offsets use the host monotonic clock. */\nexport class TrackPlanned extends Schema.TaggedClass<TrackPlanned>()(\"TrackPlanned\", {\n at: Schema.Finite,\n page: Schema.String,\n from: Motion.Point,\n samples: Motion.Plan,\n}) {}\n\n/**\n * The submitted prefix of a glide. `plan` is its TrackPlanned envelope sequence; `dispatched`\n * counts samples. `complete` means every sample was submitted, not acknowledged by the browser.\n * The terminal point clips a canceled plan so a compositor never draws its unrealized future.\n */\nexport class TrackPerformed extends Schema.TaggedClass<TrackPerformed>()(\"TrackPerformed\", {\n at: Schema.Finite,\n page: Schema.String,\n plan: Sequence,\n dispatched: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n ...Motion.Point.fields,\n complete: Schema.Boolean,\n}) {}\n\nexport class PointerPressed extends Schema.TaggedClass<PointerPressed>()(\"PointerPressed\", {\n at: Schema.Finite,\n page: Schema.String,\n ...Motion.Point.fields,\n button: Button,\n clickCount: Schema.Int.check(Schema.isGreaterThan(0)),\n}) {}\n\nexport class PointerReleased extends Schema.TaggedClass<PointerReleased>()(\"PointerReleased\", {\n at: Schema.Finite,\n page: Schema.String,\n ...Motion.Point.fields,\n button: Button,\n clickCount: Schema.Int.check(Schema.isGreaterThan(0)),\n}) {}\n\nexport class WheelScrolled extends Schema.TaggedClass<WheelScrolled>()(\"WheelScrolled\", {\n at: Schema.Finite,\n page: Schema.String,\n ...Motion.Point.fields,\n dx: Schema.Finite,\n dy: Schema.Finite,\n}) {}\n\nexport class KeyChanged extends Schema.TaggedClass<KeyChanged>()(\"KeyChanged\", {\n at: Schema.Finite,\n page: Schema.String,\n key: Schema.String,\n phase: Schema.Literals([\"down\", \"up\"]),\n}) {}\n\n/** Literal text insertion has no corresponding key events, including Unicode and newlines. */\nexport class TextInserted extends Schema.TaggedClass<TextInserted>()(\"TextInserted\", {\n at: Schema.Finite,\n page: Schema.String,\n text: Schema.String,\n}) {}\n\n/** The target's CSS cursor, obtained during target resolution without another browser call. */\nexport class CursorChanged extends Schema.TaggedClass<CursorChanged>()(\"CursorChanged\", {\n at: Schema.Finite,\n page: Schema.String,\n cursor: Schema.String,\n}) {}\n\nexport const TrackEvent = Schema.Union([\n TrackPlanned,\n TrackPerformed,\n PointerPressed,\n PointerReleased,\n WheelScrolled,\n KeyChanged,\n TextInserted,\n CursorChanged,\n]);\n\nexport type TrackEvent = typeof TrackEvent.Type;\n\n/**\n * A JavaScript dialog appeared; its completed answer, or a failed response: an alert or a leave-page prompt accepted, a\n * confirm or a prompt dismissed, as if its Cancel were pressed.\n */\nexport class DialogShown extends Schema.TaggedClass<DialogShown>()(\"DialogShown\", {\n at: Schema.Finite,\n page: Schema.String,\n kind: Schema.String,\n message: Schema.String,\n answer: Schema.Literals([\"accepted\", \"dismissed\", \"failed\"]),\n}) {}\n\n/** A context policy refused traffic; page is present only when its containing page was established.\n * Worker and out-of-process iframe requests may omit it while retaining proven context ownership. */\nexport class RequestRefused extends Schema.TaggedClass<RequestRefused>()(\"RequestRefused\", {\n at: Schema.Finite,\n page: Schema.optional(Schema.String),\n method: Schema.String,\n url: Schema.String,\n reason: Schema.String,\n /** Safe structured diagnosis; arbitrary policy error details and causes stay private. */\n failure: Schema.optional(\n Schema.Struct({\n reason: Schema.String,\n timeoutMillis: Schema.optional(Schema.Finite),\n }),\n ),\n}) {}\n\nexport const BrowserEvent = Schema.Union([\n RequestRefused,\n PageOpened,\n PageClosed,\n PageUntracked,\n Navigated,\n PageLoaded,\n Action,\n ...TrackEvent.members,\n DialogShown,\n Disconnected,\n SessionEnding,\n]);\n\nexport type BrowserEvent = typeof BrowserEvent.Type;\n\n/** A position in the browser's one replayable event history. Sequences begin at one. */\nexport class RecordedEvent extends Schema.Class<RecordedEvent>(\"effect-browser/RecordedEvent\")({\n sequence: Sequence,\n event: BrowserEvent,\n}) {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAa,aAAb,cAAgC,OAAO,YAAwB,CAAC,CAAC,cAAc;CAC7E,IAAI,OAAO;CACX,MAAM,OAAO;CACb,KAAK,OAAO;CACZ,QAAQ,OAAO,SAAS,OAAO,MAAM;AACvC,CAAC,CAAC,CAAC,CAAC;;;;;AAMJ,IAAa,aAAb,cAAgC,OAAO,YAAwB,CAAC,CAAC,cAAc;CAC7E,IAAI,OAAO;CACX,MAAM,OAAO;CACb,OAAO,OAAO,SAAS,CAAC,QAAQ,SAAS,CAAC;AAC5C,CAAC,CAAC,CAAC,CAAC;;;;;AAMJ,IAAa,gBAAb,cAAmC,OAAO,YAA2B,CAAC,CAAC,iBAAiB;CACtF,IAAI,OAAO;CACX,KAAK,OAAO;CACZ,QAAQ,OAAO;AACjB,CAAC,CAAC,CAAC,CAAC;;;;;AAMJ,IAAa,YAAb,cAA+B,OAAO,YAAuB,CAAC,CAAC,aAAa;CAC1E,IAAI,OAAO;CACX,MAAM,OAAO;CACb,KAAK,OAAO;;;;;;CAMZ,UAAU,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;CAC3D,cAAc,OAAO;AACvB,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,aAAb,cAAgC,OAAO,YAAwB,CAAC,CAAC,cAAc;CAC7E,IAAI,OAAO;CACX,MAAM,OAAO;CACb,OAAO,OAAO,SAAS,CAAC,oBAAoB,MAAM,CAAC;AACrD,CAAC,CAAC,CAAC,CAAC;;;;;AAMJ,MAAa,kBAAkB,OAAO,SAAS;CAAC;CAAc;CAAW;AAAU,CAAC;;AAKpF,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAA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mjs","names":["ActionValue","Motion.Point","Motion.Plan"],"sources":["../src/BrowserEvent.ts"],"sourcesContent":["/**\n * What happened in a browser, in order: pages and their documents, actions, pointer motion, and\n * the browser's own end.\n *\n * Every event carries `at`, host monotonic milliseconds from the owning browser’s Effect `Clock`.\n * This clock also stamps screencast frames’ `receivedAt` and moments, so wall-clock corrections\n * cannot disturb their order. Compare stamps only within the same browser clock, not across hosts.\n * A page is named by its CDP target id, which stays the same across reconnects, and every URL is\n * reported without its userinfo or known secret parameters.\n *\n * @since 0.3.0\n */\nimport { Schema } from \"effect\";\n\nimport { Action as ActionValue, Name } from \"./Action.ts\";\nimport * as Motion from \"./Geometry.ts\";\n\n/** A page opened, and the page that opened it, as a link or `window.open` does, if one did. */\nexport class PageOpened extends Schema.TaggedClass<PageOpened>()(\"PageOpened\", {\n at: Schema.Finite,\n page: Schema.String,\n url: Schema.String,\n opener: Schema.optional(Schema.String),\n}) {}\n\n/**\n * The page closed (`page`), or crashed and was closed (`crashed`). A page lost with its browser\n * has no event of its own: `Disconnected` stands for all of them.\n */\nexport class PageClosed extends Schema.TaggedClass<PageClosed>()(\"PageClosed\", {\n at: Schema.Finite,\n page: Schema.String,\n cause: Schema.Literals([\"page\", \"crashed\"]),\n}) {}\n\n/**\n * A tab the site opened that the library could not track, as its registration failed with\n * `detail`. A tab that closed as it opened has no event.\n */\nexport class PageUntracked extends Schema.TaggedClass<PageUntracked>()(\"PageUntracked\", {\n at: Schema.Finite,\n url: Schema.String,\n detail: Schema.String,\n}) {}\n\n/**\n * The page's main frame moved to `url`: into a new document, or within the current one\n * (`sameDocument`), as `pushState` and fragment links do. Frames carry the document they followed.\n */\nexport class Navigated extends Schema.TaggedClass<Navigated>()(\"Navigated\", {\n at: Schema.Finite,\n page: Schema.String,\n url: Schema.String,\n /**\n * The page's documents counted from 0, the one it had when this browser began tracking it, one\n * more for each new document. The count belongs to the page within one `Browser` and starts at\n * 0 again on a new connection, so compare it only with the same page's in the same browser.\n */\n document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n sameDocument: Schema.Boolean,\n}) {}\n\n/** The page's document finished parsing (`domcontentloaded`) or loading (`load`). */\nexport class PageLoaded extends Schema.TaggedClass<PageLoaded>()(\"PageLoaded\", {\n at: Schema.Finite,\n page: Schema.String,\n state: Schema.Literals([\"domcontentloaded\", \"load\"]),\n}) {}\n\n/**\n * Why a browser was lost to its owner: its connection dropped (`connection`), its provider ended\n * its session, at or after the session's `expiresAt` (`session`), or its owner released it.\n */\nexport const DisconnectCause = Schema.Literals([\"connection\", \"session\", \"released\"]);\n\nexport type DisconnectCause = typeof DisconnectCause.Type;\n\n/** The browser was lost to its owner, with every page in it. It happens once. */\nexport class Disconnected extends Schema.TaggedClass<Disconnected>()(\"Disconnected\", {\n at: Schema.Finite,\n cause: DisconnectCause,\n}) {}\n\n/** The provider ends this browser's session at `expiresAt`, a wall-clock instant. */\nexport class SessionEnding extends Schema.TaggedClass<SessionEnding>()(\"SessionEnding\", {\n at: Schema.Finite,\n expiresAt: Schema.DateTimeUtc,\n}) {}\n\n/**\n * The words around a subject that say which one it is, each bound to it in the page rather than\n * read off nearby text later. In a table, `row` is the row's header or first cell with text and\n * `column` the header over it; elsewhere, `label` is the words just before it in its row, item,\n * group or block, at most 40 characters. `heading` is the nearest heading above it, left out for\n * what is pinned to the viewport. Row, column and heading are at most 60 characters.\n */\nexport const SubjectContext = Schema.Struct({\n row: Schema.optional(Schema.String),\n column: Schema.optional(Schema.String),\n label: Schema.optional(Schema.String),\n heading: Schema.optional(Schema.String),\n});\n\nexport type SubjectContext = typeof SubjectContext.Type;\n\n/**\n * What an input acted on, or what `Page.find` found, as the page named it then: its role (null\n * when it has none), its accessible name (empty when it has none), its lowercase tag and its\n * context. For a point, it is the control under the point, or else the element painted there.\n * Unlike a ref, it keeps its meaning after the page changes.\n */\nexport class Subject extends Schema.Class<Subject>(\"effect-browser/Subject\")({\n role: Schema.NullOr(Schema.String),\n name: Schema.String,\n tag: Schema.String,\n context: SubjectContext,\n}) {}\n\nconst Button = Schema.Literals([\"left\", \"right\", \"middle\"]);\n\n/** An element's box in viewport CSS pixels; it may lie partly or wholly outside the viewport. */\nexport const Box = Schema.Struct({\n ...Motion.Point.fields,\n width: Schema.Finite,\n height: Schema.Finite,\n});\n\nexport type Box = typeof Box.Type;\n\n/**\n * One page operation ended, including one its caller interrupted (`error: \"interrupted\"`).\n * `value` is the decoded call. `target` is its short rendering for observers.\n * `subject` is what an element or point action found there, and `to` where a drag ended; an\n * action that failed before finding its target has neither. Point actions carry the viewport\n * point they used. `correlation` is the id its caller gave it with `Page.correlate`, such as a\n * model's tool call id.\n */\nexport class Action extends Schema.TaggedClass<Action>()(\"Action\", {\n at: Schema.Finite,\n startedAt: Schema.Finite,\n page: Schema.String,\n name: Name,\n /** The decoded call, with secrets removed before publication. */\n value: ActionValue,\n /** The address when the action ended; absent in events recorded by older releases. */\n url: Schema.optional(Schema.String),\n correlation: Schema.optional(Schema.String),\n target: Schema.optional(Schema.String),\n subject: Schema.optional(Subject),\n to: Schema.optional(Subject),\n /** For an action at a point, the box of what it found there. */\n box: Schema.optional(Box),\n text: Schema.optional(Schema.String),\n x: Schema.optional(Motion.Point.fields.x),\n y: Schema.optional(Motion.Point.fields.y),\n ok: Schema.Boolean,\n dispatched: Schema.Boolean,\n error: Schema.optional(Schema.String),\n}) {}\n\nconst Sequence = Schema.Int.check(Schema.isGreaterThan(0));\n\n/**\n * An action found its target and is about to send input there: published once, before its pointer\n * travels to the target, with what its `Action` will record of it. A glide that only scrolls the\n * target into view comes before. `x` and `y` are where the pointer goes, in viewport CSS pixels; for\n * a drag, its start. Input with no pointer travel, such as keys or typing into the focused field,\n * announces nothing.\n */\nexport class ActionAnnounced extends Schema.TaggedClass<ActionAnnounced>()(\"ActionAnnounced\", {\n at: Schema.Finite,\n page: Schema.String,\n name: Name,\n correlation: Schema.optional(Schema.String),\n subject: Schema.optional(Subject),\n to: Schema.optional(Subject),\n box: Schema.optional(Box),\n ...Motion.Point.fields,\n}) {}\n\n/** One whole glide, published before its first input. Offsets use the host monotonic clock. */\nexport class TrackPlanned extends Schema.TaggedClass<TrackPlanned>()(\"TrackPlanned\", {\n at: Schema.Finite,\n page: Schema.String,\n from: Motion.Point,\n samples: Motion.Plan,\n}) {}\n\n/**\n * The submitted prefix of a glide. `plan` is its TrackPlanned envelope sequence; `dispatched`\n * counts samples. `complete` means every sample was submitted, not acknowledged by the browser.\n * The terminal point clips a canceled plan so a compositor never draws its unrealized future.\n */\nexport class TrackPerformed extends Schema.TaggedClass<TrackPerformed>()(\"TrackPerformed\", {\n at: Schema.Finite,\n page: Schema.String,\n plan: Sequence,\n dispatched: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n ...Motion.Point.fields,\n complete: Schema.Boolean,\n}) {}\n\nexport class PointerPressed extends Schema.TaggedClass<PointerPressed>()(\"PointerPressed\", {\n at: Schema.Finite,\n page: Schema.String,\n ...Motion.Point.fields,\n button: Button,\n clickCount: Schema.Int.check(Schema.isGreaterThan(0)),\n}) {}\n\nexport class PointerReleased extends Schema.TaggedClass<PointerReleased>()(\"PointerReleased\", {\n at: Schema.Finite,\n page: Schema.String,\n ...Motion.Point.fields,\n button: Button,\n clickCount: Schema.Int.check(Schema.isGreaterThan(0)),\n}) {}\n\nexport class WheelScrolled extends Schema.TaggedClass<WheelScrolled>()(\"WheelScrolled\", {\n at: Schema.Finite,\n page: Schema.String,\n ...Motion.Point.fields,\n dx: Schema.Finite,\n dy: Schema.Finite,\n}) {}\n\nexport class KeyChanged extends Schema.TaggedClass<KeyChanged>()(\"KeyChanged\", {\n at: Schema.Finite,\n page: Schema.String,\n key: Schema.String,\n phase: Schema.Literals([\"down\", \"up\"]),\n}) {}\n\n/** Literal text insertion has no corresponding key events, including Unicode and newlines. */\nexport class TextInserted extends Schema.TaggedClass<TextInserted>()(\"TextInserted\", {\n at: Schema.Finite,\n page: Schema.String,\n text: Schema.String,\n}) {}\n\n/** The target's CSS cursor, obtained during target resolution without another browser call. */\nexport class CursorChanged extends Schema.TaggedClass<CursorChanged>()(\"CursorChanged\", {\n at: Schema.Finite,\n page: Schema.String,\n cursor: Schema.String,\n}) {}\n\nexport const TrackEvent = Schema.Union([\n ActionAnnounced,\n TrackPlanned,\n TrackPerformed,\n PointerPressed,\n PointerReleased,\n WheelScrolled,\n KeyChanged,\n TextInserted,\n CursorChanged,\n]);\n\nexport type TrackEvent = typeof TrackEvent.Type;\n\n/**\n * A JavaScript dialog appeared; its completed answer, or a failed response: an alert or a leave-page prompt accepted, a\n * confirm or a prompt dismissed, as if its Cancel were pressed.\n */\nexport class DialogShown extends Schema.TaggedClass<DialogShown>()(\"DialogShown\", {\n at: Schema.Finite,\n page: Schema.String,\n kind: Schema.String,\n message: Schema.String,\n answer: Schema.Literals([\"accepted\", \"dismissed\", \"failed\"]),\n}) {}\n\n/** A context policy refused traffic; page is present only when its containing page was established.\n * Worker and out-of-process iframe requests may omit it while retaining proven context ownership. */\nexport class RequestRefused extends Schema.TaggedClass<RequestRefused>()(\"RequestRefused\", {\n at: Schema.Finite,\n page: Schema.optional(Schema.String),\n method: Schema.String,\n url: Schema.String,\n reason: Schema.String,\n /** Safe structured diagnosis; arbitrary policy error details and causes stay private. */\n failure: Schema.optional(\n Schema.Struct({\n reason: Schema.String,\n timeoutMillis: Schema.optional(Schema.Finite),\n }),\n ),\n}) {}\n\nexport const BrowserEvent = Schema.Union([\n RequestRefused,\n PageOpened,\n PageClosed,\n PageUntracked,\n Navigated,\n PageLoaded,\n Action,\n ...TrackEvent.members,\n DialogShown,\n Disconnected,\n SessionEnding,\n]);\n\nexport type BrowserEvent = typeof BrowserEvent.Type;\n\n/** A position in the browser's one replayable event history. Sequences begin at one. */\nexport class RecordedEvent extends Schema.Class<RecordedEvent>(\"effect-browser/RecordedEvent\")({\n sequence: Sequence,\n event: BrowserEvent,\n}) {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IA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C;CAC7F,UAAU;CACV,OAAO;AACT,CAAC,CAAC,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { b as Subject } from "./BrowserEvent-lLqJ3GJS.mjs";
1
+ import { x as Subject } from "./BrowserEvent-C2p-NwuU.mjs";
2
2
  import { Schema } from "effect";
3
3
  declare namespace Change_d_exports {
4
4
  export { Change, Changes, Kind };
@@ -16,6 +16,17 @@ declare const Change_base: Schema.Class<Change, Schema.Struct<{
16
16
  * changed, so its name is empty unless something else names it, as a field's label does.
17
17
  */
18
18
  readonly subject: typeof Subject;
19
+ /**
20
+ * Where it is as the changes are read, in viewport CSS pixels, unrounded; for what went, where
21
+ * what it sat in is. A caller can frame what an input did beside the input. Absent for the title
22
+ * and for what is drawn nowhere, as what was hidden is.
23
+ */
24
+ readonly box: Schema.optional<Schema.Struct<{
25
+ readonly x: Schema.Finite;
26
+ readonly y: Schema.Finite;
27
+ readonly width: Schema.Finite;
28
+ readonly height: Schema.Finite;
29
+ }>>;
19
30
  /** When it first changed in the window, in host monotonic milliseconds on the browser's clock. */
20
31
  readonly startedAt: Schema.Finite;
21
32
  /** When it last changed in the window. */
@@ -66,4 +77,4 @@ declare const Changes_base: Schema.Class<Changes, Schema.Struct<{
66
77
  declare class Changes extends Changes_base {}
67
78
  //#endregion
68
79
  export { Kind as i, Change_d_exports as n, Changes as r, Change as t };
69
- //# sourceMappingURL=Change-Ba7INmay.d.mts.map
80
+ //# sourceMappingURL=Change-CxT1mp2e.d.mts.map
package/dist/Change.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { i as Kind, r as Changes, t as Change } from "./Change-Ba7INmay.mjs";
1
+ import { i as Kind, r as Changes, t as Change } from "./Change-CxT1mp2e.mjs";
2
2
  export { Change, Changes, Kind };
package/dist/Change.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { Subject } from "./BrowserEvent.mjs";
2
+ import { Box, Subject } from "./BrowserEvent.mjs";
3
3
  import { Schema } from "effect";
4
4
  //#region src/Change.ts
5
5
  /**
@@ -44,6 +44,12 @@ var Change = class extends Schema.Class("effect-browser/Change")({
44
44
  * changed, so its name is empty unless something else names it, as a field's label does.
45
45
  */
46
46
  subject: Subject,
47
+ /**
48
+ * Where it is as the changes are read, in viewport CSS pixels, unrounded; for what went, where
49
+ * what it sat in is. A caller can frame what an input did beside the input. Absent for the title
50
+ * and for what is drawn nowhere, as what was hidden is.
51
+ */
52
+ box: Schema.optional(Box),
47
53
  /** When it first changed in the window, in host monotonic milliseconds on the browser's clock. */
48
54
  startedAt: Schema.Finite,
49
55
  /** When it last changed in the window. */
@@ -1 +1 @@
1
- {"version":3,"file":"Change.mjs","names":[],"sources":["../src/Change.ts"],"sourcesContent":["/**\n * What visibly changed on a page over a window, element by element: text that changed, appeared,\n * disappeared or came and went, a field's value, and the document's title. A change says what was\n * shown at the window's start and at its end, how often it changed between, where it is on the\n * page, and the input it followed, where it was that input's doing.\n *\n * `Page.changes` reads it. A page records once something reads its changes: from then, and from the\n * start of each later document once it is parsed, until nobody has read it for two minutes. A page\n * nobody reads records nothing. The record keeps 256 elements, each with its last 32 changes, for a\n * minute; an element that keeps changing gives way before news, and what gives way is counted in\n * `dropped`, with `from` moved past it. A change is told when it was in view as the page rendered\n * it, its style showing it, so one scrolled away later is still told, and something removed or\n * hidden only if it was in view before. What the record cannot see: pictures, a canvas, frames,\n * shadow roots and SVG; a value a script sets; and a class that reveals an element the record has\n * not seen before, such as a toast already on the page, though its later changes are seen.\n *\n * @since 0.3.0\n */\nimport { Schema } from \"effect\";\n\nimport { Subject } from \"./BrowserEvent.ts\";\n\n/**\n * `text` changed; `appeared` and `disappeared`, whether added or removed or shown or hidden;\n * `brief`, appeared and gone again by the window's end; `value`, a field's; `title`, the document's.\n */\nexport const Kind = Schema.Literals([\"text\", \"appeared\", \"disappeared\", \"brief\", \"value\", \"title\"]);\n\nexport type Kind = typeof Kind.Type;\n\nexport class Change extends Schema.Class<Change>(\"effect-browser/Change\")({\n kind: Kind,\n /**\n * What changed, as the page names it now, or where it was for what went. Its own words are what\n * changed, so its name is empty unless something else names it, as a field's label does.\n */\n subject: Subject,\n /** When it first changed in the window, in host monotonic milliseconds on the browser's clock. */\n startedAt: Schema.Finite,\n /** When it last changed in the window. */\n at: Schema.Finite,\n /**\n * What it showed at the window's start; absent for what appeared and where the record let that go.\n * What disappeared says what it showed as it went. A field's value reads `••••` unless unmasked.\n */\n before: Schema.optional(Schema.String),\n /** What it showed at the window's end; absent for what disappeared. What came and went says what it showed. */\n after: Schema.optional(Schema.String),\n /** How many times what it showed changed in the window. */\n count: Schema.Int.check(Schema.isGreaterThan(0)),\n /** For a number that changed more than once, its lowest and highest, as shown. */\n lowest: Schema.optional(Schema.String),\n highest: Schema.optional(Schema.String),\n /** When it last changed before the window, as far back as the record keeps: in flux, not news. */\n earlier: Schema.optional(Schema.Finite),\n /**\n * When the trusted input it followed reached the page, where it was that input's doing. It was not\n * in flux: in the 10 s before the input it had not changed, and nothing had come into or left what\n * it sits in, so a ticker's tick or a feed's line is not. Then it changed within 3 s inside what\n * the input acted on or its row, form, dialog or controlled element; or, elsewhere, within 500 ms\n * of an input on a page where nothing had changed in the 2 s before, as a menu a portal puts at\n * the end of the page does. What holds the input's target, as a menu holds its item, does not\n * count against it. The page's `Action` that sent it holds that time.\n */\n cause: Schema.optional(Schema.Finite),\n}) {}\n\nexport class Changes extends Schema.Class<Changes>(\"effect-browser/Changes\")({\n /** The page's document these changes belong to, as `Navigated` counts them. */\n document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n /** Where the record is whole: before it, changes may be missing. */\n from: Schema.Finite,\n /** Where the window ends: its `until`, or when the page was read. */\n until: Schema.Finite,\n /**\n * Where the window ends on the page's own clock. Give these changes as the next read's `since` and\n * the two windows meet exactly, whatever the clock mapping does meanwhile.\n */\n cursor: Schema.Finite,\n /** Changes in the window the record let go, at least; 0 when it kept them all. */\n dropped: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n /** Oldest first, by when each began to change. */\n changes: Schema.Array(Change),\n}) {}\n\n/** A change in words for a model, such as `\"$61,240\" became \"$62,010\" (row \"Bitcoin\", column \"Price\")`. */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,OAAO,OAAO,SAAS;CAAC;CAAQ;CAAY;CAAe;CAAS;CAAS;AAAO,CAAC;AAIlG,IAAa,SAAb,cAA4B,OAAO,MAAc,uBAAuB,CAAC,CAAC;CACxE,MAAM;;;;;CAKN,SAAS;;CAET,WAAW,OAAO;;CAElB,IAAI,OAAO;;;;;CAKX,QAAQ,OAAO,SAAS,OAAO,MAAM;;CAErC,OAAO,OAAO,SAAS,OAAO,MAAM;;CAEpC,OAAO,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC;;CAE/C,QAAQ,OAAO,SAAS,OAAO,MAAM;CACrC,SAAS,OAAO,SAAS,OAAO,MAAM;;CAEtC,SAAS,OAAO,SAAS,OAAO,MAAM;;;;;;;;;;CAUtC,OAAO,OAAO,SAAS,OAAO,MAAM;AACtC,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,UAAb,cAA6B,OAAO,MAAe,wBAAwB,CAAC,CAAC;;CAE3E,UAAU,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;CAE3D,MAAM,OAAO;;CAEb,OAAO,OAAO;;;;;CAKd,QAAQ,OAAO;;CAEf,SAAS,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;CAE1D,SAAS,OAAO,MAAM,MAAM;AAC9B,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"Change.mjs","names":[],"sources":["../src/Change.ts"],"sourcesContent":["/**\n * What visibly changed on a page over a window, element by element: text that changed, appeared,\n * disappeared or came and went, a field's value, and the document's title. A change says what was\n * shown at the window's start and at its end, how often it changed between, where it is on the\n * page, and the input it followed, where it was that input's doing.\n *\n * `Page.changes` reads it. A page records once something reads its changes: from then, and from the\n * start of each later document once it is parsed, until nobody has read it for two minutes. A page\n * nobody reads records nothing. The record keeps 256 elements, each with its last 32 changes, for a\n * minute; an element that keeps changing gives way before news, and what gives way is counted in\n * `dropped`, with `from` moved past it. A change is told when it was in view as the page rendered\n * it, its style showing it, so one scrolled away later is still told, and something removed or\n * hidden only if it was in view before. What the record cannot see: pictures, a canvas, frames,\n * shadow roots and SVG; a value a script sets; and a class that reveals an element the record has\n * not seen before, such as a toast already on the page, though its later changes are seen.\n *\n * @since 0.3.0\n */\nimport { Schema } from \"effect\";\n\nimport { Box, Subject } from \"./BrowserEvent.ts\";\n\n/**\n * `text` changed; `appeared` and `disappeared`, whether added or removed or shown or hidden;\n * `brief`, appeared and gone again by the window's end; `value`, a field's; `title`, the document's.\n */\nexport const Kind = Schema.Literals([\"text\", \"appeared\", \"disappeared\", \"brief\", \"value\", \"title\"]);\n\nexport type Kind = typeof Kind.Type;\n\nexport class Change extends Schema.Class<Change>(\"effect-browser/Change\")({\n kind: Kind,\n /**\n * What changed, as the page names it now, or where it was for what went. Its own words are what\n * changed, so its name is empty unless something else names it, as a field's label does.\n */\n subject: Subject,\n /**\n * Where it is as the changes are read, in viewport CSS pixels, unrounded; for what went, where\n * what it sat in is. A caller can frame what an input did beside the input. Absent for the title\n * and for what is drawn nowhere, as what was hidden is.\n */\n box: Schema.optional(Box),\n /** When it first changed in the window, in host monotonic milliseconds on the browser's clock. */\n startedAt: Schema.Finite,\n /** When it last changed in the window. */\n at: Schema.Finite,\n /**\n * What it showed at the window's start; absent for what appeared and where the record let that go.\n * What disappeared says what it showed as it went. A field's value reads `••••` unless unmasked.\n */\n before: Schema.optional(Schema.String),\n /** What it showed at the window's end; absent for what disappeared. What came and went says what it showed. */\n after: Schema.optional(Schema.String),\n /** How many times what it showed changed in the window. */\n count: Schema.Int.check(Schema.isGreaterThan(0)),\n /** For a number that changed more than once, its lowest and highest, as shown. */\n lowest: Schema.optional(Schema.String),\n highest: Schema.optional(Schema.String),\n /** When it last changed before the window, as far back as the record keeps: in flux, not news. */\n earlier: Schema.optional(Schema.Finite),\n /**\n * When the trusted input it followed reached the page, where it was that input's doing. It was not\n * in flux: in the 10 s before the input it had not changed, and nothing had come into or left what\n * it sits in, so a ticker's tick or a feed's line is not. Then it changed within 3 s inside what\n * the input acted on or its row, form, dialog or controlled element; or, elsewhere, within 500 ms\n * of an input on a page where nothing had changed in the 2 s before, as a menu a portal puts at\n * the end of the page does. What holds the input's target, as a menu holds its item, does not\n * count against it. The page's `Action` that sent it holds that time.\n */\n cause: Schema.optional(Schema.Finite),\n}) {}\n\nexport class Changes extends Schema.Class<Changes>(\"effect-browser/Changes\")({\n /** The page's document these changes belong to, as `Navigated` counts them. */\n document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n /** Where the record is whole: before it, changes may be missing. */\n from: Schema.Finite,\n /** Where the window ends: its `until`, or when the page was read. */\n until: Schema.Finite,\n /**\n * Where the window ends on the page's own clock. Give these changes as the next read's `since` and\n * the two windows meet exactly, whatever the clock mapping does meanwhile.\n */\n cursor: Schema.Finite,\n /** Changes in the window the record let go, at least; 0 when it kept them all. */\n dropped: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n /** Oldest first, by when each began to change. */\n changes: Schema.Array(Change),\n}) {}\n\n/** A change in words for a model, such as `\"$61,240\" became \"$62,010\" (row \"Bitcoin\", column \"Price\")`. */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,OAAO,OAAO,SAAS;CAAC;CAAQ;CAAY;CAAe;CAAS;CAAS;AAAO,CAAC;AAIlG,IAAa,SAAb,cAA4B,OAAO,MAAc,uBAAuB,CAAC,CAAC;CACxE,MAAM;;;;;CAKN,SAAS;;;;;;CAMT,KAAK,OAAO,SAAS,GAAG;;CAExB,WAAW,OAAO;;CAElB,IAAI,OAAO;;;;;CAKX,QAAQ,OAAO,SAAS,OAAO,MAAM;;CAErC,OAAO,OAAO,SAAS,OAAO,MAAM;;CAEpC,OAAO,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC;;CAE/C,QAAQ,OAAO,SAAS,OAAO,MAAM;CACrC,SAAS,OAAO,SAAS,OAAO,MAAM;;CAEtC,SAAS,OAAO,SAAS,OAAO,MAAM;;;;;;;;;;CAUtC,OAAO,OAAO,SAAS,OAAO,MAAM;AACtC,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,UAAb,cAA6B,OAAO,MAAe,wBAAwB,CAAC,CAAC;;CAE3E,UAAU,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;CAE3D,MAAM,OAAO;;CAEb,OAAO,OAAO;;;;;CAKd,QAAQ,OAAO;;CAEf,SAAS,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;CAE1D,SAAS,OAAO,MAAM,MAAM;AAC9B,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { Clock, Effect, Option } from "effect";
2
+ declare namespace Clock_d_exports {
3
+ export { Estimate, Mapping, Probe, estimate, mapping, monotonicMillis, supersedes, toBrowserSeconds, toHostTime, uncertaintyAt };
4
+ }
5
+ /** Read the captured owner's clock, including from native callbacks, without changing its origin. */
6
+ declare const monotonicMillis: (clock: Clock.Clock) => number;
7
+ interface Probe {
8
+ readonly hostStart: number;
9
+ readonly hostEnd: number;
10
+ readonly browserTime: number;
11
+ }
12
+ interface Estimate {
13
+ /** Browser epoch milliseconds minus the owner's host monotonic milliseconds. */
14
+ readonly offsetMillis: number;
15
+ /** Either transport direction can own the entire round trip; symmetry is not assumed. */
16
+ readonly uncertaintyMillis: number;
17
+ readonly roundTripMillis: number;
18
+ readonly sampledAt: number;
19
+ }
20
+ /** The fastest complete probe limits uncertainty without mistaking transit delay for clock offset. */
21
+ declare const estimate: (probes: ReadonlyArray<Probe>) => Option.Option<Estimate>;
22
+ /** An estimate's uncertainty at `hostTime`, wider the further that is from when it was sampled. */
23
+ declare const uncertaintyAt: (estimate: Estimate, hostTime: number) => number;
24
+ /**
25
+ * The browser's one epoch mapping, shared by its pages, input runs and capture generations. It is
26
+ * measured on first need, by the first capture, never ahead of it.
27
+ */
28
+ interface Mapping {
29
+ /** The latest estimate, without measuring: input uses it, and never waits for one. */
30
+ readonly latest: () => Estimate | undefined;
31
+ /** The latest estimate, measured through `measure` only while the browser has none. */
32
+ readonly current: <E>(measure: Effect.Effect<Estimate, E>) => Effect.Effect<Estimate, E>;
33
+ /**
34
+ * Measure again once ten seconds have passed since the latest measurement began. A failed
35
+ * measurement keeps the estimate, which keeps widening with its age.
36
+ */
37
+ readonly renew: <E>(measure: Effect.Effect<Estimate, E>) => Effect.Effect<void>;
38
+ }
39
+ /**
40
+ * Whether a new measurement should replace the current estimate. Each interval contains the true
41
+ * offset, so overlapping intervals agree and the narrower one is kept, the current one widened by
42
+ * its age: a probe delayed behind a busy page cannot widen every tab's stamps. A disjoint
43
+ * measurement means the clocks moved (a wall clock step, or drift between a remote browser and
44
+ * this host), so the newer evidence wins.
45
+ */
46
+ declare const supersedes: (next: Estimate, current: Estimate) => boolean;
47
+ /**
48
+ * Every renderer of a browser reads the same host wall clock, so the offset belongs to the
49
+ * browser rather than a page. A busy page cannot fail work that an earlier estimate can serve.
50
+ */
51
+ declare const mapping: (now: () => number) => Mapping;
52
+ declare const toHostTime: (calibration: Estimate, browserEpochMillis: number) => number;
53
+ /** CDP input timestamps use seconds, unlike browser frame timestamps and the owner's clock. */
54
+ declare const toBrowserSeconds: (calibration: Estimate, hostMillis: number) => number;
55
+ //#endregion
56
+ export { estimate as a, supersedes as c, uncertaintyAt as d, Probe as i, toBrowserSeconds as l, Estimate as n, mapping as o, Mapping as r, monotonicMillis as s, Clock_d_exports as t, toHostTime as u };
57
+ //# sourceMappingURL=Clock-Du5nP-nK.d.mts.map
package/dist/Clock.d.mts CHANGED
@@ -1,57 +1,2 @@
1
- import { Clock, Effect, Option } from "effect";
2
- declare namespace Clock_d_exports {
3
- export { Estimate, Mapping, Probe, estimate, mapping, monotonicMillis, supersedes, toBrowserSeconds, toHostTime, uncertaintyAt };
4
- }
5
- /** Read the captured owner's clock, including from native callbacks, without changing its origin. */
6
- export declare const monotonicMillis: (clock: Clock.Clock) => number;
7
- export interface Probe {
8
- readonly hostStart: number;
9
- readonly hostEnd: number;
10
- readonly browserTime: number;
11
- }
12
- export interface Estimate {
13
- /** Browser epoch milliseconds minus the owner's host monotonic milliseconds. */
14
- readonly offsetMillis: number;
15
- /** Either transport direction can own the entire round trip; symmetry is not assumed. */
16
- readonly uncertaintyMillis: number;
17
- readonly roundTripMillis: number;
18
- readonly sampledAt: number;
19
- }
20
- /** The fastest complete probe limits uncertainty without mistaking transit delay for clock offset. */
21
- export declare const estimate: (probes: ReadonlyArray<Probe>) => Option.Option<Estimate>;
22
- /** An estimate's uncertainty at `hostTime`, wider the further that is from when it was sampled. */
23
- export declare const uncertaintyAt: (estimate: Estimate, hostTime: number) => number;
24
- /**
25
- * The browser's one epoch mapping, shared by its pages, input runs and capture generations. It is
26
- * measured on first need, by the first capture, never ahead of it.
27
- */
28
- export interface Mapping {
29
- /** The latest estimate, without measuring: input uses it, and never waits for one. */
30
- readonly latest: () => Estimate | undefined;
31
- /** The latest estimate, measured through `measure` only while the browser has none. */
32
- readonly current: <E>(measure: Effect.Effect<Estimate, E>) => Effect.Effect<Estimate, E>;
33
- /**
34
- * Measure again once ten seconds have passed since the latest measurement began. A failed
35
- * measurement keeps the estimate, which keeps widening with its age.
36
- */
37
- readonly renew: <E>(measure: Effect.Effect<Estimate, E>) => Effect.Effect<void>;
38
- }
39
- /**
40
- * Whether a new measurement should replace the current estimate. Each interval contains the true
41
- * offset, so overlapping intervals agree and the narrower one is kept, the current one widened by
42
- * its age: a probe delayed behind a busy page cannot widen every tab's stamps. A disjoint
43
- * measurement means the clocks moved (a wall clock step, or drift between a remote browser and
44
- * this host), so the newer evidence wins.
45
- */
46
- export declare const supersedes: (next: Estimate, current: Estimate) => boolean;
47
- /**
48
- * Every renderer of a browser reads the same host wall clock, so the offset belongs to the
49
- * browser rather than a page. A busy page cannot fail work that an earlier estimate can serve.
50
- */
51
- export declare const mapping: (now: () => number) => Mapping;
52
- export declare const toHostTime: (calibration: Estimate, browserEpochMillis: number) => number;
53
- /** CDP input timestamps use seconds, unlike browser frame timestamps and the owner's clock. */
54
- export declare const toBrowserSeconds: (calibration: Estimate, hostMillis: number) => number;
55
- //#endregion
56
- export { Clock_d_exports as t };
57
- //# sourceMappingURL=Clock.d.mts.map
1
+ import { a as estimate, c as supersedes, d as uncertaintyAt, i as Probe, l as toBrowserSeconds, n as Estimate, o as mapping, r as Mapping, s as monotonicMillis, u as toHostTime } from "./Clock-Du5nP-nK.mjs";
2
+ export { Estimate, Mapping, Probe, estimate, mapping, monotonicMillis, supersedes, toBrowserSeconds, toHostTime, uncertaintyAt };
@@ -0,0 +1,2 @@
1
+ import { B as Rehearsal, F as Layout, H as place, L as Pick, R as Picks, U as rehearse, V as Word, z as Place } from "./Page-CLzh5E9w.mjs";
2
+ export { Layout, Pick, Picks, Place, Rehearsal, Word, place, rehearse };
@@ -0,0 +1,81 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Point } from "./Geometry.mjs";
3
+ import { Box, Subject } from "./BrowserEvent.mjs";
4
+ import { Effect, Exit, Schema } from "effect";
5
+ //#region src/Layout.ts
6
+ /**
7
+ * Where things are on a page, as data: a box for each thing a caller picks, in the viewport and in
8
+ * the document, unrounded, with the boxes of words inside it, and the viewport, scroll and scale
9
+ * read with them in one call. A rehearsal measures things that exist only after an interaction,
10
+ * and puts the page back.
11
+ *
12
+ * @since 0.3.0
13
+ */
14
+ var Layout_exports = /* @__PURE__ */ __exportAll({
15
+ Layout: () => Layout,
16
+ Place: () => Place,
17
+ Word: () => Word,
18
+ place: () => place,
19
+ rehearse: () => rehearse
20
+ });
21
+ /** A match of a pick's `words`, by its box in the viewport and in the document. */
22
+ var Word = class extends Schema.Class("effect-browser/Word")({
23
+ text: Schema.String,
24
+ box: Box,
25
+ page: Box
26
+ }) {};
27
+ /** What one pick found. */
28
+ var Place = class extends Schema.Class("effect-browser/Place")({
29
+ /** The pick's own name. */
30
+ id: Schema.String,
31
+ ref: Schema.String,
32
+ subject: Subject,
33
+ /** Its box in viewport CSS pixels, unrounded, as an `at` point or a frame's pixels place it. */
34
+ box: Box,
35
+ /** The same box in document CSS pixels: `box` moved by the scroll it was read at. */
36
+ page: Box,
37
+ /** It keeps its place in the viewport as the page scrolls, so `page` holds only at this scroll. */
38
+ fixed: Schema.Boolean,
39
+ /** The matches of the pick's `words`, when it gave them, in text order. */
40
+ words: Schema.optional(Schema.Array(Word))
41
+ }) {};
42
+ /** A page's picked places, and the viewport, scroll and scale they were read at. */
43
+ var Layout = class extends Schema.Class("effect-browser/Layout")({
44
+ page: Schema.String,
45
+ /** The tracking connection that owns the document counter. */
46
+ connection: Schema.String,
47
+ /** The document it read, as `Navigated` counts them. */
48
+ document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
49
+ url: Schema.String,
50
+ /** Host monotonic milliseconds, when it was read. */
51
+ at: Schema.Finite,
52
+ /** The viewport's size in CSS pixels. */
53
+ viewport: Schema.Struct({
54
+ width: Schema.Finite,
55
+ height: Schema.Finite
56
+ }),
57
+ /** How far the document was scrolled, in CSS pixels. */
58
+ scroll: Point,
59
+ /** Device pixels to a CSS pixel: a `scale: "device"` picture's pixels per CSS pixel. */
60
+ scale: Schema.Finite,
61
+ /** One for each pick that found something, in the order the picks were given. */
62
+ places: Schema.Array(Place),
63
+ /** The picks that found nothing. */
64
+ missing: Schema.Array(Schema.String)
65
+ }) {};
66
+ /** The place a pick named, if it found one. */
67
+ const place = (layout, id) => layout.places.find((each) => each.id === id);
68
+ /**
69
+ * Measure what exists only after an interaction: perform `act`, wait for the page to be ready,
70
+ * read the layout, then perform `undo`, which runs whether or not acting and reading succeeded,
71
+ * and is not interrupted. A failure to act or read is the rehearsal's; otherwise one to undo is.
72
+ */
73
+ const rehearse = (page, rehearsal) => Effect.uninterruptibleMask((restore) => Effect.gen(function* () {
74
+ const measured = yield* Effect.exit(restore(Effect.forEach(rehearsal.act, page.perform, { discard: true }).pipe(Effect.andThen(page.ready()), Effect.andThen(page.layout(rehearsal.picks)))));
75
+ const undone = yield* Effect.exit(Effect.forEach(rehearsal.undo, page.perform, { discard: true }));
76
+ return yield* Exit.isFailure(measured) || Exit.isSuccess(undone) ? measured : Exit.failCause(undone.cause);
77
+ }));
78
+ //#endregion
79
+ export { Layout, Place, Word, place, rehearse, Layout_exports as t };
80
+
81
+ //# 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 * @since 0.3.0\n */\nimport { Effect, Exit, 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 \"./Geometry.ts\";\nimport type { FindQuery, Page } from \"./Page.ts\";\n\n/** A match of a pick's `words`, by its box in the viewport and in the document. */\nexport class Word extends Schema.Class<Word>(\"effect-browser/Word\")({\n text: Schema.String,\n box: Box,\n page: Box,\n}) {}\n\n/** What one pick found. */\nexport class Place extends Schema.Class<Place>(\"effect-browser/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/** A page's picked places, and the viewport, scroll and scale they were read at. */\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 `find` query that names one thing. Its scope defaults to the whole document. Every element it\n * finds is a candidate, and `choose` takes one: the first in tree order (the default), the last,\n * or the smallest or largest by area. With a selector, the candidates are what it selects that\n * shows and meets the other rules, a drawing's elements among them, which `find` leaves out.\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/** Picks by the names their places will carry. */\nexport type Picks = Readonly<Record<string, Pick>>;\n\n/** The place a pick named, if it found one. */\nexport const place = (layout: Layout, id: string): Place | undefined =>\n layout.places.find((each) => each.id === id);\n\n/** What a rehearsal does, measures, and does to put the page back. */\nexport interface Rehearsal {\n readonly act: ReadonlyArray<Action>;\n readonly picks: Picks;\n readonly undo: ReadonlyArray<Action>;\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 */\nexport const rehearse = (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(page.layout(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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiBA,IAAa,OAAb,cAA0B,OAAO,MAAY,qBAAqB,CAAC,CAAC;CAClE,MAAM,OAAO;CACb,KAAK;CACL,MAAM;AACR,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,QAAb,cAA2B,OAAO,MAAa,sBAAsB,CAAC,CAAC;;CAErE,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;;AAGJ,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;;AAqBJ,MAAa,SAAS,QAAgB,OACpC,OAAO,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