@beyondwork/docx-react-component 1.0.133 → 1.0.135
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 +23 -3
- package/dist/api/public-types.d.cts +1 -1
- package/dist/api/public-types.d.ts +1 -1
- package/dist/api/public-types.js +2 -2
- package/dist/api/v3.cjs +708 -47
- package/dist/api/v3.d.cts +2 -2
- package/dist/api/v3.d.ts +2 -2
- package/dist/api/v3.js +4 -4
- package/dist/{chunk-REFHJ2FN.js → chunk-2BNXARVO.js} +3 -3
- package/dist/{chunk-INLRCC4N.js → chunk-4CIHTMCH.js} +2 -2
- package/dist/{chunk-224TSMEB.js → chunk-5CCYF333.js} +138 -42
- package/dist/{chunk-MQ5GAJ54.js → chunk-BJXSMPHD.js} +1 -1
- package/dist/{chunk-OTRVGNZQ.js → chunk-EPFVMUKF.js} +548 -3
- package/dist/{chunk-XBQFDBXE.js → chunk-EZFF6GKF.js} +9 -2
- package/dist/{chunk-S3PEKX6H.js → chunk-FGJTOFZY.js} +72 -554
- package/dist/{chunk-3JEE5RJU.js → chunk-GIFXKIM5.js} +612 -34
- package/dist/{chunk-57HTKX3P.js → chunk-H4HI6RUE.js} +1 -1
- package/dist/{chunk-KL4TZSZV.js → chunk-HWMPNLEF.js} +1 -1
- package/dist/{chunk-ZFCZ7XXH.js → chunk-NEMOQ4QR.js} +1 -1
- package/dist/{chunk-CVSD3UNK.js → chunk-P7XDEVS6.js} +15 -2
- package/dist/{chunk-QTRJLKR2.js → chunk-TSNK4ECL.js} +1 -1
- package/dist/{chunk-WDDFU2N2.js → chunk-UR2LW63N.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.cjs +9 -2
- package/dist/core/commands/image-commands.d.cts +1 -1
- package/dist/core/commands/image-commands.d.ts +1 -1
- package/dist/core/commands/image-commands.js +4 -4
- 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.cjs +9 -2
- 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/table-structure-commands.js +3 -3
- package/dist/core/commands/text-commands.cjs +9 -2
- package/dist/core/commands/text-commands.d.cts +1 -1
- package/dist/core/commands/text-commands.d.ts +1 -1
- package/dist/core/commands/text-commands.js +4 -4
- 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 +1478 -636
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +113 -26
- 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-BQ7AB-0v.d.cts} +2 -2
- package/dist/{loader-DfTjqVwn.d.ts → loader-Cy6OYBfn.d.ts} +2 -2
- package/dist/{public-types-S8gTYwKo.d.cts → public-types-D31xKNGc.d.cts} +146 -3
- package/dist/{public-types-B5lOUIrP.d.ts → public-types-DqYt8GdP.d.ts} +146 -3
- package/dist/public-types.cjs +23 -3
- package/dist/public-types.d.cts +1 -1
- package/dist/public-types.d.ts +1 -1
- package/dist/public-types.js +2 -2
- package/dist/runtime/collab.d.cts +2 -2
- package/dist/runtime/collab.d.ts +2 -2
- package/dist/runtime/document-runtime.cjs +760 -68
- package/dist/runtime/document-runtime.d.cts +1 -1
- package/dist/runtime/document-runtime.d.ts +1 -1
- package/dist/runtime/document-runtime.js +10 -10
- package/dist/{session-CR2A1hGZ.d.cts → session-DA-F2fCw.d.cts} +2 -2
- package/dist/{session-CBDIOYXA.d.ts → session-DqL8H0oZ.d.ts} +2 -2
- package/dist/session.d.cts +4 -4
- package/dist/session.d.ts +4 -4
- package/dist/tailwind.cjs +81 -554
- package/dist/tailwind.d.cts +1 -1
- package/dist/tailwind.d.ts +1 -1
- package/dist/tailwind.js +5 -5
- package/dist/{types-yty2K-hk.d.cts → types-B2y94n5t.d.cts} +1 -1
- package/dist/{types-B-90ywjU.d.ts → types-SllbCtGs.d.ts} +1 -1
- package/dist/ui-tailwind/editor-surface/search-plugin.cjs +11 -0
- 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 +3 -3
- package/dist/ui-tailwind.cjs +81 -554
- package/dist/ui-tailwind.d.cts +2 -2
- package/dist/ui-tailwind.d.ts +2 -2
- package/dist/ui-tailwind.js +5 -5
- package/package.json +1 -1
package/dist/ui-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
|
|
@@ -12358,10 +12339,16 @@ var FormattingContextImpl = class {
|
|
|
12358
12339
|
// surface-projection calls `resolveParagraphCascade` on the same
|
|
12359
12340
|
// paragraph via `resolveParagraph` + numbering resolve + marker-rPr;
|
|
12360
12341
|
// each of those re-walked the style catalog before.
|
|
12361
|
-
|
|
12342
|
+
//
|
|
12343
|
+
// Defaults to a per-context instance, but the runtime can supply a
|
|
12344
|
+
// persistent `WeakMap` via `FormattingContextOptions.paragraphCascadeCache`
|
|
12345
|
+
// so unchanged paragraphs don't re-cascade on every keystroke. See the
|
|
12346
|
+
// contract on the option for invalidation semantics.
|
|
12347
|
+
paragraphCascadeCache;
|
|
12362
12348
|
constructor(doc, opts) {
|
|
12363
12349
|
this.doc = doc;
|
|
12364
12350
|
this.opts = opts;
|
|
12351
|
+
this.paragraphCascadeCache = opts.paragraphCascadeCache ?? /* @__PURE__ */ new WeakMap();
|
|
12365
12352
|
const canonicalTheme = doc.subParts?.canonicalTheme;
|
|
12366
12353
|
this.theme = opts.themeResolver ?? (canonicalTheme ? new ThemeColorResolver(canonicalTheme) : void 0);
|
|
12367
12354
|
this.numbering = opts.numberingPrefixResolver ?? createNumberingPrefixResolver(doc.numbering);
|
|
@@ -12796,6 +12783,7 @@ var PICTURE_EFFECT_SCHEME_ALIASES = {
|
|
|
12796
12783
|
bg2: "lt2"
|
|
12797
12784
|
};
|
|
12798
12785
|
var EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH = /* @__PURE__ */ new Map();
|
|
12786
|
+
var NO_EDITABLE_TARGETS_INDEX = EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH;
|
|
12799
12787
|
function indexEditableTargetsByBlockPath(document2) {
|
|
12800
12788
|
const targets = collectEditableTargetRefs(document2);
|
|
12801
12789
|
if (targets.length === 0) return EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH;
|
|
@@ -12845,7 +12833,8 @@ function createEditorSurfaceSnapshot(document2, _selection, activeStory = { kind
|
|
|
12845
12833
|
const formattingContext = createFormattingContext(document2, {
|
|
12846
12834
|
...options.revisionMarkupMode ? { revisionMarkupMode: options.revisionMarkupMode } : {},
|
|
12847
12835
|
...options.getEffectiveMarkupMode ? { getEffectiveMarkupMode: options.getEffectiveMarkupMode } : {},
|
|
12848
|
-
...options.authorColorPalette ? { authorColorPalette: options.authorColorPalette } : {}
|
|
12836
|
+
...options.authorColorPalette ? { authorColorPalette: options.authorColorPalette } : {},
|
|
12837
|
+
...options.paragraphCascadeCache ? { paragraphCascadeCache: options.paragraphCascadeCache } : {}
|
|
12849
12838
|
});
|
|
12850
12839
|
const editableTargetsByBlockPath = options.editableTargetsByBlockPath ?? indexEditableTargetsByBlockPath(document2);
|
|
12851
12840
|
const layoutIdentitiesByBlockPath = options.layoutIdentitiesByBlockPath;
|
|
@@ -15012,7 +15001,8 @@ function buildResolvedSections(document2) {
|
|
|
15012
15001
|
const mainSurface = createEditorSurfaceSnapshot(
|
|
15013
15002
|
document2,
|
|
15014
15003
|
createSelectionSnapshot(0, 0),
|
|
15015
|
-
MAIN_STORY_TARGET
|
|
15004
|
+
MAIN_STORY_TARGET,
|
|
15005
|
+
{ editableTargetsByBlockPath: NO_EDITABLE_TARGETS_INDEX }
|
|
15016
15006
|
);
|
|
15017
15007
|
const sections = [];
|
|
15018
15008
|
let sectionStart = 0;
|
|
@@ -25206,6 +25196,14 @@ var EDITOR_ACTION_REGISTRY = [
|
|
|
25206
25196
|
targetKinds: ["generated-field"],
|
|
25207
25197
|
callback: "onUpdateFields"
|
|
25208
25198
|
}),
|
|
25199
|
+
mk({
|
|
25200
|
+
id: "toc-refresh",
|
|
25201
|
+
label: "Refresh table of contents",
|
|
25202
|
+
description: "Refresh TOC entries through the runtime table-of-contents updater.",
|
|
25203
|
+
group: "misc",
|
|
25204
|
+
targetKinds: ["toc-field"],
|
|
25205
|
+
callback: "onUpdateTableOfContents"
|
|
25206
|
+
}),
|
|
25209
25207
|
// -------- Workflow scope --------
|
|
25210
25208
|
mk({
|
|
25211
25209
|
id: "scope-open-card",
|
|
@@ -26099,6 +26097,18 @@ function hasAncestorAttributeValue(el, attribute, expected, root) {
|
|
|
26099
26097
|
}
|
|
26100
26098
|
return false;
|
|
26101
26099
|
}
|
|
26100
|
+
function hasAncestorAttributeValueInsensitive(el, attribute, expected, root) {
|
|
26101
|
+
const normalizedExpected = expected.toLowerCase();
|
|
26102
|
+
let cursor = el;
|
|
26103
|
+
while (cursor) {
|
|
26104
|
+
if (cursor.getAttribute?.(attribute)?.toLowerCase() === normalizedExpected) {
|
|
26105
|
+
return true;
|
|
26106
|
+
}
|
|
26107
|
+
if (cursor === root) return false;
|
|
26108
|
+
cursor = cursor.parentElement;
|
|
26109
|
+
}
|
|
26110
|
+
return false;
|
|
26111
|
+
}
|
|
26102
26112
|
function resolveTargetKind(target, options = {}) {
|
|
26103
26113
|
const kinds = [];
|
|
26104
26114
|
const el = toElement(target);
|
|
@@ -26113,7 +26123,12 @@ function resolveTargetKind(target, options = {}) {
|
|
|
26113
26123
|
const insideListItem = insideNumberingMarker || hasAncestorAttributeValue(el, "data-numbered", "true", root);
|
|
26114
26124
|
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
26125
|
if (insideListItem) kinds.push("list-item");
|
|
26116
|
-
if (insideGeneratedField)
|
|
26126
|
+
if (insideGeneratedField) {
|
|
26127
|
+
kinds.push("generated-field");
|
|
26128
|
+
if (hasAncestorAttributeValueInsensitive(el, "data-field-family", "TOC", root)) {
|
|
26129
|
+
kinds.push("toc-field");
|
|
26130
|
+
}
|
|
26131
|
+
}
|
|
26117
26132
|
if (hasAncestorTag(el, "a", root)) kinds.push("hyperlink");
|
|
26118
26133
|
if (!insideNumberingMarker && hasAncestorTag(el, "img", root)) {
|
|
26119
26134
|
kinds.push("image");
|
|
@@ -27235,294 +27250,6 @@ function resolveSkeletalPageOverlayRectsFromLayout(facet) {
|
|
|
27235
27250
|
}
|
|
27236
27251
|
return rects;
|
|
27237
27252
|
}
|
|
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
27253
|
var resolvePageOverlayRectsFromGeometry2 = resolvePageOverlayRectsFromGeometry;
|
|
27527
27254
|
function resolvePageOverlayRectsFromUiApi(ui, pageCount, visiblePageIndexRange, pageIds) {
|
|
27528
27255
|
if (pageCount <= 0) return [];
|
|
@@ -27580,17 +27307,6 @@ var TwPageStackOverlayLayer = ({
|
|
|
27580
27307
|
},
|
|
27581
27308
|
[]
|
|
27582
27309
|
);
|
|
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
27310
|
const refreshRectsNow = React21.useCallback(() => {
|
|
27595
27311
|
const pageCount = facet.getPageCount();
|
|
27596
27312
|
const skeletalRects = resolveSkeletalPageOverlayRectsFromLayout(facet);
|
|
@@ -27631,51 +27347,11 @@ var TwPageStackOverlayLayer = ({
|
|
|
27631
27347
|
setRectsIfChanged(skeletalRects);
|
|
27632
27348
|
return;
|
|
27633
27349
|
}
|
|
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
|
-
}
|
|
27350
|
+
incrementInvalidationCounter("overlay.page.skeletal_fallback");
|
|
27351
|
+
setRectsIfChanged(skeletalRects);
|
|
27674
27352
|
}, [
|
|
27675
27353
|
facet,
|
|
27676
27354
|
geometryFacet,
|
|
27677
|
-
reconcilePaperRectsWithFlow,
|
|
27678
|
-
scrollRoot,
|
|
27679
27355
|
setRectsIfChanged,
|
|
27680
27356
|
ui
|
|
27681
27357
|
]);
|
|
@@ -27706,33 +27382,6 @@ var TwPageStackOverlayLayer = ({
|
|
|
27706
27382
|
}
|
|
27707
27383
|
};
|
|
27708
27384
|
}, [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
27385
|
if (rects.length === 0) {
|
|
27737
27386
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
27738
27387
|
"div",
|
|
@@ -29824,25 +29473,23 @@ var TwPageStackChromeLayerInner = ({
|
|
|
29824
29473
|
const pageCount = facet.getPageCount();
|
|
29825
29474
|
const uiRects = resolveUiPageRects(pageCount);
|
|
29826
29475
|
if (uiRects !== null) return uiRects;
|
|
29827
|
-
if (
|
|
29828
|
-
|
|
29829
|
-
|
|
29830
|
-
|
|
29831
|
-
|
|
29476
|
+
if (geometryFacet) {
|
|
29477
|
+
const warm = resolvePageOverlayRectsFromGeometry2(
|
|
29478
|
+
geometryFacet,
|
|
29479
|
+
pageCount,
|
|
29480
|
+
visiblePageIndexRange
|
|
29481
|
+
);
|
|
29482
|
+
if (warm !== null) return warm;
|
|
29483
|
+
}
|
|
29484
|
+
return resolveSkeletalPageOverlayRectsFromLayout(facet).filter(
|
|
29485
|
+
(rect2) => !visiblePageIndexRange || rect2.pageIndex >= visiblePageIndexRange.start && rect2.pageIndex < visiblePageIndexRange.end
|
|
29832
29486
|
);
|
|
29833
|
-
return warm ?? [];
|
|
29834
29487
|
});
|
|
29835
29488
|
const overlayRootRef = import_react29.default.useRef(null);
|
|
29836
29489
|
const rafHandleRef = import_react29.default.useRef(null);
|
|
29837
29490
|
const [activeStoryPageIndex, setActiveStoryPageIndex] = import_react29.default.useState(null);
|
|
29838
29491
|
const refreshRectsNow = import_react29.default.useCallback(() => {
|
|
29839
29492
|
const pageCount = facet.getPageCount();
|
|
29840
|
-
const reconcileDomRects = (baseRects) => reconcilePageStackRectsWithFlow({
|
|
29841
|
-
baseRects,
|
|
29842
|
-
pageCount,
|
|
29843
|
-
scrollRoot,
|
|
29844
|
-
originElement: overlayRootRef.current
|
|
29845
|
-
});
|
|
29846
29493
|
const uiRects = resolveUiPageRects(pageCount);
|
|
29847
29494
|
if (uiRects !== null) {
|
|
29848
29495
|
setRects(uiRects);
|
|
@@ -29861,47 +29508,11 @@ var TwPageStackChromeLayerInner = ({
|
|
|
29861
29508
|
setRects([]);
|
|
29862
29509
|
return;
|
|
29863
29510
|
}
|
|
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]);
|
|
29511
|
+
const skeletalRects = resolveSkeletalPageOverlayRectsFromLayout(facet).filter(
|
|
29512
|
+
(rect2) => !visiblePageIndexRange || rect2.pageIndex >= visiblePageIndexRange.start && rect2.pageIndex < visiblePageIndexRange.end
|
|
29513
|
+
);
|
|
29514
|
+
setRects(skeletalRects);
|
|
29515
|
+
}, [facet, geometryFacet, resolveUiPageRects, visiblePageIndexRange]);
|
|
29905
29516
|
const refreshRects = import_react29.default.useCallback(() => {
|
|
29906
29517
|
if (!scrollRoot) {
|
|
29907
29518
|
refreshRectsNow();
|
|
@@ -29941,33 +29552,6 @@ var TwPageStackChromeLayerInner = ({
|
|
|
29941
29552
|
},
|
|
29942
29553
|
[onOpenStory]
|
|
29943
29554
|
);
|
|
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
29555
|
import_react29.default.useLayoutEffect(() => {
|
|
29972
29556
|
if (!pmSurfaceElement) return;
|
|
29973
29557
|
const overlay = overlayRootRef.current;
|
|
@@ -30145,6 +29729,10 @@ function TwTableGripLayer({
|
|
|
30145
29729
|
tableGeometry,
|
|
30146
29730
|
plan.columnsTwips
|
|
30147
29731
|
);
|
|
29732
|
+
const columnWidthCapability = tableContext.operations.setColumnWidth;
|
|
29733
|
+
const rowHeightCapability = tableContext.operations.setRowHeight;
|
|
29734
|
+
const columnResizeDisabled = !!disabled || !onSetColumnWidth || columnWidthCapability?.enabled === false;
|
|
29735
|
+
const rowResizeDisabled = !!disabled || !onSetRowHeight || rowHeightCapability?.enabled === false;
|
|
30148
29736
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
30149
29737
|
plan.columnResizeHandles.map((handle) => {
|
|
30150
29738
|
const rect2 = resolveColumnEdgeRect(
|
|
@@ -30159,7 +29747,8 @@ function TwTableGripLayer({
|
|
|
30159
29747
|
colIndex: handle.columnIndex,
|
|
30160
29748
|
originalTwips: plan.columnsTwips[handle.columnIndex] ?? 720,
|
|
30161
29749
|
pxPerTwip,
|
|
30162
|
-
disabled:
|
|
29750
|
+
disabled: columnResizeDisabled,
|
|
29751
|
+
disabledReason: columnWidthCapability?.reason,
|
|
30163
29752
|
onCommit: onSetColumnWidth
|
|
30164
29753
|
},
|
|
30165
29754
|
`col-${blockId}-${handle.columnIndex}`
|
|
@@ -30180,7 +29769,8 @@ function TwTableGripLayer({
|
|
|
30180
29769
|
rowIndex,
|
|
30181
29770
|
originalTwips,
|
|
30182
29771
|
pxPerTwip,
|
|
30183
|
-
disabled:
|
|
29772
|
+
disabled: rowResizeDisabled,
|
|
29773
|
+
disabledReason: rowHeightCapability?.reason,
|
|
30184
29774
|
onCommit: onSetRowHeight
|
|
30185
29775
|
},
|
|
30186
29776
|
`row-${blockId}-${rowIndex}`
|
|
@@ -30270,6 +29860,7 @@ function ColResizeGrip({
|
|
|
30270
29860
|
originalTwips,
|
|
30271
29861
|
pxPerTwip,
|
|
30272
29862
|
disabled,
|
|
29863
|
+
disabledReason,
|
|
30273
29864
|
onCommit
|
|
30274
29865
|
}) {
|
|
30275
29866
|
const dragRef = (0, import_react30.useRef)(null);
|
|
@@ -30328,11 +29919,13 @@ function ColResizeGrip({
|
|
|
30328
29919
|
role: "separator",
|
|
30329
29920
|
"aria-orientation": "vertical",
|
|
30330
29921
|
"aria-label": `Resize column ${colIndex + 1}`,
|
|
29922
|
+
"aria-disabled": disabled ? "true" : void 0,
|
|
30331
29923
|
"data-testid": `col-resize-grip-${colIndex}`,
|
|
30332
29924
|
"data-active": isActive ? "true" : "false",
|
|
29925
|
+
title: disabled ? disabledReason : void 0,
|
|
30333
29926
|
className: [
|
|
30334
|
-
"wre-table-grip-col
|
|
30335
|
-
disabled ? "opacity-0 cursor-default" : ""
|
|
29927
|
+
"wre-table-grip-col absolute",
|
|
29928
|
+
disabled ? "pointer-events-none opacity-0 cursor-default" : "pointer-events-auto"
|
|
30336
29929
|
].filter(Boolean).join(" "),
|
|
30337
29930
|
style: {
|
|
30338
29931
|
left: `calc(${pos.left} - ${GRIP_HIT_PX / 2}px)`,
|
|
@@ -30350,6 +29943,7 @@ function RowResizeGrip({
|
|
|
30350
29943
|
originalTwips,
|
|
30351
29944
|
pxPerTwip,
|
|
30352
29945
|
disabled,
|
|
29946
|
+
disabledReason,
|
|
30353
29947
|
onCommit
|
|
30354
29948
|
}) {
|
|
30355
29949
|
const dragRef = (0, import_react30.useRef)(null);
|
|
@@ -30409,11 +30003,13 @@ function RowResizeGrip({
|
|
|
30409
30003
|
role: "separator",
|
|
30410
30004
|
"aria-orientation": "horizontal",
|
|
30411
30005
|
"aria-label": `Resize row ${rowIndex + 1}`,
|
|
30006
|
+
"aria-disabled": disabled ? "true" : void 0,
|
|
30412
30007
|
"data-testid": `row-resize-grip-${rowIndex}`,
|
|
30413
30008
|
"data-active": isActive ? "true" : "false",
|
|
30009
|
+
title: disabled ? disabledReason : void 0,
|
|
30414
30010
|
className: [
|
|
30415
|
-
"wre-table-grip-row
|
|
30416
|
-
disabled ? "opacity-0 cursor-default" : ""
|
|
30011
|
+
"wre-table-grip-row absolute",
|
|
30012
|
+
disabled ? "pointer-events-none opacity-0 cursor-default" : "pointer-events-auto"
|
|
30417
30013
|
].filter(Boolean).join(" "),
|
|
30418
30014
|
style: {
|
|
30419
30015
|
left: pos.left,
|
|
@@ -31452,45 +31048,17 @@ var TwFloatingImageLayer = ({
|
|
|
31452
31048
|
const [pageRects, setPageRects] = React37.useState([]);
|
|
31453
31049
|
const refreshPageRectsNow = React37.useCallback(() => {
|
|
31454
31050
|
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
|
-
}
|
|
31051
|
+
if (!geometryFacet) {
|
|
31465
31052
|
setPageRects([]);
|
|
31466
31053
|
return;
|
|
31467
31054
|
}
|
|
31468
|
-
|
|
31469
|
-
|
|
31470
|
-
return;
|
|
31471
|
-
}
|
|
31472
|
-
const origin = overlayRootRef.current;
|
|
31473
|
-
if (!origin) {
|
|
31474
|
-
setPageRects([]);
|
|
31475
|
-
return;
|
|
31476
|
-
}
|
|
31477
|
-
const widgets = measureWidgetsViaBoundingRect(scrollRoot, origin, {
|
|
31055
|
+
const geometryRects = resolvePageOverlayRectsFromGeometry2(
|
|
31056
|
+
geometryFacet,
|
|
31478
31057
|
pageCount,
|
|
31479
31058
|
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
31059
|
);
|
|
31493
|
-
|
|
31060
|
+
setPageRects(geometryRects ?? []);
|
|
31061
|
+
}, [facet, geometryFacet, visiblePageIndexRange]);
|
|
31494
31062
|
const refreshPageRects = React37.useCallback(() => {
|
|
31495
31063
|
if (!scrollRoot) {
|
|
31496
31064
|
refreshPageRectsNow();
|
|
@@ -31520,47 +31088,6 @@ var TwFloatingImageLayer = ({
|
|
|
31520
31088
|
}
|
|
31521
31089
|
};
|
|
31522
31090
|
}, [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
31091
|
const items = React37.useMemo(() => {
|
|
31565
31092
|
const viewportScale = geometryFacet?.getViewport().pxPerTwip;
|
|
31566
31093
|
const pxPerTwip = typeof viewportScale === "number" && viewportScale > 0 ? viewportScale : void 0;
|