react-inspector.d.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. // Type definitions for react-inspector
  2. // Project: https://github.com/xyc/react-inspector
  3. // Definitions by: vidartf <https://github.com/vidartf>
  4. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
  5. declare module 'react-inspector' {
  6. import * as React from 'react';
  7. export class DOMInspector extends React.Component<DOMInspector.IProperties> {}
  8. export namespace DOMInspector {
  9. export interface IProperties {
  10. data: HTMLElement;
  11. }
  12. }
  13. export class ObjectInspector extends React.Component<
  14. ObjectInspector.IProperties
  15. > {}
  16. export namespace ObjectInspector {
  17. export interface INodeRendererArgs {
  18. depth: number;
  19. name: string;
  20. data: any;
  21. isNonenumerable: boolean;
  22. expanded: boolean;
  23. }
  24. export interface IProperties {
  25. data: any;
  26. name?: string;
  27. expandLevel?: number;
  28. expandPaths?: string | string[];
  29. showNonenumerable?: boolean;
  30. sortObjectKeys?: boolean | ((a: string, b: string) => number);
  31. nodeRenderer?: (args: INodeRendererArgs) => React.ReactElement<any>;
  32. theme?: string | Partial<ITheme>;
  33. }
  34. }
  35. export class TableInspector extends React.Component<
  36. ObjectInspector.IProperties,
  37. ObjectInspector.IState
  38. > {
  39. handleIndexTHClick(): void;
  40. handleTHClick(col: string): void;
  41. }
  42. export namespace ObjectInspector {
  43. export interface IProperties {
  44. columns?: string[];
  45. data: any;
  46. theme?: string | Partial<ITheme>;
  47. }
  48. export interface IState {
  49. sorted: boolean;
  50. sortIndexColumn: boolean;
  51. sortColumn: string | undefined;
  52. sortAscending: boolean;
  53. }
  54. }
  55. export function Inspector(
  56. props: Partial<Inspector.IProperties>
  57. ): ObjectInspector | TableInspector | DOMInspector;
  58. export namespace Inspector {
  59. export interface IProperties {
  60. table: boolean;
  61. data: any;
  62. [key: string]: any;
  63. }
  64. }
  65. export function ObjectLabel(
  66. props: Partial<ObjectLabel.IProperties>
  67. ): React.ReactElement<ObjectLabel.IProperties>;
  68. export namespace ObjectLabel {
  69. export interface IProperties {
  70. name: string;
  71. data: any;
  72. isNonenumerable: boolean;
  73. }
  74. }
  75. export function ObjectRootLabel(
  76. props: Partial<ObjectRootLabel.IProperties>
  77. ): React.ReactElement<ObjectRootLabel.IProperties>;
  78. export namespace ObjectRootLabel {
  79. export interface IProperties {
  80. name: string;
  81. data: any;
  82. }
  83. }
  84. export function ObjectName(
  85. props: Partial<ObjectName.IProperties>,
  86. contexts: Partial<ObjectName.IContexts>
  87. ): React.ReactElement<ObjectName.IProperties>;
  88. export namespace ObjectName {
  89. export interface IProperties {
  90. name: string;
  91. dimmed: boolean;
  92. styles: React.CSSProperties;
  93. }
  94. export interface IContexts {
  95. theme: ITheme;
  96. }
  97. }
  98. export function ObjectValue(
  99. props: Partial<ObjectValue.IProperties>,
  100. contexts: Partial<ObjectValue.IContexts>
  101. ): React.ReactElement<ObjectValue.IProperties>;
  102. export namespace ObjectValue {
  103. export interface IProperties {
  104. object: any;
  105. styles: React.CSSProperties;
  106. }
  107. export interface IContexts {
  108. theme: ITheme;
  109. }
  110. }
  111. export interface ITheme {
  112. ARROW_COLOR: string;
  113. ARROW_FONT_SIZE: number;
  114. ARROW_MARGIN_RIGHT: number;
  115. BASE_BACKGROUND_COLOR: string;
  116. BASE_COLOR: string;
  117. BASE_FONT_FAMILY: string;
  118. BASE_FONT_SIZE: string;
  119. BASE_LINE_HEIGHT: string;
  120. HTML_ATTRIBUTE_NAME_COLOR: string;
  121. HTML_ATTRIBUTE_VALUE_COLOR: string;
  122. HTML_COMMENT_COLOR: string;
  123. HTML_DOCTYPE_COLOR: string;
  124. HTML_TAGNAME_COLOR: string;
  125. HTML_TAGNAME_TEXT_TRANSFORM: string;
  126. HTML_TAG_COLOR: string;
  127. OBJECT_NAME_COLOR: string;
  128. OBJECT_VALUE_BOOLEAN_COLOR: string;
  129. OBJECT_VALUE_FUNCTION_KEYWORD_COLOR: string;
  130. OBJECT_VALUE_NULL_COLOR: string;
  131. OBJECT_VALUE_NUMBER_COLOR: string;
  132. OBJECT_VALUE_REGEXP_COLOR: string;
  133. OBJECT_VALUE_STRING_COLOR: string;
  134. OBJECT_VALUE_SYMBOL_COLOR: string;
  135. OBJECT_VALUE_UNDEFINED_COLOR: string;
  136. TABLE_BORDER_COLOR: string;
  137. TABLE_DATA_BACKGROUND_IMAGE: string;
  138. TABLE_DATA_BACKGROUND_SIZE: string;
  139. TABLE_SORT_ICON_COLOR: string;
  140. TABLE_TH_BACKGROUND_COLOR: string;
  141. TABLE_TH_HOVER_COLOR: string;
  142. TREENODE_FONT_FAMILY: string;
  143. TREENODE_FONT_SIZE: string;
  144. TREENODE_LINE_HEIGHT: string;
  145. TREENODE_PADDING_LEFT: number;
  146. }
  147. export const chromeDark: ITheme;
  148. export const chromeLight: ITheme;
  149. }