@jupyterlab/codeeditor 0.19.1-alpha.0 → 0.19.1

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/lib/jsoneditor.js CHANGED
@@ -1,376 +1,376 @@
1
- "use strict";
2
- // Copyright (c) Jupyter Development Team.
3
- // Distributed under the terms of the Modified BSD License.
4
- var __importStar = (this && this.__importStar) || function (mod) {
5
- if (mod && mod.__esModule) return mod;
6
- var result = {};
7
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
8
- result["default"] = mod;
9
- return result;
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const coreutils_1 = require("@phosphor/coreutils");
13
- const widgets_1 = require("@phosphor/widgets");
14
- const React = __importStar(require("react"));
15
- const ReactDOM = __importStar(require("react-dom"));
16
- const editor_1 = require("./editor");
17
- /**
18
- * The class name added to a JSONEditor instance.
19
- */
20
- const JSONEDITOR_CLASS = 'jp-JSONEditor';
21
- /**
22
- * The class name added when the Metadata editor contains invalid JSON.
23
- */
24
- const ERROR_CLASS = 'jp-mod-error';
25
- /**
26
- * The class name added to the editor host node.
27
- */
28
- const HOST_CLASS = 'jp-JSONEditor-host';
29
- /**
30
- * The class name added to the header area.
31
- */
32
- const HEADER_CLASS = 'jp-JSONEditor-header';
33
- /**
34
- * The class name added to the title node.
35
- */
36
- const TITLE_CLASS = 'jp-JSONEditor-title';
37
- /**
38
- * The class name added to the collapser node.
39
- */
40
- const COLLAPSER_CLASS = 'jp-JSONEditor-collapser';
41
- /**
42
- * The class name added to the collapser node that is enabled.
43
- */
44
- const COLLAPSE_ENABLED_CLASS = 'jp-mod-collapse-enabled';
45
- /**
46
- * The class name added to the revert button.
47
- */
48
- const REVERT_CLASS = 'jp-JSONEditor-revertButton';
49
- /**
50
- * The class name added to the commit button.
51
- */
52
- const COMMIT_CLASS = 'jp-JSONEditor-commitButton';
53
- /**
54
- * The class name added to collapsed items.
55
- */
56
- const COLLAPSED_CLASS = 'jp-mod-collapsed';
57
- /**
58
- * A widget for editing observable JSON.
59
- */
60
- class JSONEditor extends widgets_1.Widget {
61
- /**
62
- * Construct a new JSON editor.
63
- */
64
- constructor(options) {
65
- super();
66
- this._dataDirty = false;
67
- this._inputDirty = false;
68
- this._source = null;
69
- this._originalValue = coreutils_1.JSONExt.emptyObject;
70
- this._changeGuard = false;
71
- this.addClass(JSONEDITOR_CLASS);
72
- ReactDOM.render(Private.createEditorContent(options), this.node);
73
- let host = this.editorHostNode;
74
- let model = new editor_1.CodeEditor.Model();
75
- model.value.text = 'No data!';
76
- model.mimeType = 'application/json';
77
- model.value.changed.connect(this._onValueChanged, this);
78
- this.model = model;
79
- this.editor = options.editorFactory({ host, model });
80
- this.editor.setOption('readOnly', true);
81
- this.collapsible = !!options.collapsible;
82
- }
83
- /**
84
- * The title of the editor.
85
- */
86
- get editorTitle() {
87
- return this.titleNode.textContent || '';
88
- }
89
- set editorTitle(value) {
90
- this.titleNode.textContent = value;
91
- }
92
- /**
93
- * Get the editor host node used by the JSON editor.
94
- */
95
- get editorHostNode() {
96
- return this.node.getElementsByClassName(HOST_CLASS)[0];
97
- }
98
- /**
99
- * Get the header node used by the JSON editor.
100
- */
101
- get headerNode() {
102
- return this.node.getElementsByClassName(HEADER_CLASS)[0];
103
- }
104
- /**
105
- * Get the title node used by the JSON editor.
106
- */
107
- get titleNode() {
108
- return this.node.getElementsByClassName(TITLE_CLASS)[0];
109
- }
110
- /**
111
- * Get the collapser node used by the JSON editor.
112
- */
113
- get collapserNode() {
114
- return this.node.getElementsByClassName(COLLAPSER_CLASS)[0];
115
- }
116
- /**
117
- * Get the revert button used by the JSON editor.
118
- */
119
- get revertButtonNode() {
120
- return this.node.getElementsByClassName(REVERT_CLASS)[0];
121
- }
122
- /**
123
- * Get the commit button used by the JSON editor.
124
- */
125
- get commitButtonNode() {
126
- return this.node.getElementsByClassName(COMMIT_CLASS)[0];
127
- }
128
- /**
129
- * The observable source.
130
- */
131
- get source() {
132
- return this._source;
133
- }
134
- set source(value) {
135
- if (this._source === value) {
136
- return;
137
- }
138
- if (this._source) {
139
- this._source.changed.disconnect(this._onSourceChanged, this);
140
- }
141
- this._source = value;
142
- this.editor.setOption('readOnly', value === null);
143
- if (value) {
144
- value.changed.connect(this._onSourceChanged, this);
145
- }
146
- this._setValue();
147
- }
148
- /**
149
- * Get whether the editor is dirty.
150
- */
151
- get isDirty() {
152
- return this._dataDirty || this._inputDirty;
153
- }
154
- /**
155
- * Handle the DOM events for the widget.
156
- *
157
- * @param event - The DOM event sent to the widget.
158
- *
159
- * #### Notes
160
- * This method implements the DOM `EventListener` interface and is
161
- * called in response to events on the notebook panel's node. It should
162
- * not be called directly by user code.
163
- */
164
- handleEvent(event) {
165
- switch (event.type) {
166
- case 'blur':
167
- this._evtBlur(event);
168
- break;
169
- case 'click':
170
- this._evtClick(event);
171
- break;
172
- default:
173
- break;
174
- }
175
- }
176
- /**
177
- * Handle `after-attach` messages for the widget.
178
- */
179
- onAfterAttach(msg) {
180
- let node = this.editorHostNode;
181
- node.addEventListener('blur', this, true);
182
- node.addEventListener('click', this, true);
183
- this.revertButtonNode.hidden = true;
184
- this.commitButtonNode.hidden = true;
185
- this.headerNode.addEventListener('click', this);
186
- if (this.isVisible) {
187
- this.update();
188
- }
189
- }
190
- /**
191
- * Handle `after-show` messages for the widget.
192
- */
193
- onAfterShow(msg) {
194
- this.update();
195
- }
196
- /**
197
- * Handle `update-request` messages for the widget.
198
- */
199
- onUpdateRequest(msg) {
200
- this.editor.refresh();
201
- }
202
- /**
203
- * Handle `before-detach` messages for the widget.
204
- */
205
- onBeforeDetach(msg) {
206
- let node = this.editorHostNode;
207
- node.removeEventListener('blur', this, true);
208
- node.removeEventListener('click', this, true);
209
- this.headerNode.removeEventListener('click', this);
210
- }
211
- /**
212
- * Handle a change to the metadata of the source.
213
- */
214
- _onSourceChanged(sender, args) {
215
- if (this._changeGuard) {
216
- return;
217
- }
218
- if (this._inputDirty || this.editor.hasFocus()) {
219
- this._dataDirty = true;
220
- return;
221
- }
222
- this._setValue();
223
- }
224
- /**
225
- * Handle change events.
226
- */
227
- _onValueChanged() {
228
- let valid = true;
229
- try {
230
- let value = JSON.parse(this.editor.model.value.text);
231
- this.removeClass(ERROR_CLASS);
232
- this._inputDirty =
233
- !this._changeGuard && !coreutils_1.JSONExt.deepEqual(value, this._originalValue);
234
- }
235
- catch (err) {
236
- this.addClass(ERROR_CLASS);
237
- this._inputDirty = true;
238
- valid = false;
239
- }
240
- this.revertButtonNode.hidden = !this._inputDirty;
241
- this.commitButtonNode.hidden = !valid || !this._inputDirty;
242
- }
243
- /**
244
- * Handle blur events for the text area.
245
- */
246
- _evtBlur(event) {
247
- // Update the metadata if necessary.
248
- if (!this._inputDirty && this._dataDirty) {
249
- this._setValue();
250
- }
251
- }
252
- /**
253
- * Handle click events for the buttons.
254
- */
255
- _evtClick(event) {
256
- let target = event.target;
257
- switch (target) {
258
- case this.revertButtonNode:
259
- this._setValue();
260
- break;
261
- case this.commitButtonNode:
262
- if (!this.commitButtonNode.hidden && !this.hasClass(ERROR_CLASS)) {
263
- this._changeGuard = true;
264
- this._mergeContent();
265
- this._changeGuard = false;
266
- this._setValue();
267
- }
268
- break;
269
- case this.titleNode:
270
- case this.collapserNode:
271
- if (this.collapsible) {
272
- let collapser = this.collapserNode;
273
- if (collapser.classList.contains(COLLAPSED_CLASS)) {
274
- collapser.classList.remove(COLLAPSED_CLASS);
275
- this.editorHostNode.classList.remove(COLLAPSED_CLASS);
276
- }
277
- else {
278
- collapser.classList.add(COLLAPSED_CLASS);
279
- this.editorHostNode.classList.add(COLLAPSED_CLASS);
280
- }
281
- }
282
- break;
283
- case this.editorHostNode:
284
- this.editor.focus();
285
- break;
286
- default:
287
- break;
288
- }
289
- }
290
- /**
291
- * Merge the user content.
292
- */
293
- _mergeContent() {
294
- let model = this.editor.model;
295
- let current = this._source ? this._source.toJSON() : {};
296
- let old = this._originalValue;
297
- let user = JSON.parse(model.value.text);
298
- let source = this.source;
299
- if (!source) {
300
- return;
301
- }
302
- // If it is in user and has changed from old, set in current.
303
- for (let key in user) {
304
- if (!coreutils_1.JSONExt.deepEqual(user[key], old[key] || null)) {
305
- current[key] = user[key];
306
- }
307
- }
308
- // If it was in old and is not in user, remove from current.
309
- for (let key in old) {
310
- if (!(key in user)) {
311
- delete current[key];
312
- source.delete(key);
313
- }
314
- }
315
- // Set the values.
316
- for (let key in current) {
317
- source.set(key, current[key]);
318
- }
319
- }
320
- /**
321
- * Set the value given the owner contents.
322
- */
323
- _setValue() {
324
- this._dataDirty = false;
325
- this._inputDirty = false;
326
- this.revertButtonNode.hidden = true;
327
- this.commitButtonNode.hidden = true;
328
- this.removeClass(ERROR_CLASS);
329
- let model = this.editor.model;
330
- let content = this._source ? this._source.toJSON() : {};
331
- this._changeGuard = true;
332
- if (content === void 0) {
333
- model.value.text = 'No data!';
334
- this._originalValue = coreutils_1.JSONExt.emptyObject;
335
- }
336
- else {
337
- let value = JSON.stringify(content, null, 4);
338
- model.value.text = value;
339
- this._originalValue = content;
340
- // Move the cursor to within the brace.
341
- if (value.length > 1 && value[0] === '{') {
342
- this.editor.setCursorPosition({ line: 0, column: 1 });
343
- }
344
- }
345
- this.editor.refresh();
346
- this._changeGuard = false;
347
- this.commitButtonNode.hidden = true;
348
- this.revertButtonNode.hidden = true;
349
- }
350
- }
351
- exports.JSONEditor = JSONEditor;
352
- /**
353
- * The namespace for module private data.
354
- */
355
- var Private;
356
- (function (Private) {
357
- /**
358
- * Create the JSON Editor node's content.
359
- */
360
- function createEditorContent(options) {
361
- const revertTitle = 'Revert changes to data';
362
- const confirmTitle = 'Commit changes to data';
363
- const title = options.title || '';
364
- const collapseClass = options.collapsible
365
- ? `${COLLAPSER_CLASS} ${COLLAPSE_ENABLED_CLASS}`
366
- : COLLAPSER_CLASS;
367
- return (React.createElement(React.Fragment, null,
368
- React.createElement("div", { className: HEADER_CLASS },
369
- React.createElement("span", { className: TITLE_CLASS }, title),
370
- React.createElement("span", { className: collapseClass }),
371
- React.createElement("span", { className: REVERT_CLASS, title: revertTitle }),
372
- React.createElement("span", { className: COMMIT_CLASS, title: confirmTitle })),
373
- React.createElement("div", { className: HOST_CLASS })));
374
- }
375
- Private.createEditorContent = createEditorContent;
376
- })(Private || (Private = {}));
1
+ "use strict";
2
+ // Copyright (c) Jupyter Development Team.
3
+ // Distributed under the terms of the Modified BSD License.
4
+ var __importStar = (this && this.__importStar) || function (mod) {
5
+ if (mod && mod.__esModule) return mod;
6
+ var result = {};
7
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
8
+ result["default"] = mod;
9
+ return result;
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const coreutils_1 = require("@phosphor/coreutils");
13
+ const widgets_1 = require("@phosphor/widgets");
14
+ const React = __importStar(require("react"));
15
+ const ReactDOM = __importStar(require("react-dom"));
16
+ const editor_1 = require("./editor");
17
+ /**
18
+ * The class name added to a JSONEditor instance.
19
+ */
20
+ const JSONEDITOR_CLASS = 'jp-JSONEditor';
21
+ /**
22
+ * The class name added when the Metadata editor contains invalid JSON.
23
+ */
24
+ const ERROR_CLASS = 'jp-mod-error';
25
+ /**
26
+ * The class name added to the editor host node.
27
+ */
28
+ const HOST_CLASS = 'jp-JSONEditor-host';
29
+ /**
30
+ * The class name added to the header area.
31
+ */
32
+ const HEADER_CLASS = 'jp-JSONEditor-header';
33
+ /**
34
+ * The class name added to the title node.
35
+ */
36
+ const TITLE_CLASS = 'jp-JSONEditor-title';
37
+ /**
38
+ * The class name added to the collapser node.
39
+ */
40
+ const COLLAPSER_CLASS = 'jp-JSONEditor-collapser';
41
+ /**
42
+ * The class name added to the collapser node that is enabled.
43
+ */
44
+ const COLLAPSE_ENABLED_CLASS = 'jp-mod-collapse-enabled';
45
+ /**
46
+ * The class name added to the revert button.
47
+ */
48
+ const REVERT_CLASS = 'jp-JSONEditor-revertButton';
49
+ /**
50
+ * The class name added to the commit button.
51
+ */
52
+ const COMMIT_CLASS = 'jp-JSONEditor-commitButton';
53
+ /**
54
+ * The class name added to collapsed items.
55
+ */
56
+ const COLLAPSED_CLASS = 'jp-mod-collapsed';
57
+ /**
58
+ * A widget for editing observable JSON.
59
+ */
60
+ class JSONEditor extends widgets_1.Widget {
61
+ /**
62
+ * Construct a new JSON editor.
63
+ */
64
+ constructor(options) {
65
+ super();
66
+ this._dataDirty = false;
67
+ this._inputDirty = false;
68
+ this._source = null;
69
+ this._originalValue = coreutils_1.JSONExt.emptyObject;
70
+ this._changeGuard = false;
71
+ this.addClass(JSONEDITOR_CLASS);
72
+ ReactDOM.render(Private.createEditorContent(options), this.node);
73
+ let host = this.editorHostNode;
74
+ let model = new editor_1.CodeEditor.Model();
75
+ model.value.text = 'No data!';
76
+ model.mimeType = 'application/json';
77
+ model.value.changed.connect(this._onValueChanged, this);
78
+ this.model = model;
79
+ this.editor = options.editorFactory({ host, model });
80
+ this.editor.setOption('readOnly', true);
81
+ this.collapsible = !!options.collapsible;
82
+ }
83
+ /**
84
+ * The title of the editor.
85
+ */
86
+ get editorTitle() {
87
+ return this.titleNode.textContent || '';
88
+ }
89
+ set editorTitle(value) {
90
+ this.titleNode.textContent = value;
91
+ }
92
+ /**
93
+ * Get the editor host node used by the JSON editor.
94
+ */
95
+ get editorHostNode() {
96
+ return this.node.getElementsByClassName(HOST_CLASS)[0];
97
+ }
98
+ /**
99
+ * Get the header node used by the JSON editor.
100
+ */
101
+ get headerNode() {
102
+ return this.node.getElementsByClassName(HEADER_CLASS)[0];
103
+ }
104
+ /**
105
+ * Get the title node used by the JSON editor.
106
+ */
107
+ get titleNode() {
108
+ return this.node.getElementsByClassName(TITLE_CLASS)[0];
109
+ }
110
+ /**
111
+ * Get the collapser node used by the JSON editor.
112
+ */
113
+ get collapserNode() {
114
+ return this.node.getElementsByClassName(COLLAPSER_CLASS)[0];
115
+ }
116
+ /**
117
+ * Get the revert button used by the JSON editor.
118
+ */
119
+ get revertButtonNode() {
120
+ return this.node.getElementsByClassName(REVERT_CLASS)[0];
121
+ }
122
+ /**
123
+ * Get the commit button used by the JSON editor.
124
+ */
125
+ get commitButtonNode() {
126
+ return this.node.getElementsByClassName(COMMIT_CLASS)[0];
127
+ }
128
+ /**
129
+ * The observable source.
130
+ */
131
+ get source() {
132
+ return this._source;
133
+ }
134
+ set source(value) {
135
+ if (this._source === value) {
136
+ return;
137
+ }
138
+ if (this._source) {
139
+ this._source.changed.disconnect(this._onSourceChanged, this);
140
+ }
141
+ this._source = value;
142
+ this.editor.setOption('readOnly', value === null);
143
+ if (value) {
144
+ value.changed.connect(this._onSourceChanged, this);
145
+ }
146
+ this._setValue();
147
+ }
148
+ /**
149
+ * Get whether the editor is dirty.
150
+ */
151
+ get isDirty() {
152
+ return this._dataDirty || this._inputDirty;
153
+ }
154
+ /**
155
+ * Handle the DOM events for the widget.
156
+ *
157
+ * @param event - The DOM event sent to the widget.
158
+ *
159
+ * #### Notes
160
+ * This method implements the DOM `EventListener` interface and is
161
+ * called in response to events on the notebook panel's node. It should
162
+ * not be called directly by user code.
163
+ */
164
+ handleEvent(event) {
165
+ switch (event.type) {
166
+ case 'blur':
167
+ this._evtBlur(event);
168
+ break;
169
+ case 'click':
170
+ this._evtClick(event);
171
+ break;
172
+ default:
173
+ break;
174
+ }
175
+ }
176
+ /**
177
+ * Handle `after-attach` messages for the widget.
178
+ */
179
+ onAfterAttach(msg) {
180
+ let node = this.editorHostNode;
181
+ node.addEventListener('blur', this, true);
182
+ node.addEventListener('click', this, true);
183
+ this.revertButtonNode.hidden = true;
184
+ this.commitButtonNode.hidden = true;
185
+ this.headerNode.addEventListener('click', this);
186
+ if (this.isVisible) {
187
+ this.update();
188
+ }
189
+ }
190
+ /**
191
+ * Handle `after-show` messages for the widget.
192
+ */
193
+ onAfterShow(msg) {
194
+ this.update();
195
+ }
196
+ /**
197
+ * Handle `update-request` messages for the widget.
198
+ */
199
+ onUpdateRequest(msg) {
200
+ this.editor.refresh();
201
+ }
202
+ /**
203
+ * Handle `before-detach` messages for the widget.
204
+ */
205
+ onBeforeDetach(msg) {
206
+ let node = this.editorHostNode;
207
+ node.removeEventListener('blur', this, true);
208
+ node.removeEventListener('click', this, true);
209
+ this.headerNode.removeEventListener('click', this);
210
+ }
211
+ /**
212
+ * Handle a change to the metadata of the source.
213
+ */
214
+ _onSourceChanged(sender, args) {
215
+ if (this._changeGuard) {
216
+ return;
217
+ }
218
+ if (this._inputDirty || this.editor.hasFocus()) {
219
+ this._dataDirty = true;
220
+ return;
221
+ }
222
+ this._setValue();
223
+ }
224
+ /**
225
+ * Handle change events.
226
+ */
227
+ _onValueChanged() {
228
+ let valid = true;
229
+ try {
230
+ let value = JSON.parse(this.editor.model.value.text);
231
+ this.removeClass(ERROR_CLASS);
232
+ this._inputDirty =
233
+ !this._changeGuard && !coreutils_1.JSONExt.deepEqual(value, this._originalValue);
234
+ }
235
+ catch (err) {
236
+ this.addClass(ERROR_CLASS);
237
+ this._inputDirty = true;
238
+ valid = false;
239
+ }
240
+ this.revertButtonNode.hidden = !this._inputDirty;
241
+ this.commitButtonNode.hidden = !valid || !this._inputDirty;
242
+ }
243
+ /**
244
+ * Handle blur events for the text area.
245
+ */
246
+ _evtBlur(event) {
247
+ // Update the metadata if necessary.
248
+ if (!this._inputDirty && this._dataDirty) {
249
+ this._setValue();
250
+ }
251
+ }
252
+ /**
253
+ * Handle click events for the buttons.
254
+ */
255
+ _evtClick(event) {
256
+ let target = event.target;
257
+ switch (target) {
258
+ case this.revertButtonNode:
259
+ this._setValue();
260
+ break;
261
+ case this.commitButtonNode:
262
+ if (!this.commitButtonNode.hidden && !this.hasClass(ERROR_CLASS)) {
263
+ this._changeGuard = true;
264
+ this._mergeContent();
265
+ this._changeGuard = false;
266
+ this._setValue();
267
+ }
268
+ break;
269
+ case this.titleNode:
270
+ case this.collapserNode:
271
+ if (this.collapsible) {
272
+ let collapser = this.collapserNode;
273
+ if (collapser.classList.contains(COLLAPSED_CLASS)) {
274
+ collapser.classList.remove(COLLAPSED_CLASS);
275
+ this.editorHostNode.classList.remove(COLLAPSED_CLASS);
276
+ }
277
+ else {
278
+ collapser.classList.add(COLLAPSED_CLASS);
279
+ this.editorHostNode.classList.add(COLLAPSED_CLASS);
280
+ }
281
+ }
282
+ break;
283
+ case this.editorHostNode:
284
+ this.editor.focus();
285
+ break;
286
+ default:
287
+ break;
288
+ }
289
+ }
290
+ /**
291
+ * Merge the user content.
292
+ */
293
+ _mergeContent() {
294
+ let model = this.editor.model;
295
+ let current = this._source ? this._source.toJSON() : {};
296
+ let old = this._originalValue;
297
+ let user = JSON.parse(model.value.text);
298
+ let source = this.source;
299
+ if (!source) {
300
+ return;
301
+ }
302
+ // If it is in user and has changed from old, set in current.
303
+ for (let key in user) {
304
+ if (!coreutils_1.JSONExt.deepEqual(user[key], old[key] || null)) {
305
+ current[key] = user[key];
306
+ }
307
+ }
308
+ // If it was in old and is not in user, remove from current.
309
+ for (let key in old) {
310
+ if (!(key in user)) {
311
+ delete current[key];
312
+ source.delete(key);
313
+ }
314
+ }
315
+ // Set the values.
316
+ for (let key in current) {
317
+ source.set(key, current[key]);
318
+ }
319
+ }
320
+ /**
321
+ * Set the value given the owner contents.
322
+ */
323
+ _setValue() {
324
+ this._dataDirty = false;
325
+ this._inputDirty = false;
326
+ this.revertButtonNode.hidden = true;
327
+ this.commitButtonNode.hidden = true;
328
+ this.removeClass(ERROR_CLASS);
329
+ let model = this.editor.model;
330
+ let content = this._source ? this._source.toJSON() : {};
331
+ this._changeGuard = true;
332
+ if (content === void 0) {
333
+ model.value.text = 'No data!';
334
+ this._originalValue = coreutils_1.JSONExt.emptyObject;
335
+ }
336
+ else {
337
+ let value = JSON.stringify(content, null, 4);
338
+ model.value.text = value;
339
+ this._originalValue = content;
340
+ // Move the cursor to within the brace.
341
+ if (value.length > 1 && value[0] === '{') {
342
+ this.editor.setCursorPosition({ line: 0, column: 1 });
343
+ }
344
+ }
345
+ this.editor.refresh();
346
+ this._changeGuard = false;
347
+ this.commitButtonNode.hidden = true;
348
+ this.revertButtonNode.hidden = true;
349
+ }
350
+ }
351
+ exports.JSONEditor = JSONEditor;
352
+ /**
353
+ * The namespace for module private data.
354
+ */
355
+ var Private;
356
+ (function (Private) {
357
+ /**
358
+ * Create the JSON Editor node's content.
359
+ */
360
+ function createEditorContent(options) {
361
+ const revertTitle = 'Revert changes to data';
362
+ const confirmTitle = 'Commit changes to data';
363
+ const title = options.title || '';
364
+ const collapseClass = options.collapsible
365
+ ? `${COLLAPSER_CLASS} ${COLLAPSE_ENABLED_CLASS}`
366
+ : COLLAPSER_CLASS;
367
+ return (React.createElement(React.Fragment, null,
368
+ React.createElement("div", { className: HEADER_CLASS },
369
+ React.createElement("span", { className: TITLE_CLASS }, title),
370
+ React.createElement("span", { className: collapseClass }),
371
+ React.createElement("span", { className: REVERT_CLASS, title: revertTitle }),
372
+ React.createElement("span", { className: COMMIT_CLASS, title: confirmTitle })),
373
+ React.createElement("div", { className: HOST_CLASS })));
374
+ }
375
+ Private.createEditorContent = createEditorContent;
376
+ })(Private || (Private = {}));