@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
@@ -14,6 +14,7 @@ type ArabicNodeJson = {
14
14
  opening?: string;
15
15
  closing?: string;
16
16
  lines?: ChainJson[];
17
+ source_latex?: string;
17
18
  };
18
19
  type ChainJson = {
19
20
  node_type: 'ChainClass';
@@ -26,6 +27,7 @@ declare class BaseAstNode {
26
27
  superscript: ChainNode | null;
27
28
  subscript: ChainNode | null;
28
29
  nodeType: string;
30
+ sourceLatex: string | null;
29
31
  constructor(state?: State | null);
30
32
  latex(): string;
31
33
  arabicLatex(): string;
@@ -14,6 +14,7 @@ type ArabicNodeJson = {
14
14
  opening?: string;
15
15
  closing?: string;
16
16
  lines?: ChainJson[];
17
+ source_latex?: string;
17
18
  };
18
19
  type ChainJson = {
19
20
  node_type: 'ChainClass';
@@ -26,6 +27,7 @@ declare class BaseAstNode {
26
27
  superscript: ChainNode | null;
27
28
  subscript: ChainNode | null;
28
29
  nodeType: string;
30
+ sourceLatex: string | null;
29
31
  constructor(state?: State | null);
30
32
  latex(): string;
31
33
  arabicLatex(): string;
@@ -46,6 +46,7 @@ var BaseAstNode = class {
46
46
  superscript;
47
47
  subscript;
48
48
  nodeType;
49
+ sourceLatex;
49
50
  constructor(state = null) {
50
51
  if (state === null) {
51
52
  state = new State();
@@ -54,6 +55,7 @@ var BaseAstNode = class {
54
55
  this.superscript = null;
55
56
  this.subscript = null;
56
57
  this.nodeType = this.constructor.name;
58
+ this.sourceLatex = null;
57
59
  }
58
60
  latex() {
59
61
  throw new Error("NotImplementedError");
@@ -242,6 +244,7 @@ ${this.closing}`;
242
244
  }
243
245
  };
244
246
  function parseScripts(node, json, mode) {
247
+ node.sourceLatex = typeof json.source_latex === "string" && json.source_latex.length > 0 ? json.source_latex : null;
245
248
  if (json.superscript) {
246
249
  node.superscript = parseChain(json.superscript, mode);
247
250
  }
@@ -381,7 +384,8 @@ function fromMathObjectJson(json, mode = "english") {
381
384
  function scriptsToJson(node, path) {
382
385
  return {
383
386
  ...node.superscript ? { superscript: chainToJson(node.superscript, `${path}.superscript`) } : {},
384
- ...node.subscript ? { subscript: chainToJson(node.subscript, `${path}.subscript`) } : {}
387
+ ...node.subscript ? { subscript: chainToJson(node.subscript, `${path}.subscript`) } : {},
388
+ ...node.sourceLatex ? { source_latex: node.sourceLatex } : {}
385
389
  };
386
390
  }
387
391
  function nodeToJson(node, path) {
@@ -1294,6 +1298,15 @@ var ATOMIC_OPERATOR_COMMANDS = {
1294
1298
  title: "\u0627\u0644\u0644\u0627\u0646\u0647\u0627\u064A\u0629",
1295
1299
  svg_path: null
1296
1300
  },
1301
+ top: {
1302
+ id: "top",
1303
+ category: "operators1",
1304
+ Tex: "\\top",
1305
+ mirror: false,
1306
+ Label: "\u22A4",
1307
+ title: "\u0627\u0644\u0645\u0646\u0642\u0648\u0644",
1308
+ svg_path: null
1309
+ },
1297
1310
  times: {
1298
1311
  id: "times",
1299
1312
  category: "operators1",
@@ -2045,6 +2058,7 @@ function cloneEditorSession(session) {
2045
2058
  forceSplitNextLeaf: session.forceSplitNextLeaf,
2046
2059
  arabicReverseNumberTyping: session.arabicReverseNumberTyping,
2047
2060
  currentCharacterFont: session.currentCharacterFont ?? "default",
2061
+ currentCharacterWrapper: session.currentCharacterWrapper ?? null,
2048
2062
  currentDigitForm: session.currentDigitForm ?? "western",
2049
2063
  caret: { ...session.caret },
2050
2064
  selection: session.selection ? { ...session.selection } : null,
@@ -2117,6 +2131,7 @@ function createEditorSession(englishTree, arabicTree, activeSide = "arabic") {
2117
2131
  forceSplitNextLeaf: false,
2118
2132
  arabicReverseNumberTyping: true,
2119
2133
  currentCharacterFont: "default",
2134
+ currentCharacterWrapper: null,
2120
2135
  currentDigitForm: "western",
2121
2136
  caret: {
2122
2137
  chainId: englishTree.id,
@@ -2186,6 +2201,7 @@ var CHARACTER_FONT_SPECS = [
2186
2201
  latexFontCommand: "\\maghribi",
2187
2202
  latexFontFamily: "Almaghribi Warsh Quran",
2188
2203
  browserFontStack: '"Almaghribi Warsh Quran", Amiri, "Segoe UI", Tahoma, sans-serif',
2204
+ importAliases: ["\\maghribi"],
2189
2205
  svgLayoutKey: "maghribi"
2190
2206
  }
2191
2207
  ];
@@ -2386,6 +2402,14 @@ function renderNodeEnglish(node, options) {
2386
2402
  return `${node.expr}${latinScripts(node, options)}`;
2387
2403
  }
2388
2404
  if (node.kind === "char") {
2405
+ if (node.sourceLatex) {
2406
+ return `${node.sourceLatex}${latinScripts(node, options)}`;
2407
+ }
2408
+ if (node.wrapperCommand) {
2409
+ const expr = formatDigits(node.expr, selectedDigitForm(options));
2410
+ const wrapper = node.wrapperCommand === "\\boldarabic" ? "\\mathbf" : node.wrapperCommand;
2411
+ return `${wrapper}{${escapeText(expr)}}${latinScripts(node, options)}`;
2412
+ }
2389
2413
  return `${renderCharContent(node, options)}${latinScripts(node, options)}`;
2390
2414
  }
2391
2415
  if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
@@ -2439,6 +2463,10 @@ function renderNodeArabic(node, options) {
2439
2463
  if (node.kind === "char") {
2440
2464
  const expr = formatDigits(node.expr, selectedDigitForm(options));
2441
2465
  const content = renderCharContent(node, options);
2466
+ if (node.wrapperCommand) {
2467
+ const wrapper = node.wrapperCommand === "\\mathbf" ? "\\boldarabic" : node.wrapperCommand;
2468
+ return arabicScripts(node, `${wrapper}{${content}}`, options);
2469
+ }
2442
2470
  return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
2443
2471
  }
2444
2472
  if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
@@ -3667,6 +3695,16 @@ function markExprSync(session, nodeId) {
3667
3695
  }
3668
3696
  session.sync[nodeId].expr = english.node.expr === arabic.node.expr ? "synced" : "diverged";
3669
3697
  }
3698
+ function clearSourceIdentity(session, nodeId) {
3699
+ const english = findNodeById(session.englishTree, nodeId);
3700
+ const arabic = findNodeById(session.arabicTree, nodeId);
3701
+ if (english) {
3702
+ delete english.node.sourceLatex;
3703
+ }
3704
+ if (arabic) {
3705
+ delete arabic.node.sourceLatex;
3706
+ }
3707
+ }
3670
3708
  function syncSelectionToCaret(session) {
3671
3709
  const activeKey = activeTreeKey(session.activeSide);
3672
3710
  const tree = session[activeKey];
@@ -4250,7 +4288,10 @@ function insertLeaf(session, kind, expr) {
4250
4288
  const next = cloneEditorSession(session);
4251
4289
  const englishNode = createEditorNode(kind, expr);
4252
4290
  const arabicNode = createEditorNode(kind, expr);
4253
- if (kind === "char" && (next.currentCharacterFont ?? "default") !== "default") {
4291
+ if (kind === "char" && next.currentCharacterWrapper === "\\boldarabic") {
4292
+ englishNode.wrapperCommand = "\\boldarabic";
4293
+ arabicNode.wrapperCommand = "\\boldarabic";
4294
+ } else if (kind === "char" && (next.currentCharacterFont ?? "default") !== "default") {
4254
4295
  englishNode.characterFont = next.currentCharacterFont;
4255
4296
  arabicNode.characterFont = next.currentCharacterFont;
4256
4297
  }
@@ -4265,8 +4306,12 @@ function insertLeaf(session, kind, expr) {
4265
4306
  function shouldReverseArabicNumber(session) {
4266
4307
  return session.activeSide === "arabic" && session.arabicReverseNumberTyping;
4267
4308
  }
4268
- function characterFontOf(node) {
4269
- return node.kind === "char" ? node.characterFont ?? "default" : "default";
4309
+ function characterTypingStyleOf(node) {
4310
+ if (node.kind !== "char") return "none";
4311
+ return node.wrapperCommand ? `wrapper:${node.wrapperCommand}` : `font:${node.characterFont ?? "default"}`;
4312
+ }
4313
+ function currentCharacterTypingStyle(session) {
4314
+ return session.currentCharacterWrapper ? `wrapper:${session.currentCharacterWrapper}` : `font:${session.currentCharacterFont ?? "default"}`;
4270
4315
  }
4271
4316
  function tryMergeLeafTyping(session, kind, fragment) {
4272
4317
  const engLocated = findChainById(session.englishTree, session.caret.chainId);
@@ -4279,14 +4324,14 @@ function tryMergeLeafTyping(session, kind, fragment) {
4279
4324
  let prepend = false;
4280
4325
  if (i > 0) {
4281
4326
  const prev = nodes[i - 1];
4282
- if (prev.kind === kind && (kind !== "char" || characterFontOf(prev) === (session.currentCharacterFont ?? "default"))) {
4327
+ if (prev.kind === kind && (kind !== "char" || characterTypingStyleOf(prev) === currentCharacterTypingStyle(session))) {
4283
4328
  targetId = prev.id;
4284
4329
  prepend = false;
4285
4330
  }
4286
4331
  }
4287
4332
  if (!targetId && i < nodes.length) {
4288
4333
  const fwd = nodes[i];
4289
- if (fwd.kind === kind && (kind !== "char" || characterFontOf(fwd) === (session.currentCharacterFont ?? "default"))) {
4334
+ if (fwd.kind === kind && (kind !== "char" || characterTypingStyleOf(fwd) === currentCharacterTypingStyle(session))) {
4290
4335
  targetId = fwd.id;
4291
4336
  prepend = true;
4292
4337
  }
@@ -4307,6 +4352,7 @@ function tryMergeLeafTyping(session, kind, fragment) {
4307
4352
  englishHit.node.expr = `${englishHit.node.expr}${fragment}`;
4308
4353
  arabicHit.node.expr = `${arabicHit.node.expr}${fragment}`;
4309
4354
  }
4355
+ clearSourceIdentity(session, targetId);
4310
4356
  markExprSync(session, targetId);
4311
4357
  return true;
4312
4358
  }
@@ -4345,9 +4391,17 @@ function breakLeafTyping(session) {
4345
4391
  function setCurrentCharacterFont(session, fontId) {
4346
4392
  const next = cloneEditorSession(session);
4347
4393
  next.currentCharacterFont = fontId;
4394
+ next.currentCharacterWrapper = null;
4348
4395
  appendDebug(next, "setCurrentCharacterFont", fontId);
4349
4396
  return next;
4350
4397
  }
4398
+ function setCurrentBoldCharacterStyle(session) {
4399
+ const next = cloneEditorSession(session);
4400
+ next.currentCharacterFont = "default";
4401
+ next.currentCharacterWrapper = "\\boldarabic";
4402
+ appendDebug(next, "setCurrentBoldCharacterStyle", "\\boldarabic");
4403
+ return next;
4404
+ }
4351
4405
  function toggleTakweenCharacterFont(session) {
4352
4406
  return setCurrentCharacterFont(session, (session.currentCharacterFont ?? "default") === "takween" ? "default" : "takween");
4353
4407
  }
@@ -4896,6 +4950,7 @@ function deleteBackward(session) {
4896
4950
  englishHit.node.expr = englishHit.node.expr.slice(0, -1);
4897
4951
  arabicHit.node.expr = arabicHit.node.expr.slice(0, -1);
4898
4952
  }
4953
+ clearSourceIdentity(next, id);
4899
4954
  markExprSync(next, id);
4900
4955
  next.selectedStructureNodeId = null;
4901
4956
  syncSelectionToCaret(next);
@@ -4945,6 +5000,7 @@ function deleteForward(session) {
4945
5000
  englishHit.node.expr = englishHit.node.expr.slice(1);
4946
5001
  arabicHit.node.expr = arabicHit.node.expr.slice(1);
4947
5002
  }
5003
+ clearSourceIdentity(next, node.id);
4948
5004
  markExprSync(next, node.id);
4949
5005
  next.selectedStructureNodeId = null;
4950
5006
  syncSelectionToCaret(next);
@@ -4974,6 +5030,7 @@ function createStarterSession() {
4974
5030
  forceSplitNextLeaf: false,
4975
5031
  arabicReverseNumberTyping: true,
4976
5032
  currentCharacterFont: "default",
5033
+ currentCharacterWrapper: null,
4977
5034
  currentDigitForm: "western",
4978
5035
  caret: {
4979
5036
  chainId: englishRoot.id,
@@ -5099,6 +5156,9 @@ function buildBaseNodeBody(node, digitForm = "western", side = "english") {
5099
5156
  if (cssClass) {
5100
5157
  value.classList.add(cssClass);
5101
5158
  }
5159
+ if (node.wrapperCommand === "\\boldarabic" || node.wrapperCommand === "\\mathbf") {
5160
+ value.classList.add("node-value--bold");
5161
+ }
5102
5162
  }
5103
5163
  const surfaceExpr = node.kind === "operator" ? divideOperatorSurfaceExpr(node.expr, side) : node.expr;
5104
5164
  value.textContent = surfaceExpr === "" ? "\u25A1" : formatDigits(surfaceExpr, digitForm);
@@ -6019,6 +6079,11 @@ ${BUTEX_FONT_FACE_CSS}
6019
6079
 
6020
6080
  ${CHARACTER_FONT_CSS}
6021
6081
 
6082
+ .node-value--bold {
6083
+ font-family: var(--font-display-ar, Amiri), "Noto Serif Arabic", serif;
6084
+ font-weight: 700;
6085
+ }
6086
+
6022
6087
  .chain {
6023
6088
  display: inline-flex;
6024
6089
  align-items: center;
@@ -7011,6 +7076,10 @@ function createEditorRuntime(options) {
7011
7076
  applyTransient((prev) => setCurrentCharacterFont(prev, fontId));
7012
7077
  focusInput();
7013
7078
  },
7079
+ setCurrentBoldCharacterStyle: () => {
7080
+ applyTransient((prev) => setCurrentBoldCharacterStyle(prev));
7081
+ focusInput();
7082
+ },
7014
7083
  setCurrentDigitForm: (digitForm) => {
7015
7084
  applyStructural((prev) => setCurrentDigitForm(prev, digitForm));
7016
7085
  focusInput();
@@ -7206,6 +7275,10 @@ var CHAR_FONT_EXPORT_TEX = Object.fromEntries(
7206
7275
  function charEditorNodeToAstNode(node) {
7207
7276
  const font = node.characterFont ?? "default";
7208
7277
  const charNode = new CharNode(node.expr);
7278
+ if (node.wrapperCommand) {
7279
+ const wrapper = node.wrapperCommand === "\\boldarabic" ? "\\mathbf" : node.wrapperCommand;
7280
+ return new CommandNode(wrapper, [], [new ChainNode([charNode])]);
7281
+ }
7209
7282
  if (font === "default") {
7210
7283
  return charNode;
7211
7284
  }
@@ -7232,6 +7305,9 @@ function cloneChainWithFreshIds(chain) {
7232
7305
  return structuredClone(chain);
7233
7306
  }
7234
7307
  function attachScripts(astNode, editorNode) {
7308
+ if (astNode.sourceLatex) {
7309
+ editorNode.sourceLatex = astNode.sourceLatex;
7310
+ }
7235
7311
  if (astNode.superscript) {
7236
7312
  const sup = chainToEditorChain(astNode.superscript);
7237
7313
  if (!sup.editable) {
@@ -7358,6 +7434,49 @@ function charFromTextLikeCommand(node) {
7358
7434
  const scripts = attachScripts(node, editorNode);
7359
7435
  return scripts ?? { editable: true, node: editorNode };
7360
7436
  }
7437
+ function singleCommandChar(node) {
7438
+ if (node.optionalArgs.length > 0 || node.mandatoryArgs.length !== 1) {
7439
+ return null;
7440
+ }
7441
+ const arg = node.mandatoryArgs[0];
7442
+ if (arg.chain.length !== 1 || !(arg.chain[0] instanceof CharNode)) {
7443
+ return null;
7444
+ }
7445
+ return arg.chain[0];
7446
+ }
7447
+ function wrappedAtomicCommandId(node) {
7448
+ if (node.name !== "\\mathbb" && node.name !== "\\mathrm") {
7449
+ return null;
7450
+ }
7451
+ const child = singleCommandChar(node);
7452
+ if (!child) {
7453
+ return null;
7454
+ }
7455
+ return commandIdForTex(`${node.name}{${child.expr}}`);
7456
+ }
7457
+ function editableWrapperCommand(node) {
7458
+ if (node.name !== "\\mathtt" && node.name !== "\\mathsf" && node.name !== "\\unit" && node.name !== "\\mathbf" && node.name !== "\\boldarabic") {
7459
+ return null;
7460
+ }
7461
+ const child = singleCommandChar(node);
7462
+ if (!child) {
7463
+ return null;
7464
+ }
7465
+ const normalized = normalizeCharImportExpr(child.expr);
7466
+ const editorNode = createEditorNode("char", normalized.expr);
7467
+ if (normalized.characterFont !== "default") {
7468
+ editorNode.characterFont = normalized.characterFont;
7469
+ }
7470
+ editorNode.wrapperCommand = node.name === "\\mathtt" ? "\\mathtt" : node.name === "\\mathbf" ? "\\mathbf" : node.name === "\\boldarabic" ? "\\boldarabic" : "\\unit";
7471
+ const scripts = attachScripts(node, editorNode);
7472
+ if (scripts) {
7473
+ return scripts;
7474
+ }
7475
+ if (!editorNode.sourceLatex && node.name === "\\mathsf") {
7476
+ editorNode.sourceLatex = `\\mathsf{${child.expr}}`;
7477
+ }
7478
+ return { editable: true, node: editorNode };
7479
+ }
7361
7480
  function commandToEditorNode(node) {
7362
7481
  if (node.name === "\\frac" && node.mandatoryArgs.length >= 2) {
7363
7482
  const frac = createFracNode();
@@ -7447,6 +7566,19 @@ function commandToEditorNode(node) {
7447
7566
  }
7448
7567
  return { editable: true, node: accent };
7449
7568
  }
7569
+ const wrappedAtomicId = wrappedAtomicCommandId(node);
7570
+ if (wrappedAtomicId) {
7571
+ const atomic = createEditorNode("atomicCommand", wrappedAtomicId);
7572
+ const scripts = attachScripts(node, atomic);
7573
+ if (scripts) {
7574
+ return scripts;
7575
+ }
7576
+ return { editable: true, node: atomic };
7577
+ }
7578
+ const wrapper = editableWrapperCommand(node);
7579
+ if (wrapper) {
7580
+ return wrapper;
7581
+ }
7450
7582
  const atomicId = commandIdForTex(node.name);
7451
7583
  if (atomicId && node.optionalArgs.length === 0 && node.mandatoryArgs.length === 0) {
7452
7584
  const atomic = createEditorNode("atomicCommand", atomicId);
@@ -7726,7 +7858,13 @@ function editorNodeToAstNode(node) {
7726
7858
  if (!tex) {
7727
7859
  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}` };
7728
7860
  }
7729
- astNode = new CommandNode(tex);
7861
+ if (node.expr === "ad") {
7862
+ astNode = new CommandNode("\\mathrm", [], [new ChainNode([new CharNode("d")])]);
7863
+ } else if (["N", "Z", "Q", "R", "C", "H"].includes(node.expr)) {
7864
+ astNode = new CommandNode("\\mathbb", [], [new ChainNode([new CharNode(node.expr)])]);
7865
+ } else {
7866
+ astNode = new CommandNode(tex);
7867
+ }
7730
7868
  } else if (node.kind === "atomicOperatorCommand") {
7731
7869
  const tex = atomicOperatorCommandSpec(node.expr)?.Tex;
7732
7870
  if (!tex) {
@@ -7743,6 +7881,9 @@ function editorNodeToAstNode(node) {
7743
7881
  } else {
7744
7882
  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}` };
7745
7883
  }
7884
+ if (node.sourceLatex) {
7885
+ astNode.sourceLatex = node.sourceLatex;
7886
+ }
7746
7887
  const scripts = attachAstScripts(node, astNode);
7747
7888
  return scripts ?? { ok: true, node: astNode };
7748
7889
  }
@@ -9313,6 +9454,13 @@ ${MATRIX_PICKER_CSS}
9313
9454
  box-shadow: 0 0 0 3px var(--butex-focus-shadow);
9314
9455
  }
9315
9456
 
9457
+ .butex-widget .font-mode-btn--bold,
9458
+ .butex-widget .character-font-option--bold,
9459
+ .butex-widget .butex-widget__command-sheet .character-font-option--bold {
9460
+ font-family: var(--font-display-ar, Amiri), "Noto Serif Arabic", serif;
9461
+ font-weight: 700;
9462
+ }
9463
+
9316
9464
  .butex-widget .font-mode-btn--takween,
9317
9465
  .butex-widget .character-font-option--takween,
9318
9466
  .butex-widget .butex-widget__command-sheet .character-font-option--takween {
@@ -10284,6 +10432,9 @@ function alignmentTitle(alignment, messages) {
10284
10432
  if (alignment === "r") return messages.alignColumnRight;
10285
10433
  return messages.alignColumnCenter;
10286
10434
  }
10435
+ function boldCharacterStyleLabel(uiLocale) {
10436
+ return uiLocale === "ar" ? "\u0639\u0631\u064A\u0636" : "Bold";
10437
+ }
10287
10438
  function characterFontTitle(fontId, messages) {
10288
10439
  const key = characterFontSpec(fontId).titleKey;
10289
10440
  return messages[key] ?? messages.defaultFont;
@@ -10659,18 +10810,31 @@ function EquationMobileToolbar({
10659
10810
  sheetView === "typography" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
10660
10811
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "butex-widget__sheet-section", children: [
10661
10812
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { children: messages.chooseWritingFont }),
10662
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "butex-widget__sheet-choice-row", children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10663
- "button",
10664
- {
10665
- type: "button",
10666
- className: `character-font-option--${option.id}`,
10667
- "aria-pressed": state.characterFont === option.id,
10668
- title: characterFontTitle(option.id, messages),
10669
- onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentCharacterFont(option.id)),
10670
- children: option.label
10671
- },
10672
- option.id
10673
- )) })
10813
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "butex-widget__sheet-choice-row", children: [
10814
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10815
+ "button",
10816
+ {
10817
+ type: "button",
10818
+ className: "character-font-option--bold",
10819
+ "aria-pressed": state.boldCharacterStyle,
10820
+ title: boldCharacterStyleLabel(uiLocale),
10821
+ onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentBoldCharacterStyle()),
10822
+ children: boldCharacterStyleLabel(uiLocale)
10823
+ }
10824
+ ),
10825
+ CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10826
+ "button",
10827
+ {
10828
+ type: "button",
10829
+ className: `character-font-option--${option.id}`,
10830
+ "aria-pressed": !state.boldCharacterStyle && state.characterFont === option.id,
10831
+ title: characterFontTitle(option.id, messages),
10832
+ onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentCharacterFont(option.id)),
10833
+ children: option.label
10834
+ },
10835
+ option.id
10836
+ ))
10837
+ ] })
10674
10838
  ] }),
10675
10839
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10676
10840
  "button",
@@ -10990,6 +11154,9 @@ function digitFormLabel(digitForm) {
10990
11154
  function characterFontOption(fontId) {
10991
11155
  return CHARACTER_FONT_OPTIONS.find((option) => option.id === fontId) ?? CHARACTER_FONT_OPTIONS[0];
10992
11156
  }
11157
+ function boldCharacterStyleLabel2(uiLocale) {
11158
+ return uiLocale === "ar" ? "\u0639\u0631\u064A\u0636" : "Bold";
11159
+ }
10993
11160
  function characterFontTitle2(fontId, messages) {
10994
11161
  const key = characterFontSpec(fontId).titleKey;
10995
11162
  return messages[key] ?? messages.defaultFont;
@@ -11094,6 +11261,7 @@ var ButexEditor = (0, import_react4.forwardRef)(
11094
11261
  const [openDesktopMenu, setOpenDesktopMenu] = (0, import_react4.useState)(null);
11095
11262
  const [selectedDigitForm2, setSelectedDigitForm] = (0, import_react4.useState)("western");
11096
11263
  const [selectedCharacterFont, setSelectedCharacterFont] = (0, import_react4.useState)("default");
11264
+ const [boldCharacterStyle, setBoldCharacterStyle] = (0, import_react4.useState)(initialSession?.currentCharacterWrapper === "\\boldarabic");
11097
11265
  const [activeEditorSide, setActiveEditorSide] = (0, import_react4.useState)("arabic");
11098
11266
  const [compactPreviewOpen, setCompactPreviewOpen] = (0, import_react4.useState)(false);
11099
11267
  const [compactControlState, setCompactControlState] = (0, import_react4.useState)({
@@ -11246,6 +11414,7 @@ ${arabic || currentMessages.empty}`;
11246
11414
  runtimeRef.current?.setSession(next);
11247
11415
  setSelectedDigitForm(next.currentDigitForm ?? "western");
11248
11416
  setSelectedCharacterFont(next.currentCharacterFont ?? "default");
11417
+ setBoldCharacterStyle(next.currentCharacterWrapper === "\\boldarabic");
11249
11418
  setActiveEditorSide(next.activeSide);
11250
11419
  onSessionChangeRef.current?.(next);
11251
11420
  setDebugImportError("");
@@ -11287,6 +11456,7 @@ ${arabic || currentMessages.empty}`;
11287
11456
  onSessionChange: (session) => {
11288
11457
  setSelectedDigitForm(session.currentDigitForm ?? "western");
11289
11458
  setSelectedCharacterFont(session.currentCharacterFont ?? "default");
11459
+ setBoldCharacterStyle(session.currentCharacterWrapper === "\\boldarabic");
11290
11460
  setActiveEditorSide(session.activeSide);
11291
11461
  const hasSelection = Boolean(session.selection && session.selection.anchorIndex !== session.selection.focusIndex);
11292
11462
  const nextCompactState = {
@@ -11369,6 +11539,7 @@ ${arabic || currentMessages.empty}`;
11369
11539
  ...compactControlState,
11370
11540
  activeSide: activeEditorSide,
11371
11541
  characterFont: selectedCharacterFont,
11542
+ boldCharacterStyle,
11372
11543
  digitForm: selectedDigitForm2
11373
11544
  };
11374
11545
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
@@ -12395,35 +12566,54 @@ ${arabic || currentMessages.empty}`;
12395
12566
  {
12396
12567
  ref: characterFontBtnRef,
12397
12568
  id: "select-character-font",
12398
- className: `icon-btn font-mode-btn font-mode-btn--${selectedCharacterFont}`,
12569
+ className: `icon-btn font-mode-btn font-mode-btn--${boldCharacterStyle ? "bold" : selectedCharacterFont}`,
12399
12570
  type: "button",
12400
- title: characterFontTitle2(selectedCharacterFont, messages),
12571
+ title: boldCharacterStyle ? boldCharacterStyleLabel2(uiLocale) : characterFontTitle2(selectedCharacterFont, messages),
12401
12572
  "aria-label": messages.chooseWritingFont,
12402
12573
  "aria-haspopup": "listbox",
12403
12574
  "aria-expanded": characterFontMenuOpen,
12404
12575
  onClick: () => setCharacterFontMenuOpen((open) => !open),
12405
- children: characterFontOption(selectedCharacterFont).label
12576
+ children: boldCharacterStyle ? boldCharacterStyleLabel2(uiLocale) : characterFontOption(selectedCharacterFont).label
12406
12577
  }
12407
12578
  ),
12408
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "character-font-options", role: "listbox", "aria-label": messages.chooseWritingFont, hidden: !characterFontMenuOpen, children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
12409
- "button",
12410
- {
12411
- type: "button",
12412
- role: "option",
12413
- "aria-selected": selectedCharacterFont === option.id,
12414
- className: `character-font-option character-font-option--${option.id}`,
12415
- title: characterFontTitle2(option.id, messages),
12416
- onMouseDown: (event) => event.preventDefault(),
12417
- onClick: () => {
12418
- runtimeRef.current?.setCurrentCharacterFont(option.id);
12419
- setSelectedCharacterFont(option.id);
12420
- setCharacterFontMenuOpen(false);
12421
- focusSurface();
12579
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "character-font-options", role: "listbox", "aria-label": messages.chooseWritingFont, hidden: !characterFontMenuOpen, children: [
12580
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
12581
+ "button",
12582
+ {
12583
+ type: "button",
12584
+ role: "option",
12585
+ "aria-selected": boldCharacterStyle,
12586
+ className: "character-font-option character-font-option--bold",
12587
+ title: boldCharacterStyleLabel2(uiLocale),
12588
+ onMouseDown: (event) => event.preventDefault(),
12589
+ onClick: () => {
12590
+ runtimeRef.current?.setCurrentBoldCharacterStyle();
12591
+ setCharacterFontMenuOpen(false);
12592
+ focusSurface();
12593
+ },
12594
+ children: boldCharacterStyleLabel2(uiLocale)
12595
+ }
12596
+ ),
12597
+ CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
12598
+ "button",
12599
+ {
12600
+ type: "button",
12601
+ role: "option",
12602
+ "aria-selected": !boldCharacterStyle && selectedCharacterFont === option.id,
12603
+ className: `character-font-option character-font-option--${option.id}`,
12604
+ title: characterFontTitle2(option.id, messages),
12605
+ onMouseDown: (event) => event.preventDefault(),
12606
+ onClick: () => {
12607
+ runtimeRef.current?.setCurrentCharacterFont(option.id);
12608
+ setSelectedCharacterFont(option.id);
12609
+ setCharacterFontMenuOpen(false);
12610
+ focusSurface();
12611
+ },
12612
+ children: option.label
12422
12613
  },
12423
- children: option.label
12424
- },
12425
- option.id
12426
- )) })
12614
+ option.id
12615
+ ))
12616
+ ] })
12427
12617
  ]
12428
12618
  }
12429
12619
  ),