@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.
@@ -1038,7 +1038,7 @@ var init_vermilion_docx_theme = __esm({
1038
1038
  },
1039
1039
  actionTitle: {
1040
1040
  type: "display",
1041
- color: "primary"
1041
+ color: "accent"
1042
1042
  },
1043
1043
  keyTakeaways: {
1044
1044
  type: "label",
@@ -1067,7 +1067,7 @@ var init_vermilion_docx_theme = __esm({
1067
1067
  },
1068
1068
  cover: {
1069
1069
  type: "display",
1070
- color: "primary",
1070
+ color: "accent",
1071
1071
  rule: {
1072
1072
  weightPt: 4,
1073
1073
  color: "accent"
@@ -5433,12 +5433,15 @@ function applyThemeOverrides(theme, overrides) {
5433
5433
  init_defaults();
5434
5434
  import {
5435
5435
  designCanvas,
5436
+ resolveMotif,
5436
5437
  resolveTypeRoles,
5437
5438
  validateDesignColors
5438
5439
  } from "@json-to-office/shared";
5439
5440
  function resolveDocxDesignSystem(theme) {
5440
5441
  validateDesignColors(theme, getThemeColors(theme));
5441
- if (!theme.typography && !theme.spacing) return theme;
5442
+ const motif = resolveMotif(theme.motif);
5443
+ if (!theme.typography && !theme.spacing)
5444
+ return motif === theme.motif ? theme : withMotif(theme, motif);
5442
5445
  const canvas = designCanvas("docx", theme.page.size);
5443
5446
  const roles = resolveTypeRoles(theme, canvas, theme.fonts.body.size ?? 11);
5444
5447
  const styles = { ...theme.styles };
@@ -5478,7 +5481,7 @@ function resolveDocxDesignSystem(theme) {
5478
5481
  const space = theme.spacing?.canvas?.[canvas];
5479
5482
  const safe = space?.safeAreaIn;
5480
5483
  return {
5481
- ...theme,
5484
+ ...withMotif(theme, motif),
5482
5485
  styles,
5483
5486
  page: {
5484
5487
  ...theme.page,
@@ -5495,6 +5498,12 @@ function resolveDocxDesignSystem(theme) {
5495
5498
  }
5496
5499
  };
5497
5500
  }
5501
+ function withMotif(theme, motif) {
5502
+ if (motif !== void 0) return { ...theme, motif };
5503
+ const rest = { ...theme };
5504
+ delete rest.motif;
5505
+ return rest;
5506
+ }
5498
5507
 
5499
5508
  // src/core/generationContext.ts
5500
5509
  function defaultNamedThemeLookup(themeName, customThemes, warnings) {
@@ -9673,7 +9682,7 @@ function compileParagraph(component, scope) {
9673
9682
  MARKDOWN_LIST_LEVELS[markdown.type]
9674
9683
  );
9675
9684
  }
9676
- const styleId = paragraphStyleId(props.themeStyle);
9685
+ const styleId = definedParagraphStyleId(props.themeStyle, ctx.theme);
9677
9686
  if (styleId && !ctx.styleIds.has(styleId)) ctx.styleIds.add(styleId);
9678
9687
  const children = compileRuns(props, text, ctx, path3);
9679
9688
  const bookmarkName = typeof props.id === "string" ? props.id : void 0;
@@ -11018,6 +11027,22 @@ function paragraphStyleId(themeStyle) {
11018
11027
  if (heading) return `JTD_HeadingText${heading[1]}`;
11019
11028
  return themeStyle;
11020
11029
  }
11030
+ function definedParagraphStyleId(themeStyle, theme) {
11031
+ const id = paragraphStyleId(themeStyle);
11032
+ if (id === void 0) return void 0;
11033
+ if (ALWAYS_EMITTED_PARAGRAPH_STYLE_IDS.has(id)) return id;
11034
+ const styles = theme.styles;
11035
+ const name = themeStyle;
11036
+ return styles && (styles[name] ?? styles[name.toLowerCase()]) ? id : void 0;
11037
+ }
11038
+ var ALWAYS_EMITTED_PARAGRAPH_STYLE_IDS = /* @__PURE__ */ new Set([
11039
+ "Normal",
11040
+ "Title",
11041
+ "Subtitle",
11042
+ "Header",
11043
+ "Footer",
11044
+ ...Array.from({ length: 6 }, (_, i) => `JTD_HeadingText${i + 1}`)
11045
+ ]);
11021
11046
  function customOutlineLevel(themeStyle, theme) {
11022
11047
  if (typeof themeStyle !== "string" || !themeStyle) return void 0;
11023
11048
  if (/^heading[1-6]$/.test(themeStyle.toLowerCase())) return void 0;