@drghaliasri/butex 7.2.0 → 7.2.2
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 +1 -0
- package/dist/document.d.mts +8 -0
- package/dist/document.d.ts +8 -0
- package/dist/document.js +38 -2
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +38 -2
- package/dist/document.mjs.map +1 -1
- package/dist/document2-cli.js +107 -2
- package/dist/document2-cli.js.map +1 -1
- package/dist/document2.d.mts +8 -0
- package/dist/document2.d.ts +8 -0
- package/dist/document2.js +107 -2
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +107 -2
- package/dist/document2.mjs.map +1 -1
- package/dist/index.d.mts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.global.js +109 -11
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +109 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +109 -11
- package/dist/index.mjs.map +1 -1
- package/dist/react-document.d.mts +2 -0
- package/dist/react-document.d.ts +2 -0
- package/dist/react-document.js +230 -40
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +230 -40
- package/dist/react-document.mjs.map +1 -1
- package/dist/react-document2-preview.d.mts +2 -0
- package/dist/react-document2-preview.d.ts +2 -0
- package/dist/react-document2-preview.js +91 -0
- package/dist/react-document2-preview.js.map +1 -1
- package/dist/react-document2-preview.mjs +91 -0
- package/dist/react-document2-preview.mjs.map +1 -1
- package/dist/react-document2.d.mts +8 -0
- package/dist/react-document2.d.ts +8 -0
- package/dist/react-document2.js +230 -40
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +230 -40
- package/dist/react-document2.mjs.map +1 -1
- package/dist/react.d.mts +16 -0
- package/dist/react.d.ts +16 -0
- package/dist/react.js +230 -40
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +230 -40
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/document.mjs
CHANGED
|
@@ -14,6 +14,7 @@ var BaseAstNode = class {
|
|
|
14
14
|
superscript;
|
|
15
15
|
subscript;
|
|
16
16
|
nodeType;
|
|
17
|
+
sourceLatex;
|
|
17
18
|
constructor(state = null) {
|
|
18
19
|
if (state === null) {
|
|
19
20
|
state = new State();
|
|
@@ -22,6 +23,7 @@ var BaseAstNode = class {
|
|
|
22
23
|
this.superscript = null;
|
|
23
24
|
this.subscript = null;
|
|
24
25
|
this.nodeType = this.constructor.name;
|
|
26
|
+
this.sourceLatex = null;
|
|
25
27
|
}
|
|
26
28
|
latex() {
|
|
27
29
|
throw new Error("NotImplementedError");
|
|
@@ -210,6 +212,7 @@ ${this.closing}`;
|
|
|
210
212
|
}
|
|
211
213
|
};
|
|
212
214
|
function parseScripts(node, json, mode) {
|
|
215
|
+
node.sourceLatex = typeof json.source_latex === "string" && json.source_latex.length > 0 ? json.source_latex : null;
|
|
213
216
|
if (json.superscript) {
|
|
214
217
|
node.superscript = parseChain(json.superscript, mode);
|
|
215
218
|
}
|
|
@@ -349,7 +352,8 @@ function fromMathObjectJson(json, mode = "english") {
|
|
|
349
352
|
function scriptsToJson(node, path) {
|
|
350
353
|
return {
|
|
351
354
|
...node.superscript ? { superscript: chainToJson(node.superscript, `${path}.superscript`) } : {},
|
|
352
|
-
...node.subscript ? { subscript: chainToJson(node.subscript, `${path}.subscript`) } : {}
|
|
355
|
+
...node.subscript ? { subscript: chainToJson(node.subscript, `${path}.subscript`) } : {},
|
|
356
|
+
...node.sourceLatex ? { source_latex: node.sourceLatex } : {}
|
|
353
357
|
};
|
|
354
358
|
}
|
|
355
359
|
function nodeToJson(node, path) {
|
|
@@ -1282,6 +1286,15 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1282
1286
|
title: "\u0627\u0644\u0644\u0627\u0646\u0647\u0627\u064A\u0629",
|
|
1283
1287
|
svg_path: null
|
|
1284
1288
|
},
|
|
1289
|
+
top: {
|
|
1290
|
+
id: "top",
|
|
1291
|
+
category: "operators1",
|
|
1292
|
+
Tex: "\\top",
|
|
1293
|
+
mirror: false,
|
|
1294
|
+
Label: "\u22A4",
|
|
1295
|
+
title: "\u0627\u0644\u0645\u0646\u0642\u0648\u0644",
|
|
1296
|
+
svg_path: null
|
|
1297
|
+
},
|
|
1285
1298
|
times: {
|
|
1286
1299
|
id: "times",
|
|
1287
1300
|
category: "operators1",
|
|
@@ -1909,6 +1922,7 @@ var CHARACTER_FONT_SPECS = [
|
|
|
1909
1922
|
latexFontCommand: "\\maghribi",
|
|
1910
1923
|
latexFontFamily: "Almaghribi Warsh Quran",
|
|
1911
1924
|
browserFontStack: '"Almaghribi Warsh Quran", Amiri, "Segoe UI", Tahoma, sans-serif',
|
|
1925
|
+
importAliases: ["\\maghribi"],
|
|
1912
1926
|
svgLayoutKey: "maghribi"
|
|
1913
1927
|
}
|
|
1914
1928
|
];
|
|
@@ -2069,6 +2083,10 @@ function renderNodeArabic(node, options) {
|
|
|
2069
2083
|
if (node.kind === "char") {
|
|
2070
2084
|
const expr = formatDigits(node.expr, selectedDigitForm(options));
|
|
2071
2085
|
const content = renderCharContent(node, options);
|
|
2086
|
+
if (node.wrapperCommand) {
|
|
2087
|
+
const wrapper = node.wrapperCommand === "\\mathbf" ? "\\boldarabic" : node.wrapperCommand;
|
|
2088
|
+
return arabicScripts(node, `${wrapper}{${content}}`, options);
|
|
2089
|
+
}
|
|
2072
2090
|
return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
|
|
2073
2091
|
}
|
|
2074
2092
|
if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
|
|
@@ -2639,6 +2657,11 @@ ${BUTEX_FONT_FACE_CSS}
|
|
|
2639
2657
|
|
|
2640
2658
|
${CHARACTER_FONT_CSS}
|
|
2641
2659
|
|
|
2660
|
+
.node-value--bold {
|
|
2661
|
+
font-family: var(--font-display-ar, Amiri), "Noto Serif Arabic", serif;
|
|
2662
|
+
font-weight: 700;
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2642
2665
|
.chain {
|
|
2643
2666
|
display: inline-flex;
|
|
2644
2667
|
align-items: center;
|
|
@@ -2834,6 +2857,10 @@ var CHAR_FONT_EXPORT_TEX = Object.fromEntries(
|
|
|
2834
2857
|
function charEditorNodeToAstNode(node) {
|
|
2835
2858
|
const font = node.characterFont ?? "default";
|
|
2836
2859
|
const charNode = new CharNode(node.expr);
|
|
2860
|
+
if (node.wrapperCommand) {
|
|
2861
|
+
const wrapper = node.wrapperCommand === "\\boldarabic" ? "\\mathbf" : node.wrapperCommand;
|
|
2862
|
+
return new CommandNode(wrapper, [], [new ChainNode([charNode])]);
|
|
2863
|
+
}
|
|
2837
2864
|
if (font === "default") {
|
|
2838
2865
|
return charNode;
|
|
2839
2866
|
}
|
|
@@ -2979,7 +3006,13 @@ function editorNodeToAstNode(node) {
|
|
|
2979
3006
|
if (!tex) {
|
|
2980
3007
|
return { ok: false, reason: `\u0623\u0645\u0631 \u0631\u064A\u0627\u0636\u064A \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645 \u062D\u0627\u0644\u064A\u0627: ${node.expr}` };
|
|
2981
3008
|
}
|
|
2982
|
-
|
|
3009
|
+
if (node.expr === "ad") {
|
|
3010
|
+
astNode = new CommandNode("\\mathrm", [], [new ChainNode([new CharNode("d")])]);
|
|
3011
|
+
} else if (["N", "Z", "Q", "R", "C", "H"].includes(node.expr)) {
|
|
3012
|
+
astNode = new CommandNode("\\mathbb", [], [new ChainNode([new CharNode(node.expr)])]);
|
|
3013
|
+
} else {
|
|
3014
|
+
astNode = new CommandNode(tex);
|
|
3015
|
+
}
|
|
2983
3016
|
} else if (node.kind === "atomicOperatorCommand") {
|
|
2984
3017
|
const tex = atomicOperatorCommandSpec(node.expr)?.Tex;
|
|
2985
3018
|
if (!tex) {
|
|
@@ -2996,6 +3029,9 @@ function editorNodeToAstNode(node) {
|
|
|
2996
3029
|
} else {
|
|
2997
3030
|
return { ok: false, reason: `\u0639\u0642\u062F\u0629 \u0631\u064A\u0627\u0636\u064A\u0629 \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645\u0629 \u062D\u0627\u0644\u064A\u0627: ${node.kind}` };
|
|
2998
3031
|
}
|
|
3032
|
+
if (node.sourceLatex) {
|
|
3033
|
+
astNode.sourceLatex = node.sourceLatex;
|
|
3034
|
+
}
|
|
2999
3035
|
const scripts = attachAstScripts(node, astNode);
|
|
3000
3036
|
return scripts ?? { ok: true, node: astNode };
|
|
3001
3037
|
}
|