@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
@@ -17,6 +17,7 @@ var BaseAstNode = class {
17
17
  superscript;
18
18
  subscript;
19
19
  nodeType;
20
+ sourceLatex;
20
21
  constructor(state = null) {
21
22
  if (state === null) {
22
23
  state = new State();
@@ -25,6 +26,7 @@ var BaseAstNode = class {
25
26
  this.superscript = null;
26
27
  this.subscript = null;
27
28
  this.nodeType = this.constructor.name;
29
+ this.sourceLatex = null;
28
30
  }
29
31
  latex() {
30
32
  throw new Error("NotImplementedError");
@@ -213,6 +215,7 @@ ${this.closing}`;
213
215
  }
214
216
  };
215
217
  function parseScripts(node, json, mode) {
218
+ node.sourceLatex = typeof json.source_latex === "string" && json.source_latex.length > 0 ? json.source_latex : null;
216
219
  if (json.superscript) {
217
220
  node.superscript = parseChain(json.superscript, mode);
218
221
  }
@@ -352,7 +355,8 @@ function fromMathObjectJson(json, mode = "english") {
352
355
  function scriptsToJson(node, path) {
353
356
  return {
354
357
  ...node.superscript ? { superscript: chainToJson(node.superscript, `${path}.superscript`) } : {},
355
- ...node.subscript ? { subscript: chainToJson(node.subscript, `${path}.subscript`) } : {}
358
+ ...node.subscript ? { subscript: chainToJson(node.subscript, `${path}.subscript`) } : {},
359
+ ...node.sourceLatex ? { source_latex: node.sourceLatex } : {}
356
360
  };
357
361
  }
358
362
  function nodeToJson(node, path) {
@@ -1265,6 +1269,15 @@ var ATOMIC_OPERATOR_COMMANDS = {
1265
1269
  title: "\u0627\u0644\u0644\u0627\u0646\u0647\u0627\u064A\u0629",
1266
1270
  svg_path: null
1267
1271
  },
1272
+ top: {
1273
+ id: "top",
1274
+ category: "operators1",
1275
+ Tex: "\\top",
1276
+ mirror: false,
1277
+ Label: "\u22A4",
1278
+ title: "\u0627\u0644\u0645\u0646\u0642\u0648\u0644",
1279
+ svg_path: null
1280
+ },
1268
1281
  times: {
1269
1282
  id: "times",
1270
1283
  category: "operators1",
@@ -2016,6 +2029,7 @@ function cloneEditorSession(session) {
2016
2029
  forceSplitNextLeaf: session.forceSplitNextLeaf,
2017
2030
  arabicReverseNumberTyping: session.arabicReverseNumberTyping,
2018
2031
  currentCharacterFont: session.currentCharacterFont ?? "default",
2032
+ currentCharacterWrapper: session.currentCharacterWrapper ?? null,
2019
2033
  currentDigitForm: session.currentDigitForm ?? "western",
2020
2034
  caret: { ...session.caret },
2021
2035
  selection: session.selection ? { ...session.selection } : null,
@@ -2088,6 +2102,7 @@ function createEditorSession(englishTree, arabicTree, activeSide = "arabic") {
2088
2102
  forceSplitNextLeaf: false,
2089
2103
  arabicReverseNumberTyping: true,
2090
2104
  currentCharacterFont: "default",
2105
+ currentCharacterWrapper: null,
2091
2106
  currentDigitForm: "western",
2092
2107
  caret: {
2093
2108
  chainId: englishTree.id,
@@ -2358,6 +2373,14 @@ function renderNodeEnglish(node, options) {
2358
2373
  return `${node.expr}${latinScripts(node, options)}`;
2359
2374
  }
2360
2375
  if (node.kind === "char") {
2376
+ if (node.sourceLatex) {
2377
+ return `${node.sourceLatex}${latinScripts(node, options)}`;
2378
+ }
2379
+ if (node.wrapperCommand) {
2380
+ const expr = formatDigits(node.expr, selectedDigitForm(options));
2381
+ const wrapper = node.wrapperCommand === "\\boldarabic" ? "\\mathbf" : node.wrapperCommand;
2382
+ return `${wrapper}{${escapeText(expr)}}${latinScripts(node, options)}`;
2383
+ }
2361
2384
  return `${renderCharContent(node, options)}${latinScripts(node, options)}`;
2362
2385
  }
2363
2386
  if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
@@ -2411,6 +2434,10 @@ function renderNodeArabic(node, options) {
2411
2434
  if (node.kind === "char") {
2412
2435
  const expr = formatDigits(node.expr, selectedDigitForm(options));
2413
2436
  const content = renderCharContent(node, options);
2437
+ if (node.wrapperCommand) {
2438
+ const wrapper = node.wrapperCommand === "\\mathbf" ? "\\boldarabic" : node.wrapperCommand;
2439
+ return arabicScripts(node, `${wrapper}{${content}}`, options);
2440
+ }
2414
2441
  return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
2415
2442
  }
2416
2443
  if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
@@ -3639,6 +3666,16 @@ function markExprSync(session, nodeId) {
3639
3666
  }
3640
3667
  session.sync[nodeId].expr = english.node.expr === arabic.node.expr ? "synced" : "diverged";
3641
3668
  }
3669
+ function clearSourceIdentity(session, nodeId) {
3670
+ const english = findNodeById(session.englishTree, nodeId);
3671
+ const arabic = findNodeById(session.arabicTree, nodeId);
3672
+ if (english) {
3673
+ delete english.node.sourceLatex;
3674
+ }
3675
+ if (arabic) {
3676
+ delete arabic.node.sourceLatex;
3677
+ }
3678
+ }
3642
3679
  function syncSelectionToCaret(session) {
3643
3680
  const activeKey = activeTreeKey(session.activeSide);
3644
3681
  const tree = session[activeKey];
@@ -4222,7 +4259,10 @@ function insertLeaf(session, kind, expr) {
4222
4259
  const next = cloneEditorSession(session);
4223
4260
  const englishNode = createEditorNode(kind, expr);
4224
4261
  const arabicNode = createEditorNode(kind, expr);
4225
- if (kind === "char" && (next.currentCharacterFont ?? "default") !== "default") {
4262
+ if (kind === "char" && next.currentCharacterWrapper === "\\boldarabic") {
4263
+ englishNode.wrapperCommand = "\\boldarabic";
4264
+ arabicNode.wrapperCommand = "\\boldarabic";
4265
+ } else if (kind === "char" && (next.currentCharacterFont ?? "default") !== "default") {
4226
4266
  englishNode.characterFont = next.currentCharacterFont;
4227
4267
  arabicNode.characterFont = next.currentCharacterFont;
4228
4268
  }
@@ -4237,8 +4277,12 @@ function insertLeaf(session, kind, expr) {
4237
4277
  function shouldReverseArabicNumber(session) {
4238
4278
  return session.activeSide === "arabic" && session.arabicReverseNumberTyping;
4239
4279
  }
4240
- function characterFontOf(node) {
4241
- return node.kind === "char" ? node.characterFont ?? "default" : "default";
4280
+ function characterTypingStyleOf(node) {
4281
+ if (node.kind !== "char") return "none";
4282
+ return node.wrapperCommand ? `wrapper:${node.wrapperCommand}` : `font:${node.characterFont ?? "default"}`;
4283
+ }
4284
+ function currentCharacterTypingStyle(session) {
4285
+ return session.currentCharacterWrapper ? `wrapper:${session.currentCharacterWrapper}` : `font:${session.currentCharacterFont ?? "default"}`;
4242
4286
  }
4243
4287
  function tryMergeLeafTyping(session, kind, fragment) {
4244
4288
  const engLocated = findChainById(session.englishTree, session.caret.chainId);
@@ -4251,14 +4295,14 @@ function tryMergeLeafTyping(session, kind, fragment) {
4251
4295
  let prepend = false;
4252
4296
  if (i > 0) {
4253
4297
  const prev = nodes[i - 1];
4254
- if (prev.kind === kind && (kind !== "char" || characterFontOf(prev) === (session.currentCharacterFont ?? "default"))) {
4298
+ if (prev.kind === kind && (kind !== "char" || characterTypingStyleOf(prev) === currentCharacterTypingStyle(session))) {
4255
4299
  targetId = prev.id;
4256
4300
  prepend = false;
4257
4301
  }
4258
4302
  }
4259
4303
  if (!targetId && i < nodes.length) {
4260
4304
  const fwd = nodes[i];
4261
- if (fwd.kind === kind && (kind !== "char" || characterFontOf(fwd) === (session.currentCharacterFont ?? "default"))) {
4305
+ if (fwd.kind === kind && (kind !== "char" || characterTypingStyleOf(fwd) === currentCharacterTypingStyle(session))) {
4262
4306
  targetId = fwd.id;
4263
4307
  prepend = true;
4264
4308
  }
@@ -4279,6 +4323,7 @@ function tryMergeLeafTyping(session, kind, fragment) {
4279
4323
  englishHit.node.expr = `${englishHit.node.expr}${fragment}`;
4280
4324
  arabicHit.node.expr = `${arabicHit.node.expr}${fragment}`;
4281
4325
  }
4326
+ clearSourceIdentity(session, targetId);
4282
4327
  markExprSync(session, targetId);
4283
4328
  return true;
4284
4329
  }
@@ -4317,9 +4362,17 @@ function breakLeafTyping(session) {
4317
4362
  function setCurrentCharacterFont(session, fontId) {
4318
4363
  const next = cloneEditorSession(session);
4319
4364
  next.currentCharacterFont = fontId;
4365
+ next.currentCharacterWrapper = null;
4320
4366
  appendDebug(next, "setCurrentCharacterFont", fontId);
4321
4367
  return next;
4322
4368
  }
4369
+ function setCurrentBoldCharacterStyle(session) {
4370
+ const next = cloneEditorSession(session);
4371
+ next.currentCharacterFont = "default";
4372
+ next.currentCharacterWrapper = "\\boldarabic";
4373
+ appendDebug(next, "setCurrentBoldCharacterStyle", "\\boldarabic");
4374
+ return next;
4375
+ }
4323
4376
  function toggleTakweenCharacterFont(session) {
4324
4377
  return setCurrentCharacterFont(session, (session.currentCharacterFont ?? "default") === "takween" ? "default" : "takween");
4325
4378
  }
@@ -4868,6 +4921,7 @@ function deleteBackward(session) {
4868
4921
  englishHit.node.expr = englishHit.node.expr.slice(0, -1);
4869
4922
  arabicHit.node.expr = arabicHit.node.expr.slice(0, -1);
4870
4923
  }
4924
+ clearSourceIdentity(next, id);
4871
4925
  markExprSync(next, id);
4872
4926
  next.selectedStructureNodeId = null;
4873
4927
  syncSelectionToCaret(next);
@@ -4917,6 +4971,7 @@ function deleteForward(session) {
4917
4971
  englishHit.node.expr = englishHit.node.expr.slice(1);
4918
4972
  arabicHit.node.expr = arabicHit.node.expr.slice(1);
4919
4973
  }
4974
+ clearSourceIdentity(next, node.id);
4920
4975
  markExprSync(next, node.id);
4921
4976
  next.selectedStructureNodeId = null;
4922
4977
  syncSelectionToCaret(next);
@@ -4946,6 +5001,7 @@ function createStarterSession() {
4946
5001
  forceSplitNextLeaf: false,
4947
5002
  arabicReverseNumberTyping: true,
4948
5003
  currentCharacterFont: "default",
5004
+ currentCharacterWrapper: null,
4949
5005
  currentDigitForm: "western",
4950
5006
  caret: {
4951
5007
  chainId: englishRoot.id,
@@ -5071,6 +5127,9 @@ function buildBaseNodeBody(node, digitForm = "western", side = "english") {
5071
5127
  if (cssClass) {
5072
5128
  value.classList.add(cssClass);
5073
5129
  }
5130
+ if (node.wrapperCommand === "\\boldarabic" || node.wrapperCommand === "\\mathbf") {
5131
+ value.classList.add("node-value--bold");
5132
+ }
5074
5133
  }
5075
5134
  const surfaceExpr = node.kind === "operator" ? divideOperatorSurfaceExpr(node.expr, side) : node.expr;
5076
5135
  value.textContent = surfaceExpr === "" ? "\u25A1" : formatDigits(surfaceExpr, digitForm);
@@ -5991,6 +6050,11 @@ ${BUTEX_FONT_FACE_CSS}
5991
6050
 
5992
6051
  ${CHARACTER_FONT_CSS}
5993
6052
 
6053
+ .node-value--bold {
6054
+ font-family: var(--font-display-ar, Amiri), "Noto Serif Arabic", serif;
6055
+ font-weight: 700;
6056
+ }
6057
+
5994
6058
  .chain {
5995
6059
  display: inline-flex;
5996
6060
  align-items: center;
@@ -6983,6 +7047,10 @@ function createEditorRuntime(options) {
6983
7047
  applyTransient((prev) => setCurrentCharacterFont(prev, fontId));
6984
7048
  focusInput();
6985
7049
  },
7050
+ setCurrentBoldCharacterStyle: () => {
7051
+ applyTransient((prev) => setCurrentBoldCharacterStyle(prev));
7052
+ focusInput();
7053
+ },
6986
7054
  setCurrentDigitForm: (digitForm) => {
6987
7055
  applyStructural((prev) => setCurrentDigitForm(prev, digitForm));
6988
7056
  focusInput();
@@ -7178,6 +7246,10 @@ var CHAR_FONT_EXPORT_TEX = Object.fromEntries(
7178
7246
  function charEditorNodeToAstNode(node) {
7179
7247
  const font = node.characterFont ?? "default";
7180
7248
  const charNode = new CharNode(node.expr);
7249
+ if (node.wrapperCommand) {
7250
+ const wrapper = node.wrapperCommand === "\\boldarabic" ? "\\mathbf" : node.wrapperCommand;
7251
+ return new CommandNode(wrapper, [], [new ChainNode([charNode])]);
7252
+ }
7181
7253
  if (font === "default") {
7182
7254
  return charNode;
7183
7255
  }
@@ -7204,6 +7276,9 @@ function cloneChainWithFreshIds(chain) {
7204
7276
  return structuredClone(chain);
7205
7277
  }
7206
7278
  function attachScripts(astNode, editorNode) {
7279
+ if (astNode.sourceLatex) {
7280
+ editorNode.sourceLatex = astNode.sourceLatex;
7281
+ }
7207
7282
  if (astNode.superscript) {
7208
7283
  const sup = chainToEditorChain(astNode.superscript);
7209
7284
  if (!sup.editable) {
@@ -7330,6 +7405,49 @@ function charFromTextLikeCommand(node) {
7330
7405
  const scripts = attachScripts(node, editorNode);
7331
7406
  return scripts ?? { editable: true, node: editorNode };
7332
7407
  }
7408
+ function singleCommandChar(node) {
7409
+ if (node.optionalArgs.length > 0 || node.mandatoryArgs.length !== 1) {
7410
+ return null;
7411
+ }
7412
+ const arg = node.mandatoryArgs[0];
7413
+ if (arg.chain.length !== 1 || !(arg.chain[0] instanceof CharNode)) {
7414
+ return null;
7415
+ }
7416
+ return arg.chain[0];
7417
+ }
7418
+ function wrappedAtomicCommandId(node) {
7419
+ if (node.name !== "\\mathbb" && node.name !== "\\mathrm") {
7420
+ return null;
7421
+ }
7422
+ const child = singleCommandChar(node);
7423
+ if (!child) {
7424
+ return null;
7425
+ }
7426
+ return commandIdForTex(`${node.name}{${child.expr}}`);
7427
+ }
7428
+ function editableWrapperCommand(node) {
7429
+ if (node.name !== "\\mathtt" && node.name !== "\\mathsf" && node.name !== "\\unit" && node.name !== "\\mathbf" && node.name !== "\\boldarabic") {
7430
+ return null;
7431
+ }
7432
+ const child = singleCommandChar(node);
7433
+ if (!child) {
7434
+ return null;
7435
+ }
7436
+ const normalized = normalizeCharImportExpr(child.expr);
7437
+ const editorNode = createEditorNode("char", normalized.expr);
7438
+ if (normalized.characterFont !== "default") {
7439
+ editorNode.characterFont = normalized.characterFont;
7440
+ }
7441
+ editorNode.wrapperCommand = node.name === "\\mathtt" ? "\\mathtt" : node.name === "\\mathbf" ? "\\mathbf" : node.name === "\\boldarabic" ? "\\boldarabic" : "\\unit";
7442
+ const scripts = attachScripts(node, editorNode);
7443
+ if (scripts) {
7444
+ return scripts;
7445
+ }
7446
+ if (!editorNode.sourceLatex && node.name === "\\mathsf") {
7447
+ editorNode.sourceLatex = `\\mathsf{${child.expr}}`;
7448
+ }
7449
+ return { editable: true, node: editorNode };
7450
+ }
7333
7451
  function commandToEditorNode(node) {
7334
7452
  if (node.name === "\\frac" && node.mandatoryArgs.length >= 2) {
7335
7453
  const frac = createFracNode();
@@ -7419,6 +7537,19 @@ function commandToEditorNode(node) {
7419
7537
  }
7420
7538
  return { editable: true, node: accent };
7421
7539
  }
7540
+ const wrappedAtomicId = wrappedAtomicCommandId(node);
7541
+ if (wrappedAtomicId) {
7542
+ const atomic = createEditorNode("atomicCommand", wrappedAtomicId);
7543
+ const scripts = attachScripts(node, atomic);
7544
+ if (scripts) {
7545
+ return scripts;
7546
+ }
7547
+ return { editable: true, node: atomic };
7548
+ }
7549
+ const wrapper = editableWrapperCommand(node);
7550
+ if (wrapper) {
7551
+ return wrapper;
7552
+ }
7422
7553
  const atomicId = commandIdForTex(node.name);
7423
7554
  if (atomicId && node.optionalArgs.length === 0 && node.mandatoryArgs.length === 0) {
7424
7555
  const atomic = createEditorNode("atomicCommand", atomicId);
@@ -7698,7 +7829,13 @@ function editorNodeToAstNode(node) {
7698
7829
  if (!tex) {
7699
7830
  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}` };
7700
7831
  }
7701
- astNode = new CommandNode(tex);
7832
+ if (node.expr === "ad") {
7833
+ astNode = new CommandNode("\\mathrm", [], [new ChainNode([new CharNode("d")])]);
7834
+ } else if (["N", "Z", "Q", "R", "C", "H"].includes(node.expr)) {
7835
+ astNode = new CommandNode("\\mathbb", [], [new ChainNode([new CharNode(node.expr)])]);
7836
+ } else {
7837
+ astNode = new CommandNode(tex);
7838
+ }
7702
7839
  } else if (node.kind === "atomicOperatorCommand") {
7703
7840
  const tex = atomicOperatorCommandSpec(node.expr)?.Tex;
7704
7841
  if (!tex) {
@@ -7715,6 +7852,9 @@ function editorNodeToAstNode(node) {
7715
7852
  } else {
7716
7853
  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}` };
7717
7854
  }
7855
+ if (node.sourceLatex) {
7856
+ astNode.sourceLatex = node.sourceLatex;
7857
+ }
7718
7858
  const scripts = attachAstScripts(node, astNode);
7719
7859
  return scripts ?? { ok: true, node: astNode };
7720
7860
  }
@@ -9293,6 +9433,13 @@ ${MATRIX_PICKER_CSS}
9293
9433
  box-shadow: 0 0 0 3px var(--butex-focus-shadow);
9294
9434
  }
9295
9435
 
9436
+ .butex-widget .font-mode-btn--bold,
9437
+ .butex-widget .character-font-option--bold,
9438
+ .butex-widget .butex-widget__command-sheet .character-font-option--bold {
9439
+ font-family: var(--font-display-ar, Amiri), "Noto Serif Arabic", serif;
9440
+ font-weight: 700;
9441
+ }
9442
+
9296
9443
  .butex-widget .font-mode-btn--takween,
9297
9444
  .butex-widget .character-font-option--takween,
9298
9445
  .butex-widget .butex-widget__command-sheet .character-font-option--takween {
@@ -10264,6 +10411,9 @@ function alignmentTitle(alignment, messages) {
10264
10411
  if (alignment === "r") return messages.alignColumnRight;
10265
10412
  return messages.alignColumnCenter;
10266
10413
  }
10414
+ function boldCharacterStyleLabel(uiLocale) {
10415
+ return uiLocale === "ar" ? "\u0639\u0631\u064A\u0636" : "Bold";
10416
+ }
10267
10417
  function characterFontTitle(fontId, messages) {
10268
10418
  const key = characterFontSpec(fontId).titleKey;
10269
10419
  return messages[key] ?? messages.defaultFont;
@@ -10639,18 +10789,31 @@ function EquationMobileToolbar({
10639
10789
  sheetView === "typography" ? /* @__PURE__ */ jsxs(Fragment, { children: [
10640
10790
  /* @__PURE__ */ jsxs("section", { className: "butex-widget__sheet-section", children: [
10641
10791
  /* @__PURE__ */ jsx("h4", { children: messages.chooseWritingFont }),
10642
- /* @__PURE__ */ jsx("div", { className: "butex-widget__sheet-choice-row", children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx(
10643
- "button",
10644
- {
10645
- type: "button",
10646
- className: `character-font-option--${option.id}`,
10647
- "aria-pressed": state.characterFont === option.id,
10648
- title: characterFontTitle(option.id, messages),
10649
- onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentCharacterFont(option.id)),
10650
- children: option.label
10651
- },
10652
- option.id
10653
- )) })
10792
+ /* @__PURE__ */ jsxs("div", { className: "butex-widget__sheet-choice-row", children: [
10793
+ /* @__PURE__ */ jsx(
10794
+ "button",
10795
+ {
10796
+ type: "button",
10797
+ className: "character-font-option--bold",
10798
+ "aria-pressed": state.boldCharacterStyle,
10799
+ title: boldCharacterStyleLabel(uiLocale),
10800
+ onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentBoldCharacterStyle()),
10801
+ children: boldCharacterStyleLabel(uiLocale)
10802
+ }
10803
+ ),
10804
+ CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx(
10805
+ "button",
10806
+ {
10807
+ type: "button",
10808
+ className: `character-font-option--${option.id}`,
10809
+ "aria-pressed": !state.boldCharacterStyle && state.characterFont === option.id,
10810
+ title: characterFontTitle(option.id, messages),
10811
+ onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentCharacterFont(option.id)),
10812
+ children: option.label
10813
+ },
10814
+ option.id
10815
+ ))
10816
+ ] })
10654
10817
  ] }),
10655
10818
  /* @__PURE__ */ jsx(
10656
10819
  "button",
@@ -10970,6 +11133,9 @@ function digitFormLabel(digitForm) {
10970
11133
  function characterFontOption(fontId) {
10971
11134
  return CHARACTER_FONT_OPTIONS.find((option) => option.id === fontId) ?? CHARACTER_FONT_OPTIONS[0];
10972
11135
  }
11136
+ function boldCharacterStyleLabel2(uiLocale) {
11137
+ return uiLocale === "ar" ? "\u0639\u0631\u064A\u0636" : "Bold";
11138
+ }
10973
11139
  function characterFontTitle2(fontId, messages) {
10974
11140
  const key = characterFontSpec(fontId).titleKey;
10975
11141
  return messages[key] ?? messages.defaultFont;
@@ -11074,6 +11240,7 @@ var ButexEditor = forwardRef(
11074
11240
  const [openDesktopMenu, setOpenDesktopMenu] = useState2(null);
11075
11241
  const [selectedDigitForm2, setSelectedDigitForm] = useState2("western");
11076
11242
  const [selectedCharacterFont, setSelectedCharacterFont] = useState2("default");
11243
+ const [boldCharacterStyle, setBoldCharacterStyle] = useState2(initialSession?.currentCharacterWrapper === "\\boldarabic");
11077
11244
  const [activeEditorSide, setActiveEditorSide] = useState2("arabic");
11078
11245
  const [compactPreviewOpen, setCompactPreviewOpen] = useState2(false);
11079
11246
  const [compactControlState, setCompactControlState] = useState2({
@@ -11226,6 +11393,7 @@ ${arabic || currentMessages.empty}`;
11226
11393
  runtimeRef.current?.setSession(next);
11227
11394
  setSelectedDigitForm(next.currentDigitForm ?? "western");
11228
11395
  setSelectedCharacterFont(next.currentCharacterFont ?? "default");
11396
+ setBoldCharacterStyle(next.currentCharacterWrapper === "\\boldarabic");
11229
11397
  setActiveEditorSide(next.activeSide);
11230
11398
  onSessionChangeRef.current?.(next);
11231
11399
  setDebugImportError("");
@@ -11267,6 +11435,7 @@ ${arabic || currentMessages.empty}`;
11267
11435
  onSessionChange: (session) => {
11268
11436
  setSelectedDigitForm(session.currentDigitForm ?? "western");
11269
11437
  setSelectedCharacterFont(session.currentCharacterFont ?? "default");
11438
+ setBoldCharacterStyle(session.currentCharacterWrapper === "\\boldarabic");
11270
11439
  setActiveEditorSide(session.activeSide);
11271
11440
  const hasSelection = Boolean(session.selection && session.selection.anchorIndex !== session.selection.focusIndex);
11272
11441
  const nextCompactState = {
@@ -11349,6 +11518,7 @@ ${arabic || currentMessages.empty}`;
11349
11518
  ...compactControlState,
11350
11519
  activeSide: activeEditorSide,
11351
11520
  characterFont: selectedCharacterFont,
11521
+ boldCharacterStyle,
11352
11522
  digitForm: selectedDigitForm2
11353
11523
  };
11354
11524
  return /* @__PURE__ */ jsx2(
@@ -12375,35 +12545,54 @@ ${arabic || currentMessages.empty}`;
12375
12545
  {
12376
12546
  ref: characterFontBtnRef,
12377
12547
  id: "select-character-font",
12378
- className: `icon-btn font-mode-btn font-mode-btn--${selectedCharacterFont}`,
12548
+ className: `icon-btn font-mode-btn font-mode-btn--${boldCharacterStyle ? "bold" : selectedCharacterFont}`,
12379
12549
  type: "button",
12380
- title: characterFontTitle2(selectedCharacterFont, messages),
12550
+ title: boldCharacterStyle ? boldCharacterStyleLabel2(uiLocale) : characterFontTitle2(selectedCharacterFont, messages),
12381
12551
  "aria-label": messages.chooseWritingFont,
12382
12552
  "aria-haspopup": "listbox",
12383
12553
  "aria-expanded": characterFontMenuOpen,
12384
12554
  onClick: () => setCharacterFontMenuOpen((open) => !open),
12385
- children: characterFontOption(selectedCharacterFont).label
12555
+ children: boldCharacterStyle ? boldCharacterStyleLabel2(uiLocale) : characterFontOption(selectedCharacterFont).label
12386
12556
  }
12387
12557
  ),
12388
- /* @__PURE__ */ jsx2("div", { className: "character-font-options", role: "listbox", "aria-label": messages.chooseWritingFont, hidden: !characterFontMenuOpen, children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx2(
12389
- "button",
12390
- {
12391
- type: "button",
12392
- role: "option",
12393
- "aria-selected": selectedCharacterFont === option.id,
12394
- className: `character-font-option character-font-option--${option.id}`,
12395
- title: characterFontTitle2(option.id, messages),
12396
- onMouseDown: (event) => event.preventDefault(),
12397
- onClick: () => {
12398
- runtimeRef.current?.setCurrentCharacterFont(option.id);
12399
- setSelectedCharacterFont(option.id);
12400
- setCharacterFontMenuOpen(false);
12401
- focusSurface();
12558
+ /* @__PURE__ */ jsxs2("div", { className: "character-font-options", role: "listbox", "aria-label": messages.chooseWritingFont, hidden: !characterFontMenuOpen, children: [
12559
+ /* @__PURE__ */ jsx2(
12560
+ "button",
12561
+ {
12562
+ type: "button",
12563
+ role: "option",
12564
+ "aria-selected": boldCharacterStyle,
12565
+ className: "character-font-option character-font-option--bold",
12566
+ title: boldCharacterStyleLabel2(uiLocale),
12567
+ onMouseDown: (event) => event.preventDefault(),
12568
+ onClick: () => {
12569
+ runtimeRef.current?.setCurrentBoldCharacterStyle();
12570
+ setCharacterFontMenuOpen(false);
12571
+ focusSurface();
12572
+ },
12573
+ children: boldCharacterStyleLabel2(uiLocale)
12574
+ }
12575
+ ),
12576
+ CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx2(
12577
+ "button",
12578
+ {
12579
+ type: "button",
12580
+ role: "option",
12581
+ "aria-selected": !boldCharacterStyle && selectedCharacterFont === option.id,
12582
+ className: `character-font-option character-font-option--${option.id}`,
12583
+ title: characterFontTitle2(option.id, messages),
12584
+ onMouseDown: (event) => event.preventDefault(),
12585
+ onClick: () => {
12586
+ runtimeRef.current?.setCurrentCharacterFont(option.id);
12587
+ setSelectedCharacterFont(option.id);
12588
+ setCharacterFontMenuOpen(false);
12589
+ focusSurface();
12590
+ },
12591
+ children: option.label
12402
12592
  },
12403
- children: option.label
12404
- },
12405
- option.id
12406
- )) })
12593
+ option.id
12594
+ ))
12595
+ ] })
12407
12596
  ]
12408
12597
  }
12409
12598
  ),