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
@@ -0,0 +1,714 @@
1
+ import "./BrowserError-BlcmLVzn.mjs";
2
+ import { x as Subject } from "./BrowserEvent-C2p-NwuU.mjs";
3
+ import { t as Change } from "./Change-CxT1mp2e.mjs";
4
+ import { i as Point } from "./Geometry-DJx9qrYy.mjs";
5
+ import { R as Picks, s as FindQuery } from "./Page-CLzh5E9w.mjs";
6
+ import { t as Pose } from "./Pose-2qqGzPvb.mjs";
7
+ import { n as Snapshot } from "./Snapshot-CtBVOtuu.mjs";
8
+ import "./Browser-DGR6ZEYo.mjs";
9
+ import "./Clock-Du5nP-nK.mjs";
10
+ import { c as Layouts, d as Walk, f as Names, l as Subjects, n as FindRequest, r as Match, u as ContextReader } from "./Matching-MtcWZ_hA.mjs";
11
+ import { n as addresses } from "./Url-B7P-TWwL.mjs";
12
+ import { a as Track, i as Shown, n as Folded, r as Sample, t as Fold } from "./fold.inpage-CyVZQHZL.mjs";
13
+ import { Clock, Context, Deferred, Duration, Effect, MutableRef, Option, Schema, Scope } from "effect";
14
+ import { BrowserContext } from "playwright-core";
15
+ //#region src/internal/input/evidence.inpage.d.ts
16
+ /** Page text about the first target. It never includes what a field holds. */
17
+ type Evidence = typeof EvidenceSchema.Encoded;
18
+ type Field = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
19
+ declare const evidence: (names: Names, placing: ContextReader) => {
20
+ evidenceOf: (element: Element, form: HTMLFormElement | null, method: string | undefined, action: string | undefined) => Evidence;
21
+ isField: (element: Element) => element is Field;
22
+ isFilled: (field: Field) => boolean;
23
+ };
24
+ type EvidenceReader = ReturnType<typeof evidence>;
25
+ declare const EvidenceSchema: Schema.Struct<{
26
+ readonly title: Schema.String;
27
+ readonly description: Schema.optional<Schema.String>;
28
+ readonly dialog: Schema.optional<Schema.String>;
29
+ readonly heading: Schema.optional<Schema.String>;
30
+ readonly nearby: Schema.optional<Schema.String>;
31
+ readonly form: Schema.optional<Schema.Struct<{
32
+ readonly method: Schema.String;
33
+ readonly action: Schema.String;
34
+ readonly fields: Schema.$Array<Schema.Struct<{
35
+ readonly type: Schema.String;
36
+ readonly name: Schema.String;
37
+ readonly autocomplete: Schema.optional<Schema.String>;
38
+ readonly filled: Schema.Boolean;
39
+ }>>;
40
+ }>>;
41
+ }>;
42
+ //#endregion
43
+ //#region src/internal/input/targets.inpage.d.ts
44
+ type ResolvedPoint = typeof ResolvedPointSchema.Type;
45
+ type PointResult = typeof PointResultSchema.Type;
46
+ declare const targets: (names: Names, walked: Walk, placing: ContextReader) => {
47
+ controlOf: (hit: Element) => Element;
48
+ details: (element: Element, hit: Element, x: number, y: number) => Omit<ResolvedPoint, "context">;
49
+ hitAt: (root: Document | ShadowRoot, x: number, y: number) => Element | null;
50
+ hrefAttribute: (element: Element) => string | null;
51
+ linkOf: (element: Element) => Element | undefined;
52
+ point: (target: string | Point, scroll?: boolean) => PointResult;
53
+ receives: (element: Element, hit: Element) => boolean;
54
+ scrollPlan: (ref: string) => {
55
+ x: number;
56
+ y: number;
57
+ dx: number;
58
+ dy: number;
59
+ } | null;
60
+ within: (ancestor: Element, node: Element) => boolean;
61
+ };
62
+ type Targets = ReturnType<typeof targets>;
63
+ declare const ResolvedPointSchema: Schema.Struct<{
64
+ readonly x: Schema.Finite;
65
+ readonly y: Schema.Finite;
66
+ readonly role: Schema.NullOr<Schema.String>;
67
+ readonly name: Schema.String;
68
+ readonly tag: Schema.String;
69
+ readonly context: Schema.Struct<{
70
+ readonly row: Schema.optional<Schema.String>;
71
+ readonly column: Schema.optional<Schema.String>;
72
+ readonly label: Schema.optional<Schema.String>;
73
+ readonly heading: Schema.optional<Schema.String>;
74
+ }>;
75
+ readonly element: Schema.String;
76
+ readonly box: Schema.optional<Schema.Struct<{
77
+ readonly x: Schema.Finite;
78
+ readonly y: Schema.Finite;
79
+ readonly width: Schema.Finite;
80
+ readonly height: Schema.Finite;
81
+ }>>;
82
+ readonly cursor: Schema.String;
83
+ readonly href: Schema.optional<Schema.String>;
84
+ }>;
85
+ declare const PointResultSchema: Schema.Union<readonly [Schema.Struct<{
86
+ readonly x: Schema.Finite;
87
+ readonly y: Schema.Finite;
88
+ readonly role: Schema.NullOr<Schema.String>;
89
+ readonly name: Schema.String;
90
+ readonly tag: Schema.String;
91
+ readonly context: Schema.Struct<{
92
+ readonly row: Schema.optional<Schema.String>;
93
+ readonly column: Schema.optional<Schema.String>;
94
+ readonly label: Schema.optional<Schema.String>;
95
+ readonly heading: Schema.optional<Schema.String>;
96
+ }>;
97
+ readonly element: Schema.String;
98
+ readonly box: Schema.optional<Schema.Struct<{
99
+ readonly x: Schema.Finite;
100
+ readonly y: Schema.Finite;
101
+ readonly width: Schema.Finite;
102
+ readonly height: Schema.Finite;
103
+ }>>;
104
+ readonly cursor: Schema.String;
105
+ readonly href: Schema.optional<Schema.String>;
106
+ }>, Schema.Struct<{
107
+ readonly error: Schema.Literals<readonly ["stale", "hidden", "offscreen", "disabled", "covered", "outside"]>;
108
+ readonly detail: Schema.String;
109
+ }>]>;
110
+ //#endregion
111
+ //#region src/internal/input/guard.inpage.d.ts
112
+ interface InputPlan {
113
+ readonly action: string;
114
+ readonly targets: ReadonlyArray<string | Point | null>;
115
+ readonly submit: boolean;
116
+ readonly keys: string | null;
117
+ readonly destination: string | null;
118
+ }
119
+ type PreparedInput = Exclude<PreparedInputResult, InputFailure>;
120
+ /** A refusal; a stale target is named by its index in the plan. */
121
+ type InputFailure = typeof InputPreparationError.Encoded;
122
+ type PreparedInputResult = typeof PreparedInputResultSchema.Encoded;
123
+ type ValidatedInputResult = typeof ValidatedInputResultSchema.Encoded;
124
+ /** A point where a target, by its index in the plan, is about to receive a press. */
125
+ interface Press extends Point {
126
+ readonly index: number;
127
+ }
128
+ interface ValidationOptions {
129
+ /** Require focus on the first target. */
130
+ readonly focused?: boolean;
131
+ /** After the pointer's own events have run, each target must still receive its press. */
132
+ readonly presses?: ReadonlyArray<Press>;
133
+ }
134
+ declare const guard: (names: Names, targets: Targets, evidence: EvidenceReader) => {
135
+ prepareInput: (plan: InputPlan) => PreparedInputResult;
136
+ textEntry: (element: Element) => boolean;
137
+ typingRefusal: (element: Element, explicit: boolean) => string | undefined;
138
+ validateInput: (plan: InputPlan, prepared: PreparedInput, options?: ValidationOptions) => ValidatedInputResult | Promise<ValidatedInputResult>;
139
+ };
140
+ type Guard = ReturnType<typeof guard>;
141
+ declare const InputPreparationError: Schema.Struct<{
142
+ readonly error: Schema.String;
143
+ readonly detail: Schema.String;
144
+ readonly index: Schema.optional<Schema.Finite>;
145
+ }>;
146
+ declare const PreparedInputResultSchema: Schema.Union<readonly [Schema.Struct<{
147
+ readonly url: Schema.String;
148
+ readonly targets: Schema.$Array<Schema.NullOr<Schema.Struct<{
149
+ readonly ref: Schema.String;
150
+ readonly element: Schema.String;
151
+ readonly role: Schema.NullOr<Schema.String>;
152
+ readonly name: Schema.String;
153
+ readonly cursor: Schema.String;
154
+ readonly href: Schema.optional<Schema.String>;
155
+ /** A field the DOM marks as holding a password, a one-time code or a card's details. */
156
+ readonly secret: Schema.Boolean;
157
+ readonly fingerprint: Schema.String;
158
+ }>>>;
159
+ readonly facts: Schema.$Array<Schema.Literals<readonly ["form-submit", "cross-origin", "download", "upload", "secret", "scripted", "opaque"]>>;
160
+ readonly destination: Schema.optional<Schema.String>;
161
+ readonly evidence: Schema.Struct<{
162
+ readonly title: Schema.String;
163
+ readonly description: Schema.optional<Schema.String>;
164
+ readonly dialog: Schema.optional<Schema.String>;
165
+ readonly heading: Schema.optional<Schema.String>;
166
+ readonly nearby: Schema.optional<Schema.String>;
167
+ readonly form: Schema.optional<Schema.Struct<{
168
+ readonly method: Schema.String;
169
+ readonly action: Schema.String;
170
+ readonly fields: Schema.$Array<Schema.Struct<{
171
+ readonly type: Schema.String;
172
+ readonly name: Schema.String;
173
+ readonly autocomplete: Schema.optional<Schema.String>;
174
+ readonly filled: Schema.Boolean;
175
+ }>>;
176
+ }>>;
177
+ }>;
178
+ }>, Schema.Struct<{
179
+ readonly error: Schema.String;
180
+ readonly detail: Schema.String;
181
+ readonly index: Schema.optional<Schema.Finite>;
182
+ }>]>;
183
+ declare const ValidatedInputResultSchema: Schema.Union<readonly [Schema.Struct<{
184
+ readonly ok: Schema.Literal<true>;
185
+ }>, Schema.Struct<{
186
+ readonly error: Schema.String;
187
+ readonly detail: Schema.String;
188
+ readonly index: Schema.optional<Schema.Finite>;
189
+ }>]>;
190
+ //#endregion
191
+ //#region src/internal/input/edit.inpage.d.ts
192
+ type EditResult = typeof EditResultSchema.Encoded;
193
+ /** A focused field, and whether it is secret. */
194
+ type FocusResult = typeof FocusResultSchema.Encoded;
195
+ /**
196
+ * Whether text may be typed, and whether its field is secret. Typing into focus also names the
197
+ * focused field, when it is one, so the action records what it typed into.
198
+ */
199
+ type TypeableResult = typeof TypeableResultSchema.Encoded;
200
+ declare const edit: (names: Names, guard: Guard, placing: ContextReader) => {
201
+ focus: (ref: string, replace: boolean, follow: string | null) => FocusResult;
202
+ focusOn: (ref: string) => EditResult;
203
+ select: (ref: string, values: ReadonlyArray<string>) => EditResult;
204
+ typeable: (ref: string | null, secret: boolean) => TypeableResult;
205
+ };
206
+ type Edit = ReturnType<typeof edit>;
207
+ declare const TypeableResultSchema: Schema.Union<readonly [Schema.Struct<{
208
+ readonly ok: Schema.Literal<true>;
209
+ readonly secret: Schema.Boolean;
210
+ readonly subject: Schema.optional<typeof Subject>;
211
+ }>, Schema.Struct<{
212
+ readonly error: Schema.Literals<readonly ["stale", "untypeable"]>;
213
+ readonly detail: Schema.String;
214
+ }>]>;
215
+ declare const FocusResultSchema: Schema.Union<readonly [Schema.Struct<{
216
+ readonly ok: Schema.Literal<true>;
217
+ readonly detail: Schema.String;
218
+ readonly secret: Schema.Boolean;
219
+ }>, Schema.Struct<{
220
+ readonly error: Schema.String;
221
+ readonly stale: Schema.optional<Schema.Boolean>;
222
+ }>]>;
223
+ declare const EditResultSchema: Schema.Union<readonly [Schema.Struct<{
224
+ readonly ok: Schema.Literal<true>;
225
+ readonly detail: Schema.String;
226
+ }>, Schema.Struct<{
227
+ readonly error: Schema.String;
228
+ readonly stale: Schema.optional<Schema.Boolean>;
229
+ }>]>;
230
+ //#endregion
231
+ //#region src/internal/reading/expect.inpage.d.ts
232
+ /**
233
+ * What an expectation waits for of a query's matches: some, none, or a mark other than one `until`
234
+ * gave before.
235
+ */
236
+ type Want = "some" | "none" | {
237
+ readonly other: string;
238
+ };
239
+ declare const expectations: (names: Names, subjected: Subjects, matching: Match) => {
240
+ until: (request: FindRequest, want: Want, millis: number) => Promise<{
241
+ readonly invalid: string;
242
+ } | {
243
+ met: boolean;
244
+ mark: string;
245
+ }>;
246
+ };
247
+ type Expectations = ReturnType<typeof expectations>;
248
+ //#endregion
249
+ //#region src/internal/timeline/history.inpage.d.ts
250
+ /** How much the record keeps: elements, changes of each, and for how long. */
251
+ interface Bounds {
252
+ readonly tracks: number;
253
+ readonly samples: number;
254
+ readonly retention: number;
255
+ }
256
+ declare const history: (folding: Fold, bounds?: Bounds) => {
257
+ begin: (at: number) => void;
258
+ begun: () => boolean;
259
+ clear: () => void;
260
+ changing: () => number;
261
+ /** Keys whose tracks went since this was last asked, for the recorder to stop watching. */
262
+ forgotten: () => ReadonlyArray<object>;
263
+ has: (key: object) => boolean;
264
+ /** Whether the record has let `key` go: its later changes are counted, never kept. */
265
+ refuses: (key: object) => boolean;
266
+ lose: (at: number, count: number) => void;
267
+ note: (key: object, kind: Track["kind"], at: number, shown: Shown, initial: () => Shown) => Sample | undefined;
268
+ read: (since: number, until: number, now: number) => {
269
+ from: number;
270
+ dropped: number;
271
+ folded: Folded[];
272
+ };
273
+ /** Each element's history, and when the record let changes go, for a read to judge causes. */
274
+ recent: () => {
275
+ tracks: Track[];
276
+ losses: number[];
277
+ };
278
+ /** A track moves to the element that took its key's place, as a re-rendered price does. */
279
+ rekey: (from: object, to: object) => boolean;
280
+ settle: (key: object, sample: Sample, shown: Shown, seen: boolean) => void;
281
+ };
282
+ type History = ReturnType<typeof history>;
283
+ //#endregion
284
+ //#region src/internal/reading/ready.d.ts
285
+ /** What the page is still waiting for; none when it is ready. */
286
+ declare const ReadinessSchema: Schema.$Array<Schema.Literals<readonly ["load", "paint", "animations", "images", "fonts", "busy", "content", "changing"]>>;
287
+ type Readiness = typeof ReadinessSchema.Type;
288
+ //#endregion
289
+ //#region src/internal/reading/ready.inpage.d.ts
290
+ declare const ready: (walked: Walk, texts: Texts, kept: History) => {
291
+ wait: (millis: number, quietMillis?: number, clock?: string | null) => Promise<Readiness>;
292
+ settle: () => Promise<boolean>;
293
+ };
294
+ //#endregion
295
+ //#region src/internal/timeline/changes.d.ts
296
+ /**
297
+ * What a read sends back: its window and the record's state, and each change as `Change` encodes
298
+ * it, all on the page's clock.
299
+ */
300
+ declare const ChangesResultSchema: Schema.Struct<{
301
+ readonly until: Schema.Finite;
302
+ readonly from: Schema.Finite;
303
+ readonly dropped: Schema.Int;
304
+ readonly records: Schema.$Array<typeof Change>;
305
+ }>;
306
+ type ChangesResult = typeof ChangesResultSchema.Encoded;
307
+ //#endregion
308
+ //#region src/internal/timeline/sight.inpage.d.ts
309
+ declare const sight: (names: Names, walked: Walk, texts: Texts, kept: History) => {
310
+ /** Judge a sample at once if what it shows and whether it is in view are known, else on render. */
311
+ look: (element: Element, sample: Sample) => void;
312
+ /**
313
+ * Look at an element once, for its state when it next changes: as it renders, or `now`, by its
314
+ * style, as for the few the record looks at as it starts.
315
+ */
316
+ glance: (element: Element, now?: boolean) => void;
317
+ /** Whether the style of an element looked at once showed it, if it was. */
318
+ state: (element: Element) => boolean | undefined;
319
+ /** Whether a watched element was in view as the page last rendered it. */
320
+ viewed: (element: Element) => boolean;
321
+ unwatch: (element: Element) => void;
322
+ /** Judge now what the page has not rendered since it changed, as a hidden tab never does. */
323
+ settle: () => void;
324
+ clear: () => void;
325
+ };
326
+ type Sight = ReturnType<typeof sight>;
327
+ //#endregion
328
+ //#region src/internal/timeline/marks.inpage.d.ts
329
+ declare const marks: (names: Names, kept: History, seeing: Sight) => {
330
+ mark: (records: ReadonlyArray<MutationRecord>, at: number) => void;
331
+ /** Where a removed element was, which gives its context. */
332
+ placeOf: (key: object) => Element | undefined;
333
+ /** Start afresh, from the document's title now. */
334
+ reset: () => void;
335
+ };
336
+ type Marks = ReturnType<typeof marks>;
337
+ //#endregion
338
+ //#region src/internal/timeline/record.inpage.d.ts
339
+ declare const record: (names: Names, texts: Texts, kept: History, seeing: Sight, marking: Marks) => {
340
+ stop: () => void;
341
+ /** Record from now, once the document is parsed; each read keeps the record going. */
342
+ start: () => void;
343
+ /**
344
+ * Keep an input at `target` now, as a trusted one is kept: what a site does through its own
345
+ * app, whose events the page sees as untrusted, so its changes can name their cause.
346
+ */
347
+ note: (target: Element) => void;
348
+ inputs: () => ReadonlyArray<{
349
+ readonly at: number;
350
+ readonly target: Element;
351
+ }>;
352
+ };
353
+ type Recorder = ReturnType<typeof record>;
354
+ //#endregion
355
+ //#region src/internal/timeline/changes.inpage.d.ts
356
+ /** A window on the page's own clock: epoch milliseconds, or the record's start and now. */
357
+ interface ChangesRequest {
358
+ readonly since: number | null;
359
+ readonly until: number | null;
360
+ readonly unmask: boolean;
361
+ }
362
+ declare const changes: (names: Names, walked: Walk, placing: ContextReader, kept: History, seeing: Sight, marking: Marks, recorder: Recorder) => {
363
+ read: (request: ChangesRequest) => ChangesResult;
364
+ };
365
+ type Changes = ReturnType<typeof changes>;
366
+ //#endregion
367
+ //#region src/internal/page/pose.inpage.d.ts
368
+ interface PoseRequest {
369
+ readonly ref: string;
370
+ readonly dx: number;
371
+ readonly dy: number;
372
+ readonly sx: number;
373
+ readonly sy: number;
374
+ /** Degrees, clockwise. */
375
+ readonly rotate: number;
376
+ /** In the viewport, or null for the middle of where the page draws it. */
377
+ readonly origin: {
378
+ readonly x: number;
379
+ readonly y: number;
380
+ } | null;
381
+ }
382
+ type Prepared = {
383
+ readonly stale: string;
384
+ } | {
385
+ readonly invalid: string;
386
+ } | {
387
+ readonly apply: () => void;
388
+ };
389
+ declare const pose: (names: Names) => {
390
+ prepare: (requests: ReadonlyArray<PoseRequest>) => Prepared;
391
+ set: (requests: ReadonlyArray<PoseRequest>) => {};
392
+ clear: () => void;
393
+ };
394
+ type Posing = ReturnType<typeof pose>;
395
+ //#endregion
396
+ //#region src/internal/page/overlay.inpage.d.ts
397
+ declare const overlay: (names: Names) => {
398
+ draw: (markup: string | null) => {
399
+ x: number;
400
+ y: number;
401
+ width: number;
402
+ height: number;
403
+ }[];
404
+ mount: () => ShadowRoot;
405
+ };
406
+ type Overlay = ReturnType<typeof overlay>;
407
+ //#endregion
408
+ //#region src/internal/page/time.inpage.d.ts
409
+ interface StepRequest {
410
+ /** The page clock's event name. */
411
+ readonly clock: string;
412
+ readonly op: "hold" | "advance" | "release";
413
+ readonly by: number;
414
+ /** Where to scroll the document to, in CSS pixels down it, or null to leave it. */
415
+ readonly scroll: number | null;
416
+ /** What the overlay shows, null for nothing; left out, the overlay is left alone. */
417
+ readonly markup?: string | null | undefined;
418
+ /** The elements to pose, and no others; left out, poses are left alone. */
419
+ readonly poses?: ReadonlyArray<PoseRequest> | undefined;
420
+ }
421
+ declare const time: (overlaid: Overlay, posing: Posing) => {
422
+ step: (request: StepRequest) => {
423
+ stale: string;
424
+ told: boolean;
425
+ drawn: null;
426
+ scroll: {
427
+ x: number;
428
+ y: number;
429
+ };
430
+ } | {
431
+ invalid: string;
432
+ told: boolean;
433
+ drawn: null;
434
+ scroll: {
435
+ x: number;
436
+ y: number;
437
+ };
438
+ } | {
439
+ told: boolean;
440
+ drawn: {
441
+ x: number;
442
+ y: number;
443
+ width: number;
444
+ height: number;
445
+ }[] | null;
446
+ scroll: {
447
+ x: number;
448
+ y: number;
449
+ };
450
+ };
451
+ };
452
+ type Time = ReturnType<typeof time>;
453
+ //#endregion
454
+ //#region src/internal/page/bridge.d.ts
455
+ /** What the script installs: a version, and a function of one of its parts for each call. */
456
+ interface PageApi {
457
+ readonly version: number;
458
+ readonly refs: {
459
+ next: number;
460
+ };
461
+ dispose: () => void;
462
+ snapshot: Outline["snapshot"];
463
+ find: Subjects["find"];
464
+ layout: Layouts["read"];
465
+ overlay: Overlay["draw"];
466
+ pose: Posing["set"];
467
+ unpose: Posing["clear"];
468
+ step: Time["step"];
469
+ until: Expectations["until"];
470
+ text: Texts["read"];
471
+ record: Recorder["start"];
472
+ stopRecord: Recorder["stop"];
473
+ changes: Changes["read"];
474
+ ready: ReturnType<typeof ready>["wait"];
475
+ settle: ReturnType<typeof ready>["settle"];
476
+ point: Targets["point"];
477
+ scrollPlan: Targets["scrollPlan"];
478
+ viewport: Outline["viewport"];
479
+ /** The screen as the page reads it, which another session may emulate. */
480
+ screenSize: () => {
481
+ readonly width: number;
482
+ readonly height: number;
483
+ readonly ratio: number;
484
+ };
485
+ prepareInput: Guard["prepareInput"];
486
+ validateInput: Guard["validateInput"];
487
+ typeable: Edit["typeable"];
488
+ focus: Edit["focus"];
489
+ focusOn: Edit["focusOn"];
490
+ select: Edit["select"];
491
+ }
492
+ declare global {
493
+ var __effectBrowser: PageApi | undefined;
494
+ }
495
+ //#endregion
496
+ //#region src/internal/reading/reading.d.ts
497
+ /** The outline as a `Snapshot` reads it, or why `within` is not a selector. */
498
+ declare const SnapshotResultSchema: Schema.Union<readonly [Schema.Struct<{
499
+ readonly snapshot: typeof Snapshot;
500
+ }>, Schema.Struct<{
501
+ readonly invalid: Schema.String;
502
+ }>]>;
503
+ type SnapshotResult = typeof SnapshotResultSchema.Encoded;
504
+ /** What `text` sends back, or null when its ref no longer names an element. */
505
+ declare const TextResultSchema: Schema.NullOr<Schema.Struct<{
506
+ readonly text: Schema.String;
507
+ readonly truncated: Schema.Boolean;
508
+ readonly url: Schema.String;
509
+ readonly title: Schema.String;
510
+ }>>;
511
+ type TextResult = typeof TextResultSchema.Type;
512
+ //#endregion
513
+ //#region src/internal/reading/text.inpage.d.ts
514
+ interface TextRequest {
515
+ /** An element to read whole, or null for what the viewport shows. */
516
+ readonly ref: string | null;
517
+ readonly maxChars: number;
518
+ readonly unmask: boolean;
519
+ }
520
+ declare const text: (names: Names, walked: Walk) => {
521
+ cut: (lines: string, max: number) => {
522
+ text: string;
523
+ truncated: boolean;
524
+ };
525
+ lines: (root: Element | null, unmask: boolean) => string;
526
+ read: (request: TextRequest) => TextResult;
527
+ shown: (element: Element, unmask: boolean) => string | undefined;
528
+ };
529
+ type Texts = ReturnType<typeof text>;
530
+ //#endregion
531
+ //#region src/internal/reading/controls.inpage.d.ts
532
+ declare const controls: (names: Names, subjects: Subjects, texts: Texts) => {
533
+ controlOf: (element: Element, role: string | null, kind: string, name: string) => {
534
+ readonly ref: string;
535
+ readonly kind: string;
536
+ readonly name: string;
537
+ readonly value: string;
538
+ readonly options?: readonly string[] | undefined;
539
+ readonly optionCount?: number | undefined;
540
+ readonly disabled?: boolean | undefined;
541
+ readonly checked?: boolean | undefined;
542
+ readonly editable?: boolean | undefined;
543
+ };
544
+ rootsOf: (selector: string) => ReadonlyArray<Element> | {
545
+ readonly invalid: string;
546
+ };
547
+ states: (element: Element, role: string | null) => string;
548
+ valueOf: (element: Element) => string;
549
+ };
550
+ type Controls = ReturnType<typeof controls>;
551
+ //#endregion
552
+ //#region src/internal/reading/outline.inpage.d.ts
553
+ interface SnapshotRequest {
554
+ readonly full: boolean;
555
+ readonly query: string | null;
556
+ /** A CSS selector: only what is inside the elements it matches is read. */
557
+ readonly within: string | null;
558
+ readonly maxChars: number;
559
+ /** Give every control's box, not only a canvas's or a frame's. */
560
+ readonly boxes: boolean;
561
+ }
562
+ /** The rule every address the library reports goes by, which a link's address goes by too. */
563
+ type Url = ReturnType<typeof addresses>;
564
+ declare const outline: (names: Names, walked: Walk, subjects: Subjects, texts: Texts, controlling: Controls, url: Url) => {
565
+ snapshot: (request: SnapshotRequest) => SnapshotResult;
566
+ viewport: () => {
567
+ width: number;
568
+ height: number;
569
+ };
570
+ };
571
+ type Outline = ReturnType<typeof outline>;
572
+ //#endregion
573
+ //#region src/Site.d.ts
574
+ /**
575
+ * The readers, the change record, the overlay and poses for the current document. Make one for
576
+ * each document the site shows, and `stopRecord` the last one's.
577
+ */
578
+ export declare const make: () => {
579
+ /** What a query finds in the viewport: each element's ref, subject, box and state. */
580
+ find: (query: FindQuery) => {
581
+ invalid: string;
582
+ found?: undefined;
583
+ } | {
584
+ invalid?: undefined;
585
+ found: {
586
+ ref: string;
587
+ subject: {
588
+ role: string | null;
589
+ name: string;
590
+ tag: string;
591
+ context: {
592
+ readonly row?: string | undefined;
593
+ readonly column?: string | undefined;
594
+ readonly label?: string | undefined;
595
+ readonly heading?: string | undefined;
596
+ };
597
+ };
598
+ box: {
599
+ x: number;
600
+ y: number;
601
+ width: number;
602
+ height: number;
603
+ };
604
+ inViewport: boolean;
605
+ state: {
606
+ disabled: boolean;
607
+ checked: boolean | undefined;
608
+ expanded: boolean | undefined;
609
+ selected: boolean | undefined;
610
+ pressed: boolean | undefined;
611
+ focused: boolean;
612
+ level: number | undefined;
613
+ };
614
+ }[];
615
+ };
616
+ /** Where each pick is, unrounded, with a box for each of the words it asks for. */
617
+ layout: (picks: Picks) => {
618
+ invalid: string;
619
+ layout?: undefined;
620
+ } | {
621
+ invalid?: undefined;
622
+ layout: {
623
+ url: string;
624
+ viewport: {
625
+ width: number;
626
+ height: number;
627
+ };
628
+ scroll: {
629
+ x: number;
630
+ y: number;
631
+ };
632
+ scale: number;
633
+ places: {
634
+ id: string;
635
+ ref: string;
636
+ subject: {
637
+ role: string | null;
638
+ name: string;
639
+ tag: string;
640
+ context: {
641
+ readonly row?: string | undefined;
642
+ readonly column?: string | undefined;
643
+ readonly label?: string | undefined;
644
+ readonly heading?: string | undefined;
645
+ };
646
+ };
647
+ box: {
648
+ x: number;
649
+ y: number;
650
+ width: number;
651
+ height: number;
652
+ };
653
+ fixed: boolean;
654
+ words: {
655
+ text: string;
656
+ box: {
657
+ x: number;
658
+ y: number;
659
+ width: number;
660
+ height: number;
661
+ };
662
+ }[] | undefined;
663
+ }[];
664
+ missing: string[];
665
+ };
666
+ };
667
+ /** Wait up to `millis` until what a query finds in the document is as wanted. */
668
+ until: (query: FindQuery, want: Want, millis: number) => Promise<{
669
+ readonly invalid: string;
670
+ } | {
671
+ met: boolean;
672
+ mark: string;
673
+ }>;
674
+ /** The page as an outline of its subjects, each control with a ref. */
675
+ snapshot: (request: SnapshotRequest) => SnapshotResult;
676
+ /** The text the viewport shows, or one element's. */
677
+ text: (request: TextRequest) => TextResult;
678
+ /** Wait up to `millis` for what the page is still loading, quiet for `quietMillis`. */
679
+ ready: (millis: number, quietMillis?: number) => Promise<readonly ("animations" | "busy" | "changing" | "content" | "fonts" | "images" | "load" | "paint")[]>;
680
+ /** One task, then a frame; says whether the page painted. */
681
+ settle: () => Promise<boolean>;
682
+ /** Record what changes from now, until `stopRecord`, or two minutes with no `changes`. */
683
+ record: () => void;
684
+ stopRecord: () => void;
685
+ /** Keep an act the site did through its app at `target` now, for changes to name as cause. */
686
+ note: (target: Element) => void;
687
+ /** What changed in a window of the record, each change with its box. */
688
+ changes: (request: ChangesRequest) => ChangesResult;
689
+ /** Draw an SVG document over the viewport, or take it away with null; says where its parts are. */
690
+ draw: (markup: string | null) => {
691
+ x: number;
692
+ y: number;
693
+ width: number;
694
+ height: number;
695
+ }[];
696
+ /**
697
+ * A layer of the site's own over the viewport, which no reader reads and the record leaves
698
+ * out: a closed shadow root to render into. It takes no pointer, except parts that set
699
+ * `pointer-events: auto`.
700
+ */
701
+ layer: () => ShadowRoot;
702
+ /** Pose these elements and take the pose off every other. */
703
+ pose: (poses: ReadonlyArray<Pose>) => {};
704
+ unpose: () => void;
705
+ /** An element's ref, which `pose` and a read's `ref` take. */
706
+ ref: (element: Element) => string;
707
+ /** The element a ref names, while it is in the document. */
708
+ element: (ref: string) => Element | undefined;
709
+ /** An address without its userinfo or the parameters known to carry secrets. */
710
+ redact: (url: string) => string;
711
+ };
712
+ export type Site = ReturnType<typeof make>;
713
+ //#endregion
714
+ //# sourceMappingURL=Site.d.mts.map