@autono/pinbox-toolbar 0.7.0 → 0.8.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-BAoi0bRT.d.ts +2633 -0
- package/dist/index.d.ts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/vue.d.ts +1 -1
- package/package.json +2 -2
- package/dist/index-DnhwJYxE.d.ts +0 -224
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-BAoi0bRT.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/react.d.ts
CHANGED
package/dist/svelte.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-BAoi0bRT.js";
|
|
2
2
|
import { Action } from "svelte/action";
|
|
3
3
|
//#region src/svelte.d.ts
|
|
4
4
|
/**
|
package/dist/vue.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as PinboxToolbarElement, n as PinboxConfig } from "./index-
|
|
1
|
+
import { d as PinboxToolbarElement, n as PinboxConfig } from "./index-BAoi0bRT.js";
|
|
2
2
|
import { VNode } from "vue";
|
|
3
3
|
//#region src/vue.d.ts
|
|
4
4
|
/** The slice of the Vue component instance this wrapper touches. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autono/pinbox-toolbar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@autono/pinbox-core": "0.
|
|
74
|
+
"@autono/pinbox-core": "0.8.0",
|
|
75
75
|
"@types/react": "^19.2.0",
|
|
76
76
|
"typescript": "^7.0.0",
|
|
77
77
|
"tsdown": "^0.22.0",
|
package/dist/index-DnhwJYxE.d.ts
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import { Attachment, Pin, PinInput, ThreadMessage } from "@autono/pinbox-core/schema";
|
|
2
|
-
//#region src/capture.d.ts
|
|
3
|
-
/**
|
|
4
|
-
* The full browser shapes. `Pin["target"]`/`Pin["env"]` are optional at v1 (core
|
|
5
|
-
* schema.ts §"widened in place") because a terminal `pinbox pin` has no browser to
|
|
6
|
-
* measure. A capture is the opposite case: it always has a window, so it always
|
|
7
|
-
* produces every field. Narrowing here is what keeps every capture-side consumer
|
|
8
|
-
* free of optional chaining — the widening only reaches code that reads pins back.
|
|
9
|
-
*/
|
|
10
|
-
type MaybeTarget = NonNullable<Pin["target"]>;
|
|
11
|
-
type MaybeEnv = NonNullable<Pin["env"]>;
|
|
12
|
-
/** The named keys become present-and-defined; everything else keeps its optionality. */
|
|
13
|
-
type Concrete<T, K extends keyof T> = T & { [P in K]-?: NonNullable<T[P]>; };
|
|
14
|
-
type BrowserTarget = Concrete<MaybeTarget, "url" | "selector" | "tag" | "rect" | "fixed">;
|
|
15
|
-
type BrowserEnv = Concrete<MaybeEnv, "viewport" | "browser" | "os" | "colorScheme">;
|
|
16
|
-
/** What a targeting adapter produces for a chosen element: the pin schema shapes. */
|
|
17
|
-
interface CaptureResult {
|
|
18
|
-
target: BrowserTarget;
|
|
19
|
-
env: BrowserEnv;
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/state.d.ts
|
|
23
|
-
type UiStatus = "open" | "waiting" | "replied" | "resolved" | "verify";
|
|
24
|
-
interface Draft {
|
|
25
|
-
target: CaptureResult;
|
|
26
|
-
placedAt: {
|
|
27
|
-
x: number;
|
|
28
|
-
y: number;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
interface ToolbarState {
|
|
32
|
-
pins: Pin[];
|
|
33
|
-
threads: Map<string, ThreadMessage[]>;
|
|
34
|
-
draft: Draft | null;
|
|
35
|
-
mode: "idle" | "placing";
|
|
36
|
-
activePinId: string | null;
|
|
37
|
-
inboxOpen: boolean;
|
|
38
|
-
connection: "connecting" | "live" | "offline" | "incompatible";
|
|
39
|
-
/** Outbox-queued pin ids (offline creates) — flagged "queued" in the UI until the flush. */
|
|
40
|
-
queuedIds: ReadonlySet<string>;
|
|
41
|
-
}
|
|
42
|
-
interface Store {
|
|
43
|
-
get(): ToolbarState;
|
|
44
|
-
/** Render subscribes once; every update() notifies each subscriber exactly once. */
|
|
45
|
-
subscribe(fn: (state: ToolbarState) => void): () => void;
|
|
46
|
-
update(patch: Partial<ToolbarState>): void;
|
|
47
|
-
/** Placement click: sets the draft and leaves placing mode. Client-only — no hub call. */
|
|
48
|
-
place(draft: Draft): void;
|
|
49
|
-
/** Abandoned draft: cleared without touching pins; nothing ever reached the hub. */
|
|
50
|
-
discardDraft(): void;
|
|
51
|
-
/** First comment submitted: the hub-created Pin replaces the draft and becomes active. */
|
|
52
|
-
commitDraft(pin: Pin): void;
|
|
53
|
-
}
|
|
54
|
-
declare function createStore(): Store;
|
|
55
|
-
/** Replace-by-id upsert; new pins append. */
|
|
56
|
-
declare function upsertPin(store: Store, pin: Pin): void;
|
|
57
|
-
/** Append to the pin's thread, deduping by message id (REST echo vs WS event). */
|
|
58
|
-
declare function appendThreadMessage(store: Store, message: ThreadMessage): void;
|
|
59
|
-
/**
|
|
60
|
-
* Wire events mutate the store: pin.created upserts;
|
|
61
|
-
* pin.resolved / pin.verified / pin.linked replace the payload Pin;
|
|
62
|
-
* thread.message appends — payloads are the full post-mutation objects.
|
|
63
|
-
*/
|
|
64
|
-
declare function applyHubEvent(store: Store, event: {
|
|
65
|
-
seq: number;
|
|
66
|
-
eventType: string;
|
|
67
|
-
at: string;
|
|
68
|
-
payload: unknown;
|
|
69
|
-
}): void;
|
|
70
|
-
/**
|
|
71
|
-
* Wire-status → UI-status mapping:
|
|
72
|
-
* resolved + no verification ⇒ "verify" (accept/reopen prompt);
|
|
73
|
-
* resolved + verification ⇒ "resolved";
|
|
74
|
-
* open + empty thread or last message human ⇒ "waiting";
|
|
75
|
-
* open + last message agent|mirror ⇒ "replied".
|
|
76
|
-
* The prototype's WORKING/APPLIED chips need an event vocabulary the hub does not emit — excluded here.
|
|
77
|
-
*/
|
|
78
|
-
declare function deriveUiStatus(pin: Pin, thread: ThreadMessage[]): UiStatus;
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region src/element.d.ts
|
|
81
|
-
declare const BaseElement: typeof HTMLElement;
|
|
82
|
-
declare class PinboxToolbarElement extends BaseElement {
|
|
83
|
-
#private;
|
|
84
|
-
static readonly tagName = "pinbox-toolbar";
|
|
85
|
-
/** Watched so a config that arrives after insertion can still start the transport. */
|
|
86
|
-
static readonly observedAttributes: string[];
|
|
87
|
-
readonly store: Store;
|
|
88
|
-
/** Card → transport seam (wired by #startTransport once a config exists). */
|
|
89
|
-
readonly actions: {
|
|
90
|
-
send?: (pinId: string | "draft", text: string) => void;
|
|
91
|
-
verify?: (pinId: string, outcome: "accepted" | "reopened") => void;
|
|
92
|
-
resolve?: (pinId: string) => void;
|
|
93
|
-
};
|
|
94
|
-
/** Programmatic path (Pinbox.init). The snippet path reads hub/token attributes. */
|
|
95
|
-
configure(config: PinboxConfig): void;
|
|
96
|
-
get config(): PinboxConfig | null;
|
|
97
|
-
connectedCallback(): void;
|
|
98
|
-
/**
|
|
99
|
-
* Late-config rescue: an element inserted BEFORE its hub/token attributes were
|
|
100
|
-
* set connected configless and #startTransport bailed. Starting here the moment
|
|
101
|
-
* a config first exists keeps such an element from staying silently dead.
|
|
102
|
-
* Config is still read once — a running transport is never reconfigured.
|
|
103
|
-
*/
|
|
104
|
-
attributeChangedCallback(): void;
|
|
105
|
-
disconnectedCallback(): void;
|
|
106
|
-
}
|
|
107
|
-
//#endregion
|
|
108
|
-
//#region src/transport/mirror.d.ts
|
|
109
|
-
interface StorageLike {
|
|
110
|
-
getItem(key: string): string | null;
|
|
111
|
-
setItem(key: string, value: string): void;
|
|
112
|
-
removeItem(key: string): void;
|
|
113
|
-
}
|
|
114
|
-
//#endregion
|
|
115
|
-
//#region src/transport/rest.d.ts
|
|
116
|
-
type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
|
|
117
|
-
declare class HubError extends Error {
|
|
118
|
-
readonly code: string;
|
|
119
|
-
readonly status: number;
|
|
120
|
-
readonly hint: string | undefined;
|
|
121
|
-
constructor(code: string, message: string, status: number, hint?: string);
|
|
122
|
-
}
|
|
123
|
-
//#endregion
|
|
124
|
-
//#region src/transport.d.ts
|
|
125
|
-
/** The browser WebSocket surface the transport needs — injectable for tests. */
|
|
126
|
-
interface WebSocketLike {
|
|
127
|
-
send(data: string): void;
|
|
128
|
-
close(code?: number, reason?: string): void;
|
|
129
|
-
onopen: (() => void) | null;
|
|
130
|
-
onmessage: ((ev: {
|
|
131
|
-
data: string;
|
|
132
|
-
}) => void) | null;
|
|
133
|
-
onclose: ((ev: {
|
|
134
|
-
code: number;
|
|
135
|
-
}) => void) | null;
|
|
136
|
-
onerror: (() => void) | null;
|
|
137
|
-
}
|
|
138
|
-
interface SchedulerLike {
|
|
139
|
-
setTimeout(fn: () => void, ms: number): unknown;
|
|
140
|
-
clearTimeout(id: unknown): void;
|
|
141
|
-
}
|
|
142
|
-
interface HubEvent {
|
|
143
|
-
seq: number;
|
|
144
|
-
eventType: string;
|
|
145
|
-
at: string;
|
|
146
|
-
payload: unknown;
|
|
147
|
-
}
|
|
148
|
-
type ConnectionState = "connecting" | "live" | "offline" | "incompatible";
|
|
149
|
-
interface TransportOptions {
|
|
150
|
-
endpoint: string;
|
|
151
|
-
token: string;
|
|
152
|
-
/** Default localStorage; injectable for tests. */
|
|
153
|
-
storage?: StorageLike;
|
|
154
|
-
/** Injectable for tests. */
|
|
155
|
-
webSocket?: (url: string, protocols: string[]) => WebSocketLike;
|
|
156
|
-
onEvent(e: HubEvent): void;
|
|
157
|
-
onConnection(state: ConnectionState): void;
|
|
158
|
-
/** Reconciled pin lists: fresh `listPins()` after each reconnect (hub wins on status). */
|
|
159
|
-
onPins?(pins: Pin[]): void;
|
|
160
|
-
/** Queued outbox localIds whenever the set changes — the UI flags them as pending sync. */
|
|
161
|
-
onOutbox?(localIds: string[]): void;
|
|
162
|
-
/** Test seam; default global fetch. */
|
|
163
|
-
fetchFn?: FetchLike;
|
|
164
|
-
/** Test seam standing in for fake timers; default global setTimeout/clearTimeout. */
|
|
165
|
-
scheduler?: SchedulerLike;
|
|
166
|
-
}
|
|
167
|
-
declare class HubTransport {
|
|
168
|
-
#private;
|
|
169
|
-
/** Stable per install, persisted (`pinbox:<endpoint>:consumer`). */
|
|
170
|
-
readonly consumerId: string;
|
|
171
|
-
constructor(opts: TransportOptions);
|
|
172
|
-
/** Last-known pin list — the offline read-only render seed. */
|
|
173
|
-
mirrorPins(): Pin[];
|
|
174
|
-
/** Optimistic pins for the queued outbox — offline reloads render + flag them. */
|
|
175
|
-
outboxPins(): Pin[];
|
|
176
|
-
/** Last-known thread for a pin — the offline read-only thread render seed.
|
|
177
|
-
* Empty for a pin whose thread was never fetched while connected. */
|
|
178
|
-
mirrorThread(pinId: string): ThreadMessage[];
|
|
179
|
-
/** hello → buffer live frames → apply catch-up → drain buffer. */
|
|
180
|
-
connect(): void;
|
|
181
|
-
close(): void;
|
|
182
|
-
listPins(): Promise<Pin[]>;
|
|
183
|
-
/** Offline ⇒ queued in the outbox, optimistic local pin (client wins on new pins). */
|
|
184
|
-
createPin(input: PinInput): Promise<Pin>;
|
|
185
|
-
/** Mirrored on every success, served from the mirror when the hub is unreachable —
|
|
186
|
-
* an offline reload renders read-only threads instead of empty ones. Any other
|
|
187
|
-
* hub error (auth, not-found) surfaces: the mirror is a fallback, not a mask. */
|
|
188
|
-
getThread(pinId: string): Promise<ThreadMessage[]>;
|
|
189
|
-
reply(pinId: string, text: string, attachments?: Attachment[]): Promise<ThreadMessage>;
|
|
190
|
-
resolve(pinId: string, note?: string): Promise<Pin>;
|
|
191
|
-
verify(pinId: string, outcome: "accepted" | "reopened"): Promise<Pin>;
|
|
192
|
-
}
|
|
193
|
-
//#endregion
|
|
194
|
-
//#region src/index.d.ts
|
|
195
|
-
interface PinboxConfig {
|
|
196
|
-
/** Hub base URL. */
|
|
197
|
-
endpoint: string;
|
|
198
|
-
/** Local dev: injected by the dev plugin. */
|
|
199
|
-
token?: string;
|
|
200
|
-
/** Cloud: the host app supplies (spec: auth passthrough). */
|
|
201
|
-
getToken?: () => Promise<string>;
|
|
202
|
-
/** Default "dom"; "anchor" for sandboxed cross-origin iframe hosts (Task 7). */
|
|
203
|
-
targeting?: "dom" | "anchor";
|
|
204
|
-
/** Anchor mode attribute, default "data-pb-anchor". */
|
|
205
|
-
anchorAttribute?: string;
|
|
206
|
-
/** Reserved; the realtime topic is fixed server-side. */
|
|
207
|
-
project?: string;
|
|
208
|
-
/**
|
|
209
|
-
* Attach a screenshot to new pins. Default true.
|
|
210
|
-
*
|
|
211
|
-
* Capturing one means asking the browser to share the tab, and that permission prompt is the
|
|
212
|
-
* first thing a visitor sees — fine in a project you already trust, hostile on a public page.
|
|
213
|
-
* Set false and pins ship with their structured capture (selector, markup, viewport) and no
|
|
214
|
-
* pixels.
|
|
215
|
-
*/
|
|
216
|
-
screenshots?: boolean;
|
|
217
|
-
}
|
|
218
|
-
/** Register <pinbox-toolbar>; no-op outside a browser or when already defined. */
|
|
219
|
-
declare function defineToolbarElement(): void;
|
|
220
|
-
declare const Pinbox: {
|
|
221
|
-
init(config: PinboxConfig): PinboxToolbarElement;
|
|
222
|
-
};
|
|
223
|
-
//#endregion
|
|
224
|
-
export { applyHubEvent as _, HubEvent as a, upsertPin as b, WebSocketLike as c, PinboxToolbarElement as d, Draft as f, appendThreadMessage as g, UiStatus as h, ConnectionState as i, HubError as l, ToolbarState as m, PinboxConfig as n, HubTransport as o, Store as p, defineToolbarElement as r, TransportOptions as s, Pinbox as t, StorageLike as u, createStore as v, CaptureResult as x, deriveUiStatus as y };
|