@unhingged/vizu-core 0.1.15 → 0.1.17
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 +43 -5
- package/dist/auto.cjs.map +1 -1
- package/dist/auto.js +43 -5
- package/dist/auto.js.map +1 -1
- package/dist/index.cjs +43 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +43 -5
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +2538 -0
- package/dist/internal.cjs.map +1 -0
- package/dist/internal.d.cts +446 -0
- package/dist/internal.d.ts +446 -0
- package/dist/internal.js +2507 -0
- package/dist/internal.js.map +1 -0
- package/dist/vizu.min.js +10 -6
- package/dist/vizu.min.js.map +1 -1
- package/package.json +8 -1
package/dist/index.cjs
CHANGED
|
@@ -122,6 +122,9 @@ function renderAttachmentsHtml(attachments) {
|
|
|
122
122
|
function migrateComment(raw) {
|
|
123
123
|
if (!raw || typeof raw !== "object") return raw;
|
|
124
124
|
const next = { ...raw };
|
|
125
|
+
if (next.id == null && next._id != null) {
|
|
126
|
+
next.id = next._id;
|
|
127
|
+
}
|
|
125
128
|
if (!Array.isArray(next.fingerprints) || next.fingerprints.length === 0) {
|
|
126
129
|
if (next.fingerprint) {
|
|
127
130
|
next.fingerprints = [next.fingerprint];
|
|
@@ -3378,6 +3381,10 @@ var STYLES = `
|
|
|
3378
3381
|
pointer-events: none;
|
|
3379
3382
|
z-index: 1;
|
|
3380
3383
|
}
|
|
3384
|
+
/* Opt-in only during an active dragover. The explicit display:flex
|
|
3385
|
+
* above out-specifics the browser default for [hidden], so we restate
|
|
3386
|
+
* the hide rule here to make the attribute toggle effective. */
|
|
3387
|
+
.vz-attachment-drop-hint[hidden] { display: none; }
|
|
3381
3388
|
|
|
3382
3389
|
/* Pending attachments (uploaded but not yet saved) */
|
|
3383
3390
|
.vz-attachment-list {
|
|
@@ -3774,10 +3781,25 @@ var Vizu = class {
|
|
|
3774
3781
|
/**
|
|
3775
3782
|
* Fetch the list of users who can be @-mentioned on the current
|
|
3776
3783
|
* workspace. Used by the popover's mention dropdown; hosts can also
|
|
3777
|
-
* call this directly to build their own picker.
|
|
3778
|
-
*
|
|
3784
|
+
* call this directly to build their own picker.
|
|
3785
|
+
*
|
|
3786
|
+
* Resolution order:
|
|
3787
|
+
* 1. `options.mentionable` if provided — host-supplied static or
|
|
3788
|
+
* custom resolver. Wins over everything else.
|
|
3789
|
+
* 2. Cloud adapter's API call if running cloud mode.
|
|
3790
|
+
* 3. Empty array (non-cloud, no override).
|
|
3779
3791
|
*/
|
|
3780
3792
|
async searchMentionable() {
|
|
3793
|
+
if (this.opts.mentionable) {
|
|
3794
|
+
try {
|
|
3795
|
+
return await this.opts.mentionable();
|
|
3796
|
+
} catch (err) {
|
|
3797
|
+
if (typeof console !== "undefined") {
|
|
3798
|
+
console.warn("[vizu] options.mentionable threw", err);
|
|
3799
|
+
}
|
|
3800
|
+
return [];
|
|
3801
|
+
}
|
|
3802
|
+
}
|
|
3781
3803
|
if (this.storage instanceof CloudStorageAdapter) {
|
|
3782
3804
|
return this.storage.searchMentionable();
|
|
3783
3805
|
}
|
|
@@ -4298,10 +4320,26 @@ var Vizu = class {
|
|
|
4298
4320
|
this.refreshUi();
|
|
4299
4321
|
}
|
|
4300
4322
|
async removeComment(id) {
|
|
4301
|
-
const
|
|
4302
|
-
if (
|
|
4323
|
+
const idx = this.comments.findIndex((c) => c.id === id);
|
|
4324
|
+
if (idx === -1) return;
|
|
4325
|
+
const comment = this.comments[idx];
|
|
4303
4326
|
this.comments = this.comments.filter((c) => c.id !== id);
|
|
4304
|
-
|
|
4327
|
+
try {
|
|
4328
|
+
await this.storage.removeComment(this.opts.namespace, id);
|
|
4329
|
+
} catch (err) {
|
|
4330
|
+
this.comments.splice(idx, 0, comment);
|
|
4331
|
+
const status = err?.status;
|
|
4332
|
+
const code = err?.code ?? "";
|
|
4333
|
+
const msg = status === 403 || code === "forbidden" ? "Delete failed \u2014 you don't have permission." : status === 401 || code === "auth_required" ? "Delete failed \u2014 please sign in again." : "Delete failed. Please try again.";
|
|
4334
|
+
this.pill?.toast(msg);
|
|
4335
|
+
if (this.popover?.isOpen()) {
|
|
4336
|
+
const anchors = this.popover.getAnchors();
|
|
4337
|
+
if (anchors[0]) this.popover.update(this.commentsForElement(anchors[0]));
|
|
4338
|
+
}
|
|
4339
|
+
this.refreshUi();
|
|
4340
|
+
if (typeof console !== "undefined") console.warn("[vizu] removeComment failed", err);
|
|
4341
|
+
return;
|
|
4342
|
+
}
|
|
4305
4343
|
this.bus.emit("comment:removed", { id, comment });
|
|
4306
4344
|
if (this.popover?.isOpen()) {
|
|
4307
4345
|
const anchors = this.popover.getAnchors();
|