@drghaliasri/butex 7.2.1 → 7.2.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.
Files changed (48) hide show
  1. package/README.md +1 -0
  2. package/dist/document.d.mts +8 -0
  3. package/dist/document.d.ts +8 -0
  4. package/dist/document.js +37 -2
  5. package/dist/document.js.map +1 -1
  6. package/dist/document.mjs +37 -2
  7. package/dist/document.mjs.map +1 -1
  8. package/dist/document2-cli.js +106 -2
  9. package/dist/document2-cli.js.map +1 -1
  10. package/dist/document2.d.mts +8 -0
  11. package/dist/document2.d.ts +8 -0
  12. package/dist/document2.js +106 -2
  13. package/dist/document2.js.map +1 -1
  14. package/dist/document2.mjs +106 -2
  15. package/dist/document2.mjs.map +1 -1
  16. package/dist/index.d.mts +19 -1
  17. package/dist/index.d.ts +19 -1
  18. package/dist/index.global.js +108 -11
  19. package/dist/index.global.js.map +1 -1
  20. package/dist/index.js +108 -11
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +108 -11
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/react-document.d.mts +2 -0
  25. package/dist/react-document.d.ts +2 -0
  26. package/dist/react-document.js +229 -40
  27. package/dist/react-document.js.map +1 -1
  28. package/dist/react-document.mjs +229 -40
  29. package/dist/react-document.mjs.map +1 -1
  30. package/dist/react-document2-preview.d.mts +2 -0
  31. package/dist/react-document2-preview.d.ts +2 -0
  32. package/dist/react-document2-preview.js +90 -0
  33. package/dist/react-document2-preview.js.map +1 -1
  34. package/dist/react-document2-preview.mjs +90 -0
  35. package/dist/react-document2-preview.mjs.map +1 -1
  36. package/dist/react-document2.d.mts +8 -0
  37. package/dist/react-document2.d.ts +8 -0
  38. package/dist/react-document2.js +229 -40
  39. package/dist/react-document2.js.map +1 -1
  40. package/dist/react-document2.mjs +229 -40
  41. package/dist/react-document2.mjs.map +1 -1
  42. package/dist/react.d.mts +16 -0
  43. package/dist/react.d.ts +16 -0
  44. package/dist/react.js +229 -40
  45. package/dist/react.js.map +1 -1
  46. package/dist/react.mjs +229 -40
  47. package/dist/react.mjs.map +1 -1
  48. package/package.json +1 -1
