@drghaliasri/butex 7.2.0 → 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 +38 -2
  5. package/dist/document.js.map +1 -1
  6. package/dist/document.mjs +38 -2
  7. package/dist/document.mjs.map +1 -1
  8. package/dist/document2-cli.js +107 -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 +107 -2
  13. package/dist/document2.js.map +1 -1
  14. package/dist/document2.mjs +107 -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 +109 -11
  19. package/dist/index.global.js.map +1 -1
  20. package/dist/index.js +109 -11
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +109 -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 +230 -40
  27. package/dist/react-document.js.map +1 -1
  28. package/dist/react-document.mjs +230 -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 +91 -0
  33. package/dist/react-document2-preview.js.map +1 -1
  34. package/dist/react-document2-preview.mjs +91 -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 +230 -40
  39. package/dist/react-document2.js.map +1 -1
  40. package/dist/react-document2.mjs +230 -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 +230 -40
  45. package/dist/react.js.map +1 -1
  46. package/dist/react.mjs +230 -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",
@@ -1441,6 +1452,7 @@ var CHARACTER_FONT_SPECS = [
1441
1452
  latexFontCommand: "\\maghribi",
1442
1453
  latexFontFamily: "Almaghribi Warsh Quran",
1443
1454
  browserFontStack: '"Almaghribi Warsh Quran", Amiri, "Segoe UI", Tahoma, sans-serif',
1455
+ importAliases: ["\\maghribi"],
1444
1456
  svgLayoutKey: "maghribi"
1445
1457
  }
1446
1458
  ];
@@ -1641,6 +1653,14 @@ function renderNodeEnglish(node, options) {
1641
1653
  return `${node.expr}${latinScripts(node, options)}`;
1642
1654
  }
1643
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
+ }
1644
1664
  return `${renderCharContent(node, options)}${latinScripts(node, options)}`;
1645
1665
  }
1646
1666
  if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
@@ -1694,6 +1714,10 @@ function renderNodeArabic(node, options) {
1694
1714
  if (node.kind === "char") {
1695
1715
  const expr = formatDigits(node.expr, selectedDigitForm(options));
1696
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
+ }
1697
1721
  return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
1698
1722
  }
1699
1723
  if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
@@ -2922,6 +2946,16 @@ function markExprSync(session, nodeId) {
2922
2946
  }
2923
2947
  session.sync[nodeId].expr = english.node.expr === arabic.node.expr ? "synced" : "diverged";
