@drghaliasri/butex 7.3.1 → 7.3.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/dist/document.d.mts +1 -1
- package/dist/document.d.ts +1 -1
- package/dist/document.js +27 -0
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +27 -0
- package/dist/document.mjs.map +1 -1
- package/dist/document2-cli.js +47 -0
- package/dist/document2-cli.js.map +1 -1
- package/dist/document2.d.mts +1 -1
- package/dist/document2.d.ts +1 -1
- package/dist/document2.js +47 -0
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +47 -0
- package/dist/document2.mjs.map +1 -1
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.global.js +44 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -0
- package/dist/index.mjs.map +1 -1
- package/dist/react-document.js +58 -0
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +58 -0
- package/dist/react-document.mjs.map +1 -1
- package/dist/react-document2-preview.js +41 -0
- package/dist/react-document2-preview.js.map +1 -1
- package/dist/react-document2-preview.mjs +41 -0
- package/dist/react-document2-preview.mjs.map +1 -1
- package/dist/react-document2.d.mts +1 -1
- package/dist/react-document2.d.ts +1 -1
- package/dist/react-document2.js +58 -0
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +58 -0
- package/dist/react-document2.mjs.map +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +58 -0
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +58 -0
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -54,6 +54,12 @@ function createDelimiterNode(leftDelimExpr2, rightDelimExpr2) {
|
|
|
54
54
|
innerExpr: createEditorChain()
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
+
function createBoxedNode() {
|
|
58
|
+
return {
|
|
59
|
+
...createEditorNode("boxed", ""),
|
|
60
|
+
innerExpr: createEditorChain()
|
|
61
|
+
};
|
|
62
|
+
}
|
|
57
63
|
function createFracNode() {
|
|
58
64
|
return {
|
|
59
65
|
...createEditorNode("frac", ""),
|
|
@@ -1618,6 +1624,10 @@ function renderNodeEnglish(node, options) {
|
|
|
1618
1624
|
if (node.kind === "delimiter" && node.innerExpr) {
|
|
1619
1625
|
return `${node.leftDelimExpr}${renderChainEnglish(node.innerExpr, options)}${node.rightDelimExpr}${latinScripts(node, options)}`;
|
|
1620
1626
|
}
|
|
1627
|
+
if (node.kind === "boxed" && node.innerExpr) {
|
|
1628
|
+
const body = `\\boxed{${renderChainEnglish(node.innerExpr, options)}}`;
|
|
1629
|
+
return `${body}${latinScripts(node, options)}`;
|
|
1630
|
+
}
|
|
1621
1631
|
if (node.kind === "frac" && node.numerator && node.denominator) {
|
|
1622
1632
|
const body = `\\frac{${renderChainEnglish(node.numerator, options)}}{${renderChainEnglish(node.denominator, options)}}`;
|
|
1623
1633
|
return `${body}${latinScripts(node, options)}`;
|
|
@@ -1674,6 +1684,10 @@ function renderNodeArabic(node, options) {
|
|
|
1674
1684
|
const content = `${node.leftDelimExpr}${renderChainArabic(node.innerExpr, options)}${node.rightDelimExpr}`;
|
|
1675
1685
|
return arabicScripts(node, content, options);
|
|
1676
1686
|
}
|
|
1687
|
+
if (node.kind === "boxed" && node.innerExpr) {
|
|
1688
|
+
const content = `\\boxed{${renderChainArabic(node.innerExpr, options)}}`;
|
|
1689
|
+
return arabicScripts(node, content, options);
|
|
1690
|
+
}
|
|
1677
1691
|
if (node.kind === "frac" && node.numerator && node.denominator) {
|
|
1678
1692
|
const content = `\\frac{${renderChainArabic(node.numerator, options)}}{${renderChainArabic(node.denominator, options)}}`;
|
|
1679
1693
|
return arabicScripts(node, content, options);
|
|
@@ -4510,6 +4524,29 @@ function buildDelimiterNodeBody(node, buildChain) {
|
|
|
4510
4524
|
return pair;
|
|
4511
4525
|
}
|
|
4512
4526
|
|
|
4527
|
+
// src/editor/display/boxed.ts
|
|
4528
|
+
var BOXED_CSS = `
|
|
4529
|
+
.boxed-command {
|
|
4530
|
+
display: inline-flex;
|
|
4531
|
+
align-items: center;
|
|
4532
|
+
border: 1.5px solid currentColor;
|
|
4533
|
+
padding: 0.12em 0.22em;
|
|
4534
|
+
min-height: 1.25em;
|
|
4535
|
+
}
|
|
4536
|
+
|
|
4537
|
+
.boxed-command > .chain {
|
|
4538
|
+
min-height: auto;
|
|
4539
|
+
}
|
|
4540
|
+
`.trim();
|
|
4541
|
+
function buildBoxedNodeBody(node, buildChain) {
|
|
4542
|
+
const box = document.createElement("span");
|
|
4543
|
+
box.className = "boxed-command";
|
|
4544
|
+
if (node.innerExpr) {
|
|
4545
|
+
box.appendChild(buildChain(node.innerExpr));
|
|
4546
|
+
}
|
|
4547
|
+
return box;
|
|
4548
|
+
}
|
|
4549
|
+
|
|
4513
4550
|
// src/editor/display/frac.ts
|
|
4514
4551
|
var FRAC_CSS = `
|
|
4515
4552
|
.frac {
|
|
@@ -5264,6 +5301,9 @@ function buildNodeBody(node, buildChain, side, digitForm = "western", uiLocale =
|
|
|
5264
5301
|
if (node.kind === "delimiter") {
|
|
5265
5302
|
return buildDelimiterNodeBody(node, buildChain);
|
|
5266
5303
|
}
|
|
5304
|
+
if (node.kind === "boxed") {
|
|
5305
|
+
return buildBoxedNodeBody(node, buildChain);
|
|
5306
|
+
}
|
|
5267
5307
|
if (node.kind === "frac") {
|
|
5268
5308
|
return buildFracNodeBody(node, buildChain);
|
|
5269
5309
|
}
|
|
@@ -5500,6 +5540,8 @@ ${CHARACTER_FONT_CSS}
|
|
|
5500
5540
|
|
|
5501
5541
|
${DELIMITER_CSS}
|
|
5502
5542
|
|
|
5543
|
+
${BOXED_CSS}
|
|
5544
|
+
|
|
5503
5545
|
${FRAC_CSS}
|
|
5504
5546
|
|
|
5505
5547
|
${SQRT_CSS}
|
|
@@ -9030,6 +9072,16 @@ function commandToEditorNode(node) {
|
|
|
9030
9072
|
}
|
|
9031
9073
|
return { editable: true, node: sqrt };
|
|
9032
9074
|
}
|
|
9075
|
+
if (node.name === "\\boxed" && node.optionalArgs.length === 0 && node.mandatoryArgs.length === 1) {
|
|
9076
|
+
const boxed = createBoxedNode();
|
|
9077
|
+
const inner = chainToEditorChain(node.mandatoryArgs[0]);
|
|
9078
|
+
if (!inner.editable) {
|
|
9079
|
+
return inner;
|
|
9080
|
+
}
|
|
9081
|
+
boxed.innerExpr = inner.chain;
|
|
9082
|
+
const scripts = attachScripts(node, boxed);
|
|
9083
|
+
return scripts ?? { editable: true, node: boxed };
|
|
9084
|
+
}
|
|
9033
9085
|
if (node.name === "\\overset" && node.mandatoryArgs.length >= 2) {
|
|
9034
9086
|
const overset = createOversetNode();
|
|
9035
9087
|
const overExpr = chainToEditorChain(node.mandatoryArgs[0]);
|
|
@@ -9313,6 +9365,12 @@ function editorNodeToAstNode(node) {
|
|
|
9313
9365
|
return inner;
|
|
9314
9366
|
}
|
|
9315
9367
|
astNode = new DelimiterNode(node.leftDelimExpr, inner.chain, node.rightDelimExpr);
|
|
9368
|
+
} else if (node.kind === "boxed" && node.innerExpr) {
|
|
9369
|
+
const inner = editorChainToAstChain(node.innerExpr);
|
|
9370
|
+
if (!inner.ok) {
|
|
9371
|
+
return inner;
|
|
9372
|
+
}
|
|
9373
|
+
astNode = new CommandNode("\\boxed", [], [inner.chain]);
|
|
9316
9374
|
} else if (node.kind === "frac" && node.numerator && node.denominator) {
|
|
9317
9375
|
const numerator = editorChainToAstChain(node.numerator);
|
|
9318
9376
|
const denominator = editorChainToAstChain(node.denominator);
|