@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
@@ -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,
@@ -2157,6 +2172,7 @@ var CHARACTER_FONT_SPECS = [
2157
2172
  latexFontCommand: "\\maghribi",
2158
2173
  latexFontFamily: "Almaghribi Warsh Quran",
2159
2174
  browserFontStack: '"Almaghribi Warsh Quran", Amiri, "Segoe UI", Tahoma, sans-serif',
2175
+ importAliases: ["\\maghribi"],
2160
2176
  svgLayoutKey: "maghribi"
2161
2177
  }
2162
2178
  ];
@@ -2357,6 +2373,14 @@ function renderNodeEnglish(node, options) {
2357
2373
  return `${node.expr}${latinScripts(node, options)}`;
2358
2374
  }
2359
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
+ }
2360
2384
  return `${renderCharContent(node, options)}${latinScripts(node, options)}`;
2361
2385
  }
2362
2386
  if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
@@ -2410,6 +2434,10 @@ function renderNodeArabic(node, options) {
2410
2434
  if (node.kind === "char") {
2411
2435
  const expr = formatDigits(node.expr, selectedDigitForm(options));
2412
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
+ }
2413
2441
  return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
2414
2442
  }
2415
2443
  if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
@@ -3638,6 +3666,16 @@ function markExprSync(session, nodeId) {
3638
3666
  }
3639
3667
  session.sync[nodeId].expr = english.node.expr === arabic.node.expr ? "synced" : "diverged";
