@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.d.cts CHANGED
@@ -678,12 +678,14 @@ declare class Vizu {
678
678
  setUser(user: VizuUser | null): void;
679
679
  getUser(): VizuUser | null;
680
680
  /**
681
- * Whether the pill belongs on-screen right now. Cloud-mode workspaces
682
- * keep it hidden until the user is signed in; non-cloud usage (local /
683
- * memory storage) has no auth and always shows it. Recomputed on every
684
- * setUser and on mount.
685
- */
686
- private shouldShowPill;
681
+ * Whether the full Vizu UI (pill, highlighter, markers, popover) can
682
+ * be mounted right now. Cloud-mode workspaces hold off until the
683
+ * user is signed in; non-cloud usage (local / memory storage) has no
684
+ * auth concept and mounts immediately. Re-checked from `enable()`
685
+ * and from `setUser()` so that the moment auth resolves, the UI
686
+ * appears without the user needing to press the shortcut again.
687
+ */
688
+ private shouldMount;
687
689
  /**
688
690
  * Cloud-mode write gate. Every entry point that creates or modifies a
689
691
  * comment first checks that we have a known user. Without one, the
package/dist/index.d.ts CHANGED
@@ -678,12 +678,14 @@ declare class Vizu {
678
678
  setUser(user: VizuUser | null): void;
679
679
  getUser(): VizuUser | null;
680
680
  /**
681
- * Whether the pill belongs on-screen right now. Cloud-mode workspaces
682
- * keep it hidden until the user is signed in; non-cloud usage (local /
683
- * memory storage) has no auth and always shows it. Recomputed on every
684
- * setUser and on mount.
685
- */
686
- private shouldShowPill;
681
+ * Whether the full Vizu UI (pill, highlighter, markers, popover) can
682
+ * be mounted right now. Cloud-mode workspaces hold off until the
683
+ * user is signed in; non-cloud usage (local / memory storage) has no
684
+ * auth concept and mounts immediately. Re-checked from `enable()`
685
+ * and from `setUser()` so that the moment auth resolves, the UI
686
+ * appears without the user needing to press the shortcut again.
687
+ */
688
+ private shouldMount;
687
689
  /**
688
690
  * Cloud-mode write gate. Every entry point that creates or modifies a
689
691
  * comment first checks that we have a known user. Without one, the
package/dist/index.js CHANGED
@@ -3294,22 +3294,23 @@ var Vizu = class {
3294
3294
  this.user = user;
3295
3295
  this.popover?.setUser(user);
3296
3296
  this.pill?.setUser(user);
3297
- if (this.pill) {
3298
- if (this.shouldShowPill()) this.pill.show();
3299
- else this.pill.hide();
3300
- }
3301
3297
  this.bus.emit("user:changed", { user });
3298
+ if (this.enabled && !this.root && this.shouldMount()) {
3299
+ this.deferred(() => this.mount());
3300
+ }
3302
3301
  }
3303
3302
  getUser() {
3304
3303
  return this.user;
3305
3304
  }
3306
3305
  /**
3307
- * Whether the pill belongs on-screen right now. Cloud-mode workspaces
3308
- * keep it hidden until the user is signed in; non-cloud usage (local /
3309
- * memory storage) has no auth and always shows it. Recomputed on every
3310
- * setUser and on mount.
3306
+ * Whether the full Vizu UI (pill, highlighter, markers, popover) can
3307
+ * be mounted right now. Cloud-mode workspaces hold off until the
3308
+ * user is signed in; non-cloud usage (local / memory storage) has no
3309
+ * auth concept and mounts immediately. Re-checked from `enable()`
3310
+ * and from `setUser()` so that the moment auth resolves, the UI
3311
+ * appears without the user needing to press the shortcut again.
3311
3312
  */
3312
- shouldShowPill() {
3313
+ shouldMount() {
3313
3314
  if (!(this.storage instanceof CloudStorageAdapter)) return true;
3314
3315
  return this.user !== null;
3315
3316
  }
@@ -3336,7 +3337,9 @@ var Vizu = class {
3336
3337
  if (this.enabled) return;
3337
3338
  this.enabled = true;
3338
3339
  this.bus.emit("enabled", {});
3339
- this.deferred(() => this.mount());
3340
+ if (this.shouldMount()) {
3341
+ this.deferred(() => this.mount());
3342
+ }
3340
3343
  }
3341
3344
  disable() {
3342
3345
  if (!this.enabled) return;
@@ -3676,7 +3679,7 @@ var Vizu = class {
3676
3679
  this.pill.setUser(this.user);
3677
3680
  this.pill.setComments(this.comments);
3678
3681
  this.pill.setMultiSelectState(this.multiSelectMode, this.pendingFingerprints.length);
3679
- if (this.shouldShowPill()) this.pill.show();
3682
+ this.pill.show();
3680
3683
  this.highlighter = new Highlighter(
3681
3684
  this.root,
3682
3685
  this.opts.ignoreSelectors ?? [],