@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/index.d.cts CHANGED
@@ -731,6 +731,15 @@ declare class Vizu {
731
731
  disable(): void;
732
732
  toggle(): void;
733
733
  isEnabled(): boolean;
734
+ /**
735
+ * Kick the cloud sign-in flow. Call this alongside `enable()` from an
736
+ * explicit user gesture — a host-rendered launcher button, a menu item —
737
+ * so cloud-mode users get the sign-in popup immediately instead of only
738
+ * after clicking an element. The keyboard shortcut goes through this
739
+ * same path. No-op outside cloud mode, when already signed in, or when
740
+ * the workspace has already denied access this session.
741
+ */
742
+ requestAuth(): void;
734
743
  destroy(): void;
735
744
  addAction(action: VizuAction): void;
736
745
  removeAction(id: string): void;
package/dist/index.d.ts CHANGED
@@ -731,6 +731,15 @@ declare class Vizu {
731
731
  disable(): void;
732
732
  toggle(): void;
733
733
  isEnabled(): boolean;
734
+ /**
735
+ * Kick the cloud sign-in flow. Call this alongside `enable()` from an
736
+ * explicit user gesture — a host-rendered launcher button, a menu item —
737
+ * so cloud-mode users get the sign-in popup immediately instead of only
738
+ * after clicking an element. The keyboard shortcut goes through this
739
+ * same path. No-op outside cloud mode, when already signed in, or when
740
+ * the workspace has already denied access this session.
741
+ */
742
+ requestAuth(): void;
734
743
  destroy(): void;
735
744
  addAction(action: VizuAction): void;
736
745
  removeAction(id: string): void;
package/dist/index.js CHANGED
@@ -3688,14 +3688,7 @@ var Vizu = class {
3688
3688
  e.preventDefault();
3689
3689
  const wasEnabled = this.enabled;
3690
3690
  this.toggle();
3691
- if (!wasEnabled && this.enabled && this.storage instanceof CloudStorageAdapter) {
3692
- void this.storage.preflightAuth().catch((err) => {
3693
- if (err?.code === "auth_canceled" || err?.code === "popup_blocked") return;
3694
- if (typeof console !== "undefined") {
3695
- console.warn("[vizu] preflight auth failed:", err);
3696
- }
3697
- });
3698
- }
3691
+ if (!wasEnabled && this.enabled) this.requestAuth();
3699
3692
  }
3700
3693
  };
3701
3694
  /* ===== Reposition on scroll/resize ===== */
@@ -3849,6 +3842,25 @@ var Vizu = class {
3849
3842
  isEnabled() {
3850
3843
  return this.enabled;
3851
3844
  }
3845
+ /**
3846
+ * Kick the cloud sign-in flow. Call this alongside `enable()` from an
3847
+ * explicit user gesture — a host-rendered launcher button, a menu item —
3848
+ * so cloud-mode users get the sign-in popup immediately instead of only
3849
+ * after clicking an element. The keyboard shortcut goes through this
3850
+ * same path. No-op outside cloud mode, when already signed in, or when
3851
+ * the workspace has already denied access this session.
3852
+ */
3853
+ requestAuth() {
3854
+ if (!(this.storage instanceof CloudStorageAdapter)) return;
3855
+ if (this.user) return;
3856
+ if (this.storage.isAccessDenied()) return;
3857
+ void this.storage.preflightAuth().catch((err) => {
3858
+ if (err?.code === "auth_canceled" || err?.code === "popup_blocked") return;
3859
+ if (typeof console !== "undefined") {
3860
+ console.warn("[vizu] preflight auth failed:", err);
3861
+ }
3862
+ });
3863
+ }
3852
3864
  destroy() {
3853
3865
  this.disable();
3854
3866
  if (typeof window !== "undefined") window.removeEventListener("keydown", this.onKeyDown);