@drghaliasri/butex 8.1.0 → 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.
- package/dist/document-cli.js +125 -32
- package/dist/document-cli.js.map +1 -1
- package/dist/document.d.mts +47 -4
- package/dist/document.d.ts +47 -4
- package/dist/document.js +204 -36
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +198 -36
- package/dist/document.mjs.map +1 -1
- package/dist/react-document-preview.d.mts +28 -5
- package/dist/react-document-preview.d.ts +28 -5
- package/dist/react-document-preview.js +55 -10
- package/dist/react-document-preview.js.map +1 -1
- package/dist/react-document-preview.mjs +55 -10
- package/dist/react-document-preview.mjs.map +1 -1
- package/dist/react-document.d.mts +32 -3
- package/dist/react-document.d.ts +32 -3
- package/dist/react-document.js +282 -83
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +282 -83
- package/dist/react-document.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -325,6 +325,8 @@ type TextBlock2 = {
|
|
|
325
325
|
kind: 'textBlock';
|
|
326
326
|
command: '\\section' | '\\subsection' | '\\subsubsection' | '\\paragraph';
|
|
327
327
|
field: InlineField2;
|
|
328
|
+
/** Optional imported or authored label for a section heading. */
|
|
329
|
+
label?: string;
|
|
328
330
|
metadata?: DocumentBlockMetadata;
|
|
329
331
|
/** When true on \\paragraph, center in preview and LaTeX export. */
|
|
330
332
|
centered?: boolean;
|
|
@@ -521,6 +523,23 @@ type DocumentMetaProp = Partial<Omit<DocumentMeta, 'date'>> & {
|
|
|
521
523
|
date?: Partial<DocumentHijriDate>;
|
|
522
524
|
};
|
|
523
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
|
+
|
|
524
543
|
type ImageAssetRef = {
|
|
525
544
|
assetId: string;
|
|
526
545
|
value?: string;
|
|
@@ -542,6 +561,10 @@ type ImageBlockEditorRenderContext = {
|
|
|
542
561
|
type ButexResponsiveMode = 'auto' | 'desktop' | 'compact';
|
|
543
562
|
|
|
544
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;
|
|
545
568
|
initialDocument?: DocumentJson | DocumentNode;
|
|
546
569
|
/** Seed article metadata when JSON/node omits fields (JSON wins when present). */
|
|
547
570
|
documentMeta?: DocumentMetaProp;
|
|
@@ -589,6 +612,8 @@ type ButexDocumentEditorRef = {
|
|
|
589
612
|
updateImageBlockAsset: (blockId: string, ref: ImageAssetRef) => void;
|
|
590
613
|
/** Canonical JSON without host-side AST mutation. */
|
|
591
614
|
getDocumentJson: () => DocumentJson;
|
|
615
|
+
/** Parent must consult before unmounting or switching to another unit. */
|
|
616
|
+
hasPendingChildTransaction: () => boolean;
|
|
592
617
|
};
|
|
593
618
|
|
|
594
619
|
declare function resolveInitialDocument(initialDocument: DocumentJson | DocumentNode | undefined, uiLocale?: ButexUiLocale, documentMeta?: DocumentMetaProp): DocumentInitialState;
|
|
@@ -616,6 +641,8 @@ declare function DocumentPreview({ blocks, output, documentDirection, uiLocale,
|
|
|
616
641
|
}): react_jsx_runtime.JSX.Element;
|
|
617
642
|
|
|
618
643
|
type ButexDocumentPreviewProps = {
|
|
644
|
+
mode?: DocumentEditorMode;
|
|
645
|
+
bookContext?: DocumentBookContext;
|
|
619
646
|
/** Persisted wire JSON or an already-imported live Document node. */
|
|
620
647
|
document: DocumentJson | DocumentNode;
|
|
621
648
|
className?: string;
|
|
@@ -636,9 +663,10 @@ declare function resolvePreviewDocument(input: DocumentJson | DocumentNode, uiLo
|
|
|
636
663
|
* Dedicated read-only Document renderer. This intentionally bypasses the full
|
|
637
664
|
* editor component and derives only the runtime document plus preview model.
|
|
638
665
|
*/
|
|
639
|
-
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;
|
|
640
667
|
|
|
641
668
|
type DocumentInsertToolbarProps = {
|
|
669
|
+
mode?: 'article' | 'book-content';
|
|
642
670
|
canUndo: boolean;
|
|
643
671
|
canRedo: boolean;
|
|
644
672
|
editableEquations?: boolean;
|
|
@@ -673,7 +701,7 @@ type DocumentInsertToolbarProps = {
|
|
|
673
701
|
onOpenArticleMeta?: () => void;
|
|
674
702
|
onDigitFormChange: (digitForm: DigitFormId) => void;
|
|
675
703
|
};
|
|
676
|
-
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;
|
|
677
705
|
|
|
678
706
|
type EquationMathMode = 'inline' | 'display';
|
|
679
707
|
type EquationDrawerProps = {
|
|
@@ -706,6 +734,7 @@ type InlineFieldProps = {
|
|
|
706
734
|
blockId?: string;
|
|
707
735
|
references?: Reference2[];
|
|
708
736
|
documentNode?: DocumentNode;
|
|
737
|
+
bookContext?: DocumentBookContext;
|
|
709
738
|
documentDirection?: 'rtl' | 'ltr';
|
|
710
739
|
digitForm?: DigitFormId;
|
|
711
740
|
mathOutput?: DocumentMathOutput;
|
|
@@ -726,7 +755,7 @@ type InlineFieldProps = {
|
|
|
726
755
|
onRefFocus?: (blockId: string, fieldId: string, tokenId: string) => void;
|
|
727
756
|
onFieldBlur?: () => void;
|
|
728
757
|
};
|
|
729
|
-
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;
|
|
730
759
|
|
|
731
760
|
type MathChipProps = {
|
|
732
761
|
token: MathToken2;
|
package/dist/react-document.d.ts
CHANGED
|
@@ -325,6 +325,8 @@ type TextBlock2 = {
|
|
|
325
325
|
kind: 'textBlock';
|
|
326
326
|
command: '\\section' | '\\subsection' | '\\subsubsection' | '\\paragraph';
|
|
327
327
|
field: InlineField2;
|
|
328
|
+
/** Optional imported or authored label for a section heading. */
|
|
329
|
+
label?: string;
|
|
328
330
|
metadata?: DocumentBlockMetadata;
|
|
329
331
|
/** When true on \\paragraph, center in preview and LaTeX export. */
|
|
330
332
|
centered?: boolean;
|
|
@@ -521,6 +523,23 @@ type DocumentMetaProp = Partial<Omit<DocumentMeta, 'date'>> & {
|
|
|
521
523
|
date?: Partial<DocumentHijriDate>;
|
|
522
524
|
};
|
|
523
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
|
+
|
|
524
543
|
type ImageAssetRef = {
|
|
525
544
|
assetId: string;
|
|
526
545
|
value?: string;
|
|
@@ -542,6 +561,10 @@ type ImageBlockEditorRenderContext = {
|
|
|
542
561
|
type ButexResponsiveMode = 'auto' | 'desktop' | 'compact';
|
|
543
562
|
|
|
544
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;
|
|
545
568
|
initialDocument?: DocumentJson | DocumentNode;
|
|
546
569
|
/** Seed article metadata when JSON/node omits fields (JSON wins when present). */
|
|
547
570
|
documentMeta?: DocumentMetaProp;
|
|
@@ -589,6 +612,8 @@ type ButexDocumentEditorRef = {
|
|
|
589
612
|
updateImageBlockAsset: (blockId: string, ref: ImageAssetRef) => void;
|
|
590
613
|
/** Canonical JSON without host-side AST mutation. */
|
|
591
614
|
getDocumentJson: () => DocumentJson;
|
|
615
|
+
/** Parent must consult before unmounting or switching to another unit. */
|
|
616
|
+
hasPendingChildTransaction: () => boolean;
|
|
592
617
|
};
|
|
593
618
|
|
|
594
619
|
declare function resolveInitialDocument(initialDocument: DocumentJson | DocumentNode | undefined, uiLocale?: ButexUiLocale, documentMeta?: DocumentMetaProp): DocumentInitialState;
|
|
@@ -616,6 +641,8 @@ declare function DocumentPreview({ blocks, output, documentDirection, uiLocale,
|
|
|
616
641
|
}): react_jsx_runtime.JSX.Element;
|
|
617
642
|
|
|
618
643
|
type ButexDocumentPreviewProps = {
|
|
644
|
+
mode?: DocumentEditorMode;
|
|
645
|
+
bookContext?: DocumentBookContext;
|
|
619
646
|
/** Persisted wire JSON or an already-imported live Document node. */
|
|
620
647
|
document: DocumentJson | DocumentNode;
|
|
621
648
|
className?: string;
|
|
@@ -636,9 +663,10 @@ declare function resolvePreviewDocument(input: DocumentJson | DocumentNode, uiLo
|
|
|
636
663
|
* Dedicated read-only Document renderer. This intentionally bypasses the full
|
|
637
664
|
* editor component and derives only the runtime document plus preview model.
|
|
638
665
|
*/
|
|
639
|
-
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;
|
|
640
667
|
|
|
641
668
|
type DocumentInsertToolbarProps = {
|
|
669
|
+
mode?: 'article' | 'book-content';
|
|
642
670
|
canUndo: boolean;
|
|
643
671
|
canRedo: boolean;
|
|
644
672
|
editableEquations?: boolean;
|
|
@@ -673,7 +701,7 @@ type DocumentInsertToolbarProps = {
|
|
|
673
701
|
onOpenArticleMeta?: () => void;
|
|
674
702
|
onDigitFormChange: (digitForm: DigitFormId) => void;
|
|
675
703
|
};
|
|
676
|
-
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;
|
|
677
705
|
|
|
678
706
|
type EquationMathMode = 'inline' | 'display';
|
|
679
707
|
type EquationDrawerProps = {
|
|
@@ -706,6 +734,7 @@ type InlineFieldProps = {
|
|
|
706
734
|
blockId?: string;
|
|
707
735
|
references?: Reference2[];
|
|
708
736
|
documentNode?: DocumentNode;
|
|
737
|
+
bookContext?: DocumentBookContext;
|
|
709
738
|
documentDirection?: 'rtl' | 'ltr';
|
|
710
739
|
digitForm?: DigitFormId;
|
|
711
740
|
mathOutput?: DocumentMathOutput;
|
|
@@ -726,7 +755,7 @@ type InlineFieldProps = {
|
|
|
726
755
|
onRefFocus?: (blockId: string, fieldId: string, tokenId: string) => void;
|
|
727
756
|
onFieldBlur?: () => void;
|
|
728
757
|
};
|
|
729
|
-
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;
|
|
730
759
|
|
|
731
760
|
type MathChipProps = {
|
|
732
761
|
token: MathToken2;
|