@drghaliasri/butex 4.1.0 → 4.3.0

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.
package/dist/index.d.mts CHANGED
@@ -400,6 +400,15 @@ declare const ATOMIC_COMMANDS: {
400
400
  readonly arabicLabel: "محدد";
401
401
  readonly title: "محدد";
402
402
  };
403
+ readonly ad: {
404
+ readonly id: "ad";
405
+ readonly category: "derivative";
406
+ readonly englishTex: "\\mathrm{d}";
407
+ readonly englishLabel: "d";
408
+ readonly arabicTex: "\\ad";
409
+ readonly arabicLabel: "ء";
410
+ readonly title: "علامة الاشتقاق";
411
+ };
403
412
  readonly N: {
404
413
  readonly id: "N";
405
414
  readonly category: "groups";
@@ -510,10 +519,11 @@ declare const ATOMIC_COMMANDS: {
510
519
  };
511
520
  };
512
521
  type AtomicCommandId = keyof typeof ATOMIC_COMMANDS;
513
- type AtomicCommandCategory = 'function' | 'function2' | 'limits_series' | 'groups' | 'spacing';
522
+ type AtomicCommandCategory = 'function' | 'function2' | 'limits_series' | 'groups' | 'spacing' | 'derivative';
514
523
  type SpacingDirection = 'positive' | 'negative';
515
524
  type AtomicCommandSpec = (typeof ATOMIC_COMMANDS)[AtomicCommandId] & {
516
525
  arabicRenderTex?: string;
526
+ englishLabel?: string;
517
527
  };
