@autono/pinbox-toolbar 0.1.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/index.js +1 -1
- package/dist/plugins/vite.js +11 -7
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/{src-BoLg81_j.js → src-D1qn1iet.js} +430 -33
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +1 -1
- package/dist/toolbar.iife.js +430 -33
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +1 -1
- package/package.json +2 -2
- package/dist/index-ZR3JBQu-.d.ts +0 -206
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/dist/vue.js
CHANGED
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-ZR3JBQu-.d.ts
DELETED
|
@@ -1,206 +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
|
-
readonly store: Store;
|
|
86
|
-
/** Card → transport seam (wired by #startTransport once a config exists). */
|
|
87
|
-
readonly actions: {
|
|
88
|
-
send?: (pinId: string | "draft", text: string) => void;
|
|
89
|
-
verify?: (pinId: string, outcome: "accepted" | "reopened") => void;
|
|
90
|
-
resolve?: (pinId: string) => void;
|
|
91
|
-
};
|
|
92
|
-
/** Programmatic path (Pinbox.init). The snippet path reads hub/token attributes. */
|
|
93
|
-
configure(config: PinboxConfig): void;
|
|
94
|
-
get config(): PinboxConfig | null;
|
|
95
|
-
connectedCallback(): void;
|
|
96
|
-
disconnectedCallback(): void;
|
|
97
|
-
}
|
|
98
|
-
//#endregion
|
|
99
|
-
//#region src/transport/mirror.d.ts
|
|
100
|
-
interface StorageLike {
|
|
101
|
-
getItem(key: string): string | null;
|
|
102
|
-
setItem(key: string, value: string): void;
|
|
103
|
-
removeItem(key: string): void;
|
|
104
|
-
}
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region src/transport/rest.d.ts
|
|
107
|
-
type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
|
|
108
|
-
declare class HubError extends Error {
|
|
109
|
-
readonly code: string;
|
|
110
|
-
readonly status: number;
|
|
111
|
-
readonly hint: string | undefined;
|
|
112
|
-
constructor(code: string, message: string, status: number, hint?: string);
|
|
113
|
-
}
|
|
114
|
-
//#endregion
|
|
115
|
-
//#region src/transport.d.ts
|
|
116
|
-
/** The browser WebSocket surface the transport needs — injectable for tests. */
|
|
117
|
-
interface WebSocketLike {
|
|
118
|
-
send(data: string): void;
|
|
119
|
-
close(code?: number, reason?: string): void;
|
|
120
|
-
onopen: (() => void) | null;
|
|
121
|
-
onmessage: ((ev: {
|
|
122
|
-
data: string;
|
|
123
|
-
}) => void) | null;
|
|
124
|
-
onclose: ((ev: {
|
|
125
|
-
code: number;
|
|
126
|
-
}) => void) | null;
|
|
127
|
-
onerror: (() => void) | null;
|
|
128
|
-
}
|
|
129
|
-
interface SchedulerLike {
|
|
130
|
-
setTimeout(fn: () => void, ms: number): unknown;
|
|
131
|
-
clearTimeout(id: unknown): void;
|
|
132
|
-
}
|
|
133
|
-
interface HubEvent {
|
|
134
|
-
seq: number;
|
|
135
|
-
eventType: string;
|
|
136
|
-
at: string;
|
|
137
|
-
payload: unknown;
|
|
138
|
-
}
|
|
139
|
-
type ConnectionState = "connecting" | "live" | "offline" | "incompatible";
|
|
140
|
-
interface TransportOptions {
|
|
141
|
-
endpoint: string;
|
|
142
|
-
token: string;
|
|
143
|
-
/** Default localStorage; injectable for tests. */
|
|
144
|
-
storage?: StorageLike;
|
|
145
|
-
/** Injectable for tests. */
|
|
146
|
-
webSocket?: (url: string, protocols: string[]) => WebSocketLike;
|
|
147
|
-
onEvent(e: HubEvent): void;
|
|
148
|
-
onConnection(state: ConnectionState): void;
|
|
149
|
-
/** Reconciled pin lists: fresh `listPins()` after each reconnect (hub wins on status). */
|
|
150
|
-
onPins?(pins: Pin[]): void;
|
|
151
|
-
/** Queued outbox localIds whenever the set changes — the UI flags them as pending sync. */
|
|
152
|
-
onOutbox?(localIds: string[]): void;
|
|
153
|
-
/** Test seam; default global fetch. */
|
|
154
|
-
fetchFn?: FetchLike;
|
|
155
|
-
/** Test seam standing in for fake timers; default global setTimeout/clearTimeout. */
|
|
156
|
-
scheduler?: SchedulerLike;
|
|
157
|
-
}
|
|
158
|
-
declare class HubTransport {
|
|
159
|
-
#private;
|
|
160
|
-
/** Stable per install, persisted (`pinbox:<endpoint>:consumer`). */
|
|
161
|
-
readonly consumerId: string;
|
|
162
|
-
constructor(opts: TransportOptions);
|
|
163
|
-
/** Last-known pin list — the offline read-only render seed. */
|
|
164
|
-
mirrorPins(): Pin[];
|
|
165
|
-
/** Optimistic pins for the queued outbox — offline reloads render + flag them. */
|
|
166
|
-
outboxPins(): Pin[];
|
|
167
|
-
/** Last-known thread for a pin — the offline read-only thread render seed.
|
|
168
|
-
* Empty for a pin whose thread was never fetched while connected. */
|
|
169
|
-
mirrorThread(pinId: string): ThreadMessage[];
|
|
170
|
-
/** hello → buffer live frames → apply catch-up → drain buffer. */
|
|
171
|
-
connect(): void;
|
|
172
|
-
close(): void;
|
|
173
|
-
listPins(): Promise<Pin[]>;
|
|
174
|
-
/** Offline ⇒ queued in the outbox, optimistic local pin (client wins on new pins). */
|
|
175
|
-
createPin(input: PinInput): Promise<Pin>;
|
|
176
|
-
/** Mirrored on every success, served from the mirror when the hub is unreachable —
|
|
177
|
-
* an offline reload renders read-only threads instead of empty ones. Any other
|
|
178
|
-
* hub error (auth, not-found) surfaces: the mirror is a fallback, not a mask. */
|
|
179
|
-
getThread(pinId: string): Promise<ThreadMessage[]>;
|
|
180
|
-
reply(pinId: string, text: string, attachments?: Attachment[]): Promise<ThreadMessage>;
|
|
181
|
-
resolve(pinId: string, note?: string): Promise<Pin>;
|
|
182
|
-
verify(pinId: string, outcome: "accepted" | "reopened"): Promise<Pin>;
|
|
183
|
-
}
|
|
184
|
-
//#endregion
|
|
185
|
-
//#region src/index.d.ts
|
|
186
|
-
interface PinboxConfig {
|
|
187
|
-
/** Hub base URL. */
|
|
188
|
-
endpoint: string;
|
|
189
|
-
/** Local dev: injected by the dev plugin. */
|
|
190
|
-
token?: string;
|
|
191
|
-
/** Cloud: the host app supplies (spec: auth passthrough). */
|
|
192
|
-
getToken?: () => Promise<string>;
|
|
193
|
-
/** Default "dom"; "anchor" for sandboxed cross-origin iframe hosts (Task 7). */
|
|
194
|
-
targeting?: "dom" | "anchor";
|
|
195
|
-
/** Anchor mode attribute, default "data-pb-anchor". */
|
|
196
|
-
anchorAttribute?: string;
|
|
197
|
-
/** Reserved; the realtime topic is fixed server-side. */
|
|
198
|
-
project?: string;
|
|
199
|
-
}
|
|
200
|
-
/** Register <pinbox-toolbar>; no-op outside a browser or when already defined. */
|
|
201
|
-
declare function defineToolbarElement(): void;
|
|
202
|
-
declare const Pinbox: {
|
|
203
|
-
init(config: PinboxConfig): PinboxToolbarElement;
|
|
204
|
-
};
|
|
205
|
-
//#endregion
|
|
206
|
-
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 };
|