@drghaliasri/butex 7.4.2 → 8.0.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/README.md +49 -553
- package/dist/{document2-cli.js → document-cli.js} +419 -348
- package/dist/document-cli.js.map +1 -0
- package/dist/document.d.mts +1022 -186
- package/dist/document.d.ts +1022 -186
- package/dist/document.js +6103 -652
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +5963 -612
- package/dist/document.mjs.map +1 -1
- package/dist/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.global.js +14 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -0
- package/dist/index.mjs.map +1 -1
- package/dist/react-document-preview.d.mts +338 -0
- package/dist/react-document-preview.d.ts +338 -0
- package/dist/{react-document2-preview.js → react-document-preview.js} +811 -791
- package/dist/react-document-preview.js.map +1 -0
- package/dist/{react-document2-preview.mjs → react-document-preview.mjs} +804 -784
- package/dist/react-document-preview.mjs.map +1 -0
- package/dist/react-document.d.mts +634 -35
- package/dist/react-document.d.ts +634 -35
- package/dist/react-document.js +13540 -4542
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +13536 -4546
- package/dist/react-document.mjs.map +1 -1
- package/dist/react.d.mts +12 -0
- package/dist/react.d.ts +12 -0
- package/dist/react.js +33 -12
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +33 -12
- package/dist/react.mjs.map +1 -1
- package/package.json +7 -17
- package/dist/document2-cli.js.map +0 -1
- package/dist/document2.d.mts +0 -1156
- package/dist/document2.d.ts +0 -1156
- package/dist/document2.js +0 -9137
- package/dist/document2.js.map +0 -1
- package/dist/document2.mjs +0 -8972
- package/dist/document2.mjs.map +0 -1
- package/dist/react-document2-preview.d.mts +0 -338
- package/dist/react-document2-preview.d.ts +0 -338
- package/dist/react-document2-preview.js.map +0 -1
- package/dist/react-document2-preview.mjs.map +0 -1
- package/dist/react-document2.d.mts +0 -754
- package/dist/react-document2.d.ts +0 -754
- package/dist/react-document2.js +0 -23011
- package/dist/react-document2.js.map +0 -1
- package/dist/react-document2.mjs +0 -22981
- package/dist/react-document2.mjs.map +0 -1
package/dist/react.mjs
CHANGED
|
@@ -694,6 +694,15 @@ var ATOMIC_COMMANDS = {
|
|
|
694
694
|
title: "\u0641\u0631\u0627\u063A \u0633\u0627\u0644\u0628 \u0631\u0641\u064A\u0639",
|
|
695
695
|
spacing: { direction: "negative", level: 1 }
|
|
696
696
|
},
|
|
697
|
+
thinSpace: {
|
|
698
|
+
id: "thinSpace",
|
|
699
|
+
category: "spacing",
|
|
700
|
+
englishTex: "\\,",
|
|
701
|
+
arabicTex: "\\,",
|
|
702
|
+
arabicLabel: "",
|
|
703
|
+
title: "\u0641\u0631\u0627\u063A \u0631\u0641\u064A\u0639",
|
|
704
|
+
spacing: { direction: "positive", level: 1 }
|
|
705
|
+
},
|
|
697
706
|
mediumSpace: {
|
|
698
707
|
id: "mediumSpace",
|
|
699
708
|
category: "spacing",
|
|
@@ -1714,6 +1723,10 @@ function renderNodeEnglish(node, options) {
|
|
|
1714
1723
|
}
|
|
1715
1724
|
if (node.kind === "char") {
|
|
1716
1725
|
if (node.sourceLatex) {
|
|
1726
|
+
if (node.wrapperCommand === "\\boldarabic" || node.wrapperCommand === "\\mathbf") {
|
|
1727
|
+
const boldSource = node.sourceLatex.startsWith("\\mathbf{") ? node.sourceLatex : `\\mathbf{${node.sourceLatex}}`;
|
|
1728
|
+
return `${boldSource}${latinScripts(node, options)}`;
|
|
1729
|
+
}
|
|
1717
1730
|
return `${node.sourceLatex}${latinScripts(node, options)}`;
|
|
1718
1731
|
}
|
|
1719
1732
|
if (node.wrapperCommand) {
|
|
@@ -2655,6 +2668,7 @@ var ENGLISH_COMMAND_TITLES = {
|
|
|
2655
2668
|
C: "Complex numbers",
|
|
2656
2669
|
H: "Quaternions",
|
|
2657
2670
|
negThinSpace: "Negative thin space",
|
|
2671
|
+
thinSpace: "Thin space",
|
|
2658
2672
|
mediumSpace: "Medium space",
|
|
2659
2673
|
thickSpace: "Thick space",
|
|
2660
2674
|
quadSpace: "Large space",
|
|
@@ -8717,7 +8731,7 @@ function fromArabicJson(json) {
|
|
|
8717
8731
|
return parseNode(json, "arabic");
|
|
8718
8732
|
}
|
|
8719
8733
|
|
|
8720
|
-
// src/document/mathObject.ts
|
|
8734
|
+
// src/shared/math-document/mathObject.ts
|
|
8721
8735
|
function isObject(value) {
|
|
8722
8736
|
return typeof value === "object" && value !== null;
|
|
8723
8737
|
}
|
|
@@ -8814,7 +8828,7 @@ function toMathObjectJson(math) {
|
|
|
8814
8828
|
};
|
|
8815
8829
|
}
|
|
8816
8830
|
|
|
8817
|
-
// src/document/normalizeCharImport.ts
|
|
8831
|
+
// src/shared/math-document/normalizeCharImport.ts
|
|
8818
8832
|
var WRAPPER_SPECS = [
|
|
8819
8833
|
...NON_DEFAULT_CHARACTER_FONT_SPECS.flatMap((font) => [
|
|
8820
8834
|
{ prefix: font.macro, font: font.id },
|
|
@@ -8878,7 +8892,7 @@ function normalizeCharImportExpr(expr) {
|
|
|
8878
8892
|
return { expr: current, characterFont };
|
|
8879
8893
|
}
|
|
8880
8894
|
|
|
8881
|
-
// src/document/mathEditorAdapter.ts
|
|
8895
|
+
// src/shared/math-document/mathEditorAdapter.ts
|
|
8882
8896
|
var COMMAND_FONT_MAP = Object.fromEntries([
|
|
8883
8897
|
["\\text", "infer"],
|
|
8884
8898
|
...NON_DEFAULT_CHARACTER_FONT_SPECS.flatMap((font) => [
|
|
@@ -9076,20 +9090,27 @@ function editableWrapperCommand(node) {
|
|
|
9076
9090
|
return null;
|
|
9077
9091
|
}
|
|
9078
9092
|
const child = singleCommandChar(node);
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9093
|
+
let editorNode;
|
|
9094
|
+
if (child) {
|
|
9095
|
+
const normalized = normalizeCharImportExpr(child.expr);
|
|
9096
|
+
editorNode = createEditorNode("char", normalized.expr);
|
|
9097
|
+
if (normalized.characterFont !== "default") {
|
|
9098
|
+
editorNode.characterFont = normalized.characterFont;
|
|
9099
|
+
}
|
|
9100
|
+
} else {
|
|
9101
|
+
if (node.optionalArgs.length || node.mandatoryArgs.length !== 1) return null;
|
|
9102
|
+
const nodes = node.mandatoryArgs[0]?.chain;
|
|
9103
|
+
if (!nodes || nodes.length !== 1 || !(nodes[0] instanceof CommandNode)) return null;
|
|
9104
|
+
const nested = charFromTextLikeCommand(nodes[0]);
|
|
9105
|
+
if (!nested?.editable) return null;
|
|
9106
|
+
editorNode = nested.node;
|
|
9086
9107
|
}
|
|
9087
9108
|
editorNode.wrapperCommand = node.name === "\\mathtt" ? "\\mathtt" : node.name === "\\mathbf" ? "\\mathbf" : node.name === "\\boldarabic" ? "\\boldarabic" : "\\unit";
|
|
9088
9109
|
const scripts = attachScripts(node, editorNode);
|
|
9089
9110
|
if (scripts) {
|
|
9090
9111
|
return scripts;
|
|
9091
9112
|
}
|
|
9092
|
-
if (!editorNode.sourceLatex && node.name === "\\mathsf") {
|
|
9113
|
+
if (!editorNode.sourceLatex && node.name === "\\mathsf" && child) {
|
|
9093
9114
|
editorNode.sourceLatex = `\\mathsf{${child.expr}}`;
|
|
9094
9115
|
}
|
|
9095
9116
|
return { editable: true, node: editorNode };
|
|
@@ -10342,7 +10363,7 @@ function useDesktopPopoverPlacement(rootRef, active, onClose) {
|
|
|
10342
10363
|
popover.style.position = "fixed";
|
|
10343
10364
|
popover.style.inset = "auto";
|
|
10344
10365
|
const rootRect = root.getBoundingClientRect();
|
|
10345
|
-
const scrollBoundary = root.closest(".butex-
|
|
10366
|
+
const scrollBoundary = root.closest(".butex-document-widget__equation-modal-body");
|
|
10346
10367
|
const scrollBoundaryRect = scrollBoundary?.getBoundingClientRect();
|
|
10347
10368
|
const triggerRect = trigger.getBoundingClientRect();
|
|
10348
10369
|
const boundaryLeft = Math.max(VIEWPORT_MARGIN, rootRect.left + VIEWPORT_MARGIN);
|