@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.
@@ -4589,6 +4589,11 @@ function mathTokenSourceForSide(token, side, digitForm, presentation = false) {
4589
4589
  function mathTex(token, equationSide, digitForm) {
4590
4590
  return mathTokenSourceForSide(token, equationSide, digitForm, true);
4591
4591
  }
4592
+ function projectedBookTarget(options, ownerId, kind) {
4593
+ if (options.mode !== "book-content") return void 0;
4594
+ const book = options.bookContext;
4595
+ return book?.targets?.find((target) => target.unitId === book.unitId && target.ownerId === ownerId && target.kind === kind);
4596
+ }
4592
4597
  function previewInlines(field, islands, output, equationSide, document2, previewOptions) {
4593
4598
  return field.tokens.map((token) => {
4594
4599
  if (token.kind === "text") {
@@ -4620,7 +4625,8 @@ function previewInlines(field, islands, output, equationSide, document2, preview
4620
4625
  })
4621
4626
  };
4622
4627
  }
4623
- const number = collectDocumentReferenceTargets(document2).find((target) => target.kind === "eq" && target.ownerId === token.id)?.number;
4628
+ const projected = projectedBookTarget(previewOptions, token.id, "eq");
4629
+ const number = projected ? void 0 : collectDocumentReferenceTargets(document2).find((target) => target.kind === "eq" && target.ownerId === token.id)?.number;
4624
4630
  const island = {
4625
4631
  id: token.id,
4626
4632
  tex: mathTex(token, equationSide, previewOptions.digitForm),
@@ -4628,7 +4634,7 @@ function previewInlines(field, islands, output, equationSide, document2, preview
4628
4634
  output,
4629
4635
  editable: token.editable
4630
4636
  };
4631
- const numberLabel = number == null ? void 0 : formatBibliographyNumber(number, {
4637
+ const numberLabel = projected ? projected.ordinal : number == null ? void 0 : formatBibliographyNumber(number, {
4632
4638
  documentDirection: previewOptions.documentDirection,
4633
4639
  digitForm: previewOptions.digitForm
4634
4640
  });
@@ -4657,6 +4663,8 @@ function textBlockPreview(block, islands, output, equationSide, document2, previ
4657
4663
  };
4658
4664
  }
4659
4665
  function floatNumberLabel(document2, ownerId, previewOptions) {
4666
+ const projected = projectedBookTarget(previewOptions, ownerId, "fig") ?? projectedBookTarget(previewOptions, ownerId, "tab");
4667
+ if (projected) return projected.displayLabel;
4660
4668
  const hit = collectDocumentReferenceTargets(document2).find((target) => target.ownerId === ownerId);
4661
4669
  if (!hit || hit.number === null || hit.kind !== "fig" && hit.kind !== "tab") {
4662
4670
  return void 0;
@@ -4973,91 +4981,6 @@ var DOCUMENT_WIDGET_CSS = `
4973
4981
  scrollbar-width: thin;
4974
4982
  }
4975
4983
 
4976
- .butex-document-widget__command-sheet-backdrop {
4977
- align-items: flex-end;
4978
- background: color-mix(in srgb, #000 35%, transparent);
4979
- display: flex;
4980
- inset: 0;
4981
- justify-content: center;
4982
- padding-bottom: var(--butex-safe-area-bottom);
4983
- padding-left: max(12px, var(--butex-safe-area-left));
4984
- padding-right: max(12px, var(--butex-safe-area-right));
4985
- padding-top: max(12px, var(--butex-safe-area-top));
4986
- position: fixed;
4987
- z-index: var(--butex-document-z-popover);
4988
- }
4989
-
4990
- .butex-document-widget__command-sheet {
4991
- background: var(--butex-document-panel);
4992
- border: 1px solid var(--butex-document-border);
4993
- border-radius: 16px 16px 0 0;
4994
- box-shadow: 0 -16px 40px color-mix(in srgb, #000 22%, transparent);
4995
- display: grid;
4996
- grid-template-rows: auto minmax(0, 1fr);
4997
- max-height: min(78vh, 720px);
4998
- max-height: min(720px, calc(100dvh - max(12px, var(--butex-safe-area-top)) - var(--butex-safe-area-bottom)));
4999
- max-width: 640px;
5000
- min-width: 0;
5001
- overflow: hidden;
5002
- width: 100%;
5003
- }
5004
-
5005
- .butex-document-widget__command-sheet-header {
5006
- align-items: center;
5007
- border-block-end: 1px solid var(--butex-document-border);
5008
- display: flex;
5009
- gap: 8px;
5010
- justify-content: space-between;
5011
- min-width: 0;
5012
- padding: 10px 12px;
5013
- }
5014
-
5015
- .butex-document-widget__command-sheet-body {
5016
- display: grid;
5017
- gap: 12px;
5018
- min-height: 0;
5019
- min-width: 0;
5020
- overflow-y: auto;
5021
- overscroll-behavior: contain;
5022
- padding: 12px;
5023
- }
5024
-
5025
- .butex-document-widget__command-group {
5026
- border: 1px solid var(--butex-document-border);
5027
- border-radius: 10px;
5028
- display: grid;
5029
- gap: 8px;
5030
- min-width: 0;
5031
- padding: 10px;
5032
- }
5033
-
5034
- .butex-document-widget__command-group h3 {
5035
- font-size: 0.88rem;
5036
- margin: 0;
5037
- }
5038
-
5039
- .butex-document-widget__command-grid {
5040
- display: grid;
5041
- gap: 6px;
5042
- grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
5043
- min-width: 0;
5044
- }
5045
-
5046
- .butex-document-widget__command-grid button {
5047
- min-height: 44px;
5048
- overflow-wrap: anywhere;
5049
- text-align: start;
5050
- }
5051
-
5052
- .butex-document-widget__command-grid--digits button {
5053
- text-align: center;
5054
- }
5055
-
5056
- .butex-document-widget__command-grid [aria-selected="true"] {
5057
- background: var(--butex-document-accent-bg);
5058
- border-color: var(--butex-document-accent);
5059
- }
5060
-
5061
4984
  .butex-document-widget__command-subtitle {
5062
4985
  color: var(--butex-document-muted);
5063
4986
  font-size: 0.82rem;
@@ -5948,15 +5871,6 @@ var DOCUMENT_WIDGET_CSS = `
5948
5871
  z-index: var(--butex-document-z-equation);
5949
5872
  }
5950
5873
 
5951
- .butex-document-widget__equation-modal[data-visible-viewport="true"] {
5952
- bottom: auto;
5953
- height: var(--butex-document-visible-viewport-height);
5954
- left: var(--butex-document-visible-viewport-left);
5955
- right: auto;
5956
- top: var(--butex-document-visible-viewport-top);
5957
- width: var(--butex-document-visible-viewport-width);
5958
- }
5959
-
5960
5874
  .butex-document-widget__equation-modal-backdrop {
5961
5875
  background: color-mix(in srgb, var(--butex-document-fg) 34%, transparent);
5962
5876
  border: 0;
@@ -6899,7 +6813,7 @@ var DOCUMENT_WIDGET_CSS = `
6899
6813
  width: 100%;
6900
6814
  }
6901
6815
 
6902
- .butex-document-widget__equation-modal[data-visible-viewport="true"] .butex-document-widget__equation-modal-panel {
6816
+ .butex-mobile-command-portal .butex-document-widget__equation-modal-panel {
6903
6817
  height: 100%;
6904
6818
  max-height: 100%;
6905
6819
  }
@@ -6937,21 +6851,6 @@ var DOCUMENT_WIDGET_CSS = `
6937
6851
  min-height: 44px;
6938
6852
  }
6939
6853
 
6940
- .butex-document-widget__command-sheet-backdrop {
6941
- padding-bottom: var(--butex-safe-area-bottom);
6942
- padding-left: var(--butex-safe-area-left);
6943
- padding-right: var(--butex-safe-area-right);
6944
- padding-top: max(8px, var(--butex-safe-area-top));
6945
- }
6946
-
6947
- .butex-document-widget__command-sheet {
6948
- border-block-end: 0;
6949
- border-radius: 16px 16px 0 0;
6950
- max-height: calc(100vh - 8px);
6951
- max-height: calc(100dvh - max(8px, var(--butex-safe-area-top)) - var(--butex-safe-area-bottom));
6952
- max-width: none;
6953
- }
6954
-
6955
6854
  .butex-document-widget__article-meta-date,
6956
6855
  .butex-document-widget__refs-grid {
6957
6856
  grid-template-columns: minmax(0, 1fr);
@@ -7035,6 +6934,11 @@ var DOCUMENT_WIDGET_CSS = `
7035
6934
  padding-top: max(8px, var(--butex-safe-area-top));
7036
6935
  }
7037
6936
 
6937
+ .butex-mobile-command-portal .butex-document-widget__equation-modal-panel {
6938
+ height: 100%;
6939
+ max-height: 100%;
6940
+ }
6941
+
7038
6942
  .butex-document-widget__cite-picker,
7039
6943
  .butex-document-widget__refs-panel {
7040
6944
  border-block-end: 0;