2924
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
+ }
2925
2959
  function syncSelectionToCaret(session) {
2926
2960
  const activeKey = activeTreeKey(session.activeSide);
2927
2961
  const tree = session[activeKey];
@@ -3505,7 +3539,10 @@ function insertLeaf(session, kind, expr) {
3505
3539
  const next = cloneEditorSession(session);
3506
3540
  const englishNode = createEditorNode(kind, expr);
3507
3541
  const arabicNode = createEditorNode(kind, expr);
3508
- 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") {
3509
3546
  englishNode.characterFont = next.currentCharacterFont;
3510
3547
  arabicNode.characterFont = next.currentCharacterFont;
3511
3548
  }
@@ -3520,8 +3557,12 @@ function insertLeaf(session, kind, expr) {
3520
3557
  function shouldReverseArabicNumber(session) {
3521
3558
  return session.activeSide === "arabic" && session.arabicReverseNumberTyping;
3522
3559
  }
3523
- function characterFontOf(node) {
3524
- 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"}`;
3525
3566
  }
3526
3567
  function tryMergeLeafTyping(session, kind, fragment) {
3527
3568
  const engLocated = findChainById(session.englishTree, session.caret.chainId);
@@ -3534,14 +3575,14 @@ function tryMergeLeafTyping(session, kind, fragment) {
3534
3575
  let prepend = false;
3535
3576
  if (i > 0) {
3536
3577
  const prev = nodes[i - 1];
3537
- if (prev.kind === kind && (kind !== "char" || characterFontOf(prev) === (session.currentCharacterFont ?? "default"))) {
3578
+ if (prev.kind === kind && (kind !== "char" || characterTypingStyleOf(prev) === currentCharacterTypingStyle(session))) {
3538
3579
  targetId = prev.id;
3539
3580
  prepend = false;
3540
3581
  }
3541
3582
  }
3542
3583
  if (!targetId && i < nodes.length) {
3543
3584
  const fwd = nodes[i];
3544
- if (fwd.kind === kind && (kind !== "char" || characterFontOf(fwd) === (session.currentCharacterFont ?? "default"))) {
3585
+ if (fwd.kind === kind && (kind !== "char" || characterTypingStyleOf(fwd) === currentCharacterTypingStyle(session))) {
3545
3586
  targetId = fwd.id;
3546
3587
  prepend = true;
3547
3588
  }
@@ -3562,6 +3603,7 @@ function tryMergeLeafTyping(session, kind, fragment) {
3562
3603
  englishHit.node.expr = `${englishHit.node.expr}${fragment}`;
3563
3604
  arabicHit.node.expr = `${arabicHit.node.expr}${fragment}`;
3564
3605
  }
3606
+ clearSourceIdentity(session, targetId);
3565
3607
  markExprSync(session, targetId);
3566
3608
  return true;
3567
3609
  }
@@ -3600,9 +3642,17 @@ function breakLeafTyping(session) {
3600
3642
  function setCurrentCharacterFont(session, fontId) {
3601
3643
  const next = cloneEditorSession(session);
3602
3644
  next.currentCharacterFont = fontId;
3645
+ next.currentCharacterWrapper = null;
3603
3646
  appendDebug(next, "setCurrentCharacterFont", fontId);
3604
3647
  return next;
3605
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
+ }
3606
3656
  function toggleTakweenCharacterFont(session) {
3607
3657
  return setCurrentCharacterFont(session, (session.currentCharacterFont ?? "default") === "takween" ? "default" : "takween");
3608
3658
  }
@@ -4151,6 +4201,7 @@ function deleteBackward(session) {
4151
4201
  englishHit.node.expr = englishHit.node.expr.slice(0, -1);
4152
4202
  arabicHit.node.expr = arabicHit.node.expr.slice(0, -1);
4153
4203
  }
4204
+ clearSourceIdentity(next, id);
4154
4205
  markExprSync(next, id);
4155
4206
  next.selectedStructureNodeId = null;
4156
4207
  syncSelectionToCaret(next);
@@ -4200,6 +4251,7 @@ function deleteForward(session) {
4200
4251
  englishHit.node.expr = englishHit.node.expr.slice(1);
4201
4252
  arabicHit.node.expr = arabicHit.node.expr.slice(1);
4202
4253
  }
4254
+ clearSourceIdentity(next, node.id);
4203
4255
  markExprSync(next, node.id);
4204
4256
  next.selectedStructureNodeId = null;
4205
4257
  syncSelectionToCaret(next);
@@ -4229,6 +4281,7 @@ function createStarterSession() {
4229
4281
  forceSplitNextLeaf: false,
4230
4282
  arabicReverseNumberTyping: true,
4231
4283
  currentCharacterFont: "default",
4284
+ currentCharacterWrapper: null,
4232
4285
  currentDigitForm: "western",
4233
4286
  caret: {
4234
4287
  chainId: englishRoot.id,
@@ -4354,6 +4407,9 @@ function buildBaseNodeBody(node, digitForm = "western", side = "english") {
4354
4407
  if (cssClass) {
4355
4408
  value.classList.add(cssClass);
4356
4409
  }
4410
+ if (node.wrapperCommand === "\\boldarabic" || node.wrapperCommand === "\\mathbf") {
4411
+ value.classList.add("node-value--bold");
4412
+ }
4357
4413
  }
4358
4414
  const surfaceExpr = node.kind === "operator" ? divideOperatorSurfaceExpr(node.expr, side) : node.expr;
4359
4415
  value.textContent = surfaceExpr === "" ? "\u25A1" : formatDigits(surfaceExpr, digitForm);
@@ -5274,6 +5330,11 @@ ${BUTEX_FONT_FACE_CSS}
5274
5330
 
5275
5331
  ${CHARACTER_FONT_CSS}
5276
5332
 
5333
+ .node-value--bold {
5334
+ font-family: var(--font-display-ar, Amiri), "Noto Serif Arabic", serif;
5335
+ font-weight: 700;
5336
+ }
5337
+
5277
5338
  .chain {
5278
5339
  display: inline-flex;
5279
5340
  align-items: center;
@@ -6266,6 +6327,10 @@ function createEditorRuntime(options) {
6266
6327
  applyTransient((prev) => setCurrentCharacterFont(prev, fontId));
6267
6328
  focusInput();
6268
6329
  },
6330
+ setCurrentBoldCharacterStyle: () => {
6331
+ applyTransient((prev) => setCurrentBoldCharacterStyle(prev));
6332
+ focusInput();
6333
+ },
6269
6334
  setCurrentDigitForm: (digitForm) => {
6270
6335
  applyStructural((prev) => setCurrentDigitForm(prev, digitForm));
6271
6336
  focusInput();
@@ -7438,6 +7503,13 @@ ${MATRIX_PICKER_CSS}
7438
7503
  box-shadow: 0 0 0 3px var(--butex-focus-shadow);
7439
7504
  }
7440
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
+
7441
7513
  .butex-widget .font-mode-btn--takween,
7442
7514
  .butex-widget .character-font-option--takween,
7443
7515
  .butex-widget .butex-widget__command-sheet .character-font-option--takween {
@@ -8230,6 +8302,7 @@ var BaseAstNode = class {
8230
8302
  superscript;
8231
8303
  subscript;
8232
8304
  nodeType;
8305
+ sourceLatex;
8233
8306
  constructor(state = null) {
8234
8307
  if (state === null) {
8235
8308
  state = new State();
@@ -8238,6 +8311,7 @@ var BaseAstNode = class {
8238
8311
  this.superscript = null;
8239
8312
  this.subscript = null;
8240
8313
  this.nodeType = this.constructor.name;
8314
+ this.sourceLatex = null;
8241
8315
  }
8242
8316
  latex() {
8243
8317
  throw new Error("NotImplementedError");
@@ -8426,6 +8500,7 @@ ${this.closing}`;
8426
8500
  }
8427
8501
  };
8428
8502
  function parseScripts(node, json, mode) {
8503
+ node.sourceLatex = typeof json.source_latex === "string" && json.source_latex.length > 0 ? json.source_latex : null;
8429
8504
  if (json.superscript) {
8430
8505
  node.superscript = parseChain(json.superscript, mode);
8431
8506
  }
@@ -8565,7 +8640,8 @@ function fromMathObjectJson(json, mode = "english") {
8565
8640
  function scriptsToJson(node, path) {
8566
8641
  return {
8567
8642
  ...node.superscript ? { superscript: chainToJson(node.superscript, `${path}.superscript`) } : {},
8568
- ...node.subscript ? { subscript: chainToJson(node.subscript, `${path}.subscript`) } : {}
8643
+ ...node.subscript ? { subscript: chainToJson(node.subscript, `${path}.subscript`) } : {},
8644
+ ...node.sourceLatex ? { source_latex: node.sourceLatex } : {}
8569
8645
  };
8570
8646
  }
8571
8647
  function nodeToJson(node, path) {
@@ -8701,6 +8777,10 @@ var CHAR_FONT_EXPORT_TEX = Object.fromEntries(
8701
8777
  function charEditorNodeToAstNode(node) {
8702
8778
  const font = node.characterFont ?? "default";
8703
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
+ }
8704
8784
  if (font === "default") {
8705
8785
  return charNode;
8706
8786
  }
@@ -8727,6 +8807,9 @@ function cloneChainWithFreshIds(chain) {
8727
8807
  return structuredClone(chain);
8728
8808
  }
8729
8809
  function attachScripts(astNode, editorNode) {
8810
+ if (astNode.sourceLatex) {
8811
+ editorNode.sourceLatex = astNode.sourceLatex;
8812
+ }
8730
8813
  if (astNode.superscript) {
8731
8814
  const sup = chainToEditorChain(astNode.superscript);
8732
8815
  if (!sup.editable) {
@@ -8853,6 +8936,49 @@ function charFromTextLikeCommand(node) {
8853
8936
  const scripts = attachScripts(node, editorNode);
8854
8937
  return scripts ?? { editable: true, node: editorNode };
8855
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
+ }
8856
8982
  function commandToEditorNode(node) {
8857
8983
  if (node.name === "\\frac" && node.mandatoryArgs.length >= 2) {
8858
8984
  const frac = createFracNode();
@@ -8942,6 +9068,19 @@ function commandToEditorNode(node) {
8942
9068
  }
8943
9069
  return { editable: true, node: accent };
8944
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
+ }
8945
9084
  const atomicId = commandIdForTex(node.name);
8946
9085
  if (atomicId && node.optionalArgs.length === 0 && node.mandatoryArgs.length === 0) {
8947
9086
  const atomic = createEditorNode("atomicCommand", atomicId);
@@ -9221,7 +9360,13 @@ function editorNodeToAstNode(node) {
9221
9360
  if (!tex) {
9222
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}` };
9223
9362
  }
9224
- 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
+ }
9225
9370
  } else if (node.kind === "atomicOperatorCommand") {
9226
9371
  const tex = atomicOperatorCommandSpec(node.expr)?.Tex;
9227
9372
  if (!tex) {
@@ -9238,6 +9383,9 @@ function editorNodeToAstNode(node) {
9238
9383
  } else {
9239
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}` };
9240
9385
  }
9386
+ if (node.sourceLatex) {
9387
+ astNode.sourceLatex = node.sourceLatex;
9388
+ }
9241
9389
  const scripts = attachAstScripts(node, astNode);
9242
9390
  return scripts ?? { ok: true, node: astNode };
9243
9391
  }
@@ -9463,6 +9611,9 @@ function alignmentTitle(alignment, messages) {
9463
9611
  if (alignment === "r") return messages.alignColumnRight;
9464
9612
  return messages.alignColumnCenter;
9465
9613
  }
9614
+ function boldCharacterStyleLabel(uiLocale) {
9615
+ return uiLocale === "ar" ? "\u0639\u0631\u064A\u0636" : "Bold";
9616
+ }
9466
9617
  function characterFontTitle(fontId, messages) {
9467
9618
  const key = characterFontSpec(fontId).titleKey;
9468
9619
  return messages[key] ?? messages.defaultFont;
@@ -9838,18 +9989,31 @@ function EquationMobileToolbar({
9838
9989
  sheetView === "typography" ? /* @__PURE__ */ jsxs(Fragment, { children: [
9839
9990
  /* @__PURE__ */ jsxs("section", { className: "butex-widget__sheet-section", children: [
9840
9991
  /* @__PURE__ */ jsx("h4", { children: messages.chooseWritingFont }),
9841
- /* @__PURE__ */ jsx("div", { className: "butex-widget__sheet-choice-row", children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx(
9842
- "button",
9843
- {
9844
- type: "button",
9845
- className: `character-font-option--${option.id}`,
9846
- "aria-pressed": state.characterFont === option.id,
9847
- title: characterFontTitle(option.id, messages),
9848
- onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentCharacterFont(option.id)),
9849
- children: option.label
9850
- },
9851
- option.id
9852
- )) })
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
+ ] })
9853
10017
  ] }),
9854
10018
  /* @__PURE__ */ jsx(
9855
10019
  "button",
@@ -10169,6 +10333,9 @@ function digitFormLabel(digitForm) {
10169
10333
  function characterFontOption(fontId) {
10170
10334
  return CHARACTER_FONT_OPTIONS.find((option) => option.id === fontId) ?? CHARACTER_FONT_OPTIONS[0];
10171
10335
  }
10336
+ function boldCharacterStyleLabel2(uiLocale) {
10337
+ return uiLocale === "ar" ? "\u0639\u0631\u064A\u0636" : "Bold";
10338
+ }
10172
10339
  function characterFontTitle2(fontId, messages) {
10173
10340
  const key = characterFontSpec(fontId).titleKey;
10174
10341
  return messages[key] ?? messages.defaultFont;
@@ -10273,6 +10440,7 @@ var ButexEditor = forwardRef(
10273
10440
  const [openDesktopMenu, setOpenDesktopMenu] = useState2(null);
10274
10441
  const [selectedDigitForm2, setSelectedDigitForm] = useState2("western");
10275
10442
  const [selectedCharacterFont, setSelectedCharacterFont] = useState2("default");
10443
+ const [boldCharacterStyle, setBoldCharacterStyle] = useState2(initialSession?.currentCharacterWrapper === "\\boldarabic");
10276
10444
  const [activeEditorSide, setActiveEditorSide] = useState2("arabic");
10277
10445
  const [compactPreviewOpen, setCompactPreviewOpen] = useState2(false);
10278
10446
  const [compactControlState, setCompactControlState] = useState2({
@@ -10425,6 +10593,7 @@ ${arabic || currentMessages.empty}`;
10425
10593
  runtimeRef.current?.setSession(next);
10426
10594
  setSelectedDigitForm(next.currentDigitForm ?? "western");
10427
10595
  setSelectedCharacterFont(next.currentCharacterFont ?? "default");
10596
+ setBoldCharacterStyle(next.currentCharacterWrapper === "\\boldarabic");
10428
10597
  setActiveEditorSide(next.activeSide);
10429
10598
  onSessionChangeRef.current?.(next);
10430
10599
  setDebugImportError("");
@@ -10466,6 +10635,7 @@ ${arabic || currentMessages.empty}`;
10466
10635
  onSessionChange: (session) => {
10467
10636
  setSelectedDigitForm(session.currentDigitForm ?? "western");
10468
10637
  setSelectedCharacterFont(session.currentCharacterFont ?? "default");
10638
+ setBoldCharacterStyle(session.currentCharacterWrapper === "\\boldarabic");
10469
10639
  setActiveEditorSide(session.activeSide);
10470
10640
  const hasSelection = Boolean(session.selection && session.selection.anchorIndex !== session.selection.focusIndex);
10471
10641
  const nextCompactState = {
@@ -10548,6 +10718,7 @@ ${arabic || currentMessages.empty}`;
10548
10718
  ...compactControlState,
10549
10719
  activeSide: activeEditorSide,
10550
10720
  characterFont: selectedCharacterFont,
10721
+ boldCharacterStyle,
10551
10722
  digitForm: selectedDigitForm2
10552
10723
  };
10553
10724
  return /* @__PURE__ */ jsx2(
@@ -11574,35 +11745,54 @@ ${arabic || currentMessages.empty}`;
11574
11745
  {
11575
11746
  ref: characterFontBtnRef,
11576
11747
  id: "select-character-font",
11577
- className: `icon-btn font-mode-btn font-mode-btn--${selectedCharacterFont}`,
11748
+ className: `icon-btn font-mode-btn font-mode-btn--${boldCharacterStyle ? "bold" : selectedCharacterFont}`,
11578
11749
  type: "button",
11579
- title: characterFontTitle2(selectedCharacterFont, messages),
11750
+ title: boldCharacterStyle ? boldCharacterStyleLabel2(uiLocale) : characterFontTitle2(selectedCharacterFont, messages),
11580
11751
  "aria-label": messages.chooseWritingFont,
11581
11752
  "aria-haspopup": "listbox",
11582
11753
  "aria-expanded": characterFontMenuOpen,
11583
11754
  onClick: () => setCharacterFontMenuOpen((open) => !open),
11584
- children: characterFontOption(selectedCharacterFont).label
11755
+ children: boldCharacterStyle ? boldCharacterStyleLabel2(uiLocale) : characterFontOption(selectedCharacterFont).label
11585
11756
  }
11586
11757
  ),
11587
- /* @__PURE__ */ jsx2("div", { className: "character-font-options", role: "listbox", "aria-label": messages.chooseWritingFont, hidden: !characterFontMenuOpen, children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx2(
11588
- "button",
11589
- {
11590
- type: "button",
11591
- role: "option",
11592
- "aria-selected": selectedCharacterFont === option.id,
11593
- className: `character-font-option character-font-option--${option.id}`,
11594
- title: characterFontTitle2(option.id, messages),
11595
- onMouseDown: (event) => event.preventDefault(),
11596
- onClick: () => {
11597
- runtimeRef.current?.setCurrentCharacterFont(option.id);
11598
- setSelectedCharacterFont(option.id);
11599
- setCharacterFontMenuOpen(false);
11600
- 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
11601
11792
  },
11602
- children: option.label
11603
- },
11604
- option.id
11605
- )) })
11793
+ option.id
11794
+ ))
11795
+ ] })
11606
11796
  ]
11607
11797
  }
11608
11798
  ),