@superdoc-dev/cli 0.16.0-next.15 → 0.16.0-next.17
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 +203 -42
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -68110,7 +68110,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
|
|
|
68110
68110
|
emptyOptions2 = {};
|
|
68111
68111
|
});
|
|
68112
68112
|
|
|
68113
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
68113
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-EumzHoTv.es.js
|
|
68114
68114
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
68115
68115
|
const fieldValue = extension$1.config[field];
|
|
68116
68116
|
if (typeof fieldValue === "function")
|
|
@@ -100894,11 +100894,37 @@ function translateHeadingNode(params3) {
|
|
|
100894
100894
|
function mergeMcIgnorable(defaultIgnorable = "", originalIgnorable = "") {
|
|
100895
100895
|
return [...new Set([...defaultIgnorable.split(/\s+/).filter(Boolean), ...originalIgnorable.split(/\s+/).filter(Boolean)])].join(" ");
|
|
100896
100896
|
}
|
|
100897
|
+
function normalizeDocumentBackgroundColorForExport(value) {
|
|
100898
|
+
if (typeof value !== "string")
|
|
100899
|
+
return null;
|
|
100900
|
+
const trimmed = value.trim();
|
|
100901
|
+
const hex = trimmed.startsWith("#") ? trimmed.slice(1) : trimmed;
|
|
100902
|
+
if (!/^[0-9a-fA-F]{6}$/.test(hex))
|
|
100903
|
+
return null;
|
|
100904
|
+
return hex.toUpperCase();
|
|
100905
|
+
}
|
|
100906
|
+
function translateDocumentBackgroundNode(params3) {
|
|
100907
|
+
const background = params3?.node?.attrs?.documentBackground;
|
|
100908
|
+
if (!background || typeof background !== "object")
|
|
100909
|
+
return null;
|
|
100910
|
+
if (background.originalXml && typeof background.originalXml === "object")
|
|
100911
|
+
return carbonCopy(background.originalXml);
|
|
100912
|
+
const color2 = normalizeDocumentBackgroundColorForExport(background.color);
|
|
100913
|
+
if (!color2)
|
|
100914
|
+
return null;
|
|
100915
|
+
return {
|
|
100916
|
+
type: "element",
|
|
100917
|
+
name: "w:background",
|
|
100918
|
+
attributes: { "w:color": color2 },
|
|
100919
|
+
elements: []
|
|
100920
|
+
};
|
|
100921
|
+
}
|
|
100897
100922
|
function translateDocumentNode(params3) {
|
|
100898
100923
|
const bodyNode = {
|
|
100899
100924
|
type: "body",
|
|
100900
100925
|
content: params3.node.content
|
|
100901
100926
|
};
|
|
100927
|
+
const translatedBackgroundNode = translateDocumentBackgroundNode(params3);
|
|
100902
100928
|
const translatedBodyNode = exportSchemaToJson({
|
|
100903
100929
|
...params3,
|
|
100904
100930
|
node: bodyNode
|
|
@@ -100913,7 +100939,7 @@ function translateDocumentNode(params3) {
|
|
|
100913
100939
|
attributes["mc:Ignorable"] = mergedIgnorable;
|
|
100914
100940
|
const node3 = {
|
|
100915
100941
|
name: "w:document",
|
|
100916
|
-
elements: [translatedBodyNode],
|
|
100942
|
+
elements: translatedBackgroundNode ? [translatedBackgroundNode, translatedBodyNode] : [translatedBodyNode],
|
|
100917
100943
|
attributes
|
|
100918
100944
|
};
|
|
100919
100945
|
normalizePgMarTwipsInTree(node3);
|
|
@@ -126838,7 +126864,23 @@ var isRegExp = (value) => {
|
|
|
126838
126864
|
} catch {
|
|
126839
126865
|
return /* @__PURE__ */ new Map;
|
|
126840
126866
|
}
|
|
126841
|
-
}, readTrackedChangeSourceIdMap = (docx) => parseTrackedChangeSourceIdMap(readCustomProperty(docx, TRACKED_CHANGE_SOURCE_ID_MAP_PROPERTY)),
|
|
126867
|
+
}, readTrackedChangeSourceIdMap = (docx) => parseTrackedChangeSourceIdMap(readCustomProperty(docx, TRACKED_CHANGE_SOURCE_ID_MAP_PROPERTY)), normalizeDocumentBackgroundColor = (value) => {
|
|
126868
|
+
if (typeof value !== "string")
|
|
126869
|
+
return null;
|
|
126870
|
+
const trimmed = value.trim();
|
|
126871
|
+
if (!/^[0-9a-fA-F]{6}$/.test(trimmed))
|
|
126872
|
+
return null;
|
|
126873
|
+
return `#${trimmed.toUpperCase()}`;
|
|
126874
|
+
}, getDocumentBackground = (documentNode) => {
|
|
126875
|
+
const background = documentNode?.elements?.find((el) => el?.name === "w:background");
|
|
126876
|
+
const color2 = normalizeDocumentBackgroundColor(background?.attributes?.["w:color"] ?? background?.attributes?.color);
|
|
126877
|
+
if (!background || !color2)
|
|
126878
|
+
return null;
|
|
126879
|
+
return {
|
|
126880
|
+
color: color2,
|
|
126881
|
+
originalXml: carbonCopy(background)
|
|
126882
|
+
};
|
|
126883
|
+
}, detectCommentThreadingProfile = (docx) => {
|
|
126842
126884
|
const hasCommentsExtended = !!docx["word/commentsExtended.xml"];
|
|
126843
126885
|
const hasCommentsExtensible = !!docx["word/commentsExtensible.xml"];
|
|
126844
126886
|
const hasCommentsIds = !!docx["word/commentsIds.xml"];
|
|
@@ -126855,6 +126897,7 @@ var isRegExp = (value) => {
|
|
|
126855
126897
|
const json = carbonCopy(getInitialJSON(docx));
|
|
126856
126898
|
if (!json)
|
|
126857
126899
|
return null;
|
|
126900
|
+
const documentBackground = getDocumentBackground(json.elements?.[0]);
|
|
126858
126901
|
if (converter) {
|
|
126859
126902
|
importFootnotePropertiesFromSettings(docx, converter);
|
|
126860
126903
|
importViewSettingFromSettings(docx, converter);
|
|
@@ -126925,17 +126968,22 @@ var isRegExp = (value) => {
|
|
|
126925
126968
|
parsedContent = normalizeTableBookmarksInContent(parsedContent, editor);
|
|
126926
126969
|
collapseWhitespaceNextToInlinePassthrough(parsedContent);
|
|
126927
126970
|
parsedContent = normalizeDuplicateBlockIdentitiesInContent(parsedContent);
|
|
126971
|
+
const result = {
|
|
126972
|
+
type: "doc",
|
|
126973
|
+
content: parsedContent,
|
|
126974
|
+
attrs: {
|
|
126975
|
+
attributes: json.elements[0].attributes,
|
|
126976
|
+
...bodySectPr ? { bodySectPr } : {},
|
|
126977
|
+
...documentBackground ? { documentBackground } : {}
|
|
126978
|
+
}
|
|
126979
|
+
};
|
|
126980
|
+
const pageStyles = getDocumentStyles(node3, docx, converter, editor, numbering, translatedNumbering, translatedLinkedStyles);
|
|
126981
|
+
if (documentBackground)
|
|
126982
|
+
pageStyles.documentBackground = { color: documentBackground.color };
|
|
126928
126983
|
return {
|
|
126929
|
-
pmDoc:
|
|
126930
|
-
type: "doc",
|
|
126931
|
-
content: parsedContent,
|
|
126932
|
-
attrs: {
|
|
126933
|
-
attributes: json.elements[0].attributes,
|
|
126934
|
-
...bodySectPr ? { bodySectPr } : {}
|
|
126935
|
-
}
|
|
126936
|
-
},
|
|
126984
|
+
pmDoc: result,
|
|
126937
126985
|
savedTagsToRestore: node3,
|
|
126938
|
-
pageStyles
|
|
126986
|
+
pageStyles,
|
|
126939
126987
|
comments,
|
|
126940
126988
|
footnotes,
|
|
126941
126989
|
endnotes,
|
|
@@ -131045,7 +131093,7 @@ var isRegExp = (value) => {
|
|
|
131045
131093
|
state.kern = kernNode.attributes["w:val"];
|
|
131046
131094
|
}
|
|
131047
131095
|
}, SuperConverter;
|
|
131048
|
-
var
|
|
131096
|
+
var init_SuperConverter_EumzHoTv_es = __esm(() => {
|
|
131049
131097
|
init_rolldown_runtime_Bg48TavK_es();
|
|
131050
131098
|
init_jszip_C49i9kUs_es();
|
|
131051
131099
|
init_xml_js_CqGKpaft_es();
|
|
@@ -169838,7 +169886,7 @@ var init_SuperConverter_CvwFiCth_es = __esm(() => {
|
|
|
169838
169886
|
};
|
|
169839
169887
|
});
|
|
169840
169888
|
|
|
169841
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
169889
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-1wW3u4ea.es.js
|
|
169842
169890
|
function parseSizeUnit(val = "0") {
|
|
169843
169891
|
const length3 = val.toString() || "0";
|
|
169844
169892
|
const value = Number.parseFloat(length3);
|
|
@@ -173762,7 +173810,9 @@ function executeTextRewrite(editor, tr, target, step3, mapping) {
|
|
|
173762
173810
|
tr.replaceWith(remap(change.docFrom), remap(change.docTo), content2);
|
|
173763
173811
|
}
|
|
173764
173812
|
}
|
|
173765
|
-
} else
|
|
173813
|
+
} else if (trimmedNew.length === 0)
|
|
173814
|
+
tr.delete(trimmedFrom, trimmedTo);
|
|
173815
|
+
else {
|
|
173766
173816
|
const content2 = buildTextWithTabs(editor.state.schema, trimmedNew, asProseMirrorMarks(marks));
|
|
173767
173817
|
tr.replaceWith(trimmedFrom, trimmedTo, content2);
|
|
173768
173818
|
}
|
|
@@ -180169,8 +180219,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
|
|
|
180169
180219
|
}
|
|
180170
180220
|
};
|
|
180171
180221
|
};
|
|
180172
|
-
var
|
|
180173
|
-
|
|
180222
|
+
var init_create_headless_toolbar_1wW3u4ea_es = __esm(() => {
|
|
180223
|
+
init_SuperConverter_EumzHoTv_es();
|
|
180174
180224
|
init_uuid_qzgm05fK_es();
|
|
180175
180225
|
init_constants_D_X7xF4s_es();
|
|
180176
180226
|
init_dist_B8HfvhaK_es();
|
|
@@ -229333,7 +229383,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
229333
229383
|
init_remark_gfm_BhnWr3yf_es();
|
|
229334
229384
|
});
|
|
229335
229385
|
|
|
229336
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
229386
|
+
// ../../packages/superdoc/dist/chunks/src-Ct3813p1.es.js
|
|
229337
229387
|
function deleteProps(obj, propOrProps) {
|
|
229338
229388
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
229339
229389
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -269851,7 +269901,8 @@ function resolveLayout(input2) {
|
|
|
269851
269901
|
version: 1,
|
|
269852
269902
|
flowMode,
|
|
269853
269903
|
pageGap: layout.pageGap ?? 0,
|
|
269854
|
-
pages
|
|
269904
|
+
pages,
|
|
269905
|
+
...layout.documentBackground ? { documentBackground: layout.documentBackground } : {}
|
|
269855
269906
|
};
|
|
269856
269907
|
if (blocks2.length > 0)
|
|
269857
269908
|
resolved.blockVersions = Object.fromEntries(blocks2.map((block) => [block.id, computeBlockVersion(block.id, blockMap, blockVersionCache)]));
|
|
@@ -274464,6 +274515,7 @@ function layoutDocument(blocks2, measures, options = {}) {
|
|
|
274464
274515
|
return {
|
|
274465
274516
|
pageSize,
|
|
274466
274517
|
pages,
|
|
274518
|
+
...options.documentBackground ? { documentBackground: options.documentBackground } : {},
|
|
274467
274519
|
columns: activeColumns.count > 1 ? cloneColumnLayout(activeColumns) : undefined
|
|
274468
274520
|
};
|
|
274469
274521
|
}
|
|
@@ -311626,16 +311678,17 @@ menclose::after {
|
|
|
311626
311678
|
this.mount = mount;
|
|
311627
311679
|
this.beginPaintSnapshot(resolvedLayout);
|
|
311628
311680
|
this.totalPages = resolvedLayout.pages.length;
|
|
311681
|
+
const previousLayout = this.currentLayout;
|
|
311682
|
+
this.currentLayout = resolvedLayout;
|
|
311629
311683
|
if (this.isSemanticFlow) {
|
|
311630
311684
|
applyStyles(mount, containerStyles);
|
|
311631
311685
|
mount.style.gap = "0px";
|
|
311632
311686
|
mount.style.alignItems = "stretch";
|
|
311633
|
-
if (!
|
|
311687
|
+
if (!previousLayout || this.pageStates.length === 0)
|
|
311634
311688
|
this.fullRender(resolvedLayout);
|
|
311635
311689
|
else
|
|
311636
311690
|
this.patchLayout(resolvedLayout);
|
|
311637
311691
|
this.setMountedPageIndices(this.createAllPageIndices(resolvedLayout.pages.length));
|
|
311638
|
-
this.currentLayout = resolvedLayout;
|
|
311639
311692
|
this.changedBlocks.clear();
|
|
311640
311693
|
this.currentMapping = null;
|
|
311641
311694
|
return;
|
|
@@ -311675,7 +311728,7 @@ menclose::after {
|
|
|
311675
311728
|
this.currentMapping = null;
|
|
311676
311729
|
} else {
|
|
311677
311730
|
mount.style.gap = `${this.pageGap}px`;
|
|
311678
|
-
if (!
|
|
311731
|
+
if (!previousLayout || this.pageStates.length === 0)
|
|
311679
311732
|
this.fullRender(resolvedLayout);
|
|
311680
311733
|
else {
|
|
311681
311734
|
this.patchLayout(resolvedLayout);
|
|
@@ -312497,22 +312550,26 @@ menclose::after {
|
|
|
312497
312550
|
}
|
|
312498
312551
|
}
|
|
312499
312552
|
getEffectivePageStyles() {
|
|
312500
|
-
|
|
312501
|
-
|
|
312553
|
+
const documentBackgroundColor = this.currentLayout?.documentBackground?.color;
|
|
312554
|
+
const base5 = this.options.pageStyles ?? {};
|
|
312555
|
+
const baseWithDocumentBackground = documentBackgroundColor ? {
|
|
312556
|
+
...base5,
|
|
312557
|
+
background: documentBackgroundColor
|
|
312558
|
+
} : base5;
|
|
312559
|
+
if (this.isSemanticFlow)
|
|
312502
312560
|
return {
|
|
312503
|
-
...
|
|
312504
|
-
background:
|
|
312561
|
+
...baseWithDocumentBackground,
|
|
312562
|
+
background: baseWithDocumentBackground.background ?? "var(--sd-layout-page-bg, #fff)",
|
|
312505
312563
|
boxShadow: "none",
|
|
312506
312564
|
border: "none",
|
|
312507
312565
|
margin: "0"
|
|
312508
312566
|
};
|
|
312509
|
-
}
|
|
312510
312567
|
if (this.virtualEnabled && this.layoutMode === "vertical")
|
|
312511
312568
|
return {
|
|
312512
|
-
...
|
|
312569
|
+
...baseWithDocumentBackground,
|
|
312513
312570
|
margin: "0 auto"
|
|
312514
312571
|
};
|
|
312515
|
-
return this.options.pageStyles;
|
|
312572
|
+
return documentBackgroundColor ? baseWithDocumentBackground : this.options.pageStyles;
|
|
312516
312573
|
}
|
|
312517
312574
|
renderFragment(fragment2, context, sdtBoundary, betweenInfo, resolvedItem) {
|
|
312518
312575
|
if (fragment2.kind === "para")
|
|
@@ -322804,13 +322861,13 @@ menclose::after {
|
|
|
322804
322861
|
return;
|
|
322805
322862
|
console.log(...args$1);
|
|
322806
322863
|
}, 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, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
|
|
322807
|
-
var
|
|
322864
|
+
var init_src_Ct3813p1_es = __esm(() => {
|
|
322808
322865
|
init_rolldown_runtime_Bg48TavK_es();
|
|
322809
|
-
|
|
322866
|
+
init_SuperConverter_EumzHoTv_es();
|
|
322810
322867
|
init_jszip_C49i9kUs_es();
|
|
322811
322868
|
init_xml_js_CqGKpaft_es();
|
|
322812
322869
|
init_uuid_qzgm05fK_es();
|
|
322813
|
-
|
|
322870
|
+
init_create_headless_toolbar_1wW3u4ea_es();
|
|
322814
322871
|
init_constants_D_X7xF4s_es();
|
|
322815
322872
|
init_dist_B8HfvhaK_es();
|
|
322816
322873
|
init_unified_Dsuw2be5_es();
|
|
@@ -325654,6 +325711,10 @@ ${err.toString()}`);
|
|
|
325654
325711
|
bodySectPr: {
|
|
325655
325712
|
rendered: false,
|
|
325656
325713
|
default: null
|
|
325714
|
+
},
|
|
325715
|
+
documentBackground: {
|
|
325716
|
+
rendered: false,
|
|
325717
|
+
default: null
|
|
325657
325718
|
}
|
|
325658
325719
|
};
|
|
325659
325720
|
},
|
|
@@ -350720,6 +350781,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
350720
350781
|
#hiddenHost;
|
|
350721
350782
|
#hiddenHostWrapper;
|
|
350722
350783
|
#layoutOptions;
|
|
350784
|
+
#configuredDocumentBackground;
|
|
350723
350785
|
#layoutState = {
|
|
350724
350786
|
blocks: [],
|
|
350725
350787
|
measures: [],
|
|
@@ -350835,6 +350897,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
350835
350897
|
} : undefined;
|
|
350836
350898
|
const requestedFlowMode = options.layoutEngineOptions?.flowMode === "semantic" ? "semantic" : "paginated";
|
|
350837
350899
|
const requestedLayoutMode = options.layoutEngineOptions?.layoutMode ?? "vertical";
|
|
350900
|
+
this.#configuredDocumentBackground = this.#coerceDocumentBackground(options.layoutEngineOptions?.documentBackground);
|
|
350838
350901
|
this.#layoutOptions = {
|
|
350839
350902
|
pageSize: options.layoutEngineOptions?.pageSize ?? DEFAULT_PAGE_SIZE,
|
|
350840
350903
|
margins: options.layoutEngineOptions?.margins ?? DEFAULT_MARGINS,
|
|
@@ -350843,6 +350906,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
350843
350906
|
enabled: false
|
|
350844
350907
|
} : options.layoutEngineOptions?.virtualization,
|
|
350845
350908
|
zoom: options.layoutEngineOptions?.zoom ?? 1,
|
|
350909
|
+
...this.#configuredDocumentBackground ? { documentBackground: this.#configuredDocumentBackground } : {},
|
|
350846
350910
|
pageStyles: options.layoutEngineOptions?.pageStyles,
|
|
350847
350911
|
debugLabel: options.layoutEngineOptions?.debugLabel,
|
|
350848
350912
|
layoutMode: requestedFlowMode === "semantic" ? "vertical" : requestedLayoutMode,
|
|
@@ -355150,6 +355214,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
355150
355214
|
this.#layoutOptions.pageSize = pageSize;
|
|
355151
355215
|
this.#layoutOptions.margins = margins;
|
|
355152
355216
|
const flowMode = this.#layoutOptions.flowMode ?? "paginated";
|
|
355217
|
+
const documentBackground = this.#resolveDocumentBackground();
|
|
355218
|
+
if (documentBackground)
|
|
355219
|
+
this.#layoutOptions.documentBackground = documentBackground;
|
|
355220
|
+
else
|
|
355221
|
+
delete this.#layoutOptions.documentBackground;
|
|
355153
355222
|
const resolvedMargins = {
|
|
355154
355223
|
top: margins.top,
|
|
355155
355224
|
right: margins.right,
|
|
@@ -355189,7 +355258,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
355189
355258
|
marginTop: semanticMargins.top,
|
|
355190
355259
|
marginBottom: semanticMargins.bottom
|
|
355191
355260
|
},
|
|
355192
|
-
sectionMetadata
|
|
355261
|
+
sectionMetadata,
|
|
355262
|
+
...documentBackground ? { documentBackground } : {}
|
|
355193
355263
|
};
|
|
355194
355264
|
}
|
|
355195
355265
|
this.#hiddenHost.style.width = `${pageSize.w}px`;
|
|
@@ -355198,6 +355268,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
355198
355268
|
flowMode: "paginated",
|
|
355199
355269
|
pageSize,
|
|
355200
355270
|
margins: resolvedMargins,
|
|
355271
|
+
...documentBackground ? { documentBackground } : {},
|
|
355201
355272
|
...columns ? { columns } : {},
|
|
355202
355273
|
sectionMetadata,
|
|
355203
355274
|
alternateHeaders
|
|
@@ -355217,6 +355288,15 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
355217
355288
|
out.push(...blocks2);
|
|
355218
355289
|
return out;
|
|
355219
355290
|
}
|
|
355291
|
+
#coerceDocumentBackground(candidate) {
|
|
355292
|
+
if (!candidate || typeof candidate !== "object")
|
|
355293
|
+
return;
|
|
355294
|
+
const color2 = candidate.color;
|
|
355295
|
+
return typeof color2 === "string" && color2.length > 0 ? { color: color2 } : undefined;
|
|
355296
|
+
}
|
|
355297
|
+
#resolveDocumentBackground() {
|
|
355298
|
+
return this.#coerceDocumentBackground(this.#editor?.state?.doc?.attrs?.documentBackground) ?? (this.#configuredDocumentBackground ? { ...this.#configuredDocumentBackground } : undefined);
|
|
355299
|
+
}
|
|
355220
355300
|
#buildHeaderFooterInput() {
|
|
355221
355301
|
if (this.#isSemanticFlowMode())
|
|
355222
355302
|
return null;
|
|
@@ -357186,11 +357266,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
357186
357266
|
]);
|
|
357187
357267
|
});
|
|
357188
357268
|
|
|
357189
|
-
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-
|
|
357269
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-D9QfUqai.es.js
|
|
357190
357270
|
var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
|
|
357191
|
-
var
|
|
357192
|
-
|
|
357193
|
-
|
|
357271
|
+
var init_create_super_doc_ui_D9QfUqai_es = __esm(() => {
|
|
357272
|
+
init_SuperConverter_EumzHoTv_es();
|
|
357273
|
+
init_create_headless_toolbar_1wW3u4ea_es();
|
|
357194
357274
|
MOD_ALIASES = new Set([
|
|
357195
357275
|
"Mod",
|
|
357196
357276
|
"Meta",
|
|
@@ -357232,16 +357312,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
|
|
|
357232
357312
|
|
|
357233
357313
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
357234
357314
|
var init_super_editor_es = __esm(() => {
|
|
357235
|
-
|
|
357236
|
-
|
|
357315
|
+
init_src_Ct3813p1_es();
|
|
357316
|
+
init_SuperConverter_EumzHoTv_es();
|
|
357237
357317
|
init_jszip_C49i9kUs_es();
|
|
357238
357318
|
init_xml_js_CqGKpaft_es();
|
|
357239
|
-
|
|
357319
|
+
init_create_headless_toolbar_1wW3u4ea_es();
|
|
357240
357320
|
init_constants_D_X7xF4s_es();
|
|
357241
357321
|
init_dist_B8HfvhaK_es();
|
|
357242
357322
|
init_unified_Dsuw2be5_es();
|
|
357243
357323
|
init_DocxZipper_nv_KfOqb_es();
|
|
357244
|
-
|
|
357324
|
+
init_create_super_doc_ui_D9QfUqai_es();
|
|
357245
357325
|
init_ui_C5PAS9hY_es();
|
|
357246
357326
|
init_eventemitter3_BnGqBE_Q_es();
|
|
357247
357327
|
init_errors_CNaD6vcg_es();
|
|
@@ -409959,6 +410039,70 @@ function selectRepeatedActionableOneOfError(path2, errors2) {
|
|
|
409959
410039
|
}
|
|
409960
410040
|
return bestMessage;
|
|
409961
410041
|
}
|
|
410042
|
+
function describeVariant(variant) {
|
|
410043
|
+
if ("const" in variant)
|
|
410044
|
+
return JSON.stringify(variant.const);
|
|
410045
|
+
if ("oneOf" in variant)
|
|
410046
|
+
return variant.oneOf.map(describeVariant).join(" | ");
|
|
410047
|
+
if (variant.enum)
|
|
410048
|
+
return variant.enum.map((entry) => JSON.stringify(entry)).join(" | ");
|
|
410049
|
+
if (variant.type === "object") {
|
|
410050
|
+
const properties = variant.properties ?? {};
|
|
410051
|
+
const required = new Set(variant.required ?? []);
|
|
410052
|
+
const keys6 = Object.keys(properties);
|
|
410053
|
+
if (keys6.length === 0)
|
|
410054
|
+
return "object";
|
|
410055
|
+
const parts = keys6.map((key2) => {
|
|
410056
|
+
const prop = properties[key2];
|
|
410057
|
+
if (prop && "const" in prop)
|
|
410058
|
+
return `${key2}: ${JSON.stringify(prop.const)}`;
|
|
410059
|
+
return required.has(key2) ? key2 : `${key2}?`;
|
|
410060
|
+
});
|
|
410061
|
+
return `{ ${parts.join(", ")} }`;
|
|
410062
|
+
}
|
|
410063
|
+
if (variant.type === "array")
|
|
410064
|
+
return "array";
|
|
410065
|
+
if (variant.type === "json")
|
|
410066
|
+
return "object";
|
|
410067
|
+
return variant.type ?? "value";
|
|
410068
|
+
}
|
|
410069
|
+
function getOneOfDiscriminator(variants) {
|
|
410070
|
+
const objectVariants = variants.filter((variant) => !("const" in variant) && !("oneOf" in variant) && variant.type === "object" && isRecord3(variant.properties));
|
|
410071
|
+
if (objectVariants.length < 2)
|
|
410072
|
+
return null;
|
|
410073
|
+
for (const key2 of Object.keys(objectVariants[0].properties)) {
|
|
410074
|
+
const sharedByAll = objectVariants.every((variant) => {
|
|
410075
|
+
const prop = variant.properties[key2];
|
|
410076
|
+
return prop != null && "const" in prop;
|
|
410077
|
+
});
|
|
410078
|
+
if (sharedByAll)
|
|
410079
|
+
return key2;
|
|
410080
|
+
}
|
|
410081
|
+
return null;
|
|
410082
|
+
}
|
|
410083
|
+
function variantConstFor(variant, key2) {
|
|
410084
|
+
if ("const" in variant || "oneOf" in variant || variant.type !== "object")
|
|
410085
|
+
return;
|
|
410086
|
+
const prop = variant.properties?.[key2];
|
|
410087
|
+
return prop && "const" in prop ? prop.const : undefined;
|
|
410088
|
+
}
|
|
410089
|
+
function truncateForError(serialized, max5 = 64) {
|
|
410090
|
+
return serialized.length > max5 ? `${serialized.slice(0, max5)}…` : serialized;
|
|
410091
|
+
}
|
|
410092
|
+
function describeReceived(value2) {
|
|
410093
|
+
if (value2 === null)
|
|
410094
|
+
return "null";
|
|
410095
|
+
if (Array.isArray(value2))
|
|
410096
|
+
return "an array";
|
|
410097
|
+
const valueType = typeof value2;
|
|
410098
|
+
if (valueType === "object") {
|
|
410099
|
+
const keys6 = Object.keys(value2);
|
|
410100
|
+
return keys6.length > 0 ? `an object with keys [${keys6.join(", ")}]` : "an empty object";
|
|
410101
|
+
}
|
|
410102
|
+
if (valueType === "string")
|
|
410103
|
+
return `a string (${truncateForError(JSON.stringify(value2))})`;
|
|
410104
|
+
return `a ${valueType} (${truncateForError(JSON.stringify(value2))})`;
|
|
410105
|
+
}
|
|
409962
410106
|
function validateValueAgainstTypeSpec(value2, schema, path2) {
|
|
409963
410107
|
if ("const" in schema) {
|
|
409964
410108
|
if (value2 !== schema.const) {
|
|
@@ -409977,9 +410121,26 @@ function validateValueAgainstTypeSpec(value2, schema, path2) {
|
|
|
409977
410121
|
errors2.push(error4 instanceof Error ? error4.message : String(error4));
|
|
409978
410122
|
}
|
|
409979
410123
|
}
|
|
410124
|
+
const discriminator = getOneOfDiscriminator(variants);
|
|
410125
|
+
if (discriminator && isRecord3(value2) && value2[discriminator] !== undefined) {
|
|
410126
|
+
const received = value2[discriminator];
|
|
410127
|
+
const matched = variants.find((variant) => variantConstFor(variant, discriminator) === received);
|
|
410128
|
+
if (matched) {
|
|
410129
|
+
try {
|
|
410130
|
+
validateValueAgainstTypeSpec(value2, matched, path2);
|
|
410131
|
+
return;
|
|
410132
|
+
} catch (error4) {
|
|
410133
|
+
const message2 = error4 instanceof Error ? error4.message : String(error4);
|
|
410134
|
+
throw new CliError("VALIDATION_ERROR", message2, { errors: errors2, selectedError: message2 });
|
|
410135
|
+
}
|
|
410136
|
+
}
|
|
410137
|
+
const allowedTags = variants.map((variant) => variantConstFor(variant, discriminator)).filter((tag) => tag !== undefined).map((tag) => JSON.stringify(tag));
|
|
410138
|
+
const unmatchedTagMessage = `${path2}.${discriminator} must be one of: ${allowedTags.join(", ")} (received ${truncateForError(JSON.stringify(received))}).`;
|
|
410139
|
+
throw new CliError("VALIDATION_ERROR", unmatchedTagMessage, { errors: errors2, selectedError: unmatchedTagMessage });
|
|
410140
|
+
}
|
|
409980
410141
|
const allowedValues = extractConstValues(variants);
|
|
409981
410142
|
const selectedError = selectRepeatedActionableOneOfError(path2, errors2);
|
|
409982
|
-
const message = allowedValues.length > 0 ? `${path2} must be one of: ${allowedValues.join(", ")}.` : selectedError ?? `${path2} must match one of
|
|
410143
|
+
const message = allowedValues.length > 0 ? `${path2} must be one of: ${allowedValues.join(", ")}.` : selectedError ?? `${path2} must match one of: ${variants.map(describeVariant).join(" | ")}. Received ${describeReceived(value2)}.`;
|
|
409983
410144
|
throw new CliError("VALIDATION_ERROR", message, { errors: errors2, selectedError });
|
|
409984
410145
|
}
|
|
409985
410146
|
if (schema.type === "json")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.16.0-next.
|
|
3
|
+
"version": "0.16.0-next.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -25,19 +25,19 @@
|
|
|
25
25
|
"@types/ws": "^8.5.13",
|
|
26
26
|
"typescript": "^5.9.2",
|
|
27
27
|
"@superdoc/document-api": "0.0.1",
|
|
28
|
-
"superdoc": "
|
|
29
|
-
"
|
|
28
|
+
"@superdoc/super-editor": "0.0.1",
|
|
29
|
+
"superdoc": "1.38.0"
|
|
30
30
|
},
|
|
31
31
|
"module": "src/index.ts",
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@superdoc-dev/cli-darwin-arm64": "0.16.0-next.
|
|
37
|
-
"@superdoc-dev/cli-darwin-x64": "0.16.0-next.
|
|
38
|
-
"@superdoc-dev/cli-linux-
|
|
39
|
-
"@superdoc-dev/cli-
|
|
40
|
-
"@superdoc-dev/cli-
|
|
36
|
+
"@superdoc-dev/cli-darwin-arm64": "0.16.0-next.17",
|
|
37
|
+
"@superdoc-dev/cli-darwin-x64": "0.16.0-next.17",
|
|
38
|
+
"@superdoc-dev/cli-linux-arm64": "0.16.0-next.17",
|
|
39
|
+
"@superdoc-dev/cli-windows-x64": "0.16.0-next.17",
|
|
40
|
+
"@superdoc-dev/cli-linux-x64": "0.16.0-next.17"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"predev": "node scripts/ensure-superdoc-build.js",
|