Menu.d.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. import { MathItem } from '../../core/MathItem.js';
  2. import { OutputJax } from '../../core/OutputJax.js';
  3. import { OptionList } from '../../util/Options.js';
  4. import { MJContextMenu } from './MJContextMenu.js';
  5. import { MmlVisitor } from './MmlVisitor.js';
  6. import { SelectableInfo } from './SelectableInfo.js';
  7. import { MenuMathDocument } from './MenuHandler.js';
  8. import { Info } from 'mj-context-menu/js/info.js';
  9. export interface MenuSettings {
  10. texHints: boolean;
  11. semantics: boolean;
  12. zoom: string;
  13. zscale: string;
  14. renderer: string;
  15. alt: boolean;
  16. cmd: boolean;
  17. ctrl: boolean;
  18. shift: boolean;
  19. scale: string;
  20. autocollapse: boolean;
  21. collapsible: boolean;
  22. inTabOrder: boolean;
  23. assistiveMml: boolean;
  24. backgroundColor: string;
  25. backgroundOpacity: string;
  26. braille: boolean;
  27. explorer: boolean;
  28. foregroundColor: string;
  29. foregroundOpacity: string;
  30. highlight: string;
  31. locale: string;
  32. infoPrefix: boolean;
  33. infoRole: boolean;
  34. infoType: boolean;
  35. magnification: string;
  36. magnify: string;
  37. speech: boolean;
  38. speechRules: string;
  39. subtitles: boolean;
  40. treeColoring: boolean;
  41. viewBraille: boolean;
  42. }
  43. export declare type HTMLMATHITEM = MathItem<HTMLElement, Text, Document>;
  44. export declare class Menu {
  45. static MENU_STORAGE: string;
  46. static OPTIONS: OptionList;
  47. protected static loading: number;
  48. protected static loadingPromises: Map<string, Promise<void>>;
  49. protected static _loadingPromise: Promise<void>;
  50. protected static _loadingOK: Function;
  51. protected static _loadingFailed: Function;
  52. options: OptionList;
  53. settings: MenuSettings;
  54. defaultSettings: MenuSettings;
  55. menu: MJContextMenu;
  56. MmlVisitor: MmlVisitor<HTMLElement, Text, Document>;
  57. protected document: MenuMathDocument;
  58. protected jax: {
  59. [name: string]: OutputJax<HTMLElement, Text, Document>;
  60. };
  61. protected rerenderStart: number;
  62. get isLoading(): boolean;
  63. get loadingPromise(): Promise<void>;
  64. protected about: Info;
  65. protected help: Info;
  66. protected mathmlCode: SelectableInfo;
  67. protected originalText: SelectableInfo;
  68. protected annotationText: SelectableInfo;
  69. protected zoomBox: Info;
  70. constructor(document: MenuMathDocument, options?: OptionList);
  71. protected initSettings(): void;
  72. protected initMenu(): void;
  73. protected checkLoadableItems(): void;
  74. protected enableExplorerItems(enable: boolean): void;
  75. protected mergeUserSettings(): void;
  76. protected saveUserSettings(): void;
  77. protected setA11y(options: {
  78. [key: string]: any;
  79. }): void;
  80. protected getA11y(option: string): any;
  81. protected applySettings(): void;
  82. protected setScale(scale: string): void;
  83. protected setRenderer(jax: string): void;
  84. protected setOutputJax(jax: string): void;
  85. protected setTabOrder(tab: boolean): void;
  86. protected setAssistiveMml(mml: boolean): void;
  87. protected setExplorer(explore: boolean): void;
  88. protected setCollapsible(collapse: boolean): void;
  89. protected scaleAllMath(): void;
  90. protected resetDefaults(): void;
  91. checkComponent(name: string): void;
  92. protected loadComponent(name: string, callback: () => void): void;
  93. loadA11y(component: string): void;
  94. protected transferMathList(document: MenuMathDocument): void;
  95. protected formatSource(text: string): string;
  96. protected toMML(math: HTMLMATHITEM): string;
  97. protected zoom(event: MouseEvent, type: string, math: HTMLMATHITEM): void;
  98. protected isZoomEvent(event: MouseEvent, zoom: string): boolean;
  99. protected rerender(start?: number): void;
  100. protected copyMathML(): void;
  101. protected copyOriginal(): void;
  102. copyAnnotation(): void;
  103. protected copyToClipboard(text: string): void;
  104. addMenu(math: HTMLMATHITEM): void;
  105. clear(): void;
  106. variable<T extends (string | boolean)>(name: keyof MenuSettings, action?: (value: T) => void): Object;
  107. a11yVar<T extends (string | boolean)>(name: keyof MenuSettings, action?: (value: T) => void): Object;
  108. submenu(id: string, content: string, entries?: any[], disabled?: boolean): Object;
  109. command(id: string, content: string, action: () => void, other?: Object): Object;
  110. checkbox(id: string, content: string, variable: string, other?: Object): Object;
  111. radioGroup(variable: string, radios: string[][]): Object[];
  112. radio(id: string, content: string, variable: string, other?: Object): Object;
  113. label(id: string, content: string): Object;
  114. rule(): Object;
  115. }