@kehto/paja 0.21.4 → 0.24.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.
@@ -480,6 +480,12 @@ var PAJA_CONSOLE_PANEL_ID = "paja-console";
480
480
  var PAJA_CONSOLE_TOGGLE_ID = "paja-console-toggle";
481
481
  var PAJA_CONSOLE_COLLAPSE_LABEL = "Collapse the Paja development console";
482
482
 
483
+ // src/browser-relay-panel.ts
484
+ import { normalizeURL } from "nostr-tools/utils";
485
+ var PAJA_EVENT_COUNTER_RESET_ID = "event-counter-reset";
486
+ var PAJA_EVENT_COUNTER_RESET_LABEL = "reset";
487
+ var PAJA_EVENT_COUNTER_RESET_TITLE = "reset counter";
488
+
483
489
  // src/host-page.ts
484
490
  function renderPajaHtml(config) {
485
491
  const configJson = escapeJsonForHtml(JSON.stringify(config));
@@ -500,6 +506,7 @@ function renderPajaHtml(config) {
500
506
  --muted: #a9ad9f;
501
507
  --accent: #d8c36a;
502
508
  --paja-console-column: minmax(320px, 380px);
509
+ --paja-bar-reveal: 6px;
503
510
  }
504
511
  * { box-sizing: border-box; }
505
512
  html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 13px/1.4 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
@@ -515,15 +522,58 @@ function renderPajaHtml(config) {
515
522
  .spacer { flex: 1; min-width: 0; }
516
523
  .console-toggle { align-self: center; flex: 0 0 auto; width: 28px; height: 24px; padding: 0; display: inline-grid; place-items: center; color: var(--text); }
517
524
  .console-toggle-glyph { font-size: 15px; line-height: 1; }
525
+ #paja-gamepads { display: flex; align-items: center; gap: 7px; flex: 0 1 auto; min-width: 0; overflow-x: auto; }
526
+ #paja-gamepads:empty { display: none; }
527
+ .gamepad-indicator { display: inline-flex; align-items: center; flex: 0 0 auto; color: var(--pad-color); opacity: .65; padding: 3px 1px; }
528
+ .gamepad-indicator small { font-size: 10px; font-weight: 700; margin-left: 2px; }
529
+ .gamepad-indicator[data-activity="active"] { opacity: 1; background: color-mix(in srgb, var(--pad-color) 18%, transparent); border-radius: 5px; }
530
+ .gamepad-indicator[data-activity="active"] svg { animation: var(--pad-animation) var(--pad-duration) ease-in-out infinite; }
531
+ @keyframes gamepad-bounce { 50% { transform: translateY(var(--pad-lift)); } }
532
+ @keyframes gamepad-rock {
533
+ 25% { transform: rotate(var(--pad-turn)); }
534
+ 75% { transform: rotate(calc(-1 * var(--pad-turn))); }
535
+ }
536
+ @keyframes gamepad-pulse { 50% { transform: scale(1.18); } }
537
+ @keyframes gamepad-nudge {
538
+ 25% { transform: translateX(var(--pad-lift)); }
539
+ 75% { transform: translateX(calc(-1 * var(--pad-lift))); }
540
+ }
541
+ @media (prefers-reduced-motion: reduce) {
542
+ .gamepad-indicator[data-activity="active"] svg { animation: none; }
543
+ }
518
544
  .console-toggle-glyph::before { content: '\\00ab'; }
519
545
  html[data-paja-console="collapsed"] .console-toggle-glyph::before { content: '\\00bb'; }
520
- /* Collapsing is presentation-only: the console column and its top-bar cell
521
- leave the grid and the stage reclaims the full width, so the target
522
- iframe keeps its identity, generation, and loaded napplet. */
546
+ /* Collapsing is presentation-only: the console column, its top-bar cell,
547
+ and the bottom status bar leave the grid and the stage reclaims the
548
+ full width, so the target iframe keeps its identity, generation, and
549
+ loaded napplet. The body track list shrinks with them, because
550
+ display:none alone would leave the footer's 30px row reserved. */
523
551
  html[data-paja-console="collapsed"] .top,
524
552
  html[data-paja-console="collapsed"] main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
553
+ html[data-paja-console="collapsed"] body { grid-template-rows: 38px minmax(0, 1fr); }
525
554
  html[data-paja-console="collapsed"] .top-console,
526
- html[data-paja-console="collapsed"] .console { display: none; }
555
+ html[data-paja-console="collapsed"] .console,
556
+ html[data-paja-console="collapsed"] .bottom { display: none; }
557
+ /* With a hover-capable pointer the whole top bar hides with the drawer and
558
+ returns from a --paja-bar-reveal strip at the viewport edge. The strip
559
+ is the bar's own box, so hover containment keeps the reveal stable; the
560
+ bar's children stay inert while it is parked, and :focus-within restores
561
+ it for keyboard users. Touch and stacked layouts keep the bar visible,
562
+ because they have no hover to restore it and the drawer toggle lives
563
+ inside it. */
564
+ @media (hover: hover) and (pointer: fine) and (min-width: 901px) {
565
+ html[data-paja-console="collapsed"] body { grid-template-rows: minmax(0, 1fr); }
566
+ html[data-paja-console="collapsed"] .top {
567
+ position: fixed; inset: 0 0 auto 0; height: 38px; z-index: 5;
568
+ transform: translateY(calc(-100% + var(--paja-bar-reveal)));
569
+ transition: transform 120ms;
570
+ }
571
+ html[data-paja-console="collapsed"] .top > * { opacity: 0; pointer-events: none; transition: opacity 120ms; }
572
+ html[data-paja-console="collapsed"] .top:hover,
573
+ html[data-paja-console="collapsed"] .top:focus-within { transform: none; }
574
+ html[data-paja-console="collapsed"] .top:hover > *,
575
+ html[data-paja-console="collapsed"] .top:focus-within > * { opacity: 1; pointer-events: auto; }
576
+ }
527
577
  .tabs { display: flex; align-items: stretch; align-self: flex-end; gap: 4px; min-width: 120px; max-width: min(100%, 760px); overflow-x: auto; scrollbar-width: thin; }
528
578
  .tabs:empty { display: none; }
529
579
  .tab { min-width: 116px; max-width: 240px; height: 30px; display: grid; grid-template-columns: minmax(0, 1fr) 24px 24px; align-items: center; gap: 2px; border: 1px solid var(--line); border-bottom-color: transparent; background: #151815; color: var(--muted); border-radius: 5px 5px 0 0; padding: 0 2px 0 9px; }
@@ -553,6 +603,7 @@ function renderPajaHtml(config) {
553
603
  .resource-servers textarea { width: 100%; min-width: 0; padding: 6px; resize: vertical; }
554
604
  .resource-servers small, .resource-servers [role="status"] { color: var(--muted); overflow-wrap: anywhere; }
555
605
  .switch-grid, .acl-grid { display: flex; flex-wrap: wrap; gap: 6px; }
606
+ .hint { margin: 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
556
607
  .toggle { height: 24px; padding: 0 8px; color: var(--muted); }
557
608
  .toggle[data-enabled="true"] { color: var(--text); border-color: #5f724f; background: #24301f; }
558
609
  .toggle[data-enabled="false"] { color: #8d9187; border-color: #453536; background: #241d1d; }
@@ -572,6 +623,32 @@ function renderPajaHtml(config) {
572
623
  .log-body { min-width: 0; display: grid; gap: 2px; }
573
624
  .log-type { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
574
625
  .log-detail { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #e6a5a5; }
626
+ .event-list { min-height: 44px; max-height: 34vh; overflow: auto; border: 1px solid var(--line); border-radius: 4px; background: #0b0d0b; padding: 4px 0; }
627
+ .event-box + .event-box { margin-top: 6px; border-top: 1px solid #1b1f1a; }
628
+ .event-box-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; padding: 5px 8px 3px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
629
+ .event-box-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
630
+ .event-box-count { color: var(--accent); }
631
+ .event-box-note { color: var(--muted); font-style: italic; text-transform: none; letter-spacing: normal; }
632
+ .event-relay { padding: 1px 0 2px; }
633
+ .event-relay-head { display: grid; grid-template-columns: minmax(0, 1fr) 56px 22px auto; align-items: center; gap: 6px; padding: 2px 8px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
634
+ .event-relay-url { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
635
+ .event-bar { display: block; height: 5px; border-radius: 3px; background: #1b1f1a; overflow: hidden; }
636
+ .event-bar-fill { display: block; height: 100%; background: var(--accent); }
637
+ .event-relay[data-relay-count="0"] .event-bar { background: #141714; }
638
+ .event-relay-count { color: var(--accent); text-align: right; }
639
+ .event-relay[data-relay-count="0"] .event-relay-count { color: var(--muted); }
640
+ .event-relay-idle { color: var(--muted); font-size: 10px; font-style: italic; }
641
+ .event-kinds { padding-left: 16px; }
642
+ .event-row { display: grid; grid-template-columns: 64px 12px minmax(0, 1fr); align-items: baseline; gap: 6px; padding: 2px 8px 2px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
643
+ .event-kind { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; color: var(--text); }
644
+ .event-separator { color: var(--muted); text-align: center; }
645
+ .event-count { color: var(--accent); text-align: left; }
646
+ .event-empty { padding: 4px 8px; color: var(--muted); font-style: italic; font-size: 11px; }
647
+ .section-total { color: var(--muted); font-size: 11px; margin-left: auto; }
648
+ .section-total:empty { display: none; }
649
+ .section-reset { flex: 0 0 auto; height: 18px; margin-left: 8px; padding: 0 6px; color: var(--muted); font-size: 10px; text-transform: lowercase; }
650
+ .section-total:empty + .section-reset { margin-left: auto; }
651
+ .section-total ~ .section-chevron { margin-left: 8px; }
575
652
  .stage { min-width: 0; min-height: 0; position: relative; background: #050705; }
576
653
  .empty-stage { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
577
654
  .empty-stage[hidden] { display: none; }
@@ -649,6 +726,7 @@ function renderPajaHtml(config) {
649
726
  aria-label="${PAJA_CONSOLE_COLLAPSE_LABEL}"
650
727
  title="${PAJA_CONSOLE_COLLAPSE_LABEL}"
651
728
  ><span class="console-toggle-glyph" aria-hidden="true"></span></button>
729
+ <div id="paja-gamepads" role="group" aria-label="Connected controllers"></div>
652
730
  <div class="tabs" id="napplet-tabs" role="tablist" aria-label="Loaded napplets"></div>
653
731
  <div class="spacer"></div>
654
732
  <label>theme
@@ -666,10 +744,12 @@ function renderPajaHtml(config) {
666
744
  <details class="section" id="paja-section-interfaces" data-paja-section="interfaces" open>
667
745
  <summary class="section-title">Interfaces<span class="section-chevron" aria-hidden="true">\u203A</span></summary><div class="section-body">
668
746
  <div class="switch-grid" id="interface-toggles"></div>
747
+ <p class="hint" id="paja-fs-support" role="status"></p>
669
748
  </div></details>
670
749
  <details class="section" id="paja-section-acl" data-paja-section="acl" open>
671
750
  <summary class="section-title">ACL<span class="section-chevron" aria-hidden="true">\u203A</span></summary><div class="section-body">
672
751
  <div class="acl-grid" id="acl-controls"></div>
752
+ <p class="hint">ACL grants allow operations; they do not add missing browser APIs. See Interfaces for FS picker support.</p>
673
753
  </div></details>
674
754
  <details class="section" id="paja-section-signer" data-paja-section="signer" open>
675
755
  <summary class="section-title">Signer<span class="section-chevron" aria-hidden="true">\u203A</span></summary><div class="section-body">
@@ -695,6 +775,16 @@ function renderPajaHtml(config) {
695
775
  </div>
696
776
  <div class="log-list" id="message-log" aria-live="polite"></div>
697
777
  </div></details>
778
+ <details class="section" id="paja-section-events" data-paja-section="events" open>
779
+ <summary class="section-title">Events<span class="section-total" id="event-kind-total" aria-hidden="true"></span><button
780
+ type="button"
781
+ id="${PAJA_EVENT_COUNTER_RESET_ID}"
782
+ class="section-reset"
783
+ title="${PAJA_EVENT_COUNTER_RESET_TITLE}"
784
+ aria-label="${PAJA_EVENT_COUNTER_RESET_TITLE}"
785
+ >${PAJA_EVENT_COUNTER_RESET_LABEL}</button><span class="section-chevron" aria-hidden="true">\u203A</span></summary><div class="section-body">
786
+ <div class="event-list" id="event-kind-counts" aria-label="Relay receipts by read reason, relay, and event kind"></div>
787
+ </div></details>
698
788
  </aside>
699
789
  ${renderStage(config, targetLabel)}
700
790
  </main>
@@ -1340,14 +1430,16 @@ var InstalledNappletCatalog = class {
1340
1430
  params: [...archetype.params]
1341
1431
  }))
1342
1432
  });
1433
+ const previous = this.records.get(record.id);
1343
1434
  this.records.set(record.id, record);
1344
- this.notify(record.id);
1435
+ this.notify(record.id, previous, record);
1345
1436
  return record;
1346
1437
  }
1347
1438
  /** Remove an artifact explicitly; frame teardown never calls this method. */
1348
1439
  remove(id) {
1440
+ const previous = this.records.get(id);
1349
1441
  const removed = this.records.delete(id);
1350
- if (removed) this.notify(id);
1442
+ if (removed) this.notify(id, previous);
1351
1443
  return removed;
1352
1444
  }
1353
1445
  /** Return whether a verified installation exists for a catalog ID. */
@@ -1393,8 +1485,12 @@ var InstalledNappletCatalog = class {
1393
1485
  this.listeners.add(listener);
1394
1486
  return () => this.listeners.delete(listener);
1395
1487
  }
1396
- notify(id) {
1397
- for (const listener of this.listeners) listener(id);
1488
+ notify(id, previous, current) {
1489
+ const archetypes = Object.freeze([.../* @__PURE__ */ new Set([
1490
+ ...(previous?.archetypes ?? []).map(({ slug }) => slug),
1491
+ ...(current?.archetypes ?? []).map(({ slug }) => slug)
1492
+ ])]);
1493
+ for (const listener of this.listeners) listener(id, archetypes);
1398
1494
  }
1399
1495
  };
1400
1496
  function copyPointer(pointer) {
@@ -1964,4 +2060,4 @@ export {
1964
2060
  probeTargetCors,
1965
2061
  startPajaServer
1966
2062
  };
1967
- //# sourceMappingURL=chunk-HG2CUTQC.js.map
2063
+ //# sourceMappingURL=chunk-ZRAED35O.js.map