@unhingged/vizu-core 0.1.11 → 0.1.12

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.cjs CHANGED
@@ -3330,22 +3330,23 @@ var Vizu = class {
3330
3330
  this.user = user;
3331
3331
  this.popover?.setUser(user);
3332
3332
  this.pill?.setUser(user);
3333
- if (this.pill) {
3334
- if (this.shouldShowPill()) this.pill.show();
3335
- else this.pill.hide();
3336
- }
3337
3333
  this.bus.emit("user:changed", { user });
3334
+ if (this.enabled && !this.root && this.shouldMount()) {
3335
+ this.deferred(() => this.mount());
3336
+ }
3338
3337
  }
3339
3338
  getUser() {
3340
3339
  return this.user;
3341
3340
  }
3342
3341
  /**
3343
- * Whether the pill belongs on-screen right now. Cloud-mode workspaces
3344
- * keep it hidden until the user is signed in; non-cloud usage (local /
3345
- * memory storage) has no auth and always shows it. Recomputed on every
3346
- * setUser and on mount.
3342
+ * Whether the full Vizu UI (pill, highlighter, markers, popover) can
3343
+ * be mounted right now. Cloud-mode workspaces hold off until the
3344
+ * user is signed in; non-cloud usage (local / memory storage) has no
3345
+ * auth concept and mounts immediately. Re-checked from `enable()`
3346
+ * and from `setUser()` so that the moment auth resolves, the UI
3347
+ * appears without the user needing to press the shortcut again.
3347
3348
  */
3348
- shouldShowPill() {
3349
+ shouldMount() {
3349
3350
  if (!(this.storage instanceof CloudStorageAdapter)) return true;
3350
3351
  return this.user !== null;
3351
3352
  }
@@ -3372,7 +3373,9 @@ var Vizu = class {
3372
3373
  if (this.enabled) return;
3373
3374
  this.enabled = true;
3374
3375
  this.bus.emit("enabled", {});
3375
- this.deferred(() => this.mount());
3376
+ if (this.shouldMount()) {
3377
+ this.deferred(() => this.mount());
3378
+ }
3376
3379
  }
3377
3380
  disable() {
3378
3381
  if (!this.enabled) return;
@@ -3712,7 +3715,7 @@ var Vizu = class {
3712
3715
  this.pill.setUser(this.user);
3713
3716
  this.pill.setComments(this.comments);
3714
3717
  this.pill.setMultiSelectState(this.multiSelectMode, this.pendingFingerprints.length);
3715
- if (this.shouldShowPill()) this.pill.show();
3718
+ this.pill.show();
3716
3719
  this.highlighter = new Highlighter(
3717
3720
  this.root,
3718
3721
  this.opts.ignoreSelectors ?? [],