@superdoc-dev/cli 0.3.0-next.40 → 0.3.0-next.42
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 +62 -28
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -39922,7 +39922,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
|
|
|
39922
39922
|
emptyOptions2 = {};
|
|
39923
39923
|
});
|
|
39924
39924
|
|
|
39925
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
39925
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-oKnAIRIw.es.js
|
|
39926
39926
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
39927
39927
|
const fieldValue = extension$1.config[field];
|
|
39928
39928
|
if (typeof fieldValue === "function")
|
|
@@ -85997,7 +85997,7 @@ var isRegExp = (value) => {
|
|
|
85997
85997
|
state.kern = kernNode.attributes["w:val"];
|
|
85998
85998
|
}
|
|
85999
85999
|
}, SuperConverter;
|
|
86000
|
-
var
|
|
86000
|
+
var init_SuperConverter_oKnAIRIw_es = __esm(() => {
|
|
86001
86001
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
86002
86002
|
init_jszip_ChlR43oI_es();
|
|
86003
86003
|
init_xml_js_BtmJ6bNs_es();
|
|
@@ -122099,7 +122099,7 @@ var init_SuperConverter_DarcJh0X_es = __esm(() => {
|
|
|
122099
122099
|
if (!editor)
|
|
122100
122100
|
return;
|
|
122101
122101
|
try {
|
|
122102
|
-
const stats = getWordStatistics(editor);
|
|
122102
|
+
const stats = getWordStatistics(resolveMainBodyEditor(editor));
|
|
122103
122103
|
writeAppStatistics(this.convertedXml, stats);
|
|
122104
122104
|
const settingsPart = this.convertedXml["word/settings.xml"];
|
|
122105
122105
|
if (settingsPart && stats.pages == null) {
|
|
@@ -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-CLe3UbDE.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,9 +229021,9 @@ 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_CLe3UbDE_es = __esm(() => {
|
|
228994
229025
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
228995
|
-
|
|
229026
|
+
init_SuperConverter_oKnAIRIw_es();
|
|
228996
229027
|
init_jszip_ChlR43oI_es();
|
|
228997
229028
|
init_uuid_qzgm05fK_es();
|
|
228998
229029
|
init_constants_ep1_Gwqi_es();
|
|
@@ -238805,6 +238836,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
238805
238836
|
});
|
|
238806
238837
|
const numberingData = this.converter.convertedXml["word/numbering.xml"];
|
|
238807
238838
|
const numbering = this.converter.schemaToXml(numberingData.elements[0]);
|
|
238839
|
+
const appXmlData = this.converter.convertedXml["docProps/app.xml"];
|
|
238840
|
+
const appXml = appXmlData?.elements?.[0] ? this.converter.schemaToXml(appXmlData.elements[0]) : null;
|
|
238808
238841
|
const coreXmlData = this.converter.convertedXml["docProps/core.xml"];
|
|
238809
238842
|
const coreXml = coreXmlData?.elements?.[0] ? this.converter.schemaToXml(coreXmlData.elements[0]) : null;
|
|
238810
238843
|
const updatedDocs = {
|
|
@@ -238815,6 +238848,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
238815
238848
|
"word/numbering.xml": String(numbering),
|
|
238816
238849
|
"word/styles.xml": String(styles),
|
|
238817
238850
|
...updatedHeadersFooters,
|
|
238851
|
+
...appXml ? { "docProps/app.xml": String(appXml) } : {},
|
|
238818
238852
|
...coreXml ? { "docProps/core.xml": String(coreXml) } : {}
|
|
238819
238853
|
};
|
|
238820
238854
|
if (hasCustomSettings)
|
|
@@ -262322,8 +262356,8 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
|
|
|
262322
262356
|
|
|
262323
262357
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
262324
262358
|
var init_super_editor_es = __esm(() => {
|
|
262325
|
-
|
|
262326
|
-
|
|
262359
|
+
init_src_CLe3UbDE_es();
|
|
262360
|
+
init_SuperConverter_oKnAIRIw_es();
|
|
262327
262361
|
init_jszip_ChlR43oI_es();
|
|
262328
262362
|
init_xml_js_BtmJ6bNs_es();
|
|
262329
262363
|
init_constants_ep1_Gwqi_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.42",
|
|
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-darwin-x64": "0.3.0-next.
|
|
35
|
-
"@superdoc-dev/cli-linux-x64": "0.3.0-next.
|
|
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.42",
|
|
34
|
+
"@superdoc-dev/cli-darwin-x64": "0.3.0-next.42",
|
|
35
|
+
"@superdoc-dev/cli-linux-x64": "0.3.0-next.42",
|
|
36
|
+
"@superdoc-dev/cli-linux-arm64": "0.3.0-next.42",
|
|
37
|
+
"@superdoc-dev/cli-windows-x64": "0.3.0-next.42"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"predev": "node scripts/ensure-superdoc-build.js",
|