@microlink/react-json-view 1.23.3 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import * as React from 'react'
2
2
 
3
3
  export interface ReactJsonViewProps {
4
4
  /**
@@ -6,46 +6,46 @@ export interface ReactJsonViewProps {
6
6
  *
7
7
  * Required.
8
8
  */
9
- src: object;
9
+ src: object
10
10
  /**
11
11
  * Contains the name of your root node. Use null or false for no name.
12
12
  *
13
13
  * Default: "root"
14
14
  */
15
- name?: React.JSX.Element | string | null | false;
15
+ name?: React.JSX.Element | string | null | false
16
16
  /**
17
17
  * RJV supports base-16 themes. Check out the list of supported themes in the demo.
18
18
  * A custom "rjv-default" theme applies by default.
19
19
  *
20
20
  * Default: "rjv-default"
21
21
  */
22
- theme?: ThemeKeys | ThemeObject;
22
+ theme?: ThemeKeys | ThemeObject
23
23
  /**
24
24
  * Style attributes for react-json-view container.
25
25
  * Explicit style attributes will override attributes provided by a theme.
26
26
  *
27
27
  * Default: "rjv-default"
28
28
  */
29
- style?: React.CSSProperties;
29
+ style?: React.CSSProperties
30
30
  /**
31
31
  * Style of expand/collapse icons. Accepted values are "circle", triangle" or "square".
32
32
  *
33
33
  * Default: {}
34
34
  */
35
- iconStyle?: 'circle' | 'triangle' | 'square';
35
+ iconStyle?: 'circle' | 'triangle' | 'square'
36
36
  /**
37
37
  * Set the indent-width for nested objects.
38
38
  *
39
39
  * Default: 4
40
40
  */
41
- indentWidth?: number;
41
+ indentWidth?: number
42
42
  /**
43
43
  * When set to true, all nodes will be collapsed by default.
44
44
  * Use an integer value to collapse at a particular depth.
45
45
  *
46
46
  * Default: false
47
47
  */
48
- collapsed?: boolean | number;
48
+ collapsed?: boolean | number
49
49
  /**
50
50
  * When an integer value is assigned, strings will be cut off at that length.
51
51
  * Collapsed strings are followed by an ellipsis.
@@ -53,52 +53,52 @@ export interface ReactJsonViewProps {
53
53
  *
54
54
  * Default: false
55
55
  */
56
- collapseStringsAfterLength?: number | false;
56
+ collapseStringsAfterLength?: number | false
57
57
  /**
58
58
  * Callback function to provide control over what objects and arrays should be collapsed by default.
59
59
  * An object is passed to the callback containing name, src, type ("array" or "object") and namespace.
60
60
  *
61
61
  * Default: false
62
62
  */
63
- shouldCollapse?: false | ((field: CollapsedFieldProps) => boolean);
63
+ shouldCollapse?: false | ((field: CollapsedFieldProps) => boolean)
64
64
  /**
65
65
  * When an integer value is assigned, arrays will be displayed in groups by count of the value.
66
66
  * Groups are displayed with brakcet notation and can be expanded and collapsed by clickong on the brackets.
67
67
  *
68
68
  * Default: 100
69
69
  */
70
- groupArraysAfterLength?: number;
70
+ groupArraysAfterLength?: number
71
71
  /**
72
72
  * When prop is not false, the user can copy objects and arrays to clipboard by clicking on the clipboard icon.
73
73
  * Copy callbacks are supported.
74
74
  *
75
75
  * Default: true
76
76
  */
77
- enableClipboard?: boolean | ((copy: OnCopyProps) => void);
77
+ enableClipboard?: boolean | ((copy: OnCopyProps) => void)
78
78
  /**
79
79
  * When set to true, objects and arrays are labeled with size.
80
80
  *
81
81
  * Default: true
82
82
  */
83
- displayObjectSize?: boolean;
83
+ displayObjectSize?: boolean
84
84
  /**
85
85
  * When set to true, data type labels prefix values.
86
86
  *
87
87
  * Default: true
88
88
  */
89
- displayDataTypes?: boolean;
89
+ displayDataTypes?: boolean
90
90
  /**
91
91
  * When set to true, the index of the elements prefix values
92
92
  *
93
93
  * Default: true
94
94
  */
95
- displayArrayKey?: boolean;
95
+ displayArrayKey?: boolean
96
96
  /**
97
97
  * set to false to remove quotes from keys (eg. "name": vs. name:)
98
98
  *
99
99
  * Default: true
100
100
  */
101
- quotesOnKeys?: boolean;
101
+ quotesOnKeys?: boolean
102
102
  /**
103
103
  * When a callback function is passed in, edit functionality is enabled.
104
104
  * The callback is invoked before edits are completed. Returning false
@@ -106,7 +106,7 @@ export interface ReactJsonViewProps {
106
106
  *
107
107
  * Default: false
108
108
  */
109
- onEdit?: ((edit: InteractionProps) => false | any) | false;
109
+ onEdit?: ((edit: InteractionProps) => false | any) | false
110
110
  /**
111
111
  * When a callback function is passed in, add functionality is enabled.
112
112
  * The callback is invoked before additions are completed.
@@ -114,7 +114,7 @@ export interface ReactJsonViewProps {
114
114
  *
115
115
  * Default: false
116
116
  */
117
- onAdd?: ((add: InteractionProps) => false | any) | false;
117
+ onAdd?: ((add: InteractionProps) => false | any) | false
118
118
  /**
119
119
  * When a callback function is passed in, delete functionality is enabled.
120
120
  * The callback is invoked before deletions are completed.
@@ -122,146 +122,151 @@ export interface ReactJsonViewProps {
122
122
  *
123
123
  * Default: false
124
124
  */
125
- onDelete?: ((del: InteractionProps) => false | any) | false;
125
+ onDelete?: ((del: InteractionProps) => false | any) | false
126
126
  /**
127
127
  * When a function is passed in, clicking a value triggers the onSelect method to be called.
128
128
  *
129
129
  * Default: false
130
130
  */
131
- onSelect?: ((select: OnSelectProps) => void) | false;
131
+ onSelect?: ((select: OnSelectProps) => void) | false
132
132
  /**
133
133
  * Custom message for validation failures to onEdit, onAdd, or onDelete callbacks.
134
134
  *
135
135
  * Default: "Validation Error"
136
136
  */
137
- validationMessage?: string;
137
+ validationMessage?: string
138
138
  /**
139
139
  * Set to true to sort object keys.
140
140
  *
141
141
  * Default: false
142
142
  */
143
- sortKeys?: boolean;
143
+ sortKeys?: boolean
144
144
  /**
145
145
  * Set to a value to be used as defaultValue when adding new key to json
146
146
  *
147
147
  * Default: null
148
148
  */
149
- defaultValue?: TypeDefaultValue | TypeDefaultValue[] | null;
149
+ defaultValue?: TypeDefaultValue | TypeDefaultValue[] | null
150
150
  /**
151
151
  * Whether to select the textarea contents on edit
152
152
  *
153
153
  * Default: false
154
154
  */
155
- selectOnFocus?: boolean;
155
+ selectOnFocus?: boolean
156
156
  /**
157
157
  * The key modifier to be combined with a click on JSON values to edit them
158
158
  *
159
159
  * Default: (e) => e.metaKey || e.ctrlKey
160
160
  */
161
- keyModifier?: (event: Event, type: 'edit' | 'submit') => boolean;
161
+ keyModifier?: (event: Event, type: 'edit' | 'submit') => boolean
162
+ /**
163
+ * Set to true to escape strings sequences such as \n, \t, \r, \f
164
+ *
165
+ * Default: true
166
+ */
167
+ escapeStrings?: boolean
162
168
  }
