@json-to-office/core-docx 6.8.1 → 7.0.0
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/blocks/document.d.ts.map +1 -1
- package/dist/core/generationContext.d.ts +2 -2
- package/dist/core/generationContext.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +206 -80
- package/dist/index.js.map +1 -1
- package/dist/plugin/createDocumentGenerator.d.ts.map +1 -1
- package/dist/plugin/example/index.js +129 -41
- package/dist/plugin/example/index.js.map +1 -1
- package/dist/plugin/index.d.ts +1 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/types.d.ts +27 -0
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/quality/facts.d.ts +14 -1
- package/dist/quality/facts.d.ts.map +1 -1
- package/dist/quality/rules.d.ts +2 -2
- package/dist/quality/rules.d.ts.map +1 -1
- package/dist/styles/themeToStyles.d.ts +23 -0
- package/dist/styles/themeToStyles.d.ts.map +1 -1
- package/dist/templates/themes/consulting.docx.theme.json +2 -1
- package/dist/templates/themes/index.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDocumentGenerator.d.ts","sourceRoot":"","sources":["../../src/plugin/createDocumentGenerator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAK7C,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,KAAK,EAEV,wBAAwB,
|
|
1
|
+
{"version":3,"file":"createDocumentGenerator.d.ts","sourceRoot":"","sources":["../../src/plugin/createDocumentGenerator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAK7C,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,KAAK,EAEV,wBAAwB,EAQxB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AAgBjB;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,kEAAkE;IAClE,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC3C,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,oFAAoF;IACpF,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;;;OAIG;IACH,UAAU,CAAC,EAAE,2BAA2B,CAAC;IACzC,gFAAgF;IAChF,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAq4BD;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,wBAAwB,GAChC,wBAAwB,CAAC,SAAS,EAAE,CAAC,CAkBvC"}
|
|
@@ -1336,7 +1336,8 @@ var init_consulting_docx_theme = __esm({
|
|
|
1336
1336
|
},
|
|
1337
1337
|
stat: {
|
|
1338
1338
|
face: "heading",
|
|
1339
|
-
|
|
1339
|
+
size: 22,
|
|
1340
|
+
weight: 400,
|
|
1340
1341
|
color: "accent",
|
|
1341
1342
|
lineHeight: 1
|
|
1342
1343
|
},
|
|
@@ -1643,7 +1644,7 @@ var init_themes = __esm({
|
|
|
1643
1644
|
getTheme = (themeName) => {
|
|
1644
1645
|
return themes[themeName];
|
|
1645
1646
|
};
|
|
1646
|
-
getThemeWithFallback = (themeName, fallbackTheme = "
|
|
1647
|
+
getThemeWithFallback = (themeName, fallbackTheme = "consulting") => {
|
|
1647
1648
|
const theme = getTheme(themeName) || getTheme(fallbackTheme);
|
|
1648
1649
|
if (!theme) {
|
|
1649
1650
|
throw new Error(
|
|
@@ -1723,7 +1724,7 @@ function resolveTheme(theme, themeName) {
|
|
|
1723
1724
|
if (themeName) {
|
|
1724
1725
|
return getTheme(themeName);
|
|
1725
1726
|
}
|
|
1726
|
-
return getTheme("
|
|
1727
|
+
return getTheme("consulting");
|
|
1727
1728
|
}
|
|
1728
1729
|
function resolveFontFamily(theme, fontRef) {
|
|
1729
1730
|
if (!theme?.fonts?.body?.family) {
|
|
@@ -5544,7 +5545,7 @@ function resolveThemeContext(documentIn, options = {}) {
|
|
|
5544
5545
|
}
|
|
5545
5546
|
const document = documentIn.props === void 0 ? { ...documentIn, props: {} } : documentIn;
|
|
5546
5547
|
const authoredThemeName = document.props.theme || void 0;
|
|
5547
|
-
const baseThemeName = authoredThemeName ?? "
|
|
5548
|
+
const baseThemeName = authoredThemeName ?? "consulting";
|
|
5548
5549
|
let theme = resolveNamedTheme ? resolveNamedTheme(
|
|
5549
5550
|
baseThemeName,
|
|
5550
5551
|
warnings,
|
|
@@ -7100,7 +7101,12 @@ function resolveColors(entries, at, deps) {
|
|
|
7100
7101
|
init_themes();
|
|
7101
7102
|
init_colorUtils();
|
|
7102
7103
|
init_styleHelpers();
|
|
7103
|
-
import {
|
|
7104
|
+
import {
|
|
7105
|
+
capsFormatting,
|
|
7106
|
+
designCanvas as designCanvas2,
|
|
7107
|
+
synthesizeFamilyName,
|
|
7108
|
+
typeScaleSizes
|
|
7109
|
+
} from "@json-to-office/shared";
|
|
7104
7110
|
var RIGHT_MARGIN_TAB_TWIPS = 9026 * 2;
|
|
7105
7111
|
var STATISTIC_NUMBER_STYLE_ID = "StatisticNumber";
|
|
7106
7112
|
var STATISTIC_DESCRIPTION_STYLE_ID = "StatisticDescription";
|
|
@@ -7109,6 +7115,27 @@ var STATISTIC_SIZE_POINTS = {
|
|
|
7109
7115
|
medium: 28,
|
|
7110
7116
|
large: 40
|
|
7111
7117
|
};
|
|
7118
|
+
function statisticSizes(theme, size) {
|
|
7119
|
+
const sizeOf = (style) => {
|
|
7120
|
+
const value = theme.styles?.[style]?.size;
|
|
7121
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
|
|
7122
|
+
};
|
|
7123
|
+
const role = sizeOf("stat");
|
|
7124
|
+
const medium = sizeOf(STATISTIC_NUMBER_STYLE_ID) ?? role ?? STATISTIC_SIZE_POINTS.medium;
|
|
7125
|
+
const scale = role === void 0 ? void 0 : theme.typography?.scale?.[designCanvas2("docx", theme.page?.size)];
|
|
7126
|
+
const steps = scale ? typeScaleSizes(scale) : [];
|
|
7127
|
+
const below = [...steps].reverse().find((step) => step < medium - 0.01);
|
|
7128
|
+
const above = steps.find((step) => step > medium + 0.01);
|
|
7129
|
+
const number = size === "small" ? role !== void 0 && below !== void 0 ? below : STATISTIC_SIZE_POINTS.small : size === "large" ? role !== void 0 && above !== void 0 ? above : STATISTIC_SIZE_POINTS.large : medium;
|
|
7130
|
+
const label = sizeOf("label");
|
|
7131
|
+
return {
|
|
7132
|
+
number,
|
|
7133
|
+
medium,
|
|
7134
|
+
// Half-points in the document, floored at 6pt.
|
|
7135
|
+
suffix: label ?? Math.max(12, Math.round(number)) / 2,
|
|
7136
|
+
description: sizeOf(STATISTIC_DESCRIPTION_STYLE_ID) ?? label ?? 10
|
|
7137
|
+
};
|
|
7138
|
+
}
|
|
7112
7139
|
function getStyleSafe(theme, styleName) {
|
|
7113
7140
|
return theme.styles && Object.hasOwn(theme.styles, styleName) ? theme.styles[styleName] : void 0;
|
|
7114
7141
|
}
|
|
@@ -7284,8 +7311,8 @@ function chromeRun(fontProps, theme, sizeHalfPoints) {
|
|
|
7284
7311
|
...fontProps.italic !== void 0 && { italic: fontProps.italic }
|
|
7285
7312
|
};
|
|
7286
7313
|
}
|
|
7287
|
-
function createDocumentStyles(themeNameOrObject = "
|
|
7288
|
-
const theme = typeof themeNameOrObject === "string" ? getTheme(themeNameOrObject) || getTheme("
|
|
7314
|
+
function createDocumentStyles(themeNameOrObject = "consulting", language) {
|
|
7315
|
+
const theme = typeof themeNameOrObject === "string" ? getTheme(themeNameOrObject) || getTheme("consulting") : themeNameOrObject;
|
|
7289
7316
|
const paragraphStyles = [
|
|
7290
7317
|
// Normal body text style
|
|
7291
7318
|
{
|
|
@@ -7756,14 +7783,19 @@ function createDocumentStyles(themeNameOrObject = "minimal", language) {
|
|
|
7756
7783
|
};
|
|
7757
7784
|
}
|
|
7758
7785
|
function createStatisticStyles(theme) {
|
|
7786
|
+
const sizes = statisticSizes(theme, "medium");
|
|
7787
|
+
const stat = theme.styles?.stat;
|
|
7788
|
+
const faces = ["heading", "body", "mono", "light"];
|
|
7789
|
+
const face = faces.find((candidate) => candidate === stat?.font) ?? "heading";
|
|
7790
|
+
const weight = typeof stat?.fontWeight === "number" ? stat.fontWeight : void 0;
|
|
7759
7791
|
const definitions = [
|
|
7760
7792
|
{
|
|
7761
7793
|
id: STATISTIC_NUMBER_STYLE_ID,
|
|
7762
7794
|
name: "Statistic Number",
|
|
7763
|
-
font:
|
|
7764
|
-
sizePoints:
|
|
7765
|
-
color: theme.colors.primary,
|
|
7766
|
-
bold: true,
|
|
7795
|
+
font: face,
|
|
7796
|
+
sizePoints: sizes.medium,
|
|
7797
|
+
color: typeof stat?.color === "string" ? stat.color : theme.colors.primary,
|
|
7798
|
+
bold: weight === void 0 ? true : weight >= 600,
|
|
7767
7799
|
// Space above separates the figure from whatever preceded it; none below,
|
|
7768
7800
|
// because the description is the other half of the same block.
|
|
7769
7801
|
spacing: { before: 12, after: 0 },
|
|
@@ -7776,7 +7808,7 @@ function createStatisticStyles(theme) {
|
|
|
7776
7808
|
id: STATISTIC_DESCRIPTION_STYLE_ID,
|
|
7777
7809
|
name: "Statistic Description",
|
|
7778
7810
|
font: "body",
|
|
7779
|
-
sizePoints:
|
|
7811
|
+
sizePoints: sizes.description,
|
|
7780
7812
|
color: theme.colors.textMuted,
|
|
7781
7813
|
bold: false,
|
|
7782
7814
|
spacing: { before: 0, after: 12 },
|
|
@@ -10348,9 +10380,10 @@ function compileStatistic(component, scope) {
|
|
|
10348
10380
|
);
|
|
10349
10381
|
}
|
|
10350
10382
|
const text = (value) => normalizeUnicodeText(String(value ?? ""));
|
|
10351
|
-
const
|
|
10352
|
-
const
|
|
10353
|
-
const
|
|
10383
|
+
const sizes = statisticSizes(ctx.theme, props.size);
|
|
10384
|
+
const numberPoints = sizes.number;
|
|
10385
|
+
const resized = numberPoints !== sizes.medium;
|
|
10386
|
+
const suffixHalfPoints = Math.round(sizes.suffix * 2);
|
|
10354
10387
|
const numberRuns = [];
|
|
10355
10388
|
const numberText = text(props.number);
|
|
10356
10389
|
if (numberText) {
|
|
@@ -12649,10 +12682,10 @@ import {
|
|
|
12649
12682
|
} from "@json-to-office/quality";
|
|
12650
12683
|
import { DEFAULT_DOCX_RENDERER_ID as DEFAULT_DOCX_RENDERER_ID2 } from "@json-to-office/shared-docx";
|
|
12651
12684
|
import {
|
|
12652
|
-
designCanvas as
|
|
12685
|
+
designCanvas as designCanvas3,
|
|
12653
12686
|
designColors as designColors2,
|
|
12654
12687
|
resolveDesignColor as resolveDesignColor2,
|
|
12655
|
-
typeScaleSizes
|
|
12688
|
+
typeScaleSizes as typeScaleSizes2
|
|
12656
12689
|
} from "@json-to-office/shared";
|
|
12657
12690
|
|
|
12658
12691
|
// src/json/normalizer.ts
|
|
@@ -12988,7 +13021,8 @@ async function expandBlocksWithPlugins(document, theme, plugins, render, preserv
|
|
|
12988
13021
|
document: second.standard,
|
|
12989
13022
|
preserved: first.preserved,
|
|
12990
13023
|
sourceMap: evaluator.sourceMap,
|
|
12991
|
-
blocks: evaluator.blocks
|
|
13024
|
+
blocks: evaluator.blocks,
|
|
13025
|
+
pluginOutputs: evaluator.pluginOutputs
|
|
12992
13026
|
};
|
|
12993
13027
|
}
|
|
12994
13028
|
|
|
@@ -13775,10 +13809,7 @@ function textSizeFact(node, props, path3, typography, role) {
|
|
|
13775
13809
|
};
|
|
13776
13810
|
}
|
|
13777
13811
|
function statisticSizeFacts(props, path3, typography) {
|
|
13778
|
-
const
|
|
13779
|
-
const styled = (id) => finiteNumber(asRecord2(typography.styles[id])?.size);
|
|
13780
|
-
const numberPoints = named ?? STATISTIC_SIZE_POINTS.medium;
|
|
13781
|
-
const painted = props.size === "small" || props.size === "large" ? numberPoints : styled("StatisticNumber") ?? numberPoints;
|
|
13812
|
+
const sizes = statisticSizes(typography.theme, props.size);
|
|
13782
13813
|
const present = (value) => value !== void 0 && value !== null && String(value).trim() !== "";
|
|
13783
13814
|
const facts = [];
|
|
13784
13815
|
const add = (suffix, role, fontSizePt) => facts.push({
|
|
@@ -13789,19 +13820,11 @@ function statisticSizeFacts(props, path3, typography) {
|
|
|
13789
13820
|
fontSizePt,
|
|
13790
13821
|
authored: false
|
|
13791
13822
|
});
|
|
13792
|
-
if (present(props.number)) add("number", "statistic",
|
|
13823
|
+
if (present(props.number)) add("number", "statistic", sizes.number);
|
|
13793
13824
|
if (present(props.unit) || present(props.trend) || present(props.trendValue))
|
|
13794
|
-
add(
|
|
13795
|
-
"suffix",
|
|
13796
|
-
"statistic-suffix",
|
|
13797
|
-
Math.max(12, Math.round(numberPoints)) / 2
|
|
13798
|
-
);
|
|
13825
|
+
add("suffix", "statistic-suffix", sizes.suffix);
|
|
13799
13826
|
if (present(props.description))
|
|
13800
|
-
add(
|
|
13801
|
-
"description",
|
|
13802
|
-
"statistic-description",
|
|
13803
|
-
styled("StatisticDescription") ?? 10
|
|
13804
|
-
);
|
|
13827
|
+
add("description", "statistic-description", sizes.description);
|
|
13805
13828
|
return facts;
|
|
13806
13829
|
}
|
|
13807
13830
|
function tocSizeFacts(props, path3, typography) {
|
|
@@ -13903,8 +13926,8 @@ function prepareDocxQualityDocument(document, options = {}) {
|
|
|
13903
13926
|
fonts: options.fonts,
|
|
13904
13927
|
warnings: options.warnings
|
|
13905
13928
|
});
|
|
13906
|
-
const expanded = expandBlocks(themed.document, themed.theme);
|
|
13907
|
-
const context = expanded.blocks.length > 0 ? { ...themed, document: expanded.document } : themed;
|
|
13929
|
+
const expanded = options.expanded ?? expandBlocks(themed.document, themed.theme);
|
|
13930
|
+
const context = options.expanded !== void 0 || expanded.blocks.length > 0 ? { ...themed, document: expanded.document } : themed;
|
|
13908
13931
|
const resolved = resolveDocumentTree(context.document, context.theme);
|
|
13909
13932
|
const basePage = pageBox(resolved.theme, context.themeName);
|
|
13910
13933
|
const typography = {
|
|
@@ -13916,7 +13939,7 @@ function prepareDocxQualityDocument(document, options = {}) {
|
|
|
13916
13939
|
let previousHeadingLevel;
|
|
13917
13940
|
const authoredPath = (path3) => toAuthoredPointer(
|
|
13918
13941
|
themed.sourceMap ?? {},
|
|
13919
|
-
toAuthoredPointer(expanded.sourceMap, path3)
|
|
13942
|
+
toAuthoredPointer(expanded.sourceMap, path3, expanded.pluginOutputs)
|
|
13920
13943
|
);
|
|
13921
13944
|
const addFact = (raw) => {
|
|
13922
13945
|
const fact = {
|
|
@@ -14055,7 +14078,7 @@ function prepareDocxQualityDocument(document, options = {}) {
|
|
|
14055
14078
|
);
|
|
14056
14079
|
if (size) roleSizesPt[key] = size.fontSizePt;
|
|
14057
14080
|
}
|
|
14058
|
-
const scale = resolved.theme.typography?.scale?.[
|
|
14081
|
+
const scale = resolved.theme.typography?.scale?.[designCanvas3("docx", resolved.theme.page?.size)];
|
|
14059
14082
|
const typeScalePt = [
|
|
14060
14083
|
.../* @__PURE__ */ new Set([
|
|
14061
14084
|
...Object.values(roleSizesPt),
|
|
@@ -14063,7 +14086,7 @@ function prepareDocxQualityDocument(document, options = {}) {
|
|
|
14063
14086
|
const size = resolveFontSize(resolved.theme, role);
|
|
14064
14087
|
return size === void 0 ? [] : [size];
|
|
14065
14088
|
}),
|
|
14066
|
-
...scale ?
|
|
14089
|
+
...scale ? typeScaleSizes2(scale) : []
|
|
14067
14090
|
])
|
|
14068
14091
|
].sort((a, b) => a - b);
|
|
14069
14092
|
addFact({
|
|
@@ -14219,6 +14242,7 @@ function prepareDocxQualityDocument(document, options = {}) {
|
|
|
14219
14242
|
for (const fact of svgTextFacts(props, path3)) addFact(fact);
|
|
14220
14243
|
const drawn = drawnRatio(props);
|
|
14221
14244
|
const natural = readableRatio(props);
|
|
14245
|
+
const authored = authoredPropsAt(path3);
|
|
14222
14246
|
addFact({
|
|
14223
14247
|
id: `docx:image:${path3}`,
|
|
14224
14248
|
kind: "docx/image",
|
|
@@ -14226,7 +14250,13 @@ function prepareDocxQualityDocument(document, options = {}) {
|
|
|
14226
14250
|
...typeof props.alt === "string" && props.alt.trim() !== "" && { alt: props.alt },
|
|
14227
14251
|
captioned: isCaptioned(facts, authoredPath(path3)),
|
|
14228
14252
|
...drawn !== void 0 && { drawnRatio: drawn },
|
|
14229
|
-
...natural !== void 0 && { naturalRatio: natural }
|
|
14253
|
+
...natural !== void 0 && { naturalRatio: natural },
|
|
14254
|
+
...authoredPath(path3) === path3 && finiteNumber(authored?.width) !== void 0 && finiteNumber(authored?.height) !== void 0 && {
|
|
14255
|
+
authoredSizePx: {
|
|
14256
|
+
width: authored.width,
|
|
14257
|
+
height: authored.height
|
|
14258
|
+
}
|
|
14259
|
+
}
|
|
14230
14260
|
});
|
|
14231
14261
|
}
|
|
14232
14262
|
if (node.name === "heading") {
|
|
@@ -14715,7 +14745,7 @@ function createBuilderImpl(state) {
|
|
|
14715
14745
|
}
|
|
14716
14746
|
return new Set(list);
|
|
14717
14747
|
}
|
|
14718
|
-
async function expandDocument(document, options) {
|
|
14748
|
+
async function expandDocument(document, options, provenance = false) {
|
|
14719
14749
|
const preserveSet = resolvePreserveSet(options);
|
|
14720
14750
|
const rootIn = document;
|
|
14721
14751
|
const internalDocument = rootIn.props === void 0 ? { ...rootIn, props: {} } : rootIn;
|
|
@@ -14775,7 +14805,7 @@ function createBuilderImpl(state) {
|
|
|
14775
14805
|
warnings,
|
|
14776
14806
|
resolveNamedTheme: resolveDocumentTheme
|
|
14777
14807
|
});
|
|
14778
|
-
if (modedRoot.props.blocks !== void 0) {
|
|
14808
|
+
if (modedRoot.props.blocks !== void 0 || provenance) {
|
|
14779
14809
|
const expanded = await expandBlocksWithPlugins(
|
|
14780
14810
|
modedRoot,
|
|
14781
14811
|
modedTheme,
|
|
@@ -14823,6 +14853,7 @@ function createBuilderImpl(state) {
|
|
|
14823
14853
|
modedDoc: modedDoc2,
|
|
14824
14854
|
sourceMap: expanded.sourceMap,
|
|
14825
14855
|
blockPaths: expanded.blocks,
|
|
14856
|
+
pluginOutputs: expanded.pluginOutputs,
|
|
14826
14857
|
warnings,
|
|
14827
14858
|
preserveSet,
|
|
14828
14859
|
processed: {
|
|
@@ -14871,8 +14902,64 @@ function createBuilderImpl(state) {
|
|
|
14871
14902
|
throw error;
|
|
14872
14903
|
}
|
|
14873
14904
|
}
|
|
14905
|
+
async function prepareQuality(document, options) {
|
|
14906
|
+
const {
|
|
14907
|
+
modedRoot,
|
|
14908
|
+
modedTheme,
|
|
14909
|
+
themeName,
|
|
14910
|
+
modedDoc,
|
|
14911
|
+
sourceMap,
|
|
14912
|
+
blockPaths,
|
|
14913
|
+
pluginOutputs,
|
|
14914
|
+
warnings
|
|
14915
|
+
} = await expandDocument(document, options, true);
|
|
14916
|
+
const prepared = prepareDocxQualityDocument(
|
|
14917
|
+
document,
|
|
14918
|
+
{
|
|
14919
|
+
context: { document: modedRoot, theme: modedTheme, themeName },
|
|
14920
|
+
expanded: {
|
|
14921
|
+
document: modedDoc,
|
|
14922
|
+
sourceMap: sourceMap ?? {},
|
|
14923
|
+
blocks: blockPaths ?? [],
|
|
14924
|
+
...pluginOutputs && { pluginOutputs }
|
|
14925
|
+
},
|
|
14926
|
+
customThemes: state.customThemes,
|
|
14927
|
+
fonts: state.fonts,
|
|
14928
|
+
renderer: options?.renderer ?? state.renderer ?? modedRoot.renderer,
|
|
14929
|
+
warnings
|
|
14930
|
+
}
|
|
14931
|
+
);
|
|
14932
|
+
return { prepared, warnings: warnings.length > 0 ? warnings : null };
|
|
14933
|
+
}
|
|
14934
|
+
async function generateBufferFromPrepared(prepared, options) {
|
|
14935
|
+
const { context } = prepared.model;
|
|
14936
|
+
const warnings = [];
|
|
14937
|
+
const baseDir = options?.baseDir ?? state.baseDir;
|
|
14938
|
+
const deterministic = options?.deterministic ?? state.deterministic;
|
|
14939
|
+
const generatedAt = options?.generatedAt ?? state.generatedAt;
|
|
14940
|
+
const renderer = options?.renderer ?? state.renderer ?? prepared.renderer;
|
|
14941
|
+
const { buffer } = await generateBufferViaIr(context.document, {
|
|
14942
|
+
context,
|
|
14943
|
+
prepared,
|
|
14944
|
+
...state.services ? { services: state.services } : {},
|
|
14945
|
+
...state.fonts ? { fonts: state.fonts } : {},
|
|
14946
|
+
...baseDir !== void 0 ? { baseDir } : {},
|
|
14947
|
+
...deterministic !== void 0 ? { deterministic } : {},
|
|
14948
|
+
...generatedAt !== void 0 ? { generatedAt } : {},
|
|
14949
|
+
...renderer !== void 0 ? { renderer } : {},
|
|
14950
|
+
warnings
|
|
14951
|
+
});
|
|
14952
|
+
return {
|
|
14953
|
+
buffer,
|
|
14954
|
+
warnings: warnings.length > 0 ? warnings : null,
|
|
14955
|
+
standardDefinition: context.document,
|
|
14956
|
+
preservedDefinition: void 0
|
|
14957
|
+
};
|
|
14958
|
+
}
|
|
14874
14959
|
async function generateBuffer(document, options) {
|
|
14875
14960
|
try {
|
|
14961
|
+
const reused = options?.prepared && resolvePreserveSet(options) === void 0 ? options.prepared : void 0;
|
|
14962
|
+
if (reused) return await generateBufferFromPrepared(reused, options);
|
|
14876
14963
|
const {
|
|
14877
14964
|
modedRoot,
|
|
14878
14965
|
modedTheme,
|
|
@@ -15002,6 +15089,7 @@ function createBuilderImpl(state) {
|
|
|
15002
15089
|
generateBuffer,
|
|
15003
15090
|
generateFile,
|
|
15004
15091
|
expandStandardDefinition,
|
|
15092
|
+
prepareQuality,
|
|
15005
15093
|
getComponentNames,
|
|
15006
15094
|
validate,
|
|
15007
15095
|
generateSchema,
|