superdoc 2.18.0-next.12 → 2.18.0-next.14
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/chunks/{create-super-doc-ui-BwM3I7-G.cjs → create-super-doc-ui-wDvhW9Tz.cjs} +990 -911
- package/dist/chunks/{create-super-doc-ui-Ci7OxbXV.es.js → create-super-doc-ui-wKzxrztu.es.js} +976 -909
- package/dist/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/document-api/src/images/images.types.d.ts +2 -0
- package/dist/document-api/src/types/clipboard.d.ts +22 -1
- package/dist/public/ui-react.cjs +1 -1
- package/dist/public/ui-react.es.js +1 -1
- package/dist/public/ui-vue.cjs +1 -1
- package/dist/public/ui-vue.es.js +1 -1
- package/dist/public/ui.cjs +1 -1
- package/dist/public/ui.es.js +1 -1
- package/dist/style.css +22 -22
- package/dist/style.layered.css +22 -22
- package/dist/superdoc/src/internal/toolbar/built-in/LinkInput.vue.d.ts +4 -4
- package/dist/superdoc/src/public/ui/create-super-doc-ui.d.ts +9 -1
- package/dist/superdoc.cjs +83 -80
- package/dist/superdoc.es.js +83 -80
- package/dist-cdn/style.layered.css +1 -1
- package/dist-cdn/superdoc.min.css +1 -1
- package/dist-cdn/superdoc.min.js +37 -37
- package/package.json +2 -2
package/dist/superdoc.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("./chunks/rolldown-runtime-74VwNCz7.cjs");
|
|
3
3
|
const require_blank_docx = require("./chunks/blank-docx-BuFAbRjs.cjs");
|
|
4
|
-
const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-
|
|
4
|
+
const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-wDvhW9Tz.cjs");
|
|
5
5
|
const require_eventemitter3 = require("./chunks/eventemitter3-C_TAnXOl.cjs");
|
|
6
6
|
const require_uuid = require("./chunks/uuid-BhG0ngwk.cjs");
|
|
7
7
|
const require_jszip = require("./chunks/jszip-D8mAFF-r.cjs");
|
|
@@ -316,7 +316,7 @@ var shuffleArray = (array) => {
|
|
|
316
316
|
var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
|
|
317
317
|
function getSuperdocVersion() {
|
|
318
318
|
try {
|
|
319
|
-
return "2.18.0-next.
|
|
319
|
+
return "2.18.0-next.14";
|
|
320
320
|
} catch {
|
|
321
321
|
return "unknown";
|
|
322
322
|
}
|
|
@@ -14979,6 +14979,79 @@ function useViewportFit({ getSuperdoc, superdocContainerWidth, isReady, activeZo
|
|
|
14979
14979
|
return { evaluateViewport };
|
|
14980
14980
|
}
|
|
14981
14981
|
//#endregion
|
|
14982
|
+
//#region ../layout-engine/contracts/src/author-colors.ts
|
|
14983
|
+
/**
|
|
14984
|
+
* Curated, high-contrast fallback palette. Used when neither `overrides` nor
|
|
14985
|
+
* `resolve` produces a color so imported/discovered authors the host did not
|
|
14986
|
+
* configure ahead of time still get a stable, distinct color.
|
|
14987
|
+
*/
|
|
14988
|
+
var FALLBACK_PALETTE = [
|
|
14989
|
+
"#1f6feb",
|
|
14990
|
+
"#d1242f",
|
|
14991
|
+
"#8250df",
|
|
14992
|
+
"#bf3989",
|
|
14993
|
+
"#1a7f37",
|
|
14994
|
+
"#9a6700",
|
|
14995
|
+
"#bc4c00",
|
|
14996
|
+
"#0969da",
|
|
14997
|
+
"#cf222e",
|
|
14998
|
+
"#6639ba",
|
|
14999
|
+
"#116329",
|
|
15000
|
+
"#7d4e00"
|
|
15001
|
+
];
|
|
15002
|
+
/** Stable identity string for an author (used for hashing + dedupe). */
|
|
15003
|
+
var authorIdentityKey = (author) => {
|
|
15004
|
+
if (!author) return "";
|
|
15005
|
+
return `${typeof author.name === "string" ? author.name : ""} ${typeof author.email === "string" ? author.email : ""}`;
|
|
15006
|
+
};
|
|
15007
|
+
/** Deterministic 32-bit FNV-1a hash of a string. */
|
|
15008
|
+
var hashString = (value) => {
|
|
15009
|
+
let hash = 2166136261;
|
|
15010
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
15011
|
+
hash ^= value.charCodeAt(i);
|
|
15012
|
+
hash = Math.imul(hash, 16777619);
|
|
15013
|
+
}
|
|
15014
|
+
return hash >>> 0;
|
|
15015
|
+
};
|
|
15016
|
+
/**
|
|
15017
|
+
* Deterministic fallback color derived from the author identity. The same
|
|
15018
|
+
* identity always maps to the same palette entry, so colors stay stable across
|
|
15019
|
+
* reloads and across the paint / snapshot surfaces.
|
|
15020
|
+
*/
|
|
15021
|
+
var fallbackAuthorColor = (author) => {
|
|
15022
|
+
return FALLBACK_PALETTE[hashString(authorIdentityKey(author)) % FALLBACK_PALETTE.length];
|
|
15023
|
+
};
|
|
15024
|
+
var isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
|
|
15025
|
+
/**
|
|
15026
|
+
* Composes the host `authorColors` config into a single resolver.
|
|
15027
|
+
*
|
|
15028
|
+
* Resolution order per author:
|
|
15029
|
+
* 1. `overrides` by identity — `email` first, then `name` (exact match).
|
|
15030
|
+
* 2. `resolve(author)`.
|
|
15031
|
+
* 3. A deterministic fallback color from the author identity.
|
|
15032
|
+
*
|
|
15033
|
+
* Returns `undefined` when colors are disabled (`enabled === false`) or no
|
|
15034
|
+
* config was provided, so callers can leave the existing default palette in
|
|
15035
|
+
* place by simply not threading a resolver.
|
|
15036
|
+
*/
|
|
15037
|
+
var composeAuthorColorResolver = (config) => {
|
|
15038
|
+
if (!config || config.enabled === false) return void 0;
|
|
15039
|
+
const overrides = config.overrides && typeof config.overrides === "object" ? config.overrides : void 0;
|
|
15040
|
+
const resolve = typeof config.resolve === "function" ? config.resolve : void 0;
|
|
15041
|
+
return (author) => {
|
|
15042
|
+
const safeAuthor = author ?? {};
|
|
15043
|
+
if (overrides) {
|
|
15044
|
+
if (isNonEmptyString(safeAuthor.email) && isNonEmptyString(overrides[safeAuthor.email])) return overrides[safeAuthor.email];
|
|
15045
|
+
if (isNonEmptyString(safeAuthor.name) && isNonEmptyString(overrides[safeAuthor.name])) return overrides[safeAuthor.name];
|
|
15046
|
+
}
|
|
15047
|
+
if (resolve) try {
|
|
15048
|
+
const resolved = resolve(safeAuthor);
|
|
15049
|
+
if (isNonEmptyString(resolved)) return resolved;
|
|
15050
|
+
} catch {}
|
|
15051
|
+
return fallbackAuthorColor(safeAuthor);
|
|
15052
|
+
};
|
|
15053
|
+
};
|
|
15054
|
+
//#endregion
|
|
14982
15055
|
//#region src/components/CommentsLayer/floating-comment-positioning.js
|
|
14983
15056
|
var isPersistentReviewSidebarItem = (comment) => {
|
|
14984
15057
|
return Boolean(comment?.trackedChange);
|
|
@@ -16392,79 +16465,6 @@ var _sfc_main$27 = {
|
|
|
16392
16465
|
};
|
|
16393
16466
|
var WhiteboardLayer_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$27, [["__scopeId", "data-v-54546c3d"]]);
|
|
16394
16467
|
//#endregion
|
|
16395
|
-
//#region ../layout-engine/contracts/src/author-colors.ts
|
|
16396
|
-
/**
|
|
16397
|
-
* Curated, high-contrast fallback palette. Used when neither `overrides` nor
|
|
16398
|
-
* `resolve` produces a color so imported/discovered authors the host did not
|
|
16399
|
-
* configure ahead of time still get a stable, distinct color.
|
|
16400
|
-
*/
|
|
16401
|
-
var FALLBACK_PALETTE = [
|
|
16402
|
-
"#1f6feb",
|
|
16403
|
-
"#d1242f",
|
|
16404
|
-
"#8250df",
|
|
16405
|
-
"#bf3989",
|
|
16406
|
-
"#1a7f37",
|
|
16407
|
-
"#9a6700",
|
|
16408
|
-
"#bc4c00",
|
|
16409
|
-
"#0969da",
|
|
16410
|
-
"#cf222e",
|
|
16411
|
-
"#6639ba",
|
|
16412
|
-
"#116329",
|
|
16413
|
-
"#7d4e00"
|
|
16414
|
-
];
|
|
16415
|
-
/** Stable identity string for an author (used for hashing + dedupe). */
|
|
16416
|
-
var authorIdentityKey = (author) => {
|
|
16417
|
-
if (!author) return "";
|
|
16418
|
-
return `${typeof author.name === "string" ? author.name : ""} ${typeof author.email === "string" ? author.email : ""}`;
|
|
16419
|
-
};
|
|
16420
|
-
/** Deterministic 32-bit FNV-1a hash of a string. */
|
|
16421
|
-
var hashString = (value) => {
|
|
16422
|
-
let hash = 2166136261;
|
|
16423
|
-
for (let i = 0; i < value.length; i += 1) {
|
|
16424
|
-
hash ^= value.charCodeAt(i);
|
|
16425
|
-
hash = Math.imul(hash, 16777619);
|
|
16426
|
-
}
|
|
16427
|
-
return hash >>> 0;
|
|
16428
|
-
};
|
|
16429
|
-
/**
|
|
16430
|
-
* Deterministic fallback color derived from the author identity. The same
|
|
16431
|
-
* identity always maps to the same palette entry, so colors stay stable across
|
|
16432
|
-
* reloads and across the paint / snapshot surfaces.
|
|
16433
|
-
*/
|
|
16434
|
-
var fallbackAuthorColor = (author) => {
|
|
16435
|
-
return FALLBACK_PALETTE[hashString(authorIdentityKey(author)) % FALLBACK_PALETTE.length];
|
|
16436
|
-
};
|
|
16437
|
-
var isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
|
|
16438
|
-
/**
|
|
16439
|
-
* Composes the host `authorColors` config into a single resolver.
|
|
16440
|
-
*
|
|
16441
|
-
* Resolution order per author:
|
|
16442
|
-
* 1. `overrides` by identity — `email` first, then `name` (exact match).
|
|
16443
|
-
* 2. `resolve(author)`.
|
|
16444
|
-
* 3. A deterministic fallback color from the author identity.
|
|
16445
|
-
*
|
|
16446
|
-
* Returns `undefined` when colors are disabled (`enabled === false`) or no
|
|
16447
|
-
* config was provided, so callers can leave the existing default palette in
|
|
16448
|
-
* place by simply not threading a resolver.
|
|
16449
|
-
*/
|
|
16450
|
-
var composeAuthorColorResolver = (config) => {
|
|
16451
|
-
if (!config || config.enabled === false) return void 0;
|
|
16452
|
-
const overrides = config.overrides && typeof config.overrides === "object" ? config.overrides : void 0;
|
|
16453
|
-
const resolve = typeof config.resolve === "function" ? config.resolve : void 0;
|
|
16454
|
-
return (author) => {
|
|
16455
|
-
const safeAuthor = author ?? {};
|
|
16456
|
-
if (overrides) {
|
|
16457
|
-
if (isNonEmptyString(safeAuthor.email) && isNonEmptyString(overrides[safeAuthor.email])) return overrides[safeAuthor.email];
|
|
16458
|
-
if (isNonEmptyString(safeAuthor.name) && isNonEmptyString(overrides[safeAuthor.name])) return overrides[safeAuthor.name];
|
|
16459
|
-
}
|
|
16460
|
-
if (resolve) try {
|
|
16461
|
-
const resolved = resolve(safeAuthor);
|
|
16462
|
-
if (isNonEmptyString(resolved)) return resolved;
|
|
16463
|
-
} catch {}
|
|
16464
|
-
return fallbackAuthorColor(safeAuthor);
|
|
16465
|
-
};
|
|
16466
|
-
};
|
|
16467
|
-
//#endregion
|
|
16468
16468
|
//#region src/components/HtmlViewer/HtmlViewer.vue
|
|
16469
16469
|
var _hoisted_1$20 = { class: "superdoc-html-viewer" };
|
|
16470
16470
|
var _hoisted_2$16 = { class: "superdoc-html-viewer__document" };
|
|
@@ -22171,7 +22171,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
|
|
|
22171
22171
|
executeAsync: (commandId, payload) => {
|
|
22172
22172
|
const ui = getSuperDocUI();
|
|
22173
22173
|
if (!ui) return Promise.resolve(UNAVAILABLE_COMMAND_RESULT);
|
|
22174
|
-
return
|
|
22174
|
+
return require_create_super_doc_ui.executeFirstPartyCommandAsync(ui, commandId, payload);
|
|
22175
22175
|
},
|
|
22176
22176
|
getState: (commandId) => getSuperDocUI()?.commands.get(commandId).getState() ?? UNAVAILABLE_COMMAND_STATE
|
|
22177
22177
|
},
|
|
@@ -22372,7 +22372,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
|
|
|
22372
22372
|
if (!payload) return;
|
|
22373
22373
|
clearV2EditorFailure(payload.documentId ?? null);
|
|
22374
22374
|
clearV2MutationRejectionNotifications(payload.documentId ?? null);
|
|
22375
|
-
const { host, mount, documentId, capabilities, editCommands, bindEditShortcuts, bindSessionShortcuts, commentsAdapter, trackedChangesAdapter, contextMenu, documentApi, documentMutationReadiness, documentApiUnavailableReason, pageMetrics, pageLayout, pageFurniture, presence, lock, connection, collaborationProvider, fonts, replaceFile, upgradeToCollaboration, documentOpenToken } = payload;
|
|
22375
|
+
const { host, firstPartyCommandMutation, mount, documentId, capabilities, editCommands, bindEditShortcuts, bindSessionShortcuts, commentsAdapter, trackedChangesAdapter, contextMenu, documentApi, documentMutationReadiness, documentApiUnavailableReason, pageMetrics, pageLayout, pageFurniture, presence, lock, connection, collaborationProvider, fonts, replaceFile, upgradeToCollaboration, documentOpenToken } = payload;
|
|
22376
22376
|
documentOpenTelemetry?.trackDocumentOpen(documentOpenToken ?? null, documentId ?? null);
|
|
22377
22377
|
const saveV2Bytes = createV2SaveQueue(async (saveOptions = {}) => {
|
|
22378
22378
|
if (!host || typeof host.save !== "function") throw new Error("v2-editor: save unavailable");
|
|
@@ -22688,6 +22688,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
|
|
|
22688
22688
|
if (doc) doc.provider = provider;
|
|
22689
22689
|
}
|
|
22690
22690
|
proxy.$superdoc.broadcastEditorCreate(facade);
|
|
22691
|
+
if (host && firstPartyCommandMutation) require_create_super_doc_ui.registerFirstPartyCommandMutation(proxy.$superdoc, host, firstPartyCommandMutation);
|
|
22691
22692
|
installV2CommandShortcutBinding({
|
|
22692
22693
|
documentId,
|
|
22693
22694
|
bindEditShortcuts
|
|
@@ -24495,7 +24496,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
|
|
|
24495
24496
|
], 38);
|
|
24496
24497
|
};
|
|
24497
24498
|
}
|
|
24498
|
-
}, [["__scopeId", "data-v-
|
|
24499
|
+
}, [["__scopeId", "data-v-202b7646"]]);
|
|
24499
24500
|
//#endregion
|
|
24500
24501
|
//#region src/core/create-app.js
|
|
24501
24502
|
var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
|
|
@@ -44368,7 +44369,7 @@ function executeCommand(ui, commandId, argument, options = {}) {
|
|
|
44368
44369
|
if (typeof ui.commands.has === "function" && !ui.commands.has(commandId)) return false;
|
|
44369
44370
|
const execute = typeof ui.commands.executeAsync === "function" ? ui.commands.executeAsync : ui.commands.execute;
|
|
44370
44371
|
if (typeof execute !== "function") return false;
|
|
44371
|
-
const result = argument === void 0 ? execute.call(ui.commands, commandId) : execute.call(ui.commands, commandId, argument);
|
|
44372
|
+
const result = options.firstParty ? require_create_super_doc_ui.executeFirstPartyCommandAsync(ui, commandId, argument) : argument === void 0 ? execute.call(ui.commands, commandId) : execute.call(ui.commands, commandId, argument);
|
|
44372
44373
|
const reportFailure = (settled) => {
|
|
44373
44374
|
if (!options.reportUnhandled || settled !== false) return;
|
|
44374
44375
|
options.onError?.(/* @__PURE__ */ new Error(`[superdoc toolbar] Command "${commandId}" did not run. Check that it is enabled and has the required input.`));
|
|
@@ -45016,6 +45017,7 @@ var BuiltInToolbar = class extends require_eventemitter3.import_eventemitter3.de
|
|
|
45016
45017
|
const name = item?.name?.value;
|
|
45017
45018
|
if (!name) return false;
|
|
45018
45019
|
const callbacks = {
|
|
45020
|
+
firstParty: true,
|
|
45019
45021
|
onSettled: () => this.updateToolbarState(),
|
|
45020
45022
|
onError: (error) => this.#emitCommandException(error, name)
|
|
45021
45023
|
};
|
|
@@ -45044,6 +45046,7 @@ var BuiltInToolbar = class extends require_eventemitter3.import_eventemitter3.de
|
|
|
45044
45046
|
onPick: async (file) => {
|
|
45045
45047
|
const src = await resolveImageSrc(file, this.superdoc?.config?.handleImageUpload);
|
|
45046
45048
|
executeCommand(this.ui, "image", { src }, {
|
|
45049
|
+
firstParty: true,
|
|
45047
45050
|
onSettled: () => this.updateToolbarState(),
|
|
45048
45051
|
onError: (error) => this.#emitCommandException(error, "image")
|
|
45049
45052
|
});
|
|
@@ -45746,7 +45749,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
45746
45749
|
this.config.colors = shuffleArray(this.config.colors);
|
|
45747
45750
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
45748
45751
|
this.colorIndex = 0;
|
|
45749
|
-
this.version = "2.18.0-next.
|
|
45752
|
+
this.version = "2.18.0-next.14";
|
|
45750
45753
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
45751
45754
|
this.superdocId = config.superdocId || require_uuid.v4();
|
|
45752
45755
|
this.colors = this.config.colors ?? [];
|
package/dist/superdoc.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as __toESM$2 } from "./chunks/rolldown-runtime-0pSA04fp.es.js";
|
|
2
2
|
import { t as blank_default } from "./chunks/blank-docx-DzQccOlW.es.js";
|
|
3
|
-
import { a as
|
|
3
|
+
import { a as applyV2CommentInvalidationFromMutation, c as DOM_CLASS_NAMES, d as recordInteraction, l as closeInteractionHistory, n as executeFirstPartyCommandAsync, o as getV2TrackedChangeMutationImpact, r as registerFirstPartyCommandMutation, t as createSuperDocUI, u as createInteractionHistory } from "./chunks/create-super-doc-ui-wKzxrztu.es.js";
|
|
4
4
|
import { t as import_eventemitter3 } from "./chunks/eventemitter3-DEIiXiH2.es.js";
|
|
5
5
|
import { t as v4 } from "./chunks/uuid-H0Xcmmhy.es.js";
|
|
6
6
|
import { a as init_dist$1, i as global, n as init_dist$2, o as Buffer, r as process$1, s as init_dist, t as require_jszip_min } from "./chunks/jszip-BzJ3CyxR.es.js";
|
|
@@ -315,7 +315,7 @@ var shuffleArray = (array) => {
|
|
|
315
315
|
var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
|
|
316
316
|
function getSuperdocVersion() {
|
|
317
317
|
try {
|
|
318
|
-
return "2.18.0-next.
|
|
318
|
+
return "2.18.0-next.14";
|
|
319
319
|
} catch {
|
|
320
320
|
return "unknown";
|
|
321
321
|
}
|
|
@@ -14970,6 +14970,79 @@ function useViewportFit({ getSuperdoc, superdocContainerWidth, isReady, activeZo
|
|
|
14970
14970
|
return { evaluateViewport };
|
|
14971
14971
|
}
|
|
14972
14972
|
//#endregion
|
|
14973
|
+
//#region ../layout-engine/contracts/src/author-colors.ts
|
|
14974
|
+
/**
|
|
14975
|
+
* Curated, high-contrast fallback palette. Used when neither `overrides` nor
|
|
14976
|
+
* `resolve` produces a color so imported/discovered authors the host did not
|
|
14977
|
+
* configure ahead of time still get a stable, distinct color.
|
|
14978
|
+
*/
|
|
14979
|
+
var FALLBACK_PALETTE = [
|
|
14980
|
+
"#1f6feb",
|
|
14981
|
+
"#d1242f",
|
|
14982
|
+
"#8250df",
|
|
14983
|
+
"#bf3989",
|
|
14984
|
+
"#1a7f37",
|
|
14985
|
+
"#9a6700",
|
|
14986
|
+
"#bc4c00",
|
|
14987
|
+
"#0969da",
|
|
14988
|
+
"#cf222e",
|
|
14989
|
+
"#6639ba",
|
|
14990
|
+
"#116329",
|
|
14991
|
+
"#7d4e00"
|
|
14992
|
+
];
|
|
14993
|
+
/** Stable identity string for an author (used for hashing + dedupe). */
|
|
14994
|
+
var authorIdentityKey = (author) => {
|
|
14995
|
+
if (!author) return "";
|
|
14996
|
+
return `${typeof author.name === "string" ? author.name : ""} ${typeof author.email === "string" ? author.email : ""}`;
|
|
14997
|
+
};
|
|
14998
|
+
/** Deterministic 32-bit FNV-1a hash of a string. */
|
|
14999
|
+
var hashString = (value) => {
|
|
15000
|
+
let hash = 2166136261;
|
|
15001
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
15002
|
+
hash ^= value.charCodeAt(i);
|
|
15003
|
+
hash = Math.imul(hash, 16777619);
|
|
15004
|
+
}
|
|
15005
|
+
return hash >>> 0;
|
|
15006
|
+
};
|
|
15007
|
+
/**
|
|
15008
|
+
* Deterministic fallback color derived from the author identity. The same
|
|
15009
|
+
* identity always maps to the same palette entry, so colors stay stable across
|
|
15010
|
+
* reloads and across the paint / snapshot surfaces.
|
|
15011
|
+
*/
|
|
15012
|
+
var fallbackAuthorColor = (author) => {
|
|
15013
|
+
return FALLBACK_PALETTE[hashString(authorIdentityKey(author)) % FALLBACK_PALETTE.length];
|
|
15014
|
+
};
|
|
15015
|
+
var isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
|
|
15016
|
+
/**
|
|
15017
|
+
* Composes the host `authorColors` config into a single resolver.
|
|
15018
|
+
*
|
|
15019
|
+
* Resolution order per author:
|
|
15020
|
+
* 1. `overrides` by identity — `email` first, then `name` (exact match).
|
|
15021
|
+
* 2. `resolve(author)`.
|
|
15022
|
+
* 3. A deterministic fallback color from the author identity.
|
|
15023
|
+
*
|
|
15024
|
+
* Returns `undefined` when colors are disabled (`enabled === false`) or no
|
|
15025
|
+
* config was provided, so callers can leave the existing default palette in
|
|
15026
|
+
* place by simply not threading a resolver.
|
|
15027
|
+
*/
|
|
15028
|
+
var composeAuthorColorResolver = (config) => {
|
|
15029
|
+
if (!config || config.enabled === false) return void 0;
|
|
15030
|
+
const overrides = config.overrides && typeof config.overrides === "object" ? config.overrides : void 0;
|
|
15031
|
+
const resolve = typeof config.resolve === "function" ? config.resolve : void 0;
|
|
15032
|
+
return (author) => {
|
|
15033
|
+
const safeAuthor = author ?? {};
|
|
15034
|
+
if (overrides) {
|
|
15035
|
+
if (isNonEmptyString(safeAuthor.email) && isNonEmptyString(overrides[safeAuthor.email])) return overrides[safeAuthor.email];
|
|
15036
|
+
if (isNonEmptyString(safeAuthor.name) && isNonEmptyString(overrides[safeAuthor.name])) return overrides[safeAuthor.name];
|
|
15037
|
+
}
|
|
15038
|
+
if (resolve) try {
|
|
15039
|
+
const resolved = resolve(safeAuthor);
|
|
15040
|
+
if (isNonEmptyString(resolved)) return resolved;
|
|
15041
|
+
} catch {}
|
|
15042
|
+
return fallbackAuthorColor(safeAuthor);
|
|
15043
|
+
};
|
|
15044
|
+
};
|
|
15045
|
+
//#endregion
|
|
14973
15046
|
//#region src/components/CommentsLayer/floating-comment-positioning.js
|
|
14974
15047
|
var isPersistentReviewSidebarItem = (comment) => {
|
|
14975
15048
|
return Boolean(comment?.trackedChange);
|
|
@@ -16378,79 +16451,6 @@ var WhiteboardLayer_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
16378
16451
|
}
|
|
16379
16452
|
}, [["__scopeId", "data-v-54546c3d"]]);
|
|
16380
16453
|
//#endregion
|
|
16381
|
-
//#region ../layout-engine/contracts/src/author-colors.ts
|
|
16382
|
-
/**
|
|
16383
|
-
* Curated, high-contrast fallback palette. Used when neither `overrides` nor
|
|
16384
|
-
* `resolve` produces a color so imported/discovered authors the host did not
|
|
16385
|
-
* configure ahead of time still get a stable, distinct color.
|
|
16386
|
-
*/
|
|
16387
|
-
var FALLBACK_PALETTE = [
|
|
16388
|
-
"#1f6feb",
|
|
16389
|
-
"#d1242f",
|
|
16390
|
-
"#8250df",
|
|
16391
|
-
"#bf3989",
|
|
16392
|
-
"#1a7f37",
|
|
16393
|
-
"#9a6700",
|
|
16394
|
-
"#bc4c00",
|
|
16395
|
-
"#0969da",
|
|
16396
|
-
"#cf222e",
|
|
16397
|
-
"#6639ba",
|
|
16398
|
-
"#116329",
|
|
16399
|
-
"#7d4e00"
|
|
16400
|
-
];
|
|
16401
|
-
/** Stable identity string for an author (used for hashing + dedupe). */
|
|
16402
|
-
var authorIdentityKey = (author) => {
|
|
16403
|
-
if (!author) return "";
|
|
16404
|
-
return `${typeof author.name === "string" ? author.name : ""} ${typeof author.email === "string" ? author.email : ""}`;
|
|
16405
|
-
};
|
|
16406
|
-
/** Deterministic 32-bit FNV-1a hash of a string. */
|
|
16407
|
-
var hashString = (value) => {
|
|
16408
|
-
let hash = 2166136261;
|
|
16409
|
-
for (let i = 0; i < value.length; i += 1) {
|
|
16410
|
-
hash ^= value.charCodeAt(i);
|
|
16411
|
-
hash = Math.imul(hash, 16777619);
|
|
16412
|
-
}
|
|
16413
|
-
return hash >>> 0;
|
|
16414
|
-
};
|
|
16415
|
-
/**
|
|
16416
|
-
* Deterministic fallback color derived from the author identity. The same
|
|
16417
|
-
* identity always maps to the same palette entry, so colors stay stable across
|
|
16418
|
-
* reloads and across the paint / snapshot surfaces.
|
|
16419
|
-
*/
|
|
16420
|
-
var fallbackAuthorColor = (author) => {
|
|
16421
|
-
return FALLBACK_PALETTE[hashString(authorIdentityKey(author)) % FALLBACK_PALETTE.length];
|
|
16422
|
-
};
|
|
16423
|
-
var isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
|
|
16424
|
-
/**
|
|
16425
|
-
* Composes the host `authorColors` config into a single resolver.
|
|
16426
|
-
*
|
|
16427
|
-
* Resolution order per author:
|
|
16428
|
-
* 1. `overrides` by identity — `email` first, then `name` (exact match).
|
|
16429
|
-
* 2. `resolve(author)`.
|
|
16430
|
-
* 3. A deterministic fallback color from the author identity.
|
|
16431
|
-
*
|
|
16432
|
-
* Returns `undefined` when colors are disabled (`enabled === false`) or no
|
|
16433
|
-
* config was provided, so callers can leave the existing default palette in
|
|
16434
|
-
* place by simply not threading a resolver.
|
|
16435
|
-
*/
|
|
16436
|
-
var composeAuthorColorResolver = (config) => {
|
|
16437
|
-
if (!config || config.enabled === false) return void 0;
|
|
16438
|
-
const overrides = config.overrides && typeof config.overrides === "object" ? config.overrides : void 0;
|
|
16439
|
-
const resolve = typeof config.resolve === "function" ? config.resolve : void 0;
|
|
16440
|
-
return (author) => {
|
|
16441
|
-
const safeAuthor = author ?? {};
|
|
16442
|
-
if (overrides) {
|
|
16443
|
-
if (isNonEmptyString(safeAuthor.email) && isNonEmptyString(overrides[safeAuthor.email])) return overrides[safeAuthor.email];
|
|
16444
|
-
if (isNonEmptyString(safeAuthor.name) && isNonEmptyString(overrides[safeAuthor.name])) return overrides[safeAuthor.name];
|
|
16445
|
-
}
|
|
16446
|
-
if (resolve) try {
|
|
16447
|
-
const resolved = resolve(safeAuthor);
|
|
16448
|
-
if (isNonEmptyString(resolved)) return resolved;
|
|
16449
|
-
} catch {}
|
|
16450
|
-
return fallbackAuthorColor(safeAuthor);
|
|
16451
|
-
};
|
|
16452
|
-
};
|
|
16453
|
-
//#endregion
|
|
16454
16454
|
//#region src/components/HtmlViewer/HtmlViewer.vue
|
|
16455
16455
|
var _hoisted_1$20 = { class: "superdoc-html-viewer" };
|
|
16456
16456
|
var _hoisted_2$16 = { class: "superdoc-html-viewer__document" };
|
|
@@ -22131,7 +22131,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
22131
22131
|
executeAsync: (commandId, payload) => {
|
|
22132
22132
|
const ui = getSuperDocUI();
|
|
22133
22133
|
if (!ui) return Promise.resolve(UNAVAILABLE_COMMAND_RESULT);
|
|
22134
|
-
return ui
|
|
22134
|
+
return executeFirstPartyCommandAsync(ui, commandId, payload);
|
|
22135
22135
|
},
|
|
22136
22136
|
getState: (commandId) => getSuperDocUI()?.commands.get(commandId).getState() ?? UNAVAILABLE_COMMAND_STATE
|
|
22137
22137
|
},
|
|
@@ -22332,7 +22332,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
22332
22332
|
if (!payload) return;
|
|
22333
22333
|
clearV2EditorFailure(payload.documentId ?? null);
|
|
22334
22334
|
clearV2MutationRejectionNotifications(payload.documentId ?? null);
|
|
22335
|
-
const { host, mount, documentId, capabilities, editCommands, bindEditShortcuts, bindSessionShortcuts, commentsAdapter, trackedChangesAdapter, contextMenu, documentApi, documentMutationReadiness, documentApiUnavailableReason, pageMetrics, pageLayout, pageFurniture, presence, lock, connection, collaborationProvider, fonts, replaceFile, upgradeToCollaboration, documentOpenToken } = payload;
|
|
22335
|
+
const { host, firstPartyCommandMutation, mount, documentId, capabilities, editCommands, bindEditShortcuts, bindSessionShortcuts, commentsAdapter, trackedChangesAdapter, contextMenu, documentApi, documentMutationReadiness, documentApiUnavailableReason, pageMetrics, pageLayout, pageFurniture, presence, lock, connection, collaborationProvider, fonts, replaceFile, upgradeToCollaboration, documentOpenToken } = payload;
|
|
22336
22336
|
documentOpenTelemetry?.trackDocumentOpen(documentOpenToken ?? null, documentId ?? null);
|
|
22337
22337
|
const saveV2Bytes = createV2SaveQueue(async (saveOptions = {}) => {
|
|
22338
22338
|
if (!host || typeof host.save !== "function") throw new Error("v2-editor: save unavailable");
|
|
@@ -22648,6 +22648,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
22648
22648
|
if (doc) doc.provider = provider;
|
|
22649
22649
|
}
|
|
22650
22650
|
proxy.$superdoc.broadcastEditorCreate(facade);
|
|
22651
|
+
if (host && firstPartyCommandMutation) registerFirstPartyCommandMutation(proxy.$superdoc, host, firstPartyCommandMutation);
|
|
22651
22652
|
installV2CommandShortcutBinding({
|
|
22652
22653
|
documentId,
|
|
22653
22654
|
bindEditShortcuts
|
|
@@ -24455,7 +24456,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
24455
24456
|
], 38);
|
|
24456
24457
|
};
|
|
24457
24458
|
}
|
|
24458
|
-
}, [["__scopeId", "data-v-
|
|
24459
|
+
}, [["__scopeId", "data-v-202b7646"]]);
|
|
24459
24460
|
//#endregion
|
|
24460
24461
|
//#region src/core/create-app.js
|
|
24461
24462
|
var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
|
|
@@ -44299,7 +44300,7 @@ function executeCommand(ui, commandId, argument, options = {}) {
|
|
|
44299
44300
|
if (typeof ui.commands.has === "function" && !ui.commands.has(commandId)) return false;
|
|
44300
44301
|
const execute = typeof ui.commands.executeAsync === "function" ? ui.commands.executeAsync : ui.commands.execute;
|
|
44301
44302
|
if (typeof execute !== "function") return false;
|
|
44302
|
-
const result = argument === void 0 ? execute.call(ui.commands, commandId) : execute.call(ui.commands, commandId, argument);
|
|
44303
|
+
const result = options.firstParty ? executeFirstPartyCommandAsync(ui, commandId, argument) : argument === void 0 ? execute.call(ui.commands, commandId) : execute.call(ui.commands, commandId, argument);
|
|
44303
44304
|
const reportFailure = (settled) => {
|
|
44304
44305
|
if (!options.reportUnhandled || settled !== false) return;
|
|
44305
44306
|
options.onError?.(/* @__PURE__ */ new Error(`[superdoc toolbar] Command "${commandId}" did not run. Check that it is enabled and has the required input.`));
|
|
@@ -44947,6 +44948,7 @@ var BuiltInToolbar = class extends import_eventemitter3.default {
|
|
|
44947
44948
|
const name = item?.name?.value;
|
|
44948
44949
|
if (!name) return false;
|
|
44949
44950
|
const callbacks = {
|
|
44951
|
+
firstParty: true,
|
|
44950
44952
|
onSettled: () => this.updateToolbarState(),
|
|
44951
44953
|
onError: (error) => this.#emitCommandException(error, name)
|
|
44952
44954
|
};
|
|
@@ -44975,6 +44977,7 @@ var BuiltInToolbar = class extends import_eventemitter3.default {
|
|
|
44975
44977
|
onPick: async (file) => {
|
|
44976
44978
|
const src = await resolveImageSrc(file, this.superdoc?.config?.handleImageUpload);
|
|
44977
44979
|
executeCommand(this.ui, "image", { src }, {
|
|
44980
|
+
firstParty: true,
|
|
44978
44981
|
onSettled: () => this.updateToolbarState(),
|
|
44979
44982
|
onError: (error) => this.#emitCommandException(error, "image")
|
|
44980
44983
|
});
|
|
@@ -45677,7 +45680,7 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
45677
45680
|
this.config.colors = shuffleArray(this.config.colors);
|
|
45678
45681
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
45679
45682
|
this.colorIndex = 0;
|
|
45680
|
-
this.version = "2.18.0-next.
|
|
45683
|
+
this.version = "2.18.0-next.14";
|
|
45681
45684
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
45682
45685
|
this.superdocId = config.superdocId || v4();
|
|
45683
45686
|
this.colors = this.config.colors ?? [];
|