@superdoc-dev/cli 0.5.0-next.26 → 0.5.0-next.27
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 +288 -476
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -172583,7 +172583,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
|
|
|
172583
172583
|
init_remark_gfm_z_sDF4ss_es();
|
|
172584
172584
|
});
|
|
172585
172585
|
|
|
172586
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
172586
|
+
// ../../packages/superdoc/dist/chunks/src-9QyvRUxO.es.js
|
|
172587
172587
|
function deleteProps(obj, propOrProps) {
|
|
172588
172588
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
172589
172589
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -219614,6 +219614,23 @@ function findSliceAtPosition(slices, pmPos) {
|
|
|
219614
219614
|
}
|
|
219615
219615
|
return null;
|
|
219616
219616
|
}
|
|
219617
|
+
function resolveLayout(input2) {
|
|
219618
|
+
const { layout, flowMode } = input2;
|
|
219619
|
+
const pages = layout.pages.map((page, index2) => ({
|
|
219620
|
+
id: `page-${index2}`,
|
|
219621
|
+
index: index2,
|
|
219622
|
+
number: page.number,
|
|
219623
|
+
width: page.size?.w ?? layout.pageSize.w,
|
|
219624
|
+
height: page.size?.h ?? layout.pageSize.h,
|
|
219625
|
+
items: []
|
|
219626
|
+
}));
|
|
219627
|
+
return {
|
|
219628
|
+
version: 1,
|
|
219629
|
+
flowMode,
|
|
219630
|
+
pageGap: layout.pageGap ?? 0,
|
|
219631
|
+
pages
|
|
219632
|
+
};
|
|
219633
|
+
}
|
|
219617
219634
|
function getMeasurementContext() {
|
|
219618
219635
|
if (measurementCtx)
|
|
219619
219636
|
return measurementCtx;
|
|
@@ -219906,457 +219923,6 @@ function findCharacterAtX(block, line, x, pmStart, availableWidthOverride, align
|
|
|
219906
219923
|
pmPosition
|
|
219907
219924
|
};
|
|
219908
219925
|
}
|
|
219909
|
-
function isRtlLine(lineEl) {
|
|
219910
|
-
return getComputedStyle(lineEl).direction === "rtl";
|
|
219911
|
-
}
|
|
219912
|
-
function isVisibleRect(rect) {
|
|
219913
|
-
return rect.width > 0 && rect.height > 0;
|
|
219914
|
-
}
|
|
219915
|
-
function clickToPositionDom$1(domContainer, clientX, clientY) {
|
|
219916
|
-
log2("=== clickToPositionDom START ===");
|
|
219917
|
-
log2("Input coords:", {
|
|
219918
|
-
clientX,
|
|
219919
|
-
clientY
|
|
219920
|
-
});
|
|
219921
|
-
const pageEl = findPageElement$1(domContainer, clientX, clientY);
|
|
219922
|
-
if (!pageEl) {
|
|
219923
|
-
log2("No page element found");
|
|
219924
|
-
return null;
|
|
219925
|
-
}
|
|
219926
|
-
const pageRect = pageEl.getBoundingClientRect();
|
|
219927
|
-
const pageLocalX = clientX - pageRect.left;
|
|
219928
|
-
const pageLocalY = clientY - pageRect.top;
|
|
219929
|
-
const viewX = pageRect.left + pageLocalX;
|
|
219930
|
-
const viewY = pageRect.top + pageLocalY;
|
|
219931
|
-
log2("Page found:", {
|
|
219932
|
-
pageIndex: pageEl.dataset.pageIndex,
|
|
219933
|
-
pageRect: {
|
|
219934
|
-
left: pageRect.left,
|
|
219935
|
-
top: pageRect.top,
|
|
219936
|
-
width: pageRect.width,
|
|
219937
|
-
height: pageRect.height
|
|
219938
|
-
},
|
|
219939
|
-
viewCoords: {
|
|
219940
|
-
viewX,
|
|
219941
|
-
viewY
|
|
219942
|
-
}
|
|
219943
|
-
});
|
|
219944
|
-
let hitChain = [];
|
|
219945
|
-
const doc$12 = document;
|
|
219946
|
-
const hasElementsFromPoint = typeof doc$12.elementsFromPoint === "function";
|
|
219947
|
-
if (hasElementsFromPoint)
|
|
219948
|
-
try {
|
|
219949
|
-
hitChain = doc$12.elementsFromPoint(viewX, viewY) ?? [];
|
|
219950
|
-
} catch {}
|
|
219951
|
-
if (!Array.isArray(hitChain)) {
|
|
219952
|
-
log2("elementsFromPoint returned non-array");
|
|
219953
|
-
return null;
|
|
219954
|
-
}
|
|
219955
|
-
const hitChainData = hitChain.map((el) => {
|
|
219956
|
-
const rect = el.getBoundingClientRect();
|
|
219957
|
-
return {
|
|
219958
|
-
tag: el.tagName,
|
|
219959
|
-
classes: el.className,
|
|
219960
|
-
blockId: el.dataset?.blockId,
|
|
219961
|
-
pmStart: el.dataset?.pmStart,
|
|
219962
|
-
pmEnd: el.dataset?.pmEnd,
|
|
219963
|
-
rect: {
|
|
219964
|
-
top: Math.round(rect.top),
|
|
219965
|
-
bottom: Math.round(rect.bottom),
|
|
219966
|
-
left: Math.round(rect.left),
|
|
219967
|
-
right: Math.round(rect.right),
|
|
219968
|
-
height: Math.round(rect.height)
|
|
219969
|
-
}
|
|
219970
|
-
};
|
|
219971
|
-
});
|
|
219972
|
-
log2("Hit chain elements:", JSON.stringify(hitChainData, null, 2));
|
|
219973
|
-
const fragmentData = Array.from(pageEl.querySelectorAll(`.${CLASS_NAMES.fragment}`)).map((el) => {
|
|
219974
|
-
const rect = el.getBoundingClientRect();
|
|
219975
|
-
return {
|
|
219976
|
-
blockId: el.dataset.blockId,
|
|
219977
|
-
pmStart: el.dataset.pmStart,
|
|
219978
|
-
pmEnd: el.dataset.pmEnd,
|
|
219979
|
-
rect: {
|
|
219980
|
-
top: Math.round(rect.top),
|
|
219981
|
-
bottom: Math.round(rect.bottom),
|
|
219982
|
-
left: Math.round(rect.left),
|
|
219983
|
-
right: Math.round(rect.right),
|
|
219984
|
-
height: Math.round(rect.height)
|
|
219985
|
-
}
|
|
219986
|
-
};
|
|
219987
|
-
});
|
|
219988
|
-
log2("All fragments on page:", JSON.stringify(fragmentData, null, 2));
|
|
219989
|
-
const fragmentEl = hitChain.find((el) => el.classList?.contains?.(CLASS_NAMES.fragment));
|
|
219990
|
-
if (!fragmentEl) {
|
|
219991
|
-
if (hasElementsFromPoint) {
|
|
219992
|
-
log2("No fragment found in hit chain; returning null to allow geometry mapping");
|
|
219993
|
-
return null;
|
|
219994
|
-
}
|
|
219995
|
-
const fallbackFragment = pageEl.querySelector(`.${CLASS_NAMES.fragment}`);
|
|
219996
|
-
if (!fallbackFragment) {
|
|
219997
|
-
log2("No fragment found in hit chain or fallback");
|
|
219998
|
-
return null;
|
|
219999
|
-
}
|
|
220000
|
-
log2("Using fallback fragment (no elementsFromPoint):", {
|
|
220001
|
-
blockId: fallbackFragment.dataset.blockId,
|
|
220002
|
-
pmStart: fallbackFragment.dataset.pmStart,
|
|
220003
|
-
pmEnd: fallbackFragment.dataset.pmEnd
|
|
220004
|
-
});
|
|
220005
|
-
const result$1 = processFragment(fallbackFragment, viewX, viewY);
|
|
220006
|
-
log2("=== clickToPositionDom END (fallback) ===", { result: result$1 });
|
|
220007
|
-
return result$1;
|
|
220008
|
-
}
|
|
220009
|
-
log2("Fragment found:", {
|
|
220010
|
-
blockId: fragmentEl.dataset.blockId,
|
|
220011
|
-
pmStart: fragmentEl.dataset.pmStart,
|
|
220012
|
-
pmEnd: fragmentEl.dataset.pmEnd
|
|
220013
|
-
});
|
|
220014
|
-
const hitChainLine = hitChain.find((el) => el.classList?.contains?.(CLASS_NAMES.line) && el.dataset?.pmStart !== undefined && el.dataset?.pmEnd !== undefined);
|
|
220015
|
-
if (hitChainLine) {
|
|
220016
|
-
log2("Using hit chain line directly:", {
|
|
220017
|
-
pmStart: hitChainLine.dataset.pmStart,
|
|
220018
|
-
pmEnd: hitChainLine.dataset.pmEnd
|
|
220019
|
-
});
|
|
220020
|
-
const result$1 = processLineElement(hitChainLine, viewX);
|
|
220021
|
-
log2("=== clickToPositionDom END (hitChainLine) ===", { result: result$1 });
|
|
220022
|
-
return result$1;
|
|
220023
|
-
}
|
|
220024
|
-
if (fragmentEl.classList.contains(CLASS_NAMES.tableFragment)) {
|
|
220025
|
-
log2("Table fragment without line in hit chain, deferring to geometry fallback");
|
|
220026
|
-
return null;
|
|
220027
|
-
}
|
|
220028
|
-
const result = processFragment(fragmentEl, viewX, viewY);
|
|
220029
|
-
log2("=== clickToPositionDom END ===", { result });
|
|
220030
|
-
return result;
|
|
220031
|
-
}
|
|
220032
|
-
function findPageElement$1(domContainer, clientX, clientY) {
|
|
220033
|
-
if (domContainer.classList?.contains?.(CLASS_NAMES.page))
|
|
220034
|
-
return domContainer;
|
|
220035
|
-
const doc$12 = document;
|
|
220036
|
-
if (typeof doc$12.elementsFromPoint === "function")
|
|
220037
|
-
try {
|
|
220038
|
-
const hitChain = doc$12.elementsFromPoint(clientX, clientY);
|
|
220039
|
-
if (Array.isArray(hitChain)) {
|
|
220040
|
-
const pageEl = hitChain.find((el) => el.classList?.contains?.(CLASS_NAMES.page));
|
|
220041
|
-
if (pageEl)
|
|
220042
|
-
return pageEl;
|
|
220043
|
-
}
|
|
220044
|
-
} catch {}
|
|
220045
|
-
const pages = Array.from(domContainer.querySelectorAll(`.${CLASS_NAMES.page}`));
|
|
220046
|
-
for (const page of pages) {
|
|
220047
|
-
const rect = page.getBoundingClientRect();
|
|
220048
|
-
if (clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom)
|
|
220049
|
-
return page;
|
|
220050
|
-
}
|
|
220051
|
-
if (pages.length > 0)
|
|
220052
|
-
return pages[0];
|
|
220053
|
-
return null;
|
|
220054
|
-
}
|
|
220055
|
-
function processFragment(fragmentEl, viewX, viewY) {
|
|
220056
|
-
log2("processFragment:", {
|
|
220057
|
-
viewX,
|
|
220058
|
-
viewY,
|
|
220059
|
-
blockId: fragmentEl.dataset.blockId
|
|
220060
|
-
});
|
|
220061
|
-
const lineEls = Array.from(fragmentEl.querySelectorAll(`.${CLASS_NAMES.line}`));
|
|
220062
|
-
log2("Lines in fragment:", lineEls.map((el, i4) => {
|
|
220063
|
-
const rect = el.getBoundingClientRect();
|
|
220064
|
-
return {
|
|
220065
|
-
index: i4,
|
|
220066
|
-
pmStart: el.dataset.pmStart,
|
|
220067
|
-
pmEnd: el.dataset.pmEnd,
|
|
220068
|
-
rect: {
|
|
220069
|
-
top: rect.top,
|
|
220070
|
-
bottom: rect.bottom,
|
|
220071
|
-
left: rect.left,
|
|
220072
|
-
right: rect.right
|
|
220073
|
-
}
|
|
220074
|
-
};
|
|
220075
|
-
}));
|
|
220076
|
-
if (lineEls.length === 0) {
|
|
220077
|
-
log2("No lines in fragment");
|
|
220078
|
-
return null;
|
|
220079
|
-
}
|
|
220080
|
-
const lineEl = findLineAtY(lineEls, viewY);
|
|
220081
|
-
if (!lineEl) {
|
|
220082
|
-
log2("No line found at Y:", viewY);
|
|
220083
|
-
return null;
|
|
220084
|
-
}
|
|
220085
|
-
const lineStart = Number(lineEl.dataset.pmStart ?? "NaN");
|
|
220086
|
-
const lineEnd = Number(lineEl.dataset.pmEnd ?? "NaN");
|
|
220087
|
-
const lineRect = lineEl.getBoundingClientRect();
|
|
220088
|
-
log2("Selected line:", {
|
|
220089
|
-
pmStart: lineStart,
|
|
220090
|
-
pmEnd: lineEnd,
|
|
220091
|
-
rect: {
|
|
220092
|
-
top: lineRect.top,
|
|
220093
|
-
bottom: lineRect.bottom,
|
|
220094
|
-
left: lineRect.left,
|
|
220095
|
-
right: lineRect.right
|
|
220096
|
-
}
|
|
220097
|
-
});
|
|
220098
|
-
if (!Number.isFinite(lineStart) || !Number.isFinite(lineEnd)) {
|
|
220099
|
-
log2("Line has invalid PM positions");
|
|
220100
|
-
return null;
|
|
220101
|
-
}
|
|
220102
|
-
const spanEls = Array.from(lineEl.querySelectorAll("span, a")).filter((el) => el.dataset.pmStart !== undefined && el.dataset.pmEnd !== undefined && !el.classList.contains(DOM_CLASS_NAMES.INLINE_SDT_WRAPPER));
|
|
220103
|
-
log2("Spans/anchors in line:", spanEls.map((el, i4) => {
|
|
220104
|
-
const rect = el.getBoundingClientRect();
|
|
220105
|
-
return {
|
|
220106
|
-
index: i4,
|
|
220107
|
-
tag: el.tagName,
|
|
220108
|
-
pmStart: el.dataset.pmStart,
|
|
220109
|
-
pmEnd: el.dataset.pmEnd,
|
|
220110
|
-
text: el.textContent?.substring(0, 20) + (el.textContent && el.textContent.length > 20 ? "..." : ""),
|
|
220111
|
-
visibility: el.style.visibility,
|
|
220112
|
-
rect: {
|
|
220113
|
-
left: rect.left,
|
|
220114
|
-
right: rect.right,
|
|
220115
|
-
width: rect.width
|
|
220116
|
-
}
|
|
220117
|
-
};
|
|
220118
|
-
}));
|
|
220119
|
-
return resolveLinePosition(lineEl, lineStart, lineEnd, spanEls, viewX);
|
|
220120
|
-
}
|
|
220121
|
-
function mapCharIndexToPm(spanStart, spanEnd, textLength, charIndex) {
|
|
220122
|
-
if (!Number.isFinite(spanStart) || !Number.isFinite(spanEnd))
|
|
220123
|
-
return spanStart;
|
|
220124
|
-
if (textLength <= 0)
|
|
220125
|
-
return spanStart;
|
|
220126
|
-
const pmRange = spanEnd - spanStart;
|
|
220127
|
-
if (!Number.isFinite(pmRange) || pmRange <= 0)
|
|
220128
|
-
return spanStart;
|
|
220129
|
-
if (pmRange === textLength) {
|
|
220130
|
-
const mapped = spanStart + charIndex;
|
|
220131
|
-
return Math.min(spanEnd, Math.max(spanStart, mapped));
|
|
220132
|
-
}
|
|
220133
|
-
return charIndex / textLength <= 0.5 ? spanStart : spanEnd;
|
|
220134
|
-
}
|
|
220135
|
-
function processLineElement(lineEl, viewX) {
|
|
220136
|
-
const lineStart = Number(lineEl.dataset.pmStart ?? "NaN");
|
|
220137
|
-
const lineEnd = Number(lineEl.dataset.pmEnd ?? "NaN");
|
|
220138
|
-
const lineRect = lineEl.getBoundingClientRect();
|
|
220139
|
-
log2("processLineElement:", {
|
|
220140
|
-
pmStart: lineStart,
|
|
220141
|
-
pmEnd: lineEnd,
|
|
220142
|
-
rect: {
|
|
220143
|
-
top: lineRect.top,
|
|
220144
|
-
bottom: lineRect.bottom,
|
|
220145
|
-
left: lineRect.left,
|
|
220146
|
-
right: lineRect.right
|
|
220147
|
-
}
|
|
220148
|
-
});
|
|
220149
|
-
if (!Number.isFinite(lineStart) || !Number.isFinite(lineEnd)) {
|
|
220150
|
-
log2("Line has invalid PM positions");
|
|
220151
|
-
return null;
|
|
220152
|
-
}
|
|
220153
|
-
const spanEls = Array.from(lineEl.querySelectorAll("span, a")).filter((el) => el.dataset.pmStart !== undefined && el.dataset.pmEnd !== undefined && !el.classList.contains(DOM_CLASS_NAMES.INLINE_SDT_WRAPPER));
|
|
220154
|
-
log2("Spans/anchors in line:", spanEls.map((el, i4) => {
|
|
220155
|
-
const rect = el.getBoundingClientRect();
|
|
220156
|
-
return {
|
|
220157
|
-
index: i4,
|
|
220158
|
-
tag: el.tagName,
|
|
220159
|
-
pmStart: el.dataset.pmStart,
|
|
220160
|
-
pmEnd: el.dataset.pmEnd,
|
|
220161
|
-
text: el.textContent?.substring(0, 20) + (el.textContent && el.textContent.length > 20 ? "..." : ""),
|
|
220162
|
-
visibility: el.style.visibility,
|
|
220163
|
-
rect: {
|
|
220164
|
-
left: rect.left,
|
|
220165
|
-
right: rect.right,
|
|
220166
|
-
width: rect.width
|
|
220167
|
-
}
|
|
220168
|
-
};
|
|
220169
|
-
}));
|
|
220170
|
-
return resolveLinePosition(lineEl, lineStart, lineEnd, spanEls, viewX);
|
|
220171
|
-
}
|
|
220172
|
-
function resolveLinePosition(lineEl, lineStart, lineEnd, spanEls, viewX) {
|
|
220173
|
-
if (spanEls.length === 0) {
|
|
220174
|
-
log2("No spans in line, returning lineStart:", lineStart);
|
|
220175
|
-
return lineStart;
|
|
220176
|
-
}
|
|
220177
|
-
const rtl = isRtlLine(lineEl);
|
|
220178
|
-
const allRects = spanEls.map((el) => el.getBoundingClientRect());
|
|
220179
|
-
const visibleRects = allRects.filter(isVisibleRect);
|
|
220180
|
-
const boundsRects = visibleRects.length > 0 ? visibleRects : allRects;
|
|
220181
|
-
const visualLeft = Math.min(...boundsRects.map((r$1) => r$1.left));
|
|
220182
|
-
const visualRight = Math.max(...boundsRects.map((r$1) => r$1.right));
|
|
220183
|
-
if (viewX <= visualLeft) {
|
|
220184
|
-
const pos$1 = rtl ? lineEnd : lineStart;
|
|
220185
|
-
log2("Click to visual left of all spans, returning:", pos$1);
|
|
220186
|
-
return pos$1;
|
|
220187
|
-
}
|
|
220188
|
-
if (viewX >= visualRight) {
|
|
220189
|
-
const pos$1 = rtl ? lineStart : lineEnd;
|
|
220190
|
-
log2("Click to visual right of all spans, returning:", pos$1);
|
|
220191
|
-
return pos$1;
|
|
220192
|
-
}
|
|
220193
|
-
const targetEl = findSpanAtX(spanEls, viewX);
|
|
220194
|
-
if (!targetEl) {
|
|
220195
|
-
log2("No target element found, returning lineStart:", lineStart);
|
|
220196
|
-
return lineStart;
|
|
220197
|
-
}
|
|
220198
|
-
const spanStart = Number(targetEl.dataset.pmStart ?? "NaN");
|
|
220199
|
-
const spanEnd = Number(targetEl.dataset.pmEnd ?? "NaN");
|
|
220200
|
-
const targetRect = targetEl.getBoundingClientRect();
|
|
220201
|
-
log2("Target element:", {
|
|
220202
|
-
tag: targetEl.tagName,
|
|
220203
|
-
pmStart: spanStart,
|
|
220204
|
-
pmEnd: spanEnd,
|
|
220205
|
-
text: targetEl.textContent?.substring(0, 30),
|
|
220206
|
-
visibility: targetEl.style.visibility,
|
|
220207
|
-
rect: {
|
|
220208
|
-
left: targetRect.left,
|
|
220209
|
-
right: targetRect.right,
|
|
220210
|
-
width: targetRect.width
|
|
220211
|
-
}
|
|
220212
|
-
});
|
|
220213
|
-
if (!Number.isFinite(spanStart) || !Number.isFinite(spanEnd)) {
|
|
220214
|
-
log2("Element has invalid PM positions");
|
|
220215
|
-
return null;
|
|
220216
|
-
}
|
|
220217
|
-
const firstChild = targetEl.firstChild;
|
|
220218
|
-
if (!firstChild || firstChild.nodeType !== Node.TEXT_NODE || !firstChild.textContent) {
|
|
220219
|
-
const closerToLeft = Math.abs(viewX - targetRect.left) <= Math.abs(viewX - targetRect.right);
|
|
220220
|
-
const snapPos = rtl ? closerToLeft ? spanEnd : spanStart : closerToLeft ? spanStart : spanEnd;
|
|
220221
|
-
log2("Empty/non-text element, snapping to:", {
|
|
220222
|
-
closerToLeft,
|
|
220223
|
-
rtl,
|
|
220224
|
-
snapPos
|
|
220225
|
-
});
|
|
220226
|
-
return snapPos;
|
|
220227
|
-
}
|
|
220228
|
-
const textNode = firstChild;
|
|
220229
|
-
const charIndex = findCharIndexAtX(textNode, viewX, rtl);
|
|
220230
|
-
const pos = mapCharIndexToPm(spanStart, spanEnd, textNode.length, charIndex);
|
|
220231
|
-
log2("Character position:", {
|
|
220232
|
-
charIndex,
|
|
220233
|
-
spanStart,
|
|
220234
|
-
rtl,
|
|
220235
|
-
finalPos: pos
|
|
220236
|
-
});
|
|
220237
|
-
return pos;
|
|
220238
|
-
}
|
|
220239
|
-
function findLineAtY(lineEls, viewY) {
|
|
220240
|
-
if (lineEls.length === 0)
|
|
220241
|
-
return null;
|
|
220242
|
-
for (let i4 = 0;i4 < lineEls.length; i4++) {
|
|
220243
|
-
const lineEl = lineEls[i4];
|
|
220244
|
-
const rect = lineEl.getBoundingClientRect();
|
|
220245
|
-
if (viewY >= rect.top && viewY <= rect.bottom) {
|
|
220246
|
-
log2("findLineAtY: Found line at index", i4, {
|
|
220247
|
-
pmStart: lineEl.dataset.pmStart,
|
|
220248
|
-
pmEnd: lineEl.dataset.pmEnd,
|
|
220249
|
-
rect: {
|
|
220250
|
-
top: rect.top,
|
|
220251
|
-
bottom: rect.bottom
|
|
220252
|
-
},
|
|
220253
|
-
viewY
|
|
220254
|
-
});
|
|
220255
|
-
return lineEl;
|
|
220256
|
-
}
|
|
220257
|
-
}
|
|
220258
|
-
const lastLine = lineEls[lineEls.length - 1];
|
|
220259
|
-
log2("findLineAtY: Y beyond all lines, using last line:", {
|
|
220260
|
-
pmStart: lastLine.dataset.pmStart,
|
|
220261
|
-
pmEnd: lastLine.dataset.pmEnd,
|
|
220262
|
-
viewY
|
|
220263
|
-
});
|
|
220264
|
-
return lastLine;
|
|
220265
|
-
}
|
|
220266
|
-
function findSpanAtX(spanEls, viewX) {
|
|
220267
|
-
if (spanEls.length === 0)
|
|
220268
|
-
return null;
|
|
220269
|
-
let targetSpan = spanEls[0];
|
|
220270
|
-
let minDist = Infinity;
|
|
220271
|
-
for (let i4 = 0;i4 < spanEls.length; i4++) {
|
|
220272
|
-
const span = spanEls[i4];
|
|
220273
|
-
const rect = span.getBoundingClientRect();
|
|
220274
|
-
if (!isVisibleRect(rect))
|
|
220275
|
-
continue;
|
|
220276
|
-
if (viewX >= rect.left && viewX <= rect.right) {
|
|
220277
|
-
log2("findSpanAtX: Found containing element at index", i4, {
|
|
220278
|
-
tag: span.tagName,
|
|
220279
|
-
pmStart: span.dataset.pmStart,
|
|
220280
|
-
pmEnd: span.dataset.pmEnd,
|
|
220281
|
-
rect: {
|
|
220282
|
-
left: rect.left,
|
|
220283
|
-
right: rect.right
|
|
220284
|
-
},
|
|
220285
|
-
viewX
|
|
220286
|
-
});
|
|
220287
|
-
return span;
|
|
220288
|
-
}
|
|
220289
|
-
const dist = Math.min(Math.abs(viewX - rect.left), Math.abs(viewX - rect.right));
|
|
220290
|
-
if (dist < minDist) {
|
|
220291
|
-
minDist = dist;
|
|
220292
|
-
targetSpan = span;
|
|
220293
|
-
}
|
|
220294
|
-
}
|
|
220295
|
-
log2("findSpanAtX: No containing element, using nearest:", {
|
|
220296
|
-
tag: targetSpan.tagName,
|
|
220297
|
-
pmStart: targetSpan.dataset.pmStart,
|
|
220298
|
-
pmEnd: targetSpan.dataset.pmEnd,
|
|
220299
|
-
viewX
|
|
220300
|
-
});
|
|
220301
|
-
return targetSpan;
|
|
220302
|
-
}
|
|
220303
|
-
function findCharIndexAtX(textNode, targetX, rtl) {
|
|
220304
|
-
const text5 = textNode.textContent ?? "";
|
|
220305
|
-
if (text5.length === 0)
|
|
220306
|
-
return 0;
|
|
220307
|
-
const container = textNode.parentElement;
|
|
220308
|
-
if (!container)
|
|
220309
|
-
return 0;
|
|
220310
|
-
const containerRect = container.getBoundingClientRect();
|
|
220311
|
-
const caretIndex = caretOffsetFromPoint(targetX, containerRect.top + containerRect.height / 2, textNode);
|
|
220312
|
-
if (caretIndex != null) {
|
|
220313
|
-
log2("findCharIndexAtX: caret API returned", caretIndex);
|
|
220314
|
-
return caretIndex;
|
|
220315
|
-
}
|
|
220316
|
-
log2("findCharIndexAtX: falling back to range binary search, rtl =", rtl);
|
|
220317
|
-
const range = document.createRange();
|
|
220318
|
-
const measureX = (i4) => {
|
|
220319
|
-
if (i4 <= 0)
|
|
220320
|
-
return rtl ? containerRect.right : containerRect.left;
|
|
220321
|
-
range.setStart(textNode, 0);
|
|
220322
|
-
range.setEnd(textNode, i4);
|
|
220323
|
-
const r$1 = range.getBoundingClientRect();
|
|
220324
|
-
return rtl ? r$1.left : r$1.right;
|
|
220325
|
-
};
|
|
220326
|
-
let lo = 0;
|
|
220327
|
-
let hi = text5.length;
|
|
220328
|
-
while (lo < hi) {
|
|
220329
|
-
const mid = Math.floor((lo + hi) / 2);
|
|
220330
|
-
const x = measureX(mid);
|
|
220331
|
-
if (rtl ? x > targetX : x < targetX)
|
|
220332
|
-
lo = mid + 1;
|
|
220333
|
-
else
|
|
220334
|
-
hi = mid;
|
|
220335
|
-
}
|
|
220336
|
-
const index2 = Math.max(0, Math.min(text5.length, lo));
|
|
220337
|
-
const xAt = measureX(index2);
|
|
220338
|
-
const distAt = Math.abs(xAt - targetX);
|
|
220339
|
-
if (index2 > 0) {
|
|
220340
|
-
const xPrev = measureX(index2 - 1);
|
|
220341
|
-
if (Math.abs(xPrev - targetX) < distAt)
|
|
220342
|
-
return index2 - 1;
|
|
220343
|
-
}
|
|
220344
|
-
return index2;
|
|
220345
|
-
}
|
|
220346
|
-
function caretOffsetFromPoint(x, y$1, expectedNode) {
|
|
220347
|
-
const doc$12 = document;
|
|
220348
|
-
if (typeof doc$12.caretPositionFromPoint === "function") {
|
|
220349
|
-
const cp = doc$12.caretPositionFromPoint(x, y$1);
|
|
220350
|
-
if (cp && cp.offsetNode === expectedNode)
|
|
220351
|
-
return cp.offset;
|
|
220352
|
-
}
|
|
220353
|
-
if (typeof doc$12.caretRangeFromPoint === "function") {
|
|
220354
|
-
const r$1 = doc$12.caretRangeFromPoint(x, y$1);
|
|
220355
|
-
if (r$1 && r$1.startContainer === expectedNode)
|
|
220356
|
-
return r$1.startOffset;
|
|
220357
|
-
}
|
|
220358
|
-
return null;
|
|
220359
|
-
}
|
|
220360
219926
|
function getWordLayoutConfig(block) {
|
|
220361
219927
|
if (!block || block.kind !== "paragraph")
|
|
220362
219928
|
return;
|
|
@@ -226499,32 +226065,116 @@ function renderRemoteSelection(options) {
|
|
|
226499
226065
|
});
|
|
226500
226066
|
options.renderCaret();
|
|
226501
226067
|
}
|
|
226068
|
+
function safeElementsFromPoint(doc$12, x, y$1) {
|
|
226069
|
+
if (typeof doc$12.elementsFromPoint !== "function")
|
|
226070
|
+
return [];
|
|
226071
|
+
try {
|
|
226072
|
+
return doc$12.elementsFromPoint(x, y$1) ?? [];
|
|
226073
|
+
} catch {
|
|
226074
|
+
return [];
|
|
226075
|
+
}
|
|
226076
|
+
}
|
|
226077
|
+
function hasElementsFromPoint(doc$12) {
|
|
226078
|
+
return typeof doc$12.elementsFromPoint === "function";
|
|
226079
|
+
}
|
|
226080
|
+
function getContainerDocument(domContainer) {
|
|
226081
|
+
return domContainer.ownerDocument ?? null;
|
|
226082
|
+
}
|
|
226083
|
+
function getNodeDocument(node3) {
|
|
226084
|
+
return node3.ownerDocument ?? null;
|
|
226085
|
+
}
|
|
226086
|
+
function createRangeForNode(node3) {
|
|
226087
|
+
return getNodeDocument(node3)?.createRange() ?? null;
|
|
226088
|
+
}
|
|
226089
|
+
function isVisibleRect(rect) {
|
|
226090
|
+
return rect.width > 0 && rect.height > 0;
|
|
226091
|
+
}
|
|
226092
|
+
function isRtlLine(lineEl) {
|
|
226093
|
+
return getComputedStyle(lineEl).direction === "rtl";
|
|
226094
|
+
}
|
|
226095
|
+
function readPmRange(el) {
|
|
226096
|
+
return {
|
|
226097
|
+
start: Number(el.dataset.pmStart ?? "NaN"),
|
|
226098
|
+
end: Number(el.dataset.pmEnd ?? "NaN")
|
|
226099
|
+
};
|
|
226100
|
+
}
|
|
226101
|
+
function getClickableSpans(lineEl) {
|
|
226102
|
+
return Array.from(lineEl.querySelectorAll("span, a")).filter((el) => el.dataset.pmStart !== undefined && el.dataset.pmEnd !== undefined && !el.classList.contains(CLASS.inlineSdtWrapper));
|
|
226103
|
+
}
|
|
226502
226104
|
function clickToPositionDom(domContainer, clientX, clientY) {
|
|
226503
|
-
|
|
226105
|
+
log2("=== clickToPositionDom START ===", {
|
|
226106
|
+
clientX,
|
|
226107
|
+
clientY
|
|
226108
|
+
});
|
|
226109
|
+
const pageEl = findPageElement(domContainer, clientX, clientY);
|
|
226110
|
+
if (!pageEl) {
|
|
226111
|
+
log2("No page element found");
|
|
226112
|
+
return null;
|
|
226113
|
+
}
|
|
226114
|
+
log2("Page found:", { pageIndex: pageEl.dataset.pageIndex });
|
|
226115
|
+
const doc$12 = getContainerDocument(domContainer);
|
|
226116
|
+
if (!doc$12) {
|
|
226117
|
+
log2("No owner document found");
|
|
226118
|
+
return null;
|
|
226119
|
+
}
|
|
226120
|
+
const hitChain = safeElementsFromPoint(doc$12, clientX, clientY);
|
|
226121
|
+
if (!Array.isArray(hitChain)) {
|
|
226122
|
+
log2("elementsFromPoint returned non-array");
|
|
226123
|
+
return null;
|
|
226124
|
+
}
|
|
226125
|
+
logHitChain(hitChain);
|
|
226126
|
+
const fragmentEl = hitChain.find((el) => el.classList?.contains?.(CLASS.fragment));
|
|
226127
|
+
if (!fragmentEl) {
|
|
226128
|
+
if (hasElementsFromPoint(doc$12)) {
|
|
226129
|
+
log2("No fragment in hit chain; deferring to geometry");
|
|
226130
|
+
return null;
|
|
226131
|
+
}
|
|
226132
|
+
const fallback = pageEl.querySelector(`.${CLASS.fragment}`);
|
|
226133
|
+
if (!fallback)
|
|
226134
|
+
return null;
|
|
226135
|
+
log2("Using fallback fragment (no elementsFromPoint)");
|
|
226136
|
+
return resolveFragment(fallback, clientX, clientY);
|
|
226137
|
+
}
|
|
226138
|
+
const hitChainLine = hitChain.find((el) => el.classList?.contains?.(CLASS.line) && el.dataset?.pmStart !== undefined && el.dataset?.pmEnd !== undefined);
|
|
226139
|
+
if (hitChainLine) {
|
|
226140
|
+
log2("Using hit-chain line directly");
|
|
226141
|
+
return resolveLineAtX(hitChainLine, clientX);
|
|
226142
|
+
}
|
|
226143
|
+
if (fragmentEl.classList.contains(CLASS.tableFragment)) {
|
|
226144
|
+
log2("Table fragment without line in hit chain — deferring to geometry");
|
|
226145
|
+
return null;
|
|
226146
|
+
}
|
|
226147
|
+
return resolveFragment(fragmentEl, clientX, clientY);
|
|
226504
226148
|
}
|
|
226505
226149
|
function findPageElement(domContainer, clientX, clientY) {
|
|
226506
|
-
|
|
226150
|
+
if (domContainer.classList?.contains?.(CLASS.page))
|
|
226151
|
+
return domContainer;
|
|
226152
|
+
const doc$12 = getContainerDocument(domContainer);
|
|
226153
|
+
if (!doc$12)
|
|
226154
|
+
return null;
|
|
226155
|
+
const pageFromHit = safeElementsFromPoint(doc$12, clientX, clientY).find((el) => el.classList?.contains?.(CLASS.page));
|
|
226156
|
+
if (pageFromHit)
|
|
226157
|
+
return pageFromHit;
|
|
226158
|
+
const pages = Array.from(domContainer.querySelectorAll(`.${CLASS.page}`));
|
|
226159
|
+
for (const page of pages) {
|
|
226160
|
+
const r$1 = page.getBoundingClientRect();
|
|
226161
|
+
if (clientX >= r$1.left && clientX <= r$1.right && clientY >= r$1.top && clientY <= r$1.bottom)
|
|
226162
|
+
return page;
|
|
226163
|
+
}
|
|
226164
|
+
return pages[0] ?? null;
|
|
226507
226165
|
}
|
|
226508
226166
|
function readLayoutEpochFromDom(domContainer, clientX, clientY) {
|
|
226509
|
-
const doc$12 = domContainer
|
|
226510
|
-
if (!doc$12 ||
|
|
226511
|
-
return null;
|
|
226512
|
-
let hitChain = [];
|
|
226513
|
-
try {
|
|
226514
|
-
hitChain = doc$12.elementsFromPoint(clientX, clientY) ?? [];
|
|
226515
|
-
} catch {
|
|
226167
|
+
const doc$12 = getContainerDocument(domContainer);
|
|
226168
|
+
if (!doc$12 || !hasElementsFromPoint(doc$12))
|
|
226516
226169
|
return null;
|
|
226517
|
-
|
|
226170
|
+
const hitChain = safeElementsFromPoint(doc$12, clientX, clientY);
|
|
226518
226171
|
let latestEpoch = null;
|
|
226519
226172
|
for (const el of hitChain) {
|
|
226520
226173
|
if (!(el instanceof HTMLElement))
|
|
226521
226174
|
continue;
|
|
226522
226175
|
if (!domContainer.contains(el))
|
|
226523
226176
|
continue;
|
|
226524
|
-
const
|
|
226525
|
-
if (raw == null)
|
|
226526
|
-
continue;
|
|
226527
|
-
const epoch = Number(raw);
|
|
226177
|
+
const epoch = Number(el.dataset.layoutEpoch);
|
|
226528
226178
|
if (!Number.isFinite(epoch))
|
|
226529
226179
|
continue;
|
|
226530
226180
|
if (latestEpoch == null || epoch > latestEpoch)
|
|
@@ -226532,6 +226182,153 @@ function readLayoutEpochFromDom(domContainer, clientX, clientY) {
|
|
|
226532
226182
|
}
|
|
226533
226183
|
return latestEpoch;
|
|
226534
226184
|
}
|
|
226185
|
+
function resolveFragment(fragmentEl, viewX, viewY) {
|
|
226186
|
+
const lineEls = Array.from(fragmentEl.querySelectorAll(`.${CLASS.line}`));
|
|
226187
|
+
if (lineEls.length === 0) {
|
|
226188
|
+
log2("No lines in fragment");
|
|
226189
|
+
return null;
|
|
226190
|
+
}
|
|
226191
|
+
const lineEl = findLineAtY(lineEls, viewY);
|
|
226192
|
+
if (!lineEl)
|
|
226193
|
+
return null;
|
|
226194
|
+
return resolveLineAtX(lineEl, viewX);
|
|
226195
|
+
}
|
|
226196
|
+
function resolveLineAtX(lineEl, viewX) {
|
|
226197
|
+
const { start: lineStart, end: lineEnd } = readPmRange(lineEl);
|
|
226198
|
+
if (!Number.isFinite(lineStart) || !Number.isFinite(lineEnd)) {
|
|
226199
|
+
log2("Line has invalid PM positions");
|
|
226200
|
+
return null;
|
|
226201
|
+
}
|
|
226202
|
+
return resolvePositionInLine(lineEl, lineStart, lineEnd, getClickableSpans(lineEl), viewX);
|
|
226203
|
+
}
|
|
226204
|
+
function resolvePositionInLine(lineEl, lineStart, lineEnd, spanEls, viewX) {
|
|
226205
|
+
if (spanEls.length === 0) {
|
|
226206
|
+
log2("No spans in line, returning lineStart:", lineStart);
|
|
226207
|
+
return lineStart;
|
|
226208
|
+
}
|
|
226209
|
+
const rtl = isRtlLine(lineEl);
|
|
226210
|
+
const allRects = spanEls.map((el) => el.getBoundingClientRect());
|
|
226211
|
+
const visibleRects = allRects.filter(isVisibleRect);
|
|
226212
|
+
const boundsRects = visibleRects.length > 0 ? visibleRects : allRects;
|
|
226213
|
+
const visualLeft = Math.min(...boundsRects.map((r$1) => r$1.left));
|
|
226214
|
+
const visualRight = Math.max(...boundsRects.map((r$1) => r$1.right));
|
|
226215
|
+
if (viewX <= visualLeft)
|
|
226216
|
+
return rtl ? lineEnd : lineStart;
|
|
226217
|
+
if (viewX >= visualRight)
|
|
226218
|
+
return rtl ? lineStart : lineEnd;
|
|
226219
|
+
const targetEl = findSpanAtX(spanEls, viewX);
|
|
226220
|
+
if (!targetEl)
|
|
226221
|
+
return lineStart;
|
|
226222
|
+
const { start: spanStart, end: spanEnd } = readPmRange(targetEl);
|
|
226223
|
+
if (!Number.isFinite(spanStart) || !Number.isFinite(spanEnd))
|
|
226224
|
+
return null;
|
|
226225
|
+
const firstChild = targetEl.firstChild;
|
|
226226
|
+
if (!firstChild || firstChild.nodeType !== Node.TEXT_NODE || !firstChild.textContent) {
|
|
226227
|
+
const targetRect = targetEl.getBoundingClientRect();
|
|
226228
|
+
const closerToLeft = Math.abs(viewX - targetRect.left) <= Math.abs(viewX - targetRect.right);
|
|
226229
|
+
return rtl ? closerToLeft ? spanEnd : spanStart : closerToLeft ? spanStart : spanEnd;
|
|
226230
|
+
}
|
|
226231
|
+
const textNode = firstChild;
|
|
226232
|
+
const charIndex = findCharIndexAtX(textNode, viewX, rtl);
|
|
226233
|
+
return mapCharIndexToPm(spanStart, spanEnd, textNode.length, charIndex);
|
|
226234
|
+
}
|
|
226235
|
+
function findLineAtY(lineEls, viewY) {
|
|
226236
|
+
if (lineEls.length === 0)
|
|
226237
|
+
return null;
|
|
226238
|
+
for (const lineEl of lineEls) {
|
|
226239
|
+
const r$1 = lineEl.getBoundingClientRect();
|
|
226240
|
+
if (viewY >= r$1.top && viewY <= r$1.bottom)
|
|
226241
|
+
return lineEl;
|
|
226242
|
+
}
|
|
226243
|
+
return lineEls[lineEls.length - 1];
|
|
226244
|
+
}
|
|
226245
|
+
function findSpanAtX(spanEls, viewX) {
|
|
226246
|
+
if (spanEls.length === 0)
|
|
226247
|
+
return null;
|
|
226248
|
+
let nearest = spanEls[0];
|
|
226249
|
+
let minDist = Infinity;
|
|
226250
|
+
for (const span of spanEls) {
|
|
226251
|
+
const r$1 = span.getBoundingClientRect();
|
|
226252
|
+
if (!isVisibleRect(r$1))
|
|
226253
|
+
continue;
|
|
226254
|
+
if (viewX >= r$1.left && viewX <= r$1.right)
|
|
226255
|
+
return span;
|
|
226256
|
+
const dist = Math.min(Math.abs(viewX - r$1.left), Math.abs(viewX - r$1.right));
|
|
226257
|
+
if (dist < minDist) {
|
|
226258
|
+
minDist = dist;
|
|
226259
|
+
nearest = span;
|
|
226260
|
+
}
|
|
226261
|
+
}
|
|
226262
|
+
return nearest;
|
|
226263
|
+
}
|
|
226264
|
+
function mapCharIndexToPm(spanStart, spanEnd, textLength, charIndex) {
|
|
226265
|
+
if (!Number.isFinite(spanStart) || !Number.isFinite(spanEnd))
|
|
226266
|
+
return spanStart;
|
|
226267
|
+
if (textLength <= 0)
|
|
226268
|
+
return spanStart;
|
|
226269
|
+
const pmRange = spanEnd - spanStart;
|
|
226270
|
+
if (!Number.isFinite(pmRange) || pmRange <= 0)
|
|
226271
|
+
return spanStart;
|
|
226272
|
+
if (pmRange === textLength)
|
|
226273
|
+
return Math.min(spanEnd, Math.max(spanStart, spanStart + charIndex));
|
|
226274
|
+
return charIndex / textLength <= 0.5 ? spanStart : spanEnd;
|
|
226275
|
+
}
|
|
226276
|
+
function findCharIndexAtX(textNode, targetX, rtl) {
|
|
226277
|
+
const text5 = textNode.textContent ?? "";
|
|
226278
|
+
if (text5.length === 0)
|
|
226279
|
+
return 0;
|
|
226280
|
+
const container = textNode.parentElement;
|
|
226281
|
+
if (!container)
|
|
226282
|
+
return 0;
|
|
226283
|
+
const containerRect = container.getBoundingClientRect();
|
|
226284
|
+
const caretIndex = caretOffsetFromPoint(targetX, containerRect.top + containerRect.height / 2, textNode);
|
|
226285
|
+
if (caretIndex != null)
|
|
226286
|
+
return caretIndex;
|
|
226287
|
+
return binarySearchCharIndex(textNode, text5.length, targetX, rtl, containerRect);
|
|
226288
|
+
}
|
|
226289
|
+
function caretOffsetFromPoint(x, y$1, expectedNode) {
|
|
226290
|
+
const doc$12 = getNodeDocument(expectedNode);
|
|
226291
|
+
if (!doc$12)
|
|
226292
|
+
return null;
|
|
226293
|
+
if (typeof doc$12.caretPositionFromPoint === "function") {
|
|
226294
|
+
const cp = doc$12.caretPositionFromPoint(x, y$1);
|
|
226295
|
+
if (cp && cp.offsetNode === expectedNode)
|
|
226296
|
+
return cp.offset;
|
|
226297
|
+
}
|
|
226298
|
+
if (typeof doc$12.caretRangeFromPoint === "function") {
|
|
226299
|
+
const r$1 = doc$12.caretRangeFromPoint(x, y$1);
|
|
226300
|
+
if (r$1 && r$1.startContainer === expectedNode)
|
|
226301
|
+
return r$1.startOffset;
|
|
226302
|
+
}
|
|
226303
|
+
return null;
|
|
226304
|
+
}
|
|
226305
|
+
function binarySearchCharIndex(textNode, length$12, targetX, rtl, containerRect) {
|
|
226306
|
+
const range = createRangeForNode(textNode);
|
|
226307
|
+
if (!range)
|
|
226308
|
+
return 0;
|
|
226309
|
+
const measureX = (i4) => {
|
|
226310
|
+
if (i4 <= 0)
|
|
226311
|
+
return rtl ? containerRect.right : containerRect.left;
|
|
226312
|
+
range.setStart(textNode, 0);
|
|
226313
|
+
range.setEnd(textNode, i4);
|
|
226314
|
+
const r$1 = range.getBoundingClientRect();
|
|
226315
|
+
return rtl ? r$1.left : r$1.right;
|
|
226316
|
+
};
|
|
226317
|
+
let lo = 0;
|
|
226318
|
+
let hi = length$12;
|
|
226319
|
+
while (lo < hi) {
|
|
226320
|
+
const mid = Math.floor((lo + hi) / 2);
|
|
226321
|
+
if (rtl ? measureX(mid) > targetX : measureX(mid) < targetX)
|
|
226322
|
+
lo = mid + 1;
|
|
226323
|
+
else
|
|
226324
|
+
hi = mid;
|
|
226325
|
+
}
|
|
226326
|
+
const index2 = Math.max(0, Math.min(length$12, lo));
|
|
226327
|
+
if (index2 > 0 && Math.abs(measureX(index2 - 1) - targetX) < Math.abs(measureX(index2) - targetX))
|
|
226328
|
+
return index2 - 1;
|
|
226329
|
+
return index2;
|
|
226330
|
+
}
|
|
226331
|
+
function logHitChain(hitChain) {}
|
|
226535
226332
|
function resolvePointerPositionHit(options) {
|
|
226536
226333
|
const { layout, blocks: blocks2, measures, containerPoint, domContainer, clientX, clientY, geometryHelper } = options;
|
|
226537
226334
|
const layoutEpoch = layout.layoutEpoch ?? 0;
|
|
@@ -242913,6 +242710,9 @@ var Node$13 = class Node$14 {
|
|
|
242913
242710
|
},
|
|
242914
242711
|
setScrollContainer(el) {
|
|
242915
242712
|
painter.setScrollContainer(el);
|
|
242713
|
+
},
|
|
242714
|
+
setResolvedLayout(resolvedLayout) {
|
|
242715
|
+
painter.setResolvedLayout(resolvedLayout);
|
|
242916
242716
|
}
|
|
242917
242717
|
};
|
|
242918
242718
|
}, VerticalNavigationPluginKey, createDefaultState = () => ({ goalX: null }), VerticalNavigation, createPermissionBlockMarkerNode = ({ name, attributes }) => Node$13.create({
|
|
@@ -246567,7 +246367,7 @@ var Node$13 = class Node$14 {
|
|
|
246567
246367
|
if (maxGaps === 0)
|
|
246568
246368
|
return 0;
|
|
246569
246369
|
return Math.min(Math.max(precedingChars, 0), maxGaps) * run2.letterSpacing;
|
|
246570
|
-
},
|
|
246370
|
+
}, defaultHeaderFooterIdentifier = () => ({
|
|
246571
246371
|
headerIds: {
|
|
246572
246372
|
default: null,
|
|
246573
246373
|
first: null,
|
|
@@ -251621,7 +251421,7 @@ var Node$13 = class Node$14 {
|
|
|
251621
251421
|
this.#onCursorsUpdate = null;
|
|
251622
251422
|
this.#isSetup = false;
|
|
251623
251423
|
}
|
|
251624
|
-
}, SEMANTIC_FOOTNOTES_HEADING_BLOCK_ID = "__sd_semantic_footnotes_heading", SEMANTIC_FOOTNOTE_BLOCK_ID_PREFIX = "__sd_semantic_footnote", MULTI_CLICK_TIME_THRESHOLD_MS = 400, MULTI_CLICK_DISTANCE_THRESHOLD_PX = 5, AUTO_SCROLL_EDGE_PX = 32, AUTO_SCROLL_MAX_SPEED_PX = 24, SCROLL_DETECTION_TOLERANCE_PX = 1, COMMENT_HIGHLIGHT_SELECTOR = ".superdoc-comment-highlight", clamp = (value, min$2, max$2) => Math.max(min$2, Math.min(max$2, value)), EditorInputManager = class {
|
|
251424
|
+
}, log2 = (...args$1) => {}, CLASS, SEMANTIC_FOOTNOTES_HEADING_BLOCK_ID = "__sd_semantic_footnotes_heading", SEMANTIC_FOOTNOTE_BLOCK_ID_PREFIX = "__sd_semantic_footnote", MULTI_CLICK_TIME_THRESHOLD_MS = 400, MULTI_CLICK_DISTANCE_THRESHOLD_PX = 5, AUTO_SCROLL_EDGE_PX = 32, AUTO_SCROLL_MAX_SPEED_PX = 24, SCROLL_DETECTION_TOLERANCE_PX = 1, COMMENT_HIGHLIGHT_SELECTOR = ".superdoc-comment-highlight", clamp = (value, min$2, max$2) => Math.max(min$2, Math.min(max$2, value)), EditorInputManager = class {
|
|
251625
251425
|
#deps = null;
|
|
251626
251426
|
#callbacks = {};
|
|
251627
251427
|
#isDragging = false;
|
|
@@ -255092,7 +254892,7 @@ var Node$13 = class Node$14 {
|
|
|
255092
254892
|
return;
|
|
255093
254893
|
console.log(...args$1);
|
|
255094
254894
|
}, 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;
|
|
255095
|
-
var
|
|
254895
|
+
var init_src_9QyvRUxO_es = __esm(() => {
|
|
255096
254896
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
255097
254897
|
init_SuperConverter_B9oNf3OB_es();
|
|
255098
254898
|
init_jszip_ChlR43oI_es();
|
|
@@ -273688,6 +273488,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
273688
273488
|
this.activeCommentId = null;
|
|
273689
273489
|
this.paintSnapshotBuilder = null;
|
|
273690
273490
|
this.lastPaintSnapshot = null;
|
|
273491
|
+
this.resolvedLayout = null;
|
|
273691
273492
|
this.options = options;
|
|
273692
273493
|
this.layoutMode = options.layoutMode ?? "vertical";
|
|
273693
273494
|
this.isSemanticFlow = (options.flowMode ?? "paginated") === "semantic";
|
|
@@ -273749,6 +273550,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
273749
273550
|
getActiveComment() {
|
|
273750
273551
|
return this.activeCommentId;
|
|
273751
273552
|
}
|
|
273553
|
+
setResolvedLayout(resolvedLayout) {
|
|
273554
|
+
this.resolvedLayout = resolvedLayout;
|
|
273555
|
+
}
|
|
273752
273556
|
getPaintSnapshot() {
|
|
273753
273557
|
return this.lastPaintSnapshot;
|
|
273754
273558
|
}
|
|
@@ -284363,12 +284167,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
284363
284167
|
]);
|
|
284364
284168
|
init_dist4();
|
|
284365
284169
|
SPACE_CHARS$1 = SPACE_CHARS;
|
|
284366
|
-
|
|
284367
|
-
page: DOM_CLASS_NAMES.PAGE,
|
|
284368
|
-
fragment: DOM_CLASS_NAMES.FRAGMENT,
|
|
284369
|
-
line: DOM_CLASS_NAMES.LINE,
|
|
284370
|
-
tableFragment: DOM_CLASS_NAMES.TABLE_FRAGMENT
|
|
284371
|
-
};
|
|
284170
|
+
DOM_CLASS_NAMES.PAGE, DOM_CLASS_NAMES.FRAGMENT, DOM_CLASS_NAMES.LINE, DOM_CLASS_NAMES.TABLE_FRAGMENT;
|
|
284372
284171
|
init_dist4();
|
|
284373
284172
|
FeatureFlags = {
|
|
284374
284173
|
NUMBERING_SECTION_AWARE: isEnabled("SD_NUMBERING_SECTION_AWARE", true),
|
|
@@ -284722,6 +284521,13 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
284722
284521
|
paragraphToFlowBlocks
|
|
284723
284522
|
};
|
|
284724
284523
|
DEFAULT_STALE_TIMEOUT_MS = 300 * 1000;
|
|
284524
|
+
CLASS = {
|
|
284525
|
+
page: DOM_CLASS_NAMES.PAGE,
|
|
284526
|
+
fragment: DOM_CLASS_NAMES.FRAGMENT,
|
|
284527
|
+
line: DOM_CLASS_NAMES.LINE,
|
|
284528
|
+
tableFragment: DOM_CLASS_NAMES.TABLE_FRAGMENT,
|
|
284529
|
+
inlineSdtWrapper: DOM_CLASS_NAMES.INLINE_SDT_WRAPPER
|
|
284530
|
+
};
|
|
284725
284531
|
SelectionSyncCoordinator = class extends EventEmitter2 {
|
|
284726
284532
|
#docEpoch = 0;
|
|
284727
284533
|
#layoutEpoch = 0;
|
|
@@ -287614,6 +287420,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
287614
287420
|
const previousMeasures = this.#layoutState.measures;
|
|
287615
287421
|
let layout;
|
|
287616
287422
|
let measures;
|
|
287423
|
+
let resolvedLayout;
|
|
287617
287424
|
let headerLayouts;
|
|
287618
287425
|
let footerLayouts;
|
|
287619
287426
|
let extraBlocks;
|
|
@@ -287640,6 +287447,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
287640
287447
|
extraMeasures = Array.isArray(result.extraMeasures) ? result.extraMeasures : undefined;
|
|
287641
287448
|
layout.pageGap = this.#getEffectivePageGap();
|
|
287642
287449
|
layout.layoutEpoch = layoutEpoch;
|
|
287450
|
+
resolvedLayout = resolveLayout({
|
|
287451
|
+
layout,
|
|
287452
|
+
flowMode: this.#layoutOptions.flowMode ?? "paginated"
|
|
287453
|
+
});
|
|
287643
287454
|
headerLayouts = result.headers;
|
|
287644
287455
|
footerLayouts = result.footers;
|
|
287645
287456
|
} catch (error3) {
|
|
@@ -287691,6 +287502,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
287691
287502
|
this.#updateDecorationProviders(layout);
|
|
287692
287503
|
}
|
|
287693
287504
|
const painter = this.#ensurePainter(blocksForLayout, measures);
|
|
287505
|
+
painter.setResolvedLayout?.(resolvedLayout);
|
|
287694
287506
|
if (!isSemanticFlow && typeof painter.setProviders === "function")
|
|
287695
287507
|
painter.setProviders(this.#headerFooterSession?.headerDecorationProvider, this.#headerFooterSession?.footerDecorationProvider);
|
|
287696
287508
|
const headerBlocks = [];
|
|
@@ -289304,7 +289116,7 @@ var init_zipper_YmNpPIyc_es = __esm(() => {
|
|
|
289304
289116
|
|
|
289305
289117
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
289306
289118
|
var init_super_editor_es = __esm(() => {
|
|
289307
|
-
|
|
289119
|
+
init_src_9QyvRUxO_es();
|
|
289308
289120
|
init_SuperConverter_B9oNf3OB_es();
|
|
289309
289121
|
init_jszip_ChlR43oI_es();
|
|
289310
289122
|
init_xml_js_40FWvL78_es();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.5.0-next.
|
|
3
|
+
"version": "0.5.0-next.27",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@superdoc-dev/cli-darwin-arm64": "0.5.0-next.
|
|
38
|
-
"@superdoc-dev/cli-darwin-x64": "0.5.0-next.
|
|
39
|
-
"@superdoc-dev/cli-linux-x64": "0.5.0-next.
|
|
40
|
-
"@superdoc-dev/cli-
|
|
41
|
-
"@superdoc-dev/cli-
|
|
37
|
+
"@superdoc-dev/cli-darwin-arm64": "0.5.0-next.27",
|
|
38
|
+
"@superdoc-dev/cli-darwin-x64": "0.5.0-next.27",
|
|
39
|
+
"@superdoc-dev/cli-linux-x64": "0.5.0-next.27",
|
|
40
|
+
"@superdoc-dev/cli-windows-x64": "0.5.0-next.27",
|
|
41
|
+
"@superdoc-dev/cli-linux-arm64": "0.5.0-next.27"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"predev": "node scripts/ensure-superdoc-build.js",
|