@unhingged/vizu-core 0.1.14 → 0.1.15
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 +35 -6
- package/dist/auto.cjs.map +1 -1
- package/dist/auto.js +35 -6
- package/dist/auto.js.map +1 -1
- package/dist/index.cjs +35 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +35 -6
- package/dist/index.js.map +1 -1
- package/dist/vizu.min.js +48 -38
- package/dist/vizu.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3272,7 +3272,9 @@ var STYLES = `
|
|
|
3272
3272
|
.vz-ref:hover { background: color-mix(in srgb, var(--vz-accent) 30%, var(--vz-bg-hover)); transform: translateY(-1px); }
|
|
3273
3273
|
.vz-ref::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--vz-accent); flex-shrink: 0; }
|
|
3274
3274
|
|
|
3275
|
-
/* Inline @mention chip (rendered inside displayed comments)
|
|
3275
|
+
/* Inline @mention chip (rendered inside displayed comments). user-select
|
|
3276
|
+
* prevents the user from selecting the chip's text and editing it; the
|
|
3277
|
+
* displayed comment is intentionally read-only after save. */
|
|
3276
3278
|
.vz-mention {
|
|
3277
3279
|
display: inline-flex; align-items: center;
|
|
3278
3280
|
padding: 1px 8px 1px 8px;
|
|
@@ -3282,13 +3284,21 @@ var STYLES = `
|
|
|
3282
3284
|
font-size: 12px; font-weight: 600;
|
|
3283
3285
|
vertical-align: baseline;
|
|
3284
3286
|
margin: 0 1px;
|
|
3287
|
+
user-select: none;
|
|
3288
|
+
-webkit-user-select: none;
|
|
3289
|
+
cursor: default;
|
|
3285
3290
|
}
|
|
3286
3291
|
|
|
3287
|
-
/* Mention chip inside the editor (contenteditable=false token)
|
|
3292
|
+
/* Mention chip inside the editor (contenteditable=false token). Same
|
|
3293
|
+
* non-selection rules as .vz-mention so the chip stays atomic even
|
|
3294
|
+
* inside the editable surface \u2014 caret can land before/after but not
|
|
3295
|
+
* inside, no partial-text edit. */
|
|
3288
3296
|
.vz-chip-mention {
|
|
3289
3297
|
background: color-mix(in srgb, var(--vz-accent) 16%, var(--vz-bg-hover));
|
|
3290
3298
|
color: var(--vz-accent);
|
|
3291
3299
|
font-weight: 600;
|
|
3300
|
+
user-select: none;
|
|
3301
|
+
-webkit-user-select: none;
|
|
3292
3302
|
}
|
|
3293
3303
|
.vz-chip-mention::before { display: none; }
|
|
3294
3304
|
|
|
@@ -3982,10 +3992,29 @@ var Vizu = class {
|
|
|
3982
3992
|
replies: [...this.comments[idx].replies ?? [], reply]
|
|
3983
3993
|
};
|
|
3984
3994
|
this.comments[idx] = updated;
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3995
|
+
try {
|
|
3996
|
+
if (this.storage.addReply) {
|
|
3997
|
+
await this.storage.addReply(this.opts.namespace, commentId, reply);
|
|
3998
|
+
} else {
|
|
3999
|
+
await this.storage.updateComment(this.opts.namespace, commentId, { replies: updated.replies });
|
|
4000
|
+
}
|
|
4001
|
+
} catch (err) {
|
|
4002
|
+
const cur = this.comments[idx];
|
|
4003
|
+
this.comments[idx] = {
|
|
4004
|
+
...cur,
|
|
4005
|
+
replies: (cur.replies ?? []).filter((r) => r.id !== reply.id)
|
|
4006
|
+
};
|
|
4007
|
+
const code = err?.code ?? "";
|
|
4008
|
+
const status = err?.status;
|
|
4009
|
+
const msg = status === 403 || code === "forbidden" ? "Reply failed \u2014 you don't have permission." : status === 401 || code === "auth_required" ? "Reply failed \u2014 please sign in again." : "Reply failed. Please try again.";
|
|
4010
|
+
this.pill?.toast(msg);
|
|
4011
|
+
this.refreshUi();
|
|
4012
|
+
if (this.popover?.isOpen()) {
|
|
4013
|
+
const anchors = this.popover.getAnchors();
|
|
4014
|
+
if (anchors[0]) this.popover.update(this.commentsForElement(anchors[0]));
|
|
4015
|
+
}
|
|
4016
|
+
if (typeof console !== "undefined") console.warn("[vizu] addReply failed", err);
|
|
4017
|
+
return null;
|
|
3989
4018
|
}
|
|
3990
4019
|
this.bus.emit("comment:updated", { comment: updated });
|
|
3991
4020
|
this.refreshUi();
|