@json-to-office/core-docx 5.4.0 → 6.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/index.js +30 -5
- package/dist/index.js.map +1 -1
- package/dist/plugin/example/index.js +30 -5
- package/dist/plugin/example/index.js.map +1 -1
- package/dist/templates/themes/vermilion.docx.theme.json +2 -2
- package/dist/themes/design-system.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1091,7 +1091,7 @@ var init_vermilion_docx_theme = __esm({
|
|
|
1091
1091
|
},
|
|
1092
1092
|
actionTitle: {
|
|
1093
1093
|
type: "display",
|
|
1094
|
-
color: "
|
|
1094
|
+
color: "accent"
|
|
1095
1095
|
},
|
|
1096
1096
|
keyTakeaways: {
|
|
1097
1097
|
type: "label",
|
|
@@ -1120,7 +1120,7 @@ var init_vermilion_docx_theme = __esm({
|
|
|
1120
1120
|
},
|
|
1121
1121
|
cover: {
|
|
1122
1122
|
type: "display",
|
|
1123
|
-
color: "
|
|
1123
|
+
color: "accent",
|
|
1124
1124
|
rule: {
|
|
1125
1125
|
weightPt: 4,
|
|
1126
1126
|
color: "accent"
|
|
@@ -9425,7 +9425,7 @@ function compileParagraph(component, scope) {
|
|
|
9425
9425
|
MARKDOWN_LIST_LEVELS[markdown.type]
|
|
9426
9426
|
);
|
|
9427
9427
|
}
|
|
9428
|
-
const styleId =
|
|
9428
|
+
const styleId = definedParagraphStyleId(props.themeStyle, ctx.theme);
|
|
9429
9429
|
if (styleId && !ctx.styleIds.has(styleId)) ctx.styleIds.add(styleId);
|
|
9430
9430
|
const children = compileRuns(props, text, ctx, path4);
|
|
9431
9431
|
const bookmarkName = typeof props.id === "string" ? props.id : void 0;
|
|
@@ -10770,6 +10770,22 @@ function paragraphStyleId(themeStyle) {
|
|
|
10770
10770
|
if (heading) return `JTD_HeadingText${heading[1]}`;
|
|
10771
10771
|
return themeStyle;
|
|
10772
10772
|
}
|
|
10773
|
+
function definedParagraphStyleId(themeStyle, theme) {
|
|
10774
|
+
const id = paragraphStyleId(themeStyle);
|
|
10775
|
+
if (id === void 0) return void 0;
|
|
10776
|
+
if (ALWAYS_EMITTED_PARAGRAPH_STYLE_IDS.has(id)) return id;
|
|
10777
|
+
const styles = theme.styles;
|
|
10778
|
+
const name = themeStyle;
|
|
10779
|
+
return styles && (styles[name] ?? styles[name.toLowerCase()]) ? id : void 0;
|
|
10780
|
+
}
|
|
10781
|
+
var ALWAYS_EMITTED_PARAGRAPH_STYLE_IDS = /* @__PURE__ */ new Set([
|
|
10782
|
+
"Normal",
|
|
10783
|
+
"Title",
|
|
10784
|
+
"Subtitle",
|
|
10785
|
+
"Header",
|
|
10786
|
+
"Footer",
|
|
10787
|
+
...Array.from({ length: 6 }, (_, i) => `JTD_HeadingText${i + 1}`)
|
|
10788
|
+
]);
|
|
10773
10789
|
function customOutlineLevel(themeStyle, theme) {
|
|
10774
10790
|
if (typeof themeStyle !== "string" || !themeStyle) return void 0;
|
|
10775
10791
|
if (/^heading[1-6]$/.test(themeStyle.toLowerCase())) return void 0;
|
|
@@ -12401,12 +12417,15 @@ function applyThemeOverrides(theme, overrides) {
|
|
|
12401
12417
|
init_defaults();
|
|
12402
12418
|
import {
|
|
12403
12419
|
designCanvas,
|
|
12420
|
+
resolveMotif,
|
|
12404
12421
|
resolveTypeRoles,
|
|
12405
12422
|
validateDesignColors
|
|
12406
12423
|
} from "@json-to-office/shared";
|
|
12407
12424
|
function resolveDocxDesignSystem(theme) {
|
|
12408
12425
|
validateDesignColors(theme, getThemeColors(theme));
|
|
12409
|
-
|
|
12426
|
+
const motif = resolveMotif(theme.motif);
|
|
12427
|
+
if (!theme.typography && !theme.spacing)
|
|
12428
|
+
return motif === theme.motif ? theme : withMotif(theme, motif);
|
|
12410
12429
|
const canvas = designCanvas("docx", theme.page.size);
|
|
12411
12430
|
const roles = resolveTypeRoles(theme, canvas, theme.fonts.body.size ?? 11);
|
|
12412
12431
|
const styles = { ...theme.styles };
|
|
@@ -12446,7 +12465,7 @@ function resolveDocxDesignSystem(theme) {
|
|
|
12446
12465
|
const space = theme.spacing?.canvas?.[canvas];
|
|
12447
12466
|
const safe = space?.safeAreaIn;
|
|
12448
12467
|
return {
|
|
12449
|
-
...theme,
|
|
12468
|
+
...withMotif(theme, motif),
|
|
12450
12469
|
styles,
|
|
12451
12470
|
page: {
|
|
12452
12471
|
...theme.page,
|
|
@@ -12463,6 +12482,12 @@ function resolveDocxDesignSystem(theme) {
|
|
|
12463
12482
|
}
|
|
12464
12483
|
};
|
|
12465
12484
|
}
|
|
12485
|
+
function withMotif(theme, motif) {
|
|
12486
|
+
if (motif !== void 0) return { ...theme, motif };
|
|
12487
|
+
const rest = { ...theme };
|
|
12488
|
+
delete rest.motif;
|
|
12489
|
+
return rest;
|
|
12490
|
+
}
|
|
12466
12491
|
|
|
12467
12492
|
// src/core/generationContext.ts
|
|
12468
12493
|
function defaultNamedThemeLookup(themeName, customThemes, warnings) {
|