@drghaliasri/butex 8.1.3 → 8.2.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/document.mjs CHANGED
@@ -8932,6 +8932,11 @@ function remapSelectionAfterRangeMove(selection, direction) {
8932
8932
  function mathTex(token, equationSide, digitForm) {
8933
8933
  return mathTokenSourceForSide(token, equationSide, digitForm, true);
8934
8934
  }
8935
+ function projectedBookTarget(options, ownerId, kind) {
8936
+ if (options.mode !== "book-content") return void 0;
8937
+ const book = options.bookContext;
8938
+ return book?.targets?.find((target) => target.unitId === book.unitId && target.ownerId === ownerId && target.kind === kind);
8939
+ }
8935
8940
  function previewInlines(field, islands, output, equationSide, document2, previewOptions) {
8936
8941
  return field.tokens.map((token) => {
8937
8942
  if (token.kind === "text") {
@@ -8963,7 +8968,8 @@ function previewInlines(field, islands, output, equationSide, document2, preview
8963
8968
  })
8964
8969
  };
8965
8970
  }
8966
- const number = collectDocumentReferenceTargets(document2).find((target) => target.kind === "eq" && target.ownerId === token.id)?.number;
8971
+ const projected = projectedBookTarget(previewOptions, token.id, "eq");
8972
+ const number = projected ? void 0 : collectDocumentReferenceTargets(document2).find((target) => target.kind === "eq" && target.ownerId === token.id)?.number;
8967
8973
  const island = {
8968
8974
  id: token.id,
8969
8975
  tex: mathTex(token, equationSide, previewOptions.digitForm),
@@ -8971,7 +8977,7 @@ function previewInlines(field, islands, output, equationSide, document2, preview
8971
8977
  output,
8972
8978
  editable: token.editable
8973
8979
  };
8974
- const numberLabel = number == null ? void 0 : formatBibliographyNumber(number, {
8980
+ const numberLabel = projected ? projected.ordinal : number == null ? void 0 : formatBibliographyNumber(number, {
8975
8981
  documentDirection: previewOptions.documentDirection,
8976
8982
  digitForm: previewOptions.digitForm
8977
8983
  });
@@ -9000,6 +9006,8 @@ function textBlockPreview(block, islands, output, equationSide, document2, previ
9000
9006
  };
9001
9007
  }
9002
9008
  function floatNumberLabel(document2, ownerId, previewOptions) {
9009
+ const projected = projectedBookTarget(previewOptions, ownerId, "fig") ?? projectedBookTarget(previewOptions, ownerId, "tab");
9010
+ if (projected) return projected.displayLabel;
9003
9011
  const hit = collectDocumentReferenceTargets(document2).find((target) => target.ownerId === ownerId);
9004
9012
  if (!hit || hit.number === null || hit.kind !== "fig" && hit.kind !== "tab") {
9005
9013
  return void 0;