@nsite/stealthis 0.4.0 → 0.6.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
@@ -28,7 +28,7 @@ If you want to control where the button appears, add the element yourself (the a
28
28
  |-----------|---------|-------------|
29
29
  | `button-text` | `"Borrow this nsite"` | Button text |
30
30
  | `stat-text` | `"%s npubs borrowed this nsite"` | Paper trail summary. `%s` is replaced with the count. |
31
- | `no-trail` | _(absent)_ | Boolean attribute. When present, hides the paper trail. |
31
+ | `no-trail` | _(absent)_ | Boolean attribute. When present, disables the paper trail entirely -- no `muse` tags are written and the trail UI is not rendered. |
32
32
 
33
33
  The button's `trigger` part is exposed via `::part(trigger)` for CSS customization.
34
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nsite/stealthis",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "main": "dist/stealthis.js",
6
6
  "module": "dist/stealthis.mjs",
package/src/nostr.ts CHANGED
@@ -249,6 +249,7 @@ export function createDeployEvent(
249
249
  description?: string;
250
250
  deployerPubkey: string;
251
251
  deployerRelays: string[];
252
+ noTrail?: boolean;
252
253
  }
253
254
  ): EventTemplate {
254
255
  const tags: string[][] = [];
@@ -257,25 +258,27 @@ export function createDeployEvent(
257
258
  if (t[0] === 'path' || t[0] === 'server') tags.push([...t]);
258
259
  }
259
260
 
260
- // Paper trail: copy muse tags, add new one, enforce max 9
261
- const sourceMuses = source.tags
262
- .filter((t) => t[0] === 'muse' && t[1] && t[2])
263
- .map((t) => [...t])
264
- .sort((a, b) => parseInt(a[1], 10) - parseInt(b[1], 10));
265
-
266
- const maxIndex = sourceMuses.length > 0
267
- ? Math.max(...sourceMuses.map((t) => parseInt(t[1], 10)))
268
- : -1;
269
- const newMuse = ['muse', String(maxIndex + 1), options.deployerPubkey, ...options.deployerRelays];
270
- const allMuses = [...sourceMuses, newMuse];
271
-
272
- // Keep index 0 (originator) + newest, FIFO truncate the middle
273
- if (allMuses.length > MAX_MUSE_TAGS) {
274
- const originator = allMuses[0];
275
- const keep = allMuses.slice(allMuses.length - (MAX_MUSE_TAGS - 1));
276
- tags.push(originator, ...keep);
277
- } else {
278
- for (const t of allMuses) tags.push(t);
261
+ if (!options.noTrail) {
262
+ // Paper trail: copy muse tags, add new one, enforce max 9
263
+ const sourceMuses = source.tags
264
+ .filter((t) => t[0] === 'muse' && t[1] && t[2])
265
+ .map((t) => [...t])
266
+ .sort((a, b) => parseInt(a[1], 10) - parseInt(b[1], 10));
267
+
268
+ const maxIndex = sourceMuses.length > 0
269
+ ? Math.max(...sourceMuses.map((t) => parseInt(t[1], 10)))
270
+ : -1;
271
+ const newMuse = ['muse', String(maxIndex + 1), options.deployerPubkey, ...options.deployerRelays];
272
+ const allMuses = [...sourceMuses, newMuse];
273
+
274
+ // Keep index 0 (originator) + newest, FIFO truncate the middle
275
+ if (allMuses.length > MAX_MUSE_TAGS) {
276
+ const originator = allMuses[0];
277
+ const keep = allMuses.slice(allMuses.length - (MAX_MUSE_TAGS - 1));
278
+ tags.push(originator, ...keep);
279
+ } else {
280
+ for (const t of allMuses) tags.push(t);
281
+ }
279
282
  }
280
283
 
281
284
  if (options.title) tags.push(['title', options.title]);
package/src/widget.ts CHANGED
@@ -54,12 +54,14 @@ export class NsiteDeployButton extends HTMLElement {
54
54
  this.ctx = nostr.parseContext();
55
55
  if (this.ctx) {
56
56
  this.manifestPromise = nostr.fetchManifest(this.ctx);
57
- this.manifestPromise.then((manifest) => {
58
- if (manifest) {
59
- this.muses = nostr.extractMuses(manifest);
60
- if (this.muses.length > 0 && this.state === 'idle') this.render();
61
- }
62
- });
57
+ if (!this.hasAttribute('no-trail')) {
58
+ this.manifestPromise.then((manifest) => {
59
+ if (manifest) {
60
+ this.muses = nostr.extractMuses(manifest);
61
+ if (this.muses.length > 0 && this.state === 'idle') this.render();
62
+ }
63
+ });
64
+ }
63
65
  this.render();
64
66
  }
65
67
  }
@@ -608,7 +610,8 @@ export class NsiteDeployButton extends HTMLElement {
608
610
  title: this.siteTitle || undefined,
609
611
  description: this.siteDescription || undefined,
610
612
  deployerPubkey: this.userPubkey,
611
- deployerRelays: this.userRelays
613
+ deployerRelays: this.userRelays,
614
+ noTrail: this.hasAttribute('no-trail')
612
615
  });
613
616
 
614
617
  this.statusMsg = 'Waiting for signature...';