@botiverse/porthole 0.14.15 → 0.14.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,37 @@
4
4
  section); the reasons for every change are in [docs/DECISIONS.md](docs/DECISIONS.md), by the
5
5
  P-numbers below.
6
6
 
7
+ ## 0.14.16
8
+
9
+ - **On a tab the shell asks no host (P139).** A page opened on a tab of its own no longer asks
10
+ `ui/initialize` 40 times over 10 s before the runtime says it has nothing to offer: there is no
11
+ host there to answer, so it says so at once, with no request and no timer. In a frame nothing
12
+ changes. `porthole.use` was already null at once on a tab, so pages draw as before.
13
+ - **The shell says how its handshake ended (P139).** The document's root (`<html>`) carries
14
+ `data-porthole-host`, kept when a whole page replaces the shell's body: `"none"` once no host
15
+ will answer (on a tab, before the page's own scripts run), `"answered"` once one has. A tool that shoots pages on a tab (a publish check) can wait for
16
+ it instead of a fixed 10 s, keeping the fixed wait where it is absent (an older shell). It is the
17
+ page's word, never a gate. Upgrade the content server for it.
18
+ - **Security (P139):** no CSP, sandbox, egress, gate or message changes. On a tab the shell sent
19
+ nothing before either (its parent is itself).
20
+ - **Annotations: a pick stays lit only for a host that follows it (P140, Ferryman's audit of
21
+ 0.14.15).** 0.14.15 kept every pick outlined after `selected`, and every selection in the frame's
22
+ memory, for every host, including one that never follows the selection. Now that happens only for
23
+ a host that says it follows what is selected: `annotations.start({ ..., keepSelection: true })`
24
+ (React does it for you on a start made while `trackedSelection` is given; giving it or leaving it
25
+ out later restarts no mode). Any other host gets 0.14.14's
26
+ behaviour: the outline goes with the pick, and the frame keeps nothing. A follow asked before the
27
+ pick follows it without the option. **If you follow the selection after `selected`** (0.14.15's
28
+ sample, and React with `trackedSelection`), start with `keepSelection: true`, or give
29
+ `trackedSelection` from the first render (`false` until the composer opens): without it a newer
30
+ content server has nothing to follow and answers `orphaned`, so upgrade the host with the content
31
+ server.
32
+ - **Annotations: an unasked `selectionTracked` is no refusal (P140).** A host that follows no
33
+ selection drops it unread, as 0.14.14 did, instead of counting a malformed one as `invalid`.
34
+ - **Security (P140):** a narrowing: less drawn and less kept for a host that doesn't follow, and a
35
+ page's word read by fewer hosts. No CSP, sandbox, egress or gate changes; control
36
+ `track-selection-checks` covers the unread drop too.
37
+
7
38
  ## 0.14.15
8
39
 
9
40
  - **Annotations: the selection followed (P138).** `annotations.track({ selection: true })` (React:
@@ -76,11 +76,20 @@ export interface AnnotateMode {
76
76
  readonly elements?: boolean | "hold";
77
77
  /** Text, by selecting it: each settled selection is reported, and its clearing. */
78
78
  readonly text?: boolean;
79
+ /**
80
+ * That you follow what is selected (P140): `annotations.track({ selection: true })` once
81
+ * `selected` comes (React sets it while `trackedSelection` is given). Only then does the frame
82
+ * keep it for you to follow, the element just picked outlined until the follow takes over. Without
83
+ * it the frame keeps nothing and a pick's outline goes with the pick, as before 0.14.15; a follow
84
+ * asked before the pick still follows each selection reported while it lasts.
85
+ */
86
+ readonly keepSelection?: boolean;
79
87
  }
80
88
  /**
81
89
  * What `annotations.track` follows (P112, P138): a shown mark, by its id; the selection the frame
82
90
  * last reported as `selected` (the element picked, or the words selected), highlighted in the
83
- * frame while followed; or nothing (`null`). One at a time: each replaces the last.
91
+ * frame while followed, and kept for a follow asked after `selected` only under `start`'s
92
+ * `keepSelection` (P140); or nothing (`null`). One at a time: each replaces the last.
84
93
  */
85
94
  export type AnnotationTrackTarget = string | {
86
95
  readonly selection: true;
@@ -34,8 +34,15 @@ export declare function inViewport(rect: AnnotationRect, viewport: {
34
34
  } | null | undefined): boolean;
35
35
  /** A report from the frame, checked; null if malformed (it is then dropped). */
36
36
  export declare function parseReport(value: unknown): AnnotationReport | null;
37
- /** What the host may start with: elements, text, or both (default both). */
38
- export declare function annotateMode(mode: AnnotateMode | undefined): Required<AnnotateMode>;
37
+ /** A mode as the frame gets it: `keepSelection` only where it is true (P140). */
38
+ export type StartedMode = Required<Omit<AnnotateMode, "keepSelection">> & {
39
+ readonly keepSelection?: true;
40
+ };
41
+ /**
42
+ * What the host may start with: elements, text, or both (default both); and whether it follows
43
+ * what is selected (`keepSelection`, P140).
44
+ */
45
+ export declare function annotateMode(mode: AnnotateMode | undefined): StartedMode;
39
46
  /**
40
47
  * Whether a mark gets a marker, the one thing a person can click (P104): one with a `count`, and
41
48
  * every draft (P107).
@@ -286,16 +286,23 @@ export function parseReport(value) {
286
286
  return null;
287
287
  }
288
288
  }
289
- /** What the host may start with: elements, text, or both (default both). */
289
+ /**
290
+ * What the host may start with: elements, text, or both (default both); and whether it follows
291
+ * what is selected (`keepSelection`, P140).
292
+ */
290
293
  export function annotateMode(mode) {
291
294
  const elements = mode?.elements ?? true;
292
295
  const words = mode?.text ?? true;
296
+ const keep = mode?.keepSelection ?? false;
293
297
  if ((typeof elements !== "boolean" && elements !== "hold") ||
294
298
  typeof words !== "boolean" ||
295
299
  (elements === false && !words)) {
296
300
  throw new TypeError("annotations.start: elements, text, or both");
297
301
  }
298
- return { elements, text: words };
302
+ if (typeof keep !== "boolean") {
303
+ throw new TypeError("annotations.start: keepSelection is true or false");
304
+ }
305
+ return { elements, text: words, ...(keep ? { keepSelection: true } : {}) };
299
306
  }
300
307
  /**
301
308
  * Whether a mark gets a marker, the one thing a person can click (P104): one with a `count`, and