Wrapper.d.ts 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import { AbstractWrapper, WrapperClass } from '../../core/Tree/Wrapper.js';
  2. import { PropertyList } from '../../core/Tree/Node.js';
  3. import { MmlNode, TextNode } from '../../core/MmlTree/MmlNode.js';
  4. import { Property } from '../../core/Tree/Node.js';
  5. import { Styles } from '../../util/Styles.js';
  6. import { StyleList } from '../../util/StyleList.js';
  7. import { CommonOutputJax } from './OutputJax.js';
  8. import { CommonWrapperFactory } from './WrapperFactory.js';
  9. import { BBox } from '../../util/BBox.js';
  10. import { FontData, DelimiterData, CharData, CharOptions, DIRECTION } from './FontData.js';
  11. export declare type StringMap = {
  12. [key: string]: string;
  13. };
  14. export declare type Constructor<T> = new (...args: any[]) => T;
  15. export declare type AnyWrapper = CommonWrapper<any, any, any, any, any, any>;
  16. export declare type AnyWrapperClass = CommonWrapperClass<any, any, any, any, any, any>;
  17. export declare type WrapperConstructor = Constructor<AnyWrapper>;
  18. export interface CommonWrapperClass<J extends CommonOutputJax<any, any, any, W, CommonWrapperFactory<J, W, C, CC, DD, FD>, FD, any>, W extends CommonWrapper<J, W, C, CC, DD, FD>, C extends CommonWrapperClass<J, W, C, CC, DD, FD>, CC extends CharOptions, DD extends DelimiterData, FD extends FontData<CC, any, DD>> extends WrapperClass<MmlNode, CommonWrapper<J, W, C, CC, DD, FD>> {
  19. new (factory: CommonWrapperFactory<J, W, C, CC, DD, FD>, node: MmlNode, ...args: any[]): W;
  20. }
  21. export declare class CommonWrapper<J extends CommonOutputJax<any, any, any, W, CommonWrapperFactory<J, W, C, CC, DD, FD>, FD, any>, W extends CommonWrapper<J, W, C, CC, DD, FD>, C extends CommonWrapperClass<J, W, C, CC, DD, FD>, CC extends CharOptions, DD extends DelimiterData, FD extends FontData<CC, any, DD>> extends AbstractWrapper<MmlNode, CommonWrapper<J, W, C, CC, DD, FD>> {
  22. static kind: string;
  23. static styles: StyleList;
  24. static removeStyles: string[];
  25. static skipAttributes: {
  26. [name: string]: boolean;
  27. };
  28. static BOLDVARIANTS: {
  29. [name: string]: StringMap;
  30. };
  31. static ITALICVARIANTS: {
  32. [name: string]: StringMap;
  33. };
  34. protected factory: CommonWrapperFactory<J, W, C, CC, DD, FD>;
  35. parent: W;
  36. childNodes: W[];
  37. protected removedStyles: StringMap;
  38. protected styles: Styles;
  39. variant: string;
  40. bbox: BBox;
  41. protected bboxComputed: boolean;
  42. stretch: DD;
  43. font: FD;
  44. get jax(): J;
  45. get adaptor(): import("../../core/DOMAdaptor.js").DOMAdaptor<any, any, any>;
  46. get metrics(): import("../../core/MathItem.js").Metrics;
  47. get fixesPWidth(): boolean;
  48. constructor(factory: CommonWrapperFactory<J, W, C, CC, DD, FD>, node: MmlNode, parent?: W);
  49. wrap(node: MmlNode, parent?: W): W;
  50. getBBox(save?: boolean): BBox;
  51. getOuterBBox(save?: boolean): BBox;
  52. protected computeBBox(bbox: BBox, recompute?: boolean): void;
  53. setChildPWidths(recompute: boolean, w?: (number | null), clear?: boolean): boolean;
  54. invalidateBBox(): void;
  55. protected copySkewIC(bbox: BBox): void;
  56. protected getStyles(): void;
  57. protected getVariant(): void;
  58. protected explicitVariant(fontFamily: string, fontWeight: string, fontStyle: string): string;
  59. protected getScale(): void;
  60. protected getSpace(): void;
  61. protected getMathMLSpacing(): void;
  62. protected getTeXSpacing(isTop: boolean, hasSpacing: boolean): void;
  63. protected isTopEmbellished(): boolean;
  64. core(): CommonWrapper<J, W, C, CC, DD, FD>;
  65. coreMO(): CommonWrapper<J, W, C, CC, DD, FD>;
  66. getText(): string;
  67. canStretch(direction: DIRECTION): boolean;
  68. protected getAlignShift(): [string, number];
  69. protected getAlignX(W: number, bbox: BBox, align: string): number;
  70. protected getAlignY(H: number, D: number, h: number, d: number, align: string): number;
  71. getWrapWidth(i: number): number;
  72. getChildAlign(_i: number): string;
  73. protected percent(m: number): string;
  74. protected em(m: number): string;
  75. protected px(m: number, M?: number): string;
  76. protected length2em(length: Property, size?: number, scale?: number): number;
  77. protected unicodeChars(text: string, name?: string): number[];
  78. remapChars(chars: number[]): number[];
  79. mmlText(text: string): TextNode;
  80. mmlNode(kind: string, properties?: PropertyList, children?: MmlNode[]): MmlNode;
  81. protected createMo(text: string): CommonWrapper<J, W, C, CC, DD, FD>;
  82. protected getVariantChar(variant: string, n: number): CharData<CC>;
  83. }