@extend-ai/react-docx 0.7.2 → 0.7.3
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.cjs +61 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +61 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4581,11 +4581,13 @@ var BASE_DOC_STYLE = {
|
|
|
4581
4581
|
transition: "box-shadow 0.2s ease"
|
|
4582
4582
|
};
|
|
4583
4583
|
var TRACKED_CHANGE_GUTTER_WIDTH_PX = 300;
|
|
4584
|
-
var TRACKED_CHANGE_GUTTER_CARD_LEFT_PX =
|
|
4584
|
+
var TRACKED_CHANGE_GUTTER_CARD_LEFT_PX = 48;
|
|
4585
4585
|
var TRACKED_CHANGE_GUTTER_CARD_RIGHT_PX = 12;
|
|
4586
4586
|
var TRACKED_CHANGE_GUTTER_CARD_GAP_PX = 4;
|
|
4587
4587
|
var TRACKED_CHANGE_GUTTER_CARD_MIN_HEIGHT_PX = 30;
|
|
4588
4588
|
var TRACKED_CHANGE_GUTTER_BEND_OFFSET_PX = 8;
|
|
4589
|
+
var TRACKED_CHANGE_GUTTER_CONNECTOR_LANE_GAP_PX = 7;
|
|
4590
|
+
var TRACKED_CHANGE_GUTTER_CONNECTOR_LANE_COUNT = 5;
|
|
4589
4591
|
var INITIAL_PAGINATION_STABILITY_IDLE_MS = 240;
|
|
4590
4592
|
function scheduleDomWrite(callback) {
|
|
4591
4593
|
if (typeof window !== "undefined" && typeof window.requestAnimationFrame === "function") {
|
|
@@ -18384,6 +18386,51 @@ function estimateTrackedChangeCardHeight(change) {
|
|
|
18384
18386
|
const lines = Math.min(2, Math.max(1, Math.ceil(snippet.length / 42)));
|
|
18385
18387
|
return Math.max(TRACKED_CHANGE_GUTTER_CARD_MIN_HEIGHT_PX, 22 + lines * 11);
|
|
18386
18388
|
}
|
|
18389
|
+
function assignGutterConnectorLanes(entries) {
|
|
18390
|
+
if (entries.length <= 1) {
|
|
18391
|
+
entries.forEach((entry) => {
|
|
18392
|
+
entry.connectorLane = 0;
|
|
18393
|
+
});
|
|
18394
|
+
return;
|
|
18395
|
+
}
|
|
18396
|
+
const intervalPaddingPx = 3;
|
|
18397
|
+
const laneEndY = Array.from(
|
|
18398
|
+
{ length: TRACKED_CHANGE_GUTTER_CONNECTOR_LANE_COUNT },
|
|
18399
|
+
() => Number.NEGATIVE_INFINITY
|
|
18400
|
+
);
|
|
18401
|
+
const routedEntries = entries.map((entry, index) => {
|
|
18402
|
+
const cardCenterY = entry.top + entry.heightPx / 2;
|
|
18403
|
+
return {
|
|
18404
|
+
entry,
|
|
18405
|
+
index,
|
|
18406
|
+
startY: Math.min(entry.anchorY, cardCenterY) - intervalPaddingPx,
|
|
18407
|
+
endY: Math.max(entry.anchorY, cardCenterY) + intervalPaddingPx
|
|
18408
|
+
};
|
|
18409
|
+
}).sort((left, right) => {
|
|
18410
|
+
const startDelta = left.startY - right.startY;
|
|
18411
|
+
if (startDelta !== 0) {
|
|
18412
|
+
return startDelta;
|
|
18413
|
+
}
|
|
18414
|
+
const endDelta = left.endY - right.endY;
|
|
18415
|
+
if (endDelta !== 0) {
|
|
18416
|
+
return endDelta;
|
|
18417
|
+
}
|
|
18418
|
+
return left.index - right.index;
|
|
18419
|
+
});
|
|
18420
|
+
routedEntries.forEach((route) => {
|
|
18421
|
+
let laneIndex = laneEndY.findIndex(
|
|
18422
|
+
(laneEnd) => route.startY > laneEnd + intervalPaddingPx
|
|
18423
|
+
);
|
|
18424
|
+
if (laneIndex < 0) {
|
|
18425
|
+
laneIndex = laneEndY.reduce(
|
|
18426
|
+
(bestLane, laneEnd, index) => laneEnd < laneEndY[bestLane] ? index : bestLane,
|
|
18427
|
+
0
|
|
18428
|
+
);
|
|
18429
|
+
}
|
|
18430
|
+
route.entry.connectorLane = laneIndex;
|
|
18431
|
+
laneEndY[laneIndex] = Math.max(laneEndY[laneIndex], route.endY);
|
|
18432
|
+
});
|
|
18433
|
+
}
|
|
18387
18434
|
function layoutTrackedChangesForPage(annotations, anchorByChangeId, cardHeightsByChangeId, pageWidthPx, pageHeightPx) {
|
|
18388
18435
|
if (annotations.length === 0) {
|
|
18389
18436
|
return [];
|
|
@@ -18419,7 +18466,8 @@ function layoutTrackedChangesForPage(annotations, anchorByChangeId, cardHeightsB
|
|
|
18419
18466
|
Math.max(10, pageHeightPx - 10)
|
|
18420
18467
|
),
|
|
18421
18468
|
top: 0,
|
|
18422
|
-
heightPx
|
|
18469
|
+
heightPx,
|
|
18470
|
+
connectorLane: 0
|
|
18423
18471
|
};
|
|
18424
18472
|
});
|
|
18425
18473
|
withAnchors.sort((left, right) => {
|
|
@@ -18451,6 +18499,7 @@ function layoutTrackedChangesForPage(annotations, anchorByChangeId, cardHeightsB
|
|
|
18451
18499
|
shiftedCursorTopPx = entry.top + entry.heightPx + TRACKED_CHANGE_GUTTER_CARD_GAP_PX;
|
|
18452
18500
|
});
|
|
18453
18501
|
}
|
|
18502
|
+
assignGutterConnectorLanes(withAnchors);
|
|
18454
18503
|
return withAnchors;
|
|
18455
18504
|
}
|
|
18456
18505
|
function sameParagraphLocation(a, b) {
|
|
@@ -42737,7 +42786,15 @@ ${currentText.slice(end)}`;
|
|
|
42737
42786
|
Math.max(8, pageLayout.pageWidthPx - 8)
|
|
42738
42787
|
);
|
|
42739
42788
|
const cardAttachX = pageLayout.pageWidthPx + TRACKED_CHANGE_GUTTER_CARD_LEFT_PX;
|
|
42740
|
-
const
|
|
42789
|
+
const maxConnectorLaneOffset = Math.max(
|
|
42790
|
+
TRACKED_CHANGE_GUTTER_BEND_OFFSET_PX,
|
|
42791
|
+
TRACKED_CHANGE_GUTTER_CARD_LEFT_PX - 6
|
|
42792
|
+
);
|
|
42793
|
+
const connectorLaneOffset = Math.min(
|
|
42794
|
+
TRACKED_CHANGE_GUTTER_BEND_OFFSET_PX + Math.max(0, entry.connectorLane) * TRACKED_CHANGE_GUTTER_CONNECTOR_LANE_GAP_PX,
|
|
42795
|
+
maxConnectorLaneOffset
|
|
42796
|
+
);
|
|
42797
|
+
const gutterBendX = pageLayout.pageWidthPx + connectorLaneOffset;
|
|
42741
42798
|
const cardCenterY = clampNumber(
|
|
42742
42799
|
Math.round(entry.top + entry.heightPx / 2),
|
|
42743
42800
|
8,
|
|
@@ -42952,6 +43009,7 @@ ${currentText.slice(end)}`;
|
|
|
42952
43009
|
"data-docx-gutter-annotation-id": entry.annotation.id,
|
|
42953
43010
|
"data-docx-gutter-anchor-x": Math.round(entry.anchorX),
|
|
42954
43011
|
"data-docx-gutter-anchor-y": Math.round(entry.anchorY),
|
|
43012
|
+
"data-docx-gutter-connector-lane": entry.connectorLane,
|
|
42955
43013
|
ref: (element) => {
|
|
42956
43014
|
const elementKey = `${pageIndex}:${entry.annotation.id}`;
|
|
42957
43015
|
if (element) {
|