@noldova/browser.window 0.0.0-stage → 0.0.1

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 (140) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -2
  3. package/package.json +62 -4
  4. package/src/api/index.d.ts +1922 -0
  5. package/src/api/index.js +33 -0
  6. package/src/api/index.js.map +1 -0
  7. package/src/app/components/agent-bar/agent-bar.component.js +42 -0
  8. package/src/app/components/agent-bar/agent-bar.component.js.map +1 -0
  9. package/src/app/components/agent-mark/agent-mark.component.js +58 -0
  10. package/src/app/components/agent-mark/agent-mark.component.js.map +1 -0
  11. package/src/app/components/clear-data-dialog/clear-data-dialog.component.js +23 -0
  12. package/src/app/components/clear-data-dialog/clear-data-dialog.component.js.map +1 -0
  13. package/src/app/components/page/page.component.js +264 -0
  14. package/src/app/components/page/page.component.js.map +1 -0
  15. package/src/app/components/page-state/page-state.component.js +100 -0
  16. package/src/app/components/page-state/page-state.component.js.map +1 -0
  17. package/src/app/components/pane-toolbar/pane-toolbar.component.js +295 -0
  18. package/src/app/components/pane-toolbar/pane-toolbar.component.js.map +1 -0
  19. package/src/app/components/request-notice/request-notice.component.js +73 -0
  20. package/src/app/components/request-notice/request-notice.component.js.map +1 -0
  21. package/src/app/enums/address-refusal.js +18 -0
  22. package/src/app/enums/address-refusal.js.map +1 -0
  23. package/src/app/enums/page-state-action.js +17 -0
  24. package/src/app/enums/page-state-action.js.map +1 -0
  25. package/src/app/enums/pane-state.js +17 -0
  26. package/src/app/enums/pane-state.js.map +1 -0
  27. package/src/app/enums/refused-request.js +17 -0
  28. package/src/app/enums/refused-request.js.map +1 -0
  29. package/src/app/enums/view-event-kind.js +20 -0
  30. package/src/app/enums/view-event-kind.js.map +1 -0
  31. package/src/app/enums/zoom-step.js +13 -0
  32. package/src/app/enums/zoom-step.js.map +1 -0
  33. package/src/app/exceptions/app-name-answer-malformed.exception.js +16 -0
  34. package/src/app/exceptions/app-name-answer-malformed.exception.js.map +1 -0
  35. package/src/app/exceptions/browser-window.exception.js +14 -0
  36. package/src/app/exceptions/browser-window.exception.js.map +1 -0
  37. package/src/app/exceptions/held-pages-answer-malformed.exception.js +16 -0
  38. package/src/app/exceptions/held-pages-answer-malformed.exception.js.map +1 -0
  39. package/src/app/exceptions/link-refused.exception.js +18 -0
  40. package/src/app/exceptions/link-refused.exception.js.map +1 -0
  41. package/src/app/exceptions/open-page-arguments-invalid.exception.js +16 -0
  42. package/src/app/exceptions/open-page-arguments-invalid.exception.js.map +1 -0
  43. package/src/app/exceptions/page-activities-answer-malformed.exception.js +16 -0
  44. package/src/app/exceptions/page-activities-answer-malformed.exception.js.map +1 -0
  45. package/src/app/exceptions/page-activity-event-malformed.exception.js +16 -0
  46. package/src/app/exceptions/page-activity-event-malformed.exception.js.map +1 -0
  47. package/src/app/exceptions/page-claim-answer-malformed.exception.js +16 -0
  48. package/src/app/exceptions/page-claim-answer-malformed.exception.js.map +1 -0
  49. package/src/app/exceptions/page-in-another-window.exception.js +18 -0
  50. package/src/app/exceptions/page-in-another-window.exception.js.map +1 -0
  51. package/src/app/exceptions/page-on-other-workspace.exception.js +20 -0
  52. package/src/app/exceptions/page-on-other-workspace.exception.js.map +1 -0
  53. package/src/app/exceptions/page-record-answer-malformed.exception.js +16 -0
  54. package/src/app/exceptions/page-record-answer-malformed.exception.js.map +1 -0
  55. package/src/app/exceptions/pages-inactive.exception.js +16 -0
  56. package/src/app/exceptions/pages-inactive.exception.js.map +1 -0
  57. package/src/app/exceptions/pane-unavailable.exception.js +16 -0
  58. package/src/app/exceptions/pane-unavailable.exception.js.map +1 -0
  59. package/src/app/exceptions/runtime-answer-malformed.exception.js +16 -0
  60. package/src/app/exceptions/runtime-answer-malformed.exception.js.map +1 -0
  61. package/src/app/exceptions/typed-address-answer-malformed.exception.js +16 -0
  62. package/src/app/exceptions/typed-address-answer-malformed.exception.js.map +1 -0
  63. package/src/app/models/page-opening.js +18 -0
  64. package/src/app/models/page-opening.js.map +1 -0
  65. package/src/app/models/page-state-text.js +18 -0
  66. package/src/app/models/page-state-text.js.map +1 -0
  67. package/src/app/models/pane-states.js +15 -0
  68. package/src/app/models/pane-states.js.map +1 -0
  69. package/src/app/models/pane-status.js +99 -0
  70. package/src/app/models/pane-status.js.map +1 -0
  71. package/src/app/models/pane-tab.js +29 -0
  72. package/src/app/models/pane-tab.js.map +1 -0
  73. package/src/app/models/popup-offer.js +18 -0
  74. package/src/app/models/popup-offer.js.map +1 -0
  75. package/src/app/models/read-address.js +17 -0
  76. package/src/app/models/read-address.js.map +1 -0
  77. package/src/app/models/refused-page.js +18 -0
  78. package/src/app/models/refused-page.js.map +1 -0
  79. package/src/app/models/request-notice.js +18 -0
  80. package/src/app/models/request-notice.js.map +1 -0
  81. package/src/app/models/site-list.js +54 -0
  82. package/src/app/models/site-list.js.map +1 -0
  83. package/src/app/models/typed-load.js +29 -0
  84. package/src/app/models/typed-load.js.map +1 -0
  85. package/src/app/models/view-close-event.js +24 -0
  86. package/src/app/models/view-close-event.js.map +1 -0
  87. package/src/app/models/view-crash-event.js +23 -0
  88. package/src/app/models/view-crash-event.js.map +1 -0
  89. package/src/app/models/view-event.js +10 -0
  90. package/src/app/models/view-event.js.map +1 -0
  91. package/src/app/models/view-key-event.js +25 -0
  92. package/src/app/models/view-key-event.js.map +1 -0
  93. package/src/app/models/view-load-failure-event.js +29 -0
  94. package/src/app/models/view-load-failure-event.js.map +1 -0
  95. package/src/app/models/view-new-window-event.js +29 -0
  96. package/src/app/models/view-new-window-event.js.map +1 -0
  97. package/src/app/models/view-profile-cleared-event.js +25 -0
  98. package/src/app/models/view-profile-cleared-event.js.map +1 -0
  99. package/src/app/models/view-refusal-event.js +31 -0
  100. package/src/app/models/view-refusal-event.js.map +1 -0
  101. package/src/app/models/view-request-refusal-event.js +27 -0
  102. package/src/app/models/view-request-refusal-event.js.map +1 -0
  103. package/src/app/models/view-state-event.js +33 -0
  104. package/src/app/models/view-state-event.js.map +1 -0
  105. package/src/app/models/view-zoom-event.js +25 -0
  106. package/src/app/models/view-zoom-event.js.map +1 -0
  107. package/src/app/services/address-reader.js +35 -0
  108. package/src/app/services/address-reader.js.map +1 -0
  109. package/src/app/services/agent-pages.js +50 -0
  110. package/src/app/services/agent-pages.js.map +1 -0
  111. package/src/app/services/browser-window-part.js +46 -0
  112. package/src/app/services/browser-window-part.js.map +1 -0
  113. package/src/app/services/link-places.js +49 -0
  114. package/src/app/services/link-places.js.map +1 -0
  115. package/src/app/services/local-site-check.js +16 -0
  116. package/src/app/services/local-site-check.js.map +1 -0
  117. package/src/app/services/mark-layer.js +51 -0
  118. package/src/app/services/mark-layer.js.map +1 -0
  119. package/src/app/services/open-page-arguments.js +35 -0
  120. package/src/app/services/open-page-arguments.js.map +1 -0
  121. package/src/app/services/page-answers.js +59 -0
  122. package/src/app/services/page-answers.js.map +1 -0
  123. package/src/app/services/page-keys.js +31 -0
  124. package/src/app/services/page-keys.js.map +1 -0
  125. package/src/app/services/pages.js +552 -0
  126. package/src/app/services/pages.js.map +1 -0
  127. package/src/app/services/pane-controller.js +138 -0
  128. package/src/app/services/pane-controller.js.map +1 -0
  129. package/src/app/services/pane-hearing.js +80 -0
  130. package/src/app/services/pane-hearing.js.map +1 -0
  131. package/src/app/services/placeholder-tracker.js +33 -0
  132. package/src/app/services/placeholder-tracker.js.map +1 -0
  133. package/src/app/services/web-view-event-reader.js +76 -0
  134. package/src/app/services/web-view-event-reader.js.map +1 -0
  135. package/src/app/types/address-reading.js +8 -0
  136. package/src/app/types/address-reading.js.map +1 -0
  137. package/src/app/types/page-place.js +8 -0
  138. package/src/app/types/page-place.js.map +1 -0
  139. package/src/resources.js +372 -0
  140. package/src/resources.js.map +1 -0
