@unhingged/vizu-core 0.1.21 → 0.1.22

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/auto.cjs CHANGED
@@ -3714,14 +3714,7 @@ var Vizu = class {
3714
3714
  e.preventDefault();
3715
3715
  const wasEnabled = this.enabled;
3716
3716
  this.toggle();
3717
- if (!wasEnabled && this.enabled && this.storage instanceof CloudStorageAdapter) {
3718
- void this.storage.preflightAuth().catch((err) => {
3719
- if (err?.code === "auth_canceled" || err?.code === "popup_blocked") return;
3720
- if (typeof console !== "undefined") {
3721
- console.warn("[vizu] preflight auth failed:", err);
3722
- }
3723
- });
3724
- }
3717
+ if (!wasEnabled && this.enabled) this.requestAuth();
3725
3718
  }
3726
3719
  };
3727
3720
  /* ===== Reposition on scroll/resize ===== */
@@ -3875,6 +3868,25 @@ var Vizu = class {
3875
3868
  isEnabled() {
3876
3869
  return this.enabled;
3877
3870
  }
3871
+ /**
3872
+ * Kick the cloud sign-in flow. Call this alongside `enable()` from an
3873
+ * explicit user gesture — a host-rendered launcher button, a menu item —
3874
+ * so cloud-mode users get the sign-in popup immediately instead of only
3875
+ * after clicking an element. The keyboard shortcut goes through this
3876
+ * same path. No-op outside cloud mode, when already signed in, or when
3877
+ * the workspace has already denied access this session.
3878
+ */
3879
+ requestAuth() {
3880
+ if (!(this.storage instanceof CloudStorageAdapter)) return;
3881
+ if (this.user) return;
3882
+ if (this.storage.isAccessDenied()) return;
3883
+ void this.storage.preflightAuth().catch((err) => {
3884
+ if (err?.code === "auth_canceled" || err?.code === "popup_blocked") return;
3885
+ if (typeof console !== "undefined") {
3886
+ console.warn("[vizu] preflight auth failed:", err);
3887
+ }
3888
+ });
3889
+ }
3878
3890
  destroy() {
3879
3891
  this.disable();
3880
3892
  if (typeof window !== "undefined") window.removeEventListener("keydown", this.onKeyDown);