暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

card.d.ts 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. declare module RpgCards {
  2. class Options {
  3. foreground_color: string;
  4. background_color: string;
  5. empty_color: string;
  6. default_color: string;
  7. default_icon: string;
  8. default_title_size: string;
  9. page_size: string;
  10. page_rows: number;
  11. page_columns: number;
  12. card_arrangement: string;
  13. card_size: string;
  14. card_count: number;
  15. icon_inline: boolean;
  16. constructor();
  17. }
  18. class Card {
  19. count: number;
  20. title: string;
  21. title_size: string;
  22. title_icon_text: string;
  23. color: string;
  24. color_front: string;
  25. color_back: string;
  26. icon: string;
  27. icon_front: string;
  28. icon_back: string;
  29. contents: string[];
  30. tags: string[];
  31. userData: any;
  32. constructor();
  33. static fromJSON(json: any): Card;
  34. toJSON(): any;
  35. duplicate(): Card;
  36. hasTag(tag: string): boolean;
  37. addTag(tag: string): void;
  38. removeTag(tag: string): void;
  39. findTag(pattern: string, flags?: string): string[];
  40. replaceTag(pattern: string, substitution: string, flags?: string): void;
  41. findContent(pattern: string, flags?: string): string[];
  42. replaceContent(pattern: string, substitution: string, flags?: string): void;
  43. findTitle(pattern: string, flags?: string): string[];
  44. findTitleAny(patterns: string[], flags?: string): string[];
  45. getTitle(options: Options): string;
  46. getTitleSize(options: Options): string;
  47. getTitleIconText(options: Options): string;
  48. getColorFront(options: Options): string;
  49. getColorBack(options: Options): string;
  50. getIconFront(options: Options): string;
  51. getIconBack(options: Options): string;
  52. }
  53. class CardDeck {
  54. cards: Card[];
  55. private _actions;
  56. constructor();
  57. toJSON(): any;
  58. static fromJSON(data: any): CardDeck;
  59. addCards(cards: Card[]): void;
  60. addNewCard(): Card;
  61. duplicateCard(card: Card): Card;
  62. deleteCard(card: Card): void;
  63. commit(): void;
  64. }
  65. class CardHtmlGenerator {
  66. constructor();
  67. private _icon(src, ind, ind0);
  68. private _subtitle(params, card, options, ind, ind0);
  69. private _ruler(params, card, options, ind, ind0);
  70. private _boxes(params, card, options, ind, ind0);
  71. private _property(params, card, options, ind, ind0);
  72. private _description(params, card, options, ind, ind0);
  73. private _text(params, card, options, ind, ind0);
  74. private _dndstats(params, card, options, ind, ind0);
  75. private _bullet(params, card, options, ind, ind0);
  76. private _section(params, card, options, ind, ind0);
  77. private _fill(params, card, options, ind, ind0);
  78. private _vspace(params, card, options, ind, ind0);
  79. private _unknown(params, card, options, ind, ind0);
  80. private _empty(params, card, options, ind, ind0);
  81. private _contents(contents, card, options, ind, ind0);
  82. private _title(card, options, ind, ind0);
  83. private _card_front(card, options, ind, ind0);
  84. private _card_back(card, options, ind, ind0);
  85. private _card_empty(options, ind, ind0);
  86. private _card(options, ind, ind0, content, color);
  87. /** Generates HTML for the front side of the given card */
  88. card_front(card: Card, options: Options, indent: string): string;
  89. /** Generates HTML for the back side of the given card */
  90. card_back(card: Card, options: Options, indent: string): string;
  91. /** Generates HTML for an empty given card */
  92. card_empty(options: Options, indent: string): string;
  93. }
  94. class PageHtmlGenerator {
  95. indent: string;
  96. constructor();
  97. private _pageColor(page, options);
  98. private _wrap(pageSet, options);
  99. private _generatePagesDoublesided(cards, options, rows, cols, generator);
  100. private _generatePagesFrontOnly(cards, options, rows, cols, generator);
  101. private _generatePagesSideBySide(cards, options, rows, cols, generator);
  102. private _generatePages(cards, options, rows, cols, generator);
  103. private _generateStyle(options);
  104. generateHtml(cards: Card[], options: Options): string;
  105. insertInto(cards: Card[], options: Options, container: HTMLElement): void;
  106. }
  107. }