@json-to-office/core-docx 1.9.0 → 1.10.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 CHANGED
@@ -8478,8 +8478,8 @@ function compileComponent(component, scope) {
8478
8478
  return compileStatistic(component, scope);
8479
8479
  case "toc":
8480
8480
  return compileToc(component, scope);
8481
- case "rule":
8482
- return compileRule(component, scope);
8481
+ case "divider":
8482
+ return compileDivider(component, scope);
8483
8483
  case "text-box":
8484
8484
  return compileTextBox(component, scope);
8485
8485
  case "columns":
@@ -9056,16 +9056,16 @@ function compileToc(component, scope) {
9056
9056
  });
9057
9057
  return blocks;
9058
9058
  }
9059
- var DEFAULT_RULE_SPACING_PT = 6;
9060
- var DEFAULT_RULE_THICKNESS_PT = 1;
9061
- var RULE_LINE_TWIPS = 20;
9062
- var RULE_BORDER_STYLE = {
9059
+ var DEFAULT_DIVIDER_SPACING_PT = 6;
9060
+ var DEFAULT_DIVIDER_THICKNESS_PT = 1;
9061
+ var DIVIDER_LINE_TWIPS = 20;
9062
+ var DIVIDER_BORDER_STYLE = {
9063
9063
  solid: "single",
9064
9064
  dashed: "dashed",
9065
9065
  dotted: "dotted",
9066
9066
  double: "double"
9067
9067
  };
9068
- function compileRule(component, scope) {
9068
+ function compileDivider(component, scope) {
9069
9069
  const { ctx, path: path4 } = scope;
9070
9070
  const props = component.props ?? {};
9071
9071
  ctx.features.require("borders", path4);
@@ -9073,12 +9073,12 @@ function compileRule(component, scope) {
9073
9073
  12,
9074
9074
  Math.max(
9075
9075
  0.25,
9076
- typeof props.thickness === "number" && Number.isFinite(props.thickness) ? props.thickness : DEFAULT_RULE_THICKNESS_PT
9076
+ typeof props.thickness === "number" && Number.isFinite(props.thickness) ? props.thickness : DEFAULT_DIVIDER_THICKNESS_PT
9077
9077
  )
9078
9078
  );
9079
9079
  const spacing = props.spacing ?? {};
9080
- const beforePt = typeof spacing.before === "number" && Number.isFinite(spacing.before) ? spacing.before : DEFAULT_RULE_SPACING_PT;
9081
- const afterPt = typeof spacing.after === "number" && Number.isFinite(spacing.after) ? spacing.after : DEFAULT_RULE_SPACING_PT;
9080
+ const beforePt = typeof spacing.before === "number" && Number.isFinite(spacing.before) ? spacing.before : DEFAULT_DIVIDER_SPACING_PT;
9081
+ const afterPt = typeof spacing.after === "number" && Number.isFinite(spacing.after) ? spacing.after : DEFAULT_DIVIDER_SPACING_PT;
9082
9082
  return [
9083
9083
  {
9084
9084
  kind: "paragraph",
@@ -9090,13 +9090,13 @@ function compileRule(component, scope) {
9090
9090
  spacing: {
9091
9091
  beforeTwips: pointsToTwips2(beforePt),
9092
9092
  afterTwips: pointsToTwips2(afterPt),
9093
- lineTwips: RULE_LINE_TWIPS,
9093
+ lineTwips: DIVIDER_LINE_TWIPS,
9094
9094
  lineRule: "exact"
9095
9095
  },
9096
- ...ruleIndent(props, ctx, path4),
9096
+ ...dividerIndent(props, ctx, path4),
9097
9097
  borders: {
9098
9098
  bottom: {
9099
- style: RULE_BORDER_STYLE[String(props.style)] ?? "single",
9099
+ style: DIVIDER_BORDER_STYLE[String(props.style)] ?? "single",
9100
9100
  sizeEighthPoints: pointsToEighthPoints(thicknessPt),
9101
9101
  color: irColor(
9102
9102
  resolveColor(String(props.color ?? "border"), ctx.theme)
@@ -9110,7 +9110,7 @@ function compileRule(component, scope) {
9110
9110
  }
9111
9111
  ];
9112
9112
  }
9113
- function ruleIndent(props, ctx, path4) {
9113
+ function dividerIndent(props, ctx, path4) {
9114
9114
  const width = props.width;
9115
9115
  if (width === void 0) return {};
9116
9116
  const page = getPageSetup(ctx.theme);
@@ -9133,8 +9133,8 @@ function ruleIndent(props, ctx, path4) {
9133
9133
  if (remainder < 0) {
9134
9134
  warnOnce(
9135
9135
  ctx,
9136
- "rule",
9137
- `Rule width ${JSON.stringify(width)} at ${path4} is wider than the ${Math.round(measureTwips / 20)}pt text measure; it runs the full measure instead.`
9136
+ "divider",
9137
+ `Divider width ${JSON.stringify(width)} at ${path4} is wider than the ${Math.round(measureTwips / 20)}pt text measure; it runs the full measure instead.`
9138
9138
  );
9139
9139
  }
9140
9140
  return {};
@@ -12734,9 +12734,9 @@ var docxLineBoxRule = {
12734
12734
  message: `An exact ${tenths(fact.lineBoxPt)}pt line box holds ${tenths(fact.fontSizePt)}pt text${inherited} \u2014 shorter than the capitals it contains, so the lines overlap or lose their tops.`,
12735
12735
  path: fact.path,
12736
12736
  // The second sentence is the exit from the incentive that
12737
- // produced this geometry: the reported route to a 3pt rule was a
12737
+ // produced this geometry: the reported route to a 3pt line was a
12738
12738
  // collapsed line box on 8pt type, because nothing else drew one.
12739
- suggestion: `Set the box to at least ${repairPt}pt \u2014 as tall as the type it holds \u2014 or use "atLeast" so the line grows to fit the text. To draw a line rather than set leading, use the "rule" component.${fact.patchable ? "" : " This box is not stated on the component: it arrives through `componentDefaults` and has to be repaired there."}`,
12739
+ suggestion: `Set the box to at least ${repairPt}pt \u2014 as tall as the type it holds \u2014 or use "atLeast" so the line grows to fit the text. To draw a line rather than set leading, use the "divider" component.${fact.patchable ? "" : " This box is not stated on the component: it arrives through `componentDefaults` and has to be repaired there."}`,
12740
12740
  context: {
12741
12741
  lineBoxPt: tenths(fact.lineBoxPt),
12742
12742
  fontSizePt: tenths(fact.fontSizePt),