163
169
 
164
170
  export interface OnCopyProps {
165
171
  /**
166
172
  * The JSON tree source object
167
173
  */
168
- src: object;
174
+ src: object
169
175
  /**
170
176
  * List of keys.
171
177
  */
172
- namespace: Array<string | null>;
178
+ namespace: Array<string | null>
173
179
  /**
174
180
  * The last key in the namespace array.
175
181
  */
176
- name: string | null;
182
+ name: string | null
177
183
  }
178
184
 
179
185
  export interface CollapsedFieldProps {
180
186
  /**
181
187
  * The name of the entry.
182
188
  */
183
- name: string | null;
189
+ name: string | null
184
190
  /**
185
191
  * The corresponding JSON subtree.
186
192
  */
187
- src: object;
193
+ src: object
188
194
  /**
189
195
  * The type of src. Can only be "array" or "object".
190
196
  */
191
- type: 'array' | 'object';
197
+ type: 'array' | 'object'
192
198
  /**
193
199
  * The scopes above the current entry.
194
200
  */
195
- namespace: Array<string | null>;
201
+ namespace: Array<string | null>
196
202
  }
197
203
 
198
204
  export interface InteractionProps {
199
205
  /**
200
206
  * The updated subtree of the JSON tree.
201
207
  */
202
- updated_src: object;
208
+ updated_src: object
203
209
  /**
204
210
  * The existing subtree of the JSON tree.
205
211
  */
206
- existing_src: object;
212
+ existing_src: object
207
213
  /**
208
214
  * The key of the entry that is interacted with.
209
215
  */
210
- name: string | null;
216
+ name: string | null
211
217
  /**
212
218
  * List of keys.
213
219
  */
214
- namespace: Array<string | null>;
220
+ namespace: Array<string | null>
215
221
  /**
216
222
  * The original value of the entry that is interacted with.
217
223
  */
218
- existing_value: object | string | number | boolean | null;
224
+ existing_value: object | string | number | boolean | null
219
225
  /**
220
226
  * The updated value of the entry that is interacted with.
221
227
  */
222
- new_value?: object | string | number | boolean | null;
228
+ new_value?: object | string | number | boolean | null
223
229
  }
