@superdoc-dev/cli 0.3.0-next.40 → 0.3.0-next.41
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 +54 -23
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -148813,7 +148813,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
|
|
|
148813
148813
|
init_remark_gfm_z_sDF4ss_es();
|
|
148814
148814
|
});
|
|
148815
148815
|
|
|
148816
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
148816
|
+
// ../../packages/superdoc/dist/chunks/src-DJgM_28B.es.js
|
|
148817
148817
|
function deleteProps(obj, propOrProps) {
|
|
148818
148818
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
148819
148819
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -185521,6 +185521,9 @@ function sliceLines(lines, startIndex, availableHeight) {
|
|
|
185521
185521
|
height
|
|
185522
185522
|
};
|
|
185523
185523
|
}
|
|
185524
|
+
function shouldSuppressOwnSpacing(ownStyleId, ownContextualSpacing, adjacentStyleId) {
|
|
185525
|
+
return ownContextualSpacing && !!ownStyleId && !!adjacentStyleId && ownStyleId === adjacentStyleId;
|
|
185526
|
+
}
|
|
185524
185527
|
function coerceNumber(value) {
|
|
185525
185528
|
if (isFiniteNumber(value))
|
|
185526
185529
|
return Number(value);
|
|
@@ -186159,6 +186162,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
|
|
|
186159
186162
|
state.page.fragments.push(fragment2);
|
|
186160
186163
|
state.trailingSpacing = 0;
|
|
186161
186164
|
state.lastParagraphStyleId = styleId;
|
|
186165
|
+
state.lastParagraphContextualSpacing = contextualSpacing;
|
|
186162
186166
|
return;
|
|
186163
186167
|
}
|
|
186164
186168
|
let narrowestWidth = columnWidth;
|
|
@@ -186195,8 +186199,9 @@ function layoutParagraphBlock(ctx$1, anchors) {
|
|
|
186195
186199
|
let state = ensurePage();
|
|
186196
186200
|
if (state.trailingSpacing == null)
|
|
186197
186201
|
state.trailingSpacing = 0;
|
|
186198
|
-
if (
|
|
186202
|
+
if (shouldSuppressOwnSpacing(styleId, contextualSpacing, state.lastParagraphStyleId))
|
|
186199
186203
|
spacingBefore = 0;
|
|
186204
|
+
if (shouldSuppressOwnSpacing(state.lastParagraphStyleId, state.lastParagraphContextualSpacing, styleId)) {
|
|
186200
186205
|
const prevTrailing = asSafeNumber(state.trailingSpacing);
|
|
186201
186206
|
if (prevTrailing > 0) {
|
|
186202
186207
|
state.cursorY -= prevTrailing;
|
|
@@ -186311,6 +186316,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
|
|
|
186311
186316
|
} else
|
|
186312
186317
|
lastState.trailingSpacing = 0;
|
|
186313
186318
|
lastState.lastParagraphStyleId = styleId;
|
|
186319
|
+
lastState.lastParagraphContextualSpacing = contextualSpacing;
|
|
186314
186320
|
}
|
|
186315
186321
|
}
|
|
186316
186322
|
function layoutImageBlock({ block, measure, columns, ensurePage, advanceColumn, columnX }) {
|
|
@@ -187323,7 +187329,8 @@ function createPaginator(opts) {
|
|
|
187323
187329
|
constraintBoundaries: [],
|
|
187324
187330
|
activeConstraintIndex: -1,
|
|
187325
187331
|
trailingSpacing: 0,
|
|
187326
|
-
lastParagraphStyleId: undefined
|
|
187332
|
+
lastParagraphStyleId: undefined,
|
|
187333
|
+
lastParagraphContextualSpacing: false
|
|
187327
187334
|
};
|
|
187328
187335
|
states.push(state);
|
|
187329
187336
|
pages.push(state.page);
|
|
@@ -187347,6 +187354,7 @@ function createPaginator(opts) {
|
|
|
187347
187354
|
state.cursorY = state.topMargin;
|
|
187348
187355
|
state.trailingSpacing = 0;
|
|
187349
187356
|
state.lastParagraphStyleId = undefined;
|
|
187357
|
+
state.lastParagraphContextualSpacing = false;
|
|
187350
187358
|
return state;
|
|
187351
187359
|
}
|
|
187352
187360
|
return startNewPage();
|
|
@@ -187771,14 +187779,24 @@ function calculateChainHeight(chain, blocks2, measures, state) {
|
|
|
187771
187779
|
const contextualSpacing = block.attrs?.contextualSpacing === true;
|
|
187772
187780
|
if (isFirstMember) {
|
|
187773
187781
|
const prevTrailing = Number.isFinite(state.trailingSpacing) && state.trailingSpacing > 0 ? state.trailingSpacing : 0;
|
|
187774
|
-
const
|
|
187775
|
-
const
|
|
187782
|
+
const prevSuppressAfter = shouldSuppressOwnSpacing(state.lastParagraphStyleId, state.lastParagraphContextualSpacing, styleId);
|
|
187783
|
+
const currSuppressBefore = shouldSuppressOwnSpacing(styleId, contextualSpacing, state.lastParagraphStyleId);
|
|
187784
|
+
let effectiveSpacingBefore;
|
|
187785
|
+
if (prevSuppressAfter && currSuppressBefore)
|
|
187786
|
+
effectiveSpacingBefore = 0;
|
|
187787
|
+
else if (prevSuppressAfter)
|
|
187788
|
+
effectiveSpacingBefore = spacingBefore;
|
|
187789
|
+
else if (currSuppressBefore)
|
|
187790
|
+
effectiveSpacingBefore = 0;
|
|
187791
|
+
else
|
|
187792
|
+
effectiveSpacingBefore = Math.max(spacingBefore - prevTrailing, 0);
|
|
187776
187793
|
totalHeight += effectiveSpacingBefore;
|
|
187777
187794
|
isFirstMember = false;
|
|
187778
187795
|
} else {
|
|
187779
|
-
const
|
|
187780
|
-
const
|
|
187781
|
-
const
|
|
187796
|
+
const prevSuppressAfter = shouldSuppressOwnSpacing(prevStyleId, prevContextualSpacing, styleId);
|
|
187797
|
+
const currSuppressBefore = shouldSuppressOwnSpacing(styleId, contextualSpacing, prevStyleId);
|
|
187798
|
+
const effectiveSpacingAfterPrev = prevSuppressAfter ? 0 : prevSpacingAfter;
|
|
187799
|
+
const effectiveSpacingBefore = currSuppressBefore ? 0 : spacingBefore;
|
|
187782
187800
|
totalHeight += Math.max(effectiveSpacingAfterPrev, effectiveSpacingBefore);
|
|
187783
187801
|
}
|
|
187784
187802
|
totalHeight += getMeasureHeight(block, measure);
|
|
@@ -187794,9 +187812,10 @@ function calculateChainHeight(chain, blocks2, measures, state) {
|
|
|
187794
187812
|
const anchorSpacingBefore = getParagraphSpacingBefore(anchorBlock);
|
|
187795
187813
|
const anchorStyleId = typeof anchorBlock.attrs?.styleId === "string" ? anchorBlock.attrs?.styleId : undefined;
|
|
187796
187814
|
const anchorContextualSpacing = anchorBlock.attrs?.contextualSpacing === true;
|
|
187797
|
-
const
|
|
187798
|
-
const
|
|
187799
|
-
const
|
|
187815
|
+
const prevSuppressAfter = shouldSuppressOwnSpacing(prevStyleId, prevContextualSpacing, anchorStyleId);
|
|
187816
|
+
const anchorSuppressBefore = shouldSuppressOwnSpacing(anchorStyleId, anchorContextualSpacing, prevStyleId);
|
|
187817
|
+
const effectiveSpacingAfterPrev = prevSuppressAfter ? 0 : prevSpacingAfter;
|
|
187818
|
+
const effectiveAnchorSpacingBefore = anchorSuppressBefore ? 0 : anchorSpacingBefore;
|
|
187800
187819
|
const interParagraphSpacing = Math.max(effectiveSpacingAfterPrev, effectiveAnchorSpacingBefore);
|
|
187801
187820
|
const firstLineHeight = anchorMeasure.lines[0]?.lineHeight;
|
|
187802
187821
|
const anchorHeight = typeof firstLineHeight === "number" && Number.isFinite(firstLineHeight) && firstLineHeight > 0 ? firstLineHeight : getMeasureHeight(anchorBlock, anchorMeasure);
|
|
@@ -188594,9 +188613,9 @@ function layoutDocument(blocks2, measures, options = {}) {
|
|
|
188594
188613
|
const availableHeight = state.contentBottom - state.cursorY;
|
|
188595
188614
|
const firstMemberBlock = blocks2[chain.startIndex];
|
|
188596
188615
|
const firstMemberStyleId = typeof firstMemberBlock.attrs?.styleId === "string" ? firstMemberBlock.attrs?.styleId : undefined;
|
|
188597
|
-
const
|
|
188616
|
+
const prevSuppressAfter = shouldSuppressOwnSpacing(state.lastParagraphStyleId, state.lastParagraphContextualSpacing, firstMemberStyleId);
|
|
188598
188617
|
const prevTrailing = Number.isFinite(state.trailingSpacing) && state.trailingSpacing > 0 ? state.trailingSpacing : 0;
|
|
188599
|
-
const effectiveAvailableHeight =
|
|
188618
|
+
const effectiveAvailableHeight = prevSuppressAfter ? availableHeight + prevTrailing : availableHeight;
|
|
188600
188619
|
const chainHeight = calculateChainHeight(chain, blocks2, measures, state);
|
|
188601
188620
|
if (chainHeight <= state.contentBottom - state.topMargin && chainHeight > effectiveAvailableHeight && state.page.fragments.length > 0)
|
|
188602
188621
|
state = paginator.advanceColumn(state);
|
|
@@ -188612,17 +188631,27 @@ function layoutDocument(blocks2, measures, options = {}) {
|
|
|
188612
188631
|
const prevTrailing = Number.isFinite(state.trailingSpacing) && state.trailingSpacing > 0 ? state.trailingSpacing : 0;
|
|
188613
188632
|
const currentStyleId = typeof paraBlock.attrs?.styleId === "string" ? paraBlock.attrs?.styleId : undefined;
|
|
188614
188633
|
const currentContextualSpacing = asBoolean(paraBlock.attrs?.contextualSpacing);
|
|
188615
|
-
const
|
|
188616
|
-
const
|
|
188634
|
+
const prevSuppressAfter = shouldSuppressOwnSpacing(state.lastParagraphStyleId, state.lastParagraphContextualSpacing, currentStyleId);
|
|
188635
|
+
const currSuppressBefore = shouldSuppressOwnSpacing(currentStyleId, currentContextualSpacing, state.lastParagraphStyleId);
|
|
188636
|
+
let effectiveSpacingBefore;
|
|
188637
|
+
if (prevSuppressAfter && currSuppressBefore)
|
|
188638
|
+
effectiveSpacingBefore = 0;
|
|
188639
|
+
else if (prevSuppressAfter)
|
|
188640
|
+
effectiveSpacingBefore = spacingBefore;
|
|
188641
|
+
else if (currSuppressBefore)
|
|
188642
|
+
effectiveSpacingBefore = 0;
|
|
188643
|
+
else
|
|
188644
|
+
effectiveSpacingBefore = Math.max(spacingBefore - prevTrailing, 0);
|
|
188617
188645
|
const currentHeight = getMeasureHeight(paraBlock, measure);
|
|
188618
188646
|
const nextHeight = getMeasureHeight(nextBlock, nextMeasure);
|
|
188619
188647
|
const nextIsParagraph = nextBlock.kind === "paragraph" && nextMeasure.kind === "paragraph";
|
|
188620
188648
|
const nextSpacingBefore = nextIsParagraph ? getParagraphSpacingBefore(nextBlock) : 0;
|
|
188621
188649
|
const nextStyleId = nextIsParagraph && typeof nextBlock.attrs?.styleId === "string" ? nextBlock.attrs?.styleId : undefined;
|
|
188622
188650
|
const nextContextualSpacing = nextIsParagraph && asBoolean(nextBlock.attrs?.contextualSpacing);
|
|
188623
|
-
const
|
|
188624
|
-
const
|
|
188625
|
-
const
|
|
188651
|
+
const currSuppressAfter = shouldSuppressOwnSpacing(currentStyleId, currentContextualSpacing, nextStyleId);
|
|
188652
|
+
const nextSuppressBefore = nextIsParagraph && shouldSuppressOwnSpacing(nextStyleId, nextContextualSpacing, currentStyleId);
|
|
188653
|
+
const effectiveSpacingAfter = currSuppressAfter ? 0 : spacingAfter;
|
|
188654
|
+
const effectiveNextSpacingBefore = nextSuppressBefore ? 0 : nextSpacingBefore;
|
|
188626
188655
|
const interParagraphSpacing = nextIsParagraph ? Math.max(effectiveSpacingAfter, effectiveNextSpacingBefore) : effectiveSpacingAfter;
|
|
188627
188656
|
const nextFirstLineHeight = (() => {
|
|
188628
188657
|
if (!nextIsParagraph)
|
|
@@ -188632,17 +188661,19 @@ function layoutDocument(blocks2, measures, options = {}) {
|
|
|
188632
188661
|
return firstLineHeight;
|
|
188633
188662
|
return nextHeight;
|
|
188634
188663
|
})();
|
|
188635
|
-
if ((nextIsParagraph ? effectiveSpacingBefore + currentHeight + interParagraphSpacing + nextFirstLineHeight : effectiveSpacingBefore + currentHeight + spacingAfter + nextHeight) > (
|
|
188664
|
+
if ((nextIsParagraph ? effectiveSpacingBefore + currentHeight + interParagraphSpacing + nextFirstLineHeight : effectiveSpacingBefore + currentHeight + spacingAfter + nextHeight) > (prevSuppressAfter ? availableHeight + prevTrailing : availableHeight) && state.page.fragments.length > 0)
|
|
188636
188665
|
state = paginator.advanceColumn(state);
|
|
188637
188666
|
}
|
|
188638
188667
|
}
|
|
188639
188668
|
}
|
|
188640
188669
|
let overrideSpacingAfter;
|
|
188641
188670
|
const curStyleId = typeof paraBlock.attrs?.styleId === "string" ? paraBlock.attrs.styleId : undefined;
|
|
188642
|
-
|
|
188671
|
+
const curContextualSpacing = asBoolean(paraBlock.attrs?.contextualSpacing);
|
|
188672
|
+
if (curContextualSpacing && curStyleId) {
|
|
188643
188673
|
const nextBlock = index2 < blocks2.length - 1 ? blocks2[index2 + 1] : null;
|
|
188644
188674
|
if (nextBlock?.kind === "paragraph") {
|
|
188645
|
-
|
|
188675
|
+
const nextPara = nextBlock;
|
|
188676
|
+
if (shouldSuppressOwnSpacing(curStyleId, curContextualSpacing, typeof nextPara.attrs?.styleId === "string" ? nextPara.attrs?.styleId : undefined))
|
|
188646
188677
|
overrideSpacingAfter = 0;
|
|
188647
188678
|
}
|
|
188648
188679
|
}
|
|
@@ -228990,7 +229021,7 @@ var Node$13 = class Node$14 {
|
|
|
228990
229021
|
return false;
|
|
228991
229022
|
return Boolean(checker(attrs));
|
|
228992
229023
|
}, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
|
|
228993
|
-
var
|
|
229024
|
+
var init_src_DJgM_28B_es = __esm(() => {
|
|
228994
229025
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
228995
229026
|
init_SuperConverter_DarcJh0X_es();
|
|
228996
229027
|
init_jszip_ChlR43oI_es();
|
|
@@ -262322,7 +262353,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
|
|
|
262322
262353
|
|
|
262323
262354
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
262324
262355
|
var init_super_editor_es = __esm(() => {
|
|
262325
|
-
|
|
262356
|
+
init_src_DJgM_28B_es();
|
|
262326
262357
|
init_SuperConverter_DarcJh0X_es();
|
|
262327
262358
|
init_jszip_ChlR43oI_es();
|
|
262328
262359
|
init_xml_js_BtmJ6bNs_es();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.3.0-next.
|
|
3
|
+
"version": "0.3.0-next.41",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
"typescript": "^5.9.2",
|
|
23
23
|
"@superdoc/document-api": "0.0.1",
|
|
24
24
|
"@superdoc/pm-adapter": "0.0.0",
|
|
25
|
-
"superdoc": "
|
|
26
|
-
"
|
|
25
|
+
"@superdoc/super-editor": "0.0.1",
|
|
26
|
+
"superdoc": "1.20.0"
|
|
27
27
|
},
|
|
28
28
|
"module": "src/index.ts",
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"@superdoc-dev/cli-darwin-arm64": "0.3.0-next.
|
|
34
|
-
"@superdoc-dev/cli-
|
|
35
|
-
"@superdoc-dev/cli-
|
|
36
|
-
"@superdoc-dev/cli-linux-arm64": "0.3.0-next.
|
|
37
|
-
"@superdoc-dev/cli-windows-x64": "0.3.0-next.
|
|
33
|
+
"@superdoc-dev/cli-darwin-arm64": "0.3.0-next.41",
|
|
34
|
+
"@superdoc-dev/cli-linux-x64": "0.3.0-next.41",
|
|
35
|
+
"@superdoc-dev/cli-darwin-x64": "0.3.0-next.41",
|
|
36
|
+
"@superdoc-dev/cli-linux-arm64": "0.3.0-next.41",
|
|
37
|
+
"@superdoc-dev/cli-windows-x64": "0.3.0-next.41"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"predev": "node scripts/ensure-superdoc-build.js",
|