@botiverse/porthole 0.16.0 → 0.16.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 +12 -0
- package/dist/annotate/types.d.ts +15 -1
- package/dist/annotate/validate.js +19 -1
- package/dist/bridge/types.d.ts +1 -1
- package/dist/check/page-source.js +1 -1
- package/dist/conformance/harness-source.js +1 -1
- package/dist/host/create-host.js +2 -1
- package/dist/platform/types.d.ts +1 -1
- package/dist/shell/annotate.d.ts +3 -0
- package/dist/shell/annotate.js +15 -5
- package/docs/ADOPTING.md +393 -980
- package/docs/DECISIONS.md +57 -0
- package/docs/DESIGN.md +1099 -1336
- package/docs/PRINCIPLES.md +85 -1
- package/docs/THREAT_MODEL.md +655 -997
- package/package.json +1 -1
- package/src/annotate/types.ts +12 -1
- package/src/annotate/validate.ts +23 -1
- package/src/bridge/types.ts +1 -1
- package/src/host/create-host.ts +2 -1
- package/src/platform/types.ts +1 -1
- package/src/shell/annotate.ts +15 -5
- package/docs/ARCHITECTURE.md +0 -326
- package/docs/OBJECTIVES.md +0 -116
package/dist/host/create-host.js
CHANGED
|
@@ -308,7 +308,8 @@ export function createHost(config, options = {}) {
|
|
|
308
308
|
* Every box a report carries, clamped to the frame's viewport as it is now (P104): the page
|
|
309
309
|
* places the host's own UI nowhere outside its frame. A mark's `documentRect` and the
|
|
310
310
|
* document's `scroll` (P132) pass as they were checked: where a mark is in the document,
|
|
311
|
-
* offscreen too, which a clamp would erase; the host clips what it draws from them.
|
|
311
|
+
* offscreen too, which a clamp would erase; the host clips what it draws from them. So does a
|
|
312
|
+
* pick's `pointDocument` (P150).
|
|
312
313
|
*/
|
|
313
314
|
const withinFrame = (report) => {
|
|
314
315
|
const viewport = frameViewport();
|
package/dist/platform/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ColorScheme } from "../config/schema.ts";
|
|
|
2
2
|
import type { FrameSource } from "../isolation/types.ts";
|
|
3
3
|
import type { Transport } from "../transport/types.ts";
|
|
4
4
|
/**
|
|
5
|
-
* The platform-host seam (
|
|
5
|
+
* The platform-host seam (DESIGN.md § Platform hosts): what owns the isolation primitive and
|
|
6
6
|
* the transport. The web's is an `<iframe>` with `postMessage`; a native web view is another
|
|
7
7
|
* implementation of the same interface, not a fork.
|
|
8
8
|
*/
|
package/dist/shell/annotate.d.ts
CHANGED
|
@@ -60,6 +60,9 @@ export declare const WORD_LATE: string;
|
|
|
60
60
|
* them placed as the document scrolls, from one report and the followed mark's scroll;
|
|
61
61
|
* - the last line (P133): where a selection or a mark's words end, in the document's coordinates
|
|
62
62
|
* too (`lastLineDocumentRect`), so a host places its UI after them;
|
|
63
|
+
* - the point picked (P150): where a pointer picked an element (the click's or tap's point, a held
|
|
64
|
+
* finger's), in the document's coordinates too (`pointDocument`), so a host places its UI by what
|
|
65
|
+
* the person pointed at in an element larger than the frame;
|
|
63
66
|
* - the selection followed (P138): what the last `selected` reported (the element picked, or the
|
|
64
67
|
* words selected) is kept while the host follows the selection (`track` with `selection`) or said
|
|
65
68
|
* at `start` that it will (`keepSelection`, P140), and nothing is kept otherwise; while followed
|
package/dist/shell/annotate.js
CHANGED
|
@@ -104,6 +104,9 @@ export const WORD_LATE = String.raw `(at, now) => {
|
|
|
104
104
|
* them placed as the document scrolls, from one report and the followed mark's scroll;
|
|
105
105
|
* - the last line (P133): where a selection or a mark's words end, in the document's coordinates
|
|
106
106
|
* too (`lastLineDocumentRect`), so a host places its UI after them;
|
|
107
|
+
* - the point picked (P150): where a pointer picked an element (the click's or tap's point, a held
|
|
108
|
+
* finger's), in the document's coordinates too (`pointDocument`), so a host places its UI by what
|
|
109
|
+
* the person pointed at in an element larger than the frame;
|
|
107
110
|
* - the selection followed (P138): what the last `selected` reported (the element picked, or the
|
|
108
111
|
* words selected) is kept while the host follows the selection (`track` with `selection`) or said
|
|
109
112
|
* at `start` that it will (`keepSelection`, P140), and nothing is kept otherwise; while followed
|
|
@@ -385,11 +388,15 @@ export const ANNOTATE_RUNTIME = String.raw `if (declared("annotate")) {
|
|
|
385
388
|
return rect === null ? null : inDocument(box(rect), scroll);
|
|
386
389
|
};
|
|
387
390
|
// What a selection's report adds to its box (P133): its last line, with the scroll it was
|
|
388
|
-
// read at; neither where nothing of it is drawn.
|
|
389
|
-
|
|
391
|
+
// read at; neither where nothing of it is drawn. An element's pick by a pointer adds where it
|
|
392
|
+
// was picked (P150): that point in the viewport, in the document by the same scroll.
|
|
393
|
+
const placeOf = (found, point) => {
|
|
390
394
|
const scroll = scrollOf();
|
|
391
395
|
const lastLineDocumentRect = lastLineOf(found, scroll);
|
|
392
|
-
|
|
396
|
+
if (lastLineDocumentRect === null) {
|
|
397
|
+
return {};
|
|
398
|
+
}
|
|
399
|
+
return point ? { lastLineDocumentRect, scroll, pointDocument: { x: point.x + scroll.x, y: point.y + scroll.y } } : { lastLineDocumentRect, scroll };
|
|
393
400
|
};
|
|
394
401
|
|
|
395
402
|
// The shell's own layer, over the content: marks, the outline of what would be picked.
|
|
@@ -1709,7 +1716,7 @@ export const ANNOTATE_RUNTIME = String.raw `if (declared("annotate")) {
|
|
|
1709
1716
|
holdSelected(anchor, { element });
|
|
1710
1717
|
picked = keeping && !followingSelection ? element : null;
|
|
1711
1718
|
redraw();
|
|
1712
|
-
tell(M.selected, Object.assign({ anchor, rect: box(elementRect.call(element)) }, placeOf({ element })));
|
|
1719
|
+
tell(M.selected, Object.assign({ anchor, rect: box(elementRect.call(element)) }, placeOf({ element }, { x, y })));
|
|
1713
1720
|
}, HOLD_MS),
|
|
1714
1721
|
};
|
|
1715
1722
|
}, true);
|
|
@@ -1761,7 +1768,10 @@ export const ANNOTATE_RUNTIME = String.raw `if (declared("annotate")) {
|
|
|
1761
1768
|
// only for a host that will follow it (P140): for any other it goes with the pick.
|
|
1762
1769
|
picked = keeping && !followingSelection ? element : null;
|
|
1763
1770
|
draw();
|
|
1764
|
-
|
|
1771
|
+
// Where it was clicked or tapped (P150), the point the element was found under; a click
|
|
1772
|
+
// from the keyboard (no detail) has no point.
|
|
1773
|
+
const point = event.detail === 0 ? null : { x: event.clientX, y: event.clientY };
|
|
1774
|
+
tell(M.selected, Object.assign({ anchor, rect: box(elementRect.call(element)) }, placeOf({ element }, point)));
|
|
1765
1775
|
}, true);
|
|
1766
1776
|
window.addEventListener("keydown", (event) => {
|
|
1767
1777
|
if (event.key !== "Escape") {
|