3640
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
+ }
3641
3679
  function syncSelectionToCaret(session) {
3642
3680
  const activeKey = activeTreeKey(session.activeSide);
3643
3681
  const tree = session[activeKey];
@@ -4221,7 +4259,10 @@ function insertLeaf(session, kind, expr) {
4221
4259
  const next = cloneEditorSession(session);
4222
4260
  const englishNode = createEditorNode(kind, expr);
4223
4261
  const arabicNode = createEditorNode(kind, expr);
4224
- 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") {
4225
4266
  englishNode.characterFont = next.currentCharacterFont;
4226
4267
  arabicNode.characterFont = next.currentCharacterFont;
4227
4268
  }
@@ -4236,8 +4277,12 @@ function insertLeaf(session, kind, expr) {
4236
4277
  function shouldReverseArabicNumber(session) {
4237
4278
  return session.activeSide === "arabic" && session.arabicReverseNumberTyping;
4238
4279
  }
4239
- function characterFontOf(node) {
4240
- 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"}`;
4241
4286
  }
4242
4287
  function tryMergeLeafTyping(session, kind, fragment) {
4243
4288
  const engLocated = findChainById(session.englishTree, session.caret.chainId);
@@ -4250,14 +4295,14 @@ function tryMergeLeafTyping(session, kind, fragment) {
4250
4295
  let prepend = false;
4251
4296
  if (i > 0) {
4252
4297
  const prev = nodes[i - 1];
4253
- if (prev.kind === kind && (kind !== "char" || characterFontOf(prev) === (session.currentCharacterFont ?? "default"))) {
4298
+ if (prev.kind === kind && (kind !== "char" || characterTypingStyleOf(prev) === currentCharacterTypingStyle(session))) {
4254
4299
  targetId = prev.id;
4255
4300
  prepend = false;
4256
4301
  }
4257
4302
  }
4258
4303
  if (!targetId && i < nodes.length) {
4259
4304
  const fwd = nodes[i];
4260
- if (fwd.kind === kind && (kind !== "char" || characterFontOf(fwd) === (session.currentCharacterFont ?? "default"))) {
4305
+ if (fwd.kind === kind && (kind !== "char" || characterTypingStyleOf(fwd) === currentCharacterTypingStyle(session))) {
4261
4306
  targetId = fwd.id;
4262
4307
  prepend = true;
4263
4308
  }
@@ -4278,6 +4323,7 @@ function tryMergeLeafTyping(session, kind, fragment) {
4278
4323
  englishHit.node.expr = `${englishHit.node.expr}${fragment}`;
4279
4324
  arabicHit.node.expr = `${arabicHit.node.expr}${fragment}`;
4280
4325
  }
4326
+ clearSourceIdentity(session, targetId);
4281
4327
  markExprSync(session, targetId);
4282
4328
  return true;
4283
4329
  }
@@ -4316,9 +4362,17 @@ function breakLeafTyping(session) {
4316
4362
  function setCurrentCharacterFont(session, fontId) {
4317
4363
  const next = cloneEditorSession(session);
4318
4364
  next.currentCharacterFont = fontId;
4365
+ next.currentCharacterWrapper = null;
4319
4366
  appendDebug(next, "setCurrentCharacterFont", fontId);
4320
4367
  return next;
4321
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
+ }
4322
4376
  function toggleTakweenCharacterFont(session) {
4323
4377
  return setCurrentCharacterFont(session, (session.currentCharacterFont ?? "default") === "takween" ? "default" : "takween");
4324
4378
  }
@@ -4867,6 +4921,7 @@ function deleteBackward(session) {
4867
4921
  englishHit.node.expr = englishHit.node.expr.slice(0, -1);
4868
4922
  arabicHit.node.expr = arabicHit.node.expr.slice(0, -1);
4869
4923
  }
4924
+ clearSourceIdentity(next, id);
4870
4925
  markExprSync(next, id);
4871
4926
  next.selectedStructureNodeId = null;
4872
4927
  syncSelectionToCaret(next);
@@ -4916,6 +4971,7 @@ function deleteForward(session) {
4916
4971
  englishHit.node.expr = englishHit.node.expr.slice(1);
4917
4972
  arabicHit.node.expr = arabicHit.node.expr.slice(1);
4918
4973
  }
4974
+ clearSourceIdentity(next, node.id);
4919
4975
  markExprSync(next, node.id);
4920
4976
  next.selectedStructureNodeId = null;
4921
4977
  syncSelectionToCaret(next);
@@ -4945,6 +5001,7 @@ function createStarterSession() {
4945
5001
  forceSplitNextLeaf: false,
4946
5002
  arabicReverseNumberTyping: true,
4947
5003
  currentCharacterFont: "default",
5004
+ currentCharacterWrapper: null,
4948
5005
  currentDigitForm: "western",
4949
5006
  caret: {
4950
5007
  chainId: englishRoot.id,
@@ -5070,6 +5127,9 @@ function buildBaseNodeBody(node, digitForm = "western", side = "english") {
5070
5127
  if (cssClass) {
5071
5128
  value.classList.add(cssClass);
5072
5129
  }
5130
+ if (node.wrapperCommand === "\\boldarabic" || node.wrapperCommand === "\\mathbf") {
5131
+ value.classList.add("node-value--bold");
5132
+ }
5073
5133
  }
5074
5134
  const surfaceExpr = node.kind === "operator" ? divideOperatorSurfaceExpr(node.expr, side) : node.expr;
5075
5135
  value.textContent = surfaceExpr === "" ? "\u25A1" : formatDigits(surfaceExpr, digitForm);
@@ -5990,6 +6050,11 @@ ${BUTEX_FONT_FACE_CSS}
5990
6050
 
5991
6051
  ${CHARACTER_FONT_CSS}
5992
6052
 
6053
+ .node-value--bold {
6054
+ font-family: var(--font-display-ar, Amiri), "Noto Serif Arabic", serif;
6055
+ font-weight: 700;
6056
+ }
6057
+
5993
6058
  .chain {
5994
6059
  display: inline-flex;
5995
6060
  align-items: center;
@@ -6982,6 +7047,10 @@ function createEditorRuntime(options) {
6982
7047
  applyTransient((prev) => setCurrentCharacterFont(prev, fontId));
6983
7048
  focusInput();
6984
7049
  },
7050
+ setCurrentBoldCharacterStyle: () => {
7051
+ applyTransient((prev) => setCurrentBoldCharacterStyle(prev));
7052
+ focusInput();
7053
+ },
6985
7054
  setCurrentDigitForm: (digitForm) => {
6986
7055
  applyStructural((prev) => setCurrentDigitForm(prev, digitForm));
6987
7056
  focusInput();
@@ -7177,6 +7246,10 @@ var CHAR_FONT_EXPORT_TEX = Object.fromEntries(
7177
7246
  function charEditorNodeToAstNode(node) {
7178
7247
  const font = node.characterFont ?? "default";
7179
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
+ }
7180
7253
  if (font === "default") {
7181
7254
  return charNode;
7182
7255
  }
@@ -7203,6 +7276,9 @@ function cloneChainWithFreshIds(chain) {
7203
7276
  return structuredClone(chain);
7204
7277
  }
7205
7278
  function attachScripts(astNode, editorNode) {
7279
+ if (astNode.sourceLatex) {
7280
+ editorNode.sourceLatex = astNode.sourceLatex;
7281
+ }
7206
7282
  if (astNode.superscript) {
7207
7283
  const sup = chainToEditorChain(astNode.superscript);
7208
7284
  if (!sup.editable) {
@@ -7329,6 +7405,49 @@ function charFromTextLikeCommand(node) {
7329
7405
  const scripts = attachScripts(node, editorNode);
7330
7406
  return scripts ?? { editable: true, node: editorNode };
7331
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
+ }
7332
7451
  function commandToEditorNode(node) {
7333
7452
  if (node.name === "\\frac" && node.mandatoryArgs.length >= 2) {
7334
7453
  const frac = createFracNode();
@@ -7418,6 +7537,19 @@ function commandToEditorNode(node) {
7418
7537
  }
7419
7538
  return { editable: true, node: accent };
7420
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
+ }
7421
7553
  const atomicId = commandIdForTex(node.name);
7422
7554
  if (atomicId && node.optionalArgs.length === 0 && node.mandatoryArgs.length === 0) {
7423
7555
  const atomic = createEditorNode("atomicCommand", atomicId);
@@ -7697,7 +7829,13 @@ function editorNodeToAstNode(node) {
7697
7829
  if (!tex) {
7698
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}` };
7699
7831
  }
7700
- 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
+ }
7701
7839
  } else if (node.kind === "atomicOperatorCommand") {
7702
7840
  const tex = atomicOperatorCommandSpec(node.expr)?.Tex;
7703
7841
  if (!tex) {
@@ -7714,6 +7852,9 @@ function editorNodeToAstNode(node) {
7714
7852
  } else {
7715
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}` };
7716
7854
  }
7855
+ if (node.sourceLatex) {
7856
+ astNode.sourceLatex = node.sourceLatex;
7857
+ }
7717
7858
  const scripts = attachAstScripts(node, astNode);
7718
7859
  return scripts ?? { ok: true, node: astNode };
7719
7860
  }
@@ -9292,6 +9433,13 @@ ${MATRIX_PICKER_CSS}
9292
9433
  box-shadow: 0 0 0 3px var(--butex-focus-shadow);
9293
9434
  }
9294
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
+
9295
9443
  .butex-widget .font-mode-btn--takween,
9296
9444
  .butex-widget .character-font-option--takween,
9297
9445
  .butex-widget .butex-widget__command-sheet .character-font-option--takween {
@@ -10263,6 +10411,9 @@ function alignmentTitle(alignment, messages) {
10263
10411
  if (alignment === "r") return messages.alignColumnRight;
10264
10412
  return messages.alignColumnCenter;
10265
10413
  }
10414
+ function boldCharacterStyleLabel(uiLocale) {
10415
+ return uiLocale === "ar" ? "\u0639\u0631\u064A\u0636" : "Bold";
10416
+ }
10266
10417
  function characterFontTitle(fontId, messages) {
10267
10418
  const key = characterFontSpec(fontId).titleKey;
10268
10419
  return messages[key] ?? messages.defaultFont;
@@ -10638,18 +10789,31 @@ function EquationMobileToolbar({
10638
10789
  sheetView === "typography" ? /* @__PURE__ */ jsxs(Fragment, { children: [
10639
10790
  /* @__PURE__ */ jsxs("section", { className: "butex-widget__sheet-section", children: [
10640
10791
  /* @__PURE__ */ jsx("h4", { children: messages.chooseWritingFont }),
10641
- /* @__PURE__ */ jsx("div", { className: "butex-widget__sheet-choice-row", children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx(
10642
- "button",
10643
- {
10644
- type: "button",
10645
- className: `character-font-option--${option.id}`,
10646
- "aria-pressed": state.characterFont === option.id,
10647
- title: characterFontTitle(option.id, messages),
10648
- onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentCharacterFont(option.id)),
10649
- children: option.label
10650
- },
10651
- option.id
10652
- )) })
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
+ ] })
10653
10817
  ] }),
10654
10818
  /* @__PURE__ */ jsx(
10655
10819
  "button",
@@ -10969,6 +11133,9 @@ function digitFormLabel(digitForm) {
10969
11133
  function characterFontOption(fontId) {
10970
11134
  return CHARACTER_FONT_OPTIONS.find((option) => option.id === fontId) ?? CHARACTER_FONT_OPTIONS[0];
10971
11135
  }
11136
+ function boldCharacterStyleLabel2(uiLocale) {
11137
+ return uiLocale === "ar" ? "\u0639\u0631\u064A\u0636" : "Bold";
11138
+ }
10972
11139
  function characterFontTitle2(fontId, messages) {
10973
11140
  const key = characterFontSpec(fontId).titleKey;
10974
11141
  return messages[key] ?? messages.defaultFont;
@@ -11073,6 +11240,7 @@ var ButexEditor = forwardRef(
11073
11240
  const [openDesktopMenu, setOpenDesktopMenu] = useState2(null);
11074
11241
  const [selectedDigitForm2, setSelectedDigitForm] = useState2("western");
11075
11242
  const [selectedCharacterFont, setSelectedCharacterFont] = useState2("default");
11243
+ const [boldCharacterStyle, setBoldCharacterStyle] = useState2(initialSession?.currentCharacterWrapper === "\\boldarabic");
11076
11244
  const [activeEditorSide, setActiveEditorSide] = useState2("arabic");
11077
11245
  const [compactPreviewOpen, setCompactPreviewOpen] = useState2(false);
11078
11246
  const [compactControlState, setCompactControlState] = useState2({
@@ -11225,6 +11393,7 @@ ${arabic || currentMessages.empty}`;
11225
11393
  runtimeRef.current?.setSession(next);
11226
11394
  setSelectedDigitForm(next.currentDigitForm ?? "western");
11227
11395
  setSelectedCharacterFont(next.currentCharacterFont ?? "default");
11396
+ setBoldCharacterStyle(next.currentCharacterWrapper === "\\boldarabic");
11228
11397
  setActiveEditorSide(next.activeSide);
11229
11398
  onSessionChangeRef.current?.(next);
11230
11399
  setDebugImportError("");
@@ -11266,6 +11435,7 @@ ${arabic || currentMessages.empty}`;
11266
11435
  onSessionChange: (session) => {
11267
11436
  setSelectedDigitForm(session.currentDigitForm ?? "western");
11268
11437
  setSelectedCharacterFont(session.currentCharacterFont ?? "default");
11438
+ setBoldCharacterStyle(session.currentCharacterWrapper === "\\boldarabic");
11269
11439
  setActiveEditorSide(session.activeSide);
11270
11440
  const hasSelection = Boolean(session.selection && session.selection.anchorIndex !== session.selection.focusIndex);
11271
11441
  const nextCompactState = {
@@ -11348,6 +11518,7 @@ ${arabic || currentMessages.empty}`;
11348
11518
  ...compactControlState,
11349
11519
  activeSide: activeEditorSide,
11350
11520
  characterFont: selectedCharacterFont,
11521
+ boldCharacterStyle,
11351
11522
  digitForm: selectedDigitForm2
11352
11523
  };
11353
11524
  return /* @__PURE__ */ jsx2(
@@ -12374,35 +12545,54 @@ ${arabic || currentMessages.empty}`;
12374
12545
  {
12375
12546
  ref: characterFontBtnRef,
12376
12547
  id: "select-character-font",
12377
- className: `icon-btn font-mode-btn font-mode-btn--${selectedCharacterFont}`,
12548
+ className: `icon-btn font-mode-btn font-mode-btn--${boldCharacterStyle ? "bold" : selectedCharacterFont}`,
12378
12549
  type: "button",
12379
- title: characterFontTitle2(selectedCharacterFont, messages),
12550
+ title: boldCharacterStyle ? boldCharacterStyleLabel2(uiLocale) : characterFontTitle2(selectedCharacterFont, messages),
12380
12551
  "aria-label": messages.chooseWritingFont,
12381
12552
  "aria-haspopup": "listbox",
12382
12553
  "aria-expanded": characterFontMenuOpen,
12383
12554
  onClick: () => setCharacterFontMenuOpen((open) => !open),
12384
- children: characterFontOption(selectedCharacterFont).label
12555
+ children: boldCharacterStyle ? boldCharacterStyleLabel2(uiLocale) : characterFontOption(selectedCharacterFont).label
12385
12556
  }
12386
12557
  ),
12387
- /* @__PURE__ */ jsx2("div", { className: "character-font-options", role: "listbox", "aria-label": messages.chooseWritingFont, hidden: !characterFontMenuOpen, children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx2(
12388
- "button",
12389
- {
12390
- type: "button",
12391
- role: "option",
12392
- "aria-selected": selectedCharacterFont === option.id,
12393
- className: `character-font-option character-font-option--${option.id}`,
12394
- title: characterFontTitle2(option.id, messages),
12395
- onMouseDown: (event) => event.preventDefault(),
12396
- onClick: () => {
12397
- runtimeRef.current?.setCurrentCharacterFont(option.id);
12398
- setSelectedCharacterFont(option.id);
12399
- setCharacterFontMenuOpen(false);
12400
- 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
12401
12592
  },
12402
- children: option.label
12403
- },
12404
- option.id
12405
- )) })
12593
+ option.id
12594
+ ))
12595
+ ] })
12406
12596
  ]
12407
12597
  }
12408
12598
  ),