@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
@@ -373,6 +373,7 @@ var BaseAstNode = class {
373
373
  superscript;
374
374
  subscript;
375
375
  nodeType;
376
+ sourceLatex;
376
377
  constructor(state = null) {
377
378
  if (state === null) {
378
379
  state = new State();
@@ -381,6 +382,7 @@ var BaseAstNode = class {
381
382
  this.superscript = null;
382
383
  this.subscript = null;
383
384
  this.nodeType = this.constructor.name;
385
+ this.sourceLatex = null;
384
386
  }
385
387
  latex() {
386
388
  throw new Error("NotImplementedError");
@@ -569,6 +571,7 @@ ${this.closing}`;
569
571
  }
570
572
  };
571
573
  function parseScripts(node, json, mode) {
574
+ node.sourceLatex = typeof json.source_latex === "string" && json.source_latex.length > 0 ? json.source_latex : null;
572
575
  if (json.superscript) {
573
576
  node.superscript = parseChain(json.superscript, mode);
574
577
  }
@@ -708,7 +711,8 @@ function fromMathObjectJson(json, mode = "english") {
708
711
  function scriptsToJson(node, path) {
709
712
  return {
710
713
  ...node.superscript ? { superscript: chainToJson(node.superscript, `${path}.superscript`) } : {},
711
- ...node.subscript ? { subscript: chainToJson(node.subscript, `${path}.subscript`) } : {}
714
+ ...node.subscript ? { subscript: chainToJson(node.subscript, `${path}.subscript`) } : {},
715
+ ...node.sourceLatex ? { source_latex: node.sourceLatex } : {}
712
716
  };
713
717
  }
714
718
  function nodeToJson(node, path) {
@@ -2186,6 +2190,15 @@ var ATOMIC_OPERATOR_COMMANDS = {
2186
2190
  title: "\u0627\u0644\u0644\u0627\u0646\u0647\u0627\u064A\u0629",
2187
2191
  svg_path: null
2188
2192
  },
2193
+ top: {
2194
+ id: "top",
2195
+ category: "operators1",
2196
+ Tex: "\\top",
2197
+ mirror: false,
2198
+ Label: "\u22A4",
2199
+ title: "\u0627\u0644\u0645\u0646\u0642\u0648\u0644",
2200
+ svg_path: null
2201
+ },
2189
2202
  times: {
2190
2203
  id: "times",
2191
2204
  category: "operators1",
@@ -2966,6 +2979,7 @@ function cloneEditorSession(session) {
2966
2979
  forceSplitNextLeaf: session.forceSplitNextLeaf,
2967
2980
  arabicReverseNumberTyping: session.arabicReverseNumberTyping,
2968
2981
  currentCharacterFont: session.currentCharacterFont ?? "default",
2982
+ currentCharacterWrapper: session.currentCharacterWrapper ?? null,
2969
2983
  currentDigitForm: session.currentDigitForm ?? "western",
2970
2984
  caret: { ...session.caret },
2971
2985
  selection: session.selection ? { ...session.selection } : null,
@@ -3038,6 +3052,7 @@ function createEditorSession(englishTree, arabicTree, activeSide = "arabic") {
3038
3052
  forceSplitNextLeaf: false,
3039
3053
  arabicReverseNumberTyping: true,
3040
3054
  currentCharacterFont: "default",
3055
+ currentCharacterWrapper: null,
3041
3056
  currentDigitForm: "western",
3042
3057
  caret: {
3043
3058
  chainId: englishTree.id,
@@ -3107,6 +3122,7 @@ var CHARACTER_FONT_SPECS = [
3107
3122
  latexFontCommand: "\\maghribi",
3108
3123
  latexFontFamily: "Almaghribi Warsh Quran",
3109
3124
  browserFontStack: '"Almaghribi Warsh Quran", Amiri, "Segoe UI", Tahoma, sans-serif',
3125
+ importAliases: ["\\maghribi"],
3110
3126
  svgLayoutKey: "maghribi"
3111
3127
  }
3112
3128
  ];
@@ -3279,6 +3295,14 @@ function renderNodeEnglish(node, options) {
3279
3295
  return `${node.expr}${latinScripts(node, options)}`;
3280
3296
  }
3281
3297
  if (node.kind === "char") {
3298
+ if (node.sourceLatex) {
3299
+ return `${node.sourceLatex}${latinScripts(node, options)}`;
3300
+ }
3301
+ if (node.wrapperCommand) {
3302
+ const expr = formatDigits(node.expr, selectedDigitForm(options));
3303
+ const wrapper = node.wrapperCommand === "\\boldarabic" ? "\\mathbf" : node.wrapperCommand;
3304
+ return `${wrapper}{${escapeText(expr)}}${latinScripts(node, options)}`;
3305
+ }
3282
3306
  return `${renderCharContent(node, options)}${latinScripts(node, options)}`;
3283
3307
  }
3284
3308
  if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
@@ -3332,6 +3356,10 @@ function renderNodeArabic(node, options) {
3332
3356
  if (node.kind === "char") {
3333
3357
  const expr = formatDigits(node.expr, selectedDigitForm(options));
3334
3358
  const content = renderCharContent(node, options);
3359
+ if (node.wrapperCommand) {
3360
+ const wrapper = node.wrapperCommand === "\\mathbf" ? "\\boldarabic" : node.wrapperCommand;
3361
+ return arabicScripts(node, `${wrapper}{${content}}`, options);
3362
+ }
3335
3363
  return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
3336
3364
  }
3337
3365
  if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
@@ -4560,6 +4588,16 @@ function markExprSync(session, nodeId) {
4560
4588
  }
4561
4589
  session.sync[nodeId].expr = english.node.expr === arabic.node.expr ? "synced" : "diverged";
4562
4590
  }
4591
+ function clearSourceIdentity(session, nodeId) {
4592
+ const english = findNodeById(session.englishTree, nodeId);
4593
+ const arabic = findNodeById(session.arabicTree, nodeId);
4594
+ if (english) {
4595
+ delete english.node.sourceLatex;
4596
+ }
4597
+ if (arabic) {
4598
+ delete arabic.node.sourceLatex;
4599
+ }
4600
+ }
4563
4601
  function syncSelectionToCaret(session) {
4564
4602
  const activeKey = activeTreeKey(session.activeSide);
4565
4603
  const tree = session[activeKey];
@@ -5143,7 +5181,10 @@ function insertLeaf(session, kind, expr) {
5143
5181
  const next = cloneEditorSession(session);
5144
5182
  const englishNode = createEditorNode(kind, expr);
5145
5183
  const arabicNode = createEditorNode(kind, expr);
5146
- if (kind === "char" && (next.currentCharacterFont ?? "default") !== "default") {
5184
+ if (kind === "char" && next.currentCharacterWrapper === "\\boldarabic") {
5185
+ englishNode.wrapperCommand = "\\boldarabic";
5186
+ arabicNode.wrapperCommand = "\\boldarabic";
5187
+ } else if (kind === "char" && (next.currentCharacterFont ?? "default") !== "default") {
5147
5188
  englishNode.characterFont = next.currentCharacterFont;
5148
5189
  arabicNode.characterFont = next.currentCharacterFont;
5149
5190
  }
@@ -5158,8 +5199,12 @@ function insertLeaf(session, kind, expr) {
5158
5199
  function shouldReverseArabicNumber(session) {
5159
5200
  return session.activeSide === "arabic" && session.arabicReverseNumberTyping;
5160
5201
  }
5161
- function characterFontOf(node) {
5162
- return node.kind === "char" ? node.characterFont ?? "default" : "default";
5202
+ function characterTypingStyleOf(node) {
5203
+ if (node.kind !== "char") return "none";
5204
+ return node.wrapperCommand ? `wrapper:${node.wrapperCommand}` : `font:${node.characterFont ?? "default"}`;
5205
+ }
5206
+ function currentCharacterTypingStyle(session) {
5207
+ return session.currentCharacterWrapper ? `wrapper:${session.currentCharacterWrapper}` : `font:${session.currentCharacterFont ?? "default"}`;
5163
5208
  }
5164
5209
  function tryMergeLeafTyping(session, kind, fragment) {
5165
5210
  const engLocated = findChainById(session.englishTree, session.caret.chainId);
@@ -5172,14 +5217,14 @@ function tryMergeLeafTyping(session, kind, fragment) {
5172
5217
  let prepend = false;
5173
5218
  if (i > 0) {
5174
5219
  const prev = nodes[i - 1];
5175
- if (prev.kind === kind && (kind !== "char" || characterFontOf(prev) === (session.currentCharacterFont ?? "default"))) {
5220
+ if (prev.kind === kind && (kind !== "char" || characterTypingStyleOf(prev) === currentCharacterTypingStyle(session))) {
5176
5221
  targetId = prev.id;
5177
5222
  prepend = false;
5178
5223
  }
5179
5224
  }
5180
5225
  if (!targetId && i < nodes.length) {
5181
5226
  const fwd = nodes[i];
5182
- if (fwd.kind === kind && (kind !== "char" || characterFontOf(fwd) === (session.currentCharacterFont ?? "default"))) {
5227
+ if (fwd.kind === kind && (kind !== "char" || characterTypingStyleOf(fwd) === currentCharacterTypingStyle(session))) {
5183
5228
  targetId = fwd.id;
5184
5229
  prepend = true;
5185
5230
  }
@@ -5200,6 +5245,7 @@ function tryMergeLeafTyping(session, kind, fragment) {
5200
5245
  englishHit.node.expr = `${englishHit.node.expr}${fragment}`;
5201
5246
  arabicHit.node.expr = `${arabicHit.node.expr}${fragment}`;
5202
5247
  }
5248
+ clearSourceIdentity(session, targetId);
5203
5249
  markExprSync(session, targetId);
5204
5250
  return true;
5205
5251
  }
@@ -5238,9 +5284,17 @@ function breakLeafTyping(session) {
5238
5284
  function setCurrentCharacterFont(session, fontId) {
5239
5285
  const next = cloneEditorSession(session);
5240
5286
  next.currentCharacterFont = fontId;
5287
+ next.currentCharacterWrapper = null;
5241
5288
  appendDebug(next, "setCurrentCharacterFont", fontId);
5242
5289
  return next;
5243
5290
  }
5291
+ function setCurrentBoldCharacterStyle(session) {
5292
+ const next = cloneEditorSession(session);
5293
+ next.currentCharacterFont = "default";
5294
+ next.currentCharacterWrapper = "\\boldarabic";
5295
+ appendDebug(next, "setCurrentBoldCharacterStyle", "\\boldarabic");
5296
+ return next;
5297
+ }
5244
5298
  function toggleTakweenCharacterFont(session) {
5245
5299
  return setCurrentCharacterFont(session, (session.currentCharacterFont ?? "default") === "takween" ? "default" : "takween");
5246
5300
  }
@@ -5789,6 +5843,7 @@ function deleteBackward(session) {
5789
5843
  englishHit.node.expr = englishHit.node.expr.slice(0, -1);
5790
5844
  arabicHit.node.expr = arabicHit.node.expr.slice(0, -1);
5791
5845
  }
5846
+ clearSourceIdentity(next, id);
5792
5847
  markExprSync(next, id);
5793
5848
  next.selectedStructureNodeId = null;
5794
5849
  syncSelectionToCaret(next);
@@ -5838,6 +5893,7 @@ function deleteForward(session) {
5838
5893
  englishHit.node.expr = englishHit.node.expr.slice(1);
5839
5894
  arabicHit.node.expr = arabicHit.node.expr.slice(1);
5840
5895
  }
5896
+ clearSourceIdentity(next, node.id);
5841
5897
  markExprSync(next, node.id);
5842
5898
  next.selectedStructureNodeId = null;
5843
5899
  syncSelectionToCaret(next);
@@ -5867,6 +5923,7 @@ function createStarterSession() {
5867
5923
  forceSplitNextLeaf: false,
5868
5924
  arabicReverseNumberTyping: true,
5869
5925
  currentCharacterFont: "default",
5926
+ currentCharacterWrapper: null,
5870
5927
  currentDigitForm: "western",
5871
5928
  caret: {
5872
5929
  chainId: englishRoot.id,
@@ -5992,6 +6049,9 @@ function buildBaseNodeBody(node, digitForm = "western", side = "english") {
5992
6049
  if (cssClass) {
5993
6050
  value.classList.add(cssClass);
5994
6051
  }
6052
+ if (node.wrapperCommand === "\\boldarabic" || node.wrapperCommand === "\\mathbf") {
6053
+ value.classList.add("node-value--bold");
6054
+ }
5995
6055
  }
5996
6056
  const surfaceExpr = node.kind === "operator" ? divideOperatorSurfaceExpr(node.expr, side) : node.expr;
5997
6057
  value.textContent = surfaceExpr === "" ? "\u25A1" : formatDigits(surfaceExpr, digitForm);
@@ -6912,6 +6972,11 @@ ${BUTEX_FONT_FACE_CSS}
6912
6972
 
6913
6973
  ${CHARACTER_FONT_CSS}
6914
6974
 
6975
+ .node-value--bold {
6976
+ font-family: var(--font-display-ar, Amiri), "Noto Serif Arabic", serif;
6977
+ font-weight: 700;
6978
+ }
6979
+
6915
6980
  .chain {
6916
6981
  display: inline-flex;
6917
6982
  align-items: center;
@@ -7904,6 +7969,10 @@ function createEditorRuntime(options) {
7904
7969
  applyTransient((prev) => setCurrentCharacterFont(prev, fontId));
7905
7970
  focusInput();
7906
7971
  },
7972
+ setCurrentBoldCharacterStyle: () => {
7973
+ applyTransient((prev) => setCurrentBoldCharacterStyle(prev));
7974
+ focusInput();
7975
+ },
7907
7976
  setCurrentDigitForm: (digitForm) => {
7908
7977
  applyStructural((prev) => setCurrentDigitForm(prev, digitForm));
7909
7978
  focusInput();
@@ -8099,6 +8168,10 @@ var CHAR_FONT_EXPORT_TEX = Object.fromEntries(
8099
8168
  function charEditorNodeToAstNode(node) {
8100
8169
  const font = node.characterFont ?? "default";
8101
8170
  const charNode = new CharNode(node.expr);
8171
+ if (node.wrapperCommand) {
8172
+ const wrapper = node.wrapperCommand === "\\boldarabic" ? "\\mathbf" : node.wrapperCommand;
8173
+ return new CommandNode(wrapper, [], [new ChainNode([charNode])]);
8174
+ }
8102
8175
  if (font === "default") {
8103
8176
  return charNode;
8104
8177
  }
@@ -8125,6 +8198,9 @@ function cloneChainWithFreshIds(chain) {
8125
8198
  return structuredClone(chain);
8126
8199
  }
8127
8200
  function attachScripts(astNode, editorNode) {
8201
+ if (astNode.sourceLatex) {
8202
+ editorNode.sourceLatex = astNode.sourceLatex;
8203
+ }
8128
8204
  if (astNode.superscript) {
8129
8205
  const sup = chainToEditorChain(astNode.superscript);
8130
8206
  if (!sup.editable) {
@@ -8251,6 +8327,49 @@ function charFromTextLikeCommand(node) {
8251
8327
  const scripts = attachScripts(node, editorNode);
8252
8328
  return scripts ?? { editable: true, node: editorNode };
8253
8329
  }
8330
+ function singleCommandChar(node) {
8331
+ if (node.optionalArgs.length > 0 || node.mandatoryArgs.length !== 1) {
8332
+ return null;
8333
+ }
8334
+ const arg = node.mandatoryArgs[0];
8335
+ if (arg.chain.length !== 1 || !(arg.chain[0] instanceof CharNode)) {
8336
+ return null;
8337
+ }
8338
+ return arg.chain[0];
8339
+ }
8340
+ function wrappedAtomicCommandId(node) {
8341
+ if (node.name !== "\\mathbb" && node.name !== "\\mathrm") {
8342
+ return null;
8343
+ }
8344
+ const child = singleCommandChar(node);
8345
+ if (!child) {
8346
+ return null;
8347
+ }
8348
+ return commandIdForTex(`${node.name}{${child.expr}}`);
8349
+ }
8350
+ function editableWrapperCommand(node) {
8351
+ if (node.name !== "\\mathtt" && node.name !== "\\mathsf" && node.name !== "\\unit" && node.name !== "\\mathbf" && node.name !== "\\boldarabic") {
8352
+ return null;
8353
+ }
8354
+ const child = singleCommandChar(node);
8355
+ if (!child) {
8356
+ return null;
8357
+ }
8358
+ const normalized = normalizeCharImportExpr(child.expr);
8359
+ const editorNode = createEditorNode("char", normalized.expr);
8360
+ if (normalized.characterFont !== "default") {
8361
+ editorNode.characterFont = normalized.characterFont;
8362
+ }
8363
+ editorNode.wrapperCommand = node.name === "\\mathtt" ? "\\mathtt" : node.name === "\\mathbf" ? "\\mathbf" : node.name === "\\boldarabic" ? "\\boldarabic" : "\\unit";
8364
+ const scripts = attachScripts(node, editorNode);
8365
+ if (scripts) {
8366
+ return scripts;
8367
+ }
8368
+ if (!editorNode.sourceLatex && node.name === "\\mathsf") {
8369
+ editorNode.sourceLatex = `\\mathsf{${child.expr}}`;
8370
+ }
8371
+ return { editable: true, node: editorNode };
8372
+ }
8254
8373
  function commandToEditorNode(node) {
8255
8374
  if (node.name === "\\frac" && node.mandatoryArgs.length >= 2) {
8256
8375
  const frac = createFracNode();
@@ -8340,6 +8459,19 @@ function commandToEditorNode(node) {
8340
8459
  }
8341
8460
  return { editable: true, node: accent };
8342
8461
  }
8462
+ const wrappedAtomicId = wrappedAtomicCommandId(node);
8463
+ if (wrappedAtomicId) {
8464
+ const atomic = createEditorNode("atomicCommand", wrappedAtomicId);
8465
+ const scripts = attachScripts(node, atomic);
8466
+ if (scripts) {
8467
+ return scripts;
8468
+ }
8469
+ return { editable: true, node: atomic };
8470
+ }
8471
+ const wrapper = editableWrapperCommand(node);
8472
+ if (wrapper) {
8473
+ return wrapper;
8474
+ }
8343
8475
  const atomicId = commandIdForTex(node.name);
8344
8476
  if (atomicId && node.optionalArgs.length === 0 && node.mandatoryArgs.length === 0) {
8345
8477
  const atomic = createEditorNode("atomicCommand", atomicId);
@@ -8619,7 +8751,13 @@ function editorNodeToAstNode(node) {
8619
8751
  if (!tex) {
8620
8752
  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}` };
8621
8753
  }
8622
- astNode = new CommandNode(tex);
8754
+ if (node.expr === "ad") {
8755
+ astNode = new CommandNode("\\mathrm", [], [new ChainNode([new CharNode("d")])]);
8756
+ } else if (["N", "Z", "Q", "R", "C", "H"].includes(node.expr)) {
8757
+ astNode = new CommandNode("\\mathbb", [], [new ChainNode([new CharNode(node.expr)])]);
8758
+ } else {
8759
+ astNode = new CommandNode(tex);
8760
+ }
8623
8761
  } else if (node.kind === "atomicOperatorCommand") {
8624
8762
  const tex = atomicOperatorCommandSpec(node.expr)?.Tex;
8625
8763
  if (!tex) {
@@ -8636,6 +8774,9 @@ function editorNodeToAstNode(node) {
8636
8774
  } else {
8637
8775
  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}` };
8638
8776
  }
8777
+ if (node.sourceLatex) {
8778
+ astNode.sourceLatex = node.sourceLatex;
8779
+ }
8639
8780
  const scripts = attachAstScripts(node, astNode);
8640
8781
  return scripts ?? { ok: true, node: astNode };
8641
8782
  }
@@ -14805,6 +14946,13 @@ ${MATRIX_PICKER_CSS}
14805
14946
  box-shadow: 0 0 0 3px var(--butex-focus-shadow);
14806
14947
  }
14807
14948
 
14949
+ .butex-widget .font-mode-btn--bold,
14950
+ .butex-widget .character-font-option--bold,
14951
+ .butex-widget .butex-widget__command-sheet .character-font-option--bold {
14952
+ font-family: var(--font-display-ar, Amiri), "Noto Serif Arabic", serif;
14953
+ font-weight: 700;
14954
+ }
14955
+
14808
14956
  .butex-widget .font-mode-btn--takween,
14809
14957
  .butex-widget .character-font-option--takween,
14810
14958
  .butex-widget .butex-widget__command-sheet .character-font-option--takween {
@@ -15634,6 +15782,9 @@ function alignmentTitle(alignment, messages) {
15634
15782
  if (alignment === "r") return messages.alignColumnRight;
15635
15783
  return messages.alignColumnCenter;
15636
15784
  }
15785
+ function boldCharacterStyleLabel(uiLocale) {
15786
+ return uiLocale === "ar" ? "\u0639\u0631\u064A\u0636" : "Bold";
15787
+ }
15637
15788
  function characterFontTitle(fontId, messages) {
15638
15789
  const key = characterFontSpec(fontId).titleKey;
15639
15790
  return messages[key] ?? messages.defaultFont;
@@ -16009,18 +16160,31 @@ function EquationMobileToolbar({
16009
16160
  sheetView === "typography" ? /* @__PURE__ */ jsxs12(Fragment5, { children: [
16010
16161
  /* @__PURE__ */ jsxs12("section", { className: "butex-widget__sheet-section", children: [
16011
16162
  /* @__PURE__ */ jsx13("h4", { children: messages.chooseWritingFont }),
16012
- /* @__PURE__ */ jsx13("div", { className: "butex-widget__sheet-choice-row", children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx13(
16013
- "button",
16014
- {
16015
- type: "button",
16016
- className: `character-font-option--${option.id}`,
16017
- "aria-pressed": state.characterFont === option.id,
16018
- title: characterFontTitle(option.id, messages),
16019
- onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentCharacterFont(option.id)),
16020
- children: option.label
16021
- },
16022
- option.id
16023
- )) })
16163
+ /* @__PURE__ */ jsxs12("div", { className: "butex-widget__sheet-choice-row", children: [
16164
+ /* @__PURE__ */ jsx13(
16165
+ "button",
16166
+ {
16167
+ type: "button",
16168
+ className: "character-font-option--bold",
16169
+ "aria-pressed": state.boldCharacterStyle,
16170
+ title: boldCharacterStyleLabel(uiLocale),
16171
+ onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentBoldCharacterStyle()),
16172
+ children: boldCharacterStyleLabel(uiLocale)
16173
+ }
16174
+ ),
16175
+ CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx13(
16176
+ "button",
16177
+ {
16178
+ type: "button",
16179
+ className: `character-font-option--${option.id}`,
16180
+ "aria-pressed": !state.boldCharacterStyle && state.characterFont === option.id,
16181
+ title: characterFontTitle(option.id, messages),
16182
+ onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentCharacterFont(option.id)),
16183
+ children: option.label
16184
+ },
16185
+ option.id
16186
+ ))
16187
+ ] })
16024
16188
  ] }),
16025
16189
  /* @__PURE__ */ jsx13(
16026
16190
  "button",
@@ -16340,6 +16504,9 @@ function digitFormLabel3(digitForm) {
16340
16504
  function characterFontOption(fontId) {
16341
16505
  return CHARACTER_FONT_OPTIONS.find((option) => option.id === fontId) ?? CHARACTER_FONT_OPTIONS[0];
16342
16506
  }
16507
+ function boldCharacterStyleLabel2(uiLocale) {
16508
+ return uiLocale === "ar" ? "\u0639\u0631\u064A\u0636" : "Bold";
16509
+ }
16343
16510
  function characterFontTitle2(fontId, messages) {
16344
16511
  const key = characterFontSpec(fontId).titleKey;
16345
16512
  return messages[key] ?? messages.defaultFont;
@@ -16444,6 +16611,7 @@ var ButexEditor = forwardRef(
16444
16611
  const [openDesktopMenu, setOpenDesktopMenu] = useState9(null);
16445
16612
  const [selectedDigitForm2, setSelectedDigitForm] = useState9("western");
16446
16613
  const [selectedCharacterFont, setSelectedCharacterFont] = useState9("default");
16614
+ const [boldCharacterStyle, setBoldCharacterStyle] = useState9(initialSession?.currentCharacterWrapper === "\\boldarabic");
16447
16615
  const [activeEditorSide, setActiveEditorSide] = useState9("arabic");
16448
16616
  const [compactPreviewOpen, setCompactPreviewOpen] = useState9(false);
16449
16617
  const [compactControlState, setCompactControlState] = useState9({
@@ -16596,6 +16764,7 @@ ${arabic || currentMessages.empty}`;
16596
16764
  runtimeRef.current?.setSession(next);
16597
16765
  setSelectedDigitForm(next.currentDigitForm ?? "western");
16598
16766
  setSelectedCharacterFont(next.currentCharacterFont ?? "default");
16767
+ setBoldCharacterStyle(next.currentCharacterWrapper === "\\boldarabic");
16599
16768
  setActiveEditorSide(next.activeSide);
16600
16769
  onSessionChangeRef.current?.(next);
16601
16770
  setDebugImportError("");
@@ -16637,6 +16806,7 @@ ${arabic || currentMessages.empty}`;
16637
16806
  onSessionChange: (session) => {
16638
16807
  setSelectedDigitForm(session.currentDigitForm ?? "western");
16639
16808
  setSelectedCharacterFont(session.currentCharacterFont ?? "default");
16809
+ setBoldCharacterStyle(session.currentCharacterWrapper === "\\boldarabic");
16640
16810
  setActiveEditorSide(session.activeSide);
16641
16811
  const hasSelection = Boolean(session.selection && session.selection.anchorIndex !== session.selection.focusIndex);
16642
16812
  const nextCompactState = {
@@ -16719,6 +16889,7 @@ ${arabic || currentMessages.empty}`;
16719
16889
  ...compactControlState,
16720
16890
  activeSide: activeEditorSide,
16721
16891
  characterFont: selectedCharacterFont,
16892
+ boldCharacterStyle,
16722
16893
  digitForm: selectedDigitForm2
16723
16894
  };
16724
16895
  return /* @__PURE__ */ jsx14(
@@ -17745,35 +17916,54 @@ ${arabic || currentMessages.empty}`;
17745
17916
  {
17746
17917
  ref: characterFontBtnRef,
17747
17918
  id: "select-character-font",
17748
- className: `icon-btn font-mode-btn font-mode-btn--${selectedCharacterFont}`,
17919
+ className: `icon-btn font-mode-btn font-mode-btn--${boldCharacterStyle ? "bold" : selectedCharacterFont}`,
17749
17920
  type: "button",
17750
- title: characterFontTitle2(selectedCharacterFont, messages),
17921
+ title: boldCharacterStyle ? boldCharacterStyleLabel2(uiLocale) : characterFontTitle2(selectedCharacterFont, messages),
17751
17922
  "aria-label": messages.chooseWritingFont,
17752
17923
  "aria-haspopup": "listbox",
17753
17924
  "aria-expanded": characterFontMenuOpen,
17754
17925
  onClick: () => setCharacterFontMenuOpen((open) => !open),
17755
- children: characterFontOption(selectedCharacterFont).label
17926
+ children: boldCharacterStyle ? boldCharacterStyleLabel2(uiLocale) : characterFontOption(selectedCharacterFont).label
17756
17927
  }
17757
17928
  ),
17758
- /* @__PURE__ */ jsx14("div", { className: "character-font-options", role: "listbox", "aria-label": messages.chooseWritingFont, hidden: !characterFontMenuOpen, children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx14(
17759
- "button",
17760
- {
17761
- type: "button",
17762
- role: "option",
17763
- "aria-selected": selectedCharacterFont === option.id,
17764
- className: `character-font-option character-font-option--${option.id}`,
17765
- title: characterFontTitle2(option.id, messages),
17766
- onMouseDown: (event) => event.preventDefault(),
17767
- onClick: () => {
17768
- runtimeRef.current?.setCurrentCharacterFont(option.id);
17769
- setSelectedCharacterFont(option.id);
17770
- setCharacterFontMenuOpen(false);
17771
- focusSurface();
17929
+ /* @__PURE__ */ jsxs13("div", { className: "character-font-options", role: "listbox", "aria-label": messages.chooseWritingFont, hidden: !characterFontMenuOpen, children: [
17930
+ /* @__PURE__ */ jsx14(
17931
+ "button",
17932
+ {
17933
+ type: "button",
17934
+ role: "option",
17935
+ "aria-selected": boldCharacterStyle,
17936
+ className: "character-font-option character-font-option--bold",
17937
+ title: boldCharacterStyleLabel2(uiLocale),
17938
+ onMouseDown: (event) => event.preventDefault(),
17939
+ onClick: () => {
17940
+ runtimeRef.current?.setCurrentBoldCharacterStyle();
17941
+ setCharacterFontMenuOpen(false);
17942
+ focusSurface();
17943
+ },
17944
+ children: boldCharacterStyleLabel2(uiLocale)
17945
+ }
17946
+ ),
17947
+ CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx14(
17948
+ "button",
17949
+ {
17950
+ type: "button",
17951
+ role: "option",
17952
+ "aria-selected": !boldCharacterStyle && selectedCharacterFont === option.id,
17953
+ className: `character-font-option character-font-option--${option.id}`,
17954
+ title: characterFontTitle2(option.id, messages),
17955
+ onMouseDown: (event) => event.preventDefault(),
17956
+ onClick: () => {
17957
+ runtimeRef.current?.setCurrentCharacterFont(option.id);
17958
+ setSelectedCharacterFont(option.id);
17959
+ setCharacterFontMenuOpen(false);
17960
+ focusSurface();
17961
+ },
17962
+ children: option.label
17772
17963
  },
17773
- children: option.label
17774
- },
17775
- option.id
17776
- )) })
17964
+ option.id
17965
+ ))
17966
+ ] })
17777
17967
  ]
17778
17968
  }
17779
17969
  ),