package/dist/react.mjs CHANGED
@@ -119,6 +119,7 @@ function cloneEditorSession(session) {
119
119
  forceSplitNextLeaf: session.forceSplitNextLeaf,
120
120
  arabicReverseNumberTyping: session.arabicReverseNumberTyping,
121
121
  currentCharacterFont: session.currentCharacterFont ?? "default",
122
+ currentCharacterWrapper: session.currentCharacterWrapper ?? null,
122
123
  currentDigitForm: session.currentDigitForm ?? "western",
123
124
  caret: { ...session.caret },
124
125
  selection: session.selection ? { ...session.selection } : null,
@@ -191,6 +192,7 @@ function createEditorSession(englishTree, arabicTree, activeSide = "arabic") {
191
192
  forceSplitNextLeaf: false,
192
193
  arabicReverseNumberTyping: true,
193
194
  currentCharacterFont: "default",
195
+ currentCharacterWrapper: null,
194
196
  currentDigitForm: "western",
195
197
  caret: {
196
198
  chainId: englishTree.id,
@@ -744,6 +746,15 @@ var ATOMIC_OPERATOR_COMMANDS = {
744
746
  title: "\u0627\u0644\u0644\u0627\u0646\u0647\u0627\u064A\u0629",
745
747
  svg_path: null
746
748
  },
749
+ top: {
750
+ id: "top",
751
+ category: "operators1",
752
+ Tex: "\\top",
753
+ mirror: false,
754
+ Label: "\u22A4",
755
+ title: "\u0627\u0644\u0645\u0646\u0642\u0648\u0644",
756
+ svg_path: null
757
+ },
747
758
  times: {
748
759
  id: "times",
749
760
  category: "operators1",
@@ -1642,6 +1653,14 @@ function renderNodeEnglish(node, options) {
1642
1653
  return `${node.expr}${latinScripts(node, options)}`;
1643
1654
  }
1644
1655
  if (node.kind === "char") {
1656
+ if (node.sourceLatex) {
1657
+ return `${node.sourceLatex}${latinScripts(node, options)}`;
1658
+ }
1659
+ if (node.wrapperCommand) {
1660
+ const expr = formatDigits(node.expr, selectedDigitForm(options));
1661
+ const wrapper = node.wrapperCommand === "\\boldarabic" ? "\\mathbf" : node.wrapperCommand;
1662
+ return `${wrapper}{${escapeText(expr)}}${latinScripts(node, options)}`;
1663
+ }
1645
1664
  return `${renderCharContent(node, options)}${latinScripts(node, options)}`;
1646
1665
  }
1647
1666
  if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
@@ -1695,6 +1714,10 @@ function renderNodeArabic(node, options) {
1695
1714
  if (node.kind === "char") {
1696
1715
  const expr = formatDigits(node.expr, selectedDigitForm(options));
1697
1716
  const content = renderCharContent(node, options);
1717
+ if (node.wrapperCommand) {
1718
+ const wrapper = node.wrapperCommand === "\\mathbf" ? "\\boldarabic" : node.wrapperCommand;
1719
+ return arabicScripts(node, `${wrapper}{${content}}`, options);
1720
+ }
1698
1721
  return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
1699
1722
  }
1700
1723
  if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
@@ -2923,6 +2946,16 @@ function markExprSync(session, nodeId) {
2923
2946
  }
2924
2947
  session.sync[nodeId].expr = english.node.expr === arabic.node.expr ? "synced" : "diverged";
2925
2948
  }
2949
+ function clearSourceIdentity(session, nodeId) {
2950
+ const english = findNodeById(session.englishTree, nodeId);
2951
+ const arabic = findNodeById(session.arabicTree, nodeId);
2952
+ if (english) {
2953
+ delete english.node.sourceLatex;
2954
+ }
2955
+ if (arabic) {
2956
+ delete arabic.node.sourceLatex;
2957
+ }
2958
+ }
2926
2959
  function syncSelectionToCaret(session) {
2927
2960
  const activeKey = activeTreeKey(session.activeSide);
2928
2961
  const tree = session[activeKey];
@@ -3506,7 +3539,10 @@ function insertLeaf(session, kind, expr) {
3506
3539
  const next = cloneEditorSession(session);
3507
3540
  const englishNode = createEditorNode(kind, expr);
3508
3541
  const arabicNode = createEditorNode(kind, expr);
3509
- if (kind === "char" && (next.currentCharacterFont ?? "default") !== "default") {
3542
+ if (kind === "char" && next.currentCharacterWrapper === "\\boldarabic") {
3543
+ englishNode.wrapperCommand = "\\boldarabic";
3544
+ arabicNode.wrapperCommand = "\\boldarabic";
3545
+ } else if (kind === "char" && (next.currentCharacterFont ?? "default") !== "default") {
3510
3546
  englishNode.characterFont = next.currentCharacterFont;
3511
3547
  arabicNode.characterFont = next.currentCharacterFont;
3512
3548
  }
@@ -3521,8 +3557,12 @@ function insertLeaf(session, kind, expr) {
3521
3557
  function shouldReverseArabicNumber(session) {
3522
3558
  return session.activeSide === "arabic" && session.arabicReverseNumberTyping;
3523
3559
  }
3524
- function characterFontOf(node) {
3525
- return node.kind === "char" ? node.characterFont ?? "default" : "default";
3560
+ function characterTypingStyleOf(node) {
3561
+ if (node.kind !== "char") return "none";
3562
+ return node.wrapperCommand ? `wrapper:${node.wrapperCommand}` : `font:${node.characterFont ?? "default"}`;
3563
+ }
3564
+ function currentCharacterTypingStyle(session) {
3565
+ return session.currentCharacterWrapper ? `wrapper:${session.currentCharacterWrapper}` : `font:${session.currentCharacterFont ?? "default"}`;
3526
3566
  }
3527
3567
  function tryMergeLeafTyping(session, kind, fragment) {
3528
3568
  const engLocated = findChainById(session.englishTree, session.caret.chainId);
@@ -3535,14 +3575,14 @@ function tryMergeLeafTyping(session, kind, fragment) {
3535
3575
  let prepend = false;
3536
3576
  if (i > 0) {
3537
3577
  const prev = nodes[i - 1];
3538
- if (prev.kind === kind && (kind !== "char" || characterFontOf(prev) === (session.currentCharacterFont ?? "default"))) {
3578
+ if (prev.kind === kind && (kind !== "char" || characterTypingStyleOf(prev) === currentCharacterTypingStyle(session))) {
3539
3579
  targetId = prev.id;
3540
3580
  prepend = false;
3541
3581
  }
3542
3582
  }
3543
3583
  if (!targetId && i < nodes.length) {
3544
3584
  const fwd = nodes[i];
3545
- if (fwd.kind === kind && (kind !== "char" || characterFontOf(fwd) === (session.currentCharacterFont ?? "default"))) {
3585
+ if (fwd.kind === kind && (kind !== "char" || characterTypingStyleOf(fwd) === currentCharacterTypingStyle(session))) {
3546
3586
  targetId = fwd.id;
3547
3587
  prepend = true;
3548
3588
  }
@@ -3563,6 +3603,7 @@ function tryMergeLeafTyping(session, kind, fragment) {
3563
3603
  englishHit.node.expr = `${englishHit.node.expr}${fragment}`;
3564
3604
  arabicHit.node.expr = `${arabicHit.node.expr}${fragment}`;
3565
3605
  }
3606
+ clearSourceIdentity(session, targetId);
3566
3607
  markExprSync(session, targetId);
3567
3608
  return true;
3568
3609
  }
@@ -3601,9 +3642,17 @@ function breakLeafTyping(session) {
3601
3642
  function setCurrentCharacterFont(session, fontId) {
3602
3643
  const next = cloneEditorSession(session);
3603
3644
  next.currentCharacterFont = fontId;
3645
+ next.currentCharacterWrapper = null;
3604
3646
  appendDebug(next, "setCurrentCharacterFont", fontId);
3605
3647
  return next;
3606
3648
  }
3649
+ function setCurrentBoldCharacterStyle(session) {
3650
+ const next = cloneEditorSession(session);
3651
+ next.currentCharacterFont = "default";
3652
+ next.currentCharacterWrapper = "\\boldarabic";
3653
+ appendDebug(next, "setCurrentBoldCharacterStyle", "\\boldarabic");
3654
+ return next;
3655
+ }
3607
3656
  function toggleTakweenCharacterFont(session) {
3608
3657
  return setCurrentCharacterFont(session, (session.currentCharacterFont ?? "default") === "takween" ? "default" : "takween");
3609
3658
  }
@@ -4152,6 +4201,7 @@ function deleteBackward(session) {
4152
4201
  englishHit.node.expr = englishHit.node.expr.slice(0, -1);
4153
4202
  arabicHit.node.expr = arabicHit.node.expr.slice(0, -1);
4154
4203
  }
4204
+ clearSourceIdentity(next, id);
4155
4205
  markExprSync(next, id);
4156
4206
  next.selectedStructureNodeId = null;
4157
4207
  syncSelectionToCaret(next);
@@ -4201,6 +4251,7 @@ function deleteForward(session) {
4201
4251
  englishHit.node.expr = englishHit.node.expr.slice(1);
4202
4252
  arabicHit.node.expr = arabicHit.node.expr.slice(1);
4203
4253
  }
4254
+ clearSourceIdentity(next, node.id);
4204
4255
  markExprSync(next, node.id);
4205
4256
  next.selectedStructureNodeId = null;
4206
4257
  syncSelectionToCaret(next);
@@ -4230,6 +4281,7 @@ function createStarterSession() {
4230
4281
  forceSplitNextLeaf: false,
4231
4282
  arabicReverseNumberTyping: true,
4232
4283
  currentCharacterFont: "default",
4284
+ currentCharacterWrapper: null,
4233
4285
  currentDigitForm: "western",
4234
4286
  caret: {
4235
4287
  chainId: englishRoot.id,
@@ -4355,6 +4407,9 @@ function buildBaseNodeBody(node, digitForm = "western", side = "english") {
4355
4407
  if (cssClass) {
4356
4408
  value.classList.add(cssClass);
4357
4409
  }
4410
+ if (node.wrapperCommand === "\\boldarabic" || node.wrapperCommand === "\\mathbf") {
4411
+ value.classList.add("node-value--bold");
4412
+ }
4358
4413
  }
4359
4414
  const surfaceExpr = node.kind === "operator" ? divideOperatorSurfaceExpr(node.expr, side) : node.expr;
4360
4415
  value.textContent = surfaceExpr === "" ? "\u25A1" : formatDigits(surfaceExpr, digitForm);
@@ -5275,6 +5330,11 @@ ${BUTEX_FONT_FACE_CSS}
5275
5330
 
5276
5331
  ${CHARACTER_FONT_CSS}
5277
5332
 
5333
+ .node-value--bold {
5334
+ font-family: var(--font-display-ar, Amiri), "Noto Serif Arabic", serif;
5335
+ font-weight: 700;
5336
+ }
5337
+
5278
5338
  .chain {
5279
5339
  display: inline-flex;
5280
5340
  align-items: center;
@@ -6267,6 +6327,10 @@ function createEditorRuntime(options) {
6267
6327
  applyTransient((prev) => setCurrentCharacterFont(prev, fontId));
6268
6328
  focusInput();
6269
6329
  },
6330
+ setCurrentBoldCharacterStyle: () => {
6331
+ applyTransient((prev) => setCurrentBoldCharacterStyle(prev));
6332
+ focusInput();
6333
+ },
6270
6334
  setCurrentDigitForm: (digitForm) => {
6271
6335
  applyStructural((prev) => setCurrentDigitForm(prev, digitForm));
6272
6336
  focusInput();
@@ -7439,6 +7503,13 @@ ${MATRIX_PICKER_CSS}
7439
7503
  box-shadow: 0 0 0 3px var(--butex-focus-shadow);
7440
7504
  }
7441
7505
 
7506
+ .butex-widget .font-mode-btn--bold,
7507
+ .butex-widget .character-font-option--bold,
7508
+ .butex-widget .butex-widget__command-sheet .character-font-option--bold {
7509
+ font-family: var(--font-display-ar, Amiri), "Noto Serif Arabic", serif;
7510
+ font-weight: 700;
7511
+ }
7512
+
7442
7513
  .butex-widget .font-mode-btn--takween,
7443
7514
  .butex-widget .character-font-option--takween,
7444
7515
  .butex-widget .butex-widget__command-sheet .character-font-option--takween {
@@ -8231,6 +8302,7 @@ var BaseAstNode = class {
8231
8302
  superscript;
8232
8303
  subscript;
8233
8304
  nodeType;
8305
+ sourceLatex;
8234
8306
  constructor(state = null) {
8235
8307
  if (state === null) {
8236
8308
  state = new State();
@@ -8239,6 +8311,7 @@ var BaseAstNode = class {
8239
8311
  this.superscript = null;
8240
8312
  this.subscript = null;
8241
8313
  this.nodeType = this.constructor.name;
8314
+ this.sourceLatex = null;
8242
8315
  }
8243
8316
  latex() {
8244
8317
  throw new Error("NotImplementedError");
@@ -8427,6 +8500,7 @@ ${this.closing}`;
8427
8500
  }
8428
8501
  };
8429
8502
  function parseScripts(node, json, mode) {
8503
+ node.sourceLatex = typeof json.source_latex === "string" && json.source_latex.length > 0 ? json.source_latex : null;
8430
8504
  if (json.superscript) {
8431
8505
  node.superscript = parseChain(json.superscript, mode);
8432
8506
  }
@@ -8566,7 +8640,8 @@ function fromMathObjectJson(json, mode = "english") {
8566
8640
  function scriptsToJson(node, path) {
8567
8641
  return {
8568
8642
  ...node.superscript ? { superscript: chainToJson(node.superscript, `${path}.superscript`) } : {},
8569
- ...node.subscript ? { subscript: chainToJson(node.subscript, `${path}.subscript`) } : {}
8643
+ ...node.subscript ? { subscript: chainToJson(node.subscript, `${path}.subscript`) } : {},
8644
+ ...node.sourceLatex ? { source_latex: node.sourceLatex } : {}
8570
8645
  };
8571
8646
  }
8572
8647
  function nodeToJson(node, path) {
@@ -8702,6 +8777,10 @@ var CHAR_FONT_EXPORT_TEX = Object.fromEntries(
8702
8777
  function charEditorNodeToAstNode(node) {
8703
8778
  const font = node.characterFont ?? "default";
8704
8779
  const charNode = new CharNode(node.expr);
8780
+ if (node.wrapperCommand) {
8781
+ const wrapper = node.wrapperCommand === "\\boldarabic" ? "\\mathbf" : node.wrapperCommand;
8782
+ return new CommandNode(wrapper, [], [new ChainNode([charNode])]);
8783
+ }
8705
8784
  if (font === "default") {
8706
8785
  return charNode;
8707
8786
  }
@@ -8728,6 +8807,9 @@ function cloneChainWithFreshIds(chain) {
8728
8807
  return structuredClone(chain);
8729
8808
  }
8730
8809
  function attachScripts(astNode, editorNode) {
8810
+ if (astNode.sourceLatex) {
8811
+ editorNode.sourceLatex = astNode.sourceLatex;
8812
+ }
8731
8813
  if (astNode.superscript) {
8732
8814
  const sup = chainToEditorChain(astNode.superscript);
8733
8815
  if (!sup.editable) {
@@ -8854,6 +8936,49 @@ function charFromTextLikeCommand(node) {
8854
8936
  const scripts = attachScripts(node, editorNode);
8855
8937
  return scripts ?? { editable: true, node: editorNode };
8856
8938
  }
8939
+ function singleCommandChar(node) {
8940
+ if (node.optionalArgs.length > 0 || node.mandatoryArgs.length !== 1) {
8941
+ return null;
8942
+ }
8943
+ const arg = node.mandatoryArgs[0];
8944
+ if (arg.chain.length !== 1 || !(arg.chain[0] instanceof CharNode)) {
8945
+ return null;
8946
+ }
8947
+ return arg.chain[0];
8948
+ }
8949
+ function wrappedAtomicCommandId(node) {
8950
+ if (node.name !== "\\mathbb" && node.name !== "\\mathrm") {
8951
+ return null;
8952
+ }
8953
+ const child = singleCommandChar(node);
8954
+ if (!child) {
8955
+ return null;
8956
+ }
8957
+ return commandIdForTex(`${node.name}{${child.expr}}`);
8958
+ }
8959
+ function editableWrapperCommand(node) {
8960
+ if (node.name !== "\\mathtt" && node.name !== "\\mathsf" && node.name !== "\\unit" && node.name !== "\\mathbf" && node.name !== "\\boldarabic") {
8961
+ return null;
8962
+ }
8963
+ const child = singleCommandChar(node);
8964
+ if (!child) {
8965
+ return null;
8966
+ }
8967
+ const normalized = normalizeCharImportExpr(child.expr);
8968
+ const editorNode = createEditorNode("char", normalized.expr);
8969
+ if (normalized.characterFont !== "default") {
8970
+ editorNode.characterFont = normalized.characterFont;
8971
+ }
8972
+ editorNode.wrapperCommand = node.name === "\\mathtt" ? "\\mathtt" : node.name === "\\mathbf" ? "\\mathbf" : node.name === "\\boldarabic" ? "\\boldarabic" : "\\unit";
8973
+ const scripts = attachScripts(node, editorNode);
8974
+ if (scripts) {
8975
+ return scripts;
8976
+ }
8977
+ if (!editorNode.sourceLatex && node.name === "\\mathsf") {
8978
+ editorNode.sourceLatex = `\\mathsf{${child.expr}}`;
8979
+ }
8980
+ return { editable: true, node: editorNode };
8981
+ }
8857
8982
  function commandToEditorNode(node) {
8858
8983
  if (node.name === "\\frac" && node.mandatoryArgs.length >= 2) {
8859
8984
  const frac = createFracNode();
@@ -8943,6 +9068,19 @@ function commandToEditorNode(node) {
8943
9068
  }
8944
9069
  return { editable: true, node: accent };
8945
9070
  }
9071
+ const wrappedAtomicId = wrappedAtomicCommandId(node);
9072
+ if (wrappedAtomicId) {
9073
+ const atomic = createEditorNode("atomicCommand", wrappedAtomicId);
9074
+ const scripts = attachScripts(node, atomic);
9075
+ if (scripts) {
9076
+ return scripts;
9077
+ }
9078
+ return { editable: true, node: atomic };
9079
+ }
9080
+ const wrapper = editableWrapperCommand(node);
9081
+ if (wrapper) {
9082
+ return wrapper;
9083
+ }
8946
9084
  const atomicId = commandIdForTex(node.name);
8947
9085
  if (atomicId && node.optionalArgs.length === 0 && node.mandatoryArgs.length === 0) {
8948
9086
  const atomic = createEditorNode("atomicCommand", atomicId);
@@ -9222,7 +9360,13 @@ function editorNodeToAstNode(node) {
9222
9360
  if (!tex) {
9223
9361
  return { ok: false, reason: `\u0623\u0645\u0631 \u0631\u064A\u0627\u0636\u064A \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645 \u062D\u0627\u0644\u064A\u0627: ${node.expr}` };
9224
9362
  }
9225
- astNode = new CommandNode(tex);
9363
+ if (node.expr === "ad") {
9364
+ astNode = new CommandNode("\\mathrm", [], [new ChainNode([new CharNode("d")])]);
9365
+ } else if (["N", "Z", "Q", "R", "C", "H"].includes(node.expr)) {
9366
+ astNode = new CommandNode("\\mathbb", [], [new ChainNode([new CharNode(node.expr)])]);
9367
+ } else {
9368
+ astNode = new CommandNode(tex);
9369
+ }
9226
9370
  } else if (node.kind === "atomicOperatorCommand") {
9227
9371
  const tex = atomicOperatorCommandSpec(node.expr)?.Tex;
9228
9372
  if (!tex) {
@@ -9239,6 +9383,9 @@ function editorNodeToAstNode(node) {
9239
9383
  } else {
9240
9384
  return { ok: false, reason: `\u0639\u0642\u062F\u0629 \u0631\u064A\u0627\u0636\u064A\u0629 \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645\u0629 \u062D\u0627\u0644\u064A\u0627: ${node.kind}` };
9241
9385
  }
9386
+ if (node.sourceLatex) {
9387
+ astNode.sourceLatex = node.sourceLatex;
9388
+ }
9242
9389
  const scripts = attachAstScripts(node, astNode);
9243
9390
  return scripts ?? { ok: true, node: astNode };
9244
9391
  }
@@ -9464,6 +9611,9 @@ function alignmentTitle(alignment, messages) {
9464
9611
  if (alignment === "r") return messages.alignColumnRight;
9465
9612
  return messages.alignColumnCenter;
9466
9613
  }
9614
+ function boldCharacterStyleLabel(uiLocale) {
9615
+ return uiLocale === "ar" ? "\u0639\u0631\u064A\u0636" : "Bold";
9616
+ }
9467
9617
  function characterFontTitle(fontId, messages) {
9468
9618
  const key = characterFontSpec(fontId).titleKey;
9469
9619
  return messages[key] ?? messages.defaultFont;
@@ -9839,18 +9989,31 @@ function EquationMobileToolbar({
9839
9989
  sheetView === "typography" ? /* @__PURE__ */ jsxs(Fragment, { children: [
9840
9990
  /* @__PURE__ */ jsxs("section", { className: "butex-widget__sheet-section", children: [
9841
9991
  /* @__PURE__ */ jsx("h4", { children: messages.chooseWritingFont }),
9842
- /* @__PURE__ */ jsx("div", { className: "butex-widget__sheet-choice-row", children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx(
9843
- "button",
9844
- {
9845
- type: "button",
9846
- className: `character-font-option--${option.id}`,
9847
- "aria-pressed": state.characterFont === option.id,
9848
- title: characterFontTitle(option.id, messages),
9849
- onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentCharacterFont(option.id)),
9850
- children: option.label
9851
- },
9852
- option.id
9853
- )) })
9992
+ /* @__PURE__ */ jsxs("div", { className: "butex-widget__sheet-choice-row", children: [
9993
+ /* @__PURE__ */ jsx(
9994
+ "button",
9995
+ {
9996
+ type: "button",
9997
+ className: "character-font-option--bold",
9998
+ "aria-pressed": state.boldCharacterStyle,
9999
+ title: boldCharacterStyleLabel(uiLocale),
10000
+ onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentBoldCharacterStyle()),
10001
+ children: boldCharacterStyleLabel(uiLocale)
10002
+ }
10003
+ ),
10004
+ CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx(
10005
+ "button",
10006
+ {
10007
+ type: "button",
10008
+ className: `character-font-option--${option.id}`,
10009
+ "aria-pressed": !state.boldCharacterStyle && state.characterFont === option.id,
10010
+ title: characterFontTitle(option.id, messages),
10011
+ onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentCharacterFont(option.id)),
10012
+ children: option.label
10013
+ },
10014
+ option.id
10015
+ ))
10016
+ ] })
9854
10017
  ] }),
9855
10018
  /* @__PURE__ */ jsx(
9856
10019
  "button",
@@ -10170,6 +10333,9 @@ function digitFormLabel(digitForm) {
10170
10333
  function characterFontOption(fontId) {
10171
10334
  return CHARACTER_FONT_OPTIONS.find((option) => option.id === fontId) ?? CHARACTER_FONT_OPTIONS[0];
10172
10335
  }
10336
+ function boldCharacterStyleLabel2(uiLocale) {
10337
+ return uiLocale === "ar" ? "\u0639\u0631\u064A\u0636" : "Bold";
10338
+ }
10173
10339
  function characterFontTitle2(fontId, messages) {
10174
10340
  const key = characterFontSpec(fontId).titleKey;
10175
10341
  return messages[key] ?? messages.defaultFont;
@@ -10274,6 +10440,7 @@ var ButexEditor = forwardRef(
10274
10440
  const [openDesktopMenu, setOpenDesktopMenu] = useState2(null);
10275
10441
  const [selectedDigitForm2, setSelectedDigitForm] = useState2("western");
10276
10442
  const [selectedCharacterFont, setSelectedCharacterFont] = useState2("default");
10443
+ const [boldCharacterStyle, setBoldCharacterStyle] = useState2(initialSession?.currentCharacterWrapper === "\\boldarabic");
10277
10444
  const [activeEditorSide, setActiveEditorSide] = useState2("arabic");
10278
10445
  const [compactPreviewOpen, setCompactPreviewOpen] = useState2(false);
10279
10446
  const [compactControlState, setCompactControlState] = useState2({
@@ -10426,6 +10593,7 @@ ${arabic || currentMessages.empty}`;
10426
10593
  runtimeRef.current?.setSession(next);
10427
10594
  setSelectedDigitForm(next.currentDigitForm ?? "western");
10428
10595
  setSelectedCharacterFont(next.currentCharacterFont ?? "default");
10596
+ setBoldCharacterStyle(next.currentCharacterWrapper === "\\boldarabic");
10429
10597
  setActiveEditorSide(next.activeSide);
10430
10598
  onSessionChangeRef.current?.(next);
10431
10599
  setDebugImportError("");
@@ -10467,6 +10635,7 @@ ${arabic || currentMessages.empty}`;
10467
10635
  onSessionChange: (session) => {
10468
10636
  setSelectedDigitForm(session.currentDigitForm ?? "western");
10469
10637
  setSelectedCharacterFont(session.currentCharacterFont ?? "default");
10638
+ setBoldCharacterStyle(session.currentCharacterWrapper === "\\boldarabic");
10470
10639
  setActiveEditorSide(session.activeSide);
10471
10640
  const hasSelection = Boolean(session.selection && session.selection.anchorIndex !== session.selection.focusIndex);
10472
10641
  const nextCompactState = {
@@ -10549,6 +10718,7 @@ ${arabic || currentMessages.empty}`;
10549
10718
  ...compactControlState,
10550
10719
  activeSide: activeEditorSide,
10551
10720
  characterFont: selectedCharacterFont,
10721
+ boldCharacterStyle,
10552
10722
  digitForm: selectedDigitForm2
10553
10723
  };
10554
10724
  return /* @__PURE__ */ jsx2(
@@ -11575,35 +11745,54 @@ ${arabic || currentMessages.empty}`;
11575
11745
  {
11576
11746
  ref: characterFontBtnRef,
11577
11747
  id: "select-character-font",
11578
- className: `icon-btn font-mode-btn font-mode-btn--${selectedCharacterFont}`,
11748
+ className: `icon-btn font-mode-btn font-mode-btn--${boldCharacterStyle ? "bold" : selectedCharacterFont}`,
11579
11749
  type: "button",
11580
- title: characterFontTitle2(selectedCharacterFont, messages),
11750
+ title: boldCharacterStyle ? boldCharacterStyleLabel2(uiLocale) : characterFontTitle2(selectedCharacterFont, messages),
11581
11751
  "aria-label": messages.chooseWritingFont,
11582
11752
  "aria-haspopup": "listbox",
11583
11753
  "aria-expanded": characterFontMenuOpen,
11584
11754
  onClick: () => setCharacterFontMenuOpen((open) => !open),
11585
- children: characterFontOption(selectedCharacterFont).label
11755
+ children: boldCharacterStyle ? boldCharacterStyleLabel2(uiLocale) : characterFontOption(selectedCharacterFont).label
11586
11756
  }
11587
11757
  ),
11588
- /* @__PURE__ */ jsx2("div", { className: "character-font-options", role: "listbox", "aria-label": messages.chooseWritingFont, hidden: !characterFontMenuOpen, children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx2(
11589
- "button",
11590
- {
11591
- type: "button",
11592
- role: "option",
11593
- "aria-selected": selectedCharacterFont === option.id,
11594
- className: `character-font-option character-font-option--${option.id}`,
11595
- title: characterFontTitle2(option.id, messages),
11596
- onMouseDown: (event) => event.preventDefault(),
11597
- onClick: () => {
11598
- runtimeRef.current?.setCurrentCharacterFont(option.id);
11599
- setSelectedCharacterFont(option.id);
11600
- setCharacterFontMenuOpen(false);
11601
- focusSurface();
11758
+ /* @__PURE__ */ jsxs2("div", { className: "character-font-options", role: "listbox", "aria-label": messages.chooseWritingFont, hidden: !characterFontMenuOpen, children: [
11759
+ /* @__PURE__ */ jsx2(
11760
+ "button",
11761
+ {
11762
+ type: "button",
11763
+ role: "option",
11764
+ "aria-selected": boldCharacterStyle,
11765
+ className: "character-font-option character-font-option--bold",
11766
+ title: boldCharacterStyleLabel2(uiLocale),
11767
+ onMouseDown: (event) => event.preventDefault(),
11768
+ onClick: () => {
11769
+ runtimeRef.current?.setCurrentBoldCharacterStyle();
11770
+ setCharacterFontMenuOpen(false);
11771
+ focusSurface();
11772
+ },
11773
+ children: boldCharacterStyleLabel2(uiLocale)
11774
+ }
11775
+ ),
11776
+ CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx2(
11777
+ "button",
11778
+ {
11779
+ type: "button",
11780
+ role: "option",
11781
+ "aria-selected": !boldCharacterStyle && selectedCharacterFont === option.id,
11782
+ className: `character-font-option character-font-option--${option.id}`,
11783
+ title: characterFontTitle2(option.id, messages),
11784
+ onMouseDown: (event) => event.preventDefault(),
11785
+ onClick: () => {
11786
+ runtimeRef.current?.setCurrentCharacterFont(option.id);
11787
+ setSelectedCharacterFont(option.id);
11788
+ setCharacterFontMenuOpen(false);
11789
+ focusSurface();
11790
+ },
11791
+ children: option.label
11602
11792
  },
11603
- children: option.label
11604
- },
11605
- option.id
11606
- )) })
11793
+ option.id
11794
+ ))
11795
+ ] })
11607
11796
  ]
11608
11797
  }
11609
11798
  ),