224
230
 
225
231
  export interface OnSelectProps {
226
232
  /**
227
233
  * The name of the currently selected entry.
228
234
  */
229
- name: string | null;
235
+ name: string | null
230
236
  /**
231
237
  * The value of the currently selected entry.
232
238
  */
233
- value: object | string | number | boolean | null;
239
+ value: object | string | number | boolean | null
234
240
  /**
235
241
  * The type of the value. For "number" type, it will be replaced with the more
236
242
  * accurate types: "float", "integer", or "nan".
237
243
  */
238
- type: string;
244
+ type: string
239
245
  /**
240
246
  * List of keys representing the scopes above the selected entry.
241
247
  */
242
- namespace: Array<string | null>;
243
-
248
+ namespace: Array<string | null>
244
249
  }
245
250
 
246
- export type TypeDefaultValue = string | number | boolean | object;
251
+ export type TypeDefaultValue = string | number | boolean | object
247
252
 
248
253
  export interface ThemeObject {
249
- base00: string;
250
- base01: string;
251
- base02: string;
252
- base03: string;
253
- base04: string;
254
- base05: string;
255
- base06: string;
256
- base07: string;
257
- base08: string;
258
- base09: string;
259
- base0A: string;
260
- base0B: string;
261
- base0C: string;
262
- base0D: string;
263
- base0E: string;
264
- base0F: string;
254
+ base00: string
255
+ base01: string
256
+ base02: string
257
+ base03: string
258
+ base04: string
259
+ base05: string
260
+ base06: string
261
+ base07: string
262
+ base08: string
263
+ base09: string
264
+ base0A: string
265
+ base0B: string
266
+ base0C: string
267
+ base0D: string
268
+ base0E: string
269
+ base0F: string
265
270
  }
266
271
 
267
272
  export type ThemeKeys =
@@ -301,7 +306,7 @@ export type ThemeKeys =
301
306
  | 'threezerotwofour'
302
307
  | 'tomorrow'
303
308
  | 'tube'
304
- | 'twilight';
309
+ | 'twilight'
305
310
 
306
- declare const ReactJson: React.ComponentType<ReactJsonViewProps>;
307
- export default ReactJson;
311
+ declare const ReactJson: React.ComponentType<ReactJsonViewProps>
312
+ export default ReactJson
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@microlink/react-json-view",
3
3
  "description": "Interactive react component for displaying javascript arrays and JSON objects.",
4
4
  "homepage": "https://github.com/microlinkhq/react-json-view",
5
- "version": "1.23.3",
5
+ "version": "1.24.0",
6
6
  "main": "dist/main.js",
7
7
  "author": {
8
8
  "name": "Mac Gainor"
@@ -171,6 +171,10 @@
171
171
  {
172
172
  "name": "REDMOND\\xuefl",
173
173
  "email": "xuefl@microsoft.com"
174
+ },
175
+ {
176
+ "name": "Mert Donmezyurek",
177
+ "email": "info@mertdy.com"
174
178
  }
175
179
  ],
176
180
  "repository": {
@@ -203,7 +207,6 @@
203
207
  "treeview"
204
208
  ],
