@microlink/react-json-view 1.23.2 → 1.23.4

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,145 @@ 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
162
  }
163
163
 
164
164
  export interface OnCopyProps {
165
165
  /**
166
166
  * The JSON tree source object
167
167
  */
168
- src: object;
168
+ src: object
169
169
  /**
170
170
  * List of keys.
171
171
  */
172
- namespace: Array<string | null>;
172
+ namespace: Array<string | null>
173
173
  /**
174
174
  * The last key in the namespace array.
175
175
  */
176
- name: string | null;
176
+ name: string | null
177
177
  }
178
178
 
179
179
  export interface CollapsedFieldProps {
180
180
  /**
181
181
  * The name of the entry.
182
182
  */
183
- name: string | null;
183
+ name: string | null
184
184
  /**
185
185
  * The corresponding JSON subtree.
186
186
  */
187
- src: object;
187
+ src: object
188
188
  /**
189
189
  * The type of src. Can only be "array" or "object".
190
190
  */
191
- type: 'array' | 'object';
191
+ type: 'array' | 'object'
192
192
  /**
193
193
  * The scopes above the current entry.
194
194
  */
195
- namespace: Array<string | null>;
195
+ namespace: Array<string | null>
196
196
  }
197
197
 
198
198
  export interface InteractionProps {
199
199
  /**
200
200
  * The updated subtree of the JSON tree.
201
201
  */
202
- updated_src: object;
202
+ updated_src: object
203
203
  /**
204
204
  * The existing subtree of the JSON tree.
205
205
  */
206
- existing_src: object;
206
+ existing_src: object
207
207
  /**
208
208
  * The key of the entry that is interacted with.
209
209
  */
210
- name: string | null;
210
+ name: string | null
211
211
  /**
212
212
  * List of keys.
213
213
  */
214
- namespace: Array<string | null>;
214
+ namespace: Array<string | null>
215
215
  /**
216
216
  * The original value of the entry that is interacted with.
217
217
  */
218
- existing_value: object | string | number | boolean | null;
218
+ existing_value: object | string | number | boolean | null
219
219
  /**
220
220
  * The updated value of the entry that is interacted with.
221
221
  */
222
- new_value?: object | string | number | boolean | null;
222
+ new_value?: object | string | number | boolean | null
223
223
  }
224
224
 
225
225
  export interface OnSelectProps {
226
226
  /**
227
227
  * The name of the currently selected entry.
228
228
  */
229
- name: string | null;
229
+ name: string | null
230
230
  /**
231
231
  * The value of the currently selected entry.
232
232
  */
233
- value: object | string | number | boolean | null;
233
+ value: object | string | number | boolean | null
234
234
  /**
235
235
  * The type of the value. For "number" type, it will be replaced with the more
236
236
  * accurate types: "float", "integer", or "nan".
237
237
  */
238
- type: string;
238
+ type: string
239
239
  /**
240
240
  * List of keys representing the scopes above the selected entry.
241
241
  */
242
- namespace: Array<string | null>;
243
-
242
+ namespace: Array<string | null>
244
243
  }
245
244
 
246
- export type TypeDefaultValue = string | number | boolean | object;
245
+ export type TypeDefaultValue = string | number | boolean | object
247
246
 
248
247
  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;
248
+ base00: string
249
+ base01: string
250
+ base02: string
251
+ base03: string
252
+ base04: string
253
+ base05: string
254
+ base06: string
255
+ base07: string
256
+ base08: string
257
+ base09: string
258
+ base0A: string
259
+ base0B: string
260
+ base0C: string
261
+ base0D: string
262
+ base0E: string
263
+ base0F: string
265
264
  }
266
265
 
267
266
  export type ThemeKeys =
@@ -301,7 +300,7 @@ export type ThemeKeys =
301
300
  | 'threezerotwofour'
302
301
  | 'tomorrow'
303
302
  | 'tube'
304
- | 'twilight';
303
+ | 'twilight'
305
304
 
306
- declare const ReactJson: React.ComponentType<ReactJsonViewProps>;
307
- export default ReactJson;
305
+ declare const ReactJson: React.ComponentType<ReactJsonViewProps>
306
+ 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.2",
5
+ "version": "1.23.4",
6
6
  "main": "dist/main.js",
7
7
  "author": {
8
8
  "name": "Mac Gainor"
@@ -48,6 +48,10 @@
48
48
  "name": "Andy Baird",
49
49
  "email": "andy@threadsculture.com"
50
50
  },