@@ -0,0 +1,1922 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ import type { Exception, ExceptionOptions } from "@noldova/context.exceptions";
10
+ import type { WebViewNavigation } from "@noldova/desktop.protocol";
11
+ import type { IWebViewHandle, IWindowPart } from "@noldova/desktop.window";
12
+
13
+ /**
14
+ * Why the pane didn't go to an address the person typed: the pane's or the runtime part's refusal, the protocol's `TypedAddressRefusal`
15
+ * with the same values, or `Failed` when the runtime part's request to allow the address failed.
16
+ */
17
+ export declare const AddressRefusal: {
18
+ /**
19
+ * The text isn't a web address, value `"NotAnAddress"`.
20
+ */
21
+ readonly NotAnAddress: "NotAnAddress";
22
+
23
+ /**
24
+ * The address's scheme isn't http: or https:, value `"NotWeb"`.
25
+ */
26
+ readonly NotWeb: "NotWeb";
27
+
28
+ /**
29
+ * The address is too long to open, value `"TooLong"`.
30
+ */
31
+ readonly TooLong: "TooLong";
32
+
33
+ /**
34
+ * The address holds a user name or password, value `"Credentials"`.
35
+ */
36
+ readonly Credentials: "Credentials";
37
+
38
+ /**
39
+ * The address is on this computer or its network, and Settings doesn't name its site, value `"Local"`.
40
+ */
41
+ readonly Local: "Local";
42
+
43
+ /**
44
+ * Browser never opens the address, value `"NeverAllowed"`.
45
+ */
46
+ readonly NeverAllowed: "NeverAllowed";
47
+
48
+ /**
49
+ * The runtime part's request to allow the address failed, such as when the module's storage failed, value `"Failed"`.
50
+ */
51
+ readonly Failed: "Failed";
52
+ };
53
+
54
+ /**
55
+ * One of {@link AddressRefusal}'s values.
56
+ */
57
+ export declare type AddressRefusal = (typeof AddressRefusal)[keyof typeof AddressRefusal];
58
+
59
+ /**
60
+ * What the pane shows for its page.
61
+ */
62
+ export declare const PaneState: {
63
+ /**
64
+ * Before the pane's first navigation, value `"Empty"`.
65
+ */
66
+ readonly Empty: "Empty";
67
+
68
+ /**
69
+ * While a page loads, value `"Loading"`.
70
+ */
71
+ readonly Loading: "Loading";
72
+
73
+ /**
74
+ * Once the page has loaded, value `"Loaded"`.
75
+ */
76
+ readonly Loaded: "Loaded";
77
+
78
+ /**
79
+ * The load failed, value `"Failed"`.
80
+ */
81
+ readonly Failed: "Failed";
82
+
83
+ /**
84
+ * The origin check refused the navigation, value `"Refused"`.
85
+ */
86
+ readonly Refused: "Refused";
87
+
88
+ /**
89
+ * The page's process ended, value `"Crashed"`.
90
+ */
91
+ readonly Crashed: "Crashed";
92
+
93
+ /**
94
+ * Noldova Desktop gave the pane no view, or the host closed its view, so it can show no page, value `"Unavailable"`.
95
+ */
96
+ readonly Unavailable: "Unavailable";
97
+ };
98
+
99
+ /**
100
+ * One of {@link PaneState}'s values.
101
+ */
102
+ export declare type PaneState = (typeof PaneState)[keyof typeof PaneState];
103
+
104
+ /**
105
+ * The kinds of the events the pane follows, each the `kind` of one {@link ViewEvent}.
106
+ */
107
+ export declare const ViewEventKind: {
108
+ /**
109
+ * The host closed the view, from Noldova Desktop's `Closed` event, value `"Closed"`.
110
+ */
111
+ readonly Closed: "Closed";
112
+
113
+ /**
114
+ * The page's address, title, loading or history changed, from the `State` event, value `"State"`.
115
+ */
116
+ readonly State: "State";
117
+
118
+ /**
119
+ * A load failed, from the `LoadFailed` event, value `"LoadFailed"`.
120
+ */
121
+ readonly LoadFailed: "LoadFailed";
122
+
123
+ /**
124
+ * The origin check refused a navigation, from the `NavigationRefused` event, value `"NavigationRefused"`.
125
+ */
126
+ readonly NavigationRefused: "NavigationRefused";
127
+
128
+ /**
129
+ * The page's process ended, from the `Crashed` event, value `"Crashed"`.
130
+ */
131
+ readonly Crashed: "Crashed";
132
+
133
+ /**
134
+ * A profile's data was cleared, from the `ProfileCleared` event, value `"ProfileCleared"`.
135
+ */
136
+ readonly ProfileCleared: "ProfileCleared";
137
+
138
+ /**
139
+ * The host refused something the page asked for, from the `RequestRefused` event, value `"RequestRefused"`.
140
+ */
141
+ readonly RequestRefused: "RequestRefused";
142
+
143
+ /**
144
+ * The page asked for a new window, from the `NewWindowRequested` event, value `"NewWindowRequested"`.
145
+ */
146
+ readonly NewWindowRequested: "NewWindowRequested";
147
+
148
+ /**
149
+ * The person pressed one of the pane's keys in the page, from the `Key` event, value `"Key"`.
150
+ */
151
+ readonly Key: "Key";
152
+
153
+ /**
154
+ * The view's zoom changed, from the `Zoom` event, value `"Zoom"`.
155
+ */
156
+ readonly Zoom: "Zoom";
157
+ };
158
+
159
+ /**
160
+ * One of {@link ViewEventKind}'s values.
161
+ */
162
+ export declare type ViewEventKind = (typeof ViewEventKind)[keyof typeof ViewEventKind];
163
+
164
+ /**
165
+ * An event the host sends about a pane's page; each kind is its own class, whose `kind` names it, and each gives the pane's status after it
166
+ * and tells the pane's {@link PaneHearing} of it.
167
+ *
168
+ * @remarks
169
+ * The pane reads them from Noldova Desktop's `WebViewEvent`; it follows no other kind.
170
+ */
171
+ export declare abstract class ViewEvent {
172
+ /**
173
+ * Names this event's kind among the {@link ViewEvent} classes.
174
+ */
175
+ public abstract readonly kind: ViewEventKind;
176
+
177
+ /**
178
+ * Gives the pane's status after this event, as {@link PaneStatus.apply} does.
179
+ *
180
+ * @param status The status before the event.
181
+ * @returns The new status; this same status when the event changes nothing shown.
182
+ * @example
183
+ * ```ts
184
+ * import { PaneStatus, type ViewEvent } from "@noldova/browser.window";
185
+ *
186
+ * function after(event: ViewEvent): PaneStatus {
187
+ * return event.applyTo(PaneStatus.empty);
188
+ * }
189
+ * ```
190
+ */
191
+ public abstract applyTo(status: PaneStatus): PaneStatus;
192
+
193
+ /**
194
+ * Tells the pane's hearing of this event: the listeners of its kind, or the status it changes.
195
+ *
196
+ * @param hearing The pane's hearing, which its {@link PaneController} keeps.
197
+ * @example
198
+ * ```ts
199
+ * import type { PaneHearing, ViewEvent } from "@noldova/browser.window";
200
+ *
201
+ * function hear(event: ViewEvent, hearing: PaneHearing): void {
202
+ * event.followIn(hearing);
203
+ * }
204
+ * ```
205
+ */
206
+ public abstract followIn(hearing: PaneHearing): void;
207
+ }
208
+
209
+ /**
210
+ * The host closed the view; it sends no more events and refuses every call.
211
+ *
212
+ * @remarks
213
+ * The pane reads it from Noldova Desktop's `Closed` web view event.
214
+ */
215
+ export declare class ViewCloseEvent extends ViewEvent {
216
+ /**
217
+ * Names this event's kind among the {@link ViewEvent} classes.
218
+ */
219
+ public readonly kind: typeof ViewEventKind.Closed;
220
+
221
+ /**
222
+ * Makes the event.
223
+ *
224
+ * @example
225
+ * ```ts
226
+ * import { ViewCloseEvent } from "@noldova/browser.window";
227
+ *
228
+ * const closed: ViewCloseEvent = new ViewCloseEvent();
229
+ * ```
230
+ */
231
+ public constructor();
232
+
233
+ /**
234
+ * Gives {@link PaneStatus.unavailable}, whatever the status before.
235
+ *
236
+ * @returns {@link PaneStatus.unavailable}.
237
+ * @example
238
+ * ```ts
239
+ * import { PaneStatus, ViewCloseEvent } from "@noldova/browser.window";
240
+ *
241
+ * const after: PaneStatus = new ViewCloseEvent().applyTo();
242
+ * ```
243
+ */
244
+ public applyTo(): PaneStatus;
245
+
246
+ /**
247
+ * Tells the hearing to change the pane's status by this event, as {@link PaneHearing.change} does.
248
+ *
249
+ * @param hearing The pane's hearing.
250
+ * @example
251
+ * ```ts
252
+ * import { PaneHearing, ViewCloseEvent } from "@noldova/browser.window";
253
+ *
254
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
255
+ * new ViewCloseEvent().followIn(hearing);
256
+ * ```
257
+ */
258
+ public followIn(hearing: PaneHearing): void;
259
+ }
260
+
261
+ /**
262
+ * The page's process ended unexpectedly; the view stays empty until it is navigated or reloaded.
263
+ *
264
+ * @remarks
265
+ * The pane reads it from Noldova Desktop's `Crashed` web view event.
266
+ */
267
+ export declare class ViewCrashEvent extends ViewEvent {
268
+ /**
269
+ * Names this event's kind among the {@link ViewEvent} classes.
270
+ */
271
+ public readonly kind: typeof ViewEventKind.Crashed;
272
+
273
+ /**
274
+ * Makes the event.
275
+ *
276
+ * @example
277
+ * ```ts
278
+ * import { ViewCrashEvent } from "@noldova/browser.window";
279
+ *
280
+ * const crashed: ViewCrashEvent = new ViewCrashEvent();
281
+ * ```
282
+ */
283
+ public constructor();
284
+
285
+ /**
286
+ * Gives the status of a crashed page, as {@link PaneStatus.crash} does.
287
+ *
288
+ * @param status The status before the event.
289
+ * @returns The crashed status.
290
+ * @example
291
+ * ```ts
292
+ * import { PaneStatus, ViewCrashEvent } from "@noldova/browser.window";
293
+ *
294
+ * const after: PaneStatus = new ViewCrashEvent().applyTo(PaneStatus.empty);
295
+ * ```
296
+ */
297
+ public applyTo(status: PaneStatus): PaneStatus;
298
+
299
+ /**
300
+ * Tells the hearing to change the pane's status by this event, as {@link PaneHearing.change} does.
301
+ *
302
+ * @param hearing The pane's hearing.
303
+ * @example
304
+ * ```ts
305
+ * import { PaneHearing, ViewCrashEvent } from "@noldova/browser.window";
306
+ *
307
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
308
+ * new ViewCrashEvent().followIn(hearing);
309
+ * ```
310
+ */
311
+ public followIn(hearing: PaneHearing): void;
312
+ }
313
+
314
+ /**
315
+ * One of the pane's keys that the person pressed in the page, such as reload on Ctrl+R or F5.
316
+ *
317
+ * @remarks
318
+ * The pane reads it from Noldova Desktop's `Key` web view event, which the host sends for the keys the module declares in its
319
+ * `webViews.json`; an agent's key events never send it.
320
+ */
321
+ export declare class ViewKeyEvent extends ViewEvent {
322
+ /**
323
+ * Names this event's kind among the {@link ViewEvent} classes.
324
+ */
325
+ public readonly kind: typeof ViewEventKind.Key;
326
+
327
+ /**
328
+ * The key's name in `webViews.json`: `reload`, `newPage` or `focusAddress`.
329
+ */
330
+ public readonly name: string;
331
+
332
+ /**
333
+ * Makes the event.
334
+ *
335
+ * @param name The key's name in `webViews.json`.
336
+ * @example
337
+ * ```ts
338
+ * import { ViewKeyEvent } from "@noldova/browser.window";
339
+ *
340
+ * const reload: ViewKeyEvent = new ViewKeyEvent("reload");
341
+ * ```
342
+ */
343
+ public constructor(name: string);
344
+
345
+ /**
346
+ * Gives the status unchanged: a key changes nothing shown.
347
+ *
348
+ * @param status The status before the event.
349
+ * @returns This same status: the event changes nothing shown.
350
+ * @example
351
+ * ```ts
352
+ * import { PaneStatus, ViewKeyEvent } from "@noldova/browser.window";
353
+ *
354
+ * const after: PaneStatus = new ViewKeyEvent("reload").applyTo(PaneStatus.empty);
355
+ * ```
356
+ */
357
+ public applyTo(status: PaneStatus): PaneStatus;
358
+
359
+ /**
360
+ * Tells the hearing's key listeners of the key, as {@link PaneHearing.pressKey} does.
361
+ *
362
+ * @param hearing The pane's hearing.
363
+ * @example
364
+ * ```ts
365
+ * import { PaneHearing, ViewKeyEvent } from "@noldova/browser.window";
366
+ *
367
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
368
+ * new ViewKeyEvent("reload").followIn(hearing);
369
+ * ```
370
+ */
371
+ public followIn(hearing: PaneHearing): void;
372
+ }
373
+
374
+ /**
375
+ * The view's new zoom, which the pane's calls, the person's keys or the wheel set.
376
+ *
377
+ * @remarks
378
+ * The pane reads it from Noldova Desktop's `Zoom` web view event, which only the window part gets; the view keeps its zoom across its navigations.
379
+ */
380
+ export declare class ViewZoomEvent extends ViewEvent {
381
+ /**
382
+ * Names this event's kind among the {@link ViewEvent} classes.
383
+ */
384
+ public readonly kind: typeof ViewEventKind.Zoom;
385
+
386
+ /**
387
+ * The zoom as a factor, 1 for 100%, from 0.25 to 5.
388
+ */
389
+ public readonly factor: number;
390
+
391
+ /**
392
+ * Makes the event.
393
+ *
394
+ * @param factor The zoom as a factor, 1 for 100%.
395
+ * @example
396
+ * ```ts
397
+ * import { ViewZoomEvent } from "@noldova/browser.window";
398
+ *
399
+ * const zoomed: ViewZoomEvent = new ViewZoomEvent(1.25);
400
+ * ```
401
+ */
402
+ public constructor(factor: number);
403
+
404
+ /**
405
+ * Gives the status unchanged: a zoom changes nothing shown.
406
+ *
407
+ * @param status The status before the event.
408
+ * @returns This same status: the event changes nothing shown.
409
+ * @example
410
+ * ```ts
411
+ * import { PaneStatus, ViewZoomEvent } from "@noldova/browser.window";
412
+ *
413
+ * const after: PaneStatus = new ViewZoomEvent(1.25).applyTo(PaneStatus.empty);
414
+ * ```
415
+ */
416
+ public applyTo(status: PaneStatus): PaneStatus;
417
+
418
+ /**
419
+ * Tells the hearing the view's new zoom, as {@link PaneHearing.zoomTo} does.
420
+ *
421
+ * @param hearing The pane's hearing.
422
+ * @example
423
+ * ```ts
424
+ * import { PaneHearing, ViewZoomEvent } from "@noldova/browser.window";
425
+ *
426
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
427
+ * new ViewZoomEvent(1.25).followIn(hearing);
428
+ * ```
429
+ */
430
+ public followIn(hearing: PaneHearing): void;
431
+ }
432
+
433
+ /**
434
+ * A load of the page failed.
435
+ *
436
+ * @remarks
437
+ * The pane reads it from Noldova Desktop's `LoadFailed` web view event.
438
+ */
439
+ export declare class ViewLoadFailureEvent extends ViewEvent {
440
+ /**
441
+ * Names this event's kind among the {@link ViewEvent} classes.
442
+ */
443
+ public readonly kind: typeof ViewEventKind.LoadFailed;
444
+
445
+ /**
446
+ * The address that failed to load.
447
+ */
448
+ public readonly address: string;
449
+
450
+ /**
451
+ * The engine's code for the failure, such as `-105`.
452
+ */
453
+ public readonly code: number;
454
+
455
+ /**
456
+ * The engine's description of the failure, such as `ERR_NAME_NOT_RESOLVED`.
457
+ */
458
+ public readonly description: string;
459
+
460
+ /**
461
+ * Makes the event.
462
+ *
463
+ * @param address The address that failed to load.
464
+ * @param code The engine's code for the failure.
465
+ * @param description The engine's description of the failure.
466
+ * @example
467
+ * ```ts
468
+ * import { ViewLoadFailureEvent } from "@noldova/browser.window";
469
+ *
470
+ * const failed: ViewLoadFailureEvent = new ViewLoadFailureEvent("https://www.example.com/", -105, "ERR_NAME_NOT_RESOLVED");
471
+ * ```
472
+ */
473
+ public constructor(address: string, code: number, description: string);
474
+
475
+ /**
476
+ * Gives the status of the failed load, as {@link PaneStatus.fail} does.
477
+ *
478
+ * @param status The status before the event.
479
+ * @returns The failed status.
480
+ * @example
481
+ * ```ts
482
+ * import { PaneStatus, ViewLoadFailureEvent } from "@noldova/browser.window";
483
+ *
484
+ * const after: PaneStatus = new ViewLoadFailureEvent("https://www.example.com/", -105, "ERR_NAME_NOT_RESOLVED").applyTo(PaneStatus.empty);
485
+ * ```
486
+ */
487
+ public applyTo(status: PaneStatus): PaneStatus;
488
+
489
+ /**
490
+ * Tells the hearing of the failed load, as {@link PaneHearing.fail} does: it changes the status unless it ends a load the origin check refused.
491
+ *
492
+ * @param hearing The pane's hearing.
493
+ * @example
494
+ * ```ts
495
+ * import { PaneHearing, ViewLoadFailureEvent } from "@noldova/browser.window";
496
+ *
497
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
498
+ * new ViewLoadFailureEvent("https://www.example.com/", -105, "ERR_NAME_NOT_RESOLVED").followIn(hearing);
499
+ * ```
500
+ */
501
+ public followIn(hearing: PaneHearing): void;
502
+ }
503
+
504
+ /**
505
+ * A page asked for a new window, such as a link with `target="_blank"` or a script's `window.open`.
506
+ *
507
+ * @remarks
508
+ * The pane reads it from Noldova Desktop's `NewWindowRequested` web view event, which the module takes because its `webViews.json` says
509
+ * `"newWindows": true`.
510
+ */
511
+ export declare class ViewNewWindowEvent extends ViewEvent {
512
+ /**
513
+ * Names this event's kind among the {@link ViewEvent} classes.
514
+ */
515
+ public readonly kind: typeof ViewEventKind.NewWindowRequested;
516
+
517
+ /**
518
+ * The address the page asked for, resolved against the page.
519
+ */
520
+ public readonly address: string;
521
+
522
+ /**
523
+ * Whether the person's own key, mouse button or touch reached the view in the last 5 seconds, as the host judges it.
524
+ */
525
+ public readonly hadRecentInput: boolean;
526
+
527
+ /**
528
+ * The origin of the referrer the engine would send, or `null` when it sends none.
529
+ */
530
+ public readonly origin: string | null;
531
+
532
+ /**
533
+ * Makes the event.
534
+ *
535
+ * @param address The address the page asked for.
536
+ * @param hadRecentInput Whether the person's own input reached the view in the last 5 seconds.
537
+ * @param origin The origin of the referrer, or `null`.
538
+ * @example
539
+ * ```ts
540
+ * import { ViewNewWindowEvent } from "@noldova/browser.window";
541
+ *
542
+ * const asked: ViewNewWindowEvent = new ViewNewWindowEvent("https://www.example.com/", true, "https://docs.example.com");
543
+ * ```
544
+ */
545
+ public constructor(address: string, hadRecentInput: boolean, origin: string | null);
546
+
547
+ /**
548
+ * Gives the status unchanged: the pane offers a new window only through {@link PaneController.offerPopup}.
549
+ *
550
+ * @param status The status before the event.
551
+ * @returns This same status: the event changes nothing shown.
552
+ * @example
553
+ * ```ts
554
+ * import { PaneStatus, ViewNewWindowEvent } from "@noldova/browser.window";
555
+ *
556
+ * const after: PaneStatus = new ViewNewWindowEvent("https://www.example.com/", true, "https://docs.example.com").applyTo(PaneStatus.empty);
557
+ * ```
558
+ */
559
+ public applyTo(status: PaneStatus): PaneStatus;
560
+
561
+ /**
562
+ * Tells the hearing's new-window listeners of the request, as {@link PaneHearing.openWindow} does.
563
+ *
564
+ * @param hearing The pane's hearing.
565
+ * @example
566
+ * ```ts
567
+ * import { PaneHearing, ViewNewWindowEvent } from "@noldova/browser.window";
568
+ *
569
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
570
+ * new ViewNewWindowEvent("https://www.example.com/", true, "https://docs.example.com").followIn(hearing);
571
+ * ```
572
+ */
573
+ public followIn(hearing: PaneHearing): void;
574
+ }
575
+
576
+ /**
577
+ * The view's profile was cleared of its cookies, storage and cache, and the view's pending calls ended.
578
+ *
579
+ * @remarks
580
+ * The pane reads it from Noldova Desktop's `ProfileCleared` web view event.
581
+ */
582
+ export declare class ViewProfileClearedEvent extends ViewEvent {
583
+ /**
584
+ * Names this event's kind among the {@link ViewEvent} classes.
585
+ */
586
+ public readonly kind: typeof ViewEventKind.ProfileCleared;
587
+
588
+ /**
589
+ * The key of the profile that was cleared.
590
+ */
591
+ public readonly profileKey: string;
592
+
593
+ /**
594
+ * Makes the event.
595
+ *
596
+ * @param profileKey The key of the profile that was cleared.
597
+ * @example
598
+ * ```ts
599
+ * import { ViewProfileClearedEvent } from "@noldova/browser.window";
600
+ *
601
+ * const cleared: ViewProfileClearedEvent = new ViewProfileClearedEvent("workspace-1");
602
+ * ```
603
+ */
604
+ public constructor(profileKey: string);
605
+
606
+ /**
607
+ * Gives the status unchanged: a cleared profile changes nothing shown.
608
+ *
609
+ * @param status The status before the event.
610
+ * @returns This same status: the event changes nothing shown.
611
+ * @example
612
+ * ```ts
613
+ * import { PaneStatus, ViewProfileClearedEvent } from "@noldova/browser.window";
614
+ *
615
+ * const after: PaneStatus = new ViewProfileClearedEvent("workspace-1").applyTo(PaneStatus.empty);
616
+ * ```
617
+ */
618
+ public applyTo(status: PaneStatus): PaneStatus;
619
+
620
+ /**
621
+ * Tells the hearing to change the pane's status by this event, as {@link PaneHearing.change} does.
622
+ *
623
+ * @param hearing The pane's hearing.
624
+ * @example
625
+ * ```ts
626
+ * import { PaneHearing, ViewProfileClearedEvent } from "@noldova/browser.window";
627
+ *
628
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
629
+ * new ViewProfileClearedEvent("workspace-1").followIn(hearing);
630
+ * ```
631
+ */
632
+ public followIn(hearing: PaneHearing): void;
633
+ }
634
+
635
+ /**
636
+ * The origin check refused a navigation of the page, such as a link or a redirect; the page stays where it was.
637
+ *
638
+ * @remarks
639
+ * The pane reads it from Noldova Desktop's `NavigationRefused` web view event.
640
+ */
641
+ export declare class ViewRefusalEvent extends ViewEvent {
642
+ /**
643
+ * Names this event's kind among the {@link ViewEvent} classes.
644
+ */
645
+ public readonly kind: typeof ViewEventKind.NavigationRefused;
646
+
647
+ /**
648
+ * The address the check refused.
649
+ */
650
+ public readonly address: string;
651
+
652
+ /**
653
+ * The address's origin, as the URL standard writes it.
654
+ */
655
+ public readonly origin: string;
656
+
657
+ /**
658
+ * Whether a redirect led to the address.
659
+ */
660
+ public readonly isRedirect: boolean;
661
+
662
+ /**
663
+ * Makes the event.
664
+ *
665
+ * @param address The address the check refused.
666
+ * @param origin The address's origin, as the URL standard writes it.
667
+ * @param isRedirect Whether a redirect led to the address.
668
+ * @example
669
+ * ```ts
670
+ * import { ViewRefusalEvent } from "@noldova/browser.window";
671
+ *
672
+ * const refused: ViewRefusalEvent = new ViewRefusalEvent("https://www.example.com/", "https://www.example.com", false);
673
+ * ```
674
+ */
675
+ public constructor(address: string, origin: string, isRedirect: boolean);
676
+
677
+ /**
678
+ * Gives the status with this origin refused, as {@link PaneStatus.refuse} does; when the pane isn't loading, the refusal holds the page's load.
679
+ *
680
+ * @param status The status before the event.
681
+ * @returns The refused status; this same status when it was already refused for that origin and held the same load.
682
+ * @example
683
+ * ```ts
684
+ * import { PaneStatus, ViewRefusalEvent } from "@noldova/browser.window";
685
+ *
686
+ * const after: PaneStatus = new ViewRefusalEvent("https://www.example.com/", "https://www.example.com", false).applyTo(PaneStatus.empty);
687
+ * ```
688
+ */
689
+ public applyTo(status: PaneStatus): PaneStatus;
690
+
691
+ /**
692
+ * Tells the hearing of the refusal, as {@link PaneHearing.refuse} does: a refused redirect asks the redirect listeners first.
693
+ *
694
+ * @param hearing The pane's hearing.
695
+ * @example
696
+ * ```ts
697
+ * import { PaneHearing, ViewRefusalEvent } from "@noldova/browser.window";
698
+ *
699
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
700
+ * new ViewRefusalEvent("https://www.example.com/", "https://www.example.com", false).followIn(hearing);
701
+ * ```
702
+ */
703
+ public followIn(hearing: PaneHearing): void;
704
+ }
705
+
706
+ /**
707
+ * The host refused something the page asked for, such as a download or a new window, without asking anyone.
708
+ *
709
+ * @remarks
710
+ * The pane reads it from Noldova Desktop's `RequestRefused` web view event.
711
+ */
712
+ export declare class ViewRequestRefusalEvent extends ViewEvent {
713
+ /**
714
+ * Names this event's kind among the {@link ViewEvent} classes.
715
+ */
716
+ public readonly kind: typeof ViewEventKind.RequestRefused;
717
+
718
+ /**
719
+ * What the host refused.
720
+ */
721
+ public readonly request: RefusedRequest;
722
+
723
+ /**
724
+ * The origin of the page that asked, as the URL standard writes it.
725
+ */
726
+ public readonly origin: string;
727
+
728
+ /**
729
+ * Makes the event.
730
+ *
731
+ * @param request What the host refused.
732
+ * @param origin The origin of the page that asked, as the URL standard writes it.
733
+ * @example
734
+ * ```ts
735
+ * import { RefusedRequest, ViewRequestRefusalEvent } from "@noldova/browser.window";
736
+ *
737
+ * const refused: ViewRequestRefusalEvent = new ViewRequestRefusalEvent(RefusedRequest.Download, "https://www.example.com");
738
+ * ```
739
+ */
740
+ public constructor(request: RefusedRequest, origin: string);
741
+
742
+ /**
743
+ * Gives the status with this request refused, as {@link PaneStatus.refuseRequest} does.
744
+ *
745
+ * @param status The status before the event.
746
+ * @returns The new status; this same status when it already showed that request.
747
+ * @example
748
+ * ```ts
749
+ * import { PaneStatus, RefusedRequest, ViewRequestRefusalEvent } from "@noldova/browser.window";
750
+ *
751
+ * const after: PaneStatus = new ViewRequestRefusalEvent(RefusedRequest.Download, "https://www.example.com").applyTo(PaneStatus.empty);
752
+ * ```
753
+ */
754
+ public applyTo(status: PaneStatus): PaneStatus;
755
+
756
+ /**
757
+ * Tells the hearing to change the pane's status by this event, as {@link PaneHearing.change} does.
758
+ *
759
+ * @param hearing The pane's hearing.
760
+ * @example
761
+ * ```ts
762
+ * import { PaneHearing, RefusedRequest, ViewRequestRefusalEvent } from "@noldova/browser.window";
763
+ *
764
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
765
+ * new ViewRequestRefusalEvent(RefusedRequest.Download, "https://www.example.com").followIn(hearing);
766
+ * ```
767
+ */
768
+ public followIn(hearing: PaneHearing): void;
769
+ }
770
+
771
+ /**
772
+ * The page's address, title, loading or history changed, by a navigation, a redirect, a move through the history or a stop.
773
+ *
774
+ * @remarks
775
+ * The pane reads it from Noldova Desktop's `State` web view event.
776
+ * The host sends it whenever any of its values changes.
777
+ */
778
+ export declare class ViewStateEvent extends ViewEvent {
779
+ /**
780
+ * Names this event's kind among the {@link ViewEvent} classes.
781
+ */
782
+ public readonly kind: typeof ViewEventKind.State;
783
+
784
+ /**
785
+ * The page's address as the engine reports it; empty before the first load.
786
+ */
787
+ public readonly address: string;
788
+
789
+ /**
790
+ * The page's title, which is the page's own text and untrusted; empty when it has none.
791
+ */
792
+ public readonly title: string;
793
+
794
+ /**
795
+ * Whether the page is loading.
796
+ */
797
+ public readonly isLoading: boolean;
798
+
799
+ /**
800
+ * Whether the history has an entry to go back to.
801
+ */
802
+ public readonly canGoBack: boolean;
803
+
804
+ /**
805
+ * Whether the history has an entry to go forward to.
806
+ */
807
+ public readonly canGoForward: boolean;
808
+
809
+ /**
810
+ * Makes the event.
811
+ *
812
+ * @param address The page's address; empty before the first load.
813
+ * @param title The page's title; empty when it has none.
814
+ * @param isLoading Whether the page is loading.
815
+ * @param canGoBack Whether the history has an entry to go back to.
816
+ * @param canGoForward Whether the history has an entry to go forward to.
817
+ * @example
818
+ * ```ts
819
+ * import { ViewStateEvent } from "@noldova/browser.window";
820
+ *
821
+ * const loaded: ViewStateEvent = new ViewStateEvent("https://www.example.com/", "Example", false, true, false);
822
+ * ```
823
+ */
824
+ public constructor(address: string, title: string, isLoading: boolean, canGoBack: boolean, canGoForward: boolean);
825
+
826
+ /**
827
+ * Gives the status the page's state shows, as {@link PaneStatus.show} does.
828
+ *
829
+ * @param status The status before the event.
830
+ * @returns The new status.
831
+ * @example
832
+ * ```ts
833
+ * import { PaneStatus, ViewStateEvent } from "@noldova/browser.window";
834
+ *
835
+ * const after: PaneStatus = new ViewStateEvent("https://www.example.com/", "Example", false, true, false).applyTo(PaneStatus.empty);
836
+ * ```
837
+ */
838
+ public applyTo(status: PaneStatus): PaneStatus;
839
+
840
+ /**
841
+ * Tells the hearing of the page's state, as {@link PaneHearing.show} does.
842
+ *
843
+ * @param hearing The pane's hearing.
844
+ * @example
845
+ * ```ts
846
+ * import { PaneHearing, ViewStateEvent } from "@noldova/browser.window";
847
+ *
848
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
849
+ * new ViewStateEvent("https://www.example.com/", "Example", false, true, false).followIn(hearing);
850
+ * ```
851
+ */
852
+ public followIn(hearing: PaneHearing): void;
853
+ }
854
+
855
+ /**
856
+ * What the host refuses for a page without asking anyone.
857
+ *
858
+ * @remarks
859
+ * The kinds of Noldova Desktop's `RequestRefused` web view event, as the pane reads them by the names that event writes.
860
+ */
861
+ export declare const RefusedRequest: {
862
+ /**
863
+ * A download, which Noldova Desktop's `RequestRefused` event names `download`; value `"Download"`.
864
+ */
865
+ readonly Download: "Download";
866
+
867
+ /**
868
+ * A new window, named `newWindow`; value `"NewWindow"`.
869
+ */
870
+ readonly NewWindow: "NewWindow";
871
+
872
+ /**
873
+ * A site permission, such as the camera or the location, named `permission`; value `"Permission"`.
874
+ */
875
+ readonly Permission: "Permission";
876
+
877
+ /**
878
+ * A file from this computer, named `fileChooser`; value `"FileChooser"`.
879
+ */
880
+ readonly FileChooser: "FileChooser";
881
+
882
+ /**
883
+ * A sign-in dialog, named `authentication`; value `"Authentication"`.
884
+ */
885
+ readonly Authentication: "Authentication";
886
+
887
+ /**
888
+ * A certificate the host didn't accept, named `certificate`; value `"Certificate"`.
889
+ */
890
+ readonly Certificate: "Certificate";
891
+
892
+ /**
893
+ * A page shown inside another page, named `nestedView`; value `"NestedView"`.
894
+ */
895
+ readonly NestedView: "NestedView";
896
+ };
897
+
898
+ /**
899
+ * One of {@link RefusedRequest}'s values.
900
+ */
901
+ export declare type RefusedRequest = (typeof RefusedRequest)[keyof typeof RefusedRequest];
902
+
903
+ /**
904
+ * A new window a page asked for without the person's own input, which the tab's notice offers to open as a tab.
905
+ */
906
+ export declare class PopupOffer {
907
+ /**
908
+ * The address the page asked for.
909
+ */
910
+ public readonly address: string;
911
+
912
+ /**
913
+ * The origin of the referrer, or `null` when the engine sends none.
914
+ */
915
+ public readonly origin: string | null;
916
+
917
+ /**
918
+ * Whether the person's own input came just before: true when the tab had already opened a new page for that input, so the notice
919
+ * says this window waits rather than that a pop-up was stopped.
920
+ */
921
+ public readonly hadRecentInput: boolean;
922
+
923
+ /**
924
+ * Makes the offer.
925
+ *
926
+ * @param address The address the page asked for.
927
+ * @param origin The origin of the referrer, or `null`.
928
+ * @param hadRecentInput Whether the person's own input came just before.
929
+ * @example
930
+ * ```ts
931
+ * import { PopupOffer } from "@noldova/browser.window";
932
+ *
933
+ * const offer: PopupOffer = new PopupOffer("https://www.example.com/", "https://docs.example.com", false);
934
+ * ```
935
+ */
936
+ public constructor(address: string, origin: string | null, hadRecentInput: boolean);
937
+ }
938
+
939
+ /**
940
+ * The states the pane can show.
941
+ */
942
+ export declare class PaneStates {
943
+ /**
944
+ * Every pane state, each once.
945
+ *
946
+ * @example
947
+ * ```ts
948
+ * import { PaneStates } from "@noldova/browser.window";
949
+ *
950
+ * const count: number = PaneStates.all.length;
951
+ * ```
952
+ */
953
+ public static readonly all: readonly PaneState[];
954
+
955
+ /**
956
+ * Tells whether a value, such as one a message carries, is a pane state.
957
+ *
958
+ * @param value The value to look up; it matches only exactly, case included.
959
+ * @returns `true` when `value` is one of {@link PaneStates.all}, which narrows it to {@link PaneState}; `false` otherwise.
960
+ * @example
961
+ * ```ts
962
+ * import { PaneStates } from "@noldova/browser.window";
963
+ *
964
+ * PaneStates.includes("Crashed");
965
+ * PaneStates.includes("Closed");
966
+ * ```
967
+ */
968
+ public static includes(value: string): value is PaneState;
969
+ }
970
+
971
+ /**
972
+ * What the pane shows at one moment: its state, the page's address and title, where the history allows going, and any problem.
973
+ * A value never changes; each event gives a new one.
974
+ */
975
+ export declare class PaneStatus {
976
+ /**
977
+ * The status before the first navigation: `Empty`, with no address, title, history or problem.
978
+ *
979
+ * @example
980
+ * ```ts
981
+ * import { PaneState, PaneStatus } from "@noldova/browser.window";
982
+ *
983
+ * const isEmpty: boolean = PaneStatus.empty.state === PaneState.Empty;
984
+ * ```
985
+ */
986
+ public static readonly empty: PaneStatus;
987
+
988
+ /**
989
+ * The status of a pane Noldova Desktop gave no view, or whose view the host closed: `Unavailable`, with no address, title, history or problem.
990
+ *
991
+ * @example
992
+ * ```ts
993
+ * import { PaneState, PaneStatus } from "@noldova/browser.window";
994
+ *
995
+ * const isUnavailable: boolean = PaneStatus.unavailable.state === PaneState.Unavailable;
996
+ * ```
997
+ */
998
+ public static readonly unavailable: PaneStatus;
999
+
1000
+ /**
1001
+ * What the pane shows for its page.
1002
+ */
1003
+ public readonly state: PaneState;
1004
+
1005
+ /**
1006
+ * The address to show, read-only: the page's address as the engine reports it, or after a failed load the address that failed; empty before the first navigation.
1007
+ */
1008
+ public readonly url: string;
1009
+
1010
+ /**
1011
+ * The page's title, which is the page's own text and untrusted; empty when it has none.
1012
+ */
1013
+ public readonly title: string;
1014
+
1015
+ /**
1016
+ * Whether going back is possible.
1017
+ */
1018
+ public readonly canGoBack: boolean;
1019
+
1020
+ /**
1021
+ * Whether going forward is possible.
1022
+ */
1023
+ public readonly canGoForward: boolean;
1024
+
1025
+ /**
1026
+ * Why the load failed, as the engine describes it, such as `ERR_NAME_NOT_RESOLVED`, while the state is `Failed`; `null` otherwise.
1027
+ */
1028
+ public readonly failureReason: string | null;
1029
+
1030
+ /**
1031
+ * The origin of the address the check refused, as the URL standard writes it, while the state is `Refused`; `null` otherwise.
1032
+ */
1033
+ public readonly refusedOrigin: string | null;
1034
+
1035
+ /**
1036
+ * What the page last asked for that the host refused, such as a download, until the next load starts or the person dismisses it; `null` otherwise.
1037
+ */
1038
+ public readonly refusedRequest: RefusedRequest | null;
1039
+
1040
+ /**
1041
+ * The address a refused request was for, such as a new window's that didn't open, which the notice opens in the system's browser in place of the page's own; `null` otherwise.
1042
+ */
1043
+ public readonly refusedTarget: string | null;
1044
+
1045
+ /**
1046
+ * Why the pane didn't go to an address the person typed, until a load starts, a load fails, the origin check refuses a navigation, the page asks for something the host refuses, or the person dismisses it; `null` otherwise.
1047
+ * At most one of it and {@link PaneStatus.refusedRequest} is set: the latest takes the other's place.
1048
+ */
1049
+ public readonly refusedAddress: AddressRefusal | null;
1050
+
1051
+ /**
1052
+ * A new window the page asked for without the person's own input, until a load starts, the page asks for something the host refuses,
1053
+ * the pane refuses a typed address or the person opens or dismisses it; `null` otherwise.
1054
+ * At most one of it, {@link PaneStatus.refusedRequest} and {@link PaneStatus.refusedAddress} is set: the latest takes the others' place.
1055
+ */
1056
+ public readonly popup: PopupOffer | null;
1057
+
1058
+ private constructor();
1059
+
1060
+ /**
1061
+ * Gives the status after one of the page's events.
1062
+ *
1063
+ * @param event The event, as the pane reads it from Noldova Desktop's web view.
1064
+ * @returns The new status; this same status when the event changes nothing shown.
1065
+ * A `State` event gives its address, title and history; while loading it gives `Loading` and clears a failure, a refusal or a crash, unless a refusal holds the load, and once loading stops
1066
+ * it turns `Loading` into `Loaded` and keeps any other state.
1067
+ * A `NavigationRefused` event refuses its origin, and when the pane isn't loading it holds the page's load: a loading `State` event at the page's address then keeps `Refused`
1068
+ * and the refused origin, so the load start and stop the view may still report show the refusal. The next `State` event ends the hold, and so does {@link PaneStatus.navigate}.
1069
+ * A refused request is kept in {@link PaneStatus.refusedRequest}, replacing the one before and any refused address, until a load starts or a load fails; a cleared profile changes nothing shown.
1070
+ * @example
1071
+ * ```ts
1072
+ * import { PaneStatus, ViewStateEvent } from "@noldova/browser.window";
1073
+ *
1074
+ * const loading: PaneStatus = PaneStatus.empty.apply(new ViewStateEvent("https://example.com/", "", true, false, false));
1075
+ * ```
1076
+ */
1077
+ public apply(event: ViewEvent): PaneStatus;
1078
+
1079
+ /**
1080
+ * Gives the status after the page's state: its address, title and history; while loading it gives `Loading` and clears a failure, a refusal or a crash,
1081
+ * unless a refusal holds the load at the page's address, and once loading stops it turns `Loading` into `Loaded` and keeps any other state.
1082
+ *
1083
+ * @param state The page's state.
1084
+ * @returns The new status.
1085
+ * @example
1086
+ * ```ts
1087
+ * import { PaneStatus, ViewStateEvent } from "@noldova/browser.window";
1088
+ *
1089
+ * const loading: PaneStatus = PaneStatus.empty.show(new ViewStateEvent("https://example.com/", "", true, false, false));
1090
+ * ```
1091
+ */
1092
+ public show(state: ViewStateEvent): PaneStatus;
1093
+
1094
+ /**
1095
+ * Gives the status after a load failed: `Failed`, with the failed address and the failure's description, and no refusal or pop-up.
1096
+ *
1097
+ * @param failure The failed load.
1098
+ * @returns The new status.
1099
+ * @example
1100
+ * ```ts
1101
+ * import { PaneStatus, ViewLoadFailureEvent } from "@noldova/browser.window";
1102
+ *
1103
+ * const failed: PaneStatus = PaneStatus.empty.fail(new ViewLoadFailureEvent("https://example.com/", -105, "ERR_NAME_NOT_RESOLVED"));
1104
+ * ```
1105
+ */
1106
+ public fail(failure: ViewLoadFailureEvent): PaneStatus;
1107
+
1108
+ /**
1109
+ * Gives the status after the page's process ended: `Crashed`, with the page's address, title and history, and any refused request, refused address or pop-up kept.
1110
+ *
1111
+ * @returns The new status.
1112
+ * @example
1113
+ * ```ts
1114
+ * import { PaneStatus } from "@noldova/browser.window";
1115
+ *
1116
+ * const crashed: PaneStatus = PaneStatus.empty.crash();
1117
+ * ```
1118
+ */
1119
+ public crash(): PaneStatus;
1120
+
1121
+ /**
1122
+ * Gives the status after the origin check refused an address, such as in a navigation's answer, with the page's address, title and history kept.
1123
+ *
1124
+ * @param origin The refused address's origin, as the URL standard writes it.
1125
+ * @param holdsRefusedLoad Whether the refusal holds the page's load that the view may still report after it, at the page's address, so that load
1126
+ * shows the refusal until the view's next state; `false`, the default, for a refusal that answers a navigation, which has no load to hold.
1127
+ * @returns The new status, with no refused address; this same status when it was already refused for that origin, had no refused address
1128
+ * and held the same load.
1129
+ * @example
1130
+ * ```ts
1131
+ * import { PaneStatus } from "@noldova/browser.window";
1132
+ *
1133
+ * const refused: PaneStatus = PaneStatus.empty.refuse("https://example.com");
1134
+ * const holding: PaneStatus = PaneStatus.empty.refuse("https://example.com", true);
1135
+ * ```
1136
+ */
1137
+ public refuse(origin: string, holdsRefusedLoad?: boolean): PaneStatus;
1138
+
1139
+ /**
1140
+ * Gives the status once the person or an agent started a navigation, which is new, so a refusal holds none of its loads.
1141
+ *
1142
+ * @returns The new status, which holds no load; this same status when it held none.
1143
+ * @example
1144
+ * ```ts
1145
+ * import { PaneStatus } from "@noldova/browser.window";
1146
+ *
1147
+ * const navigating: PaneStatus = PaneStatus.empty.refuse("https://example.com", true).navigate();
1148
+ * ```
1149
+ */
1150
+ public navigate(): PaneStatus;
1151
+
1152
+ /**
1153
+ * Gives the status after the pane didn't go to an address the person typed, with the page, its state and its history kept.
1154
+ *
1155
+ * @param reason Why the address was refused, by the pane itself or by the runtime part, or `Failed` when the runtime part's request failed.
1156
+ * @param origin The refused address's origin, when the runtime part refused its site; `null`, the default, for text that names no site.
1157
+ * Over a `Failed` or `Refused` state, an origin gives a `Refused` state of its own, which dismissing the address's notice takes back, so the
1158
+ * page never names two addresses.
1159
+ * @returns The new status, with this reason in place of any refused request; this same status when it already had this reason, and this origin.
1160
+ * @example
1161
+ * ```ts
1162
+ * import { TypedAddressRefusal } from "@noldova/browser.protocol";
1163
+ * import { PaneStatus } from "@noldova/browser.window";
1164
+ *
1165
+ * const refused: PaneStatus = PaneStatus.empty.refuseAddress(TypedAddressRefusal.NotAnAddress);
1166
+ * const local: PaneStatus = PaneStatus.empty.refuseAddress(TypedAddressRefusal.Local, "http://192.168.1.20");
1167
+ * ```
1168
+ */
1169
+ public refuseAddress(reason: AddressRefusal, origin?: string | null): PaneStatus;
1170
+
1171
+ /**
1172
+ * Gives the status once the person dismissed or opened the notice of a refused request or a pop-up, with everything else kept.
1173
+ *
1174
+ * @returns The new status, with no refused request or pop-up; this same status when it had neither.
1175
+ * @example
1176
+ * ```ts
1177
+ * import { PaneStatus } from "@noldova/browser.window";
1178
+ *
1179
+ * const quiet: PaneStatus = PaneStatus.empty.dismissRequest();
1180
+ * ```
1181
+ */
1182
+ public dismissRequest(): PaneStatus;
1183
+
1184
+ /**
1185
+ * Gives the status once the person dismissed the notice of a refused address, or put the page's address back in the field, with everything else kept.
1186
+ *
1187
+ * @returns The new status, with no refused address; this same status when it had none.
1188
+ * @example
1189
+ * ```ts
1190
+ * import { TypedAddressRefusal } from "@noldova/browser.protocol";
1191
+ * import { PaneStatus } from "@noldova/browser.window";
1192
+ *
1193
+ * const quiet: PaneStatus = PaneStatus.empty.refuseAddress(TypedAddressRefusal.NotWeb).dismissAddress();
1194
+ * ```
1195
+ */
1196
+ public dismissAddress(): PaneStatus;
1197
+
1198
+ /**
1199
+ * Gives the status with the notice of a new window the page asked for that didn't open by itself, in place of any other notice.
1200
+ *
1201
+ * @param popup The address the page asked for, the origin that asked, and whether the person's input came just before.
1202
+ * @returns The new status.
1203
+ * @example
1204
+ * ```ts
1205
+ * import { PaneStatus, PopupOffer } from "@noldova/browser.window";
1206
+ *
1207
+ * const offered: PaneStatus = PaneStatus.empty.offerPopup(new PopupOffer("https://example.com/", null, false));
1208
+ * ```
1209
+ */
1210
+ public offerPopup(popup: PopupOffer): PaneStatus;
1211
+
1212
+ /**
1213
+ * Gives the status with the notice of a request of the page that got nothing, in place of a typed address's or a pop-up's notice.
1214
+ *
1215
+ * @param request The request that got nothing.
1216
+ * @param target The address the request was for, such as the new window's; `null`, the default, for the page's own.
1217
+ * @returns The new status, or this one when its notice already names that request and address.
1218
+ * @example
1219
+ * ```ts
1220
+ * import { PaneStatus, RefusedRequest } from "@noldova/browser.window";
1221
+ *
1222
+ * const refused: PaneStatus = PaneStatus.empty.refuseRequest(RefusedRequest.NewWindow, "https://example.com/");
1223
+ * ```
1224
+ */
1225
+ public refuseRequest(request: RefusedRequest, target?: string | null): PaneStatus;
1226
+ }
1227
+
1228
+ /**
1229
+ * The base of every exception Browser's window part throws, so an app can catch them as one kind.
1230
+ *
1231
+ * @example
1232
+ * ```ts
1233
+ * import { BrowserWindowException, PaneUnavailableException } from "@noldova/browser.window";
1234
+ *
1235
+ * console.log(new PaneUnavailableException() instanceof BrowserWindowException);
1236
+ * ```
1237
+ */
1238
+ export declare abstract class BrowserWindowException extends Exception {
1239
+ /**
1240
+ * Makes the exception with its message, and the failure that caused it, if any.
1241
+ *
1242
+ * @param message What failed, from the window part's resources.
1243
+ * @param options The cause, as context's exception options carry it.
1244
+ */
1245
+ protected constructor(message: string, options?: ExceptionOptions);
1246
+ }
1247
+
1248
+ /**
1249
+ * Thrown when a pane Noldova Desktop gave no view, or whose view the host closed, is asked to navigate, move through its history, reload or stop.
1250
+ */
1251
+ export declare class PaneUnavailableException extends BrowserWindowException {
1252
+ /**
1253
+ * `PaneUnavailableException`.
1254
+ */
1255
+ public override readonly name: string;
1256
+
1257
+ /**
1258
+ * Makes the exception, with a message that says the pane has no embedded view, or the host closed it.
1259
+ *
1260
+ * @example
1261
+ * ```ts
1262
+ * import { PaneUnavailableException } from "@noldova/browser.window";
1263
+ *
1264
+ * function isUnavailable(error: unknown): boolean {
1265
+ * return error instanceof PaneUnavailableException;
1266
+ * }
1267
+ * ```
1268
+ */
1269
+ public constructor();
1270
+ }
1271
+
1272
+ /**
1273
+ * Drives one pane's page through Noldova Desktop's window bridge: it follows the page's events and answers into a {@link PaneStatus} and moves through the history; the module's own elements, such as its menu, lie over the live page.
1274
+ */
1275
+ export declare class PaneController {
1276
+ /**
1277
+ * Starts following a view's events.
1278
+ *
1279
+ * @param view The pane's page, which the controller owns from now on and closes in {@link PaneController.close};
1280
+ * `null` when Noldova Desktop has no view to give, and the pane stays {@link PaneStatus.unavailable}.
1281
+ * @example
1282
+ * ```ts
1283
+ * import { QualifiedName, WebViewPane } from "@noldova/desktop.protocol";
1284
+ * import type { IWindowWebViews } from "@noldova/desktop.window";
1285
+ * import { PaneController } from "@noldova/browser.window";
1286
+ *
1287
+ * async function openAsync(webViews: IWindowWebViews): Promise<PaneController> {
1288
+ * return new PaneController(await webViews.openAsync(new WebViewPane(QualifiedName.parse("browser.page"), crypto.randomUUID()), "workspace-1"));
1289
+ * }
1290
+ * ```
1291
+ * @example
1292
+ * ```ts
1293
+ * import { PaneController } from "@noldova/browser.window";
1294
+ *
1295
+ * const unavailable: PaneController = new PaneController(null);
1296
+ * ```
1297
+ */
1298
+ public constructor(view: IWebViewHandle | null);
1299
+
1300
+ /**
1301
+ * What the pane shows now; {@link PaneStatus.empty} until the first event, or {@link PaneStatus.unavailable} with no view or once the host closed it.
1302
+ */
1303
+ public get status(): PaneStatus;
1304
+
1305
+ /**
1306
+ * The view's zoom as a factor, 1 for 100%, which starts at 1 and follows the view's `Zoom` events and the zoom calls' answers.
1307
+ */
1308
+ public get zoom(): number;
1309
+
1310
+ /**
1311
+ * Listens to each change of {@link PaneController.status}.
1312
+ *
1313
+ * @param listener Called with each new status, in order; it must not throw.
1314
+ * @returns A function that stops the listening; calling it again does nothing.
1315
+ * @example
1316
+ * ```ts
1317
+ * import type { PaneController, PaneStatus } from "@noldova/browser.window";
1318
+ *
1319
+ * function follow(controller: PaneController): () => void {
1320
+ * return controller.onChange((status: PaneStatus) => console.log(status.state));
1321
+ * }
1322
+ * ```
1323
+ */
1324
+ public onChange(listener: (status: PaneStatus) => void): () => void;
1325
+
1326
+ /**
1327
+ * Tells the listener of each new window the page asks for, until it stops listening or the controller closes.
1328
+ *
1329
+ * @param listener Called with each request.
1330
+ * @returns The function that stops it listening.
1331
+ * @example
1332
+ * ```ts
1333
+ * import type { PaneController, ViewNewWindowEvent } from "@noldova/browser.window";
1334
+ *
1335
+ * function follow(controller: PaneController): () => void {
1336
+ * return controller.onNewWindow((event: ViewNewWindowEvent) => console.log(event.address));
1337
+ * }
1338
+ * ```
1339
+ */
1340
+ public onNewWindow(listener: (event: ViewNewWindowEvent) => void): () => void;
1341
+
1342
+ /**
1343
+ * Tells the listener of each of the pane's keys the person presses in the page, until it stops listening or the controller closes.
1344
+ *
1345
+ * @param listener Called with each key.
1346
+ * @returns The function that stops it listening.
1347
+ * @example
1348
+ * ```ts
1349
+ * import type { PaneController, ViewKeyEvent } from "@noldova/browser.window";
1350
+ *
1351
+ * function follow(controller: PaneController): () => void {
1352
+ * return controller.onKey((event: ViewKeyEvent) => console.log(event.name));
1353
+ * }
1354
+ * ```
1355
+ */
1356
+ public onKey(listener: (event: ViewKeyEvent) => void): () => void;
1357
+
1358
+ /**
1359
+ * Tells the listener of each change of the view's zoom, by the zoom calls, the person's keys or the wheel, once each, without a change of status,
1360
+ * until it stops listening or the controller closes.
1361
+ *
1362
+ * @param listener Called with the new zoom as a factor, 1 for 100%.
1363
+ * @returns The function that stops it listening.
1364
+ * @example
1365
+ * ```ts
1366
+ * import type { PaneController } from "@noldova/browser.window";
1367
+ *
1368
+ * function follow(controller: PaneController): () => void {
1369
+ * return controller.onZoom((factor: number) => console.log(`${String(Math.round(factor * 100))}%`));
1370
+ * }
1371
+ * ```
1372
+ */
1373
+ public onZoom(listener: (factor: number) => void): () => void;
1374
+
1375
+ /**
1376
+ * Asks the listener first about each redirect the origin check refused, until it stops listening or the controller closes; a listener
1377
+ * that takes the redirect on, such as one that follows a typed address's redirects, answers true, and the status then shows no refusal for it.
1378
+ *
1379
+ * @param listener Called with each refused redirect; it answers whether it took the redirect on.
1380
+ * @returns The function that stops it listening.
1381
+ * @example
1382
+ * ```ts
1383
+ * import type { PaneController, ViewRefusalEvent } from "@noldova/browser.window";
1384
+ *
1385
+ * function follow(controller: PaneController): () => void {
1386
+ * return controller.onRefusedRedirect((event: ViewRefusalEvent) => event.origin === "https://www.example.com");
1387
+ * }
1388
+ * ```
1389
+ */
1390
+ public onRefusedRedirect(listener: (event: ViewRefusalEvent) => boolean): () => void;
1391
+
1392
+ /**
1393
+ * Tells the controller that a navigation it didn't start, such as an agent's, began on the page, which is new too, so a refusal holds
1394
+ * none of its loads; listeners hear of a change. It does nothing once the controller closed or the tab is unavailable.
1395
+ *
1396
+ * @example
1397
+ * ```ts
1398
+ * import type { PaneController } from "@noldova/browser.window";
1399
+ *
1400
+ * function followed(controller: PaneController): void {
1401
+ * controller.followNavigation();
1402
+ * }
1403
+ * ```
1404
+ */
1405
+ public followNavigation(): void;
1406
+
1407
+ /**
1408
+ * Shows the not-allowed page for an origin, such as a redirect's that the runtime part refused; listeners hear of the change.
1409
+ * It does nothing once the controller closed or the tab is unavailable.
1410
+ *
1411
+ * @param origin The refused origin, as the URL standard writes it.
1412
+ * @example
1413
+ * ```ts
1414
+ * import type { PaneController } from "@noldova/browser.window";
1415
+ *
1416
+ * function refuse(controller: PaneController): void {
1417
+ * controller.refuseNavigation("https://www.example.com");
1418
+ * }
1419
+ * ```
1420
+ */
1421
+ public refuseNavigation(origin: string): void;
1422
+
1423
+ /**
1424
+ * Offers a new window the page asked for, which didn't open by itself, in the tab's notice; listeners hear of the change.
1425
+ * It does nothing once the controller closed or the tab is unavailable.
1426
+ *
1427
+ * @param address The address the page asked for.
1428
+ * @param origin The origin that asked, or `null`.
1429
+ * @param hadRecentInput Whether the person's input came just before, as the tab had already opened a page for it; false when left out.
1430
+ * @example
1431
+ * ```ts
1432
+ * import type { PaneController } from "@noldova/browser.window";
1433
+ *
1434
+ * function offer(controller: PaneController): void {
1435
+ * controller.offerPopup("https://example.com/", null);
1436
+ * }
1437
+ * ```
1438
+ */
1439
+ public offerPopup(address: string, origin: string | null, hadRecentInput?: boolean): void;
1440
+
1441
+ /**
1442
+ * Says in the tab's notice that a request of the page got nothing, such as a new window Noldova Desktop didn't open as a page.
1443
+ * It does nothing once the controller closed or the tab is unavailable.
1444
+ *
1445
+ * @param request The request that got nothing.
1446
+ * @param target The address the request was for, such as the new window's; `null`, the default, for the page's own.
1447
+ * @example
1448
+ * ```ts
1449
+ * import { type PaneController, RefusedRequest } from "@noldova/browser.window";
1450
+ *
1451
+ * function refuse(controller: PaneController): void {
1452
+ * controller.refuseRequest(RefusedRequest.NewWindow, "https://example.com/");
1453
+ * }
1454
+ * ```
1455
+ */
1456
+ public refuseRequest(request: RefusedRequest, target?: string | null): void;
1457
+
1458
+ /**
1459
+ * Loads an address, after Noldova Desktop's origin check; a refusal also turns the status `Refused`.
1460
+ *
1461
+ * @param url The address to load.
1462
+ * @returns A promise of Noldova Desktop's answer, `Started` or `Refused` with the origin, which rejects when the view is closed or the pane has no view.
1463
+ * @throws {@link PaneUnavailableException} As the rejection, when the pane has no view, the host closed its view, or the controller closed.
1464
+ * @example
1465
+ * ```ts
1466
+ * import { WebViewNavigationKind } from "@noldova/desktop.protocol";
1467
+ * import type { PaneController } from "@noldova/browser.window";
1468
+ *
1469
+ * async function openAsync(controller: PaneController): Promise<boolean> {
1470
+ * return (await controller.navigateAsync("https://example.com/")).kind === WebViewNavigationKind.Started;
1471
+ * }
1472
+ * ```
1473
+ */
1474
+ public navigateAsync(url: string): Promise<WebViewNavigation>;
1475
+
1476
+ /**
1477
+ * Goes back one history entry, for the pane's back control; a refusal also turns the status `Refused`.
1478
+ *
1479
+ * @returns A promise of Noldova Desktop's answer, `Started`, `Refused` with the origin, or `NoHistory`, which rejects when the view is closed or the pane has no view.
1480
+ * @throws {@link PaneUnavailableException} As the rejection, when the pane has no view, the host closed its view, or the controller closed.
1481
+ * @example
1482
+ * ```ts
1483
+ * import type { PaneController } from "@noldova/browser.window";
1484
+ *
1485
+ * async function backAsync(controller: PaneController): Promise<void> {
1486
+ * if (controller.status.canGoBack)
1487
+ * await controller.goBackAsync();
1488
+ * }
1489
+ * ```
1490
+ */
1491
+ public goBackAsync(): Promise<WebViewNavigation>;
1492
+
1493
+ /**
1494
+ * Goes forward one history entry, for the pane's forward control; a refusal also turns the status `Refused`.
1495
+ *
1496
+ * @returns A promise of Noldova Desktop's answer, `Started`, `Refused` with the origin, or `NoHistory`, which rejects when the view is closed or the pane has no view.
1497
+ * @throws {@link PaneUnavailableException} As the rejection, when the pane has no view, the host closed its view, or the controller closed.
1498
+ * @example
1499
+ * ```ts
1500
+ * import type { PaneController } from "@noldova/browser.window";
1501
+ *
1502
+ * async function forwardAsync(controller: PaneController): Promise<void> {
1503
+ * if (controller.status.canGoForward)
1504
+ * await controller.goForwardAsync();
1505
+ * }
1506
+ * ```
1507
+ */
1508
+ public goForwardAsync(): Promise<WebViewNavigation>;
1509
+
1510
+ /**
1511
+ * Reloads the page, for the pane's reload control, which also restarts a crashed page; a refusal also turns the status `Refused`.
1512
+ *
1513
+ * @returns A promise of Noldova Desktop's answer, `Started` or `Refused` with the origin, which rejects when the view is closed or the pane has no view.
1514
+ * @throws {@link PaneUnavailableException} As the rejection, when the pane has no view, the host closed its view, or the controller closed.
1515
+ * @example
1516
+ * ```ts
1517
+ * import type { PaneController } from "@noldova/browser.window";
1518
+ *
1519
+ * async function reloadAsync(controller: PaneController): Promise<void> {
1520
+ * await controller.reloadAsync();
1521
+ * }
1522
+ * ```
1523
+ */
1524
+ public reloadAsync(): Promise<WebViewNavigation>;
1525
+
1526
+ /**
1527
+ * Stops the page's load, for the pane's stop control.
1528
+ *
1529
+ * @returns A promise of Noldova Desktop's answer, `Started`, which rejects when the view is closed or the pane has no view.
1530
+ * @throws {@link PaneUnavailableException} As the rejection, when the pane has no view, the host closed its view, or the controller closed.
1531
+ * @example
1532
+ * ```ts
1533
+ * import { type PaneController, PaneState } from "@noldova/browser.window";
1534
+ *
1535
+ * async function stopAsync(controller: PaneController): Promise<void> {
1536
+ * if (controller.status.state === PaneState.Loading)
1537
+ * await controller.stopAsync();
1538
+ * }
1539
+ * ```
1540
+ */
1541
+ public stopAsync(): Promise<WebViewNavigation>;
1542
+
1543
+ /**
1544
+ * Steps the view's zoom in to Noldova Desktop's next step, as the person's Ctrl+= does; zoom listeners hear of the change.
1545
+ *
1546
+ * @returns A promise of the zoom the view took, as a factor, which stays at 5 at the greatest step, and which rejects when the view is closed or the pane has no view.
1547
+ * @throws {@link PaneUnavailableException} As the rejection, when the pane has no view, the host closed its view, or the controller closed.
1548
+ * @example
1549
+ * ```ts
1550
+ * import type { PaneController } from "@noldova/browser.window";
1551
+ *
1552
+ * async function zoomInAsync(controller: PaneController): Promise<number> {
1553
+ * return controller.zoomInAsync();
1554
+ * }
1555
+ * ```
1556
+ */
1557
+ public zoomInAsync(): Promise<number>;
1558
+
1559
+ /**
1560
+ * Steps the view's zoom out to Noldova Desktop's previous step, as the person's Ctrl+- does; zoom listeners hear of the change.
1561
+ *
1562
+ * @returns A promise of the zoom the view took, as a factor, which stays at 0.25 at the least step, and which rejects when the view is closed or the pane has no view.
1563
+ * @throws {@link PaneUnavailableException} As the rejection, when the pane has no view, the host closed its view, or the controller closed.
1564
+ * @example
1565
+ * ```ts
1566
+ * import type { PaneController } from "@noldova/browser.window";
1567
+ *
1568
+ * async function zoomOutAsync(controller: PaneController): Promise<number> {
1569
+ * return controller.zoomOutAsync();
1570
+ * }
1571
+ * ```
1572
+ */
1573
+ public zoomOutAsync(): Promise<number>;
1574
+
1575
+ /**
1576
+ * Sets the view's zoom back to 100%, as the person's Ctrl+0 does; zoom listeners hear of the change.
1577
+ *
1578
+ * @returns A promise of the zoom the view took, 1, which rejects when the view is closed or the pane has no view.
1579
+ * @throws {@link PaneUnavailableException} As the rejection, when the pane has no view, the host closed its view, or the controller closed.
1580
+ * @example
1581
+ * ```ts
1582
+ * import type { PaneController } from "@noldova/browser.window";
1583
+ *
1584
+ * async function resetZoomAsync(controller: PaneController): Promise<void> {
1585
+ * if (controller.zoom !== 1)
1586
+ * await controller.resetZoomAsync();
1587
+ * }
1588
+ * ```
1589
+ */
1590
+ public resetZoomAsync(): Promise<number>;
1591
+
1592
+ /**
1593
+ * Drops the status's refused request, once the person dismissed its notice; listeners hear of the change.
1594
+ *
1595
+ * @example
1596
+ * ```ts
1597
+ * import type { PaneController } from "@noldova/browser.window";
1598
+ *
1599
+ * function dismiss(controller: PaneController): void {
1600
+ * controller.dismissRequest();
1601
+ * }
1602
+ * ```
1603
+ */
1604
+ public dismissRequest(): void;
1605
+
1606
+ /**
1607
+ * Sets the status's refused address, when the pane didn't go to an address the person typed; listeners hear of the change.
1608
+ * It does nothing once the controller is closed or the pane is unavailable.
1609
+ *
1610
+ * @param reason Why the address was refused.
1611
+ * @param origin The refused address's origin, when the runtime part refused its site; `null`, the default, for text that names no site,
1612
+ * as {@link PaneStatus.refuseAddress} takes it.
1613
+ * @example
1614
+ * ```ts
1615
+ * import { TypedAddressRefusal } from "@noldova/browser.protocol";
1616
+ * import type { PaneController } from "@noldova/browser.window";
1617
+ *
1618
+ * function refuse(controller: PaneController): void {
1619
+ * controller.refuseAddress(TypedAddressRefusal.NotAnAddress);
1620
+ * controller.refuseAddress(TypedAddressRefusal.Local, "http://192.168.1.20");
1621
+ * }
1622
+ * ```
1623
+ */
1624
+ public refuseAddress(reason: AddressRefusal, origin?: string | null): void;
1625
+
1626
+ /**
1627
+ * Drops the status's refused address, once the person dismissed its notice or put the page's address back; listeners hear of the change.
1628
+ *
1629
+ * @example
1630
+ * ```ts
1631
+ * import type { PaneController } from "@noldova/browser.window";
1632
+ *
1633
+ * function dismiss(controller: PaneController): void {
1634
+ * controller.dismissAddress();
1635
+ * }
1636
+ * ```
1637
+ */
1638
+ public dismissAddress(): void;
1639
+
1640
+ /**
1641
+ * Stops following the page, drops every listener and closes the view, if any, which ends its pending calls; later calls do nothing.
1642
+ *
1643
+ * @example
1644
+ * ```ts
1645
+ * import type { PaneController } from "@noldova/browser.window";
1646
+ *
1647
+ * function close(controller: PaneController): void {
1648
+ * controller.close();
1649
+ * }
1650
+ * ```
1651
+ */
1652
+ public close(): void;
1653
+ }
1654
+
1655
+ /**
1656
+ * One pane's hearing of its page's events: the listeners of the events that aren't its status, the view's zoom, and the origin the check
1657
+ * last refused, whose failed load the pane doesn't show; it changes the status through the function its {@link PaneController} gives.
1658
+ */
1659
+ export declare class PaneHearing {
1660
+ /**
1661
+ * Starts a hearing with no listeners and a zoom of 1.
1662
+ *
1663
+ * @param changeStatus Called with each event that changes the pane's status.
1664
+ * @example
1665
+ * ```ts
1666
+ * import { PaneHearing, PaneStatus, type ViewEvent } from "@noldova/browser.window";
1667
+ *
1668
+ * let status: PaneStatus = PaneStatus.empty;
1669
+ * const hearing: PaneHearing = new PaneHearing((event: ViewEvent) => {
1670
+ * status = status.apply(event);
1671
+ * });
1672
+ * ```
1673
+ */
1674
+ public constructor(changeStatus: (event: ViewEvent) => void);
1675
+
1676
+ /**
1677
+ * The view's zoom as a factor, 1 for 100%, which follows {@link PaneHearing.zoomTo}.
1678
+ */
1679
+ public get zoom(): number;
1680
+
1681
+ /**
1682
+ * Tells the listener of each new window the page asks for, until it stops listening or the hearing is cleared.
1683
+ *
1684
+ * @param listener Called with each event.
1685
+ * @returns The function that stops it listening.
1686
+ * @example
1687
+ * ```ts
1688
+ * import type { PaneHearing, ViewNewWindowEvent } from "@noldova/browser.window";
1689
+ *
1690
+ * function follow(hearing: PaneHearing): () => void {
1691
+ * return hearing.onNewWindow((event: ViewNewWindowEvent) => console.log(event.address));
1692
+ * }
1693
+ * ```
1694
+ */
1695
+ public onNewWindow(listener: (event: ViewNewWindowEvent) => void): () => void;
1696
+
1697
+ /**
1698
+ * Tells the listener of each of the pane's keys the person presses in the page, until it stops listening or the hearing is cleared.
1699
+ *
1700
+ * @param listener Called with each event.
1701
+ * @returns The function that stops it listening.
1702
+ * @example
1703
+ * ```ts
1704
+ * import type { PaneHearing, ViewKeyEvent } from "@noldova/browser.window";
1705
+ *
1706
+ * function follow(hearing: PaneHearing): () => void {
1707
+ * return hearing.onKey((event: ViewKeyEvent) => console.log(event.name));
1708
+ * }
1709
+ * ```
1710
+ */
1711
+ public onKey(listener: (event: ViewKeyEvent) => void): () => void;
1712
+
1713
+ /**
1714
+ * Tells the listener of each change of the view's zoom, once each, until it stops listening or the hearing is cleared.
1715
+ *
1716
+ * @param listener Called with each factor.
1717
+ * @returns The function that stops it listening.
1718
+ * @example
1719
+ * ```ts
1720
+ * import type { PaneHearing } from "@noldova/browser.window";
1721
+ *
1722
+ * function follow(hearing: PaneHearing): () => void {
1723
+ * return hearing.onZoom((factor: number) => console.log(factor));
1724
+ * }
1725
+ * ```
1726
+ */
1727
+ public onZoom(listener: (factor: number) => void): () => void;
1728
+
1729
+ /**
1730
+ * Asks the listener first about each redirect the origin check refused, until it stops listening or the hearing is cleared; one that takes the redirect on answers true.
1731
+ *
1732
+ * @param listener Called with each event.
1733
+ * @returns The function that stops it listening.
1734
+ * @example
1735
+ * ```ts
1736
+ * import type { PaneHearing, ViewRefusalEvent } from "@noldova/browser.window";
1737
+ *
1738
+ * function follow(hearing: PaneHearing): () => void {
1739
+ * return hearing.onRefusedRedirect((event: ViewRefusalEvent) => event.origin === "https://www.example.com");
1740
+ * }
1741
+ * ```
1742
+ */
1743
+ public onRefusedRedirect(listener: (event: ViewRefusalEvent) => boolean): () => void;
1744
+
1745
+ /**
1746
+ * Changes the pane's status by the event.
1747
+ *
1748
+ * @param event The event, which the status applies.
1749
+ * @example
1750
+ * ```ts
1751
+ * import { PaneHearing, ViewCrashEvent } from "@noldova/browser.window";
1752
+ *
1753
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
1754
+ * hearing.change(new ViewCrashEvent());
1755
+ * ```
1756
+ */
1757
+ public change(event: ViewEvent): void;
1758
+
1759
+ /**
1760
+ * Tells each new-window listener of the request.
1761
+ *
1762
+ * @param event The page's request.
1763
+ * @example
1764
+ * ```ts
1765
+ * import { PaneHearing, ViewNewWindowEvent } from "@noldova/browser.window";
1766
+ *
1767
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
1768
+ * hearing.openWindow(new ViewNewWindowEvent("https://www.example.com/", true, "https://docs.example.com"));
1769
+ * ```
1770
+ */
1771
+ public openWindow(event: ViewNewWindowEvent): void;
1772
+
1773
+ /**
1774
+ * Tells each key listener of the key.
1775
+ *
1776
+ * @param event The key.
1777
+ * @example
1778
+ * ```ts
1779
+ * import { PaneHearing, ViewKeyEvent } from "@noldova/browser.window";
1780
+ *
1781
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
1782
+ * hearing.pressKey(new ViewKeyEvent("reload"));
1783
+ * ```
1784
+ */
1785
+ public pressKey(event: ViewKeyEvent): void;
1786
+
1787
+ /**
1788
+ * Keeps the view's new zoom and tells each zoom listener of it, once: a zoom equal to the one kept tells none.
1789
+ *
1790
+ * @param factor The new zoom, 1 for 100%.
1791
+ * @returns The factor.
1792
+ * @example
1793
+ * ```ts
1794
+ * import { PaneHearing } from "@noldova/browser.window";
1795
+ *
1796
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
1797
+ * const zoom: number = hearing.zoomTo(1.25);
1798
+ * ```
1799
+ */
1800
+ public zoomTo(factor: number): number;
1801
+
1802
+ /**
1803
+ * Keeps the refused origin, whose failed load the pane then doesn't show, and changes the status by the refusal, unless it is a redirect
1804
+ * that a redirect listener takes on.
1805
+ *
1806
+ * @param event The refusal.
1807
+ * @example
1808
+ * ```ts
1809
+ * import { PaneHearing, ViewRefusalEvent } from "@noldova/browser.window";
1810
+ *
1811
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
1812
+ * hearing.refuse(new ViewRefusalEvent("https://www.example.com/", "https://www.example.com", false));
1813
+ * ```
1814
+ */
1815
+ public refuse(event: ViewRefusalEvent): void;
1816
+
1817
+ /**
1818
+ * Changes the status by the failed load, unless it is the load of the origin the check last refused, which the refusal shows: that one
1819
+ * ends the refusal's hold on failed loads.
1820
+ *
1821
+ * @param event The failed load.
1822
+ * @example
1823
+ * ```ts
1824
+ * import { PaneHearing, ViewLoadFailureEvent } from "@noldova/browser.window";
1825
+ *
1826
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
1827
+ * hearing.fail(new ViewLoadFailureEvent("https://www.example.com/", -105, "ERR_NAME_NOT_RESOLVED"));
1828
+ * ```
1829
+ */
1830
+ public fail(event: ViewLoadFailureEvent): void;
1831
+
1832
+ /**
1833
+ * Changes the status by the page's state; once loading stops, a later failed load shows again.
1834
+ *
1835
+ * @param event The page's state.
1836
+ * @example
1837
+ * ```ts
1838
+ * import { PaneHearing, ViewStateEvent } from "@noldova/browser.window";
1839
+ *
1840
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
1841
+ * hearing.show(new ViewStateEvent("https://www.example.com/", "Example", false, true, false));
1842
+ * ```
1843
+ */
1844
+ public show(event: ViewStateEvent): void;
1845
+
1846
+ /**
1847
+ * Stops every listener listening, as the controller does when it closes.
1848
+ *
1849
+ * @example
1850
+ * ```ts
1851
+ * import { PaneHearing } from "@noldova/browser.window";
1852
+ *
1853
+ * const hearing: PaneHearing = new PaneHearing(() => undefined);
1854
+ * hearing.clear();
1855
+ * ```
1856
+ */
1857
+ public clear(): void;
1858
+ }
1859
+
1860
+ /**
1861
+ * Keeps the pane's view in its placeholder: it mounts the view there once, as the view opens, since its page loads only once it is mounted, where the view fills the placeholder as the page lays it out, and shows it while its page is placed.
1862
+ */
1863
+ export declare class PlaceholderTracker {
1864
+ /**
1865
+ * Mounts the view in the placeholder, hidden, so its page loads; a closed view does nothing.
1866
+ *
1867
+ * @param element The positioned element that marks where the page shows, such as one with `position: relative`.
1868
+ * @param view The pane's page.
1869
+ * @example
1870
+ * ```ts
1871
+ * import type { IWebViewHandle } from "@noldova/desktop.window";
1872
+ * import { PlaceholderTracker } from "@noldova/browser.window";
1873
+ *
1874
+ * function track(element: HTMLElement, view: IWebViewHandle): PlaceholderTracker {
1875
+ * return new PlaceholderTracker(element, view);
1876
+ * }
1877
+ * ```
1878
+ */
1879
+ public constructor(element: HTMLElement, view: IWebViewHandle);
1880
+
1881
+ /**
1882
+ * Shows the view while its page is placed, and hides it otherwise; once disposed it does nothing, and so does a closed view.
1883
+ *
1884
+ * @param isShown Whether the page is placed.
1885
+ * @example
1886
+ * ```ts
1887
+ * import type { PlaceholderTracker } from "@noldova/browser.window";
1888
+ *
1889
+ * function placed(tracker: PlaceholderTracker): void {
1890
+ * tracker.place(true);
1891
+ * }
1892
+ * ```
1893
+ */
1894
+ public place(isShown: boolean): void;
1895
+
1896
+ /**
1897
+ * Hides the view; later calls do nothing, and so does a closed view.
1898
+ *
1899
+ * @example
1900
+ * ```ts
1901
+ * import type { PlaceholderTracker } from "@noldova/browser.window";
1902
+ *
1903
+ * function stop(tracker: PlaceholderTracker): void {
1904
+ * tracker.dispose();
1905
+ * }
1906
+ * ```
1907
+ */
1908
+ public dispose(): void;
1909
+ }
1910
+
1911
+ /**
1912
+ * The browser module's window part, which Noldova Desktop activates in each window: it keeps the window's web views while it is active, for the
1913
+ * panes that open their tabs' views, and continues when the runtime starts again, since the main process holds the views.
1914
+ *
1915
+ * @example
1916
+ * ```ts
1917
+ * import { windowPart } from "@noldova/browser.window";
1918
+ *
1919
+ * console.log(windowPart.moduleId);
1920
+ * ```
1921
+ */
1922
+ export declare const windowPart: IWindowPart;