@kehto/paja 0.16.5 → 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/README.md CHANGED
@@ -59,7 +59,11 @@ warning, when the target would block the sandboxed frame.
59
59
 
60
60
  The console shows supported interfaces with per-domain injection toggles,
61
61
  runtime ACL controls, signer controls, and a filterable message log with visible
62
- error details. In runtime-pointer mode, ACL controls always display and mutate
62
+ error details. It starts expanded and collapses to the left with the chevron
63
+ button in the top bar; the same button brings the whole panel back. Collapsing
64
+ is presentation-only — the target iframe keeps its identity and the loaded
65
+ napplet keeps running — and Paja remembers the choice per browser origin. In
66
+ runtime-pointer mode, ACL controls always display and mutate
63
67
  the active tab's resolver-verified d-tag and aggregate hash; a grant or revoke
64
68
  rerenders that same identity immediately. Paja auto-connects a browser NIP-07 signer when `window.nostr` is
65
69
  available, can connect to a bunker/NIP-46 URI, and only uses the generated local
@@ -5363,6 +5363,39 @@ function nappletNamespacePrelude(domains) {
5363
5363
  });
5364
5364
  }
5365
5365
 
5366
+ // src/browser-console-panel.ts
5367
+ var PAJA_CONSOLE_PANEL_STORAGE_KEY = "kehto:paja:console:v1";
5368
+ var PAJA_CONSOLE_TOGGLE_ID = "paja-console-toggle";
5369
+ var PAJA_CONSOLE_COLLAPSE_LABEL = "Collapse the Paja development console";
5370
+ var PAJA_CONSOLE_EXPAND_LABEL = "Expand the Paja development console";
5371
+ function installPajaConsolePanel() {
5372
+ const root = document.documentElement;
5373
+ const button2 = document.getElementById(PAJA_CONSOLE_TOGGLE_ID);
5374
+ let collapsed = false;
5375
+ try {
5376
+ collapsed = localStorage.getItem(PAJA_CONSOLE_PANEL_STORAGE_KEY) === "collapsed";
5377
+ } catch {
5378
+ }
5379
+ const apply = () => {
5380
+ root.dataset.pajaConsole = collapsed ? "collapsed" : "expanded";
5381
+ const label = collapsed ? PAJA_CONSOLE_EXPAND_LABEL : PAJA_CONSOLE_COLLAPSE_LABEL;
5382
+ button2?.setAttribute("aria-expanded", String(!collapsed));
5383
+ button2?.setAttribute("aria-label", label);
5384
+ button2?.setAttribute("title", label);
5385
+ };
5386
+ const toggle = () => {
5387
+ collapsed = !collapsed;
5388
+ apply();
5389
+ try {
5390
+ localStorage.setItem(PAJA_CONSOLE_PANEL_STORAGE_KEY, root.dataset.pajaConsole);
5391
+ } catch {
5392
+ }
5393
+ };
5394
+ apply();
5395
+ button2?.addEventListener("click", toggle);
5396
+ return () => button2?.removeEventListener("click", toggle);
5397
+ }
5398
+
5366
5399
  // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/utils.js
5367
5400
  function isBytes(a) {
5368
5401
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
@@ -23681,6 +23714,7 @@ function createPajaBrowserState(context) {
23681
23714
  };
23682
23715
  }
23683
23716
  async function installPajaHost() {
23717
+ const disposeConsolePanel = installPajaConsolePanel();
23684
23718
  const config = await readLatestConfig(readConfig());
23685
23719
  const stage = getStage();
23686
23720
  const frame = config.target.mode === "runtime-pointer" ? null : getFrame();
@@ -23771,6 +23805,7 @@ async function installPajaHost() {
23771
23805
  window.addEventListener("pagehide", () => confirmationController.dispose(), { once: true });
23772
23806
  window.addEventListener("pagehide", () => notifyController?.dispose(), { once: true });
23773
23807
  window.addEventListener("pagehide", () => configController?.dispose(), { once: true });
23808
+ window.addEventListener("pagehide", disposeConsolePanel, { once: true });
23774
23809
  window.__KEHTO_PAJA__ = state;
23775
23810
  window.addEventListener("message", (event) => {
23776
23811
  const source = event.source;