@superdoc-dev/cli 0.12.0-next.23 → 0.12.0-next.24
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.js +156 -5
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -218163,7 +218163,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
218163
218163
|
init_remark_gfm_BhnWr3yf_es();
|
|
218164
218164
|
});
|
|
218165
218165
|
|
|
218166
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
218166
|
+
// ../../packages/superdoc/dist/chunks/src-Tq4gtGIV.es.js
|
|
218167
218167
|
function deleteProps(obj, propOrProps) {
|
|
218168
218168
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
218169
218169
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -234382,6 +234382,95 @@ function buildCommentJsonFromText(text5) {
|
|
|
234382
234382
|
function isCommentResolved(entry) {
|
|
234383
234383
|
return Boolean(entry.isDone || entry.resolvedTime);
|
|
234384
234384
|
}
|
|
234385
|
+
function syncCommentEntitiesFromCollaboration(editor, entries2, options = {}) {
|
|
234386
|
+
const store = getCommentEntityStore(editor);
|
|
234387
|
+
const seen = /* @__PURE__ */ new Set;
|
|
234388
|
+
const upstreamIds = /* @__PURE__ */ new Set;
|
|
234389
|
+
const validEntries = [];
|
|
234390
|
+
for (const raw of entries2) {
|
|
234391
|
+
if (!raw || typeof raw !== "object")
|
|
234392
|
+
continue;
|
|
234393
|
+
if (raw.trackedChange === true)
|
|
234394
|
+
continue;
|
|
234395
|
+
const cid = toNonEmptyString$1(raw.commentId);
|
|
234396
|
+
const iid = toNonEmptyString$1(raw.importedId);
|
|
234397
|
+
if (cid)
|
|
234398
|
+
upstreamIds.add(cid);
|
|
234399
|
+
if (iid)
|
|
234400
|
+
upstreamIds.add(iid);
|
|
234401
|
+
validEntries.push(raw);
|
|
234402
|
+
}
|
|
234403
|
+
let changed = true;
|
|
234404
|
+
while (changed) {
|
|
234405
|
+
changed = false;
|
|
234406
|
+
for (const raw of validEntries) {
|
|
234407
|
+
const parentRef = toNonEmptyString$1(raw.parentCommentId);
|
|
234408
|
+
if (!parentRef)
|
|
234409
|
+
continue;
|
|
234410
|
+
if (upstreamIds.has(parentRef))
|
|
234411
|
+
continue;
|
|
234412
|
+
const cid = toNonEmptyString$1(raw.commentId);
|
|
234413
|
+
const iid = toNonEmptyString$1(raw.importedId);
|
|
234414
|
+
if (cid && upstreamIds.delete(cid))
|
|
234415
|
+
changed = true;
|
|
234416
|
+
if (iid && upstreamIds.delete(iid))
|
|
234417
|
+
changed = true;
|
|
234418
|
+
}
|
|
234419
|
+
}
|
|
234420
|
+
for (const raw of validEntries) {
|
|
234421
|
+
const commentId = toNonEmptyString$1(raw.commentId) ?? toNonEmptyString$1(raw.importedId);
|
|
234422
|
+
if (!commentId)
|
|
234423
|
+
continue;
|
|
234424
|
+
if (!upstreamIds.has(commentId))
|
|
234425
|
+
continue;
|
|
234426
|
+
seen.add(commentId);
|
|
234427
|
+
const patch3 = {};
|
|
234428
|
+
if (typeof raw.importedId === "string")
|
|
234429
|
+
patch3.importedId = raw.importedId;
|
|
234430
|
+
if (typeof raw.parentCommentId === "string")
|
|
234431
|
+
patch3.parentCommentId = raw.parentCommentId;
|
|
234432
|
+
const commentText = typeof raw.commentText === "string" ? raw.commentText : typeof raw.text === "string" ? raw.text : undefined;
|
|
234433
|
+
if (commentText !== undefined)
|
|
234434
|
+
patch3.commentText = commentText;
|
|
234435
|
+
if (raw.commentJSON !== undefined)
|
|
234436
|
+
patch3.commentJSON = raw.commentJSON;
|
|
234437
|
+
if (raw.elements !== undefined)
|
|
234438
|
+
patch3.elements = raw.elements;
|
|
234439
|
+
if (typeof raw.creatorName === "string")
|
|
234440
|
+
patch3.creatorName = raw.creatorName;
|
|
234441
|
+
if (typeof raw.creatorEmail === "string")
|
|
234442
|
+
patch3.creatorEmail = raw.creatorEmail;
|
|
234443
|
+
if (typeof raw.creatorImage === "string")
|
|
234444
|
+
patch3.creatorImage = raw.creatorImage;
|
|
234445
|
+
if (typeof raw.createdTime === "number")
|
|
234446
|
+
patch3.createdTime = raw.createdTime;
|
|
234447
|
+
if (typeof raw.isInternal === "boolean")
|
|
234448
|
+
patch3.isInternal = raw.isInternal;
|
|
234449
|
+
if (typeof raw.isDone === "boolean")
|
|
234450
|
+
patch3.isDone = raw.isDone;
|
|
234451
|
+
if (typeof raw.resolvedTime === "number")
|
|
234452
|
+
patch3.resolvedTime = raw.resolvedTime;
|
|
234453
|
+
if (raw.resolvedTime === null)
|
|
234454
|
+
patch3.resolvedTime = null;
|
|
234455
|
+
if (typeof raw.resolvedByEmail === "string")
|
|
234456
|
+
patch3.resolvedByEmail = raw.resolvedByEmail;
|
|
234457
|
+
if (typeof raw.resolvedByName === "string")
|
|
234458
|
+
patch3.resolvedByName = raw.resolvedByName;
|
|
234459
|
+
upsertCommentEntity(store, commentId, patch3);
|
|
234460
|
+
}
|
|
234461
|
+
if (options.previouslySynced) {
|
|
234462
|
+
for (const priorId of options.previouslySynced)
|
|
234463
|
+
if (!seen.has(priorId))
|
|
234464
|
+
removeCommentEntityTree(store, priorId);
|
|
234465
|
+
}
|
|
234466
|
+
return seen;
|
|
234467
|
+
}
|
|
234468
|
+
function toNonEmptyString$1(value) {
|
|
234469
|
+
if (typeof value !== "string")
|
|
234470
|
+
return;
|
|
234471
|
+
const trimmed = value.trim();
|
|
234472
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
234473
|
+
}
|
|
234385
234474
|
function toCommentInfo(entry, options = {}) {
|
|
234386
234475
|
const resolvedId = typeof entry.commentId === "string" ? entry.commentId : String(entry.importedId ?? "");
|
|
234387
234476
|
const status = options.status ?? (isCommentResolved(entry) ? "resolved" : "open");
|
|
@@ -234521,6 +234610,15 @@ function listCommentAnchorsSafe(editor) {
|
|
|
234521
234610
|
return [];
|
|
234522
234611
|
}
|
|
234523
234612
|
}
|
|
234613
|
+
function emitCommentLifecycleUpdate(editor, type, comment2) {
|
|
234614
|
+
const emitter = editor.emit;
|
|
234615
|
+
if (typeof emitter !== "function")
|
|
234616
|
+
return;
|
|
234617
|
+
emitter.call(editor, "commentsUpdate", {
|
|
234618
|
+
type,
|
|
234619
|
+
comment: comment2
|
|
234620
|
+
});
|
|
234621
|
+
}
|
|
234524
234622
|
function applyTextSelection(editor, from$1, to) {
|
|
234525
234623
|
const setTextSelection$1 = editor.commands?.setTextSelection;
|
|
234526
234624
|
if (typeof setTextSelection$1 === "function") {
|
|
@@ -235009,17 +235107,20 @@ function resolveCommentHandler(editor, input2, options) {
|
|
|
235009
235107
|
message: "Comment is already resolved."
|
|
235010
235108
|
}
|
|
235011
235109
|
};
|
|
235110
|
+
let resolvedTimestamp = null;
|
|
235012
235111
|
if (executeDomainCommand(editor, () => {
|
|
235013
235112
|
const didResolve = resolveComment({
|
|
235014
235113
|
commentId: identity.commentId,
|
|
235015
235114
|
importedId: identity.importedId
|
|
235016
235115
|
});
|
|
235017
|
-
if (didResolve)
|
|
235116
|
+
if (didResolve) {
|
|
235117
|
+
resolvedTimestamp = Date.now();
|
|
235018
235118
|
upsertCommentEntity(store, identity.commentId, {
|
|
235019
235119
|
importedId: identity.importedId,
|
|
235020
235120
|
isDone: true,
|
|
235021
|
-
resolvedTime:
|
|
235121
|
+
resolvedTime: resolvedTimestamp
|
|
235022
235122
|
});
|
|
235123
|
+
}
|
|
235023
235124
|
return Boolean(didResolve);
|
|
235024
235125
|
}, { expectedRevision: options?.expectedRevision }).steps[0]?.effect !== "changed")
|
|
235025
235126
|
return {
|
|
@@ -235029,6 +235130,12 @@ function resolveCommentHandler(editor, input2, options) {
|
|
|
235029
235130
|
message: "Comment resolve produced no change."
|
|
235030
235131
|
}
|
|
235031
235132
|
};
|
|
235133
|
+
emitCommentLifecycleUpdate(editor, "resolved", {
|
|
235134
|
+
commentId: identity.commentId,
|
|
235135
|
+
importedId: identity.importedId,
|
|
235136
|
+
isDone: true,
|
|
235137
|
+
resolvedTime: resolvedTimestamp
|
|
235138
|
+
});
|
|
235032
235139
|
return {
|
|
235033
235140
|
success: true,
|
|
235034
235141
|
updated: [toCommentAddress(identity.commentId)]
|
|
@@ -235073,6 +235180,12 @@ function reopenCommentHandler(editor, input2, options) {
|
|
|
235073
235180
|
message: "Comment reopen produced no change."
|
|
235074
235181
|
}
|
|
235075
235182
|
};
|
|
235183
|
+
emitCommentLifecycleUpdate(editor, "update", {
|
|
235184
|
+
commentId: identity.commentId,
|
|
235185
|
+
importedId: identity.importedId,
|
|
235186
|
+
isDone: false,
|
|
235187
|
+
resolvedTime: null
|
|
235188
|
+
});
|
|
235076
235189
|
return {
|
|
235077
235190
|
success: true,
|
|
235078
235191
|
updated: [toCommentAddress(identity.commentId)]
|
|
@@ -235107,6 +235220,11 @@ function removeCommentHandler(editor, input2, options) {
|
|
|
235107
235220
|
}
|
|
235108
235221
|
if (!removedIds.size && didRemove)
|
|
235109
235222
|
removedIds.add(identity.commentId);
|
|
235223
|
+
for (const removedId of removedIds)
|
|
235224
|
+
emitCommentLifecycleUpdate(editor, "deleted", {
|
|
235225
|
+
commentId: removedId,
|
|
235226
|
+
importedId: removedId === identity.commentId ? identity.importedId : undefined
|
|
235227
|
+
});
|
|
235110
235228
|
return {
|
|
235111
235229
|
success: true,
|
|
235112
235230
|
removed: Array.from(removedIds).map((id2) => toCommentAddress(id2))
|
|
@@ -306553,7 +306671,7 @@ menclose::after {
|
|
|
306553
306671
|
return;
|
|
306554
306672
|
console.log(...args$1);
|
|
306555
306673
|
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
|
|
306556
|
-
var
|
|
306674
|
+
var init_src_Tq4gtGIV_es = __esm(() => {
|
|
306557
306675
|
init_rolldown_runtime_Bg48TavK_es();
|
|
306558
306676
|
init_SuperConverter_BptSHzcb_es();
|
|
306559
306677
|
init_jszip_C49i9kUs_es();
|
|
@@ -344378,7 +344496,7 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
|
|
|
344378
344496
|
|
|
344379
344497
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
344380
344498
|
var init_super_editor_es = __esm(() => {
|
|
344381
|
-
|
|
344499
|
+
init_src_Tq4gtGIV_es();
|
|
344382
344500
|
init_SuperConverter_BptSHzcb_es();
|
|
344383
344501
|
init_jszip_C49i9kUs_es();
|
|
344384
344502
|
init_xml_js_CqGKpaft_es();
|
|
@@ -392527,6 +392645,33 @@ function buildHeadlessCommentBridge(ydoc, user) {
|
|
|
392527
392645
|
}
|
|
392528
392646
|
}, { user: userOrigin });
|
|
392529
392647
|
}
|
|
392648
|
+
let attachedEditor = null;
|
|
392649
|
+
let yArrayObserver = null;
|
|
392650
|
+
let previousSyncedIds = new Set;
|
|
392651
|
+
function syncYArrayToStore() {
|
|
392652
|
+
if (!attachedEditor)
|
|
392653
|
+
return;
|
|
392654
|
+
const entries3 = yArray.toJSON();
|
|
392655
|
+
previousSyncedIds = syncCommentEntitiesFromCollaboration(attachedEditor, entries3, {
|
|
392656
|
+
previouslySynced: previousSyncedIds
|
|
392657
|
+
});
|
|
392658
|
+
}
|
|
392659
|
+
function detachYArrayObserver() {
|
|
392660
|
+
if (yArrayObserver) {
|
|
392661
|
+
yArray.unobserve(yArrayObserver);
|
|
392662
|
+
yArrayObserver = null;
|
|
392663
|
+
}
|
|
392664
|
+
}
|
|
392665
|
+
function attachEditor(editor) {
|
|
392666
|
+
detachYArrayObserver();
|
|
392667
|
+
attachedEditor = editor;
|
|
392668
|
+
previousSyncedIds = new Set;
|
|
392669
|
+
syncYArrayToStore();
|
|
392670
|
+
yArrayObserver = () => {
|
|
392671
|
+
syncYArrayToStore();
|
|
392672
|
+
};
|
|
392673
|
+
yArray.observe(yArrayObserver);
|
|
392674
|
+
}
|
|
392530
392675
|
return {
|
|
392531
392676
|
editorOptions: {
|
|
392532
392677
|
isCommentsEnabled: true,
|
|
@@ -392534,13 +392679,18 @@ function buildHeadlessCommentBridge(ydoc, user) {
|
|
|
392534
392679
|
onCommentsUpdate: handleCommentsUpdate,
|
|
392535
392680
|
onCommentsLoaded: handleCommentsLoaded
|
|
392536
392681
|
},
|
|
392682
|
+
attachEditor,
|
|
392537
392683
|
dispose() {
|
|
392684
|
+
detachYArrayObserver();
|
|
392685
|
+
attachedEditor = null;
|
|
392686
|
+
previousSyncedIds = new Set;
|
|
392538
392687
|
registry3.clear();
|
|
392539
392688
|
}
|
|
392540
392689
|
};
|
|
392541
392690
|
}
|
|
392542
392691
|
var init_headless_comment_bridge = __esm(() => {
|
|
392543
392692
|
init_yjs();
|
|
392693
|
+
init_super_editor_es();
|
|
392544
392694
|
});
|
|
392545
392695
|
|
|
392546
392696
|
// src/lib/document.ts
|
|
@@ -392655,6 +392805,7 @@ async function openDocument(doc3, io, options2 = {}) {
|
|
|
392655
392805
|
});
|
|
392656
392806
|
}
|
|
392657
392807
|
initPartsRuntime(editor);
|
|
392808
|
+
commentBridge?.attachEditor(editor);
|
|
392658
392809
|
if (markdownOverride != null) {
|
|
392659
392810
|
try {
|
|
392660
392811
|
const { doc: newDoc } = markdownToPmDoc(markdownOverride, editor);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.12.0-next.
|
|
3
|
+
"version": "0.12.0-next.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
"@types/ws": "^8.5.13",
|
|
26
26
|
"typescript": "^5.9.2",
|
|
27
27
|
"@superdoc/document-api": "0.0.1",
|
|
28
|
+
"@superdoc/super-editor": "0.0.1",
|
|
28
29
|
"@superdoc/pm-adapter": "0.0.0",
|
|
29
|
-
"superdoc": "1.34.0"
|
|
30
|
-
"@superdoc/super-editor": "0.0.1"
|
|
30
|
+
"superdoc": "1.34.0"
|
|
31
31
|
},
|
|
32
32
|
"module": "src/index.ts",
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@superdoc-dev/cli-darwin-arm64": "0.12.0-next.
|
|
38
|
-
"@superdoc-dev/cli-
|
|
39
|
-
"@superdoc-dev/cli-
|
|
40
|
-
"@superdoc-dev/cli-linux-arm64": "0.12.0-next.
|
|
41
|
-
"@superdoc-dev/cli-windows-x64": "0.12.0-next.
|
|
37
|
+
"@superdoc-dev/cli-darwin-arm64": "0.12.0-next.24",
|
|
38
|
+
"@superdoc-dev/cli-darwin-x64": "0.12.0-next.24",
|
|
39
|
+
"@superdoc-dev/cli-linux-x64": "0.12.0-next.24",
|
|
40
|
+
"@superdoc-dev/cli-linux-arm64": "0.12.0-next.24",
|
|
41
|
+
"@superdoc-dev/cli-windows-x64": "0.12.0-next.24"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"predev": "node scripts/ensure-superdoc-build.js",
|