@unhingged/vizu-core 0.1.9 → 0.1.10

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.d.cts CHANGED
@@ -658,6 +658,13 @@ declare class Vizu {
658
658
  off<E extends VizuEventName>(event: E, handler: VizuEventHandler<E>): void;
659
659
  setUser(user: VizuUser | null): void;
660
660
  getUser(): VizuUser | null;
661
+ /**
662
+ * Whether the pill belongs on-screen right now. Cloud-mode workspaces
663
+ * keep it hidden until the user is signed in; non-cloud usage (local /
664
+ * memory storage) has no auth and always shows it. Recomputed on every
665
+ * setUser and on mount.
666
+ */
667
+ private shouldShowPill;
661
668
  /**
662
669
  * Cloud-mode write gate. Every entry point that creates or modifies a
663
670
  * comment first checks that we have a known user. Without one, the
package/dist/index.d.ts CHANGED
@@ -658,6 +658,13 @@ declare class Vizu {
658
658
  off<E extends VizuEventName>(event: E, handler: VizuEventHandler<E>): void;
659
659
  setUser(user: VizuUser | null): void;
660
660
  getUser(): VizuUser | null;
661
+ /**
662
+ * Whether the pill belongs on-screen right now. Cloud-mode workspaces
663
+ * keep it hidden until the user is signed in; non-cloud usage (local /
664
+ * memory storage) has no auth and always shows it. Recomputed on every
665
+ * setUser and on mount.
666
+ */
667
+ private shouldShowPill;
661
668
  /**
662
669
  * Cloud-mode write gate. Every entry point that creates or modifies a
663
670
  * comment first checks that we have a known user. Without one, the
package/dist/index.js CHANGED
@@ -3271,11 +3271,25 @@ var Vizu = class {
3271
3271
  this.user = user;
3272
3272
  this.popover?.setUser(user);
3273
3273
  this.pill?.setUser(user);
3274
+ if (this.pill) {
3275
+ if (this.shouldShowPill()) this.pill.show();
3276
+ else this.pill.hide();
3277
+ }
3274
3278
  this.bus.emit("user:changed", { user });
3275
3279
  }
3276
3280
  getUser() {
3277
3281
  return this.user;
3278
3282
  }
3283
+ /**
3284
+ * Whether the pill belongs on-screen right now. Cloud-mode workspaces
3285
+ * keep it hidden until the user is signed in; non-cloud usage (local /
3286
+ * memory storage) has no auth and always shows it. Recomputed on every
3287
+ * setUser and on mount.
3288
+ */
3289
+ shouldShowPill() {
3290
+ if (!(this.storage instanceof CloudStorageAdapter)) return true;
3291
+ return this.user !== null;
3292
+ }
3279
3293
  /**
3280
3294
  * Cloud-mode write gate. Every entry point that creates or modifies a
3281
3295
  * comment first checks that we have a known user. Without one, the
@@ -3639,7 +3653,7 @@ var Vizu = class {
3639
3653
  this.pill.setUser(this.user);
3640
3654
  this.pill.setComments(this.comments);
3641
3655
  this.pill.setMultiSelectState(this.multiSelectMode, this.pendingFingerprints.length);
3642
- this.pill.show();
3656
+ if (this.shouldShowPill()) this.pill.show();
3643
3657
  this.highlighter = new Highlighter(
3644
3658
  this.root,
3645
3659
  this.opts.ignoreSelectors ?? [],