@drghaliasri/butex 8.0.3 → 8.1.1

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.
@@ -162,12 +162,14 @@ type MathObject2Json = {
162
162
  source_owner?: 'imported-structured' | 'editor';
163
163
  label_enabled?: boolean;
164
164
  label?: string;
165
+ numbered?: boolean;
165
166
  };
166
167
  /** Positional metadata for a raw-only span that has no structured equation AST. */
167
168
  type RawMathObject2Json = {
168
169
  node_type: 'RawMathObject';
169
170
  label_enabled?: boolean;
170
171
  label?: string;
172
+ numbered?: boolean;
171
173
  };
172
174
  type DocumentMathObjectJson = MathObject2Json | RawMathObject2Json;
173
175
  type ReferenceFieldSeparator = ',' | '،';
@@ -299,6 +301,8 @@ type MathToken2 = {
299
301
  /** When true on display math, export as equation env with \\label. */
300
302
  labelEnabled?: boolean;
301
303
  label?: string;
304
+ /** Independent display-equation numbering override; absent means legacy semantics. */
305
+ numbered?: boolean;
302
306
  };
303
307
  type CiteToken2 = {
304
308
  id: string;
@@ -321,6 +325,8 @@ type TextBlock2 = {
321
325
  kind: 'textBlock';
322
326
  command: '\\section' | '\\subsection' | '\\subsubsection' | '\\paragraph';
323
327
  field: InlineField2;
328
+ /** Optional imported or authored label for a section heading. */
329
+ label?: string;
324
330
  metadata?: DocumentBlockMetadata;
325
331
  /** When true on \\paragraph, center in preview and LaTeX export. */
326
332
  centered?: boolean;
@@ -400,6 +406,7 @@ type PreviewInline2 = {
400
406
  display: boolean;
401
407
  output: DocumentMathOutput;
402
408
  editable: boolean;
409
+ numberLabel?: string;
403
410
  } | {
404
411
  kind: 'cite';
405
412
  id: string;
@@ -516,6 +523,23 @@ type DocumentMetaProp = Partial<Omit<DocumentMeta, 'date'>> & {
516
523
  date?: Partial<DocumentHijriDate>;
517
524
  };
518
525
 
526
+ /** Read-only, host-supplied projection. Never copy these catalogs into a unit DocumentJson. */
527
+ type DocumentBookTarget = {
528
+ unitId: string;
529
+ ownerId: string;
530
+ key: string;
531
+ kind: DocumentLabelKind | 'section' | 'subsection' | 'subsubsection' | 'chapter' | 'appendix';
532
+ caption?: string;
533
+ displayLabel?: string;
534
+ manualKey?: string;
535
+ };
536
+ type DocumentBookContext = {
537
+ unitId: string;
538
+ references?: Reference2Json[];
539
+ targets?: DocumentBookTarget[];
540
+ };
541
+ type DocumentEditorMode = 'article' | 'book-content';
542
+
519
543
  type ImageAssetRef = {
520
544
  assetId: string;
521
545
  value?: string;
@@ -537,6 +561,10 @@ type ImageBlockEditorRenderContext = {
537
561
  type ButexResponsiveMode = 'auto' | 'desktop' | 'compact';
538
562
 
539
563
  type ButexDocumentEditorProps$1 = {
564
+ /** Opt-in chapter body editing. Article remains the default. */
565
+ mode?: DocumentEditorMode;
566
+ /** Read-only externally supplied book references/targets. */
567
+ bookContext?: DocumentBookContext;
540
568
  initialDocument?: DocumentJson | DocumentNode;
541
569
  /** Seed article metadata when JSON/node omits fields (JSON wins when present). */
542
570
  documentMeta?: DocumentMetaProp;
@@ -584,6 +612,8 @@ type ButexDocumentEditorRef = {
584
612
  updateImageBlockAsset: (blockId: string, ref: ImageAssetRef) => void;
585
613
  /** Canonical JSON without host-side AST mutation. */
586
614
  getDocumentJson: () => DocumentJson;
615
+ /** Parent must consult before unmounting or switching to another unit. */
616
+ hasPendingChildTransaction: () => boolean;
587
617
  };
588
618
 
589
619
  declare function resolveInitialDocument(initialDocument: DocumentJson | DocumentNode | undefined, uiLocale?: ButexUiLocale, documentMeta?: DocumentMetaProp): DocumentInitialState;
@@ -611,6 +641,8 @@ declare function DocumentPreview({ blocks, output, documentDirection, uiLocale,
611
641
  }): react_jsx_runtime.JSX.Element;
612
642
 
613
643
  type ButexDocumentPreviewProps = {
644
+ mode?: DocumentEditorMode;
645
+ bookContext?: DocumentBookContext;
614
646
  /** Persisted wire JSON or an already-imported live Document node. */
615
647
  document: DocumentJson | DocumentNode;
616
648
  className?: string;
@@ -631,9 +663,10 @@ declare function resolvePreviewDocument(input: DocumentJson | DocumentNode, uiLo
631
663
  * Dedicated read-only Document renderer. This intentionally bypasses the full
632
664
  * editor component and derives only the runtime document plus preview model.
633
665
  */
634
- declare function ButexDocumentPreview({ document, className, documentDirection, uiLocale, digitForm, equationSide, mathOutput, resolveImageUrl, }: ButexDocumentPreviewProps): react_jsx_runtime.JSX.Element;
666
+ declare function ButexDocumentPreview({ mode, bookContext, document, className, documentDirection, uiLocale, digitForm, equationSide, mathOutput, resolveImageUrl, }: ButexDocumentPreviewProps): react_jsx_runtime.JSX.Element;
635
667
 
636
668
  type DocumentInsertToolbarProps = {
669
+ mode?: 'article' | 'book-content';
637
670
  canUndo: boolean;
638
671
  canRedo: boolean;
639
672
  editableEquations?: boolean;
@@ -668,7 +701,7 @@ type DocumentInsertToolbarProps = {
668
701
  onOpenArticleMeta?: () => void;
669
702
  onDigitFormChange: (digitForm: DigitFormId) => void;
670
703
  };
671
- declare function DocumentInsertToolbar({ canUndo, canRedo, editableEquations, uiLocale, digitForm, selectionCount, canMoveSelectionUp, canMoveSelectionDown, canFormatText, activeTextStyles, onUndo, onRedo, onToggleTextStyle, onMoveSelectionUp, onMoveSelectionDown, onDeleteSelection, onAddSection, onAddSubsection, onAddSubsubsection, onAddParagraph, onAddInlineEquation, onAddDisplayEquation, onAddTable, onAddList, onAddEnumerate, onAddFigure, onInsertCitation, onInsertInternalRef, onInsertBibliography, onManageReferences, onManageLabels, onOpenArticleMeta, onDigitFormChange, }: DocumentInsertToolbarProps): react_jsx_runtime.JSX.Element;
704
+ declare function DocumentInsertToolbar({ mode, canUndo, canRedo, editableEquations, uiLocale, digitForm, selectionCount, canMoveSelectionUp, canMoveSelectionDown, canFormatText, activeTextStyles, onUndo, onRedo, onToggleTextStyle, onMoveSelectionUp, onMoveSelectionDown, onDeleteSelection, onAddSection, onAddSubsection, onAddSubsubsection, onAddParagraph, onAddInlineEquation, onAddDisplayEquation, onAddTable, onAddList, onAddEnumerate, onAddFigure, onInsertCitation, onInsertInternalRef, onInsertBibliography, onManageReferences, onManageLabels, onOpenArticleMeta, onDigitFormChange, }: DocumentInsertToolbarProps): react_jsx_runtime.JSX.Element;
672
705
 
673
706
  type EquationMathMode = 'inline' | 'display';
674
707
  type EquationDrawerProps = {
@@ -682,6 +715,8 @@ type EquationDrawerProps = {
682
715
  responsiveMode?: ButexResponsiveMode;
683
716
  labelEnabled?: boolean;
684
717
  label?: string;
718
+ numbered?: boolean;
719
+ onNumberedChange?: (numbered: boolean) => void;
685
720
  labels?: DocumentLabelEntry[];
686
721
  references?: Reference2[];
687
722
  ownerId?: string;
@@ -692,13 +727,14 @@ type EquationDrawerProps = {
692
727
  onSave: (session: EditorSession) => void;
693
728
  onDelete?: () => void;
694
729
  };
695
- declare function EquationDrawer({ debug, session, reason, mathMode, canDelete, equationSide, uiLocale, responsiveMode, labelEnabled, label, labels, references, ownerId, onLabelEnabledChange, onLabelChange, onMathModeChange, onClose, onSave, onDelete, }: EquationDrawerProps): react_jsx_runtime.JSX.Element;
730
+ declare function EquationDrawer({ debug, session, reason, mathMode, canDelete, equationSide, uiLocale, responsiveMode, labelEnabled, label, numbered, onNumberedChange, labels, references, ownerId, onLabelEnabledChange, onLabelChange, onMathModeChange, onClose, onSave, onDelete, }: EquationDrawerProps): react_jsx_runtime.JSX.Element;
696
731
 
697
732
  type InlineFieldProps = {
698
733
  field: InlineField2;
699
734
  blockId?: string;
700
735
  references?: Reference2[];
701
736
  documentNode?: DocumentNode;
737
+ bookContext?: DocumentBookContext;
702
738
  documentDirection?: 'rtl' | 'ltr';
703
739
  digitForm?: DigitFormId;
704
740
  mathOutput?: DocumentMathOutput;
@@ -719,7 +755,7 @@ type InlineFieldProps = {
719
755
  onRefFocus?: (blockId: string, fieldId: string, tokenId: string) => void;
720
756
  onFieldBlur?: () => void;
721
757
  };
722
- declare function InlineField({ field, blockId, references, documentNode, documentDirection, digitForm, mathOutput, equationSide, editableEquations, editableCitations, uiLocale, onTextChange, onOpenMath, onDeleteMath, onOpenCite, onDeleteCite, onOpenRef, onDeleteRef, onFieldFocus, onMathFocus, onCiteFocus, onRefFocus, onFieldBlur, }: InlineFieldProps): react_jsx_runtime.JSX.Element;
758
+ declare function InlineField({ field, blockId, references, documentNode, bookContext, documentDirection, digitForm, mathOutput, equationSide, editableEquations, editableCitations, uiLocale, onTextChange, onOpenMath, onDeleteMath, onOpenCite, onDeleteCite, onOpenRef, onDeleteRef, onFieldFocus, onMathFocus, onCiteFocus, onRefFocus, onFieldBlur, }: InlineFieldProps): react_jsx_runtime.JSX.Element;
723
759
 
724
760
  type MathChipProps = {
725
761
  token: MathToken2;
@@ -162,12 +162,14 @@ type MathObject2Json = {
162
162
  source_owner?: 'imported-structured' | 'editor';
163
163
  label_enabled?: boolean;
164
164
  label?: string;
165
+ numbered?: boolean;
165
166
  };
166
167
  /** Positional metadata for a raw-only span that has no structured equation AST. */
167
168
  type RawMathObject2Json = {
168
169
  node_type: 'RawMathObject';
169
170
  label_enabled?: boolean;
170
171
  label?: string;
172
+ numbered?: boolean;
171
173
  };
172
174
  type DocumentMathObjectJson = MathObject2Json | RawMathObject2Json;
173
175
  type ReferenceFieldSeparator = ',' | '،';
@@ -299,6 +301,8 @@ type MathToken2 = {
299
301
  /** When true on display math, export as equation env with \\label. */
300
302
  labelEnabled?: boolean;
301
303
  label?: string;
304
+ /** Independent display-equation numbering override; absent means legacy semantics. */
305
+ numbered?: boolean;
302
306
  };
303
307
  type CiteToken2 = {
304
308
  id: string;
@@ -321,6 +325,8 @@ type TextBlock2 = {
321
325
  kind: 'textBlock';
322
326
  command: '\\section' | '\\subsection' | '\\subsubsection' | '\\paragraph';
323
327
  field: InlineField2;
328
+ /** Optional imported or authored label for a section heading. */
329
+ label?: string;
324
330
  metadata?: DocumentBlockMetadata;
325
331
  /** When true on \\paragraph, center in preview and LaTeX export. */
326
332
  centered?: boolean;
@@ -400,6 +406,7 @@ type PreviewInline2 = {
400
406
  display: boolean;
401
407
  output: DocumentMathOutput;
402
408
  editable: boolean;
409
+ numberLabel?: string;
403
410
  } | {
404
411
  kind: 'cite';
405
412
  id: string;
@@ -516,6 +523,23 @@ type DocumentMetaProp = Partial<Omit<DocumentMeta, 'date'>> & {
516
523
  date?: Partial<DocumentHijriDate>;
517
524
  };
518
525
 
526
+ /** Read-only, host-supplied projection. Never copy these catalogs into a unit DocumentJson. */
527
+ type DocumentBookTarget = {
528
+ unitId: string;
529
+ ownerId: string;
530
+ key: string;
531
+ kind: DocumentLabelKind | 'section' | 'subsection' | 'subsubsection' | 'chapter' | 'appendix';
532
+ caption?: string;
533
+ displayLabel?: string;
534
+ manualKey?: string;
535
+ };
536
+ type DocumentBookContext = {
537
+ unitId: string;
538
+ references?: Reference2Json[];
539
+ targets?: DocumentBookTarget[];
540
+ };
541
+ type DocumentEditorMode = 'article' | 'book-content';
542
+
519
543
  type ImageAssetRef = {
520
544
  assetId: string;
521
545
  value?: string;
@@ -537,6 +561,10 @@ type ImageBlockEditorRenderContext = {
537
561
  type ButexResponsiveMode = 'auto' | 'desktop' | 'compact';
538
562
 
539
563
  type ButexDocumentEditorProps$1 = {
564
+ /** Opt-in chapter body editing. Article remains the default. */
565
+ mode?: DocumentEditorMode;
566
+ /** Read-only externally supplied book references/targets. */
567
+ bookContext?: DocumentBookContext;
540
568
  initialDocument?: DocumentJson | DocumentNode;
541
569
  /** Seed article metadata when JSON/node omits fields (JSON wins when present). */
542
570
  documentMeta?: DocumentMetaProp;
@@ -584,6 +612,8 @@ type ButexDocumentEditorRef = {
584
612
  updateImageBlockAsset: (blockId: string, ref: ImageAssetRef) => void;
585
613
  /** Canonical JSON without host-side AST mutation. */
586
614
  getDocumentJson: () => DocumentJson;
615
+ /** Parent must consult before unmounting or switching to another unit. */
616
+ hasPendingChildTransaction: () => boolean;
587
617
  };
588
618
 
589
619
  declare function resolveInitialDocument(initialDocument: DocumentJson | DocumentNode | undefined, uiLocale?: ButexUiLocale, documentMeta?: DocumentMetaProp): DocumentInitialState;
@@ -611,6 +641,8 @@ declare function DocumentPreview({ blocks, output, documentDirection, uiLocale,
611
641
  }): react_jsx_runtime.JSX.Element;
612
642
 
613
643
  type ButexDocumentPreviewProps = {
644
+ mode?: DocumentEditorMode;
645
+ bookContext?: DocumentBookContext;
614
646
  /** Persisted wire JSON or an already-imported live Document node. */
615
647
  document: DocumentJson | DocumentNode;
616
648
  className?: string;
@@ -631,9 +663,10 @@ declare function resolvePreviewDocument(input: DocumentJson | DocumentNode, uiLo
631
663
  * Dedicated read-only Document renderer. This intentionally bypasses the full
632
664
  * editor component and derives only the runtime document plus preview model.
633
665
  */
634
- declare function ButexDocumentPreview({ document, className, documentDirection, uiLocale, digitForm, equationSide, mathOutput, resolveImageUrl, }: ButexDocumentPreviewProps): react_jsx_runtime.JSX.Element;
666
+ declare function ButexDocumentPreview({ mode, bookContext, document, className, documentDirection, uiLocale, digitForm, equationSide, mathOutput, resolveImageUrl, }: ButexDocumentPreviewProps): react_jsx_runtime.JSX.Element;
635
667
 
636
668
  type DocumentInsertToolbarProps = {
669
+ mode?: 'article' | 'book-content';
637
670
  canUndo: boolean;
638
671
  canRedo: boolean;
639
672
  editableEquations?: boolean;
@@ -668,7 +701,7 @@ type DocumentInsertToolbarProps = {
668
701
  onOpenArticleMeta?: () => void;
669
702
  onDigitFormChange: (digitForm: DigitFormId) => void;
670
703
  };
671
- declare function DocumentInsertToolbar({ canUndo, canRedo, editableEquations, uiLocale, digitForm, selectionCount, canMoveSelectionUp, canMoveSelectionDown, canFormatText, activeTextStyles, onUndo, onRedo, onToggleTextStyle, onMoveSelectionUp, onMoveSelectionDown, onDeleteSelection, onAddSection, onAddSubsection, onAddSubsubsection, onAddParagraph, onAddInlineEquation, onAddDisplayEquation, onAddTable, onAddList, onAddEnumerate, onAddFigure, onInsertCitation, onInsertInternalRef, onInsertBibliography, onManageReferences, onManageLabels, onOpenArticleMeta, onDigitFormChange, }: DocumentInsertToolbarProps): react_jsx_runtime.JSX.Element;
704
+ declare function DocumentInsertToolbar({ mode, canUndo, canRedo, editableEquations, uiLocale, digitForm, selectionCount, canMoveSelectionUp, canMoveSelectionDown, canFormatText, activeTextStyles, onUndo, onRedo, onToggleTextStyle, onMoveSelectionUp, onMoveSelectionDown, onDeleteSelection, onAddSection, onAddSubsection, onAddSubsubsection, onAddParagraph, onAddInlineEquation, onAddDisplayEquation, onAddTable, onAddList, onAddEnumerate, onAddFigure, onInsertCitation, onInsertInternalRef, onInsertBibliography, onManageReferences, onManageLabels, onOpenArticleMeta, onDigitFormChange, }: DocumentInsertToolbarProps): react_jsx_runtime.JSX.Element;
672
705
 
673
706
  type EquationMathMode = 'inline' | 'display';
674
707
  type EquationDrawerProps = {
@@ -682,6 +715,8 @@ type EquationDrawerProps = {
682
715
  responsiveMode?: ButexResponsiveMode;
683
716
  labelEnabled?: boolean;
684
717
  label?: string;
718
+ numbered?: boolean;
719
+ onNumberedChange?: (numbered: boolean) => void;
685
720
  labels?: DocumentLabelEntry[];
686
721
  references?: Reference2[];
687
722
  ownerId?: string;
@@ -692,13 +727,14 @@ type EquationDrawerProps = {
692
727
  onSave: (session: EditorSession) => void;
693
728
  onDelete?: () => void;
694
729
  };
695
- declare function EquationDrawer({ debug, session, reason, mathMode, canDelete, equationSide, uiLocale, responsiveMode, labelEnabled, label, labels, references, ownerId, onLabelEnabledChange, onLabelChange, onMathModeChange, onClose, onSave, onDelete, }: EquationDrawerProps): react_jsx_runtime.JSX.Element;
730
+ declare function EquationDrawer({ debug, session, reason, mathMode, canDelete, equationSide, uiLocale, responsiveMode, labelEnabled, label, numbered, onNumberedChange, labels, references, ownerId, onLabelEnabledChange, onLabelChange, onMathModeChange, onClose, onSave, onDelete, }: EquationDrawerProps): react_jsx_runtime.JSX.Element;
696
731
 
697
732
  type InlineFieldProps = {
698
733
  field: InlineField2;
699
734
  blockId?: string;
700
735
  references?: Reference2[];
701
736
  documentNode?: DocumentNode;
737
+ bookContext?: DocumentBookContext;
702
738
  documentDirection?: 'rtl' | 'ltr';
703
739
  digitForm?: DigitFormId;
704
740
  mathOutput?: DocumentMathOutput;
@@ -719,7 +755,7 @@ type InlineFieldProps = {
719
755
  onRefFocus?: (blockId: string, fieldId: string, tokenId: string) => void;
720
756
  onFieldBlur?: () => void;
721
757
  };
722
- declare function InlineField({ field, blockId, references, documentNode, documentDirection, digitForm, mathOutput, equationSide, editableEquations, editableCitations, uiLocale, onTextChange, onOpenMath, onDeleteMath, onOpenCite, onDeleteCite, onOpenRef, onDeleteRef, onFieldFocus, onMathFocus, onCiteFocus, onRefFocus, onFieldBlur, }: InlineFieldProps): react_jsx_runtime.JSX.Element;
758
+ declare function InlineField({ field, blockId, references, documentNode, bookContext, documentDirection, digitForm, mathOutput, equationSide, editableEquations, editableCitations, uiLocale, onTextChange, onOpenMath, onDeleteMath, onOpenCite, onDeleteCite, onOpenRef, onDeleteRef, onFieldFocus, onMathFocus, onCiteFocus, onRefFocus, onFieldBlur, }: InlineFieldProps): react_jsx_runtime.JSX.Element;
723
759
 
724
760
  type MathChipProps = {
725
761
  token: MathToken2;