@botiverse/porthole 0.14.0 → 0.14.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.
- package/CHANGELOG.md +770 -0
- package/dist/annotate/types.d.ts +4 -1
- package/dist/annotate/types.js +2 -0
- package/dist/annotate/validate.d.ts +2 -1
- package/dist/annotate/validate.js +11 -4
- package/dist/check/page-source.js +1 -1
- package/dist/compile/policy.js +2 -2
- package/dist/conformance/harness-source.js +1 -1
- package/dist/host/create-host.js +5 -0
- package/dist/host/types.d.ts +7 -0
- package/dist/react/frame.d.ts +4 -3
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +4 -3
- package/dist/server/naming.js +4 -0
- package/dist/server/nested.d.ts +24 -2
- package/dist/server/nested.js +28 -2
- package/dist/server/server.js +145 -25
- package/dist/server/types.d.ts +5 -0
- package/dist/shell/annotate.d.ts +3 -2
- package/dist/shell/annotate.js +22 -2
- package/dist/shell/runtime.d.ts +6 -0
- package/dist/shell/runtime.js +11 -1
- package/docs/ADOPTING.md +36 -7
- package/docs/ARCHITECTURE.md +10 -5
- package/docs/DECISIONS.md +207 -1
- package/docs/DESIGN.md +12 -4
- package/docs/THREAT_MODEL.md +30 -3
- package/package.json +6 -5
- package/src/annotate/types.ts +4 -1
- package/src/annotate/validate.ts +11 -6
- package/src/compile/policy.ts +2 -2
- package/src/host/create-host.ts +5 -0
- package/src/host/types.ts +7 -0
- package/src/react/frame.tsx +4 -3
- package/src/server/index.ts +6 -2
- package/src/server/naming.ts +4 -0
- package/src/server/nested.ts +32 -2
- package/src/server/server.ts +168 -24
- package/src/server/types.ts +5 -0
- package/src/shell/annotate.ts +22 -2
- package/src/shell/runtime.ts +12 -1
package/dist/annotate/types.d.ts
CHANGED
|
@@ -76,7 +76,8 @@ export interface AnnotationMark {
|
|
|
76
76
|
readonly anchor: AnnotationAnchor;
|
|
77
77
|
/**
|
|
78
78
|
* A marker (P104): with a count, the shell also draws a small bubble with this number (0 to
|
|
79
|
-
* `ANNOTATION_LIMITS.count
|
|
79
|
+
* `ANNOTATION_LIMITS.count`, a larger one clamped to it (P116); above 99 it reads "99+", 0 draws
|
|
80
|
+
* the bubble alone) at the end of a
|
|
80
81
|
* text anchor and the top right of an element. The person can click it: the frame reports
|
|
81
82
|
* `activated`. The content can read the number; give one only where the page may know it. A
|
|
82
83
|
* draft's is dropped (P107): its marker has no number.
|
|
@@ -182,6 +183,8 @@ export declare const ANNOTATE_METHODS: {
|
|
|
182
183
|
readonly track: "porthole/annotate.track";
|
|
183
184
|
/** Frame → host: the followed mark's box, as it moves (P112). */
|
|
184
185
|
readonly tracked: "porthole/annotate.tracked";
|
|
186
|
+
/** Host → frame: take the page's text selection away, telling nothing back (P115). */
|
|
187
|
+
readonly clearSelection: "porthole/annotate.clearSelection";
|
|
185
188
|
};
|
|
186
189
|
/** The most of each part of an anchor or report the host takes. */
|
|
187
190
|
export declare const ANNOTATION_LIMITS: {
|
package/dist/annotate/types.js
CHANGED
|
@@ -34,6 +34,8 @@ export const ANNOTATE_METHODS = {
|
|
|
34
34
|
track: "porthole/annotate.track",
|
|
35
35
|
/** Frame → host: the followed mark's box, as it moves (P112). */
|
|
36
36
|
tracked: "porthole/annotate.tracked",
|
|
37
|
+
/** Host → frame: take the page's text selection away, telling nothing back (P115). */
|
|
38
|
+
clearSelection: "porthole/annotate.clearSelection",
|
|
37
39
|
};
|
|
38
40
|
/** The most of each part of an anchor or report the host takes. */
|
|
39
41
|
export const ANNOTATION_LIMITS = {
|
|
@@ -28,7 +28,8 @@ export declare function annotateMode(mode: AnnotateMode | undefined): Required<A
|
|
|
28
28
|
*/
|
|
29
29
|
export declare const hasMarker: (mark: AnnotationMark) => boolean;
|
|
30
30
|
/**
|
|
31
|
-
* The host's marks, checked before they go to the frame; throws on the first bad one
|
|
31
|
+
* The host's marks, checked before they go to the frame; throws on the first bad one (a count above
|
|
32
|
+
* `ANNOTATION_LIMITS.count` isn't bad: it is clamped to it, P116). Each is
|
|
32
33
|
* rebuilt as the frame gets it: a posted mark as 0.10.0 sent it (no `kind`), a draft with
|
|
33
34
|
* `kind: "draft"` and without its count (P107: a draft's marker shows no number, so the page isn't
|
|
34
35
|
* told one).
|
|
@@ -189,7 +189,8 @@ export function annotateMode(mode) {
|
|
|
189
189
|
*/
|
|
190
190
|
export const hasMarker = (mark) => mark.count !== undefined || mark.kind === "draft";
|
|
191
191
|
/**
|
|
192
|
-
* The host's marks, checked before they go to the frame; throws on the first bad one
|
|
192
|
+
* The host's marks, checked before they go to the frame; throws on the first bad one (a count above
|
|
193
|
+
* `ANNOTATION_LIMITS.count` isn't bad: it is clamped to it, P116). Each is
|
|
193
194
|
* rebuilt as the frame gets it: a posted mark as 0.10.0 sent it (no `kind`), a draft with
|
|
194
195
|
* `kind: "draft"` and without its count (P107: a draft's marker shows no number, so the page isn't
|
|
195
196
|
* told one).
|
|
@@ -204,8 +205,10 @@ export function checkMarks(marks) {
|
|
|
204
205
|
if (!markId(mark?.id) || seen.has(mark.id) || anchor === null) {
|
|
205
206
|
throw new TypeError(`annotations.show: mark ${index} needs a unique id (1 to ${LIMITS.id} characters) and a valid anchor`);
|
|
206
207
|
}
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
// A count above the limit is clamped to it (P116): the marker reads "99+" either way, and a
|
|
209
|
+
// count is data anyone can grow (a thread's replies), so it mustn't reject the whole list.
|
|
210
|
+
if (mark.count !== undefined && !count(mark.count, Infinity)) {
|
|
211
|
+
throw new TypeError(`annotations.show: mark ${index}'s count is a whole number, 0 or more`);
|
|
209
212
|
}
|
|
210
213
|
const kind = mark.kind;
|
|
211
214
|
if (kind !== undefined && kind !== "posted" && kind !== "draft") {
|
|
@@ -215,6 +218,10 @@ export function checkMarks(marks) {
|
|
|
215
218
|
if (kind === "draft") {
|
|
216
219
|
return { id: mark.id, anchor, kind };
|
|
217
220
|
}
|
|
218
|
-
return {
|
|
221
|
+
return {
|
|
222
|
+
id: mark.id,
|
|
223
|
+
anchor,
|
|
224
|
+
...(mark.count === undefined ? {} : { count: Math.min(mark.count, LIMITS.count) }),
|
|
225
|
+
};
|
|
219
226
|
});
|
|
220
227
|
}
|