@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-document.mjs
CHANGED
|
@@ -1964,6 +1964,12 @@ function createDelimiterNode(leftDelimExpr2, rightDelimExpr2) {
|
|
|
1964
1964
|
innerExpr: createEditorChain()
|
|
1965
1965
|
};
|
|
1966
1966
|
}
|
|
1967
|
+
function createBoxedNode() {
|
|
1968
|
+
return {
|
|
1969
|
+
...createEditorNode("boxed", ""),
|
|
1970
|
+
innerExpr: createEditorChain()
|
|
1971
|
+
};
|
|
1972
|
+
}
|
|
1967
1973
|
function createFracNode() {
|
|
1968
1974
|
return {
|
|
1969
1975
|
...createEditorNode("frac", ""),
|
|
@@ -2338,6 +2344,10 @@ function renderNodeEnglish(node, options) {
|
|
|
2338
2344
|
if (node.kind === "delimiter" && node.innerExpr) {
|
|
2339
2345
|
return `${node.leftDelimExpr}${renderChainEnglish(node.innerExpr, options)}${node.rightDelimExpr}${latinScripts(node, options)}`;
|
|
2340
2346
|
}
|
|
2347
|
+
if (node.kind === "boxed" && node.innerExpr) {
|
|
2348
|
+
const body = `\\boxed{${renderChainEnglish(node.innerExpr, options)}}`;
|
|
2349
|
+
return `${body}${latinScripts(node, options)}`;
|
|
2350
|
+
}
|
|
2341
2351
|
if (node.kind === "frac" && node.numerator && node.denominator) {
|
|
2342
2352
|
const body = `\\frac{${renderChainEnglish(node.numerator, options)}}{${renderChainEnglish(node.denominator, options)}}`;
|
|
2343
2353
|
return `${body}${latinScripts(node, options)}`;
|
|
@@ -2394,6 +2404,10 @@ function renderNodeArabic(node, options) {
|
|
|
2394
2404
|
const content = `${node.leftDelimExpr}${renderChainArabic(node.innerExpr, options)}${node.rightDelimExpr}`;
|
|
2395
2405
|
return arabicScripts(node, content, options);
|
|
2396
2406
|
}
|
|
2407
|
+
if (node.kind === "boxed" && node.innerExpr) {
|
|
2408
|
+
const content = `\\boxed{${renderChainArabic(node.innerExpr, options)}}`;
|
|
2409
|
+
return arabicScripts(node, content, options);
|
|
2410
|
+
}
|
|
2397
2411
|
if (node.kind === "frac" && node.numerator && node.denominator) {
|
|
2398
2412
|
const content = `\\frac{${renderChainArabic(node.numerator, options)}}{${renderChainArabic(node.denominator, options)}}`;
|
|
2399
2413
|
return arabicScripts(node, content, options);
|
|
@@ -5230,6 +5244,29 @@ function buildDelimiterNodeBody(node, buildChain) {
|
|
|
5230
5244
|
return pair;
|
|
5231
5245
|
}
|
|
5232
5246
|
|
|
5247
|
+
// src/editor/display/boxed.ts
|
|
5248
|
+
var BOXED_CSS = `
|
|
5249
|
+
.boxed-command {
|
|
5250
|
+
display: inline-flex;
|
|
5251
|
+
align-items: center;
|
|
5252
|
+
border: 1.5px solid currentColor;
|
|
5253
|
+
padding: 0.12em 0.22em;
|
|
5254
|
+
min-height: 1.25em;
|
|
5255
|
+
}
|
|
5256
|
+
|
|
5257
|
+
.boxed-command > .chain {
|
|
5258
|
+
min-height: auto;
|
|
5259
|
+
}
|
|
5260
|
+
`.trim();
|
|
5261
|
+
function buildBoxedNodeBody(node, buildChain) {
|
|
5262
|
+
const box = document.createElement("span");
|
|
5263
|
+
box.className = "boxed-command";
|
|
5264
|
+
if (node.innerExpr) {
|
|
5265
|
+
box.appendChild(buildChain(node.innerExpr));
|
|
5266
|
+
}
|
|
5267
|
+
return box;
|
|
5268
|
+
}
|
|
5269
|
+
|
|
5233
5270
|
// src/editor/display/frac.ts
|
|
5234
5271
|
var FRAC_CSS = `
|
|
5235
5272
|
.frac {
|
|
@@ -5984,6 +6021,9 @@ function buildNodeBody(node, buildChain, side, digitForm = "western", uiLocale =
|
|
|
5984
6021
|
if (node.kind === "delimiter") {
|
|
5985
6022
|
return buildDelimiterNodeBody(node, buildChain);
|
|
5986
6023
|
}
|
|
6024
|
+
if (node.kind === "boxed") {
|
|
6025
|
+
return buildBoxedNodeBody(node, buildChain);
|
|
6026
|
+
}
|
|
5987
6027
|
if (node.kind === "frac") {
|
|
5988
6028
|
return buildFracNodeBody(node, buildChain);
|
|
5989
6029
|
}
|
|
@@ -6220,6 +6260,8 @@ ${CHARACTER_FONT_CSS}
|
|
|
6220
6260
|
|
|
6221
6261
|
${DELIMITER_CSS}
|
|
6222
6262
|
|
|
6263
|
+
${BOXED_CSS}
|
|
6264
|
+
|
|
6223
6265
|
${FRAC_CSS}
|
|
6224
6266
|
|
|
6225
6267
|
${SQRT_CSS}
|
|
@@ -7499,6 +7541,16 @@ function commandToEditorNode(node) {
|
|
|
7499
7541
|
}
|
|
7500
7542
|
return { editable: true, node: sqrt };
|
|
7501
7543
|
}
|
|
7544
|
+
if (node.name === "\\boxed" && node.optionalArgs.length === 0 && node.mandatoryArgs.length === 1) {
|
|
7545
|
+
const boxed = createBoxedNode();
|
|
7546
|
+
const inner = chainToEditorChain(node.mandatoryArgs[0]);
|
|
7547
|
+
if (!inner.editable) {
|
|
7548
|
+
return inner;
|
|
7549
|
+
}
|
|
7550
|
+
boxed.innerExpr = inner.chain;
|
|
7551
|
+
const scripts = attachScripts(node, boxed);
|
|
7552
|
+
return scripts ?? { editable: true, node: boxed };
|
|
7553
|
+
}
|
|
7502
7554
|
if (node.name === "\\overset" && node.mandatoryArgs.length >= 2) {
|
|
7503
7555
|
const overset = createOversetNode();
|
|
7504
7556
|
const overExpr = chainToEditorChain(node.mandatoryArgs[0]);
|
|
@@ -7782,6 +7834,12 @@ function editorNodeToAstNode(node) {
|
|
|
7782
7834
|
return inner;
|
|
7783
7835
|
}
|
|
7784
7836
|
astNode = new DelimiterNode(node.leftDelimExpr, inner.chain, node.rightDelimExpr);
|
|
7837
|
+
} else if (node.kind === "boxed" && node.innerExpr) {
|
|
7838
|
+
const inner = editorChainToAstChain(node.innerExpr);
|
|
7839
|
+
if (!inner.ok) {
|
|
7840
|
+
return inner;
|
|
7841
|
+
}
|
|
7842
|
+
astNode = new CommandNode("\\boxed", [], [inner.chain]);
|
|
7785
7843
|
} else if (node.kind === "frac" && node.numerator && node.denominator) {
|
|
7786
7844
|
const numerator = editorChainToAstChain(node.numerator);
|
|
7787
7845
|
const denominator = editorChainToAstChain(node.denominator);
|