effect-browser 0.2.0-beta.9 → 0.3.0-beta.10

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 (204) hide show
  1. package/README.md +849 -1161
  2. package/dist/Browser-S4kvpmqa.mjs +605 -0
  3. package/dist/Browser-S4kvpmqa.mjs.map +1 -0
  4. package/dist/Browser.d.mts +127 -3
  5. package/dist/Browser.mjs +2 -22
  6. package/dist/BrowserError-Coy7EW1N.d.mts +140 -0
  7. package/dist/BrowserError.d.mts +2 -0
  8. package/dist/BrowserError.mjs +211 -0
  9. package/dist/BrowserError.mjs.map +1 -0
  10. package/dist/BrowserEvent-BRu2juEz.d.mts +279 -0
  11. package/dist/BrowserEvent.d.mts +2 -0
  12. package/dist/BrowserEvent.mjs +297 -0
  13. package/dist/BrowserEvent.mjs.map +1 -0
  14. package/dist/Cdp.d.mts +32 -0
  15. package/dist/Cdp.mjs +61 -0
  16. package/dist/Cdp.mjs.map +1 -0
  17. package/dist/Change-DNvztNLu.mjs +138 -0
  18. package/dist/Change-DNvztNLu.mjs.map +1 -0
  19. package/dist/Change-iMlcuzVD.d.mts +71 -0
  20. package/dist/Change.d.mts +2 -0
  21. package/dist/Change.mjs +2 -0
  22. package/dist/Chromium.d.mts +29 -81
  23. package/dist/Chromium.mjs +57 -392
  24. package/dist/Chromium.mjs.map +1 -1
  25. package/dist/Expect.d.mts +62 -0
  26. package/dist/Expect.mjs +114 -0
  27. package/dist/Expect.mjs.map +1 -0
  28. package/dist/Frame-BERmf_gM.d.mts +117 -0
  29. package/dist/Frame.d.mts +2 -0
  30. package/dist/Frame.mjs +123 -0
  31. package/dist/Frame.mjs.map +1 -0
  32. package/dist/Moment.d.mts +2 -0
  33. package/dist/Moment.mjs +288 -0
  34. package/dist/Moment.mjs.map +1 -0
  35. package/dist/Motion.d.mts +40 -0
  36. package/dist/Motion.mjs +122 -0
  37. package/dist/Motion.mjs.map +1 -0
  38. package/dist/Page-B5cjaUp5.mjs +618 -0
  39. package/dist/Page-B5cjaUp5.mjs.map +1 -0
  40. package/dist/Page-BlPjfibv.d.mts +595 -0
  41. package/dist/Page.d.mts +2 -0
  42. package/dist/Page.mjs +2 -0
  43. package/dist/Plan-BI8XGvDu.d.mts +209 -0
  44. package/dist/Plan-D1wrJVs8.mjs +508 -0
  45. package/dist/Plan-D1wrJVs8.mjs.map +1 -0
  46. package/dist/Plan.d.mts +2 -3
  47. package/dist/Plan.mjs +2 -2
  48. package/dist/Policy.d.mts +76 -0
  49. package/dist/Policy.mjs +237 -0
  50. package/dist/Policy.mjs.map +1 -0
  51. package/dist/Presentation.d.mts +48 -0
  52. package/dist/Presentation.mjs +117 -0
  53. package/dist/Presentation.mjs.map +1 -0
  54. package/dist/Snapshot-B34hZ4Jl.d.mts +68 -0
  55. package/dist/Snapshot.d.mts +2 -0
  56. package/dist/Snapshot.mjs +79 -0
  57. package/dist/Snapshot.mjs.map +1 -0
  58. package/dist/Stage.d.mts +64 -0
  59. package/dist/Stage.mjs +237 -0
  60. package/dist/Stage.mjs.map +1 -0
  61. package/dist/Supervisor-CYWFK3vM.d.mts +280 -0
  62. package/dist/Supervisor-TNKNOVzu.mjs +599 -0
  63. package/dist/Supervisor-TNKNOVzu.mjs.map +1 -0
  64. package/dist/Supervisor.d.mts +2 -0
  65. package/dist/Supervisor.mjs +2 -0
  66. package/dist/context-B6xr8nVi.mjs +261 -0
  67. package/dist/context-B6xr8nVi.mjs.map +1 -0
  68. package/dist/index.d.mts +17 -14
  69. package/dist/index.mjs +18 -13
  70. package/dist/match.inpage-xOe9LNO0.mjs +48 -0
  71. package/dist/match.inpage-xOe9LNO0.mjs.map +1 -0
  72. package/dist/page-B8tUQELg.mjs +5073 -0
  73. package/dist/page-B8tUQELg.mjs.map +1 -0
  74. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  75. package/dist/url-Cd04Okid.mjs +264 -0
  76. package/dist/url-Cd04Okid.mjs.map +1 -0
  77. package/package.json +96 -61
  78. package/src/Browser.ts +666 -0
  79. package/src/BrowserError.ts +234 -0
  80. package/src/BrowserEvent.ts +296 -0
  81. package/src/Cdp.ts +101 -0
  82. package/src/Change.ts +88 -0
  83. package/src/Chromium.ts +102 -0
  84. package/src/Expect.ts +180 -0
  85. package/src/Frame.ts +130 -0
  86. package/src/Moment.ts +479 -0
  87. package/src/Motion.ts +166 -0
  88. package/src/Page.ts +522 -0
  89. package/src/Plan.ts +663 -0
  90. package/src/Policy.ts +325 -0
  91. package/src/Presentation.ts +195 -0
  92. package/src/Snapshot.ts +89 -0
  93. package/src/Stage.ts +467 -0
  94. package/src/Supervisor.ts +599 -0
  95. package/src/index.ts +20 -0
  96. package/src/internal/input/actions.ts +610 -0
  97. package/src/internal/input/dispatch.ts +161 -0
  98. package/src/internal/input/edit.inpage.ts +162 -0
  99. package/src/internal/input/evidence.inpage.ts +164 -0
  100. package/src/internal/input/gate.ts +224 -0
  101. package/src/internal/input/guard.inpage.ts +605 -0
  102. package/src/internal/input/guard.ts +184 -0
  103. package/src/internal/input/keyboard.ts +112 -0
  104. package/src/internal/input/keys.ts +127 -0
  105. package/src/internal/input/perform.ts +376 -0
  106. package/src/internal/input/pointer.ts +153 -0
  107. package/src/internal/input/replies.ts +195 -0
  108. package/src/internal/input/settle.ts +50 -0
  109. package/src/internal/input/style.ts +186 -0
  110. package/src/internal/input/targets.inpage.ts +293 -0
  111. package/src/internal/input/targets.ts +148 -0
  112. package/src/internal/page/bridge.ts +386 -0
  113. package/src/internal/page/context.ts +312 -0
  114. package/src/internal/page/lane.ts +311 -0
  115. package/src/internal/page/navigation.ts +183 -0
  116. package/src/internal/page/openings.ts +87 -0
  117. package/src/internal/page/page.ts +165 -0
  118. package/src/internal/page/url.ts +100 -0
  119. package/src/internal/page/viewport.ts +43 -0
  120. package/src/internal/pictures/capture.ts +776 -0
  121. package/src/internal/pictures/clock.ts +141 -0
  122. package/src/internal/pictures/counts.ts +92 -0
  123. package/src/internal/pictures/pictures.ts +520 -0
  124. package/src/internal/pictures/transport.ts +242 -0
  125. package/src/internal/reading/choose.ts +100 -0
  126. package/src/internal/reading/context.inpage.ts +201 -0
  127. package/src/internal/reading/controls.inpage.ts +158 -0
  128. package/src/internal/reading/expect.inpage.ts +70 -0
  129. package/src/internal/reading/match.inpage.ts +92 -0
  130. package/src/internal/reading/names.inpage.ts +306 -0
  131. package/src/internal/reading/outline.inpage.ts +260 -0
  132. package/src/internal/reading/reading.ts +223 -0
  133. package/src/internal/reading/ready.inpage.ts +164 -0
  134. package/src/internal/reading/ready.ts +111 -0
  135. package/src/internal/reading/subjects.inpage.ts +188 -0
  136. package/src/internal/reading/text.inpage.ts +135 -0
  137. package/src/internal/reading/walk.inpage.ts +220 -0
  138. package/src/internal/supervisor/lifecycle.ts +416 -0
  139. package/src/internal/timeline/changes.inpage.ts +216 -0
  140. package/src/internal/timeline/changes.ts +100 -0
  141. package/src/internal/timeline/events.ts +94 -0
  142. package/src/internal/timeline/fold.inpage.ts +123 -0
  143. package/src/internal/timeline/history.inpage.ts +229 -0
  144. package/src/internal/timeline/marks.inpage.ts +207 -0
  145. package/src/internal/timeline/record.inpage.ts +133 -0
  146. package/src/internal/timeline/sight.inpage.ts +122 -0
  147. package/src/internal/timeline/window.ts +96 -0
  148. package/src/internal/timeline/words.ts +65 -0
  149. package/dist/Bootstrap-B9UUXsvF.d.mts +0 -183
  150. package/dist/Bootstrap-CeQOWBy6.mjs +0 -189
  151. package/dist/Bootstrap-CeQOWBy6.mjs.map +0 -1
  152. package/dist/Bootstrap.d.mts +0 -3
  153. package/dist/Bootstrap.mjs +0 -2
  154. package/dist/Browser-BF9_sORP.d.mts +0 -388
  155. package/dist/Browser.mjs.map +0 -1
  156. package/dist/BrowserData-CPIIIHol.d.mts +0 -585
  157. package/dist/BrowserData.d.mts +0 -3
  158. package/dist/BrowserData.mjs +0 -695
  159. package/dist/BrowserData.mjs.map +0 -1
  160. package/dist/BrowserRuntime-B6nT1G4X.d.mts +0 -148
  161. package/dist/BrowserRuntime-C1r2aSRK.mjs +0 -6820
  162. package/dist/BrowserRuntime-C1r2aSRK.mjs.map +0 -1
  163. package/dist/BrowserRuntime.d.mts +0 -3
  164. package/dist/BrowserRuntime.mjs +0 -3
  165. package/dist/Capture.d.mts +0 -56
  166. package/dist/Capture.mjs +0 -678
  167. package/dist/Capture.mjs.map +0 -1
  168. package/dist/CaptureData-CYriZHX1.mjs +0 -201
  169. package/dist/CaptureData-CYriZHX1.mjs.map +0 -1
  170. package/dist/CaptureData.d.mts +0 -219
  171. package/dist/CaptureData.mjs +0 -2
  172. package/dist/Errors.d.mts +0 -158
  173. package/dist/Errors.mjs +0 -207
  174. package/dist/Errors.mjs.map +0 -1
  175. package/dist/Images-yCG9BmRU.mjs +0 -76
  176. package/dist/Images-yCG9BmRU.mjs.map +0 -1
  177. package/dist/OperationOptions-DAeRS6O9.mjs +0 -55
  178. package/dist/OperationOptions-DAeRS6O9.mjs.map +0 -1
  179. package/dist/PageControl.d.mts +0 -15
  180. package/dist/PageControl.mjs +0 -34
  181. package/dist/PageControl.mjs.map +0 -1
  182. package/dist/PageRegistry-B3q9DS3g.mjs +0 -164
  183. package/dist/PageRegistry-B3q9DS3g.mjs.map +0 -1
  184. package/dist/Plan-Dyxu2q8C.mjs +0 -543
  185. package/dist/Plan-Dyxu2q8C.mjs.map +0 -1
  186. package/dist/PlanData-B668RxbQ.d.mts +0 -4831
  187. package/dist/PlanData.d.mts +0 -3
  188. package/dist/PlanData.mjs +0 -268
  189. package/dist/PlanData.mjs.map +0 -1
  190. package/dist/PlanInput-BJcPPncs.mjs +0 -75
  191. package/dist/PlanInput-BJcPPncs.mjs.map +0 -1
  192. package/dist/PublicSession-DCSMMqOj.mjs +0 -5602
  193. package/dist/PublicSession-DCSMMqOj.mjs.map +0 -1
  194. package/dist/Testing.d.mts +0 -479
  195. package/dist/Testing.mjs +0 -2147
  196. package/dist/Testing.mjs.map +0 -1
  197. package/dist/Timeline-fV22Xk-S.d.mts +0 -29
  198. package/dist/Timeline.d.mts +0 -4
  199. package/dist/Timeline.mjs +0 -20
  200. package/dist/Timeline.mjs.map +0 -1
  201. package/dist/TimelineData-BsOn-YGZ.d.mts +0 -3818
  202. package/dist/TimelineData.d.mts +0 -3
  203. package/dist/TimelineData.mjs +0 -482
  204. package/dist/TimelineData.mjs.map +0 -1
