@autono/pinbox-toolbar 0.1.0 → 0.7.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.
@@ -82,6 +82,8 @@ declare const BaseElement: typeof HTMLElement;
82
82
  declare class PinboxToolbarElement extends BaseElement {
83
83
  #private;
84
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[];
85
87
  readonly store: Store;
86
88
  /** Card → transport seam (wired by #startTransport once a config exists). */
87
89
  readonly actions: {
@@ -93,6 +95,13 @@ declare class PinboxToolbarElement extends BaseElement {
93
95
  configure(config: PinboxConfig): void;
94
96
  get config(): PinboxConfig | null;
95
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;
96
105
  disconnectedCallback(): void;
97
106
  }
98
107
  //#endregion
@@ -196,6 +205,15 @@ interface PinboxConfig {
196
205
  anchorAttribute?: string;
197
206
  /** Reserved; the realtime topic is fixed server-side. */
198
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;
199
217
  }
200
218
  /** Register <pinbox-toolbar>; no-op outside a browser or when already defined. */
201
219
  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-ZR3JBQu-.js";
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-DnhwJYxE.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-BoLg81_j.js";
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-D1qn1iet.js";
2
2
  export { HubError, HubTransport, Pinbox, PinboxToolbarElement, appendThreadMessage, applyHubEvent, createStore, defineToolbarElement, deriveUiStatus, upsertPin };
@@ -4,9 +4,11 @@ import { a as readHubToken, i as ensureHub, n as VIRTUAL_ID, r as resolveOptions
4
4
  * Build the module source injected into the dev page.
5
5
  *
6
6
  * The returned code imports the toolbar element for its side effect (custom element registration),
7
- * then appends a single `<pinbox-toolbar>` to `document.body` pointed at `hubUrl`. Re-running it
8
- * after an HMR update is a no-op: the existing element is reused and only its `hub`/`token`
9
- * attributes are refreshed (a token that disappeared is removed, never left stale).
7
+ * then appends a single `<pinbox-toolbar>` to `document.body` pointed at `hubUrl`. Attributes are
8
+ * set BEFORE the append: connectedCallback reads config synchronously on insertion, so an element
9
+ * appended bare would start configless and never connect. Re-running the snippet after an HMR
10
+ * update is a no-op: the existing element is reused and only its `hub`/`token` attributes are
11
+ * refreshed (a token that disappeared is removed, never left stale).
10
12
  *
11
13
  * The bare `import "@autono/pinbox-toolbar"` below is a SIDE-EFFECT import — it registers the
12
14
  * custom element and binds no name. That is why package.json declares
@@ -33,13 +35,15 @@ const TOKEN = ${token === void 0 ? "null" : JSON.stringify(token)};
33
35
 
34
36
  function mount() {
35
37
  let el = document.querySelector(TAG);
36
- if (!el) {
37
- el = document.createElement(TAG);
38
- document.body.appendChild(el);
39
- }
38
+ const created = !el;
39
+ if (!el) el = document.createElement(TAG);
40
+ // Attributes BEFORE insertion: connectedCallback reads its config synchronously
41
+ // on append, so an element inserted bare starts configless and stays dead —
42
+ // the toolbar renders but silently drops every pin.
40
43
  el.setAttribute("hub", HUB);
41
44
  if (TOKEN === null) el.removeAttribute("token");
42
45
  else el.setAttribute("token", TOKEN);
46
+ if (created) document.body.appendChild(el);
43
47
  }
44
48
 
45
49
  if (document.readyState === "loading") {
package/dist/react.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as PinboxConfig } from "./index-ZR3JBQu-.js";
1
+ import { n as PinboxConfig } from "./index-DnhwJYxE.js";
2
2
  import { ReactElement } from "react";
3
3
  //#region src/react.d.ts
4
4
  /**
package/dist/react.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as defineToolbarElement, r as PinboxToolbarElement } from "./src-BoLg81_j.js";
1
+ import { n as defineToolbarElement, r as PinboxToolbarElement } from "./src-D1qn1iet.js";
2
2
  import { createElement, useEffect, useRef } from "react";
3
3
  //#region src/react.ts
4
4
  /**