@autono/pinbox-toolbar 0.15.0 → 0.17.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/{index-BVd-ZD4Y.d.ts → index-DENhglDF.d.ts} +48 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +3 -7
- package/dist/{src-GX3kPe0X.js → src-BsWnyGwB.js} +2015 -1081
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +3 -3
- package/dist/toolbar.iife.js +2015 -1081
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +2 -2
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Attachment, Pin, PinInput, ThreadMessage } from "@autono/pinbox-core/schema";
|
|
2
|
+
import { Session } from "@autono/pinbox-core/sessions";
|
|
2
3
|
//#region src/capture.d.ts
|
|
3
4
|
/**
|
|
4
5
|
* The full browser shapes. `Pin["target"]`/`Pin["env"]` are optional at v1 (core
|
|
@@ -20,7 +21,7 @@ interface CaptureResult {
|
|
|
20
21
|
}
|
|
21
22
|
//#endregion
|
|
22
23
|
//#region src/state.d.ts
|
|
23
|
-
type UiStatus = "open" | "waiting" | "replied" | "resolved" | "verify";
|
|
24
|
+
type UiStatus = "open" | "waiting" | "replied" | "resolved" | "verify" | "note" | "stale";
|
|
24
25
|
interface Draft {
|
|
25
26
|
target: CaptureResult;
|
|
26
27
|
placedAt: {
|
|
@@ -50,6 +51,24 @@ interface ToolbarState {
|
|
|
50
51
|
* pin unhides so the marker you just dropped is never invisible.
|
|
51
52
|
*/
|
|
52
53
|
pinsHidden: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Wall clock, refreshed by the element every 30 s while connected (and on connect). 0 until
|
|
56
|
+
* then, which means "unknown": nothing is ever stale against an unknown clock, so tests that
|
|
57
|
+
* never tick see exactly the pre-clock behaviour. Living in state, a tick is a render.
|
|
58
|
+
*/
|
|
59
|
+
clock: number;
|
|
60
|
+
/**
|
|
61
|
+
* Is an agent session listening on the hub? From GET /sessions on each (re)connect; null
|
|
62
|
+
* until the first answer. With nobody listening, a pin goes stale after THINKING_MS instead
|
|
63
|
+
* of STALE_AFTER_MS — there is no point telling you an agent is thinking when none is there.
|
|
64
|
+
*/
|
|
65
|
+
agentLive: boolean | null;
|
|
66
|
+
/**
|
|
67
|
+
* How new pins get their picture. "dom" (default): a no-permission element snapshot
|
|
68
|
+
* (screenshot-dom.ts). "tab": real pixels via tab capture — Chrome asks once per page load.
|
|
69
|
+
* Persisted per endpoint; the bar's camera button flips it.
|
|
70
|
+
*/
|
|
71
|
+
captureMode: "dom" | "tab";
|
|
53
72
|
}
|
|
54
73
|
interface Store {
|
|
55
74
|
get(): ToolbarState;
|
|
@@ -79,15 +98,22 @@ declare function applyHubEvent(store: Store, event: {
|
|
|
79
98
|
at: string;
|
|
80
99
|
payload: unknown;
|
|
81
100
|
}): void;
|
|
101
|
+
/** What the status derivation needs from state besides the pin: the clock and agent liveness. */
|
|
102
|
+
type StatusView = Pick<ToolbarState, "clock" | "agentLive">;
|
|
82
103
|
/**
|
|
83
104
|
* Wire-status → UI-status mapping:
|
|
84
105
|
* resolved + no verification ⇒ "verify" (accept/reopen prompt);
|
|
85
106
|
* resolved + verification ⇒ "resolved";
|
|
107
|
+
* open comment pin ⇒ "note" (nobody owes a reply — never "waiting");
|
|
108
|
+
* open + reply owed too long (pendingKind "stale") ⇒ "stale";
|
|
86
109
|
* open + empty thread or last message human ⇒ "waiting";
|
|
87
110
|
* open + last message agent|mirror ⇒ "replied".
|
|
88
111
|
* The prototype's WORKING/APPLIED chips need an event vocabulary the hub does not emit — excluded here.
|
|
89
112
|
*/
|
|
90
|
-
declare function deriveUiStatus(pin: Pin, thread: ThreadMessage[]): UiStatus;
|
|
113
|
+
declare function deriveUiStatus(pin: Pin, thread: ThreadMessage[], view?: StatusView): UiStatus;
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/ui/card-parts.d.ts
|
|
116
|
+
type DraftKind = "note" | "comment";
|
|
91
117
|
//#endregion
|
|
92
118
|
//#region src/element.d.ts
|
|
93
119
|
declare const BaseElement: typeof HTMLElement;
|
|
@@ -99,9 +125,9 @@ declare class PinboxToolbarElement extends BaseElement {
|
|
|
99
125
|
readonly store: Store;
|
|
100
126
|
/** Card → transport seam (wired by #startTransport once a config exists). */
|
|
101
127
|
readonly actions: {
|
|
102
|
-
send?: (pinId: string | "draft", text: string) => void;
|
|
128
|
+
send?: (pinId: string | "draft", text: string, kind: DraftKind) => void;
|
|
103
129
|
verify?: (pinId: string, outcome: "accepted" | "reopened") => void;
|
|
104
|
-
resolve?: (pinId: string) => void;
|
|
130
|
+
resolve?: (pinId: string, note?: string) => void;
|
|
105
131
|
};
|
|
106
132
|
/** Programmatic path (Pinbox.init). The snippet path reads hub/token attributes. */
|
|
107
133
|
configure(config: PinboxConfig): void;
|
|
@@ -174,6 +200,8 @@ interface TransportOptions {
|
|
|
174
200
|
onConnection(state: ConnectionState): void;
|
|
175
201
|
/** Reconciled pin lists: fresh `listPins()` after each reconnect (hub wins on status). */
|
|
176
202
|
onPins?(pins: Pin[]): void;
|
|
203
|
+
/** Agent sessions, fetched alongside each reconcile — the UI's "is anyone listening" signal. */
|
|
204
|
+
onSessions?(sessions: Session[]): void;
|
|
177
205
|
/** Queued outbox localIds whenever the set changes — the UI flags them as pending sync. */
|
|
178
206
|
onOutbox?(localIds: string[]): void;
|
|
179
207
|
/** Test seam; default global fetch. */
|
|
@@ -223,19 +251,29 @@ interface PinboxConfig {
|
|
|
223
251
|
/** Reserved; the realtime topic is fixed server-side. */
|
|
224
252
|
project?: string;
|
|
225
253
|
/**
|
|
226
|
-
* Attach a screenshot to new pins. Default true.
|
|
227
|
-
*
|
|
228
|
-
* Capturing one means asking the browser to share the tab, and that permission prompt is the
|
|
229
|
-
* first thing a visitor sees — fine in a project you already trust, hostile on a public page.
|
|
230
|
-
* Set false and pins ship with their structured capture (selector, markup, viewport) and no
|
|
231
|
-
* pixels.
|
|
254
|
+
* Attach a screenshot to new pins. Default true. Set false and pins ship with their
|
|
255
|
+
* structured capture (selector, markup, viewport) and no pixels at all.
|
|
232
256
|
*/
|
|
233
257
|
screenshots?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* How the screenshot is taken when nothing is persisted yet. Default "dom": a no-permission
|
|
260
|
+
* snapshot of the element (cloned, styles inlined, drawn to a canvas — images become neutral
|
|
261
|
+
* boxes). "tab": real pixels via tab capture, which makes Chrome ask to share the tab once per
|
|
262
|
+
* page load. The visitor can flip this from the bar's camera button; their choice persists per
|
|
263
|
+
* endpoint and wins over this on reload.
|
|
264
|
+
*/
|
|
265
|
+
capture?: "dom" | "tab";
|
|
234
266
|
/**
|
|
235
267
|
* Start with the bar collapsed to the floating puck. Default false. A
|
|
236
268
|
* visitor's own choice, persisted per endpoint, wins over this on reload.
|
|
237
269
|
*/
|
|
238
270
|
minimized?: boolean;
|
|
271
|
+
/**
|
|
272
|
+
* Keyboard shortcuts. Default "all". "escape-only" keeps Esc (dismiss) and hands every
|
|
273
|
+
* letter back to the host; "off" never reads the keyboard. For hosts whose own hotkeys
|
|
274
|
+
* collide. A subtree can also opt out with `data-pinbox-ignore-keys`.
|
|
275
|
+
*/
|
|
276
|
+
shortcuts?: "all" | "escape-only" | "off";
|
|
239
277
|
}
|
|
240
278
|
/** Register <pinbox-toolbar>; no-op outside a browser or when already defined. */
|
|
241
279
|
declare function defineToolbarElement(): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as applyHubEvent, a as HubEvent, b as upsertPin, c as WebSocketLike, d as PinboxToolbarElement, f as Draft, g as appendThreadMessage, h as UiStatus, i as ConnectionState, l as HubError, m as ToolbarState, n as PinboxConfig, o as HubTransport, p as Store, r as defineToolbarElement, s as TransportOptions, t as Pinbox, u as StorageLike, v as createStore, x as CaptureResult, y as deriveUiStatus } from "./index-
|
|
1
|
+
import { _ as applyHubEvent, a as HubEvent, b as upsertPin, c as WebSocketLike, d as PinboxToolbarElement, f as Draft, g as appendThreadMessage, h as UiStatus, i as ConnectionState, l as HubError, m as ToolbarState, n as PinboxConfig, o as HubTransport, p as Store, r as defineToolbarElement, s as TransportOptions, t as Pinbox, u as StorageLike, v as createStore, x as CaptureResult, y as deriveUiStatus } from "./index-DENhglDF.js";
|
|
2
2
|
export { type CaptureResult, type ConnectionState, type Draft, HubError, type HubEvent, HubTransport, Pinbox, PinboxConfig, PinboxToolbarElement, type StorageLike, type Store, type ToolbarState, type TransportOptions, type UiStatus, type WebSocketLike, appendThreadMessage, applyHubEvent, createStore, defineToolbarElement, deriveUiStatus, upsertPin };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as HubError, c as createStore, i as HubTransport, l as deriveUiStatus, n as defineToolbarElement, o as appendThreadMessage, r as PinboxToolbarElement, s as applyHubEvent, t as Pinbox, u as upsertPin } from "./src-
|
|
1
|
+
import { a as HubError, c as createStore, i as HubTransport, l as deriveUiStatus, n as defineToolbarElement, o as appendThreadMessage, r as PinboxToolbarElement, s as applyHubEvent, t as Pinbox, u as upsertPin } from "./src-BsWnyGwB.js";
|
|
2
2
|
export { HubError, HubTransport, Pinbox, PinboxToolbarElement, appendThreadMessage, applyHubEvent, createStore, defineToolbarElement, deriveUiStatus, upsertPin };
|
package/dist/react.d.ts
CHANGED
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as defineToolbarElement, r as PinboxToolbarElement } from "./src-
|
|
1
|
+
import { n as defineToolbarElement, r as PinboxToolbarElement } from "./src-BsWnyGwB.js";
|
|
2
2
|
import { createElement, useEffect, useRef } from "react";
|
|
3
3
|
//#region src/react.ts
|
|
4
4
|
/**
|
|
@@ -7,22 +7,18 @@ import { createElement, useEffect, useRef } from "react";
|
|
|
7
7
|
* reconfiguration; remount with a `key` to change endpoints.
|
|
8
8
|
*/
|
|
9
9
|
function PinboxToolbar(props) {
|
|
10
|
-
const host = useRef(null);
|
|
11
10
|
const config = useRef(props);
|
|
12
11
|
config.current = props;
|
|
13
12
|
useEffect(() => {
|
|
14
13
|
defineToolbarElement();
|
|
15
14
|
const el = document.createElement(PinboxToolbarElement.tagName);
|
|
16
15
|
el.configure(config.current);
|
|
17
|
-
|
|
16
|
+
document.body.appendChild(el);
|
|
18
17
|
return () => {
|
|
19
18
|
el.remove();
|
|
20
19
|
};
|
|
21
20
|
}, []);
|
|
22
|
-
return createElement("div", {
|
|
23
|
-
ref: host,
|
|
24
|
-
style: { display: "contents" }
|
|
25
|
-
});
|
|
21
|
+
return createElement("div", { style: { display: "contents" } });
|
|
26
22
|
}
|
|
27
23
|
//#endregion
|
|
28
24
|
export { PinboxToolbar };
|