react-inspector.d.ts 4.5 KB

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