@unhingged/vizu-core 0.1.6 → 0.1.8
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 +13 -10
- package/dist/auto.cjs.map +1 -1
- package/dist/auto.js +13 -10
- package/dist/auto.js.map +1 -1
- package/dist/index.cjs +13 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -10
- package/dist/index.js.map +1 -1
- package/dist/vizu.min.js +2 -2
- package/dist/vizu.min.js.map +1 -1
- package/package.json +1 -1
package/dist/auto.cjs
CHANGED
|
@@ -406,7 +406,9 @@ var CloudStorageAdapter = class {
|
|
|
406
406
|
const payload = params.get("vizu_auth");
|
|
407
407
|
if (!payload) return null;
|
|
408
408
|
try {
|
|
409
|
-
const
|
|
409
|
+
const bytes = Uint8Array.from(atob(payload), (c) => c.charCodeAt(0));
|
|
410
|
+
const decoded = new TextDecoder("utf-8").decode(bytes);
|
|
411
|
+
const json = JSON.parse(decoded);
|
|
410
412
|
if (!json.t || !json.e || !json.u || !json.w) return null;
|
|
411
413
|
if (json.w !== this.workspace) return null;
|
|
412
414
|
const stored = {
|
|
@@ -3206,7 +3208,16 @@ var Vizu = class {
|
|
|
3206
3208
|
}
|
|
3207
3209
|
if (matches(e, this.parsedShortcut)) {
|
|
3208
3210
|
e.preventDefault();
|
|
3211
|
+
const wasEnabled = this.enabled;
|
|
3209
3212
|
this.toggle();
|
|
3213
|
+
if (!wasEnabled && this.enabled && this.storage instanceof CloudStorageAdapter) {
|
|
3214
|
+
void this.storage.preflightAuth().catch((err) => {
|
|
3215
|
+
if (err?.code === "auth_canceled" || err?.code === "popup_blocked") return;
|
|
3216
|
+
if (typeof console !== "undefined") {
|
|
3217
|
+
console.warn("[vizu] preflight auth failed:", err);
|
|
3218
|
+
}
|
|
3219
|
+
});
|
|
3220
|
+
}
|
|
3210
3221
|
}
|
|
3211
3222
|
};
|
|
3212
3223
|
/* ===== Reposition on scroll/resize ===== */
|
|
@@ -3236,6 +3247,7 @@ var Vizu = class {
|
|
|
3236
3247
|
this.opts.namespace = options.namespace ?? DEFAULTS.namespace;
|
|
3237
3248
|
this.opts.accent = options.accent ?? DEFAULTS.accent;
|
|
3238
3249
|
this.parsedShortcut = parseShortcut(this.opts.shortcut);
|
|
3250
|
+
this.user = options.user ?? null;
|
|
3239
3251
|
this.storage = resolveStorage(
|
|
3240
3252
|
options.storage,
|
|
3241
3253
|
options.cloud,
|
|
@@ -3244,7 +3256,6 @@ var Vizu = class {
|
|
|
3244
3256
|
if (info.user) this.setUser(info.user);
|
|
3245
3257
|
}
|
|
3246
3258
|
);
|
|
3247
|
-
this.user = options.user ?? null;
|
|
3248
3259
|
if (options.actions) this.actions = [...options.actions];
|
|
3249
3260
|
if (options.onCommentAdded) this.bus.on("comment:added", (p) => options.onCommentAdded(p.comment));
|
|
3250
3261
|
if (options.onCommentRemoved) this.bus.on("comment:removed", (p) => options.onCommentRemoved(p.id));
|
|
@@ -3295,14 +3306,6 @@ var Vizu = class {
|
|
|
3295
3306
|
this.enabled = true;
|
|
3296
3307
|
this.bus.emit("enabled", {});
|
|
3297
3308
|
this.deferred(() => this.mount());
|
|
3298
|
-
if (this.storage instanceof CloudStorageAdapter) {
|
|
3299
|
-
void this.storage.preflightAuth().catch((err) => {
|
|
3300
|
-
if (err?.code === "auth_canceled" || err?.code === "popup_blocked") return;
|
|
3301
|
-
if (typeof console !== "undefined") {
|
|
3302
|
-
console.warn("[vizu] preflight auth failed:", err);
|
|
3303
|
-
}
|
|
3304
|
-
});
|
|
3305
|
-
}
|
|
3306
3309
|
}
|
|
3307
3310
|
disable() {
|
|
3308
3311
|
if (!this.enabled) return;
|