@drghaliasri/butex 7.3.2 → 7.3.3

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/react.mjs CHANGED
@@ -1487,6 +1487,30 @@ function renderDivideOperatorLatex(side) {
1487
1487
  return side === "arabic" ? "\\backslash" : DIVIDE_OPERATOR_EN;
1488
1488
  }
1489
1489
 
1490
+ // src/editor/rawOperatorPresentation.ts
1491
+ var RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE = {
1492
+ "<": ">",
1493
+ ">": "<"
1494
+ };
1495
+ function rawOperatorSurfaceExpr(expr, side) {
1496
+ if (isDivideOperatorExpr(expr)) {
1497
+ return divideOperatorSurfaceExpr(expr, side);
1498
+ }
1499
+ if (side === "arabic") {
1500
+ return RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE[expr] ?? expr;
1501
+ }
1502
+ return expr;
1503
+ }
1504
+ function renderRawOperatorLatex(expr, side) {
1505
+ if (isDivideOperatorExpr(expr)) {
1506
+ return renderDivideOperatorLatex(side);
1507
+ }
1508
+ if (side === "arabic" && Object.prototype.hasOwnProperty.call(RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE, expr)) {
1509
+ return `\\butexmirror{${expr}}`;
1510
+ }
1511
+ return expr;
1512
+ }
1513
+
1490
1514
  // src/editor/digits.ts
1491
1515
  var WESTERN = "0123456789";
1492
1516
  var ARABIC_INDIC = "\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669";
@@ -1674,8 +1698,8 @@ function renderNodeEnglish(node, options) {
1674
1698
  }
1675
1699
  return `${renderCharContent(node, options)}${latinScripts(node, options)}`;
1676
1700
  }
1677
- if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
1678
- return `${renderDivideOperatorLatex("english")}${latinScripts(node, options)}`;
1701
+ if (node.kind === "operator") {
1702
+ return `${renderRawOperatorLatex(node.expr, "english")}${latinScripts(node, options)}`;
1679
1703
  }
1680
1704
  return `${formatDigits(node.expr, selectedDigitForm(options))}${latinScripts(node, options)}`;
1681
1705
  }
@@ -1735,8 +1759,8 @@ function renderNodeArabic(node, options) {
1735
1759
  }
1736
1760
  return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
1737
1761
  }
1738
- if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
1739
- return arabicScripts(node, renderDivideOperatorLatex("arabic"), options);
1762
+ if (node.kind === "operator") {
1763
+ return arabicScripts(node, renderRawOperatorLatex(node.expr, "arabic"), options);
1740
1764
  }
1741
1765
  return arabicScripts(node, formatDigits(node.expr, selectedDigitForm(options)), options);
1742
1766
  }
@@ -4430,7 +4454,7 @@ function buildBaseNodeBody(node, digitForm = "western", side = "english") {
4430
4454
  value.title = "\u0648\u062D\u062F\u0629 (unit)";
4431
4455
  }
4432
4456
  }
4433
- const surfaceExpr = node.kind === "operator" ? divideOperatorSurfaceExpr(node.expr, side) : node.expr;
4457
+ const surfaceExpr = node.kind === "operator" ? rawOperatorSurfaceExpr(node.expr, side) : node.expr;
4434
4458
  value.textContent = surfaceExpr === "" ? "\u25A1" : formatDigits(surfaceExpr, digitForm);
4435
4459
  return value;
4436
4460
  }