Region.d.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import { MathDocument } from '../../core/MathDocument.js';
  2. import { CssStyles } from '../../util/StyleList.js';
  3. import Sre from '../sre.js';
  4. export declare type A11yDocument = MathDocument<HTMLElement, Text, Document>;
  5. export interface Region<T> {
  6. AddStyles(): void;
  7. AddElement(): void;
  8. Show(node: HTMLElement, highlighter: Sre.highlighter): void;
  9. Hide(): void;
  10. Clear(): void;
  11. Update(content: T): void;
  12. }
  13. export declare abstract class AbstractRegion<T> implements Region<T> {
  14. document: A11yDocument;
  15. protected static className: string;
  16. protected static styleAdded: boolean;
  17. protected static style: CssStyles;
  18. protected div: HTMLElement;
  19. protected inner: HTMLElement;
  20. protected CLASS: typeof AbstractRegion;
  21. constructor(document: A11yDocument);
  22. AddStyles(): void;
  23. AddElement(): void;
  24. Show(node: HTMLElement, highlighter: Sre.highlighter): void;
  25. protected abstract position(node: HTMLElement): void;
  26. protected abstract highlight(highlighter: Sre.highlighter): void;
  27. Hide(): void;
  28. abstract Clear(): void;
  29. abstract Update(content: T): void;
  30. protected stackRegions(node: HTMLElement): void;
  31. }
  32. export declare class DummyRegion extends AbstractRegion<void> {
  33. Clear(): void;
  34. Update(): void;
  35. Hide(): void;
  36. Show(): void;
  37. AddElement(): void;
  38. AddStyles(): void;
  39. position(): void;
  40. highlight(_highlighter: Sre.highlighter): void;
  41. }
  42. export declare class StringRegion extends AbstractRegion<string> {
  43. Clear(): void;
  44. Update(speech: string): void;
  45. protected position(node: HTMLElement): void;
  46. protected highlight(highlighter: Sre.highlighter): void;
  47. }
  48. export declare class ToolTip extends StringRegion {
  49. protected static className: string;
  50. protected static style: CssStyles;
  51. }
  52. export declare class LiveRegion extends StringRegion {
  53. document: A11yDocument;
  54. protected static className: string;
  55. protected static style: CssStyles;
  56. constructor(document: A11yDocument);
  57. }
  58. export declare class HoverRegion extends AbstractRegion<HTMLElement> {
  59. document: A11yDocument;
  60. protected static className: string;
  61. protected static style: CssStyles;
  62. constructor(document: A11yDocument);
  63. protected position(node: HTMLElement): void;
  64. protected highlight(highlighter: Sre.highlighter): void;
  65. Show(node: HTMLElement, highlighter: Sre.highlighter): void;
  66. Clear(): void;
  67. Update(node: HTMLElement): void;
  68. private cloneNode;
  69. }