51
+ {
52
+ "name": "Marc Bernard",
53
+ "email": "59966492+mbtools@users.noreply.github.com"
54
+ },
51
55
  {
52
56
  "name": "Daniel Santos",
53
57
  "email": "dsantosp12@gmail.com"
@@ -211,35 +215,41 @@
211
215
  "@babel/plugin-syntax-class-properties": "~7.12.1",
212
216
  "@babel/plugin-syntax-jsx": "~7.12.1",
213
217
  "@babel/register": "7.12.10",
218
+ "@commitlint/cli": "latest",
219
+ "@commitlint/config-conventional": "latest",
220
+ "@ksmithut/prettier-standard": "latest",
214
221
  "@types/react": "^18.2.20",
222
+ "babel-loader": "8.4.1",
223
+ "babel-plugin-istanbul": "6.1.1",
215
224
  "babel-plugin-react-html-attrs": "~2.1.0",
225
+ "babel-preset-react-app": "10.0.1",
226
+ "browser-sync": "~3.0.3",
216
227
  "chai": "~4.2.0",
217
228
  "cheerio": "1.0.0-rc.3",
218
229
  "css-loader": "~4.3.0",
219
230
  "enzyme": "~3.11.0",
220
231
  "enzyme-adapter-react-16": "~1.15.5",
221
- "eslint": "~7.16.0",
222
- "eslint-plugin-prettier": "~3.3.1",
223
- "eslint-plugin-react": "~7.21.5",
224
232
  "github-generate-release": "latest",
225
233
  "html-webpack-plugin": "^4.5.2",
226
234
  "ignore-styles": "~5.0.1",
227
235
  "jsdom": "~16.4.0",
228
236
  "mocha": "~8.2.1",
229
237
  "moment": "~2.29.1",
238
+ "nano-staged": "latest",
230
239
  "nyc": "~15.1.0",
231
240
  "prettier": "~2.2.1",
232
241
  "react": "~16.14.0",
233
242
  "react-dom": "~16.14.0",
234
- "react-github-button": "~0.1.11",
235
- "react-scripts": "~5.0.1",
236
243
  "react-select": "~1.1.0",
237
244
  "react-test-renderer": "~16.14.0",
238
245
  "sass": "~1.47.0",
239
246
  "sass-loader": "~10.1.1",
247
+ "simple-git-hooks": "latest",
240
248
  "sinon": "~9.2.3",
249
+ "standard": "latest",
241
250
  "standard-version": "latest",
242
251
  "style-loader": "~1.3.0",
252
+ "tinyrun": "~1.0.2",
243
253
  "typescript": "^4.5.4",
244
254
  "webpack": "~5.93.0",
245
255
  "webpack-bundle-analyzer": "~4.10.2",
@@ -253,11 +263,12 @@
253
263
  ],
254
264
  "scripts": {
255
265
  "build": "NODE_OPTIONS=--openssl-legacy-provider NODE_ENV=production webpack --config webpack/webpack.config.js --progress",
256
- "build:demo": "NODE_ENV=production webpack --node-env production --config webpack/webpack.config-demo.js --progress",
257
- "dev": "NODE_ENV=development webpack-dev-server --config webpack/webpack.config-dev.js --open",
258
- "lint": "NODE_ENV=test ./node_modules/.bin/eslint src",
259
- "lint-fixup": "NODE_ENV=test ./node_modules/.bin/eslint src --ext .js,.jsx --fix",
260
- "modules:debug": "./docker/debug.sh",
266
+ "dev": "NODE_ENV=development webpack serve --config webpack/webpack.config-dev.js --open",
267
+ "docs:build": "NODE_ENV=production webpack --node-env production --config webpack/webpack.config-docs.js --progress",
268
+ "docs:dev": "tinyrun 'npm run docs:dev:watch' 'npm run docs:dev:browserync'",
269
+ "docs:dev:browserync": "browser-sync start --serveStatic docs/ --server --files 'index.html, **/*.(css|js|md)'",
270
+ "docs:dev:watch": "npm run docs:build -- --watch",
271
+ "lint": "standard",
261
272
  "modules:size-analyzer": "webpack --config webpack/webpack.config.js --json | webpack-bundle-size-analyzer",
262
273
  "modules:tree": "webpack --config webpack/webpack.config.js --json ",
263
274
  "postrelease": "npm run release:tags && npm run release:github && npm publish",
@@ -271,8 +282,41 @@
271
282
  "test:watch": "NODE_ENV=test nyc mocha -w test/**/*-test.js"
272
283
  },
273
284
  "license": "MIT",
285
+ "commitlint": {
286
+ "extends": [
287
+ "@commitlint/config-conventional"
288
+ ],
289
+ "rules": {
290
+ "body-max-line-length": [
291
+ 0
292
+ ]
293
+ }
294
+ },
295
+ "nano-staged": {
296
+ "*.js": [
297
+ "prettier-standard",
298
+ "standard --fix"
299
+ ],
300
+ "package.json": [
301
+ "finepack"
302
+ ]
303
+ },
274
304
  "peerDependencies": {
275
305
  "react": ">= 15",
276
306
  "react-dom": ">= 15"
307
+ },
308
+ "simple-git-hooks": {
309
+ "commit-msg": "npx commitlint --edit",
310
+ "pre-commit": "npx nano-staged"
311
+ },
312
+ "standard": {
313
+ "globals": [
314
+ "describe",
315
+ "it"
316
+ ],
317
+ "ignore": [
318
+ "demo/dist",
319
+ "dev-server"
320
+ ]
277
321
  }
278
322
  }
File without changes