@drghaliasri/butex 7.3.0 → 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 +36 -1
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +36 -1
- package/dist/document.mjs.map +1 -1
- package/dist/document2-cli.js +56 -1
- 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 +56 -1
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +56 -1
- 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 +75 -2
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +75 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -2
- package/dist/index.mjs.map +1 -1
- package/dist/react-document.js +71 -1
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +71 -1
- package/dist/react-document.mjs.map +1 -1
- package/dist/react-document2-preview.js +50 -1
- package/dist/react-document2-preview.js.map +1 -1
- package/dist/react-document2-preview.mjs +50 -1
- 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 +71 -1
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +71 -1
- 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 +71 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +71 -1
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -2622,6 +2622,12 @@ function createDelimiterNode(leftDelimExpr2, rightDelimExpr2) {
|
|
|
2622
2622
|
innerExpr: createEditorChain()
|
|
2623
2623
|
};
|
|
2624
2624
|
}
|
|
2625
|
+
function createBoxedNode() {
|
|
2626
|
+
return {
|
|
2627
|
+
...createEditorNode("boxed", ""),
|
|
2628
|
+
innerExpr: createEditorChain()
|
|
2629
|
+
};
|
|
2630
|
+
}
|
|
2625
2631
|
function createFracNode() {
|
|
2626
2632
|
return {
|
|
2627
2633
|
...createEditorNode("frac", ""),
|
|
@@ -2839,8 +2845,9 @@ function characterFontSpec(fontId) {
|
|
|
2839
2845
|
// src/editor/divideOperator.ts
|
|
2840
2846
|
var DIVIDE_OPERATOR_EN = "/";
|
|
2841
2847
|
var DIVIDE_OPERATOR_AR = "\\";
|
|
2848
|
+
var DIVIDE_OPERATOR_AR_LATEX = "\\backslash";
|
|
2842
2849
|
function isDivideOperatorExpr(expr) {
|
|
2843
|
-
return expr === DIVIDE_OPERATOR_EN || expr === DIVIDE_OPERATOR_AR;
|
|
2850
|
+
return expr === DIVIDE_OPERATOR_EN || expr === DIVIDE_OPERATOR_AR || expr === DIVIDE_OPERATOR_AR_LATEX;
|
|
2844
2851
|
}
|
|
2845
2852
|
function renderDivideOperatorLatex(side) {
|
|
2846
2853
|
return side === "arabic" ? "\\backslash" : DIVIDE_OPERATOR_EN;
|
|
@@ -2955,6 +2962,10 @@ function renderNodeEnglish(node, options) {
|
|
|
2955
2962
|
if (node.kind === "delimiter" && node.innerExpr) {
|
|
2956
2963
|
return `${node.leftDelimExpr}${renderChainEnglish(node.innerExpr, options)}${node.rightDelimExpr}${latinScripts(node, options)}`;
|
|
2957
2964
|
}
|
|
2965
|
+
if (node.kind === "boxed" && node.innerExpr) {
|
|
2966
|
+
const body = `\\boxed{${renderChainEnglish(node.innerExpr, options)}}`;
|
|
2967
|
+
return `${body}${latinScripts(node, options)}`;
|
|
2968
|
+
}
|
|
2958
2969
|
if (node.kind === "frac" && node.numerator && node.denominator) {
|
|
2959
2970
|
const body = `\\frac{${renderChainEnglish(node.numerator, options)}}{${renderChainEnglish(node.denominator, options)}}`;
|
|
2960
2971
|
return `${body}${latinScripts(node, options)}`;
|
|
@@ -3011,6 +3022,10 @@ function renderNodeArabic(node, options) {
|
|
|
3011
3022
|
const content = `${node.leftDelimExpr}${renderChainArabic(node.innerExpr, options)}${node.rightDelimExpr}`;
|
|
3012
3023
|
return arabicScripts(node, content, options);
|
|
3013
3024
|
}
|
|
3025
|
+
if (node.kind === "boxed" && node.innerExpr) {
|
|
3026
|
+
const content = `\\boxed{${renderChainArabic(node.innerExpr, options)}}`;
|
|
3027
|
+
return arabicScripts(node, content, options);
|
|
3028
|
+
}
|
|
3014
3029
|
if (node.kind === "frac" && node.numerator && node.denominator) {
|
|
3015
3030
|
const content = `\\frac{${renderChainArabic(node.numerator, options)}}{${renderChainArabic(node.denominator, options)}}`;
|
|
3016
3031
|
return arabicScripts(node, content, options);
|
|
@@ -3147,6 +3162,21 @@ var rightDelimExpr = buildDelimiterExpr(
|
|
|
3147
3162
|
[")", "]", "\\}", "\\rfloor", "\\rceil", "\\rangle", "`", "|", "\\|", "\\rvert", "\\vert", "\\rVert", "\\Vert"]
|
|
3148
3163
|
);
|
|
3149
3164
|
|
|
3165
|
+
// src/editor/display/boxed.ts
|
|
3166
|
+
var BOXED_CSS = `
|
|
3167
|
+
.boxed-command {
|
|
3168
|
+
display: inline-flex;
|
|
3169
|
+
align-items: center;
|
|
3170
|
+
border: 1.5px solid currentColor;
|
|
3171
|
+
padding: 0.12em 0.22em;
|
|
3172
|
+
min-height: 1.25em;
|
|
3173
|
+
}
|
|
3174
|
+
|
|
3175
|
+
.boxed-command > .chain {
|
|
3176
|
+
min-height: auto;
|
|
3177
|
+
}
|
|
3178
|
+
`.trim();
|
|
3179
|
+
|
|
3150
3180
|
// src/editor/display/frac.ts
|
|
3151
3181
|
var FRAC_CSS = `
|
|
3152
3182
|
.frac {
|
|
@@ -3659,6 +3689,13 @@ ${CHARACTER_FONT_CSS}
|
|
|
3659
3689
|
font-weight: 700;
|
|
3660
3690
|
}
|
|
3661
3691
|
|
|
3692
|
+
.node-value--unit {
|
|
3693
|
+
font-style: normal;
|
|
3694
|
+
text-decoration-line: underline;
|
|
3695
|
+
text-decoration-style: dotted;
|
|
3696
|
+
text-underline-offset: 0.2em;
|
|
3697
|
+
}
|
|
3698
|
+
|
|
3662
3699
|
.chain {
|
|
3663
3700
|
display: inline-flex;
|
|
3664
3701
|
align-items: center;
|
|
@@ -3812,6 +3849,8 @@ ${CHARACTER_FONT_CSS}
|
|
|
3812
3849
|
|
|
3813
3850
|
${DELIMITER_CSS}
|
|
3814
3851
|
|
|
3852
|
+
${BOXED_CSS}
|
|
3853
|
+
|
|
3815
3854
|
${FRAC_CSS}
|
|
3816
3855
|
|
|
3817
3856
|
${SQRT_CSS}
|
|
@@ -4138,6 +4177,16 @@ function commandToEditorNode(node) {
|
|
|
4138
4177
|
}
|
|
4139
4178
|
return { editable: true, node: sqrt };
|
|
4140
4179
|
}
|
|
4180
|
+
if (node.name === "\\boxed" && node.optionalArgs.length === 0 && node.mandatoryArgs.length === 1) {
|
|
4181
|
+
const boxed = createBoxedNode();
|
|
4182
|
+
const inner = chainToEditorChain(node.mandatoryArgs[0]);
|
|
4183
|
+
if (!inner.editable) {
|
|
4184
|
+
return inner;
|
|
4185
|
+
}
|
|
4186
|
+
boxed.innerExpr = inner.chain;
|
|
4187
|
+
const scripts = attachScripts(node, boxed);
|
|
4188
|
+
return scripts ?? { editable: true, node: boxed };
|
|
4189
|
+
}
|
|
4141
4190
|
if (node.name === "\\overset" && node.mandatoryArgs.length >= 2) {
|
|
4142
4191
|
const overset = createOversetNode();
|
|
4143
4192
|
const overExpr = chainToEditorChain(node.mandatoryArgs[0]);
|