@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.js
CHANGED
|
@@ -1993,6 +1993,12 @@ function createDelimiterNode(leftDelimExpr2, rightDelimExpr2) {
|
|
|
1993
1993
|
innerExpr: createEditorChain()
|
|
1994
1994
|
};
|
|
1995
1995
|
}
|
|
1996
|
+
function createBoxedNode() {
|
|
1997
|
+
return {
|
|
1998
|
+
...createEditorNode("boxed", ""),
|
|
1999
|
+
innerExpr: createEditorChain()
|
|
2000
|
+
};
|
|
2001
|
+
}
|
|
1996
2002
|
function createFracNode() {
|
|
1997
2003
|
return {
|
|
1998
2004
|
...createEditorNode("frac", ""),
|
|
@@ -2367,6 +2373,10 @@ function renderNodeEnglish(node, options) {
|
|
|
2367
2373
|
if (node.kind === "delimiter" && node.innerExpr) {
|
|
2368
2374
|
return `${node.leftDelimExpr}${renderChainEnglish(node.innerExpr, options)}${node.rightDelimExpr}${latinScripts(node, options)}`;
|
|
2369
2375
|
}
|
|
2376
|
+
if (node.kind === "boxed" && node.innerExpr) {
|
|
2377
|
+
const body = `\\boxed{${renderChainEnglish(node.innerExpr, options)}}`;
|
|
2378
|
+
return `${body}${latinScripts(node, options)}`;
|
|
2379
|
+
}
|
|
2370
2380
|
if (node.kind === "frac" && node.numerator && node.denominator) {
|
|
2371
2381
|
const body = `\\frac{${renderChainEnglish(node.numerator, options)}}{${renderChainEnglish(node.denominator, options)}}`;
|
|
2372
2382
|
return `${body}${latinScripts(node, options)}`;
|
|
@@ -2423,6 +2433,10 @@ function renderNodeArabic(node, options) {
|
|
|
2423
2433
|
const content = `${node.leftDelimExpr}${renderChainArabic(node.innerExpr, options)}${node.rightDelimExpr}`;
|
|
2424
2434
|
return arabicScripts(node, content, options);
|
|
2425
2435
|
}
|
|
2436
|
+
if (node.kind === "boxed" && node.innerExpr) {
|
|
2437
|
+
const content = `\\boxed{${renderChainArabic(node.innerExpr, options)}}`;
|
|
2438
|
+
return arabicScripts(node, content, options);
|
|
2439
|
+
}
|
|
2426
2440
|
if (node.kind === "frac" && node.numerator && node.denominator) {
|
|
2427
2441
|
const content = `\\frac{${renderChainArabic(node.numerator, options)}}{${renderChainArabic(node.denominator, options)}}`;
|
|
2428
2442
|
return arabicScripts(node, content, options);
|
|
@@ -5259,6 +5273,29 @@ function buildDelimiterNodeBody(node, buildChain) {
|
|
|
5259
5273
|
return pair;
|
|
5260
5274
|
}
|
|
5261
5275
|
|
|
5276
|
+
// src/editor/display/boxed.ts
|
|
5277
|
+
var BOXED_CSS = `
|
|
5278
|
+
.boxed-command {
|
|
5279
|
+
display: inline-flex;
|
|
5280
|
+
align-items: center;
|
|
5281
|
+
border: 1.5px solid currentColor;
|
|
5282
|
+
padding: 0.12em 0.22em;
|
|
5283
|
+
min-height: 1.25em;
|
|
5284
|
+
}
|
|
5285
|
+
|
|
5286
|
+
.boxed-command > .chain {
|
|
5287
|
+
min-height: auto;
|
|
5288
|
+
}
|
|
5289
|
+
`.trim();
|
|
5290
|
+
function buildBoxedNodeBody(node, buildChain) {
|
|
5291
|
+
const box = document.createElement("span");
|
|
5292
|
+
box.className = "boxed-command";
|
|
5293
|
+
if (node.innerExpr) {
|
|
5294
|
+
box.appendChild(buildChain(node.innerExpr));
|
|
5295
|
+
}
|
|
5296
|
+
return box;
|
|
5297
|
+
}
|
|
5298
|
+
|
|
5262
5299
|
// src/editor/display/frac.ts
|
|
5263
5300
|
var FRAC_CSS = `
|
|
5264
5301
|
.frac {
|
|
@@ -6013,6 +6050,9 @@ function buildNodeBody(node, buildChain, side, digitForm = "western", uiLocale =
|
|
|
6013
6050
|
if (node.kind === "delimiter") {
|
|
6014
6051
|
return buildDelimiterNodeBody(node, buildChain);
|
|
6015
6052
|
}
|
|
6053
|
+
if (node.kind === "boxed") {
|
|
6054
|
+
return buildBoxedNodeBody(node, buildChain);
|
|
6055
|
+
}
|
|
6016
6056
|
if (node.kind === "frac") {
|
|
6017
6057
|
return buildFracNodeBody(node, buildChain);
|
|
6018
6058
|
}
|
|
@@ -6249,6 +6289,8 @@ ${CHARACTER_FONT_CSS}
|
|
|
6249
6289
|
|
|
6250
6290
|
${DELIMITER_CSS}
|
|
6251
6291
|
|
|
6292
|
+
${BOXED_CSS}
|
|
6293
|
+
|
|
6252
6294
|
${FRAC_CSS}
|
|
6253
6295
|
|
|
6254
6296
|
${SQRT_CSS}
|
|
@@ -7528,6 +7570,16 @@ function commandToEditorNode(node) {
|
|
|
7528
7570
|
}
|
|
7529
7571
|
return { editable: true, node: sqrt };
|
|
7530
7572
|
}
|
|
7573
|
+
if (node.name === "\\boxed" && node.optionalArgs.length === 0 && node.mandatoryArgs.length === 1) {
|
|
7574
|
+
const boxed = createBoxedNode();
|
|
7575
|
+
const inner = chainToEditorChain(node.mandatoryArgs[0]);
|
|
7576
|
+
if (!inner.editable) {
|
|
7577
|
+
return inner;
|
|
7578
|
+
}
|
|
7579
|
+
boxed.innerExpr = inner.chain;
|
|
7580
|
+
const scripts = attachScripts(node, boxed);
|
|
7581
|
+
return scripts ?? { editable: true, node: boxed };
|
|
7582
|
+
}
|
|
7531
7583
|
if (node.name === "\\overset" && node.mandatoryArgs.length >= 2) {
|
|
7532
7584
|
const overset = createOversetNode();
|
|
7533
7585
|
const overExpr = chainToEditorChain(node.mandatoryArgs[0]);
|
|
@@ -7811,6 +7863,12 @@ function editorNodeToAstNode(node) {
|
|
|
7811
7863
|
return inner;
|
|
7812
7864
|
}
|
|
7813
7865
|
astNode = new DelimiterNode(node.leftDelimExpr, inner.chain, node.rightDelimExpr);
|
|
7866
|
+
} else if (node.kind === "boxed" && node.innerExpr) {
|
|
7867
|
+
const inner = editorChainToAstChain(node.innerExpr);
|
|
7868
|
+
if (!inner.ok) {
|
|
7869
|
+
return inner;
|
|
7870
|
+
}
|
|
7871
|
+
astNode = new CommandNode("\\boxed", [], [inner.chain]);
|
|
7814
7872
|
} else if (node.kind === "frac" && node.numerator && node.denominator) {
|
|
7815
7873
|
const numerator = editorChainToAstChain(node.numerator);
|
|
7816
7874
|
const denominator = editorChainToAstChain(node.denominator);
|