518
528
  type SpacingCommandSpec = AtomicCommandSpec & {
519
529
  category: 'spacing';
@@ -1163,11 +1173,14 @@ declare function toggleTakweenCharacterFont(session: EditorSession): EditorSessi
1163
1173
  declare function setCurrentDigitForm(session: EditorSession, digitForm: DigitFormId): EditorSession;
1164
1174
  declare function insertChar(session: EditorSession, expr: string): EditorSession;
1165
1175
  declare function insertNumber(session: EditorSession, expr: string): EditorSession;
1176
+ declare function insertDivideOperator(session: EditorSession): EditorSession;
1166
1177
  declare function insertOperator(session: EditorSession, expr: string): EditorSession;
1167
1178
  declare function insertAtomicCommand(session: EditorSession, commandId: AtomicCommandId): EditorSession;
1168
1179
  declare function insertAtomicOperatorCommand(session: EditorSession, commandId: AtomicOperatorCommandId): EditorSession;
1169
1180
  declare function insertDelimiterPair(session: EditorSession, leftDelimExpr: string, rightDelimExpr: string): EditorSession;
1170
1181
  declare function insertFraction(session: EditorSession): EditorSession;
1182
+ declare function insertFirstDerivative(session: EditorSession): EditorSession;
1183
+ declare function insertSecondDerivative(session: EditorSession): EditorSession;
1171
1184
  declare function insertSqrt(session: EditorSession): EditorSession;
1172
1185
  declare function insertMatrixEnv(session: EditorSession, style: MatrixEnvStyle, rows: number, columns: number): EditorSession;
1173
1186
  declare function insertArrayEnv(session: EditorSession, rows: number, columns: number, columnAlignments?: EnvColumnAlignment[]): EditorSession;
@@ -1268,6 +1281,8 @@ type EditorRuntimeApi = {
1268
1281
  setCurrentDigitForm: (digitForm: DigitFormId) => void;
1269
1282
  insertDelimiterByKind: (kind: 'paren' | 'bracket' | 'brace') => void;
1270
1283
  insertFraction: () => void;
1284
+ insertFirstDerivative: () => void;
1285
+ insertSecondDerivative: () => void;
1271
1286
  insertMatrixEnv: (style: MatrixEnvStyle, rows: number, columns: number) => void;
1272
1287
  insertArrayEnv: (rows: number, columns: number) => void;
1273
1288
  insertAlignedEnv: (rows: number, columns: number) => void;
@@ -1381,10 +1396,13 @@ declare const index_insertAtomicCommand: typeof insertAtomicCommand;
1381
1396
  declare const index_insertAtomicOperatorCommand: typeof insertAtomicOperatorCommand;
1382
1397
  declare const index_insertChar: typeof insertChar;
1383
1398
  declare const index_insertDelimiterPair: typeof insertDelimiterPair;
1399
+ declare const index_insertDivideOperator: typeof insertDivideOperator;
1400
+ declare const index_insertFirstDerivative: typeof insertFirstDerivative;
1384
1401
  declare const index_insertFraction: typeof insertFraction;
1385
1402
  declare const index_insertMatrixEnv: typeof insertMatrixEnv;
1386
1403
  declare const index_insertNumber: typeof insertNumber;
1387
1404
  declare const index_insertOperator: typeof insertOperator;
1405
+ declare const index_insertSecondDerivative: typeof insertSecondDerivative;
1388
1406
  declare const index_insertSqrt: typeof insertSqrt;
1389
1407
  declare const index_isSelectionActive: typeof isSelectionActive;
1390
1408
  declare const index_isSpacingCommandSpec: typeof isSpacingCommandSpec;
@@ -1430,7 +1448,7 @@ declare const index_toggleTakweenCharacterFont: typeof toggleTakweenCharacterFon
1430
1448
  declare const index_undoRedoCanRedo: typeof undoRedoCanRedo;
1431
1449
  declare const index_undoRedoCanUndo: typeof undoRedoCanUndo;
1432
1450
  declare namespace index {
1433
- export { index_ATOMIC_COMMANDS as ATOMIC_COMMANDS, index_ATOMIC_COMMAND_CSS as ATOMIC_COMMAND_CSS, index_ATOMIC_OPERATOR_COMMANDS as ATOMIC_OPERATOR_COMMANDS, index_ATOMIC_OPERATOR_COMMAND_CSS as ATOMIC_OPERATOR_COMMAND_CSS, type index_AtomicCommandCategory as AtomicCommandCategory, type index_AtomicCommandId as AtomicCommandId, type index_AtomicCommandSpec as AtomicCommandSpec, type index_AtomicOperatorCommandCategory as AtomicOperatorCommandCategory, type index_AtomicOperatorCommandId as AtomicOperatorCommandId, type index_AtomicOperatorCommandSpec as AtomicOperatorCommandSpec, index_BUTEX_EDITOR_CSS as BUTEX_EDITOR_CSS, index_BUTEX_FRAGMENT_MIME as BUTEX_FRAGMENT_MIME, type index_CharacterFontId as CharacterFontId, index_DEFAULT_UNDO_HISTORY_MAX_DEPTH as DEFAULT_UNDO_HISTORY_MAX_DEPTH, index_DELIMITER_CSS as DELIMITER_CSS, type index_DigitFormId as DigitFormId, type index_EditorCaret as EditorCaret, type index_EditorChain as EditorChain, type index_EditorDebugEntry as EditorDebugEntry, type index_EditorFragment as EditorFragment, type index_EditorNode as EditorNode, type index_EditorNodeKind as EditorNodeKind, type index_EditorRuntimeApi as EditorRuntimeApi, type index_EditorRuntimeOptions as EditorRuntimeOptions, type index_EditorSelectionRange as EditorSelectionRange, type index_EditorSession as EditorSession, type index_EditorSide as EditorSide, type index_EditorSyncMap as EditorSyncMap, type index_EditorSyncState as EditorSyncState, type index_EnvColumnAlignment as EnvColumnAlignment, index_FRAC_CSS as FRAC_CSS, type index_GridEnvName as GridEnvName, index_MATRIX_ENV_CSS as MATRIX_ENV_CSS, type index_MatrixEnvStyle as MatrixEnvStyle, index_SQRT_CSS as SQRT_CSS, type index_SpacingCommandSpec as SpacingCommandSpec, type index_SpacingDirection as SpacingDirection, type index_UndoRedoStacks as UndoRedoStacks, index_activeSideLabel as activeSideLabel, index_activeTreeKey as activeTreeKey, index_addMatrixColumn as addMatrixColumn, index_addMatrixRow as addMatrixRow, index_addSub as addSub, index_addSup as addSup, index_atomicCommandSpec as atomicCommandSpec, index_atomicCommandsByCategory as atomicCommandsByCategory, index_atomicOperatorCommandSpec as atomicOperatorCommandSpec, index_atomicOperatorCommandsByCategory as atomicOperatorCommandsByCategory, index_breakLeafTyping as breakLeafTyping, index_buildInitialSyncMap as buildInitialSyncMap, index_buildNodeBody as buildNodeBody, index_buildNodeScripts as buildNodeScripts, index_caretStep as caretStep, index_clearSelection as clearSelection, index_cloneEditorSession as cloneEditorSession, index_collectCaretPositions as collectCaretPositions, index_copySelection as copySelection, index_coveredNodeIds as coveredNodeIds, index_createAtomicCommandNode as createAtomicCommandNode, index_createAtomicOperatorCommandNode as createAtomicOperatorCommandNode, index_createDelimiterNode as createDelimiterNode, index_createEditorChain as createEditorChain, index_createEditorNode as createEditorNode, index_createEditorRuntime as createEditorRuntime, index_createEditorSession as createEditorSession, index_createFracNode as createFracNode, index_createGridEnvNode as createGridEnvNode, index_createMatrixEnvNode as createMatrixEnvNode, index_createSqrtNode as createSqrtNode, index_createStarterSession as createStarterSession, index_createUndoRedoStacks as createUndoRedoStacks, index_cutSelection as cutSelection, index_deleteBackward as deleteBackward, index_deleteForward as deleteForward, index_deleteStructure as deleteStructure, index_deserializeFragment as deserializeFragment, index_extendSelectionByStep as extendSelectionByStep, index_findChainById as findChainById, index_findNodeById as findNodeById, index_formatDigits as formatDigits, index_fragmentToPlainText as fragmentToPlainText, index_horizontalCaretDelta as horizontalCaretDelta, index_injectBuTeXEditorStyles as injectBuTeXEditorStyles, index_insertAlignedEnv as insertAlignedEnv, index_insertArrayEnv as insertArrayEnv, index_insertAtomicCommand as insertAtomicCommand, index_insertAtomicOperatorCommand as insertAtomicOperatorCommand, index_insertChar as insertChar, index_insertDelimiterPair as insertDelimiterPair, index_insertFraction as insertFraction, index_insertMatrixEnv as insertMatrixEnv, index_insertNumber as insertNumber, index_insertOperator as insertOperator, index_insertSqrt as insertSqrt, index_isSelectionActive as isSelectionActive, index_isSpacingCommandSpec as isSpacingCommandSpec, index_mirrorBuTeXOperatorsInTex as mirrorBuTeXOperatorsInTex, index_moveCaret as moveCaret, index_moveCaretHorizontal as moveCaretHorizontal, index_moveCaretVertical as moveCaretVertical, index_nodeChildChains as nodeChildChains, index_normalizeSelection as normalizeSelection, index_passiveTreeKey as passiveTreeKey, index_pasteFragment as pasteFragment, index_pasteText as pasteText, index_pushUndoRedoSnapshot as pushUndoRedoSnapshot, index_regenerateFragmentIds as regenerateFragmentIds, index_removeMatrixColumn as removeMatrixColumn, index_removeMatrixRow as removeMatrixRow, index_removeSub as removeSub, index_removeSup as removeSup, index_renderArabicLatexFromSession as renderArabicLatexFromSession, index_renderChainArabic as renderChainArabic, index_renderChainEnglish as renderChainEnglish, index_renderEnglishLatexFromSession as renderEnglishLatexFromSession, index_restoreRedo as restoreRedo, index_restoreUndo as restoreUndo, index_runtimeStatusText as runtimeStatusText, index_selectNode as selectNode, index_serializeSelection as serializeSelection, index_setArabicReverseNumberTyping as setArabicReverseNumberTyping, index_setArrayColumnAlignment as setArrayColumnAlignment, index_setCaret as setCaret, index_setCurrentCharacterFont as setCurrentCharacterFont, index_setCurrentDigitForm as setCurrentDigitForm, index_setExpr as setExpr, index_setMatrixEnvStyle as setMatrixEnvStyle, index_setRenderError as setRenderError, index_setSelectionFromMouse as setSelectionFromMouse, index_setSplitLeafTyping as setSplitLeafTyping, index_shouldMirrorOperatorDisplay as shouldMirrorOperatorDisplay, index_switchSide as switchSide, index_syncSelectionToCaret as syncSelectionToCaret, index_syncStateSummary as syncStateSummary, index_toggleTakweenCharacterFont as toggleTakweenCharacterFont, index_undoRedoCanRedo as undoRedoCanRedo, index_undoRedoCanUndo as undoRedoCanUndo };
1451
+ export { index_ATOMIC_COMMANDS as ATOMIC_COMMANDS, index_ATOMIC_COMMAND_CSS as ATOMIC_COMMAND_CSS, index_ATOMIC_OPERATOR_COMMANDS as ATOMIC_OPERATOR_COMMANDS, index_ATOMIC_OPERATOR_COMMAND_CSS as ATOMIC_OPERATOR_COMMAND_CSS, type index_AtomicCommandCategory as AtomicCommandCategory, type index_AtomicCommandId as AtomicCommandId, type index_AtomicCommandSpec as AtomicCommandSpec, type index_AtomicOperatorCommandCategory as AtomicOperatorCommandCategory, type index_AtomicOperatorCommandId as AtomicOperatorCommandId, type index_AtomicOperatorCommandSpec as AtomicOperatorCommandSpec, index_BUTEX_EDITOR_CSS as BUTEX_EDITOR_CSS, index_BUTEX_FRAGMENT_MIME as BUTEX_FRAGMENT_MIME, type index_CharacterFontId as CharacterFontId, index_DEFAULT_UNDO_HISTORY_MAX_DEPTH as DEFAULT_UNDO_HISTORY_MAX_DEPTH, index_DELIMITER_CSS as DELIMITER_CSS, type index_DigitFormId as DigitFormId, type index_EditorCaret as EditorCaret, type index_EditorChain as EditorChain, type index_EditorDebugEntry as EditorDebugEntry, type index_EditorFragment as EditorFragment, type index_EditorNode as EditorNode, type index_EditorNodeKind as EditorNodeKind, type index_EditorRuntimeApi as EditorRuntimeApi, type index_EditorRuntimeOptions as EditorRuntimeOptions, type index_EditorSelectionRange as EditorSelectionRange, type index_EditorSession as EditorSession, type index_EditorSide as EditorSide, type index_EditorSyncMap as EditorSyncMap, type index_EditorSyncState as EditorSyncState, type index_EnvColumnAlignment as EnvColumnAlignment, index_FRAC_CSS as FRAC_CSS, type index_GridEnvName as GridEnvName, index_MATRIX_ENV_CSS as MATRIX_ENV_CSS, type index_MatrixEnvStyle as MatrixEnvStyle, index_SQRT_CSS as SQRT_CSS, type index_SpacingCommandSpec as SpacingCommandSpec, type index_SpacingDirection as SpacingDirection, type index_UndoRedoStacks as UndoRedoStacks, index_activeSideLabel as activeSideLabel, index_activeTreeKey as activeTreeKey, index_addMatrixColumn as addMatrixColumn, index_addMatrixRow as addMatrixRow, index_addSub as addSub, index_addSup as addSup, index_atomicCommandSpec as atomicCommandSpec, index_atomicCommandsByCategory as atomicCommandsByCategory, index_atomicOperatorCommandSpec as atomicOperatorCommandSpec, index_atomicOperatorCommandsByCategory as atomicOperatorCommandsByCategory, index_breakLeafTyping as breakLeafTyping, index_buildInitialSyncMap as buildInitialSyncMap, index_buildNodeBody as buildNodeBody, index_buildNodeScripts as buildNodeScripts, index_caretStep as caretStep, index_clearSelection as clearSelection, index_cloneEditorSession as cloneEditorSession, index_collectCaretPositions as collectCaretPositions, index_copySelection as copySelection, index_coveredNodeIds as coveredNodeIds, index_createAtomicCommandNode as createAtomicCommandNode, index_createAtomicOperatorCommandNode as createAtomicOperatorCommandNode, index_createDelimiterNode as createDelimiterNode, index_createEditorChain as createEditorChain, index_createEditorNode as createEditorNode, index_createEditorRuntime as createEditorRuntime, index_createEditorSession as createEditorSession, index_createFracNode as createFracNode, index_createGridEnvNode as createGridEnvNode, index_createMatrixEnvNode as createMatrixEnvNode, index_createSqrtNode as createSqrtNode, index_createStarterSession as createStarterSession, index_createUndoRedoStacks as createUndoRedoStacks, index_cutSelection as cutSelection, index_deleteBackward as deleteBackward, index_deleteForward as deleteForward, index_deleteStructure as deleteStructure, index_deserializeFragment as deserializeFragment, index_extendSelectionByStep as extendSelectionByStep, index_findChainById as findChainById, index_findNodeById as findNodeById, index_formatDigits as formatDigits, index_fragmentToPlainText as fragmentToPlainText, index_horizontalCaretDelta as horizontalCaretDelta, index_injectBuTeXEditorStyles as injectBuTeXEditorStyles, index_insertAlignedEnv as insertAlignedEnv, index_insertArrayEnv as insertArrayEnv, index_insertAtomicCommand as insertAtomicCommand, index_insertAtomicOperatorCommand as insertAtomicOperatorCommand, index_insertChar as insertChar, index_insertDelimiterPair as insertDelimiterPair, index_insertDivideOperator as insertDivideOperator, index_insertFirstDerivative as insertFirstDerivative, index_insertFraction as insertFraction, index_insertMatrixEnv as insertMatrixEnv, index_insertNumber as insertNumber, index_insertOperator as insertOperator, index_insertSecondDerivative as insertSecondDerivative, index_insertSqrt as insertSqrt, index_isSelectionActive as isSelectionActive, index_isSpacingCommandSpec as isSpacingCommandSpec, index_mirrorBuTeXOperatorsInTex as mirrorBuTeXOperatorsInTex, index_moveCaret as moveCaret, index_moveCaretHorizontal as moveCaretHorizontal, index_moveCaretVertical as moveCaretVertical, index_nodeChildChains as nodeChildChains, index_normalizeSelection as normalizeSelection, index_passiveTreeKey as passiveTreeKey, index_pasteFragment as pasteFragment, index_pasteText as pasteText, index_pushUndoRedoSnapshot as pushUndoRedoSnapshot, index_regenerateFragmentIds as regenerateFragmentIds, index_removeMatrixColumn as removeMatrixColumn, index_removeMatrixRow as removeMatrixRow, index_removeSub as removeSub, index_removeSup as removeSup, index_renderArabicLatexFromSession as renderArabicLatexFromSession, index_renderChainArabic as renderChainArabic, index_renderChainEnglish as renderChainEnglish, index_renderEnglishLatexFromSession as renderEnglishLatexFromSession, index_restoreRedo as restoreRedo, index_restoreUndo as restoreUndo, index_runtimeStatusText as runtimeStatusText, index_selectNode as selectNode, index_serializeSelection as serializeSelection, index_setArabicReverseNumberTyping as setArabicReverseNumberTyping, index_setArrayColumnAlignment as setArrayColumnAlignment, index_setCaret as setCaret, index_setCurrentCharacterFont as setCurrentCharacterFont, index_setCurrentDigitForm as setCurrentDigitForm, index_setExpr as setExpr, index_setMatrixEnvStyle as setMatrixEnvStyle, index_setRenderError as setRenderError, index_setSelectionFromMouse as setSelectionFromMouse, index_setSplitLeafTyping as setSplitLeafTyping, index_shouldMirrorOperatorDisplay as shouldMirrorOperatorDisplay, index_switchSide as switchSide, index_syncSelectionToCaret as syncSelectionToCaret, index_syncStateSummary as syncStateSummary, index_toggleTakweenCharacterFont as toggleTakweenCharacterFont, index_undoRedoCanRedo as undoRedoCanRedo, index_undoRedoCanUndo as undoRedoCanUndo };
1434
1452
  }
1435
1453
 
1436
1454
  /**
package/dist/index.d.ts CHANGED
@@ -400,6 +400,15 @@ declare const ATOMIC_COMMANDS: {
400
400
  readonly arabicLabel: "محدد";
401
401
  readonly title: "محدد";
402
402
  };
403
+ readonly ad: {
404
+ readonly id: "ad";
405
+ readonly category: "derivative";
406
+ readonly englishTex: "\\mathrm{d}";
407
+ readonly englishLabel: "d";
408
+ readonly arabicTex: "\\ad";
409
+ readonly arabicLabel: "ء";
410
+ readonly title: "علامة الاشتقاق";
411
+ };
403
412
  readonly N: {
404
413
  readonly id: "N";
405
414
  readonly category: "groups";
@@ -510,10 +519,11 @@ declare const ATOMIC_COMMANDS: {
510
519
  };
511
520
  };
512
521
  type AtomicCommandId = keyof typeof ATOMIC_COMMANDS;
513
- type AtomicCommandCategory = 'function' | 'function2' | 'limits_series' | 'groups' | 'spacing';
522
+ type AtomicCommandCategory = 'function' | 'function2' | 'limits_series' | 'groups' | 'spacing' | 'derivative';
514
523
  type SpacingDirection = 'positive' | 'negative';
515
524
  type AtomicCommandSpec = (typeof ATOMIC_COMMANDS)[AtomicCommandId] & {
516
525
  arabicRenderTex?: string;
526
+ englishLabel?: string;
517
527
  };
518
528
  type SpacingCommandSpec = AtomicCommandSpec & {
519
529
  category: 'spacing';
@@ -1163,11 +1173,14 @@ declare function toggleTakweenCharacterFont(session: EditorSession): EditorSessi
1163
1173
  declare function setCurrentDigitForm(session: EditorSession, digitForm: DigitFormId): EditorSession;
1164
1174
  declare function insertChar(session: EditorSession, expr: string): EditorSession;
1165
1175
  declare function insertNumber(session: EditorSession, expr: string): EditorSession;
1176
+ declare function insertDivideOperator(session: EditorSession): EditorSession;
1166
1177
  declare function insertOperator(session: EditorSession, expr: string): EditorSession;
1167
1178
  declare function insertAtomicCommand(session: EditorSession, commandId: AtomicCommandId): EditorSession;
1168
1179
  declare function insertAtomicOperatorCommand(session: EditorSession, commandId: AtomicOperatorCommandId): EditorSession;
1169
1180
  declare function insertDelimiterPair(session: EditorSession, leftDelimExpr: string, rightDelimExpr: string): EditorSession;
1170
1181
  declare function insertFraction(session: EditorSession): EditorSession;
1182
+ declare function insertFirstDerivative(session: EditorSession): EditorSession;
1183
+ declare function insertSecondDerivative(session: EditorSession): EditorSession;
1171
1184
  declare function insertSqrt(session: EditorSession): EditorSession;
1172
1185
  declare function insertMatrixEnv(session: EditorSession, style: MatrixEnvStyle, rows: number, columns: number): EditorSession;
1173
1186
  declare function insertArrayEnv(session: EditorSession, rows: number, columns: number, columnAlignments?: EnvColumnAlignment[]): EditorSession;
@@ -1268,6 +1281,8 @@ type EditorRuntimeApi = {
1268
1281
  setCurrentDigitForm: (digitForm: DigitFormId) => void;
1269
1282
  insertDelimiterByKind: (kind: 'paren' | 'bracket' | 'brace') => void;
1270
1283
  insertFraction: () => void;
1284
+ insertFirstDerivative: () => void;
1285
+ insertSecondDerivative: () => void;
1271
1286
  insertMatrixEnv: (style: MatrixEnvStyle, rows: number, columns: number) => void;
1272
1287
  insertArrayEnv: (rows: number, columns: number) => void;
1273
1288
  insertAlignedEnv: (rows: number, columns: number) => void;
@@ -1381,10 +1396,13 @@ declare const index_insertAtomicCommand: typeof insertAtomicCommand;
1381
1396
  declare const index_insertAtomicOperatorCommand: typeof insertAtomicOperatorCommand;
1382
1397
  declare const index_insertChar: typeof insertChar;
1383
1398
  declare const index_insertDelimiterPair: typeof insertDelimiterPair;
1399
+ declare const index_insertDivideOperator: typeof insertDivideOperator;
1400
+ declare const index_insertFirstDerivative: typeof insertFirstDerivative;
1384
1401
  declare const index_insertFraction: typeof insertFraction;
1385
1402
  declare const index_insertMatrixEnv: typeof insertMatrixEnv;
1386
1403
  declare const index_insertNumber: typeof insertNumber;
1387
1404
  declare const index_insertOperator: typeof insertOperator;
1405
+ declare const index_insertSecondDerivative: typeof insertSecondDerivative;
1388
1406
  declare const index_insertSqrt: typeof insertSqrt;
1389
1407
  declare const index_isSelectionActive: typeof isSelectionActive;
1390
1408
  declare const index_isSpacingCommandSpec: typeof isSpacingCommandSpec;
@@ -1430,7 +1448,7 @@ declare const index_toggleTakweenCharacterFont: typeof toggleTakweenCharacterFon
1430
1448
  declare const index_undoRedoCanRedo: typeof undoRedoCanRedo;
1431
1449
  declare const index_undoRedoCanUndo: typeof undoRedoCanUndo;
1432
1450
  declare namespace index {
1433
- export { index_ATOMIC_COMMANDS as ATOMIC_COMMANDS, index_ATOMIC_COMMAND_CSS as ATOMIC_COMMAND_CSS, index_ATOMIC_OPERATOR_COMMANDS as ATOMIC_OPERATOR_COMMANDS, index_ATOMIC_OPERATOR_COMMAND_CSS as ATOMIC_OPERATOR_COMMAND_CSS, type index_AtomicCommandCategory as AtomicCommandCategory, type index_AtomicCommandId as AtomicCommandId, type index_AtomicCommandSpec as AtomicCommandSpec, type index_AtomicOperatorCommandCategory as AtomicOperatorCommandCategory, type index_AtomicOperatorCommandId as AtomicOperatorCommandId, type index_AtomicOperatorCommandSpec as AtomicOperatorCommandSpec, index_BUTEX_EDITOR_CSS as BUTEX_EDITOR_CSS, index_BUTEX_FRAGMENT_MIME as BUTEX_FRAGMENT_MIME, type index_CharacterFontId as CharacterFontId, index_DEFAULT_UNDO_HISTORY_MAX_DEPTH as DEFAULT_UNDO_HISTORY_MAX_DEPTH, index_DELIMITER_CSS as DELIMITER_CSS, type index_DigitFormId as DigitFormId, type index_EditorCaret as EditorCaret, type index_EditorChain as EditorChain, type index_EditorDebugEntry as EditorDebugEntry, type index_EditorFragment as EditorFragment, type index_EditorNode as EditorNode, type index_EditorNodeKind as EditorNodeKind, type index_EditorRuntimeApi as EditorRuntimeApi, type index_EditorRuntimeOptions as EditorRuntimeOptions, type index_EditorSelectionRange as EditorSelectionRange, type index_EditorSession as EditorSession, type index_EditorSide as EditorSide, type index_EditorSyncMap as EditorSyncMap, type index_EditorSyncState as EditorSyncState, type index_EnvColumnAlignment as EnvColumnAlignment, index_FRAC_CSS as FRAC_CSS, type index_GridEnvName as GridEnvName, index_MATRIX_ENV_CSS as MATRIX_ENV_CSS, type index_MatrixEnvStyle as MatrixEnvStyle, index_SQRT_CSS as SQRT_CSS, type index_SpacingCommandSpec as SpacingCommandSpec, type index_SpacingDirection as SpacingDirection, type index_UndoRedoStacks as UndoRedoStacks, index_activeSideLabel as activeSideLabel, index_activeTreeKey as activeTreeKey, index_addMatrixColumn as addMatrixColumn, index_addMatrixRow as addMatrixRow, index_addSub as addSub, index_addSup as addSup, index_atomicCommandSpec as atomicCommandSpec, index_atomicCommandsByCategory as atomicCommandsByCategory, index_atomicOperatorCommandSpec as atomicOperatorCommandSpec, index_atomicOperatorCommandsByCategory as atomicOperatorCommandsByCategory, index_breakLeafTyping as breakLeafTyping, index_buildInitialSyncMap as buildInitialSyncMap, index_buildNodeBody as buildNodeBody, index_buildNodeScripts as buildNodeScripts, index_caretStep as caretStep, index_clearSelection as clearSelection, index_cloneEditorSession as cloneEditorSession, index_collectCaretPositions as collectCaretPositions, index_copySelection as copySelection, index_coveredNodeIds as coveredNodeIds, index_createAtomicCommandNode as createAtomicCommandNode, index_createAtomicOperatorCommandNode as createAtomicOperatorCommandNode, index_createDelimiterNode as createDelimiterNode, index_createEditorChain as createEditorChain, index_createEditorNode as createEditorNode, index_createEditorRuntime as createEditorRuntime, index_createEditorSession as createEditorSession, index_createFracNode as createFracNode, index_createGridEnvNode as createGridEnvNode, index_createMatrixEnvNode as createMatrixEnvNode, index_createSqrtNode as createSqrtNode, index_createStarterSession as createStarterSession, index_createUndoRedoStacks as createUndoRedoStacks, index_cutSelection as cutSelection, index_deleteBackward as deleteBackward, index_deleteForward as deleteForward, index_deleteStructure as deleteStructure, index_deserializeFragment as deserializeFragment, index_extendSelectionByStep as extendSelectionByStep, index_findChainById as findChainById, index_findNodeById as findNodeById, index_formatDigits as formatDigits, index_fragmentToPlainText as fragmentToPlainText, index_horizontalCaretDelta as horizontalCaretDelta, index_injectBuTeXEditorStyles as injectBuTeXEditorStyles, index_insertAlignedEnv as insertAlignedEnv, index_insertArrayEnv as insertArrayEnv, index_insertAtomicCommand as insertAtomicCommand, index_insertAtomicOperatorCommand as insertAtomicOperatorCommand, index_insertChar as insertChar, index_insertDelimiterPair as insertDelimiterPair, index_insertFraction as insertFraction, index_insertMatrixEnv as insertMatrixEnv, index_insertNumber as insertNumber, index_insertOperator as insertOperator, index_insertSqrt as insertSqrt, index_isSelectionActive as isSelectionActive, index_isSpacingCommandSpec as isSpacingCommandSpec, index_mirrorBuTeXOperatorsInTex as mirrorBuTeXOperatorsInTex, index_moveCaret as moveCaret, index_moveCaretHorizontal as moveCaretHorizontal, index_moveCaretVertical as moveCaretVertical, index_nodeChildChains as nodeChildChains, index_normalizeSelection as normalizeSelection, index_passiveTreeKey as passiveTreeKey, index_pasteFragment as pasteFragment, index_pasteText as pasteText, index_pushUndoRedoSnapshot as pushUndoRedoSnapshot, index_regenerateFragmentIds as regenerateFragmentIds, index_removeMatrixColumn as removeMatrixColumn, index_removeMatrixRow as removeMatrixRow, index_removeSub as removeSub, index_removeSup as removeSup, index_renderArabicLatexFromSession as renderArabicLatexFromSession, index_renderChainArabic as renderChainArabic, index_renderChainEnglish as renderChainEnglish, index_renderEnglishLatexFromSession as renderEnglishLatexFromSession, index_restoreRedo as restoreRedo, index_restoreUndo as restoreUndo, index_runtimeStatusText as runtimeStatusText, index_selectNode as selectNode, index_serializeSelection as serializeSelection, index_setArabicReverseNumberTyping as setArabicReverseNumberTyping, index_setArrayColumnAlignment as setArrayColumnAlignment, index_setCaret as setCaret, index_setCurrentCharacterFont as setCurrentCharacterFont, index_setCurrentDigitForm as setCurrentDigitForm, index_setExpr as setExpr, index_setMatrixEnvStyle as setMatrixEnvStyle, index_setRenderError as setRenderError, index_setSelectionFromMouse as setSelectionFromMouse, index_setSplitLeafTyping as setSplitLeafTyping, index_shouldMirrorOperatorDisplay as shouldMirrorOperatorDisplay, index_switchSide as switchSide, index_syncSelectionToCaret as syncSelectionToCaret, index_syncStateSummary as syncStateSummary, index_toggleTakweenCharacterFont as toggleTakweenCharacterFont, index_undoRedoCanRedo as undoRedoCanRedo, index_undoRedoCanUndo as undoRedoCanUndo };
1451
+ export { index_ATOMIC_COMMANDS as ATOMIC_COMMANDS, index_ATOMIC_COMMAND_CSS as ATOMIC_COMMAND_CSS, index_ATOMIC_OPERATOR_COMMANDS as ATOMIC_OPERATOR_COMMANDS, index_ATOMIC_OPERATOR_COMMAND_CSS as ATOMIC_OPERATOR_COMMAND_CSS, type index_AtomicCommandCategory as AtomicCommandCategory, type index_AtomicCommandId as AtomicCommandId, type index_AtomicCommandSpec as AtomicCommandSpec, type index_AtomicOperatorCommandCategory as AtomicOperatorCommandCategory, type index_AtomicOperatorCommandId as AtomicOperatorCommandId, type index_AtomicOperatorCommandSpec as AtomicOperatorCommandSpec, index_BUTEX_EDITOR_CSS as BUTEX_EDITOR_CSS, index_BUTEX_FRAGMENT_MIME as BUTEX_FRAGMENT_MIME, type index_CharacterFontId as CharacterFontId, index_DEFAULT_UNDO_HISTORY_MAX_DEPTH as DEFAULT_UNDO_HISTORY_MAX_DEPTH, index_DELIMITER_CSS as DELIMITER_CSS, type index_DigitFormId as DigitFormId, type index_EditorCaret as EditorCaret, type index_EditorChain as EditorChain, type index_EditorDebugEntry as EditorDebugEntry, type index_EditorFragment as EditorFragment, type index_EditorNode as EditorNode, type index_EditorNodeKind as EditorNodeKind, type index_EditorRuntimeApi as EditorRuntimeApi, type index_EditorRuntimeOptions as EditorRuntimeOptions, type index_EditorSelectionRange as EditorSelectionRange, type index_EditorSession as EditorSession, type index_EditorSide as EditorSide, type index_EditorSyncMap as EditorSyncMap, type index_EditorSyncState as EditorSyncState, type index_EnvColumnAlignment as EnvColumnAlignment, index_FRAC_CSS as FRAC_CSS, type index_GridEnvName as GridEnvName, index_MATRIX_ENV_CSS as MATRIX_ENV_CSS, type index_MatrixEnvStyle as MatrixEnvStyle, index_SQRT_CSS as SQRT_CSS, type index_SpacingCommandSpec as SpacingCommandSpec, type index_SpacingDirection as SpacingDirection, type index_UndoRedoStacks as UndoRedoStacks, index_activeSideLabel as activeSideLabel, index_activeTreeKey as activeTreeKey, index_addMatrixColumn as addMatrixColumn, index_addMatrixRow as addMatrixRow, index_addSub as addSub, index_addSup as addSup, index_atomicCommandSpec as atomicCommandSpec, index_atomicCommandsByCategory as atomicCommandsByCategory, index_atomicOperatorCommandSpec as atomicOperatorCommandSpec, index_atomicOperatorCommandsByCategory as atomicOperatorCommandsByCategory, index_breakLeafTyping as breakLeafTyping, index_buildInitialSyncMap as buildInitialSyncMap, index_buildNodeBody as buildNodeBody, index_buildNodeScripts as buildNodeScripts, index_caretStep as caretStep, index_clearSelection as clearSelection, index_cloneEditorSession as cloneEditorSession, index_collectCaretPositions as collectCaretPositions, index_copySelection as copySelection, index_coveredNodeIds as coveredNodeIds, index_createAtomicCommandNode as createAtomicCommandNode, index_createAtomicOperatorCommandNode as createAtomicOperatorCommandNode, index_createDelimiterNode as createDelimiterNode, index_createEditorChain as createEditorChain, index_createEditorNode as createEditorNode, index_createEditorRuntime as createEditorRuntime, index_createEditorSession as createEditorSession, index_createFracNode as createFracNode, index_createGridEnvNode as createGridEnvNode, index_createMatrixEnvNode as createMatrixEnvNode, index_createSqrtNode as createSqrtNode, index_createStarterSession as createStarterSession, index_createUndoRedoStacks as createUndoRedoStacks, index_cutSelection as cutSelection, index_deleteBackward as deleteBackward, index_deleteForward as deleteForward, index_deleteStructure as deleteStructure, index_deserializeFragment as deserializeFragment, index_extendSelectionByStep as extendSelectionByStep, index_findChainById as findChainById, index_findNodeById as findNodeById, index_formatDigits as formatDigits, index_fragmentToPlainText as fragmentToPlainText, index_horizontalCaretDelta as horizontalCaretDelta, index_injectBuTeXEditorStyles as injectBuTeXEditorStyles, index_insertAlignedEnv as insertAlignedEnv, index_insertArrayEnv as insertArrayEnv, index_insertAtomicCommand as insertAtomicCommand, index_insertAtomicOperatorCommand as insertAtomicOperatorCommand, index_insertChar as insertChar, index_insertDelimiterPair as insertDelimiterPair, index_insertDivideOperator as insertDivideOperator, index_insertFirstDerivative as insertFirstDerivative, index_insertFraction as insertFraction, index_insertMatrixEnv as insertMatrixEnv, index_insertNumber as insertNumber, index_insertOperator as insertOperator, index_insertSecondDerivative as insertSecondDerivative, index_insertSqrt as insertSqrt, index_isSelectionActive as isSelectionActive, index_isSpacingCommandSpec as isSpacingCommandSpec, index_mirrorBuTeXOperatorsInTex as mirrorBuTeXOperatorsInTex, index_moveCaret as moveCaret, index_moveCaretHorizontal as moveCaretHorizontal, index_moveCaretVertical as moveCaretVertical, index_nodeChildChains as nodeChildChains, index_normalizeSelection as normalizeSelection, index_passiveTreeKey as passiveTreeKey, index_pasteFragment as pasteFragment, index_pasteText as pasteText, index_pushUndoRedoSnapshot as pushUndoRedoSnapshot, index_regenerateFragmentIds as regenerateFragmentIds, index_removeMatrixColumn as removeMatrixColumn, index_removeMatrixRow as removeMatrixRow, index_removeSub as removeSub, index_removeSup as removeSup, index_renderArabicLatexFromSession as renderArabicLatexFromSession, index_renderChainArabic as renderChainArabic, index_renderChainEnglish as renderChainEnglish, index_renderEnglishLatexFromSession as renderEnglishLatexFromSession, index_restoreRedo as restoreRedo, index_restoreUndo as restoreUndo, index_runtimeStatusText as runtimeStatusText, index_selectNode as selectNode, index_serializeSelection as serializeSelection, index_setArabicReverseNumberTyping as setArabicReverseNumberTyping, index_setArrayColumnAlignment as setArrayColumnAlignment, index_setCaret as setCaret, index_setCurrentCharacterFont as setCurrentCharacterFont, index_setCurrentDigitForm as setCurrentDigitForm, index_setExpr as setExpr, index_setMatrixEnvStyle as setMatrixEnvStyle, index_setRenderError as setRenderError, index_setSelectionFromMouse as setSelectionFromMouse, index_setSplitLeafTyping as setSplitLeafTyping, index_shouldMirrorOperatorDisplay as shouldMirrorOperatorDisplay, index_switchSide as switchSide, index_syncSelectionToCaret as syncSelectionToCaret, index_syncStateSummary as syncStateSummary, index_toggleTakweenCharacterFont as toggleTakweenCharacterFont, index_undoRedoCanRedo as undoRedoCanRedo, index_undoRedoCanUndo as undoRedoCanUndo };
1434
1452
  }
1435
1453
 
1436
1454
  /**
@@ -561,6 +561,16 @@ mjx-container[jax="SVG"] svg .butex-preview-mirror {
561
561
  arabicLabel: "\u0645\u062D\u062F\u062F",
562
562
  title: "\u0645\u062D\u062F\u062F"
563
563
  },
564
+ ////////////////////// Derivatives ////////////////////////////////
565
+ ad: {
566
+ id: "ad",
567
+ category: "derivative",
568
+ englishTex: "\\mathrm{d}",
569
+ englishLabel: "d",
570
+ arabicTex: "\\ad",
571
+ arabicLabel: "\u0621",
572
+ title: "\u0639\u0644\u0627\u0645\u0629 \u0627\u0644\u0627\u0634\u062A\u0642\u0627\u0642"
573
+ },
564
574
  ////////////////////// Groups /////////////////////////////////
565
575
  N: {
566
576
  id: "N",
@@ -1240,6 +1250,7 @@ mjx-container[jax="SVG"] svg .butex-preview-mirror {
1240
1250
  ln: "Natural logarithm",
1241
1251
  log: "Logarithm",
1242
1252
  det: "Determinant",
1253
+ ad: "Derivative (d / ad)",
1243
1254
  N: "Natural numbers",
1244
1255
  Z: "Integers",
1245
1256
  Q: "Rational numbers",
@@ -1351,6 +1362,10 @@ mjx-container[jax="SVG"] svg .butex-preview-mirror {
1351
1362
  insertFunction: "\u0625\u062F\u0631\u0627\u062C \u062F\u0627\u0644\u0629",
1352
1363
  insertLimitsSeries: "\u0625\u062F\u0631\u0627\u062C \u062D\u062F\u0648\u062F \u0648\u0645\u062A\u0633\u0644\u0633\u0644\u0627\u062A",
1353
1364
  insertAdditionalFunctions: "\u0625\u062F\u0631\u0627\u062C \u062F\u0648\u0627\u0644 \u0625\u0636\u0627\u0641\u064A\u0629",
1365
+ derivatives: "\u0627\u0644\u0627\u0634\u062A\u0642\u0627\u0642",
1366
+ insertDerivative: "\u0625\u062F\u0631\u0627\u062C \u0639\u0644\u0627\u0645\u0629 \u0627\u0634\u062A\u0642\u0627\u0642",
1367
+ insertFirstDerivative: "\u0625\u062F\u0631\u0627\u062C \u0627\u0634\u062A\u0642\u0627\u0642 \u0623\u0648\u0644",
1368
+ insertSecondDerivative: "\u0625\u062F\u0631\u0627\u062C \u0627\u0634\u062A\u0642\u0627\u0642 \u062B\u0627\u0646\u064A",
1354
1369
  insertNumberSets: "\u0625\u062F\u0631\u0627\u062C \u0645\u062C\u0645\u0648\u0639\u0627\u062A \u0623\u0639\u062F\u0627\u062F",
1355
1370
  operations: "\u0627\u0644\u0639\u0645\u0644\u064A\u0627\u062A",
1356
1371
  insertOperation: "\u0625\u062F\u0631\u0627\u062C \u0631\u0645\u0632 \u0639\u0645\u0644\u064A\u0629",
@@ -1454,6 +1469,10 @@ mjx-container[jax="SVG"] svg .butex-preview-mirror {
1454
1469
  insertFunction: "Insert function",
1455
1470
  insertLimitsSeries: "Insert limits and series",
1456
1471
  insertAdditionalFunctions: "Insert additional functions",
1472
+ derivatives: "Derivatives",
1473
+ insertDerivative: "Insert derivative marker",
1474
+ insertFirstDerivative: "Insert first derivative",
1475
+ insertSecondDerivative: "Insert second derivative",
1457
1476
  insertNumberSets: "Insert number sets",
1458
1477
  operations: "Operators",
1459
1478
  insertOperation: "Insert operator",
@@ -1620,7 +1639,7 @@ mjx-container[jax="SVG"] svg .butex-preview-mirror {
1620
1639
  value.appendChild(label);
1621
1640
  return value;
1622
1641
  }
1623
- value.textContent = side === "arabic" ? spec?.arabicLabel ?? node.expr : spec?.englishTex.replace("\\", "") ?? node.expr;
1642
+ value.textContent = side === "arabic" ? spec?.arabicLabel ?? node.expr : spec?.englishLabel ?? spec?.englishTex.replace(/^\\/, "") ?? node.expr;
1624
1643
  return value;
1625
1644
  }
1626
1645
  function buildSpacingAtomicCommandBody(spec, side, uiLocale) {
@@ -2524,10 +2543,13 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
2524
2543
  insertAtomicOperatorCommand: () => insertAtomicOperatorCommand,
2525
2544
  insertChar: () => insertChar,
2526
2545
  insertDelimiterPair: () => insertDelimiterPair,
2546
+ insertDivideOperator: () => insertDivideOperator,
2547
+ insertFirstDerivative: () => insertFirstDerivative,
2527
2548
  insertFraction: () => insertFraction,
2528
2549
  insertMatrixEnv: () => insertMatrixEnv,
2529
2550
  insertNumber: () => insertNumber,
2530
2551
  insertOperator: () => insertOperator,
2552
+ insertSecondDerivative: () => insertSecondDerivative,
2531
2553
  insertSqrt: () => insertSqrt,
2532
2554
  isSelectionActive: () => isSelectionActive,
2533
2555
  isSpacingCommandSpec: () => isSpacingCommandSpec,
@@ -2740,6 +2762,22 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
2740
2762
  };
2741
2763
  }
2742
2764
 
2765
+ // src/editor/divideOperator.ts
2766
+ var DIVIDE_OPERATOR_EN = "/";
2767
+ var DIVIDE_OPERATOR_AR = "\\";
2768
+ function isDivideOperatorExpr(expr) {
2769
+ return expr === DIVIDE_OPERATOR_EN || expr === DIVIDE_OPERATOR_AR;
2770
+ }
2771
+ function divideOperatorSurfaceExpr(expr, side) {
2772
+ if (!isDivideOperatorExpr(expr)) {
2773
+ return expr;
2774
+ }
2775
+ return side === "arabic" ? DIVIDE_OPERATOR_AR : DIVIDE_OPERATOR_EN;
2776
+ }
2777
+ function renderDivideOperatorLatex(side) {
2778
+ return side === "arabic" ? "\\backslash" : DIVIDE_OPERATOR_EN;
2779
+ }
2780
+
2743
2781
  // src/editor/digits.ts
2744
2782
  var WESTERN = "0123456789";
2745
2783
  var ARABIC_INDIC = "\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669";
@@ -2888,6 +2926,9 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
2888
2926
  if (node.kind === "char") {
2889
2927
  return `${renderCharContent(node, options)}${latinScripts(node, options)}`;
2890
2928
  }
2929
+ if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
2930
+ return `${renderDivideOperatorLatex("english")}${latinScripts(node, options)}`;
2931
+ }
2891
2932
  return `${formatDigits(node.expr, selectedDigitForm(options))}${latinScripts(node, options)}`;
2892
2933
  }
2893
2934
  function renderNodeArabic(node, options) {
@@ -2922,6 +2963,9 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
2922
2963
  const content = renderCharContent(node, options);
2923
2964
  return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
2924
2965
  }
2966
+ if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
2967
+ return arabicScripts(node, renderDivideOperatorLatex("arabic"), options);
2968
+ }
2925
2969
  return arabicScripts(node, formatDigits(node.expr, selectedDigitForm(options)), options);
2926
2970
  }
2927
2971
  function renderChainEnglish(chain, options) {
@@ -3448,6 +3492,128 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
3448
3492
  return stacks.future.length > 0;
3449
3493
  }
3450
3494
 
3495
+ // src/editor/derivativeTemplates.ts
3496
+ var ARABIC_VAR = "\u0633";
3497
+ var ENGLISH_VAR = "x";
3498
+ function mirroredAd() {
3499
+ const english = createAtomicCommandNode("ad");
3500
+ const arabic = createAtomicCommandNode("ad");
3501
+ arabic.id = english.id;
3502
+ return { english, arabic };
3503
+ }
3504
+ function mirroredVar() {
3505
+ const english = createEditorNode("char", ENGLISH_VAR);
3506
+ const arabic = createEditorNode("char", ARABIC_VAR);
3507
+ arabic.id = english.id;
3508
+ return { english, arabic };
3509
+ }
3510
+ function withMirroredSuperscript2(english, arabic) {
3511
+ const englishSup = createEditorChain([createEditorNode("number", "2")]);
3512
+ const arabicSup = createEditorChain([createEditorNode("number", "2")]);
3513
+ arabicSup.id = englishSup.id;
3514
+ arabicSup.nodes[0].id = englishSup.nodes[0].id;
3515
+ english.superscript = englishSup;
3516
+ arabic.superscript = arabicSup;
3517
+ }
3518
+ function syncChainIds(english, arabic) {
3519
+ arabic.id = english.id;
3520
+ const limit = Math.min(english.nodes.length, arabic.nodes.length);
3521
+ for (let index = 0; index < limit; index += 1) {
3522
+ arabic.nodes[index].id = english.nodes[index].id;
3523
+ }
3524
+ }
3525
+ function syncFracIds(englishFrac, arabicFrac) {
3526
+ arabicFrac.id = englishFrac.id;
3527
+ if (englishFrac.numerator && arabicFrac.numerator) {
3528
+ syncChainIds(englishFrac.numerator, arabicFrac.numerator);
3529
+ }
3530
+ if (englishFrac.denominator && arabicFrac.denominator) {
3531
+ syncChainIds(englishFrac.denominator, arabicFrac.denominator);
3532
+ }
3533
+ }
3534
+ function buildAdVarChain() {
3535
+ const ad = mirroredAd();
3536
+ const variable = mirroredVar();
3537
+ const english = createEditorChain([ad.english, variable.english]);
3538
+ const arabic = createEditorChain([ad.arabic, variable.arabic]);
3539
+ syncChainIds(english, arabic);
3540
+ return { english, arabic };
3541
+ }
3542
+ function mirroredEmptyDelimiter() {
3543
+ const english = createDelimiterNode("", "");
3544
+ const arabic = createDelimiterNode("", "");
3545
+ arabic.id = english.id;
3546
+ if (english.innerExpr && arabic.innerExpr) {
3547
+ syncChainIds(english.innerExpr, arabic.innerExpr);
3548
+ }
3549
+ return { english, arabic };
3550
+ }
3551
+ function setMirroredDelimiterInner(english, arabic, pairs) {
3552
+ const englishInner = createEditorChain(pairs.map((pair) => pair.english));
3553
+ const arabicInner = createEditorChain(pairs.map((pair) => pair.arabic));
3554
+ syncChainIds(englishInner, arabicInner);
3555
+ english.innerExpr = englishInner;
3556
+ arabic.innerExpr = arabicInner;
3557
+ }
3558
+ function buildFirstDerivativeFrac() {
3559
+ const englishFrac = createFracNode();
3560
+ const arabicFrac = createFracNode();
3561
+ syncFracIds(englishFrac, arabicFrac);
3562
+ const numerator = buildAdVarChain();
3563
+ const denominator = buildAdVarChain();
3564
+ englishFrac.numerator = numerator.english;
3565
+ englishFrac.denominator = denominator.english;
3566
+ arabicFrac.numerator = numerator.arabic;
3567
+ arabicFrac.denominator = denominator.arabic;
3568
+ return { english: englishFrac, arabic: arabicFrac };
3569
+ }
3570
+ function buildSecondDerivativeFrac() {
3571
+ const englishFrac = createFracNode();
3572
+ const arabicFrac = createFracNode();
3573
+ syncFracIds(englishFrac, arabicFrac);
3574
+ const numAd = mirroredAd();
3575
+ const numVar = mirroredVar();
3576
+ withMirroredSuperscript2(numAd.english, numAd.arabic);
3577
+ const englishNumerator = createEditorChain([numAd.english, numVar.english]);
3578
+ const arabicNumerator = createEditorChain([numAd.arabic, numVar.arabic]);
3579
+ syncChainIds(englishNumerator, arabicNumerator);
3580
+ englishFrac.numerator = englishNumerator;
3581
+ arabicFrac.numerator = arabicNumerator;
3582
+ const denGroup = mirroredEmptyDelimiter();
3583
+ const denInnerAd = mirroredAd();
3584
+ const denInnerVar = mirroredVar();
3585
+ setMirroredDelimiterInner(denGroup.english, denGroup.arabic, [
3586
+ { english: denInnerAd.english, arabic: denInnerAd.arabic },
3587
+ { english: denInnerVar.english, arabic: denInnerVar.arabic }
3588
+ ]);
3589
+ withMirroredSuperscript2(denGroup.english, denGroup.arabic);
3590
+ englishFrac.denominator = createEditorChain([denGroup.english]);
3591
+ arabicFrac.denominator = createEditorChain([denGroup.arabic]);
3592
+ syncChainIds(englishFrac.denominator, arabicFrac.denominator);
3593
+ return { english: englishFrac, arabic: arabicFrac };
3594
+ }
3595
+ var DERIVATIVE_TEMPLATE_VAR_CARET_INDEX = 1;
3596
+ function derivativeTemplateInitialCaret(englishFrac) {
3597
+ const denominator = englishFrac.denominator;
3598
+ if (!denominator) {
3599
+ return {
3600
+ chainId: englishFrac.numerator?.id ?? "",
3601
+ index: DERIVATIVE_TEMPLATE_VAR_CARET_INDEX
3602
+ };
3603
+ }
3604
+ const loneDelimiter = denominator.nodes.length === 1 && denominator.nodes[0]?.kind === "delimiter" && denominator.nodes[0].innerExpr;
3605
+ if (loneDelimiter) {
3606
+ return {
3607
+ chainId: denominator.nodes[0].innerExpr.id,
3608
+ index: DERIVATIVE_TEMPLATE_VAR_CARET_INDEX
3609
+ };
3610
+ }
3611
+ return {
3612
+ chainId: denominator.id,
3613
+ index: DERIVATIVE_TEMPLATE_VAR_CARET_INDEX
3614
+ };
3615
+ }
3616
+
3451
3617
  // src/editor/state.ts
3452
3618
  function ensureSyncEntry(session, nodeId) {
3453
3619
  if (!session.sync[nodeId]) {
@@ -4084,10 +4250,27 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
4084
4250
  inserted.forceSplitNextLeaf = false;
4085
4251
  return inserted;
4086
4252
  }
4253
+ function insertDivideOperator(session) {
4254
+ const base = replaceSelectionFirst(session);
4255
+ const next = cloneEditorSession(base);
4256
+ const englishNode = createEditorNode("operator", DIVIDE_OPERATOR_EN);
4257
+ const arabicNode = createEditorNode("operator", DIVIDE_OPERATOR_AR);
4258
+ arabicNode.id = englishNode.id;
4259
+ insertMirroredNode(next, next.caret.chainId, next.caret.index, englishNode, arabicNode);
4260
+ markExprSync(next, englishNode.id);
4261
+ next.caret.index += 1;
4262
+ next.selectedStructureNodeId = null;
4263
+ syncSelectionToCaret(next);
4264
+ appendDebug(next, "insertDivideOperator", "");
4265
+ return next;
4266
+ }
4087
4267
  function insertOperator(session, expr) {
4088
4268
  if (expr === "." && !session.splitLeafTyping && precedingIsExtendableNumber(session)) {
4089
4269
  return insertNumber(session, ".");
4090
4270
  }
4271
+ if (expr === DIVIDE_OPERATOR_EN || expr === DIVIDE_OPERATOR_AR) {
4272
+ return insertDivideOperator(session);
4273
+ }
4091
4274
  const base = replaceSelectionFirst(session);
4092
4275
  return insertLeaf(base, "operator", expr);
4093
4276
  }
@@ -4158,6 +4341,24 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
4158
4341
  appendDebug(next, "insertFraction", "");
4159
4342
  return next;
4160
4343
  }
4344
+ function insertDerivativeFrac(session, build, debugLabel) {
4345
+ const base = replaceSelectionFirst(session);
4346
+ const next = cloneEditorSession(base);
4347
+ const { english, arabic } = build();
4348
+ insertMirroredNode(next, next.caret.chainId, next.caret.index, english, arabic);
4349
+ syncSubtreeRecursive(next, english, arabic);
4350
+ next.caret = derivativeTemplateInitialCaret(english);
4351
+ next.selectedStructureNodeId = null;
4352
+ syncSelectionToCaret(next);
4353
+ appendDebug(next, debugLabel, "");
4354
+ return next;
4355
+ }
4356
+ function insertFirstDerivative(session) {
4357
+ return insertDerivativeFrac(session, buildFirstDerivativeFrac, "insertFirstDerivative");
4358
+ }
4359
+ function insertSecondDerivative(session) {
4360
+ return insertDerivativeFrac(session, buildSecondDerivativeFrac, "insertSecondDerivative");
4361
+ }
4161
4362
  function insertSqrt(session) {
4162
4363
  const base = replaceSelectionFirst(session);
4163
4364
  const next = cloneEditorSession(base);
@@ -4654,6 +4855,11 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
4654
4855
  i += 1;
4655
4856
  continue;
4656
4857
  }
4858
+ if (ch === DIVIDE_OPERATOR_AR) {
4859
+ s = insertDivideOperator(s);
4860
+ i += 1;
4861
+ continue;
4862
+ }
4657
4863
  s = insertChar(s, ch);
4658
4864
  i += 1;
4659
4865
  }
@@ -4661,7 +4867,7 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
4661
4867
  }
4662
4868
 
4663
4869
  // src/editor/display/base.ts
4664
- function buildBaseNodeBody(node, digitForm = "western") {
4870
+ function buildBaseNodeBody(node, digitForm = "western", side = "english") {
4665
4871
  const value = document.createElement("span");
4666
4872
  value.className = "node-value";
4667
4873
  if (node.kind === "char" && node.characterFont === "takween") {
@@ -4671,7 +4877,8 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
4671
4877
  } else if (node.kind === "char" && node.characterFont === "diwaniOutline") {
4672
4878
  value.classList.add("node-value--diwani-outline");
4673
4879
  }
4674
- value.textContent = node.expr === "" ? "\u25A1" : formatDigits(node.expr, digitForm);
4880
+ const surfaceExpr = node.kind === "operator" ? divideOperatorSurfaceExpr(node.expr, side) : node.expr;
4881
+ value.textContent = surfaceExpr === "" ? "\u25A1" : formatDigits(surfaceExpr, digitForm);
4675
4882
  return value;
4676
4883
  }
4677
4884
 
@@ -4725,7 +4932,7 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
4725
4932
  if (node.kind === "atomicOperatorCommand") {
4726
4933
  return buildAtomicOperatorCommandNodeBody(node, side, uiLocale);
4727
4934
  }
4728
- return buildBaseNodeBody(node, digitForm);
4935
+ return buildBaseNodeBody(node, digitForm, side);
4729
4936
  }
4730
4937
 
4731
4938
  // src/editor/runtime.ts
@@ -5233,6 +5440,10 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
5233
5440
  applyStructural((prev) => insertNumber(prev, char));
5234
5441
  return;
5235
5442
  }
5443
+ if (char === "\\") {
5444
+ applyStructural((prev) => insertDivideOperator(prev));
5445
+ return;
5446
+ }
5236
5447
  if (isOperator(char)) {
5237
5448
  applyStructural((prev) => insertOperator(prev, char));
5238
5449
  return;
@@ -5396,6 +5607,14 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
5396
5607
  applyStructural((prev) => insertFraction(prev));
5397
5608
  surfaceEl.focus();
5398
5609
  },
5610
+ insertFirstDerivative: () => {
5611
+ applyStructural((prev) => insertFirstDerivative(prev));
5612
+ surfaceEl.focus();
5613
+ },
5614
+ insertSecondDerivative: () => {
5615
+ applyStructural((prev) => insertSecondDerivative(prev));
5616
+ surfaceEl.focus();
5617
+ },
5399
5618
  insertMatrixEnv: (style, rows, columns) => {
5400
5619
  applyStructural((prev) => insertMatrixEnv(prev, style, rows, columns));
5401
5620
  surfaceEl.focus();