@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-document2.mjs
CHANGED
|
@@ -2914,6 +2914,12 @@ function createDelimiterNode(leftDelimExpr2, rightDelimExpr2) {
|
|
|
2914
2914
|
innerExpr: createEditorChain()
|
|
2915
2915
|
};
|
|
2916
2916
|
}
|
|
2917
|
+
function createBoxedNode() {
|
|
2918
|
+
return {
|
|
2919
|
+
...createEditorNode("boxed", ""),
|
|
2920
|
+
innerExpr: createEditorChain()
|
|
2921
|
+
};
|
|
2922
|
+
}
|
|
2917
2923
|
function createFracNode() {
|
|
2918
2924
|
return {
|
|
2919
2925
|
...createEditorNode("frac", ""),
|
|
@@ -3260,6 +3266,10 @@ function renderNodeEnglish(node, options) {
|
|
|
3260
3266
|
if (node.kind === "delimiter" && node.innerExpr) {
|
|
3261
3267
|
return `${node.leftDelimExpr}${renderChainEnglish(node.innerExpr, options)}${node.rightDelimExpr}${latinScripts(node, options)}`;
|
|
3262
3268
|
}
|
|
3269
|
+
if (node.kind === "boxed" && node.innerExpr) {
|
|
3270
|
+
const body = `\\boxed{${renderChainEnglish(node.innerExpr, options)}}`;
|
|
3271
|
+
return `${body}${latinScripts(node, options)}`;
|
|
3272
|
+
}
|
|
3263
3273
|
if (node.kind === "frac" && node.numerator && node.denominator) {
|
|
3264
3274
|
const body = `\\frac{${renderChainEnglish(node.numerator, options)}}{${renderChainEnglish(node.denominator, options)}}`;
|
|
3265
3275
|
return `${body}${latinScripts(node, options)}`;
|
|
@@ -3316,6 +3326,10 @@ function renderNodeArabic(node, options) {
|
|
|
3316
3326
|
const content = `${node.leftDelimExpr}${renderChainArabic(node.innerExpr, options)}${node.rightDelimExpr}`;
|
|
3317
3327
|
return arabicScripts(node, content, options);
|
|
3318
3328
|
}
|
|
3329
|
+
if (node.kind === "boxed" && node.innerExpr) {
|
|
3330
|
+
const content = `\\boxed{${renderChainArabic(node.innerExpr, options)}}`;
|
|
3331
|
+
return arabicScripts(node, content, options);
|
|
3332
|
+
}
|
|
3319
3333
|
if (node.kind === "frac" && node.numerator && node.denominator) {
|
|
3320
3334
|
const content = `\\frac{${renderChainArabic(node.numerator, options)}}{${renderChainArabic(node.denominator, options)}}`;
|
|
3321
3335
|
return arabicScripts(node, content, options);
|
|
@@ -6152,6 +6166,29 @@ function buildDelimiterNodeBody(node, buildChain) {
|
|
|
6152
6166
|
return pair;
|
|
6153
6167
|
}
|
|
6154
6168
|
|
|
6169
|
+
// src/editor/display/boxed.ts
|
|
6170
|
+
var BOXED_CSS = `
|
|
6171
|
+
.boxed-command {
|
|
6172
|
+
display: inline-flex;
|
|
6173
|
+
align-items: center;
|
|
6174
|
+
border: 1.5px solid currentColor;
|
|
6175
|
+
padding: 0.12em 0.22em;
|
|
6176
|
+
min-height: 1.25em;
|
|
6177
|
+
}
|
|
6178
|
+
|
|
6179
|
+
.boxed-command > .chain {
|
|
6180
|
+
min-height: auto;
|
|
6181
|
+
}
|
|
6182
|
+
`.trim();
|
|
6183
|
+
function buildBoxedNodeBody(node, buildChain) {
|
|
6184
|
+
const box = document.createElement("span");
|
|
6185
|
+
box.className = "boxed-command";
|
|
6186
|
+
if (node.innerExpr) {
|
|
6187
|
+
box.appendChild(buildChain(node.innerExpr));
|
|
6188
|
+
}
|
|
6189
|
+
return box;
|
|
6190
|
+
}
|
|
6191
|
+
|
|
6155
6192
|
// src/editor/display/frac.ts
|
|
6156
6193
|
var FRAC_CSS = `
|
|
6157
6194
|
.frac {
|
|
@@ -6906,6 +6943,9 @@ function buildNodeBody(node, buildChain, side, digitForm = "western", uiLocale =
|
|
|
6906
6943
|
if (node.kind === "delimiter") {
|
|
6907
6944
|
return buildDelimiterNodeBody(node, buildChain);
|
|
6908
6945
|
}
|
|
6946
|
+
if (node.kind === "boxed") {
|
|
6947
|
+
return buildBoxedNodeBody(node, buildChain);
|
|
6948
|
+
}
|
|
6909
6949
|
if (node.kind === "frac") {
|
|
6910
6950
|
return buildFracNodeBody(node, buildChain);
|
|
6911
6951
|
}
|
|
@@ -7142,6 +7182,8 @@ ${CHARACTER_FONT_CSS}
|
|
|
7142
7182
|
|
|
7143
7183
|
${DELIMITER_CSS}
|
|
7144
7184
|
|
|
7185
|
+
${BOXED_CSS}
|
|
7186
|
+
|
|
7145
7187
|
${FRAC_CSS}
|
|
7146
7188
|
|
|
7147
7189
|
${SQRT_CSS}
|
|
@@ -8421,6 +8463,16 @@ function commandToEditorNode(node) {
|
|
|
8421
8463
|
}
|
|
8422
8464
|
return { editable: true, node: sqrt };
|
|
8423
8465
|
}
|
|
8466
|
+
if (node.name === "\\boxed" && node.optionalArgs.length === 0 && node.mandatoryArgs.length === 1) {
|
|
8467
|
+
const boxed = createBoxedNode();
|
|
8468
|
+
const inner = chainToEditorChain(node.mandatoryArgs[0]);
|
|
8469
|
+
if (!inner.editable) {
|
|
8470
|
+
return inner;
|
|
8471
|
+
}
|
|
8472
|
+
boxed.innerExpr = inner.chain;
|
|
8473
|
+
const scripts = attachScripts(node, boxed);
|
|
8474
|
+
return scripts ?? { editable: true, node: boxed };
|
|
8475
|
+
}
|
|
8424
8476
|
if (node.name === "\\overset" && node.mandatoryArgs.length >= 2) {
|
|
8425
8477
|
const overset = createOversetNode();
|
|
8426
8478
|
const overExpr = chainToEditorChain(node.mandatoryArgs[0]);
|
|
@@ -8704,6 +8756,12 @@ function editorNodeToAstNode(node) {
|
|
|
8704
8756
|
return inner;
|
|
8705
8757
|
}
|
|
8706
8758
|
astNode = new DelimiterNode(node.leftDelimExpr, inner.chain, node.rightDelimExpr);
|
|
8759
|
+
} else if (node.kind === "boxed" && node.innerExpr) {
|
|
8760
|
+
const inner = editorChainToAstChain(node.innerExpr);
|
|
8761
|
+
if (!inner.ok) {
|
|
8762
|
+
return inner;
|
|
8763
|
+
}
|
|
8764
|
+
astNode = new CommandNode("\\boxed", [], [inner.chain]);
|
|
8707
8765
|
} else if (node.kind === "frac" && node.numerator && node.denominator) {
|
|
8708
8766
|
const numerator = editorChainToAstChain(node.numerator);
|
|
8709
8767
|
const denominator = editorChainToAstChain(node.denominator);
|