@superdoc-dev/cli 0.2.0-next.73 → 0.2.0-next.74
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 +402 -39
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -106109,9 +106109,9 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
|
|
|
106109
106109
|
init_remark_gfm_z_sDF4ss_es();
|
|
106110
106110
|
});
|
|
106111
106111
|
|
|
106112
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
106113
|
-
var
|
|
106114
|
-
__export(
|
|
106112
|
+
// ../../packages/superdoc/dist/chunks/src-BU12K8Zl.es.js
|
|
106113
|
+
var exports_src_BU12K8Zl_es = {};
|
|
106114
|
+
__export(exports_src_BU12K8Zl_es, {
|
|
106115
106115
|
zt: () => defineMark,
|
|
106116
106116
|
z: () => cM,
|
|
106117
106117
|
yt: () => removeAwarenessStates,
|
|
@@ -140260,6 +140260,11 @@ function invalidateHeaderFooterCache(cache$3, cacheState, headerBlocks, footerBl
|
|
|
140260
140260
|
}
|
|
140261
140261
|
}
|
|
140262
140262
|
async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, options, measureBlock$1, headerFooter, previousMeasures) {
|
|
140263
|
+
const isSemanticFlow = options.flowMode === "semantic";
|
|
140264
|
+
if (isSemanticFlow) {
|
|
140265
|
+
headerFooter = undefined;
|
|
140266
|
+
nextBlocks = rewriteSectionBreaksForSemanticFlow(nextBlocks, options);
|
|
140267
|
+
}
|
|
140263
140268
|
const dirtyStart = performance.now();
|
|
140264
140269
|
const dirty = computeDirtyRegions(previousBlocks, nextBlocks);
|
|
140265
140270
|
performance.now() - dirtyStart;
|
|
@@ -140270,7 +140275,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
140270
140275
|
if (measurementWidth <= 0 || measurementHeight <= 0)
|
|
140271
140276
|
throw new Error("incrementalLayout: invalid measurement constraints resolved from options");
|
|
140272
140277
|
const hasPreviousMeasures = Array.isArray(previousMeasures) && previousMeasures.length === previousBlocks.length;
|
|
140273
|
-
const previousConstraints = hasPreviousMeasures ? resolveMeasurementConstraints(options, previousBlocks) : null;
|
|
140278
|
+
const previousConstraints = hasPreviousMeasures && !isSemanticFlow ? resolveMeasurementConstraints(options, previousBlocks) : null;
|
|
140274
140279
|
const canReusePreviousMeasures = hasPreviousMeasures && previousConstraints?.measurementWidth === measurementWidth && previousConstraints?.measurementHeight === measurementHeight;
|
|
140275
140280
|
const previousPerSectionConstraints = canReusePreviousMeasures ? computePerSectionConstraints(options, previousBlocks) : null;
|
|
140276
140281
|
const previousMeasuresById = canReusePreviousMeasures ? new Map(previousBlocks.map((block, index2) => [block.id, previousMeasures[index2]])) : null;
|
|
@@ -140440,7 +140445,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
140440
140445
|
let totalRemeasureTime = 0;
|
|
140441
140446
|
let totalRelayoutTime = 0;
|
|
140442
140447
|
let converged = true;
|
|
140443
|
-
if (FeatureFlags.BODY_PAGE_TOKENS) {
|
|
140448
|
+
if (!isSemanticFlow && FeatureFlags.BODY_PAGE_TOKENS) {
|
|
140444
140449
|
while (iteration < maxIterations) {
|
|
140445
140450
|
const sections = options.sectionMetadata ?? [];
|
|
140446
140451
|
const numberingCtx = buildNumberingContext(layout, sections);
|
|
@@ -140504,7 +140509,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
140504
140509
|
let extraBlocks;
|
|
140505
140510
|
let extraMeasures;
|
|
140506
140511
|
const footnotesInput = isFootnotesLayoutInput(options.footnotes) ? options.footnotes : null;
|
|
140507
|
-
if (footnotesInput && footnotesInput.refs.length > 0 && footnotesInput.blocksById.size > 0) {
|
|
140512
|
+
if (!isSemanticFlow && footnotesInput && footnotesInput.refs.length > 0 && footnotesInput.blocksById.size > 0) {
|
|
140508
140513
|
const gap = typeof footnotesInput.gap === "number" && Number.isFinite(footnotesInput.gap) ? footnotesInput.gap : 2;
|
|
140509
140514
|
const topPadding = typeof footnotesInput.topPadding === "number" && Number.isFinite(footnotesInput.topPadding) ? footnotesInput.topPadding : 6;
|
|
140510
140515
|
const dividerHeight = typeof footnotesInput.dividerHeight === "number" && Number.isFinite(footnotesInput.dividerHeight) ? footnotesInput.dividerHeight : 6;
|
|
@@ -141037,6 +141042,37 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
141037
141042
|
extraMeasures
|
|
141038
141043
|
};
|
|
141039
141044
|
}
|
|
141045
|
+
function rewriteSectionBreaksForSemanticFlow(blocks2, options) {
|
|
141046
|
+
const semanticPageSize = options.pageSize;
|
|
141047
|
+
const semanticMargins = options.margins;
|
|
141048
|
+
if (!semanticPageSize)
|
|
141049
|
+
return blocks2;
|
|
141050
|
+
if (!blocks2.some((b$1) => b$1.kind === "sectionBreak"))
|
|
141051
|
+
return blocks2;
|
|
141052
|
+
return blocks2.map((block) => {
|
|
141053
|
+
if (block.kind !== "sectionBreak")
|
|
141054
|
+
return block;
|
|
141055
|
+
const sb = block;
|
|
141056
|
+
return {
|
|
141057
|
+
...sb,
|
|
141058
|
+
pageSize: {
|
|
141059
|
+
w: semanticPageSize.w,
|
|
141060
|
+
h: semanticPageSize.h
|
|
141061
|
+
},
|
|
141062
|
+
margins: {
|
|
141063
|
+
...sb.margins,
|
|
141064
|
+
top: semanticMargins?.top,
|
|
141065
|
+
right: semanticMargins?.right,
|
|
141066
|
+
bottom: semanticMargins?.bottom,
|
|
141067
|
+
left: semanticMargins?.left
|
|
141068
|
+
},
|
|
141069
|
+
columns: {
|
|
141070
|
+
count: 1,
|
|
141071
|
+
gap: 0
|
|
141072
|
+
}
|
|
141073
|
+
};
|
|
141074
|
+
});
|
|
141075
|
+
}
|
|
141040
141076
|
function computePerSectionConstraints(options, blocks2) {
|
|
141041
141077
|
const pageSize = options.pageSize ?? DEFAULT_PAGE_SIZE$1;
|
|
141042
141078
|
const defaultMargins = {
|
|
@@ -141080,6 +141116,18 @@ function computePerSectionConstraints(options, blocks2) {
|
|
|
141080
141116
|
return result;
|
|
141081
141117
|
}
|
|
141082
141118
|
function resolveMeasurementConstraints(options, blocks2) {
|
|
141119
|
+
if (options.flowMode === "semantic") {
|
|
141120
|
+
const semanticContentWidth = options.semantic?.contentWidth;
|
|
141121
|
+
if (typeof semanticContentWidth === "number" && Number.isFinite(semanticContentWidth) && semanticContentWidth > 0) {
|
|
141122
|
+
const semanticTop = normalizeMargin(options.semantic?.marginTop, normalizeMargin(options.margins?.top, DEFAULT_MARGINS$1.top));
|
|
141123
|
+
const semanticBottom = normalizeMargin(options.semantic?.marginBottom, normalizeMargin(options.margins?.bottom, DEFAULT_MARGINS$1.bottom));
|
|
141124
|
+
const measurementHeight$1 = Math.max(1, SEMANTIC_PAGE_HEIGHT_PX - (semanticTop + semanticBottom));
|
|
141125
|
+
return {
|
|
141126
|
+
measurementWidth: Math.max(1, Math.floor(semanticContentWidth)),
|
|
141127
|
+
measurementHeight: measurementHeight$1
|
|
141128
|
+
};
|
|
141129
|
+
}
|
|
141130
|
+
}
|
|
141083
141131
|
const pageSize = options.pageSize ?? DEFAULT_PAGE_SIZE$1;
|
|
141084
141132
|
const margins = {
|
|
141085
141133
|
top: normalizeMargin(options.margins?.top, DEFAULT_MARGINS$1.top),
|
|
@@ -142494,8 +142542,11 @@ function hitTestTable(layout, blocks2, measures, normalizedX, normalizedY, confi
|
|
|
142494
142542
|
};
|
|
142495
142543
|
return hitTestTableFragment(pageHit, blocks2, measures, point5);
|
|
142496
142544
|
}
|
|
142545
|
+
function isSemanticFootnoteBlockId(blockId) {
|
|
142546
|
+
return typeof blockId === "string" && blockId.startsWith("__sd_semantic_footnote");
|
|
142547
|
+
}
|
|
142497
142548
|
function isFootnoteBlockId(blockId) {
|
|
142498
|
-
return typeof blockId === "string" && blockId.startsWith("footnote-");
|
|
142549
|
+
return typeof blockId === "string" && (blockId.startsWith("footnote-") || isSemanticFootnoteBlockId(blockId));
|
|
142499
142550
|
}
|
|
142500
142551
|
function isInRegisteredSurface(event) {
|
|
142501
142552
|
const path2 = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
@@ -143771,6 +143822,90 @@ async function layoutWithPerSectionConstraints(kind, blocksByRId, sectionMetadat
|
|
|
143771
143822
|
}
|
|
143772
143823
|
}
|
|
143773
143824
|
}
|
|
143825
|
+
function buildSemanticFootnoteBlocks(input2, footnotesMode) {
|
|
143826
|
+
if (!input2 || input2.refs.length === 0 || input2.blocksById.size === 0)
|
|
143827
|
+
return [];
|
|
143828
|
+
if ((footnotesMode ?? "endOfDocument") !== "endOfDocument")
|
|
143829
|
+
return [];
|
|
143830
|
+
const orderedFootnoteIds = [];
|
|
143831
|
+
const seen = /* @__PURE__ */ new Set;
|
|
143832
|
+
input2.refs.forEach((ref$1) => {
|
|
143833
|
+
if (!ref$1?.id || seen.has(ref$1.id))
|
|
143834
|
+
return;
|
|
143835
|
+
seen.add(ref$1.id);
|
|
143836
|
+
orderedFootnoteIds.push(ref$1.id);
|
|
143837
|
+
});
|
|
143838
|
+
if (orderedFootnoteIds.length === 0)
|
|
143839
|
+
return [];
|
|
143840
|
+
const result = [createSemanticFootnoteHeadingBlock(resolveSemanticFootnoteHeadingRunStyle(input2.blocksById, orderedFootnoteIds))];
|
|
143841
|
+
orderedFootnoteIds.forEach((id2, footnoteIndex) => {
|
|
143842
|
+
(input2.blocksById.get(id2) ?? []).forEach((block, blockIndex) => {
|
|
143843
|
+
result.push(cloneFlowBlockForSemanticFootnote(block, id2, footnoteIndex, blockIndex));
|
|
143844
|
+
});
|
|
143845
|
+
});
|
|
143846
|
+
return result;
|
|
143847
|
+
}
|
|
143848
|
+
function resolveSemanticFootnoteHeadingRunStyle(blocksById, orderedFootnoteIds) {
|
|
143849
|
+
for (const footnoteId of orderedFootnoteIds) {
|
|
143850
|
+
const blocks2 = blocksById.get(footnoteId) ?? [];
|
|
143851
|
+
for (const block of blocks2) {
|
|
143852
|
+
if (block.kind !== "paragraph")
|
|
143853
|
+
continue;
|
|
143854
|
+
for (const run2 of block.runs) {
|
|
143855
|
+
const fontFamily$1 = run2.fontFamily;
|
|
143856
|
+
const fontSize$1 = run2.fontSize;
|
|
143857
|
+
if (typeof fontFamily$1 === "string" && fontFamily$1.length > 0 && typeof fontSize$1 === "number") {
|
|
143858
|
+
if (Number.isFinite(fontSize$1) && fontSize$1 > 0)
|
|
143859
|
+
return {
|
|
143860
|
+
fontFamily: fontFamily$1,
|
|
143861
|
+
fontSize: fontSize$1
|
|
143862
|
+
};
|
|
143863
|
+
}
|
|
143864
|
+
}
|
|
143865
|
+
}
|
|
143866
|
+
}
|
|
143867
|
+
return {
|
|
143868
|
+
fontFamily: DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE.fontFamily,
|
|
143869
|
+
fontSize: DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE.fontSize
|
|
143870
|
+
};
|
|
143871
|
+
}
|
|
143872
|
+
function createSemanticFootnoteHeadingBlock(style$1) {
|
|
143873
|
+
return {
|
|
143874
|
+
kind: "paragraph",
|
|
143875
|
+
id: SEMANTIC_FOOTNOTES_HEADING_BLOCK_ID,
|
|
143876
|
+
attrs: { spacing: DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE.spacing },
|
|
143877
|
+
runs: [{
|
|
143878
|
+
kind: "text",
|
|
143879
|
+
text: "Footnotes",
|
|
143880
|
+
fontFamily: style$1.fontFamily,
|
|
143881
|
+
fontSize: style$1.fontSize,
|
|
143882
|
+
bold: DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE.bold
|
|
143883
|
+
}]
|
|
143884
|
+
};
|
|
143885
|
+
}
|
|
143886
|
+
function cloneFlowBlock(block) {
|
|
143887
|
+
return JSON.parse(JSON.stringify(block));
|
|
143888
|
+
}
|
|
143889
|
+
function stripPmRangesDeep(value) {
|
|
143890
|
+
if (Array.isArray(value)) {
|
|
143891
|
+
value.forEach((item) => stripPmRangesDeep(item));
|
|
143892
|
+
return;
|
|
143893
|
+
}
|
|
143894
|
+
if (!value || typeof value !== "object")
|
|
143895
|
+
return;
|
|
143896
|
+
const record = value;
|
|
143897
|
+
if ("pmStart" in record)
|
|
143898
|
+
delete record.pmStart;
|
|
143899
|
+
if ("pmEnd" in record)
|
|
143900
|
+
delete record.pmEnd;
|
|
143901
|
+
Object.values(record).forEach((nested) => stripPmRangesDeep(nested));
|
|
143902
|
+
}
|
|
143903
|
+
function cloneFlowBlockForSemanticFootnote(block, footnoteId, footnoteIndex, blockIndex) {
|
|
143904
|
+
const cloned = cloneFlowBlock(block);
|
|
143905
|
+
stripPmRangesDeep(cloned);
|
|
143906
|
+
cloned.id = `${SEMANTIC_FOOTNOTE_BLOCK_ID_PREFIX}-${footnoteId}-${footnoteIndex}-${blockIndex}-${block.id}`;
|
|
143907
|
+
return cloned;
|
|
143908
|
+
}
|
|
143774
143909
|
function getBoundaries(ranges) {
|
|
143775
143910
|
const set = /* @__PURE__ */ new Set;
|
|
143776
143911
|
for (const r$1 of ranges) {
|
|
@@ -164822,7 +164957,7 @@ var Node$13 = class Node$14 {
|
|
|
164822
164957
|
if (!Number.isFinite(value) || value < 0)
|
|
164823
164958
|
return 0;
|
|
164824
164959
|
return value;
|
|
164825
|
-
}, COLUMN_MIN_WIDTH_PX = 25, COLUMN_MAX_WIDTH_PX = 200, ROW_MIN_HEIGHT_PX = 10, MIN_PARTIAL_ROW_HEIGHT = 20, ROW_HEIGHT_EPSILON = 0.1, DEFAULT_BALANCING_CONFIG, DEFAULT_PARAGRAPH_LINE_HEIGHT_PX = 20, DEFAULT_PAGE_SIZE$2, DEFAULT_MARGINS$2, COLUMN_EPSILON$1 = 0.0001, asBoolean = (value) => {
|
|
164960
|
+
}, COLUMN_MIN_WIDTH_PX = 25, COLUMN_MAX_WIDTH_PX = 200, ROW_MIN_HEIGHT_PX = 10, MIN_PARTIAL_ROW_HEIGHT = 20, ROW_HEIGHT_EPSILON = 0.1, DEFAULT_BALANCING_CONFIG, DEFAULT_PARAGRAPH_LINE_HEIGHT_PX = 20, SEMANTIC_PAGE_HEIGHT_PX = 1e6, DEFAULT_PAGE_SIZE$2, DEFAULT_MARGINS$2, COLUMN_EPSILON$1 = 0.0001, asBoolean = (value) => {
|
|
164826
164961
|
if (value === true || value === 1)
|
|
164827
164962
|
return true;
|
|
164828
164963
|
if (typeof value === "string") {
|
|
@@ -166921,6 +167056,7 @@ var Node$13 = class Node$14 {
|
|
|
166921
167056
|
const painter = new DomPainter(options.blocks, options.measures, {
|
|
166922
167057
|
pageStyles: options.pageStyles,
|
|
166923
167058
|
layoutMode: options.layoutMode,
|
|
167059
|
+
flowMode: options.flowMode,
|
|
166924
167060
|
pageGap: options.pageGap,
|
|
166925
167061
|
headerProvider: options.headerProvider,
|
|
166926
167062
|
footerProvider: options.footerProvider,
|
|
@@ -171711,7 +171847,7 @@ var Node$13 = class Node$14 {
|
|
|
171711
171847
|
this.#onCursorsUpdate = null;
|
|
171712
171848
|
this.#isSetup = false;
|
|
171713
171849
|
}
|
|
171714
|
-
}, WORD_CHARACTER_REGEX, 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, clamp = (value, min$2, max$2) => Math.max(min$2, Math.min(max$2, value)), EditorInputManager = class {
|
|
171850
|
+
}, WORD_CHARACTER_REGEX, 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, clamp = (value, min$2, max$2) => Math.max(min$2, Math.min(max$2, value)), EditorInputManager = class {
|
|
171715
171851
|
#deps = null;
|
|
171716
171852
|
#callbacks = {};
|
|
171717
171853
|
#isDragging = false;
|
|
@@ -175471,11 +175607,11 @@ var Node$13 = class Node$14 {
|
|
|
175471
175607
|
this.#hoverRegion = null;
|
|
175472
175608
|
this.#overlayManager = null;
|
|
175473
175609
|
}
|
|
175474
|
-
}, SUBSCRIPT_SUPERSCRIPT_SCALE2 = 0.65, DEFAULT_PAGE_SIZE, DEFAULT_MARGINS, DEFAULT_PAGE_GAP = 24, DEFAULT_HORIZONTAL_PAGE_GAP = 20, layoutDebugEnabled, perfLog = (...args$1) => {
|
|
175610
|
+
}, DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE, SUBSCRIPT_SUPERSCRIPT_SCALE2 = 0.65, DEFAULT_PAGE_SIZE, DEFAULT_MARGINS, DEFAULT_PAGE_GAP = 24, DEFAULT_HORIZONTAL_PAGE_GAP = 20, layoutDebugEnabled, perfLog = (...args$1) => {
|
|
175475
175611
|
if (!layoutDebugEnabled)
|
|
175476
175612
|
return;
|
|
175477
175613
|
console.log(...args$1);
|
|
175478
|
-
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, GLOBAL_PERFORMANCE, PresentationEditor, Color, FontFamily, FontSize, TextAlign, FormatCommands, DropCursorView = class {
|
|
175614
|
+
}, 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, Color, FontFamily, FontSize, TextAlign, FormatCommands, DropCursorView = class {
|
|
175479
175615
|
constructor(editorView, options) {
|
|
175480
175616
|
var _a;
|
|
175481
175617
|
this.editorView = editorView;
|
|
@@ -180788,7 +180924,7 @@ var Node$13 = class Node$14 {
|
|
|
180788
180924
|
trackedChanges: context.trackedChanges ?? []
|
|
180789
180925
|
});
|
|
180790
180926
|
}, _hoisted_1$6, _hoisted_2$2, _hoisted_3, _hoisted_4, ContextMenu_default, _hoisted_1$5, BasicUpload_default, _hoisted_1$4, MIN_WIDTH = 200, PPI = 96, alignment = "flex-end", Ruler_default, GenericPopover_default, _hoisted_1$3, _hoisted_2$1, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_HEIGHT_PX = 9, RESIZE_HANDLE_OFFSET_PX = 4, DRAG_OVERLAY_EXTENSION_PX = 1000, MIN_DRAG_OVERLAY_WIDTH_PX = 2000, THROTTLE_INTERVAL_MS = 16, MIN_RESIZE_DELTA_PX = 1, TableResizeOverlay_default, _hoisted_1$2, OVERLAY_EXPANSION_PX = 2000, RESIZE_HANDLE_SIZE_PX = 12, MOUSE_MOVE_THROTTLE_MS = 16, DIMENSION_CHANGE_THRESHOLD_PX = 1, Z_INDEX_OVERLAY = 10, Z_INDEX_HANDLE = 15, Z_INDEX_GUIDELINE = 20, ImageResizeOverlay_default, LINK_CLICK_DEBOUNCE_MS = 300, CURSOR_UPDATE_TIMEOUT_MS = 10, POPOVER_VERTICAL_OFFSET_PX = 15, LinkClickHandler_default, _hoisted_1$1, _hoisted_2, DOCX2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", TABLE_RESIZE_HOVER_THRESHOLD = 8, TABLE_RESIZE_THROTTLE_MS = 16, SuperEditor_default, _hoisted_1, SuperInput_default, SlashMenu, Extensions;
|
|
180791
|
-
var
|
|
180927
|
+
var init_src_BU12K8Zl_es = __esm(() => {
|
|
180792
180928
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
180793
180929
|
init_SuperConverter_B3_eOoDQ_es();
|
|
180794
180930
|
init_jszip_ChlR43oI_es();
|
|
@@ -194864,12 +195000,13 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
194864
195000
|
this.lastPaintSnapshot = null;
|
|
194865
195001
|
this.options = options;
|
|
194866
195002
|
this.layoutMode = options.layoutMode ?? "vertical";
|
|
195003
|
+
this.isSemanticFlow = (options.flowMode ?? "paginated") === "semantic";
|
|
194867
195004
|
this.blockLookup = this.buildBlockLookup(blocks2, measures);
|
|
194868
195005
|
this.headerProvider = options.headerProvider;
|
|
194869
195006
|
this.footerProvider = options.footerProvider;
|
|
194870
195007
|
const defaultGap = this.layoutMode === "horizontal" ? 20 : 24;
|
|
194871
195008
|
this.pageGap = typeof options.pageGap === "number" && Number.isFinite(options.pageGap) ? Math.max(0, options.pageGap) : defaultGap;
|
|
194872
|
-
if (this.layoutMode === "vertical" && options.virtualization?.enabled) {
|
|
195009
|
+
if (!this.isSemanticFlow && this.layoutMode === "vertical" && options.virtualization?.enabled) {
|
|
194873
195010
|
this.virtualEnabled = true;
|
|
194874
195011
|
this.virtualWindow = Math.max(1, options.virtualization.window ?? 5);
|
|
194875
195012
|
this.virtualOverscan = Math.max(0, options.virtualization.overscan ?? 0);
|
|
@@ -195091,7 +195228,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
195091
195228
|
ensureSdtContainerStyles(doc$2);
|
|
195092
195229
|
ensureImageSelectionStyles(doc$2);
|
|
195093
195230
|
ensureNativeSelectionStyles(doc$2);
|
|
195094
|
-
if (this.options.ruler?.enabled)
|
|
195231
|
+
if (!this.isSemanticFlow && this.options.ruler?.enabled)
|
|
195095
195232
|
ensureRulerStyles(doc$2);
|
|
195096
195233
|
mount$1.classList.add(CLASS_NAMES$1.container);
|
|
195097
195234
|
if (this.mount && this.mount !== mount$1)
|
|
@@ -195101,6 +195238,19 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
195101
195238
|
this.mount = mount$1;
|
|
195102
195239
|
this.beginPaintSnapshot(layout);
|
|
195103
195240
|
this.totalPages = layout.pages.length;
|
|
195241
|
+
if (this.isSemanticFlow) {
|
|
195242
|
+
applyStyles$1(mount$1, containerStyles);
|
|
195243
|
+
mount$1.style.gap = "0px";
|
|
195244
|
+
mount$1.style.alignItems = "stretch";
|
|
195245
|
+
if (!this.currentLayout || this.pageStates.length === 0)
|
|
195246
|
+
this.fullRender(layout);
|
|
195247
|
+
else
|
|
195248
|
+
this.patchLayout(layout);
|
|
195249
|
+
this.currentLayout = layout;
|
|
195250
|
+
this.changedBlocks.clear();
|
|
195251
|
+
this.currentMapping = null;
|
|
195252
|
+
return;
|
|
195253
|
+
}
|
|
195104
195254
|
let useDomSnapshotFallback = false;
|
|
195105
195255
|
const mode = this.layoutMode;
|
|
195106
195256
|
if (mode === "horizontal") {
|
|
@@ -195431,10 +195581,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
195431
195581
|
const el = this.doc.createElement("div");
|
|
195432
195582
|
el.classList.add(CLASS_NAMES$1.page);
|
|
195433
195583
|
applyStyles$1(el, pageStyles(width, height, this.getEffectivePageStyles()));
|
|
195584
|
+
this.applySemanticPageOverrides(el);
|
|
195434
195585
|
el.dataset.layoutEpoch = String(this.layoutEpoch);
|
|
195435
195586
|
el.dataset.pageNumber = String(page.number);
|
|
195436
195587
|
el.dataset.pageIndex = String(pageIndex);
|
|
195437
|
-
if (this.options.ruler?.enabled) {
|
|
195588
|
+
if (!this.isSemanticFlow && this.options.ruler?.enabled) {
|
|
195438
195589
|
const rulerEl = this.renderPageRuler(width, page);
|
|
195439
195590
|
if (rulerEl)
|
|
195440
195591
|
el.appendChild(rulerEl);
|
|
@@ -195500,6 +195651,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
195500
195651
|
}
|
|
195501
195652
|
}
|
|
195502
195653
|
renderDecorationsForPage(pageEl, page, pageIndex) {
|
|
195654
|
+
if (this.isSemanticFlow)
|
|
195655
|
+
return;
|
|
195503
195656
|
this.renderDecorationSection(pageEl, page, pageIndex, "header");
|
|
195504
195657
|
this.renderDecorationSection(pageEl, page, pageIndex, "footer");
|
|
195505
195658
|
}
|
|
@@ -195670,6 +195823,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
195670
195823
|
patchPage(state, page, pageSize, pageIndex) {
|
|
195671
195824
|
const pageEl = state.element;
|
|
195672
195825
|
applyStyles$1(pageEl, pageStyles(pageSize.w, pageSize.h, this.getEffectivePageStyles()));
|
|
195826
|
+
this.applySemanticPageOverrides(pageEl);
|
|
195673
195827
|
pageEl.dataset.pageNumber = String(page.number);
|
|
195674
195828
|
pageEl.dataset.layoutEpoch = String(this.layoutEpoch);
|
|
195675
195829
|
const existing = new Map(state.fragments.map((frag) => [frag.key, frag]));
|
|
@@ -195762,6 +195916,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
195762
195916
|
const el = this.doc.createElement("div");
|
|
195763
195917
|
el.classList.add(CLASS_NAMES$1.page);
|
|
195764
195918
|
applyStyles$1(el, pageStyles(pageSize.w, pageSize.h, this.getEffectivePageStyles()));
|
|
195919
|
+
this.applySemanticPageOverrides(el);
|
|
195765
195920
|
el.dataset.layoutEpoch = String(this.layoutEpoch);
|
|
195766
195921
|
const contextBase = {
|
|
195767
195922
|
pageNumber: page.number,
|
|
@@ -195788,7 +195943,24 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
195788
195943
|
fragments: fragmentStates
|
|
195789
195944
|
};
|
|
195790
195945
|
}
|
|
195946
|
+
applySemanticPageOverrides(el) {
|
|
195947
|
+
if (this.isSemanticFlow) {
|
|
195948
|
+
el.style.overflow = "visible";
|
|
195949
|
+
el.style.width = "100%";
|
|
195950
|
+
el.style.minWidth = "100%";
|
|
195951
|
+
}
|
|
195952
|
+
}
|
|
195791
195953
|
getEffectivePageStyles() {
|
|
195954
|
+
if (this.isSemanticFlow) {
|
|
195955
|
+
const base$2 = this.options.pageStyles ?? {};
|
|
195956
|
+
return {
|
|
195957
|
+
...base$2,
|
|
195958
|
+
background: base$2.background ?? "#fff",
|
|
195959
|
+
boxShadow: "none",
|
|
195960
|
+
border: "none",
|
|
195961
|
+
margin: "0"
|
|
195962
|
+
};
|
|
195963
|
+
}
|
|
195792
195964
|
if (this.virtualEnabled && this.layoutMode === "vertical")
|
|
195793
195965
|
return {
|
|
195794
195966
|
...this.options.pageStyles ?? {},
|
|
@@ -198970,6 +199142,15 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
198970
199142
|
this.#evictions = 0;
|
|
198971
199143
|
}
|
|
198972
199144
|
};
|
|
199145
|
+
DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE = {
|
|
199146
|
+
fontFamily: "Arial",
|
|
199147
|
+
fontSize: 14,
|
|
199148
|
+
bold: true,
|
|
199149
|
+
spacing: {
|
|
199150
|
+
before: 24,
|
|
199151
|
+
after: 12
|
|
199152
|
+
}
|
|
199153
|
+
};
|
|
198973
199154
|
DEFAULT_PAGE_SIZE = {
|
|
198974
199155
|
w: 612,
|
|
198975
199156
|
h: 792
|
|
@@ -199054,6 +199235,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
199054
199235
|
#decorationBridge = new DecorationBridge;
|
|
199055
199236
|
#decorationSyncRafHandle = null;
|
|
199056
199237
|
#rafHandle = null;
|
|
199238
|
+
#semanticResizeObserver = null;
|
|
199239
|
+
#semanticResizeRaf = null;
|
|
199240
|
+
#semanticResizeDebounce = null;
|
|
199241
|
+
#lastSemanticContainerWidth = null;
|
|
199057
199242
|
#editorListeners = [];
|
|
199058
199243
|
#scrollHandler = null;
|
|
199059
199244
|
#scrollContainer = null;
|
|
@@ -199100,14 +199285,21 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
199100
199285
|
maxVisible: rawPresence.maxVisible !== undefined ? Math.max(1, Math.min(rawPresence.maxVisible, 100)) : rawPresence.maxVisible,
|
|
199101
199286
|
highlightOpacity: rawPresence.highlightOpacity !== undefined ? Math.max(0, Math.min(rawPresence.highlightOpacity, 1)) : rawPresence.highlightOpacity
|
|
199102
199287
|
} : undefined;
|
|
199288
|
+
const requestedFlowMode = options.layoutEngineOptions?.flowMode === "semantic" ? "semantic" : "paginated";
|
|
199289
|
+
const requestedLayoutMode = options.layoutEngineOptions?.layoutMode ?? "vertical";
|
|
199103
199290
|
this.#layoutOptions = {
|
|
199104
199291
|
pageSize: options.layoutEngineOptions?.pageSize ?? DEFAULT_PAGE_SIZE,
|
|
199105
199292
|
margins: options.layoutEngineOptions?.margins ?? DEFAULT_MARGINS,
|
|
199106
|
-
virtualization:
|
|
199293
|
+
virtualization: requestedFlowMode === "semantic" ? {
|
|
199294
|
+
...options.layoutEngineOptions?.virtualization ?? {},
|
|
199295
|
+
enabled: false
|
|
199296
|
+
} : options.layoutEngineOptions?.virtualization,
|
|
199107
199297
|
zoom: options.layoutEngineOptions?.zoom ?? 1,
|
|
199108
199298
|
pageStyles: options.layoutEngineOptions?.pageStyles,
|
|
199109
199299
|
debugLabel: options.layoutEngineOptions?.debugLabel,
|
|
199110
|
-
layoutMode:
|
|
199300
|
+
layoutMode: requestedFlowMode === "semantic" ? "vertical" : requestedLayoutMode,
|
|
199301
|
+
flowMode: requestedFlowMode,
|
|
199302
|
+
semanticOptions: options.layoutEngineOptions?.semanticOptions,
|
|
199111
199303
|
trackedChanges: options.layoutEngineOptions?.trackedChanges,
|
|
199112
199304
|
emitCommentPositionsInViewing: options.layoutEngineOptions?.emitCommentPositionsInViewing,
|
|
199113
199305
|
enableCommentsInViewing: options.layoutEngineOptions?.enableCommentsInViewing,
|
|
@@ -199284,6 +199476,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
199284
199476
|
this.#setupDragHandlers();
|
|
199285
199477
|
this.#setupInputBridge();
|
|
199286
199478
|
this.#syncTrackedChangesPreferences();
|
|
199479
|
+
this.#setupSemanticResizeObserver();
|
|
199287
199480
|
this.#registryKey = options.documentId || `__anonymous_${Date.now()}_${Math.random().toString(36).slice(2)}`;
|
|
199288
199481
|
PresentationEditor2.#instances.set(this.#registryKey, this);
|
|
199289
199482
|
this.#pendingDocChange = true;
|
|
@@ -199669,6 +199862,93 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
199669
199862
|
getLayoutOptions() {
|
|
199670
199863
|
return { ...this.#layoutOptions };
|
|
199671
199864
|
}
|
|
199865
|
+
#isSemanticFlowMode() {
|
|
199866
|
+
return this.#layoutOptions.flowMode === "semantic";
|
|
199867
|
+
}
|
|
199868
|
+
#resolveSemanticMargins(margins) {
|
|
199869
|
+
const mode = this.#layoutOptions.semanticOptions?.marginsMode ?? "firstSection";
|
|
199870
|
+
if (mode === "none")
|
|
199871
|
+
return {
|
|
199872
|
+
left: 0,
|
|
199873
|
+
right: 0,
|
|
199874
|
+
top: 0,
|
|
199875
|
+
bottom: 0
|
|
199876
|
+
};
|
|
199877
|
+
const clamp$2 = (value, fallback) => {
|
|
199878
|
+
const v = typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
199879
|
+
return v >= 0 ? v : fallback;
|
|
199880
|
+
};
|
|
199881
|
+
if (mode === "custom") {
|
|
199882
|
+
const custom = this.#layoutOptions.semanticOptions?.customMargins;
|
|
199883
|
+
return {
|
|
199884
|
+
left: clamp$2(custom?.left, clamp$2(margins.left, DEFAULT_MARGINS.left)),
|
|
199885
|
+
right: clamp$2(custom?.right, clamp$2(margins.right, DEFAULT_MARGINS.right)),
|
|
199886
|
+
top: clamp$2(custom?.top, clamp$2(margins.top, DEFAULT_MARGINS.top)),
|
|
199887
|
+
bottom: clamp$2(custom?.bottom, clamp$2(margins.bottom, DEFAULT_MARGINS.bottom))
|
|
199888
|
+
};
|
|
199889
|
+
}
|
|
199890
|
+
return {
|
|
199891
|
+
left: clamp$2(margins.left, DEFAULT_MARGINS.left),
|
|
199892
|
+
right: clamp$2(margins.right, DEFAULT_MARGINS.right),
|
|
199893
|
+
top: 0,
|
|
199894
|
+
bottom: 0
|
|
199895
|
+
};
|
|
199896
|
+
}
|
|
199897
|
+
#resolveSemanticContainerInnerWidth() {
|
|
199898
|
+
const host = this.#visibleHost;
|
|
199899
|
+
if (!host)
|
|
199900
|
+
return DEFAULT_PAGE_SIZE.w;
|
|
199901
|
+
const style$1 = (host.ownerDocument?.defaultView ?? window).getComputedStyle(host);
|
|
199902
|
+
const paddingLeft = Number.parseFloat(style$1.paddingLeft ?? "0");
|
|
199903
|
+
const paddingRight = Number.parseFloat(style$1.paddingRight ?? "0");
|
|
199904
|
+
const horizontalPadding = (Number.isFinite(paddingLeft) ? paddingLeft : 0) + (Number.isFinite(paddingRight) ? paddingRight : 0);
|
|
199905
|
+
const clientWidth = host.clientWidth;
|
|
199906
|
+
if (Number.isFinite(clientWidth) && clientWidth > 0)
|
|
199907
|
+
return Math.max(1, clientWidth - horizontalPadding);
|
|
199908
|
+
const rectWidth = host.getBoundingClientRect().width;
|
|
199909
|
+
if (Number.isFinite(rectWidth) && rectWidth > 0)
|
|
199910
|
+
return Math.max(1, rectWidth - horizontalPadding);
|
|
199911
|
+
return Math.max(1, DEFAULT_PAGE_SIZE.w - horizontalPadding);
|
|
199912
|
+
}
|
|
199913
|
+
#setupSemanticResizeObserver() {
|
|
199914
|
+
if (!this.#isSemanticFlowMode())
|
|
199915
|
+
return;
|
|
199916
|
+
const ResizeObs = (this.#visibleHost.ownerDocument?.defaultView ?? window).ResizeObserver;
|
|
199917
|
+
if (typeof ResizeObs !== "function")
|
|
199918
|
+
return;
|
|
199919
|
+
this.#lastSemanticContainerWidth = this.#resolveSemanticContainerInnerWidth();
|
|
199920
|
+
this.#semanticResizeObserver = new ResizeObs(() => {
|
|
199921
|
+
this.#scheduleSemanticResizeRelayout();
|
|
199922
|
+
});
|
|
199923
|
+
this.#semanticResizeObserver.observe(this.#visibleHost);
|
|
199924
|
+
}
|
|
199925
|
+
#scheduleSemanticResizeRelayout() {
|
|
199926
|
+
if (!this.#isSemanticFlowMode())
|
|
199927
|
+
return;
|
|
199928
|
+
const view = this.#visibleHost.ownerDocument?.defaultView ?? window;
|
|
199929
|
+
if (this.#semanticResizeRaf == null)
|
|
199930
|
+
this.#semanticResizeRaf = view.requestAnimationFrame(() => {
|
|
199931
|
+
this.#semanticResizeRaf = null;
|
|
199932
|
+
this.#applySemanticResizeRelayout();
|
|
199933
|
+
});
|
|
199934
|
+
if (this.#semanticResizeDebounce != null)
|
|
199935
|
+
view.clearTimeout(this.#semanticResizeDebounce);
|
|
199936
|
+
this.#semanticResizeDebounce = view.setTimeout(() => {
|
|
199937
|
+
this.#semanticResizeDebounce = null;
|
|
199938
|
+
this.#applySemanticResizeRelayout();
|
|
199939
|
+
}, SEMANTIC_RESIZE_DEBOUNCE_MS);
|
|
199940
|
+
}
|
|
199941
|
+
#applySemanticResizeRelayout() {
|
|
199942
|
+
if (!this.#isSemanticFlowMode())
|
|
199943
|
+
return;
|
|
199944
|
+
const nextWidth = this.#resolveSemanticContainerInnerWidth();
|
|
199945
|
+
const prevWidth = this.#lastSemanticContainerWidth;
|
|
199946
|
+
if (prevWidth != null && Math.abs(nextWidth - prevWidth) < 1)
|
|
199947
|
+
return;
|
|
199948
|
+
this.#lastSemanticContainerWidth = nextWidth;
|
|
199949
|
+
this.#pendingDocChange = true;
|
|
199950
|
+
this.#scheduleRerender();
|
|
199951
|
+
}
|
|
199672
199952
|
getPaintSnapshot() {
|
|
199673
199953
|
return this.#domPainter?.getPaintSnapshot?.() ?? null;
|
|
199674
199954
|
}
|
|
@@ -199679,6 +199959,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
199679
199959
|
return Array.from(this.#remoteCursorManager?.state.values() ?? []);
|
|
199680
199960
|
}
|
|
199681
199961
|
setLayoutMode(mode) {
|
|
199962
|
+
if (this.#isSemanticFlowMode())
|
|
199963
|
+
return;
|
|
199682
199964
|
if (!mode || this.#layoutOptions.layoutMode === mode)
|
|
199683
199965
|
return;
|
|
199684
199966
|
this.#layoutOptions.layoutMode = mode;
|
|
@@ -200128,6 +200410,18 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
200128
200410
|
clearTimeout(this.#cursorUpdateTimer);
|
|
200129
200411
|
this.#cursorUpdateTimer = null;
|
|
200130
200412
|
}
|
|
200413
|
+
if (this.#semanticResizeRaf != null)
|
|
200414
|
+
safeCleanup(() => {
|
|
200415
|
+
(this.#visibleHost?.ownerDocument?.defaultView ?? window).cancelAnimationFrame(this.#semanticResizeRaf);
|
|
200416
|
+
this.#semanticResizeRaf = null;
|
|
200417
|
+
}, "Semantic resize RAF");
|
|
200418
|
+
if (this.#semanticResizeDebounce != null)
|
|
200419
|
+
safeCleanup(() => {
|
|
200420
|
+
(this.#visibleHost?.ownerDocument?.defaultView ?? window).clearTimeout(this.#semanticResizeDebounce);
|
|
200421
|
+
this.#semanticResizeDebounce = null;
|
|
200422
|
+
}, "Semantic resize debounce");
|
|
200423
|
+
this.#semanticResizeObserver?.disconnect();
|
|
200424
|
+
this.#semanticResizeObserver = null;
|
|
200131
200425
|
if (this.#remoteCursorManager)
|
|
200132
200426
|
safeCleanup(() => {
|
|
200133
200427
|
this.#remoteCursorManager?.destroy();
|
|
@@ -200735,9 +201029,12 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
200735
201029
|
to: r$1.to
|
|
200736
201030
|
})));
|
|
200737
201031
|
this.#applyHtmlAnnotationMeasurements(blocks2);
|
|
201032
|
+
const isSemanticFlow = this.#isSemanticFlowMode();
|
|
200738
201033
|
const baseLayoutOptions = this.#resolveLayoutOptions(blocks2, sectionMetadata);
|
|
200739
201034
|
const footnotesLayoutInput = buildFootnotesInput(this.#editor?.state, this.#editor?.converter, converterContext, this.#editor?.converter?.themeColors ?? undefined);
|
|
200740
|
-
const
|
|
201035
|
+
const semanticFootnoteBlocks = isSemanticFlow ? buildSemanticFootnoteBlocks(footnotesLayoutInput, this.#layoutOptions.semanticOptions?.footnotesMode) : [];
|
|
201036
|
+
const blocksForLayout = semanticFootnoteBlocks.length > 0 ? [...blocks2, ...semanticFootnoteBlocks] : blocks2;
|
|
201037
|
+
const layoutOptions = !isSemanticFlow && footnotesLayoutInput ? {
|
|
200741
201038
|
...baseLayoutOptions,
|
|
200742
201039
|
footnotes: footnotesLayoutInput
|
|
200743
201040
|
} : baseLayoutOptions;
|
|
@@ -200753,7 +201050,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
200753
201050
|
const headerFooterInput = this.#buildHeaderFooterInput();
|
|
200754
201051
|
try {
|
|
200755
201052
|
const incrementalLayoutStart = perfNow();
|
|
200756
|
-
const result = await incrementalLayout(previousBlocks, previousLayout,
|
|
201053
|
+
const result = await incrementalLayout(previousBlocks, previousLayout, blocksForLayout, layoutOptions, (block, constraints) => measureBlock(block, constraints), headerFooterInput ?? undefined, previousMeasures);
|
|
200757
201054
|
perfLog(`[Perf] incrementalLayout: ${(perfNow() - incrementalLayoutStart).toFixed(2)}ms`);
|
|
200758
201055
|
if (!result || typeof result !== "object") {
|
|
200759
201056
|
this.#handleLayoutError("render", /* @__PURE__ */ new Error("incrementalLayout returned invalid result"));
|
|
@@ -200786,9 +201083,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
200786
201083
|
});
|
|
200787
201084
|
if (this.#headerFooterSession)
|
|
200788
201085
|
this.#headerFooterSession.multiSectionIdentifier = multiSectionId;
|
|
200789
|
-
const anchorMap = computeAnchorMap(bookmarks, layout,
|
|
201086
|
+
const anchorMap = computeAnchorMap(bookmarks, layout, blocksForLayout);
|
|
200790
201087
|
this.#layoutState = {
|
|
200791
|
-
blocks:
|
|
201088
|
+
blocks: blocksForLayout,
|
|
200792
201089
|
measures,
|
|
200793
201090
|
layout,
|
|
200794
201091
|
bookmarks,
|
|
@@ -200818,10 +201115,12 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
200818
201115
|
else
|
|
200819
201116
|
this.#pageGeometryHelper.updateLayout(this.#layoutState.layout, pageGap);
|
|
200820
201117
|
}
|
|
200821
|
-
|
|
200822
|
-
|
|
200823
|
-
|
|
200824
|
-
|
|
201118
|
+
if (!isSemanticFlow) {
|
|
201119
|
+
await this.#layoutPerRIdHeaderFooters(headerFooterInput, layout, sectionMetadata);
|
|
201120
|
+
this.#updateDecorationProviders(layout);
|
|
201121
|
+
}
|
|
201122
|
+
const painter = this.#ensurePainter(blocksForLayout, measures);
|
|
201123
|
+
if (!isSemanticFlow && typeof painter.setProviders === "function")
|
|
200825
201124
|
painter.setProviders(this.#headerFooterSession?.headerDecorationProvider, this.#headerFooterSession?.footerDecorationProvider);
|
|
200826
201125
|
const headerBlocks = [];
|
|
200827
201126
|
const headerMeasures = [];
|
|
@@ -200854,7 +201153,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
200854
201153
|
footerMeasures.push(...extraMeasures);
|
|
200855
201154
|
}
|
|
200856
201155
|
const painterSetDataStart = perfNow();
|
|
200857
|
-
painter.setData?.(
|
|
201156
|
+
painter.setData?.(blocksForLayout, measures, headerBlocks.length > 0 ? headerBlocks : undefined, headerMeasures.length > 0 ? headerMeasures : undefined, footerBlocks.length > 0 ? footerBlocks : undefined, footerMeasures.length > 0 ? footerMeasures : undefined);
|
|
200858
201157
|
perfLog(`[Perf] painter.setData: ${(perfNow() - painterSetDataStart).toFixed(2)}ms`);
|
|
200859
201158
|
this.#domIndexObserverManager?.pause();
|
|
200860
201159
|
const mapping = this.#pendingMapping;
|
|
@@ -200881,10 +201180,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
200881
201180
|
this.#layoutErrorState = "healthy";
|
|
200882
201181
|
this.#dismissErrorBanner();
|
|
200883
201182
|
this.#applyZoom();
|
|
200884
|
-
const metrics = createLayoutMetrics(perf2, startMark, layout,
|
|
201183
|
+
const metrics = createLayoutMetrics(perf2, startMark, layout, blocksForLayout);
|
|
200885
201184
|
const payload = {
|
|
200886
201185
|
layout,
|
|
200887
|
-
blocks:
|
|
201186
|
+
blocks: blocksForLayout,
|
|
200888
201187
|
measures,
|
|
200889
201188
|
metrics
|
|
200890
201189
|
};
|
|
@@ -200917,6 +201216,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
200917
201216
|
blocks: blocks2,
|
|
200918
201217
|
measures,
|
|
200919
201218
|
layoutMode: this.#layoutOptions.layoutMode ?? "vertical",
|
|
201219
|
+
flowMode: this.#layoutOptions.flowMode ?? "paginated",
|
|
200920
201220
|
virtualization: normalizedVirtualization,
|
|
200921
201221
|
pageStyles: this.#layoutOptions.pageStyles,
|
|
200922
201222
|
headerProvider: this.#headerFooterSession?.headerDecorationProvider,
|
|
@@ -201410,15 +201710,61 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
201410
201710
|
const columns = firstSection?.columns ?? defaults2.columns;
|
|
201411
201711
|
this.#layoutOptions.pageSize = pageSize;
|
|
201412
201712
|
this.#layoutOptions.margins = margins;
|
|
201713
|
+
const flowMode = this.#layoutOptions.flowMode ?? "paginated";
|
|
201714
|
+
const resolvedMargins = {
|
|
201715
|
+
top: margins.top,
|
|
201716
|
+
right: margins.right,
|
|
201717
|
+
bottom: margins.bottom,
|
|
201718
|
+
left: margins.left,
|
|
201719
|
+
...margins.header != null ? { header: margins.header } : {},
|
|
201720
|
+
...margins.footer != null ? { footer: margins.footer } : {}
|
|
201721
|
+
};
|
|
201722
|
+
if (flowMode === "semantic") {
|
|
201723
|
+
const semanticMargins = this.#resolveSemanticMargins(margins);
|
|
201724
|
+
const containerWidth = this.#resolveSemanticContainerInnerWidth();
|
|
201725
|
+
const semanticContentWidth = Math.max(MIN_SEMANTIC_CONTENT_WIDTH_PX, containerWidth - semanticMargins.left - semanticMargins.right);
|
|
201726
|
+
const semanticPageWidth = semanticContentWidth + semanticMargins.left + semanticMargins.right;
|
|
201727
|
+
this.#hiddenHost.style.width = `${semanticContentWidth}px`;
|
|
201728
|
+
this.#lastSemanticContainerWidth = containerWidth;
|
|
201729
|
+
return {
|
|
201730
|
+
flowMode: "semantic",
|
|
201731
|
+
pageSize: {
|
|
201732
|
+
w: semanticPageWidth,
|
|
201733
|
+
h: pageSize.h
|
|
201734
|
+
},
|
|
201735
|
+
margins: {
|
|
201736
|
+
...resolvedMargins,
|
|
201737
|
+
top: semanticMargins.top,
|
|
201738
|
+
right: semanticMargins.right,
|
|
201739
|
+
bottom: semanticMargins.bottom,
|
|
201740
|
+
left: semanticMargins.left
|
|
201741
|
+
},
|
|
201742
|
+
columns: {
|
|
201743
|
+
count: 1,
|
|
201744
|
+
gap: 0
|
|
201745
|
+
},
|
|
201746
|
+
semantic: {
|
|
201747
|
+
contentWidth: semanticContentWidth,
|
|
201748
|
+
marginLeft: semanticMargins.left,
|
|
201749
|
+
marginRight: semanticMargins.right,
|
|
201750
|
+
marginTop: semanticMargins.top,
|
|
201751
|
+
marginBottom: semanticMargins.bottom
|
|
201752
|
+
},
|
|
201753
|
+
sectionMetadata
|
|
201754
|
+
};
|
|
201755
|
+
}
|
|
201413
201756
|
this.#hiddenHost.style.width = `${pageSize.w}px`;
|
|
201414
201757
|
return {
|
|
201758
|
+
flowMode: "paginated",
|
|
201415
201759
|
pageSize,
|
|
201416
|
-
margins,
|
|
201760
|
+
margins: resolvedMargins,
|
|
201417
201761
|
...columns ? { columns } : {},
|
|
201418
201762
|
sectionMetadata
|
|
201419
201763
|
};
|
|
201420
201764
|
}
|
|
201421
201765
|
#buildHeaderFooterInput() {
|
|
201766
|
+
if (this.#isSemanticFlowMode())
|
|
201767
|
+
return null;
|
|
201422
201768
|
const adapter = this.#headerFooterSession?.adapter;
|
|
201423
201769
|
if (!adapter)
|
|
201424
201770
|
return null;
|
|
@@ -201711,6 +202057,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
201711
202057
|
});
|
|
201712
202058
|
}
|
|
201713
202059
|
#getEffectivePageGap() {
|
|
202060
|
+
if (this.#isSemanticFlowMode())
|
|
202061
|
+
return 0;
|
|
201714
202062
|
if (this.#layoutOptions.virtualization?.enabled)
|
|
201715
202063
|
return Math.max(0, this.#layoutOptions.virtualization.gap ?? DEFAULT_PAGE_GAP);
|
|
201716
202064
|
if (this.#layoutOptions.layoutMode === "horizontal")
|
|
@@ -201810,6 +202158,21 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
201810
202158
|
};
|
|
201811
202159
|
}
|
|
201812
202160
|
#applyZoom() {
|
|
202161
|
+
if (this.#isSemanticFlowMode()) {
|
|
202162
|
+
this.#viewportHost.style.width = "100%";
|
|
202163
|
+
this.#viewportHost.style.minWidth = "";
|
|
202164
|
+
this.#viewportHost.style.minHeight = "";
|
|
202165
|
+
this.#viewportHost.style.transform = "";
|
|
202166
|
+
this.#painterHost.style.width = "100%";
|
|
202167
|
+
this.#painterHost.style.minHeight = "";
|
|
202168
|
+
this.#painterHost.style.transformOrigin = "";
|
|
202169
|
+
this.#painterHost.style.transform = "";
|
|
202170
|
+
this.#selectionOverlay.style.width = "100%";
|
|
202171
|
+
this.#selectionOverlay.style.height = "100%";
|
|
202172
|
+
this.#selectionOverlay.style.transformOrigin = "";
|
|
202173
|
+
this.#selectionOverlay.style.transform = "";
|
|
202174
|
+
return;
|
|
202175
|
+
}
|
|
201813
202176
|
const zoom = this.#layoutOptions.zoom ?? 1;
|
|
201814
202177
|
const layoutMode = this.#layoutOptions.layoutMode ?? "vertical";
|
|
201815
202178
|
const pages = this.#layoutState.layout?.pages;
|
|
@@ -212067,8 +212430,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
212067
212430
|
return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
212068
212431
|
};
|
|
212069
212432
|
stubFalse_default = stubFalse;
|
|
212070
|
-
freeExports$2 = typeof
|
|
212071
|
-
freeModule$2 = freeExports$2 && typeof
|
|
212433
|
+
freeExports$2 = typeof exports_src_BU12K8Zl_es == "object" && exports_src_BU12K8Zl_es && !exports_src_BU12K8Zl_es.nodeType && exports_src_BU12K8Zl_es;
|
|
212434
|
+
freeModule$2 = freeExports$2 && typeof module_src_BU12K8Zl_es == "object" && module_src_BU12K8Zl_es && !module_src_BU12K8Zl_es.nodeType && module_src_BU12K8Zl_es;
|
|
212072
212435
|
Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
|
|
212073
212436
|
isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
|
|
212074
212437
|
typedArrayTags = {};
|
|
@@ -212076,8 +212439,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
212076
212439
|
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
|
|
212077
212440
|
_baseIsTypedArray_default = baseIsTypedArray;
|
|
212078
212441
|
_baseUnary_default = baseUnary;
|
|
212079
|
-
freeExports$1 = typeof
|
|
212080
|
-
freeModule$1 = freeExports$1 && typeof
|
|
212442
|
+
freeExports$1 = typeof exports_src_BU12K8Zl_es == "object" && exports_src_BU12K8Zl_es && !exports_src_BU12K8Zl_es.nodeType && exports_src_BU12K8Zl_es;
|
|
212443
|
+
freeModule$1 = freeExports$1 && typeof module_src_BU12K8Zl_es == "object" && module_src_BU12K8Zl_es && !module_src_BU12K8Zl_es.nodeType && module_src_BU12K8Zl_es;
|
|
212081
212444
|
freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
|
|
212082
212445
|
_nodeUtil_default = function() {
|
|
212083
212446
|
try {
|
|
@@ -212182,8 +212545,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
212182
212545
|
Stack.prototype.has = _stackHas_default;
|
|
212183
212546
|
Stack.prototype.set = _stackSet_default;
|
|
212184
212547
|
_Stack_default = Stack;
|
|
212185
|
-
freeExports = typeof
|
|
212186
|
-
freeModule = freeExports && typeof
|
|
212548
|
+
freeExports = typeof exports_src_BU12K8Zl_es == "object" && exports_src_BU12K8Zl_es && !exports_src_BU12K8Zl_es.nodeType && exports_src_BU12K8Zl_es;
|
|
212549
|
+
freeModule = freeExports && typeof module_src_BU12K8Zl_es == "object" && module_src_BU12K8Zl_es && !module_src_BU12K8Zl_es.nodeType && module_src_BU12K8Zl_es;
|
|
212187
212550
|
Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
|
|
212188
212551
|
allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
|
|
212189
212552
|
_cloneBuffer_default = cloneBuffer;
|
|
@@ -219986,7 +220349,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
219986
220349
|
class: normalizeClass(["super-editor-container", { "web-layout": isWebLayout.value }]),
|
|
219987
220350
|
style: normalizeStyle(containerStyle.value)
|
|
219988
220351
|
}, [
|
|
219989
|
-
__props.options.rulerContainer && rulersVisible.value && !!activeEditor.value ? (openBlock(), createBlock(Teleport, {
|
|
220352
|
+
__props.options.rulerContainer && rulersVisible.value && !isWebLayout.value && !!activeEditor.value ? (openBlock(), createBlock(Teleport, {
|
|
219990
220353
|
key: 0,
|
|
219991
220354
|
to: __props.options.rulerContainer
|
|
219992
220355
|
}, [createBaseVNode("div", {
|
|
@@ -219996,7 +220359,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
219996
220359
|
class: "ruler superdoc-ruler",
|
|
219997
220360
|
editor: activeEditor.value,
|
|
219998
220361
|
onMarginChange: handleMarginChange
|
|
219999
|
-
}, null, 8, ["editor"])], 4)], 8, ["to"])) : rulersVisible.value && !!activeEditor.value ? (openBlock(), createElementBlock("div", {
|
|
220362
|
+
}, null, 8, ["editor"])], 4)], 8, ["to"])) : rulersVisible.value && !isWebLayout.value && !!activeEditor.value ? (openBlock(), createElementBlock("div", {
|
|
220000
220363
|
key: 1,
|
|
220001
220364
|
class: "ruler-host",
|
|
220002
220365
|
style: normalizeStyle(rulerHostStyle.value)
|
|
@@ -220129,7 +220492,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
220129
220492
|
], 6);
|
|
220130
220493
|
};
|
|
220131
220494
|
}
|
|
220132
|
-
}), [["__scopeId", "data-v-
|
|
220495
|
+
}), [["__scopeId", "data-v-ff351a2a"]]);
|
|
220133
220496
|
_hoisted_1 = ["innerHTML"];
|
|
220134
220497
|
SuperInput_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
|
|
220135
220498
|
__name: "SuperInput",
|
|
@@ -220263,7 +220626,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
|
|
|
220263
220626
|
|
|
220264
220627
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
220265
220628
|
var init_super_editor_es = __esm(() => {
|
|
220266
|
-
|
|
220629
|
+
init_src_BU12K8Zl_es();
|
|
220267
220630
|
init_SuperConverter_B3_eOoDQ_es();
|
|
220268
220631
|
init_jszip_ChlR43oI_es();
|
|
220269
220632
|
init_xml_js_DLE8mr0n_es();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.74",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"@types/bun": "^1.3.8",
|
|
21
21
|
"@types/node": "22.19.2",
|
|
22
22
|
"typescript": "^5.9.2",
|
|
23
|
+
"@superdoc/document-api": "0.0.1",
|
|
23
24
|
"@superdoc/pm-adapter": "0.0.0",
|
|
24
25
|
"@superdoc/super-editor": "0.0.1",
|
|
25
|
-
"@superdoc/document-api": "0.0.1",
|
|
26
26
|
"superdoc": "1.17.0"
|
|
27
27
|
},
|
|
28
28
|
"module": "src/index.ts",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.
|
|
34
|
-
"@superdoc-dev/cli-darwin-x64": "0.2.0-next.
|
|
35
|
-
"@superdoc-dev/cli-linux-x64": "0.2.0-next.
|
|
36
|
-
"@superdoc-dev/cli-
|
|
37
|
-
"@superdoc-dev/cli-
|
|
33
|
+
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.74",
|
|
34
|
+
"@superdoc-dev/cli-darwin-x64": "0.2.0-next.74",
|
|
35
|
+
"@superdoc-dev/cli-linux-x64": "0.2.0-next.74",
|
|
36
|
+
"@superdoc-dev/cli-linux-arm64": "0.2.0-next.74",
|
|
37
|
+
"@superdoc-dev/cli-windows-x64": "0.2.0-next.74"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"dev": "bun run src/index.ts",
|