205
209
  "dependencies": {
206
- "flux": "~4.0.1",
207
210
  "react-base16-styling": "~0.9.0",
208
211
  "react-lifecycles-compat": "~3.0.4",
209
212
  "react-textarea-autosize": "~8.3.2"
@@ -215,35 +218,41 @@
215
218
  "@babel/plugin-syntax-class-properties": "~7.12.1",
216
219
  "@babel/plugin-syntax-jsx": "~7.12.1",
217
220
  "@babel/register": "7.12.10",
221
+ "@commitlint/cli": "latest",
222
+ "@commitlint/config-conventional": "latest",
223
+ "@ksmithut/prettier-standard": "latest",
218
224
  "@types/react": "^18.2.20",
225
+ "babel-loader": "8.4.1",
226
+ "babel-plugin-istanbul": "6.1.1",
219
227
  "babel-plugin-react-html-attrs": "~2.1.0",
228
+ "babel-preset-react-app": "10.0.1",
229
+ "browser-sync": "~3.0.3",
220
230
  "chai": "~4.2.0",
221
231
  "cheerio": "1.0.0-rc.3",
222
232
  "css-loader": "~4.3.0",
223
233
  "enzyme": "~3.11.0",
224
234
  "enzyme-adapter-react-16": "~1.15.5",
225
- "eslint": "~7.16.0",
226
- "eslint-plugin-prettier": "~3.3.1",
227
- "eslint-plugin-react": "~7.21.5",
228
235
  "github-generate-release": "latest",
229
236
  "html-webpack-plugin": "^4.5.2",
230
237
  "ignore-styles": "~5.0.1",
231
238
  "jsdom": "~16.4.0",
232
239
  "mocha": "~8.2.1",
233
240
  "moment": "~2.29.1",
241
+ "nano-staged": "latest",
234
242
  "nyc": "~15.1.0",
235
243
  "prettier": "~2.2.1",
236
244
  "react": "~16.14.0",
237
245
  "react-dom": "~16.14.0",
238
- "react-github-button": "~0.1.11",
239
- "react-scripts": "~5.0.1",
240
246
  "react-select": "~1.1.0",
241
247
  "react-test-renderer": "~16.14.0",
242
248
  "sass": "~1.47.0",
243
249
  "sass-loader": "~10.1.1",
250
+ "simple-git-hooks": "latest",
244
251
  "sinon": "~9.2.3",
252
+ "standard": "latest",
245
253
  "standard-version": "latest",
246
254
  "style-loader": "~1.3.0",
255
+ "tinyrun": "~1.0.2",
247
256
  "typescript": "^4.5.4",
248
257
  "webpack": "~5.93.0",
249
258
  "webpack-bundle-analyzer": "~4.10.2",
@@ -257,11 +266,12 @@
257
266
  ],
258
267
  "scripts": {
259
268
  "build": "NODE_OPTIONS=--openssl-legacy-provider NODE_ENV=production webpack --config webpack/webpack.config.js --progress",
260
- "build:demo": "NODE_ENV=production webpack --node-env production --config webpack/webpack.config-demo.js --progress",
261
- "dev": "NODE_ENV=development webpack-dev-server --config webpack/webpack.config-dev.js --open",
262
- "lint": "NODE_ENV=test ./node_modules/.bin/eslint src",
263
- "lint-fixup": "NODE_ENV=test ./node_modules/.bin/eslint src --ext .js,.jsx --fix",
264
- "modules:debug": "./docker/debug.sh",
269
+ "dev": "NODE_ENV=development webpack serve --config webpack/webpack.config-dev.js --open",
270
+ "docs:build": "NODE_ENV=production webpack --node-env production --config webpack/webpack.config-docs.js --progress",
271
+ "docs:dev": "tinyrun 'npm run docs:dev:watch' 'npm run docs:dev:browserync'",
272
+ "docs:dev:browserync": "browser-sync start --serveStatic docs/ --server --files 'index.html, **/*.(css|js|md)'",
273
+ "docs:dev:watch": "npm run docs:build -- --watch",
274
+ "lint": "standard",
265
275
  "modules:size-analyzer": "webpack --config webpack/webpack.config.js --json | webpack-bundle-size-analyzer",
266
276
  "modules:tree": "webpack --config webpack/webpack.config.js --json ",
267
277
  "postrelease": "npm run release:tags && npm run release:github && npm publish",
@@ -275,8 +285,41 @@
275
285
  "test:watch": "NODE_ENV=test nyc mocha -w test/**/*-test.js"
276
286
  },
277
287
  "license": "MIT",
288
+ "commitlint": {
289
+ "extends": [
290
+ "@commitlint/config-conventional"
291
+ ],
292
+ "rules": {
293
+ "body-max-line-length": [
294
+ 0
295
+ ]
296
+ }
297
+ },
298
+ "nano-staged": {
299
+ "*.js": [
300
+ "prettier-standard",
301
+ "standard --fix"
302
+ ],
303
+ "package.json": [
304
+ "finepack"
305
+ ]
306
+ },
278
307
  "peerDependencies": {
279
308
  "react": ">= 15",
280
309
  "react-dom": ">= 15"
310
+ },
311
+ "simple-git-hooks": {
312
+ "commit-msg": "npx commitlint --edit",
313
+ "pre-commit": "npx nano-staged"
314
+ },
315
+ "standard": {
316
+ "globals": [
317
+ "describe",
318
+ "it"
319
+ ],
320
+ "ignore": [
321
+ "demo/dist",
322
+ "dev-server"
323
+ ]
281
324
  }
282
325
  }
File without changes