@beyondwork/docx-react-component 1.0.133 → 1.0.134
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/api/public-types.cjs +3 -1
- package/dist/api/public-types.d.cts +1 -1
- package/dist/api/public-types.d.ts +1 -1
- package/dist/api/public-types.js +1 -1
- package/dist/api/v3.cjs +688 -45
- package/dist/api/v3.d.cts +2 -2
- package/dist/api/v3.d.ts +2 -2
- package/dist/api/v3.js +3 -3
- package/dist/{chunk-S3PEKX6H.js → chunk-3YR47WTD.js} +53 -547
- package/dist/{chunk-57HTKX3P.js → chunk-74R5B2EZ.js} +1 -1
- package/dist/{chunk-KL4TZSZV.js → chunk-7Y6JCIK3.js} +1 -1
- package/dist/{chunk-3JEE5RJU.js → chunk-EBSI6VQX.js} +457 -16
- package/dist/{chunk-OTRVGNZQ.js → chunk-ESEEWELA.js} +547 -2
- package/dist/{chunk-224TSMEB.js → chunk-IJD6D7HU.js} +137 -41
- package/dist/{chunk-CVSD3UNK.js → chunk-O4EDZR44.js} +3 -1
- package/dist/{chunk-ZFCZ7XXH.js → chunk-VA24T4EB.js} +1 -1
- package/dist/core/commands/formatting-commands.d.cts +1 -1
- package/dist/core/commands/formatting-commands.d.ts +1 -1
- package/dist/core/commands/image-commands.d.cts +1 -1
- package/dist/core/commands/image-commands.d.ts +1 -1
- package/dist/core/commands/section-layout-commands.d.cts +1 -1
- package/dist/core/commands/section-layout-commands.d.ts +1 -1
- package/dist/core/commands/style-commands.d.cts +1 -1
- package/dist/core/commands/style-commands.d.ts +1 -1
- package/dist/core/commands/table-structure-commands.d.cts +1 -1
- package/dist/core/commands/table-structure-commands.d.ts +1 -1
- package/dist/core/commands/text-commands.d.cts +1 -1
- package/dist/core/commands/text-commands.d.ts +1 -1
- package/dist/core/selection/mapping.d.cts +1 -1
- package/dist/core/selection/mapping.d.ts +1 -1
- package/dist/core/state/editor-state.d.cts +1 -1
- package/dist/core/state/editor-state.d.ts +1 -1
- package/dist/index.cjs +1289 -615
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +105 -19
- package/dist/io/docx-session.d.cts +3 -3
- package/dist/io/docx-session.d.ts +3 -3
- package/dist/{loader-B2H99237.d.cts → loader-CK3lZy4h.d.cts} +2 -2
- package/dist/{loader-DfTjqVwn.d.ts → loader-CQXplstv.d.ts} +2 -2
- package/dist/{public-types-S8gTYwKo.d.cts → public-types-BR1SYK2F.d.cts} +140 -3
- package/dist/{public-types-B5lOUIrP.d.ts → public-types-DXNZVKrS.d.ts} +140 -3
- package/dist/public-types.cjs +3 -1
- package/dist/public-types.d.cts +1 -1
- package/dist/public-types.d.ts +1 -1
- package/dist/public-types.js +1 -1
- package/dist/runtime/collab.d.cts +2 -2
- package/dist/runtime/collab.d.ts +2 -2
- package/dist/runtime/document-runtime.cjs +591 -54
- package/dist/runtime/document-runtime.d.cts +1 -1
- package/dist/runtime/document-runtime.d.ts +1 -1
- package/dist/runtime/document-runtime.js +4 -4
- package/dist/{session-CBDIOYXA.d.ts → session-C9UjrhJF.d.ts} +2 -2
- package/dist/{session-CR2A1hGZ.d.cts → session-CSbwkgII.d.cts} +2 -2
- package/dist/session.d.cts +4 -4
- package/dist/session.d.ts +4 -4
- package/dist/tailwind.cjs +54 -546
- package/dist/tailwind.d.cts +1 -1
- package/dist/tailwind.d.ts +1 -1
- package/dist/tailwind.js +4 -4
- package/dist/{types-yty2K-hk.d.cts → types-CZtAueri.d.cts} +1 -1
- package/dist/{types-B-90ywjU.d.ts → types-RzkCXDNV.d.ts} +1 -1
- package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +2 -2
- package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +2 -2
- package/dist/ui-tailwind/editor-surface/search-plugin.js +2 -2
- package/dist/ui-tailwind.cjs +54 -546
- package/dist/ui-tailwind.d.cts +2 -2
- package/dist/ui-tailwind.d.ts +2 -2
- package/dist/ui-tailwind.js +4 -4
- package/package.json +1 -1
package/dist/tailwind.cjs
CHANGED
|
@@ -876,18 +876,7 @@ function findScrollAnchor(root, options) {
|
|
|
876
876
|
offsetWithinBlock: viewportTopFramePx - blockTop
|
|
877
877
|
};
|
|
878
878
|
}
|
|
879
|
-
|
|
880
|
-
const rootRect = root.getBoundingClientRect();
|
|
881
|
-
const rootTop = rootRect.top;
|
|
882
|
-
for (const block of blocks) {
|
|
883
|
-
const rect2 = block.getBoundingClientRect();
|
|
884
|
-
if (rect2.bottom < rootTop) continue;
|
|
885
|
-
const blockId = block.getAttribute("data-block-id");
|
|
886
|
-
if (!blockId) continue;
|
|
887
|
-
return {
|
|
888
|
-
blockId,
|
|
889
|
-
offsetWithinBlock: rootTop - rect2.top
|
|
890
|
-
};
|
|
879
|
+
return null;
|
|
891
880
|
}
|
|
892
881
|
return null;
|
|
893
882
|
}
|
|
@@ -905,17 +894,9 @@ function resolveScrollTopForAnchor(root, anchor, options) {
|
|
|
905
894
|
const rect2 = geometry.rects[0];
|
|
906
895
|
return rect2.topPx + anchor.offsetWithinBlock;
|
|
907
896
|
}
|
|
897
|
+
return null;
|
|
908
898
|
}
|
|
909
|
-
|
|
910
|
-
const block = root.querySelector(selector);
|
|
911
|
-
if (!block) return null;
|
|
912
|
-
const rootRect = root.getBoundingClientRect();
|
|
913
|
-
const blockRect = block.getBoundingClientRect();
|
|
914
|
-
const delta = blockRect.top - rootRect.top + anchor.offsetWithinBlock;
|
|
915
|
-
return root.scrollTop + delta;
|
|
916
|
-
}
|
|
917
|
-
function cssEscape(value) {
|
|
918
|
-
return value.replace(/[^a-zA-Z0-9_-]/g, (ch) => `\\${ch}`);
|
|
899
|
+
return null;
|
|
919
900
|
}
|
|
920
901
|
|
|
921
902
|
// src/ui/headless/chrome-registry.ts
|
|
@@ -12796,6 +12777,7 @@ var PICTURE_EFFECT_SCHEME_ALIASES = {
|
|
|
12796
12777
|
bg2: "lt2"
|
|
12797
12778
|
};
|
|
12798
12779
|
var EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH = /* @__PURE__ */ new Map();
|
|
12780
|
+
var NO_EDITABLE_TARGETS_INDEX = EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH;
|
|
12799
12781
|
function indexEditableTargetsByBlockPath(document2) {
|
|
12800
12782
|
const targets = collectEditableTargetRefs(document2);
|
|
12801
12783
|
if (targets.length === 0) return EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH;
|
|
@@ -15012,7 +14994,8 @@ function buildResolvedSections(document2) {
|
|
|
15012
14994
|
const mainSurface = createEditorSurfaceSnapshot(
|
|
15013
14995
|
document2,
|
|
15014
14996
|
createSelectionSnapshot(0, 0),
|
|
15015
|
-
MAIN_STORY_TARGET
|
|
14997
|
+
MAIN_STORY_TARGET,
|
|
14998
|
+
{ editableTargetsByBlockPath: NO_EDITABLE_TARGETS_INDEX }
|
|
15016
14999
|
);
|
|
15017
15000
|
const sections = [];
|
|
15018
15001
|
let sectionStart = 0;
|
|
@@ -25206,6 +25189,14 @@ var EDITOR_ACTION_REGISTRY = [
|
|
|
25206
25189
|
targetKinds: ["generated-field"],
|
|
25207
25190
|
callback: "onUpdateFields"
|
|
25208
25191
|
}),
|
|
25192
|
+
mk({
|
|
25193
|
+
id: "toc-refresh",
|
|
25194
|
+
label: "Refresh table of contents",
|
|
25195
|
+
description: "Refresh TOC entries through the runtime table-of-contents updater.",
|
|
25196
|
+
group: "misc",
|
|
25197
|
+
targetKinds: ["toc-field"],
|
|
25198
|
+
callback: "onUpdateTableOfContents"
|
|
25199
|
+
}),
|
|
25209
25200
|
// -------- Workflow scope --------
|
|
25210
25201
|
mk({
|
|
25211
25202
|
id: "scope-open-card",
|
|
@@ -26099,6 +26090,18 @@ function hasAncestorAttributeValue(el, attribute, expected, root) {
|
|
|
26099
26090
|
}
|
|
26100
26091
|
return false;
|
|
26101
26092
|
}
|
|
26093
|
+
function hasAncestorAttributeValueInsensitive(el, attribute, expected, root) {
|
|
26094
|
+
const normalizedExpected = expected.toLowerCase();
|
|
26095
|
+
let cursor = el;
|
|
26096
|
+
while (cursor) {
|
|
26097
|
+
if (cursor.getAttribute?.(attribute)?.toLowerCase() === normalizedExpected) {
|
|
26098
|
+
return true;
|
|
26099
|
+
}
|
|
26100
|
+
if (cursor === root) return false;
|
|
26101
|
+
cursor = cursor.parentElement;
|
|
26102
|
+
}
|
|
26103
|
+
return false;
|
|
26104
|
+
}
|
|
26102
26105
|
function resolveTargetKind(target, options = {}) {
|
|
26103
26106
|
const kinds = [];
|
|
26104
26107
|
const el = toElement(target);
|
|
@@ -26113,7 +26116,12 @@ function resolveTargetKind(target, options = {}) {
|
|
|
26113
26116
|
const insideListItem = insideNumberingMarker || hasAncestorAttributeValue(el, "data-numbered", "true", root);
|
|
26114
26117
|
const insideGeneratedField = hasAncestorAttributeValue(el, "data-generated-field", "true", root) || hasAncestorAttributeValue(el, "data-node-type", "field_ref_atom", root) || hasAncestorAttributeValue(el, "data-node-type", "field_ref", root);
|
|
26115
26118
|
if (insideListItem) kinds.push("list-item");
|
|
26116
|
-
if (insideGeneratedField)
|
|
26119
|
+
if (insideGeneratedField) {
|
|
26120
|
+
kinds.push("generated-field");
|
|
26121
|
+
if (hasAncestorAttributeValueInsensitive(el, "data-field-family", "TOC", root)) {
|
|
26122
|
+
kinds.push("toc-field");
|
|
26123
|
+
}
|
|
26124
|
+
}
|
|
26117
26125
|
if (hasAncestorTag(el, "a", root)) kinds.push("hyperlink");
|
|
26118
26126
|
if (!insideNumberingMarker && hasAncestorTag(el, "img", root)) {
|
|
26119
26127
|
kinds.push("image");
|
|
@@ -27235,294 +27243,6 @@ function resolveSkeletalPageOverlayRectsFromLayout(facet) {
|
|
|
27235
27243
|
}
|
|
27236
27244
|
return rects;
|
|
27237
27245
|
}
|
|
27238
|
-
function pageOverlayLastBottom(rects) {
|
|
27239
|
-
let bottom = 0;
|
|
27240
|
-
for (const rect2 of rects) {
|
|
27241
|
-
if (rect2.bottomPx > bottom) bottom = rect2.bottomPx;
|
|
27242
|
-
}
|
|
27243
|
-
return bottom;
|
|
27244
|
-
}
|
|
27245
|
-
function extendFinalPageOverlayRectToFlowHeight(rects, flowHeightPx) {
|
|
27246
|
-
if (rects.length === 0 || !Number.isFinite(flowHeightPx)) return rects;
|
|
27247
|
-
const last = rects[rects.length - 1];
|
|
27248
|
-
if (flowHeightPx <= last.bottomPx + 1) return rects;
|
|
27249
|
-
return [
|
|
27250
|
-
...rects.slice(0, -1),
|
|
27251
|
-
{
|
|
27252
|
-
...last,
|
|
27253
|
-
bottomPx: flowHeightPx,
|
|
27254
|
-
heightPx: Math.max(0, flowHeightPx - last.topPx)
|
|
27255
|
-
}
|
|
27256
|
-
];
|
|
27257
|
-
}
|
|
27258
|
-
function extendPageOverlayRectsAcrossTableBoundaryGaps(rects, tableBoundaryIndices) {
|
|
27259
|
-
if (rects.length === 0 || tableBoundaryIndices.length === 0) return rects;
|
|
27260
|
-
const tableBoundaries = new Set(tableBoundaryIndices);
|
|
27261
|
-
const byPageIndex = /* @__PURE__ */ new Map();
|
|
27262
|
-
for (const rect2 of rects) {
|
|
27263
|
-
byPageIndex.set(rect2.pageIndex, rect2);
|
|
27264
|
-
}
|
|
27265
|
-
let changed = false;
|
|
27266
|
-
const bridged = rects.map((rect2) => {
|
|
27267
|
-
if (!tableBoundaries.has(rect2.pageIndex)) return rect2;
|
|
27268
|
-
const next = byPageIndex.get(rect2.pageIndex + 1);
|
|
27269
|
-
if (!next || next.topPx <= rect2.bottomPx + 1) return rect2;
|
|
27270
|
-
changed = true;
|
|
27271
|
-
return {
|
|
27272
|
-
...rect2,
|
|
27273
|
-
bottomPx: next.topPx,
|
|
27274
|
-
heightPx: Math.max(0, next.topPx - rect2.topPx)
|
|
27275
|
-
};
|
|
27276
|
-
});
|
|
27277
|
-
return changed ? bridged : rects;
|
|
27278
|
-
}
|
|
27279
|
-
function mergePageOverlayRectsByPageIndex(baseRects, flowRects) {
|
|
27280
|
-
if (baseRects.length === 0 || flowRects.length === 0) return baseRects;
|
|
27281
|
-
const flowByIndex = /* @__PURE__ */ new Map();
|
|
27282
|
-
for (const rect2 of flowRects) {
|
|
27283
|
-
flowByIndex.set(rect2.pageIndex, rect2);
|
|
27284
|
-
}
|
|
27285
|
-
return baseRects.map((rect2) => flowByIndex.get(rect2.pageIndex) ?? rect2);
|
|
27286
|
-
}
|
|
27287
|
-
function normalizeVisiblePageIndexRange(range, pageCount) {
|
|
27288
|
-
if (!range || pageCount <= 0) return null;
|
|
27289
|
-
const start = Math.max(0, Math.min(range.start, pageCount));
|
|
27290
|
-
const end = Math.max(start, Math.min(range.end, pageCount));
|
|
27291
|
-
if (start >= end) return null;
|
|
27292
|
-
return { start, end };
|
|
27293
|
-
}
|
|
27294
|
-
function collectBoundaryIndicesForVisibleRange(range, pageCount) {
|
|
27295
|
-
if (pageCount <= 1) return [];
|
|
27296
|
-
const startBoundaryIndex = Math.max(0, range.start - 1);
|
|
27297
|
-
const endBoundaryIndex = Math.min(pageCount - 2, range.end - 1);
|
|
27298
|
-
if (startBoundaryIndex > endBoundaryIndex) return [];
|
|
27299
|
-
const indices = [];
|
|
27300
|
-
for (let index = startBoundaryIndex; index <= endBoundaryIndex; index += 1) {
|
|
27301
|
-
indices.push(index);
|
|
27302
|
-
}
|
|
27303
|
-
return indices;
|
|
27304
|
-
}
|
|
27305
|
-
function parsePageBoundaryIndex(prevPageId) {
|
|
27306
|
-
const match = /^page-(\d+)$/.exec(prevPageId);
|
|
27307
|
-
if (!match) return void 0;
|
|
27308
|
-
return Number.parseInt(match[1] ?? "", 10);
|
|
27309
|
-
}
|
|
27310
|
-
function collectTableEmbeddedBoundaryIndices(queryRoot) {
|
|
27311
|
-
if (!queryRoot) return [];
|
|
27312
|
-
const indices = [];
|
|
27313
|
-
const widgets = Array.from(
|
|
27314
|
-
queryRoot.querySelectorAll("[data-page-frame-end]")
|
|
27315
|
-
);
|
|
27316
|
-
for (const widget of widgets) {
|
|
27317
|
-
const prevPageId = widget.getAttribute("data-page-frame-end");
|
|
27318
|
-
if (!prevPageId) continue;
|
|
27319
|
-
const boundaryIndex = parsePageBoundaryIndex(prevPageId);
|
|
27320
|
-
if (boundaryIndex === void 0) continue;
|
|
27321
|
-
if (widget.closest("[data-pm-table-root='true'], table")) {
|
|
27322
|
-
indices.push(boundaryIndex);
|
|
27323
|
-
}
|
|
27324
|
-
}
|
|
27325
|
-
return indices;
|
|
27326
|
-
}
|
|
27327
|
-
function containsTableBoundaryRisk(queryRoot) {
|
|
27328
|
-
if (!queryRoot) return false;
|
|
27329
|
-
if (queryRoot.getElementsByTagName("table").length > 0) return true;
|
|
27330
|
-
const descendants = queryRoot.getElementsByTagName("*");
|
|
27331
|
-
for (let i = 0; i < descendants.length; i += 1) {
|
|
27332
|
-
const element = descendants[i];
|
|
27333
|
-
if (element.getAttribute("data-pm-table-root") === "true") {
|
|
27334
|
-
return true;
|
|
27335
|
-
}
|
|
27336
|
-
}
|
|
27337
|
-
return false;
|
|
27338
|
-
}
|
|
27339
|
-
function resolvePageOverlayRects(input, legacyPageCount) {
|
|
27340
|
-
let widgets;
|
|
27341
|
-
let pageCount;
|
|
27342
|
-
let scrollHeight;
|
|
27343
|
-
if (Array.isArray(input)) {
|
|
27344
|
-
const [scrollRoot, count] = input;
|
|
27345
|
-
if (!scrollRoot || count <= 0) return [];
|
|
27346
|
-
widgets = measureWidgetsViaOffsetChain(scrollRoot);
|
|
27347
|
-
pageCount = count;
|
|
27348
|
-
scrollHeight = scrollRoot.clientHeight;
|
|
27349
|
-
} else if (input !== null && typeof input === "object" && "widgets" in input) {
|
|
27350
|
-
widgets = input.widgets;
|
|
27351
|
-
pageCount = input.pageCount;
|
|
27352
|
-
scrollHeight = input.scrollHeight;
|
|
27353
|
-
} else if (input && legacyPageCount !== void 0) {
|
|
27354
|
-
const scrollRoot = input;
|
|
27355
|
-
if (legacyPageCount <= 0) return [];
|
|
27356
|
-
widgets = measureWidgetsViaOffsetChain(scrollRoot);
|
|
27357
|
-
pageCount = legacyPageCount;
|
|
27358
|
-
scrollHeight = scrollRoot.clientHeight;
|
|
27359
|
-
} else {
|
|
27360
|
-
return [];
|
|
27361
|
-
}
|
|
27362
|
-
if (pageCount <= 0) return [];
|
|
27363
|
-
const boundaries = [...widgets].sort((a, b) => a.topPx - b.topPx);
|
|
27364
|
-
const normalizedVisiblePageIndexRange = Array.isArray(input) ? null : normalizeVisiblePageIndexRange(input.visiblePageIndexRange, pageCount);
|
|
27365
|
-
const boundaryByIndex = /* @__PURE__ */ new Map();
|
|
27366
|
-
boundaries.forEach((boundary, index) => {
|
|
27367
|
-
const boundaryIndex = boundary.boundaryIndex ?? parsePageBoundaryIndex(boundary.prevPageId) ?? index;
|
|
27368
|
-
boundaryByIndex.set(boundaryIndex, boundary);
|
|
27369
|
-
});
|
|
27370
|
-
const pageStart = normalizedVisiblePageIndexRange?.start ?? 0;
|
|
27371
|
-
const pageEnd = normalizedVisiblePageIndexRange?.end ?? pageCount;
|
|
27372
|
-
const rects = [];
|
|
27373
|
-
for (let pageIndex = pageStart; pageIndex < pageEnd; pageIndex += 1) {
|
|
27374
|
-
const boundaryBefore = pageIndex === 0 ? null : boundaryByIndex.get(pageIndex - 1) ?? null;
|
|
27375
|
-
const boundaryAfter = pageIndex === pageCount - 1 ? null : boundaryByIndex.get(pageIndex) ?? null;
|
|
27376
|
-
let pageId = null;
|
|
27377
|
-
if (boundaryBefore) pageId = boundaryBefore.nextPageId;
|
|
27378
|
-
else if (boundaryAfter) pageId = boundaryAfter.prevPageId;
|
|
27379
|
-
if (!pageId) pageId = `page-${pageIndex}`;
|
|
27380
|
-
const topPx = boundaryBefore ? boundaryBefore.bottomPx : 0;
|
|
27381
|
-
const bottomPx = boundaryAfter ? boundaryAfter.topPx : scrollHeight;
|
|
27382
|
-
if (bottomPx <= topPx) continue;
|
|
27383
|
-
rects.push({
|
|
27384
|
-
pageId,
|
|
27385
|
-
pageIndex,
|
|
27386
|
-
topPx,
|
|
27387
|
-
bottomPx,
|
|
27388
|
-
heightPx: bottomPx - topPx
|
|
27389
|
-
});
|
|
27390
|
-
}
|
|
27391
|
-
return rects;
|
|
27392
|
-
}
|
|
27393
|
-
function measureWidgetsViaBoundingRect(queryRoot, originElement, options) {
|
|
27394
|
-
if (!queryRoot || !originElement) return [];
|
|
27395
|
-
const originRect = originElement.getBoundingClientRect();
|
|
27396
|
-
const normalizedVisiblePageIndexRange = normalizeVisiblePageIndexRange(
|
|
27397
|
-
options?.visiblePageIndexRange,
|
|
27398
|
-
options?.pageCount ?? 0
|
|
27399
|
-
);
|
|
27400
|
-
const queryOne = typeof queryRoot.querySelector === "function" ? queryRoot.querySelector.bind(queryRoot) : null;
|
|
27401
|
-
const widgets = normalizedVisiblePageIndexRange && queryOne && options?.pageCount ? collectBoundaryIndicesForVisibleRange(
|
|
27402
|
-
normalizedVisiblePageIndexRange,
|
|
27403
|
-
options.pageCount
|
|
27404
|
-
).map(
|
|
27405
|
-
(boundaryIndex) => queryOne(`[data-page-frame-end="page-${boundaryIndex}"]`)
|
|
27406
|
-
).filter((widget) => widget !== null) : Array.from(
|
|
27407
|
-
queryRoot.querySelectorAll("[data-page-frame-end]")
|
|
27408
|
-
);
|
|
27409
|
-
const out = [];
|
|
27410
|
-
for (const widget of widgets) {
|
|
27411
|
-
const prevPageId = widget.getAttribute("data-page-frame-end");
|
|
27412
|
-
const nextPageId = widget.getAttribute("data-page-frame-start");
|
|
27413
|
-
if (!prevPageId || !nextPageId) continue;
|
|
27414
|
-
const rect2 = widget.getBoundingClientRect();
|
|
27415
|
-
out.push({
|
|
27416
|
-
prevPageId,
|
|
27417
|
-
nextPageId,
|
|
27418
|
-
boundaryIndex: parsePageBoundaryIndex(prevPageId),
|
|
27419
|
-
topPx: rect2.top - originRect.top,
|
|
27420
|
-
bottomPx: rect2.bottom - originRect.top
|
|
27421
|
-
});
|
|
27422
|
-
}
|
|
27423
|
-
return out;
|
|
27424
|
-
}
|
|
27425
|
-
function measureWidgetsViaOffsetChain(scrollRoot, options) {
|
|
27426
|
-
const normalizedVisiblePageIndexRange = normalizeVisiblePageIndexRange(
|
|
27427
|
-
options?.visiblePageIndexRange,
|
|
27428
|
-
options?.pageCount ?? 0
|
|
27429
|
-
);
|
|
27430
|
-
const queryOne = typeof scrollRoot.querySelector === "function" ? scrollRoot.querySelector.bind(scrollRoot) : null;
|
|
27431
|
-
const widgets = normalizedVisiblePageIndexRange && queryOne && options?.pageCount ? collectBoundaryIndicesForVisibleRange(
|
|
27432
|
-
normalizedVisiblePageIndexRange,
|
|
27433
|
-
options.pageCount
|
|
27434
|
-
).map(
|
|
27435
|
-
(boundaryIndex) => queryOne(`[data-page-frame-end="page-${boundaryIndex}"]`)
|
|
27436
|
-
).filter((widget) => widget !== null) : Array.from(
|
|
27437
|
-
scrollRoot.querySelectorAll("[data-page-frame-end]")
|
|
27438
|
-
);
|
|
27439
|
-
const out = [];
|
|
27440
|
-
for (const widget of widgets) {
|
|
27441
|
-
const prevPageId = widget.getAttribute("data-page-frame-end");
|
|
27442
|
-
const nextPageId = widget.getAttribute("data-page-frame-start");
|
|
27443
|
-
if (!prevPageId || !nextPageId) continue;
|
|
27444
|
-
const topPx = resolveOffsetTop(widget, scrollRoot);
|
|
27445
|
-
const bottomPx = topPx + resolveOffsetHeight(widget);
|
|
27446
|
-
out.push({
|
|
27447
|
-
prevPageId,
|
|
27448
|
-
nextPageId,
|
|
27449
|
-
boundaryIndex: parsePageBoundaryIndex(prevPageId),
|
|
27450
|
-
topPx,
|
|
27451
|
-
bottomPx
|
|
27452
|
-
});
|
|
27453
|
-
}
|
|
27454
|
-
return out;
|
|
27455
|
-
}
|
|
27456
|
-
function resolveOffsetTop(widget, scrollRoot) {
|
|
27457
|
-
let node = widget;
|
|
27458
|
-
let top = 0;
|
|
27459
|
-
while (node) {
|
|
27460
|
-
top += node.offsetTop ?? 0;
|
|
27461
|
-
const parent = node.offsetParent;
|
|
27462
|
-
if (parent === scrollRoot || parent === null) break;
|
|
27463
|
-
node = parent;
|
|
27464
|
-
}
|
|
27465
|
-
return top;
|
|
27466
|
-
}
|
|
27467
|
-
function resolveOffsetHeight(widget) {
|
|
27468
|
-
return widget.offsetHeight ?? 0;
|
|
27469
|
-
}
|
|
27470
|
-
function readElementFlowHeight(element, options = {}) {
|
|
27471
|
-
if (!element) return 0;
|
|
27472
|
-
let height = 0;
|
|
27473
|
-
height = Math.max(height, element.clientHeight || 0);
|
|
27474
|
-
if (options.includeScrollHeight !== false) {
|
|
27475
|
-
height = Math.max(height, element.scrollHeight || 0);
|
|
27476
|
-
}
|
|
27477
|
-
if (height <= 0) {
|
|
27478
|
-
const rect2 = element.getBoundingClientRect();
|
|
27479
|
-
height = Math.max(height, rect2.height || 0);
|
|
27480
|
-
}
|
|
27481
|
-
return height;
|
|
27482
|
-
}
|
|
27483
|
-
function readOverlayFlowHeight(origin) {
|
|
27484
|
-
if (!origin) return 0;
|
|
27485
|
-
const parent = origin.parentElement instanceof HTMLElement ? origin.parentElement : null;
|
|
27486
|
-
const parentHeight = readElementFlowHeight(parent);
|
|
27487
|
-
if (parentHeight > 0) return parentHeight;
|
|
27488
|
-
return readElementFlowHeight(origin, { includeScrollHeight: false });
|
|
27489
|
-
}
|
|
27490
|
-
function reconcilePageStackRectsWithFlow(input) {
|
|
27491
|
-
const { baseRects, pageCount, scrollRoot, originElement } = input;
|
|
27492
|
-
if (baseRects.length === 0 || pageCount <= 0) return baseRects;
|
|
27493
|
-
const flowHeight = readOverlayFlowHeight(originElement);
|
|
27494
|
-
if (flowHeight <= 0) return baseRects;
|
|
27495
|
-
const geometryBottom = pageOverlayLastBottom(baseRects);
|
|
27496
|
-
const tableBoundaryRisk = containsTableBoundaryRisk(scrollRoot);
|
|
27497
|
-
if (!tableBoundaryRisk && flowHeight <= geometryBottom + 1) {
|
|
27498
|
-
return extendFinalPageOverlayRectToFlowHeight(baseRects, flowHeight);
|
|
27499
|
-
}
|
|
27500
|
-
const bridgedBase = extendPageOverlayRectsAcrossTableBoundaryGaps(
|
|
27501
|
-
baseRects,
|
|
27502
|
-
tableBoundaryRisk ? collectTableEmbeddedBoundaryIndices(scrollRoot) : []
|
|
27503
|
-
);
|
|
27504
|
-
const extendedBase = extendFinalPageOverlayRectToFlowHeight(
|
|
27505
|
-
bridgedBase,
|
|
27506
|
-
flowHeight
|
|
27507
|
-
);
|
|
27508
|
-
if (!originElement || !scrollRoot) return extendedBase;
|
|
27509
|
-
if (flowHeight <= pageOverlayLastBottom(bridgedBase) + 1) {
|
|
27510
|
-
return extendedBase;
|
|
27511
|
-
}
|
|
27512
|
-
const widgets = measureWidgetsViaBoundingRect(scrollRoot, originElement, {
|
|
27513
|
-
pageCount,
|
|
27514
|
-
visiblePageIndexRange: null
|
|
27515
|
-
});
|
|
27516
|
-
if (widgets.length === 0) return extendedBase;
|
|
27517
|
-
const flowRects = resolvePageOverlayRects({
|
|
27518
|
-
widgets,
|
|
27519
|
-
pageCount,
|
|
27520
|
-
scrollHeight: flowHeight,
|
|
27521
|
-
visiblePageIndexRange: null
|
|
27522
|
-
});
|
|
27523
|
-
const merged = mergePageOverlayRectsByPageIndex(extendedBase, flowRects);
|
|
27524
|
-
return extendFinalPageOverlayRectToFlowHeight(merged, flowHeight);
|
|
27525
|
-
}
|
|
27526
27246
|
var resolvePageOverlayRectsFromGeometry2 = resolvePageOverlayRectsFromGeometry;
|
|
27527
27247
|
function resolvePageOverlayRectsFromUiApi(ui, pageCount, visiblePageIndexRange, pageIds) {
|
|
27528
27248
|
if (pageCount <= 0) return [];
|
|
@@ -27580,17 +27300,6 @@ var TwPageStackOverlayLayer = ({
|
|
|
27580
27300
|
},
|
|
27581
27301
|
[]
|
|
27582
27302
|
);
|
|
27583
|
-
const reconcilePaperRectsWithFlow = React21.useCallback(
|
|
27584
|
-
(baseRects, pageCount) => {
|
|
27585
|
-
return reconcilePageStackRectsWithFlow({
|
|
27586
|
-
baseRects,
|
|
27587
|
-
pageCount,
|
|
27588
|
-
scrollRoot,
|
|
27589
|
-
originElement: overlayRootRef.current
|
|
27590
|
-
});
|
|
27591
|
-
},
|
|
27592
|
-
[scrollRoot]
|
|
27593
|
-
);
|
|
27594
27303
|
const refreshRectsNow = React21.useCallback(() => {
|
|
27595
27304
|
const pageCount = facet.getPageCount();
|
|
27596
27305
|
const skeletalRects = resolveSkeletalPageOverlayRectsFromLayout(facet);
|
|
@@ -27631,51 +27340,11 @@ var TwPageStackOverlayLayer = ({
|
|
|
27631
27340
|
setRectsIfChanged(skeletalRects);
|
|
27632
27341
|
return;
|
|
27633
27342
|
}
|
|
27634
|
-
|
|
27635
|
-
|
|
27636
|
-
return;
|
|
27637
|
-
}
|
|
27638
|
-
const origin = overlayRootRef.current;
|
|
27639
|
-
incrementInvalidationCounter("overlay.page.dom_fallback");
|
|
27640
|
-
if (origin) {
|
|
27641
|
-
incrementInvalidationCounter("overlay.page.dom.degraded");
|
|
27642
|
-
const widgets = measureWidgetsViaBoundingRect(scrollRoot, origin, {
|
|
27643
|
-
pageCount,
|
|
27644
|
-
visiblePageIndexRange: null
|
|
27645
|
-
});
|
|
27646
|
-
const originRect = origin.getBoundingClientRect();
|
|
27647
|
-
const domRects = resolvePageOverlayRects({
|
|
27648
|
-
widgets,
|
|
27649
|
-
pageCount,
|
|
27650
|
-
scrollHeight: (
|
|
27651
|
-
// geometry:allow-dom-fallback
|
|
27652
|
-
origin.clientHeight > 0 ? origin.clientHeight : originRect.height
|
|
27653
|
-
),
|
|
27654
|
-
visiblePageIndexRange: null
|
|
27655
|
-
});
|
|
27656
|
-
const reconciled = reconcilePaperRectsWithFlow(domRects, pageCount);
|
|
27657
|
-
setRectsIfChanged(reconciled.length > 0 ? reconciled : skeletalRects);
|
|
27658
|
-
} else {
|
|
27659
|
-
incrementInvalidationCounter("overlay.page.dom.degraded");
|
|
27660
|
-
const widgets = measureWidgetsViaOffsetChain(scrollRoot, {
|
|
27661
|
-
pageCount,
|
|
27662
|
-
visiblePageIndexRange: null
|
|
27663
|
-
});
|
|
27664
|
-
const domRects = resolvePageOverlayRects({
|
|
27665
|
-
widgets,
|
|
27666
|
-
pageCount,
|
|
27667
|
-
// geometry:allow-dom-fallback
|
|
27668
|
-
scrollHeight: scrollRoot.clientHeight,
|
|
27669
|
-
visiblePageIndexRange: null
|
|
27670
|
-
});
|
|
27671
|
-
const reconciled = reconcilePaperRectsWithFlow(domRects, pageCount);
|
|
27672
|
-
setRectsIfChanged(reconciled.length > 0 ? reconciled : skeletalRects);
|
|
27673
|
-
}
|
|
27343
|
+
incrementInvalidationCounter("overlay.page.skeletal_fallback");
|
|
27344
|
+
setRectsIfChanged(skeletalRects);
|
|
27674
27345
|
}, [
|
|
27675
27346
|
facet,
|
|
27676
27347
|
geometryFacet,
|
|
27677
|
-
reconcilePaperRectsWithFlow,
|
|
27678
|
-
scrollRoot,
|
|
27679
27348
|
setRectsIfChanged,
|
|
27680
27349
|
ui
|
|
27681
27350
|
]);
|
|
@@ -27706,33 +27375,6 @@ var TwPageStackOverlayLayer = ({
|
|
|
27706
27375
|
}
|
|
27707
27376
|
};
|
|
27708
27377
|
}, [refreshRects, renderFrameRevision, scrollRoot]);
|
|
27709
|
-
React21.useEffect(() => {
|
|
27710
|
-
if (geometryFacet) return;
|
|
27711
|
-
if (!scrollRoot) return;
|
|
27712
|
-
const runtime = scrollRoot.ownerDocument?.defaultView;
|
|
27713
|
-
if (!runtime?.ResizeObserver) return;
|
|
27714
|
-
const observer = new runtime.ResizeObserver(() => refreshRects());
|
|
27715
|
-
observer.observe(scrollRoot);
|
|
27716
|
-
return () => observer.disconnect();
|
|
27717
|
-
}, [geometryFacet, scrollRoot, refreshRects]);
|
|
27718
|
-
React21.useEffect(() => {
|
|
27719
|
-
if (geometryFacet) return;
|
|
27720
|
-
if (!scrollRoot) return;
|
|
27721
|
-
const runtime = scrollRoot.ownerDocument?.defaultView;
|
|
27722
|
-
if (!runtime?.MutationObserver) return;
|
|
27723
|
-
const observer = new runtime.MutationObserver((records) => {
|
|
27724
|
-
const overlay = overlayRootRef.current;
|
|
27725
|
-
if (overlay) {
|
|
27726
|
-
const allSelf = records.every(
|
|
27727
|
-
(r) => r.target instanceof Node && overlay.contains(r.target)
|
|
27728
|
-
);
|
|
27729
|
-
if (allSelf) return;
|
|
27730
|
-
}
|
|
27731
|
-
refreshRects();
|
|
27732
|
-
});
|
|
27733
|
-
observer.observe(scrollRoot, { childList: true, subtree: false });
|
|
27734
|
-
return () => observer.disconnect();
|
|
27735
|
-
}, [geometryFacet, scrollRoot, refreshRects]);
|
|
27736
27378
|
if (rects.length === 0) {
|
|
27737
27379
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
27738
27380
|
"div",
|
|
@@ -29824,25 +29466,23 @@ var TwPageStackChromeLayerInner = ({
|
|
|
29824
29466
|
const pageCount = facet.getPageCount();
|
|
29825
29467
|
const uiRects = resolveUiPageRects(pageCount);
|
|
29826
29468
|
if (uiRects !== null) return uiRects;
|
|
29827
|
-
if (
|
|
29828
|
-
|
|
29829
|
-
|
|
29830
|
-
|
|
29831
|
-
|
|
29469
|
+
if (geometryFacet) {
|
|
29470
|
+
const warm = resolvePageOverlayRectsFromGeometry2(
|
|
29471
|
+
geometryFacet,
|
|
29472
|
+
pageCount,
|
|
29473
|
+
visiblePageIndexRange
|
|
29474
|
+
);
|
|
29475
|
+
if (warm !== null) return warm;
|
|
29476
|
+
}
|
|
29477
|
+
return resolveSkeletalPageOverlayRectsFromLayout(facet).filter(
|
|
29478
|
+
(rect2) => !visiblePageIndexRange || rect2.pageIndex >= visiblePageIndexRange.start && rect2.pageIndex < visiblePageIndexRange.end
|
|
29832
29479
|
);
|
|
29833
|
-
return warm ?? [];
|
|
29834
29480
|
});
|
|
29835
29481
|
const overlayRootRef = import_react29.default.useRef(null);
|
|
29836
29482
|
const rafHandleRef = import_react29.default.useRef(null);
|
|
29837
29483
|
const [activeStoryPageIndex, setActiveStoryPageIndex] = import_react29.default.useState(null);
|
|
29838
29484
|
const refreshRectsNow = import_react29.default.useCallback(() => {
|
|
29839
29485
|
const pageCount = facet.getPageCount();
|
|
29840
|
-
const reconcileDomRects = (baseRects) => reconcilePageStackRectsWithFlow({
|
|
29841
|
-
baseRects,
|
|
29842
|
-
pageCount,
|
|
29843
|
-
scrollRoot,
|
|
29844
|
-
originElement: overlayRootRef.current
|
|
29845
|
-
});
|
|
29846
29486
|
const uiRects = resolveUiPageRects(pageCount);
|
|
29847
29487
|
if (uiRects !== null) {
|
|
29848
29488
|
setRects(uiRects);
|
|
@@ -29861,47 +29501,11 @@ var TwPageStackChromeLayerInner = ({
|
|
|
29861
29501
|
setRects([]);
|
|
29862
29502
|
return;
|
|
29863
29503
|
}
|
|
29864
|
-
|
|
29865
|
-
|
|
29866
|
-
|
|
29867
|
-
|
|
29868
|
-
|
|
29869
|
-
if (origin) {
|
|
29870
|
-
const widgets = measureWidgetsViaBoundingRect(scrollRoot, origin, {
|
|
29871
|
-
pageCount,
|
|
29872
|
-
visiblePageIndexRange
|
|
29873
|
-
});
|
|
29874
|
-
const originRect = origin.getBoundingClientRect();
|
|
29875
|
-
const scrollHeight = (
|
|
29876
|
-
// geometry:allow-dom-fallback
|
|
29877
|
-
origin.clientHeight > 0 ? origin.clientHeight : originRect.height > 0 ? originRect.height : scrollRoot.clientHeight
|
|
29878
|
-
);
|
|
29879
|
-
const domRects = resolvePageOverlayRects({
|
|
29880
|
-
widgets,
|
|
29881
|
-
pageCount,
|
|
29882
|
-
scrollHeight,
|
|
29883
|
-
visiblePageIndexRange
|
|
29884
|
-
});
|
|
29885
|
-
setRects(
|
|
29886
|
-
reconcileDomRects(domRects)
|
|
29887
|
-
);
|
|
29888
|
-
} else {
|
|
29889
|
-
const widgets = measureWidgetsViaOffsetChain(scrollRoot, {
|
|
29890
|
-
pageCount,
|
|
29891
|
-
visiblePageIndexRange
|
|
29892
|
-
});
|
|
29893
|
-
const domRects = resolvePageOverlayRects({
|
|
29894
|
-
widgets,
|
|
29895
|
-
pageCount,
|
|
29896
|
-
// geometry:allow-dom-fallback
|
|
29897
|
-
scrollHeight: scrollRoot.clientHeight,
|
|
29898
|
-
visiblePageIndexRange
|
|
29899
|
-
});
|
|
29900
|
-
setRects(
|
|
29901
|
-
reconcileDomRects(domRects)
|
|
29902
|
-
);
|
|
29903
|
-
}
|
|
29904
|
-
}, [facet, geometryFacet, resolveUiPageRects, scrollRoot, visiblePageIndexRange]);
|
|
29504
|
+
const skeletalRects = resolveSkeletalPageOverlayRectsFromLayout(facet).filter(
|
|
29505
|
+
(rect2) => !visiblePageIndexRange || rect2.pageIndex >= visiblePageIndexRange.start && rect2.pageIndex < visiblePageIndexRange.end
|
|
29506
|
+
);
|
|
29507
|
+
setRects(skeletalRects);
|
|
29508
|
+
}, [facet, geometryFacet, resolveUiPageRects, visiblePageIndexRange]);
|
|
29905
29509
|
const refreshRects = import_react29.default.useCallback(() => {
|
|
29906
29510
|
if (!scrollRoot) {
|
|
29907
29511
|
refreshRectsNow();
|
|
@@ -29941,33 +29545,6 @@ var TwPageStackChromeLayerInner = ({
|
|
|
29941
29545
|
},
|
|
29942
29546
|
[onOpenStory]
|
|
29943
29547
|
);
|
|
29944
|
-
import_react29.default.useEffect(() => {
|
|
29945
|
-
if (geometryFacet) return;
|
|
29946
|
-
if (!scrollRoot) return;
|
|
29947
|
-
const runtime = scrollRoot.ownerDocument?.defaultView;
|
|
29948
|
-
if (!runtime?.ResizeObserver) return;
|
|
29949
|
-
const observer = new runtime.ResizeObserver(() => refreshRects());
|
|
29950
|
-
observer.observe(scrollRoot);
|
|
29951
|
-
return () => observer.disconnect();
|
|
29952
|
-
}, [geometryFacet, scrollRoot, refreshRects]);
|
|
29953
|
-
import_react29.default.useEffect(() => {
|
|
29954
|
-
if (geometryFacet) return;
|
|
29955
|
-
if (!scrollRoot) return;
|
|
29956
|
-
const runtime = scrollRoot.ownerDocument?.defaultView;
|
|
29957
|
-
if (!runtime?.MutationObserver) return;
|
|
29958
|
-
const observer = new runtime.MutationObserver((records) => {
|
|
29959
|
-
const overlay = overlayRootRef.current;
|
|
29960
|
-
if (overlay) {
|
|
29961
|
-
const allSelf = records.every(
|
|
29962
|
-
(r) => r.target instanceof Node && overlay.contains(r.target)
|
|
29963
|
-
);
|
|
29964
|
-
if (allSelf) return;
|
|
29965
|
-
}
|
|
29966
|
-
refreshRects();
|
|
29967
|
-
});
|
|
29968
|
-
observer.observe(scrollRoot, { childList: true, subtree: false });
|
|
29969
|
-
return () => observer.disconnect();
|
|
29970
|
-
}, [geometryFacet, scrollRoot, refreshRects]);
|
|
29971
29548
|
import_react29.default.useLayoutEffect(() => {
|
|
29972
29549
|
if (!pmSurfaceElement) return;
|
|
29973
29550
|
const overlay = overlayRootRef.current;
|
|
@@ -31452,45 +31029,17 @@ var TwFloatingImageLayer = ({
|
|
|
31452
31029
|
const [pageRects, setPageRects] = React37.useState([]);
|
|
31453
31030
|
const refreshPageRectsNow = React37.useCallback(() => {
|
|
31454
31031
|
const pageCount = facet.getPageCount();
|
|
31455
|
-
if (geometryFacet) {
|
|
31456
|
-
const geometryRects = resolvePageOverlayRectsFromGeometry2(
|
|
31457
|
-
geometryFacet,
|
|
31458
|
-
pageCount,
|
|
31459
|
-
visiblePageIndexRange
|
|
31460
|
-
);
|
|
31461
|
-
if (geometryRects !== null) {
|
|
31462
|
-
setPageRects(geometryRects);
|
|
31463
|
-
return;
|
|
31464
|
-
}
|
|
31465
|
-
setPageRects([]);
|
|
31466
|
-
return;
|
|
31467
|
-
}
|
|
31468
|
-
if (!scrollRoot) {
|
|
31032
|
+
if (!geometryFacet) {
|
|
31469
31033
|
setPageRects([]);
|
|
31470
31034
|
return;
|
|
31471
31035
|
}
|
|
31472
|
-
const
|
|
31473
|
-
|
|
31474
|
-
setPageRects([]);
|
|
31475
|
-
return;
|
|
31476
|
-
}
|
|
31477
|
-
const widgets = measureWidgetsViaBoundingRect(scrollRoot, origin, {
|
|
31036
|
+
const geometryRects = resolvePageOverlayRectsFromGeometry2(
|
|
31037
|
+
geometryFacet,
|
|
31478
31038
|
pageCount,
|
|
31479
31039
|
visiblePageIndexRange
|
|
31480
|
-
});
|
|
31481
|
-
const originRect = origin.getBoundingClientRect();
|
|
31482
|
-
setPageRects(
|
|
31483
|
-
resolvePageOverlayRects({
|
|
31484
|
-
widgets,
|
|
31485
|
-
pageCount,
|
|
31486
|
-
scrollHeight: (
|
|
31487
|
-
// geometry:allow-dom-fallback
|
|
31488
|
-
origin.clientHeight > 0 ? origin.clientHeight : originRect.height
|
|
31489
|
-
),
|
|
31490
|
-
visiblePageIndexRange
|
|
31491
|
-
})
|
|
31492
31040
|
);
|
|
31493
|
-
|
|
31041
|
+
setPageRects(geometryRects ?? []);
|
|
31042
|
+
}, [facet, geometryFacet, visiblePageIndexRange]);
|
|
31494
31043
|
const refreshPageRects = React37.useCallback(() => {
|
|
31495
31044
|
if (!scrollRoot) {
|
|
31496
31045
|
refreshPageRectsNow();
|
|
@@ -31520,47 +31069,6 @@ var TwFloatingImageLayer = ({
|
|
|
31520
31069
|
}
|
|
31521
31070
|
};
|
|
31522
31071
|
}, [refreshPageRects, renderFrameRevision, scrollRoot]);
|
|
31523
|
-
React37.useEffect(() => {
|
|
31524
|
-
if (geometryFacet) {
|
|
31525
|
-
return;
|
|
31526
|
-
}
|
|
31527
|
-
if (!scrollRoot) {
|
|
31528
|
-
return;
|
|
31529
|
-
}
|
|
31530
|
-
const runtime = scrollRoot.ownerDocument?.defaultView;
|
|
31531
|
-
if (!runtime?.ResizeObserver) {
|
|
31532
|
-
return;
|
|
31533
|
-
}
|
|
31534
|
-
const observer = new runtime.ResizeObserver(() => refreshPageRects());
|
|
31535
|
-
observer.observe(scrollRoot);
|
|
31536
|
-
return () => observer.disconnect();
|
|
31537
|
-
}, [geometryFacet, refreshPageRects, scrollRoot]);
|
|
31538
|
-
React37.useEffect(() => {
|
|
31539
|
-
if (geometryFacet) {
|
|
31540
|
-
return;
|
|
31541
|
-
}
|
|
31542
|
-
if (!scrollRoot) {
|
|
31543
|
-
return;
|
|
31544
|
-
}
|
|
31545
|
-
const runtime = scrollRoot.ownerDocument?.defaultView;
|
|
31546
|
-
if (!runtime?.MutationObserver) {
|
|
31547
|
-
return;
|
|
31548
|
-
}
|
|
31549
|
-
const observer = new runtime.MutationObserver((records) => {
|
|
31550
|
-
const overlay = overlayRootRef.current;
|
|
31551
|
-
if (overlay) {
|
|
31552
|
-
const allSelf = records.every(
|
|
31553
|
-
(record) => record.target instanceof Node && overlay.contains(record.target)
|
|
31554
|
-
);
|
|
31555
|
-
if (allSelf) {
|
|
31556
|
-
return;
|
|
31557
|
-
}
|
|
31558
|
-
}
|
|
31559
|
-
refreshPageRects();
|
|
31560
|
-
});
|
|
31561
|
-
observer.observe(scrollRoot, { childList: true, subtree: false });
|
|
31562
|
-
return () => observer.disconnect();
|
|
31563
|
-
}, [geometryFacet, refreshPageRects, scrollRoot]);
|
|
31564
31072
|
const items = React37.useMemo(() => {
|
|
31565
31073
|
const viewportScale = geometryFacet?.getViewport().pxPerTwip;
|
|
31566
31074
|
const pxPerTwip = typeof viewportScale === "number" && viewportScale > 0 ? viewportScale : void 0;
|