@drghaliasri/butex 7.3.0 → 7.3.1

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/index.mjs CHANGED
@@ -141,6 +141,12 @@ mjx-container[jax="CHTML"] .butex-preview-mirror {
141
141
  unicode-bidi: isolate;
142
142
  }
143
143
 
144
+ .butex-unit-text,
145
+ .butex-unit-text mjx-utext {
146
+ font-style: normal !important;
147
+ font-weight: 400;
148
+ }
149
+
144
150
  .butex-diwani-command {
145
151
  font-family: ${BUTEX_DIWANI_FONT_STACK};
146
152
  direction: rtl;
@@ -857,6 +863,16 @@ function passthroughArgument(parser, name) {
857
863
  const inner = new TexParserClass(arg, parser.stack.env, parser.configuration).mml();
858
864
  parser.Push(inner);
859
865
  }
866
+ function unitArgument(parser, name) {
867
+ const text = parser.GetArgument(name);
868
+ const node = parser.create(
869
+ "token",
870
+ "mtext",
871
+ { class: "butex-unit-text", "data-butex-unit": text },
872
+ text
873
+ );
874
+ parser.Push(node);
875
+ }
860
876
  function arabvecArgument(parser, name) {
861
877
  const arg = parser.GetArgument(name);
862
878
  const TexParserClass = parser.constructor;
@@ -865,10 +881,11 @@ function arabvecArgument(parser, name) {
865
881
  parser.Push(inner);
866
882
  }
867
883
  var passthroughArgumentTyped = passthroughArgument;
884
+ var unitArgumentTyped = unitArgument;
868
885
  var arabvecArgumentTyped = arabvecArgument;
869
886
  function registerPassthroughCommandMacros(CommandMap) {
870
887
  new CommandMap(COMMAND_MAP7, {
871
- unit: passthroughArgumentTyped,
888
+ unit: unitArgumentTyped,
872
889
  idx: passthroughArgumentTyped,
873
890
  arabvec: arabvecArgumentTyped
874
891
  });
@@ -2928,6 +2945,13 @@ ${CHARACTER_FONT_CSS}
2928
2945
  font-weight: 700;
2929
2946
  }
2930
2947
 
2948
+ .node-value--unit {
2949
+ font-style: normal;
2950
+ text-decoration-line: underline;
2951
+ text-decoration-style: dotted;
2952
+ text-underline-offset: 0.2em;
2953
+ }
2954
+
2931
2955
  .chain {
2932
2956
  display: inline-flex;
2933
2957
  align-items: center;
@@ -3463,8 +3487,9 @@ function createEditorSession(englishTree, arabicTree, activeSide = "arabic") {
3463
3487
  // src/editor/divideOperator.ts
3464
3488
  var DIVIDE_OPERATOR_EN = "/";
3465
3489
  var DIVIDE_OPERATOR_AR = "\\";
3490
+ var DIVIDE_OPERATOR_AR_LATEX = "\\backslash";
3466
3491
  function isDivideOperatorExpr(expr) {
3467
- return expr === DIVIDE_OPERATOR_EN || expr === DIVIDE_OPERATOR_AR;
3492
+ return expr === DIVIDE_OPERATOR_EN || expr === DIVIDE_OPERATOR_AR || expr === DIVIDE_OPERATOR_AR_LATEX;
3468
3493
  }
3469
3494
  function divideOperatorSurfaceExpr(expr, side) {
3470
3495
  if (!isDivideOperatorExpr(expr)) {
@@ -6051,6 +6076,10 @@ function buildBaseNodeBody(node, digitForm = "western", side = "english") {
6051
6076
  if (node.wrapperCommand === "\\boldarabic" || node.wrapperCommand === "\\mathbf") {
6052
6077
  value.classList.add("node-value--bold");
6053
6078
  }
6079
+ if (node.wrapperCommand === "\\unit") {
6080
+ value.classList.add("node-value--unit");
6081
+ value.title = "\u0648\u062D\u062F\u0629 (unit)";
6082
+ }
6054
6083
  }
6055
6084
  const surfaceExpr = node.kind === "operator" ? divideOperatorSurfaceExpr(node.expr, side) : node.expr;
6056
6085
  value.textContent = surfaceExpr === "" ? "\u25A1" : formatDigits(surfaceExpr, digitForm);