package/dist/Cdp.d.mts ADDED
@@ -0,0 +1,32 @@
1
+ import { t as BrowserError } from "./BrowserError-Coy7EW1N.mjs";
2
+ import { Browser, CaptureSource, Options as Options$1, Service, t as Browser_d_exports } from "./Browser.mjs";
3
+ import { DateTime, Effect, Layer, Redacted } from "effect";
4
+ declare namespace Cdp_d_exports {
5
+ export { Options, layer, open };
6
+ }
7
+ export interface Options extends Options$1 {
8
+ /**
9
+ * `ws://`, `wss://` or `http://` DevTools endpoint. Often a credential, so it may be redacted;
10
+ * connect failures never include its userinfo, path or query.
11
+ */
12
+ readonly endpoint: string | Redacted.Redacted<string>;
13
+ readonly headers?: Readonly<Record<string, string>> | undefined;
14
+ /** Identifies the session in `Browser.id`. Defaults to `"cdp"`. */
15
+ readonly id?: string | undefined;
16
+ readonly provider?: string | undefined;
17
+ /** Bound on connecting. Defaults to 30 seconds. */
18
+ readonly connectTimeoutMillis?: number | undefined;
19
+ /** When the provider ends the session on its own, as a hosted session's timeout does. */
20
+ readonly expiresAt?: DateTime.Utc | undefined;
21
+ /**
22
+ * A connection apart from this one for the pages' screencasts, as a hosted provider supplies.
23
+ * Without one, each page's capture runs on its own session.
24
+ */
25
+ readonly capture?: CaptureSource | undefined;
26
+ }
27
+ /** Connect and open a `Browser` over the endpoint's first context. */
28
+ export declare const open: (options: Options) => Effect.Effect<Service, BrowserError, import("effect/Scope").Scope>;
29
+ export declare const layer: (options: Options) => Layer.Layer<Browser, BrowserError>;
30
+ //#endregion
31
+ export { Cdp_d_exports as t };
32
+ //# sourceMappingURL=Cdp.d.mts.map
package/dist/Cdp.mjs ADDED
@@ -0,0 +1,61 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Failed } from "./BrowserError.mjs";
3
+ import { i as make, t as Browser } from "./Browser-S4kvpmqa.mjs";
4
+ import { o as reasonOf, s as undispatched } from "./context-B6xr8nVi.mjs";
5
+ import { r as quoted } from "./url-Cd04Okid.mjs";
6
+ import { Effect, Layer, Redacted } from "effect";
7
+ import { chromium } from "playwright-core";
8
+ //#region src/Cdp.ts
9
+ /**
10
+ * A browser reached over the Chrome DevTools Protocol: a Chrome started with
11
+ * `--remote-debugging-port`, or any provider that hands out a CDP WebSocket URL.
12
+ *
13
+ * Closing the scope disconnects. It does not close the remote browser; its owner does that.
14
+ *
15
+ * @since 0.3.0
16
+ */
17
+ var Cdp_exports = /* @__PURE__ */ __exportAll({
18
+ layer: () => layer,
19
+ open: () => open
20
+ });
21
+ /**
22
+ * Playwright can echo the endpoint, or a URL derived from it with its query, userinfo or path, in
23
+ * a connect failure. Those parts are often the credential, so a URL keeps its scheme, host and
24
+ * port, and any other echo of the endpoint is replaced.
25
+ */
26
+ const withoutEndpoint = (endpoint, reason) => {
27
+ if (reason._tag !== "Failed") return reason;
28
+ const origins = reason.detail.replace(quoted, (url) => {
29
+ const parsed = URL.parse(url);
30
+ return parsed === null || parsed.host === "" ? "<url>" : `${parsed.protocol}//${parsed.host}`;
31
+ });
32
+ return new Failed({ detail: endpoint === "" ? origins : origins.replaceAll(endpoint, "<endpoint>") });
33
+ };
34
+ /** Connect and open a `Browser` over the endpoint's first context. */
35
+ const open = Effect.fn("Cdp.open")(function* (options) {
36
+ const endpoint = Redacted.isRedacted(options.endpoint) ? Redacted.value(options.endpoint) : options.endpoint;
37
+ const timeout = options.connectTimeoutMillis ?? 3e4;
38
+ const failed = (cause, timeoutMillis) => undispatched("connect", withoutEndpoint(endpoint, reasonOf(cause, timeoutMillis)));
39
+ const connected = yield* Effect.acquireRelease(Effect.tryPromise({
40
+ try: () => chromium.connectOverCDP(endpoint, {
41
+ timeout,
42
+ ...options.headers === void 0 ? {} : { headers: { ...options.headers } }
43
+ }),
44
+ catch: (cause) => failed(cause, timeout)
45
+ }).pipe(Effect.withSpan("Cdp.connect", {}, { captureStackTrace: false })), (browser) => Effect.tryPromise(() => browser.close()).pipe(Effect.ignore));
46
+ const context = connected.contexts()[0] ?? (yield* Effect.tryPromise({
47
+ try: () => connected.newContext(),
48
+ catch: (cause) => failed(cause)
49
+ }));
50
+ return yield* make(context, {
51
+ id: options.id ?? "cdp",
52
+ provider: options.provider ?? "cdp",
53
+ expiresAt: options.expiresAt,
54
+ capture: options.capture
55
+ }, options);
56
+ });
57
+ const layer = (options) => Layer.effect(Browser, open(options));
58
+ //#endregion
59
+ export { layer, open, Cdp_exports as t };
60
+
61
+ //# sourceMappingURL=Cdp.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cdp.mjs","names":["Url.quoted","Browser.make","Browser.Browser"],"sources":["../src/Cdp.ts"],"sourcesContent":["/**\n * A browser reached over the Chrome DevTools Protocol: a Chrome started with\n * `--remote-debugging-port`, or any provider that hands out a CDP WebSocket URL.\n *\n * Closing the scope disconnects. It does not close the remote browser; its owner does that.\n *\n * @since 0.3.0\n */\nimport { type DateTime, Effect, Layer, Redacted } from \"effect\";\nimport { chromium } from \"playwright-core\";\n\nimport * as Browser from \"./Browser.ts\";\nimport { type BrowserError, Failed, type Reason } from \"./BrowserError.ts\";\nimport { reasonOf, undispatched } from \"./internal/page/context.ts\";\nimport * as Url from \"./internal/page/url.ts\";\n\nexport interface Options extends Browser.Options {\n /**\n * `ws://`, `wss://` or `http://` DevTools endpoint. Often a credential, so it may be redacted;\n * connect failures never include its userinfo, path or query.\n */\n readonly endpoint: string | Redacted.Redacted<string>;\n readonly headers?: Readonly<Record<string, string>> | undefined;\n /** Identifies the session in `Browser.id`. Defaults to `\"cdp\"`. */\n readonly id?: string | undefined;\n readonly provider?: string | undefined;\n /** Bound on connecting. Defaults to 30 seconds. */\n readonly connectTimeoutMillis?: number | undefined;\n /** When the provider ends the session on its own, as a hosted session's timeout does. */\n readonly expiresAt?: DateTime.Utc | undefined;\n /**\n * A connection apart from this one for the pages' screencasts, as a hosted provider supplies.\n * Without one, each page's capture runs on its own session.\n */\n readonly capture?: Browser.CaptureSource | undefined;\n}\n\n/**\n * Playwright can echo the endpoint, or a URL derived from it with its query, userinfo or path, in\n * a connect failure. Those parts are often the credential, so a URL keeps its scheme, host and\n * port, and any other echo of the endpoint is replaced.\n */\nconst withoutEndpoint = (endpoint: string, reason: Reason): Reason => {\n if (reason._tag !== \"Failed\") return reason;\n\n const origins = reason.detail.replace(Url.quoted, (url) => {\n const parsed = URL.parse(url);\n\n return parsed === null || parsed.host === \"\" ? \"<url>\" : `${parsed.protocol}//${parsed.host}`;\n });\n\n return new Failed({\n detail: endpoint === \"\" ? origins : origins.replaceAll(endpoint, \"<endpoint>\"),\n });\n};\n\n/** Connect and open a `Browser` over the endpoint's first context. */\nexport const open = Effect.fn(\"Cdp.open\")(function* (options: Options) {\n const endpoint = Redacted.isRedacted(options.endpoint)\n ? Redacted.value(options.endpoint)\n : options.endpoint;\n\n const timeout = options.connectTimeoutMillis ?? 30_000;\n\n const failed = (cause: unknown, timeoutMillis?: number) =>\n undispatched(\"connect\", withoutEndpoint(endpoint, reasonOf(cause, timeoutMillis)));\n\n // The endpoint is often a credential, so the connect span names no part of it.\n const connected = yield* Effect.acquireRelease(\n Effect.tryPromise({\n try: () =>\n chromium.connectOverCDP(endpoint, {\n timeout,\n ...(options.headers === undefined ? {} : { headers: { ...options.headers } }),\n }),\n catch: (cause) => failed(cause, timeout),\n }).pipe(Effect.withSpan(\"Cdp.connect\", {}, { captureStackTrace: false })),\n (browser) => Effect.tryPromise(() => browser.close()).pipe(Effect.ignore),\n );\n\n const context =\n connected.contexts()[0] ??\n (yield* Effect.tryPromise({\n try: () => connected.newContext(),\n catch: (cause) => failed(cause),\n }));\n\n return yield* Browser.make(\n context,\n {\n id: options.id ?? \"cdp\",\n provider: options.provider ?? \"cdp\",\n expiresAt: options.expiresAt,\n capture: options.capture,\n },\n options,\n );\n});\n\nexport const layer = (options: Options): Layer.Layer<Browser.Browser, BrowserError> =>\n Layer.effect(Browser.Browser, open(options));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,mBAAmB,UAAkB,WAA2B;CACpE,IAAI,OAAO,SAAS,UAAU,OAAO;CAErC,MAAM,UAAU,OAAO,OAAO,QAAQA,SAAa,QAAQ;EACzD,MAAM,SAAS,IAAI,MAAM,GAAG;EAE5B,OAAO,WAAW,QAAQ,OAAO,SAAS,KAAK,UAAU,GAAG,OAAO,SAAS,IAAI,OAAO;CACzF,CAAC;CAED,OAAO,IAAI,OAAO,EAChB,QAAQ,aAAa,KAAK,UAAU,QAAQ,WAAW,UAAU,YAAY,EAC/E,CAAC;AACH;;AAGA,MAAa,OAAO,OAAO,GAAG,UAAU,CAAC,CAAC,WAAW,SAAkB;CACrE,MAAM,WAAW,SAAS,WAAW,QAAQ,QAAQ,IACjD,SAAS,MAAM,QAAQ,QAAQ,IAC/B,QAAQ;CAEZ,MAAM,UAAU,QAAQ,wBAAwB;CAEhD,MAAM,UAAU,OAAgB,kBAC9B,aAAa,WAAW,gBAAgB,UAAU,SAAS,OAAO,aAAa,CAAC,CAAC;CAGnF,MAAM,YAAY,OAAO,OAAO,eAC9B,OAAO,WAAW;EAChB,WACE,SAAS,eAAe,UAAU;GAChC;GACA,GAAI,QAAQ,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,QAAQ,QAAQ,EAAE;EAC7E,CAAC;EACH,QAAQ,UAAU,OAAO,OAAO,OAAO;CACzC,CAAC,CAAC,CAAC,KAAK,OAAO,SAAS,eAAe,CAAC,GAAG,EAAE,mBAAmB,MAAM,CAAC,CAAC,IACvE,YAAY,OAAO,iBAAiB,QAAQ,MAAM,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,CAC1E;CAEA,MAAM,UACJ,UAAU,SAAS,CAAC,CAAC,OACpB,OAAO,OAAO,WAAW;EACxB,WAAW,UAAU,WAAW;EAChC,QAAQ,UAAU,OAAO,KAAK;CAChC,CAAC;CAEH,OAAO,OAAOC,KACZ,SACA;EACE,IAAI,QAAQ,MAAM;EAClB,UAAU,QAAQ,YAAY;EAC9B,WAAW,QAAQ;EACnB,SAAS,QAAQ;CACnB,GACA,OACF;AACF,CAAC;AAED,MAAa,SAAS,YACpB,MAAM,OAAOC,SAAiB,KAAK,OAAO,CAAC"}
@@ -0,0 +1,138 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Subject } from "./BrowserEvent.mjs";
3
+ import { Schema } from "effect";
4
+ //#region src/internal/timeline/words.ts
5
+ const quoted = (value) => JSON.stringify(value ?? "");
6
+ /** A subject in words, such as `button "Play"`; one without a name says where it was. */
7
+ const named = (subject, point) => {
8
+ const kind = subject.role ?? subject.tag;
9
+ if (subject.name !== "") return `${kind} ${JSON.stringify(subject.name)}`;
10
+ return point === void 0 ? kind : `${kind} at ${point}`;
11
+ };
12
+ /** A change's context in words: `row "Ether", column "1h"` or `beside "Price", under "Bitcoin"`. */
13
+ const where = ({ row, column, label, heading }, grouped = false) => {
14
+ const parts = [
15
+ row === void 0 ? "" : `row ${quoted(row)}`,
16
+ column === void 0 || grouped ? "" : `column ${quoted(column)}`,
17
+ label === void 0 ? "" : `beside ${quoted(label)}`,
18
+ heading === void 0 || grouped ? "" : `under ${quoted(heading)}`
19
+ ].filter((part) => part !== "");
20
+ return parts.length === 0 ? "" : ` (${parts.join(", ")})`;
21
+ };
22
+ /** A change in words, such as `"$61,240" became "$62,010" (row "Bitcoin", column "Price")`. */
23
+ const describe$1 = (change, grouped = false) => {
24
+ const { subject, before, after, count, lowest, highest } = change;
25
+ const context = where(subject.context, grouped);
26
+ const range = lowest === void 0 || highest === void 0 ? "" : `, from ${lowest} to ${highest}`;
27
+ const times = count > 1 ? ` (it changed ${count} times${range})` : "";
28
+ switch (change.kind) {
29
+ case "title": return `the title ${before === void 0 ? "now reads" : `${quoted(before)} became`} ${quoted(after)}`;
30
+ case "value": {
31
+ const field = named(subject, void 0);
32
+ if (after === "checked" || after === "not checked") return `${field} is now ${after}`;
33
+ if (after === void 0 || after === "") return `${field} was cleared`;
34
+ return after === "••••" || before === void 0 || before === "" ? `${field} was ${after === "••••" ? "edited" : `set to ${quoted(after)}`}` : `${field} changed from ${quoted(before)} to ${quoted(after)}`;
35
+ }
36
+ case "appeared": return `${quoted(after)} appeared${context}`;
37
+ case "disappeared": return `${quoted(before)} disappeared${context}`;
38
+ case "brief": return `${quoted(after)} appeared and went away again${context}`;
39
+ case "text": return before === void 0 ? `now reads ${quoted(after)}${context}${times}` : `${quoted(before)} became ${quoted(after)}${context}${times}`;
40
+ }
41
+ };
42
+ //#endregion
43
+ //#region src/Change.ts
44
+ /**
45
+ * What visibly changed on a page over a window, element by element: text that changed, appeared,
46
+ * disappeared or came and went, a field's value, and the document's title. A change says what was
47
+ * shown at the window's start and at its end, how often it changed between, where it is on the
48
+ * page, and the input it followed, where it was that input's doing.
49
+ *
50
+ * `Page.changes` reads it. A page records once something reads its changes: from then, and from the
51
+ * start of each later document once it is parsed, until nobody has read it for two minutes. A page
52
+ * nobody reads records nothing. The record keeps 256 elements, each with its last 32 changes, for a
53
+ * minute; an element that keeps changing gives way before news, and what gives way is counted in
54
+ * `dropped`, with `from` moved past it. A change is told when it was in view as the page rendered
55
+ * it, its style showing it, so one scrolled away later is still told, and something removed or
56
+ * hidden only if it was in view before. What the record cannot see: pictures, a canvas, frames,
57
+ * shadow roots and SVG; a value a script sets; and a class that reveals an element the record has
58
+ * not seen before, such as a toast already on the page, though its later changes are seen.
59
+ *
60
+ * @since 0.3.0
61
+ */
62
+ var Change_exports = /* @__PURE__ */ __exportAll({
63
+ Change: () => Change,
64
+ Changes: () => Changes,
65
+ Kind: () => Kind,
66
+ describe: () => describe
67
+ });
68
+ /**
69
+ * `text` changed; `appeared` and `disappeared`, whether added or removed or shown or hidden;
70
+ * `brief`, appeared and gone again by the window's end; `value`, a field's; `title`, the document's.
71
+ */
72
+ const Kind = Schema.Literals([
73
+ "text",
74
+ "appeared",
75
+ "disappeared",
76
+ "brief",
77
+ "value",
78
+ "title"
79
+ ]);
80
+ var Change = class extends Schema.Class("effect-browser/Change")({
81
+ kind: Kind,
82
+ /**
83
+ * What changed, as the page names it now, or where it was for what went. Its own words are what
84
+ * changed, so its name is empty unless something else names it, as a field's label does.
85
+ */
86
+ subject: Subject,
87
+ /** When it first changed in the window, in host monotonic milliseconds on the browser's clock. */
88
+ startedAt: Schema.Finite,
89
+ /** When it last changed in the window. */
90
+ at: Schema.Finite,
91
+ /**
92
+ * What it showed at the window's start; absent for what appeared and where the record let that go.
93
+ * What disappeared says what it showed as it went. A field's value reads `••••` unless unmasked.
94
+ */
95
+ before: Schema.optional(Schema.String),
96
+ /** What it showed at the window's end; absent for what disappeared. What came and went says what it showed. */
97
+ after: Schema.optional(Schema.String),
98
+ /** How many times what it showed changed in the window. */
99
+ count: Schema.Int.check(Schema.isGreaterThan(0)),
100
+ /** For a number that changed more than once, its lowest and highest, as shown. */
101
+ lowest: Schema.optional(Schema.String),
102
+ highest: Schema.optional(Schema.String),
103
+ /** When it last changed before the window, as far back as the record keeps: in flux, not news. */
104
+ earlier: Schema.optional(Schema.Finite),
105
+ /**
106
+ * When the trusted input it followed reached the page, where it was that input's doing. It was not
107
+ * in flux: in the 10 s before the input it had not changed, and nothing had come into or left what
108
+ * it sits in, so a ticker's tick or a feed's line is not. Then it changed within 3 s inside what
109
+ * the input acted on or its row, form, dialog or controlled element; or, elsewhere, within 500 ms
110
+ * of an input on a page where nothing had changed in the 2 s before, as a menu a portal puts at
111
+ * the end of the page does. What holds the input's target, as a menu holds its item, does not
112
+ * count against it. The page's `Action` that sent it holds that time.
113
+ */
114
+ cause: Schema.optional(Schema.Finite)
115
+ }) {};
116
+ var Changes = class extends Schema.Class("effect-browser/Changes")({
117
+ /** The page's document these changes belong to, as `Navigated` counts them. */
118
+ document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
119
+ /** Where the record is whole: before it, changes may be missing. */
120
+ from: Schema.Finite,
121
+ /** Where the window ends: its `until`, or when the page was read. */
122
+ until: Schema.Finite,
123
+ /**
124
+ * Where the window ends on the page's own clock. Give these changes as the next read's `since` and
125
+ * the two windows meet exactly, whatever the clock mapping does meanwhile.
126
+ */
127
+ cursor: Schema.Finite,
128
+ /** Changes in the window the record let go, at least; 0 when it kept them all. */
129
+ dropped: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
130
+ /** Oldest first, by when each began to change. */
131
+ changes: Schema.Array(Change)
132
+ }) {};
133
+ /** A change in words for a model, such as `"$61,240" became "$62,010" (row "Bitcoin", column "Price")`. */
134
+ const describe = (change) => describe$1(change);
135
+ //#endregion
136
+ export { describe as a, quoted as c, Kind as i, where as l, Change_exports as n, describe$1 as o, Changes as r, named as s, Change as t };
137
+
138
+ //# sourceMappingURL=Change-DNvztNLu.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Change-DNvztNLu.mjs","names":["describe","Words.describe"],"sources":["../src/internal/timeline/words.ts","../src/Change.ts"],"sourcesContent":["/**\n * What changed on a page, in words for a model: a change with where it is, and what it is. A moment\n * tells its changes this way, and a tool's receipt the changes its action caused.\n */\nimport type { Subject, SubjectContext } from \"../../BrowserEvent.ts\";\nimport type { Change } from \"../../Change.ts\";\n\nexport const quoted = (value: string | undefined) => JSON.stringify(value ?? \"\");\n\n/** A subject in words, such as `button \"Play\"`; one without a name says where it was. */\nexport const named = (subject: Subject, point: string | undefined) => {\n const kind = subject.role ?? subject.tag;\n\n if (subject.name !== \"\") return `${kind} ${JSON.stringify(subject.name)}`;\n\n return point === undefined ? kind : `${kind} at ${point}`;\n};\n\n/** A change's context in words: `row \"Ether\", column \"1h\"` or `beside \"Price\", under \"Bitcoin\"`. */\nexport const where = ({ row, column, label, heading }: SubjectContext, grouped = false) => {\n const parts = [\n row === undefined ? \"\" : `row ${quoted(row)}`,\n column === undefined || grouped ? \"\" : `column ${quoted(column)}`,\n label === undefined ? \"\" : `beside ${quoted(label)}`,\n heading === undefined || grouped ? \"\" : `under ${quoted(heading)}`,\n ].filter((part) => part !== \"\");\n\n return parts.length === 0 ? \"\" : ` (${parts.join(\", \")})`;\n};\n\n/** A change in words, such as `\"$61,240\" became \"$62,010\" (row \"Bitcoin\", column \"Price\")`. */\nexport const describe = (change: Change, grouped = false): string => {\n const { subject, before, after, count, lowest, highest } = change;\n const context = where(subject.context, grouped);\n\n const range =\n lowest === undefined || highest === undefined ? \"\" : `, from ${lowest} to ${highest}`;\n\n const times = count > 1 ? ` (it changed ${count} times${range})` : \"\";\n\n switch (change.kind) {\n case \"title\":\n return `the title ${before === undefined ? \"now reads\" : `${quoted(before)} became`} ${quoted(after)}`;\n case \"value\": {\n const field = named(subject, undefined);\n\n if (after === \"checked\" || after === \"not checked\") return `${field} is now ${after}`;\n if (after === undefined || after === \"\") return `${field} was cleared`;\n\n return after === \"••••\" || before === undefined || before === \"\"\n ? `${field} was ${after === \"••••\" ? \"edited\" : `set to ${quoted(after)}`}`\n : `${field} changed from ${quoted(before)} to ${quoted(after)}`;\n }\n case \"appeared\":\n return `${quoted(after)} appeared${context}`;\n case \"disappeared\":\n return `${quoted(before)} disappeared${context}`;\n case \"brief\":\n return `${quoted(after)} appeared and went away again${context}`;\n case \"text\":\n return before === undefined\n ? `now reads ${quoted(after)}${context}${times}`\n : `${quoted(before)} became ${quoted(after)}${context}${times}`;\n }\n};\n","/**\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\";\nimport * as Words from \"./internal/timeline/words.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\")`. */\nexport const describe = (change: Change): string => Words.describe(change);\n"],"mappings":";;;;AAOA,MAAa,UAAU,UAA8B,KAAK,UAAU,SAAS,EAAE;;AAG/E,MAAa,SAAS,SAAkB,UAA8B;CACpE,MAAM,OAAO,QAAQ,QAAQ,QAAQ;CAErC,IAAI,QAAQ,SAAS,IAAI,OAAO,GAAG,KAAK,GAAG,KAAK,UAAU,QAAQ,IAAI;CAEtE,OAAO,UAAU,KAAA,IAAY,OAAO,GAAG,KAAK,MAAM;AACpD;;AAGA,MAAa,SAAS,EAAE,KAAK,QAAQ,OAAO,WAA2B,UAAU,UAAU;CACzF,MAAM,QAAQ;EACZ,QAAQ,KAAA,IAAY,KAAK,OAAO,OAAO,GAAG;EAC1C,WAAW,KAAA,KAAa,UAAU,KAAK,UAAU,OAAO,MAAM;EAC9D,UAAU,KAAA,IAAY,KAAK,UAAU,OAAO,KAAK;EACjD,YAAY,KAAA,KAAa,UAAU,KAAK,SAAS,OAAO,OAAO;CACjE,CAAC,CAAC,QAAQ,SAAS,SAAS,EAAE;CAE9B,OAAO,MAAM,WAAW,IAAI,KAAK,KAAK,MAAM,KAAK,IAAI,EAAE;AACzD;;AAGA,MAAaA,cAAY,QAAgB,UAAU,UAAkB;CACnE,MAAM,EAAE,SAAS,QAAQ,OAAO,OAAO,QAAQ,YAAY;CAC3D,MAAM,UAAU,MAAM,QAAQ,SAAS,OAAO;CAE9C,MAAM,QACJ,WAAW,KAAA,KAAa,YAAY,KAAA,IAAY,KAAK,UAAU,OAAO,MAAM;CAE9E,MAAM,QAAQ,QAAQ,IAAI,gBAAgB,MAAM,QAAQ,MAAM,KAAK;CAEnE,QAAQ,OAAO,MAAf;EACE,KAAK,SACH,OAAO,aAAa,WAAW,KAAA,IAAY,cAAc,GAAG,OAAO,MAAM,EAAE,SAAS,GAAG,OAAO,KAAK;EACrG,KAAK,SAAS;GACZ,MAAM,QAAQ,MAAM,SAAS,KAAA,CAAS;GAEtC,IAAI,UAAU,aAAa,UAAU,eAAe,OAAO,GAAG,MAAM,UAAU;GAC9E,IAAI,UAAU,KAAA,KAAa,UAAU,IAAI,OAAO,GAAG,MAAM;GAEzD,OAAO,UAAU,UAAU,WAAW,KAAA,KAAa,WAAW,KAC1D,GAAG,MAAM,OAAO,UAAU,SAAS,WAAW,UAAU,OAAO,KAAK,QACpE,GAAG,MAAM,gBAAgB,OAAO,MAAM,EAAE,MAAM,OAAO,KAAK;EAChE;EACA,KAAK,YACH,OAAO,GAAG,OAAO,KAAK,EAAE,WAAW;EACrC,KAAK,eACH,OAAO,GAAG,OAAO,MAAM,EAAE,cAAc;EACzC,KAAK,SACH,OAAO,GAAG,OAAO,KAAK,EAAE,+BAA+B;EACzD,KAAK,QACH,OAAO,WAAW,KAAA,IACd,aAAa,OAAO,KAAK,IAAI,UAAU,UACvC,GAAG,OAAO,MAAM,EAAE,UAAU,OAAO,KAAK,IAAI,UAAU;CAC9D;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACrCA,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;;AAGJ,MAAa,YAAY,WAA2BC,WAAe,MAAM"}
@@ -0,0 +1,71 @@
1
+ import { b as Subject } from "./BrowserEvent-BRu2juEz.mjs";
2
+ import { Schema } from "effect";
3
+ declare namespace Change_d_exports {
4
+ export { Change, Changes, Kind, describe };
5
+ }
6
+ /**
7
+ * `text` changed; `appeared` and `disappeared`, whether added or removed or shown or hidden;
8
+ * `brief`, appeared and gone again by the window's end; `value`, a field's; `title`, the document's.
9
+ */
10
+ declare const Kind: Schema.Literals<readonly ["text", "appeared", "disappeared", "brief", "value", "title"]>;
11
+ type Kind = typeof Kind.Type;
12
+ declare const Change_base: Schema.Class<Change, Schema.Struct<{
13
+ readonly kind: Schema.Literals<readonly ["text", "appeared", "disappeared", "brief", "value", "title"]>;
14
+ /**
15
+ * What changed, as the page names it now, or where it was for what went. Its own words are what
16
+ * changed, so its name is empty unless something else names it, as a field's label does.
17
+ */
18
+ readonly subject: typeof Subject;
19
+ /** When it first changed in the window, in host monotonic milliseconds on the browser's clock. */
20
+ readonly startedAt: Schema.Finite;
21
+ /** When it last changed in the window. */
22
+ readonly at: Schema.Finite;
23
+ /**
24
+ * What it showed at the window's start; absent for what appeared and where the record let that go.
25
+ * What disappeared says what it showed as it went. A field's value reads `••••` unless unmasked.
26
+ */
27
+ readonly before: Schema.optional<Schema.String>;
28
+ /** What it showed at the window's end; absent for what disappeared. What came and went says what it showed. */
29
+ readonly after: Schema.optional<Schema.String>;
30
+ /** How many times what it showed changed in the window. */
31
+ readonly count: Schema.Int;
32
+ /** For a number that changed more than once, its lowest and highest, as shown. */
33
+ readonly lowest: Schema.optional<Schema.String>;
34
+ readonly highest: Schema.optional<Schema.String>;
35
+ /** When it last changed before the window, as far back as the record keeps: in flux, not news. */
36
+ readonly earlier: Schema.optional<Schema.Finite>;
37
+ /**
38
+ * When the trusted input it followed reached the page, where it was that input's doing. It was not
39
+ * in flux: in the 10 s before the input it had not changed, and nothing had come into or left what
40
+ * it sits in, so a ticker's tick or a feed's line is not. Then it changed within 3 s inside what
41
+ * the input acted on or its row, form, dialog or controlled element; or, elsewhere, within 500 ms
42
+ * of an input on a page where nothing had changed in the 2 s before, as a menu a portal puts at
43
+ * the end of the page does. What holds the input's target, as a menu holds its item, does not
44
+ * count against it. The page's `Action` that sent it holds that time.
45
+ */
46
+ readonly cause: Schema.optional<Schema.Finite>;
47
+ }>, {}>;
48
+ declare class Change extends Change_base {}
49
+ declare const Changes_base: Schema.Class<Changes, Schema.Struct<{
50
+ /** The page's document these changes belong to, as `Navigated` counts them. */
51
+ readonly document: Schema.Int;
52
+ /** Where the record is whole: before it, changes may be missing. */
53
+ readonly from: Schema.Finite;
54
+ /** Where the window ends: its `until`, or when the page was read. */
55
+ readonly until: Schema.Finite;
56
+ /**
57
+ * Where the window ends on the page's own clock. Give these changes as the next read's `since` and
58
+ * the two windows meet exactly, whatever the clock mapping does meanwhile.
59
+ */
60
+ readonly cursor: Schema.Finite;
61
+ /** Changes in the window the record let go, at least; 0 when it kept them all. */
62
+ readonly dropped: Schema.Int;
63
+ /** Oldest first, by when each began to change. */
64
+ readonly changes: Schema.$Array<typeof Change>;
65
+ }>, {}>;
66
+ declare class Changes extends Changes_base {}
67
+ /** A change in words for a model, such as `"$61,240" became "$62,010" (row "Bitcoin", column "Price")`. */
68
+ declare const describe: (change: Change) => string;
69
+ //#endregion
70
+ export { describe as a, Kind as i, Change_d_exports as n, Changes as r, Change as t };
71
+ //# sourceMappingURL=Change-iMlcuzVD.d.mts.map
@@ -0,0 +1,2 @@
1
+ import { a as describe, i as Kind, r as Changes, t as Change } from "./Change-iMlcuzVD.mjs";
2
+ export { Change, Changes, Kind, describe };
@@ -0,0 +1,2 @@
1
+ import { a as describe, i as Kind, r as Changes, t as Change } from "./Change-DNvztNLu.mjs";
2
+ export { Change, Changes, Kind, describe };
@@ -1,85 +1,33 @@
1
- import { BrowserError, InitializationError } from "./Errors.mjs";
2
- import { it as Viewport, o as BrowserPolicy, r as AutomationOptions } from "./BrowserData-CPIIIHol.mjs";
3
- import { c as OpenOptions, i as BrowserSession } from "./Browser-BF9_sORP.mjs";
4
- import { Context, Crypto, Effect, Layer, Option, Redacted, Schema, Scope } from "effect";
5
- //#region src/internal/chromium/Data.d.ts
6
- declare const ChromiumReference_base: Schema.Class<ChromiumReference, Schema.Struct<{
7
- readonly provider: Schema.Literal<"chromium">;
8
- readonly id: Schema.NonEmptyString;
9
- }>, {}>;
10
- /** Identifies this Chromium ownership lifetime, not a reusable endpoint. */
11
- export declare class ChromiumReference extends ChromiumReference_base {}
12
- declare const ChromiumCleanupIssue_base: Schema.Class<ChromiumCleanupIssue, Schema.Struct<{
13
- readonly step: Schema.Literals<readonly ["fence", "capture", "initialization", "disconnect", "terminate", "profile"]>;
14
- readonly reason: Schema.Literals<readonly ["timeout", "failed", "interrupted"]>;
15
- }>, {}>;
16
- export declare class ChromiumCleanupIssue extends ChromiumCleanupIssue_base {}
17
- declare const ChromiumCleanupResult_base: Schema.Class<ChromiumCleanupResult, Schema.Struct<{
18
- readonly reference: typeof ChromiumReference;
19
- readonly ownership: Schema.Literals<readonly ["owned", "borrowed"]>;
20
- readonly connection: Schema.Literals<readonly ["closed", "failed", "not-connected", "pending"]>;
21
- readonly process: Schema.Literals<readonly ["terminated", "unknown", "not-owned"]>;
22
- readonly issues: Schema.$Array<typeof ChromiumCleanupIssue>;
23
- }>, {}>;
24
- /** Connection teardown and observed process exit are separate facts; no provider status exists. */
25
- export declare class ChromiumCleanupResult extends ChromiumCleanupResult_base {}
26
- export declare const ChromiumLaunch: Schema.Struct<{
27
- readonly executablePath: Schema.optionalKey<Schema.NonEmptyString>;
28
- readonly headless: Schema.optionalKey<Schema.Boolean>;
29
- /** Enabled by default; a trusted host must explicitly choose a sandbox exception. */
30
- readonly chromiumSandbox: Schema.optionalKey<Schema.Boolean>;
31
- readonly args: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
32
- readonly proxy: Schema.optionalKey<Schema.Struct<{
33
- readonly server: Schema.NonEmptyString;
34
- readonly bypass: Schema.optionalKey<Schema.NonEmptyString>;
35
- }>>;
36
- readonly startupTimeoutMillis: Schema.optionalKey<Schema.Int>;
37
- }>;
38
- export type ChromiumLaunch = typeof ChromiumLaunch.Type;
39
- //#endregion
40
- //#region src/Chromium.d.ts
41
- /** Host-only process configuration. Building this layer neither loads Playwright nor starts Chromium. */
42
- export interface ChromiumOptions extends AutomationOptions {
43
- readonly launch?: ChromiumLaunch;
44
- readonly viewport?: Viewport;
45
- readonly onCleanup?: (result: ChromiumCleanupResult) => Effect.Effect<void>;
46
- }
47
- /** An owned or borrowed Chromium lifetime with one modeled browser connection. */
48
- export interface ChromiumSession<E = never> extends BrowserSession<E> {
49
- readonly reference: ChromiumReference;
50
- readonly closeChecked: Effect.Effect<ChromiumCleanupResult, BrowserError>;
51
- readonly close: Effect.Effect<ChromiumCleanupResult>;
52
- readonly cleanupResult: Effect.Effect<Option.Option<ChromiumCleanupResult>>;
53
- }
54
- export interface ChromiumAcquisition<E = never> {
55
- readonly reference: ChromiumReference;
56
- readonly failure: Effect.Effect<never, E | InitializationError>;
57
- readonly connect: Effect.Effect<ChromiumSession<E>, BrowserError | InitializationError | E>;
58
- readonly close: Effect.Effect<ChromiumCleanupResult>;
59
- }
60
- export interface ChromiumAttachRequest<E = never, R = never> extends OpenOptions<E, R> {
61
- readonly policy: BrowserPolicy;
62
- /** Resolve this exact target; without it, multiple open pages are an ambiguity error. */
63
- readonly target?: {
64
- readonly targetId: string;
65
- };
1
+ import { t as BrowserError } from "./BrowserError-Coy7EW1N.mjs";
2
+ import { Browser, Options as Options$1, Service, t as Browser_d_exports } from "./Browser.mjs";
3
+ import { Effect, Layer } from "effect";
4
+ declare namespace Chromium_d_exports {
5
+ export { Options, layer, open };
66
6
  }
67
- declare const Chromium_base: Context.ServiceClass<Chromium, "effect-browser/Chromium", {
68
- readonly acquire: <E = never, R = never>(policy: BrowserPolicy, request?: OpenOptions<E, R>) => Effect.Effect<ChromiumAcquisition<E>, BrowserError, Scope.Scope | Exclude<R, Scope.Scope>>;
69
- readonly launch: <E = never, R = never>(policy: BrowserPolicy, request?: OpenOptions<E, R>) => Effect.Effect<ChromiumSession<E>, BrowserError | InitializationError | E, Scope.Scope | Exclude<R, Scope.Scope>>;
70
- /** A concrete loopback ws://.../devtools/browser/... endpoint; this scope owns only its connection. */
71
- readonly attach: <E = never, R = never>(endpoint: Redacted.Redacted<string>, request: ChromiumAttachRequest<E, R>) => Effect.Effect<ChromiumSession<E>, BrowserError | InitializationError | E, Scope.Scope | Exclude<R, Scope.Scope>>;
72
- }>;
73
- export declare class Chromium extends Chromium_base {
74
- /** Launch through the configured service; compose with Browser.scoped for supervised ownership. */
75
- static launch<E = never, R = never>(policy: BrowserPolicy, request?: OpenOptions<E, R>): Effect.Effect<ChromiumSession<E>, E | BrowserError | InitializationError, Chromium | Scope.Scope | Exclude<R, Scope.Scope>>;
76
- /** Acquire the process lifetime before connecting, using the caller's scope. */
77
- static acquire<E = never, R = never>(policy: BrowserPolicy, request?: OpenOptions<E, R>): Effect.Effect<ChromiumAcquisition<E>, BrowserError, Chromium | Scope.Scope | Exclude<R, Scope.Scope>>;
78
- /** Borrow a concrete loopback endpoint; cleanup never terminates its external process. */
79
- static attach<E = never, R = never>(endpoint: Redacted.Redacted<string>, request: ChromiumAttachRequest<E, R>): Effect.Effect<ChromiumSession<E>, E | BrowserError | InitializationError, Chromium | Scope.Scope | Exclude<R, Scope.Scope>>;
80
- /** Chromium references, connection ids and handoff tokens come from the required `Crypto`. */
81
- static layer(options?: ChromiumOptions): Layer.Layer<Chromium, BrowserError, Crypto.Crypto>;
7
+ export interface Options extends Options$1 {
8
+ /** Defaults to true. */
9
+ readonly headless?: boolean | undefined;
10
+ /**
11
+ * Run Chromium's sandbox. Defaults to false, as in Playwright, so an exploit in a page's renderer
12
+ * runs with this process's privileges. Hosts that don't allow unprivileged user namespaces, such
13
+ * as many containers and Ubuntu 23.10 or later by default, can't start the sandbox; opening then
14
+ * fails and says so.
15
+ */
16
+ readonly sandbox?: boolean | undefined;
17
+ /** Defaults to 1280x720 CSS pixels at a device scale factor of 1. */
18
+ readonly viewport?: {
19
+ readonly width: number;
20
+ readonly height: number;
21
+ } | undefined;
22
+ readonly executablePath?: string | undefined;
23
+ readonly args?: ReadonlyArray<string> | undefined;
24
+ readonly userAgent?: string | undefined;
25
+ readonly locale?: string | undefined;
82
26
  }
27
+ /** Launch Chromium and open a `Browser` over a fresh context. */
28
+ export declare const open: (options?: Options | undefined) => Effect.Effect<Service, BrowserError, import("effect/Scope").Scope>;
29
+ /** A `Browser` Layer that launches Chromium when built and closes it when released. */
30
+ export declare const layer: (options?: Options) => Layer.Layer<Browser, BrowserError>;
83
31
  //#endregion
84
- export {};
32
+ export { Chromium_d_exports as t };
85
33
  //# sourceMappingURL=Chromium.d.mts.map