@botiverse/porthole 0.9.0 → 0.12.0
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/dist/annotate/types.d.ts +21 -7
- package/dist/annotate/validate.d.ts +18 -3
- package/dist/annotate/validate.js +29 -5
- package/dist/bridge/bridge.js +1 -51
- package/dist/bridge/unseen.d.ts +18 -0
- package/dist/bridge/unseen.js +71 -0
- package/dist/check/files.d.ts +2 -0
- package/dist/check/files.js +67 -50
- package/dist/check/lint.d.ts +8 -1
- package/dist/check/lint.js +18 -0
- package/dist/check/markup.d.ts +7 -0
- package/dist/check/markup.js +49 -0
- package/dist/check/page-source.js +1 -1
- package/dist/check/scroll.d.ts +100 -0
- package/dist/check/scroll.js +1429 -0
- package/dist/conformance/behavior.js +107 -68
- package/dist/conformance/clipboard.js +16 -14
- package/dist/conformance/harness-source.js +1 -1
- package/dist/conformance/limits.js +117 -64
- package/dist/conformance/probes.js +66 -49
- package/dist/conformance/runtime.js +6 -0
- package/dist/conformance/served.js +66 -63
- package/dist/guide/guide.js +1 -1
- package/dist/guide/runtime.js +2 -2
- package/dist/host/create-host.js +46 -4
- package/dist/index.d.ts +1 -1
- package/dist/platform/types.d.ts +4 -2
- package/dist/react/frame.d.ts +2 -1
- package/dist/runtime/requests.d.ts +5 -0
- package/dist/runtime/requests.js +16 -1
- package/dist/runtime/types.generated.js +1 -1
- package/dist/shell/annotate.d.ts +6 -3
- package/dist/shell/annotate.js +474 -104
- package/dist/shell/use.js +9 -1
- package/docs/ADOPTING.md +99 -1
- package/docs/ARCHITECTURE.md +2 -1
- package/docs/DECISIONS.md +764 -14
- package/docs/DESIGN.md +192 -42
- package/docs/THREAT_MODEL.md +109 -27
- package/package.json +1 -1
- package/src/annotate/types.ts +22 -7
- package/src/annotate/validate.ts +32 -6
- package/src/bridge/bridge.ts +1 -60
- package/src/bridge/unseen.ts +82 -0
- package/src/check/files.ts +68 -54
- package/src/check/lint.ts +24 -0
- package/src/check/markup.ts +53 -0
- package/src/check/scroll.ts +1757 -0
- package/src/conformance/behavior.ts +221 -69
- package/src/conformance/clipboard.ts +44 -14
- package/src/conformance/limits.ts +169 -76
- package/src/conformance/probes.ts +97 -49
- package/src/conformance/runtime.ts +9 -0
- package/src/conformance/served.ts +112 -63
- package/src/guide/guide.ts +1 -0
- package/src/guide/runtime.ts +2 -2
- package/src/host/create-host.ts +50 -4
- package/src/index.ts +1 -0
- package/src/platform/types.ts +4 -2
- package/src/react/frame.tsx +2 -1
- package/src/runtime/requests.ts +23 -1
- package/src/runtime/types.generated.ts +1 -1
- package/src/shell/annotate.ts +474 -104
- package/src/shell/use.ts +9 -1
- package/types/runtime/v1/comments.d.ts +14 -4
package/src/shell/use.ts
CHANGED
|
@@ -131,7 +131,15 @@ export const USE_RUNTIME = String.raw`
|
|
|
131
131
|
const METHODS = {
|
|
132
132
|
user: { get: () => call("user", "get", {}) },
|
|
133
133
|
comments: {
|
|
134
|
-
|
|
134
|
+
// The draft goes as the page gave it, for the host to refuse what isn't text (P108): read
|
|
135
|
+
// after the click's check, so a getter that throws is a rejection; options that aren't an
|
|
136
|
+
// object send a null draft, refused.
|
|
137
|
+
open: (anchor, options) =>
|
|
138
|
+
clicked("comments", "comments.open") ||
|
|
139
|
+
Promise.resolve().then(() => {
|
|
140
|
+
const draft = options === undefined || options === null ? undefined : typeof options === "object" ? options.draft : null;
|
|
141
|
+
return call("comments", "open", { anchor: typeof anchor === "string" ? { name: anchor } : record(anchor), ...(draft === undefined ? {} : { draft }) });
|
|
142
|
+
}),
|
|
135
143
|
},
|
|
136
144
|
clipboard: { copy: (text) => clicked("copyText", "clipboard.copy") || call("clipboard", "copy", { text: String(text) }) },
|
|
137
145
|
links: { open: (url) => clicked("openLink", "links.open") || call("links", "open", { url: String(url) }) },
|
|
@@ -10,13 +10,23 @@ interface PortholeCommentAnchor {
|
|
|
10
10
|
readonly quote?: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/** How the composer opens. */
|
|
14
|
+
interface PortholeCommentOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Text the composer starts with (at most 2,000 characters): a draft the person edits, posts
|
|
17
|
+
* or discards in the app. It is never posted without them. Visible text only: new lines and
|
|
18
|
+
* tabs are fine; a draft with zero-width, bidi or tag characters is refused.
|
|
19
|
+
*/
|
|
20
|
+
readonly draft?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
13
23
|
interface PortholeComments {
|
|
14
24
|
/**
|
|
15
|
-
* Opens the app's comment composer at the anchor (a name alone is { name })
|
|
16
|
-
* and posts it in the app. Resolves true if the
|
|
17
|
-
* comments. Call it from a click. Level: view.
|
|
25
|
+
* Opens the app's comment composer at the anchor (a name alone is { name }), starting with
|
|
26
|
+
* `options.draft` if given. The person writes and posts it in the app. Resolves true if the
|
|
27
|
+
* composer opened. Write-only: a page never reads comments. Call it from a click. Level: view.
|
|
18
28
|
*/
|
|
19
|
-
open(anchor: PortholeCommentAnchor | string): Promise<boolean>;
|
|
29
|
+
open(anchor: PortholeCommentAnchor | string, options?: PortholeCommentOptions): Promise<boolean>;
|
|
20
30
|
}
|
|
21
31
|
|
|
22
32
|
interface PortholeCapabilities {
|